changeset 47:c2436a591e56

Add "include bots" checkbox
author Lewin Bormann <lbo@spheniscida.de>
date Tue, 19 Jul 2022 21:42:01 -0700
parents 746d8278aa31
children 616a145a1bb3
files assets/index.html.hbs assets/static/style.css
diffstat 2 files changed, 35 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/assets/index.html.hbs	Tue Jul 19 21:23:56 2022 -0700
+++ b/assets/index.html.hbs	Tue Jul 19 21:42:01 2022 -0700
@@ -35,6 +35,12 @@
                 usp.set("duration", new_duration.toFixed());
                 window.location.search = usp.toString();
             };
+            function toggleBots(checkboxid) {
+                let box = document.getElementById(checkboxid);
+                let usp = new URLSearchParams(window.location.search);
+                usp.set("includebots", box.checked);
+                window.location.search = usp.toString();
+            };
         </script>
 
     </head>
@@ -60,18 +66,22 @@
 
     <!-- Time navigation -->
     <div id="timebox">
-    <div id="timeindicator">
-        from {{ date.today }} ({{date.duration}} days)
-    </div>
-    <div id="timenav">
-        <button onclick="adjustURLDateParams(-30, 1)">-30d</button>
-        <button onclick="adjustURLDateParams(-7, 1)">-7d</button>
-        <button onclick="adjustURLDateParams(-1, 1)">-1d</button>
-        &nbsp;&nbsp;
-        <button onclick="adjustURLDateParams(1, 1)">+1d</button>
-        <button onclick="adjustURLDateParams(7, 1)">+7d</button>
-        <button onclick="adjustURLDateParams(30, 1)">+30d</button>
-    </div>
+        <div id="timeindicator">
+            from {{ date.today }} ({{date.duration}} days)
+        </div>
+        <div id="timenav">
+            <button onclick="adjustURLDateParams(-30, 1)">-30d</button>
+            <button onclick="adjustURLDateParams(-7, 1)">-7d</button>
+            <button onclick="adjustURLDateParams(-1, 1)">-1d</button>
+            &nbsp;&nbsp;
+            <button onclick="adjustURLDateParams(1, 1)">+1d</button>
+            <button onclick="adjustURLDateParams(7, 1)">+7d</button>
+            <button onclick="adjustURLDateParams(30, 1)">+30d</button>
+        </div>
+        <div id="topconfig">
+            <label for="botbox" id="botboxlabel">Include bots</label>
+            <input type="checkbox" id="botbox" name="botbox" onclick="toggleBots('botbox')"></input>
+        </div>
     </div>
 
 
@@ -107,5 +117,14 @@
     </script>
     {{/if}}
 
+    <script>
+        // Set up page after load.
+        (function() {
+        let box = document.getElementById("botbox");
+        let usp = new URLSearchParams(window.location.search);
+        box.checked = usp.get("includebots") == "true";
+        })();
+    </script>
+
     </body>
 </html>
--- a/assets/static/style.css	Tue Jul 19 21:23:56 2022 -0700
+++ b/assets/static/style.css	Tue Jul 19 21:42:01 2022 -0700
@@ -15,10 +15,13 @@
 .fullwidth { width: 95%; }
 .halfwidth { width: 48%; }
 
-#timebox { display: flex; justify-content: center; flex-direction: column; }
+#timebox { display: flex; justify-content: center; flex-direction: column; padding: 0.5em; }
 #timenav { text-align: center; }
 #timeindicator { text-align: center; }
 
+#topconfig { text-align: center;  }
+#botbox { position: relative; top: .3em; }
+#botboxlabel { position: relative; top: -.3em }
 
 /* Login form */
 #loginformbox {  display: flex; justify-content: center; }