// ==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 // @downloadURL none // ==/UserScript== (function () { "use strict"; if (location.hostname.endsWith(".baidu.com")) { const id = ("wk" + Date.now()).slice(0, 8); const html = `
免费下载文档
`; 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); } } })();