pacejs_rails 0.4.16 → 0.4.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/app/assets/javascripts/pace.js +127 -43
- data/lib/pacejs_rails/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MTgzMTc1MmRjODIxN2I5NTM1NDgyZTZiZWJhYWUxNTBhNjJiMDk3Yw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZmQ4MTI3YjUyNTRkZjk0ZGQxMGRkNGY5YzYzMGEzMGVmN2I3MTA0Yw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ODc2MzQ0NDNmNmRmMGZmNjE0MjUwNGJmZjAwMDU3MzBhMDg4YmJlOTlmYTNm
|
10
|
+
NDVkNjAzZTBmOTYxMjliNjQ0M2QxNDE3YTdhNjNhM2FkOTdmNzY1NzAyNDZj
|
11
|
+
MmQzNzBjNjhiMjZkZGRiMDgxNzg5YWIwMGVjMzVkZDBhMmIwM2Y=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZTQ0M2EzYWY0NWM3ZjhjNjRiYmY2ZmQ3Y2FhYzFlNDg1ZDU1MTIzYTk3ZWI1
|
14
|
+
ZDEyYThkNWVmYzY4YTI3OGQxMGYwODRhZmY5NDMxYTJlOGE1MzZjNjVhMDIy
|
15
|
+
YjkwMDg2OGE5NGRiNzVjY2U0ZmZhY2Y5ODFjNGU3MDcxZGYzMjA=
|
@@ -2,7 +2,7 @@
|
|
2
2
|
// Pace.js
|
3
3
|
// https://github.com/HubSpot/pace
|
4
4
|
(function() {
|
5
|
-
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,
|
5
|
+
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, shouldTrack, source, sources, uniScaler, _WebSocket, _XDomainRequest, _XMLHttpRequest, _i, _intercept, _len, _pushState, _ref, _ref1, _replaceState,
|
6
6
|
__slice = [].slice,
|
7
7
|
__hasProp = {}.hasOwnProperty,
|
8
8
|
__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; },
|
@@ -135,18 +135,97 @@
|
|
135
135
|
}
|
136
136
|
};
|
137
137
|
|
138
|
+
Evented = (function() {
|
139
|
+
function Evented() {}
|
140
|
+
|
141
|
+
Evented.prototype.on = function(event, handler, ctx, once) {
|
142
|
+
var _base;
|
143
|
+
if (once == null) {
|
144
|
+
once = false;
|
145
|
+
}
|
146
|
+
if (this.bindings == null) {
|
147
|
+
this.bindings = {};
|
148
|
+
}
|
149
|
+
if ((_base = this.bindings)[event] == null) {
|
150
|
+
_base[event] = [];
|
151
|
+
}
|
152
|
+
return this.bindings[event].push({
|
153
|
+
handler: handler,
|
154
|
+
ctx: ctx,
|
155
|
+
once: once
|
156
|
+
});
|
157
|
+
};
|
158
|
+
|
159
|
+
Evented.prototype.once = function(event, handler, ctx) {
|
160
|
+
return this.on(event, handler, ctx, true);
|
161
|
+
};
|
162
|
+
|
163
|
+
Evented.prototype.off = function(event, handler) {
|
164
|
+
var i, _ref, _results;
|
165
|
+
if (((_ref = this.bindings) != null ? _ref[event] : void 0) == null) {
|
166
|
+
return;
|
167
|
+
}
|
168
|
+
if (handler == null) {
|
169
|
+
return delete this.bindings[event];
|
170
|
+
} else {
|
171
|
+
i = 0;
|
172
|
+
_results = [];
|
173
|
+
while (i < this.bindings[event].length) {
|
174
|
+
if (this.bindings[event][i].handler === handler) {
|
175
|
+
_results.push(this.bindings[event].splice(i, 1));
|
176
|
+
} else {
|
177
|
+
_results.push(i++);
|
178
|
+
}
|
179
|
+
}
|
180
|
+
return _results;
|
181
|
+
}
|
182
|
+
};
|
183
|
+
|
184
|
+
Evented.prototype.trigger = function() {
|
185
|
+
var args, ctx, event, handler, i, once, _ref, _ref1, _results;
|
186
|
+
event = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
|
187
|
+
if ((_ref = this.bindings) != null ? _ref[event] : void 0) {
|
188
|
+
i = 0;
|
189
|
+
_results = [];
|
190
|
+
while (i < this.bindings[event].length) {
|
191
|
+
_ref1 = this.bindings[event][i], handler = _ref1.handler, ctx = _ref1.ctx, once = _ref1.once;
|
192
|
+
handler.apply(ctx != null ? ctx : this, args);
|
193
|
+
if (once) {
|
194
|
+
_results.push(this.bindings[event].splice(i, 1));
|
195
|
+
} else {
|
196
|
+
_results.push(i++);
|
197
|
+
}
|
198
|
+
}
|
199
|
+
return _results;
|
200
|
+
}
|
201
|
+
};
|
202
|
+
|
203
|
+
return Evented;
|
204
|
+
|
205
|
+
})();
|
206
|
+
|
138
207
|
if (window.Pace == null) {
|
139
208
|
window.Pace = {};
|
140
209
|
}
|
141
210
|
|
142
|
-
|
211
|
+
extend(Pace, Evented.prototype);
|
212
|
+
|
213
|
+
options = Pace.options = extend({}, defaultOptions, window.paceOptions, getFromDOM());
|
214
|
+
|
215
|
+
_ref = ['ajax', 'document', 'eventLag', 'elements'];
|
216
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
217
|
+
source = _ref[_i];
|
218
|
+
if (options[source] === true) {
|
219
|
+
options[source] = defaultOptions[source];
|
220
|
+
}
|
221
|
+
}
|
143
222
|
|
144
223
|
NoTargetError = (function(_super) {
|
145
224
|
__extends(NoTargetError, _super);
|
146
225
|
|
147
226
|
function NoTargetError() {
|
148
|
-
|
149
|
-
return
|
227
|
+
_ref1 = NoTargetError.__super__.constructor.apply(this, arguments);
|
228
|
+
return _ref1;
|
150
229
|
}
|
151
230
|
|
152
231
|
return NoTargetError;
|
@@ -236,12 +315,12 @@
|
|
236
315
|
}
|
237
316
|
|
238
317
|
Events.prototype.trigger = function(name, val) {
|
239
|
-
var binding,
|
318
|
+
var binding, _j, _len1, _ref2, _results;
|
240
319
|
if (this.bindings[name] != null) {
|
241
|
-
|
320
|
+
_ref2 = this.bindings[name];
|
242
321
|
_results = [];
|
243
|
-
for (
|
244
|
-
binding =
|
322
|
+
for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
|
323
|
+
binding = _ref2[_j];
|
245
324
|
_results.push(binding.call(this, val));
|
246
325
|
}
|
247
326
|
return _results;
|
@@ -305,7 +384,7 @@
|
|
305
384
|
};
|
306
385
|
|
307
386
|
shouldTrack = function(method) {
|
308
|
-
var
|
387
|
+
var _ref2;
|
309
388
|
if (method == null) {
|
310
389
|
method = 'GET';
|
311
390
|
}
|
@@ -315,7 +394,7 @@
|
|
315
394
|
if (!ignoreStack.length && options.ajax) {
|
316
395
|
if (method === 'socket' && options.ajax.trackWebSockets) {
|
317
396
|
return true;
|
318
|
-
} else if (
|
397
|
+
} else if (_ref2 = method.toUpperCase(), __indexOf.call(options.ajax.trackMethods, _ref2) >= 0) {
|
319
398
|
return true;
|
320
399
|
}
|
321
400
|
}
|
@@ -400,18 +479,18 @@
|
|
400
479
|
after = 0;
|
401
480
|
}
|
402
481
|
return setTimeout(function() {
|
403
|
-
var
|
482
|
+
var stillActive, _j, _len1, _ref2, _ref3, _results;
|
404
483
|
if (type === 'socket') {
|
405
484
|
stillActive = request.readyState < 2;
|
406
485
|
} else {
|
407
|
-
stillActive = (0 < (
|
486
|
+
stillActive = (0 < (_ref2 = request.readyState) && _ref2 < 4);
|
408
487
|
}
|
409
488
|
if (stillActive) {
|
410
489
|
Pace.restart();
|
411
|
-
|
490
|
+
_ref3 = Pace.sources;
|
412
491
|
_results = [];
|
413
|
-
for (
|
414
|
-
source =
|
492
|
+
for (_j = 0, _len1 = _ref3.length; _j < _len1; _j++) {
|
493
|
+
source = _ref3[_j];
|
415
494
|
if (source instanceof AjaxMonitor) {
|
416
495
|
source.watch.apply(source, args);
|
417
496
|
break;
|
@@ -451,7 +530,7 @@
|
|
451
530
|
|
452
531
|
XHRRequestTracker = (function() {
|
453
532
|
function XHRRequestTracker(request) {
|
454
|
-
var event, size,
|
533
|
+
var event, size, _j, _len1, _onreadystatechange, _ref2,
|
455
534
|
_this = this;
|
456
535
|
this.progress = 0;
|
457
536
|
if (window.ProgressEvent != null) {
|
@@ -463,9 +542,9 @@
|
|
463
542
|
return _this.progress = _this.progress + (100 - _this.progress) / 2;
|
464
543
|
}
|
465
544
|
});
|
466
|
-
|
467
|
-
for (
|
468
|
-
event =
|
545
|
+
_ref2 = ['load', 'abort', 'timeout', 'error'];
|
546
|
+
for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
|
547
|
+
event = _ref2[_j];
|
469
548
|
request.addEventListener(event, function() {
|
470
549
|
return _this.progress = 100;
|
471
550
|
});
|
@@ -473,8 +552,8 @@
|
|
473
552
|
} else {
|
474
553
|
_onreadystatechange = request.onreadystatechange;
|
475
554
|
request.onreadystatechange = function() {
|
476
|
-
var
|
477
|
-
if ((
|
555
|
+
var _ref3;
|
556
|
+
if ((_ref3 = request.readyState) === 0 || _ref3 === 4) {
|
478
557
|
_this.progress = 100;
|
479
558
|
} else if (request.readyState === 3) {
|
480
559
|
_this.progress = 50;
|
@@ -490,12 +569,12 @@
|
|
490
569
|
|
491
570
|
SocketRequestTracker = (function() {
|
492
571
|
function SocketRequestTracker(request) {
|
493
|
-
var event,
|
572
|
+
var event, _j, _len1, _ref2,
|
494
573
|
_this = this;
|
495
574
|
this.progress = 0;
|
496
|
-
|
497
|
-
for (
|
498
|
-
event =
|
575
|
+
_ref2 = ['error', 'open'];
|
576
|
+
for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
|
577
|
+
event = _ref2[_j];
|
499
578
|
request.addEventListener(event, function() {
|
500
579
|
return _this.progress = 100;
|
501
580
|
});
|
@@ -508,7 +587,7 @@
|
|
508
587
|
|
509
588
|
ElementMonitor = (function() {
|
510
589
|
function ElementMonitor(options) {
|
511
|
-
var selector,
|
590
|
+
var selector, _j, _len1, _ref2;
|
512
591
|
if (options == null) {
|
513
592
|
options = {};
|
514
593
|
}
|
@@ -516,9 +595,9 @@
|
|
516
595
|
if (options.selectors == null) {
|
517
596
|
options.selectors = [];
|
518
597
|
}
|
519
|
-
|
520
|
-
for (
|
521
|
-
selector =
|
598
|
+
_ref2 = options.selectors;
|
599
|
+
for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
|
600
|
+
selector = _ref2[_j];
|
522
601
|
this.elements.push(new ElementTracker(selector));
|
523
602
|
}
|
524
603
|
}
|
@@ -561,9 +640,9 @@
|
|
561
640
|
};
|
562
641
|
|
563
642
|
function DocumentMonitor() {
|
564
|
-
var _onreadystatechange,
|
643
|
+
var _onreadystatechange, _ref2,
|
565
644
|
_this = this;
|
566
|
-
this.progress = (
|
645
|
+
this.progress = (_ref2 = this.states[document.readyState]) != null ? _ref2 : 100;
|
567
646
|
_onreadystatechange = document.onreadystatechange;
|
568
647
|
document.onreadystatechange = function() {
|
569
648
|
if (_this.states[document.readyState] != null) {
|
@@ -698,18 +777,18 @@
|
|
698
777
|
};
|
699
778
|
|
700
779
|
(init = function() {
|
701
|
-
var
|
780
|
+
var type, _j, _k, _len1, _len2, _ref2, _ref3, _ref4;
|
702
781
|
Pace.sources = sources = [];
|
703
|
-
|
704
|
-
for (
|
705
|
-
type =
|
782
|
+
_ref2 = ['ajax', 'elements', 'document', 'eventLag'];
|
783
|
+
for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
|
784
|
+
type = _ref2[_j];
|
706
785
|
if (options[type] !== false) {
|
707
786
|
sources.push(new SOURCE_KEYS[type](options[type]));
|
708
787
|
}
|
709
788
|
}
|
710
|
-
|
711
|
-
for (
|
712
|
-
source =
|
789
|
+
_ref4 = (_ref3 = options.extraSources) != null ? _ref3 : [];
|
790
|
+
for (_k = 0, _len2 = _ref4.length; _k < _len2; _k++) {
|
791
|
+
source = _ref4[_k];
|
713
792
|
sources.push(new source(options));
|
714
793
|
}
|
715
794
|
Pace.bar = bar = new Bar;
|
@@ -718,6 +797,7 @@
|
|
718
797
|
})();
|
719
798
|
|
720
799
|
Pace.stop = function() {
|
800
|
+
Pace.trigger('stop');
|
721
801
|
Pace.running = false;
|
722
802
|
bar.destroy();
|
723
803
|
cancelAnimation = true;
|
@@ -731,6 +811,7 @@
|
|
731
811
|
};
|
732
812
|
|
733
813
|
Pace.restart = function() {
|
814
|
+
Pace.trigger('restart');
|
734
815
|
Pace.stop();
|
735
816
|
return Pace.start();
|
736
817
|
};
|
@@ -740,15 +821,15 @@
|
|
740
821
|
bar.render();
|
741
822
|
cancelAnimation = false;
|
742
823
|
return animation = runAnimation(function(frameTime, enqueueNextFrame) {
|
743
|
-
var avg, count, done, element, elements, i, j, remaining, scaler, scalerList,
|
824
|
+
var avg, count, done, element, elements, i, j, remaining, scaler, scalerList, start, sum, _j, _k, _len1, _len2, _ref2;
|
744
825
|
remaining = 100 - bar.progress;
|
745
826
|
count = sum = 0;
|
746
827
|
done = true;
|
747
|
-
for (i =
|
828
|
+
for (i = _j = 0, _len1 = sources.length; _j < _len1; i = ++_j) {
|
748
829
|
source = sources[i];
|
749
830
|
scalerList = scalers[i] != null ? scalers[i] : scalers[i] = [];
|
750
|
-
elements = (
|
751
|
-
for (j =
|
831
|
+
elements = (_ref2 = source.elements) != null ? _ref2 : [source];
|
832
|
+
for (j = _k = 0, _len2 = elements.length; _k < _len2; j = ++_k) {
|
752
833
|
element = elements[j];
|
753
834
|
scaler = scalerList[j] != null ? scalerList[j] : scalerList[j] = new Scaler(element);
|
754
835
|
done &= scaler.done;
|
@@ -764,9 +845,11 @@
|
|
764
845
|
start = now();
|
765
846
|
if (bar.done() || done || cancelAnimation) {
|
766
847
|
bar.update(100);
|
848
|
+
Pace.trigger('done');
|
767
849
|
return setTimeout(function() {
|
768
850
|
bar.finish();
|
769
|
-
|
851
|
+
Pace.running = false;
|
852
|
+
return Pace.trigger('hide');
|
770
853
|
}, Math.max(options.ghostTime, Math.min(options.minTime, now() - start)));
|
771
854
|
} else {
|
772
855
|
return enqueueNextFrame();
|
@@ -785,6 +868,7 @@
|
|
785
868
|
if (!document.querySelector('.pace')) {
|
786
869
|
return setTimeout(Pace.start, 50);
|
787
870
|
} else {
|
871
|
+
Pace.trigger('start');
|
788
872
|
return Pace.go();
|
789
873
|
}
|
790
874
|
};
|
data/lib/pacejs_rails/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pacejs_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guy Israeli
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|