Created
July 9, 2023 20:17
-
-
Save Albirew/507a9ee1cc9c0055e416c3ab4c87eee5 to your computer and use it in GitHub Desktop.
Unlazy-Load Images userscript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Unlazy-Load Images | |
// @namespace https://greasyfork.org/en/users/85671-jcunews | |
// @version 0.2b | |
// @license AGPL v3 | |
// @author jcunews | |
// @description remove shitty lazyload | |
// @exclude http*://*gog.com/* | |
// @include http*://*mangasushi.org/* | |
// @include http*://*www.webtoons.com/* | |
// @include * | |
// @grant none | |
// ==/UserScript== | |
(() => { | |
function doimg(ele, a) { | |
["data-src", "data-original-src", "data-original", "data-sco-src", "rs-data-src", "data-pagespeed-lazy-src", "data-lazy-src", "data-url"].some(n => { | |
if (ele.attributes[n]) { | |
ele.src = ele.getAttribute(n); | |
ele.classList.replace('lazy', 'unlaziedModaFoka'); | |
ele.classList.replace('lazyload', 'unlaziedModaFoka'); | |
return true; | |
} | |
}) || | |
["data-srcset", "data-original-srcset", "rs-data-srcset"].some((n, a) => { | |
if (ele.attributes[n] && (a = ele.getAttribute(n).match(/^(.*?)[\s,]/))) { | |
ele.src = a[1]; | |
return true; | |
} | |
}); | |
if (ele.srcset && ele.src) { | |
ele.srcset = ""; | |
ele.removeAttribute("srcset"); | |
} | |
["width", "height"].forEach(p => { | |
["data-", "data-original-", "rs-data-"].some((s, t) => { | |
if (t = ele.attributes[s + p]) { | |
ele[p] = t.value; | |
return true; | |
} | |
}); | |
}); | |
} | |
document.querySelectorAll("img").forEach(doimg); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment