PageSourceSearch

http://iqingua.com/template/dean_fineck_160201/deancss/js/pace.js

js iqingua.com collected 2026-10-07 04:04:34 UTC 25,115 bytes, 885 lines download raw bytes

vendor: 8,747 bytes, lines 1-284
1(function() {
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, shouldTrack, source, sources, uniScaler, _WebSocket, _XDomainRequest, _XMLHttpRequest, _i, _intercept, _len, _pushState, _ref, _ref1, _replaceState,
3    __slice = [].slice,
4    __hasProp = {}.hasOwnProperty,
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; },
6    __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
7
8  defaultOptions = {
9    catchupTime: 500,
10    initialRate: .03,
11    minTime: 500,
12    ghostTime: 500,
13    maxProgressPerFrame: 10,
14    easeFactor: 1.25,
15    startOnPageLoad: true,
16    restartOnPushState: true,
17    restartOnRequestAfter: 500,
18    target: 'body',
19    elements: {
20      checkInterval: 100,
21      selectors: ['body']
22    },
23    eventLag: {
24      minSamples: 10,
25      sampleCount: 3,
26      lagThreshold: 3
27    },
28    ajax: {
29      trackMethods: ['GET'],
30      trackWebSockets: false
31    }
32  };
33
34  now = function() {
35    var _ref;
36    return (_ref = typeof performance !== "undefined" && performance !== null ? typeof performance.now === "function" ? performance.now() : void 0 : void 0) != null ? _ref : +(new Date);
37  };
38
39  requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame;
40
41  cancelAnimationFrame = window.cancelAnimationFrame || window.mozCancelAnimationFrame;
42
43  if (requestAnimationFrame == null) {
44    requestAnimationFrame = function(fn) {
45      return setTimeout(fn, 50);
46    };
47    cancelAnimationFrame = function(id) {
48      return clearTimeout(id);
49    };
50  }
51
52  runAnimation = function(fn) {
53    var last, tick;
54    last = now();
55    tick = function() {
56      var diff;
57      diff = now() - last;
58      if (diff >= 33) {
59        last = now();
60        return fn(diff, function() {
61          return requestAnimationFrame(tick);
62        });
63      } else {
64        return setTimeout(tick, 33 - diff);
65      }
66    };
67    return tick();
68  };
69
70  result = function() {
71    var args, key, obj;
72    obj = arguments[0], key = arguments[1], args = 3 <= arguments.length ? __slice.call(arguments, 2) : [];
73    if (typeof obj[key] === 'function') {
74      return obj[key].apply(obj, args);
75    } else {
76      return obj[key];
77    }
78  };
79
80  extend = function() {
81    var key, out, source, sources, val, _i, _len;
82    out = arguments[0], sources = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
83    for (_i = 0, _len = sources.length; _i < _len; _i++) {
84      source = sources[_i];
85      if (source) {
86        for (key in source) {
87          if (!__hasProp.call(source, key)) continue;
88          val = source[key];
89          if ((out[key] != null) && typeof out[key] === 'object' && (val != null) && typeof val === 'object') {
90            extend(out[key], val);
91          } else {
92            out[key] = val;
93          }
94        }
95      }
96    }
97    return out;
98  };
99
100  avgAmplitude = function(arr) {
101    var count, sum, v, _i, _len;
102    sum = count = 0;
103    for (_i = 0, _len = arr.length; _i < _len; _i++) {
104      v = arr[_i];
105      sum += Math.abs(v);
106      count++;
107    }
108    return sum / count;
109  };
110
111  getFromDOM = function(key, json) {
112    var data, e, el;
113    if (key == null) {
114      key = 'options';
115    }
116    if (json == null) {
117      json = true;
118    }
119    el = document.querySelector("[data-pace-" + key + "]");
120    if (!el) {
121      return;
122    }
123    data = el.getAttribute("data-pace-" + key);
124    if (!json) {
125      return data;
126    }
127    try {
128      return JSON.parse(data);
129    } catch (_error) {
130      e = _error;
131      return typeof console !== "undefined" && console !== null ? console.error("Error parsing inline pace options", e) : void 0;
132    }
133  };
134
135  Evented = (function() {
136    function Evented() {}
137
138    Evented.prototype.on = function(event, handler, ctx, once) {
139      var _base;
140      if (once == null) {
141        once = false;
142      }
143      if (this.bindings == null) {
144        this.bindings = {};
145      }
146      if ((_base = this.bindings)[event] == null) {
147        _base[event] = [];
148      }
149      return this.bindings[event].push({
150        handler: handler,
151        ctx: ctx,
152        once: once
153      });
154    };
155
156    Evented.prototype.once = function(event, handler, ctx) {
157      return this.on(event, handler, ctx, true);
158    };
159
160    Evented.prototype.off = function(event, handler) {
161      var i, _ref, _results;
162      if (((_ref = this.bindings) != null ? _ref[event] : void 0) == null) {
163        return;
164      }
165      if (handler == null) {
166        return delete this.bindings[event];
167      } else {
168        i = 0;
169        _results = [];
170        while (i < this.bindings[event].length) {
171          if (this.bindings[event][i].handler === handler) {
172            _results.push(this.bindings[event].splice(i, 1));
173          } else {
174            _results.push(i++);
175          }
176        }
177        return _results;
178      }
179    };
180
181    Evented.prototype.trigger = function() {
182      var args, ctx, event, handler, i, once, _ref, _ref1, _results;
183      event = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
184      if ((_ref = this.bindings) != null ? _ref[event] : void 0) {
185        i = 0;
186        _results = [];
187        while (i < this.bindings[event].length) {
188          _ref1 = this.bindings[event][i], handler = _ref1.handler, ctx = _ref1.ctx, once = _ref1.once;
189          handler.apply(ctx != null ? ctx : this, args);
190          if (once) {
191            _results.push(this.bindings[event].splice(i, 1));
192          } else {
193            _results.push(i++);
194          }
195        }
196        return _results;
197      }
198    };
199
200    return Evented;
201
202  })();
203
204  if (window.Pace == null) {
205    window.Pace = {};
206  }
207
208  extend(Pace, Evented.prototype);
209
210  options = Pace.options = extend({}, defaultOptions, window.paceOptions, getFromDOM());
211
212  _ref = ['ajax', 'document', 'eventLag', 'elements'];
213  for (_i = 0, _len = _ref.length; _i < _len; _i++) {
214    source = _ref[_i];
215    if (options[source] === true) {
216      options[source] = defaultOptions[source];
217    }
218  }
219
220  NoTargetError = (function(_super) {
221    __extends(NoTargetError, _super);
222
223    function NoTargetError() {
224      _ref1 = NoTargetError.__super__.constructor.apply(this, arguments);
225      return _ref1;
226    }
227
228    return NoTargetError;
229
230  })(Error);
231
232  Bar = (function() {
233    function Bar() {
234      this.progress = 0;
235    }
236
237    Bar.prototype.getElement = function() {
238      var targetElement;
239      if (this.el == null) {
240        targetElement = document.querySelector(options.target);
241        if (!targetElement) {
242          throw new NoTargetError;
243        }
244        this.el = document.createElement('div');
245        this.el.className = "pace pace-active";
246        document.body.className = document.body.className.replace('pace-done', '');
247        document.body.className += ' pace-running';
248        this.el.innerHTML = '<div class="pace-progress">\n  <div class="pace-progress-inner"></div>\n</div>\n<div class="pace-activity"></div>';
249        if (targetElement.firstChild != null) {
250          targetElement.insertBefore(this.el, targetElement.firstChild);
251        } else {
252          targetElement.appendChild(this.el);
253        }
254      }
255      return this.el;
256    };
257
258    Bar.prototype.finish = function() {
259      var el;
260      el = this.getElement();
261      el.className = el.className.replace('pace-active', '');
262      el.className += ' pace-inactive';
263      document.body.className = document.body.className.replace('pace-running', '');
264      return document.body.className += ' pace-done';
265    };
266
267    Bar.prototype.update = function(prog) {
268      this.progress = prog;
269      return this.render();
270    };
271
272    Bar.prototype.destroy = function() {
273      try {
274        this.getElement().parentNode.removeChild(this.getElement());
275      } catch (_error) {
276        NoTargetError = _error;
277      }
278      return this.el = void 0;
279    };
280
281    Bar.prototype.render = function() {
282      var el, progressStr;
283      if (document.querySelector(options.target) == null) {
284        return false;
285      }
286      el = this.getElement();
287      el.children[0].style.width = "" + this.progress + "%";
288      if (!this.lastRenderedProgress || this.lastRenderedProgress | 0 !== this.progress | 0) {
289        el.children[0].setAttribute('data-progress-text', "" + (this.progress | 0) + "%");
290        if (this.progress >= 100) {
291          progressStr = '99';
292        } else {
293          progressStr = this.progress < 10 ? "0" : "";
294          progressStr += this.progress | 0;
295        }
296        el.children[0].setAttribute('data-progress', "" + progressStr);
297      }
298      return this.lastRenderedProgress = this.progress;
299    };
300
301    Bar.prototype.done = function() {
302      return this.progress >= 100;
303    };
304
305    return Bar;
306
307  })();
308
309  Events = (function() {
310    function Events() {
311      this.bindings = {};
312    }
313
314    Events.prototype.trigger = function(name, val) {
315      var binding, _j, _len1, _ref2, _results;
316      if (this.bindings[name] != null) {
317        _ref2 = this.bindings[name];
318        _results = [];
319        for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
320          binding = _ref2[_j];
321          _results.push(binding.call(this, val));
322        }
323        return _results;
324      }
325    };
326
327    Events.prototype.on = function(name, fn) {
328      var _base;
329      if ((_base = this.bindings)[name] == null) {
330        _base[name] = [];
331      }
332      return this.bindings[name].push(fn);
333    };
334
335    return Events;
336
337  })();
338
339  _XMLHttpRequest = window.XMLHttpRequest;
340
341  _XDomainRequest = window.XDomainRequest;
342
343  _WebSocket = window.WebSocket;
344
345  extendNative = function(to, from) {
346    var e, key, val, _results;
347    _results = [];
348    for (key in from.prototype) {
349      try {
350        val = from.prototype[key];
351        if ((to[key] == null) && typeof val !== 'function') {
352          _results.push(to[key] = val);
353        } else {
354          _results.push(void 0);
355        }
356      } catch (_error) {
357        e = _error;
358      }
359    }
360    return _results;
361  };
362
363  ignoreStack = [];
364
365  Pace.ignore = function() {
366    var args, fn, ret;
367    fn = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
368    ignoreStack.unshift('ignore');
369    ret = fn.apply(null, args);
370    ignoreStack.shift();
371    return ret;
372  };
373
374  Pace.track = function() {
375    var args, fn, ret;
376    fn = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
377    ignoreStack.unshift('track');
378    ret = fn.apply(null, args);
379    ignoreStack.shift();
380    return ret;
381  };
382
383  shouldTrack = function(method) {
384    var _ref2;
385    if (method == null) {
386      method = 'GET';
387    }
388    if (ignoreStack[0] === 'track') {
389      return 'force';
390    }
391    if (!ignoreStack.length && options.ajax) {
392      if (method === 'socket' && options.ajax.trackWebSockets) {
393        return true;
394      } else if (_ref2 = method.toUpperCase(), __indexOf.call(options.ajax.trackMethods, _ref2) >= 0) {
395        return true;
396      }
397    }
398    return false;
399  };
400
401  RequestIntercept = (function(_super) {
402    __extends(RequestIntercept, _super);
403
404    function RequestIntercept() {
405      var monitorXHR,
406        _this = this;
407      RequestIntercept.__super__.constructor.apply(this, arguments);
408      monitorXHR = function(req) {
409        var _open;
410        _open = req.open;
411        return req.open = function(type, url, async) {
412          if (shouldTrack(type)) {
413            _this.trigger('request', {
414              type: type,
415              url: url,
416              request: req
417            });
418          }
419          return _open.apply(req, arguments);
420        };
421      };
422      window.XMLHttpRequest = function(flags) {
423        var req;
424        req = new _XMLHttpRequest(flags);
425        monitorXHR(req);
426        return req;
427      };
428      extendNative(window.XMLHttpRequest, _XMLHttpRequest);
429      if (_XDomainRequest != null) {
430        window.XDomainRequest = function() {
431          var req;
432          req = new _XDomainRequest;
433          monitorXHR(req);
434          return req;
435        };
436        extendNative(window.XDomainRequest, _XDomainRequest);
437      }
438      if ((_WebSocket != null) && options.ajax.trackWebSockets) {
439        window.WebSocket = function(url, protocols) {
440          var req;
441          req = new _WebSocket(url, protocols);
442          if (shouldTrack('socket')) {
443            _this.trigger('request', {
444              type: 'socket',
445              url: url,
446              protocols: protocols,
447              request: req
448            });
449          }
450          return req;
451        };
452        extendNative(window.WebSocket, _WebSocket);
453      }
454    }
455
456    return RequestIntercept;
457
458  })(Events);
459
460  _intercept = null;
461
462  getIntercept = function() {
463    if (_intercept == null) {
464      _intercept = new RequestIntercept;
465    }
466    return _intercept;
467  };
468
469  getIntercept().on('request', function(_arg) {
470    var after, args, request, type;
471    type = _arg.type, request = _arg.request;
472    if (!Pace.running && (options.restartOnRequestAfter !== false || shouldTrack(type) === 'force')) {
473      args = arguments;
474      after = options.restartOnRequestAfter || 0;
475      if (typeof after === 'boolean') {
476        after = 0;
477      }
478      return setTimeout(function() {
479        var stillActive, _j, _len1, _ref2, _ref3, _results;
480        if (type === 'socket') {
481          stillActive = request.readyState < 2;
482        } else {
483          stillActive = (0 < (_ref2 = request.readyState) && _ref2 < 4);
484        }
485        if (stillActive) {
486          Pace.restart();
487          _ref3 = Pace.sources;
488          _results = [];
489          for (_j = 0, _len1 = _ref3.length; _j < _len1; _j++) {
490            source = _ref3[_j];
491            if (source instanceof AjaxMonitor) {
492              source.watch.apply(source, args);
493              break;
494            } else {
495              _results.push(void 0);
496            }
497          }
498          return _results;
499        }
500      }, after);
501    }
502  });
503
504  AjaxMonitor = (function() {
505    function AjaxMonitor() {
506      var _this = this;
507      this.elements = [];
508      getIntercept().on('request', function() {
509        return _this.watch.apply(_this, arguments);
510      });
511    }
512
513    AjaxMonitor.prototype.watch = function(_arg) {
514      var request, tracker, type;
515      type = _arg.type, request = _arg.request;
516      if (type === 'socket') {
517        tracker = new SocketRequestTracker(request);
518      } else {
519        tracker = new XHRRequestTracker(request);
520      }
521      return this.elements.push(tracker);
522    };
523
524    return AjaxMonitor;
525
526  })();
527
528  XHRRequestTracker = (function() {
529    function XHRRequestTracker(request) {
530      var event, size, _j, _len1, _onreadystatechange, _ref2,
531        _this = this;
532      this.progress = 0;
533      if (window.ProgressEvent != null) {
534        size = null;
535        request.addEventListener('progress', function(evt) {
536          if (evt.lengthComputable) {
537            return _this.progress = 100 * evt.loaded / evt.total;
538          } else {
539            return _this.progress = _this.progress + (100 - _this.progress) / 2;
540          }
541        });
542        _ref2 = ['load', 'abort', 'timeout', 'error'];
543        for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
544          event = _ref2[_j];
545          request.addEventListener(event, function() {
546            return _this.progress = 100;
547          });
548        }
549      } else {
550        _onreadystatechange = request.onreadystatechange;
551        request.onreadystatechange = function() {
552          var _ref3;
553          if ((_ref3 = request.readyState) === 0 || _ref3 === 4) {
554            _this.progress = 100;
555          } else if (request.readyState === 3) {
556            _this.progress = 50;
557          }
558          return typeof _onreadystatechange === "function" ? _onreadystatechange.apply(null, arguments) : void 0;
559        };
560      }
561    }
562
563    return XHRRequestTracker;
564
565  })();
566
567  SocketRequestTracker = (function() {
568    function SocketRequestTracker(request) {
569      var event, _j, _len1, _ref2,
570        _this = this;
571      this.progress = 0;
572      _ref2 = ['error', 'open'];
573      for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
574        event = _ref2[_j];
575        request.addEventListener(event, function() {
576          return _this.progress = 100;
577        }
vendor: 6,080 bytes, lines 577-817
577);
578      }
579    }
580
581    return SocketRequestTracker;
582
583  })();
584
585  ElementMonitor = (function() {
586    function ElementMonitor(options) {
587      var selector, _j, _len1, _ref2;
588      if (options == null) {
589        options = {};
590      }
591      this.elements = [];
592      if (options.selectors == null) {
593        options.selectors = [];
594      }
595      _ref2 = options.selectors;
596      for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
597        selector = _ref2[_j];
598        this.elements.push(new ElementTracker(selector));
599      }
600    }
601
602    return ElementMonitor;
603
604  })();
605
606  ElementTracker = (function() {
607    function ElementTracker(selector) {
608      this.selector = selector;
609      this.progress = 0;
610      this.check();
611    }
612
613    ElementTracker.prototype.check = function() {
614      var _this = this;
615      if (document.querySelector(this.selector)) {
616        return this.done();
617      } else {
618        return setTimeout((function() {
619          return _this.check();
620        }), options.elements.checkInterval);
621      }
622    };
623
624    ElementTracker.prototype.done = function() {
625      return this.progress = 100;
626    };
627
628    return ElementTracker;
629
630  })();
631
632  DocumentMonitor = (function() {
633    DocumentMonitor.prototype.states = {
634      loading: 0,
635      interactive: 50,
636      complete: 100
637    };
638
639    function DocumentMonitor() {
640      var _onreadystatechange, _ref2,
641        _this = this;
642      this.progress = (_ref2 = this.states[document.readyState]) != null ? _ref2 : 100;
643      _onreadystatechange = document.onreadystatechange;
644      document.onreadystatechange = function() {
645        if (_this.states[document.readyState] != null) {
646          _this.progress = _this.states[document.readyState];
647        }
648        return typeof _onreadystatechange === "function" ? _onreadystatechange.apply(null, arguments) : void 0;
649      };
650    }
651
652    return DocumentMonitor;
653
654  })();
655
656  EventLagMonitor = (function() {
657    function EventLagMonitor() {
658      var avg, interval, last, points, samples,
659        _this = this;
660      this.progress = 0;
661      avg = 0;
662      samples = [];
663      points = 0;
664      last = now();
665      interval = setInterval(function() {
666        var diff;
667        diff = now() - last - 50;
668        last = now();
669        samples.push(diff);
670        if (samples.length > options.eventLag.sampleCount) {
671          samples.shift();
672        }
673        avg = avgAmplitude(samples);
674        if (++points >= options.eventLag.minSamples && avg < options.eventLag.lagThreshold) {
675          _this.progress = 100;
676          return clearInterval(interval);
677        } else {
678          return _this.progress = 100 * (3 / (avg + 3));
679        }
680      }, 50);
681    }
682
683    return EventLagMonitor;
684
685  })();
686
687  Scaler = (function() {
688    function Scaler(source) {
689      this.source = source;
690      this.last = this.sinceLastUpdate = 0;
691      this.rate = options.initialRate;
692      this.catchup = 0;
693      this.progress = this.lastProgress = 0;
694      if (this.source != null) {
695        this.progress = result(this.source, 'progress');
696      }
697    }
698
699    Scaler.prototype.tick = function(frameTime, val) {
700      var scaling;
701      if (val == null) {
702        val = result(this.source, 'progress');
703      }
704      if (val >= 100) {
705        this.done = true;
706      }
707      if (val === this.last) {
708        this.sinceLastUpdate += frameTime;
709      } else {
710        if (this.sinceLastUpdate) {
711          this.rate = (val - this.last) / this.sinceLastUpdate;
712        }
713        this.catchup = (val - this.progress) / options.catchupTime;
714        this.sinceLastUpdate = 0;
715        this.last = val;
716      }
717      if (val > this.progress) {
718        this.progress += this.catchup * frameTime;
719      }
720      scaling = 1 - Math.pow(this.progress / 100, options.easeFactor);
721      this.progress += scaling * this.rate * frameTime;
722      this.progress = Math.min(this.lastProgress + options.maxProgressPerFrame, this.progress);
723      this.progress = Math.max(0, this.progress);
724      this.progress = Math.min(100, this.progress);
725      this.lastProgress = this.progress;
726      return this.progress;
727    };
728
729    return Scaler;
730
731  })();
732
733  sources = null;
734
735  scalers = null;
736
737  bar = null;
738
739  uniScaler = null;
740
741  animation = null;
742
743  cancelAnimation = null;
744
745  Pace.running = false;
746
747  handlePushState = function() {
748    if (options.restartOnPushState) {
749      return Pace.restart();
750    }
751  };
752
753  if (window.history.pushState != null) {
754    _pushState = window.history.pushState;
755    window.history.pushState = function() {
756      handlePushState();
757      return _pushState.apply(window.history, arguments);
758    };
759  }
760
761  if (window.history.replaceState != null) {
762    _replaceState = window.history.replaceState;
763    window.history.replaceState = function() {
764      handlePushState();
765      return _replaceState.apply(window.history, arguments);
766    };
767  }
768
769  SOURCE_KEYS = {
770    ajax: AjaxMonitor,
771    elements: ElementMonitor,
772    document: DocumentMonitor,
773    eventLag: EventLagMonitor
774  };
775
776  (init = function() {
777    var type, _j, _k, _len1, _len2, _ref2, _ref3, _ref4;
778    Pace.sources = sources = [];
779    _ref2 = ['ajax', 'elements', 'document', 'eventLag'];
780    for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
781      type = _ref2[_j];
782      if (options[type] !== false) {
783        sources.push(new SOURCE_KEYS[type](options[type]));
784      }
785    }
786    _ref4 = (_ref3 = options.extraSources) != null ? _ref3 : [];
787    for (_k = 0, _len2 = _ref4.length; _k < _len2; _k++) {
788      source = _ref4[_k];
789      sources.push(new source(options));
790    }
791    Pace.bar = bar = new Bar;
792    scalers = [];
793    return uniScaler = new Scaler;
794  })();
795
796  Pace.stop = function() {
797    Pace.trigger('stop');
798    Pace.running = false;
799    bar.destroy();
800    cancelAnimation = true;
801    if (animation != null) {
802      if (typeof cancelAnimationFrame === "function") {
803        cancelAnimationFrame(animation);
804      }
805      animation = null;
806    }
807    return init();
808  };
809
810  Pace.restart = function() {
811    Pace.trigger('restart');
812    Pace.stop();
813    return Pace.start();
814  };
815
816  Pace.go = function() {
817    
817Pace.running = true;
818    bar.render();
819    cancelAnimation = false;
820    return animation = runAnimation(function(frameTime, enqueueNextFrame) {
821      var avg, count, done, element, elements, i, j, remaining, scaler, scalerList, start, sum, _j, _k, _len1, _len2, _ref2;
822      remaining = 100 - bar.progress;
823      count = sum = 0;
824      done = true;
825      for (i = _j = 0, _len1 = sources.length; _j < _len1; i = ++_j) {
826        source = sources[i];
827        scalerList = scalers[i] != null ? scalers[i] : scalers[i] = [];
828        elements = (_ref2 = source.elements) != null ? _ref2 : [source];
829        for (j = _k = 0, _len2 = elements.length; _k < _len2; j = ++_k) {
830          element = elements[j];
831          scaler = scalerList[j] != null ? scalerList[j] : scalerList[j] = new Scaler(element);
832          done &= scaler.done;
833          if (scaler.done) {
834            continue;
835          }
836          count++;
837          sum += scaler.tick(frameTime);
838        }
839      }
840      avg = sum / count;
841      bar.update(uniScaler.tick(frameTime, avg));
842      start = now();
843      if (bar.done() || done || cancelAnimation) {
844        bar.update(100);
845        Pace.trigger('done');
846        return setTimeout(function() {
847          bar.finish();
848          Pace.running = false;
849          return Pace.trigger('hide');
850        }, Math.max(options.ghostTime, Math.min(options.minTime, now() - start)));
851      } else {
852        return enqueueNextFrame();
853      }
854    });
855  };
856
857  Pace.start = function(_options) {
858    extend(options, _options);
859    Pace.running = true;
860    try {
861      bar.render();
862    } catch (_error) {
863      NoTargetError = _error;
864    }
865    if (!document.querySelector('.pace')) {
866      return setTimeout(Pace.start, 50);
867    } else {
868      Pace.trigger('start');
869      return Pace.go();
870    }
871  };
872
873  if (typeof define === 'function' && define.amd) {
874    define(function() {
875      return Pace;
876    });
877  } else if (typeof exports === 'object') {
878    module.exports = Pace;
879  } else {
880    if (options.startOnPageLoad) {
881      Pace.start();
882    }
883  }
884
885}).call(this);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.