Last active
          September 20, 2024 07:01 
        
      - 
      
- 
        Save bramus/d8bce55dab1881cde18aa2169c66ac33 to your computer and use it in GitHub Desktop. 
Revisions
- 
        bramus revised this gist Nov 25, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewingThis 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 charactersOriginal file line number Diff line number Diff line change @@ -1 +1 @@ 🚚 The bookmarklet has moved to [https://github.com/bramus/mastodon-profile-redirect/](https://github.com/bramus/mastodon-profile-redirect/) 
- 
        bramus revised this gist Nov 24, 2022 . 2 changed files with 1 addition and 36 deletions.There are no files selected for viewingThis 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 charactersOriginal file line number Diff line number Diff line change @@ -1,36 +0,0 @@ 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ 🚚 The bookmarklet has moved to [https://github.com/bramus/mastodon-profile-redirect/tree/main/bookmarklet](https://github.com/bramus/mastodon-profile-redirect/tree/main/bookmarklet) 
- 
        bramus revised this gist Nov 23, 2022 . 1 changed file with 13 additions and 10 deletions.There are no files selected for viewingThis 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 charactersOriginal file line number Diff line number Diff line change @@ -6,28 +6,31 @@ javascript:(function(){ /* Profile with a moved banner (e.g. https://mastodon.social/@bramus): follow that link */ const userNewProfile = document.querySelector('.moved-account-banner .button')?.getAttribute('href'); if (userNewProfile) { return userNewProfile.substring(2); } /* Profile page, e.g. https://fediverse.zachleat.com/@zachleat and https://front-end.social/@mia */ const userFromProfilePage = document.querySelector('meta[property="profile:username"]')?.getAttribute('content'); if (userFromProfilePage) { /* Don’t return if already watching on own LOCAL_DOMAIN instance */ if (window.location.host === MY_MASTO_LOCAL_DOMAIN) return null; return userFromProfilePage; }; /* Message detail, e.g. https://front-end.social/@mia/109348973362020954 and https://bell.bz/@andy/109392510558650993 and https://bell.bz/@andy/109392510558650993 */ const userFromDetailPage = document.querySelector('.detailed-status .display-name__account')?.innerText; if (userFromDetailPage) return userFromDetailPage.substring(1); return null; }; let user = tryAndGetUserName(); if (!user) return; /* Trim off @domain suffix in case it matches with MY_MASTO_LOCAL_DOMAIN. This due to https://github.com/mastodon/mastodon/issues/21469 */ if (user.endsWith(`@${MY_MASTO_LOCAL_DOMAIN}`)) { user = user.substring(0, user.length - `@${MY_MASTO_LOCAL_DOMAIN}`.length); } window.location.href = `https://${MY_MASTO_WEB_DOMAIN}/@${user}`; })(); 
- 
        bramus revised this gist Nov 23, 2022 . 1 changed file with 27 additions and 4 deletions.There are no files selected for viewingThis 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 charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,33 @@ javascript:(function(){ const MY_MASTO_LOCAL_DOMAIN = 'front-end.social'; /* 👈 Change this value */ const MY_MASTO_WEB_DOMAIN = MY_MASTO_LOCAL_DOMAIN; /* 👈 Only change this value if your Masto host is hosted an different domain than the LOCAL_DOMAIN */ function tryAndGetUserName() { /* Profile with a moved banner (e.g. https://mastodon.social/@bramus): follow that link */ const userNewProfile = document.querySelector('.moved-account-banner .button')?.getAttribute('href'); if (userNewProfile) { /* Trim off @domain suffix in case it matches with MY_MASTO_LOCAL_DOMAIN. This due to https://github.com/mastodon/mastodon/issues/21469 */ if (userNewProfile.endsWith(`@${MY_MASTO_LOCAL_DOMAIN}`)) { return userNewProfile.substring(2, userNewProfile.length - `@${MY_MASTO_LOCAL_DOMAIN}`.length); } return userNewProfile.substring(2); } /* Profile, viewed on other host, e.g. https://fediverse.zachleat.com/@zachleat */ const userFromProfilePage = document.querySelector('meta[property="profile:username"]')?.getAttribute('content'); if (userFromProfilePage) return userFromProfilePage; /* Message detail, e.g. https://bell.bz/@andy/109392510558650993 and https://bell.bz/@andy/109392510558650993 */ const userFromDetailPage = document.querySelector('.detailed-status .display-name__account')?.innerText; if (userFromDetailPage) return userFromDetailPage.substring(1); return null; }; /* if (window.location.host === MY_MASTO_WEB_DOMAIN) return; */ const user = tryAndGetUserName(); if (!user) return; window.location.href = `https://${MY_MASTO_WEB_DOMAIN}/@${user}`; })(); 
- 
        bramus created this gist Nov 21, 2022 .There are no files selected for viewingThis 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ javascript:(function(){ const MY_MASTO_HOST = 'front-end.social'; if (window.location.host === MY_MASTO_HOST) return; const user = document.querySelector('meta[property="profile:username"]')?.getAttribute('content'); if (!user) return; window.location.href = `https://${MY_MASTO_HOST}/@${user}`; })();