Greasy Fork is available in English.
精确恢复ID为 secondaryDownload 的隐藏下载按钮
// ==UserScript==
// @name 精准恢复pdf下载按钮 (PDF.js)
// @namespace http://tampermonkey.net/
// @version 1.1
// @description 精确恢复ID为 secondaryDownload 的隐藏下载按钮
// @author Gemini
// @match *://*/*
// @grant none
// ==/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);
})();