小报童复制

解除 Xiaobot.net 上的文本选择和复制限制

// ==UserScript==
// @name         小报童复制
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  解除 Xiaobot.net 上的文本选择和复制限制
// @author       Keniu
// @match        https://xiaobot.net/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=xiaobot.net
// @grant        none
// @license MIT
// ==/UserScript==

(function () {
    'use strict';

    // Function to unlock text selection and copying restrictions
    function unlockTextSelection() {
        try {
            // Unlock the body element
            document.body.style.userSelect = 'auto';
            document.body.onmousedown = null;
            document.body.onselectstart = null;

            // Unlock all elements
            document.querySelectorAll('*').forEach(element => {
                element.style.userSelect = 'auto';
                element.onmousedown = null;
                element.onselectstart = null;
            });

            console.log('Text selection and copying unlocked.');
        } catch (error) {
            console.error('Error unlocking text selection:', error);
        }
    }

    // Wait for the DOM to fully load before executing
    if (document.readyState === 'complete') {
        unlockTextSelection();
    } else {
        window.addEventListener('load', unlockTextSelection);
    }
})();