view 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
line wrap: on
line source

// ==UserScript==
// @name        melonbooks unlazy
// @namespace   https://nanaya.net
// @match       https://www.melonbooks.co.jp/*
// @grant       none
// @run-at      document-end
// @version     1.0.1
// @author      nanaya
// @description replace lazy loaded images with just images
// @downloadURL https://hg.nanaya.net/ec-userscripts/raw-file/tip/melonbooks-unlazy.user.js
// ==/UserScript==

'use strict'

for (const img of document.querySelectorAll('.lazyload')) {
  const src = img.dataset.src

  if (src != null) {
    img.src = src
    img.classList.remove('lazyload')
    img.classList.add('unlazied')
    delete img.dataset.src
  }
}