-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDialogJavaScript.html
More file actions
44 lines (37 loc) · 1.16 KB
/
DialogJavaScript.html
File metadata and controls
44 lines (37 loc) · 1.16 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
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>
/**
* Run initializations on dialog load.
*/
$(function() {
// Assign handler functions to dialog elements here, if needed.
$('#alt-text-form').submit(onTextSave);
});
/**
* Calls the server to modify the document.
* Changes the document title to match the dialog text.
*/
function onTextSave() {
this.disabled = true;
// Gather any information that needs to be sent to the server here.
var altTexts = [];
for (var i = 0; i < imageAlt.length; i++) {
altTexts.push(document.getElementById('alt-text-' + i).value);
}
// Send the value to the server and handle the response.
google.script.run
.withSuccessHandler(
function(msg, element) {
// Respond to success conditions here.
element.disabled = false;
})
.withFailureHandler(
function(msg, element) {
// Respond to failure conditions here.
element.disabled = false;
})
.withUserObject(this)
.setAltText(altTexts);
return false;
}
</script>