# HG changeset patch # User nanaya # Date 1618466183 -32400 # Node ID af4f8b25495e6575e85c94321e7f2069f184886d # Parent a1e007bea4f194c2e868482773aa3f46ca64001e Merge elements first and use actual srcset diff -r a1e007bea4f1 -r af4f8b25495e soranews-image.user.js --- a/soranews-image.user.js Tue Apr 13 15:11:32 2021 +0900 +++ b/soranews-image.user.js Thu Apr 15 14:56:23 2021 +0900 @@ -1,7 +1,7 @@ // ==UserScript== // @name Soranews image fix // @namespace https://myconan.net -// @version 1.0.2 +// @version 1.0.3 // @description Soranews lazy load image fix // @author nanaya // @match https://soranews24.com/* @@ -19,11 +19,8 @@ } for (var i = 0; i < nodes.length; i++) { - // first try fixing itself - fix(nodes[i]) - - // and then find all the images inside - var images = nodes[i].querySelectorAll('.lazy') + // find all the images inside (and self) + var images = [nodes[i], ...nodes[i].querySelectorAll('.lazy')] for (var j = 0; j < images.length; j++) { fix(images[j]) @@ -39,7 +36,7 @@ image.classList.remove('lazy') image.removeAttribute('src') - image.setAttribute('srcset', image.dataset.scoSrc) + image.setAttribute('srcset', image.dataset.scoSrcset) } var onMutate = function (mutations) {