NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @namespace https://openuserjs.org/users/mfluehr // @name Add Podomatic Keyboard Controls // @description Adds keyboard shortcut keys to podomatic.com. Use Space to play/pause. Use M to mute/unmute. // @license MIT // @version 1.0.0 // @match *://*.podomatic.com/* // @run-at document-start // @grant none // ==/UserScript== // ==OpenUserJS== // @author mfluehr // ==/OpenUserJS== function mute() { const $mute = document.querySelector('.volume_mute'); $mute.click(); } function play() { const $play = document.querySelector('.audio_play'); $play.click(); } const fns = new Map([ ['Space', play], ['KeyM', mute] ]); document.addEventListener('keydown', e => { const player = document.querySelector('.homebase_controls'); if (player && fns.has(e.code)) { e.preventDefault(); } }); document.addEventListener('keyup', e => { const player = document.querySelector('.homebase_controls'); if (player && fns.has(e.code)) { e.preventDefault(); fns.get(e.code)(); } });