PluginProbe
Meow Gallery / 4.3.0
Meow Gallery v4.3.0
5.5.5 5.5.4 5.5.3 5.5.2 5.5.1 5.5.0 5.4.9 5.4.8 5.4.7 4.1.5 4.1.6 4.1.7 4.1.8 4.1.9 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4 4.2.5 4.2.6 4.2.7 4.2.8 4.2.9 4.3.0 All 157 releases
meow-gallery / app / galleries.js

galleries.js in Meow Gallery 4.3.0, at app/galleries.js

1 lines 9.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (()=>{var o={415:()=>{window.addEventListener("load",(function(){document.querySelector(".mgl-gallery.mgl-horizontal")&&document.querySelectorAll(".mgl-gallery.mgl-horizontal").forEach((function(o){var t=o.querySelector(".meow-horizontal-track");Settings.right_click&&o.addEventListener("contextmenu",(function(o){o.preventDefault()})),o.addEventListener("wheel",(function(o){o.preventDefault(),t.scrollLeft+=o.deltaY}));var e=0,i=0,n=!1,r=!1;o.addEventListener("mousedown",(function(o){o.preventDefault(),i=t.scrollLeft,e=o.screenX,n=!0})),o.addEventListener("mousemove",(function(o){var a=e-o.screenX;n&&(Math.abs(a)>5&&!r?(r=!0,t.querySelectorAll("img").forEach((function(o){o.classList.remove("mwl-img"),o.classList.add("mwl-img-disabled")}))):r=!1,r&&(t.scrollLeft=i+a))})),o.addEventListener("mouseout",(function(){n&&(n=!1,r=!1,t.querySelectorAll("img").forEach((function(o){o.classList.add("mwl-img"),o.classList.remove("mwl-img-disabled")})))}),!1),o.addEventListener("mouseup",(function(){n=!1,r=!1,setTimeout((function(){t.querySelectorAll("img").forEach((function(o){o.classList.add("mwl-img"),o.classList.remove("mwl-img-disabled")}))}))}))}))}))},849:(o,t,e)=>{"use strict";var i;e.d(t,{Z:()=>n});const n={right_click:"undefined"!=typeof mgl_settings&&(null===(i=mgl_settings)||void 0===i?void 0:i.disable_right_click)}},958:(o,t,e)=>{"use strict";e.r(t);const i={o:{box:"a",orientation:"landscape"},i:{box:"a",orientation:"portrait"},oo:{box:"a",orientation:"landscape"},ii:{box:"a",orientation:"portrait"},oi:{box:"a",orientation:"landscape"},io:{box:"a",orientation:"portrait"},ooo:{box:"c",orientation:"landscape"},ioo:{box:"b",orientation:"landscape"},oio:{box:"a",orientation:"landscape"},ooi:{box:"a",orientation:"landscape"},oii:{box:"a",orientation:"landscape"},ioi:{box:"b",orientation:"landscape"},iio:{box:"c",orientation:"landscape"},iii:{box:"a",orientation:"portrait"},"oooo-v0":{box:"c",orientation:"landscape"},"oooo-v1":{box:"a",orientation:"landscape"},"oooo-v2":{box:"a",orientation:"landscape"},oioo:{box:"a",orientation:"landscape"},iooo:{box:"d",orientation:"landscape"},ooio:{box:"d",orientation:"landscape"},oooi:{box:"a",orientation:"landscape"},iiii:{box:"a",orientation:"portrait"},aoooo:{box:"a",orientation:"portrait"},ioooo:{box:"a",orientation:"portrait"},ooioo:{box:"c",orientation:"portrait"},ooooi:{box:"e",orientation:"portrait"},iiooo:{box:"a",orientation:"portrait"},iooio:{box:"a",orientation:"portrait"},ooiio:{box:"e",orientation:"landscape"},ooioi:{box:"c",orientation:"portrait"},oooii:{box:"d",orientation:"portrait"},oiioo:{box:"b",orientation:"portrait"},oiooi:{box:"b",orientation:"portrait"},iiioo:{box:"a",orientation:"portrait"},iiooi:{box:"a",orientation:"portrait"},iooii:{box:"a",orientation:"portrait"},ooiii:{box:"c",orientation:"portrait"}};function n(o){return function(o){if(Array.isArray(o))return a(o)}(o)||function(o){if("undefined"!=typeof Symbol&&null!=o[Symbol.iterator]||null!=o["@@iterator"])return Array.from(o)}(o)||r(o)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(o,t){if(o){if("string"==typeof o)return a(o,t);var e=Object.prototype.toString.call(o).slice(8,-1);return"Object"===e&&o.constructor&&(e=o.constructor.name),"Map"===e||"Set"===e?Array.from(o):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?a(o,t):void 0}}function a(o,t){(null==t||t>o.length)&&(t=o.length);for(var e=0,i=new Array(t);e<t;e++)i[e]=o[e];return i}function s(o,t){for(var e=0;e<t.length;e++){var i=t[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(o,i.key,i)}}var l="three-two",c=function(){function o(t){!function(o,t){if(!(o instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),this.gallery=t.gallery,this.galleryItems=[],this.rowClasses=[],this.rows=[],this.ooooLayoutVariant=0,this.density="high",this.currentDevice="desktop",this.options={density:t.density}}var t,e;return t=o,(e=[{key:"getCurrentDevice",value:function(){var o=window.innerWidth;return o<=460?"mobile":o<=768?"tablet":"desktop"}},{key:"setDensity",value:function(){this.density=this.options.density[this.currentDevice]}},{key:"getAvailableRowClasses",value:function(){switch(this.density){case"high":this.rowClasses=["o","i","oo","ii","oi","io","ooo","oii","ooi","ioo","oio","ioi","iio","iii","iooo","oioo","ooio","oooi","iiii","oooo","ioooo","ooioo","ooooi","iiooo","iooio","ooiio","ooioi","oooii","oiioo","oiooi","iiioo","iiooi","iooii","ooiii"];break;case"medium":this.rowClasses=["o","i","oo","ii","oi","io","ooo","oii","ooi","ioo","oio","ioi","iio","iii"];break;case"low":this.rowClasses=["o","i","oo","ii","oi","io"]}}},{key:"createGalleryItemsArray",value:function(){var o=this;this.gallery.querySelectorAll(".mgl-item").forEach((function(t){var e,i=parseInt(t.getAttribute("data-mgl-width")),n=parseInt(t.getAttribute("data-mgl-height"));e=i>=n?"o":"i",o.galleryItems.push({id:parseInt(t.getAttribute("data-mgl-id")),width:i,height:n,orientation:e,markup:t.outerHTML})}))}},{key:"calculateGalleryRows",value:function(){var o=n(this.galleryItems);this.rows=[];for(var t="";o.length>0;){var e=o.shift(),i=t+e.orientation;this.rowClasses.includes(i)?t=i:(this.rows.push(t),t=e.orientation),0===o.length&&this.rows.push(t)}this.avoidLoneLastItems()}},{key:"avoidLoneLastItems",value:function(){if(this.rows.length>=2){var o=this.rows[this.rows.length-1].split(""),t=this.rows[this.rows.length-2].split("");if(1===o.length&&t.length>2){var e=t.pop();o.unshift(e)}this.rows[this.rows.length-2]=t.join(""),this.rows[this.rows.length-1]=o.join("")}}},{key:"getLetterFromIndex",value:function(o){switch(o){case 0:return"a";case 1:return"b";case 2:return"c";case 3:return"d";case 4:return"e"}}},{key:"getRowLayout",value:function(o){var t="";return"oooo"===o?(3===this.ooooLayoutVariant&&(this.ooooLayoutVariant=0),0===this.ooooLayoutVariant?t+="".concat(o,"-v0"):t+="".concat(o,"-v").concat(this.ooooLayoutVariant),this.ooooLayoutVariant++):t+=o,t}},{key:"getRowClass",value:function(o){return"mgl-layout-".concat(o.length,"-").concat(this.getRowLayout(o))}},{key:"getRowMarkup",value:function(o,t){for(var e=this.getRowLayout(o),i='<div class="mgl-row mgl-layout-'.concat(o.length,"-").concat(e,'" data-row-layout="').concat(e,'">'),n=0,r=0;r<o.length;r++){var a='<div class="mgl-box '.concat(this.getLetterFromIndex(n),'">');a+=t.shift().markup,i+=a+="</div>",n++}return i+"</div>"}},{key:"writeMarkup",value:function(o){var t,e=n(this.galleryItems),i="",a=function(o,t){var e="undefined"!=typeof Symbol&&o[Symbol.iterator]||o["@@iterator"];if(!e){if(Array.isArray(o)||(e=r(o))){e&&(o=e);var i=0,n=function(){};return{s:n,n:function(){return i>=o.length?{done:!0}:{done:!1,value:o[i++]}},e:function(o){throw o},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,l=!1;return{s:function(){e=e.call(o)},n:function(){var o=e.next();return s=o.done,o},e:function(o){l=!0,a=o},f:function(){try{s||null==e.return||e.return()}finally{if(l)throw a}}}}(n(this.rows));try{for(a.s();!(t=a.n()).done;){var s=t.value,l=e.splice(0,s.length);i+=this.getRowMarkup(s,l)}}catch(o){a.e(o)}finally{a.f()}this.gallery.innerHTML=i,o()}},{key:"getHeightByWidth",value:function(o,t,e){if("landscape"==e)switch(o){case"three-two":return 2*t/3;case"five-four":return 4*t/5}else switch(o){case"three-two":return 3*t/2;case"five-four":return 5*t/4}}},{key:"setRowsHeight",value:function(){var o=this;this.gallery.querySelectorAll(".mgl-row").forEach((function(t){var e=t.getAttribute("data-row-layout"),n=i[e],r=t.querySelector(".mgl-box.".concat(n.box));0===o.getHeightByWidth(l,r.offsetWidth,n.orientation)?setTimeout((function(){t.style.height=o.getHeightByWidth(l,r.offsetWidth,n.orientation)+"px"}),750):t.style.height=o.getHeightByWidth(l,r.offsetWidth,n.orientation)+"px"}))}},{key:"init",value:function(o){this.currentDevice=this.getCurrentDevice(),this.setDensity(),this.getAvailableRowClasses(),this.createGalleryItemsArray(),this.calculateGalleryRows(),this.writeMarkup(o)}},{key:"tilify",value:function(o){this.currentDevice!==this.getCurrentDevice()&&(this.currentDevice=this.getCurrentDevice(),this.ooooLayoutVariant=0,this.setDensity(),this.getAvailableRowClasses(),this.calculateGalleryRows(),this.writeMarkup(o))}}])&&s(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),o}();e(849);const u=function(){document.querySelectorAll(".mgl-tiles").forEach((function(o){var t,e,i=new c({gallery:o,density:null===(t=mgl_settings)||void 0===t||null===(e=t.tiles)||void 0===e?void 0:e.density});i.init((function(){i.setRowsHeight()}));var n=null;window.addEventListener("resize",(function(){clearTimeout(n),n=setTimeout((function(){i.tilify((function(){document.body.dispatchEvent(new Event("post-load"))})),i.setRowsHeight()}),500)}))}))};window.mglInitTiles=u,document.addEventListener("DOMContentLoaded",(function(){u()}))}},t={};function e(i){var n=t[i];if(void 0!==n)return n.exports;var r=t[i]={exports:{}};return o[i](r,r.exports,e),r.exports}e.d=(o,t)=>{for(var i in t)e.o(t,i)&&!e.o(o,i)&&Object.defineProperty(o,i,{enumerable:!0,get:t[i]})},e.o=(o,t)=>Object.prototype.hasOwnProperty.call(o,t),e.r=o=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})},(()=>{"use strict";var o=e(849);e(958),e(415),o.Z.right_click&&document.querySelectorAll(".mgl-gallery").forEach((function(o){o.addEventListener("contextmenu",(function(o){o.preventDefault()}))}))})()})();