This repository has been archived by the owner on Jan 28, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Loading.html
123 lines (109 loc) · 4.05 KB
/
Loading.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<?!= include('LoadingCSS'); ?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
</head>
<body>
<div class="progress">
<div class="progress-bar progress-bar-uploading progress-bar-striped active" role="progressbar" id="progressBar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width: 100%;"></div>
</div>
<script>
function whileConvertingDoesntWork(){
var progressBar = $('#progressBar');
progressBar.removeClass('progress-bar-uploading');
progressBar.addClass('progress-bar-converting');
inserting();
}
whileConvertingDoesntWork();
function inserting(){
var progressBar = $('#progressBar');
progressBar.removeClass('progress-bar-converting');
progressBar.removeClass('progress-bar-striped');
progressBar.removeClass('active');
progressBar.addClass('progress-bar-inserting');
progressBar.css('width', '0%');
var interval = setInterval(function() {
google.script.run.withSuccessHandler(updateProgress).progress();
if (progressBar.style.width >= 100) {
clearInterval(interval);
}
}, 1000);
}
function updateProgress(width){
var progressBar = $('#progressBar');
var barWidth = Math.round(width) + "%";
progressBar.css('width', width + '%');
progressBar.html(barWidth);
if (width == 100) {
setTimeout(function () {
google.script.host.close();
}, 4000);
}
}
//Order of changing progress bar
/*
remove progress-bar-uploading
add progress-bar-converting
change aria-valuetext to converting...
change div content to Converting...
--
remove progress-bar-converting
remove progress-bar-striped
remove active
add progress-bar-inserting
change width to 0%
change aria-valuetext to Inserting...
update div content
update width
update aria-valuenow
*/
</script>
<script>
/* function checkerConvertingProgressBar() {
function timerFct() {
if (document.getElementById("checkerConvertingProgressBar").style.width == '100%') {
clearTimeout(timeoutHandler);
document.getElementById("convertingProgressBar").innerHTML = "";
checkerAddingProgressBar();
}
else {
google.script.run.withSuccessHandler(updateConvertingProgressBar).progress("convert");
}
}
var turechange = false
, timeoutHandler = setInterval(timerFct, 500);
}
function updateConvertingProgressBar(percentage) {
var progressWithPercentage = percentage + '%';
document.getElementById('convertingProgressBar').style.width = progressWithPercentage;
document.getElementById("convertingProgressBar").innerHTML = progressWithPercentage;
}
checkerConvertingProgressBar();
function checkerAddingProgressBar() {
function timerFct() {
if (document.getElementById("addingProgressBar").style.width == '100%') {
clearTimeout(timeoutHandler);
setTimeout(function () {
google.script.host.close();
}, 4000);
}
else {
google.script.run.withSuccessHandler(updateAddingProgressBar).progress("add");
}
}
var turechange = false
, timeoutHandler = setInterval(timerFct, 500);
}
function updateAddingProgressBar(percentage) {
var progressWithPercentage = percentage + '%';
document.getElementById('addingProgressBar').style.width = progressWithPercentage;
var progressDifference = 100 - percentage;
document.getElementById('convertingProgressBar').style.width = progressDifference;
document.getElementById("addingProgressBar").innerHTML = progressWithPercentage;
}
*/
</script>
</body>
</html>