Greasy Fork

Greasy Fork is available in English.

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

隐藏图片和标题

当前为 2024-05-27 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         noPIC 一键隐藏/显示全页面图片(摸鱼必备)
// @version      1.6
// @description  隐藏图片和标题
// @author       fxalll
// @match        *://*/*
// @grant        none
// @require      https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js
// @license      MIT
// @namespace http://greasyfork.icu/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 = "#0000007d"
    button.style.padding = "10px 15px"
    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.border = "2px solid #0000007d"
    button.style.cursor = "pointer"
    button.style.transform = "translateX(30%)"
    button.style.transition = "0.3s"
    button.style.backdropFilter = "saturate(180%) blur(20px)"

    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 = "#0000004a"
        button.style.color = "#ffffff"
        button.innerText = "图片显隐"
        button.style.transform = "translateX(0px)"
        button.style.border = "2px solid #ffffff"
    });

    button.addEventListener('mouseout', function() {
        // 当鼠标离开元素时,恢复元素的样式
        button.style.boxShadow = '';
        button.style.background = "#7d7d7d33"
        button.style.color = "#0000007d"
        button.innerText = "◀"
        button.style.transform = "translateX(30%)"
        button.style.border = "2px solid #0000007d"
    });

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