active_frontend 13.3.0 → 14.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (221) hide show
  1. checksums.yaml +4 -4
  2. data/.DS_Store +0 -0
  3. data/.fasterer.yml +19 -0
  4. data/.reek +27 -0
  5. data/.rubocop.yml +38 -0
  6. data/.scss-lint.yml +27 -0
  7. data/Rakefile +1 -1
  8. data/active_frontend.gemspec +21 -18
  9. data/app/.DS_Store +0 -0
  10. data/app/assets/.DS_Store +0 -0
  11. data/app/assets/fonts/.DS_Store +0 -0
  12. data/app/assets/fonts/dripicons/.DS_Store +0 -0
  13. data/app/assets/fonts/dripicons/dripicons.woff +0 -0
  14. data/app/assets/fonts/fakt-pro/.DS_Store +0 -0
  15. data/app/assets/fonts/fakt-pro/fakt-pro-bold.woff +0 -0
  16. data/app/assets/fonts/fakt-pro/fakt-pro-normal.woff +0 -0
  17. data/app/assets/fonts/fakt-pro/fakt-pro-semibold.woff +0 -0
  18. data/app/assets/fonts/fakt-pro/fakt-pro-semilight.woff +0 -0
  19. data/app/assets/fonts/fakt-soft-pro/.DS_Store +0 -0
  20. data/app/assets/fonts/fakt-soft-pro/fakt-soft-pro-bold.woff +0 -0
  21. data/app/assets/fonts/fakt-soft-pro/fakt-soft-pro-normal.woff +0 -0
  22. data/app/assets/fonts/fakt-soft-pro/fakt-soft-pro-semibold.woff +0 -0
  23. data/app/assets/fonts/fakt-soft-pro/fakt-soft-pro-semilight.woff +0 -0
  24. data/app/assets/images/.DS_Store +0 -0
  25. data/app/assets/images/.keep +0 -0
  26. data/app/assets/images/placeholders/.DS_Store +0 -0
  27. data/app/assets/images/placeholders/camera-large.png +0 -0
  28. data/app/assets/images/placeholders/camera-small.png +0 -0
  29. data/app/assets/images/placeholders/camera.png +0 -0
  30. data/app/assets/images/placeholders/document-large.png +0 -0
  31. data/app/assets/images/placeholders/document-small.png +0 -0
  32. data/app/assets/images/placeholders/document.png +0 -0
  33. data/app/assets/images/placeholders/photo-large.png +0 -0
  34. data/app/assets/images/placeholders/{picture-small.png → photo-small.png} +0 -0
  35. data/app/assets/images/placeholders/photo.png +0 -0
  36. data/app/assets/images/placeholders/store-large.png +0 -0
  37. data/app/assets/images/placeholders/store-small.png +0 -0
  38. data/app/assets/images/placeholders/store.png +0 -0
  39. data/app/assets/images/placeholders/user-large.png +0 -0
  40. data/app/assets/images/placeholders/user-small.png +0 -0
  41. data/app/assets/images/placeholders/user.png +0 -0
  42. data/app/helpers/active_frontend_helper.rb +22 -37
  43. data/lib/.DS_Store +0 -0
  44. data/lib/active_frontend.rb +3 -4
  45. data/lib/active_frontend/.DS_Store +0 -0
  46. data/lib/active_frontend/version.rb +1 -1
  47. data/lib/generators/active_frontend/install_generator.rb +3 -3
  48. data/lib/generators/active_frontend/templates/install.js +35 -30
  49. data/lib/generators/active_frontend/templates/install.scss +55 -58
  50. data/vendor/.DS_Store +0 -0
  51. data/vendor/assets/.DS_Store +0 -0
  52. data/vendor/assets/javascripts/.DS_Store +0 -0
  53. data/vendor/assets/javascripts/active_frontend.js +35 -30
  54. data/vendor/assets/javascripts/base/_affix.js +170 -0
  55. data/vendor/assets/javascripts/base/_alert.js +80 -0
  56. data/vendor/assets/javascripts/base/_animation.js +106 -0
  57. data/vendor/assets/javascripts/base/_button.js +123 -0
  58. data/vendor/assets/javascripts/base/_carousel.js +237 -0
  59. data/vendor/assets/javascripts/base/_collapse.js +200 -0
  60. data/vendor/assets/javascripts/base/_colorpicker.js +147 -0
  61. data/vendor/assets/javascripts/base/_datepicker.js +1411 -0
  62. data/vendor/assets/javascripts/base/_dropdown.js +154 -0
  63. data/vendor/assets/javascripts/base/_filepicker.js +235 -0
  64. data/vendor/assets/javascripts/base/_hoverdown.js +116 -0
  65. data/vendor/assets/javascripts/base/_layout.js +126 -0
  66. data/vendor/assets/javascripts/base/_list.js +103 -0
  67. data/vendor/assets/javascripts/{_modal.js → base/_modal.js} +170 -167
  68. data/vendor/assets/javascripts/base/_popover.js +101 -0
  69. data/vendor/assets/javascripts/base/_scrollspy.js +161 -0
  70. data/vendor/assets/javascripts/base/_switch.js +160 -0
  71. data/vendor/assets/javascripts/base/_tab.js +139 -0
  72. data/vendor/assets/javascripts/base/_table.js +224 -0
  73. data/vendor/assets/javascripts/base/_timeago.js +270 -0
  74. data/vendor/assets/javascripts/base/_timepicker.js +541 -0
  75. data/vendor/assets/javascripts/base/_tooltip.js +525 -0
  76. data/vendor/assets/javascripts/base/_tour.js +268 -0
  77. data/vendor/assets/javascripts/base/_transition.js +52 -0
  78. data/vendor/assets/javascripts/base/_typeahead.js +362 -0
  79. data/vendor/assets/javascripts/extensions/_calendar.js +4709 -0
  80. data/vendor/assets/javascripts/extensions/_chart.js +9371 -0
  81. data/vendor/assets/javascripts/extensions/_map.js +2153 -0
  82. data/vendor/assets/stylesheets/.DS_Store +0 -0
  83. data/vendor/assets/stylesheets/{_mixin.scss → _utility.scss} +96 -10
  84. data/vendor/assets/stylesheets/_variable.scss +201 -19
  85. data/vendor/assets/stylesheets/active_frontend.scss +55 -58
  86. data/vendor/assets/stylesheets/blocks/_anchor.scss +15 -0
  87. data/vendor/assets/stylesheets/blocks/_button.scss +278 -0
  88. data/vendor/assets/stylesheets/blocks/_code.scss +144 -0
  89. data/vendor/assets/stylesheets/blocks/_common.scss +127 -0
  90. data/vendor/assets/stylesheets/blocks/_form.scss +508 -0
  91. data/vendor/assets/stylesheets/blocks/_icon.scss +359 -0
  92. data/vendor/assets/stylesheets/blocks/_list.scss +76 -0
  93. data/vendor/assets/stylesheets/blocks/_multimedia.scss +62 -0
  94. data/vendor/assets/stylesheets/blocks/_reset.scss +179 -0
  95. data/vendor/assets/stylesheets/blocks/_table.scss +211 -0
  96. data/vendor/assets/stylesheets/blocks/_typography.scss +204 -0
  97. data/vendor/assets/stylesheets/components/_ad.scss +78 -0
  98. data/vendor/assets/stylesheets/components/_affix.scss +14 -0
  99. data/vendor/assets/stylesheets/components/_alert.scss +50 -0
  100. data/vendor/assets/stylesheets/components/_animation.scss +1670 -0
  101. data/vendor/assets/stylesheets/components/_breadcrumb.scss +17 -0
  102. data/vendor/assets/stylesheets/components/_calendar.scss +213 -0
  103. data/vendor/assets/stylesheets/components/_card.scss +30 -0
  104. data/vendor/assets/stylesheets/components/_carousel.scss +135 -0
  105. data/vendor/assets/stylesheets/components/_chart.scss +10 -0
  106. data/vendor/assets/stylesheets/components/_collapse.scss +17 -0
  107. data/vendor/assets/stylesheets/components/_colorpicker.scss +38 -0
  108. data/vendor/assets/stylesheets/components/_datepicker.scss +80 -0
  109. data/vendor/assets/stylesheets/components/_dropmenu.scss +151 -0
  110. data/vendor/assets/stylesheets/components/_footer.scss +11 -0
  111. data/vendor/assets/stylesheets/components/_grid.scss +144 -0
  112. data/vendor/assets/stylesheets/components/_header.scss +99 -0
  113. data/vendor/assets/stylesheets/components/_label_and_badge.scss +57 -0
  114. data/vendor/assets/stylesheets/components/_layout.scss +63 -0
  115. data/vendor/assets/stylesheets/components/_map.scss +14 -0
  116. data/vendor/assets/stylesheets/components/_milestone.scss +49 -0
  117. data/vendor/assets/stylesheets/components/_missive.scss +40 -0
  118. data/vendor/assets/stylesheets/components/_modal.scss +126 -0
  119. data/vendor/assets/stylesheets/components/_nav_and_tab.scss +202 -0
  120. data/vendor/assets/stylesheets/components/_navbar.scss +66 -0
  121. data/vendor/assets/stylesheets/components/_pagination.scss +79 -0
  122. data/vendor/assets/stylesheets/components/_placeholder.scss +23 -0
  123. data/vendor/assets/stylesheets/components/_popover.scss +167 -0
  124. data/vendor/assets/stylesheets/components/_progress.scss +62 -0
  125. data/vendor/assets/stylesheets/components/_sidebar.scss +74 -0
  126. data/vendor/assets/stylesheets/components/_spinner.scss +83 -0
  127. data/vendor/assets/stylesheets/components/_switch.scss +150 -0
  128. data/vendor/assets/stylesheets/components/_timepicker.scss +30 -0
  129. data/vendor/assets/stylesheets/components/_tooltip.scss +93 -0
  130. data/vendor/assets/stylesheets/components/_transition.scss +12 -0
  131. data/vendor/assets/stylesheets/components/_typeahead.scss +18 -0
  132. metadata +150 -94
  133. data/app/assets/fonts/gotham/gotham-bold.woff +0 -0
  134. data/app/assets/fonts/gotham/gotham-book.woff +0 -0
  135. data/app/assets/fonts/gotham/gotham-light.woff +0 -0
  136. data/app/assets/fonts/gotham/gotham-medium.woff +0 -0
  137. data/app/assets/fonts/gotham/gotham-rounded-bold.woff +0 -0
  138. data/app/assets/fonts/gotham/gotham-rounded-book.woff +0 -0
  139. data/app/assets/fonts/gotham/gotham-rounded-light.woff +0 -0
  140. data/app/assets/fonts/gotham/gotham-rounded-medium.woff +0 -0
  141. data/app/assets/images/placeholders/archive-large.png +0 -0
  142. data/app/assets/images/placeholders/archive-small.png +0 -0
  143. data/app/assets/images/placeholders/archive.png +0 -0
  144. data/app/assets/images/placeholders/picture-large.png +0 -0
  145. data/app/assets/images/placeholders/picture.png +0 -0
  146. data/vendor/assets/javascripts/_affix.js +0 -153
  147. data/vendor/assets/javascripts/_alert.js +0 -85
  148. data/vendor/assets/javascripts/_animation.js +0 -103
  149. data/vendor/assets/javascripts/_button.js +0 -107
  150. data/vendor/assets/javascripts/_carousel.js +0 -228
  151. data/vendor/assets/javascripts/_chart.js +0 -3742
  152. data/vendor/assets/javascripts/_collapse.js +0 -202
  153. data/vendor/assets/javascripts/_color_picker.js +0 -108
  154. data/vendor/assets/javascripts/_date_picker.js +0 -1650
  155. data/vendor/assets/javascripts/_dropdown.js +0 -156
  156. data/vendor/assets/javascripts/_file_input.js +0 -71
  157. data/vendor/assets/javascripts/_hoverdown.js +0 -109
  158. data/vendor/assets/javascripts/_inputmask.js +0 -341
  159. data/vendor/assets/javascripts/_loader.js +0 -361
  160. data/vendor/assets/javascripts/_map.js +0 -2401
  161. data/vendor/assets/javascripts/_popover.js +0 -99
  162. data/vendor/assets/javascripts/_scrollspy.js +0 -163
  163. data/vendor/assets/javascripts/_slider.js +0 -1572
  164. data/vendor/assets/javascripts/_sort.js +0 -1432
  165. data/vendor/assets/javascripts/_swoggle.js +0 -415
  166. data/vendor/assets/javascripts/_tab.js +0 -146
  167. data/vendor/assets/javascripts/_tablespy.js +0 -1883
  168. data/vendor/assets/javascripts/_time_ago.js +0 -206
  169. data/vendor/assets/javascripts/_time_picker.js +0 -1088
  170. data/vendor/assets/javascripts/_tooltip.js +0 -504
  171. data/vendor/assets/javascripts/_transition.js +0 -50
  172. data/vendor/assets/javascripts/_typeahead.js +0 -366
  173. data/vendor/assets/stylesheets/_ad.scss +0 -63
  174. data/vendor/assets/stylesheets/_affix.scss +0 -14
  175. data/vendor/assets/stylesheets/_alert.scss +0 -114
  176. data/vendor/assets/stylesheets/_animation.scss +0 -1370
  177. data/vendor/assets/stylesheets/_breadcrumb.scss +0 -100
  178. data/vendor/assets/stylesheets/_button.scss +0 -386
  179. data/vendor/assets/stylesheets/_canvas.scss +0 -182
  180. data/vendor/assets/stylesheets/_carousel.scss +0 -158
  181. data/vendor/assets/stylesheets/_chart.scss +0 -15
  182. data/vendor/assets/stylesheets/_code.scss +0 -150
  183. data/vendor/assets/stylesheets/_collapse.scss +0 -14
  184. data/vendor/assets/stylesheets/_color.scss +0 -55
  185. data/vendor/assets/stylesheets/_colorpicker.scss +0 -63
  186. data/vendor/assets/stylesheets/_datepicker.scss +0 -122
  187. data/vendor/assets/stylesheets/_dropdown.scss +0 -248
  188. data/vendor/assets/stylesheets/_footer.scss +0 -71
  189. data/vendor/assets/stylesheets/_form.scss +0 -661
  190. data/vendor/assets/stylesheets/_grid.scss +0 -184
  191. data/vendor/assets/stylesheets/_header.scss +0 -156
  192. data/vendor/assets/stylesheets/_icon.scss +0 -362
  193. data/vendor/assets/stylesheets/_image.scss +0 -33
  194. data/vendor/assets/stylesheets/_label_and_badge.scss +0 -104
  195. data/vendor/assets/stylesheets/_link.scss +0 -55
  196. data/vendor/assets/stylesheets/_list.scss +0 -122
  197. data/vendor/assets/stylesheets/_loader.scss +0 -71
  198. data/vendor/assets/stylesheets/_map.scss +0 -44
  199. data/vendor/assets/stylesheets/_missive.scss +0 -74
  200. data/vendor/assets/stylesheets/_modal.scss +0 -204
  201. data/vendor/assets/stylesheets/_nav_and_tab.scss +0 -230
  202. data/vendor/assets/stylesheets/_navbar.scss +0 -73
  203. data/vendor/assets/stylesheets/_pagination.scss +0 -79
  204. data/vendor/assets/stylesheets/_panel.scss +0 -80
  205. data/vendor/assets/stylesheets/_placeholder.scss +0 -63
  206. data/vendor/assets/stylesheets/_popover.scss +0 -128
  207. data/vendor/assets/stylesheets/_progress.scss +0 -86
  208. data/vendor/assets/stylesheets/_reset.scss +0 -140
  209. data/vendor/assets/stylesheets/_sidebar.scss +0 -148
  210. data/vendor/assets/stylesheets/_slider.scss +0 -151
  211. data/vendor/assets/stylesheets/_spinner.scss +0 -572
  212. data/vendor/assets/stylesheets/_subheader.scss +0 -112
  213. data/vendor/assets/stylesheets/_swoggle.scss +0 -120
  214. data/vendor/assets/stylesheets/_table.scss +0 -210
  215. data/vendor/assets/stylesheets/_timepicker.scss +0 -77
  216. data/vendor/assets/stylesheets/_toolbar.scss +0 -130
  217. data/vendor/assets/stylesheets/_tooltip.scss +0 -105
  218. data/vendor/assets/stylesheets/_transition.scss +0 -11
  219. data/vendor/assets/stylesheets/_trunk.scss +0 -147
  220. data/vendor/assets/stylesheets/_typeahead.scss +0 -18
  221. data/vendor/assets/stylesheets/_typography.scss +0 -233
@@ -1,1432 +0,0 @@
1
- ;(function(){
2
-
3
- /**
4
- * Require the given path.
5
- *
6
- * @param {String} path
7
- * @return {Object} exports
8
- * @api public
9
- */
10
-
11
- function require(path, parent, orig) {
12
- var resolved = require.resolve(path);
13
-
14
- // lookup failed
15
- if (null == resolved) {
16
- orig = orig || path;
17
- parent = parent || 'root';
18
- var err = new Error('Failed to require "' + orig + '" from "' + parent + '"');
19
- err.path = orig;
20
- err.parent = parent;
21
- err.require = true;
22
- throw err;
23
- }
24
-
25
- var module = require.modules[resolved];
26
-
27
- // perform real require()
28
- // by invoking the module's
29
- // registered function
30
- if (!module._resolving && !module.exports) {
31
- var mod = {};
32
- mod.exports = {};
33
- mod.client = mod.component = true;
34
- module._resolving = true;
35
- module.call(this, mod.exports, require.relative(resolved), mod);
36
- delete module._resolving;
37
- module.exports = mod.exports;
38
- }
39
-
40
- return module.exports;
41
- }
42
-
43
- /**
44
- * Registered modules.
45
- */
46
-
47
- require.modules = {};
48
-
49
- /**
50
- * Registered aliases.
51
- */
52
-
53
- require.aliases = {};
54
-
55
- /**
56
- * Resolve `path`.
57
- *
58
- * Lookup:
59
- *
60
- * - PATH/index.js
61
- * - PATH.js
62
- * - PATH
63
- *
64
- * @param {String} path
65
- * @return {String} path or null
66
- * @api private
67
- */
68
-
69
- require.resolve = function(path) {
70
- if (path.charAt(0) === '/') path = path.slice(1);
71
-
72
- var paths = [
73
- path,
74
- path + '.js',
75
- path + '.json',
76
- path + '/index.js',
77
- path + '/index.json'
78
- ];
79
-
80
- for (var i = 0; i < paths.length; i++) {
81
- var path = paths[i];
82
- if (require.modules.hasOwnProperty(path)) return path;
83
- if (require.aliases.hasOwnProperty(path)) return require.aliases[path];
84
- }
85
- };
86
-
87
- /**
88
- * Normalize `path` relative to the current path.
89
- *
90
- * @param {String} curr
91
- * @param {String} path
92
- * @return {String}
93
- * @api private
94
- */
95
-
96
- require.normalize = function(curr, path) {
97
- var segs = [];
98
-
99
- if ('.' != path.charAt(0)) return path;
100
-
101
- curr = curr.split('/');
102
- path = path.split('/');
103
-
104
- for (var i = 0; i < path.length; ++i) {
105
- if ('..' == path[i]) {
106
- curr.pop();
107
- } else if ('.' != path[i] && '' != path[i]) {
108
- segs.push(path[i]);
109
- }
110
- }
111
-
112
- return curr.concat(segs).join('/');
113
- };
114
-
115
- /**
116
- * Register module at `path` with callback `definition`.
117
- *
118
- * @param {String} path
119
- * @param {Function} definition
120
- * @api private
121
- */
122
-
123
- require.register = function(path, definition) {
124
- require.modules[path] = definition;
125
- };
126
-
127
- /**
128
- * Alias a module definition.
129
- *
130
- * @param {String} from
131
- * @param {String} to
132
- * @api private
133
- */
134
-
135
- require.alias = function(from, to) {
136
- if (!require.modules.hasOwnProperty(from)) {
137
- throw new Error('Failed to alias "' + from + '", it does not exist');
138
- }
139
- require.aliases[to] = from;
140
- };
141
-
142
- /**
143
- * Return a require function relative to the `parent` path.
144
- *
145
- * @param {String} parent
146
- * @return {Function}
147
- * @api private
148
- */
149
-
150
- require.relative = function(parent) {
151
- var p = require.normalize(parent, '..');
152
-
153
- /**
154
- * lastIndexOf helper.
155
- */
156
-
157
- function lastIndexOf(arr, obj) {
158
- var i = arr.length;
159
- while (i--) {
160
- if (arr[i] === obj) return i;
161
- }
162
- return -1;
163
- }
164
-
165
- /**
166
- * The relative require() itself.
167
- */
168
-
169
- function localRequire(path) {
170
- var resolved = localRequire.resolve(path);
171
- return require(resolved, parent, path);
172
- }
173
-
174
- /**
175
- * Resolve relative to the parent.
176
- */
177
-
178
- localRequire.resolve = function(path) {
179
- var c = path.charAt(0);
180
- if ('/' == c) return path.slice(1);
181
- if ('.' == c) return require.normalize(p, path);
182
-
183
- // resolve deps by returning
184
- // the dep in the nearest "deps"
185
- // directory
186
- var segs = parent.split('/');
187
- var i = lastIndexOf(segs, 'deps') + 1;
188
- if (!i) i = 0;
189
- path = segs.slice(0, i + 1).join('/') + '/deps/' + path;
190
- return path;
191
- };
192
-
193
- /**
194
- * Check if module is defined at `path`.
195
- */
196
-
197
- localRequire.exists = function(path) {
198
- return require.modules.hasOwnProperty(localRequire.resolve(path));
199
- };
200
-
201
- return localRequire;
202
- };
203
- require.register("component-classes/index.js", function(exports, require, module){
204
- /**
205
- * Module dependencies.
206
- */
207
-
208
- var index = require('indexof');
209
-
210
- /**
211
- * Whitespace regexp.
212
- */
213
-
214
- var re = /\s+/;
215
-
216
- /**
217
- * toString reference.
218
- */
219
-
220
- var toString = Object.prototype.toString;
221
-
222
- /**
223
- * Wrap `el` in a `ClassList`.
224
- *
225
- * @param {Element} el
226
- * @return {ClassList}
227
- * @api public
228
- */
229
-
230
- module.exports = function(el){
231
- return new ClassList(el);
232
- };
233
-
234
- /**
235
- * Initialize a new ClassList for `el`.
236
- *
237
- * @param {Element} el
238
- * @api private
239
- */
240
-
241
- function ClassList(el) {
242
- if (!el) throw new Error('A DOM element reference is required');
243
- this.el = el;
244
- this.list = el.classList;
245
- }
246
-
247
- /**
248
- * Add class `name` if not already present.
249
- *
250
- * @param {String} name
251
- * @return {ClassList}
252
- * @api public
253
- */
254
-
255
- ClassList.prototype.add = function(name){
256
- // classList
257
- if (this.list) {
258
- this.list.add(name);
259
- return this;
260
- }
261
-
262
- // fallback
263
- var arr = this.array();
264
- var i = index(arr, name);
265
- if (!~i) arr.push(name);
266
- this.el.className = arr.join(' ');
267
- return this;
268
- };
269
-
270
- /**
271
- * Remove class `name` when present, or
272
- * pass a regular expression to remove
273
- * any which match.
274
- *
275
- * @param {String|RegExp} name
276
- * @return {ClassList}
277
- * @api public
278
- */
279
-
280
- ClassList.prototype.remove = function(name){
281
- if ('[object RegExp]' == toString.call(name)) {
282
- return this.removeMatching(name);
283
- }
284
-
285
- // classList
286
- if (this.list) {
287
- this.list.remove(name);
288
- return this;
289
- }
290
-
291
- // fallback
292
- var arr = this.array();
293
- var i = index(arr, name);
294
- if (~i) arr.splice(i, 1);
295
- this.el.className = arr.join(' ');
296
- return this;
297
- };
298
-
299
- /**
300
- * Remove all classes matching `re`.
301
- *
302
- * @param {RegExp} re
303
- * @return {ClassList}
304
- * @api private
305
- */
306
-
307
- ClassList.prototype.removeMatching = function(re){
308
- var arr = this.array();
309
- for (var i = 0; i < arr.length; i++) {
310
- if (re.test(arr[i])) {
311
- this.remove(arr[i]);
312
- }
313
- }
314
- return this;
315
- };
316
-
317
- /**
318
- * Toggle class `name`, can force state via `force`.
319
- *
320
- * For browsers that support classList, but do not support `force` yet,
321
- * the mistake will be detected and corrected.
322
- *
323
- * @param {String} name
324
- * @param {Boolean} force
325
- * @return {ClassList}
326
- * @api public
327
- */
328
-
329
- ClassList.prototype.toggle = function(name, force){
330
- // classList
331
- if (this.list) {
332
- if ("undefined" !== typeof force) {
333
- if (force !== this.list.toggle(name, force)) {
334
- this.list.toggle(name); // toggle again to correct
335
- }
336
- } else {
337
- this.list.toggle(name);
338
- }
339
- return this;
340
- }
341
-
342
- // fallback
343
- if ("undefined" !== typeof force) {
344
- if (!force) {
345
- this.remove(name);
346
- } else {
347
- this.add(name);
348
- }
349
- } else {
350
- if (this.has(name)) {
351
- this.remove(name);
352
- } else {
353
- this.add(name);
354
- }
355
- }
356
-
357
- return this;
358
- };
359
-
360
- /**
361
- * Return an array of classes.
362
- *
363
- * @return {Array}
364
- * @api public
365
- */
366
-
367
- ClassList.prototype.array = function(){
368
- var str = this.el.className.replace(/^\s+|\s+$/g, '');
369
- var arr = str.split(re);
370
- if ('' === arr[0]) arr.shift();
371
- return arr;
372
- };
373
-
374
- /**
375
- * Check if class `name` is present.
376
- *
377
- * @param {String} name
378
- * @return {ClassList}
379
- * @api public
380
- */
381
-
382
- ClassList.prototype.has =
383
- ClassList.prototype.contains = function(name){
384
- return this.list
385
- ? this.list.contains(name)
386
- : !! ~index(this.array(), name);
387
- };
388
-
389
- });
390
- require.register("segmentio-extend/index.js", function(exports, require, module){
391
-
392
- module.exports = function extend (object) {
393
- // Takes an unlimited number of extenders.
394
- var args = Array.prototype.slice.call(arguments, 1);
395
-
396
- // For each extender, copy their properties on our object.
397
- for (var i = 0, source; source = args[i]; i++) {
398
- if (!source) continue;
399
- for (var property in source) {
400
- object[property] = source[property];
401
- }
402
- }
403
-
404
- return object;
405
- };
406
- });
407
- require.register("component-indexof/index.js", function(exports, require, module){
408
- module.exports = function(arr, obj){
409
- if (arr.indexOf) return arr.indexOf(obj);
410
- for (var i = 0; i < arr.length; ++i) {
411
- if (arr[i] === obj) return i;
412
- }
413
- return -1;
414
- };
415
- });
416
- require.register("component-event/index.js", function(exports, require, module){
417
- var bind = window.addEventListener ? 'addEventListener' : 'attachEvent',
418
- unbind = window.removeEventListener ? 'removeEventListener' : 'detachEvent',
419
- prefix = bind !== 'addEventListener' ? 'on' : '';
420
-
421
- /**
422
- * Bind `el` event `type` to `fn`.
423
- *
424
- * @param {Element} el
425
- * @param {String} type
426
- * @param {Function} fn
427
- * @param {Boolean} capture
428
- * @return {Function}
429
- * @api public
430
- */
431
-
432
- exports.bind = function(el, type, fn, capture){
433
- el[bind](prefix + type, fn, capture || false);
434
- return fn;
435
- };
436
-
437
- /**
438
- * Unbind `el` event `type`'s callback `fn`.
439
- *
440
- * @param {Element} el
441
- * @param {String} type
442
- * @param {Function} fn
443
- * @param {Boolean} capture
444
- * @return {Function}
445
- * @api public
446
- */
447
-
448
- exports.unbind = function(el, type, fn, capture){
449
- el[unbind](prefix + type, fn, capture || false);
450
- return fn;
451
- };
452
- });
453
- require.register("javve-to-array/index.js", function(exports, require, module){
454
- /**
455
- * Convert an array-like object into an `Array`.
456
- * If `collection` is already an `Array`, then will return a clone of `collection`.
457
- *
458
- * @param {Array | Mixed} collection An `Array` or array-like object to convert e.g. `arguments` or `NodeList`
459
- * @return {Array} Naive conversion of `collection` to a new `Array`.
460
- * @api public
461
- */
462
-
463
- module.exports = function toArray(collection) {
464
- if (typeof collection === 'undefined') return []
465
- if (collection === null) return [null]
466
- if (collection === window) return [window]
467
- if (typeof collection === 'string') return [collection]
468
- if (collection instanceof Array) return collection
469
- if (typeof collection.length != 'number') return [collection]
470
- if (typeof collection === 'function') return [collection]
471
-
472
- var arr = []
473
- for (var i = 0; i < collection.length; i++) {
474
- if (Object.prototype.hasOwnProperty.call(collection, i) || i in collection) {
475
- arr.push(collection[i])
476
- }
477
- }
478
- if (!arr.length) return []
479
- return arr
480
- }
481
-
482
- });
483
- require.register("javve-events/index.js", function(exports, require, module){
484
- var events = require('event'),
485
- toArray = require('to-array');
486
-
487
- /**
488
- * Bind `el` event `type` to `fn`.
489
- *
490
- * @param {Element} el, NodeList, HTMLCollection or Array
491
- * @param {String} type
492
- * @param {Function} fn
493
- * @param {Boolean} capture
494
- * @api public
495
- */
496
-
497
- exports.bind = function(el, type, fn, capture){
498
- el = toArray(el);
499
- for ( var i = 0; i < el.length; i++ ) {
500
- events.bind(el[i], type, fn, capture);
501
- }
502
- };
503
-
504
- /**
505
- * Unbind `el` event `type`'s callback `fn`.
506
- *
507
- * @param {Element} el, NodeList, HTMLCollection or Array
508
- * @param {String} type
509
- * @param {Function} fn
510
- * @param {Boolean} capture
511
- * @api public
512
- */
513
-
514
- exports.unbind = function(el, type, fn, capture){
515
- el = toArray(el);
516
- for ( var i = 0; i < el.length; i++ ) {
517
- events.unbind(el[i], type, fn, capture);
518
- }
519
- };
520
-
521
- });
522
- require.register("javve-get-by-class/index.js", function(exports, require, module){
523
- /**
524
- * Find all elements with class `className` inside `container`.
525
- * Use `single = true` to increase performance in older browsers
526
- * when only one element is needed.
527
- *
528
- * @param {String} className
529
- * @param {Element} container
530
- * @param {Boolean} single
531
- * @api public
532
- */
533
-
534
- module.exports = (function() {
535
- if (document.getElementsByClassName) {
536
- return function(container, className, single) {
537
- if (single) {
538
- return container.getElementsByClassName(className)[0];
539
- } else {
540
- return container.getElementsByClassName(className);
541
- }
542
- };
543
- } else if (document.querySelector) {
544
- return function(container, className, single) {
545
- className = '.' + className;
546
- if (single) {
547
- return container.querySelector(className);
548
- } else {
549
- return container.querySelectorAll(className);
550
- }
551
- };
552
- } else {
553
- return function(container, className, single) {
554
- var classElements = [],
555
- tag = '*';
556
- if (container == null) {
557
- container = document;
558
- }
559
- var els = container.getElementsByTagName(tag);
560
- var elsLen = els.length;
561
- var pattern = new RegExp("(^|\\s)"+className+"(\\s|$)");
562
- for (var i = 0, j = 0; i < elsLen; i++) {
563
- if ( pattern.test(els[i].className) ) {
564
- if (single) {
565
- return els[i];
566
- } else {
567
- classElements[j] = els[i];
568
- j++;
569
- }
570
- }
571
- }
572
- return classElements;
573
- };
574
- }
575
- })();
576
-
577
- });
578
- require.register("javve-get-attribute/index.js", function(exports, require, module){
579
- /**
580
- * Return the value for `attr` at `element`.
581
- *
582
- * @param {Element} el
583
- * @param {String} attr
584
- * @api public
585
- */
586
-
587
- module.exports = function(el, attr) {
588
- var result = (el.getAttribute && el.getAttribute(attr)) || null;
589
- if( !result ) {
590
- var attrs = el.attributes;
591
- var length = attrs.length;
592
- for(var i = 0; i < length; i++) {
593
- if (attr[i] !== undefined) {
594
- if(attr[i].nodeName === attr) {
595
- result = attr[i].nodeValue;
596
- }
597
- }
598
- }
599
- }
600
- return result;
601
- }
602
- });
603
- require.register("javve-natural-sort/index.js", function(exports, require, module){
604
- /*
605
- * Natural Sort algorithm for Javascript - Version 0.7 - Released under MIT license
606
- * Author: Jim Palmer (based on chunking idea from Dave Koelle)
607
- */
608
-
609
- module.exports = function(a, b, options) {
610
- var re = /(^-?[0-9]+(\.?[0-9]*)[df]?e?[0-9]?$|^0x[0-9a-f]+$|[0-9]+)/gi,
611
- sre = /(^[ ]*|[ ]*$)/g,
612
- dre = /(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,
613
- hre = /^0x[0-9a-f]+$/i,
614
- ore = /^0/,
615
- options = options || {},
616
- i = function(s) { return options.insensitive && (''+s).toLowerCase() || ''+s },
617
- // convert all to strings strip whitespace
618
- x = i(a).replace(sre, '') || '',
619
- y = i(b).replace(sre, '') || '',
620
- // chunk/tokenize
621
- xN = x.replace(re, '\0$1\0').replace(/\0$/,'').replace(/^\0/,'').split('\0'),
622
- yN = y.replace(re, '\0$1\0').replace(/\0$/,'').replace(/^\0/,'').split('\0'),
623
- // numeric, hex or date detection
624
- xD = parseInt(x.match(hre)) || (xN.length != 1 && x.match(dre) && Date.parse(x)),
625
- yD = parseInt(y.match(hre)) || xD && y.match(dre) && Date.parse(y) || null,
626
- oFxNcL, oFyNcL,
627
- mult = options.desc ? -1 : 1;
628
- // first try and sort Hex codes or Dates
629
- if (yD)
630
- if ( xD < yD ) return -1 * mult;
631
- else if ( xD > yD ) return 1 * mult;
632
- // natural sorting through split numeric strings and default strings
633
- for(var cLoc=0, numS=Math.max(xN.length, yN.length); cLoc < numS; cLoc++) {
634
- // find floats not starting with '0', string or 0 if not defined (Clint Priest)
635
- oFxNcL = !(xN[cLoc] || '').match(ore) && parseFloat(xN[cLoc]) || xN[cLoc] || 0;
636
- oFyNcL = !(yN[cLoc] || '').match(ore) && parseFloat(yN[cLoc]) || yN[cLoc] || 0;
637
- // handle numeric vs string comparison - number < string - (Kyle Adams)
638
- if (isNaN(oFxNcL) !== isNaN(oFyNcL)) { return (isNaN(oFxNcL)) ? 1 : -1; }
639
- // rely on string comparison if different types - i.e. '02' < 2 != '02' < '2'
640
- else if (typeof oFxNcL !== typeof oFyNcL) {
641
- oFxNcL += '';
642
- oFyNcL += '';
643
- }
644
- if (oFxNcL < oFyNcL) return -1 * mult;
645
- if (oFxNcL > oFyNcL) return 1 * mult;
646
- }
647
- return 0;
648
- };
649
-
650
- /*
651
- var defaultSort = getSortFunction();
652
-
653
- module.exports = function(a, b, options) {
654
- if (arguments.length == 1) {
655
- options = a;
656
- return getSortFunction(options);
657
- } else {
658
- return defaultSort(a,b);
659
- }
660
- }
661
- */
662
- });
663
- require.register("javve-to-string/index.js", function(exports, require, module){
664
- module.exports = function(s) {
665
- s = (s === undefined) ? "" : s;
666
- s = (s === null) ? "" : s;
667
- s = s.toString();
668
- return s;
669
- };
670
-
671
- });
672
- require.register("component-type/index.js", function(exports, require, module){
673
- /**
674
- * toString ref.
675
- */
676
-
677
- var toString = Object.prototype.toString;
678
-
679
- /**
680
- * Return the type of `val`.
681
- *
682
- * @param {Mixed} val
683
- * @return {String}
684
- * @api public
685
- */
686
-
687
- module.exports = function(val){
688
- switch (toString.call(val)) {
689
- case '[object Date]': return 'date';
690
- case '[object RegExp]': return 'regexp';
691
- case '[object Arguments]': return 'arguments';
692
- case '[object Array]': return 'array';
693
- case '[object Error]': return 'error';
694
- }
695
-
696
- if (val === null) return 'null';
697
- if (val === undefined) return 'undefined';
698
- if (val !== val) return 'nan';
699
- if (val && val.nodeType === 1) return 'element';
700
-
701
- return typeof val.valueOf();
702
- };
703
-
704
- });
705
- require.register("list.js/index.js", function(exports, require, module){
706
- /*
707
- ListJS with beta 1.0.0
708
- By Jonny Strömberg (www.jonnystromberg.com, www.listjs.com)
709
- */
710
- (function( window, undefined ) {
711
- "use strict";
712
-
713
- var document = window.document,
714
- getByClass = require('get-by-class'),
715
- extend = require('extend'),
716
- indexOf = require('indexof');
717
-
718
- var List = function(id, options, values) {
719
-
720
- var self = this,
721
- init,
722
- Item = require('./src/item')(self),
723
- addAsync = require('./src/add-async')(self),
724
- parse = require('./src/parse')(self);
725
-
726
- init = {
727
- start: function() {
728
- self.listClass = "sortable";
729
- self.searchClass = "sort-filter";
730
- self.sortClass = "sort-trigger";
731
- self.page = 200;
732
- self.i = 1;
733
- self.items = [];
734
- self.visibleItems = [];
735
- self.matchingItems = [];
736
- self.searched = false;
737
- self.filtered = false;
738
- self.handlers = { 'updated': [] };
739
- self.plugins = {};
740
- self.helpers = {
741
- getByClass: getByClass,
742
- extend: extend,
743
- indexOf: indexOf
744
- };
745
-
746
- extend(self, options);
747
-
748
- self.listContainer = (typeof(id) === 'string') ? document.getElementById(id) : id;
749
- if (!self.listContainer) { return; }
750
- self.list = getByClass(self.listContainer, self.listClass, true);
751
-
752
- self.templater = require('./src/templater')(self);
753
- self.search = require('./src/search')(self);
754
- self.filter = require('./src/filter')(self);
755
- self.sort = require('./src/sort')(self);
756
-
757
- this.items();
758
- self.update();
759
- this.plugins();
760
- },
761
- items: function() {
762
- parse(self.list);
763
- if (values !== undefined) {
764
- self.add(values);
765
- }
766
- },
767
- plugins: function() {
768
- for (var i = 0; i < self.plugins.length; i++) {
769
- var plugin = self.plugins[i];
770
- self[plugin.name] = plugin;
771
- plugin.init(self);
772
- }
773
- }
774
- };
775
-
776
-
777
- /*
778
- * Add object to list
779
- */
780
- this.add = function(values, callback) {
781
- if (callback) {
782
- addAsync(values, callback);
783
- return;
784
- }
785
- var added = [],
786
- notCreate = false;
787
- if (values[0] === undefined){
788
- values = [values];
789
- }
790
- for (var i = 0, il = values.length; i < il; i++) {
791
- var item = null;
792
- if (values[i] instanceof Item) {
793
- item = values[i];
794
- item.reload();
795
- } else {
796
- notCreate = (self.items.length > self.page) ? true : false;
797
- item = new Item(values[i], undefined, notCreate);
798
- }
799
- self.items.push(item);
800
- added.push(item);
801
- }
802
- self.update();
803
- return added;
804
- };
805
-
806
- this.show = function(i, page) {
807
- this.i = i;
808
- this.page = page;
809
- self.update();
810
- return self;
811
- };
812
-
813
- /* Removes object from list.
814
- * Loops through the list and removes objects where
815
- * property "valuename" === value
816
- */
817
- this.remove = function(valueName, value, options) {
818
- var found = 0;
819
- for (var i = 0, il = self.items.length; i < il; i++) {
820
- if (self.items[i].values()[valueName] == value) {
821
- self.templater.remove(self.items[i], options);
822
- self.items.splice(i,1);
823
- il--;
824
- i--;
825
- found++;
826
- }
827
- }
828
- self.update();
829
- return found;
830
- };
831
-
832
- /* Gets the objects in the list which
833
- * property "valueName" === value
834
- */
835
- this.get = function(valueName, value) {
836
- var matchedItems = [];
837
- for (var i = 0, il = self.items.length; i < il; i++) {
838
- var item = self.items[i];
839
- if (item.values()[valueName] == value) {
840
- matchedItems.push(item);
841
- }
842
- }
843
- return matchedItems;
844
- };
845
-
846
- /*
847
- * Get size of the list
848
- */
849
- this.size = function() {
850
- return self.items.length;
851
- };
852
-
853
- /*
854
- * Removes all items from the list
855
- */
856
- this.clear = function() {
857
- self.templater.clear();
858
- self.items = [];
859
- return self;
860
- };
861
-
862
- this.on = function(event, callback) {
863
- self.handlers[event].push(callback);
864
- return self;
865
- };
866
-
867
- this.off = function(event, callback) {
868
- var e = self.handlers[event];
869
- var index = indexOf(e, callback);
870
- if (index > -1) {
871
- e.splice(index, 1);
872
- }
873
- return self;
874
- };
875
-
876
- this.trigger = function(event) {
877
- var i = self.handlers[event].length;
878
- while(i--) {
879
- self.handlers[event][i](self);
880
- }
881
- return self;
882
- };
883
-
884
- this.reset = {
885
- filter: function() {
886
- var is = self.items,
887
- il = is.length;
888
- while (il--) {
889
- is[il].filtered = false;
890
- }
891
- return self;
892
- },
893
- search: function() {
894
- var is = self.items,
895
- il = is.length;
896
- while (il--) {
897
- is[il].found = false;
898
- }
899
- return self;
900
- }
901
- };
902
-
903
- this.update = function() {
904
- var is = self.items,
905
- il = is.length;
906
-
907
- self.visibleItems = [];
908
- self.matchingItems = [];
909
- self.templater.clear();
910
- for (var i = 0; i < il; i++) {
911
- if (is[i].matching() && ((self.matchingItems.length+1) >= self.i && self.visibleItems.length < self.page)) {
912
- is[i].show();
913
- self.visibleItems.push(is[i]);
914
- self.matchingItems.push(is[i]);
915
- } else if (is[i].matching()) {
916
- self.matchingItems.push(is[i]);
917
- is[i].hide();
918
- } else {
919
- is[i].hide();
920
- }
921
- }
922
- self.trigger('updated');
923
- return self;
924
- };
925
-
926
- init.start();
927
- };
928
-
929
- module.exports = List;
930
-
931
- })(window);
932
-
933
- });
934
- require.register("list.js/src/search.js", function(exports, require, module){
935
- var events = require('events'),
936
- getByClass = require('get-by-class'),
937
- toString = require('to-string');
938
-
939
- module.exports = function(list) {
940
- var item,
941
- text,
942
- columns,
943
- searchString,
944
- customSearch;
945
-
946
- var prepare = {
947
- resetList: function() {
948
- list.i = 1;
949
- list.templater.clear();
950
- customSearch = undefined;
951
- },
952
- setOptions: function(args) {
953
- if (args.length == 2 && args[1] instanceof Array) {
954
- columns = args[1];
955
- } else if (args.length == 2 && typeof(args[1]) == "function") {
956
- customSearch = args[1];
957
- } else if (args.length == 3) {
958
- columns = args[1];
959
- customSearch = args[2];
960
- }
961
- },
962
- setColumns: function() {
963
- columns = (columns === undefined) ? prepare.toArray(list.items[0].values()) : columns;
964
- },
965
- setSearchString: function(s) {
966
- s = toString(s).toLowerCase();
967
- s = s.replace(/[-[\]{}()*+?.,\\^$|#]/g, "\\$&"); // Escape regular expression characters
968
- searchString = s;
969
- },
970
- toArray: function(values) {
971
- var tmpColumn = [];
972
- for (var name in values) {
973
- tmpColumn.push(name);
974
- }
975
- return tmpColumn;
976
- }
977
- };
978
- var search = {
979
- list: function() {
980
- for (var k = 0, kl = list.items.length; k < kl; k++) {
981
- search.item(list.items[k]);
982
- }
983
- },
984
- item: function(item) {
985
- item.found = false;
986
- for (var j = 0, jl = columns.length; j < jl; j++) {
987
- if (search.values(item.values(), columns[j])) {
988
- item.found = true;
989
- return;
990
- }
991
- }
992
- },
993
- values: function(values, column) {
994
- if (values.hasOwnProperty(column)) {
995
- text = toString(values[column]).toLowerCase();
996
- if ((searchString !== "") && (text.search(searchString) > -1)) {
997
- return true;
998
- }
999
- }
1000
- return false;
1001
- },
1002
- reset: function() {
1003
- list.reset.search();
1004
- list.searched = false;
1005
- }
1006
- };
1007
-
1008
- var searchMethod = function(str) {
1009
- list.trigger('searchStart');
1010
-
1011
- prepare.resetList();
1012
- prepare.setSearchString(str);
1013
- prepare.setOptions(arguments); // str, cols|searchFunction, searchFunction
1014
- prepare.setColumns();
1015
-
1016
- if (searchString === "" ) {
1017
- search.reset();
1018
- } else {
1019
- list.searched = true;
1020
- if (customSearch) {
1021
- customSearch(searchString, columns);
1022
- } else {
1023
- search.list();
1024
- }
1025
- }
1026
-
1027
- list.update();
1028
- list.trigger('searchComplete');
1029
- return list.visibleItems;
1030
- };
1031
-
1032
- list.handlers.searchStart = list.handlers.searchStart || [];
1033
- list.handlers.searchComplete = list.handlers.searchComplete || [];
1034
-
1035
- events.bind(getByClass(list.listContainer, list.searchClass), 'keyup', function(e) {
1036
- var target = e.target || e.srcElement; // IE have srcElement
1037
- searchMethod(target.value);
1038
- });
1039
-
1040
- list.helpers.toString = toString;
1041
- return searchMethod;
1042
- };
1043
-
1044
- });
1045
- require.register("list.js/src/sort.js", function(exports, require, module){
1046
- var naturalSort = require('natural-sort'),
1047
- classes = require('classes'),
1048
- events = require('events'),
1049
- getByClass = require('get-by-class'),
1050
- getAttribute = require('get-attribute');
1051
-
1052
- module.exports = function(list) {
1053
- list.sortFunction = list.sortFunction || function(itemA, itemB, options) {
1054
- options.desc = options.order == "desc" ? true : false; // Natural sort uses this format
1055
- return naturalSort(itemA.values()[options.valueName], itemB.values()[options.valueName], options);
1056
- };
1057
-
1058
- var buttons = {
1059
- els: undefined,
1060
- clear: function() {
1061
- for (var i = 0, il = buttons.els.length; i < il; i++) {
1062
- classes(buttons.els[i]).remove('asc');
1063
- classes(buttons.els[i]).remove('desc');
1064
- }
1065
- },
1066
- getOrder: function(btn) {
1067
- var predefinedOrder = getAttribute(btn, 'data-order');
1068
- if (predefinedOrder == "asc" || predefinedOrder == "desc") {
1069
- return predefinedOrder;
1070
- } else if (classes(btn).has('desc')) {
1071
- return "asc";
1072
- } else if (classes(btn).has('asc')) {
1073
- return "desc";
1074
- } else {
1075
- return "asc";
1076
- }
1077
- },
1078
- getInSensitive: function(btn, options) {
1079
- var insensitive = getAttribute(btn, 'data-insensitive');
1080
- if (insensitive === "true") {
1081
- options.insensitive = true;
1082
- } else {
1083
- options.insensitive = false;
1084
- }
1085
- },
1086
- setOrder: function(options) {
1087
- for (var i = 0, il = buttons.els.length; i < il; i++) {
1088
- var btn = buttons.els[i];
1089
- if (getAttribute(btn, 'data-sort') !== options.valueName) {
1090
- continue;
1091
- }
1092
- var predefinedOrder = getAttribute(btn, 'data-order');
1093
- if (predefinedOrder == "asc" || predefinedOrder == "desc") {
1094
- if (predefinedOrder == options.order) {
1095
- classes(btn).add(options.order);
1096
- }
1097
- } else {
1098
- classes(btn).add(options.order);
1099
- }
1100
- }
1101
- }
1102
- };
1103
- var sort = function() {
1104
- list.trigger('sortStart');
1105
- options = {};
1106
-
1107
- var target = arguments[0].currentTarget || arguments[0].srcElement || undefined;
1108
-
1109
- if (target) {
1110
- options.valueName = getAttribute(target, 'data-sort');
1111
- buttons.getInSensitive(target, options);
1112
- options.order = buttons.getOrder(target);
1113
- } else {
1114
- options = arguments[1] || options;
1115
- options.valueName = arguments[0];
1116
- options.order = options.order || "asc";
1117
- options.insensitive = (typeof options.insensitive == "undefined") ? true : options.insensitive;
1118
- }
1119
- buttons.clear();
1120
- buttons.setOrder(options);
1121
-
1122
- options.sortFunction = options.sortFunction || list.sortFunction;
1123
- list.items.sort(function(a, b) {
1124
- return options.sortFunction(a, b, options);
1125
- });
1126
- list.update();
1127
- list.trigger('sortComplete');
1128
- };
1129
-
1130
- // Add handlers
1131
- list.handlers.sortStart = list.handlers.sortStart || [];
1132
- list.handlers.sortComplete = list.handlers.sortComplete || [];
1133
-
1134
- buttons.els = getByClass(list.listContainer, list.sortClass);
1135
- events.bind(buttons.els, 'click', sort);
1136
- list.on('searchStart', buttons.clear);
1137
- list.on('filterStart', buttons.clear);
1138
-
1139
- // Helpers
1140
- list.helpers.classes = classes;
1141
- list.helpers.naturalSort = naturalSort;
1142
- list.helpers.events = events;
1143
- list.helpers.getAttribute = getAttribute;
1144
-
1145
- return sort;
1146
- };
1147
-
1148
- });
1149
- require.register("list.js/src/item.js", function(exports, require, module){
1150
- module.exports = function(list) {
1151
- return function(initValues, element, notCreate) {
1152
- var item = this;
1153
-
1154
- this._values = {};
1155
-
1156
- this.found = false; // Show if list.searched == true and this.found == true
1157
- this.filtered = false;// Show if list.filtered == true and this.filtered == true
1158
-
1159
- var init = function(initValues, element, notCreate) {
1160
- if (element === undefined) {
1161
- if (notCreate) {
1162
- item.values(initValues, notCreate);
1163
- } else {
1164
- item.values(initValues);
1165
- }
1166
- } else {
1167
- item.elm = element;
1168
- var values = list.templater.get(item, initValues);
1169
- item.values(values);
1170
- }
1171
- };
1172
- this.values = function(newValues, notCreate) {
1173
- if (newValues !== undefined) {
1174
- for(var name in newValues) {
1175
- item._values[name] = newValues[name];
1176
- }
1177
- if (notCreate !== true) {
1178
- list.templater.set(item, item.values());
1179
- }
1180
- } else {
1181
- return item._values;
1182
- }
1183
- };
1184
- this.show = function() {
1185
- list.templater.show(item);
1186
- };
1187
- this.hide = function() {
1188
- list.templater.hide(item);
1189
- };
1190
- this.matching = function() {
1191
- return (
1192
- (list.filtered && list.searched && item.found && item.filtered) ||
1193
- (list.filtered && !list.searched && item.filtered) ||
1194
- (!list.filtered && list.searched && item.found) ||
1195
- (!list.filtered && !list.searched)
1196
- );
1197
- };
1198
- this.visible = function() {
1199
- return (item.elm.parentNode == list.list) ? true : false;
1200
- };
1201
- init(initValues, element, notCreate);
1202
- };
1203
- };
1204
-
1205
- });
1206
- require.register("list.js/src/templater.js", function(exports, require, module){
1207
- var getByClass = require('get-by-class');
1208
-
1209
- var Templater = function(list) {
1210
- var itemSource = getItemSource(list.item),
1211
- templater = this;
1212
-
1213
- function getItemSource(item) {
1214
- if (item === undefined) {
1215
- var nodes = list.list.childNodes,
1216
- items = [];
1217
-
1218
- for (var i = 0, il = nodes.length; i < il; i++) {
1219
- // Only textnodes have a data attribute
1220
- if (nodes[i].data === undefined) {
1221
- return nodes[i];
1222
- }
1223
- }
1224
- return null;
1225
- } else if (item.indexOf("<") !== -1) { // Try create html element of list, do not work for tables!!
1226
- var div = document.createElement('div');
1227
- div.innerHTML = item;
1228
- return div.firstChild;
1229
- } else {
1230
- return document.getElementById(list.item);
1231
- }
1232
- }
1233
-
1234
- /* Get values from element */
1235
- this.get = function(item, valueNames) {
1236
- templater.create(item);
1237
- var values = {};
1238
- for(var i = 0, il = valueNames.length; i < il; i++) {
1239
- var elm = getByClass(item.elm, valueNames[i], true);
1240
- values[valueNames[i]] = elm ? elm.innerHTML : "";
1241
- }
1242
- return values;
1243
- };
1244
-
1245
- /* Sets values at element */
1246
- this.set = function(item, values) {
1247
- if (!templater.create(item)) {
1248
- for(var v in values) {
1249
- if (values.hasOwnProperty(v)) {
1250
- // TODO speed up if possible
1251
- var elm = getByClass(item.elm, v, true);
1252
- if (elm) {
1253
- /* src attribute for image tag & text for other tags */
1254
- if (elm.tagName === "IMG" && values[v] !== "") {
1255
- elm.src = values[v];
1256
- } else {
1257
- elm.innerHTML = values[v];
1258
- }
1259
- }
1260
- }
1261
- }
1262
- }
1263
- };
1264
-
1265
- this.create = function(item) {
1266
- if (item.elm !== undefined) {
1267
- return false;
1268
- }
1269
- /* If item source does not exists, use the first item in list as
1270
- source for new items */
1271
- var newItem = itemSource.cloneNode(true);
1272
- newItem.removeAttribute('id');
1273
- item.elm = newItem;
1274
- templater.set(item, item.values());
1275
- return true;
1276
- };
1277
- this.remove = function(item) {
1278
- list.list.removeChild(item.elm);
1279
- };
1280
- this.show = function(item) {
1281
- templater.create(item);
1282
- list.list.appendChild(item.elm);
1283
- };
1284
- this.hide = function(item) {
1285
- if (item.elm !== undefined && item.elm.parentNode === list.list) {
1286
- list.list.removeChild(item.elm);
1287
- }
1288
- };
1289
- this.clear = function() {
1290
- /* .innerHTML = ''; fucks up IE */
1291
- if (list.list.hasChildNodes()) {
1292
- while (list.list.childNodes.length >= 1)
1293
- {
1294
- list.list.removeChild(list.list.firstChild);
1295
- }
1296
- }
1297
- };
1298
- };
1299
-
1300
- module.exports = function(list) {
1301
- return new Templater(list);
1302
- };
1303
-
1304
- });
1305
- require.register("list.js/src/filter.js", function(exports, require, module){
1306
- module.exports = function(list) {
1307
-
1308
- // Add handlers
1309
- list.handlers.filterStart = list.handlers.filterStart || [];
1310
- list.handlers.filterComplete = list.handlers.filterComplete || [];
1311
-
1312
- return function(filterFunction) {
1313
- list.trigger('filterStart');
1314
- list.i = 1; // Reset paging
1315
- list.reset.filter();
1316
- if (filterFunction === undefined) {
1317
- list.filtered = false;
1318
- } else {
1319
- list.filtered = true;
1320
- var is = list.items;
1321
- for (var i = 0, il = is.length; i < il; i++) {
1322
- var item = is[i];
1323
- if (filterFunction(item)) {
1324
- item.filtered = true;
1325
- } else {
1326
- item.filtered = false;
1327
- }
1328
- }
1329
- }
1330
- list.update();
1331
- list.trigger('filterComplete');
1332
- return list.visibleItems;
1333
- };
1334
- };
1335
-
1336
- });
1337
- require.register("list.js/src/add-async.js", function(exports, require, module){
1338
- module.exports = function(list) {
1339
- return function(values, callback, items) {
1340
- var valuesToAdd = values.splice(0, 100);
1341
- items = items || [];
1342
- items = items.concat(list.add(valuesToAdd));
1343
- if (values.length > 0) {
1344
- setTimeout(function() {
1345
- addAsync(values, callback, items);
1346
- }, 10);
1347
- } else {
1348
- list.update();
1349
- callback(items);
1350
- }
1351
- };
1352
- };
1353
- });
1354
- require.register("list.js/src/parse.js", function(exports, require, module){
1355
- module.exports = function(list) {
1356
-
1357
- var Item = require('./item')(list);
1358
-
1359
- var getChildren = function(parent) {
1360
- var nodes = parent.childNodes,
1361
- items = [];
1362
- for (var i = 0, il = nodes.length; i < il; i++) {
1363
- // Only textnodes have a data attribute
1364
- if (nodes[i].data === undefined) {
1365
- items.push(nodes[i]);
1366
- }
1367
- }
1368
- return items;
1369
- };
1370
-
1371
- var parse = function(itemElements, valueNames) {
1372
- for (var i = 0, il = itemElements.length; i < il; i++) {
1373
- list.items.push(new Item(valueNames, itemElements[i]));
1374
- }
1375
- };
1376
- var parseAsync = function(itemElements, valueNames) {
1377
- var itemsToIndex = itemElements.splice(0, 100); // TODO: If < 100 items, what happens in IE etc?
1378
- parse(itemsToIndex, valueNames);
1379
- if (itemElements.length > 0) {
1380
- setTimeout(function() {
1381
- init.items.indexAsync(itemElements, valueNames);
1382
- }, 10);
1383
- } else {
1384
- list.update();
1385
- // TODO: Add indexed callback
1386
- }
1387
- };
1388
-
1389
- return function() {
1390
- var itemsToIndex = getChildren(list.list),
1391
- valueNames = list.valueNames;
1392
-
1393
- if (list.indexAsync) {
1394
- parseAsync(itemsToIndex, valueNames);
1395
- } else {
1396
- parse(itemsToIndex, valueNames);
1397
- }
1398
- };
1399
- };
1400
-
1401
- });
1402
-
1403
- require.alias("component-classes/index.js", "list.js/deps/classes/index.js");
1404
- require.alias("component-classes/index.js", "classes/index.js");
1405
- require.alias("component-indexof/index.js", "component-classes/deps/indexof/index.js");
1406
- require.alias("segmentio-extend/index.js", "list.js/deps/extend/index.js");
1407
- require.alias("segmentio-extend/index.js", "extend/index.js");
1408
- require.alias("component-indexof/index.js", "list.js/deps/indexof/index.js");
1409
- require.alias("component-indexof/index.js", "indexof/index.js");
1410
- require.alias("javve-events/index.js", "list.js/deps/events/index.js");
1411
- require.alias("javve-events/index.js", "events/index.js");
1412
- require.alias("component-event/index.js", "javve-events/deps/event/index.js");
1413
- require.alias("javve-to-array/index.js", "javve-events/deps/to-array/index.js");
1414
- require.alias("javve-get-by-class/index.js", "list.js/deps/get-by-class/index.js");
1415
- require.alias("javve-get-by-class/index.js", "get-by-class/index.js");
1416
- require.alias("javve-get-attribute/index.js", "list.js/deps/get-attribute/index.js");
1417
- require.alias("javve-get-attribute/index.js", "get-attribute/index.js");
1418
- require.alias("javve-natural-sort/index.js", "list.js/deps/natural-sort/index.js");
1419
- require.alias("javve-natural-sort/index.js", "natural-sort/index.js");
1420
- require.alias("javve-to-string/index.js", "list.js/deps/to-string/index.js");
1421
- require.alias("javve-to-string/index.js", "list.js/deps/to-string/index.js");
1422
- require.alias("javve-to-string/index.js", "to-string/index.js");
1423
- require.alias("javve-to-string/index.js", "javve-to-string/index.js");
1424
- require.alias("component-type/index.js", "list.js/deps/type/index.js");
1425
- require.alias("component-type/index.js", "type/index.js");
1426
- if (typeof exports == "object") {
1427
- module.exports = require("list.js");
1428
- } else if (typeof define == "function" && define.amd) {
1429
- define(function(){ return require("list.js"); });
1430
- } else {
1431
- this["List"] = require("list.js");
1432
- }})();