NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name CowcotLand Helper
// @namespace https://www.cowcotland.com
// @version 0.3
// @description Make CowcotLand great again.
// @author sytha
// @match https://www.cowcotland.com/*
// @match https://cowcotland.com/*
// @grant none
// @license GPL-3.0-or-later
// @updateURL https://openuserjs.org/meta/sytha/CowcotLand_Helper.meta.js
// ==/UserScript==
(function() {
"use strict";
const animationDurations = 100;
const imageLinks = document.querySelectorAll("a[onclick*=\"popup_image\"]");
imageLinks.forEach(element => {
// Remove the initial onclick listener
element.onclick = event => event.preventDefault();
// Remove the title to prevent the "Click here to zoom" from appearing in the Lightbox
element.title = "";
// Add the data-lightbox attribute
element.setAttribute("data-lightbox", "page-images");
});
// Lightbox script from CloudFlare CDN
const lbScript = document.createElement("script");
lbScript.type = "text/javascript";
lbScript.src = "https://cdnjs.cloudflare.com/ajax/libs/lightbox2/2.11.1/js/lightbox.min.js";
// Lightbox style from CloudFlare CDN
const lbStyle = document.createElement("link");
lbStyle.href = "https://cdnjs.cloudflare.com/ajax/libs/lightbox2/2.11.1/css/lightbox.min.css";
lbStyle.rel = "stylesheet";
// Inject the script & style in the page <head>
document.head.appendChild(lbScript);
document.head.appendChild(lbStyle);
lbScript.addEventListener("load", event => {
lightbox.option({
albumLabel: "Image %1 sur %2",
resizeDuration: animationDurations,
fadeDuration: animationDurations,
imageFadeDuration: animationDurations,
});
});
})();