Created
March 1, 2024 09:22
-
-
Save ewels/8815c45f31cf13e6c4305fdd01a2fee0 to your computer and use it in GitHub Desktop.
StreamYard UserScript to add missing hotkeys
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 StreamYard overlay/music hotkeys | |
// @namespace https://phil.ewels.co.uk/ | |
// @version 2024-02-29 | |
// @description Add missing hotkeys for StreamYard | |
// @author Phil Ewels | |
// @match https://streamyard.com/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=streamyard.com | |
// @grant none | |
// ==/UserScript== | |
// Edit as appropriate for your music / overlay names | |
// - NB: All shortcut keys have SHIFT added | |
// - NB: Take visible text from buttons, then add ` music` | |
// for background music or ` overlay` for overlays. | |
const shortcut_keys = [ | |
["M", "Feeding the ducks music"], | |
["Q", "podcast_start_screen overlay"], | |
["W", "podcast_overlay overlay"], | |
["E", "podcast_end_screen overlay"], | |
]; | |
function findAndClickButton(labelText) { | |
var buttonElement = document.querySelector('button[aria-label="' + labelText + '"]'); | |
if (!buttonElement) { | |
alert("Button with label '" + labelText + "' not found."); | |
return; | |
} else { | |
buttonElement.click(); | |
} | |
} | |
(function() { | |
'use strict'; | |
shortcut_keys.forEach(([key, labelText]) => { | |
document.addEventListener('keydown', function(event) { | |
if (event.shiftKey && event.key === key) { | |
findAndClickButton(labelText); | |
} | |
}); | |
}); | |
})(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment