Skip to content

Instantly share code, notes, and snippets.

@triptych
Forked from kentbrew/tootski.md
Created December 24, 2022 21:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save triptych/202bd7cd9eaf84e12dc33b331a7f71cd to your computer and use it in GitHub Desktop.
Save triptych/202bd7cd9eaf84e12dc33b331a7f71cd to your computer and use it in GitHub Desktop.
Tootski, a sharing bookmarklet for Mastodon

Tootski, a sharing bookmarklet for Mastodon

Tootski is a bookmarklet that will share the page you're on to your Mastodon instance, including the title, address, and any text you may have selected.

Before You Begin

You need to know the name of your Mastodon instance if it's not mastodon.social. To find it, visit your home page on Mastodon and copy out the part between the second and third slash. My home URL looks like this:

https://xoxo.zone/@kentbrew

... so I'm going to use xoxo.zone. I'm going to be careful here to only copy over the https:// part or any slashes, just the name!

For Firefox, Chrome, Edge, Opera, and Everybody Else Except Safari

Right-click your bookmarks bar and choose New Bookmarklet (Firefox) or Add Page (Chrome, Edge, Opera)

In Name, put this:

Tootski

In URL, put this:

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("\n\n")}${e(d.URL)}`,'_blank')}(window,document,encodeURIComponent,'mastodon.social')));

Before you save, be sure to change where it says mastodon.social at the end of the JavaScript to the name of your instance. You may need to scroll right to see it; it's at the very end.

For My Little Special Friend Safari:

  • if you don't see your bookmarks bar, choose Show Favorites Bar under View, main menu
  • open about:blank in a new window (otherwise your new bookmarklet will have the favicon of whatever page you're on right now)
  • hit command-D to start a new bookmarklet
  • choose Favorites under Add this page to:
  • enter Tootski in the Name box and click Add; a new bookmarklet should appear
  • right-click your new bookmarklet and choose Edit Address
  • paste in the JavaScript from above, with the instance name fixed up.

Mobile Devices?

This may very well work as an IOS shortcut; I have not tried it yet.

Thank You

Happy tooting! If you need help with this, please catch me at https://xoxo.zone/@kentbrew.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment