aboutsummaryrefslogtreecommitdiff
path: root/Neutron-trunk/cms-special/gallery/preview
diff options
context:
space:
mode:
Diffstat (limited to 'Neutron-trunk/cms-special/gallery/preview')
-rw-r--r--Neutron-trunk/cms-special/gallery/preview/index.php129
1 files changed, 129 insertions, 0 deletions
diff --git a/Neutron-trunk/cms-special/gallery/preview/index.php b/Neutron-trunk/cms-special/gallery/preview/index.php
new file mode 100644
index 0000000..e033cc0
--- /dev/null
+++ b/Neutron-trunk/cms-special/gallery/preview/index.php
@@ -0,0 +1,129 @@
+<?php require_once "../../../resources/private/relative.php"; getRelativeDetails("cms-special"); ?>
+<?php
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/api/lang/processor.php";
+
+if (isset($_GET['return'])) {
+ $callback = $_GET['return'];
+}
+
+?>
+<!DOCTYPE html>
+<html lang="en" style="height:100%;overflow:hidden;">
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <meta http-equiv="X-UA-Compatible" content="ie=edge">
+ <link rel="stylesheet" href="<?= $GLOBALS['SYSTEM_ROOT'] ?>/resources/css/preview.css">
+ <script src="<?= $GLOBALS['SYSTEM_ROOT'] ?>/resources/js/jquery.js"></script>
+ <title><?= $lang["gallery"]["preview"]['title'] ?></title>
+</head>
+<?php
+
+ if (isset($_GET['url'])) {
+ if (strpos($_GET['url'], '..') !== false) {
+ require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["gallery"]["preview"]['invalid']);
+ } else {
+ if (file_exists($GLOBALS['ORIGINAL_DOCUMENT_ROOT'] . "/" . $_GET['url'])) {
+ $ext1 = explode(".", $_GET['url']);
+ $ext2 = end($ext1);
+ $ext = strtoupper($ext2);
+ } else {
+ require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["gallery"]["preview"]['notfound']);
+ }
+ }
+ } else {
+ require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit($lang["gallery"]["preview"]['none']);
+ }
+
+?>
+<body style="background-size:contain;background-position:center;height: 100%;margin: 0;background-repeat: no-repeat;background-color: #222;">
+ <div class="container">
+ <img class="image" id="scroll" src="<?= $_GET['url'] ?>" draggable="false" onmouseup="clearTimeout(mdt);--mousedown;" onclick="return false;">
+ <script>
+ document.getElementsByClassName('image')[0].style.transform = "scale(1)";
+ </script>
+ </div>
+ <?php if (isset($callback)): ?><a class="close" title="<?= $lang["gallery"]["preview"]['close'] ?>"><img class="icon" src="<?= $GLOBALS['SYSTEM_ROOT'] ?>/resources/image/close.svg" onclick="location.href = &quot;<?= $callback ?>&quot;"></a><?php endif ?>
+ <a class="download" href="<?= $_GET['url'] ?>" title="<?= $lang["gallery"]["preview"]['placeholder'][0] ?> <?= $ext ?> <?= $lang["gallery"]["preview"]['placeholder'][1] ?>" download><?= $lang["gallery"]["preview"]['download'] ?> (<?= $ext ?>)</a>
+ <span class="zoom">
+ <a class="zoomin" onclick="zoomin();"></a>
+ <a class="zoomout" onclick="zoomout();"></a>
+ </span>
+</body>
+<script>
+
+function zoomin() {
+ tf = document.getElementsByClassName("image")[0].style.transform.split("(")[1].split(")")[0] - 1 + 1;
+ if (tf < 8) {
+ tf++;
+ document.getElementsByClassName('image')[0].style.transform = `scale(${tf})`;
+ document.getElementsByClassName('image')[0].style['margin-top'] = (((1055 / 6) * (window.innerHeight / 480)) * tf) + 'px';
+ document.getElementsByClassName('image')[0].style['margin-left'] = (((1055 / 6) * (window.innerWidth / 480)) * tf) + 'px';
+ }
+}
+
+function zoomout() {
+ tf = document.getElementsByClassName("image")[0].style.transform.split("(")[1].split(")")[0] - 1 + 1;
+ if (tf > 1) {
+ tf--;
+ if (tf > 1) {
+ document.getElementsByClassName('image')[0].style.transform = `scale(${tf})`;
+ document.getElementsByClassName('image')[0].style['margin-top'] = (((1055 / 6) * (window.innerHeight / 480)) * tf) + 'px';
+ document.getElementsByClassName('image')[0].style['margin-left'] = (((1055 / 6) * (window.innerWidth / 480)) * tf) + 'px';
+ } else {
+ document.getElementsByClassName('image')[0].style.transform = `scale(${tf})`;
+ document.getElementsByClassName('image')[0].style['margin-top'] = (((1055 / 6) / 422) * tf) + 'px';
+ document.getElementsByClassName('image')[0].style['margin-left'] = (((1055 / 6) / 422) * tf) + 'px';
+ }
+ }
+}
+
+window.onload = () => {setTimeout(() => {Array.from(document.getElementsByClassName('ppreview')).forEach((el) => {el.classList.add('loaded')});}, 1000)}
+
+(function($) {
+ $.dragScroll = function(options) {
+ var settings = $.extend({
+ scrollVertical: true,
+ scrollHorizontal: true,
+ cursor: null
+ }, options);
+
+ var clicked = false,
+ clickY, clickX;
+
+ var getCursor = function() {
+ if (settings.cursor) return settings.cursor;
+ if (settings.scrollVertical && settings.scrollHorizontal) return 'move';
+ if (settings.scrollVertical) return 'row-resize';
+ if (settings.scrollHorizontal) return 'col-resize';
+ }
+
+ var updateScrollPos = function(e, el) {
+ $('html').css('cursor', getCursor());
+ var $el = $(el);
+ settings.scrollVertical && $el.scrollTop($el.scrollTop() + (clickY - e.pageY));
+ settings.scrollHorizontal && $el.scrollLeft($el.scrollLeft() + (clickX - e.pageX));
+ }
+
+ $(document).on({
+ 'mousemove': function(e) {
+ clicked && updateScrollPos(e, this);
+ },
+ 'mousedown': function(e) {
+ clicked = true;
+ clickY = e.pageY;
+ clickX = e.pageX;
+ },
+ 'mouseup': function() {
+ clicked = false;
+ $('html').css('cursor', 'auto');
+ }
+ });
+ }
+}(jQuery))
+
+$.dragScroll();
+
+</script>
+</html> \ No newline at end of file