1/* QuoJS v2.3.6 - 2013/5/13 2 http://quojs.tapquo.com 3 Copyright (c) 2013 Javi Jimenez Villar (@soyjavi) - Licensed MIT */ 4(function() { 5 var Quo; 6 7 Quo = (function() { 8 var $$, EMPTY_ARRAY, Q; 9 10 EMPTY_ARRAY = []; 11 $$ = function(selector, children) { 12 var dom; 13 14 if (!selector) { 15 return Q(); 16 } else if ($$.toType(selector) === "function") { 17 return $$(document).ready(selector); 18 } else { 19 dom = $$.getDOMObject(selector, children); 20 return Q(dom, selector); 21 } 22 }; 23 Q = function(dom, selector) { 24 dom = dom || EMPTY_ARRAY; 25 dom.__proto__ = Q.prototype; 26 dom.selector = selector || ''; 27 return dom; 28 }; 29 $$.extend = function(target) { 30 Array.prototype.slice.call(arguments, 1).forEach(function(source) { 31 var key, _results; 32 33 _results = []; 34 for (key in source) { 35 _results.push(target[key] = source[key]); 36 } 37 return _results; 38 }); 39 return target; 40 }; 41 Q.prototype = $$.fn = {}; 42 return $$; 43 })(); 44 45 window.Quo = Quo; 46 47 "$$" in window || (window.$$ = Quo); 48 49}).call(this); 50 51(function() { 52 (function($$) { 53 var DEFAULT, JSONP_ID, MIME_TYPES, _isJsonP, _parseResponse, _xhrError, _xhrForm, _xhrHeaders, _xhrStatus, _xhrSuccess, _xhrTimeout; 54 55 DEFAULT = { 56 TYPE: "GET", 57 MIME: "json" 58 }; 59 MIME_TYPES = { 60 script: "text/javascript, application/javascript", 61 json: "application/json", 62 xml: "application/xml, text/xml", 63 html: "text/html", 64 text: "text/plain" 65 }; 66 JSONP_ID = 0; 67 $$.ajaxSettings = { 68 type: DEFAULT.TYPE, 69 async: true, 70 success: {}, 71 error: {}, 72 context: null, 73 dataType: DEFAULT.MIME, 74 headers: {}, 75 xhr: function() { 76 return new window.XMLHttpRequest(); 77 }, 78 crossDomain: false, 79 timeout: 0 80 }; 81 $$.ajax = function(options) { 82 var abortTimeout, error, settings, xhr; 83 84 settings = $$.mix($$.ajaxSettings, options); 85 if (settings.type === DEFAULT.TYPE) { 86 settings.url += $$.serializeParameters(settings.data, "?"); 87 } else { 88 settings.data = $$.serializeParameters(settings.data); 89 } 90 if (_isJsonP(settings.url)) { 91 return $$.jsonp(settings); 92 } 93 xhr = settings.xhr(); 94 xhr.onreadystatechange = function() { 95 if (xhr.readyState === 4) { 96 clearTimeout(abortTimeout); 97 return _xhrStatus(xhr, settings); 98 } 99 }; 100 xhr.open(settings.type, settings.url, settings.async); 101 _xhrHeaders(xhr, settings); 102 if (settings.timeout > 0) { 103 abortTimeout = setTimeout((function() { 104 return _xhrTimeout(xhr, settings); 105 }), settings.timeout); 106 } 107 try { 108 xhr.send(settings.data); 109 } catch (_error) { 110 error = _error; 111 xhr = error; 112 _xhrError("Resource not found", xhr, settings); 113 } 114 if (settings.async) { 115 return xhr; 116 } else { 117 return _parseResponse(xhr, settings); 118 } 119 }; 120 $$.jsonp = function(settings) { 121 var abortTimeout, callbackName, script, xhr; 122 123 if (settings.async) { 124 callbackName = "jsonp" + (++JSONP_ID); 125 script = document.createElement("script"); 126 xhr = { 127 abort: function() { 128 $$(script).remove(); 129 if (callbackName in window) { 130 return window[callbackName] = {}; 131 } 132 } 133 }; 134 abortTimeout = void 0; 135 window[callbackName] = function(response) { 136 clearTimeout(abortTimeout); 137 $$(script).remove(); 138 delete window[callbackName]; 139 return _xhrSuccess(response, xhr, settings); 140 }; 141 script.src = settings.url.replace(RegExp("=\\?"), "=" + callbackName); 142 $$("head").append(script); 143 if (settings.timeout > 0) { 144 abortTimeout = setTimeout((function() { 145 return _xhrTimeout(xhr, settings); 146 }), settings.timeout); 147 } 148 return xhr; 149 } else { 150 return console.error("QuoJS.ajax: Unable to make jsonp synchronous call."); 151 } 152 }; 153 $$.get = function(url, data, success, dataType) { 154 return $$.ajax({ 155 url: url, 156 data: data, 157 success: success, 158 dataType: dataType 159 }); 160 }; 161 $$.post = function(url, data, success, dataType) { 162 return _xhrForm("POST", url, data, success, dataType); 163 }; 164 $$.put = function(url, data, success, dataType) { 165 return _xhrForm("PUT", url, data, success, dataType); 166 }; 167 $$["delete"] = function(url, data, success, dataType) { 168 return _xhrForm("DELETE", url, data, success, dataType); 169 }; 170 $$.json = function(url, data, success) { 171 return $$.ajax({ 172 url: url, 173 data: data, 174 success: success, 175 dataType: DEFAULT.MIME 176 }); 177 }; 178 $$.serializeParameters = function(parameters, character) { 179 var parameter, serialize; 180 181 if (character == null) { 182 character = ""; 183 } 184 serialize = character; 185 for (parameter in parameters) { 186 if (parameters.hasOwnProperty(parameter)) { 187 if (serialize !== character) { 188 serialize += "&"; 189 } 190 serialize += "" + (encodeURIComponent(parameter)) + "=" + (encodeURIComponent(parameters[parameter])); 191 } 192 } 193 if (serialize === character) { 194 return ""; 195 } else { 196 return serialize; 197 } 198 }; 199 _xhrStatus = function(xhr, settings) { 200 if ((xhr.status >= 200 && xhr.status < 300) || xhr.status === 0) { 201 if (settings.async) { 202 _xhrSuccess(_parseResponse(xhr, settings), xhr, settings); 203 } 204 } else { 205 _xhrError("QuoJS.ajax: Unsuccesful request", xhr, settings); 206 } 207 }; 208 _xhrSuccess = function(response, xhr, settings) { 209 settings.success.call(settings.context, response, xhr); 210 }; 211 _xhrError = function(type, xhr, settings) { 212 settings.error.call(settings.context, type, xhr, settings); 213 }; 214 _xhrHeaders = function(xhr, settings) { 215 var header; 216 217 if (settings.contentType) { 218 settings.headers["Content-Type"] = settings.contentType; 219 } 220 if (settings.dataType) { 221 settings.headers["Accept"] = MIME_TYPES[settings.dataType]; 222 } 223 for (header in settings.headers) { 224 xhr.setRequestHeader(header, settings.headers[header]); 225 } 226 }; 227 _xhrTimeout = function(xhr, settings) { 228 xhr.onreadystatechange = {}; 229 xhr.abort(); 230 _xhrError("QuoJS.ajax: Timeout exceeded", xhr, settings); 231 }; 232 _xhrForm = function(method, url, data, success, dataType) { 233 return $$.ajax({ 234 type: method, 235 url: url, 236 data: data, 237 success: success, 238 dataType: dataType, 239 contentType: "application/x-www-form-urlencoded" 240 }); 241 }; 242 _parseResponse = function(xhr, settings) { 243 var error, response; 244 245 response = xhr.responseText; 246 if (response) { 247 if (settings.dataType === DEFAULT.MIME) { 248 try { 249 response = JSON.parse(response); 250 } catch (_error) { 251 error = _error; 252 response = error; 253 _xhrError("QuoJS.ajax: Parse Error", xhr, settings); 254 } 255 } else { 256 if (settings.dataType === "xml") { 257 response = xhr.responseXML; 258 } 259 } 260 } 261 return response; 262 }; 263 return _isJsonP = function(url) { 264 return RegExp("=\\?").test(url); 265 }; 266 })(Quo); 267 268}).call(this); 269 270(function () { 271 (function ($$) { 272 var CLASS_SELECTOR, ID_SELECTOR, PARENT_NODE, TAG_SELECTOR, _filtered, _findAnce
272stors; 273 274 PARENT_NODE = "parentNode"; 275 CLASS_SELECTOR = /^\.([\w-]+)$/; 276 ID_SELECTOR = /^#[\w\d-]+$/; 277 TAG_SELECTOR = /^[\w-]+$/; 278 $$.query = function (domain, selector) { 279 var elements; 280 281 selector = selector.trim(); 282 if (CLASS_SELECTOR.test(selector)) { 283 elements = domain.getElementsByClassName(selector.replace(".", "")); 284 } else if (TAG_SELECTOR.test(selector)) { 285 elements = domain.getElementsByTagName(selector); 286 } else if (ID_SELECTOR.test(selector) && domain === document) { 287 elements = domain.getElementById(selector.replace("#", "")); 288 if (!elements) { 289 elements = []; 290 } 291 } else { 292 elements = domain.querySelectorAll(selector); 293 } 294 if (elements.nodeType) { 295 return [elements]; 296 } else { 297 return Array.prototype.slice.call(elements); 298 } 299 }; 300 $$.fn.find = function (selector) { 301 var result; 302 303 if (this.length === 1) { 304 result = Quo.query(this[0], selector); 305 } else { 306 result = this.map(function () { 307 return Quo.query(this, selector); 308 }); 309 } 310 return $$(result); 311 }; 312 $$.fn.parent = function (selector) { 313 var ancestors; 314 315 ancestors = (selector ? _findAncestors(this) : this.instance(PARENT_NODE)); 316 return _filtered(ancestors, selector); 317 }; 318 $$.fn.siblings = function (selector) { 319 var siblings_elements; 320 321 siblings_elements = this.map(function (index, element) { 322 return Array.prototype.slice.call(element.parentNode.children).filter(function (child) { 323 return child !== element; 324 }); 325 }); 326 return _filtered(siblings_elements, selector); 327 }; 328 $$.fn.children = function (selector) { 329 var children_elements; 330 331 children_elements = this.map(function () { 332 return Array.prototype.slice.call(this.children); 333 }); 334 return _filtered(children_elements, selector); 335 }; 336 $$.fn.get = function (index) { 337 if (index === undefined) { 338 return this; 339 } else { 340 return this[index]; 341 } 342 }; 343 $$.fn.first = function () { 344 return $$(this[0]); 345 }; 346 $$.fn.last = function () { 347 return $$(this[this.length - 1]); 348 }; 349 $$.fn.closest = function (selector, context) { 350 var candidates, node; 351 352 node = this[0]; 353 candidates = $$(selector); 354 if (!candidates.length) { 355 node = null; 356 } 357 while (node && candidates.indexOf(node) < 0) { 358 node = node !== context && node !== document && node.parentNode; 359 } 360 return $$(node); 361 }; 362 $$.fn.each = function (callback) { 363 this.forEach(function (element, index) { 364 return callback.call(element, index, element); 365 }); 366 return this; 367 };
368 _findAncestors = function (nodes) { 369 var ancestors; 370 371 ancestors = []; 372 while (nodes.length > 0) { 373 nodes = $$.map(nodes, function (node) { 374 if ((node = node.parentNode) && node !== document && ancestors.indexOf(node) < 0) { 375 ancestors.push(node); 376 return node; 377 } 378 }); 379 } 380 return ancestors; 381 }; 382 return _filtered = function (nodes, selector) { 383 if (selector === undefined) { 384 return $$(nodes); 385 } else { 386 return $$(nodes).filter(selector); 387 } 388 }; 389 })(Quo); 390 391}).call(this); 392 393(function() { 394 (function($$) { 395 var EMPTY_ARRAY, HTML_CONTAINERS, IS_HTML_FRAGMENT, OBJECT_PROTOTYPE, TABLE, TABLE_ROW, _compact, _flatten; 396 397 EMPTY_ARRAY = []; 398 OBJECT_PROTOTYPE = Object.prototype; 399 IS_HTML_FRAGMENT = /^\s*<(\w+|!)[^>]*>/; 400 TABLE = document.createElement('table'); 401 TABLE_ROW = document.createElement('tr'); 402 HTML_CONTAINERS = { 403 "tr": document.createElement("tbody"), 404 "tbody": TABLE, 405 "thead": TABLE, 406 "tfoot": TABLE, 407 "td": TABLE_ROW, 408 "th": TABLE_ROW, 409 "*": document.createElement("div") 410 }; 411 $$.toType = function(obj) { 412 return OBJECT_PROTOTYPE.toString.call(obj).match(/\s([a-z|A-Z]+)/)[1].toLowerCase(); 413 }; 414 $$.isOwnProperty = function(object, property) { 415 return OBJECT_PROTOTYPE.hasOwnProperty.call(object, property); 416 }; 417 $$.getDOMObject = function(selector, children) { 418 var domain, elementTypes, type; 419 420 domain = null; 421 elementTypes = [1, 9, 11]; 422 type = $$.toType(selector); 423 if (type === "array") { 424 domain = _compact(selector); 425 } else if (type === "string" && IS_HTML_FRAGMENT.test(selector)) { 426 domain = $$.fragment(selector.trim(), RegExp.$1); 427 selector = null; 428 } else if (type === "string") { 429 domain = $$.query(document, selector); 430 if (children) { 431 if (domain.length === 1) { 432 domain = $$.query(domain[0], children); 433 } else { 434 domain = $$.map(function() { 435 return $$.query(domain, children); 436 }); 437 } 438 } 439 } else if (elementTypes.indexOf(selector.nodeType) >= 0 || selector === window) { 440 domain = [selector]; 441 selector = null; 442 } 443 return domain; 444 }; 445 $$.map = function(elements, callback) { 446 var i, key, value, values; 447 448 values = []; 449 i = void 0; 450 key = void 0; 451 if ($$.toType(elements) === "array") { 452 i = 0; 453 while (i < elements.length) { 454 value = callback(elements[i], i); 455 if (value != null) { 456 values.push(value); 457 } 458 i++; 459 } 460 } else { 461 for (key in elements) { 462 value = callback(elements[key], key); 463 if (value != null) { 464 values.push(value); 465 } 466 } 467 } 468 return _flatten(values); 469 }; 470 $$.each = function(elements, callback) { 471 var i, key; 472 473 i = void 0; 474 key = void 0; 475 if ($$.toType(elements) === "array") { 476 i = 0; 477 while (i < elements.length) { 478 if (callback.call(elements[i], i, elements[i]) === false) { 479 return elements; 480 } 481 i++; 482 } 483 } else { 484 for (key in elements) { 485 if (callback.call(elements[key], key, elements[key]) === false) { 486 return elements; 487 } 488 } 489 } 490 return elements; 491 }; 492 $$.mix = function() { 493 var arg, argument, child, len, prop; 494 495 child = {}; 496 arg = 0; 497 len = arguments.length; 498 while (arg < len) { 499 argument = arguments[arg]; 500 for (prop in argument) { 501 if ($$.isOwnProperty(argument, prop) && argument[prop] !== undefined) { 502 child[prop] = argument[prop]; 503 } 504 } 505 arg++; 506 } 507 return child; 508 }; 509 $$.fragment = function(markup, tag) { 510 var container; 511 512 if (tag == null) { 513 tag = "*"; 514 } 515 if (!(tag in HTML_CONTAINERS)) { 516 tag = "*"; 517 } 518 container = HTML_CONTAINERS[tag]; 519 container.innerHTML = "" + markup; 520 return $$.each(Array.prototype.slice.call(container.childNodes), function() { 521 return container.removeChild(this); 522 }); 523 }; 524 $$.fn.map = function(fn) { 525 return $$.map(this, function(el, i) {
526 return fn.call(el, i, el); 527 }); 528 }; 529 $$.fn.instance = function(property) { 530 return this.map(function() { 531 return this[property]; 532 }); 533 }; 534 $$.fn.filter = function(selector) { 535 return $$([].filter.call(this, function(element) { 536 return element.parentNode && $$.query(element.parentNode, selector).indexOf(element) >= 0; 537 })); 538 }; 539 $$.fn.forEach = EMPTY_ARRAY.forEach; 540 $$.fn.indexOf = EMPTY_ARRAY.indexOf; 541 _compact = function(array) { 542 return array.filter(function(item) { 543 return item !== void 0 && item !== null; 544 }); 545 }; 546 return _flatten = function(array) { 547 if (array.length > 0) { 548 return [].concat.apply([], array); 549 } else { 550 return array; 551 } 552 }; 553 })(Quo); 554 555}).call(this); 556 557(function() { 558 (function($$) { 559 $$.fn.attr = function(name, value) { 560 if (this.length === 0) { 561 null; 562 } 563 if ($$.toType(name) === "string" && value === void 0) { 564 return this[0].getAttribute(name); 565 } else { 566 return this.each(function() { 567 return this.setAttribute(name, value); 568 }); 569 } 570 }; 571 $$.fn.removeAttr = function(name) { 572 return this.each(function() { 573 return this.removeAttribute(name); 574 }); 575 }; 576 $$.fn.data = function(name, value) { 577 return this.attr("data-" + name, value); 578 }; 579 $$.fn.removeData = function(name) { 580 return this.removeAttr("data-" + name); 581 }; 582 $$.fn.val = function(value) { 583 if ($$.toType(value) === "string") { 584 return this.each(function() { 585 return this.value = value; 586 }); 587 } else { 588 if (this.length > 0) { 589 return this[0].value; 590 } else { 591 return null; 592 } 593 } 594 }; 595 $$.fn.show = function() { 596 return this.style("display", "block"); 597 }; 598 $$.fn.hide = function() { 599 return this.style("display", "none"); 600 }; 601 $$.fn.height = function() { 602 var offset; 603 604 offset = this.offset(); 605 return offset.height; 606 }; 607 $$.fn.width = function() { 608 var offset; 609 610 offset = this.offset(); 611 return offset.width; 612 }; 613 $$.fn.offset = function() { 614 var bounding; 615 616 bounding = this[0].getBoundingClientRect(); 617 return { 618 left: bounding.left + window.pageXOffset, 619 top: bounding.top + window.pageYOffset, 620 width: bounding.width, 621 height: bounding.height 622 }; 623 }; 624 return $$.fn.remove = function() { 625 return this.each(function() { 626 if (this.parentNode != null) { 627 return this.parentNode.removeChild(this); 628 } 629 }); 630 }; 631 })(Quo); 632 633}).call(this); 634 635(function() { 636 (function($$) { 637 var IS_WEBKIT, SUPPORTED_OS, _current, _detectBrowser, _detectEnvironment, _detectOS, _detectScreen; 638 639 _current = null; 640 IS_WEBKIT = /WebKit\/([\d.]+)/; 641 SUPPORTED_OS = { 642 Android: /(Android)\s+([\d.]+)/, 643 ipad: /(iPad).*OS\s([\d_]+)/, 644 iphone: /(iPhone\sOS)\s([\d_]+)/, 645 Blackberry: /(BlackBerry|BB10|Playbook).*Version\/([\d.]+)/, 646 FirefoxOS: /(Mozilla).*Mobile[^\/]*\/([\d\.]*)/, 647 webOS: /(webOS|hpwOS)[\s\/]([\d.]+)/ 648 }; 649 $$.isMobile = function() { 650 _current = _current || _detectEnvironment(); 651 return _current.isMobile && _current.os.name !== "firefoxOS"; 652 }; 653 $$.environment = function() { 654 _current = _current || _detectEnvironment(); 655 return _current; 656 }; 657 $$.isOnline = function() { 658 return navigator.onLine; 659 }; 660 _detectEnvironment = function() { 661 var environment, user_agent; 662 663 user_agent = navigator.userAgent; 664 environment = {}; 665 environment.browser = _detectBrowser(user_agent); 666 environment.os = _detectOS(user_agent); 667 environment.isMobile = !!environment.os; 668 environment.screen = _detectScreen(); 669 return environment; 670 }; 671 _detectBrowser = function(user_agent) { 672 var is_webkit; 673 674 is_webkit = user_agent.match(IS_WEBKIT); 675 if (is_webkit) { 676 return is_webkit[0]; 677 } else { 678 return user_agent; 679 } 680 }; 681 _detectOS = function(user_agent) { 682 var detected_os, os, supported; 683 684 detected_os = null; 685 for (os in SUPPORTED_OS) { 686 supported = user_agent.match(SUPPORTED_OS[os]); 687 if (supported) { 688 detected_os = { 689 name: (os === "iphone" || os === "ipad" ? "ios" : os),
690 version: supported[2].replace("_", ".") 691 }; 692 break; 693 } 694 } 695 return detected_os; 696 }; 697 return _detectScreen = function() { 698 return { 699 width: window.innerWidth, 700 height: window.innerHeight 701 }; 702 }; 703 })(Quo); 704 705}).call(this); 706 707(function() { 708 (function($$) { 709 var ELEMENT_ID, EVENTS_DESKTOP, EVENT_METHODS, HANDLERS, READY_EXPRESSION, _createProxy, _createProxyCallback, _environmentEvent, _findHandlers, _getElementId, _subscribe, _unsubscribe; 710 711 ELEMENT_ID = 1; 712 HANDLERS = {}; 713 EVENT_METHODS = { 714 preventDefault: "isDefaultPrevented", 715 stopImmediatePropagation: "isImmediatePropagationStopped", 716 stopPropagation: "isPropagationStopped" 717 }; 718 EVENTS_DESKTOP = { 719 touchstart: "mousedown", 720 touchmove: "mousemove", 721 touchend: "mouseup", 722 touch: "click", 723 doubletap: "dblclick", 724 orientationchange: "resize" 725 }; 726 READY_EXPRESSION = /complete|loaded|interactive/; 727 $$.fn.on = function(event, selector, callback) { 728 if (selector === "undefined" || $$.toType(selector) === "function") { 729 return this.bind(event, selector); 730 } else { 731 return this.delegate(selector, event, callback); 732 } 733 }; 734 $$.fn.off = function(event, selector, callback) { 735 if (selector === "undefined" || $$.toType(selector) === "function") { 736 return this.unbind(event, selector); 737 } else { 738 return this.undelegate(selector, event, callback); 739 } 740 }; 741 $$.fn.ready = function(callback) { 742 if (READY_EXPRESSION.test(document.readyState)) { 743 return callback($$); 744 } else { 745 return $$.fn.addEvent(document, "DOMContentLoaded", function() { 746 return callback($$); 747 }); 748 } 749 }; 750 $$.Event = function(type, touch) { 751 var event, property; 752 753 event = document.createEvent("Events"); 754 event.initEvent(type, true, true, null, null, null, null, null, null, null, null, null, null, null, null); 755 if (touch) { 756 for (property in touch) { 757 event[property] = touch[property]; 758 } 759 } 760 return event; 761 }; 762 $$.fn.bind = function(event, callback) { 763 return this.each(function() { 764 _subscribe(this, event, callback); 765 }); 766 }; 767 $$.fn.unbind = function(event, callback) { 768 return this.each(function() { 769 _unsubscribe(this, event, callback); 770 }); 771 }; 772 $$.fn.delegate = function(selector, event, callback) { 773 return this.each(function(i, element) { 774 _subscribe(element, event, callback, selector, function(fn) { 775 return function(e) { 776 var evt, match; 777 778 match = $$(e.target).closest(selector, element).get(0); 779 if (match) { 780 evt = $$.extend(_createProxy(e), { 781 currentTarget: match, 782 liveFired: element 783 }); 784 return fn.apply(match, [evt].concat([].slice.call(arguments, 1))); 785 } 786 }; 787 }); 788 }); 789 }; 790 $$.fn.undelegate = function(selector, event, callback) { 791 return this.each(function() { 792 _unsubscribe(this, event, callback, selector); 793 }); 794 }; 795 $$.fn.trigger = function(event, touch, originalEvent) { 796 if ($$.toType(event) === "string") { 797 event = $$.Event(event, touch); 798 } 799 if (originalEvent != null) { 800 event.originalEvent = originalEvent; 801 } 802 return this.each(function() { 803 this.dispatchEvent(event); 804 }); 805 }; 806 $$.fn.addEvent = function(element, event_name, callback) { 807 if (element.addEventListener) { 808 return element.addEventListener(event_name, callback, false); 809 } else if (element.attachEvent) { 810 return element.attachEvent("on" + event_name, callback); 811 } else { 812 return element["on" + event_name] = callback; 813 } 814 }; 815 $$.fn.removeEvent = function(element, event_name, callback) { 816 if (element.removeEventListener) { 817 return element.removeEventListener(event_name, callback, false); 818 } else if (element.detachEvent) { 819 return element.detachEvent("on" + event_name, callback); 820 } else { 821 return element["on" + event_name] = null; 822 } 823 }; 824 _subscribe = function(element, event, callback, selector, delegate_callback) { 825 var delegate, element_handlers, element_id, handler; 826 827 event = _environmentEvent(event); 828 element_id = _getElementId(element); 829 element_handlers = HANDLERS[element_id] || (HANDLERS[element_id] = []); 830 delegate = delegate_callback && delegate_callback(callback, event); 831 handler = { 832 event: event, 833 callback: callback, 834 selector: selector, 835 proxy: _createProxyCallback(delegate, callback, element), 836 delegate: delegate, 837 index: element_handlers.length 838 }; 839 element_handlers.push(handler); 840 return $$.fn.addEvent(element, handler.event, handler.proxy); 841 }; 842 _unsubscribe = function(element, event, callback, selector) { 843 var element_id; 844 845 event = _environmentEvent(event); 846 element_id = _getElementId(element); 847 return _findHandlers(element_id, event, callback, selector).forEach(function(handler) { 848 delete HANDLERS[element_id][handler.index]; 849 return $$.fn.removeEvent(element, handler.event, handler.proxy); 850 }); 851 }; 852 _getElementId = function(element) { 853 return element._id || (element._id = ELEMENT_ID++); 854 }; 855 _environmentEvent = function(event) { 856 var environment_event; 857 858 environment_event = ($$.isMobile() ? event : EVENTS_DESKTOP[event]); 859 return environment_event || event; 860 }; 861 _createProxyCallback = function(delegate, callback, element) { 862 var proxy; 863 864 callback = delegate || callback; 865 proxy = function(event) { 866 var result; 867 868 result = callback.apply(element, [event].concat(event.data)); 869 if (result === false) { 870 event.preventDefault(); 871 } 872 return result; 873 }; 874 return proxy; 875 }; 876 _findHandlers = function(element_id, event, fn, selector) { 877 return (HANDLERS[element_id] || []).filter(function(handler) { 878 return handler && (!event || handler.event === event) && (!fn || handler.callback === fn) && (!selector || handler.selector === selector); 879 }); 880 }; 881 return _createProxy = function(event) { 882 var proxy; 883 884 proxy = $$.extend({ 885 originalEvent: event 886 }, event); 887 $$.each(EVENT_METHODS, function(name, method) { 888 proxy[name] = function() { 889 this[method] = function() { 890 return true; 891 }; 892 return event[name].apply(event, arguments); 893 }; 894 return proxy[method] = function() { 895 return false;
896 }; 897 }); 898 return proxy; 899 }; 900 })(Quo); 901 902}).call(this); 903 904(function() { 905 (function($$) { 906 var CURRENT_TOUCH, EVENT, FIRST_TOUCH, GESTURE, GESTURES, HOLD_DELAY, TAPS, TOUCH_TIMEOUT, _angle, _capturePinch, _captureRotation, _cleanGesture, _distance, _fingersPosition, _getTouches, _hold, _isSwipe, _listenTouches, _onTouchEnd, _onTouchMove, _onTouchStart, _parentIfText, _swipeDirection, _trigger; 907 908 TAPS = null; 909 EVENT = void 0; 910 GESTURE = {}; 911 FIRST_TOUCH = []; 912 CURRENT_TOUCH = []; 913 TOUCH_TIMEOUT = void 0; 914 HOLD_DELAY = 650; 915 GESTURES = ["touch", "tap", "singleTap", "doubleTap", "hold", "swipe", "swiping", "swipeLeft", "swipeRight", "swipeUp", "swipeDown", "rotate", "rotating", "rotateLeft", "rotateRight", "pinch", "pinching", "pinchIn", "pinchOut", "drag", "dragLeft", "dragRight", "dragUp", "dragDown"]; 916 GESTURES.forEach(function(event) { 917 $$.fn[event] = function(callback) { 918 var event_name; 919 920 event_name = event === "touch" ? "touchend" : event; 921 return $$(document.body).delegate(this.selector, event_name, callback); 922 }; 923 return this; 924 }); 925 _listenTouches = function() { 926 var environment; 927 928 environment = $$(document.body); 929 environment.bind("touchstart", _onTouchStart); 930 environment.bind("touchmove", _onTouchMove); 931 environment.bind("touchend", _onTouchEnd); 932 return environment.bind("touchcancel", _cleanGesture); 933 }; 934 _onTouchStart = function(event) { 935 var delta, fingers, now, touches; 936 937 EVENT = event; 938 now = Date.now(); 939 delta = now - (GESTURE.last || now); 940 TOUCH_TIMEOUT && clearTimeout(TOUCH_TIMEOUT); 941 touches = _getTouches(event); 942 fingers = touches.length; 943 FIRST_TOUCH = _fingersPosition(touches, fingers); 944 GESTURE.el = $$(_parentIfText(touches[0].target)); 945 GESTURE.fingers = fingers; 946 GESTURE.last = now; 947 if (!GESTURE.taps) { 948 GESTURE.taps = 0; 949 } 950 GESTURE.taps++; 951 if (fingers === 1) { 952 if (fingers >= 1) { 953 GESTURE.gap = delta > 0 && delta <= 250; 954 } 955 return setTimeout(_hold, HOLD_DELAY); 956 } else if (fingers === 2) { 957 GESTURE.initial_angle = parseInt(_angle(FIRST_TOUCH), 10); 958 GESTURE.initial_distance = parseInt(_distance(FIRST_TOUCH), 10); 959 GESTURE.angle_difference = 0; 960 return GESTURE.distance_difference = 0; 961 } 962 }; 963 _onTouchMove = function(event) { 964 var fingers, is_swipe, touches; 965 966 EVENT = event; 967 if (GESTURE.el) { 968 touches = _getTouches(event); 969 fingers = touches.length; 970 if (fingers === GESTURE.fingers) { 971 CURRENT_TOUCH = _fingersPosition(touches, fingers); 972 is_swipe = _isSwipe(event); 973 if (is_swipe) { 974 GESTURE.prevSwipe = true; 975 } 976 if (is_swipe || GESTURE.prevSwipe === true) { 977 _trigger("swiping"); 978 } 979 if (fingers === 2) { 980 _captureRotation(); 981 _capturePinch(); 982 } 983 } else { 984 _cleanGesture(); 985 } 986 } 987 return true; 988 }; 989 _isSwipe = function(event) { 990 var it_is, move_horizontal, move_vertical; 991 992 it_is = false; 993 if (CURRENT_TOUCH[0]) { 994 move_horizontal = Math.abs(FIRST_TOUCH[0].x - CURRENT_TOUCH[0].x) > 30; 995 move_vertical = Math.abs(FIRST_TOUCH[0].y - CURRENT_TOUCH[0].y) > 30; 996 it_is = GESTURE.el && (move_horizontal || move_vertical); 997 } 998 return it_is; 999 }; 1000 _onTouchEnd = function(event) { 1001 var anyevent, drag_direction, pinch_direction, rotation_direction, swipe_direction; 1002 1003 EVENT = event; 1004 _trigger("touch"); 1005 if (GESTURE.fingers === 1) { 1006 if (GESTURE.taps === 2 && GESTURE.gap) { 1007 _trigger("doubleTap"); 1008 _cleanGesture(); 1009 } else if (_isSwipe() || GESTURE.prevSwipe) { 1010 _trigger("swipe"); 1011 swipe_direction = _swipeDirection(FIRST_TOUCH[0].x, CURRENT_TOUCH[0].x, FIRST_TOUCH[0].y, CURRENT_TOUCH[0].y); 1012 _trigger("swipe" + swipe_direction); 1013 _cleanGesture(); 1014 } else { 1015 _trigger("tap"); 1016 if (GESTURE.taps === 1) { 1017 TOUCH_TIMEOUT = setTimeout((function() { 1018 _trigger("singleTap"); 1019 return _cleanGesture(); 1020 }), 100); 1021 } 1022 } 1023 } else { 1024 anyevent = false;
1025 if (GESTURE.angle_difference !== 0) { 1026 _trigger("rotate", { 1027 angle: GESTURE.angle_difference 1028 }); 1029 rotation_direction = GESTURE.angle_difference > 0 ? "rotateRight" : "rotateLeft"; 1030 _trigger(rotation_direction, { 1031 angle: GESTURE.angle_difference 1032 }); 1033 anyevent = true; 1034 } 1035 if (GESTURE.distance_difference !== 0) { 1036 _trigger("pinch", { 1037 angle: GESTURE.distance_difference 1038 }); 1039 pinch_direction = GESTURE.distance_difference > 0 ? "pinchOut" : "pinchIn"; 1040 _trigger(pinch_direction, { 1041 distance: GESTURE.distance_difference 1042 }); 1043 anyevent = true; 1044 } 1045 if (!anyevent && CURRENT_TOUCH[0]) { 1046 if (Math.abs(FIRST_TOUCH[0].x - CURRENT_TOUCH[0].x) > 10 || Math.abs(FIRST_TOUCH[0].y - CURRENT_TOUCH[0].y) > 10) { 1047 _trigger("drag"); 1048 drag_direction = _swipeDirection(FIRST_TOUCH[0].x, CURRENT_TOUCH[0].x, FIRST_TOUCH[0].y, CURRENT_TOUCH[0].y); 1049 _trigger("drag" + drag_direction); 1050 } 1051 } 1052 _cleanGesture(); 1053 } 1054 return EVENT = void 0; 1055 }; 1056 _fingersPosition = function(touches, fingers) { 1057 var i, result; 1058 1059 result = []; 1060 i = 0; 1061 touches = touches[0].targetTouches ? touches[0].targetTouches : touches; 1062 while (i < fingers) { 1063 result.push({ 1064 x: touches[i].pageX, 1065 y: touches[i].pageY 1066 }); 1067 i++; 1068 } 1069 return result; 1070 }; 1071 _captureRotation = function() { 1072 var angle, diff, i, symbol; 1073 1074 angle = parseInt(_angle(CURRENT_TOUCH), 10); 1075 diff = parseInt(GESTURE.initial_angle - angle, 10); 1076 if (Math.abs(diff) > 20 || GESTURE.angle_difference !== 0) { 1077 i = 0; 1078 symbol = GESTURE.angle_difference < 0 ? "-" : "+"; 1079 while (Math.abs(diff - GESTURE.angle_difference) > 90 && i++ < 10) { 1080 eval("diff " + symbol + "= 180;"); 1081 } 1082 GESTURE.angle_difference = parseInt(diff, 10); 1083 return _trigger("rotating", { 1084 angle: GESTURE.angle_difference 1085 }); 1086 } 1087 }; 1088 _capturePinch = function() { 1089 var diff, distance; 1090 1091 distance = parseInt(_distance(CURRENT_TOUCH), 10); 1092 diff = GESTURE.initial_distance - distance; 1093 if (Math.abs(diff) > 10) { 1094 GESTURE.distance_difference = diff; 1095 return _trigger("pinching", { 1096 distance: diff 1097 }); 1098 } 1099 }; 1100 _trigger = function(type, params) { 1101 if (GESTURE.el) { 1102 params = params || {}; 1103 if (CURRENT_TOUCH[0]) { 1104 params.iniTouch = (GESTURE.fingers > 1 ? FIRST_TOUCH : FIRST_TOUCH[0]); 1105 params.currentTouch = (GESTURE.fingers > 1 ? CURRENT_TOUCH : CURRENT_TOUCH[0]); 1106 } 1107 return GESTURE.el.trigger(type, params, EVENT); 1108 } 1109 }; 1110 _cleanGesture = function(event) { 1111 FIRST_TOUCH = []; 1112 CURRENT_TOUCH = []; 1113 GESTURE = {}; 1114 return clearTimeout(TOUCH_TIMEOUT); 1115 }; 1116 _angle = function(touches_data) { 1117 var A, B, angle; 1118 1119 A = touches_data[0]; 1120 B = touches_data[1]; 1121 angle = Math.atan((B.y - A.y) * -1 / (B.x - A.x)) * (180 / Math.PI); 1122 if (angle < 0) { 1123 return angle + 180; 1124 } else { 1125 return angle; 1126 } 1127 }; 1128 _distance = function(touches_data) { 1129 var A, B; 1130 1131 A = touches_data[0]; 1132 B = touches_data[1]; 1133 return Math.sqrt((B.x - A.x) * (B.x - A.x) + (B.y - A.y) * (B.y - A.y)) * -1; 1134 }; 1135 _getTouches = function(event) { 1136 if ($$.isMobile()) { 1137 return event.touches; 1138 } else { 1139 return [event]; 1140 } 1141 }; 1142 _parentIfText = function(node) { 1143 if ("tagName" in node) { 1144 return node; 1145 } else { 1146 return node.parentNode; 1147 } 1148 }; 1149 _swipeDirection = function(x1, x2, y1, y2) { 1150 var xDelta, yDelta; 1151 1152 xDelta = Math.abs(x1 - x2); 1153 yDelta = Math.abs(y1 - y2); 1154 if (xDelta >= yDelta) { 1155 if (x1 - x2 > 0) { 1156 return "Left"; 1157 } else { 1158 return "Right"; 1159 } 1160 } else { 1161 if (y1 - y2 > 0) { 1162 return "Up"; 1163 } else { 1164 return "Down"; 1165 } 1166 } 1167 }; 1168 $$(document).ready(function () { 1169 return _listenTouches(); 1170 }); 1171 return _hold = function() { 1172 if (GESTURE.last && (Date.now() - GESTURE.last >= HOLD_DELAY)) { 1173 _trigger("hold"); 1174 return GESTURE.taps = 0; 1175 } 1176 }; 1177 })(Quo); 1178 1179}).call(this); 1180 1181(function() { 1182 (function($$) { 1183 $$.fn.text = function(value) { 1184 if (value || $$.toType(value) === "number") { 1185 return this.each(function() { 1186 return this.textContent = value; 1187 }); 1188 } else { 1189 return this[0].textContent; 1190 } 1191 }; 1192 $$.fn.html = function(value) { 1193 var type; 1194 1195 type = $$.toType(value); 1196 if (value || type === "number" || type === "string") { 1197 return this.each(function() { 1198 var element, _i, _len, _results; 1199 1200 if (type === "string" || type === "number") { 1201 return this.innerHTML = value; 1202 } else { 1203 this.innerHTML = null; 1204 if (type === "array") { 1205 _results = []; 1206 for (_i = 0, _len = value.length; _i < _len; _i++) { 1207 element = value[_i]; 1208 _results.push(this.appendChild(element)); 1209 } 1210 return _results; 1211 } else { 1212 return this.appendChild(value); 1213 } 1214 } 1215 }); 1216 } else { 1217 return this[0].innerHTML; 1218 } 1219 }; 1220 $$.fn.append = function(value) { 1221 var type; 1222 1223 type = $$.toType(value); 1224 return this.each(function() { 1225 var _this = this; 1226 1227 if (type === "string") { 1228 return this.insertAdjacentHTML("beforeend", value); 1229 } else if (type === "array") { 1230 return value.each(function(index, value) { 1231 return _this.appendChild(value); 1232 }); 1233 } else { 1234 return this.appendChild(value); 1235 } 1236 }); 1237 }; 1238 $$.fn.prepend = function(value) { 1239 var type; 1240 1241 type = $$.toType(value); 1242 return this.each(function() { 1243 var _this = this; 1244 1245 if (type === "string") { 1246 return this.insertAdjacentHTML("afterbegin", value); 1247 } else if (type === "array") { 1248 return value.each(function(index, value) { 1249 return _this.insertBefore(value, _this.firstChild); 1250 }); 1251 } else { 1252 return this.insertBefore(value, this.firstChild); 1253 } 1254 }); 1255 }; 1256 $$.fn.replaceWith = function(value) { 1257 var type; 1258 1259 type = $$.toType(value); 1260 this.each(function() { 1261 var _this = this; 1262 1263 if (this.parentNode) { 1264 if (type === "string") { 1265 return this.insertAdjacentHTML("beforeBegin", value); 1266 } else if (type === "array") { 1267 return value.each(function(index, value) { 1268 return _this.parentNode.insertBefore(value, _this); 1269 }); 1270 } else { 1271 return this.parentNode.insertBefore(value, this); 1272 } 1273 } 1274 }); 1275 return this.remove(); 1276 }; 1277 return $$.fn.empty = function() { 1278 return this.each(function() { 1279 return this.innerHTML = null; 1280 }); 1281 }; 1282 })(Quo); 1283 1284}).call(this); 1285 1286(function() { 1287 (function($$) { 1288 var VENDORS, _computedStyle, _existsClass; 1289 1290 VENDORS = ["-webkit-", "-moz-", "-ms-", "-o-", ""]; 1291 $$.fn.addClass = function(name) { 1292 return this.each(function() { 1293 if (!_existsClass(name, this.className)) { 1294 this.className += " " + name; 1295 return this.className = this.className.trim(); 1296 } 1297 }); 1298 }; 1299 $$.fn.removeClass = function(name) { 1300 return this.each(function() { 1301 if (!name) { 1302 return this.className = ""; 1303 } else { 1304 if (_existsClass(name, this.className)) { 1305 return this.className = this.className.replace(name, " ").replace(/\s+/g, " ").trim(); 1306 } 1307 } 1308 }); 1309 }; 1310 $$.fn.toggleClass = function(name) { 1311 return this.each(function() { 1312 if (_existsClass(name, this.className)) { 1313 return this.className = this.className.replace(name, " "); 1314 } else { 1315 this.className += " " + name; 1316 return this.className = this.className.trim(); 1317 } 1318 }); 1319 }; 1320 $$.fn.hasClass = function(name) { 1321 return _existsClass(name, this[0].className); 1322 }; 1323 $$.fn.style = function(property, value) { 1324 if (value) { 1325 return this.each(function() { 1326 return this.style[property] = value; 1327 }); 1328 } else { 1329 return this[0].style[property] || _computedStyle(this[0], property); 1330 } 1331 }; 1332 $$.fn.css = function(property, value) { 1333 return this.style(property, value); 1334 }; 1335 $$.fn.vendor = function(property, value) { 1336 var vendor, _i, _len, _results; 1337 1338 _results = []; 1339 for (_i = 0, _len = VENDORS.length; _i < _len; _i++) { 1340 vendor = VENDORS[_i];
1341 _results.push(this.style("" + vendor + property, value)); 1342 } 1343 return _results; 1344 }; 1345 _existsClass = function(name, className) { 1346 var classes; 1347 1348 classes = className.split(/\s+/g); 1349 return classes.indexOf(name) >= 0; 1350 }; 1351 return _computedStyle = function(element, property) { 1352 return document.defaultView.getComputedStyle(element, "")[property]; 1353 }; 1354 })(Quo); 1355 1356}).call(this);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.