Last active
April 3, 2018 08:08
-
-
Save lucahammer/c2b23ced71198c9b292327efa6ea05bf to your computer and use it in GitHub Desktop.
Typo Bookmarklets
This file contains 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
// Copy a zero width whitespace to the clipboard | |
// Adds a element to the document, selects it, adds it to the clipboard and removes it | |
// Source: https://stackoverflow.com/questions/5046972/copy-text-to-clipboard-from-bookmarklet | |
javascript:!function(a){var b=document.createElement("textarea"),c=document.getSelection();b.textContent=a,document.body.appendChild(b),c.removeAllRanges(),b.select(),document.execCommand("copy"),c.removeAllRanges(),document.body.removeChild(b)}(""); | |
// Add Proper Quotation Marks | |
// Adds quotations marks around selected text | |
// Source https://stackoverflow.com/questions/40584878/how-to-create-a-js-bookmarklet-to-insert-fixed-text-at-cursor-position | |
javascript:(function(a){a.value=a.value.slice(0,a.selectionStart)+"„"+a.value.slice(a.selectionStart,a.selectionEnd)+"“"+a.value.slice(a.selectionEnd);})(document.activeElement); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment