Last active
August 27, 2017 13:00
-
-
Save MighteeCactus/08f5750ad105b7ca695db52fca7c9324 to your computer and use it in GitHub Desktop.
Quick hack for google translate service to train listening of numbers in foreign language
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
function sayMeRandNum(min, max) | |
{ | |
var num = min + (Math.floor(Math.random()*100000000000000) % (max - min)); | |
$("#source").value = num | |
function triggerMouseEvent (node, eventType) { | |
var clickEvent = document.createEvent('MouseEvents'); | |
clickEvent.initEvent (eventType, true, true); | |
node.dispatchEvent (clickEvent); | |
} | |
var srcListenButton = document.getElementById('gt-src-listen'); | |
setTimeout(function() { | |
triggerMouseEvent (srcListenButton, 'mouseover'); | |
triggerMouseEvent (srcListenButton, 'mousedown'); | |
triggerMouseEvent (srcListenButton, 'mouseup'); | |
}, 2000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment