-
Notifications
You must be signed in to change notification settings - Fork 8
/
index.html
executable file
·153 lines (147 loc) · 5.9 KB
/
index.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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<!doctype html>
<html>
<head>
<script type="text/javascript" src="progress.js"></script>
<link type="text/css" rel="stylesheet" href="progress.css" />
<style type="text/css">
/* demo page definitions */
html, body {
font-family: Impact, Charcoal, sans-serif;
color: #555;
margin-left: 17px;
}
h2 {
margin-bottom: 4px;
font-size: 18px;
}
a {
color: #555;
font-weight: bold;
}
p {
font-size: 13px;
border: 1px dashed #555;
padding: 10px;
margin-bottom: 25px;
}
div#content {
width: 500px;
}
div.code {
margin-top: 5px;
}
div.code span {
font-family: Lucida Console, Monaco, monospace;
font-size: 11px;
}
/* base definitions, can be overridden via id */
.outerDiv {
width: 100%;
background-color: #dddddd;
border-radius: 5px;
text-align: center;
}
.outerDiv span {
color: white;
font-weight: bold;
position: relative;
height: 0;
display: block;
}
.innerDiv {
width: 0;
border-radius: 5px;
background-image: url("fastChecks/barAnimation/stripes.png");
width: 100%;
height: 20px;
}
/* override of base definitions for single progress bars */
#progress4 .innerDiv {
background-image: url("fastChecks/barAnimation/stripes2.gif");
}
#progress5 .innerDiv {
background-image: none;
background-color: green;
}
#progress6 {
background-color: #888;
}
</style>
<script type="text/javascript">
window.setTimeout(function() {
var chargeBar = new Progress.bar({ id: "progress1", autoRemove: false, backgroundSpeed: 5, type: "charge" });
chargeBar.renderTo(document.getElementById('chargeBar'));
var chargeBar2 = new Progress.bar({ id: "progress2", autoRemove: false, backgroundSpeed: -5, type: "charge" });
chargeBar2.renderTo(document.getElementById('chargeBar2'));
var chargeBar3 = new Progress.bar({ id: "progress6", autoRemove: false, backgroundSpeed: 5, type: "charge", showPercentage: true });
chargeBar3.renderTo(document.getElementById('chargeBar3'));
var dischargeBar = new Progress.bar({ id: "progress3", autoRemove: false, backgroundSpeed: 5, type: "discharge" });
dischargeBar.renderTo(document.getElementById('dischargeBar'));
var dischargeBar2 = new Progress.bar({ id: "progress4", autoRemove: false, backgroundSpeed: -5, type: "discharge" });
dischargeBar2.renderTo(document.getElementById('dischargeBar2'));
var dischargeBar3 = new Progress.bar({ id: "progress5", autoRemove: false, backgroundSpeed: -5, type: "discharge" });
dischargeBar3.renderTo(document.getElementById('dischargeBar3'));
var percent = 0;
window.setInterval(function() {
percent = percent + Math.floor(Math.random()*10);
percent = percent >= 100 ? 0 : percent;
chargeBar.update(percent);
}, 500);
var percent2 = 0;
window.setInterval(function() {
percent2 = percent2 + Math.floor(Math.random()*10);
percent2 = percent2 >= 100 ? 0 : percent2;
chargeBar2.update(percent2);
}, 400);
var percent3 = 100;
window.setInterval(function() {
percent3 = percent3 - Math.floor(Math.random()*15);
percent3 = percent3 <= 0 ? 100 : percent3;
dischargeBar.update(percent3);
}, 500);
var percent4 = 100;
window.setInterval(function() {
percent4 = percent4 - Math.floor(Math.random()*20);
percent4 = percent4 <= 0 ? 100 : percent4;
dischargeBar2.update(percent4);
}, 700);
var percent5 = 100;
window.setInterval(function() {
percent5 = percent5 - Math.floor(Math.random()*10);
percent5 = percent5 <= 0 ? 100 : percent5;
dischargeBar3.update(percent5);
}, 700);
var percent6 = 0;
window.setInterval(function() {
percent6 = percent6 + Math.floor(Math.random()*10);
percent6 = percent6 >= 100 ? 0 : percent6;
chargeBar3.update(percent6);
}, 700);
}, 500)
</script>
</head>
<body>
<div id="content">
<h1>progress.js</h1>
<p><strong>NOTE:</strong> In case you did not get here via github, the <a href="https://github.com/mdix/progress.js">Documentation</a> is over there.</p>
<h2>charge bar</h2>
<div id="chargeBar"></div>
<div class="code"><span>new Progress.bar({ id: "progress1", autoRemove: false, backgroundSpeed: 5, type: "charge" });</span></div>
<h2>charge bar 2</h2>
<div id="chargeBar2"></div>
<div class="code"><span>new Progress.bar({ id: "progress2", autoRemove: false, backgroundSpeed: -5, type: "charge" });</span></div>
<h2>charge bar 3 (percentage display)</h2>
<div id="chargeBar3"></div>
<div class="code"><span>new Progress.bar({ id: "progress6", autoRemove: false, backgroundSpeed: 5, type: "charge", showPercentage: true });</span></div>
<h2>discharge bar</h2>
<div id="dischargeBar"></div>
<div class="code"><span>new Progress.bar({ id: "progress3", autoRemove: false, backgroundSpeed: 5, type: "discharge" });</span></div>
<h2>discharge bar</h2>
<div id="dischargeBar2"></div>
<div class="code"><span>new Progress.bar({ id: "progress4", autoRemove: false, backgroundSpeed: -5, type: "discharge" });</span></div>
<h2>discharge bar (solid)</h2>
<div id="dischargeBar3"></div>
<div class="code"><span>new Progress.bar({ id: "progress5", autoRemove: false, backgroundSpeed: -5, type: "discharge" });</span></div>
</div>
</body>
</html>