Created
October 13, 2025 15:29
-
-
Save JoeGlines/091b463775466d6e1e8d572025202522 to your computer and use it in GitHub Desktop.
automaticlly backup an edit field on your browser
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function() | |
{if(window.__grabberInstalled) | |
{alert('Auto-grabber already running!');return;}function activeEl(doc) | |
{doc=doc||document;let el=doc.activeElement;if(el&&el.shadowRoot) | |
{el=el.shadowRoot.activeElement||el;}if(el&&el.tagName==='IFRAME') | |
{try | |
{return activeEl(el.contentDocument)||el;}catch(e) | |
{}}return el;}async function copyNow() | |
{let el=activeEl();let txt='';if(!el) | |
{return;}if(el.isContentEditable) | |
{txt=el.innerText||el.textContent||'';}else if('value'in el) | |
{txt=el.value;}if(!txt) | |
{txt=String(getSelection&&getSelection()||'');}if(txt) | |
{try | |
{await navigator.clipboard.writeText(txt);console.log('Auto-copied:',txt.substring(0,50)+'...');}catch(e) | |
{console.log(e);}}}window.__grabberInterval=setInterval(copyNow,3000);window.__grabberInstalled=true;alert('Auto-grabber running! Copying every 3 seconds. \n\nRefresh page to stop.');})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment