Meh-rathon countdown alarm {Unofficial}
3If you’re a Meh-RATHON nerd like me (GOT MY Fukobukuro, WOOT! get it? woot?), and want an actual audible alarm to go off when meh changes the product, open the browser console on the meh page, then copy/paste this snippet into it:
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
clear(); | |
var cdSettings = { | |
debug: true, | |
evt: null, | |
audio: null, | |
audioUrl: 'https://jtsternberg.com/file-drop/analog-watch-alarm_daniel-simion.mp3', | |
secondsLeft: 0, | |
timeLeft: 0, | |
log: true, | |
alarming: false, | |
listener: evt => { | |
cdSettings.evt = evt; | |
cdSettings.timeLeft = evt.strftime('%N%S'); | |
cdSettings.secondsLeft = parseInt( cdSettings.timeLeft, 10 ); | |
if ( cdSettings.debug ) { | |
console.log({cdSettings}); | |
} | |
if ( cdSettings.log ) { | |
console.log(cdSettings.secondsLeft); | |
} | |
if ( cdSettings.secondsLeft < 10 ) { | |
if ( ! cdSettings.alarming ) { | |
cdSettings.audio = cdSettings.audio || new Audio(cdSettings.audioUrl); | |
cdSettings.audio.play(); | |
} | |
cdSettings.alarming = true; | |
} else { | |
cdSettings.alarming = false; | |
} | |
cdSettings.debug = false; | |
}, | |
play: () => { | |
cdSettings.audio = cdSettings.audio || new Audio(cdSettings.audioUrl); | |
cdSettings.audio.play(); | |
}, | |
pause: () => { | |
cdSettings.audio = cdSettings.audio || new Audio(cdSettings.audioUrl); | |
cdSettings.audio.pause(); | |
}, | |
}; | |
console.log('testing sound...'); | |
setTimeout( () => { | |
cdSettings.play(); | |
setTimeout( () => { | |
cdSettings.pause(); | |
console.log('test complete...'); | |
}, 800 ); | |
}, 200 ); | |
jQuery('#countdown').on('update.countdown', cdSettings.listener); |
(Keep in mind, they refresh the page when the timer runs out, so you’ll have to re-paste/start this snippet each time the product changes)
Standard Disclaimer: I accept no liability if your browser/computer/house explodes as a result of running this code. Also, I can’t fix your printer. (also, don’t tell meh about this )