shithub: puzzles

Download patch

ref: 1f72a1a2ecc89ba789a0b665a5e39da5febe27d2
parent: 31badae3c12d71857ad0a327f8e05af24fb92648
author: Ben Harris <bjh21@bjh21.me.uk>
date: Mon Jan 23 18:50:39 EST 2023

Move KaiAds menu option

It's a bit of a nuisance at the moment if you're trying to get to the
documentation by pressing the up arrow, so I've moved it above the
documentation links, which is where I keep expecting to find it.  I
probably want to do some larger-scale menu re-organisation on KaiOS,
though.

--- a/kaios/kaiads-glue.js
+++ b/kaios/kaiads-glue.js
@@ -20,7 +20,9 @@
     advertbutton.disabled = true;
     var advertli = document.createElement("li");
     advertli.appendChild(advertbutton);
-    menuform.querySelector("ul").appendChild(advertli);
+    var topmenu = menuform.querySelector("ul");
+    var before = topmenu.querySelector(":scope > li:nth-last-child(2)");
+    topmenu.insertBefore(advertli, before);
     // Now work out whether we're installed from the Store (and hence
     // want real adverts) or not (and hence want test ones).
     var selfrequest = navigator.mozApps.getSelf();