ESP8266 part of the f105-motor-demo project (see f105-motor-demo_stm32)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
f105-motor-demo_esp/html_src/js/all.min.js.map

1 lines
33 KiB

{"version":3,"sources":["app.js","chibi.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACjPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"all.min.js","sourcesContent":["function bool(x) {\n\treturn (x === 1 || x === '1' || x === true || x === 'true');\n}\n\n/** html entities */\nfunction e(x) {\n\treturn String(x)\n\t\t.replace(/&/g, '&amp;')\n\t\t.replace(/\"/g, '&quot;')\n\t\t.replace(/'/g, '&#39;')\n\t\t.replace(/</g, '&lt;')\n\t\t.replace(/>/g, '&gt;');\n}\n\n/** Returns true if argument is array [] */\nfunction isArray(obj) {\n\treturn Object.prototype.toString.call(obj) === '[object Array]';\n}\n\n/** Returns true if argument is object {} */\nfunction isObject(obj) {\n\treturn Object.prototype.toString.call(obj) === '[object Object]';\n}\n\n/** escape a string to have no special meaning in regex */\nfunction regexEscape(s) {\n\treturn s.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&');\n}\n\n/** Perform a substitution in the given string.\n *\n * Arguments - array or list of replacements.\n * Arguments numeric keys will replace {0}, {1} etc.\n * Named keys also work, ie. {foo: \"bar\"} -> replaces {foo} with bar.\n *\n * Braces are added to keys if missing.\n *\n * @returns {String} result\n */\nString.prototype.format = function () {\n\tvar out = this;\n\n\tvar repl = arguments;\n\n\tif (arguments.length == 1 && (isArray(arguments[0]) || isObject(arguments[0]))) {\n\t\trepl = arguments[0];\n\t}\n\n\tfor (var ph in repl) {\n\t\tif (repl.hasOwnProperty(ph)) {\n\t\t\tvar ph_orig = ph;\n\n\t\t\tif (!ph.match(/^\\{.*\\}$/)) {\n\t\t\t\tph = '{' + ph + '}';\n\t\t\t}\n\n\t\t\t// replace all occurrences\n\t\t\tvar pattern = new RegExp(regexEscape(ph), \"g\");\n\t\t\tout = out.replace(pattern, repl[ph_orig]);\n\t\t}\n\t}\n\n\treturn out;\n};\n\n/** Module for toggling a modal overlay */\nvar modal = (function () {\n\tvar modal = {};\n\n\tmodal.show = function (sel) {\n\t\tvar $m = $(sel);\n\t\t$m.removeClass('hidden visible');\n\t\tsetTimeout(function () {\n\t\t\t$m.addClass('visible');\n\t\t}, 1);\n\t};\n\n\tmodal.hide = function (sel) {\n\t\tvar $m = $(sel);\n\t\t$m.removeClass('visible');\n\t\tsetTimeout(function () {\n\t\t\t$m.addClass('hidden');\n\t\t}, 500); // transition time\n\t};\n\n\tmodal.init = function () {\n\t\t// close modal by click outside the dialog\n\t\t$('.Modal').on('click', function () {\n\t\t\tmodal.hide(this);\n\t\t});\n\n\t\t$('.Dialog').on('click', function (e) {\n\t\t\te.stopImmediatePropagation();\n\t\t});\n\n\t\t// Hide all modals on esc\n\t\t$(window).on('keydown', function (e) {\n\t\t\tif (e.which == 27) {\n\t\t\t\tmodal.hide('.Modal');\n\t\t\t}\n\t\t});\n\t};\n\n\treturn modal;\n})();\n\n\n/** Wifi page */\nvar wifi = (function () {\n\tvar wifi = {};\n\tvar authStr = ['Open', 'WEP', 'WPA', 'WPA2', 'WPA/WPA2'];\n\n\t/** Update display for received response */\n\tfunction onScan(resp, status) {\n\t\tif (status != 200) {\n\t\t\t// bad response\n\t\t\trescan(5000); // wait 5sm then retry\n\t\t\treturn;\n\t\t}\n\n\t\tresp = JSON.parse(resp);\n\n\t\tvar done = !bool(resp.result.inProgress) && (resp.result.APs.length > 0);\n\t\trescan(done ? 15000 : 1000);\n\n\t\t// clear the AP list\n\t\tvar $list = $('#ap-list');\n\t\t// remove old APs\n\t\t$('.AP').remove();\n\n\t\t$list.toggle(done);\n\t\t$('#ap-loader').toggle(!done);\n\n\t\t// scan done\n\t\tresp.result.APs\n\t\t\t.sort(function (a, b) {\n\t\t\t\treturn b.rssi - a.rssi\n\t\t\t})\n\t\t\t.forEach(function (ap) {\n\t\t\t\tap.enc = parseInt(ap.enc);\n\n\t\t\t\tif (ap.enc > 4) return; // hide unsupported auths\n\n\t\t\t\tvar item = document.createElement('div');\n\n\t\t\t\tvar $item = $(item)\n\t\t\t\t\t.data('ssid', ap.essid)\n\t\t\t\t\t.data('pwd', ap.enc != 0)\n\t\t\t\t\t.addClass('AP');\n\n\t\t\t\t// mark current SSID\n\t\t\t\tif (ap.essid == wifi.current) {\n\t\t\t\t\t$item.addClass('selected');\n\t\t\t\t}\n\n\t\t\t\tvar inner = document.createElement('div');\n\t\t\t\tvar $inner = $(inner).addClass('inner')\n\t\t\t\t\t.htmlAppend('<div class=\"rssi\">{0}</div>'.format(Math.round(ap.rssi / 2.55)))\n\t\t\t\t\t.htmlAppend('<div class=\"essid\" title=\"{0}\">{0}</div>'.format(e(ap.essid)))\n\t\t\t\t\t.htmlAppend('<div class=\"auth\">{0}</div>'.format(authStr[ap.enc]));\n\n\t\t\t\t$item.on('click', function () {\n\t\t\t\t\tvar $th = $(this);\n\n\t\t\t\t\t// populate the form\n\t\t\t\t\t$('#conn-essid').val($th.data('ssid'));\n\t\t\t\t\t$('#conn-passwd').val(''); // clear\n\n\t\t\t\t\tif ($th.data('pwd')) {\n\t\t\t\t\t\t// this AP needs a password\n\t\t\t\t\t\tmodal.show('#psk-modal');\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$('#conn-form').submit();\n\t\t\t\t\t}\n\t\t\t\t});\n\n\n\t\t\t\titem.appendChild(inner);\n\t\t\t\t$list[0].appendChild(item);\n\t\t\t});\n\t}\n\n\t/** Ask the CGI what APs are visible (async) */\n\tfunction scanAPs() {\n\t\t$().get('/wifi/scan.cgi', onScan, true, true); // no cache, no jsonp\n\t}\n\n\tfunction rescan(time) {\n\t\tsetTimeout(scanAPs, time);\n\t}\n\n\t/** Set up the WiFi page */\n\twifi.init = function () {\n\t\t//var ap_json = {\n\t\t//\t\"result\": {\n\t\t//\t\t\"inProgress\": \"0\",\n\t\t//\t\t\"APs\": [\n\t\t//\t\t\t{\"essid\": \"Chlivek\", \"bssid\": \"88:f7:c7:52:b3:99\", \"rssi\": \"204\", \"enc\": \"4\", \"channel\": \"1\"},\n\t\t//\t\t\t{\"essid\": \"TyNikdy\", \"bssid\": \"5c:f4:ab:0d:f1:1b\", \"rssi\": \"164\", \"enc\": \"3\", \"channel\": \"1\"},\n\t\t//\t\t\t{\"essid\": \"UPC5616805\", \"bssid\": \"08:95:2a:0c:84:3f\", \"rssi\": \"164\", \"enc\": \"4\", \"channel\": \"1\"},\n\t\t//\t\t\t{\"essid\": \"Sitovina\", \"bssid\": \"20:cf:30:98:cb:3a\", \"rssi\": \"166\", \"enc\": \"3\", \"channel\": \"1\"},\n\t\t//\t\t\t{\"essid\": \"Tramp\", \"bssid\": \"c4:e9:84:6f:6c:e0\", \"rssi\": \"170\", \"enc\": \"3\", \"channel\": \"2\"},\n\t\t//\t\t\t{\"essid\": \"KV2\", \"bssid\": \"4c:5e:0c:2c:84:9b\", \"rssi\": \"172\", \"enc\": \"3\", \"channel\": \"3\"},\n\t\t//\t\t\t{\"essid\": \"UPC373123\", \"bssid\": \"e8:40:f2:ae:0e:f4\", \"rssi\": \"164\", \"enc\": \"3\", \"channel\": \"1\"},\n\t\t//\t\t\t{\"essid\": \"www.podoli.org prazak\", \"bssid\": \"00:00:00:00:00:00\", \"rssi\": \"165\", \"enc\": \"0\", \"channel\": \"4\"},\n\t\t//\t\t\t{\"essid\": \"Medvjedov\", \"bssid\": \"00:00:00:00:00:00\", \"rssi\": \"181\", \"enc\": \"4\", \"channel\": \"6\"},\n\t\t//\t\t\t{\"essid\": \"MARIAN-PC\", \"bssid\": \"f8:d1:11:af:d7:72\", \"rssi\": \"175\", \"enc\": \"3\", \"channel\": \"6\"},\n\t\t//\t\t\t{\"essid\": \"UPC3226244\", \"bssid\": \"64:7c:34:9a:6f:7c\", \"rssi\": \"169\", \"enc\": \"4\", \"channel\": \"6\"},\n\t\t//\t\t\t{\"essid\": \"molly\", \"bssid\": \"00:00:00:00:00:00\", \"rssi\": \"168\", \"enc\": \"3\", \"channel\": \"7\"},\n\t\t//\t\t\t{\"essid\": \"UPC2607759\", \"bssid\": \"88:f7:c7:4e:c1:b2\", \"rssi\": \"164\", \"enc\": \"4\", \"channel\": \"8\"},\n\t\t//\t\t\t{\"essid\": \"blondyna\", \"bssid\": \"98:fc:11:bd:0f:b8\", \"rssi\": \"166\", \"enc\": \"4\", \"channel\": \"9\"},\n\t\t//\t\t\t{\"essid\": \"UPC246587811\", \"bssid\": \"80:f5:03:20:6c:85\", \"rssi\": \"171\", \"enc\": \"3\", \"channel\": \"11\"},\n\t\t//\t\t\t{\"essid\": \"UPC930648\", \"bssid\": \"4c:72:b9:50:6d:38\", \"rssi\": \"167\", \"enc\": \"3\", \"channel\": \"11\"},\n\t\t//\t\t\t{\"essid\": \"PRAHA4.NET-R21-2\", \"bssid\": \"00:00:00:00:00:00\", \"rssi\": \"173\", \"enc\": \"0\", \"channel\": \"12\"},\n\t\t//\t\t\t{\"essid\": \"Internet_B0\", \"bssid\": \"5c:f4:ab:11:3b:b3\", \"rssi\": \"166\", \"enc\": \"3\", \"channel\": \"13\"}\n\t\t//\t\t]\n\t\t//\t}\n\t\t//};\n\n\t\t//onScan(ap_json, 200);\n\t\tscanAPs();\n\t};\n\n\treturn wifi;\n})();\n\n\n/** Global generic init */\nfunction initDef() {\n\t// loader dots...\n\tsetInterval(function () {\n\t\t$('.anim-dots').each(function (x) {\n\t\t\tvar $x = $(x);\n\t\t\tvar dots = $x.html() + '.';\n\t\t\tif (dots.length == 5) dots = '.';\n\t\t\t$x.html(dots);\n\t\t});\n\t}, 1000);\n\n\tmodal.init();\n}\n","/*!chibi 3.0.7, Copyright 2012-2016 Kyle Barrow, released under MIT license */\n(function () {\n\t'use strict';\n\n\tvar readyfn = [],\n\t\tloadedfn = [],\n\t\tdomready = false,\n\t\tpageloaded = false,\n\t\tjsonpcount = 0,\n\t\td = document,\n\t\tw = window;\n\n\t// Fire any function calls on ready event\n\tfunction fireReady() {\n\t\tvar i;\n\t\tdomready = true;\n\t\tfor (i = 0; i < readyfn.length; i += 1) {\n\t\t\treadyfn[i]();\n\t\t}\n\t\treadyfn = [];\n\t}\n\n\t// Fire any function calls on loaded event\n\tfunction fireLoaded() {\n\t\tvar i;\n\t\tpageloaded = true;\n\t\t// For browsers with no DOM loaded support\n\t\tif (!domready) {\n\t\t\tfireReady();\n\t\t}\n\t\tfor (i = 0; i < loadedfn.length; i += 1) {\n\t\t\tloadedfn[i]();\n\t\t}\n\t\tloadedfn = [];\n\t}\n\n\t// Check DOM ready, page loaded\n\tif (d.addEventListener) {\n\t\t// Standards\n\t\td.addEventListener('DOMContentLoaded', fireReady, false);\n\t\tw.addEventListener('load', fireLoaded, false);\n\t} else if (d.attachEvent) {\n\t\t// IE\n\t\td.attachEvent('onreadystatechange', fireReady);\n\t\t// IE < 9\n\t\tw.attachEvent('onload', fireLoaded);\n\t} else {\n\t\t// Anything else\n\t\tw.onload = fireLoaded;\n\t}\n\n\t// Utility functions\n\n\t// Loop through node array\n\tfunction nodeLoop(fn, nodes) {\n\t\tvar i;\n\t\t// Good idea to walk up the DOM\n\t\tfor (i = nodes.length - 1; i >= 0; i -= 1) {\n\t\t\tfn(nodes[i]);\n\t\t}\n\t}\n\n\t// Convert to camel case\n\tfunction cssCamel(property) {\n\t\treturn property.replace(/-\\w/g, function (result) {return result.charAt(1).toUpperCase(); });\n\t}\n\n\t// Get computed style\n\tfunction computeStyle(elm, property) {\n\t\t// IE, everything else or null\n\t\treturn (elm.currentStyle) ? elm.currentStyle[cssCamel(property)] : (w.getComputedStyle) ? w.getComputedStyle(elm, null).getPropertyValue(property) : null;\n\n\t}\n\n\t// Returns URI encoded query string pair\n\tfunction queryPair(name, value) {\n\t\treturn encodeURIComponent(name).replace(/%20/g, '+') + '=' + encodeURIComponent(value).replace(/%20/g, '+');\n\t}\n\n\t// Set CSS, important to wrap in try to prevent error thown on unsupported property\n\tfunction setCss(elm, property, value) {\n\t\ttry {\n\t\t\telm.style[cssCamel(property)] = value;\n\t\t} catch (e) {}\n\t}\n\n\t// Show CSS\n\tfunction showCss(elm) {\n\t\telm.style.display = '';\n\t\t// For elements still hidden by style block\n\t\tif (computeStyle(elm, 'display') === 'none') {\n\t\t\telm.style.display = 'block';\n\t\t}\n\t}\n\n\t// Serialize form & JSON values\n\tfunction serializeData(nodes) {\n\t\tvar querystring = '', subelm, i, j;\n\t\tif (nodes.constructor === Object) { // Serialize JSON data\n\t\t\tfor (subelm in nodes) {\n\t\t\t\tif (nodes.hasOwnProperty(subelm)) {\n\t\t\t\t\tif (nodes[subelm].constructor === Array) {\n\t\t\t\t\t\tfor (i = 0; i < nodes[subelm].length; i += 1) {\n\t\t\t\t\t\t\tquerystring += '&' + queryPair(subelm, nodes[subelm][i]);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tquerystring += '&' + queryPair(subelm, nodes[subelm]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else { // Serialize node data\n\t\t\tnodeLoop(function (elm) {\n\t\t\t\tif (elm.nodeName === 'FORM') {\n\t\t\t\t\tfor (i = 0; i < elm.elements.length; i += 1) {\n\t\t\t\t\t\tsubelm = elm.elements[i];\n\n\t\t\t\t\t\tif (!subelm.disabled) {\n\t\t\t\t\t\t\tswitch (subelm.type) {\n\t\t\t\t\t\t\t// Ignore buttons, unsupported XHR 1 form fields\n\t\t\t\t\t\t\tcase 'button':\n\t\t\t\t\t\t\tcase 'image':\n\t\t\t\t\t\t\tcase 'file':\n\t\t\t\t\t\t\tcase 'submit':\n\t\t\t\t\t\t\tcase 'reset':\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase 'select-one':\n\t\t\t\t\t\t\t\tif (subelm.length > 0) {\n\t\t\t\t\t\t\t\t\tquerystring += '&' + queryPair(subelm.name, subelm.value);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase 'select-multiple':\n\t\t\t\t\t\t\t\tfor (j = 0; j < subelm.length; j += 1) {\n\t\t\t\t\t\t\t\t\tif (subelm[j].selected) {\n\t\t\t\t\t\t\t\t\t\tquerystring += '&' + queryPair(subelm.name, subelm[j].value);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase 'checkbox':\n\t\t\t\t\t\t\tcase 'radio':\n\t\t\t\t\t\t\t\tif (subelm.checked) {\n\t\t\t\t\t\t\t\t\tquerystring += '&' + queryPair(subelm.name, subelm.value);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\t// Everything else including shinny new HTML5 input types\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tquerystring += '&' + queryPair(subelm.name, subelm.value);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}, nodes);\n\t\t}\n\t\t// Tidy up first &\n\t\treturn (querystring.length > 0) ? querystring.substring(1) : '';\n\t}\n\n\t// Class helper\n\tfunction classHelper(classes, action, nodes) {\n\t\tvar classarray, search, i, has = false;\n\t\tif (classes) {\n\t\t\t// Trim any whitespace\n\t\t\tclassarray = classes.split(/\\s+/);\n\t\t\tnodeLoop(function (elm) {\n\t\t\t\tfor (i = 0; i < classarray.length; i += 1) {\n\t\t\t\t\tsearch = new RegExp('\\\\b' + classarray[i] + '\\\\b', 'g');\n\t\t\t\t\tif (action === 'remove') {\n\t\t\t\t\t\telm.className = elm.className.replace(search, '');\n\t\t\t\t\t} else if (action === 'toggle') {\n\t\t\t\t\t\telm.className = (elm.className.match(search)) ? elm.className.replace(search, '') : elm.className + ' ' + classarray[i];\n\t\t\t\t\t} else if (action === 'has') {\n\t\t\t\t\t\tif (elm.className.match(search)) {\n\t\t\t\t\t\t\thas = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}, nodes);\n\t\t}\n\t\treturn has;\n\t}\n\n\t// HTML insertion helper\n\tfunction insertHtml(value, position, nodes) {\n\t\tvar tmpnodes, tmpnode;\n\t\tif (value) {\n\t\t\tnodeLoop(function (elm) {\n\t\t\t\t// No insertAdjacentHTML support for FF < 8 and IE doesn't allow insertAdjacentHTML table manipulation, so use this instead\n\t\t\t\t// Convert string to node. We can't innerHTML on a document fragment\n\t\t\t\ttmpnodes = d.createElement('div');\n\t\t\t\ttmpnodes.innerHTML = value;\n\t\t\t\twhile ((tmpnode = tmpnodes.lastChild) !== null) {\n\t\t\t\t\t// Catch error in unlikely case elm has been removed\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (position === 'before') {\n\t\t\t\t\t\t\telm.parentNode.insertBefore(tmpnode, elm);\n\t\t\t\t\t\t} else if (position === 'after') {\n\t\t\t\t\t\t\telm.parentNode.insertBefore(tmpnode, elm.nextSibling);\n\t\t\t\t\t\t} else if (position === 'append') {\n\t\t\t\t\t\t\telm.appendChild(tmpnode);\n\t\t\t\t\t\t} else if (position === 'prepend') {\n\t\t\t\t\t\t\telm.insertBefore(tmpnode, elm.firstChild);\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (e) {break; }\n\t\t\t\t}\n\t\t\t}, nodes);\n\t\t}\n\t}\n\n\t// Get nodes and return chibi\n\tfunction chibi(selector) {\n\t\tvar cb, nodes = [], json = false, nodelist, i;\n\n\t\tif (selector) {\n\n\t\t\t// Element node, would prefer to use (selector instanceof HTMLElement) but no IE support\n\t\t\tif (selector.nodeType && selector.nodeType === 1) {\n\t\t\t\tnodes = [selector]; // return element as node list\n\t\t\t} else if (typeof selector === 'object') {\n\t\t\t\t// JSON, document object or node list, would prefer to use (selector instanceof NodeList) but no IE support\n\t\t\t\tjson = (typeof selector.length !== 'number');\n\t\t\t\tnodes = selector;\n\t\t\t} else if (typeof selector === 'string') {\n\n\t\t\t\t// A very light querySelectorAll polyfill for IE < 8. It suits my needs but is restricted to IE CSS support, is no speed demon, and does leave older mobile browsers in the cold (that support neither querySelectorAll nor currentStyle/getComputedStyle). If you want to use a fuller featured selector engine like Qwery, Sizzle et al, just return results to the nodes array: nodes = altselectorengine(selector)\n\n\t\t\t\t// IE < 8\n\t\t\t\tif (!d.querySelectorAll) {\n\t\t\t\t\t// Polyfill querySelectorAll\n\t\t\t\t\td.querySelectorAll = function (selector) {\n\n\t\t\t\t\t\tvar style, head = d.getElementsByTagName('head')[0], allnodes, selectednodes = [], i;\n\n\t\t\t\t\t\tstyle = d.createElement('STYLE');\n\t\t\t\t\t\tstyle.type = 'text/css';\n\n\t\t\t\t\t\tif (style.styleSheet) {\n\t\t\t\t\t\t\tstyle.styleSheet.cssText = selector + ' {a:b}';\n\n\t\t\t\t\t\t\thead.appendChild(style);\n\n\t\t\t\t\t\t\tallnodes = d.getElementsByTagName('*');\n\n\t\t\t\t\t\t\tfor (i = 0; i < allnodes.length; i += 1) {\n\t\t\t\t\t\t\t\tif (computeStyle(allnodes[i], 'a') === 'b') {\n\t\t\t\t\t\t\t\t\tselectednodes.push(allnodes[i]);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\thead.removeChild(style);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn selectednodes;\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tnodelist = d.querySelectorAll(selector);\n\n\t\t\t\t// Convert node list to array so results have full access to array methods\n\t\t\t\t// Array.prototype.slice.call not supported in IE < 9 and often slower than loop anyway\n\t\t\t\tfor (i = 0; i < nodelist.length; i += 1) {\n\t\t\t\t\tnodes[i] = nodelist[i];\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\n\t\t// Only attach nodes if not JSON\n\t\tcb = json ? {} : nodes;\n\n\t\t// Public functions\n\n\t\t// Fire on DOM ready\n\t\tcb.ready = function (fn) {\n\t\t\tif (fn) {\n\t\t\t\tif (domready) {\n\t\t\t\t\tfn();\n\t\t\t\t\treturn cb;\n\t\t\t\t} else {\n\t\t\t\t\treadyfn.push(fn);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\t// Fire on page loaded\n\t\tcb.loaded = function (fn) {\n\t\t\tif (fn) {\n\t\t\t\tif (pageloaded) {\n\t\t\t\t\tfn();\n\t\t\t\t\treturn cb;\n\t\t\t\t} else {\n\t\t\t\t\tloadedfn.push(fn);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\t// Executes a function on nodes\n\t\tcb.each = function (fn) {\n\t\t\tif (typeof fn === 'function') {\n\t\t\t\tnodeLoop(function (elm) {\n\t\t\t\t\t// <= IE 8 loses scope so need to apply\n\t\t\t\t\treturn fn.apply(elm, arguments);\n\t\t\t\t}, nodes);\n\t\t\t}\n\t\t\treturn cb;\n\t\t};\n\t\t// Find first\n\t\tcb.first = function () {\n\t\t\treturn chibi(nodes.shift());\n\t\t};\n\t\t// Find last\n\t\tcb.last = function () {\n\t\t\treturn chibi(nodes.pop());\n\t\t};\n\t\t// Find odd\n\t\tcb.odd = function () {\n\t\t\tvar odds = [], i;\n\t\t\tfor (i = 0; i < nodes.length; i += 2) {\n\t\t\t\todds.push(nodes[i]);\n\t\t\t}\n\t\t\treturn chibi(odds);\n\t\t};\n\t\t// Find even\n\t\tcb.even = function () {\n\t\t\tvar evens = [], i;\n\t\t\tfor (i = 1; i < nodes.length; i += 2) {\n\t\t\t\tevens.push(nodes[i]);\n\t\t\t}\n\t\t\treturn chibi(evens);\n\t\t};\n\t\t// Hide node\n\t\tcb.hide = function () {\n\t\t\tnodeLoop(function (elm) {\n\t\t\t\telm.style.display = 'none';\n\t\t\t}, nodes);\n\t\t\treturn cb;\n\t\t};\n\t\t// Show node\n\t\tcb.show = function () {\n\t\t\tnodeLoop(function (elm) {\n\t\t\t\tshowCss(elm);\n\t\t\t}, nodes);\n\t\t\treturn cb;\n\t\t};\n\t\t// Toggle node display\n\t\tcb.toggle = function (state) {\n\t\t\tif (typeof state != 'undefined') { // ADDED\n\t\t\t\tif(state)\n\t\t\t\t\tcb.show();\n\t\t\t\telse\n\t\t\t\t\tcb.hide();\n\t\t\t} else {\n\t\t\t\tnodeLoop(function (elm) {\n\t\t\t\t\t// computeStyle instead of style.display == 'none' catches elements that are hidden via style block\n\t\t\t\t\tif (computeStyle(elm, 'display') === 'none') {\n\t\t\t\t\t\tshowCss(elm);\n\t\t\t\t\t} else {\n\t\t\t\t\t\telm.style.display = 'none';\n\t\t\t\t\t}\n\n\t\t\t\t}, nodes);\n\t\t\t}\n\t\t\treturn cb;\n\t\t};\n\t\t// Remove node\n\t\tcb.remove = function () {\n\t\t\tnodeLoop(function (elm) {\n\t\t\t\t// Catch error in unlikely case elm has been removed\n\t\t\t\ttry {\n\t\t\t\t\telm.parentNode.removeChild(elm);\n\t\t\t\t} catch (e) {}\n\t\t\t}, nodes);\n\t\t\treturn chibi();\n\t\t};\n\t\t// Get/Set CSS\n\t\tcb.css = function (property, value) {\n\t\t\tif (property) {\n\t\t\t\tif (value || value === '') {\n\t\t\t\t\tnodeLoop(function (elm) {\n\t\t\t\t\t\tsetCss(elm, property, value);\n\t\t\t\t\t}, nodes);\n\t\t\t\t\treturn cb;\n\t\t\t\t}\n\t\t\t\tif (nodes[0]) {\n\t\t\t\t\tif (nodes[0].style[cssCamel(property)]) {\n\t\t\t\t\t\treturn nodes[0].style[cssCamel(property)];\n\t\t\t\t\t}\n\t\t\t\t\tif (computeStyle(nodes[0], property)) {\n\t\t\t\t\t\treturn computeStyle(nodes[0], property);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\t// Get class(es)\n\t\tcb.getClass = function () {\n\t\t\tif (nodes[0] && nodes[0].className.length > 0) {\n\t\t\t\t// Weak IE trim support\n\t\t\t\treturn nodes[0].className.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g, '').replace(/\\s+/,' ');\n\t\t\t}\n\t\t};\n\t\t// Set (replaces) classes\n\t\tcb.setClass = function (classes) {\n\t\t\tif (classes || classes === '') {\n\t\t\t\tnodeLoop(function (elm) {\n\t\t\t\t\telm.className = classes;\n\t\t\t\t}, nodes);\n\t\t\t}\n\t\t\treturn cb;\n\t\t};\n\t\t// Add class\n\t\tcb.addClass = function (classes) {\n\t\t\tif (classes) {\n\t\t\t\tnodeLoop(function (elm) {\n\t\t\t\t\telm.className += ' ' + classes;\n\t\t\t\t}, nodes);\n\t\t\t}\n\t\t\treturn cb;\n\t\t};\n\t\t// Remove class\n\t\tcb.removeClass = function (classes) {\n\t\t\tclassHelper(classes, 'remove', nodes);\n\t\t\treturn cb;\n\t\t};\n\t\t// Toggle class\n\t\tcb.toggleClass = function (classes) {\n\t\t\tclassHelper(classes, 'toggle', nodes);\n\t\t\treturn cb;\n\t\t};\n\t\t// Has class\n\t\tcb.hasClass = function (classes) {\n\t\t\treturn classHelper(classes, 'has', nodes);\n\t\t};\n\t\t// Get/set HTML\n\t\tcb.html = function (value) {\n\t\t\tif (value || value === '') {\n\t\t\t\tnodeLoop(function (elm) {\n\t\t\t\t\telm.innerHTML = value;\n\t\t\t\t}, nodes);\n\t\t\t\treturn cb;\n\t\t\t}\n\t\t\tif (nodes[0]) {\n\t\t\t\treturn nodes[0].innerHTML;\n\t\t\t}\n\t\t};\n\t\t// Insert HTML before selector\n\t\tcb.htmlBefore = function (value) {\n\t\t\tinsertHtml(value, 'before', nodes);\n\t\t\treturn cb;\n\t\t};\n\t\t// Insert HTML after selector\n\t\tcb.htmlAfter = function (value) {\n\t\t\tinsertHtml(value, 'after', nodes);\n\t\t\treturn cb;\n\t\t};\n\t\t// Insert HTML after selector innerHTML\n\t\tcb.htmlAppend = function (value) {\n\t\t\tinsertHtml(value, 'append', nodes);\n\t\t\treturn cb;\n\t\t};\n\t\t// Insert HTML before selector innerHTML\n\t\tcb.htmlPrepend = function (value) {\n\t\t\tinsertHtml(value, 'prepend', nodes);\n\t\t\treturn cb;\n\t\t};\n\t\t// Get/Set HTML attributes\n\t\tcb.attr = function (property, value) {\n\t\t\tif (property) {\n\t\t\t\tproperty = property.toLowerCase();\n\t\t\t\t// IE < 9 doesn't allow style or class via get/setAttribute so switch. cssText returns prettier CSS anyway\n\t\t\t\tif (typeof value !== 'undefined') {//FIXED BUG HERE\n\t\t\t\t\tnodeLoop(function (elm) {\n\t\t\t\t\t\tif (property === 'style') {\n\t\t\t\t\t\t\telm.style.cssText = value;\n\t\t\t\t\t\t} else if (property === 'class') {\n\t\t\t\t\t\t\telm.className = value;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\telm.setAttribute(property, value);\n\t\t\t\t\t\t}\n\t\t\t\t\t}, nodes);\n\t\t\t\t\treturn cb;\n\t\t\t\t}\n\t\t\t\tif (nodes[0]) {\n\t\t\t\t\tif (property === 'style') {\n\t\t\t\t\t\tif (nodes[0].style.cssText) {\n\t\t\t\t\t\t\treturn nodes[0].style.cssText;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (property === 'class') {\n\t\t\t\t\t\tif (nodes[0].className) {\n\t\t\t\t\t\t\treturn nodes[0].className;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (nodes[0].getAttribute(property)) {\n\t\t\t\t\t\t\treturn nodes[0].getAttribute(property);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\t// Get/Set HTML data property\n\t\tcb.data = function (key, value) {\n\t\t\tif (key) {\n\t\t\t\treturn cb.attr('data-'+key, value);\n\t\t\t}\n\t\t};\n\t\t// Get/Set form element values\n\t\tcb.val = function (value) {\n\t\t\tvar values, i, j;\n\t\t\tif (value || value === '') {\n\t\t\t\tnodeLoop(function (elm) {\n\t\t\t\t\tswitch (elm.nodeName) {\n\t\t\t\t\tcase 'SELECT':\n\t\t\t\t\t\tif (typeof value === 'string' || typeof value === 'number') {\n\t\t\t\t\t\t\tvalue = [value];\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfor (i = 0; i < elm.length; i += 1) {\n\t\t\t\t\t\t\t// Multiple select\n\t\t\t\t\t\t\tfor (j = 0; j < value.length; j += 1) {\n\t\t\t\t\t\t\t\telm[i].selected = '';\n\t\t\t\t\t\t\t\tif (elm[i].value === value[j]) {\n\t\t\t\t\t\t\t\t\telm[i].selected = 'selected';\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'INPUT':\n\t\t\t\t\tcase 'TEXTAREA':\n\t\t\t\t\tcase 'BUTTON':\n\t\t\t\t\t\telm.value = value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}, nodes);\n\n\t\t\t\treturn cb;\n\t\t\t}\n\t\t\tif (nodes[0]) {\n\t\t\t\tswitch (nodes[0].nodeName) {\n\t\t\t\tcase 'SELECT':\n\t\t\t\t\tvalues = [];\n\t\t\t\t\tfor (i = 0; i < nodes[0].length; i += 1) {\n\t\t\t\t\t\tif (nodes[0][i].selected) {\n\t\t\t\t\t\t\tvalues.push(nodes[0][i].value);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn (values.length > 1) ? values : values[0];\n\t\t\t\tcase 'INPUT':\n\t\t\t\tcase 'TEXTAREA':\n\t\t\t\tcase 'BUTTON':\n\t\t\t\t\treturn nodes[0].value;\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\t// Return matching checked checkbox or radios\n\t\tcb.checked = function (check) {\n\t\t\tif (typeof check === 'boolean') {\n\t\t\t\tnodeLoop(function (elm) {\n\t\t\t\t\tif (elm.nodeName === 'INPUT' && (elm.type === 'checkbox' || elm.type === 'radio')) {\n\t\t\t\t\t\telm.checked = check;\n\t\t\t\t\t}\n\t\t\t\t}, nodes);\n\t\t\t\treturn cb;\n\t\t\t}\n\t\t\tif (nodes[0] && nodes[0].nodeName === 'INPUT' && (nodes[0].type === 'checkbox' || nodes[0].type === 'radio')) {\n\t\t\t\treturn (!!nodes[0].checked);\n\t\t\t}\n\t\t};\n\t\t// Add event handler\n\t\tcb.on = function (event, fn) {\n\t\t\tif (selector === w || selector === d) {\n\t\t\t\tnodes = [selector];\n\t\t\t}\n\t\t\tnodeLoop(function (elm) {\n\t\t\t\tif (d.addEventListener) {\n\t\t\t\t\telm.addEventListener(event, fn, false);\n\t\t\t\t} else if (d.attachEvent) {\n\t\t\t\t\t// <= IE 8 loses scope so need to apply, we add this to object so we can detach later (can't detach anonymous functions)\n\t\t\t\t\telm[event + fn] = function () { return fn.apply(elm, arguments); };\n\t\t\t\t\telm.attachEvent('on' + event, elm[event + fn]);\n\t\t\t\t}\n\t\t\t}, nodes);\n\t\t\treturn cb;\n\t\t};\n\t\t// Remove event handler\n\t\tcb.off = function (event, fn) {\n\t\t\tif (selector === w || selector === d) {\n\t\t\t\tnodes = [selector];\n\t\t\t}\n\t\t\tnodeLoop(function (elm) {\n\t\t\t\tif (d.addEventListener) {\n\t\t\t\t\telm.removeEventListener(event, fn, false);\n\t\t\t\t} else if (d.attachEvent) {\n\t\t\t\t\telm.detachEvent('on' + event, elm[event + fn]);\n\t\t\t\t\t// Tidy up\n\t\t\t\t\telm[event + fn] = null;\n\t\t\t\t}\n\t\t\t}, nodes);\n\t\t\treturn cb;\n\t\t};\n\t\t// Basic XHR 1, no file support. Shakes fist at IE\n\t\tcb.ajax = function (url, method, callback, nocache, nojsonp) {\n\t\t\tvar xhr,\n\t\t\t\tquery = serializeData(nodes),\n\t\t\t\ttype = (method) ? method.toUpperCase() : 'GET',\n\t\t\t\thostsearch = new RegExp('http[s]?://(.*?)/', 'gi'),\n\t\t\t\tdomain = hostsearch.exec(url),\n\t\t\t\ttimestamp = '_ts=' + (+new Date()),\n\t\t\t\thead = d.getElementsByTagName('head')[0],\n\t\t\t\tjsonpcallback = 'chibi' + (+new Date()) + (jsonpcount += 1),\n\t\t\t\tscript;\n\n\t\t\tif (query && (type === 'GET' || type === 'DELETE')) {\n\t\t\t\turl += (url.indexOf('?') === -1) ? '?' + query : '&' + query;\n\t\t\t\tquery = null;\n\t\t\t}\n\n\t\t\t// JSONP if cross domain url\n\t\t\tif (type === 'GET' && !nojsonp && domain && w.location.host !== domain[1]) {\n\n\t\t\t\tif (nocache) {\n\t\t\t\t\turl += (url.indexOf('?') === -1) ? '?' + timestamp : '&' + timestamp;\n\t\t\t\t}\n\n\t\t\t\t// Replace possible encoded ?\n\t\t\t\turl = url.replace('=%3F', '=?');\n\n\t\t\t\t// Replace jsonp ? with callback\n\t\t\t\tif (callback && url.indexOf('=?') !== -1) {\n\n\t\t\t\t\turl = url.replace('=?', '=' + jsonpcallback);\n\n\t\t\t\t\tw[jsonpcallback] = function (data) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tcallback(data, 200);\n\t\t\t\t\t\t} catch (e) {}\n\n\t\t\t\t\t\t// Tidy up\n\t\t\t\t\t\tw[jsonpcallback] = undefined;\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\t// JSONP\n\t\t\t\tscript = document.createElement('script');\n\t\t\t\tscript.async = true;\n\t\t\t\tscript.src = url;\n\n\t\t\t\t// Tidy up\n\t\t\t\tscript.onload = function () {\n\t\t\t\t\thead.removeChild(script);\n\t\t\t\t};\n\n\t\t\t\thead.appendChild(script);\n\n\t\t\t} else {\n\n\t\t\t\tif (w.XMLHttpRequest) {\n\t\t\t\t\txhr = new XMLHttpRequest();\n\t\t\t\t} else if (w.ActiveXObject) {\n\t\t\t\t\txhr = new ActiveXObject('Microsoft.XMLHTTP'); // IE < 9\n\t\t\t\t}\n\n\t\t\t\tif (xhr) {\n\n\t\t\t\t\tif (nocache) {\n\t\t\t\t\t\turl += (url.indexOf('?') === -1) ? '?' + timestamp : '&' + timestamp;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Douglas Crockford: \"Synchronous programming is disrespectful and should not be employed in applications which are used by people\"\n\t\t\t\t\txhr.open(type, url, true);\n\n\t\t\t\t\txhr.onreadystatechange = function () {\n\t\t\t\t\t\tif (xhr.readyState === 4) {\n\t\t\t\t\t\t\tif (callback) {\n\t\t\t\t\t\t\t\tcallback(xhr.responseText, xhr.status);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\n\t\t\t\t\txhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');\n\n\t\t\t\t\tif (type === 'POST' || type === 'PUT') {\n\t\t\t\t\t\txhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');\n\t\t\t\t\t}\n\n\t\t\t\t\txhr.send(query);\n\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn cb;\n\t\t};\n\t\t// Alias to cb.ajax(url, 'get', callback, nocache, nojsonp)\n\t\tcb.get = function (url, callback, nocache, nojsonp) {\n\t\t\treturn cb.ajax(url, 'get', callback, nocache, nojsonp);\n\t\t};\n\t\t// Alias to cb.ajax(url, 'post', callback, nocache)\n\t\tcb.post = function (url, callback, nocache) {\n\t\t\treturn cb.ajax(url, 'post', callback, nocache);\n\t\t};\n\n\t\treturn cb;\n\t}\n\n\t// Set Chibi's global namespace here ($)\n\tw.$ = chibi;\n\n}());\n"],"sourceRoot":"/source/"}