nprogress-rails 0.1.3.0 → 0.1.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 261db801b935edcfac7746e803dab06b69127599
4
- data.tar.gz: 3d6c2634d465e766d1de036d54ec22b6899d5fe1
3
+ metadata.gz: 3e835d33bd6cae627162c79cb68c07f0d883baa7
4
+ data.tar.gz: 8cafa374c86de5cea8f47a28defe21e9806634a8
5
5
  SHA512:
6
- metadata.gz: 9f535bce837e0f27a93cb9db21324fc2f7603e1fc4a665edee1708794f1fa8024bd074dde5f02686d014d94c46be5ccc250c0737c415326e2892095045d092b6
7
- data.tar.gz: 32e7de0350ca750f49e13d989b4c100a0d1cafe8faf220ac6829272a530ebdce909a21f3b303684fbe51f0f488528ed1125a035567fe2705b698a14814140133
6
+ metadata.gz: fefa04715b218bca13f31cede920e6b5646d5b746edbcc0b0f2e1485bb296aa68ff7dc9fcbc52a6668183ee138e3487025378402c6aa0b7f12d7c7db568b0896
7
+ data.tar.gz: 1816fcc91bbef8c8d6638b3ccffdc6feb3118287d0b5e5be971170e0b40f0cd832b7cdb9352ea3fd5f0f6ded980086e7fd81b957c756591c441eb4e7cb433b19
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # nprogress-rails
2
2
 
3
3
  This is basically a ruby gem for asset pipeline which includes the version
4
- 0.1.2 of the awesome [rstacruz][rstacruz]' [nprogress][lib] library.
4
+ 0.1.6 of the awesome [rstacruz][rstacruz]' [nprogress][lib] library.
5
5
 
6
6
  - [**Original lib**][lib]
7
7
  - [**Demo**][demo]
@@ -1,20 +1,20 @@
1
- /*! NProgress (c) 2013, Rico Sta. Cruz
2
- * http://ricostacruz.com/nprogress */
1
+ /* NProgress, (c) 2013, 2014 Rico Sta. Cruz - http://ricostacruz.com/nprogress
2
+ * @license MIT */
3
3
 
4
- ;(function(factory) {
4
+ ;(function(root, factory) {
5
5
 
6
- if (typeof module === 'function') {
7
- module.exports = factory();
8
- } else if (typeof define === 'function' && define.amd) {
6
+ if (typeof define === 'function' && define.amd) {
9
7
  define(factory);
8
+ } else if (typeof exports === 'object') {
9
+ module.exports = factory();
10
10
  } else {
11
- this.NProgress = factory();
11
+ root.NProgress = factory();
12
12
  }
13
13
 
14
- })(function() {
14
+ })(this, function() {
15
15
  var NProgress = {};
16
16
 
17
- NProgress.version = '0.1.3';
17
+ NProgress.version = '0.1.6';
18
18
 
19
19
  var Settings = NProgress.settings = {
20
20
  minimum: 0.08,
@@ -27,6 +27,7 @@
27
27
  showSpinner: true,
28
28
  barSelector: '[role="bar"]',
29
29
  spinnerSelector: '[role="spinner"]',
30
+ parent: 'body',
30
31
  template: '<div class="bar" role="bar"><div class="peg"></div></div><div class="spinner" role="spinner"><div class="spinner-icon"></div></div>'
31
32
  };
32
33
 
@@ -82,16 +83,16 @@
82
83
 
83
84
  if (n === 1) {
84
85
  // Fade out
85
- css(progress, {
86
- transition: 'none',
87
- opacity: 1
86
+ css(progress, {
87
+ transition: 'none',
88
+ opacity: 1
88
89
  });
89
90
  progress.offsetWidth; /* Repaint */
90
91
 
91
92
  setTimeout(function() {
92
- css(progress, {
93
- transition: 'all ' + speed + 'ms linear',
94
- opacity: 0
93
+ css(progress, {
94
+ transition: 'all ' + speed + 'ms linear',
95
+ opacity: 0
95
96
  });
96
97
  setTimeout(function() {
97
98
  NProgress.remove();
@@ -177,24 +178,24 @@
177
178
  /**
178
179
  * Waits for all supplied jQuery promises and
179
180
  * increases the progress as the promises resolve.
180
- *
181
+ *
181
182
  * @param $promise jQUery Promise
182
183
  */
183
184
  (function() {
184
185
  var initial = 0, current = 0;
185
-
186
+
186
187
  NProgress.promise = function($promise) {
187
188
  if (!$promise || $promise.state() == "resolved") {
188
189
  return this;
189
190
  }
190
-
191
+
191
192
  if (current == 0) {
192
193
  NProgress.start();
193
194
  }
194
-
195
+
195
196
  initial++;
196
197
  current++;
197
-
198
+
198
199
  $promise.always(function() {
199
200
  current--;
200
201
  if (current == 0) {
@@ -204,10 +205,10 @@
204
205
  NProgress.set((initial - current) / initial);
205
206
  }
206
207
  });
207
-
208
+
208
209
  return this;
209
210
  };
210
-
211
+
211
212
  })();
212
213
 
213
214
  /**
@@ -219,15 +220,16 @@
219
220
  if (NProgress.isRendered()) return document.getElementById('nprogress');
220
221
 
221
222
  addClass(document.documentElement, 'nprogress-busy');
222
-
223
+
223
224
  var progress = document.createElement('div');
224
225
  progress.id = 'nprogress';
225
226
  progress.innerHTML = Settings.template;
226
227
 
227
228
  var bar = progress.querySelector(Settings.barSelector),
228
229
  perc = fromStart ? '-100' : toBarPerc(NProgress.status || 0),
230
+ parent = document.querySelector(Settings.parent),
229
231
  spinner;
230
-
232
+
231
233
  css(bar, {
232
234
  transition: 'all 0 linear',
233
235
  transform: 'translate3d(' + perc + '%,0,0)'
@@ -238,7 +240,11 @@
238
240
  spinner && removeElement(spinner);
239
241
  }
240
242
 
241
- document.body.appendChild(progress);
243
+ if (parent != document.body) {
244
+ addClass(parent, 'nprogress-custom-parent');
245
+ }
246
+
247
+ parent.appendChild(progress);
242
248
  return progress;
243
249
  };
244
250
 
@@ -248,6 +254,7 @@
248
254
 
249
255
  NProgress.remove = function() {
250
256
  removeClass(document.documentElement, 'nprogress-busy');
257
+ removeClass(document.querySelector(Settings.parent), 'nprogress-custom-parent')
251
258
  var progress = document.getElementById('nprogress');
252
259
  progress && removeElement(progress);
253
260
  };
@@ -333,7 +340,7 @@
333
340
 
334
341
  var queue = (function() {
335
342
  var pending = [];
336
-
343
+
337
344
  function next() {
338
345
  var fn = pending.shift();
339
346
  if (fn) {
@@ -348,10 +355,10 @@
348
355
  })();
349
356
 
350
357
  /**
351
- * (Internal) Applies css properties to an element, similar to the jQuery
358
+ * (Internal) Applies css properties to an element, similar to the jQuery
352
359
  * css method.
353
360
  *
354
- * While this helper does assist with vendor prefixed property names, it
361
+ * While this helper does assist with vendor prefixed property names, it
355
362
  * does not perform any manipulation of values prior to setting styles.
356
363
  */
357
364
 
@@ -392,7 +399,7 @@
392
399
 
393
400
  return function(element, properties) {
394
401
  var args = arguments,
395
- prop,
402
+ prop,
396
403
  value;
397
404
 
398
405
  if (args.length == 2) {
@@ -423,7 +430,7 @@
423
430
  var oldList = classList(element),
424
431
  newList = oldList + name;
425
432
 
426
- if (hasClass(oldList, name)) return;
433
+ if (hasClass(oldList, name)) return;
427
434
 
428
435
  // Trim the opening space.
429
436
  element.className = newList.substring(1);
@@ -447,8 +454,8 @@
447
454
  }
448
455
 
449
456
  /**
450
- * (Internal) Gets a space separated list of the class names on the element.
451
- * The list is wrapped with a single space on each end to facilitate finding
457
+ * (Internal) Gets a space separated list of the class names on the element.
458
+ * The list is wrapped with a single space on each end to facilitate finding
452
459
  * matches within the list.
453
460
  */
454
461
 
@@ -465,4 +472,4 @@
465
472
  }
466
473
 
467
474
  return NProgress;
468
- });
475
+ });
@@ -1,4 +1,5 @@
1
1
  $nprogress-color: #29d !default;
2
+ $nprogress-zindex: 100 !default;
2
3
 
3
4
  /* Make clicks pass-through */
4
5
  #nprogress {
@@ -9,7 +10,7 @@ $nprogress-color: #29d !default;
9
10
  background: $nprogress-color;
10
11
 
11
12
  position: fixed;
12
- z-index: 100;
13
+ z-index: $nprogress-zindex;
13
14
  top: 0;
14
15
  left: 0;
15
16
 
@@ -36,7 +37,7 @@ $nprogress-color: #29d !default;
36
37
  #nprogress .spinner {
37
38
  display: block;
38
39
  position: fixed;
39
- z-index: 100;
40
+ z-index: $nprogress-zindex;
40
41
  top: 15px;
41
42
  right: 15px;
42
43
  }
@@ -55,6 +56,16 @@ $nprogress-color: #29d !default;
55
56
  animation: nprogress-spinner 400ms linear infinite;
56
57
  }
57
58
 
59
+ .nprogress-custom-parent {
60
+ overflow: hidden;
61
+ position: relative;
62
+ }
63
+
64
+ .nprogress-custom-parent #nprogress .spinner,
65
+ .nprogress-custom-parent #nprogress .bar {
66
+ position: absolute;
67
+ }
68
+
58
69
  @-webkit-keyframes nprogress-spinner {
59
70
  0% { -webkit-transform: rotate(0deg); }
60
71
  100% { -webkit-transform: rotate(360deg); }
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'nprogress-rails'
7
- spec.version = '0.1.3.0'
7
+ spec.version = '0.1.3.1'
8
8
  spec.authors = ['Carlos Alexandro Becker']
9
9
  spec.email = ['caarlos0@gmail.com']
10
10
  spec.description = %q{This is a gem for the rstacruz' nprogress implementation. It's based on version nprogress 0.1.2.}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nprogress-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3.0
4
+ version: 0.1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carlos Alexandro Becker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-11 00:00:00.000000000 Z
11
+ date: 2014-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler