Force Enable Text Copying

Force-enables text copying, even on sites that disable it.

  1. // ==UserScript==
  2. // @name Force Enable Text Copying
  3. // @version 0.2
  4. // @description Force-enables text copying, even on sites that disable it.
  5. // @author You (or your name/handle)
  6. // @namespace https://viayoo.com/ (or your personal URL)
  7. // @match https://*/*
  8. // @grant none
  9. // @run-at document-end
  10. // @icon https://hermit.chimbori.com/config/userscripts/content-copy.svg
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. // Select all elements on the page
  17. const allElements = document.querySelectorAll('*');
  18.  
  19. // Loop through each element
  20. allElements.forEach(el => {
  21. // Force enable text selection using CSS user-select properties
  22. // Apply multiple versions for cross-browser compatibility
  23. try {
  24. el.style.webkitUserSelect = 'text'; /* Chrome, Safari, Opera */
  25. el.style.mozUserSelect = 'text'; /* Firefox */
  26. el.style.msUserSelect = 'text'; /* Internet Explorer/Edge (older) */
  27. el.style.userSelect = 'text'; /* Standard */
  28. } catch (e) {
  29. // Ignore errors (e.g., trying to style elements that don't support it)
  30. // console.error('Could not apply user-select:', el, e); // Uncomment for debugging
  31. }
  32. });
  33.  
  34. })();