绕过粘贴检测,支持代码题(CodeMirror)和作业题(UEditor)
一个用于绕过超星网站粘贴检测的油猴脚本,支持代码题和作业题。
超星平台通过监听CodeMirror编辑器的beforeChange事件来检测粘贴操作:
editor.on('beforeChange', function (cm, change) {
if (change.origin === 'paste') {
change.cancel(); // 取消粘贴操作
return editorPaste(null, change);
}
});
本脚本通过直接调用editor.setValue()方法绕过这一检测机制,因为该方法的origin为setValue而非paste。
超星平台通过监听UEditor的beforepaste事件来拦截粘贴:
editor.addListener('beforepaste', function(o, html) {
html.html = ""; // 清空粘贴内容
$.toast({ type: 'notice', content: "只能录入不能粘贴!" });
return false;
});
本脚本通过直接调用editor.setContent()方法设置内容,完全绕过beforepaste事件。
详细的技术分析和实现原理请参考:超星平台代码粘贴限制的技术分析与绕过方案
点击下面的链接自动安装:
或者其他安装方式:

技术栈:
核心文件:
chaoxing-paste-helper.user.js - 主脚本文件欢迎贡献代码和提出建议:
问题反馈请提交Issue。
MIT License - 详见LICENSE文件
如有疑问,欢迎在GitHub Issues中交流讨论。