Created
May 12, 2017 02:40
-
-
Save hyuki0000/3186540cad7c71f6c67f0a0e73d11b6b to your computer and use it in GitHub Desktop.
RemoteFollowBookmarklet.js - Jump to the mastodon user's remote_follow page.
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
/* | |
* RemoteFollowBookmarklet.js | |
* | |
* When you see | |
* https://mastodon.example.com/@exampleuser | |
* or | |
* https://mastodon.example.com/users/exampleuser/... | |
* Then you jump to | |
* https://mastodon.example.com/users/exampleuser/remote_follow | |
*/ | |
function start() { | |
if (location.href.match(/(https?:\/\/.*)\/@(.+)/) || location.href.match(/(https?:\/\/.*)\/users\/([^/]+)/)) { | |
var prefix = RegExp.$1; | |
var username = RegExp.$2; | |
location = prefix + '/users/' + username + '/remote_follow'; | |
} else { | |
alert("Error."); | |
} | |
} | |
start(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment