pace-rails 0.0.9 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +16 -10
  3. data/app/assets/javascripts/pace/pace.js +167 -53
  4. data/app/assets/stylesheets/pace/pace-theme-barber-shop.css +2 -1
  5. data/app/assets/stylesheets/pace/pace-theme-big-counter.css +1 -1
  6. data/app/assets/stylesheets/pace/pace-theme-bounce.css +1 -0
  7. data/app/assets/stylesheets/pace/pace-theme-center-atom.css +170 -0
  8. data/app/assets/stylesheets/pace/pace-theme-center-circle.css +2 -1
  9. data/app/assets/stylesheets/pace/pace-theme-center-radar.css +2 -1
  10. data/app/assets/stylesheets/pace/pace-theme-center-simple.css +54 -0
  11. data/app/assets/stylesheets/pace/pace-theme-corner-indicator.css +2 -1
  12. data/app/assets/stylesheets/pace/pace-theme-fill-left.css +2 -1
  13. data/app/assets/stylesheets/pace/pace-theme-flash.css +2 -1
  14. data/app/assets/stylesheets/pace/pace-theme-flat-top.css +1 -0
  15. data/app/assets/stylesheets/pace/pace-theme-loading-bar.css +1 -0
  16. data/app/assets/stylesheets/pace/pace-theme-mac-osx.css +2 -1
  17. data/app/assets/stylesheets/pace/pace-theme-minimal.css +2 -1
  18. data/lib/pace/rails/version.rb +1 -1
  19. data/pace-rails.gemspec +1 -1
  20. data/vendor/assets/javascripts/pace/pace.js +167 -53
  21. data/vendor/assets/stylesheets/pace/pace-theme-barber-shop.css +2 -1
  22. data/vendor/assets/stylesheets/pace/pace-theme-big-counter.css +1 -1
  23. data/vendor/assets/stylesheets/pace/pace-theme-bounce.css +1 -0
  24. data/vendor/assets/stylesheets/pace/pace-theme-center-atom.css +170 -0
  25. data/vendor/assets/stylesheets/pace/pace-theme-center-circle.css +2 -1
  26. data/vendor/assets/stylesheets/pace/pace-theme-center-radar.css +2 -1
  27. data/vendor/assets/stylesheets/pace/pace-theme-center-simple.css +54 -0
  28. data/vendor/assets/stylesheets/pace/pace-theme-corner-indicator.css +2 -1
  29. data/vendor/assets/stylesheets/pace/pace-theme-fill-left.css +2 -1
  30. data/vendor/assets/stylesheets/pace/pace-theme-flash.css +2 -1
  31. data/vendor/assets/stylesheets/pace/pace-theme-flat-top.css +1 -0
  32. data/vendor/assets/stylesheets/pace/pace-theme-loading-bar.css +1 -0
  33. data/vendor/assets/stylesheets/pace/pace-theme-mac-osx.css +2 -1
  34. data/vendor/assets/stylesheets/pace/pace-theme-minimal.css +2 -1
  35. metadata +8 -4
@@ -1,3 +1,4 @@
1
+ /* This is a compiled file, you should be editing the file in the templates directory */
1
2
  .pace {
2
3
  -webkit-pointer-events: none;
3
4
  pointer-events: none;
@@ -68,4 +69,4 @@
68
69
  @keyframes pace-stripe-animation {
69
70
  0% { transform: none; transform: none; }
70
71
  100% { transform: translate(-32px, 0); transform: translate(-32px, 0); }
71
- }
72
+ }
@@ -32,4 +32,4 @@
32
32
  line-height: 1;
33
33
  text-align: right;
34
34
  color: rgba(0, 0, 0, 0.19999999999999996);
35
- }
35
+ }
@@ -1,3 +1,4 @@
1
+ /* This is a compiled file, you should be editing the file in the templates directory */
1
2
  .pace {
2
3
  width: 140px;
3
4
  height: 300px;
@@ -0,0 +1,170 @@
1
+ /* This is a compiled file, you should be editing the file in the templates directory */
2
+ .pace.pace-inactive {
3
+ display: none;
4
+ }
5
+
6
+ .pace {
7
+ -webkit-pointer-events: none;
8
+ pointer-events: none;
9
+
10
+ -webkit-user-select: none;
11
+ -moz-user-select: none;
12
+ user-select: none;
13
+
14
+ z-index: 2000;
15
+ position: fixed;
16
+ height: 60px;
17
+ width: 100px;
18
+ margin: auto;
19
+ top: 0;
20
+ left: 0;
21
+ right: 0;
22
+ bottom: 0;
23
+ }
24
+
25
+ .pace .pace-progress {
26
+ z-index: 2000;
27
+ position: absolute;
28
+ height: 60px;
29
+ width: 100px !important;
30
+ }
31
+
32
+ .pace .pace-progress:before {
33
+ content: attr(data-progress-text);
34
+ text-align: center;
35
+ color: #fff;
36
+ background: #29d;
37
+ border-radius: 50%;
38
+ font-family: "Helvetica Neue", sans-serif;
39
+ font-size: 14px;
40
+ font-weight: 100;
41
+ line-height: 1;
42
+ padding: 20% 0 7px;
43
+ width: 50%;
44
+ height: 40%;
45
+ margin: 10px 0 0 30px;
46
+ display: block;
47
+ z-index: 999;
48
+ position: absolute;
49
+ }
50
+
51
+ .pace .pace-progress:after {
52
+ border-radius: 50%;
53
+ border: 5px solid #29d;
54
+ content: ' ';
55
+ display: block;
56
+ position: absolute;
57
+ top: 0;
58
+ left: 0;
59
+ height: 60px;
60
+ width: 100px;
61
+
62
+ -webkit-transform: rotate(90deg);
63
+ -moz-transform: rotate(90deg);
64
+ -o-transform: rotate(90deg);
65
+ transform: rotate(90deg);
66
+ -webkit-animation: spin-3 2s linear infinite;
67
+ -moz-animation: spin-3 2s linear infinite;
68
+ -o-animation: spin-3 2s linear infinite;
69
+ animation: spin-3 2s linear infinite;
70
+ }
71
+
72
+ .pace .pace-activity {
73
+ font-size: 15px;
74
+ line-height: 1;
75
+ z-index: 2000;
76
+ position: absolute;
77
+ height: 60px;
78
+ width: 100px;
79
+
80
+ display: block;
81
+ }
82
+
83
+ .pace .pace-activity:before {
84
+ border-radius: 50%;
85
+ border: 5px solid #29d;
86
+ content: ' ';
87
+ display: block;
88
+ position: absolute;
89
+ top: 0;
90
+ left: 0;
91
+ height: 60px;
92
+ width: 100px;
93
+
94
+ -webkit-animation: spin-1 2s linear infinite;
95
+ -moz-animation: spin-1 2s linear infinite;
96
+ -o-animation: spin-1 2s linear infinite;
97
+ animation: spin-1 2s linear infinite;
98
+ }
99
+
100
+ .pace .pace-activity:after{
101
+ border-radius: 50%;
102
+ border: 5px solid #29d;
103
+ content: ' ';
104
+ display: block;
105
+ position: absolute;
106
+ top: 0;
107
+ left: 0;
108
+ height: 60px;
109
+ width: 100px;
110
+
111
+ -webkit-transform: rotate(45deg);
112
+ -moz-transform: rotate(45deg);
113
+ -o-transform: rotate(45deg);
114
+ transform: rotate(45deg);
115
+ -webkit-animation: spin-2 2s linear infinite;
116
+ -moz-animation: spin-2 2s linear infinite;
117
+ -o-animation: spin-2 2s linear infinite;
118
+ animation: spin-2 2s linear infinite;
119
+ }
120
+
121
+ @-webkit-keyframes spin-1 {
122
+ 0% { -webkit-transform: rotate(0deg); }
123
+ 100%{ -webkit-transform: rotate(359deg);}
124
+ }
125
+ @-moz-keyframes spin-1 {
126
+ 0% { -moz-transform: rotate(0deg); }
127
+ 100%{ -moz-transform: rotate(359deg);}
128
+ }
129
+ @-o-keyframes spin-1 {
130
+ 0% { -o-transform: rotate(0deg); }
131
+ 100%{ -o-transform: rotate(359deg);}
132
+ }
133
+ @keyframes spin-1 {
134
+ 0% { transform: rotate(0deg); }
135
+ 100%{ transform: rotate(359deg);}
136
+ }
137
+
138
+ @-webkit-keyframes spin-2 {
139
+ 0% { -webkit-transform: rotate(59.8deg); }
140
+ 100%{ -webkit-transform: rotate(418.8deg);}
141
+ }
142
+ @-moz-keyframes spin-2 {
143
+ 0% { -moz-transform: rotate(59.8deg); }
144
+ 100%{ -moz-transform: rotate(418.8deg);}
145
+ }
146
+ @-o-keyframes spin-2 {
147
+ 0% { -o-transform: rotate(59.8deg); }
148
+ 100%{ -o-transform: rotate(418.8deg);}
149
+ }
150
+ @keyframes spin-2 {
151
+ 0% { transform: rotate(59.8deg); }
152
+ 100%{ transform: rotate(418.8deg);}
153
+ }
154
+
155
+ @-webkit-keyframes spin-3 {
156
+ 0% { -webkit-transform: rotate(119.6deg); }
157
+ 100%{ -webkit-transform: rotate(478.6deg);}
158
+ }
159
+ @-moz-keyframes spin-3 {
160
+ 0% { -moz-transform: rotate(119.6deg); }
161
+ 100%{ -moz-transform: rotate(478.6deg);}
162
+ }
163
+ @-o-keyframes spin-3 {
164
+ 0% { -o-transform: rotate(119.6deg); }
165
+ 100%{ -o-transform: rotate(478.6deg);}
166
+ }
167
+ @keyframes spin-3 {
168
+ 0% { transform: rotate(119.6deg); }
169
+ 100%{ transform: rotate(478.6deg);}
170
+ }
@@ -1,3 +1,4 @@
1
+ /* This is a compiled file, you should be editing the file in the templates directory */
1
2
  .pace {
2
3
  -webkit-pointer-events: none;
3
4
  pointer-events: none;
@@ -106,4 +107,4 @@
106
107
  to {
107
108
  transform: rotateY(360deg);
108
109
  }
109
- }
110
+ }
@@ -1,3 +1,4 @@
1
+ /* This is a compiled file, you should be editing the file in the templates directory */
1
2
  .pace {
2
3
  -webkit-pointer-events: none;
3
4
  pointer-events: none;
@@ -67,4 +68,4 @@
67
68
 
68
69
  @keyframes spin {
69
70
  100% { transform: rotate(359deg); }
70
- }
71
+ }
@@ -0,0 +1,54 @@
1
+ /* This is a compiled file, you should be editing the file in the templates directory */
2
+ .pace {
3
+ -webkit-pointer-events: none;
4
+ pointer-events: none;
5
+ -webkit-user-select: none;
6
+ -moz-user-select: none;
7
+ user-select: none;
8
+
9
+ z-index: 2000;
10
+ position: fixed;
11
+ margin: auto;
12
+ top: 0;
13
+ left: 0;
14
+ right: 0;
15
+ bottom: 0;
16
+ height: 5px;
17
+ width: 200px;
18
+ background: #fff;
19
+ border: 1px solid #29d;
20
+ }
21
+
22
+ .pace .pace-progress {
23
+ -webkit-box-sizing: border-box;
24
+ -moz-box-sizing: border-box;
25
+ -ms-box-sizing: border-box;
26
+ -o-box-sizing: border-box;
27
+ box-sizing: border-box;
28
+
29
+ -webkit-transition: width 1s ease-in-out 1s linear;
30
+ -moz-transition: width 1s ease-in-out 1s linear;
31
+ -ms-transition: width 1s ease-in-out 1s linear;
32
+ -o-transition: width 1s ease-in-out 1s linear;
33
+ transition: width 1s ease-in-out 1s linear;
34
+
35
+ -webkit-transform: translate3d(0, 0, 0);
36
+ -moz-transform: translate3d(0, 0, 0);
37
+ -ms-transform: translate3d(0, 0, 0);
38
+ -o-transform: translate3d(0, 0, 0);
39
+ transform: translate3d(0, 0, 0);
40
+
41
+ max-width: 200px;
42
+ position: fixed;
43
+ z-index: 2000;
44
+ display: block;
45
+ position: absolute;
46
+ left: 0px;
47
+ top: 0px;
48
+ height: 100%;
49
+ background: #29d;
50
+ }
51
+
52
+ .pace.pace-inactive {
53
+ display: none;
54
+ }
@@ -1,3 +1,4 @@
1
+ /* This is a compiled file, you should be editing the file in the templates directory */
1
2
  .pace {
2
3
  -webkit-pointer-events: none;
3
4
  pointer-events: none;
@@ -66,4 +67,4 @@
66
67
  @keyframes pace-rotation {
67
68
  0% { transform: rotate(0deg); }
68
69
  100% { transform: rotate(359deg); }
69
- }
70
+ }
@@ -1,3 +1,4 @@
1
+ /* This is a compiled file, you should be editing the file in the templates directory */
1
2
  .pace {
2
3
  -webkit-pointer-events: none;
3
4
  pointer-events: none;
@@ -18,4 +19,4 @@
18
19
  -moz-transition: width 1s;
19
20
  -o-transition: width 1s;
20
21
  transition: width 1s;
21
- }
22
+ }
@@ -1,3 +1,4 @@
1
+ /* This is a compiled file, you should be editing the file in the templates directory */
1
2
  .pace {
2
3
  -webkit-pointer-events: none;
3
4
  pointer-events: none;
@@ -77,4 +78,4 @@
77
78
  @keyframes pace-spinner {
78
79
  0% { transform: rotate(0deg); transform: rotate(0deg); }
79
80
  100% { transform: rotate(360deg); transform: rotate(360deg); }
80
- }
81
+ }
@@ -1,3 +1,4 @@
1
+ /* This is a compiled file, you should be editing the file in the templates directory */
1
2
  .pace {
2
3
  -webkit-pointer-events: none;
3
4
  pointer-events: none;
@@ -1,3 +1,4 @@
1
+ /* This is a compiled file, you should be editing the file in the templates directory */
1
2
  .pace {
2
3
  -webkit-box-sizing: border-box;
3
4
  -moz-box-sizing: border-box;
@@ -1,3 +1,4 @@
1
+ /* This is a compiled file, you should be editing the file in the templates directory */
1
2
  .pace {
2
3
  -webkit-pointer-events: none;
3
4
  pointer-events: none;
@@ -81,4 +82,4 @@
81
82
  @keyframes pace-stripe-animation {
82
83
  0% { transform: none; transform: none; }
83
84
  100% { transform: translate(-28px, 0); transform: translate(-28px, 0); }
84
- }
85
+ }
@@ -1,3 +1,4 @@
1
+ /* This is a compiled file, you should be editing the file in the templates directory */
1
2
  .pace .pace-progress {
2
3
  background: #29d;
3
4
  position: fixed;
@@ -14,4 +15,4 @@
14
15
 
15
16
  .pace-inactive {
16
17
  display: none;
17
- }
18
+ }
@@ -1,5 +1,5 @@
1
1
  module Pace
2
2
  module Rails
3
- VERSION = "0.0.9"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
data/pace-rails.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["dan@yovu.co"]
11
11
  spec.description = %q{Pace automatic web page progress bar}
12
12
  spec.summary = %q{Pace automatic web page progress bar, integrated in Rails assets pipeline.}
13
- spec.homepage = "https://github.com/drkyro/pace-rails"
13
+ spec.homepage = "https://github.com/yovu/pace-rails"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files`.split($/)
@@ -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: false
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
- options = Pace.options = extend(defaultOptions, window.paceOptions, getFromDOM());
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
- _ref = NoTargetError.__super__.constructor.apply(this, arguments);
146
- return _ref;
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('pace-done', '');
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, _i, _len, _ref1, _results;
316
+ var binding, _j, _len1, _ref2, _results;
237
317
  if (this.bindings[name] != null) {
238
- _ref1 = this.bindings[name];
318
+ _ref2 = this.bindings[name];
239
319
  _results = [];
240
- for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
241
- binding = _ref1[_i];
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 _ref1;
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 (_ref1 = method.toUpperCase(), __indexOf.call(options.ajax.trackMethods, _ref1) >= 0) {
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
- req = new _WebSocket(url, protocols);
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 source, stillActive, _i, _len, _ref1, _ref2, _results;
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 < (_ref1 = request.readyState) && _ref1 < 4);
509
+ stillActive = (0 < (_ref2 = request.readyState) && _ref2 < 4);
405
510
  }
406
511
  if (stillActive) {
407
512
  Pace.restart();
408
- _ref2 = Pace.sources;
513
+ _ref3 = Pace.sources;
409
514
  _results = [];
410
- for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
411
- source = _ref2[_i];
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, _i, _len, _onreadystatechange, _ref1,
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
- _ref1 = ['load', 'abort', 'timeout', 'error'];
464
- for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
465
- event = _ref1[_i];
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 _ref2;
474
- if ((_ref2 = request.readyState) === 0 || _ref2 === 4) {
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, _i, _len, _ref1,
598
+ var event, _j, _len1, _ref2,
491
599
  _this = this;
492
600
  this.progress = 0;
493
- _ref1 = ['error', 'open'];
494
- for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
495
- event = _ref1[_i];
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, _i, _len, _ref1;
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
- _ref1 = options.selectors;
517
- for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
518
- selector = _ref1[_i];
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, _ref1,
669
+ var _onreadystatechange, _ref2,
562
670
  _this = this;
563
- this.progress = (_ref1 = this.states[document.readyState]) != null ? _ref1 : 100;
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 source, type, _i, _j, _len, _len1, _ref1, _ref2, _ref3;
806
+ var type, _j, _k, _len1, _len2, _ref2, _ref3, _ref4;
699
807
  Pace.sources = sources = [];
700
- _ref1 = ['ajax', 'elements', 'document', 'eventLag'];
701
- for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
702
- type = _ref1[_i];
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
- _ref3 = (_ref2 = options.extraSources) != null ? _ref2 : [];
708
- for (_j = 0, _len1 = _ref3.length; _j < _len1; _j++) {
709
- source = _ref3[_j];
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, source, start, sum, _i, _j, _len, _len1, _ref1;
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 = _i = 0, _len = sources.length; _i < _len; i = ++_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 = (_ref1 = source.elements) != null ? _ref1 : [source];
748
- for (j = _j = 0, _len1 = elements.length; _j < _len1; j = ++_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
- return Pace.running = false;
767
- }, Math.max(options.ghostTime, Math.min(options.minTime, now() - start)));
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);