comparison melonbooks-unlazy.user.js @ 99:b44d5cb661c5

Also check for empty string
author nanaya <me@nanaya.net>
date Sat, 24 Dec 2022 06:55:55 +0900
parents 3e5f1fa9ed52
children 3fded109e23a
comparison
equal deleted inserted replaced
98:3e5f1fa9ed52 99:b44d5cb661c5
2 // @name melonbooks unlazy 2 // @name melonbooks unlazy
3 // @namespace https://nanaya.net 3 // @namespace https://nanaya.net
4 // @match https://www.melonbooks.co.jp/* 4 // @match https://www.melonbooks.co.jp/*
5 // @grant none 5 // @grant none
6 // @run-at document-start 6 // @run-at document-start
7 // @version 1.0.2 7 // @version 1.0.3
8 // @author nanaya 8 // @author nanaya
9 // @description replace lazy loaded images with just images 9 // @description replace lazy loaded images with just images
10 // @downloadURL https://hg.nanaya.net/ec-userscripts/raw-file/tip/melonbooks-unlazy.user.js 10 // @downloadURL https://hg.nanaya.net/ec-userscripts/raw-file/tip/melonbooks-unlazy.user.js
11 // ==/UserScript== 11 // ==/UserScript==
12 12
13 'use strict' 13 'use strict'
14 14
15 function fix (image) { 15 function fix (image) {
16 const src = image.dataset.src 16 const src = image.dataset.src
17 17
18 if (src == null) return 18 if (src == null || src === '') return
19 19
20 image.classList.remove('lazyload') 20 image.classList.remove('lazyload')
21 image.src = image.dataset.src 21 image.src = image.dataset.src
22 delete image.dataset.src 22 delete image.dataset.src
23 } 23 }