📄百度文库下载|VIP文档免费下载

百度文库破解免费下载

// ==UserScript==
// @name         📄百度文库下载|VIP文档免费下载
// @namespace    http://tampermonkey.net/
// @version      1.0.2
// @description  百度文库破解免费下载
// @author       mounui
// @match        *://wenku.baidu.com/*
// @match        *://wk.baidu.com/*
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none
// ==/UserScript==

(function () {
    "use strict";
    if (location.hostname.endsWith(".baidu.com")) {
        const id = ("wk" + Date.now()).slice(0, 8);
        const html = `
            <div id="${id}">
                <style>
                    #${id}{
                        /* box-shadow: 0 0 24px #00000080, 0 0 50px #0003; */
                        z-index: 9999999999;
                        bottom: 66px;
                        position: fixed;
                        left: 288px;
                        border-radius: 6px;
                        cursor: pointer;
                        text-align: center;
                        font-size: 17px;
                        padding: 10px 15px;
                        transition: 0.1s;
                        background: #4e6ef2;
                        color: #efefef;
                        border: 1.5px solid #e77717;
                    }
                    #${id}:hover {
                        background: #4662d9;
                    }
                </style>
                    免费下载文档
            </div>
            `;
        onload(() => {
            document.body.insertAdjacentHTML("afterbegin", html);
            const btn = document.getElementById(id);
            btn.addEventListener("click", () => {
                window.open(
                    "https://doc.idjams.top?url=" +
                    encodeURIComponent(location.href)
                );
            });
            setInterval(() => {
                btn.style.setProperty(
                    "display",
                    location.pathname.startsWith("/view/") ? "block" : "none"
                );
            }, 500);
        });
    }
    function onload(cb) {
        cb = cb || new Function();
        if (document.readyState !== "loading") {
            cb();
        } else {
            document.addEventListener("DOMContentLoaded", cb);
        }
    }
})();