Skip to content

Instantly share code, notes, and snippets.

@aznnico
Created August 10, 2025 07:10
Show Gist options
  • Save aznnico/b45ef0374fa2f394d64d24c65c7f4dbe to your computer and use it in GitHub Desktop.
Save aznnico/b45ef0374fa2f394d64d24c65c7f4dbe to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Chatgpt enable left click highlight
// @namespace chatgpt
// @version 1.0
// @description Re-enable text selection and copying
// @author s2k
// @match https://chatgpt.com/*
// @grant none
// @run-at document-idle
// ==/UserScript==
(function() {
'use strict';
try {
if (document.getElementById('enable-select-style')) { alert('EnableSelect already applied'); return; }
var s = document.createElement('style');
s.id = 'enable-select-style';
s.textContent = '*{user-select:text!important;-webkit-user-select:text!important;-moz-user-select:text!important;-ms-user-select:text!important;-webkit-touch-callout:default!important} ::selection{background:rgba(180,200,255,0.6)!important}';
document.head.appendChild(s);
} catch (e) {}
function recurse(root) {
try {
var nodes = (root.shadowRoot ? root.shadowRoot : root).querySelectorAll('*');
for (var i = 0; i < nodes.length; i++) {
var el = nodes[i];
try {
el.onselectstart = null;
el.onmousedown = null;
el.onmouseup = null;
el.style && (el.style.userSelect = 'text');
el.style && (el.style.webkitUserSelect = 'text');
} catch (e) {}
if (el.shadowRoot) recurse(el);
}
} catch (e) {}
}
recurse(document);
Array.from(document.querySelectorAll('body *')).forEach(function(el) {
try {
var cs = getComputedStyle(el);
var r = el.getBoundingClientRect();
var z = parseInt(cs.zIndex) || 0;
if (z >= 1000 && r.width >= window.innerWidth * 0.9 && r.height >= window.innerHeight * 0.9 && cs.pointerEvents !== 'none') {
el.style.pointerEvents = 'none';
el.style.userSelect = 'text';
}
} catch (e) {}
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment