diff --git a/html/index.html b/html/index.html index b35166426..5c81c193a 100644 --- a/html/index.html +++ b/html/index.html @@ -40,6 +40,16 @@ $("#logoutmenuitem").hide(); } $("#banner").html(product + " HTTP Server"); + + // show power button for supported boards only + const ProductsWithPwrCtrl = ["Ultimate 64-II", "C64 Ultimate"]; + if (ProductsWithPwrCtrl.includes(product)) + $("#menu-power").show(); + + // show firmware version in side panel + if (ultimateInfo.firmware_version) + $("#firmware-version").html("firmware v"+ultimateInfo.firmware_version); + $("#left-nav").css("visibility", "visible"); $(".page").hide(); $("#welcome").show(); @@ -72,7 +82,19 @@ let [status_code, content] = await make_put_request("http://" + serverIP + "/v1/machine:reset", params); }; - $('#doreboot').click(function(event){ + async function doPowerOff() { + let params = {}; + if (confirm("Are you sure you want to power off your Ultimate?")) { + let [status_code, content] = await make_put_request("http://" + serverIP + "/v1/machine:poweroff", params); + } + }; + + $('#dopoweroff').click(function(event) { + event.preventDefault(); // Prevents the default action of the anchor tag + doPowerOff(); + }); + + $('#doreboot').click(function(event) { event.preventDefault(); // Prevents the default action of the anchor tag doReboot(); }); @@ -208,9 +230,10 @@ } // PRG/CRT(/SID) loader - async function submitRunner() { - let body = $('#runnerfile')[0].files[0]; - let extension = getFileExtension(body.name); + async function submitRunner(file, drive) { + if (drive === undefined) drive = "a"; + if (file === undefined) file = $('#runnerfile')[0].files[0]; + let extension = getFileExtension(file.name); let params = {}; $("#runmsg").hide(); @@ -221,14 +244,28 @@ route = "/v1/runners:run_crt"; else if (extension === "SID") route = "/v1/runners:sidplay"; + else if (extension === "D64") { + route = `/v1/drives/${drive}:mount`; + params = {"type":"d64"}; + } + else if (extension === "D71") { + route = `/v1/drives/${drive}:mount`; + params = {"type":"d71"}; + } + else if (extension === "D81") { + route = `/v1/drives/${drive}:mount`; + params = {"type":"d81"}; + } else alert("Unsupported file extension: '."+ extension.toLowerCase()+"'"); if (route !== null) { - let [status_code, content] = await make_post_request("http://" + serverIP + route, params, body); + let [status_code, content] = await make_post_request("http://" + serverIP + route, params, file); if(status_code !== 200) $("#runmsg").show(); - } + return status_code == 200; + } + return false; } // BASIC/tokenizer page event handlers @@ -270,6 +307,8 @@ $('#uppercaseBASIC').on('change', async function (event) { $("#basiceditor").toggleClass("uppercase", this.checked); // change upper/lowercase display }); + // browser may have cached the checkbox state on a page reload: synchronize the initially displayed state + $("#basiceditor").toggleClass("uppercase", $('#uppercaseBASIC').prop('checked')); // convenience: write memory - show error message when access fails async function writeMemory(param, errorMsg) { @@ -845,6 +884,7 @@ }, { checkArity: false, + processArguments: false, greetings: 'Ultimate 64 / II+ Remote Monitor\nhelp = list of commands\n' }); @@ -1380,6 +1420,14 @@ div#left-nav a:hover { background-color: #beffff; } + #firmware-version { + font-size: 12px; + color: darkgray; + text-align: center; + } + #menu-power { + display: none; + } #login { padding: 20px; width: 800px; @@ -1390,12 +1438,7 @@ width: 800px; display: none; } - #livemon { - flex-grow: 1; - padding: 20px; - display:none; - } - #sidplay { + div#livemon, div#sidplay, div#runner, div#tokenizer { flex-grow: 1; padding: 20px; display:none; @@ -1415,35 +1458,7 @@ color: #4caf50; background-color: #f6fff6; } - #runner { - flex-grow: 1; - padding: 20px; - display:none; - } - #tokenizer { - flex-grow: 1; - padding: 20px; - display:none; - } - #sidmsg { - flex-grow: 1; - margin-top: 20px; - padding: 20px; - display:none; - background-color: red; - color: white; - width: 400px; - } - #runmsg { - flex-grow: 1; - margin-top: 20px; - padding: 20px; - display:none; - background-color: red; - color: white; - width: 400px; - } - #basicmsg { + #sidmsg, #runmsg, #basicmsg { flex-grow: 1; margin-top: 20px; padding: 20px; @@ -1469,7 +1484,7 @@ margin: 5px 0; } - @font-face { + @font-face { font-family: 'C64'; src: url('C64_Pro-STYLE.woff') format('woff'); /* Path to your C64 font file */ } @@ -1492,7 +1507,7 @@ line-height: 1.5; width: 900px; height: 400px; - resize: none; + resize: both; } .trinity-dialog { @@ -1523,8 +1538,10 @@ } .trinity-dialog header .title { margin-top: -2px; - background: var(--color); + background: rgb(160, 182, 247); padding: 1px 10px; + top: -6px; + left: -2px; } .trinity-dialog header { background: var(--color); @@ -1579,9 +1596,10 @@