flashgrid-ext 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +48 -0
- data/Rakefile +1 -0
- data/flashgrid-ext.gemspec +23 -0
- data/lib/flashgrid/ext.rb +8 -0
- data/lib/flashgrid/ext/version.rb +5 -0
- data/vendor/assets/javascripts/animate.js +82 -0
- data/vendor/assets/javascripts/calendar.js +6097 -0
- data/vendor/assets/javascripts/carousel.js +196 -0
- data/vendor/assets/javascripts/editor.js +2580 -0
- data/vendor/assets/javascripts/hover.js +84 -0
- data/vendor/assets/javascripts/inline_editor.js +764 -0
- data/vendor/assets/javascripts/input_mask.js +339 -0
- data/vendor/assets/javascripts/scrollspy.js +144 -0
- data/vendor/assets/javascripts/sort.js +1417 -0
- data/vendor/assets/javascripts/time_ago.js +187 -0
- data/vendor/assets/stylesheets/animate.css.scss +2319 -0
- data/vendor/assets/stylesheets/calendar.css.scss +373 -0
- data/vendor/assets/stylesheets/carousel.css.scss +153 -0
- data/vendor/assets/stylesheets/editor.css.scss +355 -0
- data/vendor/assets/stylesheets/inline_editor.css.scss +353 -0
- data/vendor/assets/stylesheets/panel.css.scss +156 -0
- data/vendor/assets/stylesheets/sort.css.scss +25 -0
- metadata +98 -0
@@ -0,0 +1,1417 @@
|
|
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`.
|
319
|
+
*
|
320
|
+
* @param {String} name
|
321
|
+
* @return {ClassList}
|
322
|
+
* @api public
|
323
|
+
*/
|
324
|
+
|
325
|
+
ClassList.prototype.toggle = function(name){
|
326
|
+
// classList
|
327
|
+
if (this.list) {
|
328
|
+
this.list.toggle(name);
|
329
|
+
return this;
|
330
|
+
}
|
331
|
+
|
332
|
+
// fallback
|
333
|
+
if (this.has(name)) {
|
334
|
+
this.remove(name);
|
335
|
+
} else {
|
336
|
+
this.add(name);
|
337
|
+
}
|
338
|
+
return this;
|
339
|
+
};
|
340
|
+
|
341
|
+
/**
|
342
|
+
* Return an array of classes.
|
343
|
+
*
|
344
|
+
* @return {Array}
|
345
|
+
* @api public
|
346
|
+
*/
|
347
|
+
|
348
|
+
ClassList.prototype.array = function(){
|
349
|
+
var str = this.el.className.replace(/^\s+|\s+$/g, '');
|
350
|
+
var arr = str.split(re);
|
351
|
+
if ('' === arr[0]) arr.shift();
|
352
|
+
return arr;
|
353
|
+
};
|
354
|
+
|
355
|
+
/**
|
356
|
+
* Check if class `name` is present.
|
357
|
+
*
|
358
|
+
* @param {String} name
|
359
|
+
* @return {ClassList}
|
360
|
+
* @api public
|
361
|
+
*/
|
362
|
+
|
363
|
+
ClassList.prototype.has =
|
364
|
+
ClassList.prototype.contains = function(name){
|
365
|
+
return this.list
|
366
|
+
? this.list.contains(name)
|
367
|
+
: !! ~index(this.array(), name);
|
368
|
+
};
|
369
|
+
|
370
|
+
});
|
371
|
+
require.register("segmentio-extend/index.js", function(exports, require, module){
|
372
|
+
|
373
|
+
module.exports = function extend (object) {
|
374
|
+
// Takes an unlimited number of extenders.
|
375
|
+
var args = Array.prototype.slice.call(arguments, 1);
|
376
|
+
|
377
|
+
// For each extender, copy their properties on our object.
|
378
|
+
for (var i = 0, source; source = args[i]; i++) {
|
379
|
+
if (!source) continue;
|
380
|
+
for (var property in source) {
|
381
|
+
object[property] = source[property];
|
382
|
+
}
|
383
|
+
}
|
384
|
+
|
385
|
+
return object;
|
386
|
+
};
|
387
|
+
});
|
388
|
+
require.register("component-indexof/index.js", function(exports, require, module){
|
389
|
+
module.exports = function(arr, obj){
|
390
|
+
if (arr.indexOf) return arr.indexOf(obj);
|
391
|
+
for (var i = 0; i < arr.length; ++i) {
|
392
|
+
if (arr[i] === obj) return i;
|
393
|
+
}
|
394
|
+
return -1;
|
395
|
+
};
|
396
|
+
});
|
397
|
+
require.register("component-event/index.js", function(exports, require, module){
|
398
|
+
var bind = window.addEventListener ? 'addEventListener' : 'attachEvent',
|
399
|
+
unbind = window.removeEventListener ? 'removeEventListener' : 'detachEvent',
|
400
|
+
prefix = bind !== 'addEventListener' ? 'on' : '';
|
401
|
+
|
402
|
+
/**
|
403
|
+
* Bind `el` event `type` to `fn`.
|
404
|
+
*
|
405
|
+
* @param {Element} el
|
406
|
+
* @param {String} type
|
407
|
+
* @param {Function} fn
|
408
|
+
* @param {Boolean} capture
|
409
|
+
* @return {Function}
|
410
|
+
* @api public
|
411
|
+
*/
|
412
|
+
|
413
|
+
exports.bind = function(el, type, fn, capture){
|
414
|
+
el[bind](prefix + type, fn, capture || false);
|
415
|
+
return fn;
|
416
|
+
};
|
417
|
+
|
418
|
+
/**
|
419
|
+
* Unbind `el` event `type`'s callback `fn`.
|
420
|
+
*
|
421
|
+
* @param {Element} el
|
422
|
+
* @param {String} type
|
423
|
+
* @param {Function} fn
|
424
|
+
* @param {Boolean} capture
|
425
|
+
* @return {Function}
|
426
|
+
* @api public
|
427
|
+
*/
|
428
|
+
|
429
|
+
exports.unbind = function(el, type, fn, capture){
|
430
|
+
el[unbind](prefix + type, fn, capture || false);
|
431
|
+
return fn;
|
432
|
+
};
|
433
|
+
});
|
434
|
+
require.register("javve-is-collection/index.js", function(exports, require, module){
|
435
|
+
var typeOf = require('type')
|
436
|
+
|
437
|
+
/**
|
438
|
+
* Evaluates _obj_ to determine if it's an array, an array-like collection, or
|
439
|
+
* something else. This is useful when working with the function `arguments`
|
440
|
+
* collection and `HTMLElement` collections.
|
441
|
+
* Note: This implementation doesn't consider elements that are also
|
442
|
+
*
|
443
|
+
*
|
444
|
+
|
445
|
+
collections, such as `<form>` and `<select>`, to be array-like.
|
446
|
+
|
447
|
+
@method test
|
448
|
+
@param {Object} obj Object to test.
|
449
|
+
@return {Number} A number indicating the results of the test:
|
450
|
+
|
451
|
+
* 0: Neither an array nor an array-like collection.
|
452
|
+
* 1: Real array.
|
453
|
+
* 2: Array-like collection.
|
454
|
+
|
455
|
+
@api private
|
456
|
+
**/
|
457
|
+
module.exports = function isCollection(obj) {
|
458
|
+
var type = typeOf(obj)
|
459
|
+
if (type === 'array') return 1
|
460
|
+
switch (type) {
|
461
|
+
case 'arguments': return 2
|
462
|
+
case 'object':
|
463
|
+
if (isNodeList(obj)) return 2
|
464
|
+
try {
|
465
|
+
// indexed, but no tagName (element) or scrollTo/document (window. From DOM.isWindow test which we can't use here),
|
466
|
+
// or functions without apply/call (Safari
|
467
|
+
// HTMLElementCollection bug).
|
468
|
+
if ('length' in obj
|
469
|
+
&& !obj.tagName
|
470
|
+
&& !(obj.scrollTo && obj.document)
|
471
|
+
&& !obj.apply) {
|
472
|
+
return 2
|
473
|
+
}
|
474
|
+
} catch (ex) {}
|
475
|
+
case 'function':
|
476
|
+
if (isNodeList(obj)) return 2
|
477
|
+
try {
|
478
|
+
// indexed, but no tagName (element) or scrollTo/document (window. From DOM.isWindow test which we can't use here),
|
479
|
+
// or functions without apply/call (Safari
|
480
|
+
// HTMLElementCollection bug).
|
481
|
+
if ('length' in obj
|
482
|
+
&& !obj.tagName
|
483
|
+
&& !(obj.scrollTo && obj.document)
|
484
|
+
&& !obj.apply) {
|
485
|
+
return 2
|
486
|
+
}
|
487
|
+
} catch (ex) {}
|
488
|
+
default:
|
489
|
+
return 0
|
490
|
+
}
|
491
|
+
}
|
492
|
+
|
493
|
+
function isNodeList(nodes) {
|
494
|
+
return typeof nodes === 'object'
|
495
|
+
&& /^\[object (NodeList)\]$/.test(Object.prototype.toString.call(nodes))
|
496
|
+
&& nodes.hasOwnProperty('length')
|
497
|
+
&& (nodes.length == 0 || (typeof nodes[0] === "object" && nodes[0].nodeType > 0))
|
498
|
+
}
|
499
|
+
|
500
|
+
|
501
|
+
});
|
502
|
+
require.register("javve-events/index.js", function(exports, require, module){
|
503
|
+
var events = require('event'),
|
504
|
+
isCollection = require('is-collection');
|
505
|
+
|
506
|
+
/**
|
507
|
+
* Bind `el` event `type` to `fn`.
|
508
|
+
*
|
509
|
+
* @param {Element} el, NodeList, HTMLCollection or Array
|
510
|
+
* @param {String} type
|
511
|
+
* @param {Function} fn
|
512
|
+
* @param {Boolean} capture
|
513
|
+
* @api public
|
514
|
+
*/
|
515
|
+
|
516
|
+
exports.bind = function(el, type, fn, capture){
|
517
|
+
if (!isCollection(el)) {
|
518
|
+
events.bind(el, type, fn, capture);
|
519
|
+
} else if ( el && el[0] !== undefined ) {
|
520
|
+
for ( var i = 0; i < el.length; i++ ) {
|
521
|
+
events.bind(el[i], type, fn, capture);
|
522
|
+
}
|
523
|
+
}
|
524
|
+
};
|
525
|
+
|
526
|
+
/**
|
527
|
+
* Unbind `el` event `type`'s callback `fn`.
|
528
|
+
*
|
529
|
+
* @param {Element} el, NodeList, HTMLCollection or Array
|
530
|
+
* @param {String} type
|
531
|
+
* @param {Function} fn
|
532
|
+
* @param {Boolean} capture
|
533
|
+
* @api public
|
534
|
+
*/
|
535
|
+
|
536
|
+
exports.unbind = function(el, type, fn, capture){
|
537
|
+
if (!isCollection(el)) {
|
538
|
+
events.unbind(el, type, fn, capture);
|
539
|
+
} else if ( el && el[0] !== undefined ) {
|
540
|
+
for ( var i = 0; i < el.length; i++ ) {
|
541
|
+
events.unbind(el[i], type, fn, capture);
|
542
|
+
}
|
543
|
+
}
|
544
|
+
};
|
545
|
+
});
|
546
|
+
require.register("javve-get-by-class/index.js", function(exports, require, module){
|
547
|
+
/**
|
548
|
+
* Find all elements with class `className` inside `container`.
|
549
|
+
* Use `single = true` to increase performance in older browsers
|
550
|
+
* when only one element is needed.
|
551
|
+
*
|
552
|
+
* @param {String} className
|
553
|
+
* @param {Element} container
|
554
|
+
* @param {Boolean} single
|
555
|
+
* @api public
|
556
|
+
*/
|
557
|
+
|
558
|
+
module.exports = (function() {
|
559
|
+
if (document.getElementsByClassName) {
|
560
|
+
return function(container, className, single) {
|
561
|
+
if (single) {
|
562
|
+
return container.getElementsByClassName(className)[0];
|
563
|
+
} else {
|
564
|
+
return container.getElementsByClassName(className);
|
565
|
+
}
|
566
|
+
};
|
567
|
+
} else if (document.querySelector) {
|
568
|
+
return function(container, className, single) {
|
569
|
+
className = '.' + className;
|
570
|
+
if (single) {
|
571
|
+
return container.querySelector(className);
|
572
|
+
} else {
|
573
|
+
return container.querySelectorAll(className);
|
574
|
+
}
|
575
|
+
};
|
576
|
+
} else {
|
577
|
+
return function(container, className, single) {
|
578
|
+
var classElements = [],
|
579
|
+
tag = '*';
|
580
|
+
if (container == null) {
|
581
|
+
container = document;
|
582
|
+
}
|
583
|
+
var els = container.getElementsByTagName(tag);
|
584
|
+
var elsLen = els.length;
|
585
|
+
var pattern = new RegExp("(^|\\s)"+className+"(\\s|$)");
|
586
|
+
for (var i = 0, j = 0; i < elsLen; i++) {
|
587
|
+
if ( pattern.test(els[i].className) ) {
|
588
|
+
if (single) {
|
589
|
+
return els[i];
|
590
|
+
} else {
|
591
|
+
classElements[j] = els[i];
|
592
|
+
j++;
|
593
|
+
}
|
594
|
+
}
|
595
|
+
}
|
596
|
+
return classElements;
|
597
|
+
};
|
598
|
+
}
|
599
|
+
})();
|
600
|
+
|
601
|
+
});
|
602
|
+
require.register("javve-get-attribute/index.js", function(exports, require, module){
|
603
|
+
/**
|
604
|
+
* Return the value for `attr` at `element`.
|
605
|
+
*
|
606
|
+
* @param {Element} el
|
607
|
+
* @param {String} attr
|
608
|
+
* @api public
|
609
|
+
*/
|
610
|
+
|
611
|
+
module.exports = function(el, attr) {
|
612
|
+
var result = (el.getAttribute && el.getAttribute(attr)) || null;
|
613
|
+
if( !result ) {
|
614
|
+
var attrs = el.attributes;
|
615
|
+
var length = attrs.length;
|
616
|
+
for(var i = 0; i < length; i++) {
|
617
|
+
if (attr[i] !== undefined) {
|
618
|
+
if(attr[i].nodeName === attr) {
|
619
|
+
result = attr[i].nodeValue;
|
620
|
+
}
|
621
|
+
}
|
622
|
+
}
|
623
|
+
}
|
624
|
+
return result;
|
625
|
+
}
|
626
|
+
});
|
627
|
+
require.register("javve-natural-sort/index.js", function(exports, require, module){
|
628
|
+
/*
|
629
|
+
* Natural Sort algorithm for Javascript - Version 0.7 - Released under MIT license
|
630
|
+
* Author: Jim Palmer (based on chunking idea from Dave Koelle)
|
631
|
+
*/
|
632
|
+
|
633
|
+
module.exports = function(a, b, options) {
|
634
|
+
var re = /(^-?[0-9]+(\.?[0-9]*)[df]?e?[0-9]?$|^0x[0-9a-f]+$|[0-9]+)/gi,
|
635
|
+
sre = /(^[ ]*|[ ]*$)/g,
|
636
|
+
dre = /(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,
|
637
|
+
hre = /^0x[0-9a-f]+$/i,
|
638
|
+
ore = /^0/,
|
639
|
+
options = options || {},
|
640
|
+
i = function(s) { return options.insensitive && (''+s).toLowerCase() || ''+s },
|
641
|
+
// convert all to strings strip whitespace
|
642
|
+
x = i(a).replace(sre, '') || '',
|
643
|
+
y = i(b).replace(sre, '') || '',
|
644
|
+
// chunk/tokenize
|
645
|
+
xN = x.replace(re, '\0$1\0').replace(/\0$/,'').replace(/^\0/,'').split('\0'),
|
646
|
+
yN = y.replace(re, '\0$1\0').replace(/\0$/,'').replace(/^\0/,'').split('\0'),
|
647
|
+
// numeric, hex or date detection
|
648
|
+
xD = parseInt(x.match(hre)) || (xN.length != 1 && x.match(dre) && Date.parse(x)),
|
649
|
+
yD = parseInt(y.match(hre)) || xD && y.match(dre) && Date.parse(y) || null,
|
650
|
+
oFxNcL, oFyNcL,
|
651
|
+
mult = options.desc ? -1 : 1;
|
652
|
+
// first try and sort Hex codes or Dates
|
653
|
+
if (yD)
|
654
|
+
if ( xD < yD ) return -1 * mult;
|
655
|
+
else if ( xD > yD ) return 1 * mult;
|
656
|
+
// natural sorting through split numeric strings and default strings
|
657
|
+
for(var cLoc=0, numS=Math.max(xN.length, yN.length); cLoc < numS; cLoc++) {
|
658
|
+
// find floats not starting with '0', string or 0 if not defined (Clint Priest)
|
659
|
+
oFxNcL = !(xN[cLoc] || '').match(ore) && parseFloat(xN[cLoc]) || xN[cLoc] || 0;
|
660
|
+
oFyNcL = !(yN[cLoc] || '').match(ore) && parseFloat(yN[cLoc]) || yN[cLoc] || 0;
|
661
|
+
// handle numeric vs string comparison - number < string - (Kyle Adams)
|
662
|
+
if (isNaN(oFxNcL) !== isNaN(oFyNcL)) { return (isNaN(oFxNcL)) ? 1 : -1; }
|
663
|
+
// rely on string comparison if different types - i.e. '02' < 2 != '02' < '2'
|
664
|
+
else if (typeof oFxNcL !== typeof oFyNcL) {
|
665
|
+
oFxNcL += '';
|
666
|
+
oFyNcL += '';
|
667
|
+
}
|
668
|
+
if (oFxNcL < oFyNcL) return -1 * mult;
|
669
|
+
if (oFxNcL > oFyNcL) return 1 * mult;
|
670
|
+
}
|
671
|
+
return 0;
|
672
|
+
};
|
673
|
+
|
674
|
+
/*
|
675
|
+
var defaultSort = getSortFunction();
|
676
|
+
|
677
|
+
module.exports = function(a, b, options) {
|
678
|
+
if (arguments.length == 1) {
|
679
|
+
options = a;
|
680
|
+
return getSortFunction(options);
|
681
|
+
} else {
|
682
|
+
return defaultSort(a,b);
|
683
|
+
}
|
684
|
+
}
|
685
|
+
*/
|
686
|
+
});
|
687
|
+
require.register("javve-to-string/index.js", function(exports, require, module){
|
688
|
+
module.exports = function(s) {
|
689
|
+
s = (s === undefined) ? "" : s;
|
690
|
+
s = (s === null) ? "" : s;
|
691
|
+
s = s.toString();
|
692
|
+
return s;
|
693
|
+
};
|
694
|
+
|
695
|
+
});
|
696
|
+
require.register("component-type/index.js", function(exports, require, module){
|
697
|
+
/**
|
698
|
+
* toString ref.
|
699
|
+
*/
|
700
|
+
|
701
|
+
var toString = Object.prototype.toString;
|
702
|
+
|
703
|
+
/**
|
704
|
+
* Return the type of `val`.
|
705
|
+
*
|
706
|
+
* @param {Mixed} val
|
707
|
+
* @return {String}
|
708
|
+
* @api public
|
709
|
+
*/
|
710
|
+
|
711
|
+
module.exports = function(val){
|
712
|
+
switch (toString.call(val)) {
|
713
|
+
case '[object Date]': return 'date';
|
714
|
+
case '[object RegExp]': return 'regexp';
|
715
|
+
case '[object Arguments]': return 'arguments';
|
716
|
+
case '[object Array]': return 'array';
|
717
|
+
}
|
718
|
+
|
719
|
+
if (val === null) return 'null';
|
720
|
+
if (val === undefined) return 'undefined';
|
721
|
+
if (val && val.nodeType === 1) return 'element';
|
722
|
+
|
723
|
+
return typeof val.valueOf();
|
724
|
+
};
|
725
|
+
|
726
|
+
});
|
727
|
+
require.register("list.js/index.js", function(exports, require, module){
|
728
|
+
/*
|
729
|
+
ListJS with beta 1.0.0
|
730
|
+
By Jonny Strömberg (www.jonnystromberg.com, www.listjs.com)
|
731
|
+
*/
|
732
|
+
(function( window, undefined ) {
|
733
|
+
"use strict";
|
734
|
+
|
735
|
+
var document = window.document,
|
736
|
+
events = require('events'),
|
737
|
+
getByClass = require('get-by-class'),
|
738
|
+
extend = require('extend'),
|
739
|
+
indexOf = require('indexof');
|
740
|
+
|
741
|
+
var List = function(id, options, values) {
|
742
|
+
|
743
|
+
var self = this,
|
744
|
+
init,
|
745
|
+
Item = require('./src/item')(self),
|
746
|
+
addAsync = require('./src/add-async')(self),
|
747
|
+
parse = require('./src/parse')(self);
|
748
|
+
|
749
|
+
this.listClass = "sort";
|
750
|
+
this.searchClass = "sort-filter";
|
751
|
+
this.sortClass = "sort-trigger";
|
752
|
+
this.page = 200;
|
753
|
+
this.i = 1;
|
754
|
+
this.items = [];
|
755
|
+
this.visibleItems = [];
|
756
|
+
this.matchingItems = [];
|
757
|
+
this.searched = false;
|
758
|
+
this.filtered = false;
|
759
|
+
this.handlers = { 'updated': [] };
|
760
|
+
this.plugins = {};
|
761
|
+
|
762
|
+
extend(this, options);
|
763
|
+
|
764
|
+
this.listContainer = (typeof(id) === 'string') ? document.getElementById(id) : id;
|
765
|
+
if (!this.listContainer) { return; }
|
766
|
+
this.list = getByClass(this.listContainer, this.listClass, true);
|
767
|
+
|
768
|
+
this.templater = require('./src/templater')(self);
|
769
|
+
this.sort = require('./src/sort')(self);
|
770
|
+
this.search = require('./src/search')(self);
|
771
|
+
this.filter = require('./src/filter')(self);
|
772
|
+
|
773
|
+
init = {
|
774
|
+
start: function(values) {
|
775
|
+
parse(self.list);
|
776
|
+
if (values !== undefined) {
|
777
|
+
self.add(values);
|
778
|
+
}
|
779
|
+
self.update();
|
780
|
+
this.plugins();
|
781
|
+
},
|
782
|
+
plugins: function() {
|
783
|
+
for (var i = 0; i < self.plugins.length; i++) {
|
784
|
+
var plugin = self.plugins[i];
|
785
|
+
self[plugin.name] = plugin;
|
786
|
+
plugin.init(self);
|
787
|
+
}
|
788
|
+
}
|
789
|
+
};
|
790
|
+
|
791
|
+
|
792
|
+
/*
|
793
|
+
* Add object to list
|
794
|
+
*/
|
795
|
+
this.add = function(values, callback) {
|
796
|
+
if (callback) {
|
797
|
+
addAsync(values, callback);
|
798
|
+
return;
|
799
|
+
}
|
800
|
+
var added = [],
|
801
|
+
notCreate = false;
|
802
|
+
if (values[0] === undefined){
|
803
|
+
values = [values];
|
804
|
+
}
|
805
|
+
for (var i = 0, il = values.length; i < il; i++) {
|
806
|
+
var item = null;
|
807
|
+
if (values[i] instanceof Item) {
|
808
|
+
item = values[i];
|
809
|
+
item.reload();
|
810
|
+
} else {
|
811
|
+
notCreate = (self.items.length > self.page) ? true : false;
|
812
|
+
item = new Item(values[i], undefined, notCreate);
|
813
|
+
}
|
814
|
+
self.items.push(item);
|
815
|
+
added.push(item);
|
816
|
+
}
|
817
|
+
self.update();
|
818
|
+
return added;
|
819
|
+
};
|
820
|
+
|
821
|
+
this.show = function(i, page) {
|
822
|
+
this.i = i;
|
823
|
+
this.page = page;
|
824
|
+
self.update();
|
825
|
+
return self;
|
826
|
+
};
|
827
|
+
|
828
|
+
/* Removes object from list.
|
829
|
+
* Loops through the list and removes objects where
|
830
|
+
* property "valuename" === value
|
831
|
+
*/
|
832
|
+
this.remove = function(valueName, value, options) {
|
833
|
+
var found = 0;
|
834
|
+
for (var i = 0, il = self.items.length; i < il; i++) {
|
835
|
+
if (self.items[i].values()[valueName] == value) {
|
836
|
+
self.templater.remove(self.items[i], options);
|
837
|
+
self.items.splice(i,1);
|
838
|
+
il--;
|
839
|
+
i--;
|
840
|
+
found++;
|
841
|
+
}
|
842
|
+
}
|
843
|
+
self.update();
|
844
|
+
return found;
|
845
|
+
};
|
846
|
+
|
847
|
+
/* Gets the objects in the list which
|
848
|
+
* property "valueName" === value
|
849
|
+
*/
|
850
|
+
this.get = function(valueName, value) {
|
851
|
+
var matchedItems = [];
|
852
|
+
for (var i = 0, il = self.items.length; i < il; i++) {
|
853
|
+
var item = self.items[i];
|
854
|
+
if (item.values()[valueName] == value) {
|
855
|
+
matchedItems.push(item);
|
856
|
+
}
|
857
|
+
}
|
858
|
+
return matchedItems;
|
859
|
+
};
|
860
|
+
|
861
|
+
/*
|
862
|
+
* Get size of the list
|
863
|
+
*/
|
864
|
+
this.size = function() {
|
865
|
+
return self.items.length;
|
866
|
+
};
|
867
|
+
|
868
|
+
/*
|
869
|
+
* Removes all items from the list
|
870
|
+
*/
|
871
|
+
this.clear = function() {
|
872
|
+
self.templater.clear();
|
873
|
+
self.items = [];
|
874
|
+
return self;
|
875
|
+
};
|
876
|
+
|
877
|
+
this.on = function(event, callback) {
|
878
|
+
self.handlers[event].push(callback);
|
879
|
+
return self;
|
880
|
+
};
|
881
|
+
|
882
|
+
this.off = function(event, callback) {
|
883
|
+
var e = self.handlers[event];
|
884
|
+
var index = indexOf(e, callback);
|
885
|
+
if (index > -1) {
|
886
|
+
e.splice(index, 1);
|
887
|
+
}
|
888
|
+
return self;
|
889
|
+
};
|
890
|
+
|
891
|
+
this.trigger = function(event) {
|
892
|
+
var i = self.handlers[event].length;
|
893
|
+
while(i--) {
|
894
|
+
self.handlers[event][i](self);
|
895
|
+
}
|
896
|
+
return self;
|
897
|
+
};
|
898
|
+
|
899
|
+
this.reset = {
|
900
|
+
filter: function() {
|
901
|
+
var is = self.items,
|
902
|
+
il = is.length;
|
903
|
+
while (il--) {
|
904
|
+
is[il].filtered = false;
|
905
|
+
}
|
906
|
+
return self;
|
907
|
+
},
|
908
|
+
search: function() {
|
909
|
+
var is = self.items,
|
910
|
+
il = is.length;
|
911
|
+
while (il--) {
|
912
|
+
is[il].found = false;
|
913
|
+
}
|
914
|
+
return self;
|
915
|
+
}
|
916
|
+
};
|
917
|
+
|
918
|
+
this.update = function() {
|
919
|
+
var is = self.items,
|
920
|
+
il = is.length;
|
921
|
+
|
922
|
+
self.visibleItems = [];
|
923
|
+
self.matchingItems = [];
|
924
|
+
self.templater.clear();
|
925
|
+
for (var i = 0; i < il; i++) {
|
926
|
+
if (is[i].matching() && ((self.matchingItems.length+1) >= self.i && self.visibleItems.length < self.page)) {
|
927
|
+
is[i].show();
|
928
|
+
self.visibleItems.push(is[i]);
|
929
|
+
self.matchingItems.push(is[i]);
|
930
|
+
} else if (is[i].matching()) {
|
931
|
+
self.matchingItems.push(is[i]);
|
932
|
+
is[i].hide();
|
933
|
+
} else {
|
934
|
+
is[i].hide();
|
935
|
+
}
|
936
|
+
}
|
937
|
+
self.trigger('updated');
|
938
|
+
return self;
|
939
|
+
};
|
940
|
+
|
941
|
+
init.start(values);
|
942
|
+
};
|
943
|
+
|
944
|
+
module.exports = List;
|
945
|
+
|
946
|
+
})(window);
|
947
|
+
|
948
|
+
});
|
949
|
+
require.register("list.js/src/search.js", function(exports, require, module){
|
950
|
+
var events = require('events'),
|
951
|
+
getByClass = require('get-by-class'),
|
952
|
+
toString = require('to-string');
|
953
|
+
|
954
|
+
module.exports = function(list) {
|
955
|
+
var item,
|
956
|
+
text,
|
957
|
+
columns,
|
958
|
+
searchString,
|
959
|
+
customSearch;
|
960
|
+
|
961
|
+
var prepare = {
|
962
|
+
resetList: function() {
|
963
|
+
list.i = 1;
|
964
|
+
list.templater.clear();
|
965
|
+
customSearch = undefined;
|
966
|
+
},
|
967
|
+
setOptions: function(args) {
|
968
|
+
if (args.length == 2 && args[1] instanceof Array) {
|
969
|
+
columns = args[1];
|
970
|
+
} else if (args.length == 2 && typeof(args[1]) == "function") {
|
971
|
+
customSearch = args[1];
|
972
|
+
} else if (args.length == 3) {
|
973
|
+
columns = args[1];
|
974
|
+
customSearch = args[2];
|
975
|
+
}
|
976
|
+
},
|
977
|
+
setColumns: function() {
|
978
|
+
columns = (columns === undefined) ? prepare.toArray(list.items[0].values()) : columns;
|
979
|
+
},
|
980
|
+
setSearchString: function(s) {
|
981
|
+
s = toString(s).toLowerCase();
|
982
|
+
s = s.replace(/[-[\]{}()*+?.,\\^$|#]/g, "\\$&"); // Escape regular expression characters
|
983
|
+
searchString = s;
|
984
|
+
},
|
985
|
+
toArray: function(values) {
|
986
|
+
var tmpColumn = [];
|
987
|
+
for (var name in values) {
|
988
|
+
tmpColumn.push(name);
|
989
|
+
}
|
990
|
+
return tmpColumn;
|
991
|
+
}
|
992
|
+
};
|
993
|
+
var search = {
|
994
|
+
list: function() {
|
995
|
+
for (var k = 0, kl = list.items.length; k < kl; k++) {
|
996
|
+
search.item(list.items[k]);
|
997
|
+
}
|
998
|
+
},
|
999
|
+
item: function(item) {
|
1000
|
+
item.found = false;
|
1001
|
+
for (var j = 0, jl = columns.length; j < jl; j++) {
|
1002
|
+
if (search.values(item.values(), columns[j])) {
|
1003
|
+
item.found = true;
|
1004
|
+
return;
|
1005
|
+
}
|
1006
|
+
}
|
1007
|
+
},
|
1008
|
+
values: function(values, column) {
|
1009
|
+
if (values.hasOwnProperty(column)) {
|
1010
|
+
text = toString(values[column]).toLowerCase();
|
1011
|
+
if ((searchString !== "") && (text.search(searchString) > -1)) {
|
1012
|
+
return true;
|
1013
|
+
}
|
1014
|
+
}
|
1015
|
+
return false;
|
1016
|
+
},
|
1017
|
+
reset: function() {
|
1018
|
+
list.reset.search();
|
1019
|
+
list.searched = false;
|
1020
|
+
}
|
1021
|
+
};
|
1022
|
+
|
1023
|
+
var searchMethod = function(str) {
|
1024
|
+
list.trigger('searchStart');
|
1025
|
+
|
1026
|
+
prepare.resetList();
|
1027
|
+
prepare.setSearchString(str);
|
1028
|
+
prepare.setOptions(arguments); // str, cols|searchFunction, searchFunction
|
1029
|
+
prepare.setColumns();
|
1030
|
+
|
1031
|
+
if (searchString === "" ) {
|
1032
|
+
search.reset();
|
1033
|
+
} else {
|
1034
|
+
list.searched = true;
|
1035
|
+
if (customSearch) {
|
1036
|
+
customSearch(searchString, columns);
|
1037
|
+
} else {
|
1038
|
+
search.list();
|
1039
|
+
}
|
1040
|
+
}
|
1041
|
+
|
1042
|
+
list.update();
|
1043
|
+
list.trigger('searchComplete');
|
1044
|
+
return list.visibleItems;
|
1045
|
+
};
|
1046
|
+
|
1047
|
+
list.handlers.searchStart = list.handlers.searchStart || [];
|
1048
|
+
list.handlers.searchComplete = list.handlers.searchComplete || [];
|
1049
|
+
|
1050
|
+
events.bind(getByClass(list.listContainer, list.searchClass), 'keyup', function(e) {
|
1051
|
+
var target = e.target || e.srcElement; // IE have srcElement
|
1052
|
+
searchMethod(target.value);
|
1053
|
+
});
|
1054
|
+
|
1055
|
+
return searchMethod;
|
1056
|
+
};
|
1057
|
+
|
1058
|
+
});
|
1059
|
+
require.register("list.js/src/sort.js", function(exports, require, module){
|
1060
|
+
var naturalSort = require('natural-sort'),
|
1061
|
+
classes = require('classes'),
|
1062
|
+
events = require('events'),
|
1063
|
+
getByClass = require('get-by-class'),
|
1064
|
+
getAttribute = require('get-attribute'),
|
1065
|
+
sortButtons;
|
1066
|
+
|
1067
|
+
var clearPreviousSorting = function() {
|
1068
|
+
for (var i = 0, il = sortButtons.length; i < il; i++) {
|
1069
|
+
classes(sortButtons[i]).remove('asc');
|
1070
|
+
classes(sortButtons[i]).remove('desc');
|
1071
|
+
}
|
1072
|
+
};
|
1073
|
+
|
1074
|
+
module.exports = function(list) {
|
1075
|
+
var sort = function() {
|
1076
|
+
var options = {},
|
1077
|
+
valueName;
|
1078
|
+
|
1079
|
+
if (arguments[0].currentTarget || arguments[0].srcElement) {
|
1080
|
+
var e = arguments[0],
|
1081
|
+
target = e.currentTarget || e.srcElement,
|
1082
|
+
newSortingOrder;
|
1083
|
+
|
1084
|
+
valueName = getAttribute(target, 'data-sort');
|
1085
|
+
|
1086
|
+
if (classes(target).has('desc')) {
|
1087
|
+
options.desc = false;
|
1088
|
+
newSortingOrder = 'asc';
|
1089
|
+
} else if (classes(target).has('asc')) {
|
1090
|
+
options.desc = true;
|
1091
|
+
newSortingOrder = 'desc';
|
1092
|
+
} else {
|
1093
|
+
options.desc = false;
|
1094
|
+
newSortingOrder = 'asc';
|
1095
|
+
}
|
1096
|
+
clearPreviousSorting();
|
1097
|
+
classes(target).add(newSortingOrder);
|
1098
|
+
} else {
|
1099
|
+
valueName = arguments[0];
|
1100
|
+
options = arguments[1] || options;
|
1101
|
+
}
|
1102
|
+
|
1103
|
+
options.insensitive = (typeof options.insensitive == "undefined") ? true : options.insensitive;
|
1104
|
+
options.sortFunction = options.sortFunction || function(a, b) {
|
1105
|
+
return naturalSort(a.values()[valueName], b.values()[valueName], options);
|
1106
|
+
};
|
1107
|
+
|
1108
|
+
list.trigger('sortStart');
|
1109
|
+
list.items.sort(options.sortFunction);
|
1110
|
+
list.update();
|
1111
|
+
list.trigger('sortComplete');
|
1112
|
+
};
|
1113
|
+
|
1114
|
+
// Add handlers
|
1115
|
+
list.handlers.sortStart = list.handlers.sortStart || [];
|
1116
|
+
list.handlers.sortComplete = list.handlers.sortComplete || [];
|
1117
|
+
|
1118
|
+
sortButtons = getByClass(list.listContainer, list.sortClass);
|
1119
|
+
events.bind(sortButtons, 'click', sort);
|
1120
|
+
|
1121
|
+
return sort;
|
1122
|
+
};
|
1123
|
+
|
1124
|
+
});
|
1125
|
+
require.register("list.js/src/item.js", function(exports, require, module){
|
1126
|
+
module.exports = function(list) {
|
1127
|
+
return function(initValues, element, notCreate) {
|
1128
|
+
var item = this;
|
1129
|
+
|
1130
|
+
this._values = {};
|
1131
|
+
|
1132
|
+
this.found = false; // Show if list.searched == true and this.found == true
|
1133
|
+
this.filtered = false;// Show if list.filtered == true and this.filtered == true
|
1134
|
+
|
1135
|
+
var init = function(initValues, element, notCreate) {
|
1136
|
+
if (element === undefined) {
|
1137
|
+
if (notCreate) {
|
1138
|
+
item.values(initValues, notCreate);
|
1139
|
+
} else {
|
1140
|
+
item.values(initValues);
|
1141
|
+
}
|
1142
|
+
} else {
|
1143
|
+
item.elm = element;
|
1144
|
+
var values = list.templater.get(item, initValues);
|
1145
|
+
item.values(values);
|
1146
|
+
}
|
1147
|
+
};
|
1148
|
+
this.values = function(newValues, notCreate) {
|
1149
|
+
if (newValues !== undefined) {
|
1150
|
+
for(var name in newValues) {
|
1151
|
+
item._values[name] = newValues[name];
|
1152
|
+
}
|
1153
|
+
if (notCreate !== true) {
|
1154
|
+
list.templater.set(item, item.values());
|
1155
|
+
}
|
1156
|
+
} else {
|
1157
|
+
return item._values;
|
1158
|
+
}
|
1159
|
+
};
|
1160
|
+
this.show = function() {
|
1161
|
+
list.templater.show(item);
|
1162
|
+
};
|
1163
|
+
this.hide = function() {
|
1164
|
+
list.templater.hide(item);
|
1165
|
+
};
|
1166
|
+
this.matching = function() {
|
1167
|
+
return (
|
1168
|
+
(list.filtered && list.searched && item.found && item.filtered) ||
|
1169
|
+
(list.filtered && !list.searched && item.filtered) ||
|
1170
|
+
(!list.filtered && list.searched && item.found) ||
|
1171
|
+
(!list.filtered && !list.searched)
|
1172
|
+
);
|
1173
|
+
};
|
1174
|
+
this.visible = function() {
|
1175
|
+
return (item.elm.parentNode == list.list) ? true : false;
|
1176
|
+
};
|
1177
|
+
init(initValues, element, notCreate);
|
1178
|
+
};
|
1179
|
+
};
|
1180
|
+
|
1181
|
+
});
|
1182
|
+
require.register("list.js/src/templater.js", function(exports, require, module){
|
1183
|
+
var getByClass = require('get-by-class');
|
1184
|
+
|
1185
|
+
var Templater = function(list) {
|
1186
|
+
var itemSource = getItemSource(list.item),
|
1187
|
+
templater = this;
|
1188
|
+
|
1189
|
+
function getItemSource(item) {
|
1190
|
+
if (item === undefined) {
|
1191
|
+
var nodes = list.list.childNodes,
|
1192
|
+
items = [];
|
1193
|
+
|
1194
|
+
for (var i = 0, il = nodes.length; i < il; i++) {
|
1195
|
+
// Only textnodes have a data attribute
|
1196
|
+
if (nodes[i].data === undefined) {
|
1197
|
+
return nodes[i];
|
1198
|
+
}
|
1199
|
+
}
|
1200
|
+
return null;
|
1201
|
+
} else if (item.indexOf("<") !== -1) { // Try create html element of list, do not work for tables!!
|
1202
|
+
var div = document.createElement('div');
|
1203
|
+
div.innerHTML = item;
|
1204
|
+
return div.firstChild;
|
1205
|
+
} else {
|
1206
|
+
return document.getElementById(list.item);
|
1207
|
+
}
|
1208
|
+
}
|
1209
|
+
|
1210
|
+
/* Get values from element */
|
1211
|
+
this.get = function(item, valueNames) {
|
1212
|
+
templater.create(item);
|
1213
|
+
var values = {};
|
1214
|
+
for(var i = 0, il = valueNames.length; i < il; i++) {
|
1215
|
+
var elm = getByClass(item.elm, valueNames[i], true);
|
1216
|
+
values[valueNames[i]] = elm ? elm.innerHTML : "";
|
1217
|
+
}
|
1218
|
+
return values;
|
1219
|
+
};
|
1220
|
+
|
1221
|
+
/* Sets values at element */
|
1222
|
+
this.set = function(item, values) {
|
1223
|
+
if (!templater.create(item)) {
|
1224
|
+
for(var v in values) {
|
1225
|
+
if (values.hasOwnProperty(v)) {
|
1226
|
+
// TODO speed up if possible
|
1227
|
+
var elm = getByClass(item.elm, v, true);
|
1228
|
+
if (elm) {
|
1229
|
+
/* src attribute for image tag & text for other tags */
|
1230
|
+
if (elm.tagName === "IMG" && values[v] !== "") {
|
1231
|
+
elm.src = values[v];
|
1232
|
+
} else {
|
1233
|
+
elm.innerHTML = values[v];
|
1234
|
+
}
|
1235
|
+
}
|
1236
|
+
}
|
1237
|
+
}
|
1238
|
+
}
|
1239
|
+
};
|
1240
|
+
|
1241
|
+
this.create = function(item) {
|
1242
|
+
if (item.elm !== undefined) {
|
1243
|
+
return false;
|
1244
|
+
}
|
1245
|
+
/* If item source does not exists, use the first item in list as
|
1246
|
+
source for new items */
|
1247
|
+
var newItem = itemSource.cloneNode(true);
|
1248
|
+
newItem.removeAttribute('id');
|
1249
|
+
item.elm = newItem;
|
1250
|
+
templater.set(item, item.values());
|
1251
|
+
return true;
|
1252
|
+
};
|
1253
|
+
this.remove = function(item) {
|
1254
|
+
list.list.removeChild(item.elm);
|
1255
|
+
};
|
1256
|
+
this.show = function(item) {
|
1257
|
+
templater.create(item);
|
1258
|
+
list.list.appendChild(item.elm);
|
1259
|
+
};
|
1260
|
+
this.hide = function(item) {
|
1261
|
+
if (item.elm !== undefined && item.elm.parentNode === list.list) {
|
1262
|
+
list.list.removeChild(item.elm);
|
1263
|
+
}
|
1264
|
+
};
|
1265
|
+
this.clear = function() {
|
1266
|
+
/* .innerHTML = ''; fucks up IE */
|
1267
|
+
if (list.list.hasChildNodes()) {
|
1268
|
+
while (list.list.childNodes.length >= 1)
|
1269
|
+
{
|
1270
|
+
list.list.removeChild(list.list.firstChild);
|
1271
|
+
}
|
1272
|
+
}
|
1273
|
+
};
|
1274
|
+
};
|
1275
|
+
|
1276
|
+
module.exports = function(list) {
|
1277
|
+
return new Templater(list);
|
1278
|
+
};
|
1279
|
+
|
1280
|
+
});
|
1281
|
+
require.register("list.js/src/filter.js", function(exports, require, module){
|
1282
|
+
module.exports = function(list) {
|
1283
|
+
|
1284
|
+
// Add handlers
|
1285
|
+
list.handlers.filterStart = list.handlers.filterStart || [];
|
1286
|
+
list.handlers.filterComplete = list.handlers.filterComplete || [];
|
1287
|
+
|
1288
|
+
return function(filterFunction) {
|
1289
|
+
list.trigger('filterStart');
|
1290
|
+
list.i = 1; // Reset paging
|
1291
|
+
list.reset.filter();
|
1292
|
+
if (filterFunction === undefined) {
|
1293
|
+
list.filtered = false;
|
1294
|
+
} else {
|
1295
|
+
list.filtered = true;
|
1296
|
+
var is = list.items;
|
1297
|
+
for (var i = 0, il = is.length; i < il; i++) {
|
1298
|
+
var item = is[i];
|
1299
|
+
if (filterFunction(item)) {
|
1300
|
+
item.filtered = true;
|
1301
|
+
} else {
|
1302
|
+
item.filtered = false;
|
1303
|
+
}
|
1304
|
+
}
|
1305
|
+
}
|
1306
|
+
list.update();
|
1307
|
+
list.trigger('filterComplete');
|
1308
|
+
return list.visibleItems;
|
1309
|
+
};
|
1310
|
+
};
|
1311
|
+
|
1312
|
+
});
|
1313
|
+
require.register("list.js/src/add-async.js", function(exports, require, module){
|
1314
|
+
module.exports = function(list) {
|
1315
|
+
return function(values, callback, items) {
|
1316
|
+
var valuesToAdd = values.splice(0, 100);
|
1317
|
+
items = items || [];
|
1318
|
+
items = items.concat(list.add(valuesToAdd));
|
1319
|
+
if (values.length > 0) {
|
1320
|
+
setTimeout(function() {
|
1321
|
+
addAsync(values, callback, items);
|
1322
|
+
}, 10);
|
1323
|
+
} else {
|
1324
|
+
list.update();
|
1325
|
+
callback(items);
|
1326
|
+
}
|
1327
|
+
};
|
1328
|
+
};
|
1329
|
+
});
|
1330
|
+
require.register("list.js/src/parse.js", function(exports, require, module){
|
1331
|
+
module.exports = function(list) {
|
1332
|
+
|
1333
|
+
var Item = require('./item')(list);
|
1334
|
+
|
1335
|
+
var getChildren = function(parent) {
|
1336
|
+
var nodes = parent.childNodes,
|
1337
|
+
items = [];
|
1338
|
+
for (var i = 0, il = nodes.length; i < il; i++) {
|
1339
|
+
// Only textnodes have a data attribute
|
1340
|
+
if (nodes[i].data === undefined) {
|
1341
|
+
items.push(nodes[i]);
|
1342
|
+
}
|
1343
|
+
}
|
1344
|
+
return items;
|
1345
|
+
};
|
1346
|
+
|
1347
|
+
var parse = function(itemElements, valueNames) {
|
1348
|
+
for (var i = 0, il = itemElements.length; i < il; i++) {
|
1349
|
+
list.items.push(new Item(valueNames, itemElements[i]));
|
1350
|
+
}
|
1351
|
+
};
|
1352
|
+
var parseAsync = function(itemElements, valueNames) {
|
1353
|
+
var itemsToIndex = itemElements.splice(0, 100); // TODO: If < 100 items, what happens in IE etc?
|
1354
|
+
parse(itemsToIndex, valueNames);
|
1355
|
+
if (itemElements.length > 0) {
|
1356
|
+
setTimeout(function() {
|
1357
|
+
init.items.indexAsync(itemElements, valueNames);
|
1358
|
+
}, 10);
|
1359
|
+
} else {
|
1360
|
+
list.update();
|
1361
|
+
// TODO: Add indexed callback
|
1362
|
+
}
|
1363
|
+
};
|
1364
|
+
|
1365
|
+
return function() {
|
1366
|
+
var itemsToIndex = getChildren(list.list),
|
1367
|
+
valueNames = list.valueNames;
|
1368
|
+
|
1369
|
+
if (list.indexAsync) {
|
1370
|
+
parseAsync(itemsToIndex, valueNames);
|
1371
|
+
} else {
|
1372
|
+
parse(itemsToIndex, valueNames);
|
1373
|
+
}
|
1374
|
+
};
|
1375
|
+
};
|
1376
|
+
|
1377
|
+
});
|
1378
|
+
|
1379
|
+
require.alias("component-classes/index.js", "list.js/deps/classes/index.js");
|
1380
|
+
require.alias("component-classes/index.js", "classes/index.js");
|
1381
|
+
require.alias("component-indexof/index.js", "component-classes/deps/indexof/index.js");
|
1382
|
+
|
1383
|
+
require.alias("segmentio-extend/index.js", "list.js/deps/extend/index.js");
|
1384
|
+
require.alias("segmentio-extend/index.js", "extend/index.js");
|
1385
|
+
|
1386
|
+
require.alias("component-indexof/index.js", "list.js/deps/indexof/index.js");
|
1387
|
+
require.alias("component-indexof/index.js", "indexof/index.js");
|
1388
|
+
|
1389
|
+
require.alias("javve-events/index.js", "list.js/deps/events/index.js");
|
1390
|
+
require.alias("javve-events/index.js", "events/index.js");
|
1391
|
+
require.alias("component-event/index.js", "javve-events/deps/event/index.js");
|
1392
|
+
|
1393
|
+
require.alias("javve-is-collection/index.js", "javve-events/deps/is-collection/index.js");
|
1394
|
+
require.alias("component-type/index.js", "javve-is-collection/deps/type/index.js");
|
1395
|
+
|
1396
|
+
require.alias("javve-get-by-class/index.js", "list.js/deps/get-by-class/index.js");
|
1397
|
+
require.alias("javve-get-by-class/index.js", "get-by-class/index.js");
|
1398
|
+
|
1399
|
+
require.alias("javve-get-attribute/index.js", "list.js/deps/get-attribute/index.js");
|
1400
|
+
require.alias("javve-get-attribute/index.js", "get-attribute/index.js");
|
1401
|
+
|
1402
|
+
require.alias("javve-natural-sort/index.js", "list.js/deps/natural-sort/index.js");
|
1403
|
+
require.alias("javve-natural-sort/index.js", "natural-sort/index.js");
|
1404
|
+
|
1405
|
+
require.alias("javve-to-string/index.js", "list.js/deps/to-string/index.js");
|
1406
|
+
require.alias("javve-to-string/index.js", "list.js/deps/to-string/index.js");
|
1407
|
+
require.alias("javve-to-string/index.js", "to-string/index.js");
|
1408
|
+
require.alias("javve-to-string/index.js", "javve-to-string/index.js");
|
1409
|
+
require.alias("component-type/index.js", "list.js/deps/type/index.js");
|
1410
|
+
require.alias("component-type/index.js", "type/index.js");
|
1411
|
+
if (typeof exports == "object") {
|
1412
|
+
module.exports = require("list.js");
|
1413
|
+
} else if (typeof define == "function" && define.amd) {
|
1414
|
+
define(function(){ return require("list.js"); });
|
1415
|
+
} else {
|
1416
|
+
this["List"] = require("list.js");
|
1417
|
+
}})();
|