How to trigger the listen button on the Google-translate page using javascript?
问题 I want to add shortcuts to the Google-translate page. Press Alt c or Esc to clear the textarea ; press Alt j to pronounce. This is the current user script: userscripts.org/scripts/review/110928 I do not know how to trigger the listen button on that page. I tried: var evt = document.createEvent("MouseEvents"); evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); var cb = document.getElementById("gt-src-listen"); cb.dispatchEvent(evt); but it does