aboutsummaryrefslogtreecommitdiff
path: root/static
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2020-08-12 15:57:55 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2020-08-12 15:57:55 +0200
commitfd72079c5163f9881872d70b64aafde03b8b2385 (patch)
tree6840d4c4bf511f0e4a2c53fd0fe74240e076775c /static
parentCalendar names now encoded with modified base64 (diff)
downloadcalp-fd72079c5163f9881872d70b64aafde03b8b2385.tar.gz
calp-fd72079c5163f9881872d70b64aafde03b8b2385.tar.xz
Add option for default calendar.
Diffstat (limited to 'static')
-rw-r--r--static/script.js19
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