您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
添加一个按钮,用于从iframe的pdfpath参数下载PDF
// ==UserScript== // @name Button to download PDF from iframe's pdfpath parameter // @description Adds a button to download PDF from iframe's pdfpath parameter // @name:zh-CN 从iframe的pdfpath参数下载PDF的按钮 // @description:zh-CN 添加一个按钮,用于从iframe的pdfpath参数下载PDF // @namespace http://tampermonkey.net/ // @version 1.0.1 // @author aspen138 // @match https://wk.askci.com/* // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; // Create a button element const button = document.createElement('button'); button.textContent = 'Download PDF'; button.style.position = 'fixed'; button.style.top = '10px'; button.style.right = '10px'; button.style.zIndex = '9999'; button.style.padding = '10px'; button.style.backgroundColor = '#4CAF50'; button.style.color = 'white'; button.style.border = 'none'; button.style.borderRadius = '5px'; button.style.cursor = 'pointer'; // Append button to the page document.body.appendChild(button); // Add click event listener to the button button.addEventListener('click', () => { // Find the iframe const iframe = document.querySelector('iframe'); if (!iframe) { alert('No iframe found on the page.'); return; } // Get iframe src const src = iframe.src; if (!src) { alert('Iframe src is empty.'); return; } // Extract query parameters const queryString = src.substring(src.indexOf('?') + 1); if (!queryString) { alert('No query parameters found in iframe src.'); return; } // Parse query parameters const urlParams = new URLSearchParams(queryString); const downloadUrl = urlParams.get('pdfpath'); if (!downloadUrl) { alert('No pdfpath parameter found in iframe src.'); return; } // Open the download URL in a new tab window.open(downloadUrl, '_blank'); }); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址