Repository: rstacruz/nprogress
Branch: master
Commit: e1a8b7fb6e05
Files: 18
Total size: 40.1 KB
Directory structure:
gitextract_xsivouz_/
├── .gitignore
├── .npmignore
├── .travis.yml
├── History.md
├── License.md
├── Notes.md
├── Readme.md
├── bower.json
├── component.json
├── index.html
├── nprogress.css
├── nprogress.js
├── package.json
├── support/
│ ├── extras.css
│ └── style.css
└── test/
├── component.html
├── index.html
└── test.js
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
node_modules
build
components
================================================
FILE: .npmignore
================================================
vendor
index.html
support
================================================
FILE: .travis.yml
================================================
language: node_js
node_js: ["iojs"]
================================================
FILE: History.md
================================================
## [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])
Minor changes:
* [#92] - Fix typo in Readme ([@FND])
* [#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
* [#86] - Add support for specifying a different parent container. ([@jonjaques], [#14], [#33], [#39])
* [#64] - Fix Require.js support ([#75], [#85])
* [#54] - Fix component support
## [v0.1.5] - June 21, 2014
* [#82] - Release properly to the npm registry
## [v0.1.4] - June 21, 2014
* [#65] - Bower: don't download package.json. Fixes browserify + jquery problem. ([@amelon])
* [#75] - Fix compatibility with Karma. ([@shaqq])
Internal changes:
* [#77] - Use SVG to display Travis-CI badge. ([@Mithgol])
* [#34] - Readme: update .inc() and .status docs ([@lacivert])
* [#73] - Readme: update year ([@rwholmes])
## [v0.1.3] - March 26, 2014
* [#7] - Remove jQuery dependency ([#28], [#17], [@rurjur])
* [#73] - Update Readme to change year to 2014. ([@rwholmes])
## [v0.1.2] - August 21, 2013
Minor update for proper [Bower] and [Component] support.
* Add Bower support.
* Fix Component support and use `component/jquery` as a dependency.
## [v0.1.1] - August 21, 2013
Minor fixes.
* Removed the busy cursor that occurs when loading.
* Added support for IE7 to IE9. ([#3], [@markbao])
* Implement `trickleRate` and `trickleSpeed` options.
* [#5] - Implement the `showSpinner` option to allow removing the spinner. ([#9], [@rahulcs])
* Registered as a Component in Component.io.
* [#8] - Updated the Readme with better Turbolinks instructions.
## v0.1.0 - August 20, 2013
Initial release.
[Bower]: http://bower.io
[Component]: http://component.io
[#119]: https://github.com/rstacruz/nprogress/issues/119
[#120]: https://github.com/rstacruz/nprogress/issues/120
[#14]: https://github.com/rstacruz/nprogress/issues/14
[#17]: https://github.com/rstacruz/nprogress/issues/17
[#28]: https://github.com/rstacruz/nprogress/issues/28
[#33]: https://github.com/rstacruz/nprogress/issues/33
[#34]: https://github.com/rstacruz/nprogress/issues/34
[#39]: https://github.com/rstacruz/nprogress/issues/39
[#3]: https://github.com/rstacruz/nprogress/issues/3
[#54]: https://github.com/rstacruz/nprogress/issues/84
[#5]: https://github.com/rstacruz/nprogress/issues/5
[#64]: https://github.com/rstacruz/nprogress/issues/64
[#65]: https://github.com/rstacruz/nprogress/issues/65
[#73]: https://github.com/rstacruz/nprogress/issues/73
[#75]: https://github.com/rstacruz/nprogress/issues/75
[#77]: https://github.com/rstacruz/nprogress/issues/77
[#7]: https://github.com/rstacruz/nprogress/issues/7
[#82]: https://github.com/rstacruz/nprogress/issues/82
[#84]: https://github.com/rstacruz/nprogress/issues/84
[#85]: https://github.com/rstacruz/nprogress/issues/85
[#86]: https://github.com/rstacruz/nprogress/issues/86
[#8]: https://github.com/rstacruz/nprogress/issues/8
[#90]: https://github.com/rstacruz/nprogress/issues/90
[#92]: https://github.com/rstacruz/nprogress/issues/92
[#93]: https://github.com/rstacruz/nprogress/issues/93
[#9]: https://github.com/rstacruz/nprogress/issues/9
[@slang800]: https://github.com/slang800
[@teeceepee]: https://github.com/teeceepee
[@FND]: https://github.com/FND
[@mdxs]: https://github.com/mdxs
[@infertux]: https://github.com/infertux
[@jonjaques]: https://github.com/jonjaques
[@amelon]: https://github.com/amelon
[@shaqq]: https://github.com/shaqq
[@Mithgol]: https://github.com/Mithgol
[@lacivert]: https://github.com/lacivert
[@rwholmes]: https://github.com/rwholmes
[@rurjur]: https://github.com/rurjur
[@markbao]: https://github.com/markbao
[@rahulcs]: https://github.com/rahulcs
[v0.1.6]: https://github.com/rstacruz/nprogress/compare/v0.1.5...v0.1.6
[v0.1.5]: https://github.com/rstacruz/nprogress/compare/v0.1.4...v0.1.5
[v0.1.4]: https://github.com/rstacruz/nprogress/compare/v0.1.3...v0.1.4
[v0.1.3]: https://github.com/rstacruz/nprogress/compare/v0.1.2...v0.1.3
[v0.1.2]: https://github.com/rstacruz/nprogress/compare/v0.1.1...v0.1.2
[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
================================================
FILE: License.md
================================================
Copyright (c) 2013-2014 Rico Sta. Cruz
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
================================================
FILE: Notes.md
================================================
Testing
-------
$ npm install
$ npm test
or try it out in the browser:
$ open test/index.html
Testing component build
-----------------------
$ component install
$ component build
$ open test/component.html
Releasing
---------
$ npm test
$ bump *.json nprogress.js # bump version numbers
$ git release 0.1.1 # release to bower/github
$ npm publish # release to npm
$ git push origin master:gh-pages # update the site
================================================
FILE: Readme.md
================================================
NProgress
=========
[](http://travis-ci.org/rstacruz/nprogress)
[](https://npmjs.org/package/nprogress "View this project on npm")
[](https://www.jsdelivr.com/package/npm/nprogress)
> Minimalist progress bar
Slim progress bars for Ajax'y applications. Inspired by Google, YouTube, and
Medium.
Installation
------------
Add [nprogress.js] and [nprogress.css] to your project.
```html
```
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
-----------
Simply call `start()` and `done()` to control the progress bar.
~~~ js
NProgress.start();
NProgress.done();
~~~
### 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))
~~~ js
$(document).on('page:fetch', function() { NProgress.start(); });
$(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
-----
* Add progress to your Ajax calls! Bind it to the jQuery `ajaxStart` and
`ajaxStop` events.
* Make a fancy loading bar even without Turbolinks/Pjax! Bind it to
`$(document).ready` and `$(window).load`.
Advanced usage
--------------
__Percentages:__ To set a progress percentage, call `.set(n)`, where *n* is a
number between `0..1`.
~~~ js
NProgress.set(0.0); // Sorta same as .start()
NProgress.set(0.4);
NProgress.set(1.0); // Sorta same as .done()
~~~
__Incrementing:__ To increment the progress bar, just use `.inc()`. This
increments it with a random amount. This will never get to 100%: use it for
every image load (or similar).
~~~ js
NProgress.inc();
~~~
If you want to increment by a specific value, you can pass that as a parameter:
~~~ js
NProgress.inc(0.2); // This will get the current status value and adds 0.2 until status is 0.994
~~~
__Force-done:__ By passing `true` to `done()`, it will show the progress bar
even if it's not being shown. (The default behavior is that *.done()* will not
do anything if *.start()* isn't called)
~~~ js
NProgress.done(true);
~~~
__Get the status value:__ To get the status value, use `.status`
Configuration
-------------
#### `minimum`
Changes the minimum percentage used upon starting. (default: `0.08`)
~~~ js
NProgress.configure({ minimum: 0.1 });
~~~
#### `template`
You can change the markup using `template`. To keep the progress
bar working, keep an element with `role='bar'` in there. See the [default template]
for reference.
~~~ js
NProgress.configure({
template: "