您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Extract and display links from an smartedu's text books
当前为
// ==UserScript== // @name text book PDF Link Extractor for smartedu // @namespace http://tampermonkey.net/ // @version 1.1 // @description Extract and display links from an smartedu's text books // @author Fieber Zhang // @match *://basic.smartedu.cn/tchMaterial/* // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; // 创建浮动窗口的样式 const styles = ` #iframe-url-extractor { position: fixed; top: 10px; right: 10px; width: 300px; max-height: 200px; overflow-y: auto; background: white; border: 1px solid #ccc; box-shadow: 0 0 10px rgba(0,0,0,0.5); z-index: 9999; padding: 10px; border-radius: 5px; } #iframe-url-extractor h2 { margin: 0; font-size: 16px; border-bottom: 1px solid #ccc; padding-bottom: 5px; margin-bottom: 10px; } #iframe-url-extractor a { display: block; margin-bottom: 5px; color: blue; text-decoration: none; } #iframe-url-extractor a:hover { text-decoration: underline; } `; // 向页面插入样式 const styleSheet = document.createElement("style"); styleSheet.type = "text/css"; styleSheet.innerText = styles; document.head.appendChild(styleSheet); // 创建浮动窗口 const container = document.createElement('div'); container.id = 'iframe-url-extractor'; container.innerHTML = '<h2>Extracted URL</h2><div id="url-list">Loading...</div>'; document.body.appendChild(container); // 提取并显示 URL window.addEventListener('load', function() { const iframe = document.querySelector('iframe'); if (iframe && iframe.contentWindow) { iframe.addEventListener('load', function() { try { const iframeDoc = iframe.contentDocument || iframe.contentWindow.document; const iframeHTML = iframeDoc.documentElement.outerHTML; // 正则表达式提取 #document(URL) const urlRegex = /#document\((.*?)\)/; const match = urlRegex.exec(iframeHTML); const urlList = document.getElementById('url-list'); urlList.innerHTML = ''; if (match && match[1]) { const extractedURL = match[1]; const linkElement = document.createElement('a'); linkElement.href = extractedURL; linkElement.target = '_blank'; // 在新标签页中打开 linkElement.textContent = extractedURL; urlList.appendChild(linkElement); } else { urlList.textContent = 'No matching URL found.'; } } catch (e) { console.error('无法访问 iframe 内容:', e); const urlList = document.getElementById('url-list'); urlList.textContent = 'Error accessing iframe content.'; } }); } }); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址