-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathlof-config.html
96 lines (91 loc) · 2.69 KB
/
lof-config.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
86
87
88
89
90
91
92
93
94
95
96
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<link rel='stylesheet' href='https://ssl.gstatic.com/docs/script/css/add-ons1.css'>
<?!= include('loader-style'); ?>
<style>
.load-overlay {
margin-top: 60px;
}
.order-box {
width: 40px;
}
.title {
font-weight: bold;
height: 1.2rem;
}
.row {
height: 50px;
}
.buttons {
margin-top: 26px;
}
.actions__button {
margin-right: 8px !important;
}
</style>
</head>
<body>
<div class='load-overlay'>
<div class='loader'>
<span class='l-1'></span>
<span class='l-2'></span>
<span class='l-3'></span>
<span class='l-4'></span>
<span class='l-5'></span>
<span class='l-6'></span>
</div>
</div>
<form id='form__main' hidden>
<div class='row'>
<div id='fig' class='title'>Figures</div>
<div class='inputs'>
<label for="fig-enabled">Enabled</label>
<input id='fig-enabled' name='fig-enabled' type='checkbox'>
<label for="fig-order">Order</label>
<input id='fig-order' class='order-box' value=0 name='fig-order' type='number'>
</div>
</div>
<div class='row'>
<div id='tab' class='title'>Tables</div>
<div class='inputs'>
<label for="tab-enabled">Enabled</label>
<input id='tab-enabled' name='tab-enabled' type='checkbox'>
<label for="tab-order">Order</label>
<input id='tab-order' class='order-box' value=0 name='tab-order' type='number'>
</div>
</div>
<div class='buttons'>
<input type='submit' name='save' class='actions__button blue' id='save' value='Save'>
<button class='actions__button' id='cancel' onclick='close()'>Cancel</button>
</div>
</form>
</body>
<script src='//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js'></script>
<script>
$(function () {
google.script.run.withSuccessHandler(initialise).getLofConfig()
})
function initialise(lofSettings) {
for (const code in lofSettings) {
$('#' + code + '-enabled').prop('checked', true)
$('#' + code + '-order').val(lofSettings[code].order)
}
$('.load-overlay').hide()
$('#form__main').show()
}
$('#form__main').submit(function (e) {
e.preventDefault()
const values = {}
for (const code of ['fig', 'tab']) {
if (!$('#' + code + '-enabled').prop('checked')) continue
values[code] = {'order': parseInt($('#' + code + '-order').val())}
}
google.script.run.withSuccessHandler(close).saveLofConfig(values)
})
function close() {
google.script.host.close()
}
</script>
</html>