Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@szepeviktor
Last active March 3, 2021 19:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save szepeviktor/f946409a446f761c63efdb98f217fbc6 to your computer and use it in GitHub Desktop.
Save szepeviktor/f946409a446f761c63efdb98f217fbc6 to your computer and use it in GitHub Desktop.
KIFLI.hu termékkép nagyító - 🇬🇧 Enlarge ROHLIK.cz product images
// ==UserScript==
// @name Kifli nagy képek
// @version 0.1.0
// @icon https://www.kifli.hu/favicon/hu/favicon.ico
// @run-at document-idle
// @grant none
// @include https://www.kifli.hu/*
// @include https://kifli.hu/*
// @include https://www.rohlik.cz/*
// ==/UserScript==
let currentUrl = document.location.toString();
function _enlargeProductImages() {
let images = document.getElementById("productDetail");
if (images == null) {
return;
}
images.querySelectorAll("div[data-gtm-item='product-image'] div > img").forEach(function (image) {
// Make CDN enlarge image to fit into carousel
image.src = image.src.replaceAll("=500", "=708");
});
};
// Run on initial page load
setTimeout(_enlargeProductImages, 1500);
document.documentElement.addEventListener("DOMNodeInserted", function (event) {
let newUrl = document.location.toString();
if (newUrl == currentUrl) {
return;
}
currentUrl = newUrl;
setTimeout(_enlargeProductImages, 500);
});
@szepeviktor
Copy link
Author

szepeviktor commented Dec 30, 2020

Original

kép


Maximum size

kép

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment