Mercurial > ec-userscripts
comparison melonbooks-unlazy.user.js @ 95:afad36fddb64
Add melonbooks unlazy
author | nanaya <me@nanaya.net> |
---|---|
date | Fri, 23 Dec 2022 19:10:50 +0900 |
parents | |
children | 368035f2213b |
comparison
equal
deleted
inserted
replaced
94:a35ddabefd9d | 95:afad36fddb64 |
---|---|
1 // ==UserScript== | |
2 // @name melonbooks unlazy | |
3 // @namespace https://nanaya.net | |
4 // @match https://www.melonbooks.co.jp/* | |
5 // @grant none | |
6 // @version 1.0.0 | |
7 // @author nanaya | |
8 // @description replace lazy loaded images with just images | |
9 // @downloadURL https://hg.nanaya.net/ec-userscripts/raw-file/tip/melonbooks-unlazy.user.js | |
10 // ==/UserScript== | |
11 | |
12 'use strict' | |
13 | |
14 function unlazy () { | |
15 for (const img of document.querySelectorAll('.lazyload')) { | |
16 const src = img.dataset.src | |
17 | |
18 if (src != null) { | |
19 img.src = src | |
20 img.classList.remove('lazyload') | |
21 img.classList.add('unlazied') | |
22 delete img.dataset.src | |
23 } | |
24 } | |
25 } | |
26 | |
27 if (document.readyState === 'loading') { | |
28 document.addEventListener('DOMContentLoaded', unlazy) | |
29 } else { | |
30 unlazy() | |
31 } |