// ==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 https://update.greasyfork.icu/scripts/550265/%E8%B6%85%E6%98%9F%E5%AD%A6%E4%B9%A0%E9%80%9A%E7%B2%98%E8%B4%B4%E9%99%90%E5%88%B6%E8%A7%A3%E9%99%A4.user.js // @updateURL https://update.greasyfork.icu/scripts/550265/%E8%B6%85%E6%98%9F%E5%AD%A6%E4%B9%A0%E9%80%9A%E7%B2%98%E8%B4%B4%E9%99%90%E5%88%B6%E8%A7%A3%E9%99%A4.meta.js // ==/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); })();