Created
May 24, 2024 10:18
-
-
Save mogita/d544213732a1f8eac380fbda7203e998 to your computer and use it in GitHub Desktop.
Share to mastodon bookmarklet with commet placeholder
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
// Usage: | |
// - copy the minified line of code | |
// - replace the mastodon domain name near the end of the code with your instance | |
// - create a new bookmark in your browser and paste the whole code to the URL input box | |
// - click on the bookmark to share the current page | |
// - (optional) feel free to tweak the format of the shared text if you know some JavaScript | |
// minified | |
javascript:void((function(w,d,e,i){s=w.getSelection().toString();t=e(s?s+"\n\n":"");w.open(`https://${i}/share?text=${t}${e(d.title)}${e(" ")}${e(d.URL)}${e("\n\n// ")}`,'_blank')}(window,document,encodeURIComponent,'mastodon.social'))); | |
// beautified | |
javascript: void((function(w, d, e, i) { | |
s = w.getSelection().toString(); | |
t = e(s ? s + "\n\n" : ""); | |
w.open(`https://${i}/share?text=${t}${e(d.title)}${e(" ")}${e(d.URL)}${e("\n\n// ")}`, '_blank') | |
}(window, document, encodeURIComponent, 'mastodon.social'))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment