Copy & Select Unlocker

Unblock text selection, copy, right‑click but leave video clicks intact

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         Copy & Select Unlocker
// @namespace    http://shinobu-scripts.local/
// @version      2.2
// @description  Unblock text selection, copy, right‑click but leave video clicks intact
// @author       Shinobu
// @match        *://*/*
// @run-at       document-end
// @license      GPLv3
// ==/UserScript==

(function() {
  'use strict';

  function injectSelectionStyles() {
    const css = `
      * { user-select: text !important; -webkit-user-select: text !important; }
      [style*="user-select: none"] { user-select: text !important; }
    `;
    const s = document.createElement('style');
    s.textContent = css;
    document.head.appendChild(s);
  }

  function removeOverlays() {
    document.querySelectorAll('div, section').forEach(el => {
      if (el.querySelector('video')) return;        // don’t touch video holders
      const st = getComputedStyle(el);
      const z = parseInt(st.zIndex, 10) || 0;
      if ((st.position==='fixed'||st.position==='absolute') &&
          z > 1000 &&
          el.offsetWidth >= innerWidth * .9 &&
          el.offsetHeight>= innerHeight * .9) {
        el.style.pointerEvents = 'none';           // let clicks pass through
      }
    });
  }

  function observeOverlays() {
    const mo = new MutationObserver(removeOverlays);
    mo.observe(document, { childList: true, subtree: true });
    removeOverlays();
  }

  function restoreEvents() {
    ['onselectstart','onmousedown','ondragstart'].forEach(e => { document[e]=null; });
    if (window.getSelection().empty) window.getSelection().empty = ()=>{};
  }

  function stopProp(e) { e.stopImmediatePropagation(); }

  function init() {
    injectSelectionStyles();
    ['contextmenu','selectstart','copy'].forEach(evt=>{
      document.addEventListener(evt, stopProp, true);
    });
    document.addEventListener('keydown', e => {
      if ((e.ctrlKey||e.metaKey) && e.key==='c') e.stopImmediatePropagation();
    }, true);
    restoreEvents();
    observeOverlays();
    console.log('Copy & Select Unlocker v2.2 running');
  }

  if (document.readyState==='loading')
    window.addEventListener('load', init);
  else init();
})();