Skip to content

Instantly share code, notes, and snippets.

@daltonnyx
Created April 13, 2017 04:46
Show Gist options
  • Save daltonnyx/bc9921fd7934aecc2fe4b174cd7768a0 to your computer and use it in GitHub Desktop.
Save daltonnyx/bc9921fd7934aecc2fe4b174cd7768a0 to your computer and use it in GitHub Desktop.
/*
* This is a JavaScript Scratchpad.
*
* Enter some JavaScript, then Right Click or choose from the Execute Menu:
* 1. Run to evaluate the selected text (Ctrl+R),
* 2. Inspect to bring up an Object Inspector on the result (Ctrl+I), or,
* 3. Display to insert the result in a comment after the selection. (Ctrl+L)
*/
const __words = 150;
window.setInterval(function(){
var hightLightText = document.querySelector("#row1 .highlight");
var textBox = document.getElementById("inputfield");
if(!hightLightText)
return;
textBox.value = hightLightText.innerText;
var spacePress = document.createEvent("KeyboardEvent");
var initMethod = typeof spacePress.initKeyboardEvent !== "undefined" ? "initKeybardEvent" : "initKeyEvent";
spacePress[initMethod](
"keyup",
true,
true,
window,
false,
false,
false,
false,
32,
0
);
textBox.dispatchEvent(spacePress);
},(60 * 1000) / __words);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment