// ==UserScript== // @name 过图自定义 // @namespace https://greasyfork.org/zh-CN/scripts/381167 // @version 0.0.06 // @description 给手机网站增加一个可以删除图片的按钮 // @homepage https://greasyfork.org/zh-CN/scripts/381167 // @author unmht001 // @match *://*/* // @grant none // @downloadURL none // ==/UserScript== function clearzindex(c){ console.log("clear z-index > 100."); (Array.from(top.document.querySelectorAll('body *'))).map(function (x){ ((+window.getComputedStyle(x).zIndex || 0) >100)?(x.style.cssText+=";z-index:-1;display:none"):""; }); setTimeout(function (){ clearzindex(c+c ); },c) } function addbtn(){ clearzindex(1000); var div =top.document.createElement("div"); div.style.cssText+=";position:fixed;z-index:100"; var b1=top.document.createElement("button"); b1.innerText = "弹出文字"; b1.onclick=function () { alert(top.document.body.innerText); window.scrollTo(0,top.document.body.clientHeight) }; div.appendChild(b1); var b2=top.document.createElement("button"); b2.innerText = "关闭图片"; b2.onclick=function () { Array.from(top.document.getElementsByTagName("img")).map( function (x){x.style.cssText+=";display:none;width:0px;height:0px";} ); }; div.appendChild(b2); top.document.body.insertBefore(div, top.document.body.firstElementChild); } addbtn();