diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-09-27 23:17:01 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-09-27 23:21:05 +0200 |
commit | b3250ac8289e4f4154682680d89c417f9a115e18 (patch) | |
tree | 320d4ef9a375cfef8eab1b361c760899b9d118fc /static/script.js | |
parent | Input cleaned up. (diff) | |
download | calp-b3250ac8289e4f4154682680d89c417f9a115e18.tar.gz calp-b3250ac8289e4f4154682680d89c417f9a115e18.tar.xz |
Add fancy editing of tag list.
Diffstat (limited to '')
-rw-r--r-- | static/script.js | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/static/script.js b/static/script.js index ce57e5e1..069d9a2e 100644 --- a/static/script.js +++ b/static/script.js @@ -623,6 +623,11 @@ window.onload = function () { serializer.serializeToString(xml); */ + + for (let el of document.querySelectorAll(".inline-edit input")) { + el.oninput = update_inline_list; + } + } function close_popup(popup) { @@ -716,6 +721,25 @@ function get_property(el, field, default_value, bind_to_ical=true) { } + +/* +class display_tab { +} + +class edit_tab { +} + +class vcomponent { + set_value(field, value) { + if (value === '') { + remove_property(field); + } + } +} + + +*/ + /* Properties are icalendar properties. @@ -804,4 +828,34 @@ function bind_properties (el, wide_event=false) { calprop.push([el, rplcs]); calprop.push([el, (s, v) => s.dataset.calendar = v]); + + + /* ---------- Calendar ------------------------------ */ + + +} + + +function advance_final(li) { + li.classList.remove("final"); + let new_li = makeElement ('input', { + className: 'final', + size: 2, + oninput: li.oninput, + }); + li.closest(".inline-edit").appendChild(new_li); +} + +function update_inline_list () { + if (this.classList.contains("final")) { + if (this.value !== '') { + advance_final(this); + } + } else { + if (this.value === '') { + let sibling = this.previousElementSibling || this.nextElementSibling; + this.remove(); + sibling.focus(); + } + } } |