comparison johndyer-mediaelement-13fa20a/src/js/jeesh.js @ 0:032bc65ebafc

added core components
author George Fazekas <gyorgy.fazekas@eecs.qmul.ac.uk>
date Wed, 06 Mar 2013 15:45:48 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:032bc65ebafc
1 /*!
2 * Ender: open module JavaScript framework
3 * copyright Dustin Diaz & Jacob Thornton 2011 (@ded @fat)
4 * https://ender.no.de
5 * License MIT
6 * Build: ender build jeesh --output jeesh
7 */
8 !function (context) {
9
10 function aug(o, o2) {
11 for (var k in o2) {
12 k != 'noConflict' && k != '_VERSION' && (o[k] = o2[k]);
13 }
14 return o;
15 }
16
17 function boosh(s, r, els) {
18 // string || node || nodelist || window
19 if (ender._select && (typeof s == 'string' || s.nodeName || s.length && 'item' in s || s == window)) {
20 els = ender._select(s, r);
21 els.selector = s;
22 } else {
23 els = isFinite(s.length) ? s : [s];
24 }
25 return aug(els, boosh);
26 }
27
28 function ender(s, r) {
29 return boosh(s, r);
30 }
31
32 aug(ender, {
33 _VERSION: '0.2.4',
34 ender: function (o, chain) {
35 aug(chain ? boosh : ender, o);
36 },
37 fn: context.$ && context.$.fn || {} // for easy compat to jQuery plugins
38 });
39
40 aug(boosh, {
41 forEach: function (fn, scope, i) {
42 // opt out of native forEach so we can intentionally call our own scope
43 // defaulting to the current item and be able to return self
44 for (i = 0, l = this.length; i < l; ++i) {
45 i in this && fn.call(scope || this[i], this[i], i, this);
46 }
47 // return self for chaining
48 return this;
49 },
50 $: ender // handy reference to self
51 });
52
53 var old = context.$;
54 ender.noConflict = function () {
55 context.$ = old;
56 return this;
57 };
58
59 (typeof module !== 'undefined') && module.exports && (module.exports = ender);
60 // use subscript notation as extern for Closure compilation
61 context['ender'] = context['$'] = ender;
62
63 }(this);
64 /*!
65 * bean.js - copyright Jacob Thornton 2011
66 * https://github.com/fat/bean
67 * MIT License
68 * special thanks to:
69 * dean edwards: http://dean.edwards.name/
70 * dperini: https://github.com/dperini/nwevents
71 * the entire mootools team: github.com/mootools/mootools-core
72 */
73 !function (context) {
74 var __uid = 1, registry = {}, collected = {},
75 overOut = /over|out/,
76 namespace = /[^\.]*(?=\..*)\.|.*/,
77 stripName = /\..*/,
78 addEvent = 'addEventListener',
79 attachEvent = 'attachEvent',
80 removeEvent = 'removeEventListener',
81 detachEvent = 'detachEvent',
82 doc = context.document || {},
83 root = doc.documentElement || {},
84 W3C_MODEL = root[addEvent],
85 eventSupport = W3C_MODEL ? addEvent : attachEvent,
86
87 isDescendant = function (parent, child) {
88 var node = child.parentNode;
89 while (node != null) {
90 if (node == parent) {
91 return true;
92 }
93 node = node.parentNode;
94 }
95 },
96
97 retrieveUid = function (obj, uid) {
98 return (obj.__uid = uid || obj.__uid || __uid++);
99 },
100
101 retrieveEvents = function (element) {
102 var uid = retrieveUid(element);
103 return (registry[uid] = registry[uid] || {});
104 },
105
106 listener = W3C_MODEL ? function (element, type, fn, add) {
107 element[add ? addEvent : removeEvent](type, fn, false);
108 } : function (element, type, fn, add, custom) {
109 custom && add && (element['_on' + custom] = element['_on' + custom] || 0);
110 element[add ? attachEvent : detachEvent]('on' + type, fn);
111 },
112
113 nativeHandler = function (element, fn, args) {
114 return function (event) {
115 event = fixEvent(event || ((this.ownerDocument || this.document || this).parentWindow || context).event);
116 return fn.apply(element, [event].concat(args));
117 };
118 },
119
120 customHandler = function (element, fn, type, condition, args) {
121 return function (event) {
122 if (condition ? condition.call(this, event) : W3C_MODEL ? true : event && event.propertyName == '_on' + type || !event) {
123 fn.apply(element, [event].concat(args));
124 }
125 };
126 },
127
128 addListener = function (element, orgType, fn, args) {
129 var type = orgType.replace(stripName, ''),
130 events = retrieveEvents(element),
131 handlers = events[type] || (events[type] = {}),
132 uid = retrieveUid(fn, orgType.replace(namespace, ''));
133 if (handlers[uid]) {
134 return element;
135 }
136 var custom = customEvents[type];
137 if (custom) {
138 fn = custom.condition ? customHandler(element, fn, type, custom.condition) : fn;
139 type = custom.base || type;
140 }
141 var isNative = nativeEvents[type];
142 fn = isNative ? nativeHandler(element, fn, args) : customHandler(element, fn, type, false, args);
143 isNative = W3C_MODEL || isNative;
144 if (type == 'unload') {
145 var org = fn;
146 fn = function () {
147 removeListener(element, type, fn) && org();
148 };
149 }
150 element[eventSupport] && listener(element, isNative ? type : 'propertychange', fn, true, !isNative && type);
151 handlers[uid] = fn;
152 fn.__uid = uid;
153 return type == 'unload' ? element : (collected[retrieveUid(element)] = element);
154 },
155
156 removeListener = function (element, orgType, handler) {
157 var uid, names, uids, i, events = retrieveEvents(element), type = orgType.replace(stripName, '');
158 if (!events || !events[type]) {
159 return element;
160 }
161 names = orgType.replace(namespace, '');
162 uids = names ? names.split('.') : [handler.__uid];
163 for (i = uids.length; i--;) {
164 uid = uids[i];
165 handler = events[type][uid];
166 delete events[type][uid];
167 if (element[eventSupport]) {
168 type = customEvents[type] ? customEvents[type].base : type;
169 var isNative = W3C_MODEL || nativeEvents[type];
170 listener(element, isNative ? type : 'propertychange', handler, false, !isNative && type);
171 }
172 }
173 return element;
174 },
175
176 del = function (selector, fn, $) {
177 return function (e) {
178 var array = typeof selector == 'string' ? $(selector, this) : selector;
179 for (var target = e.target; target && target != this; target = target.parentNode) {
180 for (var i = array.length; i--;) {
181 if (array[i] == target) {
182 return fn.apply(target, arguments);
183 }
184 }
185 }
186 };
187 },
188
189 add = function (element, events, fn, delfn, $) {
190 if (typeof events == 'object' && !fn) {
191 for (var type in events) {
192 events.hasOwnProperty(type) && add(element, type, events[type]);
193 }
194 } else {
195 var isDel = typeof fn == 'string', types = (isDel ? fn : events).split(' ');
196 fn = isDel ? del(events, delfn, $) : fn;
197 for (var i = types.length; i--;) {
198 addListener(element, types[i], fn, Array.prototype.slice.call(arguments, isDel ? 4 : 3));
199 }
200 }
201 return element;
202 },
203
204 remove = function (element, orgEvents, fn) {
205 var k, type, events, i,
206 isString = typeof(orgEvents) == 'string',
207 names = isString && orgEvents.replace(namespace, ''),
208 rm = removeListener,
209 attached = retrieveEvents(element);
210 if (isString && /\s/.test(orgEvents)) {
211 orgEvents = orgEvents.split(' ');
212 i = orgEvents.length - 1;
213 while (remove(element, orgEvents[i]) && i--) {}
214 return element;
215 }
216 events = isString ? orgEvents.replace(stripName, '') : orgEvents;
217 if (!attached || (isString && !attached[events])) {
218 return element;
219 }
220 if (typeof fn == 'function') {
221 rm(element, events, fn);
222 } else if (names) {
223 rm(element, orgEvents);
224 } else {
225 rm = events ? rm : remove;
226 type = isString && events;
227 events = events ? (fn || attached[events] || events) : attached;
228 for (k in events) {
229 events.hasOwnProperty(k) && rm(element, type || k, events[k]);
230 }
231 }
232 return element;
233 },
234
235 fire = function (element, type, args) {
236 var evt, k, i, types = type.split(' ');
237 for (i = types.length; i--;) {
238 type = types[i].replace(stripName, '');
239 var isNative = nativeEvents[type],
240 isNamespace = types[i].replace(namespace, ''),
241 handlers = retrieveEvents(element)[type];
242 if (isNamespace) {
243 isNamespace = isNamespace.split('.');
244 for (k = isNamespace.length; k--;) {
245 handlers[isNamespace[k]] && handlers[isNamespace[k]].apply(element, args);
246 }
247 } else if (!args && element[eventSupport]) {
248 fireListener(isNative, type, element);
249 } else {
250 for (k in handlers) {
251 handlers.hasOwnProperty(k) && handlers[k].apply(element, args);
252 }
253 }
254 }
255 return element;
256 },
257
258 fireListener = W3C_MODEL ? function (isNative, type, element) {
259 evt = document.createEvent(isNative ? "HTMLEvents" : "UIEvents");
260 evt[isNative ? 'initEvent' : 'initUIEvent'](type, true, true, context, 1);
261 element.dispatchEvent(evt);
262 } : function (isNative, type, element) {
263 isNative ? element.fireEvent('on' + type, document.createEventObject()) : element['_on' + type]++;
264 },
265
266 clone = function (element, from, type) {
267 var events = retrieveEvents(from), obj, k;
268 obj = type ? events[type] : events;
269 for (k in obj) {
270 obj.hasOwnProperty(k) && (type ? add : clone)(element, type || from, type ? obj[k] : k);
271 }
272 return element;
273 },
274
275 fixEvent = function (e) {
276 var result = {};
277 if (!e) {
278 return result;
279 }
280 var type = e.type, target = e.target || e.srcElement;
281 result.preventDefault = fixEvent.preventDefault(e);
282 result.stopPropagation = fixEvent.stopPropagation(e);
283 result.target = target && target.nodeType == 3 ? target.parentNode : target;
284 if (~type.indexOf('key')) {
285 result.keyCode = e.which || e.keyCode;
286 } else if ((/click|mouse|menu/i).test(type)) {
287 result.rightClick = e.which == 3 || e.button == 2;
288 result.pos = { x: 0, y: 0 };
289 if (e.pageX || e.pageY) {
290 result.clientX = e.pageX;
291 result.clientY = e.pageY;
292 } else if (e.clientX || e.clientY) {
293 result.clientX = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
294 result.clientY = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
295 }
296 overOut.test(type) && (result.relatedTarget = e.relatedTarget || e[(type == 'mouseover' ? 'from' : 'to') + 'Element']);
297 }
298 for (var k in e) {
299 if (!(k in result)) {
300 result[k] = e[k];
301 }
302 }
303 return result;
304 };
305
306 fixEvent.preventDefault = function (e) {
307 return function () {
308 if (e.preventDefault) {
309 e.preventDefault();
310 }
311 else {
312 e.returnValue = false;
313 }
314 };
315 };
316
317 fixEvent.stopPropagation = function (e) {
318 return function () {
319 if (e.stopPropagation) {
320 e.stopPropagation();
321 } else {
322 e.cancelBubble = true;
323 }
324 };
325 };
326
327 var nativeEvents = { click: 1, dblclick: 1, mouseup: 1, mousedown: 1, contextmenu: 1, //mouse buttons
328 mousewheel: 1, DOMMouseScroll: 1, //mouse wheel
329 mouseover: 1, mouseout: 1, mousemove: 1, selectstart: 1, selectend: 1, //mouse movement
330 keydown: 1, keypress: 1, keyup: 1, //keyboard
331 orientationchange: 1, // mobile
332 touchstart: 1, touchmove: 1, touchend: 1, touchcancel: 1, // touch
333 gesturestart: 1, gesturechange: 1, gestureend: 1, // gesture
334 focus: 1, blur: 1, change: 1, reset: 1, select: 1, submit: 1, //form elements
335 load: 1, unload: 1, beforeunload: 1, resize: 1, move: 1, DOMContentLoaded: 1, readystatechange: 1, //window
336 error: 1, abort: 1, scroll: 1 }; //misc
337
338 function check(event) {
339 var related = event.relatedTarget;
340 if (!related) {
341 return related == null;
342 }
343 return (related != this && related.prefix != 'xul' && !/document/.test(this.toString()) && !isDescendant(this, related));
344 }
345
346 var customEvents = {
347 mouseenter: { base: 'mouseover', condition: check },
348 mouseleave: { base: 'mouseout', condition: check },
349 mousewheel: { base: /Firefox/.test(navigator.userAgent) ? 'DOMMouseScroll' : 'mousewheel' }
350 };
351
352 var bean = { add: add, remove: remove, clone: clone, fire: fire };
353
354 var clean = function (el) {
355 var uid = remove(el).__uid;
356 if (uid) {
357 delete collected[uid];
358 delete registry[uid];
359 }
360 };
361
362 if (context[attachEvent]) {
363 add(context, 'unload', function () {
364 for (var k in collected) {
365 collected.hasOwnProperty(k) && clean(collected[k]);
366 }
367 context.CollectGarbage && CollectGarbage();
368 });
369 }
370
371 var oldBean = context.bean;
372 bean.noConflict = function () {
373 context.bean = oldBean;
374 return this;
375 };
376
377 (typeof module !== 'undefined' && module.exports) ?
378 (module.exports = bean) :
379 (context['bean'] = bean);
380
381 }(this);!function ($) {
382 var b = bean.noConflict(),
383 integrate = function (method, type, method2) {
384 var _args = type ? [type] : [];
385 return function () {
386 for (var args, i = 0, l = this.length; i < l; i++) {
387 args = [this[i]].concat(_args, Array.prototype.slice.call(arguments, 0));
388 args.length == 4 && args.push($);
389 !arguments.length && method == 'add' && type && (method = 'fire');
390 b[method].apply(this, args);
391 }
392 return this;
393 };
394 };
395
396 var add = integrate('add'),
397 remove = integrate('remove'),
398 fire = integrate('fire');
399
400 var methods = {
401
402 on: add,
403 addListener: add,
404 bind: add,
405 listen: add,
406 delegate: add,
407
408 unbind: remove,
409 unlisten: remove,
410 removeListener: remove,
411 undelegate: remove,
412
413 emit: fire,
414 trigger: fire,
415
416 cloneEvents: integrate('clone'),
417
418 hover: function (enter, leave, i) { // i for internal
419 for (i = this.length; i--;) {
420 b.add.call(this, this[i], 'mouseenter', enter);
421 b.add.call(this, this[i], 'mouseleave', leave);
422 }
423 return this;
424 }
425 };
426
427 var i, shortcuts = [
428 'blur', 'change', 'click', 'dblclick', 'error', 'focus', 'focusin',
429 'focusout', 'keydown', 'keypress', 'keyup', 'load', 'mousedown',
430 'mouseenter', 'mouseleave', 'mouseout', 'mouseover', 'mouseup', 'mousemove',
431 'resize', 'scroll', 'select', 'submit', 'unload'
432 ];
433
434 for (i = shortcuts.length; i--;) {
435 methods[shortcuts[i]] = integrate('add', shortcuts[i]);
436 }
437
438 $.ender(methods, true);
439 }(ender);
440 /*!
441 * bonzo.js - copyright @dedfat 2011
442 * https://github.com/ded/bonzo
443 * Follow our software http://twitter.com/dedfat
444 * MIT License
445 */
446 !function (context, win) {
447
448 var doc = context.document,
449 html = doc.documentElement,
450 parentNode = 'parentNode',
451 query = null,
452 byTag = 'getElementsByTagName',
453 specialAttributes = /^checked|value|selected$/,
454 specialTags = /select|fieldset|table|tbody|tfoot|td|tr|colgroup/i,
455 table = 'table',
456 tagMap = { thead: table, tbody: table, tfoot: table, tr: 'tbody', th: 'tr', td: 'tr', fieldset: 'form', option: 'select' },
457 stateAttributes = /^checked|selected$/,
458 ie = /msie/i.test(navigator.userAgent),
459 uidList = [],
460 uuids = 0,
461 digit = /^-?[\d\.]+$/,
462 px = 'px',
463 // commonly used methods
464 setAttribute = 'setAttribute',
465 getAttribute = 'getAttribute',
466 trimReplace = /(^\s*|\s*$)/g,
467 unitless = { lineHeight: 1, zoom: 1, zIndex: 1, opacity: 1 };
468
469 function classReg(c) {
470 return new RegExp("(^|\\s+)" + c + "(\\s+|$)");
471 }
472
473 function each(ar, fn, scope) {
474 for (var i = 0, l = ar.length; i < l; i++) {
475 fn.call(scope || ar[i], ar[i], i, ar);
476 }
477 return ar;
478 }
479
480 var trim = String.prototype.trim ?
481 function (s) {
482 return s.trim();
483 } :
484 function (s) {
485 return s.replace(trimReplace, '');
486 };
487
488 function camelize(s) {
489 return s.replace(/-(.)/g, function (m, m1) {
490 return m1.toUpperCase();
491 });
492 }
493
494 function is(node) {
495 return node && node.nodeName && node.nodeType == 1;
496 }
497
498 function some(ar, fn, scope) {
499 for (var i = 0, j = ar.length; i < j; ++i) {
500 if (fn.call(scope, ar[i], i, ar)) {
501 return true;
502 }
503 }
504 return false;
505 }
506
507 var getStyle = doc.defaultView && doc.defaultView.getComputedStyle ?
508 function (el, property) {
509 var value = null;
510 if (property == 'float') {
511 property = 'cssFloat';
512 }
513 var computed = doc.defaultView.getComputedStyle(el, '');
514 computed && (value = computed[camelize(property)]);
515 return el.style[property] || value;
516
517 } : (ie && html.currentStyle) ?
518
519 function (el, property) {
520 property = camelize(property);
521 property = property == 'float' ? 'styleFloat' : property;
522
523 if (property == 'opacity') {
524 var val = 100;
525 try {
526 val = el.filters['DXImageTransform.Microsoft.Alpha'].opacity;
527 } catch (e1) {
528 try {
529 val = el.filters('alpha').opacity;
530 } catch (e2) {}
531 }
532 return val / 100;
533 }
534 var value = el.currentStyle ? el.currentStyle[property] : null;
535 return el.style[property] || value;
536 } :
537
538 function (el, property) {
539 return el.style[camelize(property)];
540 };
541
542 function insert(target, host, fn) {
543 var i = 0, self = host || this, r = [],
544 nodes = query && typeof target == 'string' && target.charAt(0) != '<' ? function (n) {
545 return (n = query(target)) && (n.selected = 1) && n;
546 }() : target;
547 each(normalize(nodes), function (t) {
548 each(self, function (el) {
549 var n = !el[parentNode] || (el[parentNode] && !el[parentNode][parentNode]) ?
550 function () {
551 var c = el.cloneNode(true);
552 self.$ && self.cloneEvents && self.$(c).cloneEvents(el);
553 return c;
554 }() :
555 el;
556 fn(t, n);
557 r[i] = n;
558 i++;
559 });
560 }, this);
561 each(r, function (e, i) {
562 self[i] = e;
563 });
564 self.length = i;
565 return self;
566 }
567
568 function xy(el, x, y) {
569 var $el = bonzo(el),
570 style = $el.css('position'),
571 offset = $el.offset(),
572 rel = 'relative',
573 isRel = style == rel,
574 delta = [parseInt($el.css('left'), 10), parseInt($el.css('top'), 10)];
575
576 if (style == 'static') {
577 $el.css('position', rel);
578 style = rel;
579 }
580
581 isNaN(delta[0]) && (delta[0] = isRel ? 0 : el.offsetLeft);
582 isNaN(delta[1]) && (delta[1] = isRel ? 0 : el.offsetTop);
583
584 x !== null && (el.style.left = x - offset.left + delta[0] + 'px');
585 y !== null && (el.style.top = y - offset.top + delta[1] + 'px');
586
587 }
588
589 function Bonzo(elements) {
590 this.length = 0;
591 if (elements) {
592 elements = typeof elements !== 'string' &&
593 !elements.nodeType &&
594 typeof elements.length !== 'undefined' ?
595 elements :
596 [elements];
597 this.length = elements.length;
598 for (var i = 0; i < elements.length; i++) {
599 this[i] = elements[i];
600 }
601 }
602 }
603
604 Bonzo.prototype = {
605
606 each: function (fn, scope) {
607 return each(this, fn, scope);
608 },
609
610 map: function (fn, reject) {
611 var m = [], n, i;
612 for (i = 0; i < this.length; i++) {
613 n = fn.call(this, this[i]);
614 reject ? (reject(n) && m.push(n)) : m.push(n);
615 }
616 return m;
617 },
618
619 first: function () {
620 return bonzo(this[0]);
621 },
622
623 last: function () {
624 return bonzo(this[this.length - 1]);
625 },
626
627 html: function (h, text) {
628 var method = text ?
629 html.textContent == null ?
630 'innerText' :
631 'textContent' :
632 'innerHTML', m;
633 function append(el) {
634 while (el.firstChild) {
635 el.removeChild(el.firstChild);
636 }
637 each(normalize(h), function (node) {
638 el.appendChild(node);
639 });
640 }
641 return typeof h !== 'undefined' ?
642 this.each(function (el) {
643 (m = el.tagName.match(specialTags)) ?
644 append(el, m[0]) :
645 (el[method] = h);
646 }) :
647 this[0] ? this[0][method] : '';
648 },
649
650 text: function (text) {
651 return this.html(text, 1);
652 },
653
654 addClass: function (c) {
655 return this.each(function (el) {
656 this.hasClass(el, c) || (el.className = trim(el.className + ' ' + c));
657 }, this);
658 },
659
660 removeClass: function (c) {
661 return this.each(function (el) {
662 this.hasClass(el, c) && (el.className = trim(el.className.replace(classReg(c), ' ')));
663 }, this);
664 },
665
666 hasClass: function (el, c) {
667 return typeof c == 'undefined' ?
668 some(this, function (i) {
669 return classReg(el).test(i.className);
670 }) :
671 classReg(c).test(el.className);
672 },
673
674 toggleClass: function (c, condition) {
675 if (typeof condition !== 'undefined' && !condition) {
676 return this;
677 }
678 return this.each(function (el) {
679 this.hasClass(el, c) ?
680 (el.className = trim(el.className.replace(classReg(c), ' '))) :
681 (el.className = trim(el.className + ' ' + c));
682 }, this);
683 },
684
685 show: function (type) {
686 return this.each(function (el) {
687 el.style.display = type || '';
688 });
689 },
690
691 hide: function (elements) {
692 return this.each(function (el) {
693 el.style.display = 'none';
694 });
695 },
696
697 append: function (node) {
698 return this.each(function (el) {
699 each(normalize(node), function (i) {
700 el.appendChild(i);
701 });
702 });
703 },
704
705 prepend: function (node) {
706 return this.each(function (el) {
707 var first = el.firstChild;
708 each(normalize(node), function (i) {
709 el.insertBefore(i, first);
710 });
711 });
712 },
713
714 appendTo: function (target, host) {
715 return insert.call(this, target, host, function (t, el) {
716 t.appendChild(el);
717 });
718 },
719
720 prependTo: function (target, host) {
721 return insert.call(this, target, host, function (t, el) {
722 t.insertBefore(el, t.firstChild);
723 });
724 },
725
726 next: function () {
727 return this.related('nextSibling');
728 },
729
730 previous: function () {
731 return this.related('previousSibling');
732 },
733
734 related: function (method) {
735 return this.map(
736 function (el) {
737 el = el[method];
738 while (el && el.nodeType !== 1) {
739 el = el[method];
740 }
741 return el || 0;
742 },
743 function (el) {
744 return el;
745 }
746 );
747 },
748
749 before: function (node) {
750 return this.each(function (el) {
751 each(bonzo.create(node), function (i) {
752 el[parentNode].insertBefore(i, el);
753 });
754 });
755 },
756
757 after: function (node) {
758 return this.each(function (el) {
759 each(bonzo.create(node), function (i) {
760 el[parentNode].insertBefore(i, el.nextSibling);
761 });
762 });
763 },
764
765 insertBefore: function (target, host) {
766 return insert.call(this, target, host, function (t, el) {
767 t[parentNode].insertBefore(el, t);
768 });
769 },
770
771 insertAfter: function (target, host) {
772 return insert.call(this, target, host, function (t, el) {
773 var sibling = t.nextSibling;
774 if (sibling) {
775 t[parentNode].insertBefore(el, sibling);
776 }
777 else {
778 t[parentNode].appendChild(el);
779 }
780 });
781 },
782
783 css: function (o, v, p) {
784 // is this a request for just getting a style?
785 if (v === undefined && typeof o == 'string') {
786 // repurpose 'v'
787 v = this[0];
788 if (!v) {
789 return null;
790 }
791 if (v == doc || v == win) {
792 p = (v == doc) ? bonzo.doc() : bonzo.viewport();
793 return o == 'width' ? p.width :
794 o == 'height' ? p.height : '';
795 }
796 return getStyle(v, o);
797 }
798 var iter = o;
799 if (typeof o == 'string') {
800 iter = {};
801 iter[o] = v;
802 }
803
804 if (ie && iter.opacity) {
805 // oh this 'ol gamut
806 iter.filter = 'alpha(opacity=' + (iter.opacity * 100) + ')';
807 // give it layout
808 iter.zoom = o.zoom || 1;
809 delete iter.opacity;
810 }
811
812 if (v = iter['float']) {
813 // float is a reserved style word. w3 uses cssFloat, ie uses styleFloat
814 ie ? (iter.styleFloat = v) : (iter.cssFloat = v);
815 delete iter['float'];
816 }
817
818 var fn = function (el, p, v) {
819 for (var k in iter) {
820 if (iter.hasOwnProperty(k)) {
821 v = iter[k];
822 // change "5" to "5px" - unless you're line-height, which is allowed
823 (p = camelize(k)) && digit.test(v) && !(p in unitless) && (v += px);
824 el.style[p] = v;
825 }
826 }
827 };
828 return this.each(fn);
829 },
830
831 offset: function (x, y) {
832 if (x || y) {
833 return this.each(function (el) {
834 xy(el, x, y);
835 });
836 }
837 var el = this[0];
838 var width = el.offsetWidth;
839 var height = el.offsetHeight;
840 var top = el.offsetTop;
841 var left = el.offsetLeft;
842 while (el = el.offsetParent) {
843 top = top + el.offsetTop;
844 left = left + el.offsetLeft;
845 }
846
847 return {
848 top: top,
849 left: left,
850 height: height,
851 width: width
852 };
853 },
854
855 attr: function (k, v) {
856 var el = this[0];
857 return typeof v == 'undefined' ?
858 specialAttributes.test(k) ?
859 stateAttributes.test(k) && typeof el[k] == 'string' ?
860 true : el[k] : el[getAttribute](k) :
861 this.each(function (el) {
862 k == 'value' ? (el.value = v) : el[setAttribute](k, v);
863 });
864 },
865
866 val: function (s) {
867 return (typeof s == 'string') ? this.attr('value', s) : this[0].value;
868 },
869
870 removeAttr: function (k) {
871 return this.each(function (el) {
872 el.removeAttribute(k);
873 });
874 },
875
876 data: function (k, v) {
877 var el = this[0];
878 if (typeof v === 'undefined') {
879 el[getAttribute]('data-node-uid') || el[setAttribute]('data-node-uid', ++uuids);
880 var uid = el[getAttribute]('data-node-uid');
881 uidList[uid] || (uidList[uid] = {});
882 return uidList[uid][k];
883 } else {
884 return this.each(function (el) {
885 el[getAttribute]('data-node-uid') || el[setAttribute]('data-node-uid', ++uuids);
886 var uid = el[getAttribute]('data-node-uid');
887 var o = {};
888 o[k] = v;
889 uidList[uid] = o;
890 });
891 }
892 },
893
894 remove: function () {
895 return this.each(function (el) {
896 el[parentNode] && el[parentNode].removeChild(el);
897 });
898 },
899
900 empty: function () {
901 return this.each(function (el) {
902 while (el.firstChild) {
903 el.removeChild(el.firstChild);
904 }
905 });
906 },
907
908 detach: function () {
909 return this.map(function (el) {
910 return el[parentNode].removeChild(el);
911 });
912 },
913
914 scrollTop: function (y) {
915 return scroll.call(this, null, y, 'y');
916 },
917
918 scrollLeft: function (x) {
919 return scroll.call(this, x, null, 'x');
920 }
921 };
922
923 function normalize(node) {
924 return typeof node == 'string' ? bonzo.create(node) : is(node) ? [node] : node; // assume [nodes]
925 }
926
927 function scroll(x, y, type) {
928 var el = this[0];
929 if (x == null && y == null) {
930 return (isBody(el) ? getWindowScroll() : { x: el.scrollLeft, y: el.scrollTop })[type];
931 }
932 if (isBody(el)) {
933 win.scrollTo(x, y);
934 } else {
935 x != null && (el.scrollLeft = x);
936 y != null && (el.scrollTop = y);
937 }
938 return this;
939 }
940
941 function isBody(element) {
942 return element === win || (/^(?:body|html)$/i).test(element.tagName);
943 }
944
945 function getWindowScroll() {
946 return { x: win.pageXOffset || html.scrollLeft, y: win.pageYOffset || html.scrollTop };
947 }
948
949 function bonzo(els, host) {
950 return new Bonzo(els, host);
951 }
952
953 bonzo.setQueryEngine = function (q) {
954 query = q;
955 delete bonzo.setQueryEngine;
956 };
957
958 bonzo.aug = function (o, target) {
959 for (var k in o) {
960 o.hasOwnProperty(k) && ((target || Bonzo.prototype)[k] = o[k]);
961 }
962 };
963
964 bonzo.create = function (node) {
965 return typeof node == 'string' ?
966 function () {
967 var tag = /^<([^\s>]+)/.exec(node);
968 var el = doc.createElement(tag && tagMap[tag[1].toLowerCase()] || 'div'), els = [];
969 el.innerHTML = node;
970 var nodes = el.childNodes;
971 el = el.firstChild;
972 els.push(el);
973 while (el = el.nextSibling) {
974 (el.nodeType == 1) && els.push(el);
975 }
976 return els;
977
978 }() : is(node) ? [node.cloneNode(true)] : [];
979 };
980
981 bonzo.doc = function () {
982 var w = html.scrollWidth,
983 h = html.scrollHeight,
984 vp = this.viewport();
985 return {
986 width: Math.max(w, vp.width),
987 height: Math.max(h, vp.height)
988 };
989 };
990
991 bonzo.firstChild = function (el) {
992 for (var c = el.childNodes, i = 0, j = (c && c.length) || 0, e; i < j; i++) {
993 if (c[i].nodeType === 1) {
994 e = c[j = i];
995 }
996 }
997 return e;
998 };
999
1000 bonzo.viewport = function () {
1001 var h = self.innerHeight,
1002 w = self.innerWidth;
1003 if (ie) {
1004 h = html.clientHeight;
1005 w = html.clientWidth;
1006 }
1007 return {
1008 width: w,
1009 height: h
1010 };
1011 };
1012
1013 bonzo.isAncestor = 'compareDocumentPosition' in html ?
1014 function (container, element) {
1015 return (container.compareDocumentPosition(element) & 16) == 16;
1016 } : 'contains' in html ?
1017 function (container, element) {
1018 return container !== element && container.contains(element);
1019 } :
1020 function (container, element) {
1021 while (element = element[parentNode]) {
1022 if (element === container) {
1023 return true;
1024 }
1025 }
1026 return false;
1027 };
1028
1029 var old = context.bonzo;
1030 bonzo.noConflict = function () {
1031 context.bonzo = old;
1032 return this;
1033 };
1034 context['bonzo'] = bonzo;
1035
1036 }(this, window);!function ($) {
1037
1038 var b = bonzo;
1039 b.setQueryEngine($);
1040 $.ender(b);
1041 $.ender(b(), true);
1042 $.ender({
1043 create: function (node) {
1044 return $(b.create(node));
1045 }
1046 });
1047
1048 $.id = function (id) {
1049 return $([document.getElementById(id)]);
1050 };
1051
1052 function indexOf(ar, val) {
1053 for (var i = 0; i < ar.length; i++) {
1054 if (ar[i] === val) {
1055 return i;
1056 }
1057 }
1058 return -1;
1059 }
1060
1061 function uniq(ar) {
1062 var a = [], i, j;
1063 label:
1064 for (i = 0; i < ar.length; i++) {
1065 for (j = 0; j < a.length; j++) {
1066 if (a[j] == ar[i]) {
1067 continue label;
1068 }
1069 }
1070 a[a.length] = ar[i];
1071 }
1072 return a;
1073 }
1074
1075 $.ender({
1076 parents: function (selector, closest) {
1077 var collection = $(selector), j, k, p, r = [];
1078 for (j = 0, k = this.length; j < k; j++) {
1079 p = this[j];
1080 while (p = p.parentNode) {
1081 if (indexOf(collection, p) !== -1) {
1082 r.push(p);
1083 if (closest) break;
1084 }
1085 }
1086 }
1087 return $(uniq(r));
1088 },
1089
1090 closest: function (selector) {
1091 return this.parents(selector, true);
1092 },
1093
1094 first: function () {
1095 return $(this[0]);
1096 },
1097
1098 last: function () {
1099 return $(this[this.length - 1]);
1100 },
1101
1102 next: function () {
1103 return $(b(this).next());
1104 },
1105
1106 previous: function () {
1107 return $(b(this).previous());
1108 },
1109
1110 appendTo: function (t) {
1111 return b(this.selector).appendTo(t, this);
1112 },
1113
1114 prependTo: function (t) {
1115 return b(this.selector).prependTo(t, this);
1116 },
1117
1118 insertAfter: function (t) {
1119 return b(this.selector).insertAfter(t, this);
1120 },
1121
1122 insertBefore: function (t) {
1123 return b(this.selector).insertBefore(t, this);
1124 },
1125
1126 siblings: function () {
1127 var i, l, p, r = [];
1128 for (i = 0, l = this.length; i < l; i++) {
1129 p = this[i];
1130 while (p = p.previousSibling) {
1131 p.nodeType == 1 && r.push(p);
1132 }
1133 p = this[i];
1134 while (p = p.nextSibling) {
1135 p.nodeType == 1 && r.push(p);
1136 }
1137 }
1138 return $(r);
1139 },
1140
1141 children: function () {
1142 var i, el, r = [];
1143 for (i = 0, l = this.length; i < l; i++) {
1144 if (!(el = b.firstChild(this[i]))) {
1145 continue;
1146 }
1147 r.push(el);
1148 while (el = el.nextSibling) {
1149 el.nodeType == 1 && r.push(el);
1150 }
1151 }
1152 return $(uniq(r));
1153 },
1154
1155 height: function (v) {
1156 return dimension(v, this, 'height')
1157 },
1158
1159 width: function (v) {
1160 return dimension(v, this, 'width')
1161 }
1162 }, true);
1163
1164 function dimension(v, self, which) {
1165 return v ?
1166 self.css(which, v) :
1167 function (r) {
1168 r = parseInt(self.css(which), 10);
1169 return isNaN(r) ? self[0]['offset' + which.replace(/^\w/, function (m) {return m.toUpperCase()})] : r
1170 }()
1171 }
1172
1173 }(ender || $);
1174
1175 !function (context, doc) {
1176 var fns = [], ol, fn, f = false,
1177 testEl = doc.documentElement,
1178 hack = testEl.doScroll,
1179 domContentLoaded = 'DOMContentLoaded',
1180 addEventListener = 'addEventListener',
1181 onreadystatechange = 'onreadystatechange',
1182 loaded = /^loade|c/.test(doc.readyState);
1183
1184 function flush(i) {
1185 loaded = 1;
1186 while (i = fns.shift()) { i() }
1187 }
1188 doc[addEventListener] && doc[addEventListener](domContentLoaded, fn = function () {
1189 doc.removeEventListener(domContentLoaded, fn, f);
1190 flush();
1191 }, f);
1192
1193
1194 hack && doc.attachEvent(onreadystatechange, (ol = function () {
1195 if (/^c/.test(doc.readyState)) {
1196 doc.detachEvent(onreadystatechange, ol);
1197 flush();
1198 }
1199 }));
1200
1201 context['domReady'] = hack ?
1202 function (fn) {
1203 self != top ?
1204 loaded ? fn() : fns.push(fn) :
1205 function () {
1206 try {
1207 testEl.doScroll('left');
1208 } catch (e) {
1209 return setTimeout(function() { domReady(fn) }, 50);
1210 }
1211 fn();
1212 }()
1213 } :
1214 function (fn) {
1215 loaded ? fn() : fns.push(fn);
1216 };
1217
1218 }(this, document);!function ($) {
1219 $.ender({domReady: domReady});
1220 $.ender({
1221 ready: function (f) {
1222 domReady(f);
1223 return this;
1224 }
1225 }, true);
1226 }(ender);
1227 /*!
1228 * Qwery - A Blazing Fast query selector engine
1229 * https://github.com/ded/qwery
1230 * copyright Dustin Diaz & Jacob Thornton 2011
1231 * MIT License
1232 */
1233
1234 !function (context, doc) {
1235
1236 var c, i, j, k, l, m, o, p, r, v,
1237 el, node, len, found, classes, item, items, token,
1238 html = doc.documentElement,
1239 id = /#([\w\-]+)/,
1240 clas = /\.[\w\-]+/g,
1241 idOnly = /^#([\w\-]+$)/,
1242 classOnly = /^\.([\w\-]+)$/,
1243 tagOnly = /^([\w\-]+)$/,
1244 tagAndOrClass = /^([\w]+)?\.([\w\-]+)$/,
1245 normalizr = /\s*([\s\+\~>])\s*/g,
1246 splitters = /[\s\>\+\~]/,
1247 splittersMore = /(?![\s\w\-\/\?\&\=\:\.\(\)\!,@#%<>\{\}\$\*\^'"]*\])/,
1248 dividers = new RegExp('(' + splitters.source + ')' + splittersMore.source, 'g'),
1249 tokenizr = new RegExp(splitters.source + splittersMore.source),
1250 specialChars = /([.*+?\^=!:${}()|\[\]\/\\])/g,
1251 simple = /^([a-z0-9]+)?(?:([\.\#]+[\w\-\.#]+)?)/,
1252 attr = /\[([\w\-]+)(?:([\|\^\$\*\~]?\=)['"]?([ \w\-\/\?\&\=\:\.\(\)\!,@#%<>\{\}\$\*\^]+)["']?)?\]/,
1253 pseudo = /:([\w\-]+)(\(['"]?(\w+)['"]?\))?/,
1254 chunker = new RegExp(simple.source + '(' + attr.source + ')?' + '(' + pseudo.source + ')?'),
1255 walker = {
1256 ' ': function (node) {
1257 return node && node !== html && node.parentNode
1258 },
1259 '>': function (node, contestant) {
1260 return node && node.parentNode == contestant.parentNode && node.parentNode;
1261 },
1262 '~': function (node) {
1263 return node && node.previousSibling;
1264 },
1265 '+': function (node, contestant, p1, p2) {
1266 if (!node) {
1267 return false;
1268 }
1269 p1 = previous(node);
1270 p2 = previous(contestant);
1271 return p1 && p2 && p1 == p2 && p1;
1272 }
1273 };
1274 window.tokenizr = tokenizr;
1275 window.dividers = dividers;
1276 function cache() {
1277 this.c = {};
1278 }
1279 cache.prototype = {
1280 g: function (k) {
1281 return this.c[k] || undefined;
1282 },
1283 s: function (k, v) {
1284 this.c[k] = v;
1285 return v;
1286 }
1287 };
1288
1289 var classCache = new cache(),
1290 cleanCache = new cache(),
1291 attrCache = new cache(),
1292 tokenCache = new cache();
1293
1294 function array(ar) {
1295 r = [];
1296 for (i = 0, len = ar.length; i < len; i++) {
1297 r[i] = ar[i];
1298 }
1299 return r;
1300 }
1301
1302 function previous(n) {
1303 while (n = n.previousSibling) {
1304 if (n.nodeType == 1) {
1305 break;
1306 }
1307 }
1308 return n
1309 }
1310
1311 function q(query) {
1312 return query.match(chunker);
1313 }
1314
1315 // this next method expect at most these args
1316 // given => div.hello[title="world"]:foo('bar')
1317
1318 // div.hello[title="world"]:foo('bar'), div, .hello, [title="world"], title, =, world, :foo('bar'), foo, ('bar'), bar]
1319
1320 function interpret(whole, tag, idsAndClasses, wholeAttribute, attribute, qualifier, value, wholePseudo, pseudo, wholePseudoVal, pseudoVal) {
1321 var m, c, k;
1322 if (tag && this.tagName.toLowerCase() !== tag) {
1323 return false;
1324 }
1325 if (idsAndClasses && (m = idsAndClasses.match(id)) && m[1] !== this.id) {
1326 return false;
1327 }
1328 if (idsAndClasses && (classes = idsAndClasses.match(clas))) {
1329 for (i = classes.length; i--;) {
1330 c = classes[i].slice(1);
1331 if (!(classCache.g(c) || classCache.s(c, new RegExp('(^|\\s+)' + c + '(\\s+|$)'))).test(this.className)) {
1332 return false;
1333 }
1334 }
1335 }
1336 if (pseudo && qwery.pseudos[pseudo] && !qwery.pseudos[pseudo](this, pseudoVal)) {
1337 return false;
1338 }
1339 if (wholeAttribute && !value) {
1340 o = this.attributes;
1341 for (k in o) {
1342 if (Object.prototype.hasOwnProperty.call(o, k) && (o[k].name || k) == attribute) {
1343 return this;
1344 }
1345 }
1346 }
1347 if (wholeAttribute && !checkAttr(qualifier, this.getAttribute(attribute) || '', value)) {
1348 return false;
1349 }
1350 return this;
1351 }
1352
1353 function clean(s) {
1354 return cleanCache.g(s) || cleanCache.s(s, s.replace(specialChars, '\\$1'));
1355 }
1356
1357 function checkAttr(qualify, actual, val) {
1358 switch (qualify) {
1359 case '=':
1360 return actual == val;
1361 case '^=':
1362 return actual.match(attrCache.g('^=' + val) || attrCache.s('^=' + val, new RegExp('^' + clean(val))));
1363 case '$=':
1364 return actual.match(attrCache.g('$=' + val) || attrCache.s('$=' + val, new RegExp(clean(val) + '$')));
1365 case '*=':
1366 return actual.match(attrCache.g(val) || attrCache.s(val, new RegExp(clean(val))));
1367 case '~=':
1368 return actual.match(attrCache.g('~=' + val) || attrCache.s('~=' + val, new RegExp('(?:^|\\s+)' + clean(val) + '(?:\\s+|$)')));
1369 case '|=':
1370 return actual.match(attrCache.g('|=' + val) || attrCache.s('|=' + val, new RegExp('^' + clean(val) + '(-|$)')));
1371 }
1372 return 0;
1373 }
1374
1375 function _qwery(selector) {
1376 var r = [], ret = [], i, j = 0, k, l, m, p, token, tag, els, root, intr, item, children,
1377 tokens = tokenCache.g(selector) || tokenCache.s(selector, selector.split(tokenizr)),
1378 dividedTokens = selector.match(dividers), dividedToken;
1379 tokens = tokens.slice(0); // this makes a copy of the array so the cached original is not effected
1380 if (!tokens.length) {
1381 return r;
1382 }
1383
1384 token = tokens.pop();
1385 root = tokens.length && (m = tokens[tokens.length - 1].match(idOnly)) ? doc.getElementById(m[1]) : doc;
1386 if (!root) {
1387 return r;
1388 }
1389 intr = q(token);
1390 els = dividedTokens && /^[+~]$/.test(dividedTokens[dividedTokens.length - 1]) ? function (r) {
1391 while (root = root.nextSibling) {
1392 root.nodeType == 1 && (intr[1] ? intr[1] == root.tagName.toLowerCase() : 1) && r.push(root)
1393 }
1394 return r
1395 }([]) :
1396 root.getElementsByTagName(intr[1] || '*');
1397 for (i = 0, l = els.length; i < l; i++) {
1398 if (item = interpret.apply(els[i], intr)) {
1399 r[j++] = item;
1400 }
1401 }
1402 if (!tokens.length) {
1403 return r;
1404 }
1405
1406 // loop through all descendent tokens
1407 for (j = 0, l = r.length, k = 0; j < l; j++) {
1408 p = r[j];
1409 // loop through each token backwards crawling up tree
1410 for (i = tokens.length; i--;) {
1411 // loop through parent nodes
1412 while (p = walker[dividedTokens[i]](p, r[j])) {
1413 if (found = interpret.apply(p, q(tokens[i]))) {
1414 break;
1415 }
1416 }
1417 }
1418 found && (ret[k++] = r[j]);
1419 }
1420 return ret;
1421 }
1422
1423 function boilerPlate(selector, _root, fn) {
1424 var root = (typeof _root == 'string') ? fn(_root)[0] : (_root || doc);
1425 if (selector === window || isNode(selector)) {
1426 return !_root || (selector !== window && isNode(root) && isAncestor(selector, root)) ? [selector] : [];
1427 }
1428 if (selector && typeof selector === 'object' && isFinite(selector.length)) {
1429 return array(selector);
1430 }
1431 if (m = selector.match(idOnly)) {
1432 return (el = doc.getElementById(m[1])) ? [el] : [];
1433 }
1434 if (m = selector.match(tagOnly)) {
1435 return array(root.getElementsByTagName(m[1]));
1436 }
1437 return false;
1438 }
1439
1440 function isNode(el) {
1441 return (el && el.nodeType && (el.nodeType == 1 || el.nodeType == 9));
1442 }
1443
1444 function uniq(ar) {
1445 var a = [], i, j;
1446 label:
1447 for (i = 0; i < ar.length; i++) {
1448 for (j = 0; j < a.length; j++) {
1449 if (a[j] == ar[i]) {
1450 continue label;
1451 }
1452 }
1453 a[a.length] = ar[i];
1454 }
1455 return a;
1456 }
1457
1458 function qwery(selector, _root) {
1459 var root = (typeof _root == 'string') ? qwery(_root)[0] : (_root || doc);
1460 if (!root || !selector) {
1461 return [];
1462 }
1463 if (m = boilerPlate(selector, _root, qwery)) {
1464 return m;
1465 }
1466 return select(selector, root);
1467 }
1468
1469 var isAncestor = 'compareDocumentPosition' in html ?
1470 function (element, container) {
1471 return (container.compareDocumentPosition(element) & 16) == 16;
1472 } : 'contains' in html ?
1473 function (element, container) {
1474 container = container == doc || container == window ? html : container;
1475 return container !== element && container.contains(element);
1476 } :
1477 function (element, container) {
1478 while (element = element.parentNode) {
1479 if (element === container) {
1480 return 1;
1481 }
1482 }
1483 return 0;
1484 },
1485
1486 select = (doc.querySelector && doc.querySelectorAll) ?
1487 function (selector, root) {
1488 if (doc.getElementsByClassName && (m = selector.match(classOnly))) {
1489 return array((root).getElementsByClassName(m[1]));
1490 }
1491 return array((root).querySelectorAll(selector));
1492 } :
1493 function (selector, root) {
1494 selector = selector.replace(normalizr, '$1');
1495 var result = [], collection, collections = [], i;
1496 if (m = selector.match(tagAndOrClass)) {
1497 items = root.getElementsByTagName(m[1] || '*');
1498 r = classCache.g(m[2]) || classCache.s(m[2], new RegExp('(^|\\s+)' + m[2] + '(\\s+|$)'));
1499 for (i = 0, l = items.length, j = 0; i < l; i++) {
1500 r.test(items[i].className) && (result[j++] = items[i]);
1501 }
1502 return result;
1503 }
1504 for (i = 0, items = selector.split(','), l = items.length; i < l; i++) {
1505 collections[i] = _qwery(items[i]);
1506 }
1507 for (i = 0, l = collections.length; i < l && (collection = collections[i]); i++) {
1508 var ret = collection;
1509 if (root !== doc) {
1510 ret = [];
1511 for (j = 0, m = collection.length; j < m && (element = collection[j]); j++) {
1512 // make sure element is a descendent of root
1513 isAncestor(element, root) && ret.push(element);
1514 }
1515 }
1516 result = result.concat(ret);
1517 }
1518 return uniq(result);
1519 };
1520
1521 qwery.uniq = uniq;
1522 qwery.pseudos = {};
1523
1524 var oldQwery = context.qwery;
1525 qwery.noConflict = function () {
1526 context.qwery = oldQwery;
1527 return this;
1528 };
1529 context['qwery'] = qwery;
1530
1531 }(this, document);!function (doc) {
1532 var q = qwery.noConflict();
1533 var table = 'table',
1534 nodeMap = {
1535 thead: table,
1536 tbody: table,
1537 tfoot: table,
1538 tr: 'tbody',
1539 th: 'tr',
1540 td: 'tr',
1541 fieldset: 'form',
1542 option: 'select'
1543 }
1544 function create(node, root) {
1545 var tag = /^<([^\s>]+)/.exec(node)[1]
1546 var el = (root || doc).createElement(nodeMap[tag] || 'div'), els = [];
1547 el.innerHTML = node;
1548 var nodes = el.childNodes;
1549 el = el.firstChild;
1550 els.push(el);
1551 while (el = el.nextSibling) {
1552 (el.nodeType == 1) && els.push(el);
1553 }
1554 return els;
1555 }
1556 $._select = function (s, r) {
1557 return /^\s*</.test(s) ? create(s, r) : q(s, r);
1558 };
1559 $.ender({
1560 find: function (s) {
1561 var r = [], i, l, j, k, els;
1562 for (i = 0, l = this.length; i < l; i++) {
1563 els = q(s, this[i]);
1564 for (j = 0, k = els.length; j < k; j++) {
1565 r.push(els[j]);
1566 }
1567 }
1568 return $(q.uniq(r));
1569 }
1570 , and: function (s) {
1571 var plus = $(s);
1572 for (var i = this.length, j = 0, l = this.length + plus.length; i < l; i++, j++) {
1573 this[i] = plus[j];
1574 }
1575 return this;
1576 }
1577 }, true);
1578 }(document);