Greasy Fork is available in English.
在网页右下角添加一个按钮,可以隐藏和显示页面上的所有img标签
当前为
// ==UserScript==
// @name 隐藏/显示页面图片
// @name:en hide/display image
// @namespace None
// @version 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://s2.xptou.com/2023/06/06/647e9bde4a0c6.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://s2.xptou.com/2023/06/06/647ea5578ac7b.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);