nexusmods-image

nexusmods模糊图片直接显示

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         nexusmods-image
// @namespace    http://tampermonkey.net/
// @version      1.1
// @license      MPL-2.0
// @description  nexusmods模糊图片直接显示
// @author       brackrock12
// @match        https://www.nexusmods.com/*
// @require      http://libs.baidu.com/jquery/2.0.0/jquery.min.js
// ==/UserScript==

(function () {
    'use strict';

    function show_Image() {

        $("[class*='blur-image']").each(function () {
            const img = $(this);
            const classlist = img.attr('class').split(' ');
            classlist.forEach(element => {
                if (element.indexOf('blur-image') > -1) {
                    img.removeClass(element);
                }
            });
        });

        $(".mod_adult_warning_wrapper").each(function () {
            $(this).hide();
        });
        $(".unblur-btn").each(function () {
            $(this).hide();
        });
        $(".blur-description").each(function () {
            $(this).removeClass('blur-description');
        });

        if ($(".mod_adult_warning_wrapper").length == 0) return;

        // Firefox和Chrome早期版本中带有前缀
        var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver
        // 选择目标节点
        var target = document.querySelector('body');
        // 创建观察者对象
        var observer = new MutationObserver(function (mutations) {
            const subimg = $("[class*='blur-image']");
            if (subimg.length == 0) {
                return;
            }
            subimg.each(function () {
                const img = $(this);
                const classlist = img.attr('class').split(' ');
                classlist.forEach(element => {
                    if (element.indexOf('blur-image') > -1) {
                        img.removeClass(element);
                    }
                });
            });
            $(".unblur-btn").each(function () {
                $(this).hide();
            });
            // if (subimg.length == 0) {
            //     observer.disconnect();
            // }
        });
        // 配置观察选项:
        var config = { attributes: true, childList: true, characterData: true, subtree: true }         // 传入目标节点和观察选项
        observer.observe(target, config);
    }

    setTimeout(show_Image, 100);

})();