Mercurial > ec-userscripts
diff melonbooks-unlazy.user.js @ 108:2c4470b73ad9
Switch to semistandard
No more `;` at the start of line.
author | nanaya <me@nanaya.net> |
---|---|
date | Sun, 15 Jan 2023 23:24:03 +0900 |
parents | 93e21738b588 |
children | ef21ef445fc6 |
line wrap: on
line diff
--- a/melonbooks-unlazy.user.js Sun Jan 15 23:15:45 2023 +0900 +++ b/melonbooks-unlazy.user.js Sun Jan 15 23:24:03 2023 +0900 @@ -10,37 +10,37 @@ // @downloadURL https://hg.nanaya.net/ec-userscripts/raw-file/tip/melonbooks-unlazy.user.js // ==/UserScript== -'use strict' +'use strict'; function fix (image) { - if (!image.classList.contains('lazyload')) return + if (!image.classList.contains('lazyload')) return; - const src = image.dataset.src + const src = image.dataset.src; - if (src == null || src === '') return + if (src == null || src === '') return; - image.classList.remove('lazyload') - image.src = image.dataset.src - delete image.dataset.src + image.classList.remove('lazyload'); + image.src = image.dataset.src; + delete image.dataset.src; } function run (node) { - if (!(node instanceof window.HTMLElement)) return + if (!(node instanceof window.HTMLElement)) return; - fix(node) + fix(node); for (const image of node.querySelectorAll('.lazyload')) { - fix(image) + fix(image); } } function onMutate (mutations) { for (const mutation of mutations) { for (const node of mutation.addedNodes) { - run(node) + run(node); } } } -const observer = new window.MutationObserver(onMutate) -observer.observe(document, { childList: true, subtree: true }) -run(document.body) +const observer = new window.MutationObserver(onMutate); +observer.observe(document, { childList: true, subtree: true }); +run(document.body);