Created
November 10, 2022 03:09
-
-
Save keithn/3f78041631a1bdcf9adb174eaae5ce38 to your computer and use it in GitHub Desktop.
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
// ==UserScript== | |
// @name Tooting on Mastodon | |
// @namespace Violentmonkey Scripts | |
// @match https://mastodon.nz/* | |
// @grant none | |
// @version 1.0 | |
// @author Keith Nicholas | |
// @description 10/11/2022, 3:42:31 pm | |
// ==/UserScript== | |
console.log('make tooting sounds...') | |
function tooting() { | |
let buttonTags = [].slice.call(document.getElementsByClassName("button")); | |
console.log(buttonTags) | |
let toot = buttonTags.find(t => t.textContent == 'Toot!') | |
if(toot) toot.addEventListener('click', function(){ new Audio('https://soundbible.com/mp3/Bike%20Horn-SoundBible.com-602544869.mp3').play()}, false); | |
} | |
if(window.onload) { | |
let currentOnLoad = window.onload; | |
let newOnload = function(evt) { | |
currentOnLoad(evt); | |
tooting(); | |
}; | |
window.onload = newOnload; | |
} else { | |
window.onload = tooting; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment