Skip to content

Instantly share code, notes, and snippets.

@hmans
Last active December 22, 2022 03:11
Show Gist options
  • Select an option

  • Save hmans/eebda20ee21c81ad6811d15739715aaa to your computer and use it in GitHub Desktop.

Select an option

Save hmans/eebda20ee21c81ad6811d15739715aaa to your computer and use it in GitHub Desktop.

Revisions

  1. hmans revised this gist Dec 16, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion mastodon_bookmarklet.md
    Original file line number Diff line number Diff line change
    @@ -14,7 +14,7 @@ Here's how to set it up in Chrome:
    - Right click on it, select "Add Page"
    - Enter any title in the "Name" field
    - Copy the above JavaScript into the "URL" field
    - Don't forget to change the hostname of your instance in the beginning of the script
    - **Important:** Finally, change the hostname of your instance in the beginning of the script!

    Now, whenever you're viewing a user profile or post on a remote Mastodon instance in your browser, hit that bookmarklet, and it will take you back to your home instance, where you can follow or interact with it.

  2. hmans renamed this gist Dec 16, 2022. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. hmans revised this gist Dec 16, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion instructions.md
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,7 @@ All desktop browsers (I think/hope) support bookmarklets -- bookmarks that conta
    The bookmarklet:

    ```js
    var host="mastodon.social";if(document.location.hostname==host){alert("Already on your own instance!")}else{document.location=("https://"+host+"/authorize_interaction?uri="+encodeURIComponent(document.location))}
    javascript:var host="mastodon.social";if(document.location.hostname==host){alert("Already on your own instance!")}else{document.location=("https://"+host+"/authorize_interaction?uri="+encodeURIComponent(document.location))}
    ```

    Here's how to set it up in Chrome:
  4. hmans revised this gist Dec 16, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion instructions.md
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,7 @@ All desktop browsers (I think/hope) support bookmarklets -- bookmarks that conta
    The bookmarklet:

    ```js
    var host = "mastodon.social"; if (document.location.hostname == host) { alert("You're already on your own instance!") } else { document.location=("https://"+host+"/authorize_interaction?uri="+encodeURIComponent(document.location)) }
    var host="mastodon.social";if(document.location.hostname==host){alert("Already on your own instance!")}else{document.location=("https://"+host+"/authorize_interaction?uri="+encodeURIComponent(document.location))}
    ```

    Here's how to set it up in Chrome:
  5. hmans revised this gist Dec 16, 2022. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion instructions.md
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,8 @@ All desktop browsers (I think/hope) support bookmarklets -- bookmarks that conta
    The bookmarklet:

    ```js
    var host = "mastodon.social"; if (document.location.hostname == host) { alert("You're already on your own instance!") } else { document.location=("https://"+host+"/authorize_interaction?uri="+encodeURIComponent(document.location)) }```
    var host = "mastodon.social"; if (document.location.hostname == host) { alert("You're already on your own instance!") } else { document.location=("https://"+host+"/authorize_interaction?uri="+encodeURIComponent(document.location)) }
    ```

    Here's how to set it up in Chrome:

  6. hmans revised this gist Dec 16, 2022. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions instructions.md
    Original file line number Diff line number Diff line change
    @@ -5,8 +5,7 @@ All desktop browsers (I think/hope) support bookmarklets -- bookmarks that conta
    The bookmarklet:

    ```js
    javascript:var host = "mastodon.social"; if (/^https:\/\/${test}/.test(document.location)) { alert("You're already on your own instance!") } else { document.location=("https://"+host+"/authorize_interaction?uri="+encodeURIComponent(document.location)) }
    ```
    var host = "mastodon.social"; if (document.location.hostname == host) { alert("You're already on your own instance!") } else { document.location=("https://"+host+"/authorize_interaction?uri="+encodeURIComponent(document.location)) }```
    Here's how to set it up in Chrome:
  7. hmans revised this gist Dec 16, 2022. 2 changed files with 1 addition and 2 deletions.
    1 change: 0 additions & 1 deletion bookmarklet.js
    Original file line number Diff line number Diff line change
    @@ -1 +0,0 @@
    javascript:var host = "mastodon.social"; if (/^https:\/\/${test}/.test(document.location)) { alert("You're already on your own instance!") } else { document.location=("https://"+host+"/authorize_interaction?uri="+encodeURIComponent(document.location)) }
    2 changes: 1 addition & 1 deletion instructions.md
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,7 @@ The bookmarklet:
    javascript:var host = "mastodon.social"; if (/^https:\/\/${test}/.test(document.location)) { alert("You're already on your own instance!") } else { document.location=("https://"+host+"/authorize_interaction?uri="+encodeURIComponent(document.location)) }
    ```

    Here's how to create one in Chrome:
    Here's how to set it up in Chrome:

    - Make sure your bookmarks bar is visible (Ctrl-Shift-B in Windows and Linux, Cmd-Shift-B in macOS)
    - Right click on it, select "Add Page"
  8. hmans revised this gist Dec 16, 2022. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions instructions.md
    Original file line number Diff line number Diff line change
    @@ -2,6 +2,12 @@

    All desktop browsers (I think/hope) support bookmarklets -- bookmarks that contain JavaScript code which is run when you select them. **This bookmarklet makes it easier to follow users or interact with toots from other Mastodon instances** by passing their URLs back to your home instance, where you can then follow/interact with them normally.

    The bookmarklet:

    ```js
    javascript:var host = "mastodon.social"; if (/^https:\/\/${test}/.test(document.location)) { alert("You're already on your own instance!") } else { document.location=("https://"+host+"/authorize_interaction?uri="+encodeURIComponent(document.location)) }
    ```

    Here's how to create one in Chrome:

    - Make sure your bookmarks bar is visible (Ctrl-Shift-B in Windows and Linux, Cmd-Shift-B in macOS)
  9. hmans revised this gist Dec 16, 2022. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions instructions.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    # Mastodon Follow/Interact Bookmarklet

    All desktop browsers (I think/hope) support bookmarklets -- bookmarks that contain JavaScript code which is run when you select them. **This bookmarklet makes it easier to follow users or interact with toots from other Mastodon instances** by passing their URLs back to your home instance, where you can then follow/interact with them normally.

    Here's how to create one in Chrome:
  10. hmans revised this gist Dec 16, 2022. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions instructions.md
    Original file line number Diff line number Diff line change
    @@ -8,6 +8,8 @@ Here's how to create one in Chrome:
    - Copy the above JavaScript into the "URL" field
    - Don't forget to change the hostname of your instance in the beginning of the script

    Now, whenever you're viewing a user profile or post on a remote Mastodon instance in your browser, hit that bookmarklet, and it will take you back to your home instance, where you can follow or interact with it.

    Enjoy!

    [@hmans@norden.social](https://norden.social/@hmans)
  11. hmans revised this gist Dec 16, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion instructions.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    All desktop browsers (I think/hope) support bookmarklets -- bookmarks that contain JavaScript code which is run when you select them. This bookmarklet makes it easier to follow users or interact with toots from other Mastodon instances by passing their URLs back to your home instance, where you can then follow/interact with them normally.
    All desktop browsers (I think/hope) support bookmarklets -- bookmarks that contain JavaScript code which is run when you select them. **This bookmarklet makes it easier to follow users or interact with toots from other Mastodon instances** by passing their URLs back to your home instance, where you can then follow/interact with them normally.

    Here's how to create one in Chrome:

  12. hmans revised this gist Dec 16, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion instructions.md
    Original file line number Diff line number Diff line change
    @@ -10,4 +10,4 @@ Here's how to create one in Chrome:

    Enjoy!

    [@hmans@norden.social](https://norden.social/@hmans)
    [@hmans@norden.social](https://norden.social/@hmans)
  13. hmans revised this gist Dec 16, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion instructions.md
    Original file line number Diff line number Diff line change
    @@ -10,4 +10,4 @@ Here's how to create one in Chrome:

    Enjoy!

    - [@hmans@norden.social](https://norden.social/@hmans)
    [@hmans@norden.social](https://norden.social/@hmans)
  14. hmans revised this gist Dec 16, 2022. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion instructions.md
    Original file line number Diff line number Diff line change
    @@ -8,4 +8,6 @@ Here's how to create one in Chrome:
    - Copy the above JavaScript into the "URL" field
    - Don't forget to change the hostname of your instance in the beginning of the script

    Enjoy!
    Enjoy!

    - [@hmans@norden.social](https://norden.social/@hmans)
  15. hmans created this gist Dec 16, 2022.
    1 change: 1 addition & 0 deletions bookmarklet.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    javascript:var host = "mastodon.social"; if (/^https:\/\/${test}/.test(document.location)) { alert("You're already on your own instance!") } else { document.location=("https://"+host+"/authorize_interaction?uri="+encodeURIComponent(document.location)) }
    11 changes: 11 additions & 0 deletions instructions.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    All desktop browsers (I think/hope) support bookmarklets -- bookmarks that contain JavaScript code which is run when you select them. This bookmarklet makes it easier to follow users or interact with toots from other Mastodon instances by passing their URLs back to your home instance, where you can then follow/interact with them normally.

    Here's how to create one in Chrome:

    - Make sure your bookmarks bar is visible (Ctrl-Shift-B in Windows and Linux, Cmd-Shift-B in macOS)
    - Right click on it, select "Add Page"
    - Enter any title in the "Name" field
    - Copy the above JavaScript into the "URL" field
    - Don't forget to change the hostname of your instance in the beginning of the script

    Enjoy!