summaryrefslogtreecommitdiff
path: root/js/lmmtfy.js
diff options
context:
space:
mode:
authordweller <dweller@cabin.digital>2024-02-26 11:47:32 +0200
committerdweller <dweller@cabin.digital>2024-02-26 11:47:32 +0200
commitf0181813ecf9867f13a206d87fc46b15d295acbc (patch)
treeb1b6f94e6a2318010cb322bbd119356b46076dd4 /js/lmmtfy.js
parenta87359aaacac66655af6baa80ced112ac842f651 (diff)
wire up frontend with PHP, badly
Diffstat (limited to 'js/lmmtfy.js')
-rw-r--r--js/lmmtfy.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/js/lmmtfy.js b/js/lmmtfy.js
new file mode 100644
index 0000000..d0410ab
--- /dev/null
+++ b/js/lmmtfy.js
@@ -0,0 +1,32 @@
+const dom_query = document.getElementById("query");
+const dom_sect = document.getElementById("sect");
+const dom_man = document.getElementById("man");
+
+const query = dom_query.value;
+dom_query.value = "";
+
+let i = 0, j = 0;
+let elapsed = 0;
+let actions =
+[
+ [250, () => { dom_query.focus(); }, 1],
+ [150, () => { dom_query.value += query[j++]; }, query.length],
+ [250, () => { dom_man.focus(); }, 1],
+ [250, () => { dom_man.click(); }, 1],
+];
+
+function do_stuff()
+{
+ elapsed += 50;
+
+ if((elapsed % actions[i][0]) == 0)
+ {
+ actions[i][1]();
+ actions[i][2]--;
+ if(actions[i][2] <= 0) i++;
+ }
+
+ setTimeout(do_stuff, 50);
+}
+
+do_stuff();