Click-a-picture-to-Hide

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

目前為 2023-09-05 提交的版本,檢視 最新版本

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

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

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

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

你需要先安裝一款使用者腳本管理器擴展,比如 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)
}