Unlimit-Web

解除网页限制: 恢复文本的选中和复制, 过滤文本小尾巴, 恢复右键菜单. Remove webpage restrictions: restore the selection and copy of text, clear the text tail, and restore the right-click menu.

Ekde 2022/05/21. Vidu La ĝisdata versio.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Unlimit-Web
// @description  解除网页限制: 恢复文本的选中和复制, 过滤文本小尾巴, 恢复右键菜单. Remove webpage restrictions: restore the selection and copy of text, clear the text tail, and restore the right-click menu.
// @version      2.0
// @author       xcanwin
// @namespace    https://github.com/xcanwin/Unlimit-Web/
// @supportURL   https://github.com/xcanwin/Unlimit-Web/
// @license      AGPL-3.0-only
// @icon         data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAC/VBMVEUAAACsauD2We3stnT+i5/9rG3/dsZB7rt8Q/7hlL1l7KvwvWvdQv/sRv4W0dtR77TRRP//Xe7/rGfhWvv4Tvr3gLb5fcRX8ar1XPFbT/zwUfzerJkvYvgagfP/W+9iieeAhebTznZHl+ap3Yr+lorue9uA5Z3/iaH/g7C504SW5ZHysndT9a//Yeelsbn/c87eyHH7pXrxauk6muaX4JT/fL47V/yr1orphsz/csyuPP8NxOLXeOaR5pTPX/n+n33/gbPbUP7OyH+YqsfpxWkZrub/Zt/oSf36q3f/d8n6q3b/e7X/WvL/bdcr58vH1niWO//eoKxfmeHzvmUYyN4668L/aOL8q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JfomzIxMkmIRDVv5uXlEUbYAhBzBAsLi4OGPiPMNyITeHl4BFJgfIZ0lfMsLBqmSEaKuPMI7OnaCDNg2oUL59VzkOSlhB0F9uy2Wgo1wlDl0gWVdGhQGUkwwuSvB0hCFCTaX7oUIQ32TIyqqmqMkbDdvn27b1y/Vb8eYkP4lSv22iCW2GQLi8ePbdpK7O6+v3H7FgfHKrACVqFdVzwMQYEdz8l55skTm+Of7364f5uDY+/eRYxQBbu8WIEM6UCggjOnjh//dv/evTt39t68OccMogCgdzAF5168OHVq24kTXw8f/nhw//79kTAF16BWnPv98vm2bScUFL58OnjwwIEDkWArmIOvXasGOzKz4+Xzp08LqhTk5Y8+eCAjI7MC4s1l3Nzc0eYgI/Qm1To7z1oTJK909OihQ4fq1kEUGLhwv201ADPz9FbrbWIwDlL6fuSIrGy/JDSog99evTqPGSmojacWHjt2RDYJFltrXa4qOmlKI6nY4Prw4bFOY3h0RysqXq7UNIEnz6yQokePXJNEl8eJQBIFYNn+ly9fVJ6oZQJyKnvWym4+PmvrhZnebHLu0ERh4H/xovKbcrX5CQmLQ/2Kt2/n4wvJTTz/68c+WIxmz1R+Y/v39SsuLv4dO55t394Ym88Q/u/ctsN9UAUMeVo9tmB5kIJSv1R2BgZtpz8/lRaYwV1mojVdramMv6alNzQ1H+x2TbX22FzkxM8unqGjo5Mhzg7lm4uDmJQDAKcu8tauXdauAAAAAElFTkSuQmCC
// @run-at       document-end
// @match        *://*/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    let main = function(){
        Array.prototype.forEach.call(document.getElementsByTagName("*"), function(el) {
            [
                "user-select", "-webkit-user-select", "-moz-user-select", "-ms-user-select", "-khtml-user-select"
            ].forEach(xcanwin => {
                let filterstyle = document.defaultView.getComputedStyle(el, null)[xcanwin];
                if (filterstyle && filterstyle == 'none') {
                    el.style[xcanwin] = "text";
                }
            });

            [
                "pointer-events"
            ].forEach(xcanwin => {
                let filterstyle = document.defaultView.getComputedStyle(el, null)[xcanwin];
                if (filterstyle && filterstyle != 'auto') {
                    el.style[xcanwin] = "auto !important";
                }
            });

            [
                "onselect", "onselectstart", "onselectionchange",
                "oncontextmenu",
                "oncopy", "onbeforecopy",
                "onpaste", "onbeforepaste", "oncut", "onbeforecut",
                "onpointercancel", "onpointerdown", "onpointerenter", "onpointerleave", "onpointerlockchange", "onpointerlockerror", "onpointermove", "onpointerout", "onpointerover", "onpointerrawupdate", "onpointerup"
            ].forEach(xcanwin => {
                el[xcanwin] = function(e) {
                    e.stopImmediatePropagation();
                }
            });

            [
                "onmouseenter", "onmouseleave", "onmousedown", "onmouseenter", "onmouseleave", "onmousemove", "onmouseout", "onmouseover", "onmouseup"
            ].forEach(xcanwin => {
                el[xcanwin] = function(e) {
                    if ([ "P" ].indexOf(e.target.nodeName) >=0) {
                        // 处理html文本标签
                        e.stopImmediatePropagation();
                    }
                }
            });

            [
                "onkeypress", "onkeyup", "onkeydown"
            ].forEach(xcanwin => {
                el[xcanwin] = function(e) {
                    let keyCode = e.keyCode || e.which || e.charCode;
                    let ctrlKey = e.ctrlKey || e.metaKey;
                    if (ctrlKey && keyCode == 67) {
                        // 处理ctrl+c
                        e.stopImmediatePropagation();
                    }
                }
            });

        });
    };

    main();
})();