forked from googleworkspace/apps-script-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDialog.html
More file actions
81 lines (71 loc) · 2.4 KB
/
Dialog.html
File metadata and controls
81 lines (71 loc) · 2.4 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
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
<!DOCTYPE html>
<!--
Copyright 2015 Google Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License
-->
<html>
<head>
<link rel="stylesheet" href="https://ssl.gstatic.com/docs/script/css/add-ons.css">
</head>
<body>
<form onsubmit="onSubmit(); return false;">
<p>Content goes here...</p>
<section class="button-bar">
<input type="submit" id="type" class="action" value="Submit" />
<button onclick="cancel(); return false;">Cancel</button>
</section>
</form>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<?!= include('Intercom.js'); ?>
<script>
/**
* The ID of this dialog. This is set once when the template is rendered.
*/
var DIALOG_ID = '<?= dialogId ?>';
/**
* How often to check-in with the server, in milliseconds.
*/
var CHECKIN_INTERVAL_MS = 500;
/**
* Instance of the Intercom.js library.
*/
var intercom = Intercom.getInstance();
// Sets up an interval to check-in with the server every few seconds, so we can tell
// if it's been X-ed out.
window.setInterval(function() {
intercom.emit(DIALOG_ID, 'checkIn');
}, CHECKIN_INTERVAL_MS);
/**
* Runs when the form is submitted.
*/
function onSubmit() {
// Here is where you would add custom logic specific to your form.
// You may need to make additional google.script.run calls to store various information
// collected in the dialog.
intercom.emit(DIALOG_ID, 'done');
close();
}
/**
* Runs when the cancel button is clicked.
*/
function cancel() {
intercom.emit(DIALOG_ID, 'aborted');
close();
}
/**
* Closes the dialog.
*/
function close() {
google.script.host.close();
}
</script>
</body>
</html>