Created
March 1, 2023 15:45
-
-
Save orllewin/4d2ffada0c8ff370d345c45b5c524d0f to your computer and use it in GitHub Desktop.
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
| // ==UserScript== | |
| // @name Mastodon: Keep Local Feed Quieter | |
| // @namespace http://tampermonkey.net/ | |
| // @version 0.1 | |
| // @description Stop publicly replying to your own posts on Mastodon. | |
| // @author Orllewin | |
| // @match https://merveilles.town/* | |
| // @icon https://www.google.com/s2/favicons?sz=64&domain=merveilles.town | |
| // @grant none | |
| // ==/UserScript== | |
| (function() { | |
| 'use strict'; | |
| console.log("Mastodon: Keep Local Feed Quieter") | |
| document.addEventListener('click', function(event) { | |
| if(event.target.className == "button button--block"){ | |
| const greatGrandparent = event.target.parentNode.parentNode.parentNode | |
| if(greatGrandparent.className == "compose-form"){ | |
| const privacyButton = document.getElementsByClassName("privacy-dropdown__value-icon")[0] | |
| if(privacyButton.innerHTML.includes("fa-globe")){ | |
| const displayNameElement = document.getElementsByClassName("reply-indicator__display-name")[0] | |
| const replyingToAccountNameElement = displayNameElement.getElementsByClassName("display-name__account")[0] | |
| const replyToName = replyingToAccountNameElement.innerHTML.substring(1) | |
| var currentUser = document.head.querySelector("[property~='profile:username'][content]").content | |
| currentUser = currentUser.substring(0, currentUser.indexOf("@")) | |
| if(replyToName === currentUser){ | |
| event.stopPropagation() | |
| event.preventDefault() | |
| alert("Use unlisted when replying to yourself.") | |
| } | |
| } | |
| } | |
| } | |
| }, true) | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment