Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Unlazy-Load Images
- // @namespace https://greasyfork.org/en/users/85671-jcunews
- // @version 0.2
- // @license AGPL v3
- // @author jcunews
- // @description .
- // @include *:*
- // @exclude *://*.tumblr.com/*
- // @grant none
- // ==/UserScript==
- (() => {
- function doimg(ele, a) {
- ["data-src", "data-original-src", "data-original", "rs-data-src", "data-pagespeed-lazy-src"].some(n => {
- if (ele.attributes[n]) {
- ele.src = ele.getAttribute(n);
- 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);
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement