|
22 | 22 | },
|
23 | 23 |
|
24 | 24 | /**
|
25 |
| - * (Internal) Queues a function to be executed. |
| 25 | + * Queues a function to be executed. |
26 | 26 | */
|
27 | 27 |
|
28 | 28 | queue: (function() {
|
|
33 | 33 | if (fn) {
|
34 | 34 | fn(next);
|
35 | 35 | }
|
36 |
| - } |
| 36 | + } |
37 | 37 |
|
38 |
| - return function(fn) { |
39 |
| - pending.push(fn); |
40 |
| - if (pending.length == 1) next(); |
41 |
| - }; |
42 |
| - })(), |
| 38 | + return function(fn) { |
| 39 | + pending.push(fn); |
| 40 | + if (pending.length == 1) next(); |
| 41 | + }; |
| 42 | + })(), |
43 | 43 |
|
44 |
| - /** |
45 |
| - * (Internal) Applies css properties to an element, similar to the jQuery |
46 |
| - * setcss method. |
47 |
| - * |
48 |
| - * While this helper does assist with vendor prefixed property names, it |
49 |
| - * does not perform any manipulation of values prior to setting styles. |
50 |
| - */ |
51 |
| - setcss: (function() { |
52 |
| - var cssPrefixes = [ 'Webkit', 'O', 'Moz', 'ms' ], |
53 |
| - cssProps = {}; |
| 44 | + /** |
| 45 | + * Applies css properties to an element, similar to the jQuery |
| 46 | + * setcss method. |
| 47 | + * |
| 48 | + * While this helper does assist with vendor prefixed property names, it |
| 49 | + * does not perform any manipulation of values prior to setting styles. |
| 50 | + */ |
| 51 | + setcss: (function() { |
| 52 | + var cssPrefixes = [ 'Webkit', 'O', 'Moz', 'ms' ], |
| 53 | + cssProps = {}; |
54 | 54 |
|
55 |
| - function camelCase(string) { |
56 |
| - return string.replace(/^-ms-/, 'ms-').replace(/-([\da-z])/gi, function(match, letter) { |
57 |
| - return letter.toUpperCase(); |
58 |
| - }); |
59 |
| - } |
| 55 | + function camelCase(string) { |
| 56 | + return string.replace(/^-ms-/, 'ms-').replace(/-([\da-z])/gi, function(match, letter) { |
| 57 | + return letter.toUpperCase(); |
| 58 | + }); |
| 59 | + } |
60 | 60 |
|
61 |
| - function getVendorProp(name) { |
62 |
| - var style = document.body.style; |
63 |
| - if (name in style) return name; |
| 61 | + function getVendorProp(name) { |
| 62 | + var style = document.body.style; |
| 63 | + if (name in style) return name; |
64 | 64 |
|
65 |
| - var i = cssPrefixes.length, |
66 |
| - capName = name.charAt(0).toUpperCase() + name.slice(1), |
67 |
| - vendorName; |
68 |
| - while (i--) { |
69 |
| - vendorName = cssPrefixes[i] + capName; |
70 |
| - if (vendorName in style) return vendorName; |
71 |
| - } |
| 65 | + var i = cssPrefixes.length, |
| 66 | + capName = name.charAt(0).toUpperCase() + name.slice(1), |
| 67 | + vendorName; |
| 68 | + while (i--) { |
| 69 | + vendorName = cssPrefixes[i] + capName; |
| 70 | + if (vendorName in style) return vendorName; |
| 71 | + } |
72 | 72 |
|
73 |
| - return name; |
74 |
| - } |
| 73 | + return name; |
| 74 | + } |
75 | 75 |
|
76 |
| - function getStyleProp(name) { |
77 |
| - name = camelCase(name); |
78 |
| - return cssProps[name] || (cssProps[name] = getVendorProp(name)); |
79 |
| - } |
| 76 | + function getStyleProp(name) { |
| 77 | + name = camelCase(name); |
| 78 | + return cssProps[name] || (cssProps[name] = getVendorProp(name)); |
| 79 | + } |
80 | 80 |
|
81 |
| - function applyCss(element, prop, value) { |
82 |
| - prop = getStyleProp(prop); |
83 |
| - element.style[prop] = value; |
84 |
| - } |
| 81 | + function applyCss(element, prop, value) { |
| 82 | + prop = getStyleProp(prop); |
| 83 | + element.style[prop] = value; |
| 84 | + } |
85 | 85 |
|
86 |
| - return function(element, properties) { |
87 |
| - var args = arguments, |
88 |
| - prop, |
89 |
| - value; |
| 86 | + return function(element, properties) { |
| 87 | + var args = arguments, |
| 88 | + prop, |
| 89 | + value; |
90 | 90 |
|
91 |
| - if (args.length == 2) { |
92 |
| - for (prop in properties) { |
93 |
| - value = properties[prop]; |
94 |
| - if (value !== undefined && properties.hasOwnProperty(prop)) applyCss(element, prop, value); |
| 91 | + if (args.length == 2) { |
| 92 | + for (prop in properties) { |
| 93 | + value = properties[prop]; |
| 94 | + if (value !== undefined && properties.hasOwnProperty(prop)) applyCss(element, prop, value); |
| 95 | + } |
| 96 | + } else { |
| 97 | + applyCss(element, args[1], args[2]); |
95 | 98 | }
|
96 |
| - } else { |
97 |
| - applyCss(element, args[1], args[2]); |
98 | 99 | }
|
99 |
| - } |
100 |
| - })(), |
| 100 | + })(), |
101 | 101 |
|
102 |
| - clamp: function(n, min, max) { |
103 |
| - if (n < min) return min; |
104 |
| - if (n > max) return max; |
105 |
| - return n; |
106 |
| - }, |
107 |
| - |
108 |
| - /** |
109 |
| - * (Internal) converts a percentage (`0..1`) to a bar translateX |
110 |
| - * percentage (`-100%..0%`). |
111 |
| - */ |
112 |
| - toBarPerc: function(n) { |
113 |
| - return (-1 + n) * 100; |
114 |
| - }, |
| 102 | + clamp: function(n, min, max) { |
| 103 | + if (n < min) return min; |
| 104 | + if (n > max) return max; |
| 105 | + return n; |
| 106 | + }, |
115 | 107 |
|
116 |
| - hasClass: function(element, name) { |
117 |
| - var list = typeof element == 'string' ? element : $$utils$$Utils.classList(element); |
118 |
| - return list.indexOf(' ' + name + ' ') >= 0; |
119 |
| - }, |
| 108 | + /** |
| 109 | + * converts a percentage (`0..1`) to a bar translateX |
| 110 | + * percentage (`-100%..0%`). |
| 111 | + */ |
| 112 | + toBarPerc: function(n) { |
| 113 | + return (-1 + n) * 100; |
| 114 | + }, |
120 | 115 |
|
121 |
| - addClass: function(element, name) { |
122 |
| - var oldList = $$utils$$Utils.classList(element), |
123 |
| - newList = oldList + name; |
| 116 | + hasClass: function(element, name) { |
| 117 | + var list = typeof element == 'string' ? element : $$utils$$Utils.classList(element); |
| 118 | + return list.indexOf(' ' + name + ' ') >= 0; |
| 119 | + }, |
124 | 120 |
|
125 |
| - if ($$utils$$Utils.hasClass(oldList, name)) return; |
| 121 | + addClass: function(element, name) { |
| 122 | + var oldList = $$utils$$Utils.classList(element), |
| 123 | + newList = oldList + name; |
126 | 124 |
|
127 |
| - // Trim the opening space. |
128 |
| - element.className = newList.substring(1); |
129 |
| - }, |
| 125 | + if ($$utils$$Utils.hasClass(oldList, name)) return; |
130 | 126 |
|
131 |
| - removeClass: function(element, name) { |
132 |
| - var oldList = $$utils$$Utils.classList(element), |
133 |
| - newList; |
| 127 | + // Trim the opening space. |
| 128 | + element.className = newList.substring(1); |
| 129 | + }, |
134 | 130 |
|
135 |
| - if (!$$utils$$Utils.hasClass(element, name)) return; |
| 131 | + removeClass: function(element, name) { |
| 132 | + var oldList = $$utils$$Utils.classList(element), |
| 133 | + newList; |
136 | 134 |
|
137 |
| - // Replace the class name. |
138 |
| - newList = oldList.replace(' ' + name + ' ', ' '); |
| 135 | + if (!$$utils$$Utils.hasClass(element, name)) return; |
139 | 136 |
|
140 |
| - // Trim the opening and closing spaces. |
141 |
| - element.className = newList.substring(1, newList.length - 1); |
142 |
| - }, |
| 137 | + // Replace the class name. |
| 138 | + newList = oldList.replace(' ' + name + ' ', ' '); |
143 | 139 |
|
144 |
| - showEl: function(element) { |
145 |
| - $$utils$$Utils.setcss(element, { |
146 |
| - display: 'block' |
147 |
| - }); |
148 |
| - }, |
| 140 | + // Trim the opening and closing spaces. |
| 141 | + element.className = newList.substring(1, newList.length - 1); |
| 142 | + }, |
149 | 143 |
|
150 |
| - hideEl: function(element) { |
151 |
| - $$utils$$Utils.setcss(element, { |
152 |
| - display: 'none' |
153 |
| - }); |
154 |
| - }, |
| 144 | + showEl: function(element) { |
| 145 | + $$utils$$Utils.setcss(element, { |
| 146 | + display: 'block' |
| 147 | + }); |
| 148 | + }, |
155 | 149 |
|
156 |
| - classList: function(element) { |
157 |
| - return (' ' + (element.className || '') + ' ').replace(/\s+/gi, ' '); |
158 |
| - }, |
| 150 | + hideEl: function(element) { |
| 151 | + $$utils$$Utils.setcss(element, { |
| 152 | + display: 'none' |
| 153 | + }); |
| 154 | + }, |
159 | 155 |
|
160 |
| - /** |
161 |
| - * (Internal) Removes an element from the DOM. |
162 |
| - */ |
163 |
| - removeElement: function(element) { |
164 |
| - element && element.parentNode && element.parentNode.removeChild(element); |
165 |
| - } |
| 156 | + classList: function(element) { |
| 157 | + return (' ' + (element.className || '') + ' ').replace(/\s+/gi, ' '); |
| 158 | + }, |
166 | 159 |
|
| 160 | + /** |
| 161 | + * Removes an element from the DOM. |
| 162 | + */ |
| 163 | + removeElement: function(element) { |
| 164 | + element && element.parentNode && element.parentNode.removeChild(element); |
| 165 | + } |
167 | 166 | };
|
168 | 167 |
|
169 |
| - |
170 | 168 | var $$utils$$default = $$utils$$Utils;
|
171 | 169 | (function(root, factory) {
|
172 | 170 | // UMD
|
|
694 | 692 | };
|
695 | 693 |
|
696 | 694 | /**
|
697 |
| - * Waits for all supplied jQuery or Zepto.js promises and |
| 695 | + * Waits for all supplied jQuery or Zepto promises and |
698 | 696 | * increases the progress as the promises resolve.
|
699 | 697 | *
|
700 | 698 | * @param $promise jQuery or Zepto Promise
|
|
0 commit comments