shithub: puzzles

Download patch

ref: 49849e40ec2560fc22cf2da2a5f9be10c90f42bc
parent: c90d64f2439cf4fc5ac07f0ace27100aad2b69be
author: Ben Harris <bjh21@bjh21.me.uk>
date: Mon Oct 17 18:34:54 EDT 2022

js: Move dialogue-box sizing and positioning from JavaScript to CSS

This has the advantage that if you resize the window while a dialogue
box is active, the dialogue box adjusts itself accordingly.

--- a/emccpre.js
+++ b/emccpre.js
@@ -184,9 +184,6 @@
     // Now create a form which sits on top of that in turn.
     dlg_form = document.createElement("form");
     dlg_form.id = "dlgform";
-    dlg_form.style.width = (window.innerWidth * 2 / 3) + "px";
-    dlg_form.style.top = (window.innerHeight / 10) + "px";
-    dlg_form.style.left = (window.innerWidth / 6) + "px";
 
     var title = document.createElement("p");
     title.className = "title";
--- a/html/jspage.pl
+++ b/html/jspage.pl
@@ -225,6 +225,7 @@
 }
 
 #dlgform {
+    width: 66.6667vw;
     opacity: 1;
     background: #ffffff;
     color: #000000;
@@ -231,6 +232,8 @@
     position: absolute;
     border: 2px solid black;
     padding: 20px;
+    top: 10vh;
+    left: 16.6667vw;
     z-index: 100;
 }