pace-rails 0.0.9 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +16 -10
- data/app/assets/javascripts/pace/pace.js +167 -53
- data/app/assets/stylesheets/pace/pace-theme-barber-shop.css +2 -1
- data/app/assets/stylesheets/pace/pace-theme-big-counter.css +1 -1
- data/app/assets/stylesheets/pace/pace-theme-bounce.css +1 -0
- data/app/assets/stylesheets/pace/pace-theme-center-atom.css +170 -0
- data/app/assets/stylesheets/pace/pace-theme-center-circle.css +2 -1
- data/app/assets/stylesheets/pace/pace-theme-center-radar.css +2 -1
- data/app/assets/stylesheets/pace/pace-theme-center-simple.css +54 -0
- data/app/assets/stylesheets/pace/pace-theme-corner-indicator.css +2 -1
- data/app/assets/stylesheets/pace/pace-theme-fill-left.css +2 -1
- data/app/assets/stylesheets/pace/pace-theme-flash.css +2 -1
- data/app/assets/stylesheets/pace/pace-theme-flat-top.css +1 -0
- data/app/assets/stylesheets/pace/pace-theme-loading-bar.css +1 -0
- data/app/assets/stylesheets/pace/pace-theme-mac-osx.css +2 -1
- data/app/assets/stylesheets/pace/pace-theme-minimal.css +2 -1
- data/lib/pace/rails/version.rb +1 -1
- data/pace-rails.gemspec +1 -1
- data/vendor/assets/javascripts/pace/pace.js +167 -53
- data/vendor/assets/stylesheets/pace/pace-theme-barber-shop.css +2 -1
- data/vendor/assets/stylesheets/pace/pace-theme-big-counter.css +1 -1
- data/vendor/assets/stylesheets/pace/pace-theme-bounce.css +1 -0
- data/vendor/assets/stylesheets/pace/pace-theme-center-atom.css +170 -0
- data/vendor/assets/stylesheets/pace/pace-theme-center-circle.css +2 -1
- data/vendor/assets/stylesheets/pace/pace-theme-center-radar.css +2 -1
- data/vendor/assets/stylesheets/pace/pace-theme-center-simple.css +54 -0
- data/vendor/assets/stylesheets/pace/pace-theme-corner-indicator.css +2 -1
- data/vendor/assets/stylesheets/pace/pace-theme-fill-left.css +2 -1
- data/vendor/assets/stylesheets/pace/pace-theme-flash.css +2 -1
- data/vendor/assets/stylesheets/pace/pace-theme-flat-top.css +1 -0
- data/vendor/assets/stylesheets/pace/pace-theme-loading-bar.css +1 -0
- data/vendor/assets/stylesheets/pace/pace-theme-mac-osx.css +2 -1
- data/vendor/assets/stylesheets/pace/pace-theme-minimal.css +2 -1
- metadata +8 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f8bd2b7c4688e2be06055c6461bd0a4d68b99802
|
|
4
|
+
data.tar.gz: e106f958b260e65850b54cc8eb58c96cd5135e4c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ff0b8f9621b0a639aba19afcc4727ee67be8bcecf82d7f715b69bb71008b67ed8866eedfb52b1ee30e2aad53d21e62907c33ec4745f465747882ff6d7c9689d5
|
|
7
|
+
data.tar.gz: f3ca9752efe4d6fcc568fd7d3dabb8e6884acf65075ce325bbbb7b19f9a8a5da18f298b3122f26e5ce65b02af76917dd6be1c3a265ab921dc4028b3cc30894dc
|
data/README.md
CHANGED
|
@@ -26,26 +26,32 @@ Pace supports a few themes, selec one of the following and have fun and create y
|
|
|
26
26
|
app/assets/stylesheets/application.css
|
|
27
27
|
|
|
28
28
|
*= require pace/pace-theme-minimal
|
|
29
|
-
|
|
30
|
-
*= require pace/pace-theme-flash
|
|
31
29
|
|
|
32
|
-
|
|
30
|
+
*= require pace/pace-theme-mac-osx
|
|
31
|
+
|
|
32
|
+
*= require pace/pace-theme-loading-bar
|
|
33
|
+
|
|
34
|
+
*= require pace/pace-theme-flat-top
|
|
33
35
|
|
|
34
|
-
|
|
36
|
+
*= require pace/pace-theme-flash
|
|
35
37
|
|
|
36
38
|
*= require pace/pace-theme-fill-left
|
|
37
39
|
|
|
38
|
-
|
|
40
|
+
*= require pace/pace-theme-corner-indicator
|
|
39
41
|
|
|
40
|
-
|
|
42
|
+
*= require pace/pace-theme-center-simple
|
|
41
43
|
|
|
42
|
-
|
|
44
|
+
*= require pace/pace-theme-center-radar
|
|
43
45
|
|
|
44
|
-
|
|
46
|
+
*= require pace/pace-theme-center-circle
|
|
45
47
|
|
|
46
|
-
|
|
48
|
+
*= require pace/pace-theme-center-atom
|
|
47
49
|
|
|
48
|
-
|
|
50
|
+
*= require pace/pace-theme-bounce
|
|
51
|
+
|
|
52
|
+
*= require pace/pace-theme-big-counter
|
|
53
|
+
|
|
54
|
+
*= require pace/pace-theme-barber-shop
|
|
49
55
|
|
|
50
56
|
You may need to restart your rails server.
|
|
51
57
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
(function() {
|
|
2
|
-
var AjaxMonitor, Bar, DocumentMonitor, ElementMonitor, ElementTracker, EventLagMonitor, Events, NoTargetError, RequestIntercept, SOURCE_KEYS, Scaler, SocketRequestTracker, XHRRequestTracker, animation, avgAmplitude, bar, cancelAnimation, cancelAnimationFrame, defaultOptions, extend, extendNative, getFromDOM, getIntercept, handlePushState, ignoreStack, init, now, options, requestAnimationFrame, result, runAnimation, scalers, shouldTrack, sources, uniScaler, _WebSocket, _XDomainRequest, _XMLHttpRequest, _intercept, _pushState, _ref, _replaceState,
|
|
2
|
+
var AjaxMonitor, Bar, DocumentMonitor, ElementMonitor, ElementTracker, EventLagMonitor, Evented, Events, NoTargetError, RequestIntercept, SOURCE_KEYS, Scaler, SocketRequestTracker, XHRRequestTracker, animation, avgAmplitude, bar, cancelAnimation, cancelAnimationFrame, defaultOptions, extend, extendNative, getFromDOM, getIntercept, handlePushState, ignoreStack, init, now, options, requestAnimationFrame, result, runAnimation, scalers, shouldIgnoreURL, shouldTrack, source, sources, uniScaler, _WebSocket, _XDomainRequest, _XMLHttpRequest, _i, _intercept, _len, _pushState, _ref, _ref1, _replaceState,
|
|
3
3
|
__slice = [].slice,
|
|
4
4
|
__hasProp = {}.hasOwnProperty,
|
|
5
5
|
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
|
@@ -27,7 +27,8 @@
|
|
|
27
27
|
},
|
|
28
28
|
ajax: {
|
|
29
29
|
trackMethods: ['GET'],
|
|
30
|
-
trackWebSockets:
|
|
30
|
+
trackWebSockets: true,
|
|
31
|
+
ignoreURLs: []
|
|
31
32
|
}
|
|
32
33
|
};
|
|
33
34
|
|
|
@@ -132,18 +133,97 @@
|
|
|
132
133
|
}
|
|
133
134
|
};
|
|
134
135
|
|
|
136
|
+
Evented = (function() {
|
|
137
|
+
function Evented() {}
|
|
138
|
+
|
|
139
|
+
Evented.prototype.on = function(event, handler, ctx, once) {
|
|
140
|
+
var _base;
|
|
141
|
+
if (once == null) {
|
|
142
|
+
once = false;
|
|
143
|
+
}
|
|
144
|
+
if (this.bindings == null) {
|
|
145
|
+
this.bindings = {};
|
|
146
|
+
}
|
|
147
|
+
if ((_base = this.bindings)[event] == null) {
|
|
148
|
+
_base[event] = [];
|
|
149
|
+
}
|
|
150
|
+
return this.bindings[event].push({
|
|
151
|
+
handler: handler,
|
|
152
|
+
ctx: ctx,
|
|
153
|
+
once: once
|
|
154
|
+
});
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
Evented.prototype.once = function(event, handler, ctx) {
|
|
158
|
+
return this.on(event, handler, ctx, true);
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
Evented.prototype.off = function(event, handler) {
|
|
162
|
+
var i, _ref, _results;
|
|
163
|
+
if (((_ref = this.bindings) != null ? _ref[event] : void 0) == null) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
if (handler == null) {
|
|
167
|
+
return delete this.bindings[event];
|
|
168
|
+
} else {
|
|
169
|
+
i = 0;
|
|
170
|
+
_results = [];
|
|
171
|
+
while (i < this.bindings[event].length) {
|
|
172
|
+
if (this.bindings[event][i].handler === handler) {
|
|
173
|
+
_results.push(this.bindings[event].splice(i, 1));
|
|
174
|
+
} else {
|
|
175
|
+
_results.push(i++);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
return _results;
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
Evented.prototype.trigger = function() {
|
|
183
|
+
var args, ctx, event, handler, i, once, _ref, _ref1, _results;
|
|
184
|
+
event = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
|
|
185
|
+
if ((_ref = this.bindings) != null ? _ref[event] : void 0) {
|
|
186
|
+
i = 0;
|
|
187
|
+
_results = [];
|
|
188
|
+
while (i < this.bindings[event].length) {
|
|
189
|
+
_ref1 = this.bindings[event][i], handler = _ref1.handler, ctx = _ref1.ctx, once = _ref1.once;
|
|
190
|
+
handler.apply(ctx != null ? ctx : this, args);
|
|
191
|
+
if (once) {
|
|
192
|
+
_results.push(this.bindings[event].splice(i, 1));
|
|
193
|
+
} else {
|
|
194
|
+
_results.push(i++);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
return _results;
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
return Evented;
|
|
202
|
+
|
|
203
|
+
})();
|
|
204
|
+
|
|
135
205
|
if (window.Pace == null) {
|
|
136
206
|
window.Pace = {};
|
|
137
207
|
}
|
|
138
208
|
|
|
139
|
-
|
|
209
|
+
extend(Pace, Evented.prototype);
|
|
210
|
+
|
|
211
|
+
options = Pace.options = extend({}, defaultOptions, window.paceOptions, getFromDOM());
|
|
212
|
+
|
|
213
|
+
_ref = ['ajax', 'document', 'eventLag', 'elements'];
|
|
214
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
|
215
|
+
source = _ref[_i];
|
|
216
|
+
if (options[source] === true) {
|
|
217
|
+
options[source] = defaultOptions[source];
|
|
218
|
+
}
|
|
219
|
+
}
|
|
140
220
|
|
|
141
221
|
NoTargetError = (function(_super) {
|
|
142
222
|
__extends(NoTargetError, _super);
|
|
143
223
|
|
|
144
224
|
function NoTargetError() {
|
|
145
|
-
|
|
146
|
-
return
|
|
225
|
+
_ref1 = NoTargetError.__super__.constructor.apply(this, arguments);
|
|
226
|
+
return _ref1;
|
|
147
227
|
}
|
|
148
228
|
|
|
149
229
|
return NoTargetError;
|
|
@@ -164,7 +244,7 @@
|
|
|
164
244
|
}
|
|
165
245
|
this.el = document.createElement('div');
|
|
166
246
|
this.el.className = "pace pace-active";
|
|
167
|
-
document.body.className = document.body.className.replace(
|
|
247
|
+
document.body.className = document.body.className.replace(/pace-done/g, '');
|
|
168
248
|
document.body.className += ' pace-running';
|
|
169
249
|
this.el.innerHTML = '<div class="pace-progress">\n <div class="pace-progress-inner"></div>\n</div>\n<div class="pace-activity"></div>';
|
|
170
250
|
if (targetElement.firstChild != null) {
|
|
@@ -233,12 +313,12 @@
|
|
|
233
313
|
}
|
|
234
314
|
|
|
235
315
|
Events.prototype.trigger = function(name, val) {
|
|
236
|
-
var binding,
|
|
316
|
+
var binding, _j, _len1, _ref2, _results;
|
|
237
317
|
if (this.bindings[name] != null) {
|
|
238
|
-
|
|
318
|
+
_ref2 = this.bindings[name];
|
|
239
319
|
_results = [];
|
|
240
|
-
for (
|
|
241
|
-
binding =
|
|
320
|
+
for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
|
|
321
|
+
binding = _ref2[_j];
|
|
242
322
|
_results.push(binding.call(this, val));
|
|
243
323
|
}
|
|
244
324
|
return _results;
|
|
@@ -302,7 +382,7 @@
|
|
|
302
382
|
};
|
|
303
383
|
|
|
304
384
|
shouldTrack = function(method) {
|
|
305
|
-
var
|
|
385
|
+
var _ref2;
|
|
306
386
|
if (method == null) {
|
|
307
387
|
method = 'GET';
|
|
308
388
|
}
|
|
@@ -312,7 +392,7 @@
|
|
|
312
392
|
if (!ignoreStack.length && options.ajax) {
|
|
313
393
|
if (method === 'socket' && options.ajax.trackWebSockets) {
|
|
314
394
|
return true;
|
|
315
|
-
} else if (
|
|
395
|
+
} else if (_ref2 = method.toUpperCase(), __indexOf.call(options.ajax.trackMethods, _ref2) >= 0) {
|
|
316
396
|
return true;
|
|
317
397
|
}
|
|
318
398
|
}
|
|
@@ -359,7 +439,11 @@
|
|
|
359
439
|
if ((_WebSocket != null) && options.ajax.trackWebSockets) {
|
|
360
440
|
window.WebSocket = function(url, protocols) {
|
|
361
441
|
var req;
|
|
362
|
-
|
|
442
|
+
if (protocols != null) {
|
|
443
|
+
req = new _WebSocket(url, protocols);
|
|
444
|
+
} else {
|
|
445
|
+
req = new _WebSocket(url);
|
|
446
|
+
}
|
|
363
447
|
if (shouldTrack('socket')) {
|
|
364
448
|
_this.trigger('request', {
|
|
365
449
|
type: 'socket',
|
|
@@ -387,9 +471,30 @@
|
|
|
387
471
|
return _intercept;
|
|
388
472
|
};
|
|
389
473
|
|
|
474
|
+
shouldIgnoreURL = function(url) {
|
|
475
|
+
var pattern, _j, _len1, _ref2;
|
|
476
|
+
_ref2 = options.ajax.ignoreURLs;
|
|
477
|
+
for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
|
|
478
|
+
pattern = _ref2[_j];
|
|
479
|
+
if (typeof pattern === 'string') {
|
|
480
|
+
if (url.indexOf(pattern) !== -1) {
|
|
481
|
+
return true;
|
|
482
|
+
}
|
|
483
|
+
} else {
|
|
484
|
+
if (pattern.test(url)) {
|
|
485
|
+
return true;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
return false;
|
|
490
|
+
};
|
|
491
|
+
|
|
390
492
|
getIntercept().on('request', function(_arg) {
|
|
391
|
-
var after, args, request, type;
|
|
392
|
-
type = _arg.type, request = _arg.request;
|
|
493
|
+
var after, args, request, type, url;
|
|
494
|
+
type = _arg.type, request = _arg.request, url = _arg.url;
|
|
495
|
+
if (shouldIgnoreURL(url)) {
|
|
496
|
+
return;
|
|
497
|
+
}
|
|
393
498
|
if (!Pace.running && (options.restartOnRequestAfter !== false || shouldTrack(type) === 'force')) {
|
|
394
499
|
args = arguments;
|
|
395
500
|
after = options.restartOnRequestAfter || 0;
|
|
@@ -397,18 +502,18 @@
|
|
|
397
502
|
after = 0;
|
|
398
503
|
}
|
|
399
504
|
return setTimeout(function() {
|
|
400
|
-
var
|
|
505
|
+
var stillActive, _j, _len1, _ref2, _ref3, _results;
|
|
401
506
|
if (type === 'socket') {
|
|
402
507
|
stillActive = request.readyState < 2;
|
|
403
508
|
} else {
|
|
404
|
-
stillActive = (0 < (
|
|
509
|
+
stillActive = (0 < (_ref2 = request.readyState) && _ref2 < 4);
|
|
405
510
|
}
|
|
406
511
|
if (stillActive) {
|
|
407
512
|
Pace.restart();
|
|
408
|
-
|
|
513
|
+
_ref3 = Pace.sources;
|
|
409
514
|
_results = [];
|
|
410
|
-
for (
|
|
411
|
-
source =
|
|
515
|
+
for (_j = 0, _len1 = _ref3.length; _j < _len1; _j++) {
|
|
516
|
+
source = _ref3[_j];
|
|
412
517
|
if (source instanceof AjaxMonitor) {
|
|
413
518
|
source.watch.apply(source, args);
|
|
414
519
|
break;
|
|
@@ -432,8 +537,11 @@
|
|
|
432
537
|
}
|
|
433
538
|
|
|
434
539
|
AjaxMonitor.prototype.watch = function(_arg) {
|
|
435
|
-
var request, tracker, type;
|
|
436
|
-
type = _arg.type, request = _arg.request;
|
|
540
|
+
var request, tracker, type, url;
|
|
541
|
+
type = _arg.type, request = _arg.request, url = _arg.url;
|
|
542
|
+
if (shouldIgnoreURL(url)) {
|
|
543
|
+
return;
|
|
544
|
+
}
|
|
437
545
|
if (type === 'socket') {
|
|
438
546
|
tracker = new SocketRequestTracker(request);
|
|
439
547
|
} else {
|
|
@@ -448,7 +556,7 @@
|
|
|
448
556
|
|
|
449
557
|
XHRRequestTracker = (function() {
|
|
450
558
|
function XHRRequestTracker(request) {
|
|
451
|
-
var event, size,
|
|
559
|
+
var event, size, _j, _len1, _onreadystatechange, _ref2,
|
|
452
560
|
_this = this;
|
|
453
561
|
this.progress = 0;
|
|
454
562
|
if (window.ProgressEvent != null) {
|
|
@@ -460,9 +568,9 @@
|
|
|
460
568
|
return _this.progress = _this.progress + (100 - _this.progress) / 2;
|
|
461
569
|
}
|
|
462
570
|
});
|
|
463
|
-
|
|
464
|
-
for (
|
|
465
|
-
event =
|
|
571
|
+
_ref2 = ['load', 'abort', 'timeout', 'error'];
|
|
572
|
+
for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
|
|
573
|
+
event = _ref2[_j];
|
|
466
574
|
request.addEventListener(event, function() {
|
|
467
575
|
return _this.progress = 100;
|
|
468
576
|
});
|
|
@@ -470,8 +578,8 @@
|
|
|
470
578
|
} else {
|
|
471
579
|
_onreadystatechange = request.onreadystatechange;
|
|
472
580
|
request.onreadystatechange = function() {
|
|
473
|
-
var
|
|
474
|
-
if ((
|
|
581
|
+
var _ref3;
|
|
582
|
+
if ((_ref3 = request.readyState) === 0 || _ref3 === 4) {
|
|
475
583
|
_this.progress = 100;
|
|
476
584
|
} else if (request.readyState === 3) {
|
|
477
585
|
_this.progress = 50;
|
|
@@ -487,12 +595,12 @@
|
|
|
487
595
|
|
|
488
596
|
SocketRequestTracker = (function() {
|
|
489
597
|
function SocketRequestTracker(request) {
|
|
490
|
-
var event,
|
|
598
|
+
var event, _j, _len1, _ref2,
|
|
491
599
|
_this = this;
|
|
492
600
|
this.progress = 0;
|
|
493
|
-
|
|
494
|
-
for (
|
|
495
|
-
event =
|
|
601
|
+
_ref2 = ['error', 'open'];
|
|
602
|
+
for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
|
|
603
|
+
event = _ref2[_j];
|
|
496
604
|
request.addEventListener(event, function() {
|
|
497
605
|
return _this.progress = 100;
|
|
498
606
|
});
|
|
@@ -505,7 +613,7 @@
|
|
|
505
613
|
|
|
506
614
|
ElementMonitor = (function() {
|
|
507
615
|
function ElementMonitor(options) {
|
|
508
|
-
var selector,
|
|
616
|
+
var selector, _j, _len1, _ref2;
|
|
509
617
|
if (options == null) {
|
|
510
618
|
options = {};
|
|
511
619
|
}
|
|
@@ -513,9 +621,9 @@
|
|
|
513
621
|
if (options.selectors == null) {
|
|
514
622
|
options.selectors = [];
|
|
515
623
|
}
|
|
516
|
-
|
|
517
|
-
for (
|
|
518
|
-
selector =
|
|
624
|
+
_ref2 = options.selectors;
|
|
625
|
+
for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
|
|
626
|
+
selector = _ref2[_j];
|
|
519
627
|
this.elements.push(new ElementTracker(selector));
|
|
520
628
|
}
|
|
521
629
|
}
|
|
@@ -558,9 +666,9 @@
|
|
|
558
666
|
};
|
|
559
667
|
|
|
560
668
|
function DocumentMonitor() {
|
|
561
|
-
var _onreadystatechange,
|
|
669
|
+
var _onreadystatechange, _ref2,
|
|
562
670
|
_this = this;
|
|
563
|
-
this.progress = (
|
|
671
|
+
this.progress = (_ref2 = this.states[document.readyState]) != null ? _ref2 : 100;
|
|
564
672
|
_onreadystatechange = document.onreadystatechange;
|
|
565
673
|
document.onreadystatechange = function() {
|
|
566
674
|
if (_this.states[document.readyState] != null) {
|
|
@@ -695,18 +803,18 @@
|
|
|
695
803
|
};
|
|
696
804
|
|
|
697
805
|
(init = function() {
|
|
698
|
-
var
|
|
806
|
+
var type, _j, _k, _len1, _len2, _ref2, _ref3, _ref4;
|
|
699
807
|
Pace.sources = sources = [];
|
|
700
|
-
|
|
701
|
-
for (
|
|
702
|
-
type =
|
|
808
|
+
_ref2 = ['ajax', 'elements', 'document', 'eventLag'];
|
|
809
|
+
for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
|
|
810
|
+
type = _ref2[_j];
|
|
703
811
|
if (options[type] !== false) {
|
|
704
812
|
sources.push(new SOURCE_KEYS[type](options[type]));
|
|
705
813
|
}
|
|
706
814
|
}
|
|
707
|
-
|
|
708
|
-
for (
|
|
709
|
-
source =
|
|
815
|
+
_ref4 = (_ref3 = options.extraSources) != null ? _ref3 : [];
|
|
816
|
+
for (_k = 0, _len2 = _ref4.length; _k < _len2; _k++) {
|
|
817
|
+
source = _ref4[_k];
|
|
710
818
|
sources.push(new source(options));
|
|
711
819
|
}
|
|
712
820
|
Pace.bar = bar = new Bar;
|
|
@@ -715,6 +823,7 @@
|
|
|
715
823
|
})();
|
|
716
824
|
|
|
717
825
|
Pace.stop = function() {
|
|
826
|
+
Pace.trigger('stop');
|
|
718
827
|
Pace.running = false;
|
|
719
828
|
bar.destroy();
|
|
720
829
|
cancelAnimation = true;
|
|
@@ -728,24 +837,27 @@
|
|
|
728
837
|
};
|
|
729
838
|
|
|
730
839
|
Pace.restart = function() {
|
|
840
|
+
Pace.trigger('restart');
|
|
731
841
|
Pace.stop();
|
|
732
842
|
return Pace.start();
|
|
733
843
|
};
|
|
734
844
|
|
|
735
845
|
Pace.go = function() {
|
|
846
|
+
var start;
|
|
736
847
|
Pace.running = true;
|
|
737
848
|
bar.render();
|
|
849
|
+
start = now();
|
|
738
850
|
cancelAnimation = false;
|
|
739
851
|
return animation = runAnimation(function(frameTime, enqueueNextFrame) {
|
|
740
|
-
var avg, count, done, element, elements, i, j, remaining, scaler, scalerList,
|
|
852
|
+
var avg, count, done, element, elements, i, j, remaining, scaler, scalerList, sum, _j, _k, _len1, _len2, _ref2;
|
|
741
853
|
remaining = 100 - bar.progress;
|
|
742
854
|
count = sum = 0;
|
|
743
855
|
done = true;
|
|
744
|
-
for (i =
|
|
856
|
+
for (i = _j = 0, _len1 = sources.length; _j < _len1; i = ++_j) {
|
|
745
857
|
source = sources[i];
|
|
746
858
|
scalerList = scalers[i] != null ? scalers[i] : scalers[i] = [];
|
|
747
|
-
elements = (
|
|
748
|
-
for (j =
|
|
859
|
+
elements = (_ref2 = source.elements) != null ? _ref2 : [source];
|
|
860
|
+
for (j = _k = 0, _len2 = elements.length; _k < _len2; j = ++_k) {
|
|
749
861
|
element = elements[j];
|
|
750
862
|
scaler = scalerList[j] != null ? scalerList[j] : scalerList[j] = new Scaler(element);
|
|
751
863
|
done &= scaler.done;
|
|
@@ -758,13 +870,14 @@
|
|
|
758
870
|
}
|
|
759
871
|
avg = sum / count;
|
|
760
872
|
bar.update(uniScaler.tick(frameTime, avg));
|
|
761
|
-
start = now();
|
|
762
873
|
if (bar.done() || done || cancelAnimation) {
|
|
763
874
|
bar.update(100);
|
|
875
|
+
Pace.trigger('done');
|
|
764
876
|
return setTimeout(function() {
|
|
765
877
|
bar.finish();
|
|
766
|
-
|
|
767
|
-
|
|
878
|
+
Pace.running = false;
|
|
879
|
+
return Pace.trigger('hide');
|
|
880
|
+
}, Math.max(options.ghostTime, Math.max(options.minTime - (now() - start), 0)));
|
|
768
881
|
} else {
|
|
769
882
|
return enqueueNextFrame();
|
|
770
883
|
}
|
|
@@ -782,6 +895,7 @@
|
|
|
782
895
|
if (!document.querySelector('.pace')) {
|
|
783
896
|
return setTimeout(Pace.start, 50);
|
|
784
897
|
} else {
|
|
898
|
+
Pace.trigger('start');
|
|
785
899
|
return Pace.go();
|
|
786
900
|
}
|
|
787
901
|
};
|
|
@@ -798,4 +912,4 @@
|
|
|
798
912
|
}
|
|
799
913
|
}
|
|
800
914
|
|
|
801
|
-
}).call(this);
|
|
915
|
+
}).call(this);
|