epuber 0.5.7 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +5 -2
- data/README.md +20 -26
- data/bin/epuber +2 -3
- data/epuber.gemspec +10 -12
- data/lib/epuber/book/contributor.rb +1 -1
- data/lib/epuber/book/file_request.rb +1 -1
- data/lib/epuber/book/target.rb +1 -2
- data/lib/epuber/book/toc_item.rb +1 -2
- data/lib/epuber/book.rb +1 -2
- data/lib/epuber/checker/text_checker.rb +1 -1
- data/lib/epuber/checker.rb +1 -2
- data/lib/epuber/checker_transformer_base.rb +1 -0
- data/lib/epuber/command/build.rb +1 -2
- data/lib/epuber/command/compile.rb +1 -1
- data/lib/epuber/command/init.rb +1 -2
- data/lib/epuber/command/server.rb +1 -2
- data/lib/epuber/command.rb +1 -1
- data/lib/epuber/compiler/compilation_context.rb +1 -1
- data/lib/epuber/compiler/file_database.rb +3 -5
- data/lib/epuber/compiler/file_finders/abstract.rb +1 -1
- data/lib/epuber/compiler/file_finders/imaginary.rb +1 -2
- data/lib/epuber/compiler/file_finders/normal.rb +1 -1
- data/lib/epuber/compiler/file_resolver.rb +1 -2
- data/lib/epuber/compiler/file_stat.rb +0 -1
- data/lib/epuber/compiler/file_types/abstract_file.rb +1 -2
- data/lib/epuber/compiler/file_types/bade_file.rb +1 -2
- data/lib/epuber/compiler/file_types/coffee_script_file.rb +1 -2
- data/lib/epuber/compiler/file_types/container_xml_file.rb +1 -2
- data/lib/epuber/compiler/file_types/generated_file.rb +1 -2
- data/lib/epuber/compiler/file_types/ibooks_display_options_file.rb +1 -7
- data/lib/epuber/compiler/file_types/image_file.rb +1 -2
- data/lib/epuber/compiler/file_types/mime_type_file.rb +1 -2
- data/lib/epuber/compiler/file_types/nav_file.rb +1 -2
- data/lib/epuber/compiler/file_types/opf_file.rb +1 -2
- data/lib/epuber/compiler/file_types/source_file.rb +1 -2
- data/lib/epuber/compiler/file_types/static_file.rb +1 -2
- data/lib/epuber/compiler/file_types/stylus_file.rb +1 -2
- data/lib/epuber/compiler/file_types/xhtml_file.rb +2 -4
- data/lib/epuber/compiler/generator.rb +1 -1
- data/lib/epuber/compiler/meta_inf_generator.rb +1 -1
- data/lib/epuber/compiler/nav_generator.rb +1 -1
- data/lib/epuber/compiler/opf_generator.rb +1 -1
- data/lib/epuber/compiler/problem.rb +1 -2
- data/lib/epuber/compiler/xhtml_processor.rb +6 -6
- data/lib/epuber/compiler.rb +7 -11
- data/lib/epuber/config.rb +3 -4
- data/lib/epuber/dsl/attribute.rb +1 -1
- data/lib/epuber/dsl/attribute_support.rb +2 -2
- data/lib/epuber/dsl/object.rb +1 -1
- data/lib/epuber/dsl/tree_object.rb +1 -1
- data/lib/epuber/helper.rb +1 -1
- data/lib/epuber/lockfile.rb +1 -1
- data/lib/epuber/plugin.rb +1 -1
- data/lib/epuber/ruby_extensions/match_data.rb +1 -0
- data/lib/epuber/ruby_extensions/thread.rb +1 -0
- data/lib/epuber/server/handlers.rb +1 -1
- data/lib/epuber/server.rb +3 -2
- data/lib/epuber/templates.rb +2 -1
- data/lib/epuber/third_party/bower/bower.json +3 -3
- data/lib/epuber/third_party/bower/bower_components/cookies-js/bower.json +1 -1
- data/lib/epuber/third_party/bower/bower_components/cookies-js/dist/cookies.js +2 -3
- data/lib/epuber/third_party/bower/bower_components/cookies-js/dist/cookies.min.js +6 -6
- data/lib/epuber/third_party/bower/bower_components/jquery/AUTHORS.txt +278 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/{MIT-LICENSE.txt → LICENSE.txt} +17 -2
- data/lib/epuber/third_party/bower/bower_components/jquery/README.md +65 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/bower.json +2 -16
- data/lib/epuber/third_party/bower/bower_components/jquery/dist/jquery.js +2566 -1962
- data/lib/epuber/third_party/bower/bower_components/jquery/dist/jquery.min.js +4 -5
- data/lib/epuber/third_party/bower/bower_components/jquery/dist/jquery.min.map +1 -1
- data/lib/epuber/third_party/bower/bower_components/jquery/external/sizzle/LICENSE.txt +36 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/{src → external}/sizzle/dist/sizzle.js +236 -160
- data/lib/epuber/third_party/bower/bower_components/jquery/external/sizzle/dist/sizzle.min.js +3 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/external/sizzle/dist/sizzle.min.map +1 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/ajax/jsonp.js +25 -14
- data/lib/epuber/third_party/bower/bower_components/jquery/src/ajax/load.js +20 -12
- data/lib/epuber/third_party/bower/bower_components/jquery/src/ajax/parseJSON.js +2 -2
- data/lib/epuber/third_party/bower/bower_components/jquery/src/ajax/parseXML.js +4 -5
- data/lib/epuber/third_party/bower/bower_components/jquery/src/ajax/script.js +16 -12
- data/lib/epuber/third_party/bower/bower_components/jquery/src/ajax/var/location.js +3 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/ajax/var/nonce.js +2 -2
- data/lib/epuber/third_party/bower/bower_components/jquery/src/ajax/var/rquery.js +3 -3
- data/lib/epuber/third_party/bower/bower_components/jquery/src/ajax/xhr.js +73 -42
- data/lib/epuber/third_party/bower/bower_components/jquery/src/ajax.js +116 -57
- data/lib/epuber/third_party/bower/bower_components/jquery/src/attributes/attr.js +49 -48
- data/lib/epuber/third_party/bower/bower_components/jquery/src/attributes/classes.js +86 -67
- data/lib/epuber/third_party/bower/bower_components/jquery/src/attributes/prop.js +63 -32
- data/lib/epuber/third_party/bower/bower_components/jquery/src/attributes/support.js +6 -5
- data/lib/epuber/third_party/bower/bower_components/jquery/src/attributes/val.js +40 -24
- data/lib/epuber/third_party/bower/bower_components/jquery/src/attributes.js +2 -2
- data/lib/epuber/third_party/bower/bower_components/jquery/src/callbacks.js +114 -87
- data/lib/epuber/third_party/bower/bower_components/jquery/src/core/access.js +11 -6
- data/lib/epuber/third_party/bower/bower_components/jquery/src/core/init.js +27 -16
- data/lib/epuber/third_party/bower/bower_components/jquery/src/core/parseHTML.js +10 -8
- data/lib/epuber/third_party/bower/bower_components/jquery/src/core/ready.js +20 -14
- data/lib/epuber/third_party/bower/bower_components/jquery/src/core/var/rsingleTag.js +4 -3
- data/lib/epuber/third_party/bower/bower_components/jquery/src/core.js +77 -85
- data/lib/epuber/third_party/bower/bower_components/jquery/src/css/addGetHookIf.js +5 -3
- data/lib/epuber/third_party/bower/bower_components/jquery/src/css/adjustCSS.js +65 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/css/curCSS.js +20 -17
- data/lib/epuber/third_party/bower/bower_components/jquery/src/css/defaultDisplay.js +16 -14
- data/lib/epuber/third_party/bower/bower_components/jquery/src/css/hiddenVisibleSelectors.js +9 -6
- data/lib/epuber/third_party/bower/bower_components/jquery/src/css/showHide.js +48 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/css/support.js +86 -61
- data/lib/epuber/third_party/bower/bower_components/jquery/src/css/var/cssExpand.js +2 -2
- data/lib/epuber/third_party/bower/bower_components/jquery/src/css/var/getStyles.js +8 -5
- data/lib/epuber/third_party/bower/bower_components/jquery/src/css/var/isHidden.js +6 -3
- data/lib/epuber/third_party/bower/bower_components/jquery/src/css/var/rmargin.js +3 -3
- data/lib/epuber/third_party/bower/bower_components/jquery/src/css/var/rnumnonpx.js +2 -2
- data/lib/epuber/third_party/bower/bower_components/jquery/src/css/{swap.js → var/swap.js} +3 -7
- data/lib/epuber/third_party/bower/bower_components/jquery/src/css.js +107 -55
- data/lib/epuber/third_party/bower/bower_components/jquery/src/data/Data.js +93 -74
- data/lib/epuber/third_party/bower/bower_components/jquery/src/data/{accepts.js → var/acceptData.js} +4 -6
- data/lib/epuber/third_party/bower/bower_components/jquery/src/data/var/{data_priv.js → dataPriv.js} +2 -2
- data/lib/epuber/third_party/bower/bower_components/jquery/src/data/var/{data_user.js → dataUser.js} +2 -2
- data/lib/epuber/third_party/bower/bower_components/jquery/src/data.js +49 -40
- data/lib/epuber/third_party/bower/bower_components/jquery/src/deferred.js +34 -25
- data/lib/epuber/third_party/bower/bower_components/jquery/src/deprecated.js +27 -8
- data/lib/epuber/third_party/bower/bower_components/jquery/src/dimensions.js +9 -5
- data/lib/epuber/third_party/bower/bower_components/jquery/src/effects/Tween.js +14 -7
- data/lib/epuber/third_party/bower/bower_components/jquery/src/effects/animatedSelector.js +4 -4
- data/lib/epuber/third_party/bower/bower_components/jquery/src/effects.js +96 -115
- data/lib/epuber/third_party/bower/bower_components/jquery/src/event/ajax.js +11 -4
- data/lib/epuber/third_party/bower/bower_components/jquery/src/event/alias.js +11 -23
- data/lib/epuber/third_party/bower/bower_components/jquery/src/event/focusin.js +53 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/event/support.js +3 -3
- data/lib/epuber/third_party/bower/bower_components/jquery/src/event/trigger.js +183 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/event.js +168 -325
- data/lib/epuber/third_party/bower/bower_components/jquery/src/exports/amd.js +3 -3
- data/lib/epuber/third_party/bower/bower_components/jquery/src/exports/global.js +2 -8
- data/lib/epuber/third_party/bower/bower_components/jquery/src/intro.js +1 -1
- data/lib/epuber/third_party/bower/bower_components/jquery/src/jquery.js +5 -5
- data/lib/epuber/third_party/bower/bower_components/jquery/src/manipulation/_evalUrl.js +6 -4
- data/lib/epuber/third_party/bower/bower_components/jquery/src/manipulation/buildFragment.js +102 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/manipulation/getAll.js +21 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/manipulation/setGlobalEval.js +20 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/manipulation/support.js +7 -6
- data/lib/epuber/third_party/bower/bower_components/jquery/src/manipulation/var/rcheckableType.js +3 -3
- data/lib/epuber/third_party/bower/bower_components/jquery/src/manipulation/var/rscriptType.js +3 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/manipulation/var/rtagName.js +3 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/manipulation/wrapMap.js +27 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/manipulation.js +206 -305
- data/lib/epuber/third_party/bower/bower_components/jquery/src/offset.js +40 -29
- data/lib/epuber/third_party/bower/bower_components/jquery/src/outro.js +1 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/queue/delay.js +6 -6
- data/lib/epuber/third_party/bower/bower_components/jquery/src/queue.js +23 -22
- data/lib/epuber/third_party/bower/bower_components/jquery/src/selector-native.js +107 -68
- data/lib/epuber/third_party/bower/bower_components/jquery/src/selector-sizzle.js +5 -5
- data/lib/epuber/third_party/bower/bower_components/jquery/src/selector.js +1 -1
- data/lib/epuber/third_party/bower/bower_components/jquery/src/serialize.js +28 -14
- data/lib/epuber/third_party/bower/bower_components/jquery/src/traversing/findFilter.js +13 -13
- data/lib/epuber/third_party/bower/bower_components/jquery/src/traversing/var/dir.js +20 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/traversing/var/rneedsContext.js +2 -2
- data/lib/epuber/third_party/bower/bower_components/jquery/src/traversing/var/siblings.js +15 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/traversing.js +32 -56
- data/lib/epuber/third_party/bower/bower_components/jquery/src/var/arr.js +2 -2
- data/lib/epuber/third_party/bower/bower_components/jquery/src/var/class2type.js +3 -2
- data/lib/epuber/third_party/bower/bower_components/jquery/src/var/concat.js +2 -2
- data/lib/epuber/third_party/bower/bower_components/jquery/src/var/document.js +3 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/var/documentElement.js +5 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/var/hasOwn.js +2 -2
- data/lib/epuber/third_party/bower/bower_components/jquery/src/var/indexOf.js +2 -2
- data/lib/epuber/third_party/bower/bower_components/jquery/src/var/pnum.js +3 -3
- data/lib/epuber/third_party/bower/bower_components/jquery/src/var/push.js +2 -2
- data/lib/epuber/third_party/bower/bower_components/jquery/src/var/rcssNum.js +7 -0
- data/lib/epuber/third_party/bower/bower_components/jquery/src/var/rnotwhite.js +3 -3
- data/lib/epuber/third_party/bower/bower_components/jquery/src/var/slice.js +2 -2
- data/lib/epuber/third_party/bower/bower_components/jquery/src/var/support.js +3 -2
- data/lib/epuber/third_party/bower/bower_components/jquery/src/var/toString.js +2 -2
- data/lib/epuber/third_party/bower/bower_components/jquery/src/wrap.js +19 -19
- data/lib/epuber/third_party/bower/bower_components/spin.js/{LICENSE.txt → LICENSE.md} +2 -1
- data/lib/epuber/third_party/bower/bower_components/spin.js/README.md +21 -21
- data/lib/epuber/third_party/bower/bower_components/spin.js/bower.json +0 -1
- data/lib/epuber/third_party/bower/bower_components/spin.js/jquery.spin.js +23 -24
- data/lib/epuber/third_party/bower/bower_components/spin.js/spin.js +153 -113
- data/lib/epuber/third_party/bower/bower_components/spin.js/spin.min.js +2 -0
- data/lib/epuber/third_party/bower/bower_components/uri.js/CHANGELOG.md +424 -0
- data/lib/epuber/third_party/bower/bower_components/uri.js/README.md +23 -308
- data/lib/epuber/third_party/bower/bower_components/uri.js/SECURITY.md +12 -0
- data/lib/epuber/third_party/bower/bower_components/uri.js/bower.json +2 -2
- data/lib/epuber/third_party/bower/bower_components/uri.js/contributing.md +0 -4
- data/lib/epuber/third_party/bower/bower_components/uri.js/src/IPv6.js +3 -6
- data/lib/epuber/third_party/bower/bower_components/uri.js/src/SecondLevelDomains.js +8 -4
- data/lib/epuber/third_party/bower/bower_components/uri.js/src/URI.fragmentQuery.js +21 -4
- data/lib/epuber/third_party/bower/bower_components/uri.js/src/URI.fragmentURI.js +1 -1
- data/lib/epuber/third_party/bower/bower_components/uri.js/src/URI.js +312 -69
- data/lib/epuber/third_party/bower/bower_components/uri.js/src/URI.min.js +85 -77
- data/lib/epuber/third_party/bower/bower_components/uri.js/src/URITemplate.js +28 -11
- data/lib/epuber/third_party/bower/bower_components/uri.js/src/jquery.URI.js +17 -18
- data/lib/epuber/third_party/bower/bower_components/uri.js/src/jquery.URI.min.js +6 -6
- data/lib/epuber/third_party/bower/bower_components/uri.js/src/punycode.js +63 -38
- data/lib/epuber/third_party/bower.rb +2 -0
- data/lib/epuber/transformer/text_transformer.rb +1 -2
- data/lib/epuber/transformer.rb +1 -2
- data/lib/epuber/user_interface.rb +1 -1
- data/lib/epuber/vendor/hash_binding.rb +1 -1
- data/lib/epuber/vendor/nokogiri_extensions.rb +24 -21
- data/lib/epuber/vendor/ruby_templater.rb +1 -2
- data/lib/epuber/vendor/size.rb +1 -0
- data/lib/epuber/vendor/version.rb +1 -1
- data/lib/epuber/version.rb +2 -1
- data/lib/epuber.rb +1 -1
- metadata +77 -46
- data/lib/epuber/ruby_extensions/string.rb +0 -16
- data/lib/epuber/third_party/bower/bower_components/jquery/src/sizzle/dist/sizzle.min.js +0 -3
- data/lib/epuber/third_party/bower/bower_components/jquery/src/sizzle/dist/sizzle.min.map +0 -1
- data/lib/epuber/third_party/bower/bower_components/jquery/src/var/strundefined.js +0 -3
- data/lib/epuber/vendor/globals_context.rb +0 -26
@@ -1,21 +1,21 @@
|
|
1
|
-
# spin.js
|
2
|
-
|
3
|
-
An animated CSS3 loading spinner with VML fallback for IE.
|
4
|
-
|
5
|
-
* No images, no external CSS
|
6
|
-
* No dependencies
|
7
|
-
* Highly configurable
|
8
|
-
* Resolution independent
|
9
|
-
* Uses VML as fallback in old IEs
|
10
|
-
* Uses @keyframe animations, falling back to setTimeout()
|
11
|
-
* Works in all major browsers, including IE6
|
12
|
-
* Small footprint (~1.9K gzipped)
|
13
|
-
* MIT License
|
14
|
-
|
15
|
-
## Usage
|
16
|
-
|
17
|
-
```javascript
|
18
|
-
new Spinner({color:'#fff', lines: 12}).spin(target);
|
19
|
-
```
|
20
|
-
|
21
|
-
For an interactive demo and a list of all supported options please refer to the [project's homepage](http://
|
1
|
+
# spin.js [![JS.ORG](https://img.shields.io/badge/js.org-spin-ffb400.svg?style=flat-square)](http://js.org)
|
2
|
+
|
3
|
+
An animated CSS3 loading spinner with VML fallback for IE.
|
4
|
+
|
5
|
+
* No images, no external CSS
|
6
|
+
* No dependencies
|
7
|
+
* Highly configurable
|
8
|
+
* Resolution independent
|
9
|
+
* Uses VML as fallback in old IEs
|
10
|
+
* Uses @keyframe animations, falling back to setTimeout()
|
11
|
+
* Works in all major browsers, including IE6
|
12
|
+
* Small footprint (~1.9K gzipped)
|
13
|
+
* MIT License
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
|
17
|
+
```javascript
|
18
|
+
new Spinner({color:'#fff', lines: 12}).spin(target);
|
19
|
+
```
|
20
|
+
|
21
|
+
For an interactive demo and a list of all supported options please refer to the [project's homepage](http://spin.js.org).
|
@@ -1,6 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* Copyright (c) 2011-2014 Felix Gnass
|
3
3
|
* Licensed under the MIT license
|
4
|
+
* http://spin.js.org/
|
4
5
|
*/
|
5
6
|
|
6
7
|
/*
|
@@ -8,42 +9,40 @@
|
|
8
9
|
Basic Usage:
|
9
10
|
============
|
10
11
|
|
11
|
-
$('#el').spin()
|
12
|
-
$('#el').spin({ ... })
|
12
|
+
$('#el').spin() // Creates a default Spinner using the text color of #el.
|
13
|
+
$('#el').spin({ ... }) // Creates a Spinner using the provided options.
|
13
14
|
|
14
|
-
$('#el').spin(false)
|
15
|
+
$('#el').spin(false) // Stops and removes the spinner.
|
15
16
|
|
16
17
|
Using Presets:
|
17
18
|
==============
|
18
19
|
|
19
|
-
$('#el').spin('small')
|
20
|
-
$('#el').spin('large', '#fff')
|
20
|
+
$('#el').spin('small') // Creates a 'small' Spinner using the text color of #el.
|
21
|
+
$('#el').spin('large', '#fff') // Creates a 'large' white Spinner.
|
21
22
|
|
22
23
|
Adding a custom preset:
|
23
24
|
=======================
|
24
25
|
|
25
26
|
$.fn.spin.presets.flower = {
|
26
|
-
lines:
|
27
|
-
|
28
|
-
|
29
|
-
|
27
|
+
lines: 9
|
28
|
+
, length: 10
|
29
|
+
, width: 20
|
30
|
+
, radius: 0
|
30
31
|
}
|
31
32
|
|
32
|
-
$('#el').spin('flower', 'red')
|
33
|
+
$('#el').spin('flower', 'red')
|
33
34
|
|
34
35
|
*/
|
35
36
|
|
36
|
-
(function(factory) {
|
37
|
+
;(function(factory) {
|
37
38
|
|
38
39
|
if (typeof exports == 'object') {
|
39
40
|
// CommonJS
|
40
41
|
factory(require('jquery'), require('spin.js'))
|
41
|
-
}
|
42
|
-
else if (typeof define == 'function' && define.amd) {
|
42
|
+
} else if (typeof define == 'function' && define.amd) {
|
43
43
|
// AMD, register as anonymous module
|
44
44
|
define(['jquery', 'spin'], factory)
|
45
|
-
}
|
46
|
-
else {
|
45
|
+
} else {
|
47
46
|
// Browser globals
|
48
47
|
if (!window.Spinner) throw new Error('Spin.js not present')
|
49
48
|
factory(window.jQuery, window.Spinner)
|
@@ -54,17 +53,17 @@ $('#el').spin('flower', 'red');
|
|
54
53
|
$.fn.spin = function(opts, color) {
|
55
54
|
|
56
55
|
return this.each(function() {
|
57
|
-
var $this = $(this)
|
58
|
-
data = $this.data()
|
56
|
+
var $this = $(this)
|
57
|
+
, data = $this.data()
|
59
58
|
|
60
59
|
if (data.spinner) {
|
61
|
-
data.spinner.stop()
|
62
|
-
delete data.spinner
|
60
|
+
data.spinner.stop()
|
61
|
+
delete data.spinner
|
63
62
|
}
|
64
63
|
if (opts !== false) {
|
65
64
|
opts = $.extend(
|
66
|
-
{ color: color || $this.css('color') }
|
67
|
-
|
65
|
+
{ color: color || $this.css('color') }
|
66
|
+
, $.fn.spin.presets[opts] || opts
|
68
67
|
)
|
69
68
|
data.spinner = new Spinner(opts).spin(this)
|
70
69
|
}
|
@@ -72,9 +71,9 @@ $('#el').spin('flower', 'red');
|
|
72
71
|
}
|
73
72
|
|
74
73
|
$.fn.spin.presets = {
|
75
|
-
tiny:
|
76
|
-
|
77
|
-
|
74
|
+
tiny: { lines: 8, length: 2, width: 2, radius: 3 }
|
75
|
+
, small: { lines: 8, length: 4, width: 3, radius: 5 }
|
76
|
+
, large: { lines: 10, length: 8, width: 4, radius: 8 }
|
78
77
|
}
|
79
78
|
|
80
79
|
}));
|
@@ -1,63 +1,82 @@
|
|
1
1
|
/**
|
2
2
|
* Copyright (c) 2011-2014 Felix Gnass
|
3
3
|
* Licensed under the MIT license
|
4
|
+
* http://spin.js.org/
|
5
|
+
*
|
6
|
+
* Example:
|
7
|
+
var opts = {
|
8
|
+
lines: 12 // The number of lines to draw
|
9
|
+
, length: 7 // The length of each line
|
10
|
+
, width: 5 // The line thickness
|
11
|
+
, radius: 10 // The radius of the inner circle
|
12
|
+
, scale: 1.0 // Scales overall size of the spinner
|
13
|
+
, corners: 1 // Roundness (0..1)
|
14
|
+
, color: '#000' // #rgb or #rrggbb
|
15
|
+
, opacity: 1/4 // Opacity of the lines
|
16
|
+
, rotate: 0 // Rotation offset
|
17
|
+
, direction: 1 // 1: clockwise, -1: counterclockwise
|
18
|
+
, speed: 1 // Rounds per second
|
19
|
+
, trail: 100 // Afterglow percentage
|
20
|
+
, fps: 20 // Frames per second when using setTimeout()
|
21
|
+
, zIndex: 2e9 // Use a high z-index by default
|
22
|
+
, className: 'spinner' // CSS class to assign to the element
|
23
|
+
, top: '50%' // center vertically
|
24
|
+
, left: '50%' // center horizontally
|
25
|
+
, shadow: false // Whether to render a shadow
|
26
|
+
, hwaccel: false // Whether to use hardware acceleration (might be buggy)
|
27
|
+
, position: 'absolute' // Element positioning
|
28
|
+
}
|
29
|
+
var target = document.getElementById('foo')
|
30
|
+
var spinner = new Spinner(opts).spin(target)
|
4
31
|
*/
|
5
|
-
(function(root, factory) {
|
32
|
+
;(function (root, factory) {
|
6
33
|
|
7
34
|
/* CommonJS */
|
8
|
-
if (typeof
|
35
|
+
if (typeof module == 'object' && module.exports) module.exports = factory()
|
9
36
|
|
10
37
|
/* AMD module */
|
11
38
|
else if (typeof define == 'function' && define.amd) define(factory)
|
12
39
|
|
13
40
|
/* Browser global */
|
14
41
|
else root.Spinner = factory()
|
15
|
-
}
|
16
|
-
|
17
|
-
"use strict";
|
42
|
+
}(this, function () {
|
43
|
+
"use strict"
|
18
44
|
|
19
45
|
var prefixes = ['webkit', 'Moz', 'ms', 'O'] /* Vendor prefixes */
|
20
46
|
, animations = {} /* Animation rules keyed by their name */
|
21
47
|
, useCssAnimations /* Whether to use CSS animations or setTimeout */
|
48
|
+
, sheet /* A stylesheet to hold the @keyframe or VML rules. */
|
22
49
|
|
23
50
|
/**
|
24
51
|
* Utility function to create elements. If no tag name is given,
|
25
52
|
* a DIV is created. Optionally properties can be passed.
|
26
53
|
*/
|
27
|
-
function createEl(tag, prop) {
|
54
|
+
function createEl (tag, prop) {
|
28
55
|
var el = document.createElement(tag || 'div')
|
29
56
|
, n
|
30
57
|
|
31
|
-
for(n in prop) el[n] = prop[n]
|
58
|
+
for (n in prop) el[n] = prop[n]
|
32
59
|
return el
|
33
60
|
}
|
34
61
|
|
35
62
|
/**
|
36
63
|
* Appends children and returns the parent.
|
37
64
|
*/
|
38
|
-
function ins(parent /* child1, child2, ...*/) {
|
39
|
-
for (var i=1, n=arguments.length; i<n; i++)
|
65
|
+
function ins (parent /* child1, child2, ...*/) {
|
66
|
+
for (var i = 1, n = arguments.length; i < n; i++) {
|
40
67
|
parent.appendChild(arguments[i])
|
68
|
+
}
|
41
69
|
|
42
70
|
return parent
|
43
71
|
}
|
44
72
|
|
45
|
-
/**
|
46
|
-
* Insert a new stylesheet to hold the @keyframe or VML rules.
|
47
|
-
*/
|
48
|
-
var sheet = (function() {
|
49
|
-
var el = createEl('style', {type : 'text/css'})
|
50
|
-
ins(document.getElementsByTagName('head')[0], el)
|
51
|
-
return el.sheet || el.styleSheet
|
52
|
-
}())
|
53
|
-
|
54
73
|
/**
|
55
74
|
* Creates an opacity keyframe animation rule and returns its name.
|
56
75
|
* Since most mobile Webkits have timing issues with animation-delay,
|
57
76
|
* we create separate rules for each line/segment.
|
58
77
|
*/
|
59
|
-
function addAnimation(alpha, trail, i, lines) {
|
60
|
-
var name = ['opacity', trail, ~~(alpha*100), i, lines].join('-')
|
78
|
+
function addAnimation (alpha, trail, i, lines) {
|
79
|
+
var name = ['opacity', trail, ~~(alpha * 100), i, lines].join('-')
|
61
80
|
, start = 0.01 + i/lines * 100
|
62
81
|
, z = Math.max(1 - (1-alpha) / trail * (100-start), alpha)
|
63
82
|
, prefix = useCssAnimations.substring(0, useCssAnimations.indexOf('Animation')).toLowerCase()
|
@@ -82,25 +101,26 @@
|
|
82
101
|
/**
|
83
102
|
* Tries various vendor prefixes and returns the first supported property.
|
84
103
|
*/
|
85
|
-
function vendor(el, prop) {
|
104
|
+
function vendor (el, prop) {
|
86
105
|
var s = el.style
|
87
106
|
, pp
|
88
107
|
, i
|
89
108
|
|
90
109
|
prop = prop.charAt(0).toUpperCase() + prop.slice(1)
|
91
|
-
|
110
|
+
if (s[prop] !== undefined) return prop
|
111
|
+
for (i = 0; i < prefixes.length; i++) {
|
92
112
|
pp = prefixes[i]+prop
|
93
|
-
if(s[pp] !== undefined) return pp
|
113
|
+
if (s[pp] !== undefined) return pp
|
94
114
|
}
|
95
|
-
if(s[prop] !== undefined) return prop
|
96
115
|
}
|
97
116
|
|
98
117
|
/**
|
99
118
|
* Sets multiple style properties at once.
|
100
119
|
*/
|
101
|
-
function css(el, prop) {
|
102
|
-
for (var n in prop)
|
103
|
-
el.style[vendor(el, n)||n] = prop[n]
|
120
|
+
function css (el, prop) {
|
121
|
+
for (var n in prop) {
|
122
|
+
el.style[vendor(el, n) || n] = prop[n]
|
123
|
+
}
|
104
124
|
|
105
125
|
return el
|
106
126
|
}
|
@@ -108,11 +128,12 @@
|
|
108
128
|
/**
|
109
129
|
* Fills in default values.
|
110
130
|
*/
|
111
|
-
function merge(obj) {
|
112
|
-
for (var i=1; i < arguments.length; i++) {
|
131
|
+
function merge (obj) {
|
132
|
+
for (var i = 1; i < arguments.length; i++) {
|
113
133
|
var def = arguments[i]
|
114
|
-
for (var n in def)
|
134
|
+
for (var n in def) {
|
115
135
|
if (obj[n] === undefined) obj[n] = def[n]
|
136
|
+
}
|
116
137
|
}
|
117
138
|
return obj
|
118
139
|
}
|
@@ -120,34 +141,37 @@
|
|
120
141
|
/**
|
121
142
|
* Returns the line color from the given string or array.
|
122
143
|
*/
|
123
|
-
function getColor(color, idx) {
|
144
|
+
function getColor (color, idx) {
|
124
145
|
return typeof color == 'string' ? color : color[idx % color.length]
|
125
146
|
}
|
126
147
|
|
127
148
|
// Built-in defaults
|
128
149
|
|
129
150
|
var defaults = {
|
130
|
-
lines: 12
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
151
|
+
lines: 12 // The number of lines to draw
|
152
|
+
, length: 7 // The length of each line
|
153
|
+
, width: 5 // The line thickness
|
154
|
+
, radius: 10 // The radius of the inner circle
|
155
|
+
, scale: 1.0 // Scales overall size of the spinner
|
156
|
+
, corners: 1 // Roundness (0..1)
|
157
|
+
, color: '#000' // #rgb or #rrggbb
|
158
|
+
, opacity: 1/4 // Opacity of the lines
|
159
|
+
, rotate: 0 // Rotation offset
|
160
|
+
, direction: 1 // 1: clockwise, -1: counterclockwise
|
161
|
+
, speed: 1 // Rounds per second
|
162
|
+
, trail: 100 // Afterglow percentage
|
163
|
+
, fps: 20 // Frames per second when using setTimeout()
|
164
|
+
, zIndex: 2e9 // Use a high z-index by default
|
165
|
+
, className: 'spinner' // CSS class to assign to the element
|
166
|
+
, top: '50%' // center vertically
|
167
|
+
, left: '50%' // center horizontally
|
168
|
+
, shadow: false // Whether to render a shadow
|
169
|
+
, hwaccel: false // Whether to use hardware acceleration (might be buggy)
|
170
|
+
, position: 'absolute' // Element positioning
|
147
171
|
}
|
148
172
|
|
149
173
|
/** The constructor */
|
150
|
-
function Spinner(o) {
|
174
|
+
function Spinner (o) {
|
151
175
|
this.opts = merge(o || {}, Spinner.defaults, defaults)
|
152
176
|
}
|
153
177
|
|
@@ -155,26 +179,28 @@
|
|
155
179
|
Spinner.defaults = {}
|
156
180
|
|
157
181
|
merge(Spinner.prototype, {
|
158
|
-
|
159
182
|
/**
|
160
183
|
* Adds the spinner to the given target element. If this instance is already
|
161
184
|
* spinning, it is automatically removed from its previous target b calling
|
162
185
|
* stop() internally.
|
163
186
|
*/
|
164
|
-
spin: function(target) {
|
187
|
+
spin: function (target) {
|
165
188
|
this.stop()
|
166
189
|
|
167
190
|
var self = this
|
168
191
|
, o = self.opts
|
169
|
-
, el = self.el =
|
192
|
+
, el = self.el = createEl(null, {className: o.className})
|
170
193
|
|
171
194
|
css(el, {
|
172
|
-
|
173
|
-
|
195
|
+
position: o.position
|
196
|
+
, width: 0
|
197
|
+
, zIndex: o.zIndex
|
198
|
+
, left: o.left
|
199
|
+
, top: o.top
|
174
200
|
})
|
175
|
-
|
201
|
+
|
176
202
|
if (target) {
|
177
|
-
target.insertBefore(el, target.firstChild||null)
|
203
|
+
target.insertBefore(el, target.firstChild || null)
|
178
204
|
}
|
179
205
|
|
180
206
|
el.setAttribute('role', 'progressbar')
|
@@ -186,27 +212,27 @@
|
|
186
212
|
, start = (o.lines - 1) * (1 - o.direction) / 2
|
187
213
|
, alpha
|
188
214
|
, fps = o.fps
|
189
|
-
, f = fps/o.speed
|
190
|
-
, ostep = (1-o.opacity) / (f*o.trail / 100)
|
191
|
-
, astep = f/o.lines
|
215
|
+
, f = fps / o.speed
|
216
|
+
, ostep = (1 - o.opacity) / (f * o.trail / 100)
|
217
|
+
, astep = f / o.lines
|
192
218
|
|
193
|
-
;(function anim() {
|
194
|
-
i
|
219
|
+
;(function anim () {
|
220
|
+
i++
|
195
221
|
for (var j = 0; j < o.lines; j++) {
|
196
222
|
alpha = Math.max(1 - (i + (o.lines - j) * astep) % f * ostep, o.opacity)
|
197
223
|
|
198
224
|
self.opacity(el, j * o.direction + start, alpha, o)
|
199
225
|
}
|
200
|
-
self.timeout = self.el && setTimeout(anim, ~~(1000/fps))
|
226
|
+
self.timeout = self.el && setTimeout(anim, ~~(1000 / fps))
|
201
227
|
})()
|
202
228
|
}
|
203
229
|
return self
|
204
|
-
}
|
230
|
+
}
|
205
231
|
|
206
232
|
/**
|
207
233
|
* Stops and removes the Spinner.
|
208
234
|
*/
|
209
|
-
|
235
|
+
, stop: function () {
|
210
236
|
var el = this.el
|
211
237
|
if (el) {
|
212
238
|
clearTimeout(this.timeout)
|
@@ -214,123 +240,137 @@
|
|
214
240
|
this.el = undefined
|
215
241
|
}
|
216
242
|
return this
|
217
|
-
}
|
243
|
+
}
|
218
244
|
|
219
245
|
/**
|
220
246
|
* Internal method that draws the individual lines. Will be overwritten
|
221
247
|
* in VML fallback mode below.
|
222
248
|
*/
|
223
|
-
|
249
|
+
, lines: function (el, o) {
|
224
250
|
var i = 0
|
225
251
|
, start = (o.lines - 1) * (1 - o.direction) / 2
|
226
252
|
, seg
|
227
253
|
|
228
|
-
function fill(color, shadow) {
|
254
|
+
function fill (color, shadow) {
|
229
255
|
return css(createEl(), {
|
230
|
-
position: 'absolute'
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
256
|
+
position: 'absolute'
|
257
|
+
, width: o.scale * (o.length + o.width) + 'px'
|
258
|
+
, height: o.scale * o.width + 'px'
|
259
|
+
, background: color
|
260
|
+
, boxShadow: shadow
|
261
|
+
, transformOrigin: 'left'
|
262
|
+
, transform: 'rotate(' + ~~(360/o.lines*i + o.rotate) + 'deg) translate(' + o.scale*o.radius + 'px' + ',0)'
|
263
|
+
, borderRadius: (o.corners * o.scale * o.width >> 1) + 'px'
|
238
264
|
})
|
239
265
|
}
|
240
266
|
|
241
267
|
for (; i < o.lines; i++) {
|
242
268
|
seg = css(createEl(), {
|
243
|
-
position: 'absolute'
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
269
|
+
position: 'absolute'
|
270
|
+
, top: 1 + ~(o.scale * o.width / 2) + 'px'
|
271
|
+
, transform: o.hwaccel ? 'translate3d(0,0,0)' : ''
|
272
|
+
, opacity: o.opacity
|
273
|
+
, animation: useCssAnimations && addAnimation(o.opacity, o.trail, start + i * o.direction, o.lines) + ' ' + 1 / o.speed + 's linear infinite'
|
248
274
|
})
|
249
275
|
|
250
|
-
if (o.shadow) ins(seg, css(fill('#000', '0 0 4px
|
276
|
+
if (o.shadow) ins(seg, css(fill('#000', '0 0 4px #000'), {top: '2px'}))
|
251
277
|
ins(el, ins(seg, fill(getColor(o.color, i), '0 0 1px rgba(0,0,0,.1)')))
|
252
278
|
}
|
253
279
|
return el
|
254
|
-
}
|
280
|
+
}
|
255
281
|
|
256
282
|
/**
|
257
283
|
* Internal method that adjusts the opacity of a single line.
|
258
284
|
* Will be overwritten in VML fallback mode below.
|
259
285
|
*/
|
260
|
-
|
286
|
+
, opacity: function (el, i, val) {
|
261
287
|
if (i < el.childNodes.length) el.childNodes[i].style.opacity = val
|
262
288
|
}
|
263
289
|
|
264
290
|
})
|
265
291
|
|
266
292
|
|
267
|
-
function initVML() {
|
293
|
+
function initVML () {
|
268
294
|
|
269
295
|
/* Utility function to create a VML tag */
|
270
|
-
function vml(tag, attr) {
|
296
|
+
function vml (tag, attr) {
|
271
297
|
return createEl('<' + tag + ' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">', attr)
|
272
298
|
}
|
273
299
|
|
274
300
|
// No CSS transforms but VML support, add a CSS rule for VML elements:
|
275
301
|
sheet.addRule('.spin-vml', 'behavior:url(#default#VML)')
|
276
302
|
|
277
|
-
Spinner.prototype.lines = function(el, o) {
|
278
|
-
var r = o.length+o.width
|
279
|
-
, s = 2*r
|
303
|
+
Spinner.prototype.lines = function (el, o) {
|
304
|
+
var r = o.scale * (o.length + o.width)
|
305
|
+
, s = o.scale * 2 * r
|
280
306
|
|
281
|
-
function grp() {
|
307
|
+
function grp () {
|
282
308
|
return css(
|
283
309
|
vml('group', {
|
284
|
-
coordsize: s + ' ' + s
|
285
|
-
|
286
|
-
})
|
287
|
-
|
310
|
+
coordsize: s + ' ' + s
|
311
|
+
, coordorigin: -r + ' ' + -r
|
312
|
+
})
|
313
|
+
, { width: s, height: s }
|
288
314
|
)
|
289
315
|
}
|
290
316
|
|
291
|
-
var margin = -(o.width+o.length)*2 + 'px'
|
317
|
+
var margin = -(o.width + o.length) * o.scale * 2 + 'px'
|
292
318
|
, g = css(grp(), {position: 'absolute', top: margin, left: margin})
|
293
319
|
, i
|
294
320
|
|
295
|
-
function seg(i, dx, filter) {
|
296
|
-
ins(
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
321
|
+
function seg (i, dx, filter) {
|
322
|
+
ins(
|
323
|
+
g
|
324
|
+
, ins(
|
325
|
+
css(grp(), {rotation: 360 / o.lines * i + 'deg', left: ~~dx})
|
326
|
+
, ins(
|
327
|
+
css(
|
328
|
+
vml('roundrect', {arcsize: o.corners})
|
329
|
+
, { width: r
|
330
|
+
, height: o.scale * o.width
|
331
|
+
, left: o.scale * o.radius
|
332
|
+
, top: -o.scale * o.width >> 1
|
333
|
+
, filter: filter
|
334
|
+
}
|
335
|
+
)
|
336
|
+
, vml('fill', {color: getColor(o.color, i), opacity: o.opacity})
|
337
|
+
, vml('stroke', {opacity: 0}) // transparent stroke to fix color bleeding upon opacity change
|
307
338
|
)
|
308
339
|
)
|
309
340
|
)
|
310
341
|
}
|
311
342
|
|
312
343
|
if (o.shadow)
|
313
|
-
for (i = 1; i <= o.lines; i++)
|
344
|
+
for (i = 1; i <= o.lines; i++) {
|
314
345
|
seg(i, -2, 'progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)')
|
346
|
+
}
|
315
347
|
|
316
348
|
for (i = 1; i <= o.lines; i++) seg(i)
|
317
349
|
return ins(el, g)
|
318
350
|
}
|
319
351
|
|
320
|
-
Spinner.prototype.opacity = function(el, i, val, o) {
|
352
|
+
Spinner.prototype.opacity = function (el, i, val, o) {
|
321
353
|
var c = el.firstChild
|
322
354
|
o = o.shadow && o.lines || 0
|
323
|
-
if (c && i+o < c.childNodes.length) {
|
324
|
-
c = c.childNodes[i+o]; c = c && c.firstChild; c = c && c.firstChild
|
355
|
+
if (c && i + o < c.childNodes.length) {
|
356
|
+
c = c.childNodes[i + o]; c = c && c.firstChild; c = c && c.firstChild
|
325
357
|
if (c) c.opacity = val
|
326
358
|
}
|
327
359
|
}
|
328
360
|
}
|
329
361
|
|
330
|
-
|
362
|
+
if (typeof document !== 'undefined') {
|
363
|
+
sheet = (function () {
|
364
|
+
var el = createEl('style', {type : 'text/css'})
|
365
|
+
ins(document.getElementsByTagName('head')[0], el)
|
366
|
+
return el.sheet || el.styleSheet
|
367
|
+
}())
|
368
|
+
|
369
|
+
var probe = css(createEl('group'), {behavior: 'url(#default#VML)'})
|
331
370
|
|
332
|
-
|
333
|
-
|
371
|
+
if (!vendor(probe, 'transform') && probe.adj) initVML()
|
372
|
+
else useCssAnimations = vendor(probe, 'animation')
|
373
|
+
}
|
334
374
|
|
335
375
|
return Spinner
|
336
376
|
|
@@ -0,0 +1,2 @@
|
|
1
|
+
// http://spin.js.org/#v2.3.2
|
2
|
+
!function(a,b){"object"==typeof module&&module.exports?module.exports=b():"function"==typeof define&&define.amd?define(b):a.Spinner=b()}(this,function(){"use strict";function a(a,b){var c,d=document.createElement(a||"div");for(c in b)d[c]=b[c];return d}function b(a){for(var b=1,c=arguments.length;c>b;b++)a.appendChild(arguments[b]);return a}function c(a,b,c,d){var e=["opacity",b,~~(100*a),c,d].join("-"),f=.01+c/d*100,g=Math.max(1-(1-a)/b*(100-f),a),h=j.substring(0,j.indexOf("Animation")).toLowerCase(),i=h&&"-"+h+"-"||"";return m[e]||(k.insertRule("@"+i+"keyframes "+e+"{0%{opacity:"+g+"}"+f+"%{opacity:"+a+"}"+(f+.01)+"%{opacity:1}"+(f+b)%100+"%{opacity:"+a+"}100%{opacity:"+g+"}}",k.cssRules.length),m[e]=1),e}function d(a,b){var c,d,e=a.style;if(b=b.charAt(0).toUpperCase()+b.slice(1),void 0!==e[b])return b;for(d=0;d<l.length;d++)if(c=l[d]+b,void 0!==e[c])return c}function e(a,b){for(var c in b)a.style[d(a,c)||c]=b[c];return a}function f(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)void 0===a[d]&&(a[d]=c[d])}return a}function g(a,b){return"string"==typeof a?a:a[b%a.length]}function h(a){this.opts=f(a||{},h.defaults,n)}function i(){function c(b,c){return a("<"+b+' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">',c)}k.addRule(".spin-vml","behavior:url(#default#VML)"),h.prototype.lines=function(a,d){function f(){return e(c("group",{coordsize:k+" "+k,coordorigin:-j+" "+-j}),{width:k,height:k})}function h(a,h,i){b(m,b(e(f(),{rotation:360/d.lines*a+"deg",left:~~h}),b(e(c("roundrect",{arcsize:d.corners}),{width:j,height:d.scale*d.width,left:d.scale*d.radius,top:-d.scale*d.width>>1,filter:i}),c("fill",{color:g(d.color,a),opacity:d.opacity}),c("stroke",{opacity:0}))))}var i,j=d.scale*(d.length+d.width),k=2*d.scale*j,l=-(d.width+d.length)*d.scale*2+"px",m=e(f(),{position:"absolute",top:l,left:l});if(d.shadow)for(i=1;i<=d.lines;i++)h(i,-2,"progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)");for(i=1;i<=d.lines;i++)h(i);return b(a,m)},h.prototype.opacity=function(a,b,c,d){var e=a.firstChild;d=d.shadow&&d.lines||0,e&&b+d<e.childNodes.length&&(e=e.childNodes[b+d],e=e&&e.firstChild,e=e&&e.firstChild,e&&(e.opacity=c))}}var j,k,l=["webkit","Moz","ms","O"],m={},n={lines:12,length:7,width:5,radius:10,scale:1,corners:1,color:"#000",opacity:.25,rotate:0,direction:1,speed:1,trail:100,fps:20,zIndex:2e9,className:"spinner",top:"50%",left:"50%",shadow:!1,hwaccel:!1,position:"absolute"};if(h.defaults={},f(h.prototype,{spin:function(b){this.stop();var c=this,d=c.opts,f=c.el=a(null,{className:d.className});if(e(f,{position:d.position,width:0,zIndex:d.zIndex,left:d.left,top:d.top}),b&&b.insertBefore(f,b.firstChild||null),f.setAttribute("role","progressbar"),c.lines(f,c.opts),!j){var g,h=0,i=(d.lines-1)*(1-d.direction)/2,k=d.fps,l=k/d.speed,m=(1-d.opacity)/(l*d.trail/100),n=l/d.lines;!function o(){h++;for(var a=0;a<d.lines;a++)g=Math.max(1-(h+(d.lines-a)*n)%l*m,d.opacity),c.opacity(f,a*d.direction+i,g,d);c.timeout=c.el&&setTimeout(o,~~(1e3/k))}()}return c},stop:function(){var a=this.el;return a&&(clearTimeout(this.timeout),a.parentNode&&a.parentNode.removeChild(a),this.el=void 0),this},lines:function(d,f){function h(b,c){return e(a(),{position:"absolute",width:f.scale*(f.length+f.width)+"px",height:f.scale*f.width+"px",background:b,boxShadow:c,transformOrigin:"left",transform:"rotate("+~~(360/f.lines*k+f.rotate)+"deg) translate("+f.scale*f.radius+"px,0)",borderRadius:(f.corners*f.scale*f.width>>1)+"px"})}for(var i,k=0,l=(f.lines-1)*(1-f.direction)/2;k<f.lines;k++)i=e(a(),{position:"absolute",top:1+~(f.scale*f.width/2)+"px",transform:f.hwaccel?"translate3d(0,0,0)":"",opacity:f.opacity,animation:j&&c(f.opacity,f.trail,l+k*f.direction,f.lines)+" "+1/f.speed+"s linear infinite"}),f.shadow&&b(i,e(h("#000","0 0 4px #000"),{top:"2px"})),b(d,b(i,h(g(f.color,k),"0 0 1px rgba(0,0,0,.1)")));return d},opacity:function(a,b,c){b<a.childNodes.length&&(a.childNodes[b].style.opacity=c)}}),"undefined"!=typeof document){k=function(){var c=a("style",{type:"text/css"});return b(document.getElementsByTagName("head")[0],c),c.sheet||c.styleSheet}();var o=e(a("group"),{behavior:"url(#default#VML)"});!d(o,"transform")&&o.adj?i():j=d(o,"animation")}return h});
|