// ==UserScript== // @name 超星/学习通粘贴限制解除 // @namespace http://tampermonkey.net/ // @version 1.1 // @description 自动重写学习通作业/考试页面的editorPaste函数,解除富文本编辑器的粘贴限制。 // @author NanCunChild // @match *://*.chaoxing.com/* // @grant none // @run-at document-start // @license MIT // @downloadURL none // ==/UserScript== (function() { 'use strict'; console.log('超星粘贴限制解除脚本已激活,正在监控 editorPaste 函数...'); // 超星网页有些用JS渲染,需要延迟,等到页面完成后重写它 const intervalId = setInterval(() => { // 检查 window.editorPaste 是否是一个函数,并且原始,包含拦截逻辑 if (typeof window.editorPaste === 'function' && window.editorPaste.toString().includes("只能录入不能粘贴")) { console.log('检测到目标函数 editorPaste,准备重写...'); window.editorPaste = function(o, html) { console.log('NanCunChild:已成功拦截并放行粘贴操作!'); return true; }; clearInterval(intervalId); console.log('editorPaste 函数重写完成,粘贴限制已解除。'); } }, 1000); setTimeout(() => { clearInterval(intervalId); }, 15000); })();