noPIC 一键隐藏/显示全页面图片(摸鱼必备)

隐藏图片和标题

目前為 2024-05-27 提交的版本,檢視 最新版本

// ==UserScript==
// @name         noPIC 一键隐藏/显示全页面图片(摸鱼必备)
// @version      1.4
// @description  隐藏图片和标题
// @author       fxalll
// @match        *://*/*
// @grant        none
// @require      https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js
// @license      MIT
// @namespace https://gf.qytechs.cn/users/1043548
// ==/UserScript==



(function () {
    window.imgHidenSet = null;
    window.imgShownSet = null;
    let imgHiden = function() {
        $(".RichContent-cover-inner").each(function(){
            $(this).hide();
        });
        $(".ZVideoRecommendationItem-thumbnailImage").each(function(){
            $(this).hide();
        });
        $(".QuestionHeader-title").each(function(){
            $(this).hide();
        });
        $("iframee").each(function(){
            $(this).hide();
        });
        $("img").each(function(){
            $(this).hide();
        });
    };


    let imgShown = function() {
        $(".RichContent-cover-inner").each(function(){
            $(this).show();
        });
        $(".ZVideoRecommendationItem-thumbnailImage").each(function(){
            $(this).show();
        });
        $(".QuestionHeader-title").each(function(){
            $(this).show();
        });
        $("iframee").each(function(){
            $(this).show();
        });
        $("img").each(function(){
            $(this).show();
        });
    };



    let handleButtonClick = function(){
        if (window.imgHidenSet === null) {
            clearInterval(window.imgShownSet);
            window.imgShownSet = null;
            imgHiden()
            window.imgHidenSet = setInterval(function(){
                imgHiden();
            }, 300)

        } else {
            clearInterval(window.imgHidenSet);
            window.imgHidenSet = null;
            imgShown()
            window.imgShownSet = setInterval(function(){
                imgShown();
            }, 300)
        }
    }

    // 自动隐藏图片
    //imgHiden();
    //window.imgHidenSet = setInterval(function(){
    //imgHiden();
    //}, 300)

    let button = document.createElement('div')
    button.innerText = "图片显隐"
    button.setAttribute("id", "myButton");
    button.style.color = "#ffffff40"
    button.style.padding = "10px 20px"
    button.style.position = "fixed"
    button.style.bottom = "20px"
    button.style.right = "3px"
    button.style.textAlign = "center"
    button.style.alignContent = "center"
    button.style.background = "#7d7d7d33"
    button.style.borderRadius = "15px"
    button.style.cursor = "pointer"
    button.style.transform = "translateX(82px)"
    button.style.transition = "0.3s"

    button.style.zIndex = "99999999999999999999999999999"
    button.addEventListener("click", handleButtonClick);
    // 添加鼠标悬停效果
    button.addEventListener('mouseover', function() {
        // 当鼠标悬停在元素上时,改变元素的样式
        button.style.boxShadow = "0 0 10px rgba(0, 0, 0, 0.5)"; /* 鼠标悬停时的阴影效果 */;
        button.style.background = "#4760e1bf"
        button.style.color = "#ffffff"
        button.style.transform = "translateX(0px)"
    });

    button.addEventListener('mouseout', function() {
        // 当鼠标离开元素时,恢复元素的样式
        button.style.boxShadow = '';
        button.style.background = "#7d7d7d33"
        button.style.color = "#ffffff40"
        button.style.transform = "translateX(82px)"
    });

    document.body.appendChild(button);
})()

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址