Die Datei:
<html>
<head>
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
<link rel='shortcut icon' href='http://mytolino.com/wp-content/themes/tolino/favicon.ico' type='image/vnd.microsoft.icon; charset=binary'>
<title>tolino remote control</title>
<style>
a {text-decoration:none}
@font-face {font-family:'icons';src: url('https://html5reader.thalia.de/library/assets/common/fonts/tolino-iconfont.woff') format('woff'), url('https://html5reader.thalia.de/library/assets/common/fonts/tolino-iconfont.ttf') format('truetype'), url('https://html5reader.thalia.de/library/assets/common/fonts/tolino-iconfont.otf') format('opentype')}
</style>
<script>
function transfer(e) {
document.forms[0].submit()
e.value=''
}
function keydownHandler(e) {
var evt = e ? e:event;
var chrTyped;
var sProperties = ''
+(evt.keyCode ==null ? '':' keyCode=' +evt.keyCode )
+(evt.charCode==null ? '':' charCode='+evt.charCode)
+(evt.which ==null ? '':' which='+evt.which)
// console.log(evt.keyCode)
switch(evt.keyCode) {
case 40: chrTyped='KEYCODE_DPAD_DOWN' ; break;
case 37: chrTyped='KEYCODE_DPAD_LEFT' ; break;
case 39: chrTyped='KEYCODE_DPAD_RIGHT' ; break;
case 38: chrTyped='KEYCODE_DPAD_UP' ; break;
case 35: chrTyped='KEYCODE_MOVE_END' ; break;
case 36: chrTyped='KEYCODE_MOVE_HOME' ; break;
case 46: chrTyped='KEYCODE_FORWARD_DEL'; break;
case 8: chrTyped='KEYCODE_DEL' ; evt.preventDefault(); break;
}
document.getElementById('sChrCode').innerHTML = sProperties;
if(typeof chrTyped != 'undefined') {
var xmlhttp = new XMLHttpRequest();
xmlhttp.open('GET', document.URL+'?key='+encodeURIComponent(chrTyped), false);
xmlhttp.send(null);
}
return true;
}
var transfer=true;
var keys='';
var i=0;
function keypressHandler(e) {
var evt = e ? e:event;
var chrTyped, chrCode = 0;
var sProperties = ''
+(evt.keyCode ==null ? '':' keyCode=' +evt.keyCode )
+(evt.charCode==null ? '':' charCode='+evt.charCode)
+(evt.which ==null ? '':' which='+evt.which)
if (evt.charCode!=null) chrCode = evt.charCode;
else if (evt.which!=null) chrCode = evt.which;
else if (evt.keyCode!=null) chrCode = evt.keyCode;
if (chrCode==0) chrTyped = 'SPECIAL KEY';
else chrTyped = String.fromCharCode(chrCode);
document.getElementById('sChrCode').innerHTML = sProperties;
document.getElementById('sChrName').innerHTML = ' Character: '+chrTyped.bold();
if(chrCode!=0) keys+=chrTyped;
console.log('keys='+keys);
console.log('i='+(i++));
if(transfer) {
transfer=false;
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == XMLHttpRequest.DONE) {
transfer=true;
console.log('XMLHttpRequest.DONE');
if(keys.length>0)keypressHandler();
}
}
var url=document.URL+'?key='+encodeURIComponent(keys);
console.log('GET '+url);
xmlhttp.open('GET', url, true);
keys='';
xmlhttp.send(null);
}
return true;
}
// TODO combine into keypressHandler
document.onkeypress=keypressHandler;
document.onkeydown=keydownHandler;
</script>
</head>
<body bgcolor='black' text='white' link='white' alink='white' vlink='white'>
<div style='font-family:icons; font-size:75px'>
<!--⇤<Xa href='?BACKWARD'>«</a><span style='padding-left:0.3em'></span>-->
<a href='/'>»</a>
<!--⇥-->
</div>
<form target='datatransfer'>
<input name='key' Xonchange='javascript:transfer(this)' onfocus='if(navigator.userAgent.indexOf("Chrome")>0)document.getElementById("warning").innerHTML="Soft keyboard does not work in Chrome!"'>
<div id="warning" style="color:red"></div>
<iframe name='datatransfer' style='display:none'></iframe>
<div id="sChrCode"></div>
<div id="sChrName"></div>
</form>
</body></html>