pacejs_rails 0.4.17 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- MTgzMTc1MmRjODIxN2I5NTM1NDgyZTZiZWJhYWUxNTBhNjJiMDk3Yw==
5
- data.tar.gz: !binary |-
6
- ZmQ4MTI3YjUyNTRkZjk0ZGQxMGRkNGY5YzYzMGEzMGVmN2I3MTA0Yw==
2
+ SHA1:
3
+ metadata.gz: 76e6f715ea28b0b876c4d0502680525a0038a681
4
+ data.tar.gz: e00dd64e3bdba73f2b6fbcb03fbd158f7306a178
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- ODc2MzQ0NDNmNmRmMGZmNjE0MjUwNGJmZjAwMDU3MzBhMDg4YmJlOTlmYTNm
10
- NDVkNjAzZTBmOTYxMjliNjQ0M2QxNDE3YTdhNjNhM2FkOTdmNzY1NzAyNDZj
11
- MmQzNzBjNjhiMjZkZGRiMDgxNzg5YWIwMGVjMzVkZDBhMmIwM2Y=
12
- data.tar.gz: !binary |-
13
- ZTQ0M2EzYWY0NWM3ZjhjNjRiYmY2ZmQ3Y2FhYzFlNDg1ZDU1MTIzYTk3ZWI1
14
- ZDEyYThkNWVmYzY4YTI3OGQxMGYwODRhZmY5NDMxYTJlOGE1MzZjNjVhMDIy
15
- YjkwMDg2OGE5NGRiNzVjY2U0ZmZhY2Y5ODFjNGU3MDcxZGYzMjA=
6
+ metadata.gz: a339aa7da95af6aa968462042ecbee5d590ff54381d15d02d82c292e3a01c9da7ab9ee8e5fe8acca33719e573d6f1fcaa37e76996da9062385eef5e958c76e0e
7
+ data.tar.gz: 905b328e6cb2bf90a6ab47b6096a82da184b82a05706bccf26a417fd4ba9c3674e3872e014273d7ffa39930bb74ec42772fb0e90e3ba072bfdc75fec45b52034
@@ -1,8 +1,8 @@
1
- // v 0.4.16
1
+ // v 0.5.1
2
2
  // Pace.js
3
3
  // https://github.com/HubSpot/pace
4
4
  (function() {
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,
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, shouldIgnoreURL, 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; },
@@ -30,7 +30,8 @@
30
30
  },
31
31
  ajax: {
32
32
  trackMethods: ['GET'],
33
- trackWebSockets: false
33
+ trackWebSockets: true,
34
+ ignoreURLs: []
34
35
  }
35
36
  };
36
37
 
@@ -246,7 +247,7 @@
246
247
  }
247
248
  this.el = document.createElement('div');
248
249
  this.el.className = "pace pace-active";
249
- document.body.className = document.body.className.replace('pace-done', '');
250
+ document.body.className = document.body.className.replace(/pace-done/g, '');
250
251
  document.body.className += ' pace-running';
251
252
  this.el.innerHTML = '<div class="pace-progress">\n <div class="pace-progress-inner"></div>\n</div>\n<div class="pace-activity"></div>';
252
253
  if (targetElement.firstChild != null) {
@@ -441,7 +442,11 @@
441
442
  if ((_WebSocket != null) && options.ajax.trackWebSockets) {
442
443
  window.WebSocket = function(url, protocols) {
443
444
  var req;
444
- req = new _WebSocket(url, protocols);
445
+ if (protocols != null) {
446
+ req = new _WebSocket(url, protocols);
447
+ } else {
448
+ req = new _WebSocket(url);
449
+ }
445
450
  if (shouldTrack('socket')) {
446
451
  _this.trigger('request', {
447
452
  type: 'socket',
@@ -469,9 +474,30 @@
469
474
  return _intercept;
470
475
  };
471
476
 
477
+ shouldIgnoreURL = function(url) {
478
+ var pattern, _j, _len1, _ref2;
479
+ _ref2 = options.ajax.ignoreURLs;
480
+ for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
481
+ pattern = _ref2[_j];
482
+ if (typeof pattern === 'string') {
483
+ if (url.indexOf(pattern) !== -1) {
484
+ return true;
485
+ }
486
+ } else {
487
+ if (pattern.test(url)) {
488
+ return true;
489
+ }
490
+ }
491
+ }
492
+ return false;
493
+ };
494
+
472
495
  getIntercept().on('request', function(_arg) {
473
- var after, args, request, type;
474
- type = _arg.type, request = _arg.request;
496
+ var after, args, request, type, url;
497
+ type = _arg.type, request = _arg.request, url = _arg.url;
498
+ if (shouldIgnoreURL(url)) {
499
+ return;
500
+ }
475
501
  if (!Pace.running && (options.restartOnRequestAfter !== false || shouldTrack(type) === 'force')) {
476
502
  args = arguments;
477
503
  after = options.restartOnRequestAfter || 0;
@@ -514,8 +540,11 @@
514
540
  }
515
541
 
516
542
  AjaxMonitor.prototype.watch = function(_arg) {
517
- var request, tracker, type;
518
- type = _arg.type, request = _arg.request;
543
+ var request, tracker, type, url;
544
+ type = _arg.type, request = _arg.request, url = _arg.url;
545
+ if (shouldIgnoreURL(url)) {
546
+ return;
547
+ }
519
548
  if (type === 'socket') {
520
549
  tracker = new SocketRequestTracker(request);
521
550
  } else {
@@ -817,11 +846,13 @@
817
846
  };
818
847
 
819
848
  Pace.go = function() {
849
+ var start;
820
850
  Pace.running = true;
821
851
  bar.render();
852
+ start = now();
822
853
  cancelAnimation = false;
823
854
  return animation = runAnimation(function(frameTime, enqueueNextFrame) {
824
- var avg, count, done, element, elements, i, j, remaining, scaler, scalerList, start, sum, _j, _k, _len1, _len2, _ref2;
855
+ var avg, count, done, element, elements, i, j, remaining, scaler, scalerList, sum, _j, _k, _len1, _len2, _ref2;
825
856
  remaining = 100 - bar.progress;
826
857
  count = sum = 0;
827
858
  done = true;
@@ -842,7 +873,6 @@
842
873
  }
843
874
  avg = sum / count;
844
875
  bar.update(uniScaler.tick(frameTime, avg));
845
- start = now();
846
876
  if (bar.done() || done || cancelAnimation) {
847
877
  bar.update(100);
848
878
  Pace.trigger('done');
@@ -850,7 +880,7 @@
850
880
  bar.finish();
851
881
  Pace.running = false;
852
882
  return Pace.trigger('hide');
853
- }, Math.max(options.ghostTime, Math.min(options.minTime, now() - start)));
883
+ }, Math.max(options.ghostTime, Math.max(options.minTime - (now() - start), 0)));
854
884
  } else {
855
885
  return enqueueNextFrame();
856
886
  }
@@ -1,3 +1,3 @@
1
1
  module PacejsRails
2
- VERSION = "0.4.17"
2
+ VERSION = "0.5.1"
3
3
  end
metadata CHANGED
@@ -1,65 +1,65 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pacejs_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.17
4
+ version: 0.5.1
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-22 00:00:00.000000000 Z
11
+ date: 2014-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ! '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ! '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: railties
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ! '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '3.1'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ! '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.1'
55
- description: ! 'pace.js for Rails 3.1 and above - Automatic web page progress bar '
55
+ description: 'pace.js for Rails 3.1 and above - Automatic web page progress bar '
56
56
  email:
57
57
  - guy.israeli@gmail.com
58
58
  executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
- - .gitignore
62
+ - ".gitignore"
63
63
  - Gemfile
64
64
  - LICENSE.txt
65
65
  - README.md
@@ -88,17 +88,17 @@ require_paths:
88
88
  - lib
89
89
  required_ruby_version: !ruby/object:Gem::Requirement
90
90
  requirements:
91
- - - ! '>='
91
+ - - ">="
92
92
  - !ruby/object:Gem::Version
93
93
  version: '0'
94
94
  required_rubygems_version: !ruby/object:Gem::Requirement
95
95
  requirements:
96
- - - ! '>='
96
+ - - ">="
97
97
  - !ruby/object:Gem::Version
98
98
  version: '0'
99
99
  requirements: []
100
100
  rubyforge_project:
101
- rubygems_version: 2.1.3
101
+ rubygems_version: 2.2.1
102
102
  signing_key:
103
103
  specification_version: 4
104
104
  summary: pace.js for Rails with versions! horray!