From ccc1286c5601c89d2069c2b90e40b599483c99e3 Mon Sep 17 00:00:00 2001 From: Lukas Bachschwell Date: Tue, 17 Oct 2017 00:10:48 +0200 Subject: [PATCH] Make stuff work and efficient --- src/CSS_NORMALIZE.h | 250 --------------------------- src/CSS_STYLE.h | 402 -------------------------------------------- src/EasyUI.cpp | 134 ++++----------- src/EasyUI.h | 19 +-- src/HTML_PAGE.h | 2 +- src/JS_ZEPTO.h | 4 - 6 files changed, 36 insertions(+), 775 deletions(-) delete mode 100644 src/CSS_NORMALIZE.h delete mode 100644 src/CSS_STYLE.h delete mode 100644 src/JS_ZEPTO.h diff --git a/src/CSS_NORMALIZE.h b/src/CSS_NORMALIZE.h deleted file mode 100644 index 7f74cf0..0000000 --- a/src/CSS_NORMALIZE.h +++ /dev/null @@ -1,250 +0,0 @@ -const char CSS_NORMALIZE[] PROGMEM = R"=====( - - html { - font-family: sans-serif; /* 1 */ - -ms-text-size-adjust: 100%; /* 2 */ - -webkit-text-size-adjust: 100%; /* 2 */ - } - - body { - margin: 0; - } - - /* HTML5 display definitions - ========================================================================== */ - - article, - aside, - details, - figcaption, - figure, - footer, - header, - hgroup, - main, - menu, - nav, - section, - summary { - display: block; - } - - audio, - canvas, - progress, - video { - display: inline-block; /* 1 */ - vertical-align: baseline; /* 2 */ - } - - audio:not([controls]) { - display: none; - height: 0; - } - - [hidden], - template { - display: none; - } - - /* Links - ========================================================================== */ - - a { - background-color: transparent; - } - - a:active, - a:hover { - outline: 0; - } - - /* Text-level semantics - ========================================================================== */ - - abbr[title] { - border-bottom: 1px dotted; - } - - b, - strong { - font-weight: bold; - } - - dfn { - font-style: italic; - } - - h1 { - font-size: 2em; - margin: 0.67em 0; - } - - mark { - background: #ff0; - color: #000; - } - - small { - font-size: 80%; - } - - sub, - sup { - font-size: 75%; - line-height: 0; - position: relative; - vertical-align: baseline; - } - - sup { - top: -0.5em; - } - - sub { - bottom: -0.25em; - } - - /* Embedded content - ========================================================================== */ - - img { - border: 0; - } - - svg:not(:root) { - overflow: hidden; - } - - /* Grouping content - ========================================================================== */ - - figure { - margin: 1em 40px; - } - - hr { - -moz-box-sizing: content-box; - box-sizing: content-box; - height: 0; - } - - pre { - overflow: auto; - } - - code, - kbd, - pre, - samp { - font-family: monospace, monospace; - font-size: 1em; - } - - button, - input, - optgroup, - select, - textarea { - color: inherit; /* 1 */ - font: inherit; /* 2 */ - margin: 0; /* 3 */ - } - - button { - overflow: visible; - } - - button, - select { - text-transform: none; - } - - button, - html input[type="button"], /* 1 */ - input[type="reset"], - input[type="submit"] { - -webkit-appearance: button; /* 2 */ - cursor: pointer; /* 3 */ - } - - button[disabled], - html input[disabled] { - cursor: default; - } - - button::-moz-focus-inner, - input::-moz-focus-inner { - border: 0; - padding: 0; - } - - input { - line-height: normal; - } - - input[type="checkbox"], - input[type="radio"] { - box-sizing: border-box; /* 1 */ - padding: 0; /* 2 */ - } - - input[type="number"]::-webkit-inner-spin-button, - input[type="number"]::-webkit-outer-spin-button { - height: auto; - } - - input[type="search"] { - -webkit-appearance: textfield; /* 1 */ - -moz-box-sizing: content-box; - -webkit-box-sizing: content-box; /* 2 */ - box-sizing: content-box; - } - - input[type="search"]::-webkit-search-cancel-button, - input[type="search"]::-webkit-search-decoration { - -webkit-appearance: none; - } - - fieldset { - border: 1px solid #c0c0c0; - margin: 0 2px; - padding: 0.35em 0.625em 0.75em; - } - - /** - * 1. Correct `color` not being inherited in IE 8/9/10/11. - * 2. Remove padding so people aren't caught out if they zero out fieldsets. - */ - - legend { - border: 0; /* 1 */ - padding: 0; /* 2 */ - } - - textarea { - overflow: auto; - } - - /** - * Don't inherit the `font-weight` (applied by a rule above). - * NOTE: the default cannot safely be changed in Chrome and Safari on OS X. - */ - - optgroup { - font-weight: bold; - } - - /* Tables - ========================================================================== */ - table { - border-collapse: collapse; - border-spacing: 0; - } - - td, - th { - padding: 0; - } - -)====="; diff --git a/src/CSS_STYLE.h b/src/CSS_STYLE.h deleted file mode 100644 index df56854..0000000 --- a/src/CSS_STYLE.h +++ /dev/null @@ -1,402 +0,0 @@ -const char CSS_STYLE[] PROGMEM = R"=====( - body{ - background-color: #F4F3EF; - } - .container { - position: relative; - width: 79%; - margin: 20px; - box-sizing: border-box; } - .column, - .columns { - width: 100%; - float: left; } - - .card{ - margin-top: 2%; - border-radius: 6px; - box-shadow: 0 2px 2px rgba(204, 197, 185, 0.5); - padding-left: 20px; - padding-right: 20px; - margin-bottom: 10px; - min-width: 150px; - } - - .label { - box-sizing: border-box; - white-space: nowrap; - border-radius: 0.2em; - padding: 0.12em 0.4em 0.14em; - text-align: center; - color: #ffffff; - font-size: 0.75em; - font-weight: 700; - line-height: 1; - display: inline; - white-space: nowrap; - vertical-align: baseline; - position: relative; - top: -0.15em; - background-color: #999999; } - - .label { ... } - - .label.color-blue { background-color: #6f9ad1; } - .label.color-red { background-color: #d37c7c; } - .label.color-green { background-color: #9bc268; } - .label.color-orange { background-color: #dea154; } - .label.color-yellow { background-color: #e9d641; } - .label.color-purple { background-color: #9f83d1; } - - /* For devices larger than 400px */ - @media (min-width: 400px) { - .container { - width: 84%;} - - } - - /* For devices larger than 550px */ - @media (min-width: 630px) { - .container { - width: 98%; } - .column, - .columns { - margin-right: 2%; } - .column:first-child, - .columns:first-child { - margin-left: 0; } - - .one.column, - .one.columns { width: 4.66666666667%; } - .two.columns { width: 13.3333333333%; } - .three.columns { width: 22%; } - .four.columns { width: 30.6666666667%; } - .five.columns { width: 39.3333333333%; } - .six.columns { width: 48%; } - .seven.columns { width: 56.6666666667%; } - .eight.columns { width: 65.3333333333%; } - .nine.columns { width: 74.0%; } - .ten.columns { width: 82.6666666667%; } - .eleven.columns { width: 91.3333333333%; } - .twelve.columns { width: 100%; margin-left: 0; } - - .one-third.column { width: 30.6666666667%; } - .two-thirds.column { width: 65.3333333333%; } - - .one-half.column { width: 48%; } - - /* Offsets */ - .offset-by-one.column, - .offset-by-one.columns { margin-left: 8.66666666667%; } - .offset-by-two.column, - .offset-by-two.columns { margin-left: 17.3333333333%; } - .offset-by-three.column, - .offset-by-three.columns { margin-left: 26%; } - .offset-by-four.column, - .offset-by-four.columns { margin-left: 34.6666666667%; } - .offset-by-five.column, - .offset-by-five.columns { margin-left: 43.3333333333%; } - .offset-by-six.column, - .offset-by-six.columns { margin-left: 52%; } - .offset-by-seven.column, - .offset-by-seven.columns { margin-left: 60.6666666667%; } - .offset-by-eight.column, - .offset-by-eight.columns { margin-left: 69.3333333333%; } - .offset-by-nine.column, - .offset-by-nine.columns { margin-left: 78.0%; } - .offset-by-ten.column, - .offset-by-ten.columns { margin-left: 86.6666666667%; } - .offset-by-eleven.column, - .offset-by-eleven.columns { margin-left: 95.3333333333%; } - - .offset-by-one-third.column, - .offset-by-one-third.columns { margin-left: 34.6666666667%; } - .offset-by-two-thirds.column, - .offset-by-two-thirds.columns { margin-left: 69.3333333333%; } - - .offset-by-one-half.column, - .offset-by-one-half.columns { margin-left: 52%; } - - } - - - /* Base Styles - –––––––––––––––––––––––––––––––––––––––––––––––––– */ - /* NOTE - html is set to 62.5% so that all the REM measurements throughout Skeleton - are based on 10px sizing. So basically 1.5rem = 15px :) */ - html { - font-size: 62.5%; } - body { - margin: 0; - font-size: 1.5em; /* currently ems cause chrome bug misinterpreting rems on body element */ - line-height: 1.0; - font-weight: 400; - font-family: "Raleway", "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif; - color: #222; } - - - /* Typography - –––––––––––––––––––––––––––––––––––––––––––––––––– */ - h1, h2, h3, h4, h5, h6 { - margin-top: 0; - margin-bottom: 0.5rem; - font-weight: 300; } - h1 { font-size: 4.0rem; line-height: 1.2; letter-spacing: -.1rem;} - h2 { font-size: 3.6rem; line-height: 1.25; letter-spacing: -.1rem; } - h3 { font-size: 3.0rem; line-height: 1.3; letter-spacing: -.1rem; } - h4 { font-size: 2.4rem; line-height: 1.35; letter-spacing: -.08rem; } - h5 { font-size: 1.8rem; line-height: 1.5; letter-spacing: -.05rem; } - h6 { font-size: 1.5rem; line-height: 1.6; letter-spacing: 0; } - - /* Larger than phablet */ - @media (min-width: 630px) { - h1 { font-size: 5.0rem; } - h2 { font-size: 4.2rem; } - h3 { font-size: 3.6rem; } - h4 { font-size: 3.0rem; } - h5 { font-size: 2.0rem; } - h6 { font-size: 1.5rem; } - } - - p { - margin-top: 0; } - - - /* Links - –––––––––––––––––––––––––––––––––––––––––––––––––– */ - a { - color: #1EAEDB; } - a:hover { - color: #0FA0CE; } - - - /* Buttons - –––––––––––––––––––––––––––––––––––––––––––––––––– */ - .button, - button, - input[type="submit"], - input[type="reset"], - input[type="button"] { - display: inline-block; - height: 38px; - padding: 0 30px; - color: #555; - text-align: center; - font-size: 11px; - font-weight: 600; - line-height: 38px; - letter-spacing: .1rem; - text-transform: uppercase; - text-decoration: none; - white-space: nowrap; - background-color: transparent; - border-radius: 4px; - border: 1px solid #bbb; - cursor: pointer; - box-sizing: border-box; } - .button:hover, - button:hover, - input[type="submit"]:hover, - input[type="reset"]:hover, - input[type="button"]:hover, - .button:focus, - button:focus, - input[type="submit"]:focus, - input[type="reset"]:focus, - input[type="button"]:focus { - color: #333; - border-color: #888; - outline: 0; } - .button.button-primary, - button.button-primary, - input[type="submit"].button-primary, - input[type="reset"].button-primary, - input[type="button"].button-primary { - color: #FFF; - background-color: #33C3F0; - border-color: #33C3F0; } - .button.button-primary:hover, - button.button-primary:hover, - input[type="submit"].button-primary:hover, - input[type="reset"].button-primary:hover, - input[type="button"].button-primary:hover, - .button.button-primary:focus, - button.button-primary:focus, - input[type="submit"].button-primary:focus, - input[type="reset"].button-primary:focus, - input[type="button"].button-primary:focus { - color: #FFF; - background-color: #1EAEDB; - border-color: #1EAEDB; } - - - /* Forms - –––––––––––––––––––––––––––––––––––––––––––––––––– */ - input[type="email"], - input[type="number"], - input[type="search"], - input[type="text"], - input[type="tel"], - input[type="url"], - input[type="password"], - textarea, - select { - height: 38px; - padding: 6px 10px; /* The 6px vertically centers text on FF, ignored by Webkit */ - background-color: #fff; - border: 1px solid #D1D1D1; - border-radius: 4px; - box-shadow: none; - box-sizing: border-box; } - /* Removes awkward default styles on some inputs for iOS */ - input[type="email"], - input[type="number"], - input[type="search"], - input[type="text"], - input[type="tel"], - input[type="url"], - input[type="password"], - textarea { - -webkit-appearance: none; - -moz-appearance: none; - appearance: none; } - textarea { - min-height: 65px; - padding-top: 6px; - padding-bottom: 6px; } - input[type="email"]:focus, - input[type="number"]:focus, - input[type="search"]:focus, - input[type="text"]:focus, - input[type="tel"]:focus, - input[type="url"]:focus, - input[type="password"]:focus, - textarea:focus, - select:focus { - border: 1px solid #33C3F0; - outline: 0; } - label, - legend { - display: block; - margin-bottom: .5rem; - font-weight: 600; } - fieldset { - padding: 0; - border-width: 0; } - input[type="checkbox"], - input[type="radio"] { - display: inline; } - label > .label-body { - display: inline-block; - margin-left: .5rem; - font-weight: normal; } - - - /* Lists - –––––––––––––––––––––––––––––––––––––––––––––––––– */ - ul { - list-style: circle inside; } - ol { - list-style: decimal inside; } - ol, ul { - padding-left: 0; - margin-top: 0; } - ul ul, - ul ol, - ol ol, - ol ul { - margin: 1.5rem 0 1.5rem 3rem; - font-size: 90%; } - li { - margin-bottom: 1rem; } - - - /* Code - –––––––––––––––––––––––––––––––––––––––––––––––––– */ - code { - padding: .2rem .5rem; - margin: 0 .2rem; - font-size: 90%; - white-space: nowrap; - background: #F1F1F1; - border: 1px solid #E1E1E1; - border-radius: 4px; } - pre > code { - display: block; - padding: 1rem 1.5rem; - white-space: pre; } - - - /* Tables - –––––––––––––––––––––––––––––––––––––––––––––––––– */ - th, - td { - padding: 12px 15px; - text-align: left; - border-bottom: 1px solid #E1E1E1; } - th:first-child, - td:first-child { - padding-left: 0; } - th:last-child, - td:last-child { - padding-right: 0; } - - - /* Spacing - –––––––––––––––––––––––––––––––––––––––––––––––––– */ - button, - .button { - margin-bottom: 1rem; } - input, - textarea, - select, - fieldset { - margin-bottom: 1.5rem; } - pre, - blockquote, - dl, - figure, - table, - p, - ul, - ol, - form { - margin-bottom: 2.5rem; } - - - /* Utilities - –––––––––––––––––––––––––––––––––––––––––––––––––– */ - .u-full-width { - width: 100%; - box-sizing: border-box; } - .u-max-full-width { - max-width: 100%; - box-sizing: border-box; } - .u-pull-right { - float: right; } - .u-pull-left { - float: left; } - - - /* Misc - –––––––––––––––––––––––––––––––––––––––––––––––––– */ - hr { - margin-top: 0.5rem; - margin-bottom: 1.2rem; - border-width: 0; - border-top: 1px solid #E1E1E1; } - - - /* Clearing - –––––––––––––––––––––––––––––––––––––––––––––––––– */ - - /* Self Clearing Goodness */ - .container:after, - .row:after, - .u-cf { - content: ""; - display: table; - clear: both; } - -)====="; diff --git a/src/EasyUI.cpp b/src/EasyUI.cpp index 77a08ef..543d0cd 100644 --- a/src/EasyUI.cpp +++ b/src/EasyUI.cpp @@ -1,67 +1,7 @@ #include "EasyUI.h" - -#include "HTML_PAGE.h" // Added HTML Index Page -#include "CSS_STYLE.h" // Added Main CSS Style -#include "CSS_NORMALIZE.h" // Added Normalize CSS -#include "JS_ZEPTO.h" #include - #include -using namespace std; -using namespace std::placeholders; -/* -// Generate Websockets Script for Webpage -void EasyUIClass::handleSockets(AsyncWebServerRequest *request){ - String ip; - if(WiFi.localIP().toString() != "0.0.0.0"){ - ip = WiFi.localIP().toString(); - } - else if(WiFi.softAPIP().toString() != "0.0.0.0"){ - ip = WiFi.softAPIP().toString(); - } - - String wsString; - wsString = "var connection = new WebSocket(\"ws://"+ip+":81/\", ['easyui']);"; - wsString += " var keys = {};"; - wsString += " connection.onopen = function () {"; - wsString += " $(\"#connection_status\").toggleClass(\"color-green\");"; - wsString += " $(\"#connection_status\").text(\"Connected\");"; - wsString += String(" connection.send(")+"\"{'mode': 'check_tb_status'}\");"; - for(int i=0; i
\"+obj.l_title+\"

\"+obj.l_value+\"

\");}"; - wsString += " else if(obj.mode === 'create_tbutton'){ $('#row').append(\"
\"+obj.tb_title+\"

\");}"; - wsString += " else if(obj.mode === 't_button_startup'){ var tb_index = obj.index; for(i=0; isend(200, "application/javascript", wsString); -} - -// Handle Index HTML -void EasyUIClass::handleRoot(AsyncWebServerRequest *request){ - String rootString; - //request->setContentLength(CONTENT_LENGTH_UNKNOWN); - rootString += HTML_HEAD1; - rootString += String("")+ui_title+""; - rootString += HTML_HEAD2; - rootString += String("

")+ui_title+" Offline


"; - rootString += HTML_BODY; - rootString += ""; - - rootString += HTML_END; - request->send(200,"text/html", rootString); - //server->client().stop(); -} -*/ -/* // Handle Websockets Communication void onWsEvent(AsyncWebSocket * server, AsyncWebSocketClient * client, AwsEventType type, void * arg, uint8_t *data, size_t len){ switch(type) { @@ -72,26 +12,33 @@ void onWsEvent(AsyncWebSocket * server, AsyncWebSocketClient * client, AwsEventT { //Serial.printf("[WSc] Connected to url: %s\n", payload); Serial.println("Connected"); - EasyUI.handleWebpage(); + EasyUI.handleWebpage(client); Serial.println("JSON Data Sent to Client!"); } break; case WS_EVT_DATA: + Serial.print("WS Event"); + String msg = ""; + for (size_t i = 0; i < len; i++) { + msg += (char) data[i]; + } + Serial.println(msg); + StaticJsonBuffer<200> jsonBuffer; JsonObject& root = jsonBuffer.parseObject(data); String mode = root["mode"]; if(mode == "check_tb_status"){ - EasyUI.tbuttonStatus(); + //EasyUI.tbuttonStatus(); } else if(mode == "tb_click"){ String status = root["status"]; String index = root["index"]; - EasyUI.tbClick(index, status); + //EasyUI.tbClick(index, status); } break; } } -*/ + void EasyUIClass::title(const char* _title){ ui_title = _title; } @@ -116,7 +63,6 @@ void EasyUIClass::toggleButton(uint8_t pin, const char* tbutton_label, int star // Create a generic Button void EasyUIClass::button(uint8_t pin, const char* tbutton_label, int start_state, bool swap_state){ //TODO: Implement - pinMode(pin, OUTPUT); digitalWrite(pin, start_state); tbutton_swap[tb_index] = swap_state; tbutton_pinout[tb_index] = pin; @@ -189,60 +135,45 @@ void EasyUIClass::tbClick(String _index, String _status){ } } */ -/* -// Convert & Transfer Arduino elements to JSON elements -void EasyUIClass::handleWebpage(){ +// Convert & Transfer Arduino elements to JSON elements +void EasyUIClass::handleWebpage(AsyncWebSocketClient * client){ + // Labels for(int i=0; i jsonBuffer1; JsonObject& root1 = jsonBuffer1.createObject(); - root1["mode"] = "create_label"; + root1["type"] = "domLabel"; root1["l_title"] = String(label_title[i]); - root1["l_value"] = String(label_value[i]); + root1["label"] = String(label_value[i]); root1.printTo(json); - webSocket->broadcastTXT(json); + client->text(json); } - + // Buttons for(int i=0; i jsonBuffer2; JsonObject& root2 = jsonBuffer2.createObject(); - root2["mode"] = "create_tbutton"; + root2["type"] = "domButton"; root2["index"] = String(i); - root2["tb_title"] = tbuttontitle[i]; + root2["label"] = tbuttontitle[i]; root2.printTo(json); - webSocket->broadcastTXT(json); + client->text(json); } } -*/ + void EasyUIClass::begin(){ - server.reset(new AsyncWebServer(80)); - //ws.reset(new AsyncWebSocket("/ws")); - //SPIFFS.begin(); + server = new AsyncWebServer(80); + ws = new AsyncWebSocket("/ws"); + SPIFFS.begin(false); + + ws->onEvent(onWsEvent); + server->addHandler(ws); + + server->serveStatic("/", SPIFFS, "/").setDefaultFile("index.htm"); - //ws->onEvent(onWsEvent); - //server->addHandler(&ws); -/* - server->on("/", HTTP_GET, [](AsyncWebServerRequest *request){ - EasyUI.handleRoot(request); - }); - server->on("/js/sockets.js", HTTP_GET, [](AsyncWebServerRequest *request){ - EasyUI.handleSockets(request); - }); -*/ - // Static constant serving =P - server->on("/js/zepto.js", HTTP_GET, [](AsyncWebServerRequest *request){ - request->send(200, "application/javascript", JS_ZEPTO); - }); - server->on("/css/normalize.css", HTTP_GET, [](AsyncWebServerRequest *request){ - request->send(200, "text/css", CSS_NORMALIZE); - }); - server->on("/css/style.css", HTTP_GET, [](AsyncWebServerRequest *request){ - request->send(200, "text/css", CSS_STYLE); - }); //Heap for general Servertest server->on("/heap", HTTP_GET, [](AsyncWebServerRequest *request){ request->send(200, "text/plain", String(ESP.getFreeHeap())); @@ -253,12 +184,7 @@ void EasyUIClass::begin(){ }); server->begin(); - //webSocket->onEvent(webSocketEvent); - Serial.println("UI Initialized"); } -void EasyUIClass::loop(){ -} - EasyUIClass EasyUI; diff --git a/src/EasyUI.h b/src/EasyUI.h index 20f2f6e..2e6bf45 100644 --- a/src/EasyUI.h +++ b/src/EasyUI.h @@ -9,7 +9,8 @@ #include "Arduino.h" #include "stdlib_noniso.h" #include "ArduinoJson.h" -//#include "FS.h" +#include "FS.h" +#include "SPIFFS.h" #include "WiFi.h" #include @@ -24,8 +25,6 @@ public: void toggleButton(uint8_t pin, const char* tbutton_label, int start_state = 0, bool swap_state = false); // Create Toggle Button void button(uint8_t pin, const char* tbutton_label, int start_state = 0, bool swap_state = false); // Create Toggle Button void label(const char* label_name, const char* label_val); // Create Label - void loop(); // Do All Loop Work - // Variables --- const char* ui_title = "EasyUI"; // Store UI Title and Header Name int tb_index; // Calculate How Many Toggle Buttons @@ -43,21 +42,13 @@ public: String webpage; // Coverts Arduino elements to JSON elements String wsString = ""; // Stores Websockets Script - // Don't Issue the Below functions in your Sketch! - These are Resposible for Webpage functioning. void tbClick(String _index, String _status); void tbuttonStatus(); - void handleWebpage(); - + void handleWebpage(AsyncWebSocketClient * client); private: - std::unique_ptr server; // Create Unique Instance for Webserver - std::unique_ptr ws; // Create Unique Instance for WebSocketsServer - - void handleRoot(AsyncWebServerRequest *request); // Handle MainPage - void handleNotFound(); // Handle Page Not-Found - void handleSockets(AsyncWebServerRequest *request); // Handle Sockets Script - - + AsyncWebServer* server; // Create Unique Instance for Webserver + AsyncWebSocket* ws; }; extern EasyUIClass EasyUI; diff --git a/src/HTML_PAGE.h b/src/HTML_PAGE.h index a8f589e..c26daea 100644 --- a/src/HTML_PAGE.h +++ b/src/HTML_PAGE.h @@ -9,7 +9,7 @@ const char HTML_HEAD2[] PROGMEM = R"=====( - +
diff --git a/src/JS_ZEPTO.h b/src/JS_ZEPTO.h deleted file mode 100644 index 7bdf7d6..0000000 --- a/src/JS_ZEPTO.h +++ /dev/null @@ -1,4 +0,0 @@ -const char JS_ZEPTO[] PROGMEM = R"=====( - /* Zepto v1.2.0 - zepto event ajax form ie - zeptojs.com/license */ - !function(t,e){"function"==typeof define&&define.amd?define(function(){return e(t)}):e(t)}(this,function(t){var e=function(){function $(t){return null==t?String(t):S[C.call(t)]||"object"}function F(t){return"function"==$(t)}function k(t){return null!=t&&t==t.window}function M(t){return null!=t&&t.nodeType==t.DOCUMENT_NODE}function R(t){return"object"==$(t)}function Z(t){return R(t)&&!k(t)&&Object.getPrototypeOf(t)==Object.prototype}function z(t){var e=!!t&&"length"in t&&t.length,n=r.type(t);return"function"!=n&&!k(t)&&("array"==n||0===e||"number"==typeof e&&e>0&&e-1 in t)}function q(t){return a.call(t,function(t){return null!=t})}function H(t){return t.length>0?r.fn.concat.apply([],t):t}function I(t){return t.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()}function V(t){return t in l?l[t]:l[t]=new RegExp("(^|\\s)"+t+"(\\s|$)")}function _(t,e){return"number"!=typeof e||h[I(t)]?e:e+"px"}function B(t){var e,n;return c[t]||(e=f.createElement(t),f.body.appendChild(e),n=getComputedStyle(e,"").getPropertyValue("display"),e.parentNode.removeChild(e),"none"==n&&(n="block"),c[t]=n),c[t]}function U(t){return"children"in t?u.call(t.children):r.map(t.childNodes,function(t){return 1==t.nodeType?t:void 0})}function X(t,e){var n,r=t?t.length:0;for(n=0;r>n;n++)this[n]=t[n];this.length=r,this.selector=e||""}function J(t,r,i){for(n in r)i&&(Z(r[n])||L(r[n]))?(Z(r[n])&&!Z(t[n])&&(t[n]={}),L(r[n])&&!L(t[n])&&(t[n]=[]),J(t[n],r[n],i)):r[n]!==e&&(t[n]=r[n])}function W(t,e){return null==e?r(t):r(t).filter(e)}function Y(t,e,n,r){return F(e)?e.call(t,n,r):e}function G(t,e,n){null==n?t.removeAttribute(e):t.setAttribute(e,n)}function K(t,n){var r=t.className||"",i=r&&r.baseVal!==e;return n===e?i?r.baseVal:r:void(i?r.baseVal=n:t.className=n)}function Q(t){try{return t?"true"==t||("false"==t?!1:"null"==t?null:+t+""==t?+t:/^[\[\{]/.test(t)?r.parseJSON(t):t):t}catch(e){return t}}function tt(t,e){e(t);for(var n=0,r=t.childNodes.length;r>n;n++)tt(t.childNodes[n],e)}var e,n,r,i,O,P,o=[],s=o.concat,a=o.filter,u=o.slice,f=t.document,c={},l={},h={"column-count":1,columns:1,"font-weight":1,"line-height":1,opacity:1,"z-index":1,zoom:1},p=/^\s*<(\w+|!)[^>]*>/,d=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,m=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,g=/^(?:body|html)$/i,v=/([A-Z])/g,y=["val","css","html","text","data","width","height","offset"],x=["after","prepend","before","append"],b=f.createElement("table"),E=f.createElement("tr"),j={tr:f.createElement("tbody"),tbody:b,thead:b,tfoot:b,td:E,th:E,"*":f.createElement("div")},w=/complete|loaded|interactive/,T=/^[\w-]*$/,S={},C=S.toString,N={},A=f.createElement("div"),D={tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},L=Array.isArray||function(t){return t instanceof Array};return N.matches=function(t,e){if(!e||!t||1!==t.nodeType)return!1;var n=t.matches||t.webkitMatchesSelector||t.mozMatchesSelector||t.oMatchesSelector||t.matchesSelector;if(n)return n.call(t,e);var r,i=t.parentNode,o=!i;return o&&(i=A).appendChild(t),r=~N.qsa(i,e).indexOf(t),o&&A.removeChild(t),r},O=function(t){return t.replace(/-+(.)?/g,function(t,e){return e?e.toUpperCase():""})},P=function(t){return a.call(t,function(e,n){return t.indexOf(e)==n})},N.fragment=function(t,n,i){var o,s,a;return d.test(t)&&(o=r(f.createElement(RegExp.$1))),o||(t.replace&&(t=t.replace(m,"<$1>")),n===e&&(n=p.test(t)&&RegExp.$1),n in j||(n="*"),a=j[n],a.innerHTML=""+t,o=r.each(u.call(a.childNodes),function(){a.removeChild(this)})),Z(i)&&(s=r(o),r.each(i,function(t,e){y.indexOf(t)>-1?s[t](e):s.attr(t,e)})),o},N.Z=function(t,e){return new X(t,e)},N.isZ=function(t){return t instanceof N.Z},N.init=function(t,n){var i;if(!t)return N.Z();if("string"==typeof t)if(t=t.trim(),"<"==t[0]&&p.test(t))i=N.fragment(t,RegExp.$1,n),t=null;else{if(n!==e)return r(n).find(t);i=N.qsa(f,t)}else{if(F(t))return r(f).ready(t);if(N.isZ(t))return t;if(L(t))i=q(t);else if(R(t))i=[t],t=null;else if(p.test(t))i=N.fragment(t.trim(),RegExp.$1,n),t=null;else{if(n!==e)return r(n).find(t);i=N.qsa(f,t)}}return N.Z(i,t)},r=function(t,e){return N.init(t,e)},r.extend=function(t){var e,n=u.call(arguments,1);return"boolean"==typeof t&&(e=t,t=n.shift()),n.forEach(function(n){J(t,n,e)}),t},N.qsa=function(t,e){var n,r="#"==e[0],i=!r&&"."==e[0],o=r||i?e.slice(1):e,s=T.test(o);return t.getElementById&&s&&r?(n=t.getElementById(o))?[n]:[]:1!==t.nodeType&&9!==t.nodeType&&11!==t.nodeType?[]:u.call(s&&!r&&t.getElementsByClassName?i?t.getElementsByClassName(o):t.getElementsByTagName(e):t.querySelectorAll(e))},r.contains=f.documentElement.contains?function(t,e){return t!==e&&t.contains(e)}:function(t,e){for(;e&&(e=e.parentNode);)if(e===t)return!0;return!1},r.type=$,r.isFunction=F,r.isWindow=k,r.isArray=L,r.isPlainObject=Z,r.isEmptyObject=function(t){var e;for(e in t)return!1;return!0},r.isNumeric=function(t){var e=Number(t),n=typeof t;return null!=t&&"boolean"!=n&&("string"!=n||t.length)&&!isNaN(e)&&isFinite(e)||!1},r.inArray=function(t,e,n){return o.indexOf.call(e,t,n)},r.camelCase=O,r.trim=function(t){return null==t?"":String.prototype.trim.call(t)},r.uuid=0,r.support={},r.expr={},r.noop=function(){},r.map=function(t,e){var n,i,o,r=[];if(z(t))for(i=0;i=0?t:t+this.length]},toArray:function(){return this.get()},size:function(){return this.length},remove:function(){return this.each(function(){null!=this.parentNode&&this.parentNode.removeChild(this)})},each:function(t){return o.every.call(this,function(e,n){return t.call(e,n,e)!==!1}),this},filter:function(t){return F(t)?this.not(this.not(t)):r(a.call(this,function(e){return N.matches(e,t)}))},add:function(t,e){return r(P(this.concat(r(t,e))))},is:function(t){return this.length>0&&N.matches(this[0],t)},not:function(t){var n=[];if(F(t)&&t.call!==e)this.each(function(e){t.call(this,e)||n.push(this)});else{var i="string"==typeof t?this.filter(t):z(t)&&F(t.item)?u.call(t):r(t);this.forEach(function(t){i.indexOf(t)<0&&n.push(t)})}return r(n)},has:function(t){return this.filter(function(){return R(t)?r.contains(this,t):r(this).find(t).size()})},eq:function(t){return-1===t?this.slice(t):this.slice(t,+t+1)},first:function(){var t=this[0];return t&&!R(t)?t:r(t)},last:function(){var t=this[this.length-1];return t&&!R(t)?t:r(t)},find:function(t){var e,n=this;return e=t?"object"==typeof t?r(t).filter(function(){var t=this;return o.some.call(n,function(e){return r.contains(e,t)})}):1==this.length?r(N.qsa(this[0],t)):this.map(function(){return N.qsa(this,t)}):r()},closest:function(t,e){var n=[],i="object"==typeof t&&r(t);return this.each(function(r,o){for(;o&&!(i?i.indexOf(o)>=0:N.matches(o,t));)o=o!==e&&!M(o)&&o.parentNode;o&&n.indexOf(o)<0&&n.push(o)}),r(n)},parents:function(t){for(var e=[],n=this;n.length>0;)n=r.map(n,function(t){return(t=t.parentNode)&&!M(t)&&e.indexOf(t)<0?(e.push(t),t):void 0});return W(e,t)},parent:function(t){return W(P(this.pluck("parentNode")),t)},children:function(t){return W(this.map(function(){return U(this)}),t)},contents:function(){return this.map(function(){return this.contentDocument||u.call(this.childNodes)})},siblings:function(t){return W(this.map(function(t,e){return a.call(U(e.parentNode),function(t){return t!==e})}),t)},empty:function(){return this.each(function(){this.innerHTML=""})},pluck:function(t){return r.map(this,function(e){return e[t]})},show:function(){return this.each(function(){"none"==this.style.display&&(this.style.display=""),"none"==getComputedStyle(this,"").getPropertyValue("display")&&(this.style.display=B(this.nodeName))})},replaceWith:function(t){return this.before(t).remove()},wrap:function(t){var e=F(t);if(this[0]&&!e)var n=r(t).get(0),i=n.parentNode||this.length>1;return this.each(function(o){r(this).wrapAll(e?t.call(this,o):i?n.cloneNode(!0):n)})},wrapAll:function(t){if(this[0]){r(this[0]).before(t=r(t));for(var e;(e=t.children()).length;)t=e.first();r(t).append(this)}return this},wrapInner:function(t){var e=F(t);return this.each(function(n){var i=r(this),o=i.contents(),s=e?t.call(this,n):t;o.length?o.wrapAll(s):i.append(s)})},unwrap:function(){return this.parent().each(function(){r(this).replaceWith(r(this).children())}),this},clone:function(){return this.map(function(){return this.cloneNode(!0)})},hide:function(){return this.css("display","none")},toggle:function(t){return this.each(function(){var n=r(this);(t===e?"none"==n.css("display"):t)?n.show():n.hide()})},prev:function(t){return r(this.pluck("previousElementSibling")).filter(t||"*")},next:function(t){return r(this.pluck("nextElementSibling")).filter(t||"*")},html:function(t){return 0 in arguments?this.each(function(e){var n=this.innerHTML;r(this).empty().append(Y(this,t,e,n))}):0 in this?this[0].innerHTML:null},text:function(t){return 0 in arguments?this.each(function(e){var n=Y(this,t,e,this.textContent);this.textContent=null==n?"":""+n}):0 in this?this.pluck("textContent").join(""):null},attr:function(t,r){var i;return"string"!=typeof t||1 in arguments?this.each(function(e){if(1===this.nodeType)if(R(t))for(n in t)G(this,n,t[n]);else G(this,t,Y(this,r,e,this.getAttribute(t)))}):0 in this&&1==this[0].nodeType&&null!=(i=this[0].getAttribute(t))?i:e},removeAttr:function(t){return this.each(function(){1===this.nodeType&&t.split(" ").forEach(function(t){G(this,t)},this)})},prop:function(t,e){return t=D[t]||t,1 in arguments?this.each(function(n){this[t]=Y(this,e,n,this[t])}):this[0]&&this[0][t]},removeProp:function(t){return t=D[t]||t,this.each(function(){delete this[t]})},data:function(t,n){var r="data-"+t.replace(v,"-$1").toLowerCase(),i=1 in arguments?this.attr(r,n):this.attr(r);return null!==i?Q(i):e},val:function(t){return 0 in arguments?(null==t&&(t=""),this.each(function(e){this.value=Y(this,t,e,this.value)})):this[0]&&(this[0].multiple?r(this[0]).find("option").filter(function(){return this.selected}).pluck("value"):this[0].value)},offset:function(e){if(e)return this.each(function(t){var n=r(this),i=Y(this,e,t,n.offset()),o=n.offsetParent().offset(),s={top:i.top-o.top,left:i.left-o.left};"static"==n.css("position")&&(s.position="relative"),n.css(s)});if(!this.length)return null;if(f.documentElement!==this[0]&&!r.contains(f.documentElement,this[0]))return{top:0,left:0};var n=this[0].getBoundingClientRect();return{left:n.left+t.pageXOffset,top:n.top+t.pageYOffset,width:Math.round(n.width),height:Math.round(n.height)}},css:function(t,e){if(arguments.length<2){var i=this[0];if("string"==typeof t){if(!i)return;return i.style[O(t)]||getComputedStyle(i,"").getPropertyValue(t)}if(L(t)){if(!i)return;var o={},s=getComputedStyle(i,"");return r.each(t,function(t,e){o[e]=i.style[O(e)]||s.getPropertyValue(e)}),o}}var a="";if("string"==$(t))e||0===e?a=I(t)+":"+_(t,e):this.each(function(){this.style.removeProperty(I(t))});else for(n in t)t[n]||0===t[n]?a+=I(n)+":"+_(n,t[n])+";":this.each(function(){this.style.removeProperty(I(n))});return this.each(function(){this.style.cssText+=";"+a})},index:function(t){return t?this.indexOf(r(t)[0]):this.parent().children().indexOf(this[0])},hasClass:function(t){return t?o.some.call(this,function(t){return this.test(K(t))},V(t)):!1},addClass:function(t){return t?this.each(function(e){if("className"in this){i=[];var n=K(this),o=Y(this,t,e,n);o.split(/\s+/g).forEach(function(t){r(this).hasClass(t)||i.push(t)},this),i.length&&K(this,n+(n?" ":"")+i.join(" "))}}):this},removeClass:function(t){return this.each(function(n){if("className"in this){if(t===e)return K(this,"");i=K(this),Y(this,t,n,i).split(/\s+/g).forEach(function(t){i=i.replace(V(t)," ")}),K(this,i.trim())}})},toggleClass:function(t,n){return t?this.each(function(i){var o=r(this),s=Y(this,t,i,K(this));s.split(/\s+/g).forEach(function(t){(n===e?!o.hasClass(t):n)?o.addClass(t):o.removeClass(t)})}):this},scrollTop:function(t){if(this.length){var n="scrollTop"in this[0];return t===e?n?this[0].scrollTop:this[0].pageYOffset:this.each(n?function(){this.scrollTop=t}:function(){this.scrollTo(this.scrollX,t)})}},scrollLeft:function(t){if(this.length){var n="scrollLeft"in this[0];return t===e?n?this[0].scrollLeft:this[0].pageXOffset:this.each(n?function(){this.scrollLeft=t}:function(){this.scrollTo(t,this.scrollY)})}},position:function(){if(this.length){var t=this[0],e=this.offsetParent(),n=this.offset(),i=g.test(e[0].nodeName)?{top:0,left:0}:e.offset();return n.top-=parseFloat(r(t).css("margin-top"))||0,n.left-=parseFloat(r(t).css("margin-left"))||0,i.top+=parseFloat(r(e[0]).css("border-top-width"))||0,i.left+=parseFloat(r(e[0]).css("border-left-width"))||0,{top:n.top-i.top,left:n.left-i.left}}},offsetParent:function(){return this.map(function(){for(var t=this.offsetParent||f.body;t&&!g.test(t.nodeName)&&"static"==r(t).css("position");)t=t.offsetParent;return t})}},r.fn.detach=r.fn.remove,["width","height"].forEach(function(t){var n=t.replace(/./,function(t){return t[0].toUpperCase()});r.fn[t]=function(i){var o,s=this[0];return i===e?k(s)?s["inner"+n]:M(s)?s.documentElement["scroll"+n]:(o=this.offset())&&o[t]:this.each(function(e){s=r(this),s.css(t,Y(this,i,e,s[t]()))})}}),x.forEach(function(n,i){var o=i%2;r.fn[n]=function(){var n,a,s=r.map(arguments,function(t){var i=[];return n=$(t),"array"==n?(t.forEach(function(t){return t.nodeType!==e?i.push(t):r.zepto.isZ(t)?i=i.concat(t.get()):void(i=i.concat(N.fragment(t)))}),i):"object"==n||null==t?t:N.fragment(t)}),u=this.length>1;return s.length<1?this:this.each(function(e,n){a=o?n:n.parentNode,n=0==i?n.nextSibling:1==i?n.firstChild:2==i?n:null;var c=r.contains(f.documentElement,a);s.forEach(function(e){if(u)e=e.cloneNode(!0);else if(!a)return r(e).remove();a.insertBefore(e,n),c&&tt(e,function(e){if(!(null==e.nodeName||"SCRIPT"!==e.nodeName.toUpperCase()||e.type&&"text/javascript"!==e.type||e.src)){var n=e.ownerDocument?e.ownerDocument.defaultView:t;n.eval.call(n,e.innerHTML)}})})})},r.fn[o?n+"To":"insert"+(i?"Before":"After")]=function(t){return r(t)[n](this),this}}),N.Z.prototype=X.prototype=r.fn,N.uniq=P,N.deserializeValue=Q,r.zepto=N,r}();return t.Zepto=e,void 0===t.$&&(t.$=e),function(e){function h(t){return t._zid||(t._zid=n++)}function p(t,e,n,r){if(e=d(e),e.ns)var i=m(e.ns);return(a[h(t)]||[]).filter(function(t){return t&&(!e.e||t.e==e.e)&&(!e.ns||i.test(t.ns))&&(!n||h(t.fn)===h(n))&&(!r||t.sel==r)})}function d(t){var e=(""+t).split(".");return{e:e[0],ns:e.slice(1).sort().join(" ")}}function m(t){return new RegExp("(?:^| )"+t.replace(" "," .* ?")+"(?: |$)")}function g(t,e){return t.del&&!f&&t.e in c||!!e}function v(t){return l[t]||f&&c[t]||t}function y(t,n,i,o,s,u,f){var c=h(t),p=a[c]||(a[c]=[]);n.split(/\s/).forEach(function(n){if("ready"==n)return e(document).ready(i);var a=d(n);a.fn=i,a.sel=s,a.e in l&&(i=function(t){var n=t.relatedTarget;return!n||n!==this&&!e.contains(this,n)?a.fn.apply(this,arguments):void 0}),a.del=u;var c=u||i;a.proxy=function(e){if(e=T(e),!e.isImmediatePropagationStopped()){e.data=o;var n=c.apply(t,e._args==r?[e]:[e].concat(e._args));return n===!1&&(e.preventDefault(),e.stopPropagation()),n}},a.i=p.length,p.push(a),"addEventListener"in t&&t.addEventListener(v(a.e),a.proxy,g(a,f))})}function x(t,e,n,r,i){var o=h(t);(e||"").split(/\s/).forEach(function(e){p(t,e,n,r).forEach(function(e){delete a[o][e.i],"removeEventListener"in t&&t.removeEventListener(v(e.e),e.proxy,g(e,i))})})}function T(t,n){return(n||!t.isDefaultPrevented)&&(n||(n=t),e.each(w,function(e,r){var i=n[e];t[e]=function(){return this[r]=b,i&&i.apply(n,arguments)},t[r]=E}),t.timeStamp||(t.timeStamp=Date.now()),(n.defaultPrevented!==r?n.defaultPrevented:"returnValue"in n?n.returnValue===!1:n.getPreventDefault&&n.getPreventDefault())&&(t.isDefaultPrevented=b)),t}function S(t){var e,n={originalEvent:t};for(e in t)j.test(e)||t[e]===r||(n[e]=t[e]);return T(n,t)}var r,n=1,i=Array.prototype.slice,o=e.isFunction,s=function(t){return"string"==typeof t},a={},u={},f="onfocusin"in t,c={focus:"focusin",blur:"focusout"},l={mouseenter:"mouseover",mouseleave:"mouseout"};u.click=u.mousedown=u.mouseup=u.mousemove="MouseEvents",e.event={add:y,remove:x},e.proxy=function(t,n){var r=2 in arguments&&i.call(arguments,2);if(o(t)){var a=function(){return t.apply(n,r?r.concat(i.call(arguments)):arguments)};return a._zid=h(t),a}if(s(n))return r?(r.unshift(t[n],t),e.proxy.apply(null,r)):e.proxy(t[n],t);throw new TypeError("expected function")},e.fn.bind=function(t,e,n){return this.on(t,e,n)},e.fn.unbind=function(t,e){return this.off(t,e)},e.fn.one=function(t,e,n,r){return this.on(t,e,n,r,1)};var b=function(){return!0},E=function(){return!1},j=/^([A-Z]|returnValue$|layer[XY]$|webkitMovement[XY]$)/,w={preventDefault:"isDefaultPrevented",stopImmediatePropagation:"isImmediatePropagationStopped",stopPropagation:"isPropagationStopped"};e.fn.delegate=function(t,e,n){return this.on(e,t,n)},e.fn.undelegate=function(t,e,n){return this.off(e,t,n)},e.fn.live=function(t,n){return e(document.body).delegate(this.selector,t,n),this},e.fn.die=function(t,n){return e(document.body).undelegate(this.selector,t,n),this},e.fn.on=function(t,n,a,u,f){var c,l,h=this;return t&&!s(t)?(e.each(t,function(t,e){h.on(t,n,a,e,f)}),h):(s(n)||o(u)||u===!1||(u=a,a=n,n=r),(u===r||a===!1)&&(u=a,a=r),u===!1&&(u=E),h.each(function(r,o){f&&(c=function(t){return x(o,t.type,u),u.apply(this,arguments)}),n&&(l=function(t){var r,s=e(t.target).closest(n,o).get(0);return s&&s!==o?(r=e.extend(S(t),{currentTarget:s,liveFired:o}),(c||u).apply(s,[r].concat(i.call(arguments,1)))):void 0}),y(o,t,u,a,n,l||c)}))},e.fn.off=function(t,n,i){var a=this;return t&&!s(t)?(e.each(t,function(t,e){a.off(t,n,e)}),a):(s(n)||o(i)||i===!1||(i=n,n=r),i===!1&&(i=E),a.each(function(){x(this,t,i,n)}))},e.fn.trigger=function(t,n){return t=s(t)||e.isPlainObject(t)?e.Event(t):T(t),t._args=n,this.each(function(){t.type in c&&"function"==typeof this[t.type]?this[t.type]():"dispatchEvent"in this?this.dispatchEvent(t):e(this).triggerHandler(t,n)})},e.fn.triggerHandler=function(t,n){var r,i;return this.each(function(o,a){r=S(s(t)?e.Event(t):t),r._args=n,r.target=a,e.each(p(a,t.type||t),function(t,e){return i=e.proxy(r),r.isImmediatePropagationStopped()?!1:void 0})}),i},"focusin focusout focus blur load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error".split(" ").forEach(function(t){e.fn[t]=function(e){return 0 in arguments?this.bind(t,e):this.trigger(t)}}),e.Event=function(t,e){s(t)||(e=t,t=e.type);var n=document.createEvent(u[t]||"Events"),r=!0;if(e)for(var i in e)"bubbles"==i?r=!!e[i]:n[i]=e[i];return n.initEvent(t,r,!0),T(n)}}(e),function(e){function p(t,n,r){var i=e.Event(n);return e(t).trigger(i,r),!i.isDefaultPrevented()}function d(t,e,n,i){return t.global?p(e||r,n,i):void 0}function m(t){t.global&&0===e.active++&&d(t,null,"ajaxStart")}function g(t){t.global&&!--e.active&&d(t,null,"ajaxStop")}function v(t,e){var n=e.context;return e.beforeSend.call(n,t,e)===!1||d(e,n,"ajaxBeforeSend",[t,e])===!1?!1:void d(e,n,"ajaxSend",[t,e])}function y(t,e,n,r){var i=n.context,o="success";n.success.call(i,t,o,e),r&&r.resolveWith(i,[t,o,e]),d(n,i,"ajaxSuccess",[e,n,t]),b(o,e,n)}function x(t,e,n,r,i){var o=r.context;r.error.call(o,n,e,t),i&&i.rejectWith(o,[n,e,t]),d(r,o,"ajaxError",[n,r,t||e]),b(e,n,r)}function b(t,e,n){var r=n.context;n.complete.call(r,e,t),d(n,r,"ajaxComplete",[e,n]),g(n)}function E(t,e,n){if(n.dataFilter==j)return t;var r=n.context;return n.dataFilter.call(r,t,e)}function j(){}function w(t){return t&&(t=t.split(";",2)[0]),t&&(t==c?"html":t==f?"json":a.test(t)?"script":u.test(t)&&"xml")||"text"}function T(t,e){return""==e?t:(t+"&"+e).replace(/[&?]{1,2}/,"?")}function S(t){t.processData&&t.data&&"string"!=e.type(t.data)&&(t.data=e.param(t.data,t.traditional)),!t.data||t.type&&"GET"!=t.type.toUpperCase()&&"jsonp"!=t.dataType||(t.url=T(t.url,t.data),t.data=void 0)}function C(t,n,r,i){return e.isFunction(n)&&(i=r,r=n,n=void 0),e.isFunction(r)||(i=r,r=void 0),{url:t,data:n,success:r,dataType:i}}function O(t,n,r,i){var o,s=e.isArray(n),a=e.isPlainObject(n);e.each(n,function(n,u){o=e.type(u),i&&(n=r?i:i+"["+(a||"object"==o||"array"==o?n:"")+"]"),!i&&s?t.add(u.name,u.value):"array"==o||!r&&"object"==o?O(t,u,r,n):t.add(n,u)})}var i,o,n=+new Date,r=t.document,s=/)<[^<]*)*<\/script>/gi,a=/^(?:text|application)\/javascript/i,u=/^(?:text|application)\/xml/i,f="application/json",c="text/html",l=/^\s*$/,h=r.createElement("a");h.href=t.location.href,e.active=0,e.ajaxJSONP=function(i,o){if(!("type"in i))return e.ajax(i);var c,p,s=i.jsonpCallback,a=(e.isFunction(s)?s():s)||"Zepto"+n++,u=r.createElement("script"),f=t[a],l=function(t){e(u).triggerHandler("error",t||"abort")},h={abort:l};return o&&o.promise(h),e(u).on("load error",function(n,r){clearTimeout(p),e(u).off().remove(),"error"!=n.type&&c?y(c[0],h,i,o):x(null,r||"error",h,i,o),t[a]=f,c&&e.isFunction(f)&&f(c[0]),f=c=void 0}),v(h,i)===!1?(l("abort"),h):(t[a]=function(){c=arguments},u.src=i.url.replace(/\?(.+)=\?/,"?$1="+a),r.head.appendChild(u),i.timeout>0&&(p=setTimeout(function(){l("timeout")},i.timeout)),h)},e.ajaxSettings={type:"GET",beforeSend:j,success:j,error:j,complete:j,context:null,global:!0,xhr:function(){return new t.XMLHttpRequest},accepts:{script:"text/javascript, application/javascript, application/x-javascript",json:f,xml:"application/xml, text/xml",html:c,text:"text/plain"},crossDomain:!1,timeout:0,processData:!0,cache:!0,dataFilter:j},e.ajax=function(n){var u,f,s=e.extend({},n||{}),a=e.Deferred&&e.Deferred();for(i in e.ajaxSettings)void 0===s[i]&&(s[i]=e.ajaxSettings[i]);m(s),s.crossDomain||(u=r.createElement("a"),u.href=s.url,u.href=u.href,s.crossDomain=h.protocol+"//"+h.host!=u.protocol+"//"+u.host),s.url||(s.url=t.location.toString()),(f=s.url.indexOf("#"))>-1&&(s.url=s.url.slice(0,f)),S(s);var c=s.dataType,p=/\?.+=\?/.test(s.url);if(p&&(c="jsonp"),s.cache!==!1&&(n&&n.cache===!0||"script"!=c&&"jsonp"!=c)||(s.url=T(s.url,"_="+Date.now())),"jsonp"==c)return p||(s.url=T(s.url,s.jsonp?s.jsonp+"=?":s.jsonp===!1?"":"callback=?")),e.ajaxJSONP(s,a);var P,d=s.accepts[c],g={},b=function(t,e){g[t.toLowerCase()]=[t,e]},C=/^([\w-]+:)\/\//.test(s.url)?RegExp.$1:t.location.protocol,N=s.xhr(),O=N.setRequestHeader;if(a&&a.promise(N),s.crossDomain||b("X-Requested-With","XMLHttpRequest"),b("Accept",d||"*/*"),(d=s.mimeType||d)&&(d.indexOf(",")>-1&&(d=d.split(",",2)[0]),N.overrideMimeType&&N.overrideMimeType(d)),(s.contentType||s.contentType!==!1&&s.data&&"GET"!=s.type.toUpperCase())&&b("Content-Type",s.contentType||"application/x-www-form-urlencoded"),s.headers)for(o in s.headers)b(o,s.headers[o]);if(N.setRequestHeader=b,N.onreadystatechange=function(){if(4==N.readyState){N.onreadystatechange=j,clearTimeout(P);var t,n=!1;if(N.status>=200&&N.status<300||304==N.status||0==N.status&&"file:"==C){if(c=c||w(s.mimeType||N.getResponseHeader("content-type")),"arraybuffer"==N.responseType||"blob"==N.responseType)t=N.response;else{t=N.responseText;try{t=E(t,c,s),"script"==c?(1,eval)(t):"xml"==c?t=N.responseXML:"json"==c&&(t=l.test(t)?null:e.parseJSON(t))}catch(r){n=r}if(n)return x(n,"parsererror",N,s,a)}y(t,N,s,a)}else x(N.statusText||null,N.status?"error":"abort",N,s,a)}},v(N,s)===!1)return N.abort(),x(null,"abort",N,s,a),N;var A="async"in s?s.async:!0;if(N.open(s.type,s.url,A,s.username,s.password),s.xhrFields)for(o in s.xhrFields)N[o]=s.xhrFields[o];for(o in g)O.apply(N,g[o]);return s.timeout>0&&(P=setTimeout(function(){N.onreadystatechange=j,N.abort(),x(null,"timeout",N,s,a)},s.timeout)),N.send(s.data?s.data:null),N},e.get=function(){return e.ajax(C.apply(null,arguments))},e.post=function(){var t=C.apply(null,arguments);return t.type="POST",e.ajax(t)},e.getJSON=function(){var t=C.apply(null,arguments);return t.dataType="json",e.ajax(t)},e.fn.load=function(t,n,r){if(!this.length)return this;var a,i=this,o=t.split(/\s/),u=C(t,n,r),f=u.success;return o.length>1&&(u.url=o[0],a=o[1]),u.success=function(t){i.html(a?e("
").html(t.replace(s,"")).find(a):t),f&&f.apply(i,arguments)},e.ajax(u),this};var N=encodeURIComponent;e.param=function(t,n){var r=[];return r.add=function(t,n){e.isFunction(n)&&(n=n()),null==n&&(n=""),this.push(N(t)+"="+N(n))},O(r,t,n),r.join("&").replace(/%20/g,"+")}}(e),function(t){t.fn.serializeArray=function(){var e,n,r=[],i=function(t){return t.forEach?t.forEach(i):void r.push({name:e,value:t})};return this[0]&&t.each(this[0].elements,function(r,o){n=o.type,e=o.name,e&&"fieldset"!=o.nodeName.toLowerCase()&&!o.disabled&&"submit"!=n&&"reset"!=n&&"button"!=n&&"file"!=n&&("radio"!=n&&"checkbox"!=n||o.checked)&&i(t(o).val())}),r},t.fn.serialize=function(){var t=[];return this.serializeArray().forEach(function(e){t.push(encodeURIComponent(e.name)+"="+encodeURIComponent(e.value))}),t.join("&")},t.fn.submit=function(e){if(0 in arguments)this.bind("submit",e);else if(this.length){var n=t.Event("submit");this.eq(0).trigger(n),n.isDefaultPrevented()||this.get(0).submit()}return this}}(e),function(){try{getComputedStyle(void 0)}catch(e){var n=getComputedStyle;t.getComputedStyle=function(t,e){try{return n(t,e)}catch(r){return null}}}}(),e}); -)=====";