隐藏/显示页面图片

在网页右下角添加一个按钮,可以隐藏和显示页面上的所有img标签

目前为 2023-06-19 提交的版本。查看 最新版本

// ==UserScript==
// @name              隐藏/显示页面图片
// @name:en           hide/display image
// @namespace         None
// @version           1.1.1
// @description       在网页右下角添加一个按钮,可以隐藏和显示页面上的所有img标签
// @description:en    Add a button for all websites which can back to the top and go to the bottom,and there is a sliding effecct.
// @author            mofiter
// @create            2023-06-06
// @lastmodified      2023-06-06
// @include           http*://*/*
// @license MIT
// ==/UserScript==
function creatIcon(){
  const img = document.createElement("img");
  img.src = "https://i.niupic.com/images/2023/06/19/bqao.png";
  img.style.position = "fixed";
  img.style.width = "45px";
  img.style.height = "45px";
  img.style.bottom = "60px";
  img.style.right = "6vw";
  img.style.opacity = "0.5";
  img.id="baojin_ovo"
  img.addEventListener("click", () => {
  const images = document.querySelectorAll("img");
  const elementToRemove = document.getElementById("baojin_ovo");
  images.forEach(image => {
  image.style.display = "inline";
  });
  elementToRemove.parentNode.removeChild(elementToRemove);
  });
  document.body.appendChild(img);
}
const img = document.createElement("img");
img.src = "https://i.niupic.com/images/2023/06/19/bqad.png";
img.style.position = "fixed";
img.style.width = "45px";
img.style.height = "45px";
img.style.bottom = "-60px";
img.style.right = "6vw";
img.style.opacity = "0.5";
img.id="baojin_owo"

img.addEventListener("click", () => {
const images = document.querySelectorAll("img");
images.forEach(image => {
image.style.display = "none";
});
  creatIcon();
});
document.body.appendChild(img);
const placeholder = document.getElementById("img-placeholder");
setTimeout(() => {
img.style.transition = "transform 1.2s";
img.style.transform = "translateY(-120px)";
//   placeholder.remove();
}, 1000);

QingJ © 2025

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