Greasy Fork is available in English.
给手机网站增加一个可以删除图片的按钮
当前为
// ==UserScript==
// @name 过图自定义
// @namespace http://greasyfork.icu/zh-CN/scripts/381167
// @version 0.0.04
// @description 给手机网站增加一个可以删除图片的按钮
// @homepage http://greasyfork.icu/zh-CN/scripts/381167
// @author unmht001
// @match *://*/*
// @grant none
// ==/UserScript==
function hidePic(){
var a = document.getElementsByTagName("img");
for(var i =0;i<a.length;i++){
a[i].style.display = "none";
a[i].style.width=0;
a[i].style.height=0;
}
console.info(a.length);
}
function addbtn(){
(Array.from(document.querySelectorAll('body *'))).map(function (x){
((+window.getComputedStyle(x).zIndex || 0) >100)?(x.style.cssText+=";z-index:-1"):"";
});
var div=document.createElement("button");
div.innerText = "关闭图片";
div.style.cssText+=";z-index:2147483647"
div.onclick=hidePic;
//把div元素节点添加到body元素节点中成为其子节点,但是放在body的现有子节点的最后
document.body.appendChild(div);
//插入到最前面
document.body.insertBefore(div, document.body.firstElementChild);
}
addbtn();