<!doctype html>
<html>
    <head>
        <meta charset="utf-8">
        <title>IRremote Controller</title>
    </head>
    <body>
        <h1>IRremote Controller</h1>
        <h3>TV:</h3>
        <!--<p>
            &nbsp;&nbsp;&nbsp;&nbsp;<button type="button" onclick="window.location.href='action/power'">Power</button><br>
            <button type="button" onclick="window.location.href='action/back'">Back</button> <button type="button" onclick="window.location.href='action/home'">Home</button><br>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button type="button" onclick="window.location.href='action/up'">/\</button><br>
            &nbsp;<button type="button" onclick="window.location.href='action/left'"><</button> <button type="button" onclick="window.location.href='action/ok'">Ok</button> <button type="button" onclick="window.location.href='action/right'">></button><br>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button type="button" onclick="window.location.href='action/down'">\/</button><br>
            &nbsp;&nbsp;<button type="button" onclick="window.location.href='action/reload'">Reload</button> <button type="button" onclick="window.location.href='action/star'">*</button><br>
            <button type="button" onclick="window.location.href='action/rewind'"><<</button> <button type="button" onclick="window.location.href='action/play-pause'">Play/Pause</button> <button type="button" onclick="window.location.href='action/fast-forward'">>></button><br>
            <button type="button" onclick="window.location.href='action/vol+'">Vol +</button> <button type="button" onclick="window.location.href='action/mute'">Vol Mute</button> <button type="button" onclick="window.location.href='action/vol-'">Vol -</button><br>
        </p>-->
        <p>
            &nbsp;&nbsp;&nbsp;&nbsp;<button type="button" onclick="sendCommandTV('power')">Power</button><br>
            <button type="button" onclick="sendCommandTV('back')">Back</button> <button type="button" onclick="sendCommandTV('home')">Home</button><br>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button type="button" onclick="sendCommandTV('up')">/\</button><br>
            &nbsp;<button type="button" onclick="sendCommandTV('left')"><</button> <button type="button" onclick="sendCommandTV('ok')">Ok</button> <button type="button" onclick="sendCommandTV('right')">></button><br>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button type="button" onclick="sendCommandTV('down')">\/</button><br>
            &nbsp;&nbsp;<button type="button" onclick="sendCommandTV('reload')">Reload</button> <button type="button" onclick="sendCommandTV('star')">*</button><br>
            <button type="button" onclick="sendCommandTV('rewind')"><<</button> <button type="button" onclick="sendCommandTV('play-pause')">Play/Pause</button> <button type="button" onclick="sendCommandTV('fast-forward')">>></button><br>
            <button type="button" onclick="sendCommandTV('vol+')">Vol +</button> <button type="button" onclick="sendCommandTV('mute')">Vol Mute</button> <button type="button" onclick="sendCommandTV('vol-')">Vol -</button><br>
        </p>
        <h3>MOVIE BOX:</h3>
        <p>
            &nbsp;&nbsp;&nbsp;&nbsp;<button type="button" onclick="sendCommandMB('power')">Power</button><br>
            <button type="button" onclick="sendCommandMB('home')">Home</button> <button type="button" onclick="sendCommandMB('back')">Back</button><br>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button type="button" onclick="sendCommandMB('up')">/\</button><br>
            &nbsp;<button type="button" onclick="sendCommandMB('left')"><</button> <button type="button" onclick="sendCommandMB('ok')">Ok</button> <button type="button" onclick="sendCommandMB('right')">></button><br>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button type="button" onclick="sendCommandMB('down')">\/</button><br>
        </p>
        <script>
            function sendCommandTV(cmd) {
                const xhttp = new XMLHttpRequest();
                xhttp.onload = function() {}
                xhttp.open("GET", "tv/"+cmd, true);
                xhttp.send();
            }
            function sendCommandMB(cmd) {
                const xhttp = new XMLHttpRequest();
                xhttp.onload = function() {}
                xhttp.open("GET", "mb/"+cmd, true);
                xhttp.send();
            }
        </script>
    </body>
</html>