forked from tbep-tech/wq-dash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcssloaders_in_header.html
135 lines (127 loc) · 3.69 KB
/
cssloaders_in_header.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
124
125
126
127
128
129
130
131
132
133
134
135
<style>
.load1 .loader,
.load1 .loader:before,
.load1 .loader:after {
background: #ffffff;
-webkit-animation: load1 1s infinite ease-in-out;
animation: load1 1s infinite ease-in-out;
width: 1em;
height: 4em;
}
.load1 .loader {
color: #ffffff;
text-indent: -9999em;
margin: 88px auto;
position: relative;
font-size: 11px;
-webkit-transform: translateZ(0);
-ms-transform: translateZ(0);
transform: translateZ(0);
-webkit-animation-delay: -0.16s;
animation-delay: -0.16s;
}
.load1 .loader:before,
.load1 .loader:after {
position: absolute;
top: 0;
content: '';
}
.load1 .loader:before {
left: -1.5em;
-webkit-animation-delay: -0.32s;
animation-delay: -0.32s;
}
.load1 .loader:after {
left: 1.5em;
}
@-webkit-keyframes load1 {
0%,
80%,
100% {
box-shadow: 0 0;
height: 4em;
}
40% {
box-shadow: 0 -2em;
height: 5em;
}
}
@keyframes load1 {
0%,
80%,
100% {
box-shadow: 0 0;
height: 4em;
}
40% {
box-shadow: 0 -2em;
height: 5em;
}
}
.shiny-spinner-output-container {
position: relative;
}
.load-container {
position: absolute;
top: 50%;
-webkit-transform: translateY(-50%);
transform: translateY(-50%);
/* to avoid showing a vertical scrollbar
http://stackoverflow.com/questions/38251204/horizontal-animation-causes-vertical-scrollbar-in-css */
overflow:hidden;
width: 100%;
}
.shiny-spinner-hidden {
position: absolute;
top:0;
left:0;
z-index: -1;
visibility:hidden;
}
.load1 .loader, .load1 .loader:before, .load1 .loader:after {background: #0275D8} .load1 .loader {color: #0275D8}
.load1 .loader {font-size: 8px}
</style>
<script>
(function() {
var output_states = [];
function show_spinner(id) {
$("#"+id).siblings(".load-container, .shiny-spinner-placeholder").removeClass('shiny-spinner-hidden');
$("#"+id).siblings(".load-container").siblings('.shiny-bound-output, .shiny-output-error').css('visibility', 'hidden');
// if there is a proxy div, hide the previous output
$("#"+id).siblings(".shiny-spinner-placeholder").siblings('.shiny-bound-output, .shiny-output-error').addClass('shiny-spinner-hidden');
}
function hide_spinner(id) {
$("#"+id).siblings(".load-container, .shiny-spinner-placeholder").addClass('shiny-spinner-hidden');
$("#"+id).siblings(".load-container").siblings('.shiny-bound-output').css('visibility', 'visible');
// if there is a proxy div, show the previous output in case it was hidden
$("#"+id).siblings(".shiny-spinner-placeholder").siblings('.shiny-bound-output').removeClass('shiny-spinner-hidden');
}
function update_spinner(id) {
if (!(id in output_states)) {
show_spinner(id);
}
if (output_states[id] <= 0) {
show_spinner(id);
} else {
hide_spinner(id);
}
}
$(document).on('shiny:bound', function(event){
/* if not bound before, then set the value to 0 */
if (!(event.target.id in output_states)) {
output_states[event.target.id] = 0;
}
update_spinner(event.target.id);
});
/* When recalculating starts, show the spinner container & hide the output */
$(document).on('shiny:outputinvalidated', function(event) {
output_states[event.target.id] = 0;
update_spinner(event.target.id);
});
/* When new value or error comes in, hide spinner container (if any) & show the output */
$(document).on('shiny:value shiny:error', function(event) {
output_states[event.target.id] = 1;
update_spinner(event.target.id);
});
}());
</script>