omf_web 0.9.9 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +31 -0
- data/bin/omf_web_server.rb +157 -0
- data/doc/screenshot2.png +0 -0
- data/doc/widget_detail.png +0 -0
- data/example/demo/data_sources/downloads.rb +2 -1
- data/example/simple/README.md +12 -13
- data/example/simple/create_waveform.rb +29 -0
- data/example/simple/introduction.md +17 -0
- data/example/simple/sample.sq3 +0 -0
- data/example/simple/sample.sql +1008 -0
- data/example/simple/simple.yaml +62 -0
- data/example/simple/simple_dynamic.yaml +66 -0
- data/lib/irods4r/file.rb +15 -14
- data/lib/irods4r/icommands.rb +18 -18
- data/lib/irods4r.rb +9 -9
- data/lib/omf-web/config.ru +41 -16
- data/lib/omf-web/content/git_repository.rb +32 -31
- data/lib/omf-web/content/irods_repository.rb +34 -33
- data/lib/omf-web/content/repository.rb +48 -44
- data/lib/omf-web/data_source_proxy.rb +33 -22
- data/lib/omf-web/rack/session_authenticator.rb +48 -12
- data/lib/omf-web/rack/tab_mapper.rb +30 -36
- data/lib/omf-web/rack/websocket_handler.rb +26 -25
- data/lib/omf-web/session_store.rb +16 -13
- data/lib/omf-web/theme/abstract_page.rb +26 -22
- data/lib/omf-web/theme/bright/page.rb +84 -34
- data/lib/omf-web/theme/bright/stacked_renderer.rb +20 -19
- data/lib/omf-web/theme.rb +14 -9
- data/lib/omf-web/thin/runner.rb +38 -36
- data/lib/omf-web/thin/server.rb +255 -0
- data/lib/omf-web/version.rb +1 -1
- data/lib/omf-web/widget/data_widget.rb +6 -6
- data/lib/omf-web/widget/text/maruku/helpers.rb +33 -30
- data/lib/omf-web/widget/text/maruku/input/parse_block.rb +117 -117
- data/lib/omf-web/widget/text/maruku/output/to_html.rb +155 -154
- data/lib/omf-web/widget/text/maruku.rb +17 -16
- data/omf_web.gemspec +6 -2
- data/sample.sq3 +0 -0
- data/share/htdocs/graph/js/gauge.js +524 -0
- data/share/htdocs/vendor/VERSION_MAP.yaml +3 -3
- data/share/htdocs/vendor/backbone-1.0.0/backbone.js +1571 -0
- data/share/htdocs/vendor/d3-3.0/LICENSE.brewer.txt +38 -0
- data/share/htdocs/vendor/d3-3.0/colorbrewer.js +1 -0
- data/share/htdocs/vendor/d3-3.0/d3.js +8810 -0
- data/share/htdocs/vendor/d3-3.0/d3.min.js +5 -0
- data/share/htdocs/vendor/geo_json/Readme.txt +71 -0
- data/share/htdocs/vendor/geo_json/regions.json +41 -0
- data/share/htdocs/vendor/geo_json/switzerland.json +24 -0
- data/share/htdocs/vendor/geo_json/world.json +497 -0
- data/share/htdocs/vendor/nv_d3/js/nv.d3.js +8801 -4447
- data/share/htdocs/vendor/spin/jquery.spin.js +46 -0
- data/share/htdocs/vendor/spin/spin.js +349 -0
- data/share/htdocs/vendor/spin/spin.min.js +1 -0
- data/share/htdocs/vendor/underscore-1.4.4/underscore.js +1227 -0
- metadata +63 -48
- data/example/simple/data_sources/gimi31.sq3 +0 -0
- data/example/simple/data_sources/ping_source.rb +0 -56
- data/example/simple/simple_viz_server.rb +0 -39
- data/example/simple/widgets/charts_tab.yaml +0 -38
- data/share/.DS_Store +0 -0
- data/share/htdocs/.DS_Store +0 -0
- data/share/htdocs/vendor/backbone-0.5.3/backbone.js +0 -1158
- data/share/htdocs/vendor/underscore-1.2.1/underscore.js +0 -958
@@ -0,0 +1,46 @@
|
|
1
|
+
|
2
|
+
// Copied from http://fgnass.github.io/spin.js
|
3
|
+
|
4
|
+
// var opts = {
|
5
|
+
// lines: 13, // The number of lines to draw
|
6
|
+
// length: 20, // The length of each line
|
7
|
+
// width: 10, // The line thickness
|
8
|
+
// radius: 30, // The radius of the inner circle
|
9
|
+
// corners: 1, // Corner roundness (0..1)
|
10
|
+
// rotate: 0, // The rotation offset
|
11
|
+
// direction: 1, // 1: clockwise, -1: counterclockwise
|
12
|
+
// color: '#000', // #rgb or #rrggbb
|
13
|
+
// speed: 1, // Rounds per second
|
14
|
+
// trail: 60, // Afterglow percentage
|
15
|
+
// shadow: false, // Whether to render a shadow
|
16
|
+
// hwaccel: false, // Whether to use hardware acceleration
|
17
|
+
// className: 'spinner', // The CSS class to assign to the spinner
|
18
|
+
// zIndex: 2e9, // The z-index (defaults to 2000000000)
|
19
|
+
// top: 'auto', // Top position relative to parent in px
|
20
|
+
// left: 'auto' // Left position relative to parent in px
|
21
|
+
// };
|
22
|
+
|
23
|
+
function _jquery_spin_() {
|
24
|
+
$.fn.spin = function(opts) {
|
25
|
+
this.each(function() {
|
26
|
+
var $this = $(this),
|
27
|
+
data = $this.data();
|
28
|
+
|
29
|
+
if (data.spinner) {
|
30
|
+
data.spinner.stop();
|
31
|
+
delete data.spinner;
|
32
|
+
}
|
33
|
+
if (opts !== false) {
|
34
|
+
data.spinner = new Spinner($.extend({left: '0px', color: $this.css('color')}, opts)).spin(this);
|
35
|
+
}
|
36
|
+
});
|
37
|
+
return this;
|
38
|
+
};
|
39
|
+
}
|
40
|
+
|
41
|
+
if (L != undefined) {
|
42
|
+
L.provide('jquery.spin', ['/resource/vendor/spin/spin.min.js'], _jquery_spin_);
|
43
|
+
} else {
|
44
|
+
// This assumes that /resource/vendor/spin/spin.min.js has already been loaded
|
45
|
+
_jquery_spin_();
|
46
|
+
}
|
@@ -0,0 +1,349 @@
|
|
1
|
+
//fgnass.github.com/spin.js#v1.3
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Copyright (c) 2011-2013 Felix Gnass
|
5
|
+
* Licensed under the MIT license
|
6
|
+
*/
|
7
|
+
(function(root, factory) {
|
8
|
+
|
9
|
+
/* CommonJS */
|
10
|
+
if (typeof exports == 'object') module.exports = factory()
|
11
|
+
|
12
|
+
/* AMD module */
|
13
|
+
else if (typeof define == 'function' && define.amd) define(factory)
|
14
|
+
|
15
|
+
/* Browser global */
|
16
|
+
else root.Spinner = factory()
|
17
|
+
}
|
18
|
+
(this, function() {
|
19
|
+
"use strict";
|
20
|
+
|
21
|
+
var prefixes = ['webkit', 'Moz', 'ms', 'O'] /* Vendor prefixes */
|
22
|
+
, animations = {} /* Animation rules keyed by their name */
|
23
|
+
, useCssAnimations /* Whether to use CSS animations or setTimeout */
|
24
|
+
|
25
|
+
/**
|
26
|
+
* Utility function to create elements. If no tag name is given,
|
27
|
+
* a DIV is created. Optionally properties can be passed.
|
28
|
+
*/
|
29
|
+
function createEl(tag, prop) {
|
30
|
+
var el = document.createElement(tag || 'div')
|
31
|
+
, n
|
32
|
+
|
33
|
+
for(n in prop) el[n] = prop[n]
|
34
|
+
return el
|
35
|
+
}
|
36
|
+
|
37
|
+
/**
|
38
|
+
* Appends children and returns the parent.
|
39
|
+
*/
|
40
|
+
function ins(parent /* child1, child2, ...*/) {
|
41
|
+
for (var i=1, n=arguments.length; i<n; i++)
|
42
|
+
parent.appendChild(arguments[i])
|
43
|
+
|
44
|
+
return parent
|
45
|
+
}
|
46
|
+
|
47
|
+
/**
|
48
|
+
* Insert a new stylesheet to hold the @keyframe or VML rules.
|
49
|
+
*/
|
50
|
+
var sheet = (function() {
|
51
|
+
var el = createEl('style', {type : 'text/css'})
|
52
|
+
ins(document.getElementsByTagName('head')[0], el)
|
53
|
+
return el.sheet || el.styleSheet
|
54
|
+
}())
|
55
|
+
|
56
|
+
/**
|
57
|
+
* Creates an opacity keyframe animation rule and returns its name.
|
58
|
+
* Since most mobile Webkits have timing issues with animation-delay,
|
59
|
+
* we create separate rules for each line/segment.
|
60
|
+
*/
|
61
|
+
function addAnimation(alpha, trail, i, lines) {
|
62
|
+
var name = ['opacity', trail, ~~(alpha*100), i, lines].join('-')
|
63
|
+
, start = 0.01 + i/lines * 100
|
64
|
+
, z = Math.max(1 - (1-alpha) / trail * (100-start), alpha)
|
65
|
+
, prefix = useCssAnimations.substring(0, useCssAnimations.indexOf('Animation')).toLowerCase()
|
66
|
+
, pre = prefix && '-' + prefix + '-' || ''
|
67
|
+
|
68
|
+
if (!animations[name]) {
|
69
|
+
sheet.insertRule(
|
70
|
+
'@' + pre + 'keyframes ' + name + '{' +
|
71
|
+
'0%{opacity:' + z + '}' +
|
72
|
+
start + '%{opacity:' + alpha + '}' +
|
73
|
+
(start+0.01) + '%{opacity:1}' +
|
74
|
+
(start+trail) % 100 + '%{opacity:' + alpha + '}' +
|
75
|
+
'100%{opacity:' + z + '}' +
|
76
|
+
'}', sheet.cssRules.length)
|
77
|
+
|
78
|
+
animations[name] = 1
|
79
|
+
}
|
80
|
+
|
81
|
+
return name
|
82
|
+
}
|
83
|
+
|
84
|
+
/**
|
85
|
+
* Tries various vendor prefixes and returns the first supported property.
|
86
|
+
*/
|
87
|
+
function vendor(el, prop) {
|
88
|
+
var s = el.style
|
89
|
+
, pp
|
90
|
+
, i
|
91
|
+
|
92
|
+
if(s[prop] !== undefined) return prop
|
93
|
+
prop = prop.charAt(0).toUpperCase() + prop.slice(1)
|
94
|
+
for(i=0; i<prefixes.length; i++) {
|
95
|
+
pp = prefixes[i]+prop
|
96
|
+
if(s[pp] !== undefined) return pp
|
97
|
+
}
|
98
|
+
}
|
99
|
+
|
100
|
+
/**
|
101
|
+
* Sets multiple style properties at once.
|
102
|
+
*/
|
103
|
+
function css(el, prop) {
|
104
|
+
for (var n in prop)
|
105
|
+
el.style[vendor(el, n)||n] = prop[n]
|
106
|
+
|
107
|
+
return el
|
108
|
+
}
|
109
|
+
|
110
|
+
/**
|
111
|
+
* Fills in default values.
|
112
|
+
*/
|
113
|
+
function merge(obj) {
|
114
|
+
for (var i=1; i < arguments.length; i++) {
|
115
|
+
var def = arguments[i]
|
116
|
+
for (var n in def)
|
117
|
+
if (obj[n] === undefined) obj[n] = def[n]
|
118
|
+
}
|
119
|
+
return obj
|
120
|
+
}
|
121
|
+
|
122
|
+
/**
|
123
|
+
* Returns the absolute page-offset of the given element.
|
124
|
+
*/
|
125
|
+
function pos(el) {
|
126
|
+
var o = { x:el.offsetLeft, y:el.offsetTop }
|
127
|
+
while((el = el.offsetParent))
|
128
|
+
o.x+=el.offsetLeft, o.y+=el.offsetTop
|
129
|
+
|
130
|
+
return o
|
131
|
+
}
|
132
|
+
|
133
|
+
// Built-in defaults
|
134
|
+
|
135
|
+
var defaults = {
|
136
|
+
lines: 12, // The number of lines to draw
|
137
|
+
length: 7, // The length of each line
|
138
|
+
width: 5, // The line thickness
|
139
|
+
radius: 10, // The radius of the inner circle
|
140
|
+
rotate: 0, // Rotation offset
|
141
|
+
corners: 1, // Roundness (0..1)
|
142
|
+
color: '#000', // #rgb or #rrggbb
|
143
|
+
direction: 1, // 1: clockwise, -1: counterclockwise
|
144
|
+
speed: 1, // Rounds per second
|
145
|
+
trail: 100, // Afterglow percentage
|
146
|
+
opacity: 1/4, // Opacity of the lines
|
147
|
+
fps: 20, // Frames per second when using setTimeout()
|
148
|
+
zIndex: 2e9, // Use a high z-index by default
|
149
|
+
className: 'spinner', // CSS class to assign to the element
|
150
|
+
top: 'auto', // center vertically
|
151
|
+
left: 'auto', // center horizontally
|
152
|
+
position: 'relative' // element position
|
153
|
+
}
|
154
|
+
|
155
|
+
/** The constructor */
|
156
|
+
function Spinner(o) {
|
157
|
+
if (typeof this == 'undefined') return new Spinner(o)
|
158
|
+
this.opts = merge(o || {}, Spinner.defaults, defaults)
|
159
|
+
}
|
160
|
+
|
161
|
+
// Global defaults that override the built-ins:
|
162
|
+
Spinner.defaults = {}
|
163
|
+
|
164
|
+
merge(Spinner.prototype, {
|
165
|
+
|
166
|
+
/**
|
167
|
+
* Adds the spinner to the given target element. If this instance is already
|
168
|
+
* spinning, it is automatically removed from its previous target b calling
|
169
|
+
* stop() internally.
|
170
|
+
*/
|
171
|
+
spin: function(target) {
|
172
|
+
this.stop()
|
173
|
+
|
174
|
+
var self = this
|
175
|
+
, o = self.opts
|
176
|
+
, el = self.el = css(createEl(0, {className: o.className}), {position: o.position, width: 0, zIndex: o.zIndex})
|
177
|
+
, mid = o.radius+o.length+o.width
|
178
|
+
, ep // element position
|
179
|
+
, tp // target position
|
180
|
+
|
181
|
+
if (target) {
|
182
|
+
target.insertBefore(el, target.firstChild||null)
|
183
|
+
tp = pos(target)
|
184
|
+
ep = pos(el)
|
185
|
+
css(el, {
|
186
|
+
left: (o.left == 'auto' ? tp.x-ep.x + (target.offsetWidth >> 1) : parseInt(o.left, 10) + mid) + 'px',
|
187
|
+
top: (o.top == 'auto' ? tp.y-ep.y + (target.offsetHeight >> 1) : parseInt(o.top, 10) + mid) + 'px'
|
188
|
+
})
|
189
|
+
}
|
190
|
+
|
191
|
+
el.setAttribute('role', 'progressbar')
|
192
|
+
self.lines(el, self.opts)
|
193
|
+
|
194
|
+
if (!useCssAnimations) {
|
195
|
+
// No CSS animation support, use setTimeout() instead
|
196
|
+
var i = 0
|
197
|
+
, start = (o.lines - 1) * (1 - o.direction) / 2
|
198
|
+
, alpha
|
199
|
+
, fps = o.fps
|
200
|
+
, f = fps/o.speed
|
201
|
+
, ostep = (1-o.opacity) / (f*o.trail / 100)
|
202
|
+
, astep = f/o.lines
|
203
|
+
|
204
|
+
;(function anim() {
|
205
|
+
i++;
|
206
|
+
for (var j = 0; j < o.lines; j++) {
|
207
|
+
alpha = Math.max(1 - (i + (o.lines - j) * astep) % f * ostep, o.opacity)
|
208
|
+
|
209
|
+
self.opacity(el, j * o.direction + start, alpha, o)
|
210
|
+
}
|
211
|
+
self.timeout = self.el && setTimeout(anim, ~~(1000/fps))
|
212
|
+
})()
|
213
|
+
}
|
214
|
+
return self
|
215
|
+
},
|
216
|
+
|
217
|
+
/**
|
218
|
+
* Stops and removes the Spinner.
|
219
|
+
*/
|
220
|
+
stop: function() {
|
221
|
+
var el = this.el
|
222
|
+
if (el) {
|
223
|
+
clearTimeout(this.timeout)
|
224
|
+
if (el.parentNode) el.parentNode.removeChild(el)
|
225
|
+
this.el = undefined
|
226
|
+
}
|
227
|
+
return this
|
228
|
+
},
|
229
|
+
|
230
|
+
/**
|
231
|
+
* Internal method that draws the individual lines. Will be overwritten
|
232
|
+
* in VML fallback mode below.
|
233
|
+
*/
|
234
|
+
lines: function(el, o) {
|
235
|
+
var i = 0
|
236
|
+
, start = (o.lines - 1) * (1 - o.direction) / 2
|
237
|
+
, seg
|
238
|
+
|
239
|
+
function fill(color, shadow) {
|
240
|
+
return css(createEl(), {
|
241
|
+
position: 'absolute',
|
242
|
+
width: (o.length+o.width) + 'px',
|
243
|
+
height: o.width + 'px',
|
244
|
+
background: color,
|
245
|
+
boxShadow: shadow,
|
246
|
+
transformOrigin: 'left',
|
247
|
+
transform: 'rotate(' + ~~(360/o.lines*i+o.rotate) + 'deg) translate(' + o.radius+'px' +',0)',
|
248
|
+
borderRadius: (o.corners * o.width>>1) + 'px'
|
249
|
+
})
|
250
|
+
}
|
251
|
+
|
252
|
+
for (; i < o.lines; i++) {
|
253
|
+
seg = css(createEl(), {
|
254
|
+
position: 'absolute',
|
255
|
+
top: 1+~(o.width/2) + 'px',
|
256
|
+
transform: o.hwaccel ? 'translate3d(0,0,0)' : '',
|
257
|
+
opacity: o.opacity,
|
258
|
+
animation: useCssAnimations && addAnimation(o.opacity, o.trail, start + i * o.direction, o.lines) + ' ' + 1/o.speed + 's linear infinite'
|
259
|
+
})
|
260
|
+
|
261
|
+
if (o.shadow) ins(seg, css(fill('#000', '0 0 4px ' + '#000'), {top: 2+'px'}))
|
262
|
+
|
263
|
+
ins(el, ins(seg, fill(o.color, '0 0 1px rgba(0,0,0,.1)')))
|
264
|
+
}
|
265
|
+
return el
|
266
|
+
},
|
267
|
+
|
268
|
+
/**
|
269
|
+
* Internal method that adjusts the opacity of a single line.
|
270
|
+
* Will be overwritten in VML fallback mode below.
|
271
|
+
*/
|
272
|
+
opacity: function(el, i, val) {
|
273
|
+
if (i < el.childNodes.length) el.childNodes[i].style.opacity = val
|
274
|
+
}
|
275
|
+
|
276
|
+
})
|
277
|
+
|
278
|
+
|
279
|
+
function initVML() {
|
280
|
+
|
281
|
+
/* Utility function to create a VML tag */
|
282
|
+
function vml(tag, attr) {
|
283
|
+
return createEl('<' + tag + ' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">', attr)
|
284
|
+
}
|
285
|
+
|
286
|
+
// No CSS transforms but VML support, add a CSS rule for VML elements:
|
287
|
+
sheet.addRule('.spin-vml', 'behavior:url(#default#VML)')
|
288
|
+
|
289
|
+
Spinner.prototype.lines = function(el, o) {
|
290
|
+
var r = o.length+o.width
|
291
|
+
, s = 2*r
|
292
|
+
|
293
|
+
function grp() {
|
294
|
+
return css(
|
295
|
+
vml('group', {
|
296
|
+
coordsize: s + ' ' + s,
|
297
|
+
coordorigin: -r + ' ' + -r
|
298
|
+
}),
|
299
|
+
{ width: s, height: s }
|
300
|
+
)
|
301
|
+
}
|
302
|
+
|
303
|
+
var margin = -(o.width+o.length)*2 + 'px'
|
304
|
+
, g = css(grp(), {position: 'absolute', top: margin, left: margin})
|
305
|
+
, i
|
306
|
+
|
307
|
+
function seg(i, dx, filter) {
|
308
|
+
ins(g,
|
309
|
+
ins(css(grp(), {rotation: 360 / o.lines * i + 'deg', left: ~~dx}),
|
310
|
+
ins(css(vml('roundrect', {arcsize: o.corners}), {
|
311
|
+
width: r,
|
312
|
+
height: o.width,
|
313
|
+
left: o.radius,
|
314
|
+
top: -o.width>>1,
|
315
|
+
filter: filter
|
316
|
+
}),
|
317
|
+
vml('fill', {color: o.color, opacity: o.opacity}),
|
318
|
+
vml('stroke', {opacity: 0}) // transparent stroke to fix color bleeding upon opacity change
|
319
|
+
)
|
320
|
+
)
|
321
|
+
)
|
322
|
+
}
|
323
|
+
|
324
|
+
if (o.shadow)
|
325
|
+
for (i = 1; i <= o.lines; i++)
|
326
|
+
seg(i, -2, 'progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)')
|
327
|
+
|
328
|
+
for (i = 1; i <= o.lines; i++) seg(i)
|
329
|
+
return ins(el, g)
|
330
|
+
}
|
331
|
+
|
332
|
+
Spinner.prototype.opacity = function(el, i, val, o) {
|
333
|
+
var c = el.firstChild
|
334
|
+
o = o.shadow && o.lines || 0
|
335
|
+
if (c && i+o < c.childNodes.length) {
|
336
|
+
c = c.childNodes[i+o]; c = c && c.firstChild; c = c && c.firstChild
|
337
|
+
if (c) c.opacity = val
|
338
|
+
}
|
339
|
+
}
|
340
|
+
}
|
341
|
+
|
342
|
+
var probe = css(createEl('group'), {behavior: 'url(#default#VML)'})
|
343
|
+
|
344
|
+
if (!vendor(probe, 'transform') && probe.adj) initVML()
|
345
|
+
else useCssAnimations = vendor(probe, 'animation')
|
346
|
+
|
347
|
+
return Spinner
|
348
|
+
|
349
|
+
}));
|
@@ -0,0 +1 @@
|
|
1
|
+
(function(t,e){if(typeof exports=="object")module.exports=e();else if(typeof define=="function"&&define.amd)define(e);else t.Spinner=e()})(this,function(){"use strict";var t=["webkit","Moz","ms","O"],e={},i;function o(t,e){var i=document.createElement(t||"div"),o;for(o in e)i[o]=e[o];return i}function n(t){for(var e=1,i=arguments.length;e<i;e++)t.appendChild(arguments[e]);return t}var r=function(){var t=o("style",{type:"text/css"});n(document.getElementsByTagName("head")[0],t);return t.sheet||t.styleSheet}();function s(t,o,n,s){var a=["opacity",o,~~(t*100),n,s].join("-"),f=.01+n/s*100,l=Math.max(1-(1-t)/o*(100-f),t),d=i.substring(0,i.indexOf("Animation")).toLowerCase(),u=d&&"-"+d+"-"||"";if(!e[a]){r.insertRule("@"+u+"keyframes "+a+"{"+"0%{opacity:"+l+"}"+f+"%{opacity:"+t+"}"+(f+.01)+"%{opacity:1}"+(f+o)%100+"%{opacity:"+t+"}"+"100%{opacity:"+l+"}"+"}",r.cssRules.length);e[a]=1}return a}function a(e,i){var o=e.style,n,r;if(o[i]!==undefined)return i;i=i.charAt(0).toUpperCase()+i.slice(1);for(r=0;r<t.length;r++){n=t[r]+i;if(o[n]!==undefined)return n}}function f(t,e){for(var i in e)t.style[a(t,i)||i]=e[i];return t}function l(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var o in i)if(t[o]===undefined)t[o]=i[o]}return t}function d(t){var e={x:t.offsetLeft,y:t.offsetTop};while(t=t.offsetParent)e.x+=t.offsetLeft,e.y+=t.offsetTop;return e}var u={lines:12,length:7,width:5,radius:10,rotate:0,corners:1,color:"#000",direction:1,speed:1,trail:100,opacity:1/4,fps:20,zIndex:2e9,className:"spinner",top:"auto",left:"auto",position:"relative"};function p(t){if(typeof this=="undefined")return new p(t);this.opts=l(t||{},p.defaults,u)}p.defaults={};l(p.prototype,{spin:function(t){this.stop();var e=this,n=e.opts,r=e.el=f(o(0,{className:n.className}),{position:n.position,width:0,zIndex:n.zIndex}),s=n.radius+n.length+n.width,a,l;if(t){t.insertBefore(r,t.firstChild||null);l=d(t);a=d(r);f(r,{left:(n.left=="auto"?l.x-a.x+(t.offsetWidth>>1):parseInt(n.left,10)+s)+"px",top:(n.top=="auto"?l.y-a.y+(t.offsetHeight>>1):parseInt(n.top,10)+s)+"px"})}r.setAttribute("role","progressbar");e.lines(r,e.opts);if(!i){var u=0,p=(n.lines-1)*(1-n.direction)/2,c,h=n.fps,m=h/n.speed,y=(1-n.opacity)/(m*n.trail/100),g=m/n.lines;(function v(){u++;for(var t=0;t<n.lines;t++){c=Math.max(1-(u+(n.lines-t)*g)%m*y,n.opacity);e.opacity(r,t*n.direction+p,c,n)}e.timeout=e.el&&setTimeout(v,~~(1e3/h))})()}return e},stop:function(){var t=this.el;if(t){clearTimeout(this.timeout);if(t.parentNode)t.parentNode.removeChild(t);this.el=undefined}return this},lines:function(t,e){var r=0,a=(e.lines-1)*(1-e.direction)/2,l;function d(t,i){return f(o(),{position:"absolute",width:e.length+e.width+"px",height:e.width+"px",background:t,boxShadow:i,transformOrigin:"left",transform:"rotate("+~~(360/e.lines*r+e.rotate)+"deg) translate("+e.radius+"px"+",0)",borderRadius:(e.corners*e.width>>1)+"px"})}for(;r<e.lines;r++){l=f(o(),{position:"absolute",top:1+~(e.width/2)+"px",transform:e.hwaccel?"translate3d(0,0,0)":"",opacity:e.opacity,animation:i&&s(e.opacity,e.trail,a+r*e.direction,e.lines)+" "+1/e.speed+"s linear infinite"});if(e.shadow)n(l,f(d("#000","0 0 4px "+"#000"),{top:2+"px"}));n(t,n(l,d(e.color,"0 0 1px rgba(0,0,0,.1)")))}return t},opacity:function(t,e,i){if(e<t.childNodes.length)t.childNodes[e].style.opacity=i}});function c(){function t(t,e){return o("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">',e)}r.addRule(".spin-vml","behavior:url(#default#VML)");p.prototype.lines=function(e,i){var o=i.length+i.width,r=2*o;function s(){return f(t("group",{coordsize:r+" "+r,coordorigin:-o+" "+-o}),{width:r,height:r})}var a=-(i.width+i.length)*2+"px",l=f(s(),{position:"absolute",top:a,left:a}),d;function u(e,r,a){n(l,n(f(s(),{rotation:360/i.lines*e+"deg",left:~~r}),n(f(t("roundrect",{arcsize:i.corners}),{width:o,height:i.width,left:i.radius,top:-i.width>>1,filter:a}),t("fill",{color:i.color,opacity:i.opacity}),t("stroke",{opacity:0}))))}if(i.shadow)for(d=1;d<=i.lines;d++)u(d,-2,"progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)");for(d=1;d<=i.lines;d++)u(d);return n(e,l)};p.prototype.opacity=function(t,e,i,o){var n=t.firstChild;o=o.shadow&&o.lines||0;if(n&&e+o<n.childNodes.length){n=n.childNodes[e+o];n=n&&n.firstChild;n=n&&n.firstChild;if(n)n.opacity=i}}}var h=f(o("group"),{behavior:"url(#default#VML)"});if(!a(h,"transform")&&h.adj)c();else i=a(h,"animation");return p});
|