// ==UserScript== // @name 精准恢复pdf下载按钮 (PDF.js) // @namespace http://tampermonkey.net/ // @version 1.1 // @description 精确恢复ID为 secondaryDownload 的隐藏下载按钮 // @author Gemini // @match *://*/* // @grant none // @downloadURL https://update.greasyfork.icu/scripts/575042/%E7%B2%BE%E5%87%86%E6%81%A2%E5%A4%8Dpdf%E4%B8%8B%E8%BD%BD%E6%8C%89%E9%92%AE%20%28PDFjs%29.user.js // @updateURL https://update.greasyfork.icu/scripts/575042/%E7%B2%BE%E5%87%86%E6%81%A2%E5%A4%8Dpdf%E4%B8%8B%E8%BD%BD%E6%8C%89%E9%92%AE%20%28PDFjs%29.meta.js // ==/UserScript== (function() { 'use strict'; // 很多 PDF 阅读器是动态加载的,所以我们设置一个定时器循环检测 // 每隔 1 秒检测一次,直到找到按钮并将其显示出来 let checkExist = setInterval(function() { let downloadBtn = document.getElementById('secondaryDownload'); if (downloadBtn) { // 找到按钮了!强制修改它的 CSS 样式 downloadBtn.style.setProperty('visibility', 'visible', 'important'); downloadBtn.style.setProperty('display', 'inline-block', 'important'); console.log("成功破解:已强制显示 secondaryDownload 按钮!"); // 按钮已经显示,停止循环检测 clearInterval(checkExist); } }, 1000); // 1000毫秒 = 1秒 // 为了防止无限循环占用内存,设置 15 秒后自动停止检测 setTimeout(function() { clearInterval(checkExist); }, 15000); })();