您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
深度解除网页复制内容限制 智能恢复右键菜单/文本选择/剪贴板操作/拖拽功能
当前为
- // ==UserScript==
- // @name 网页限制解除器
- // @description 深度解除网页复制内容限制 智能恢复右键菜单/文本选择/剪贴板操作/拖拽功能
- // @version 1.0.1
- // @author 念柚
- // @namespace https://github.com/MiPoNianYou/UserScripts
- // @license GPL-3.0
- // @match *://*/*
- // @grant none
- // @run-at document-start
- // ==/UserScript==
- class CopyRestrictionRemover {
- constructor() {
- this.InitializeObserver();
- this.ExecuteCoreFeatures();
- }
- ExecuteCoreFeatures() {
- this.RemoveEventListeners(document);
- this.RemoveEventListeners(document.body);
- this.InjectLiberationStyles();
- this.BindGlobalEventHandlers();
- this.ProcessExistingElements();
- }
- BindGlobalEventHandlers() {
- const EventConfigurations = [
- ['contextmenu', this.HandleContextMenu],
- ['selectstart', this.HandleSelection],
- ['copy', this.HandleClipboard],
- ['cut', this.HandleClipboard],
- ['paste', this.HandleClipboard]
- ];
- EventConfigurations.forEach(([eventType, handler]) => {
- document.addEventListener(eventType, handler.bind(this), true);
- });
- }
- HandleContextMenu(event) {
- event.stopPropagation();
- return true;
- }
- HandleSelection(event) {
- event.stopPropagation();
- return true;
- }
- HandleClipboard(event) {
- event.stopPropagation();
- return true;
- }
- InjectLiberationStyles() {
- const StyleDeclaration = `
- * {
- -webkit-user-select: text !important;
- -moz-user-select: text !important;
- -ms-user-select: text !important;
- user-select: text !important;
- -webkit-user-drag: auto !important;
- -moz-user-drag: auto !important;
- user-drag: auto !important;
- }
- `;
- const StyleElement = document.createElement('style');
- StyleElement.textContent = StyleDeclaration;
- document.head.appendChild(StyleElement);
- }
- ProcessExistingElements() {
- document.querySelectorAll('*').forEach(element => {
- this.RemoveEventListeners(element);
- });
- }
- RemoveEventListeners(element) {
- if (!element) return;
- const RestrictedProperties = [
- 'oncontextmenu', 'onselectstart',
- 'oncopy', 'oncut', 'onpaste',
- 'ondrag', 'ondragstart'
- ];
- RestrictedProperties.forEach(property => {
- element[property] = null;
- });
- }
- InitializedMutationHandler(mutationsList) {
- for (const mutation of mutationsList) {
- if (mutation.type === 'childList') {
- mutation.addedNodes.forEach(node => {
- if (node.nodeType === Node.ELEMENT_NODE) {
- this.RemoveEventListeners(node);
- node.querySelectorAll('*').forEach(child => {
- this.RemoveEventListeners(child);
- });
- }
- });
- }
- }
- }
- InitializeObserver() {
- this.DomObserver = new MutationObserver(this.InitializedMutationHandler.bind(this));
- this.DomObserver.observe(document.documentElement, {
- childList: true,
- subtree: true,
- attributes: false,
- characterData: false
- });
- }
- }
- new CopyRestrictionRemover();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址