-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathdemo.js
executable file
·64 lines (56 loc) · 1.63 KB
/
demo.js
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*!
* demo.js
* Shawwwn (shawwwn1@gmail.com)
*/
document.addEventListener('DOMContentLoaded', (event) => setTimeout(() => {
let app = document.querySelector('#calender').__vue__;
// time
document.querySelector('#p1 > span')
.innerText = app.today;
// button click
document.getElementById('btn1')
.addEventListener('click', function(evt) {
var data = app.matrix2span(app.mat, true);
if (!data) { return; }
console.log(data);
var txt = [];
Object.keys(data).forEach(function(date, i) {
txt.push(date + ": " + JSON.stringify(data[date]));
});
txt = txt.join("\n");
alert(txt);
});
document.getElementById('btn2')
.addEventListener('click', function(evt) {
app.resetMatrix(app.mat, false);
app.saveData();
app.$forceUpdate();
var data = app.matrix2span(app.mat);
console.log(data);
});
document.getElementById('btn3')
.addEventListener('click', function(evt) {
var date = prompt("Enter the date you wish to navigate to:", moment().format('YYYY-MM-DD'));
if (date) {
app.navigateToDate(moment(date));
}
});
document.getElementById('btn4')
.addEventListener('click', function(evt) {
console.log(app.data)
});
// document.getElementById('btn5')
// .addEventListener('click', function(evt) {
// app.saveData()
// });
// document.getElementById('btn6')
// .addEventListener('click', function(evt) {
// app.loadData()
// });
// checkbox
document.getElementById('cb1')
.addEventListener('change', function(evt) {
var cb = evt.target;
app.display_half_hour_labels = cb.checked;
});
}, 100));