Remove Restrictions and Restore Default Behavior

Allows you select, cut, copy, paste, save and open the DevTools on any website.

As of 02.05.2024. See апошняя версія.

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             Remove Restrictions and Restore Default Behavior
// @name:zh          解除网页限制,恢复默认行为
// @namespace        http://hl-bo.github.io/namespaces/user-script/remove-limits
// @version          0.1
// @license          AGPLv3
// @description      Allows you select, cut, copy, paste, save and open the DevTools on any website.
// @description:zh   恢复选择、剪切、复制、粘贴、保存、右键菜单和打开开发者工具的默认行为
// @author           HL-Bo
// @match            *://*/*
// @exclude          *://vscode.dev/*
// @icon             data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAspJREFUWEfVl89PE1EQx7/TdpcabKFAoEKQH22ktEYSqRevXiRijEr8cSDe/DNM9D/xhPFn4oF4MeBZuJi0SiiQikTjD2gLCLS7jNmFLt2mu/uWYtB36G73zWQ+b2bevDeEijE5Od/Q3ut5CNA9gMOVc3bvG7+3MLeYRU9nhxqP9r2WURoPh8ObIvpUKTSbzkww6I6IYqWMAdAVxmCkF8z8zk/KFREIA2BmbilGu7tpZpigRGCqATQdAk3LKI46QRjGZtOZ6wx6KWKwWqYWgCbDzNN+UmwhDID3HxduEuP5UQKIQPx1gDJEnpTRoRqJaQnw/dcqVvPrANf2iST50N/dCSKCVQjMmjyVg3K1GsISILvyFT/X8pYRkXw+nD3TD4/HIwigp+ZUDkUThG0I9MVbeIAq9srW9g7SmSW0t4ZwPjHglEZvf3xZGkkmk6W93bI/qpNQUVVs7xRtPOBFgyzr88yM1PwidoolRE53oS3UbAuhMo8Mx/re2ALMZ5dRWLcuZlrsh2JReL1e3ZiWB5nsMlR118kDII/39v2xy09tAQobm8jrALVjIEsSOtpaTMZKioLVXAHaU/OK1fAAt65duvjMFsBxGXUIMGHswmDkhS2AtpK1wnodZg5UQ8EAWpqDxgchgIXPK8gdEUBzMKAnZ3kIAWgxLCmq9T4U9g1B8nn1gvV/ARx7CI49CYVDfAhBoSR0KkTidglNgUYETza6S0KtrO5VwvqHBhDt6XYH4HQYucHyN8jw7Z8Z+uElUgl1QePHjbkqWao4cvenhACcLiRukNpCTejpOuUuBE5XMmEAAlqaAmhvPTg5hTwgbOAQgv8mQD2NiVsnEPjGcDz6ynQfmPkwFyPJd6jWzA0AEZhLSjx5buCTCUD7M5temGDAdXPqCgB4MhyP3C3rmBrRVColb5H/kdv2XAyAvgH8+ARvP0gkEsZ1+w+ixcUwoQ+80AAAAABJRU5ErkJggg==
// @grant            none
// @run-at           document-idle
// ==/UserScript==

(function() {
    'use strict';
    // 取消通过 JavaScript 实现的禁止复制
    document.oncopy=function(event){ event.returnValue=true; };
    document.body.oncopy=function(event){ event.returnValue=true; };
    // 取消通过 JavaScript 实现的禁止文字选择
    document.onselectstart=function(event){ event.returnValue=true; };
    document.body.onselectstart=function(event){ event.returnValue=true; };
    // 取消通过 JavaScript 实现的禁止右键菜单
    document.oncontextmenu=function(event){ event.returnValue=true; };
    document.body.oncontextmenu=function(event){ event.returnValue=true; };
    // 取消通过 JavaScript 实现的禁止剪切
    document.oncut = function(event){ event.returnValue=true; };
    document.body.oncut = function(event){ event.returnValue=true; };
    // 取消通过 JavaScript 实现的禁止粘贴
    document.onpaste = function (event) { event.returnValue=true; };
    document.body.onpaste = function (event) { event.returnValue=true; };
    // 取消通过 CSS 实现的禁止选中
    document.body.style.webkitUserSelect = 'auto'; // Firefox
    document.body.style.userSelect = 'auto'; // Chrome
    // 取消通过 JavaScript 实现的禁用快捷键
    function allow_key_event(event) {
        var keyCode = event.keyCode || event.which || event.charCode;
        var ctrlKey = event.ctrlKey || event.metaKey;
        var shiftKey = event.shiftKey;
        if (ctrlKey && (keyCode == 83 || keyCode == 85 || keyCode == 67 || keyCode == 86 || keyCode == 88)) {
            // Ctrl+S (save), Ctrl+U (view-source), Ctrl+C (copy), Ctrl+V (paste), Ctrl+X (cut)
            event.returnValue=true;
        }
        else if (ctrlKey && shiftKey && (keyCode == 73 || keyCode == 74 || keyCode == 67)) {
            // Ctrl+Shift+I (devtools), Ctrl+Shift+J (console), Ctrl+Shift+C (elements)
            event.returnValue=true;
        } else if (keyCode && keyCode == 123) { // F12
            event.returnValue=true;
        }
    }
    document.onkeypress = allow_key_event;
    document.body.onkeypress = allow_key_event;
    document.onkeydown = allow_key_event;
    document.body.onkeydown = allow_key_event;
    document.onkeyup = allow_key_event;
    document.body.onkeyup = allow_key_event;
})();