Created
June 23, 2020 06:26
-
-
Save nawada/2a05cef44128d0c908568fd3524cb648 to your computer and use it in GitHub Desktop.
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
var newUrl=new URL(location); | |
newUrl.hash=`:~:text=${encodeURIComponent(getSelection().toString())}`; | |
var input=document.createElement('input'); | |
input.value=newUrl; | |
document.querySelector('body').appendChild(input); | |
input.select(); | |
document.execCommand('copy'); | |
input.remove(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment