您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Enable copy and paste on aryun.ustcori.com
// ==UserScript== // @name Enable Copy and Paste (科大奥瑞) // @namespace http://tampermonkey.net/ // @version 2024-04-27 // @description Enable copy and paste on aryun.ustcori.com // @author ReekyStive // @match *://aryun.ustcori.com/ReportStudent/SLabSource/SReport // @icon https://www.google.com/s2/favicons?sz=64&domain=ustcori.com // @grant none // @run-at document-idle // @license MIT // ==/UserScript== function hookInputTypeProperty() { if (typeof InputEvent === 'undefined') return; const originalGetter = Object.getOwnPropertyDescriptor(InputEvent.prototype, 'inputType').get; Object.defineProperty(InputEvent.prototype, 'inputType', { get: function () { const originalValue = originalGetter.call(this); const hookedValue = originalValue === 'insertFromPaste' ? 'insertText' : originalValue; console.log( '[userscript] getting InputEvent.inputType: %o, originalValue: %o, hookedValue: %o', this, originalValue, hookedValue ); return hookedValue; }, set: function (value) { console.warn('[userscript] attempt to set InputEvent.inputType, which is a read-only property.'); }, configurable: true, enumerable: true, }); } function removeAttributeListeners(root, attributes) { console.log('[userscript] removing attributes from %o', root); function traverse(node) { if (node.nodeType === Node.ELEMENT_NODE) { attributes.forEach((attribute) => { node.removeAttribute(attribute); }); Array.from(node.childNodes).forEach(traverse); } } traverse(root); } (function () { 'use strict'; hookInputTypeProperty(); removeAttributeListeners(document.body, ['oncontextmenu', 'oncopy', 'oncut', 'onpaste']); })();