-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIndex.html
86 lines (78 loc) · 2.08 KB
/
Index.html
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<style>
table {
}
button {
width: 100%;
}
</style>
</head>
<body>
<div id='title'>Sort by</div>
<div id='filters'> </div>
<br/>
<br/>
<? var data = loadFilter();
let arr = [];?>
<table>
<? for (var i = 0; i < data.length; i++) {
let time = new Date(data[i][2]);
let dateString = data[i][2].toString();
let isString = isNaN(time.getFullYear());
let month, date;
if (arr.indexOf(dateString) === -1 && !isString) {
arr.push(dateString);
month = time.getMonth() + 1;
date = time.getDate() + 1;
};?>
<? if(typeof month !== 'undefined') { ?>
<tr>
<td>
<button class='btn'>
<?= month + '/' + date ?>
</button>
</td>
</tr>
<?
} else {
}
} ?>
</table>
<button id='show_all'>Show All</button>
<?
//<button id='parse_data'>Set sheet</button>
?>
<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
<input type="button" value="Close"
onclick="google.script.host.close()" />
</body>
<script>
const filters = document.getElementById('filters');
const buttons = Array.from(document.getElementsByClassName('btn'));
const showAll = document.getElementById('show_all');
const parseData = document.getElementById('parse_data');
//Assign buttons for filtering
buttons.forEach( bt => {
bt.onclick = function(e) {
console.log(e.target.innerText);
google.script.run.filterBtn(e.target.innerText);
}
});
//Show all rows
showAll.onclick = function() {
google.script.run.showAllRows();
}
parseData.onClick = function() {
}
document.body.onload = function() {
//console.log(buttons[0].innerHTML);
//alert(filter)
//filters.innerHTML = filter[0];
}
</script>
<script src="https://apis.google.com/js/api.js?onload=onApiLoad">
</script>
</html>