绕过openwrite公众号导流

去除openwrite“博客导流公众号”功能

当前为 2021-03-30 提交的版本,查看 最新版本

// ==UserScript==
// @name         绕过openwrite公众号导流
// @namespace    http://tampermonkey.net/
// @version      1.3
// @description  去除openwrite“博客导流公众号”功能
// @author       GoodbyeNJN
// @match        *://*/*
// @grant        none
// ==/UserScript==

const WAIT_TIME = 500;

(function () {
    "use strict";

    const hasBTWPlugin = typeof BTWPlugin === "function";
    const hasJquery = typeof $ === "function";

    if (!hasBTWPlugin || !hasJquery) {
        return;
    }

    const { id } = (BTWPlugin.prototype && BTWPlugin.prototype.options) || {
        id: "container",
        blogId: "",
        name: "",
        qrcode: "",
        keyword: "",
    };

    const showHidden = (e) => {
        setTimeout(() => {
            $("#btw-modal-wrap, #read-more-wrap").remove();
            $(`#${id}`).height("");
        }, WAIT_TIME);
    };

    const _wrap = (type) => {
        const fn = history[type];
        return function (...args) {
            const res = fn.apply(this, args);
            const e = new Event(type);
            e.arguments = args;
            window.dispatchEvent(e);
            return res;
        };
    };

    history.pushState = _wrap("pushState");
    history.replaceState = _wrap("replaceState");

    window.addEventListener("replaceState", showHidden);
    window.addEventListener("pushState", showHidden);
    window.addEventListener("hashchange", showHidden);

    $().ready(() => {
        showHidden();
    });
})();

QingJ © 2025

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