智云学堂插件

自动解除 textarea 上的复制、粘贴、拖拽和文本选择限制

目前为 2024-12-20 提交的版本,查看 最新版本

// ==UserScript==
// @name         智云学堂插件
// @namespace    http://tampermonkey.net/
// @version      0.0.1
// @description  自动解除 textarea 上的复制、粘贴、拖拽和文本选择限制
// @author       You
// @match        https://www.e100soft.com/aikc/kcxxmain.asp
// @icon         https://www.google.com/s2/favicons?sz=64&domain=e100soft.com
// @grant        none
// @license      MIT
// @run-at       document-idle
// ==/UserScript==

(function() {
    'use strict';

    function removeEventRestrictions() {
        const testID = document.getElementById('testNr');
        if (testID) {
            const newTestID = testID.cloneNode(true);
            testID.parentNode.replaceChild(newTestID, testID);
            console.log('已成功解除对 textarea 的所有限制');
            observer.disconnect();
        }
    }

    const observer = new MutationObserver((mutations, obs) => {
        removeEventRestrictions();
    });

    observer.observe(document.body, { childList: true, subtree: true });

    removeEventRestrictions();

    console.log('脚本运行中...');


})();