您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Force-enable text copying across more browsers
- // ==UserScript==
- // @name Force Text Copying Enhanced
- // @namespace https://viayoo.com/
- // @version 0.2
- // @description Force-enable text copying across more browsers
- // @author You
- // @run-at document-end
- // @match https://*/*
- // @grant none
- // ==/UserScript==
- (function() {
- 'use strict';
- // Apply user-select: text to all elements with different prefixes and standard property
- document.querySelectorAll("*").forEach(function(el) {
- el.style.webkitUserSelect = 'text'; // For WebKit browsers (Chrome, Safari) [cite: 2]
- el.style.mozUserSelect = 'text'; // For Firefox
- el.style.msUserSelect = 'text'; // For Internet Explorer/Edge (older versions)
- el.style.userSelect = 'text'; // Standard property
- });
- // --- Optional: Attempt to re-enable copy/cut events ---
- // This part is more complex and might not work on all sites or could cause unintended side effects.
- // Use with caution and test thoroughly.
- /*
- document.addEventListener('copy', enableCopy);
- document.addEventListener('cut', enableCopy);
- document.addEventListener('selectstart', enableCopy);
- function enableCopy(e) {
- e.stopPropagation(); // Stop the event from propagating up the DOM tree
- // In some cases, you might need to explicitly set the clipboard data,
- // but stopping propagation is often enough to prevent sites from blocking the default action.
- }
- */
- })();