-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmastodon-publish-button.user.js
48 lines (38 loc) · 1.65 KB
/
mastodon-publish-button.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// ==UserScript==
// @name Mastodon - Publish-button
// @namespace https://github.com/phpmacher/mastodon-publish-button/
// @downloadURL https://github.com/phpmacher/mastodon-publish-button/mastodon-publish-button.user.js
// @updateURL https://github.com/phpmacher/mastodon-publish-button/mastodon-publish-button.user.js
// @version 0.2
// @description rename publish button back to trööt (or toot or to whatever)
// @author @phpmacher@sueden.social
// @license MIT
// @match https://sueden.social/*
// @match https://chaos.social/*
// @match https://mastodon.social/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @run-at document-idle
// ==/UserScript==
(function() {
'use strict';
function setButton(container) {
// Edit this variable to change the text of the publish-button
var buttonText = 'Tröt!';
if (container.innerHTML != buttonText) {
container.innerHTML = buttonText;
}
}
window.addEventListener('load', function() {
var container = document.querySelector(".compose-form__publish-button-wrapper .button.button--block");
// initial renaming
setButton(container);
// monitor the button
var dom_observer = new MutationObserver(function(mutation) {
// if change is detected, set button-name again
setButton(container);
});
// config observer and start it
var config = { attributes: false, childList: false, characterData: true, subtree: true};
dom_observer.observe(container, config);
}, false);
})();