summaryrefslogtreecommitdiff
path: root/wwwroot/js
diff options
context:
space:
mode:
authorJake Mannens <jake@asger.xyz>2026-05-22 00:52:16 +1000
committerJake Mannens <jake@asger.xyz>2026-05-23 22:22:55 +1000
commit12eaa5814ef20b0910e8d64a753378b6f6797989 (patch)
tree062cf477c29054e0f089cb80f0cd79a9f3b7ccd9 /wwwroot/js
parent6de5d7f5364fe1d54703da6d6b7cb08ea26e939f (diff)
Initial commitwasm-initial
Diffstat (limited to 'wwwroot/js')
-rw-r--r--wwwroot/js/dialog.js78
-rw-r--r--wwwroot/js/keyboard.js57
-rw-r--r--wwwroot/js/mobile.js7
3 files changed, 0 insertions, 142 deletions
diff --git a/wwwroot/js/dialog.js b/wwwroot/js/dialog.js
deleted file mode 100644
index 418962f..0000000
--- a/wwwroot/js/dialog.js
+++ /dev/null
@@ -1,78 +0,0 @@
-function dialogMouseDown(e) {
- bumpDialog(e.currentTarget);
-}
-
-function dialogTitleMouseDown(e) {
- e = e || window.event;
- e.preventDefault();
- var element = e.currentTarget.parentElement;
- var ds = element.dataset;
- ds.lastX = e.clientX;
- ds.lastY = e.clientY;
-
- window.dragDialog = element;
- document.onmouseup = dragMouseUp;
- document.onmousemove = dragMouseMove;
-}
-
-function dragMouseUp() {
- window.dragDialog = null;
- document.onmouseup = null;
- document.onmousemove = null;
-}
-
-function dragMouseMove(e) {
- e = e || window.event;
- e.preventDefault();
- var element = window.dragDialog;
- var ds = element.dataset;
- deltaX = ds.lastX - e.clientX;
- deltaY = ds.lastY - e.clientY;
- ds.lastX = e.clientX;
- ds.lastY = e.clientY;
- element.style.left = (element.offsetLeft - deltaX) + 'px';
- element.style.top = (element.offsetTop - deltaY) + 'px';
-}
-
-function setDialogVisibility(element, visible) {
- if(visible) {
- element.style.left = null;
- element.style.top = null;
- element.style.opacity = 1;
- element.style.visibility = 'visible';
- bumpDialog(element);
-
- var input = element.querySelector('input[type="text"]');
- if(input) {
- setTimeout(() => input.focus(), 100);
- }
- } else {
- element.style.opacity = 0;
- element.style.visibility = 'hidden';
- }
-}
-
-function bumpDialog(element) {
- var dialogs = Array
- .from(document.querySelectorAll('div.dialog'))
- .map(e => ({ zIndex: parseInt(e.style.zIndex), element: e }))
- .sort((a, b) => a.zIndex - b.zIndex)
- .map(d => d.element)
- .filter(e => e != element);
-
- dialogs.push(element);
-
- var z = 900;
- for(var d of dialogs)
- d.style.zIndex = z++;
-}
-
-function dialogAddObjectReference(element, dialogObject) {
- if(!window.dialogObjects)
- window.dialogObjects = []
-
- window.dialogObjects.push({
- element: element,
- dialogObject: dialogObject
- });
-}
diff --git a/wwwroot/js/keyboard.js b/wwwroot/js/keyboard.js
deleted file mode 100644
index 8b46639..0000000
--- a/wwwroot/js/keyboard.js
+++ /dev/null
@@ -1,57 +0,0 @@
-async function keyDownHandler(e) {
- function isDialogChild(e) {
- while(e = e.parentElement)
- if(e.tagName == 'DIV' && e.classList.contains('dialog'))
- return true;
- return false;
- }
-
- var tag = document.activeElement.tagName;
- if((tag == 'INPUT' || (tag == 'TEXTAREA' && e.ctrlKey)) && e.key == 'Enter') {
- var element = document.activeElement;
- while(element = element.parentElement) {
- if(element.tagName == 'FORM') {
- element
- .querySelectorAll('input,textarea')
- .forEach(e => e.dispatchEvent(new Event('change')));
- element.requestSubmit();
- e.preventDefault();
- return;
- }
- }
- }
-
- if((tag == 'INPUT' || tag == 'TEXTAREA') && e.key != 'Escape')
- return;
-
- var element = Array.from(document.querySelectorAll('div.dialog'))
- .filter(e => e.style.visibility == 'visible')
- .map(e => ({ element: e, zIndex: parseInt(e.style.zIndex) }))
- .sort((a, b) => b.zIndex - a.zIndex)
- .map(e => e.element)[0];
-
- if(element) {
- await window.dialogObjects
- .find(d => d.element == element)
- .dialogObject
- .invokeMethodAsync('KeyHandler', e.key);
- e.preventDefault();
- return;
- }
-
- var button = Array.from(document.getElementsByTagName('button'))
- .filter(b => typeof(b.dataset.keyboardShortcut) == 'string')
- .filter(b => !isDialogChild(b))
- .find(b => b.dataset.keyboardShortcut == e.key);
-
- if(!e.ctrlKey && button) {
- button.click();
- e.preventDefault();
- return;
- }
-
- if(typeof pageKeyDownHandler == 'function')
- pageKeyDownHandler(e);
-}
-
-window.onload = () => document.onkeydown = keyDownHandler; \ No newline at end of file
diff --git a/wwwroot/js/mobile.js b/wwwroot/js/mobile.js
deleted file mode 100644
index 0af11cc..0000000
--- a/wwwroot/js/mobile.js
+++ /dev/null
@@ -1,7 +0,0 @@
-function hideMobileMenu() {
- document.getElementsByTagName('body')[0].classList.remove('mobile-menu-visible');
-}
-
-function toggleMobileMenu() {
- document.getElementsByTagName('body')[0].classList.toggle('mobile-menu-visible');
-}