4 * Require the given path.
7 * @return {Object} exports
11 function require(path, parent, orig) {
12 var resolved = require.resolve(path);
15 if (null == resolved) {
17 parent = parent || 'root';
18 var err = new Error('Failed to require "' + orig + '" from "' + parent + '"');
25 var module = require.modules[resolved];
27 // perform real require()
28 // by invoking the module's
29 // registered function
30 if (!module._resolving && !module.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;
40 return module.exports;
64 * @param {String} path
65 * @return {String} path or null
69 require.resolve = function(path) {
70 if (path.charAt(0) === '/') path = path.slice(1);
80 for (var i = 0; i < paths.length; i++) {
82 if (require.modules.hasOwnProperty(path)) return path;
83 if (require.aliases.hasOwnProperty(path)) return require.aliases[path];
88 * Normalize `path` relative to the current path.
90 * @param {String} curr
91 * @param {String} path
96 require.normalize = function(curr, path) {
99 if ('.' != path.charAt(0)) return path;
101 curr = curr.split('/');
102 path = path.split('/');
104 for (var i = 0; i < path.length; ++i) {
105 if ('..' == path[i]) {
107 } else if ('.' != path[i] && '' != path[i]) {
112 return curr.concat(segs).join('/');
116 * Register module at `path` with callback `definition`.
118 * @param {String} path
119 * @param {Function} definition
123 require.register = function(path, definition) {
124 require.modules[path] = definition;
128 * Alias a module definition.
130 * @param {String} from
135 require.alias = function(from, to) {
136 if (!require.modules.hasOwnProperty(from)) {
137 throw new Error('Failed to alias "' + from + '", it does not exist');
139 require.aliases[to] = from;
143 * Return a require function relative to the `parent` path.
145 * @param {String} parent
150 require.relative = function(parent) {
151 var p = require.normalize(parent, '..');
154 * lastIndexOf helper.
157 function lastIndexOf(arr, obj) {
160 if (arr[i] === obj) return i;
166 * The relative require() itself.
169 function localRequire(path) {
170 var resolved = localRequire.resolve(path);
171 return require(resolved, parent, path);
175 * Resolve relative to the parent.
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);
183 // resolve deps by returning
184 // the dep in the nearest "deps"
186 var segs = parent.split('/');
187 var i = lastIndexOf(segs, 'deps') + 1;
189 path = segs.slice(0, i + 1).join('/') + '/deps/' + path;
194 * Check if module is defined at `path`.
197 localRequire.exists = function(path) {
198 return require.modules.hasOwnProperty(localRequire.resolve(path));
203 require.register("component-classes/index.js", function(exports, require, module){
205 * Module dependencies.
208 var index = require('indexof');
217 * toString reference.
220 var toString = Object.prototype.toString;
223 * Wrap `el` in a `ClassList`.
225 * @param {Element} el
226 * @return {ClassList}
230 module.exports = function(el){
231 return new ClassList(el);
235 * Initialize a new ClassList for `el`.
237 * @param {Element} el
241 function ClassList(el) {
242 if (!el) throw new Error('A DOM element reference is required');
244 this.list = el.classList;
248 * Add class `name` if not already present.
250 * @param {String} name
251 * @return {ClassList}
255 ClassList.prototype.add = function(name){
263 var arr = this.array();
264 var i = index(arr, name);
265 if (!~i) arr.push(name);
266 this.el.className = arr.join(' ');
271 * Remove class `name` when present, or
272 * pass a regular expression to remove
275 * @param {String|RegExp} name
276 * @return {ClassList}
280 ClassList.prototype.remove = function(name){
281 if ('[object RegExp]' == toString.call(name)) {
282 return this.removeMatching(name);
287 this.list.remove(name);
292 var arr = this.array();
293 var i = index(arr, name);
294 if (~i) arr.splice(i, 1);
295 this.el.className = arr.join(' ');
300 * Remove all classes matching `re`.
303 * @return {ClassList}
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])) {
318 * Toggle class `name`, can force state via `force`.
320 * For browsers that support classList, but do not support `force` yet,
321 * the mistake will be detected and corrected.
323 * @param {String} name
324 * @param {Boolean} force
325 * @return {ClassList}
329 ClassList.prototype.toggle = function(name, force){
332 if ("undefined" !== typeof force) {
333 if (force !== this.list.toggle(name, force)) {
334 this.list.toggle(name); // toggle again to correct
337 this.list.toggle(name);
343 if ("undefined" !== typeof force) {
350 if (this.has(name)) {
361 * Return an array of classes.
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();
375 * Check if class `name` is present.
377 * @param {String} name
378 * @return {ClassList}
382 ClassList.prototype.has =
383 ClassList.prototype.contains = function(name){
385 ? this.list.contains(name)
386 : !! ~index(this.array(), name);
390 require.register("segmentio-extend/index.js", function(exports, require, module){
392 module.exports = function extend (object) {
393 // Takes an unlimited number of extenders.
394 var args = Array.prototype.slice.call(arguments, 1);
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];
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;
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' : '';
422 * Bind `el` event `type` to `fn`.
424 * @param {Element} el
425 * @param {String} type
426 * @param {Function} fn
427 * @param {Boolean} capture
432 exports.bind = function(el, type, fn, capture){
433 el[bind](prefix + type, fn, capture || false);
438 * Unbind `el` event `type`'s callback `fn`.
440 * @param {Element} el
441 * @param {String} type
442 * @param {Function} fn
443 * @param {Boolean} capture
448 exports.unbind = function(el, type, fn, capture){
449 el[unbind](prefix + type, fn, capture || false);
453 require.register("timoxley-to-array/index.js", function(exports, require, module){
455 * Convert an array-like object into an `Array`.
456 * If `collection` is already an `Array`, then will return a clone of `collection`.
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`.
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 (isArray(collection)) return collection
469 if (typeof collection.length != 'number') return [collection]
470 if (typeof collection === 'function' && collection instanceof Function) return [collection]
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])
478 if (!arr.length) return []
482 function isArray(arr) {
483 return Object.prototype.toString.call(arr) === "[object Array]";
487 require.register("javve-events/index.js", function(exports, require, module){
488 var events = require('event'),
489 toArray = require('to-array');
492 * Bind `el` event `type` to `fn`.
494 * @param {Element} el, NodeList, HTMLCollection or Array
495 * @param {String} type
496 * @param {Function} fn
497 * @param {Boolean} capture
501 exports.bind = function(el, type, fn, capture){
503 for ( var i = 0; i < el.length; i++ ) {
504 events.bind(el[i], type, fn, capture);
509 * Unbind `el` event `type`'s callback `fn`.
511 * @param {Element} el, NodeList, HTMLCollection or Array
512 * @param {String} type
513 * @param {Function} fn
514 * @param {Boolean} capture
518 exports.unbind = function(el, type, fn, capture){
520 for ( var i = 0; i < el.length; i++ ) {
521 events.unbind(el[i], type, fn, capture);
526 require.register("javve-get-by-class/index.js", function(exports, require, module){
528 * Find all elements with class `className` inside `container`.
529 * Use `single = true` to increase performance in older browsers
530 * when only one element is needed.
532 * @param {String} className
533 * @param {Element} container
534 * @param {Boolean} single
538 module.exports = (function() {
539 if (document.getElementsByClassName) {
540 return function(container, className, single) {
542 return container.getElementsByClassName(className)[0];
544 return container.getElementsByClassName(className);
547 } else if (document.querySelector) {
548 return function(container, className, single) {
549 className = '.' + className;
551 return container.querySelector(className);
553 return container.querySelectorAll(className);
557 return function(container, className, single) {
558 var classElements = [],
560 if (container == null) {
561 container = document;
563 var els = container.getElementsByTagName(tag);
564 var elsLen = els.length;
565 var pattern = new RegExp("(^|\\s)"+className+"(\\s|$)");
566 for (var i = 0, j = 0; i < elsLen; i++) {
567 if ( pattern.test(els[i].className) ) {
571 classElements[j] = els[i];
576 return classElements;
582 require.register("javve-get-attribute/index.js", function(exports, require, module){
584 * Return the value for `attr` at `element`.
586 * @param {Element} el
587 * @param {String} attr
591 module.exports = function(el, attr) {
592 var result = (el.getAttribute && el.getAttribute(attr)) || null;
594 var attrs = el.attributes;
595 var length = attrs.length;
596 for(var i = 0; i < length; i++) {
597 if (attr[i] !== undefined) {
598 if(attr[i].nodeName === attr) {
599 result = attr[i].nodeValue;
607 require.register("javve-natural-sort/index.js", function(exports, require, module){
609 * Natural Sort algorithm for Javascript - Version 0.7 - Released under MIT license
610 * Author: Jim Palmer (based on chunking idea from Dave Koelle)
613 module.exports = function(a, b, options) {
614 var re = /(^-?[0-9]+(\.?[0-9]*)[df]?e?[0-9]?$|^0x[0-9a-f]+$|[0-9]+)/gi,
615 sre = /(^[ ]*|[ ]*$)/g,
616 dre = /(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,
617 hre = /^0x[0-9a-f]+$/i,
619 options = options || {},
620 i = function(s) { return options.insensitive && (''+s).toLowerCase() || ''+s },
621 // convert all to strings strip whitespace
622 x = i(a).replace(sre, '') || '',
623 y = i(b).replace(sre, '') || '',
625 xN = x.replace(re, '\0$1\0').replace(/\0$/,'').replace(/^\0/,'').split('\0'),
626 yN = y.replace(re, '\0$1\0').replace(/\0$/,'').replace(/^\0/,'').split('\0'),
627 // numeric, hex or date detection
628 xD = parseInt(x.match(hre)) || (xN.length != 1 && x.match(dre) && Date.parse(x)),
629 yD = parseInt(y.match(hre)) || xD && y.match(dre) && Date.parse(y) || null,
631 mult = options.desc ? -1 : 1;
632 // first try and sort Hex codes or Dates
634 if ( xD < yD ) return -1 * mult;
635 else if ( xD > yD ) return 1 * mult;
636 // natural sorting through split numeric strings and default strings
637 for(var cLoc=0, numS=Math.max(xN.length, yN.length); cLoc < numS; cLoc++) {
638 // find floats not starting with '0', string or 0 if not defined (Clint Priest)
639 oFxNcL = !(xN[cLoc] || '').match(ore) && parseFloat(xN[cLoc]) || xN[cLoc] || 0;
640 oFyNcL = !(yN[cLoc] || '').match(ore) && parseFloat(yN[cLoc]) || yN[cLoc] || 0;
641 // handle numeric vs string comparison - number < string - (Kyle Adams)
642 if (isNaN(oFxNcL) !== isNaN(oFyNcL)) { return (isNaN(oFxNcL)) ? 1 : -1; }
643 // rely on string comparison if different types - i.e. '02' < 2 != '02' < '2'
644 else if (typeof oFxNcL !== typeof oFyNcL) {
648 if (oFxNcL < oFyNcL) return -1 * mult;
649 if (oFxNcL > oFyNcL) return 1 * mult;
655 var defaultSort = getSortFunction();
657 module.exports = function(a, b, options) {
658 if (arguments.length == 1) {
660 return getSortFunction(options);
662 return defaultSort(a,b);
667 require.register("javve-to-string/index.js", function(exports, require, module){
668 module.exports = function(s) {
669 s = (s === undefined) ? "" : s;
670 s = (s === null) ? "" : s;
676 require.register("component-type/index.js", function(exports, require, module){
681 var toString = Object.prototype.toString;
684 * Return the type of `val`.
691 module.exports = function(val){
692 switch (toString.call(val)) {
693 case '[object Date]': return 'date';
694 case '[object RegExp]': return 'regexp';
695 case '[object Arguments]': return 'arguments';
696 case '[object Array]': return 'array';
697 case '[object Error]': return 'error';
700 if (val === null) return 'null';
701 if (val === undefined) return 'undefined';
702 if (val !== val) return 'nan';
703 if (val && val.nodeType === 1) return 'element';
705 return typeof val.valueOf();
709 require.register("list.js/index.js", function(exports, require, module){
711 ListJS with beta 1.0.0
712 By Jonny Strömberg (www.jonnystromberg.com, www.listjs.com)
714 (function( window, undefined ) {
717 var document = window.document,
718 getByClass = require('get-by-class'),
719 extend = require('extend'),
720 indexOf = require('indexof');
722 var List = function(id, options, values) {
726 Item = require('./src/item')(self),
727 addAsync = require('./src/add-async')(self),
728 parse = require('./src/parse')(self);
732 self.listClass = "list";
733 self.searchClass = "search";
734 self.sortClass = "sort";
738 self.visibleItems = [];
739 self.matchingItems = [];
740 self.searched = false;
741 self.filtered = false;
742 self.handlers = { 'updated': [] };
745 getByClass: getByClass,
750 extend(self, options);
752 self.listContainer = (typeof(id) === 'string') ? document.getElementById(id) : id;
753 if (!self.listContainer) { return; }
754 self.list = getByClass(self.listContainer, self.listClass, true);
756 self.templater = require('./src/templater')(self);
757 self.search = require('./src/search')(self);
758 self.filter = require('./src/filter')(self);
759 self.sort = require('./src/sort')(self);
767 if (values !== undefined) {
771 plugins: function() {
772 for (var i = 0; i < self.plugins.length; i++) {
773 var plugin = self.plugins[i];
774 self[plugin.name] = plugin;
784 this.add = function(values, callback) {
786 addAsync(values, callback);
791 if (values[0] === undefined){
794 for (var i = 0, il = values.length; i < il; i++) {
796 if (values[i] instanceof Item) {
800 notCreate = (self.items.length > self.page) ? true : false;
801 item = new Item(values[i], undefined, notCreate);
803 self.items.push(item);
810 this.show = function(i, page) {
817 /* Removes object from list.
818 * Loops through the list and removes objects where
819 * property "valuename" === value
821 this.remove = function(valueName, value, options) {
823 for (var i = 0, il = self.items.length; i < il; i++) {
824 if (self.items[i].values()[valueName] == value) {
825 self.templater.remove(self.items[i], options);
826 self.items.splice(i,1);
836 /* Gets the objects in the list which
837 * property "valueName" === value
839 this.get = function(valueName, value) {
840 var matchedItems = [];
841 for (var i = 0, il = self.items.length; i < il; i++) {
842 var item = self.items[i];
843 if (item.values()[valueName] == value) {
844 matchedItems.push(item);
851 * Get size of the list
853 this.size = function() {
854 return self.items.length;
858 * Removes all items from the list
860 this.clear = function() {
861 self.templater.clear();
866 this.on = function(event, callback) {
867 self.handlers[event].push(callback);
871 this.off = function(event, callback) {
872 var e = self.handlers[event];
873 var index = indexOf(e, callback);
880 this.trigger = function(event) {
881 var i = self.handlers[event].length;
883 self.handlers[event][i](self);
893 is[il].filtered = false;
901 is[il].found = false;
907 this.update = function() {
911 self.visibleItems = [];
912 self.matchingItems = [];
913 self.templater.clear();
914 for (var i = 0; i < il; i++) {
915 if (is[i].matching() && ((self.matchingItems.length+1) >= self.i && self.visibleItems.length < self.page)) {
917 self.visibleItems.push(is[i]);
918 self.matchingItems.push(is[i]);
919 } else if (is[i].matching()) {
920 self.matchingItems.push(is[i]);
926 self.trigger('updated');
933 module.exports = List;
938 require.register("list.js/src/search.js", function(exports, require, module){
939 var events = require('events'),
940 getByClass = require('get-by-class'),
941 toString = require('to-string');
943 module.exports = function(list) {
951 resetList: function() {
953 list.templater.clear();
954 customSearch = undefined;
956 setOptions: function(args) {
957 if (args.length == 2 && args[1] instanceof Array) {
959 } else if (args.length == 2 && typeof(args[1]) == "function") {
960 customSearch = args[1];
961 } else if (args.length == 3) {
963 customSearch = args[2];
966 setColumns: function() {
967 columns = (columns === undefined) ? prepare.toArray(list.items[0].values()) : columns;
969 setSearchString: function(s) {
970 s = toString(s).toLowerCase();
971 s = s.replace(/[-[\]{}()*+?.,\\^$|#]/g, "\\$&"); // Escape regular expression characters
974 toArray: function(values) {
976 for (var name in values) {
977 tmpColumn.push(name);
984 for (var k = 0, kl = list.items.length; k < kl; k++) {
985 search.item(list.items[k]);
988 item: function(item) {
990 for (var j = 0, jl = columns.length; j < jl; j++) {
991 if (search.values(item.values(), columns[j])) {
997 values: function(values, column) {
998 if (values.hasOwnProperty(column)) {
999 text = toString(values[column]).toLowerCase();
1000 if ((searchString !== "") && (text.search(searchString) > -1)) {
1007 list.reset.search();
1008 list.searched = false;
1012 var searchMethod = function(str) {
1013 list.trigger('searchStart');
1015 prepare.resetList();
1016 prepare.setSearchString(str);
1017 prepare.setOptions(arguments); // str, cols|searchFunction, searchFunction
1018 prepare.setColumns();
1020 if (searchString === "" ) {
1023 list.searched = true;
1025 customSearch(searchString, columns);
1032 list.trigger('searchComplete');
1033 return list.visibleItems;
1036 list.handlers.searchStart = list.handlers.searchStart || [];
1037 list.handlers.searchComplete = list.handlers.searchComplete || [];
1039 events.bind(getByClass(list.listContainer, list.searchClass), 'keyup', function(e) {
1040 var target = e.target || e.srcElement, // IE have srcElement
1041 alreadyCleared = (target.value === "" && !list.searched);
1042 if (!alreadyCleared) { // If oninput already have resetted the list, do nothing
1043 searchMethod(target.value);
1047 // Used to detect click on HTML5 clear button
1048 events.bind(getByClass(list.listContainer, list.searchClass), 'input', function(e) {
1049 var target = e.target || e.srcElement;
1050 if (target.value === "") {
1055 list.helpers.toString = toString;
1056 return searchMethod;
1060 require.register("list.js/src/sort.js", function(exports, require, module){
1061 var naturalSort = require('natural-sort'),
1062 classes = require('classes'),
1063 events = require('events'),
1064 getByClass = require('get-by-class'),
1065 getAttribute = require('get-attribute');
1067 module.exports = function(list) {
1068 list.sortFunction = list.sortFunction || function(itemA, itemB, options) {
1069 options.desc = options.order == "desc" ? true : false; // Natural sort uses this format
1070 return naturalSort(itemA.values()[options.valueName], itemB.values()[options.valueName], options);
1076 for (var i = 0, il = buttons.els.length; i < il; i++) {
1077 classes(buttons.els[i]).remove('asc');
1078 classes(buttons.els[i]).remove('desc');
1081 getOrder: function(btn) {
1082 var predefinedOrder = getAttribute(btn, 'data-order');
1083 if (predefinedOrder == "asc" || predefinedOrder == "desc") {
1084 return predefinedOrder;
1085 } else if (classes(btn).has('desc')) {
1087 } else if (classes(btn).has('asc')) {
1093 getInSensitive: function(btn, options) {
1094 var insensitive = getAttribute(btn, 'data-insensitive');
1095 if (insensitive === "true") {
1096 options.insensitive = true;
1098 options.insensitive = false;
1101 setOrder: function(options) {
1102 for (var i = 0, il = buttons.els.length; i < il; i++) {
1103 var btn = buttons.els[i];
1104 if (getAttribute(btn, 'data-sort') !== options.valueName) {
1107 var predefinedOrder = getAttribute(btn, 'data-order');
1108 if (predefinedOrder == "asc" || predefinedOrder == "desc") {
1109 if (predefinedOrder == options.order) {
1110 classes(btn).add(options.order);
1113 classes(btn).add(options.order);
1118 var sort = function() {
1119 list.trigger('sortStart');
1122 var target = arguments[0].currentTarget || arguments[0].srcElement || undefined;
1125 options.valueName = getAttribute(target, 'data-sort');
1126 buttons.getInSensitive(target, options);
1127 options.order = buttons.getOrder(target);
1129 options = arguments[1] || options;
1130 options.valueName = arguments[0];
1131 options.order = options.order || "asc";
1132 options.insensitive = (typeof options.insensitive == "undefined") ? true : options.insensitive;
1135 buttons.setOrder(options);
1137 options.sortFunction = options.sortFunction || list.sortFunction;
1138 list.items.sort(function(a, b) {
1139 return options.sortFunction(a, b, options);
1142 list.trigger('sortComplete');
1146 list.handlers.sortStart = list.handlers.sortStart || [];
1147 list.handlers.sortComplete = list.handlers.sortComplete || [];
1149 buttons.els = getByClass(list.listContainer, list.sortClass);
1150 events.bind(buttons.els, 'click', sort);
1151 list.on('searchStart', buttons.clear);
1152 list.on('filterStart', buttons.clear);
1155 list.helpers.classes = classes;
1156 list.helpers.naturalSort = naturalSort;
1157 list.helpers.events = events;
1158 list.helpers.getAttribute = getAttribute;
1164 require.register("list.js/src/item.js", function(exports, require, module){
1165 module.exports = function(list) {
1166 return function(initValues, element, notCreate) {
1171 this.found = false; // Show if list.searched == true and this.found == true
1172 this.filtered = false;// Show if list.filtered == true and this.filtered == true
1174 var init = function(initValues, element, notCreate) {
1175 if (element === undefined) {
1177 item.values(initValues, notCreate);
1179 item.values(initValues);
1183 var values = list.templater.get(item, initValues);
1184 item.values(values);
1187 this.values = function(newValues, notCreate) {
1188 if (newValues !== undefined) {
1189 for(var name in newValues) {
1190 item._values[name] = newValues[name];
1192 if (notCreate !== true) {
1193 list.templater.set(item, item.values());
1196 return item._values;
1199 this.show = function() {
1200 list.templater.show(item);
1202 this.hide = function() {
1203 list.templater.hide(item);
1205 this.matching = function() {
1207 (list.filtered && list.searched && item.found && item.filtered) ||
1208 (list.filtered && !list.searched && item.filtered) ||
1209 (!list.filtered && list.searched && item.found) ||
1210 (!list.filtered && !list.searched)
1213 this.visible = function() {
1214 return (item.elm.parentNode == list.list) ? true : false;
1216 init(initValues, element, notCreate);
1221 require.register("list.js/src/templater.js", function(exports, require, module){
1222 var getByClass = require('get-by-class');
1224 var Templater = function(list) {
1225 var itemSource = getItemSource(list.item),
1228 function getItemSource(item) {
1229 if (item === undefined) {
1230 var nodes = list.list.childNodes,
1233 for (var i = 0, il = nodes.length; i < il; i++) {
1234 // Only textnodes have a data attribute
1235 if (nodes[i].data === undefined) {
1240 } else if (item.indexOf("<") !== -1) { // Try create html element of list, do not work for tables!!
1241 var div = document.createElement('div');
1242 div.innerHTML = item;
1243 return div.firstChild;
1245 return document.getElementById(list.item);
1249 /* Get values from element */
1250 this.get = function(item, valueNames) {
1251 templater.create(item);
1253 for(var i = 0, il = valueNames.length; i < il; i++) {
1254 var elm = getByClass(item.elm, valueNames[i], true);
1255 values[valueNames[i]] = elm ? elm.innerHTML : "";
1260 /* Sets values at element */
1261 this.set = function(item, values) {
1262 if (!templater.create(item)) {
1263 for(var v in values) {
1264 if (values.hasOwnProperty(v)) {
1265 // TODO speed up if possible
1266 var elm = getByClass(item.elm, v, true);
1268 /* src attribute for image tag & text for other tags */
1269 if (elm.tagName === "IMG" && values[v] !== "") {
1270 elm.src = values[v];
1272 elm.innerHTML = values[v];
1280 this.create = function(item) {
1281 if (item.elm !== undefined) {
1284 /* If item source does not exists, use the first item in list as
1285 source for new items */
1286 var newItem = itemSource.cloneNode(true);
1287 newItem.removeAttribute('id');
1289 templater.set(item, item.values());
1292 this.remove = function(item) {
1293 list.list.removeChild(item.elm);
1295 this.show = function(item) {
1296 templater.create(item);
1297 list.list.appendChild(item.elm);
1299 this.hide = function(item) {
1300 if (item.elm !== undefined && item.elm.parentNode === list.list) {
1301 list.list.removeChild(item.elm);
1304 this.clear = function() {
1305 /* .innerHTML = ''; fucks up IE */
1306 if (list.list.hasChildNodes()) {
1307 while (list.list.childNodes.length >= 1)
1309 list.list.removeChild(list.list.firstChild);
1315 module.exports = function(list) {
1316 return new Templater(list);
1320 require.register("list.js/src/filter.js", function(exports, require, module){
1321 module.exports = function(list) {
1324 list.handlers.filterStart = list.handlers.filterStart || [];
1325 list.handlers.filterComplete = list.handlers.filterComplete || [];
1327 return function(filterFunction) {
1328 list.trigger('filterStart');
1329 list.i = 1; // Reset paging
1330 list.reset.filter();
1331 if (filterFunction === undefined) {
1332 list.filtered = false;
1334 list.filtered = true;
1335 var is = list.items;
1336 for (var i = 0, il = is.length; i < il; i++) {
1338 if (filterFunction(item)) {
1339 item.filtered = true;
1341 item.filtered = false;
1346 list.trigger('filterComplete');
1347 return list.visibleItems;
1352 require.register("list.js/src/add-async.js", function(exports, require, module){
1353 module.exports = function(list) {
1354 return function(values, callback, items) {
1355 var valuesToAdd = values.splice(0, 100);
1356 items = items || [];
1357 items = items.concat(list.add(valuesToAdd));
1358 if (values.length > 0) {
1359 setTimeout(function() {
1360 addAsync(values, callback, items);
1369 require.register("list.js/src/parse.js", function(exports, require, module){
1370 module.exports = function(list) {
1372 var Item = require('./item')(list);
1374 var getChildren = function(parent) {
1375 var nodes = parent.childNodes,
1377 for (var i = 0, il = nodes.length; i < il; i++) {
1378 // Only textnodes have a data attribute
1379 if (nodes[i].data === undefined) {
1380 items.push(nodes[i]);
1386 var parse = function(itemElements, valueNames) {
1387 for (var i = 0, il = itemElements.length; i < il; i++) {
1388 list.items.push(new Item(valueNames, itemElements[i]));
1391 var parseAsync = function(itemElements, valueNames) {
1392 var itemsToIndex = itemElements.splice(0, 100); // TODO: If < 100 items, what happens in IE etc?
1393 parse(itemsToIndex, valueNames);
1394 if (itemElements.length > 0) {
1395 setTimeout(function() {
1396 init.items.indexAsync(itemElements, valueNames);
1400 // TODO: Add indexed callback
1405 var itemsToIndex = getChildren(list.list),
1406 valueNames = list.valueNames;
1408 if (list.indexAsync) {
1409 parseAsync(itemsToIndex, valueNames);
1411 parse(itemsToIndex, valueNames);
1437 require.alias("component-classes/index.js", "list.js/deps/classes/index.js");
1438 require.alias("component-classes/index.js", "classes/index.js");
1439 require.alias("component-indexof/index.js", "component-classes/deps/indexof/index.js");
1441 require.alias("segmentio-extend/index.js", "list.js/deps/extend/index.js");
1442 require.alias("segmentio-extend/index.js", "extend/index.js");
1444 require.alias("component-indexof/index.js", "list.js/deps/indexof/index.js");
1445 require.alias("component-indexof/index.js", "indexof/index.js");
1447 require.alias("javve-events/index.js", "list.js/deps/events/index.js");
1448 require.alias("javve-events/index.js", "events/index.js");
1449 require.alias("component-event/index.js", "javve-events/deps/event/index.js");
1451 require.alias("timoxley-to-array/index.js", "javve-events/deps/to-array/index.js");
1453 require.alias("javve-get-by-class/index.js", "list.js/deps/get-by-class/index.js");
1454 require.alias("javve-get-by-class/index.js", "get-by-class/index.js");
1456 require.alias("javve-get-attribute/index.js", "list.js/deps/get-attribute/index.js");
1457 require.alias("javve-get-attribute/index.js", "get-attribute/index.js");
1459 require.alias("javve-natural-sort/index.js", "list.js/deps/natural-sort/index.js");
1460 require.alias("javve-natural-sort/index.js", "natural-sort/index.js");
1462 require.alias("javve-to-string/index.js", "list.js/deps/to-string/index.js");
1463 require.alias("javve-to-string/index.js", "list.js/deps/to-string/index.js");
1464 require.alias("javve-to-string/index.js", "to-string/index.js");
1465 require.alias("javve-to-string/index.js", "javve-to-string/index.js");
1466 require.alias("component-type/index.js", "list.js/deps/type/index.js");
1467 require.alias("component-type/index.js", "type/index.js");
1468 if (typeof exports == "object") {
1469 module.exports = require("list.js");
1470 } else if (typeof define == "function" && define.amd) {
1471 define(function(){ return require("list.js"); });
1473 this["List"] = require("list.js");