cc

 avatar
user_2795378
plain_text
a year ago
1.4 kB
9
Indexable
// ==UserScript==
// @name        Lightbox image
// @namespace   Violentmonkey Scripts
// @match       *://*.*.*.*/*
// @grant       none
// @version     1.0
// @author      -
// @description 16:20:11 6/5/2024
// ==/UserScript==
(function(n){function t(e){return Object.prototype.toString.call(e).replace(/(?:^\[object\s(.*?)\]$)/,"$1").toLowerCase()}const e=Array.prototype.filter.call("string"===t(n.selectors)?document.querySelectorAll(n.selectors):"array"===t(n.selectors)?document.querySelectorAll(n.selectors.join(",")):[],function(e){return!("IMG"!==e.tagName||"string"===t(n.ignoreClass)&&n.ignoreClass&&e.classList.contains(n.ignoreClass))});if(0!==e.length){const o=document.createElement("div");o.className=n.classes.lightboxWrapper,o.addEventListener("click",function(e){o.classList.remove("active")}),o.addEventListener("transitionend",function(e){"opacity"!==e.propertyName||"0"!==getComputedStyle(o).getPropertyValue("opacity")||o.classList.contains("active")||o.parentNode.removeChild(o)}),e.forEach(function(t){const e=document.createElement("div");e.className=n.classes.imageWrapper,t.parentNode.insertBefore(e,t),e.appendChild(t),e.addEventListener("click",function(e){e.preventDefault(),o.innerHTML=t.outerHTML,document.body.appendChild(o),setTimeout(function(){o.classList.add("active")},40)})})}}).call(this, {
  selectors: "img,video",
  classes: {
    imageWrapper: "lbImg",
    lightboxWrapper: "zmImg"
  }
});
Editor is loading...
Leave a Comment