-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScripts.html
More file actions
67 lines (49 loc) · 1.76 KB
/
Copy pathScripts.html
File metadata and controls
67 lines (49 loc) · 1.76 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
<script>
(function(e,t,n){
var r=e.querySelectorAll("html")[0];
r.className=r.className.replace(/(^|\s)no-js(\s|$)/,"$1js$2")})(document,window,0);
/*
By Osvaldas Valutis, www.osvaldas.info
Available for use under the MIT License
*/
//this script was modified for that particular form demonstration
'use strict';
;( function ( document, window, index )
{
var inputs = document.querySelectorAll( '.upload input' );
Array.prototype.forEach.call( inputs, function( input )
{
var label = input.nextElementSibling.nextElementSibling,
labelVal = label.innerHTML;
input.addEventListener( 'change', function( e )
{
var fileName = e.target.value.split( '\\' ).pop();
if( fileName )
label.innerHTML = fileName;
else
label.innerHTML = labelVal;
});
// Firefox bug fix
input.addEventListener( 'focus', function(){ input.classList.add( 'has-focus' ); });
input.addEventListener( 'blur', function(){ input.classList.remove( 'has-focus' ); });
});
}( document, window, 0 ));
function preventSubmit() {
var frm = document.getElementById('upload_form');
frm.addEventListener('submit', function(event) {
event.preventDefault();
}, false);
}
window.addEventListener('load', preventSubmit);
function formSubmit(formObject) {
document.getElementsByClassName("required-asterisk")[0].style.display = "none";
document.getElementsByClassName("form-content")[0].innerHTML = 'Sending...';
google.script.run.withSuccessHandler(onSuccess).withFailureHandler(onFailure).uploadFiles(formObject);
}
function onSuccess(respond) {
document.getElementsByClassName("form-content")[0].innerHTML = respond;
}
function onFailure(respond) {
document.getElementsByClassName("form-content")[0].innerHTML = respond;
}
</script>