2016-01-11 01:38:53 +03:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
2011-11-01 09:11:47 +04:00
|
|
|
<head>
|
2016-01-11 01:38:53 +03:00
|
|
|
<meta charset="UTF-8">
|
2011-11-01 09:11:47 +04:00
|
|
|
</head>
|
2012-03-21 03:21:15 +04:00
|
|
|
<body>
|
2016-01-11 01:38:53 +03:00
|
|
|
<script>
|
|
|
|
window.addEventListener("Test:DispatchKeyEvents", aEvent => {
|
|
|
|
var keyCode = KeyEvent["DOM_" + aEvent.detail.code];
|
2011-11-01 09:11:47 +04:00
|
|
|
|
|
|
|
document.body.focus();
|
|
|
|
var evt = document.createEvent("KeyEvents");
|
|
|
|
evt.initKeyEvent("keydown", true, true, window,
|
|
|
|
false, false, false, false,
|
2016-01-11 01:38:53 +03:00
|
|
|
keyCode, 0);
|
2011-11-01 09:11:47 +04:00
|
|
|
document.body.dispatchEvent(evt);
|
|
|
|
|
|
|
|
evt = document.createEvent("KeyEvents");
|
|
|
|
evt.initKeyEvent("keypress", true, true, window,
|
|
|
|
false, false, false, false,
|
2016-01-11 01:38:53 +03:00
|
|
|
keyCode, 0);
|
2011-11-01 09:11:47 +04:00
|
|
|
document.body.dispatchEvent(evt);
|
|
|
|
|
|
|
|
evt = document.createEvent("KeyEvents");
|
|
|
|
evt.initKeyEvent("keyup", true, true, window,
|
|
|
|
false, false, false, false,
|
2016-01-11 01:38:53 +03:00
|
|
|
keyCode, 0);
|
2011-11-01 09:11:47 +04:00
|
|
|
document.body.dispatchEvent(evt);
|
2016-01-11 01:38:53 +03:00
|
|
|
});
|
2011-11-01 09:11:47 +04:00
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|