From e82b9ea81168632167978dc48f9ebaaf820c82ef Mon Sep 17 00:00:00 2001 From: Matthew Barbour Date: Tue, 12 Jan 2021 19:38:22 -0600 Subject: [PATCH] Added post peek extension --- core/basethemelet.php | 2 +- ext/handle_pixel/theme.php | 2 +- ext/post_peek/info.php | 12 +++ ext/post_peek/main.php | 5 ++ ext/post_peek/script.js | 167 +++++++++++++++++++++++++++++++++++++ ext/post_peek/theme.php | 5 ++ 6 files changed, 191 insertions(+), 2 deletions(-) create mode 100644 ext/post_peek/info.php create mode 100644 ext/post_peek/main.php create mode 100644 ext/post_peek/script.js create mode 100644 ext/post_peek/theme.php diff --git a/core/basethemelet.php b/core/basethemelet.php index 39aadcd5..3f2e2598 100644 --- a/core/basethemelet.php +++ b/core/basethemelet.php @@ -72,7 +72,7 @@ class BaseThemelet } } - return "". + return "". "$h_tip". "\n"; } diff --git a/ext/handle_pixel/theme.php b/ext/handle_pixel/theme.php index 485b6b5a..10dc2c24 100644 --- a/ext/handle_pixel/theme.php +++ b/ext/handle_pixel/theme.php @@ -30,7 +30,7 @@ class PixelFileHandlerTheme extends Themelet } $html = "main image"; + "data-width='{$image->width}' data-height='{$image->height} data-mime='{$image->get_mime()}'>"; $page->add_block(new Block("Image", $html, "main", 10)); } } diff --git a/ext/post_peek/info.php b/ext/post_peek/info.php new file mode 100644 index 00000000..a6072544 --- /dev/null +++ b/ext/post_peek/info.php @@ -0,0 +1,12 @@ +candidateSize) { + candidateSize = newCandidateSize; + candidate = newCandidate; + } + } + + peekerElement.style.left = candidate[0]; + peekerElement.style.right = candidate[1]; + peekerElement.style.top =candidate[2]; + peekerElement.style.bottom = candidate[3]; + + peekerElement.style.width = candidate[4][0] + "px"; + peekerElement.style.height = candidate[4][1] + "px"; + + + peekerElement.appendChild(imgElement); + + if(!peekerOpen) { + document.body.appendChild(peekerElement); + } + + peekerOpen = true; + } + linkElement.onmouseleave = function (e) { + if(peekerOpen) { + document.body.removeChild(peekerElement); + peekerOpen = false; + } + } + + parent.appendChild(linkElement); + + + // + // var offsetX = (item.offsetWidth - newWidth)/2; + // var offsetY = (item.offsetHeight - newHeight)/2; + // + // var scaleX = newWidth / frameWidth; + // var scaleY = newHeight / frameHeight; + // var scale = scaleX; + // if(scaleY
" + inWidth + ":" + inHeight + "
"); + // $(parent).append(frame); + } + }); +} + + +document.addEventListener('DOMContentLoaded', () => { + postPeekAddPeeker(); +}); diff --git a/ext/post_peek/theme.php b/ext/post_peek/theme.php new file mode 100644 index 00000000..79efa1af --- /dev/null +++ b/ext/post_peek/theme.php @@ -0,0 +1,5 @@ +