diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-08-12 15:57:55 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-08-12 15:57:55 +0200 |
commit | fd72079c5163f9881872d70b64aafde03b8b2385 (patch) | |
tree | 6840d4c4bf511f0e4a2c53fd0fe74240e076775c /static | |
parent | Calendar names now encoded with modified base64 (diff) | |
download | calp-fd72079c5163f9881872d70b64aafde03b8b2385.tar.gz calp-fd72079c5163f9881872d70b64aafde03b8b2385.tar.xz |
Add option for default calendar.
Diffstat (limited to 'static')
-rw-r--r-- | static/script.js | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/static/script.js b/static/script.js index 40d8a6d1..ab882d6a 100644 --- a/static/script.js +++ b/static/script.js @@ -522,12 +522,19 @@ function place_in_edit_mode (event) { let calendar_dropdown = document.getElementById('calendar-dropdown-template').firstChild.cloneNode(true); let [_, calclass] = popup.classList.find(/^CAL_/); - for (let [i, option] of calendar_dropdown.childNodes.entries()) { - if (option.value === calclass.substr(4)) { - calendar_dropdown.selectedIndex = i; - break; - } - } + label: { + for (let [i, option] of calendar_dropdown.childNodes.entries()) { + if (option.value === calclass.substr(4)) { + calendar_dropdown.selectedIndex = i; + break label; + } + } + /* no match, try find default calendar */ + let t; + if ((t = calendar_dropdown.querySelector("[selected]"))) { + event.properties.calendar = t.value; + } + } /* Instant change while user is stepping through would be |