From 299d66134b94e524f9ea67c43e5970cc9418bea4 Mon Sep 17 00:00:00 2001 From: "Rico Sta. Cruz" Date: Wed, 13 May 2015 18:32:13 +0800 Subject: [PATCH 01/19] Fix History.md annotations --- History.md | 1 + 1 file changed, 1 insertion(+) diff --git a/History.md b/History.md index b72f4d7..c3dd7f5 100644 --- a/History.md +++ b/History.md @@ -108,3 +108,4 @@ Initial release. [v0.1.1]: https://github.com/rstacruz/nprogress/compare/v0.1.0...v0.1.1 [#53]: https://github.com/rstacruz/nprogress/issues/53 [v0.2.0]: https://github.com/rstacruz/nprogress/compare/v0.1.6...v0.2.0 +[@drodil]: https://github.com/drodil From f094b7cae0a3b8c45dd85ad67aedc739b32bda37 Mon Sep 17 00:00:00 2001 From: "Rico Sta. Cruz" Date: Thu, 14 May 2015 11:38:41 +0800 Subject: [PATCH 02/19] Update History.md --- History.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/History.md b/History.md index c3dd7f5..79b994f 100644 --- a/History.md +++ b/History.md @@ -1,5 +1,7 @@ ## [v0.2.0] - May 13, 2015 +This is a maintenance release with cleanups. No functionality changes were introduced. + * [#93] - Remove jQuery dependency in component ([@slang800]) * [#120] - Fix the Readme showing a wrong example for `ease` ([@teeceepee]) @@ -9,6 +11,7 @@ Minor changes: * [#90] - Fix typo in Readme ([@mdxs]) * [#119] - Fix typo in Readme ([@infertux]) * [#53] - Use `===` instead of `==` ([@drodil]) + * Update test dependencies ## [v0.1.6] - June 25, 2014 From 4d1745bcbead65f2d07fab9f8496f8290c6d2dfc Mon Sep 17 00:00:00 2001 From: "Rico Sta. Cruz" Date: Mon, 18 May 2015 07:18:13 +0800 Subject: [PATCH 03/19] Readme: add pjax instructions --- Readme.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Readme.md b/Readme.md index 4097088..b0245e7 100644 --- a/Readme.md +++ b/Readme.md @@ -34,9 +34,9 @@ NProgress.start(); NProgress.done(); ~~~ -Using [Turbolinks] or similar? Ensure you're using Turbolinks 1.3.0+, and use -this: (explained - [here](https://github.com/rstacruz/nprogress/issues/8#issuecomment-23010560)) +### Turbolinks +Ensure you're using Turbolinks 1.3.0+, and use +this: (explained [here](https://github.com/rstacruz/nprogress/issues/8#issuecomment-23010560)) ~~~ js $(document).on('page:fetch', function() { NProgress.start(); }); @@ -44,6 +44,14 @@ $(document).on('page:change', function() { NProgress.done(); }); $(document).on('page:restore', function() { NProgress.remove(); }); ~~~ +### Pjax +Try this: (explained [here](https://github.com/rstacruz/nprogress/issues/22#issuecomment-36540472)) + +~~~ js +$(document).on('pjax:start', function() { NProgress.start(); }); +$(document).on('pjax:end', function() { NProgress.done(); }); +~~~ + Ideas ----- From 33878ab3fd7168b4e2d3863e58f83c241ab4e638 Mon Sep 17 00:00:00 2001 From: "Rico Sta. Cruz" Date: Sat, 4 Jul 2015 10:44:04 +0800 Subject: [PATCH 04/19] Track script errors in mocha html --- package.json | 2 +- test/index.html | 23 +++++++++++------------ 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index aa732dd..28f7471 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "devDependencies": { "chai": "~1.6.1", "jquery": "^2.1.1", - "jsdom": "^5.4.1", + "jsdom": "^5.4.3", "mocha": "^2.2.4", "mocha-jsdom": "^0.3.0" }, diff --git a/test/index.html b/test/index.html index 9fb4a8e..5479d26 100644 --- a/test/index.html +++ b/test/index.html @@ -1,25 +1,24 @@ - - + Nprogress tests - - - - - + + + + +
+ + + - + - - - -
+ From 1cc3d2872c686db8ee8dd7f365b94f9513ab0b70 Mon Sep 17 00:00:00 2001 From: Martin Ratinaud Date: Thu, 10 Sep 2015 15:51:29 +0200 Subject: [PATCH 05/19] Add guard on classList function if element does not exist anymore --- nprogress.js | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/nprogress.js b/nprogress.js index b23b300..ef69871 100644 --- a/nprogress.js +++ b/nprogress.js @@ -83,16 +83,16 @@ if (n === 1) { // Fade out - css(progress, { - transition: 'none', - opacity: 1 + css(progress, { + transition: 'none', + opacity: 1 }); progress.offsetWidth; /* Repaint */ setTimeout(function() { - css(progress, { - transition: 'all ' + speed + 'ms linear', - opacity: 0 + css(progress, { + transition: 'all ' + speed + 'ms linear', + opacity: 0 }); setTimeout(function() { NProgress.remove(); @@ -220,7 +220,7 @@ if (NProgress.isRendered()) return document.getElementById('nprogress'); addClass(document.documentElement, 'nprogress-busy'); - + var progress = document.createElement('div'); progress.id = 'nprogress'; progress.innerHTML = Settings.template; @@ -229,7 +229,7 @@ perc = fromStart ? '-100' : toBarPerc(NProgress.status || 0), parent = document.querySelector(Settings.parent), spinner; - + css(bar, { transition: 'all 0 linear', transform: 'translate3d(' + perc + '%,0,0)' @@ -340,7 +340,7 @@ var queue = (function() { var pending = []; - + function next() { var fn = pending.shift(); if (fn) { @@ -355,10 +355,10 @@ })(); /** - * (Internal) Applies css properties to an element, similar to the jQuery + * (Internal) Applies css properties to an element, similar to the jQuery * css method. * - * While this helper does assist with vendor prefixed property names, it + * While this helper does assist with vendor prefixed property names, it * does not perform any manipulation of values prior to setting styles. */ @@ -399,7 +399,7 @@ return function(element, properties) { var args = arguments, - prop, + prop, value; if (args.length == 2) { @@ -430,7 +430,7 @@ var oldList = classList(element), newList = oldList + name; - if (hasClass(oldList, name)) return; + if (hasClass(oldList, name)) return; // Trim the opening space. element.className = newList.substring(1); @@ -454,13 +454,13 @@ } /** - * (Internal) Gets a space separated list of the class names on the element. - * The list is wrapped with a single space on each end to facilitate finding + * (Internal) Gets a space separated list of the class names on the element. + * The list is wrapped with a single space on each end to facilitate finding * matches within the list. */ function classList(element) { - return (' ' + (element.className || '') + ' ').replace(/\s+/gi, ' '); + return (' ' + (element && element.className || '') + ' ').replace(/\s+/gi, ' '); } /** @@ -473,4 +473,3 @@ return NProgress; }); - From bba86d636e1b047cabed0f1dec2cdcadd462867e Mon Sep 17 00:00:00 2001 From: Chris Cinelli Date: Fri, 18 Dec 2015 13:03:15 -0800 Subject: [PATCH 06/19] Smoother decelerating increments (with optimal defaults) --- nprogress.js | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/nprogress.js b/nprogress.js index ef69871..708bee1 100644 --- a/nprogress.js +++ b/nprogress.js @@ -18,12 +18,11 @@ var Settings = NProgress.settings = { minimum: 0.08, - easing: 'ease', + easing: 'linear', positionUsing: '', - speed: 200, + speed: 350, trickle: true, - trickleRate: 0.02, - trickleSpeed: 800, + trickleSpeed: 250, showSpinner: true, barSelector: '[role="bar"]', spinnerSelector: '[role="spinner"]', @@ -161,9 +160,26 @@ if (!n) { return NProgress.start(); + } else if(n > 1) { + return; } else { if (typeof amount !== 'number') { - amount = (1 - n) * clamp(Math.random() * n, 0.1, 0.95); + if (n >= 0 && n < 0.25) { + // Start out between 3 - 6% increments + amount = (Math.random() * (5 - 3 + 1) + 3) / 100; + } else if (n >= 0.25 && n < 0.65) { + // increment between 0 - 3% + amount = (Math.random() * 3) / 100; + } else if (n >= 0.65 && n < 0.9) { + // increment between 0 - 2% + amount = (Math.random() * 2) / 100; + } else if (n >= 0.9 && n < 0.99) { + // finally, increment it .5 % + amount = 0.005; + } else { + // after 99%, don't increment: + amount = 0; + } } n = clamp(n + amount, 0, 0.994); @@ -172,7 +188,7 @@ }; NProgress.trickle = function() { - return NProgress.inc(Math.random() * Settings.trickleRate); + return NProgress.inc(); }; /** From 8845ea0fd0b76bfd32394170bffcb70f6c1cf7cd Mon Sep 17 00:00:00 2001 From: Tyler Brown Date: Fri, 1 Jul 2016 10:32:50 -0400 Subject: [PATCH 07/19] smoother decelerating trickle --- Readme.md | 7 +++---- nprogress.js | 21 +++++---------------- 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/Readme.md b/Readme.md index b0245e7..a7e3e5f 100644 --- a/Readme.md +++ b/Readme.md @@ -133,12 +133,11 @@ Turn off the automatic incrementing behavior by setting this to `false`. (defaul NProgress.configure({ trickle: false }); ~~~ -#### `trickleRate` and `trickleSpeed` -You can adjust the *trickleRate* (how much to increase per trickle) and -*trickleSpeed* (how often to trickle, in ms). +#### `trickleSpeed` +Adjust how often to trickle/increment, in ms. ~~~ js -NProgress.configure({ trickleRate: 0.02, trickleSpeed: 800 }); +NProgress.configure({ trickleSpeed: 800 }); ~~~ #### `showSpinner` diff --git a/nprogress.js b/nprogress.js index 708bee1..349cccf 100644 --- a/nprogress.js +++ b/nprogress.js @@ -164,22 +164,11 @@ return; } else { if (typeof amount !== 'number') { - if (n >= 0 && n < 0.25) { - // Start out between 3 - 6% increments - amount = (Math.random() * (5 - 3 + 1) + 3) / 100; - } else if (n >= 0.25 && n < 0.65) { - // increment between 0 - 3% - amount = (Math.random() * 3) / 100; - } else if (n >= 0.65 && n < 0.9) { - // increment between 0 - 2% - amount = (Math.random() * 2) / 100; - } else if (n >= 0.9 && n < 0.99) { - // finally, increment it .5 % - amount = 0.005; - } else { - // after 99%, don't increment: - amount = 0; - } + if (n >= 0 && n < 0.2) { amount = 0.1; } + else if (n >= 0.2 && n < 0.5) { amount = 0.04; } + else if (n >= 0.5 && n < 0.8) { amount = 0.02; } + else if (n >= 0.8 && n < 0.99) { amount = 0.005; } + else { amount = 0; } } n = clamp(n + amount, 0, 0.994); From 2a078a2303c3b6d3ea8bbe3a3ba723c34dcdd8a6 Mon Sep 17 00:00:00 2001 From: Tyler Brown Date: Fri, 1 Jul 2016 10:33:39 -0400 Subject: [PATCH 08/19] better defaults for smoother trickle --- Readme.md | 2 +- nprogress.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Readme.md b/Readme.md index a7e3e5f..1e1390d 100644 --- a/Readme.md +++ b/Readme.md @@ -137,7 +137,7 @@ NProgress.configure({ trickle: false }); Adjust how often to trickle/increment, in ms. ~~~ js -NProgress.configure({ trickleSpeed: 800 }); +NProgress.configure({ trickleSpeed: 200 }); ~~~ #### `showSpinner` diff --git a/nprogress.js b/nprogress.js index 349cccf..beb9d2c 100644 --- a/nprogress.js +++ b/nprogress.js @@ -20,9 +20,9 @@ minimum: 0.08, easing: 'linear', positionUsing: '', - speed: 350, + speed: 200, trickle: true, - trickleSpeed: 250, + trickleSpeed: 200, showSpinner: true, barSelector: '[role="bar"]', spinnerSelector: '[role="spinner"]', From d68df8d5608112d6c8abb5658fa5515471eaaabc Mon Sep 17 00:00:00 2001 From: "Rico Sta. Cruz" Date: Thu, 11 Aug 2016 18:18:42 +0800 Subject: [PATCH 09/19] Update Turbolinks 5+ instructions --- Readme.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index b0245e7..60db109 100644 --- a/Readme.md +++ b/Readme.md @@ -34,7 +34,21 @@ NProgress.start(); NProgress.done(); ~~~ -### Turbolinks +### Turbolinks (version 5+) +Ensure you're using Turbolinks 5+, and use +this: (explained [here](https://github.com/rstacruz/nprogress/issues/8#issuecomment-239107109)) + +~~~ js +$(document).on('turbolinks:click', function() { + NProgress.start(); +}); +$(document).on('turbolinks:render', function() { + NProgress.done(); + NProgress.remove(); +}); +~~~ + +### Turbolinks (version 3 and below) Ensure you're using Turbolinks 1.3.0+, and use this: (explained [here](https://github.com/rstacruz/nprogress/issues/8#issuecomment-23010560)) From fe912b9777111adbe65aacf49c116de9adb7ec1b Mon Sep 17 00:00:00 2001 From: "Rico Sta. Cruz" Date: Sat, 9 Sep 2017 18:54:23 +0800 Subject: [PATCH 10/19] Readme: lessen references to bower and spm --- Readme.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Readme.md b/Readme.md index dc9b15c..8a8cb95 100644 --- a/Readme.md +++ b/Readme.md @@ -15,14 +15,12 @@ Add [nprogress.js] and [nprogress.css] to your project. ``` -NProgress is available via [bower] and [npm] and [spm]. +NProgress is available via [bower] and [npm]. - $ bower install --save nprogress $ npm install --save nprogress [bower]: http://bower.io/search/?q=nprogress [npm]: https://www.npmjs.org/package/nprogress -[spm]: http://spmjs.io/package/nprogress Basic usage ----------- From debf0cf40f6b465af3844f6bc76f66e8b16a6919 Mon Sep 17 00:00:00 2001 From: "Rico Sta. Cruz" Date: Sat, 9 Sep 2017 18:56:38 +0800 Subject: [PATCH 11/19] Readme: follow common formats more closely --- Readme.md | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/Readme.md b/Readme.md index 8a8cb95..901be64 100644 --- a/Readme.md +++ b/Readme.md @@ -1,9 +1,13 @@ NProgress ========= +> Minimalist progress bar + Slim progress bars for Ajax'y applications. Inspired by Google, YouTube, and Medium. +[![Status](https://api.travis-ci.org/rstacruz/nprogress.svg?branch=master)](http://travis-ci.org/rstacruz/nprogress) +[![npm version](https://img.shields.io/npm/v/nprogress.png)](https://npmjs.org/package/nprogress "View this project on npm") Installation ------------ @@ -19,8 +23,14 @@ NProgress is available via [bower] and [npm]. $ npm install --save nprogress +Also available via [unpkg] CDN: + +- https://unpkg.com/nprogress@0.2.0/nprogress.js +- https://unpkg.com/nprogress@0.2.0/nprogress.css + [bower]: http://bower.io/search/?q=nprogress [npm]: https://www.npmjs.org/package/nprogress +[unpkg]: https://unpkg.com/ Basic usage ----------- @@ -192,8 +202,7 @@ __Questions__: ask them at StackOverflow with the tag *nprogress*.
__Chat__: join us at gitter.im.
[![Chat](http://img.shields.io/badge/gitter-rstacruz / nprogress-brightgreen.svg)]( https://gitter.im/rstacruz/nprogress ) -[default template]: -https://github.com/rstacruz/nprogress/blob/master/nprogress.js#L31 +[default template]: https://github.com/rstacruz/nprogress/blob/master/nprogress.js#L31 [Turbolinks]: https://github.com/rails/turbolinks [nprogress.js]: http://ricostacruz.com/nprogress/nprogress.js [nprogress.css]: http://ricostacruz.com/nprogress/nprogress.css @@ -201,7 +210,7 @@ https://github.com/rstacruz/nprogress/blob/master/nprogress.js#L31 Thanks ------ -**NProgress** © 2013-2014, Rico Sta. Cruz. Released under the [MIT License].
+**NProgress** © 2013-2017, Rico Sta. Cruz. Released under the [MIT License].
Authored and maintained by Rico Sta. Cruz with help from [contributors]. > [ricostacruz.com](http://ricostacruz.com)  ·  @@ -211,6 +220,5 @@ Authored and maintained by Rico Sta. Cruz with help from [contributors]. [MIT License]: http://mit-license.org/ [contributors]: http://github.com/rstacruz/nprogress/contributors -[![Status](https://api.travis-ci.org/rstacruz/nprogress.svg?branch=master)](http://travis-ci.org/rstacruz/nprogress) -[![npm version](https://img.shields.io/npm/v/nprogress.png)](https://npmjs.org/package/nprogress "View this project on npm") -[![spm package](http://spmjs.io/badge/nprogress)](http://spmjs.io/package/nprogress) +[![](https://img.shields.io/github/followers/rstacruz.svg?style=social&label=@rstacruz)](https://github.com/rstacruz)   +[![](https://img.shields.io/twitter/follow/rstacruz.svg?style=social&label=@rstacruz)](https://twitter.com/rstacruz) From b9c6eeea53a2a28c2b5851a73e3fc1de92c2a891 Mon Sep 17 00:00:00 2001 From: "Rico Sta. Cruz" Date: Sat, 9 Sep 2017 18:57:52 +0800 Subject: [PATCH 12/19] Readme: fix gitter link --- Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index 901be64..119e994 100644 --- a/Readme.md +++ b/Readme.md @@ -200,7 +200,7 @@ __Questions__: ask them at StackOverflow with the tag *nprogress*.
[![StackOverflow](http://img.shields.io/badge/stackoverflow-nprogress-brightgreen.svg)]( http://stackoverflow.com/questions/tagged/nprogress ) __Chat__: join us at gitter.im.
-[![Chat](http://img.shields.io/badge/gitter-rstacruz / nprogress-brightgreen.svg)]( https://gitter.im/rstacruz/nprogress ) +[![Chat](http://img.shields.io/badge/gitter-rstacruz/nprogress-brightgreen.svg)]( https://gitter.im/rstacruz/nprogress ) [default template]: https://github.com/rstacruz/nprogress/blob/master/nprogress.js#L31 [Turbolinks]: https://github.com/rails/turbolinks From 6bcf12a764c806cbddca67b772a6a29c42880b30 Mon Sep 17 00:00:00 2001 From: "Rico Sta. Cruz" Date: Mon, 18 Sep 2017 13:48:42 +0800 Subject: [PATCH 13/19] Readme: add codesponsor.io badge --- Readme.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Readme.md b/Readme.md index 119e994..153bc73 100644 --- a/Readme.md +++ b/Readme.md @@ -9,6 +9,8 @@ Medium. [![Status](https://api.travis-ci.org/rstacruz/nprogress.svg?branch=master)](http://travis-ci.org/rstacruz/nprogress) [![npm version](https://img.shields.io/npm/v/nprogress.png)](https://npmjs.org/package/nprogress "View this project on npm") + Sponsor + Installation ------------ From d01d50fb45d606f6f0c8b199b7f50734d24bd209 Mon Sep 17 00:00:00 2001 From: "Rico Sta. Cruz" Date: Mon, 18 Sep 2017 14:04:25 +0800 Subject: [PATCH 14/19] Readme: update code badge appearance --- Readme.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Readme.md b/Readme.md index 153bc73..abd7ec1 100644 --- a/Readme.md +++ b/Readme.md @@ -1,16 +1,20 @@ NProgress ========= +[![Status](https://api.travis-ci.org/rstacruz/nprogress.svg?branch=master)](http://travis-ci.org/rstacruz/nprogress) +[![npm version](https://img.shields.io/npm/v/nprogress.png)](https://npmjs.org/package/nprogress "View this project on npm") + > Minimalist progress bar Slim progress bars for Ajax'y applications. Inspired by Google, YouTube, and Medium. -[![Status](https://api.travis-ci.org/rstacruz/nprogress.svg?branch=master)](http://travis-ci.org/rstacruz/nprogress) -[![npm version](https://img.shields.io/npm/v/nprogress.png)](https://npmjs.org/package/nprogress "View this project on npm") +***** Sponsor +***** + Installation ------------ From 9fa882223375b3c5dfee2285a807b2021f416929 Mon Sep 17 00:00:00 2001 From: "Rico Sta. Cruz" Date: Mon, 18 Sep 2017 14:08:01 +0800 Subject: [PATCH 15/19] Readme: update appearance a bit --- Readme.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Readme.md b/Readme.md index abd7ec1..c05c765 100644 --- a/Readme.md +++ b/Readme.md @@ -9,12 +9,16 @@ NProgress Slim progress bars for Ajax'y applications. Inspired by Google, YouTube, and Medium. +
+ ***** Sponsor ***** +
+ Installation ------------ From 2987cbc2e7e96c41af7270cea295bd203021e021 Mon Sep 17 00:00:00 2001 From: Lukas Drgon Date: Sun, 8 Oct 2017 19:34:13 +0200 Subject: [PATCH 16/19] Add jsDelivr hits badge --- Readme.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Readme.md b/Readme.md index c05c765..9edfaae 100644 --- a/Readme.md +++ b/Readme.md @@ -3,6 +3,7 @@ NProgress [![Status](https://api.travis-ci.org/rstacruz/nprogress.svg?branch=master)](http://travis-ci.org/rstacruz/nprogress) [![npm version](https://img.shields.io/npm/v/nprogress.png)](https://npmjs.org/package/nprogress "View this project on npm") +[![jsDelivr Hits](https://data.jsdelivr.com/v1/package/npm/nprogress/badge?style=rounded)](https://www.jsdelivr.com/package/npm/nprogress) > Minimalist progress bar From a0ab16ccdaca501d8d9881a4da1d691f4e6c4dda Mon Sep 17 00:00:00 2001 From: "Rico Sta. Cruz" Date: Thu, 7 Dec 2017 19:22:02 +0800 Subject: [PATCH 17/19] Remove codesponsor.io badge --- Readme.md | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/Readme.md b/Readme.md index 9edfaae..2ddda6e 100644 --- a/Readme.md +++ b/Readme.md @@ -10,16 +10,6 @@ NProgress Slim progress bars for Ajax'y applications. Inspired by Google, YouTube, and Medium. -
- -***** - - Sponsor - -***** - -
- Installation ------------ From c53348981400fb50ba24c902f9cf4bafdea9d377 Mon Sep 17 00:00:00 2001 From: anyc <53881706@qq.com> Date: Mon, 23 Mar 2020 17:41:48 +0800 Subject: [PATCH 18/19] set dom --- nprogress.js | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/nprogress.js b/nprogress.js index beb9d2c..cdb5f4b 100644 --- a/nprogress.js +++ b/nprogress.js @@ -230,10 +230,14 @@ progress.id = 'nprogress'; progress.innerHTML = Settings.template; - var bar = progress.querySelector(Settings.barSelector), - perc = fromStart ? '-100' : toBarPerc(NProgress.status || 0), - parent = document.querySelector(Settings.parent), - spinner; + + + var bar = progress.querySelector(Settings.barSelector), + perc = fromStart ? '-100' : toBarPerc(NProgress.status || 0), + parent = isDOM(Settings.parent) + ? Settings.parent + : document.querySelector(Settings.parent), + spinner css(bar, { transition: 'all 0 linear', @@ -259,7 +263,10 @@ NProgress.remove = function() { removeClass(document.documentElement, 'nprogress-busy'); - removeClass(document.querySelector(Settings.parent), 'nprogress-custom-parent'); + var parent = isDOM(Settings.parent) + ? Settings.parent + : document.querySelector(Settings.parent) + removeClass(parent, 'nprogress-custom-parent') var progress = document.getElementById('nprogress'); progress && removeElement(progress); }; @@ -302,6 +309,18 @@ * Helpers */ + function isDOM (obj) { + if (typeof HTMLElement === 'object') { + return obj instanceof HTMLElement + } + return ( + obj && + typeof obj === 'object' && + obj.nodeType === 1 && + typeof obj.nodeName === 'string' + ) + } + function clamp(n, min, max) { if (n < min) return min; if (n > max) return max; From f236a2f8fb3b75e9c0052e93d187d953db06fe8b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 19 Apr 2020 00:47:40 +0000 Subject: [PATCH 19/19] Bump jquery from 2.2.4 to 3.5.0 Bumps [jquery](https://github.com/jquery/jquery) from 2.2.4 to 3.5.0. - [Release notes](https://github.com/jquery/jquery/releases) - [Commits](https://github.com/jquery/jquery/compare/2.2.4...3.5.0) Signed-off-by: dependabot[bot] --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 28f7471..9da5f7c 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "license": "MIT", "devDependencies": { "chai": "~1.6.1", - "jquery": "^2.1.1", + "jquery": "^3.5.0", "jsdom": "^5.4.3", "mocha": "^2.2.4", "mocha-jsdom": "^0.3.0"