forked from adamlaska/datatracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_timeslot.js
More file actions
43 lines (39 loc) · 1.16 KB
/
create_timeslot.js
File metadata and controls
43 lines (39 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright The IETF Trust 2021, All Rights Reserved
/* global URLSearchParams */
(function() {
'use strict';
function initialize() {
const form = document.getElementById('timeslot-form');
if (!form) {
return;
}
const params = new URLSearchParams(document.location.search);
const day = params.get('day');
const date = params.get('date');
const location = params.get('location');
const time = params.get('time');
const duration = params.get('duration');
if (day) {
const inp = form.querySelector('#id_days input[value="' + day +'"]');
if (inp) {
inp.checked = true;
} else if (date) {
const date_field = form.querySelector('#id_other_date');
date_field.value = date;
}
}
if (location) {
const inp = form.querySelector('#id_locations input[value="' + location + '"]');
inp.checked=true;
}
if (time) {
const inp = form.querySelector('input#id_time');
inp.value = time;
}
if (duration) {
const inp = form.querySelector('input#id_duration');
inp.value = duration;
}
}
window.addEventListener('load', initialize);
})();