From f9449af87a4f5420aa7683d3f15110bfa2f1bf17 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Sat, 29 Oct 2022 18:22:35 +0100 Subject: kaios: Major parts of a build for KaiOS KaiOS (which is based on Firefox OS, formerly Boot to Gecko) runs its "native" apps in a Web browser, so this is essentially a rather specialised version of the JavaScript front-end. Indeed, the JavaScript and C parts are the same as the Web version. There are three major parts that are specific to the KaiOS build. First, there's manifest.pl, which generates a KaiOS-specific JSON manifest describing each puzzle. Second, there's a new HTML page generator, apppage.pl, that generates an HTML page that is much less like a Web page, and much more like an application, than the one generated by jspage.pl. It expects to build a single HTML page at a time and gets all its limited knowledge of the environment from its command line. This makes it gratuitously different from jspage.pl and javapage.pl, but makes it easier to run from the build system. And finally, there's the CMake glue that assembles the necessary parts for each application in a directory. This includes the manifest, the HTML, the JavaScript, the KaiOS-specific icons (generated as part of the GTK build) and a copy of the HTML documentation. The directory is assembled using CMake's install() function, and can be installed on a KaiOS device using the developer tools. --- emccpre.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'emccpre.js') diff --git a/emccpre.js b/emccpre.js index 2bbaa57..f0169ec 100644 --- a/emccpre.js +++ b/emccpre.js @@ -534,6 +534,14 @@ function initPuzzle() { } menuform.addEventListener("keydown", menukey); + // Open documentation links within the application in KaiOS. + for (var elem of document.querySelectorAll("#gamemenu a[href]")) { + elem.addEventListener("click", function(event) { + window.open(event.target.href); + event.preventDefault(); + }); + } + // In IE, the canvas doesn't automatically gain focus on a mouse // click, so make sure it does onscreen_canvas.addEventListener("mousedown", function(event) { @@ -567,7 +575,7 @@ function initPuzzle() { event.preventDefault(); event.stopPropagation(); } - }, true); + }); // Event handler to fake :focus-within on browsers too old for // it (like KaiOS 2.5). Browsers without :focus-within are also -- cgit v1.1