故宫博物院水印去除

去除故宫博物院藏品水印,免打开新网页浏览

目前為 2023-08-21 提交的版本,檢視 最新版本

// ==UserScript==
// @name         故宫博物院水印去除
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  去除故宫博物院藏品水印,免打开新网页浏览
// @author       weixiaorucimeimiao
// @match        *.dpm.org.cn/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    setTimeout (function() {
        const watermark4 = document.querySelector("#watermark4");
        if (watermark4) {
            watermark4.style.display = "none"; // 隐藏水印
        }
    }, 100);
    setTimeout (function() {
        const zoomControls = document.querySelector(".openseadragon-container > div:nth-child(2)");
        if (zoomControls) {
            zoomControls.style.visibility = "hidden"; // 缩放按钮图片缺失,暂时隐藏
        }
    }, 500);

    // setTimeout (function() {
        // const byxBody =document.querySelector("html > #byxBody");
        // if (byxBody) {
            // byxBody.style.background = "none transparent"; // 背景透明化
        // }
    // }, 100);

    function adjustment() {
        const imgElement = document.querySelector("div.boximg > div.foucs > div > div > img");
        let src = imgElement.getAttribute("custom_tilegenerator");
        if (imgElement && src) {
            const oldEmbed = document.querySelector("embed");
            if (oldEmbed) {
                oldEmbed.remove();
            }
            document.querySelector("div.boximg > div.foucs").style.height = "660px";
            const rightList = document.querySelector("div.boximg > div.rightlist");
            if (rightList) {
                rightList.style.height = "660px";
            }
            const embedElement = document.createElement("embed");
            embedElement.style.height = "660px";
            embedElement.style.width = "100%";
            if (src.startsWith("http://")) {
                src = src.replace("http://", "https://");
            }
            embedElement.setAttribute("src", src);
            imgElement.parentNode.insertBefore(embedElement, imgElement.nextSibling); // 将 <embed> 元素添加在 <img> 元素后面
            setTimeout (function() {
                const Btn = document.querySelector(".pic > .fdj");
                if (Btn) {
                    Btn.addEventListener("click", function() {
                        window.open(src, "_blank"); // 按钮添加链接
                    });
                }
                if (document.querySelector(".pic > embed")) {
                imgElement.style.display = "none"; // 隐藏原图
                }
            }, 200);
        }
    }
    adjustment(); // 调用函数

    const rightlist = document.querySelector("#hl_content > div > div.boximg > div.rightlist > div");
    rightlist.addEventListener("click", function() {
        adjustment(); // 调用函数
    });

})();

QingJ © 2025

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