Greasy Fork

Greasy Fork is available in English.

过图自定义

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

当前为 2019-03-31 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         过图自定义
// @namespace    http://greasyfork.icu/zh-CN/scripts/381167
// @version      0.0.06
// @description  给手机网站增加一个可以删除图片的按钮
// @homepage     http://greasyfork.icu/zh-CN/scripts/381167
// @author       unmht001
// @match        *://*/*
// @grant        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();