-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreset board.gs
47 lines (36 loc) · 1015 Bytes
/
reset board.gs
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
function SouthResetButton() {
resetdialog('South')
}
function NorthResetButton() {
resetdialog('North')
}
function EastResetButton() {
resetdialog('East')
}
function WestResetButton() {
resetdialog('West')
}
function SoutheastResetButton() {
resetdialog('Southeast')
}
function SouthwestResetButton() {
resetdialog('Southwest')
}
function NorthwestResetButton() {
resetdialog('Northwest')
}
function NortheastResetButton() {
resetdialog('Northeast')
}
// confirm dialog
function resetdialog(division){
var warningtext = ('Are you sure you want to reset the ' + division + ' division board?!')
var ui = SpreadsheetApp.getUi();
var response = ui.alert('Confirm', warningtext, ui.ButtonSet.YES_NO);
if (response == ui.Button.YES) {
// using string as object name!
eval(division).Reset()
} else {
SpreadsheetApp.getUi().alert('okay be careful next time');
}
}