您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
dx 网上大学 pdf
// ==UserScript== // @name pdf 转换 // @namespace http://tampermonkey.net/ // @version 2024-07-07 // @description dx 网上大学 pdf // @author hn_lzy // @license MIT // @match *://kc.zhixueyun.com/* // @icon https://www.google.com/s2/favicons?sz=64&domain=zhixueyun.com // @grant none // @connect self // ==/UserScript== (function() { 'use strict'; console.log('Script is running on kc.zhixueyun.com'); const originalFetch = window.fetch; console.log('--------------test pdf------------'); window.fetch = function(...args) { return originalFetch.apply(this, args).then(response => { if (response.headers.get('Content-Type') === 'application/pdf') { console.log('Intercepted PDF response:', response.url); console.log('test url'); return response.blob().then(blob => { // 创建一个临时的a标签用于下载 console.log(blob); const a = document.createElement('a'); a.style.display= 'none'; a.href = URL.createObjectURL(blob); a.download =prompt('给下载的pdf文件命名:'); document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(a.href); }); } // 对于非PDF响应,返回原始的Response对象 return response; }).catch(error => { console.error('Fetch error:', error); // 根据需要处理错误,或者可以重新抛出错误 throw error; }); }; })();