Skip to content

Instantly share code, notes, and snippets.

@nissoh
Created March 4, 2018 15:16
Show Gist options
  • Save nissoh/b232200635d17e5ad81d16f82ead6bae to your computer and use it in GitHub Desktop.
Save nissoh/b232200635d17e5ad81d16f82ead6bae to your computer and use it in GitHub Desktop.
nano watch deposit alarm https://nanowat.ch/account/xrb_3jwrszth46rk1mu7rmb4rhm54us8yg1gw3ipodftqtikf5yqdyr7471nsg1k - run this script in your developer tools
const compose = (f, g) => (x) => f(g(x))
const getAmountAndSliceMxrbStr = ev => ev.querySelector('.amount').textContent.slice(0, -5).split(',').join('')
const play = (url) => new Audio(url).play()
const soundChaChing = () => play('http://soundbible.com/mp3/Cha_Ching_Register-Muska666-173262285.mp3')
const roundIt = compose(Math.round,
compose(Number,
getAmountAndSliceMxrbStr))
document.body.querySelector('#app > div > div > div > div:nth-child(2) > div:nth-child(1) > div').addEventListener ("DOMNodeInserted", (ev) => {
const amount = roundIt(ev.target)
if (amount > 0) console.log(amount)
if (amount > 5000) {
soundChaChing()
// console.log(amount)
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment