Click-a-picture-to-Hide

点击图片隐藏它 click a picture to Hide it

当前为 2023-09-05 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

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

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Click-a-picture-to-Hide
// @namespace    https://www.hornmiclink.com/
// @version      1.0.0
// @description  点击图片隐藏它 click a picture to Hide it
// @author       [email protected]
// @require      https://cdn.staticfile.org/jquery/2.0.0/jquery.min.js
// @match        *://*/*
// @icon         https://web-generate.oss-accelerate.aliyuncs.com//temp/HJSMshortcuticon_1653040529394.png
// @grant        none
// @license      MIT
// ==/UserScript==

//updated @ 230905 8:48
$(function($){
    //添加界面    //alert(window.location.hostname);
    var node = document.createElement("div");
    node.id = "uiDiv";
    //node.className = "uiDivCCS";
    node.style.cssText = "position:fixed; top:80px; left:0px; z-index=2147483647; padding:6px; border-radius:6px; font-size:12px;"
        +" background-color:#329CC0; opacity: 0.88; text-align:center; "
    //node.style.position ="fixed";    //node.style.top = 10;    //node.style.left = 100;    //node.style.z-index= 999;
    node.innerHTML ="<button id='hideBtn' title='click to HIDE all images'>Hide</button> or "+
        "<button id='showBtn' title='click to SHOW all images'>Show</button><br> all images" +
        "<br><button id='closeBtn' title='click to Close this menu. And press F2 to reload this tool.' width=80% >&nbsp;X&nbsp;</button>"
    //document.body.appendChild(node);
    document.documentElement.appendChild(node);
    node.title="Please contact [email protected] to get more. Thanks.";
    //为hideBtn添加click事件
    document.querySelector("#hideBtn").addEventListener("click",hideBtnDo);
    document.querySelector("#showBtn").addEventListener("click",showBtnDo);
    document.querySelector("#closeBtn").addEventListener("click",closeMyself);


    //点击图片隐藏它
    $("img").click(
        function(){
            $(this).hide();
            console.log("Click-a-picture-to-Hide点击图片隐藏它-调试@230815")
        }) //end of .click

    var hasHided = 0;  //是否隐藏的标记,默认为0(unhided status);
    $("body").keyup(function(event){
        //按下F2则显/隐主界面(Show the main UI)
        //alert("Key: " + event.which);
        if (event.which=113){
            if (hasHided==0){
                closeMyself();
                hasHided=1;
            }
            else {
                showUI();
                hasHided=0;
            }
            //按下F2则Show or Hide主界面(Show/Hide the main UI)
        }
    });// end of .keyup
})();

//click #hideBtn BUTTON
function hideBtnDo(){
    //select by DOM Name:img - select all images
    $("img").hide();//隐藏所有图片
}
//click #showBtn BUTTON
function showBtnDo(){
    $("img").show();//显示所有图片 //select by DOM Name:img - select all images
}
//click #closeBtn to HIDE #uiDiv
function closeMyself(){
    $("#uiDiv").hide();//关闭当前界面(hide it)//select by #ID
}
//click #closeBtn to HIDE #uiDiv
function showUI(){
    $("#uiDiv").show();//显示主界面(Show the main UI)
}