@@ -0,0 +1,1058 @@
1+/*!
2+ * Ender: open module JavaScript framework
3+ * copyright Dustin Diaz & Jacob Thornton 2011 (@ded @fat)
4+ * https://github.com/ender-js/ender
5+ * License MIT
6+ * Build: ender just bonzo qwery reqwest
7+ */
8+!function (context) {
9+
10+ function aug(o, o2) {
11+ for (var k in o2) {
12+ k != 'noConflict' && (o[k] = o2[k]);
13+ }
14+ }
15+
16+ function _$(s, r) {
17+ this.elements = typeof s !== 'string' && !s.nodeType && typeof s.length !== 'undefined' ? s : $._select(s, r);
18+ this.length = this.elements.length;
19+ for (var i = 0; i < this.length; i++) {
20+ this[i] = this.elements[i];
21+ }
22+ }
23+
24+ function $(s, r) {
25+ return new _$(s, r);
26+ }
27+
28+ aug($, {
29+ ender: function (o, proto) {
30+ aug(proto ? _$.prototype : $, o);
31+ },
32+ _select: function () {
33+ return [];
34+ }
35+ });
36+
37+ var old = context.$;
38+ $.noConflict = function () {
39+ context.$ = old;
40+ return this;
41+ };
42+
43+ (typeof module !== 'undefined') && module.exports ?
44+ (module.exports = $) :
45+ (context.$ = $);
46+
47+}(this);
48+/*!
49+ * bonzo.js - copyright @dedfat 2011
50+ * https://github.com/ded/bonzo
51+ * Follow our software http://twitter.com/dedfat
52+ * MIT License
53+ */
54+!function (context) {
55+
56+ var doc = document,
57+ html = doc.documentElement,
58+ specialAttributes = /^checked|value|selected$/,
59+ stateAttributes = /^checked|selected$/,
60+ ie = /msie/.test(navigator.userAgent),
61+ uidList = [],
62+ uuids = 0;
63+
64+ function classReg(c) {
65+ return new RegExp("(^|\\s+)" + c + "(\\s+|$)");
66+ }
67+
68+ function each(ar, fn) {
69+ for (i = 0, len = ar.length; i < len; i++) {
70+ fn(ar[i]);
71+ }
72+ }
73+
74+ function trim(s) {
75+ return s.replace(/(^\s*|\s*$)/g, '');
76+ }
77+
78+ function camelize(s) {
79+ return s.replace(/-(.)/g, function (m, m1) {
80+ return m1.toUpperCase();
81+ });
82+ }
83+
84+ function is(node) {
85+ return node && node.nodeName && node.nodeType == 1;
86+ }
87+
88+ function some(ar, fn, scope) {
89+ for (var i = 0, j = ar.length; i < j; ++i) {
90+ if (fn.call(scope, ar[i], i, ar)) {
91+ return true;
92+ }
93+ }
94+ return false;
95+ }
96+
97+ function sucks(o) {
98+ for (var k in o) {
99+ switch (k) {
100+ case 'opacity':
101+ o.filter = 'alpha(opacity=' + (o[k] * 100) + ')';
102+ delete o[k];
103+ break;
104+ case '':
105+ break;
106+ }
107+ }
108+ }
109+
110+ function _bonzo(elements) {
111+ this.elements = [];
112+ this.length = 0;
113+ if (elements) {
114+ this.elements = typeof elements !== 'string' && !elements.nodeType && typeof elements.length !== 'undefined' ? elements : [elements];
115+ this.length = this.elements.length;
116+ for (var i = 0; i < this.length; i++) {
117+ this[i] = this.elements[i];
118+ }
119+ }
120+ }
121+
122+ _bonzo.prototype = {
123+
124+ each: function (fn) {
125+ for (var i = 0, l = this.length; i < l; i++) {
126+ fn.call(this, this[i], i);
127+ }
128+ return this;
129+ },
130+
131+ map: function (fn, reject) {
132+ var m = [], n;
133+ for (var i = 0; i < this.length; i++) {
134+ n = fn.call(this, this[i]);
135+ reject ? (reject(n) && m.push(n)) : m.push(n);
136+ }
137+ return m;
138+ },
139+
140+ first: function () {
141+ return bonzo(this[0]);
142+ },
143+
144+ last: function () {
145+ return bonzo(this[this.length - 1]);
146+ },
147+
148+ html: function (html) {
149+ return typeof html !== 'undefined' ?
150+ this.each(function (el) {
151+ el.innerHTML = html;
152+ }) :
153+ this.elements[0] ? this.elements[0].innerHTML : '';
154+ },
155+
156+ addClass: function (c) {
157+ return this.each(function (el) {
158+ this.hasClass(el, c) || (el.className = trim(el.className + ' ' + c));
159+ });
160+ },
161+
162+ removeClass: function (c) {
163+ return this.each(function (el) {
164+ this.hasClass(el, c) && (el.className = trim(el.className.replace(classReg(c), ' ')));
165+ });
166+ },
167+
168+ hasClass: function (el, c) {
169+ return typeof c == 'undefined' ?
170+ some(this.elements, function (i) {
171+ return classReg(el).test(i.className);
172+ }) :
173+ classReg(c).test(el.className);
174+ },
175+
176+ toggleClass: function (c, condition) {
177+ if (typeof condition !== 'undefined' && !condition) {
178+ return this;
179+ }
180+ return this.each(function (el) {
181+ this.hasClass(el, c) ?
182+ (el.className = trim(el.className.replace(classReg(c), ' '))) :
183+ (el.className = trim(el.className + ' ' + c));
184+ });
185+ },
186+
187+ show: function (elements) {
188+ return this.each(function (el) {
189+ el.style.display = '';
190+ });
191+ },
192+
193+ hide: function (elements) {
194+ return this.each(function (el) {
195+ el.style.display = 'none';
196+ });
197+ },
198+
199+ append: function (node) {
200+ return this.each(function (el) {
201+ each(normalize(node), function (i) {
202+ el.appendChild(i);
203+ });
204+ });
205+ },
206+
207+ prepend: function (node) {
208+ return this.each(function (el) {
209+ var first = el.firstChild;
210+ each(normalize(node), function (i) {
211+ el.insertBefore(i, first);
212+ });
213+ });
214+ },
215+
216+ appendTo: function (target) {
217+ return this.each(function (el) {
218+ target.appendChild(el);
219+ });
220+ },
221+
222+ next: function () {
223+ return this.related('nextSibling');
224+ },
225+
226+ previous: function () {
227+ return this.related('previousSibling');
228+ },
229+
230+ related: function (method) {
231+ return this.map(
232+ function (el) {
233+ el = el[method];
234+ while (el && el.nodeType !== 1) {
235+ el = el[method];
236+ }
237+ return el || 0;
238+ },
239+ function (el) {
240+ return el;
241+ }
242+ );
243+ },
244+
245+ prependTo: function (target) {
246+ return this.each(function (el) {
247+ target.insertBefore(el, bonzo.firstChild(target));
248+ });
249+ },
250+
251+ before: function (node) {
252+ return this.each(function (el) {
253+ each(bonzo.create(node), function (i) {
254+ el.parentNode.insertBefore(i, el);
255+ });
256+ });
257+ },
258+
259+ insertBefore: function (node) {
260+ return this.each(function (el) {
261+ each(normalize(node), function (n) {
262+ n.parentNode.insertBefore(el, n);
263+ });
264+ });
265+ },
266+
267+ insertAfter: function (node) {
268+ return this.each(function (el) {
269+ each(normalize(node), function (n) {
270+ n.parentNode.insertBefore(el, (n.nextSibling || n));
271+ });
272+ });
273+ },
274+
275+ after: function (node) {
276+ return this.each(function (el) {
277+ each(bonzo.create(node), function (i) {
278+ el.parentNode.insertBefore(i, el.nextSibling);
279+ });
280+ });
281+ },
282+
283+ css: function (o, v) {
284+ if (v === undefined && typeof o == 'string') {
285+ return this[0].style[camelize(o)];
286+ }
287+ var iter = o;
288+ if (typeof o == 'string') {
289+ iter = {};
290+ iter[o] = v;
291+ }
292+ ie && sucks(iter);
293+ var fn = function (el) {
294+ for (var k in iter) {
295+ iter.hasOwnProperty(k) && (el.style[camelize(k)] = iter[k]);
296+ }
297+ };
298+ return this.each(fn);
299+ },
300+
301+ offset: function () {
302+ var el = this.elements[0];
303+ var width = el.offsetWidth;
304+ var height = el.offsetHeight;
305+ var top = el.offsetTop;
306+ var left = el.offsetLeft;
307+ while (el = el.offsetParent) {
308+ top = top + el.offsetTop;
309+ left = left + el.offsetLeft;
310+ }
311+
312+ return {
313+ top: top,
314+ left: left,
315+ height: height,
316+ width: width
317+ };
318+ },
319+
320+ attr: function (k, v) {
321+ var el = this.elements[0];
322+ return typeof v == 'undefined' ?
323+ specialAttributes.test(k) ?
324+ stateAttributes.test(k) && typeof el[k] == 'string' ?
325+ true : el[k] : el.getAttribute(k) :
326+ this.each(function (el) {
327+ el.setAttribute(k, v);
328+ });
329+ },
330+
331+ removeAttr: function (k) {
332+ return this.each(function (el) {
333+ el.removeAttribute(k);
334+ });
335+ },
336+
337+ data: function (k, v) {
338+ var el = this.elements[0];
339+ if (typeof v === 'undefined') {
340+ el.getAttribute('data-node-uid') || el.setAttribute('data-node-uid', ++uuids);
341+ var uid = el.getAttribute('data-node-uid');
342+ uidList[uid] || (uidList[uid] = {});
343+ return uidList[uid][k];
344+ } else {
345+ return this.each(function (el) {
346+ el.getAttribute('data-node-uid') || el.setAttribute('data-node-uid', ++uuids);
347+ var uid = el.getAttribute('data-node-uid');
348+ var o = {};
349+ o[k] = v;
350+ uidList[uid] = o;
351+ });
352+ }
353+ },
354+
355+ remove: function () {
356+ return this.each(function (el) {
357+ el.parentNode && el.parentNode.removeChild(el);
358+ });
359+ },
360+
361+ empty: function () {
362+ return this.each(function (el) {
363+ while (el.firstChild) {
364+ el.removeChild(el.firstChild);
365+ }
366+ });
367+ },
368+
369+ detach: function () {
370+ return this.map(function (el) {
371+ return el.parentNode.removeChild(el);
372+ });
373+ },
374+
375+ scrollTop: function (y) {
376+ return scroll.call(this, null, y, 'y');
377+ },
378+
379+ scrollLeft: function (x) {
380+ return scroll.call(this, x, null, 'x');
381+ },
382+
383+ serialize: function () {
384+ var form = this[0],
385+ inputs = form.getElementsByTagName('input'),
386+ selects = form.getElementsByTagName('select'),
387+ texts = form.getElementsByTagName('textarea');
388+ return (bonzo(inputs).map(serial).join('') +
389+ bonzo(selects).map(serial).join('') +
390+ bonzo(texts).map(serial).join('')).replace(/&$/, '');
391+ },
392+
393+ serializeArray: function () {
394+ for (var pairs = this.serialize().split('&'), i = 0, l = pairs.length, r = [], o; i < l; i++) {
395+ pairs[i] && (o = pairs[i].split('=')) && r.push({name: o[0], value: o[1]});
396+ }
397+ return r;
398+ }
399+ };
400+
401+ function enc(v) {
402+ return encodeURIComponent(v);
403+ }
404+
405+ function serial(el) {
406+ var n = el.name;
407+ // don't serialize elements that are disabled or without a name
408+ if (el.disabled || !n) {
409+ return '';
410+ }
411+ n = enc(n);
412+ switch (el.tagName.toLowerCase()) {
413+ case 'input':
414+ switch (el.type) {
415+ case 'reset':
416+ case 'button':
417+ case 'image':
418+ case 'file':
419+ return '';
420+ case 'checkbox':
421+ case 'radio':
422+ return el.checked ? n + '=' + (el.value ? enc(el.value) : true) + '&' : '';
423+ default: // text hidden password submit
424+ return n + '=' + (el.value ? enc(el.value) : true) + '&';
425+ }
426+ break;
427+ case 'textarea':
428+ return n + '=' + enc(el.value) + '&';
429+ case 'select':
430+ // @todo refactor beyond basic single selected value case
431+ return n + '=' + enc(el.options[el.selectedIndex].value) + '&';
432+ }
433+ return '';
434+ }
435+
436+ function normalize(node) {
437+ return typeof node == 'string' ? bonzo.create(node) : is(node) ? [node] : node;
438+ }
439+
440+ function scroll(x, y, type) {
441+ var el = this.elements[0];
442+ if (x == null && y == null) {
443+ return (isBody(el) ? getWindowScroll() : { x: el.scrollLeft, y: el.scrollTop })[type];
444+ }
445+ if (isBody(el)) {
446+ window.scrollTo(x, y);
447+ } else {
448+ x != null && (el.scrollLeft = x);
449+ y != null && (el.scrollTop = y);
450+ }
451+ return this;
452+ }
453+
454+ function isBody(element) {
455+ return element === window || (/^(?:body|html)$/i).test(element.tagName);
456+ }
457+
458+ function getWindowScroll() {
459+ return { x: window.pageXOffset || html.scrollLeft, y: window.pageYOffset || html.scrollTop };
460+ }
461+
462+ function bonzo(els) {
463+ return new _bonzo(els);
464+ }
465+
466+ bonzo.aug = function (o, target) {
467+ for (var k in o) {
468+ o.hasOwnProperty(k) && ((target || _bonzo.prototype)[k] = o[k]);
469+ }
470+ };
471+
472+ bonzo.create = function (node) {
473+ return typeof node == 'string' ?
474+ function () {
475+ var el = doc.createElement('div'), els = [];
476+ el.innerHTML = node;
477+ var nodes = el.childNodes;
478+ el = el.firstChild;
479+ els.push(el);
480+ while (el = el.nextSibling) {
481+ (el.nodeType == 1) && els.push(el);
482+ }
483+ return els;
484+
485+ }() : is(node) ? [node.cloneNode(true)] : [];
486+ };
487+
488+ bonzo.doc = function () {
489+ var w = html.scrollWidth,
490+ h = html.scrollHeight,
491+ vp = this.viewport();
492+ return {
493+ width: Math.max(w, vp.width),
494+ height: Math.max(h, vp.height)
495+ };
496+ };
497+
498+ bonzo.firstChild = function (el) {
499+ for (var c = el.childNodes, i = 0, j = (c && c.length) || 0, e; i < j; i++) {
500+ if (c[i].nodeType === 1) {
501+ e = c[j = i];
502+ }
503+ }
504+ return e;
505+ };
506+
507+ bonzo.viewport = function () {
508+ var h = self.innerHeight,
509+ w = self.innerWidth;
510+ ie && (h = html.clientHeight) && (w = html.clientWidth);
511+ return {
512+ width: w,
513+ height: h
514+ };
515+ };
516+
517+ bonzo.isAncestor = 'compareDocumentPosition' in html ?
518+ function (container, element) {
519+ return (container.compareDocumentPosition(element) & 16) == 16;
520+ } : 'contains' in html ?
521+ function (container, element) {
522+ return container !== element && container.contains(element);
523+ } :
524+ function (container, element) {
525+ while (element = element.parentNode) {
526+ if (element === container) {
527+ return true;
528+ }
529+ }
530+ return false;
531+ };
532+
533+ var old = context.bonzo;
534+ bonzo.noConflict = function () {
535+ context.bonzo = old;
536+ return this;
537+ };
538+ context.bonzo = bonzo;
539+
540+}(this);!function () {
541+ var b = bonzo.noConflict();
542+ $.ender(b);
543+ $.ender(b(), true);
544+ $.ender({
545+ create: function (node) {
546+ return $(b.create(node));
547+ }
548+ });
549+
550+ function indexOf(ar, val) {
551+ for (var i = 0; i < ar.length; i++) {
552+ if ( ar[i] === val ) {
553+ return i;
554+ }
555+ }
556+ return -1;
557+ }
558+
559+ function uniq(ar) {
Cut short: this commit's diff is over 1000 lines.