过图自定义

给手机网站增加一个可以删除图片的按钮

目前為 2019-03-31 提交的版本,檢視 最新版本

// ==UserScript==
// @name         过图自定义
// @namespace    http://tampermonkey.net/
// @version      0.0.02
// @description  给手机网站增加一个可以删除图片的按钮
// @author       self
// @match        *://*/*
// @require      https://cdn.staticfile.org/jquery/1.12.4/jquery.min.js
// @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;
    alert(a[i].style.z-index);
  }

}
function addbtn(){
 (Array.from(document.querySelectorAll('body *'))).map(function (x){
    ((+window.getComputedStyle(x).zIndex || 0) >100)?($(x).css("z-index","-1")):"";
  });
  var div=document.createElement("button");
  div.innerText = "关闭图片";
  div.onclick=hidePic;
//把div元素节点添加到body元素节点中成为其子节点,但是放在body的现有子节点的最后
  document.body.appendChild(div);
//插入到最前面
  document.body.insertBefore(div, document.body.firstElementChild);    
}
addbtn();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址