Last active
January 2, 2024 17:08
-
-
Save mvark/b3b681c8f64c653c032bf1bba060f442 to your computer and use it in GitHub Desktop.
This is compact code version of Snippets Bookmarklet that saves snippets you need with custom names & retrieves them with a single click
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(){function g(t){return prompt(t)}d=localStorage;a=g('Enter "get" or "set": ');if(a=="get"){k=d.length?[...Array(d.length)].map(i=>d.key(i)).filter(k=>k.startsWith('z_')):[];k=g("Keys: "+k+"\nEnter key:");if(d.getItem(k))document.getElementById("prompt-textarea").value=d.getItem(k);else alert("Key does not exist!")}else if(a=="set"){k="z_"+g("Enter new key: ");v=g("Enter value to store:");d.setItem(k,v)}else alert("Invalid action")})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment