From e9cb7f4bc6e41fcfe248778ad645574ad27066f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Tue, 12 Jan 2021 23:59:58 +0100 Subject: Add animations to popup tab labels. --- static/style.scss | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'static') diff --git a/static/style.scss b/static/style.scss index 4cd6b410..b81e8c01 100644 --- a/static/style.scss +++ b/static/style.scss @@ -815,8 +815,14 @@ along with their colors. max-height: 5ex; min-height: 5ex; + min-width: 5ex; - max-width: 5ex; + width: 5ex; + + transition: width 0.1s ease-in-out; + &:hover { + width: 10ex; + } border: 1px solid #ccc; border-radius: 0 5px 5px 0; -- cgit v1.2.3 From 3aa241410947f8e495ac673fc17cc90964325902 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Wed, 13 Jan 2021 01:00:53 +0100 Subject: Bind recur dropdowns. --- static/binders.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'static') diff --git a/static/binders.js b/static/binders.js index 15275d28..79803c09 100644 --- a/static/binders.js +++ b/static/binders.js @@ -23,7 +23,12 @@ function bind_recur(el, e) { el.properties.rrule[rr.name] = this.value; }); } else if (rr.tagName === 'select') { - console.log("TODO"); + rr.addEventListener('change', function () { + let opt = this.options[this.selectedIndex]; + let v = opt.value; + // console.log(v); + el.properties.rrule[rr.name] = v; + }); } } -- cgit v1.2.3 From 223d6d327db5c56a551cdedb35186adc3b21f899 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Wed, 13 Jan 2021 01:04:51 +0100 Subject: Add TODO about byday. --- static/binders.js | 1 + 1 file changed, 1 insertion(+) (limited to 'static') diff --git a/static/binders.js b/static/binders.js index 79803c09..197fb368 100644 --- a/static/binders.js +++ b/static/binders.js @@ -12,6 +12,7 @@ function bind_recur(el, e) { /* add listeners to bind-rr tags */ for (let rr of e.querySelectorAll('.bind-rr')) { + /* TODO handle byday */ if (rr.classList.contains('input-list')) { rr.addEventListener('input', function () { let name = rr.attributes.name.value; -- cgit v1.2.3 From 39f7054589f3cb97e4ac916085ec58a68c6078fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Wed, 13 Jan 2021 02:46:04 +0100 Subject: Add keyborad bindings for popup tabs. --- static/popup.js | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'static') diff --git a/static/popup.js b/static/popup.js index bc4e766d..e19db6f2 100644 --- a/static/popup.js +++ b/static/popup.js @@ -59,3 +59,45 @@ function toggle_popup(popup_id) { open_popup(popup); } } + +/* Code for managing "selected" popup */ +/* Makes the popup last hovered over the selected popup, moving it to + * the top, and allowing global keyboard bindings to affect it. */ + +let activePopup; + +for (let popup of document.querySelectorAll('.popup-container')) { + /* TODO possibly only change "active" element after a fraction of + * a second, for example when moving between tabs */ + popup.addEventListener('mouseover', function () { + /* This is ever so slightly inefficient, + but it really dosen't mammet */ + for (let other of + document.querySelectorAll('.popup-container')) + { + /* TODO get this from somewhere */ + /* Currently it's manually copied from the stylesheet */ + other.style['z-index'] = 1000; + } + popup.style['z-index'] += 1; + activePopup = popup; + }); +} + +document.addEventListener('keydown', function (event) { + /* Physical key position, names are what that key would + be in QWERTY */ + let i = ({ + 'KeyQ': 0, + 'KeyW': 1, + 'KeyE': 2, + 'KeyR': 3, + })[event.code]; + if (i === undefined) return + if (! activePopup) return; + let element = activePopup.querySelectorAll(".tab > label")[i]; + if (! element) return; + element.click(); +}); + +/* END Code for managing "selected" popup */ -- cgit v1.2.3