Mercurial > ec-userscripts
annotate melonbooks-unlazy.user.js @ 96:368035f2213b
Use builtin framework for document ready
author | nanaya <me@nanaya.net> |
---|---|
date | Fri, 23 Dec 2022 19:14:04 +0900 |
parents | afad36fddb64 |
children | c8f9350c5307 |
rev | line source |
---|---|
95 | 1 // ==UserScript== |
2 // @name melonbooks unlazy | |
3 // @namespace https://nanaya.net | |
4 // @match https://www.melonbooks.co.jp/* | |
5 // @grant none | |
96
368035f2213b
Use builtin framework for document ready
nanaya <me@nanaya.net>
parents:
95
diff
changeset
|
6 // @run-at document-end |
368035f2213b
Use builtin framework for document ready
nanaya <me@nanaya.net>
parents:
95
diff
changeset
|
7 // @version 1.0.1 |
95 | 8 // @author nanaya |
9 // @description replace lazy loaded images with just images | |
10 // @downloadURL https://hg.nanaya.net/ec-userscripts/raw-file/tip/melonbooks-unlazy.user.js | |
11 // ==/UserScript== | |
12 | |
13 'use strict' | |
14 | |
96
368035f2213b
Use builtin framework for document ready
nanaya <me@nanaya.net>
parents:
95
diff
changeset
|
15 for (const img of document.querySelectorAll('.lazyload')) { |
368035f2213b
Use builtin framework for document ready
nanaya <me@nanaya.net>
parents:
95
diff
changeset
|
16 const src = img.dataset.src |
95 | 17 |
96
368035f2213b
Use builtin framework for document ready
nanaya <me@nanaya.net>
parents:
95
diff
changeset
|
18 if (src != null) { |
368035f2213b
Use builtin framework for document ready
nanaya <me@nanaya.net>
parents:
95
diff
changeset
|
19 img.src = src |
368035f2213b
Use builtin framework for document ready
nanaya <me@nanaya.net>
parents:
95
diff
changeset
|
20 img.classList.remove('lazyload') |
368035f2213b
Use builtin framework for document ready
nanaya <me@nanaya.net>
parents:
95
diff
changeset
|
21 img.classList.add('unlazied') |
368035f2213b
Use builtin framework for document ready
nanaya <me@nanaya.net>
parents:
95
diff
changeset
|
22 delete img.dataset.src |
95 | 23 } |
24 } |