Greasy Fork

Greasy Fork is available in English.

うんはらバスター

おんjで画像を表示するか逐一確認!

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         うんはらバスター
// @namespace    http://tampermonkey.net/
// @version      1.2
// @description  おんjで画像を表示するか逐一確認!
// @author       icchi
// @match        *://hayabusa.open2ch.net/test/read.cgi/livejupiter/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    function checkImages() {
        document.querySelectorAll('img').forEach(img => {
            if (img.src.includes("imgur.com") && !img.dataset.checked) { // imgur画像で未処理のもの
                img.dataset.checked = "true"; // 重複処理防止
                img.style.display = "none"; // 画像を非表示
                let btn = document.createElement("button");
                btn.textContent = "画像を表示する";
                btn.style.margin = "5px";
                btn.onclick = function() {
                    img.style.display = "block"; // 画像を表示
                    btn.remove(); // ボタン削除
                };
                img.insertAdjacentElement("beforebegin", btn);
            }
        });
    }

    // 初回実行
    checkImages();

    // ページの変更を監視(新しく読み込まれた画像にも対応)
    let observer = new MutationObserver(checkImages);
    observer.observe(document.body, { childList: true, subtree: true });
})();