· 10 years ago · Mar 26, 2016, 11:27 AM
1// ==UserScript==
2// @name Eternalfest
3// @namespace http://eternalfest.net
4// @description This userscript enables access to Eternalfest
5// @version 2.0.0
6// @include http://www.hfest.net/*
7// @include http://www.hammerfest.fr/*
8// @grant GM_xmlhttpRequest
9// @run-at document-end
10// ==/UserScript==
11
12var uScripter = function(){};
13
14uScripter._CSS = {};
15uScripter._IMG = {};
16uScripter._HTML = {};
17
18uScripter.setImage = function(path, url){
19 uScripter._IMG[path] = url;
20}
21
22uScripter.getImage = function(path){
23 if (!(path in uScripter._IMG)) {
24 throw new Error('Image not found: '+path);
25 }
26 return uScripter._IMG[path];
27}
28
29uScripter.setStyle = function(path, css){
30 uScripter._CSS[path] = css;
31}
32
33uScripter.getStyle = function(path){
34 if (!(path in uScripter._CSS)) {
35 throw new Error('CSS not found: '+path);
36 }
37 return uScripter._CSS[path];
38}
39
40uScripter.setHtml = function(path, html){
41 uScripter._HTML[path] = html;
42}
43
44uScripter.getHtml = function(path){
45 if (!(path in uScripter._HTML)) {
46 throw new Error('HTML not found: '+path);
47 }
48 return uScripter._HTML[path];
49}
50
51
52uScripter.setImage("img/icon_efest.png", "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFMAAABTCAIAAABs0KxXAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAADReSURBVHhezZsHeBzltfed0AIEDCSQ0DEmuSQ3JDbggrHBgAsQ4yb3ot57773Larur3mVZVpdlWb1sUddqpVXvvaz6arW9TfnO7MqykR1y8+Vy753n/wwjsZLm9/7POe85s+tt+nmc/xYZ3ppVXxgnzcZ93hr7eWv8odaeWWn/ouz/pv5dctP4GSeX4cBL7RHfNQZe6gi4wiYdaYg+SIs+SI3+nJ52peOWbtct/e5Cj7GqlMW6Ym5LPb+9W9Q9Lulb+F9elP8v8tw5c8qMs+1Q0DkW5TADOCn7qZGfgGpJe2ojPqZGfMKI3FNP2k+jHKBSPq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hTzietuZ+0Zn/SlFeIyxhIB30Y4nbdn5/R1qSGMg71DBIbIhy69zrmjH0l5BDnf5N8nWVOGhwBnGBwALoB8JdJabCM1OBBWJNgqVVWKOOf/d95p9pXQr7vuop3ri3fe23Zlzzv/6ZlvAYFHKRmSVe4Omcmq88o9Zp9JeQfXd/4wda697bUZCYNUCOj3j/cEadKPS5czEgNY/kXSL1mXwl51ra+Izd1H76xA0SAhWHPtChT3mG0htz+RzliTWpYh3x5qdfsKyEvvm2q8NaJgltGoYtCdYXTmhTrR/naNUfA6a45AnthgP13OQLemamO8GkgNcykMI1/SanX7CshL9/JKd8xW7ZjBs4GdBCt+CEIYZG05ogJ0dIoT3NqREDErkXEFzgCngRPQRLBX8EnsOUm+Ni/S+o1+0rIK3bOZQy+AE4IDNSA7gLFNuMI6LEQnOscMTinAEd0s4TrHJExOIbYhuchXuCdmfkEPgqc+/cyZ+wrJ19nq16wxc7oiBmFGfowBPCaI2AgAXlhDzUMBrIRrhoSByrZ2nyy7vO/vP1Pk6+zzzoCMjbjCMhecMS0zAhBAXsIbACG4QRexeH9OfPJl7f/z+Tr7AwRYQxAUOC9MQBLa4jt/0JKn9H+d5GvMyA81da9+t8yZ/L/AW5/r8WUwlngAAAAAElFTkSuQmCC");
54uScripter.setImage("img/logo_efest-100.png", "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsIAAA7CARUoSoAAACQvSURBVHhe7ZwJlFxneaa/6q26q1dJvakla7MkS7KxEUjGC8YCr4k9LDGDA8xikslMJkMyJ3FCGDxAciYTMMHjc3B8YBg4Z8g4c4CAd1mOF7wmtmV5kS0h22i11lZLvVdXdVV317zPf+tvlUpV3bW14wm80u1bdevef/neb/uXqtDll1+esiwcPXrUUqmUhUKh9JXKYmpqylpbW625udnVUy6qq6tt3759Vltbm75SOiYnJ23evHnW1NRUkbblAzI4duyYe50p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JXY4RnCZQTYJMM+ZWJaoEeoKzN07dvHzdAXGLgqDJCERsKtDCarDONHr169/CN2xLDRAgmUSL5MdAJYwQhvLaVO5eOXbx1WDI8UCChBSc/AiCJpAQE1bdy0MV1I/fuTIILGjJUcEMo+SRKsy7VIYNWrBm1bOTQyasVwsMHECBekKFdClYsWdq8ectGrViwZeow4wIIJljwAh1tgNaLJKYYwkceh9hCjDLPYAPPNTeEgEITqiwywWL/PBLKLZWoQMMcgsjhxBSNnOKDEVqI4kgJCOT1jy9pXLRGARiMkAIJQcShRhc79KFIDgGMNZArVvhxURIzERBBAVco4kcOAMgA1UCjIFElRmAqcoUIAcjwk0GuPAHDD1/4UYgfXxBBpgNPbGnQL5gc0QECAgQgAAIdHIHJRxMRpIsnkAQCiScSHRQQADs=");
57uScripter.setImage("img/smarrow.gif", "data:image/gif;base64,R0lGODlhCwANAKUsAFap+E6l+Gmz+VKn+GWx+WKv+ZDG+nu8+V6t+ZHH+oC/+oK/+r7e/Uuj91qr+Lvc/F+u+YzF+2qz+abS/Fmq+Emj91iq+Emi97jb/FWo+GOw+YXB+lys+aLQ+2iy+Wy0+Wq0+WOv+bPY/IbC+pzN+1Oo+Lba/Hy9+sPh/Uyk9zRy942Tuf///////////////////////////////////////////////////////////////////////////////yH5BAEKAD8ALAAAAAALAA0AAAZNwJ9QpRIajypG8WhUTTDLIVFFGpmiKpS2QziIlqrESUIoQBaPosrgaKQCJc0mQlRQKpfUACBQgwQIAykZAGBTHhwBUU0hH4tNFo9NkkEAOw==");
58
59uScripter.setStyle("css/main.css", "button.reset{\r\n\tbackground: none;\r\n\tborder: 0;\r\n\tcolor: inherit;\r\n\tcursor: default;\r\n\tfont: inherit;\r\n\tline-height: inherit;\r\n\toverflow: visible;\r\n\tpadding: 0;\r\n\t-webkit-appearance: button;\r\n\t/* for button */\r\n\t-moz-user-select: none;\r\n\t-ms-user-select: none;\r\n}\r\n\r\nbutton.reset::-moz-focus-inner {\r\n border: 0;\r\n padding: 0;\r\n}\r\n\r\n.icons {\r\n\ttop: 230px;\r\n}\r\n\r\n.siteMinHeight {\r\n\tmin-height: 463px;\r\n}\r\n\r\n.iconEfest img {\r\n background-image: url('"+uScripter.getImage("img/icon_efest.png")+"');\r\n background-repeat: no-repeat;\r\n background-position: 2px 0;\r\n width: 92px;\r\n\theight: 83px;\r\n}\r\n\r\n.iconEfest a:hover img {\r\n background-image: url('"+uScripter.getImage("img/icon_efest_on.png")+"');\r\n}\r\n\r\n.news .image.logo-efest {\r\n\twidth: 100px;\r\n\theight: 100px;\r\n\tbackground-image: url('"+uScripter.getImage("img/logo_efest-100.png")+"');\r\n}\r\n\r\n.efest ._template{\r\n\tdisplay: none;\r\n}\r\n\r\n.efest .menuContLeft{\r\n\ttext-align: left;\r\n}\r\n\r\n.efest .menuContLeft h2{\r\n\tmargin-bottom: 5px;\r\n}\r\n\r\n.efest .menuContLeft li{\r\n\ttext-align: left;\r\n\tpadding-left: 10px;\r\n\tpadding-top: 5px;\r\n}\r\n\r\n.efest .menuContLeft button{\r\n\tcolor: #EDF1FC;\r\n\tcursor: pointer;\r\n}\r\n\r\n.menuContLeft ul{\r\n\tmargin-bottom: 15px;\r\n}\r\n\r\n.efest .menuContLeft li button{\r\n\ttext-decoration: underline;\r\n}\r\n\r\n.efest .menuContLeft button:hover{\r\n\tcolor: #FFF;\r\n}\r\n\r\n.efest .menuContLeft a{\r\n\tmargin-left: 6px;\r\n\tcolor: #EDF1FC;\r\n}\r\n\r\n.efest .menuContLeft a:hover{\r\n\tcolor: white;\r\n}\r\n\r\n.efest .menuContLeft a::before{\r\n\tcontent: '';\r\n\tdisplay: inline-block;\r\n\twidth: 11px;\r\n\theight: 13px;\r\n\tbackground-image: url('"+uScripter.getImage("img/smarrow.gif")+"');\r\n\tbackground-repeat: no-repeat;\r\n\tmargin-right: 3px;\r\n\tvertical-align: sub;\r\n}\r\n\r\n\r\n.efest .gameslist{\r\n\tmargin: 0;\r\n\tpadding: 0;\r\n}\r\n\r\n.efest .gameslist li{\r\n\tlist-style: none;\r\n}\r\n\r\n.efest .gameslist .game{\r\n\twidth:200px;\r\n\theight:170px;\r\n\tmargin:17px 0 0 17px;\r\n\tfloat:left;\r\n\tcursor:pointer;\r\n\tbackground:#b497d9;\r\n\toverflow:hidden;\r\n\tposition: relative;\r\n\ttext-align: left;\r\n}\r\n\r\n.efest .gameslist .game>div {\r\n\tposition: absolute;\r\n\ttop: 0;\r\n\tleft: 0;\r\n\twidth: 100%;\r\n\theight: 100%;\r\n\tline-height: inherit;\r\n\tfont-size: inherit;\r\n}\r\n\r\n.efest .gameslist .game h1 {\r\n\tmargin:3px;\r\n\tfont-size:13px;\r\n\ttext-align:left;\r\n}\r\n\r\n.efest .gameslist .game img {\r\n\twidth:64px;\r\n\tmargin:3px;\r\n\tfloat:left;\r\n}\r\n\r\n.efest .gameslist .game p {\r\n\tpadding:4px;\r\n}\r\n\r\n.efest .menuInfo {\r\n\tdisplay: block;\r\n}\r\n\r\n.efest .menuInfo .gmodes {\r\n\tbackground-color: #AAAFCD;\r\n\twidth: 225px;\r\n\tmargin: 5px 0px 0px 10px;\r\n\tpadding-left: 5px;\r\n}\r\n\r\n.efest .menuInfo .mopt>span, .efest .menuInfo .gmodes>span {\r\n\ttext-transform: uppercase;\r\n\tfont-size: 7pt;\r\n\tfont-weight: bold;\r\n}\r\n\r\n.efest .menuInfo .mopt label span {\r\n\ttext-transform: inherit;\r\n\tfont-size: inherit;\r\n\tfont-weight: inherit;\r\n}\r\n\r\n.efest .menuInfo .mopt input, .efest .menuInfo .gmodes input {\r\n\twidth: 15px;\r\n\tborder: 0px none;\r\n\tvertical-align: -15%;\r\n}\r\n\r\n.efest .menuInfo .button {\r\n\tmargin: auto;\r\n\tdisplay: block;\r\n\twidth: 100px;\r\n\tpadding: 2px 3px;\r\n\tfont-weight: bold;\r\n\tfont-size: 10.5pt;\r\n\ttext-decoration: none;\r\n\ttext-align: center;\r\n\tcolor: #FFF;\r\n\tbackground-color: #B89BDE;\r\n\tborder-width: 1px;\r\n\tborder-style: solid;\r\n\tborder-color: #A389C5 #8263A5 #8263A5 #A389C5;\r\n\t\r\n\tmargin-top: 5px;\r\n}\r\n\r\n.efest .menuInfo .button:hover {\r\n\tbackground-color: #AD8FCF;\r\n\tborder-width: 1px;\r\n\tborder-style: solid;\r\n\tborder-color: #8263A5 #A389C5 #A389C5 #8263A5;\r\n\tcursor: pointer;\r\n}\r\n\r\n.efest .menuInfo p.error {\r\n\tcolor: rgb(127, 0, 0);\r\n}");
60
61uScripter.setHtml("html/bottom_menu.html", "<div class=\"bottomMenuContent\">\r\n\t<a href=\"http://www.motion-twin.com\" target=\"_blank\"><img src=\"/img/design/motiontwin.gif\" alt=\"Motion Twin\" class=\"firefox\"/></a> ~\r\n\t<a href=\"/guide.html\">guide du jeu</a> ~\r\n\t<a href=\"http://www.motion-twin.com/cgu.php?s=hfest\" target=\"_blank\">règlement</a> ~\r\n\t<a href=\"http://support.motion-twin.com/user/login?site=hfest;sid=3e36ee43f695b5839448004b723bc928\" target=\"_blank\">FAQ et contact</a> ~\r\n\t<a href=\"http://www.getfirefox.com/\" target=\"_blank\"><img src=\"/img/design/icon_firefox.png\" class=\"firefox\" alt=\"Firefox\" title=\"Igor aime Firefox\"/></a>\r\n</div>\r\n");
62uScripter.setHtml("html/efest/game.html", "<div class=\"game\">\r\n\t<div class=\"topBar\"></div>\r\n\t<embed type=\"application/x-shockwave-flash\" ></embed>\r\n\t<div class=\"bottomBar\"></div>\r\n</div>\r\n");
63uScripter.setHtml("html/efest/main.html", "<div class=\"menu\">\r\n\t<div class=\"menuTop\"></div>\r\n\t<div class=\"menuMiddle\">\r\n\t\t<div class=\"_main_menu\"></div>\r\n\t\t<div class=\"_main_rightpane\"></div>\r\n\t\t<div class=\"clear\"></div>\r\n\t</div>\r\n\t<div class=\"menuBottom\"></div>\r\n\t\r\n\t<div class=\"menubTop\"></div>\r\n\t<div class=\"menubMiddle\">\r\n\t\t<div class=\"_main_gameslist\"></div>\r\n\t</div>\r\n\t<div class=\"menubBottom\"></div>\r\n\t\r\n\t<div class=\"clear\"></div>\r\n</div>\r\n");
64uScripter.setHtml("html/efest/main_gamedetails.html", "<div class=\"menuInfo\">\r\n\t<h2>{{title}}</h2>\r\n\t<p class=\"description\">{{description}}</p>\r\n\t<p class=\"error\">{{error}}</p>\r\n\t<form action=\"/play.html/eternalfest/play\" method=\"get\">\r\n\t\t<div class=\"gmodes\">\r\n\t\t\t<span>Mode de jeu :</span>\r\n\t\t\t<ul class=\"moptl\">\r\n\t\t\t\t<li class=\"_template\">\r\n\t\t\t\t\t<label><input name=\"gamemode\" value=\"\" type=\"radio\"> <span>{{label}}</span></label>\r\n\t\t\t\t</li>\r\n\t\t\t</ul>\r\n\t\t</div>\r\n\t\t<div class=\"mopt\">\r\n\t\t\t<span>OPTIONS SUPPLEMENTAIRES :</span>\r\n\t\t\t<ul class=\"moptl\">\r\n\t\t\t\t<li class=\"_template\">\r\n\t\t\t\t\t<label><input value=\"\" type=\"checkbox\"> <span>{{label}}</span></label>\r\n\t\t\t\t</li>\r\n\t\t\t</ul>\r\n\t\t</div>\r\n\t\t<input type=\"hidden\" name=\"gid\" value=\"\" />\r\n\t\t<input type=\"hidden\" name=\"options\" value=\"\" />\r\n\t\t<button class=\"reset button\" type=\"submit\">Commencer</button>\r\n\t</form>\r\n\t<img src=\"/img/design/menu/adventure1.gif\" class=\"scra\" alt=\"\">\r\n\t<img src=\"/img/design/menu/adventure2.gif\" class=\"scrb\" alt=\"\">\r\n\t<p>\r\n\t\t<img src=\"/img/design/menu/smarrow.gif\" alt=\"\"> Ce mode est <strong>gratuit et illimité</strong>\r\n\t</p>\r\n</div>\r\n");
65uScripter.setHtml("html/efest/main_gameslist.html", "<ul class=\"gameslist\">\r\n\t<li class=\"_template\">\r\n\t\t<button class=\"game reset\">\r\n\t\t\t<div>\r\n\t\t\t\t<h1><span>{{title}}</span></h1>\r\n\t\t\t\t<!--<div class=\"clear\"></div>-->\r\n\t\t\t\t<img class=\"icon\"/>\r\n\t\t\t\t<p class=\"description\">{{description}}</p>\r\n\t\t\t\t<!--<div class=\"clear\"></div>-->\r\n\t\t\t</div>\r\n\t\t</button>\r\n\t</li>\r\n</ul>\r\n<div class=\"clear\"></div>\r\n");
66uScripter.setHtml("html/efest/main_menu.html", "<div class=\"menuContLeft\">\r\n\t<h2><button class=\"all reset\">{{all}}</button></h2>\r\n\t<ul>\r\n\t\t<li class=\"_template\">\r\n\t\t\t<button class=\"reset\">\r\n\t\t\t\t<span>{{title}}</span>\r\n\t\t\t</button>\r\n\t\t</li>\r\n\t</ul>\r\n\t<a>Visiter Eternalfest</a>\r\n</div>");
67uScripter.setHtml("html/efest/main_news.html", "<div class=\"menuInfo\" >\r\n\t<div class=\"news\">\r\n\t\t<h2>Bienvenue sur Eternalfest</h2>\r\n\t\t<h3>Le 8 septembre 2015</h3>\r\n\t\t<div class=\"image logo-efest\"><img src=\"/img/design/pixel.gif\" alt=\"\"></div>\r\n\t\t<p>Cher Hammerfestien(ne),</p>\r\n\t\t<p>Vous êtes en possession du script d'Eternalfest !</p>\r\n\t\t<p>Faites attention, vous pouvez désormais jouer à Eternal à vos risques et périls.</p>\r\n\t\t<p>Le nouveau serveur venant juste de passer en ligne il est normal qu'il y ait quelques bugs mais ils devraient être corrigés assez rapidement. Notament, la liste des jeux peut prendre une dizaine de secondes à charger. Merci de signaler tout bug que vous rencontreriez.</p>\r\n\t\t<p>Perdu.</p>\r\n\t</div>\r\n\t<div class=\"clear\"></div>\r\n\t<div class=\"borderarrow\"></div>\r\n\t<div class=\"arrow\">Choisissez un jeu</div>\r\n</div>");
68uScripter.setHtml("html/icon_efest.html", "<div class=\"iconEfest\">\r\n\t<a href=\"/play.html/eternalfest\">\r\n\t\t<img title=\"Eternalfest\" alt=\"Eternalfest\" src=\"/img/design/pixel.gif\">\r\n\t</a>\r\n</div>\r\n");
69uScripter.setHtml("html/icons.html", "<div class=\"iconPlay\">\r\n\t<a href=\"/play.html\"><img src=\"/img/design/pixel.gif\" alt=\"Jouer\" title=\"Jouer\"></a>\r\n</div>\r\n<div class=\"iconInventory\">\r\n\t<a href=\"/user.html/inventory\"><img src=\"/img/design/pixel.gif\" alt=\"Réfrigérateur\" title=\"Réfrigérateur\"></a>\r\n</div>\r\n<div class=\"iconQuests\">\r\n\t<a href=\"/user.html/quests\"><img src=\"/img/design/pixel.gif\" alt=\"Quêtes\" title=\"Quêtes\"></a>\r\n</div>\r\n<div class=\"iconScore\">\r\n\t<a href=\"/scores.html\"><img src=\"/img/design/pixel.gif\" alt=\"Score\" title=\"Classement\"></a>\r\n</div>\r\n<div class=\"iconAccount\">\r\n\t<a href=\"/user.html\"><img src=\"/img/design/pixel.gif\" alt=\"Mon compte\" title=\"Mon compte\"></a>\r\n</div>\r\n<div class=\"iconShop\">\r\n\t<a href=\"/shop.html\"><img src=\"/img/design/pixel.gif\" alt=\"Plus de Parties\" title=\"Plus de Parties\"></a>\r\n</div>\r\n<div class=\"iconSponsor\">\r\n\t<a href=\"/user.html/godChildren\"><img src=\"/img/design/pixel.gif\" alt=\"Parrainage\" title=\"Parrainage\"></a>\r\n</div>\r\n<div class=\"iconLogout\">\r\n\t<a href=\"/login.html/logout\" onclick=\"return confirm('Quitter le site ?');\"><img src=\"/img/design/pixel.gif\" alt=\"Déconnecter\" title=\"Déconnecter\"></a>\r\n</div>\r\n<div class=\"buttonForum\">\r\n\t<a href=\"/forum.html\"><img src=\"/img/design/pixel.gif\" alt=\"Forum\" title=\"\"></a>\r\n</div>\r\n");
70uScripter.setHtml("html/player_info.html", "<a href=\"/user.html/1041317\">Eternalfest</a> <span>~</span>\r\n<a href=\"/shop.html\" title=\"Plus de Parties\">∞</a>\r\n<div class=\"iconSnowFlake\">\r\n\t<a href=\"/shop.html\" title=\"Plus de Parties\">\r\n\t\t<img src=\"/img/design/snow_flake.gif\" alt=\"Flocons\">\r\n\t</a>\r\n</div>\r\n");
71
72/*!
73 * jQuery JavaScript Library v2.1.4
74 * http://jquery.com/
75 *
76 * Includes Sizzle.js
77 * http://sizzlejs.com/
78 *
79 * Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors
80 * Released under the MIT license
81 * http://jquery.org/license
82 *
83 * Date: 2015-04-28T16:01Z
84 */
85
86(function( global, factory ) {
87
88 if ( typeof module === "object" && typeof module.exports === "object" ) {
89 // For CommonJS and CommonJS-like environments where a proper `window`
90 // is present, execute the factory and get jQuery.
91 // For environments that do not have a `window` with a `document`
92 // (such as Node.js), expose a factory as module.exports.
93 // This accentuates the need for the creation of a real `window`.
94 // e.g. var jQuery = require("jquery")(window);
95 // See ticket #14549 for more info.
96 module.exports = global.document ?
97 factory( global, true ) :
98 function( w ) {
99 if ( !w.document ) {
100 throw new Error( "jQuery requires a window with a document" );
101 }
102 return factory( w );
103 };
104 } else {
105 factory( global );
106 }
107
108// Pass this if window is not defined yet
109}(typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
110
111// Support: Firefox 18+
112// Can't be in strict mode, several libs including ASP.NET trace
113// the stack via arguments.caller.callee and Firefox dies if
114// you try to trace through "use strict" call chains. (#13335)
115//
116
117var arr = [];
118
119var slice = arr.slice;
120
121var concat = arr.concat;
122
123var push = arr.push;
124
125var indexOf = arr.indexOf;
126
127var class2type = {};
128
129var toString = class2type.toString;
130
131var hasOwn = class2type.hasOwnProperty;
132
133var support = {};
134
135
136
137var
138 // Use the correct document accordingly with window argument (sandbox)
139 document = window.document,
140
141 version = "2.1.4",
142
143 // Define a local copy of jQuery
144 jQuery = function( selector, context ) {
145 // The jQuery object is actually just the init constructor 'enhanced'
146 // Need init if jQuery is called (just allow error to be thrown if not included)
147 return new jQuery.fn.init( selector, context );
148 },
149
150 // Support: Android<4.1
151 // Make sure we trim BOM and NBSP
152 rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
153
154 // Matches dashed string for camelizing
155 rmsPrefix = /^-ms-/,
156 rdashAlpha = /-([\da-z])/gi,
157
158 // Used by jQuery.camelCase as callback to replace()
159 fcamelCase = function( all, letter ) {
160 return letter.toUpperCase();
161 };
162
163jQuery.fn = jQuery.prototype = {
164 // The current version of jQuery being used
165 jquery: version,
166
167 constructor: jQuery,
168
169 // Start with an empty selector
170 selector: "",
171
172 // The default length of a jQuery object is 0
173 length: 0,
174
175 toArray: function() {
176 return slice.call( this );
177 },
178
179 // Get the Nth element in the matched element set OR
180 // Get the whole matched element set as a clean array
181 get: function( num ) {
182 return num != null ?
183
184 // Return just the one element from the set
185 ( num < 0 ? this[ num + this.length ] : this[ num ] ) :
186
187 // Return all the elements in a clean array
188 slice.call( this );
189 },
190
191 // Take an array of elements and push it onto the stack
192 // (returning the new matched element set)
193 pushStack: function( elems ) {
194
195 // Build a new jQuery matched element set
196 var ret = jQuery.merge( this.constructor(), elems );
197
198 // Add the old object onto the stack (as a reference)
199 ret.prevObject = this;
200 ret.context = this.context;
201
202 // Return the newly-formed element set
203 return ret;
204 },
205
206 // Execute a callback for every element in the matched set.
207 // (You can seed the arguments with an array of args, but this is
208 // only used internally.)
209 each: function( callback, args ) {
210 return jQuery.each( this, callback, args );
211 },
212
213 map: function( callback ) {
214 return this.pushStack( jQuery.map(this, function( elem, i ) {
215 return callback.call( elem, i, elem );
216 }));
217 },
218
219 slice: function() {
220 return this.pushStack( slice.apply( this, arguments ) );
221 },
222
223 first: function() {
224 return this.eq( 0 );
225 },
226
227 last: function() {
228 return this.eq( -1 );
229 },
230
231 eq: function( i ) {
232 var len = this.length,
233 j = +i + ( i < 0 ? len : 0 );
234 return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );
235 },
236
237 end: function() {
238 return this.prevObject || this.constructor(null);
239 },
240
241 // For internal use only.
242 // Behaves like an Array's method, not like a jQuery method.
243 push: push,
244 sort: arr.sort,
245 splice: arr.splice
246};
247
248jQuery.extend = jQuery.fn.extend = function() {
249 var options, name, src, copy, copyIsArray, clone,
250 target = arguments[0] || {},
251 i = 1,
252 length = arguments.length,
253 deep = false;
254
255 // Handle a deep copy situation
256 if ( typeof target === "boolean" ) {
257 deep = target;
258
259 // Skip the boolean and the target
260 target = arguments[ i ] || {};
261 i++;
262 }
263
264 // Handle case when target is a string or something (possible in deep copy)
265 if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
266 target = {};
267 }
268
269 // Extend jQuery itself if only one argument is passed
270 if ( i === length ) {
271 target = this;
272 i--;
273 }
274
275 for ( ; i < length; i++ ) {
276 // Only deal with non-null/undefined values
277 if ( (options = arguments[ i ]) != null ) {
278 // Extend the base object
279 for ( name in options ) {
280 src = target[ name ];
281 copy = options[ name ];
282
283 // Prevent never-ending loop
284 if ( target === copy ) {
285 continue;
286 }
287
288 // Recurse if we're merging plain objects or arrays
289 if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
290 if ( copyIsArray ) {
291 copyIsArray = false;
292 clone = src && jQuery.isArray(src) ? src : [];
293
294 } else {
295 clone = src && jQuery.isPlainObject(src) ? src : {};
296 }
297
298 // Never move original objects, clone them
299 target[ name ] = jQuery.extend( deep, clone, copy );
300
301 // Don't bring in undefined values
302 } else if ( copy !== undefined ) {
303 target[ name ] = copy;
304 }
305 }
306 }
307 }
308
309 // Return the modified object
310 return target;
311};
312
313jQuery.extend({
314 // Unique for each copy of jQuery on the page
315 expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
316
317 // Assume jQuery is ready without the ready module
318 isReady: true,
319
320 error: function( msg ) {
321 throw new Error( msg );
322 },
323
324 noop: function() {},
325
326 isFunction: function( obj ) {
327 return jQuery.type(obj) === "function";
328 },
329
330 isArray: Array.isArray,
331
332 isWindow: function( obj ) {
333 return obj != null && obj === obj.window;
334 },
335
336 isNumeric: function( obj ) {
337 // parseFloat NaNs numeric-cast false positives (null|true|false|"")
338 // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
339 // subtraction forces infinities to NaN
340 // adding 1 corrects loss of precision from parseFloat (#15100)
341 return !jQuery.isArray( obj ) && (obj - parseFloat( obj ) + 1) >= 0;
342 },
343
344 isPlainObject: function( obj ) {
345 // Not plain objects:
346 // - Any object or value whose internal [[Class]] property is not "[object Object]"
347 // - DOM nodes
348 // - window
349 if ( jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
350 return false;
351 }
352
353 if ( obj.constructor &&
354 !hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) {
355 return false;
356 }
357
358 // If the function hasn't returned already, we're confident that
359 // |obj| is a plain object, created by {} or constructed with new Object
360 return true;
361 },
362
363 isEmptyObject: function( obj ) {
364 var name;
365 for ( name in obj ) {
366 return false;
367 }
368 return true;
369 },
370
371 type: function( obj ) {
372 if ( obj == null ) {
373 return obj + "";
374 }
375 // Support: Android<4.0, iOS<6 (functionish RegExp)
376 return typeof obj === "object" || typeof obj === "function" ?
377 class2type[ toString.call(obj) ] || "object" :
378 typeof obj;
379 },
380
381 // Evaluates a script in a global context
382 globalEval: function( code ) {
383 var script,
384 indirect = eval;
385
386 code = jQuery.trim( code );
387
388 if ( code ) {
389 // If the code includes a valid, prologue position
390 // strict mode pragma, execute code by injecting a
391 // script tag into the document.
392 if ( code.indexOf("use strict") === 1 ) {
393 script = document.createElement("script");
394 script.text = code;
395 document.head.appendChild( script ).parentNode.removeChild( script );
396 } else {
397 // Otherwise, avoid the DOM node creation, insertion
398 // and removal by using an indirect global eval
399 indirect( code );
400 }
401 }
402 },
403
404 // Convert dashed to camelCase; used by the css and data modules
405 // Support: IE9-11+
406 // Microsoft forgot to hump their vendor prefix (#9572)
407 camelCase: function( string ) {
408 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
409 },
410
411 nodeName: function( elem, name ) {
412 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
413 },
414
415 // args is for internal usage only
416 each: function( obj, callback, args ) {
417 var value,
418 i = 0,
419 length = obj.length,
420 isArray = isArraylike( obj );
421
422 if ( args ) {
423 if ( isArray ) {
424 for ( ; i < length; i++ ) {
425 value = callback.apply( obj[ i ], args );
426
427 if ( value === false ) {
428 break;
429 }
430 }
431 } else {
432 for ( i in obj ) {
433 value = callback.apply( obj[ i ], args );
434
435 if ( value === false ) {
436 break;
437 }
438 }
439 }
440
441 // A special, fast, case for the most common use of each
442 } else {
443 if ( isArray ) {
444 for ( ; i < length; i++ ) {
445 value = callback.call( obj[ i ], i, obj[ i ] );
446
447 if ( value === false ) {
448 break;
449 }
450 }
451 } else {
452 for ( i in obj ) {
453 value = callback.call( obj[ i ], i, obj[ i ] );
454
455 if ( value === false ) {
456 break;
457 }
458 }
459 }
460 }
461
462 return obj;
463 },
464
465 // Support: Android<4.1
466 trim: function( text ) {
467 return text == null ?
468 "" :
469 ( text + "" ).replace( rtrim, "" );
470 },
471
472 // results is for internal usage only
473 makeArray: function( arr, results ) {
474 var ret = results || [];
475
476 if ( arr != null ) {
477 if ( isArraylike( Object(arr) ) ) {
478 jQuery.merge( ret,
479 typeof arr === "string" ?
480 [ arr ] : arr
481 );
482 } else {
483 push.call( ret, arr );
484 }
485 }
486
487 return ret;
488 },
489
490 inArray: function( elem, arr, i ) {
491 return arr == null ? -1 : indexOf.call( arr, elem, i );
492 },
493
494 merge: function( first, second ) {
495 var len = +second.length,
496 j = 0,
497 i = first.length;
498
499 for ( ; j < len; j++ ) {
500 first[ i++ ] = second[ j ];
501 }
502
503 first.length = i;
504
505 return first;
506 },
507
508 grep: function( elems, callback, invert ) {
509 var callbackInverse,
510 matches = [],
511 i = 0,
512 length = elems.length,
513 callbackExpect = !invert;
514
515 // Go through the array, only saving the items
516 // that pass the validator function
517 for ( ; i < length; i++ ) {
518 callbackInverse = !callback( elems[ i ], i );
519 if ( callbackInverse !== callbackExpect ) {
520 matches.push( elems[ i ] );
521 }
522 }
523
524 return matches;
525 },
526
527 // arg is for internal usage only
528 map: function( elems, callback, arg ) {
529 var value,
530 i = 0,
531 length = elems.length,
532 isArray = isArraylike( elems ),
533 ret = [];
534
535 // Go through the array, translating each of the items to their new values
536 if ( isArray ) {
537 for ( ; i < length; i++ ) {
538 value = callback( elems[ i ], i, arg );
539
540 if ( value != null ) {
541 ret.push( value );
542 }
543 }
544
545 // Go through every key on the object,
546 } else {
547 for ( i in elems ) {
548 value = callback( elems[ i ], i, arg );
549
550 if ( value != null ) {
551 ret.push( value );
552 }
553 }
554 }
555
556 // Flatten any nested arrays
557 return concat.apply( [], ret );
558 },
559
560 // A global GUID counter for objects
561 guid: 1,
562
563 // Bind a function to a context, optionally partially applying any
564 // arguments.
565 proxy: function( fn, context ) {
566 var tmp, args, proxy;
567
568 if ( typeof context === "string" ) {
569 tmp = fn[ context ];
570 context = fn;
571 fn = tmp;
572 }
573
574 // Quick check to determine if target is callable, in the spec
575 // this throws a TypeError, but we will just return undefined.
576 if ( !jQuery.isFunction( fn ) ) {
577 return undefined;
578 }
579
580 // Simulated bind
581 args = slice.call( arguments, 2 );
582 proxy = function() {
583 return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
584 };
585
586 // Set the guid of unique handler to the same of original handler, so it can be removed
587 proxy.guid = fn.guid = fn.guid || jQuery.guid++;
588
589 return proxy;
590 },
591
592 now: Date.now,
593
594 // jQuery.support is not used in Core but other projects attach their
595 // properties to it so it needs to exist.
596 support: support
597});
598
599// Populate the class2type map
600jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
601 class2type[ "[object " + name + "]" ] = name.toLowerCase();
602});
603
604function isArraylike( obj ) {
605
606 // Support: iOS 8.2 (not reproducible in simulator)
607 // `in` check used to prevent JIT error (gh-2145)
608 // hasOwn isn't used here due to false negatives
609 // regarding Nodelist length in IE
610 var length = "length" in obj && obj.length,
611 type = jQuery.type( obj );
612
613 if ( type === "function" || jQuery.isWindow( obj ) ) {
614 return false;
615 }
616
617 if ( obj.nodeType === 1 && length ) {
618 return true;
619 }
620
621 return type === "array" || length === 0 ||
622 typeof length === "number" && length > 0 && ( length - 1 ) in obj;
623}
624var Sizzle =
625/*!
626 * Sizzle CSS Selector Engine v2.2.0-pre
627 * http://sizzlejs.com/
628 *
629 * Copyright 2008, 2014 jQuery Foundation, Inc. and other contributors
630 * Released under the MIT license
631 * http://jquery.org/license
632 *
633 * Date: 2014-12-16
634 */
635(function( window ) {
636
637var i,
638 support,
639 Expr,
640 getText,
641 isXML,
642 tokenize,
643 compile,
644 select,
645 outermostContext,
646 sortInput,
647 hasDuplicate,
648
649 // Local document vars
650 setDocument,
651 document,
652 docElem,
653 documentIsHTML,
654 rbuggyQSA,
655 rbuggyMatches,
656 matches,
657 contains,
658
659 // Instance-specific data
660 expando = "sizzle" + 1 * new Date(),
661 preferredDoc = window.document,
662 dirruns = 0,
663 done = 0,
664 classCache = createCache(),
665 tokenCache = createCache(),
666 compilerCache = createCache(),
667 sortOrder = function( a, b ) {
668 if ( a === b ) {
669 hasDuplicate = true;
670 }
671 return 0;
672 },
673
674 // General-purpose constants
675 MAX_NEGATIVE = 1 << 31,
676
677 // Instance methods
678 hasOwn = ({}).hasOwnProperty,
679 arr = [],
680 pop = arr.pop,
681 push_native = arr.push,
682 push = arr.push,
683 slice = arr.slice,
684 // Use a stripped-down indexOf as it's faster than native
685 // http://jsperf.com/thor-indexof-vs-for/5
686 indexOf = function( list, elem ) {
687 var i = 0,
688 len = list.length;
689 for ( ; i < len; i++ ) {
690 if ( list[i] === elem ) {
691 return i;
692 }
693 }
694 return -1;
695 },
696
697 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
698
699 // Regular expressions
700
701 // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
702 whitespace = "[\\x20\\t\\r\\n\\f]",
703 // http://www.w3.org/TR/css3-syntax/#characters
704 characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
705
706 // Loosely modeled on CSS identifier characters
707 // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors
708 // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
709 identifier = characterEncoding.replace( "w", "w#" ),
710
711 // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
712 attributes = "\\[" + whitespace + "*(" + characterEncoding + ")(?:" + whitespace +
713 // Operator (capture 2)
714 "*([*^$|!~]?=)" + whitespace +
715 // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
716 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
717 "*\\]",
718
719 pseudos = ":(" + characterEncoding + ")(?:\\((" +
720 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
721 // 1. quoted (capture 3; capture 4 or capture 5)
722 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
723 // 2. simple (capture 6)
724 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
725 // 3. anything else (capture 2)
726 ".*" +
727 ")\\)|)",
728
729 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
730 rwhitespace = new RegExp( whitespace + "+", "g" ),
731 rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
732
733 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
734 rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
735
736 rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
737
738 rpseudo = new RegExp( pseudos ),
739 ridentifier = new RegExp( "^" + identifier + "$" ),
740
741 matchExpr = {
742 "ID": new RegExp( "^#(" + characterEncoding + ")" ),
743 "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
744 "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
745 "ATTR": new RegExp( "^" + attributes ),
746 "PSEUDO": new RegExp( "^" + pseudos ),
747 "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
748 "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
749 "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
750 "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
751 // For use in libraries implementing .is()
752 // We use this for POS matching in `select`
753 "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
754 whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
755 },
756
757 rinputs = /^(?:input|select|textarea|button)$/i,
758 rheader = /^h\d$/i,
759
760 rnative = /^[^{]+\{\s*\[native \w/,
761
762 // Easily-parseable/retrievable ID or TAG or CLASS selectors
763 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
764
765 rsibling = /[+~]/,
766 rescape = /'|\\/g,
767
768 // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
769 runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
770 funescape = function( _, escaped, escapedWhitespace ) {
771 var high = "0x" + escaped - 0x10000;
772 // NaN means non-codepoint
773 // Support: Firefox<24
774 // Workaround erroneous numeric interpretation of +"0x"
775 return high !== high || escapedWhitespace ?
776 escaped :
777 high < 0 ?
778 // BMP codepoint
779 String.fromCharCode( high + 0x10000 ) :
780 // Supplemental Plane codepoint (surrogate pair)
781 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
782 },
783
784 // Used for iframes
785 // See setDocument()
786 // Removing the function wrapper causes a "Permission Denied"
787 // error in IE
788 unloadHandler = function() {
789 setDocument();
790 };
791
792// Optimize for push.apply( _, NodeList )
793try {
794 push.apply(
795 (arr = slice.call( preferredDoc.childNodes )),
796 preferredDoc.childNodes
797 );
798 // Support: Android<4.0
799 // Detect silently failing push.apply
800 arr[ preferredDoc.childNodes.length ].nodeType;
801} catch ( e ) {
802 push = { apply: arr.length ?
803
804 // Leverage slice if possible
805 function( target, els ) {
806 push_native.apply( target, slice.call(els) );
807 } :
808
809 // Support: IE<9
810 // Otherwise append directly
811 function( target, els ) {
812 var j = target.length,
813 i = 0;
814 // Can't trust NodeList.length
815 while ( (target[j++] = els[i++]) ) {}
816 target.length = j - 1;
817 }
818 };
819}
820
821function Sizzle( selector, context, results, seed ) {
822 var match, elem, m, nodeType,
823 // QSA vars
824 i, groups, old, nid, newContext, newSelector;
825
826 if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
827 setDocument( context );
828 }
829
830 context = context || document;
831 results = results || [];
832 nodeType = context.nodeType;
833
834 if ( typeof selector !== "string" || !selector ||
835 nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
836
837 return results;
838 }
839
840 if ( !seed && documentIsHTML ) {
841
842 // Try to shortcut find operations when possible (e.g., not under DocumentFragment)
843 if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
844 // Speed-up: Sizzle("#ID")
845 if ( (m = match[1]) ) {
846 if ( nodeType === 9 ) {
847 elem = context.getElementById( m );
848 // Check parentNode to catch when Blackberry 4.6 returns
849 // nodes that are no longer in the document (jQuery #6963)
850 if ( elem && elem.parentNode ) {
851 // Handle the case where IE, Opera, and Webkit return items
852 // by name instead of ID
853 if ( elem.id === m ) {
854 results.push( elem );
855 return results;
856 }
857 } else {
858 return results;
859 }
860 } else {
861 // Context is not a document
862 if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
863 contains( context, elem ) && elem.id === m ) {
864 results.push( elem );
865 return results;
866 }
867 }
868
869 // Speed-up: Sizzle("TAG")
870 } else if ( match[2] ) {
871 push.apply( results, context.getElementsByTagName( selector ) );
872 return results;
873
874 // Speed-up: Sizzle(".CLASS")
875 } else if ( (m = match[3]) && support.getElementsByClassName ) {
876 push.apply( results, context.getElementsByClassName( m ) );
877 return results;
878 }
879 }
880
881 // QSA path
882 if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
883 nid = old = expando;
884 newContext = context;
885 newSelector = nodeType !== 1 && selector;
886
887 // qSA works strangely on Element-rooted queries
888 // We can work around this by specifying an extra ID on the root
889 // and working up from there (Thanks to Andrew Dupont for the technique)
890 // IE 8 doesn't work on object elements
891 if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
892 groups = tokenize( selector );
893
894 if ( (old = context.getAttribute("id")) ) {
895 nid = old.replace( rescape, "\\$&" );
896 } else {
897 context.setAttribute( "id", nid );
898 }
899 nid = "[id='" + nid + "'] ";
900
901 i = groups.length;
902 while ( i-- ) {
903 groups[i] = nid + toSelector( groups[i] );
904 }
905 newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context;
906 newSelector = groups.join(",");
907 }
908
909 if ( newSelector ) {
910 try {
911 push.apply( results,
912 newContext.querySelectorAll( newSelector )
913 );
914 return results;
915 } catch(qsaError) {
916 } finally {
917 if ( !old ) {
918 context.removeAttribute("id");
919 }
920 }
921 }
922 }
923 }
924
925 // All others
926 return select( selector.replace( rtrim, "$1" ), context, results, seed );
927}
928
929/**
930 * Create key-value caches of limited size
931 * @returns {Function(string, Object)} Returns the Object data after storing it on itself with
932 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
933 * deleting the oldest entry
934 */
935function createCache() {
936 var keys = [];
937
938 function cache( key, value ) {
939 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
940 if ( keys.push( key + " " ) > Expr.cacheLength ) {
941 // Only keep the most recent entries
942 delete cache[ keys.shift() ];
943 }
944 return (cache[ key + " " ] = value);
945 }
946 return cache;
947}
948
949/**
950 * Mark a function for special use by Sizzle
951 * @param {Function} fn The function to mark
952 */
953function markFunction( fn ) {
954 fn[ expando ] = true;
955 return fn;
956}
957
958/**
959 * Support testing using an element
960 * @param {Function} fn Passed the created div and expects a boolean result
961 */
962function assert( fn ) {
963 var div = document.createElement("div");
964
965 try {
966 return !!fn( div );
967 } catch (e) {
968 return false;
969 } finally {
970 // Remove from its parent by default
971 if ( div.parentNode ) {
972 div.parentNode.removeChild( div );
973 }
974 // release memory in IE
975 div = null;
976 }
977}
978
979/**
980 * Adds the same handler for all of the specified attrs
981 * @param {String} attrs Pipe-separated list of attributes
982 * @param {Function} handler The method that will be applied
983 */
984function addHandle( attrs, handler ) {
985 var arr = attrs.split("|"),
986 i = attrs.length;
987
988 while ( i-- ) {
989 Expr.attrHandle[ arr[i] ] = handler;
990 }
991}
992
993/**
994 * Checks document order of two siblings
995 * @param {Element} a
996 * @param {Element} b
997 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
998 */
999function siblingCheck( a, b ) {
1000 var cur = b && a,
1001 diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
1002 ( ~b.sourceIndex || MAX_NEGATIVE ) -
1003 ( ~a.sourceIndex || MAX_NEGATIVE );
1004
1005 // Use IE sourceIndex if available on both nodes
1006 if ( diff ) {
1007 return diff;
1008 }
1009
1010 // Check if b follows a
1011 if ( cur ) {
1012 while ( (cur = cur.nextSibling) ) {
1013 if ( cur === b ) {
1014 return -1;
1015 }
1016 }
1017 }
1018
1019 return a ? 1 : -1;
1020}
1021
1022/**
1023 * Returns a function to use in pseudos for input types
1024 * @param {String} type
1025 */
1026function createInputPseudo( type ) {
1027 return function( elem ) {
1028 var name = elem.nodeName.toLowerCase();
1029 return name === "input" && elem.type === type;
1030 };
1031}
1032
1033/**
1034 * Returns a function to use in pseudos for buttons
1035 * @param {String} type
1036 */
1037function createButtonPseudo( type ) {
1038 return function( elem ) {
1039 var name = elem.nodeName.toLowerCase();
1040 return (name === "input" || name === "button") && elem.type === type;
1041 };
1042}
1043
1044/**
1045 * Returns a function to use in pseudos for positionals
1046 * @param {Function} fn
1047 */
1048function createPositionalPseudo( fn ) {
1049 return markFunction(function( argument ) {
1050 argument = +argument;
1051 return markFunction(function( seed, matches ) {
1052 var j,
1053 matchIndexes = fn( [], seed.length, argument ),
1054 i = matchIndexes.length;
1055
1056 // Match elements found at the specified indexes
1057 while ( i-- ) {
1058 if ( seed[ (j = matchIndexes[i]) ] ) {
1059 seed[j] = !(matches[j] = seed[j]);
1060 }
1061 }
1062 });
1063 });
1064}
1065
1066/**
1067 * Checks a node for validity as a Sizzle context
1068 * @param {Element|Object=} context
1069 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
1070 */
1071function testContext( context ) {
1072 return context && typeof context.getElementsByTagName !== "undefined" && context;
1073}
1074
1075// Expose support vars for convenience
1076support = Sizzle.support = {};
1077
1078/**
1079 * Detects XML nodes
1080 * @param {Element|Object} elem An element or a document
1081 * @returns {Boolean} True iff elem is a non-HTML XML node
1082 */
1083isXML = Sizzle.isXML = function( elem ) {
1084 // documentElement is verified for cases where it doesn't yet exist
1085 // (such as loading iframes in IE - #4833)
1086 var documentElement = elem && (elem.ownerDocument || elem).documentElement;
1087 return documentElement ? documentElement.nodeName !== "HTML" : false;
1088};
1089
1090/**
1091 * Sets document-related variables once based on the current document
1092 * @param {Element|Object} [doc] An element or document object to use to set the document
1093 * @returns {Object} Returns the current document
1094 */
1095setDocument = Sizzle.setDocument = function( node ) {
1096 var hasCompare, parent,
1097 doc = node ? node.ownerDocument || node : preferredDoc;
1098
1099 // If no document and documentElement is available, return
1100 if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
1101 return document;
1102 }
1103
1104 // Set our document
1105 document = doc;
1106 docElem = doc.documentElement;
1107 parent = doc.defaultView;
1108
1109 // Support: IE>8
1110 // If iframe document is assigned to "document" variable and if iframe has been reloaded,
1111 // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936
1112 // IE6-8 do not support the defaultView property so parent will be undefined
1113 if ( parent && parent !== parent.top ) {
1114 // IE11 does not have attachEvent, so all must suffer
1115 if ( parent.addEventListener ) {
1116 parent.addEventListener( "unload", unloadHandler, false );
1117 } else if ( parent.attachEvent ) {
1118 parent.attachEvent( "onunload", unloadHandler );
1119 }
1120 }
1121
1122 /* Support tests
1123 ---------------------------------------------------------------------- */
1124 documentIsHTML = !isXML( doc );
1125
1126 /* Attributes
1127 ---------------------------------------------------------------------- */
1128
1129 // Support: IE<8
1130 // Verify that getAttribute really returns attributes and not properties
1131 // (excepting IE8 booleans)
1132 support.attributes = assert(function( div ) {
1133 div.className = "i";
1134 return !div.getAttribute("className");
1135 });
1136
1137 /* getElement(s)By*
1138 ---------------------------------------------------------------------- */
1139
1140 // Check if getElementsByTagName("*") returns only elements
1141 support.getElementsByTagName = assert(function( div ) {
1142 div.appendChild( doc.createComment("") );
1143 return !div.getElementsByTagName("*").length;
1144 });
1145
1146 // Support: IE<9
1147 support.getElementsByClassName = rnative.test( doc.getElementsByClassName );
1148
1149 // Support: IE<10
1150 // Check if getElementById returns elements by name
1151 // The broken getElementById methods don't pick up programatically-set names,
1152 // so use a roundabout getElementsByName test
1153 support.getById = assert(function( div ) {
1154 docElem.appendChild( div ).id = expando;
1155 return !doc.getElementsByName || !doc.getElementsByName( expando ).length;
1156 });
1157
1158 // ID find and filter
1159 if ( support.getById ) {
1160 Expr.find["ID"] = function( id, context ) {
1161 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
1162 var m = context.getElementById( id );
1163 // Check parentNode to catch when Blackberry 4.6 returns
1164 // nodes that are no longer in the document #6963
1165 return m && m.parentNode ? [ m ] : [];
1166 }
1167 };
1168 Expr.filter["ID"] = function( id ) {
1169 var attrId = id.replace( runescape, funescape );
1170 return function( elem ) {
1171 return elem.getAttribute("id") === attrId;
1172 };
1173 };
1174 } else {
1175 // Support: IE6/7
1176 // getElementById is not reliable as a find shortcut
1177 delete Expr.find["ID"];
1178
1179 Expr.filter["ID"] = function( id ) {
1180 var attrId = id.replace( runescape, funescape );
1181 return function( elem ) {
1182 var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
1183 return node && node.value === attrId;
1184 };
1185 };
1186 }
1187
1188 // Tag
1189 Expr.find["TAG"] = support.getElementsByTagName ?
1190 function( tag, context ) {
1191 if ( typeof context.getElementsByTagName !== "undefined" ) {
1192 return context.getElementsByTagName( tag );
1193
1194 // DocumentFragment nodes don't have gEBTN
1195 } else if ( support.qsa ) {
1196 return context.querySelectorAll( tag );
1197 }
1198 } :
1199
1200 function( tag, context ) {
1201 var elem,
1202 tmp = [],
1203 i = 0,
1204 // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
1205 results = context.getElementsByTagName( tag );
1206
1207 // Filter out possible comments
1208 if ( tag === "*" ) {
1209 while ( (elem = results[i++]) ) {
1210 if ( elem.nodeType === 1 ) {
1211 tmp.push( elem );
1212 }
1213 }
1214
1215 return tmp;
1216 }
1217 return results;
1218 };
1219
1220 // Class
1221 Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
1222 if ( documentIsHTML ) {
1223 return context.getElementsByClassName( className );
1224 }
1225 };
1226
1227 /* QSA/matchesSelector
1228 ---------------------------------------------------------------------- */
1229
1230 // QSA and matchesSelector support
1231
1232 // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
1233 rbuggyMatches = [];
1234
1235 // qSa(:focus) reports false when true (Chrome 21)
1236 // We allow this because of a bug in IE8/9 that throws an error
1237 // whenever `document.activeElement` is accessed on an iframe
1238 // So, we allow :focus to pass through QSA all the time to avoid the IE error
1239 // See http://bugs.jquery.com/ticket/13378
1240 rbuggyQSA = [];
1241
1242 if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) {
1243 // Build QSA regex
1244 // Regex strategy adopted from Diego Perini
1245 assert(function( div ) {
1246 // Select is set to empty string on purpose
1247 // This is to test IE's treatment of not explicitly
1248 // setting a boolean content attribute,
1249 // since its presence should be enough
1250 // http://bugs.jquery.com/ticket/12359
1251 docElem.appendChild( div ).innerHTML = "<a id='" + expando + "'></a>" +
1252 "<select id='" + expando + "-\f]' msallowcapture=''>" +
1253 "<option selected=''></option></select>";
1254
1255 // Support: IE8, Opera 11-12.16
1256 // Nothing should be selected when empty strings follow ^= or $= or *=
1257 // The test attribute must be unknown in Opera but "safe" for WinRT
1258 // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
1259 if ( div.querySelectorAll("[msallowcapture^='']").length ) {
1260 rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
1261 }
1262
1263 // Support: IE8
1264 // Boolean attributes and "value" are not treated correctly
1265 if ( !div.querySelectorAll("[selected]").length ) {
1266 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
1267 }
1268
1269 // Support: Chrome<29, Android<4.2+, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.7+
1270 if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
1271 rbuggyQSA.push("~=");
1272 }
1273
1274 // Webkit/Opera - :checked should return selected option elements
1275 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
1276 // IE8 throws error here and will not see later tests
1277 if ( !div.querySelectorAll(":checked").length ) {
1278 rbuggyQSA.push(":checked");
1279 }
1280
1281 // Support: Safari 8+, iOS 8+
1282 // https://bugs.webkit.org/show_bug.cgi?id=136851
1283 // In-page `selector#id sibing-combinator selector` fails
1284 if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) {
1285 rbuggyQSA.push(".#.+[+~]");
1286 }
1287 });
1288
1289 assert(function( div ) {
1290 // Support: Windows 8 Native Apps
1291 // The type and name attributes are restricted during .innerHTML assignment
1292 var input = doc.createElement("input");
1293 input.setAttribute( "type", "hidden" );
1294 div.appendChild( input ).setAttribute( "name", "D" );
1295
1296 // Support: IE8
1297 // Enforce case-sensitivity of name attribute
1298 if ( div.querySelectorAll("[name=d]").length ) {
1299 rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
1300 }
1301
1302 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
1303 // IE8 throws error here and will not see later tests
1304 if ( !div.querySelectorAll(":enabled").length ) {
1305 rbuggyQSA.push( ":enabled", ":disabled" );
1306 }
1307
1308 // Opera 10-11 does not throw on post-comma invalid pseudos
1309 div.querySelectorAll("*,:x");
1310 rbuggyQSA.push(",.*:");
1311 });
1312 }
1313
1314 if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
1315 docElem.webkitMatchesSelector ||
1316 docElem.mozMatchesSelector ||
1317 docElem.oMatchesSelector ||
1318 docElem.msMatchesSelector) )) ) {
1319
1320 assert(function( div ) {
1321 // Check to see if it's possible to do matchesSelector
1322 // on a disconnected node (IE 9)
1323 support.disconnectedMatch = matches.call( div, "div" );
1324
1325 // This should fail with an exception
1326 // Gecko does not error, returns false instead
1327 matches.call( div, "[s!='']:x" );
1328 rbuggyMatches.push( "!=", pseudos );
1329 });
1330 }
1331
1332 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
1333 rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
1334
1335 /* Contains
1336 ---------------------------------------------------------------------- */
1337 hasCompare = rnative.test( docElem.compareDocumentPosition );
1338
1339 // Element contains another
1340 // Purposefully does not implement inclusive descendent
1341 // As in, an element does not contain itself
1342 contains = hasCompare || rnative.test( docElem.contains ) ?
1343 function( a, b ) {
1344 var adown = a.nodeType === 9 ? a.documentElement : a,
1345 bup = b && b.parentNode;
1346 return a === bup || !!( bup && bup.nodeType === 1 && (
1347 adown.contains ?
1348 adown.contains( bup ) :
1349 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
1350 ));
1351 } :
1352 function( a, b ) {
1353 if ( b ) {
1354 while ( (b = b.parentNode) ) {
1355 if ( b === a ) {
1356 return true;
1357 }
1358 }
1359 }
1360 return false;
1361 };
1362
1363 /* Sorting
1364 ---------------------------------------------------------------------- */
1365
1366 // Document order sorting
1367 sortOrder = hasCompare ?
1368 function( a, b ) {
1369
1370 // Flag for duplicate removal
1371 if ( a === b ) {
1372 hasDuplicate = true;
1373 return 0;
1374 }
1375
1376 // Sort on method existence if only one input has compareDocumentPosition
1377 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
1378 if ( compare ) {
1379 return compare;
1380 }
1381
1382 // Calculate position if both inputs belong to the same document
1383 compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
1384 a.compareDocumentPosition( b ) :
1385
1386 // Otherwise we know they are disconnected
1387 1;
1388
1389 // Disconnected nodes
1390 if ( compare & 1 ||
1391 (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
1392
1393 // Choose the first element that is related to our preferred document
1394 if ( a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
1395 return -1;
1396 }
1397 if ( b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
1398 return 1;
1399 }
1400
1401 // Maintain original order
1402 return sortInput ?
1403 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
1404 0;
1405 }
1406
1407 return compare & 4 ? -1 : 1;
1408 } :
1409 function( a, b ) {
1410 // Exit early if the nodes are identical
1411 if ( a === b ) {
1412 hasDuplicate = true;
1413 return 0;
1414 }
1415
1416 var cur,
1417 i = 0,
1418 aup = a.parentNode,
1419 bup = b.parentNode,
1420 ap = [ a ],
1421 bp = [ b ];
1422
1423 // Parentless nodes are either documents or disconnected
1424 if ( !aup || !bup ) {
1425 return a === doc ? -1 :
1426 b === doc ? 1 :
1427 aup ? -1 :
1428 bup ? 1 :
1429 sortInput ?
1430 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
1431 0;
1432
1433 // If the nodes are siblings, we can do a quick check
1434 } else if ( aup === bup ) {
1435 return siblingCheck( a, b );
1436 }
1437
1438 // Otherwise we need full lists of their ancestors for comparison
1439 cur = a;
1440 while ( (cur = cur.parentNode) ) {
1441 ap.unshift( cur );
1442 }
1443 cur = b;
1444 while ( (cur = cur.parentNode) ) {
1445 bp.unshift( cur );
1446 }
1447
1448 // Walk down the tree looking for a discrepancy
1449 while ( ap[i] === bp[i] ) {
1450 i++;
1451 }
1452
1453 return i ?
1454 // Do a sibling check if the nodes have a common ancestor
1455 siblingCheck( ap[i], bp[i] ) :
1456
1457 // Otherwise nodes in our document sort first
1458 ap[i] === preferredDoc ? -1 :
1459 bp[i] === preferredDoc ? 1 :
1460 0;
1461 };
1462
1463 return doc;
1464};
1465
1466Sizzle.matches = function( expr, elements ) {
1467 return Sizzle( expr, null, null, elements );
1468};
1469
1470Sizzle.matchesSelector = function( elem, expr ) {
1471 // Set document vars if needed
1472 if ( ( elem.ownerDocument || elem ) !== document ) {
1473 setDocument( elem );
1474 }
1475
1476 // Make sure that attribute selectors are quoted
1477 expr = expr.replace( rattributeQuotes, "='$1']" );
1478
1479 if ( support.matchesSelector && documentIsHTML &&
1480 ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
1481 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
1482
1483 try {
1484 var ret = matches.call( elem, expr );
1485
1486 // IE 9's matchesSelector returns false on disconnected nodes
1487 if ( ret || support.disconnectedMatch ||
1488 // As well, disconnected nodes are said to be in a document
1489 // fragment in IE 9
1490 elem.document && elem.document.nodeType !== 11 ) {
1491 return ret;
1492 }
1493 } catch (e) {}
1494 }
1495
1496 return Sizzle( expr, document, null, [ elem ] ).length > 0;
1497};
1498
1499Sizzle.contains = function( context, elem ) {
1500 // Set document vars if needed
1501 if ( ( context.ownerDocument || context ) !== document ) {
1502 setDocument( context );
1503 }
1504 return contains( context, elem );
1505};
1506
1507Sizzle.attr = function( elem, name ) {
1508 // Set document vars if needed
1509 if ( ( elem.ownerDocument || elem ) !== document ) {
1510 setDocument( elem );
1511 }
1512
1513 var fn = Expr.attrHandle[ name.toLowerCase() ],
1514 // Don't get fooled by Object.prototype properties (jQuery #13807)
1515 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
1516 fn( elem, name, !documentIsHTML ) :
1517 undefined;
1518
1519 return val !== undefined ?
1520 val :
1521 support.attributes || !documentIsHTML ?
1522 elem.getAttribute( name ) :
1523 (val = elem.getAttributeNode(name)) && val.specified ?
1524 val.value :
1525 null;
1526};
1527
1528Sizzle.error = function( msg ) {
1529 throw new Error( "Syntax error, unrecognized expression: " + msg );
1530};
1531
1532/**
1533 * Document sorting and removing duplicates
1534 * @param {ArrayLike} results
1535 */
1536Sizzle.uniqueSort = function( results ) {
1537 var elem,
1538 duplicates = [],
1539 j = 0,
1540 i = 0;
1541
1542 // Unless we *know* we can detect duplicates, assume their presence
1543 hasDuplicate = !support.detectDuplicates;
1544 sortInput = !support.sortStable && results.slice( 0 );
1545 results.sort( sortOrder );
1546
1547 if ( hasDuplicate ) {
1548 while ( (elem = results[i++]) ) {
1549 if ( elem === results[ i ] ) {
1550 j = duplicates.push( i );
1551 }
1552 }
1553 while ( j-- ) {
1554 results.splice( duplicates[ j ], 1 );
1555 }
1556 }
1557
1558 // Clear input after sorting to release objects
1559 // See https://github.com/jquery/sizzle/pull/225
1560 sortInput = null;
1561
1562 return results;
1563};
1564
1565/**
1566 * Utility function for retrieving the text value of an array of DOM nodes
1567 * @param {Array|Element} elem
1568 */
1569getText = Sizzle.getText = function( elem ) {
1570 var node,
1571 ret = "",
1572 i = 0,
1573 nodeType = elem.nodeType;
1574
1575 if ( !nodeType ) {
1576 // If no nodeType, this is expected to be an array
1577 while ( (node = elem[i++]) ) {
1578 // Do not traverse comment nodes
1579 ret += getText( node );
1580 }
1581 } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
1582 // Use textContent for elements
1583 // innerText usage removed for consistency of new lines (jQuery #11153)
1584 if ( typeof elem.textContent === "string" ) {
1585 return elem.textContent;
1586 } else {
1587 // Traverse its children
1588 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
1589 ret += getText( elem );
1590 }
1591 }
1592 } else if ( nodeType === 3 || nodeType === 4 ) {
1593 return elem.nodeValue;
1594 }
1595 // Do not include comment or processing instruction nodes
1596
1597 return ret;
1598};
1599
1600Expr = Sizzle.selectors = {
1601
1602 // Can be adjusted by the user
1603 cacheLength: 50,
1604
1605 createPseudo: markFunction,
1606
1607 match: matchExpr,
1608
1609 attrHandle: {},
1610
1611 find: {},
1612
1613 relative: {
1614 ">": { dir: "parentNode", first: true },
1615 " ": { dir: "parentNode" },
1616 "+": { dir: "previousSibling", first: true },
1617 "~": { dir: "previousSibling" }
1618 },
1619
1620 preFilter: {
1621 "ATTR": function( match ) {
1622 match[1] = match[1].replace( runescape, funescape );
1623
1624 // Move the given value to match[3] whether quoted or unquoted
1625 match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
1626
1627 if ( match[2] === "~=" ) {
1628 match[3] = " " + match[3] + " ";
1629 }
1630
1631 return match.slice( 0, 4 );
1632 },
1633
1634 "CHILD": function( match ) {
1635 /* matches from matchExpr["CHILD"]
1636 1 type (only|nth|...)
1637 2 what (child|of-type)
1638 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
1639 4 xn-component of xn+y argument ([+-]?\d*n|)
1640 5 sign of xn-component
1641 6 x of xn-component
1642 7 sign of y-component
1643 8 y of y-component
1644 */
1645 match[1] = match[1].toLowerCase();
1646
1647 if ( match[1].slice( 0, 3 ) === "nth" ) {
1648 // nth-* requires argument
1649 if ( !match[3] ) {
1650 Sizzle.error( match[0] );
1651 }
1652
1653 // numeric x and y parameters for Expr.filter.CHILD
1654 // remember that false/true cast respectively to 0/1
1655 match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
1656 match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
1657
1658 // other types prohibit arguments
1659 } else if ( match[3] ) {
1660 Sizzle.error( match[0] );
1661 }
1662
1663 return match;
1664 },
1665
1666 "PSEUDO": function( match ) {
1667 var excess,
1668 unquoted = !match[6] && match[2];
1669
1670 if ( matchExpr["CHILD"].test( match[0] ) ) {
1671 return null;
1672 }
1673
1674 // Accept quoted arguments as-is
1675 if ( match[3] ) {
1676 match[2] = match[4] || match[5] || "";
1677
1678 // Strip excess characters from unquoted arguments
1679 } else if ( unquoted && rpseudo.test( unquoted ) &&
1680 // Get excess from tokenize (recursively)
1681 (excess = tokenize( unquoted, true )) &&
1682 // advance to the next closing parenthesis
1683 (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
1684
1685 // excess is a negative index
1686 match[0] = match[0].slice( 0, excess );
1687 match[2] = unquoted.slice( 0, excess );
1688 }
1689
1690 // Return only captures needed by the pseudo filter method (type and argument)
1691 return match.slice( 0, 3 );
1692 }
1693 },
1694
1695 filter: {
1696
1697 "TAG": function( nodeNameSelector ) {
1698 var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
1699 return nodeNameSelector === "*" ?
1700 function() { return true; } :
1701 function( elem ) {
1702 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
1703 };
1704 },
1705
1706 "CLASS": function( className ) {
1707 var pattern = classCache[ className + " " ];
1708
1709 return pattern ||
1710 (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
1711 classCache( className, function( elem ) {
1712 return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
1713 });
1714 },
1715
1716 "ATTR": function( name, operator, check ) {
1717 return function( elem ) {
1718 var result = Sizzle.attr( elem, name );
1719
1720 if ( result == null ) {
1721 return operator === "!=";
1722 }
1723 if ( !operator ) {
1724 return true;
1725 }
1726
1727 result += "";
1728
1729 return operator === "=" ? result === check :
1730 operator === "!=" ? result !== check :
1731 operator === "^=" ? check && result.indexOf( check ) === 0 :
1732 operator === "*=" ? check && result.indexOf( check ) > -1 :
1733 operator === "$=" ? check && result.slice( -check.length ) === check :
1734 operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
1735 operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
1736 false;
1737 };
1738 },
1739
1740 "CHILD": function( type, what, argument, first, last ) {
1741 var simple = type.slice( 0, 3 ) !== "nth",
1742 forward = type.slice( -4 ) !== "last",
1743 ofType = what === "of-type";
1744
1745 return first === 1 && last === 0 ?
1746
1747 // Shortcut for :nth-*(n)
1748 function( elem ) {
1749 return !!elem.parentNode;
1750 } :
1751
1752 function( elem, context, xml ) {
1753 var cache, outerCache, node, diff, nodeIndex, start,
1754 dir = simple !== forward ? "nextSibling" : "previousSibling",
1755 parent = elem.parentNode,
1756 name = ofType && elem.nodeName.toLowerCase(),
1757 useCache = !xml && !ofType;
1758
1759 if ( parent ) {
1760
1761 // :(first|last|only)-(child|of-type)
1762 if ( simple ) {
1763 while ( dir ) {
1764 node = elem;
1765 while ( (node = node[ dir ]) ) {
1766 if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) {
1767 return false;
1768 }
1769 }
1770 // Reverse direction for :only-* (if we haven't yet done so)
1771 start = dir = type === "only" && !start && "nextSibling";
1772 }
1773 return true;
1774 }
1775
1776 start = [ forward ? parent.firstChild : parent.lastChild ];
1777
1778 // non-xml :nth-child(...) stores cache data on `parent`
1779 if ( forward && useCache ) {
1780 // Seek `elem` from a previously-cached index
1781 outerCache = parent[ expando ] || (parent[ expando ] = {});
1782 cache = outerCache[ type ] || [];
1783 nodeIndex = cache[0] === dirruns && cache[1];
1784 diff = cache[0] === dirruns && cache[2];
1785 node = nodeIndex && parent.childNodes[ nodeIndex ];
1786
1787 while ( (node = ++nodeIndex && node && node[ dir ] ||
1788
1789 // Fallback to seeking `elem` from the start
1790 (diff = nodeIndex = 0) || start.pop()) ) {
1791
1792 // When found, cache indexes on `parent` and break
1793 if ( node.nodeType === 1 && ++diff && node === elem ) {
1794 outerCache[ type ] = [ dirruns, nodeIndex, diff ];
1795 break;
1796 }
1797 }
1798
1799 // Use previously-cached element index if available
1800 } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {
1801 diff = cache[1];
1802
1803 // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)
1804 } else {
1805 // Use the same loop as above to seek `elem` from the start
1806 while ( (node = ++nodeIndex && node && node[ dir ] ||
1807 (diff = nodeIndex = 0) || start.pop()) ) {
1808
1809 if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) {
1810 // Cache the index of each encountered element
1811 if ( useCache ) {
1812 (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];
1813 }
1814
1815 if ( node === elem ) {
1816 break;
1817 }
1818 }
1819 }
1820 }
1821
1822 // Incorporate the offset, then check against cycle size
1823 diff -= last;
1824 return diff === first || ( diff % first === 0 && diff / first >= 0 );
1825 }
1826 };
1827 },
1828
1829 "PSEUDO": function( pseudo, argument ) {
1830 // pseudo-class names are case-insensitive
1831 // http://www.w3.org/TR/selectors/#pseudo-classes
1832 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
1833 // Remember that setFilters inherits from pseudos
1834 var args,
1835 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
1836 Sizzle.error( "unsupported pseudo: " + pseudo );
1837
1838 // The user may use createPseudo to indicate that
1839 // arguments are needed to create the filter function
1840 // just as Sizzle does
1841 if ( fn[ expando ] ) {
1842 return fn( argument );
1843 }
1844
1845 // But maintain support for old signatures
1846 if ( fn.length > 1 ) {
1847 args = [ pseudo, pseudo, "", argument ];
1848 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
1849 markFunction(function( seed, matches ) {
1850 var idx,
1851 matched = fn( seed, argument ),
1852 i = matched.length;
1853 while ( i-- ) {
1854 idx = indexOf( seed, matched[i] );
1855 seed[ idx ] = !( matches[ idx ] = matched[i] );
1856 }
1857 }) :
1858 function( elem ) {
1859 return fn( elem, 0, args );
1860 };
1861 }
1862
1863 return fn;
1864 }
1865 },
1866
1867 pseudos: {
1868 // Potentially complex pseudos
1869 "not": markFunction(function( selector ) {
1870 // Trim the selector passed to compile
1871 // to avoid treating leading and trailing
1872 // spaces as combinators
1873 var input = [],
1874 results = [],
1875 matcher = compile( selector.replace( rtrim, "$1" ) );
1876
1877 return matcher[ expando ] ?
1878 markFunction(function( seed, matches, context, xml ) {
1879 var elem,
1880 unmatched = matcher( seed, null, xml, [] ),
1881 i = seed.length;
1882
1883 // Match elements unmatched by `matcher`
1884 while ( i-- ) {
1885 if ( (elem = unmatched[i]) ) {
1886 seed[i] = !(matches[i] = elem);
1887 }
1888 }
1889 }) :
1890 function( elem, context, xml ) {
1891 input[0] = elem;
1892 matcher( input, null, xml, results );
1893 // Don't keep the element (issue #299)
1894 input[0] = null;
1895 return !results.pop();
1896 };
1897 }),
1898
1899 "has": markFunction(function( selector ) {
1900 return function( elem ) {
1901 return Sizzle( selector, elem ).length > 0;
1902 };
1903 }),
1904
1905 "contains": markFunction(function( text ) {
1906 text = text.replace( runescape, funescape );
1907 return function( elem ) {
1908 return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
1909 };
1910 }),
1911
1912 // "Whether an element is represented by a :lang() selector
1913 // is based solely on the element's language value
1914 // being equal to the identifier C,
1915 // or beginning with the identifier C immediately followed by "-".
1916 // The matching of C against the element's language value is performed case-insensitively.
1917 // The identifier C does not have to be a valid language name."
1918 // http://www.w3.org/TR/selectors/#lang-pseudo
1919 "lang": markFunction( function( lang ) {
1920 // lang value must be a valid identifier
1921 if ( !ridentifier.test(lang || "") ) {
1922 Sizzle.error( "unsupported lang: " + lang );
1923 }
1924 lang = lang.replace( runescape, funescape ).toLowerCase();
1925 return function( elem ) {
1926 var elemLang;
1927 do {
1928 if ( (elemLang = documentIsHTML ?
1929 elem.lang :
1930 elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
1931
1932 elemLang = elemLang.toLowerCase();
1933 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
1934 }
1935 } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
1936 return false;
1937 };
1938 }),
1939
1940 // Miscellaneous
1941 "target": function( elem ) {
1942 var hash = window.location && window.location.hash;
1943 return hash && hash.slice( 1 ) === elem.id;
1944 },
1945
1946 "root": function( elem ) {
1947 return elem === docElem;
1948 },
1949
1950 "focus": function( elem ) {
1951 return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
1952 },
1953
1954 // Boolean properties
1955 "enabled": function( elem ) {
1956 return elem.disabled === false;
1957 },
1958
1959 "disabled": function( elem ) {
1960 return elem.disabled === true;
1961 },
1962
1963 "checked": function( elem ) {
1964 // In CSS3, :checked should return both checked and selected elements
1965 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
1966 var nodeName = elem.nodeName.toLowerCase();
1967 return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
1968 },
1969
1970 "selected": function( elem ) {
1971 // Accessing this property makes selected-by-default
1972 // options in Safari work properly
1973 if ( elem.parentNode ) {
1974 elem.parentNode.selectedIndex;
1975 }
1976
1977 return elem.selected === true;
1978 },
1979
1980 // Contents
1981 "empty": function( elem ) {
1982 // http://www.w3.org/TR/selectors/#empty-pseudo
1983 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
1984 // but not by others (comment: 8; processing instruction: 7; etc.)
1985 // nodeType < 6 works because attributes (2) do not appear as children
1986 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
1987 if ( elem.nodeType < 6 ) {
1988 return false;
1989 }
1990 }
1991 return true;
1992 },
1993
1994 "parent": function( elem ) {
1995 return !Expr.pseudos["empty"]( elem );
1996 },
1997
1998 // Element/input types
1999 "header": function( elem ) {
2000 return rheader.test( elem.nodeName );
2001 },
2002
2003 "input": function( elem ) {
2004 return rinputs.test( elem.nodeName );
2005 },
2006
2007 "button": function( elem ) {
2008 var name = elem.nodeName.toLowerCase();
2009 return name === "input" && elem.type === "button" || name === "button";
2010 },
2011
2012 "text": function( elem ) {
2013 var attr;
2014 return elem.nodeName.toLowerCase() === "input" &&
2015 elem.type === "text" &&
2016
2017 // Support: IE<8
2018 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
2019 ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
2020 },
2021
2022 // Position-in-collection
2023 "first": createPositionalPseudo(function() {
2024 return [ 0 ];
2025 }),
2026
2027 "last": createPositionalPseudo(function( matchIndexes, length ) {
2028 return [ length - 1 ];
2029 }),
2030
2031 "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
2032 return [ argument < 0 ? argument + length : argument ];
2033 }),
2034
2035 "even": createPositionalPseudo(function( matchIndexes, length ) {
2036 var i = 0;
2037 for ( ; i < length; i += 2 ) {
2038 matchIndexes.push( i );
2039 }
2040 return matchIndexes;
2041 }),
2042
2043 "odd": createPositionalPseudo(function( matchIndexes, length ) {
2044 var i = 1;
2045 for ( ; i < length; i += 2 ) {
2046 matchIndexes.push( i );
2047 }
2048 return matchIndexes;
2049 }),
2050
2051 "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
2052 var i = argument < 0 ? argument + length : argument;
2053 for ( ; --i >= 0; ) {
2054 matchIndexes.push( i );
2055 }
2056 return matchIndexes;
2057 }),
2058
2059 "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
2060 var i = argument < 0 ? argument + length : argument;
2061 for ( ; ++i < length; ) {
2062 matchIndexes.push( i );
2063 }
2064 return matchIndexes;
2065 })
2066 }
2067};
2068
2069Expr.pseudos["nth"] = Expr.pseudos["eq"];
2070
2071// Add button/input type pseudos
2072for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
2073 Expr.pseudos[ i ] = createInputPseudo( i );
2074}
2075for ( i in { submit: true, reset: true } ) {
2076 Expr.pseudos[ i ] = createButtonPseudo( i );
2077}
2078
2079// Easy API for creating new setFilters
2080function setFilters() {}
2081setFilters.prototype = Expr.filters = Expr.pseudos;
2082Expr.setFilters = new setFilters();
2083
2084tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
2085 var matched, match, tokens, type,
2086 soFar, groups, preFilters,
2087 cached = tokenCache[ selector + " " ];
2088
2089 if ( cached ) {
2090 return parseOnly ? 0 : cached.slice( 0 );
2091 }
2092
2093 soFar = selector;
2094 groups = [];
2095 preFilters = Expr.preFilter;
2096
2097 while ( soFar ) {
2098
2099 // Comma and first run
2100 if ( !matched || (match = rcomma.exec( soFar )) ) {
2101 if ( match ) {
2102 // Don't consume trailing commas as valid
2103 soFar = soFar.slice( match[0].length ) || soFar;
2104 }
2105 groups.push( (tokens = []) );
2106 }
2107
2108 matched = false;
2109
2110 // Combinators
2111 if ( (match = rcombinators.exec( soFar )) ) {
2112 matched = match.shift();
2113 tokens.push({
2114 value: matched,
2115 // Cast descendant combinators to space
2116 type: match[0].replace( rtrim, " " )
2117 });
2118 soFar = soFar.slice( matched.length );
2119 }
2120
2121 // Filters
2122 for ( type in Expr.filter ) {
2123 if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
2124 (match = preFilters[ type ]( match ))) ) {
2125 matched = match.shift();
2126 tokens.push({
2127 value: matched,
2128 type: type,
2129 matches: match
2130 });
2131 soFar = soFar.slice( matched.length );
2132 }
2133 }
2134
2135 if ( !matched ) {
2136 break;
2137 }
2138 }
2139
2140 // Return the length of the invalid excess
2141 // if we're just parsing
2142 // Otherwise, throw an error or return tokens
2143 return parseOnly ?
2144 soFar.length :
2145 soFar ?
2146 Sizzle.error( selector ) :
2147 // Cache the tokens
2148 tokenCache( selector, groups ).slice( 0 );
2149};
2150
2151function toSelector( tokens ) {
2152 var i = 0,
2153 len = tokens.length,
2154 selector = "";
2155 for ( ; i < len; i++ ) {
2156 selector += tokens[i].value;
2157 }
2158 return selector;
2159}
2160
2161function addCombinator( matcher, combinator, base ) {
2162 var dir = combinator.dir,
2163 checkNonElements = base && dir === "parentNode",
2164 doneName = done++;
2165
2166 return combinator.first ?
2167 // Check against closest ancestor/preceding element
2168 function( elem, context, xml ) {
2169 while ( (elem = elem[ dir ]) ) {
2170 if ( elem.nodeType === 1 || checkNonElements ) {
2171 return matcher( elem, context, xml );
2172 }
2173 }
2174 } :
2175
2176 // Check against all ancestor/preceding elements
2177 function( elem, context, xml ) {
2178 var oldCache, outerCache,
2179 newCache = [ dirruns, doneName ];
2180
2181 // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
2182 if ( xml ) {
2183 while ( (elem = elem[ dir ]) ) {
2184 if ( elem.nodeType === 1 || checkNonElements ) {
2185 if ( matcher( elem, context, xml ) ) {
2186 return true;
2187 }
2188 }
2189 }
2190 } else {
2191 while ( (elem = elem[ dir ]) ) {
2192 if ( elem.nodeType === 1 || checkNonElements ) {
2193 outerCache = elem[ expando ] || (elem[ expando ] = {});
2194 if ( (oldCache = outerCache[ dir ]) &&
2195 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
2196
2197 // Assign to newCache so results back-propagate to previous elements
2198 return (newCache[ 2 ] = oldCache[ 2 ]);
2199 } else {
2200 // Reuse newcache so results back-propagate to previous elements
2201 outerCache[ dir ] = newCache;
2202
2203 // A match means we're done; a fail means we have to keep checking
2204 if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
2205 return true;
2206 }
2207 }
2208 }
2209 }
2210 }
2211 };
2212}
2213
2214function elementMatcher( matchers ) {
2215 return matchers.length > 1 ?
2216 function( elem, context, xml ) {
2217 var i = matchers.length;
2218 while ( i-- ) {
2219 if ( !matchers[i]( elem, context, xml ) ) {
2220 return false;
2221 }
2222 }
2223 return true;
2224 } :
2225 matchers[0];
2226}
2227
2228function multipleContexts( selector, contexts, results ) {
2229 var i = 0,
2230 len = contexts.length;
2231 for ( ; i < len; i++ ) {
2232 Sizzle( selector, contexts[i], results );
2233 }
2234 return results;
2235}
2236
2237function condense( unmatched, map, filter, context, xml ) {
2238 var elem,
2239 newUnmatched = [],
2240 i = 0,
2241 len = unmatched.length,
2242 mapped = map != null;
2243
2244 for ( ; i < len; i++ ) {
2245 if ( (elem = unmatched[i]) ) {
2246 if ( !filter || filter( elem, context, xml ) ) {
2247 newUnmatched.push( elem );
2248 if ( mapped ) {
2249 map.push( i );
2250 }
2251 }
2252 }
2253 }
2254
2255 return newUnmatched;
2256}
2257
2258function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
2259 if ( postFilter && !postFilter[ expando ] ) {
2260 postFilter = setMatcher( postFilter );
2261 }
2262 if ( postFinder && !postFinder[ expando ] ) {
2263 postFinder = setMatcher( postFinder, postSelector );
2264 }
2265 return markFunction(function( seed, results, context, xml ) {
2266 var temp, i, elem,
2267 preMap = [],
2268 postMap = [],
2269 preexisting = results.length,
2270
2271 // Get initial elements from seed or context
2272 elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
2273
2274 // Prefilter to get matcher input, preserving a map for seed-results synchronization
2275 matcherIn = preFilter && ( seed || !selector ) ?
2276 condense( elems, preMap, preFilter, context, xml ) :
2277 elems,
2278
2279 matcherOut = matcher ?
2280 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
2281 postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
2282
2283 // ...intermediate processing is necessary
2284 [] :
2285
2286 // ...otherwise use results directly
2287 results :
2288 matcherIn;
2289
2290 // Find primary matches
2291 if ( matcher ) {
2292 matcher( matcherIn, matcherOut, context, xml );
2293 }
2294
2295 // Apply postFilter
2296 if ( postFilter ) {
2297 temp = condense( matcherOut, postMap );
2298 postFilter( temp, [], context, xml );
2299
2300 // Un-match failing elements by moving them back to matcherIn
2301 i = temp.length;
2302 while ( i-- ) {
2303 if ( (elem = temp[i]) ) {
2304 matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
2305 }
2306 }
2307 }
2308
2309 if ( seed ) {
2310 if ( postFinder || preFilter ) {
2311 if ( postFinder ) {
2312 // Get the final matcherOut by condensing this intermediate into postFinder contexts
2313 temp = [];
2314 i = matcherOut.length;
2315 while ( i-- ) {
2316 if ( (elem = matcherOut[i]) ) {
2317 // Restore matcherIn since elem is not yet a final match
2318 temp.push( (matcherIn[i] = elem) );
2319 }
2320 }
2321 postFinder( null, (matcherOut = []), temp, xml );
2322 }
2323
2324 // Move matched elements from seed to results to keep them synchronized
2325 i = matcherOut.length;
2326 while ( i-- ) {
2327 if ( (elem = matcherOut[i]) &&
2328 (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
2329
2330 seed[temp] = !(results[temp] = elem);
2331 }
2332 }
2333 }
2334
2335 // Add elements to results, through postFinder if defined
2336 } else {
2337 matcherOut = condense(
2338 matcherOut === results ?
2339 matcherOut.splice( preexisting, matcherOut.length ) :
2340 matcherOut
2341 );
2342 if ( postFinder ) {
2343 postFinder( null, results, matcherOut, xml );
2344 } else {
2345 push.apply( results, matcherOut );
2346 }
2347 }
2348 });
2349}
2350
2351function matcherFromTokens( tokens ) {
2352 var checkContext, matcher, j,
2353 len = tokens.length,
2354 leadingRelative = Expr.relative[ tokens[0].type ],
2355 implicitRelative = leadingRelative || Expr.relative[" "],
2356 i = leadingRelative ? 1 : 0,
2357
2358 // The foundational matcher ensures that elements are reachable from top-level context(s)
2359 matchContext = addCombinator( function( elem ) {
2360 return elem === checkContext;
2361 }, implicitRelative, true ),
2362 matchAnyContext = addCombinator( function( elem ) {
2363 return indexOf( checkContext, elem ) > -1;
2364 }, implicitRelative, true ),
2365 matchers = [ function( elem, context, xml ) {
2366 var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
2367 (checkContext = context).nodeType ?
2368 matchContext( elem, context, xml ) :
2369 matchAnyContext( elem, context, xml ) );
2370 // Avoid hanging onto element (issue #299)
2371 checkContext = null;
2372 return ret;
2373 } ];
2374
2375 for ( ; i < len; i++ ) {
2376 if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
2377 matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
2378 } else {
2379 matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
2380
2381 // Return special upon seeing a positional matcher
2382 if ( matcher[ expando ] ) {
2383 // Find the next relative operator (if any) for proper handling
2384 j = ++i;
2385 for ( ; j < len; j++ ) {
2386 if ( Expr.relative[ tokens[j].type ] ) {
2387 break;
2388 }
2389 }
2390 return setMatcher(
2391 i > 1 && elementMatcher( matchers ),
2392 i > 1 && toSelector(
2393 // If the preceding token was a descendant combinator, insert an implicit any-element `*`
2394 tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
2395 ).replace( rtrim, "$1" ),
2396 matcher,
2397 i < j && matcherFromTokens( tokens.slice( i, j ) ),
2398 j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
2399 j < len && toSelector( tokens )
2400 );
2401 }
2402 matchers.push( matcher );
2403 }
2404 }
2405
2406 return elementMatcher( matchers );
2407}
2408
2409function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
2410 var bySet = setMatchers.length > 0,
2411 byElement = elementMatchers.length > 0,
2412 superMatcher = function( seed, context, xml, results, outermost ) {
2413 var elem, j, matcher,
2414 matchedCount = 0,
2415 i = "0",
2416 unmatched = seed && [],
2417 setMatched = [],
2418 contextBackup = outermostContext,
2419 // We must always have either seed elements or outermost context
2420 elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
2421 // Use integer dirruns iff this is the outermost matcher
2422 dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
2423 len = elems.length;
2424
2425 if ( outermost ) {
2426 outermostContext = context !== document && context;
2427 }
2428
2429 // Add elements passing elementMatchers directly to results
2430 // Keep `i` a string if there are no elements so `matchedCount` will be "00" below
2431 // Support: IE<9, Safari
2432 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
2433 for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
2434 if ( byElement && elem ) {
2435 j = 0;
2436 while ( (matcher = elementMatchers[j++]) ) {
2437 if ( matcher( elem, context, xml ) ) {
2438 results.push( elem );
2439 break;
2440 }
2441 }
2442 if ( outermost ) {
2443 dirruns = dirrunsUnique;
2444 }
2445 }
2446
2447 // Track unmatched elements for set filters
2448 if ( bySet ) {
2449 // They will have gone through all possible matchers
2450 if ( (elem = !matcher && elem) ) {
2451 matchedCount--;
2452 }
2453
2454 // Lengthen the array for every element, matched or not
2455 if ( seed ) {
2456 unmatched.push( elem );
2457 }
2458 }
2459 }
2460
2461 // Apply set filters to unmatched elements
2462 matchedCount += i;
2463 if ( bySet && i !== matchedCount ) {
2464 j = 0;
2465 while ( (matcher = setMatchers[j++]) ) {
2466 matcher( unmatched, setMatched, context, xml );
2467 }
2468
2469 if ( seed ) {
2470 // Reintegrate element matches to eliminate the need for sorting
2471 if ( matchedCount > 0 ) {
2472 while ( i-- ) {
2473 if ( !(unmatched[i] || setMatched[i]) ) {
2474 setMatched[i] = pop.call( results );
2475 }
2476 }
2477 }
2478
2479 // Discard index placeholder values to get only actual matches
2480 setMatched = condense( setMatched );
2481 }
2482
2483 // Add matches to results
2484 push.apply( results, setMatched );
2485
2486 // Seedless set matches succeeding multiple successful matchers stipulate sorting
2487 if ( outermost && !seed && setMatched.length > 0 &&
2488 ( matchedCount + setMatchers.length ) > 1 ) {
2489
2490 Sizzle.uniqueSort( results );
2491 }
2492 }
2493
2494 // Override manipulation of globals by nested matchers
2495 if ( outermost ) {
2496 dirruns = dirrunsUnique;
2497 outermostContext = contextBackup;
2498 }
2499
2500 return unmatched;
2501 };
2502
2503 return bySet ?
2504 markFunction( superMatcher ) :
2505 superMatcher;
2506}
2507
2508compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
2509 var i,
2510 setMatchers = [],
2511 elementMatchers = [],
2512 cached = compilerCache[ selector + " " ];
2513
2514 if ( !cached ) {
2515 // Generate a function of recursive functions that can be used to check each element
2516 if ( !match ) {
2517 match = tokenize( selector );
2518 }
2519 i = match.length;
2520 while ( i-- ) {
2521 cached = matcherFromTokens( match[i] );
2522 if ( cached[ expando ] ) {
2523 setMatchers.push( cached );
2524 } else {
2525 elementMatchers.push( cached );
2526 }
2527 }
2528
2529 // Cache the compiled function
2530 cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
2531
2532 // Save selector and tokenization
2533 cached.selector = selector;
2534 }
2535 return cached;
2536};
2537
2538/**
2539 * A low-level selection function that works with Sizzle's compiled
2540 * selector functions
2541 * @param {String|Function} selector A selector or a pre-compiled
2542 * selector function built with Sizzle.compile
2543 * @param {Element} context
2544 * @param {Array} [results]
2545 * @param {Array} [seed] A set of elements to match against
2546 */
2547select = Sizzle.select = function( selector, context, results, seed ) {
2548 var i, tokens, token, type, find,
2549 compiled = typeof selector === "function" && selector,
2550 match = !seed && tokenize( (selector = compiled.selector || selector) );
2551
2552 results = results || [];
2553
2554 // Try to minimize operations if there is no seed and only one group
2555 if ( match.length === 1 ) {
2556
2557 // Take a shortcut and set the context if the root selector is an ID
2558 tokens = match[0] = match[0].slice( 0 );
2559 if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
2560 support.getById && context.nodeType === 9 && documentIsHTML &&
2561 Expr.relative[ tokens[1].type ] ) {
2562
2563 context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
2564 if ( !context ) {
2565 return results;
2566
2567 // Precompiled matchers will still verify ancestry, so step up a level
2568 } else if ( compiled ) {
2569 context = context.parentNode;
2570 }
2571
2572 selector = selector.slice( tokens.shift().value.length );
2573 }
2574
2575 // Fetch a seed set for right-to-left matching
2576 i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
2577 while ( i-- ) {
2578 token = tokens[i];
2579
2580 // Abort if we hit a combinator
2581 if ( Expr.relative[ (type = token.type) ] ) {
2582 break;
2583 }
2584 if ( (find = Expr.find[ type ]) ) {
2585 // Search, expanding context for leading sibling combinators
2586 if ( (seed = find(
2587 token.matches[0].replace( runescape, funescape ),
2588 rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
2589 )) ) {
2590
2591 // If seed is empty or no tokens remain, we can return early
2592 tokens.splice( i, 1 );
2593 selector = seed.length && toSelector( tokens );
2594 if ( !selector ) {
2595 push.apply( results, seed );
2596 return results;
2597 }
2598
2599 break;
2600 }
2601 }
2602 }
2603 }
2604
2605 // Compile and execute a filtering function if one is not provided
2606 // Provide `match` to avoid retokenization if we modified the selector above
2607 ( compiled || compile( selector, match ) )(
2608 seed,
2609 context,
2610 !documentIsHTML,
2611 results,
2612 rsibling.test( selector ) && testContext( context.parentNode ) || context
2613 );
2614 return results;
2615};
2616
2617// One-time assignments
2618
2619// Sort stability
2620support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
2621
2622// Support: Chrome 14-35+
2623// Always assume duplicates if they aren't passed to the comparison function
2624support.detectDuplicates = !!hasDuplicate;
2625
2626// Initialize against the default document
2627setDocument();
2628
2629// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
2630// Detached nodes confoundingly follow *each other*
2631support.sortDetached = assert(function( div1 ) {
2632 // Should return 1, but returns 4 (following)
2633 return div1.compareDocumentPosition( document.createElement("div") ) & 1;
2634});
2635
2636// Support: IE<8
2637// Prevent attribute/property "interpolation"
2638// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
2639if ( !assert(function( div ) {
2640 div.innerHTML = "<a href='#'></a>";
2641 return div.firstChild.getAttribute("href") === "#" ;
2642}) ) {
2643 addHandle( "type|href|height|width", function( elem, name, isXML ) {
2644 if ( !isXML ) {
2645 return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
2646 }
2647 });
2648}
2649
2650// Support: IE<9
2651// Use defaultValue in place of getAttribute("value")
2652if ( !support.attributes || !assert(function( div ) {
2653 div.innerHTML = "<input/>";
2654 div.firstChild.setAttribute( "value", "" );
2655 return div.firstChild.getAttribute( "value" ) === "";
2656}) ) {
2657 addHandle( "value", function( elem, name, isXML ) {
2658 if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
2659 return elem.defaultValue;
2660 }
2661 });
2662}
2663
2664// Support: IE<9
2665// Use getAttributeNode to fetch booleans when getAttribute lies
2666if ( !assert(function( div ) {
2667 return div.getAttribute("disabled") == null;
2668}) ) {
2669 addHandle( booleans, function( elem, name, isXML ) {
2670 var val;
2671 if ( !isXML ) {
2672 return elem[ name ] === true ? name.toLowerCase() :
2673 (val = elem.getAttributeNode( name )) && val.specified ?
2674 val.value :
2675 null;
2676 }
2677 });
2678}
2679
2680return Sizzle;
2681
2682})( window );
2683
2684
2685
2686jQuery.find = Sizzle;
2687jQuery.expr = Sizzle.selectors;
2688jQuery.expr[":"] = jQuery.expr.pseudos;
2689jQuery.unique = Sizzle.uniqueSort;
2690jQuery.text = Sizzle.getText;
2691jQuery.isXMLDoc = Sizzle.isXML;
2692jQuery.contains = Sizzle.contains;
2693
2694
2695
2696var rneedsContext = jQuery.expr.match.needsContext;
2697
2698var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/);
2699
2700
2701
2702var risSimple = /^.[^:#\[\.,]*$/;
2703
2704// Implement the identical functionality for filter and not
2705function winnow( elements, qualifier, not ) {
2706 if ( jQuery.isFunction( qualifier ) ) {
2707 return jQuery.grep( elements, function( elem, i ) {
2708 /* jshint -W018 */
2709 return !!qualifier.call( elem, i, elem ) !== not;
2710 });
2711
2712 }
2713
2714 if ( qualifier.nodeType ) {
2715 return jQuery.grep( elements, function( elem ) {
2716 return ( elem === qualifier ) !== not;
2717 });
2718
2719 }
2720
2721 if ( typeof qualifier === "string" ) {
2722 if ( risSimple.test( qualifier ) ) {
2723 return jQuery.filter( qualifier, elements, not );
2724 }
2725
2726 qualifier = jQuery.filter( qualifier, elements );
2727 }
2728
2729 return jQuery.grep( elements, function( elem ) {
2730 return ( indexOf.call( qualifier, elem ) >= 0 ) !== not;
2731 });
2732}
2733
2734jQuery.filter = function( expr, elems, not ) {
2735 var elem = elems[ 0 ];
2736
2737 if ( not ) {
2738 expr = ":not(" + expr + ")";
2739 }
2740
2741 return elems.length === 1 && elem.nodeType === 1 ?
2742 jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] :
2743 jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
2744 return elem.nodeType === 1;
2745 }));
2746};
2747
2748jQuery.fn.extend({
2749 find: function( selector ) {
2750 var i,
2751 len = this.length,
2752 ret = [],
2753 self = this;
2754
2755 if ( typeof selector !== "string" ) {
2756 return this.pushStack( jQuery( selector ).filter(function() {
2757 for ( i = 0; i < len; i++ ) {
2758 if ( jQuery.contains( self[ i ], this ) ) {
2759 return true;
2760 }
2761 }
2762 }) );
2763 }
2764
2765 for ( i = 0; i < len; i++ ) {
2766 jQuery.find( selector, self[ i ], ret );
2767 }
2768
2769 // Needed because $( selector, context ) becomes $( context ).find( selector )
2770 ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
2771 ret.selector = this.selector ? this.selector + " " + selector : selector;
2772 return ret;
2773 },
2774 filter: function( selector ) {
2775 return this.pushStack( winnow(this, selector || [], false) );
2776 },
2777 not: function( selector ) {
2778 return this.pushStack( winnow(this, selector || [], true) );
2779 },
2780 is: function( selector ) {
2781 return !!winnow(
2782 this,
2783
2784 // If this is a positional/relative selector, check membership in the returned set
2785 // so $("p:first").is("p:last") won't return true for a doc with two "p".
2786 typeof selector === "string" && rneedsContext.test( selector ) ?
2787 jQuery( selector ) :
2788 selector || [],
2789 false
2790 ).length;
2791 }
2792});
2793
2794
2795// Initialize a jQuery object
2796
2797
2798// A central reference to the root jQuery(document)
2799var rootjQuery,
2800
2801 // A simple way to check for HTML strings
2802 // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
2803 // Strict HTML recognition (#11290: must start with <)
2804 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
2805
2806 init = jQuery.fn.init = function( selector, context ) {
2807 var match, elem;
2808
2809 // HANDLE: $(""), $(null), $(undefined), $(false)
2810 if ( !selector ) {
2811 return this;
2812 }
2813
2814 // Handle HTML strings
2815 if ( typeof selector === "string" ) {
2816 if ( selector[0] === "<" && selector[ selector.length - 1 ] === ">" && selector.length >= 3 ) {
2817 // Assume that strings that start and end with <> are HTML and skip the regex check
2818 match = [ null, selector, null ];
2819
2820 } else {
2821 match = rquickExpr.exec( selector );
2822 }
2823
2824 // Match html or make sure no context is specified for #id
2825 if ( match && (match[1] || !context) ) {
2826
2827 // HANDLE: $(html) -> $(array)
2828 if ( match[1] ) {
2829 context = context instanceof jQuery ? context[0] : context;
2830
2831 // Option to run scripts is true for back-compat
2832 // Intentionally let the error be thrown if parseHTML is not present
2833 jQuery.merge( this, jQuery.parseHTML(
2834 match[1],
2835 context && context.nodeType ? context.ownerDocument || context : document,
2836 true
2837 ) );
2838
2839 // HANDLE: $(html, props)
2840 if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
2841 for ( match in context ) {
2842 // Properties of context are called as methods if possible
2843 if ( jQuery.isFunction( this[ match ] ) ) {
2844 this[ match ]( context[ match ] );
2845
2846 // ...and otherwise set as attributes
2847 } else {
2848 this.attr( match, context[ match ] );
2849 }
2850 }
2851 }
2852
2853 return this;
2854
2855 // HANDLE: $(#id)
2856 } else {
2857 elem = document.getElementById( match[2] );
2858
2859 // Support: Blackberry 4.6
2860 // gEBID returns nodes no longer in the document (#6963)
2861 if ( elem && elem.parentNode ) {
2862 // Inject the element directly into the jQuery object
2863 this.length = 1;
2864 this[0] = elem;
2865 }
2866
2867 this.context = document;
2868 this.selector = selector;
2869 return this;
2870 }
2871
2872 // HANDLE: $(expr, $(...))
2873 } else if ( !context || context.jquery ) {
2874 return ( context || rootjQuery ).find( selector );
2875
2876 // HANDLE: $(expr, context)
2877 // (which is just equivalent to: $(context).find(expr)
2878 } else {
2879 return this.constructor( context ).find( selector );
2880 }
2881
2882 // HANDLE: $(DOMElement)
2883 } else if ( selector.nodeType ) {
2884 this.context = this[0] = selector;
2885 this.length = 1;
2886 return this;
2887
2888 // HANDLE: $(function)
2889 // Shortcut for document ready
2890 } else if ( jQuery.isFunction( selector ) ) {
2891 return typeof rootjQuery.ready !== "undefined" ?
2892 rootjQuery.ready( selector ) :
2893 // Execute immediately if ready is not present
2894 selector( jQuery );
2895 }
2896
2897 if ( selector.selector !== undefined ) {
2898 this.selector = selector.selector;
2899 this.context = selector.context;
2900 }
2901
2902 return jQuery.makeArray( selector, this );
2903 };
2904
2905// Give the init function the jQuery prototype for later instantiation
2906init.prototype = jQuery.fn;
2907
2908// Initialize central reference
2909rootjQuery = jQuery( document );
2910
2911
2912var rparentsprev = /^(?:parents|prev(?:Until|All))/,
2913 // Methods guaranteed to produce a unique set when starting from a unique set
2914 guaranteedUnique = {
2915 children: true,
2916 contents: true,
2917 next: true,
2918 prev: true
2919 };
2920
2921jQuery.extend({
2922 dir: function( elem, dir, until ) {
2923 var matched = [],
2924 truncate = until !== undefined;
2925
2926 while ( (elem = elem[ dir ]) && elem.nodeType !== 9 ) {
2927 if ( elem.nodeType === 1 ) {
2928 if ( truncate && jQuery( elem ).is( until ) ) {
2929 break;
2930 }
2931 matched.push( elem );
2932 }
2933 }
2934 return matched;
2935 },
2936
2937 sibling: function( n, elem ) {
2938 var matched = [];
2939
2940 for ( ; n; n = n.nextSibling ) {
2941 if ( n.nodeType === 1 && n !== elem ) {
2942 matched.push( n );
2943 }
2944 }
2945
2946 return matched;
2947 }
2948});
2949
2950jQuery.fn.extend({
2951 has: function( target ) {
2952 var targets = jQuery( target, this ),
2953 l = targets.length;
2954
2955 return this.filter(function() {
2956 var i = 0;
2957 for ( ; i < l; i++ ) {
2958 if ( jQuery.contains( this, targets[i] ) ) {
2959 return true;
2960 }
2961 }
2962 });
2963 },
2964
2965 closest: function( selectors, context ) {
2966 var cur,
2967 i = 0,
2968 l = this.length,
2969 matched = [],
2970 pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
2971 jQuery( selectors, context || this.context ) :
2972 0;
2973
2974 for ( ; i < l; i++ ) {
2975 for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) {
2976 // Always skip document fragments
2977 if ( cur.nodeType < 11 && (pos ?
2978 pos.index(cur) > -1 :
2979
2980 // Don't pass non-elements to Sizzle
2981 cur.nodeType === 1 &&
2982 jQuery.find.matchesSelector(cur, selectors)) ) {
2983
2984 matched.push( cur );
2985 break;
2986 }
2987 }
2988 }
2989
2990 return this.pushStack( matched.length > 1 ? jQuery.unique( matched ) : matched );
2991 },
2992
2993 // Determine the position of an element within the set
2994 index: function( elem ) {
2995
2996 // No argument, return index in parent
2997 if ( !elem ) {
2998 return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
2999 }
3000
3001 // Index in selector
3002 if ( typeof elem === "string" ) {
3003 return indexOf.call( jQuery( elem ), this[ 0 ] );
3004 }
3005
3006 // Locate the position of the desired element
3007 return indexOf.call( this,
3008
3009 // If it receives a jQuery object, the first element is used
3010 elem.jquery ? elem[ 0 ] : elem
3011 );
3012 },
3013
3014 add: function( selector, context ) {
3015 return this.pushStack(
3016 jQuery.unique(
3017 jQuery.merge( this.get(), jQuery( selector, context ) )
3018 )
3019 );
3020 },
3021
3022 addBack: function( selector ) {
3023 return this.add( selector == null ?
3024 this.prevObject : this.prevObject.filter(selector)
3025 );
3026 }
3027});
3028
3029function sibling( cur, dir ) {
3030 while ( (cur = cur[dir]) && cur.nodeType !== 1 ) {}
3031 return cur;
3032}
3033
3034jQuery.each({
3035 parent: function( elem ) {
3036 var parent = elem.parentNode;
3037 return parent && parent.nodeType !== 11 ? parent : null;
3038 },
3039 parents: function( elem ) {
3040 return jQuery.dir( elem, "parentNode" );
3041 },
3042 parentsUntil: function( elem, i, until ) {
3043 return jQuery.dir( elem, "parentNode", until );
3044 },
3045 next: function( elem ) {
3046 return sibling( elem, "nextSibling" );
3047 },
3048 prev: function( elem ) {
3049 return sibling( elem, "previousSibling" );
3050 },
3051 nextAll: function( elem ) {
3052 return jQuery.dir( elem, "nextSibling" );
3053 },
3054 prevAll: function( elem ) {
3055 return jQuery.dir( elem, "previousSibling" );
3056 },
3057 nextUntil: function( elem, i, until ) {
3058 return jQuery.dir( elem, "nextSibling", until );
3059 },
3060 prevUntil: function( elem, i, until ) {
3061 return jQuery.dir( elem, "previousSibling", until );
3062 },
3063 siblings: function( elem ) {
3064 return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
3065 },
3066 children: function( elem ) {
3067 return jQuery.sibling( elem.firstChild );
3068 },
3069 contents: function( elem ) {
3070 return elem.contentDocument || jQuery.merge( [], elem.childNodes );
3071 }
3072}, function( name, fn ) {
3073 jQuery.fn[ name ] = function( until, selector ) {
3074 var matched = jQuery.map( this, fn, until );
3075
3076 if ( name.slice( -5 ) !== "Until" ) {
3077 selector = until;
3078 }
3079
3080 if ( selector && typeof selector === "string" ) {
3081 matched = jQuery.filter( selector, matched );
3082 }
3083
3084 if ( this.length > 1 ) {
3085 // Remove duplicates
3086 if ( !guaranteedUnique[ name ] ) {
3087 jQuery.unique( matched );
3088 }
3089
3090 // Reverse order for parents* and prev-derivatives
3091 if ( rparentsprev.test( name ) ) {
3092 matched.reverse();
3093 }
3094 }
3095
3096 return this.pushStack( matched );
3097 };
3098});
3099var rnotwhite = (/\S+/g);
3100
3101
3102
3103// String to Object options format cache
3104var optionsCache = {};
3105
3106// Convert String-formatted options into Object-formatted ones and store in cache
3107function createOptions( options ) {
3108 var object = optionsCache[ options ] = {};
3109 jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) {
3110 object[ flag ] = true;
3111 });
3112 return object;
3113}
3114
3115/*
3116 * Create a callback list using the following parameters:
3117 *
3118 * options: an optional list of space-separated options that will change how
3119 * the callback list behaves or a more traditional option object
3120 *
3121 * By default a callback list will act like an event callback list and can be
3122 * "fired" multiple times.
3123 *
3124 * Possible options:
3125 *
3126 * once: will ensure the callback list can only be fired once (like a Deferred)
3127 *
3128 * memory: will keep track of previous values and will call any callback added
3129 * after the list has been fired right away with the latest "memorized"
3130 * values (like a Deferred)
3131 *
3132 * unique: will ensure a callback can only be added once (no duplicate in the list)
3133 *
3134 * stopOnFalse: interrupt callings when a callback returns false
3135 *
3136 */
3137jQuery.Callbacks = function( options ) {
3138
3139 // Convert options from String-formatted to Object-formatted if needed
3140 // (we check in cache first)
3141 options = typeof options === "string" ?
3142 ( optionsCache[ options ] || createOptions( options ) ) :
3143 jQuery.extend( {}, options );
3144
3145 var // Last fire value (for non-forgettable lists)
3146 memory,
3147 // Flag to know if list was already fired
3148 fired,
3149 // Flag to know if list is currently firing
3150 firing,
3151 // First callback to fire (used internally by add and fireWith)
3152 firingStart,
3153 // End of the loop when firing
3154 firingLength,
3155 // Index of currently firing callback (modified by remove if needed)
3156 firingIndex,
3157 // Actual callback list
3158 list = [],
3159 // Stack of fire calls for repeatable lists
3160 stack = !options.once && [],
3161 // Fire callbacks
3162 fire = function( data ) {
3163 memory = options.memory && data;
3164 fired = true;
3165 firingIndex = firingStart || 0;
3166 firingStart = 0;
3167 firingLength = list.length;
3168 firing = true;
3169 for ( ; list && firingIndex < firingLength; firingIndex++ ) {
3170 if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
3171 memory = false; // To prevent further calls using add
3172 break;
3173 }
3174 }
3175 firing = false;
3176 if ( list ) {
3177 if ( stack ) {
3178 if ( stack.length ) {
3179 fire( stack.shift() );
3180 }
3181 } else if ( memory ) {
3182 list = [];
3183 } else {
3184 self.disable();
3185 }
3186 }
3187 },
3188 // Actual Callbacks object
3189 self = {
3190 // Add a callback or a collection of callbacks to the list
3191 add: function() {
3192 if ( list ) {
3193 // First, we save the current length
3194 var start = list.length;
3195 (function add( args ) {
3196 jQuery.each( args, function( _, arg ) {
3197 var type = jQuery.type( arg );
3198 if ( type === "function" ) {
3199 if ( !options.unique || !self.has( arg ) ) {
3200 list.push( arg );
3201 }
3202 } else if ( arg && arg.length && type !== "string" ) {
3203 // Inspect recursively
3204 add( arg );
3205 }
3206 });
3207 })( arguments );
3208 // Do we need to add the callbacks to the
3209 // current firing batch?
3210 if ( firing ) {
3211 firingLength = list.length;
3212 // With memory, if we're not firing then
3213 // we should call right away
3214 } else if ( memory ) {
3215 firingStart = start;
3216 fire( memory );
3217 }
3218 }
3219 return this;
3220 },
3221 // Remove a callback from the list
3222 remove: function() {
3223 if ( list ) {
3224 jQuery.each( arguments, function( _, arg ) {
3225 var index;
3226 while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
3227 list.splice( index, 1 );
3228 // Handle firing indexes
3229 if ( firing ) {
3230 if ( index <= firingLength ) {
3231 firingLength--;
3232 }
3233 if ( index <= firingIndex ) {
3234 firingIndex--;
3235 }
3236 }
3237 }
3238 });
3239 }
3240 return this;
3241 },
3242 // Check if a given callback is in the list.
3243 // If no argument is given, return whether or not list has callbacks attached.
3244 has: function( fn ) {
3245 return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length );
3246 },
3247 // Remove all callbacks from the list
3248 empty: function() {
3249 list = [];
3250 firingLength = 0;
3251 return this;
3252 },
3253 // Have the list do nothing anymore
3254 disable: function() {
3255 list = stack = memory = undefined;
3256 return this;
3257 },
3258 // Is it disabled?
3259 disabled: function() {
3260 return !list;
3261 },
3262 // Lock the list in its current state
3263 lock: function() {
3264 stack = undefined;
3265 if ( !memory ) {
3266 self.disable();
3267 }
3268 return this;
3269 },
3270 // Is it locked?
3271 locked: function() {
3272 return !stack;
3273 },
3274 // Call all callbacks with the given context and arguments
3275 fireWith: function( context, args ) {
3276 if ( list && ( !fired || stack ) ) {
3277 args = args || [];
3278 args = [ context, args.slice ? args.slice() : args ];
3279 if ( firing ) {
3280 stack.push( args );
3281 } else {
3282 fire( args );
3283 }
3284 }
3285 return this;
3286 },
3287 // Call all the callbacks with the given arguments
3288 fire: function() {
3289 self.fireWith( this, arguments );
3290 return this;
3291 },
3292 // To know if the callbacks have already been called at least once
3293 fired: function() {
3294 return !!fired;
3295 }
3296 };
3297
3298 return self;
3299};
3300
3301
3302jQuery.extend({
3303
3304 Deferred: function( func ) {
3305 var tuples = [
3306 // action, add listener, listener list, final state
3307 [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
3308 [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
3309 [ "notify", "progress", jQuery.Callbacks("memory") ]
3310 ],
3311 state = "pending",
3312 promise = {
3313 state: function() {
3314 return state;
3315 },
3316 always: function() {
3317 deferred.done( arguments ).fail( arguments );
3318 return this;
3319 },
3320 then: function( /* fnDone, fnFail, fnProgress */ ) {
3321 var fns = arguments;
3322 return jQuery.Deferred(function( newDefer ) {
3323 jQuery.each( tuples, function( i, tuple ) {
3324 var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
3325 // deferred[ done | fail | progress ] for forwarding actions to newDefer
3326 deferred[ tuple[1] ](function() {
3327 var returned = fn && fn.apply( this, arguments );
3328 if ( returned && jQuery.isFunction( returned.promise ) ) {
3329 returned.promise()
3330 .done( newDefer.resolve )
3331 .fail( newDefer.reject )
3332 .progress( newDefer.notify );
3333 } else {
3334 newDefer[ tuple[ 0 ] + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments );
3335 }
3336 });
3337 });
3338 fns = null;
3339 }).promise();
3340 },
3341 // Get a promise for this deferred
3342 // If obj is provided, the promise aspect is added to the object
3343 promise: function( obj ) {
3344 return obj != null ? jQuery.extend( obj, promise ) : promise;
3345 }
3346 },
3347 deferred = {};
3348
3349 // Keep pipe for back-compat
3350 promise.pipe = promise.then;
3351
3352 // Add list-specific methods
3353 jQuery.each( tuples, function( i, tuple ) {
3354 var list = tuple[ 2 ],
3355 stateString = tuple[ 3 ];
3356
3357 // promise[ done | fail | progress ] = list.add
3358 promise[ tuple[1] ] = list.add;
3359
3360 // Handle state
3361 if ( stateString ) {
3362 list.add(function() {
3363 // state = [ resolved | rejected ]
3364 state = stateString;
3365
3366 // [ reject_list | resolve_list ].disable; progress_list.lock
3367 }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
3368 }
3369
3370 // deferred[ resolve | reject | notify ]
3371 deferred[ tuple[0] ] = function() {
3372 deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments );
3373 return this;
3374 };
3375 deferred[ tuple[0] + "With" ] = list.fireWith;
3376 });
3377
3378 // Make the deferred a promise
3379 promise.promise( deferred );
3380
3381 // Call given func if any
3382 if ( func ) {
3383 func.call( deferred, deferred );
3384 }
3385
3386 // All done!
3387 return deferred;
3388 },
3389
3390 // Deferred helper
3391 when: function( subordinate /* , ..., subordinateN */ ) {
3392 var i = 0,
3393 resolveValues = slice.call( arguments ),
3394 length = resolveValues.length,
3395
3396 // the count of uncompleted subordinates
3397 remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
3398
3399 // the master Deferred. If resolveValues consist of only a single Deferred, just use that.
3400 deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
3401
3402 // Update function for both resolve and progress values
3403 updateFunc = function( i, contexts, values ) {
3404 return function( value ) {
3405 contexts[ i ] = this;
3406 values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
3407 if ( values === progressValues ) {
3408 deferred.notifyWith( contexts, values );
3409 } else if ( !( --remaining ) ) {
3410 deferred.resolveWith( contexts, values );
3411 }
3412 };
3413 },
3414
3415 progressValues, progressContexts, resolveContexts;
3416
3417 // Add listeners to Deferred subordinates; treat others as resolved
3418 if ( length > 1 ) {
3419 progressValues = new Array( length );
3420 progressContexts = new Array( length );
3421 resolveContexts = new Array( length );
3422 for ( ; i < length; i++ ) {
3423 if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
3424 resolveValues[ i ].promise()
3425 .done( updateFunc( i, resolveContexts, resolveValues ) )
3426 .fail( deferred.reject )
3427 .progress( updateFunc( i, progressContexts, progressValues ) );
3428 } else {
3429 --remaining;
3430 }
3431 }
3432 }
3433
3434 // If we're not waiting on anything, resolve the master
3435 if ( !remaining ) {
3436 deferred.resolveWith( resolveContexts, resolveValues );
3437 }
3438
3439 return deferred.promise();
3440 }
3441});
3442
3443
3444// The deferred used on DOM ready
3445var readyList;
3446
3447jQuery.fn.ready = function( fn ) {
3448 // Add the callback
3449 jQuery.ready.promise().done( fn );
3450
3451 return this;
3452};
3453
3454jQuery.extend({
3455 // Is the DOM ready to be used? Set to true once it occurs.
3456 isReady: false,
3457
3458 // A counter to track how many items to wait for before
3459 // the ready event fires. See #6781
3460 readyWait: 1,
3461
3462 // Hold (or release) the ready event
3463 holdReady: function( hold ) {
3464 if ( hold ) {
3465 jQuery.readyWait++;
3466 } else {
3467 jQuery.ready( true );
3468 }
3469 },
3470
3471 // Handle when the DOM is ready
3472 ready: function( wait ) {
3473
3474 // Abort if there are pending holds or we're already ready
3475 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
3476 return;
3477 }
3478
3479 // Remember that the DOM is ready
3480 jQuery.isReady = true;
3481
3482 // If a normal DOM Ready event fired, decrement, and wait if need be
3483 if ( wait !== true && --jQuery.readyWait > 0 ) {
3484 return;
3485 }
3486
3487 // If there are functions bound, to execute
3488 readyList.resolveWith( document, [ jQuery ] );
3489
3490 // Trigger any bound ready events
3491 if ( jQuery.fn.triggerHandler ) {
3492 jQuery( document ).triggerHandler( "ready" );
3493 jQuery( document ).off( "ready" );
3494 }
3495 }
3496});
3497
3498/**
3499 * The ready event handler and self cleanup method
3500 */
3501function completed() {
3502 document.removeEventListener( "DOMContentLoaded", completed, false );
3503 window.removeEventListener( "load", completed, false );
3504 jQuery.ready();
3505}
3506
3507jQuery.ready.promise = function( obj ) {
3508 if ( !readyList ) {
3509
3510 readyList = jQuery.Deferred();
3511
3512 // Catch cases where $(document).ready() is called after the browser event has already occurred.
3513 // We once tried to use readyState "interactive" here, but it caused issues like the one
3514 // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
3515 if ( document.readyState === "complete" ) {
3516 // Handle it asynchronously to allow scripts the opportunity to delay ready
3517 setTimeout( jQuery.ready );
3518
3519 } else {
3520
3521 // Use the handy event callback
3522 document.addEventListener( "DOMContentLoaded", completed, false );
3523
3524 // A fallback to window.onload, that will always work
3525 window.addEventListener( "load", completed, false );
3526 }
3527 }
3528 return readyList.promise( obj );
3529};
3530
3531// Kick off the DOM ready check even if the user does not
3532jQuery.ready.promise();
3533
3534
3535
3536
3537// Multifunctional method to get and set values of a collection
3538// The value/s can optionally be executed if it's a function
3539var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
3540 var i = 0,
3541 len = elems.length,
3542 bulk = key == null;
3543
3544 // Sets many values
3545 if ( jQuery.type( key ) === "object" ) {
3546 chainable = true;
3547 for ( i in key ) {
3548 jQuery.access( elems, fn, i, key[i], true, emptyGet, raw );
3549 }
3550
3551 // Sets one value
3552 } else if ( value !== undefined ) {
3553 chainable = true;
3554
3555 if ( !jQuery.isFunction( value ) ) {
3556 raw = true;
3557 }
3558
3559 if ( bulk ) {
3560 // Bulk operations run against the entire set
3561 if ( raw ) {
3562 fn.call( elems, value );
3563 fn = null;
3564
3565 // ...except when executing function values
3566 } else {
3567 bulk = fn;
3568 fn = function( elem, key, value ) {
3569 return bulk.call( jQuery( elem ), value );
3570 };
3571 }
3572 }
3573
3574 if ( fn ) {
3575 for ( ; i < len; i++ ) {
3576 fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );
3577 }
3578 }
3579 }
3580
3581 return chainable ?
3582 elems :
3583
3584 // Gets
3585 bulk ?
3586 fn.call( elems ) :
3587 len ? fn( elems[0], key ) : emptyGet;
3588};
3589
3590
3591/**
3592 * Determines whether an object can have data
3593 */
3594jQuery.acceptData = function( owner ) {
3595 // Accepts only:
3596 // - Node
3597 // - Node.ELEMENT_NODE
3598 // - Node.DOCUMENT_NODE
3599 // - Object
3600 // - Any
3601 /* jshint -W018 */
3602 return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
3603};
3604
3605
3606function Data() {
3607 // Support: Android<4,
3608 // Old WebKit does not have Object.preventExtensions/freeze method,
3609 // return new empty object instead with no [[set]] accessor
3610 Object.defineProperty( this.cache = {}, 0, {
3611 get: function() {
3612 return {};
3613 }
3614 });
3615
3616 this.expando = jQuery.expando + Data.uid++;
3617}
3618
3619Data.uid = 1;
3620Data.accepts = jQuery.acceptData;
3621
3622Data.prototype = {
3623 key: function( owner ) {
3624 // We can accept data for non-element nodes in modern browsers,
3625 // but we should not, see #8335.
3626 // Always return the key for a frozen object.
3627 if ( !Data.accepts( owner ) ) {
3628 return 0;
3629 }
3630
3631 var descriptor = {},
3632 // Check if the owner object already has a cache key
3633 unlock = owner[ this.expando ];
3634
3635 // If not, create one
3636 if ( !unlock ) {
3637 unlock = Data.uid++;
3638
3639 // Secure it in a non-enumerable, non-writable property
3640 try {
3641 descriptor[ this.expando ] = { value: unlock };
3642 Object.defineProperties( owner, descriptor );
3643
3644 // Support: Android<4
3645 // Fallback to a less secure definition
3646 } catch ( e ) {
3647 descriptor[ this.expando ] = unlock;
3648 jQuery.extend( owner, descriptor );
3649 }
3650 }
3651
3652 // Ensure the cache object
3653 if ( !this.cache[ unlock ] ) {
3654 this.cache[ unlock ] = {};
3655 }
3656
3657 return unlock;
3658 },
3659 set: function( owner, data, value ) {
3660 var prop,
3661 // There may be an unlock assigned to this node,
3662 // if there is no entry for this "owner", create one inline
3663 // and set the unlock as though an owner entry had always existed
3664 unlock = this.key( owner ),
3665 cache = this.cache[ unlock ];
3666
3667 // Handle: [ owner, key, value ] args
3668 if ( typeof data === "string" ) {
3669 cache[ data ] = value;
3670
3671 // Handle: [ owner, { properties } ] args
3672 } else {
3673 // Fresh assignments by object are shallow copied
3674 if ( jQuery.isEmptyObject( cache ) ) {
3675 jQuery.extend( this.cache[ unlock ], data );
3676 // Otherwise, copy the properties one-by-one to the cache object
3677 } else {
3678 for ( prop in data ) {
3679 cache[ prop ] = data[ prop ];
3680 }
3681 }
3682 }
3683 return cache;
3684 },
3685 get: function( owner, key ) {
3686 // Either a valid cache is found, or will be created.
3687 // New caches will be created and the unlock returned,
3688 // allowing direct access to the newly created
3689 // empty data object. A valid owner object must be provided.
3690 var cache = this.cache[ this.key( owner ) ];
3691
3692 return key === undefined ?
3693 cache : cache[ key ];
3694 },
3695 access: function( owner, key, value ) {
3696 var stored;
3697 // In cases where either:
3698 //
3699 // 1. No key was specified
3700 // 2. A string key was specified, but no value provided
3701 //
3702 // Take the "read" path and allow the get method to determine
3703 // which value to return, respectively either:
3704 //
3705 // 1. The entire cache object
3706 // 2. The data stored at the key
3707 //
3708 if ( key === undefined ||
3709 ((key && typeof key === "string") && value === undefined) ) {
3710
3711 stored = this.get( owner, key );
3712
3713 return stored !== undefined ?
3714 stored : this.get( owner, jQuery.camelCase(key) );
3715 }
3716
3717 // [*]When the key is not a string, or both a key and value
3718 // are specified, set or extend (existing objects) with either:
3719 //
3720 // 1. An object of properties
3721 // 2. A key and value
3722 //
3723 this.set( owner, key, value );
3724
3725 // Since the "set" path can have two possible entry points
3726 // return the expected data based on which path was taken[*]
3727 return value !== undefined ? value : key;
3728 },
3729 remove: function( owner, key ) {
3730 var i, name, camel,
3731 unlock = this.key( owner ),
3732 cache = this.cache[ unlock ];
3733
3734 if ( key === undefined ) {
3735 this.cache[ unlock ] = {};
3736
3737 } else {
3738 // Support array or space separated string of keys
3739 if ( jQuery.isArray( key ) ) {
3740 // If "name" is an array of keys...
3741 // When data is initially created, via ("key", "val") signature,
3742 // keys will be converted to camelCase.
3743 // Since there is no way to tell _how_ a key was added, remove
3744 // both plain key and camelCase key. #12786
3745 // This will only penalize the array argument path.
3746 name = key.concat( key.map( jQuery.camelCase ) );
3747 } else {
3748 camel = jQuery.camelCase( key );
3749 // Try the string as a key before any manipulation
3750 if ( key in cache ) {
3751 name = [ key, camel ];
3752 } else {
3753 // If a key with the spaces exists, use it.
3754 // Otherwise, create an array by matching non-whitespace
3755 name = camel;
3756 name = name in cache ?
3757 [ name ] : ( name.match( rnotwhite ) || [] );
3758 }
3759 }
3760
3761 i = name.length;
3762 while ( i-- ) {
3763 delete cache[ name[ i ] ];
3764 }
3765 }
3766 },
3767 hasData: function( owner ) {
3768 return !jQuery.isEmptyObject(
3769 this.cache[ owner[ this.expando ] ] || {}
3770 );
3771 },
3772 discard: function( owner ) {
3773 if ( owner[ this.expando ] ) {
3774 delete this.cache[ owner[ this.expando ] ];
3775 }
3776 }
3777};
3778var data_priv = new Data();
3779
3780var data_user = new Data();
3781
3782
3783
3784// Implementation Summary
3785//
3786// 1. Enforce API surface and semantic compatibility with 1.9.x branch
3787// 2. Improve the module's maintainability by reducing the storage
3788// paths to a single mechanism.
3789// 3. Use the same single mechanism to support "private" and "user" data.
3790// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
3791// 5. Avoid exposing implementation details on user objects (eg. expando properties)
3792// 6. Provide a clear path for implementation upgrade to WeakMap in 2014
3793
3794var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
3795 rmultiDash = /([A-Z])/g;
3796
3797function dataAttr( elem, key, data ) {
3798 var name;
3799
3800 // If nothing was found internally, try to fetch any
3801 // data from the HTML5 data-* attribute
3802 if ( data === undefined && elem.nodeType === 1 ) {
3803 name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
3804 data = elem.getAttribute( name );
3805
3806 if ( typeof data === "string" ) {
3807 try {
3808 data = data === "true" ? true :
3809 data === "false" ? false :
3810 data === "null" ? null :
3811 // Only convert to a number if it doesn't change the string
3812 +data + "" === data ? +data :
3813 rbrace.test( data ) ? jQuery.parseJSON( data ) :
3814 data;
3815 } catch( e ) {}
3816
3817 // Make sure we set the data so it isn't changed later
3818 data_user.set( elem, key, data );
3819 } else {
3820 data = undefined;
3821 }
3822 }
3823 return data;
3824}
3825
3826jQuery.extend({
3827 hasData: function( elem ) {
3828 return data_user.hasData( elem ) || data_priv.hasData( elem );
3829 },
3830
3831 data: function( elem, name, data ) {
3832 return data_user.access( elem, name, data );
3833 },
3834
3835 removeData: function( elem, name ) {
3836 data_user.remove( elem, name );
3837 },
3838
3839 // TODO: Now that all calls to _data and _removeData have been replaced
3840 // with direct calls to data_priv methods, these can be deprecated.
3841 _data: function( elem, name, data ) {
3842 return data_priv.access( elem, name, data );
3843 },
3844
3845 _removeData: function( elem, name ) {
3846 data_priv.remove( elem, name );
3847 }
3848});
3849
3850jQuery.fn.extend({
3851 data: function( key, value ) {
3852 var i, name, data,
3853 elem = this[ 0 ],
3854 attrs = elem && elem.attributes;
3855
3856 // Gets all values
3857 if ( key === undefined ) {
3858 if ( this.length ) {
3859 data = data_user.get( elem );
3860
3861 if ( elem.nodeType === 1 && !data_priv.get( elem, "hasDataAttrs" ) ) {
3862 i = attrs.length;
3863 while ( i-- ) {
3864
3865 // Support: IE11+
3866 // The attrs elements can be null (#14894)
3867 if ( attrs[ i ] ) {
3868 name = attrs[ i ].name;
3869 if ( name.indexOf( "data-" ) === 0 ) {
3870 name = jQuery.camelCase( name.slice(5) );
3871 dataAttr( elem, name, data[ name ] );
3872 }
3873 }
3874 }
3875 data_priv.set( elem, "hasDataAttrs", true );
3876 }
3877 }
3878
3879 return data;
3880 }
3881
3882 // Sets multiple values
3883 if ( typeof key === "object" ) {
3884 return this.each(function() {
3885 data_user.set( this, key );
3886 });
3887 }
3888
3889 return access( this, function( value ) {
3890 var data,
3891 camelKey = jQuery.camelCase( key );
3892
3893 // The calling jQuery object (element matches) is not empty
3894 // (and therefore has an element appears at this[ 0 ]) and the
3895 // `value` parameter was not undefined. An empty jQuery object
3896 // will result in `undefined` for elem = this[ 0 ] which will
3897 // throw an exception if an attempt to read a data cache is made.
3898 if ( elem && value === undefined ) {
3899 // Attempt to get data from the cache
3900 // with the key as-is
3901 data = data_user.get( elem, key );
3902 if ( data !== undefined ) {
3903 return data;
3904 }
3905
3906 // Attempt to get data from the cache
3907 // with the key camelized
3908 data = data_user.get( elem, camelKey );
3909 if ( data !== undefined ) {
3910 return data;
3911 }
3912
3913 // Attempt to "discover" the data in
3914 // HTML5 custom data-* attrs
3915 data = dataAttr( elem, camelKey, undefined );
3916 if ( data !== undefined ) {
3917 return data;
3918 }
3919
3920 // We tried really hard, but the data doesn't exist.
3921 return;
3922 }
3923
3924 // Set the data...
3925 this.each(function() {
3926 // First, attempt to store a copy or reference of any
3927 // data that might've been store with a camelCased key.
3928 var data = data_user.get( this, camelKey );
3929
3930 // For HTML5 data-* attribute interop, we have to
3931 // store property names with dashes in a camelCase form.
3932 // This might not apply to all properties...*
3933 data_user.set( this, camelKey, value );
3934
3935 // *... In the case of properties that might _actually_
3936 // have dashes, we need to also store a copy of that
3937 // unchanged property.
3938 if ( key.indexOf("-") !== -1 && data !== undefined ) {
3939 data_user.set( this, key, value );
3940 }
3941 });
3942 }, null, value, arguments.length > 1, null, true );
3943 },
3944
3945 removeData: function( key ) {
3946 return this.each(function() {
3947 data_user.remove( this, key );
3948 });
3949 }
3950});
3951
3952
3953jQuery.extend({
3954 queue: function( elem, type, data ) {
3955 var queue;
3956
3957 if ( elem ) {
3958 type = ( type || "fx" ) + "queue";
3959 queue = data_priv.get( elem, type );
3960
3961 // Speed up dequeue by getting out quickly if this is just a lookup
3962 if ( data ) {
3963 if ( !queue || jQuery.isArray( data ) ) {
3964 queue = data_priv.access( elem, type, jQuery.makeArray(data) );
3965 } else {
3966 queue.push( data );
3967 }
3968 }
3969 return queue || [];
3970 }
3971 },
3972
3973 dequeue: function( elem, type ) {
3974 type = type || "fx";
3975
3976 var queue = jQuery.queue( elem, type ),
3977 startLength = queue.length,
3978 fn = queue.shift(),
3979 hooks = jQuery._queueHooks( elem, type ),
3980 next = function() {
3981 jQuery.dequeue( elem, type );
3982 };
3983
3984 // If the fx queue is dequeued, always remove the progress sentinel
3985 if ( fn === "inprogress" ) {
3986 fn = queue.shift();
3987 startLength--;
3988 }
3989
3990 if ( fn ) {
3991
3992 // Add a progress sentinel to prevent the fx queue from being
3993 // automatically dequeued
3994 if ( type === "fx" ) {
3995 queue.unshift( "inprogress" );
3996 }
3997
3998 // Clear up the last queue stop function
3999 delete hooks.stop;
4000 fn.call( elem, next, hooks );
4001 }
4002
4003 if ( !startLength && hooks ) {
4004 hooks.empty.fire();
4005 }
4006 },
4007
4008 // Not public - generate a queueHooks object, or return the current one
4009 _queueHooks: function( elem, type ) {
4010 var key = type + "queueHooks";
4011 return data_priv.get( elem, key ) || data_priv.access( elem, key, {
4012 empty: jQuery.Callbacks("once memory").add(function() {
4013 data_priv.remove( elem, [ type + "queue", key ] );
4014 })
4015 });
4016 }
4017});
4018
4019jQuery.fn.extend({
4020 queue: function( type, data ) {
4021 var setter = 2;
4022
4023 if ( typeof type !== "string" ) {
4024 data = type;
4025 type = "fx";
4026 setter--;
4027 }
4028
4029 if ( arguments.length < setter ) {
4030 return jQuery.queue( this[0], type );
4031 }
4032
4033 return data === undefined ?
4034 this :
4035 this.each(function() {
4036 var queue = jQuery.queue( this, type, data );
4037
4038 // Ensure a hooks for this queue
4039 jQuery._queueHooks( this, type );
4040
4041 if ( type === "fx" && queue[0] !== "inprogress" ) {
4042 jQuery.dequeue( this, type );
4043 }
4044 });
4045 },
4046 dequeue: function( type ) {
4047 return this.each(function() {
4048 jQuery.dequeue( this, type );
4049 });
4050 },
4051 clearQueue: function( type ) {
4052 return this.queue( type || "fx", [] );
4053 },
4054 // Get a promise resolved when queues of a certain type
4055 // are emptied (fx is the type by default)
4056 promise: function( type, obj ) {
4057 var tmp,
4058 count = 1,
4059 defer = jQuery.Deferred(),
4060 elements = this,
4061 i = this.length,
4062 resolve = function() {
4063 if ( !( --count ) ) {
4064 defer.resolveWith( elements, [ elements ] );
4065 }
4066 };
4067
4068 if ( typeof type !== "string" ) {
4069 obj = type;
4070 type = undefined;
4071 }
4072 type = type || "fx";
4073
4074 while ( i-- ) {
4075 tmp = data_priv.get( elements[ i ], type + "queueHooks" );
4076 if ( tmp && tmp.empty ) {
4077 count++;
4078 tmp.empty.add( resolve );
4079 }
4080 }
4081 resolve();
4082 return defer.promise( obj );
4083 }
4084});
4085var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source;
4086
4087var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
4088
4089var isHidden = function( elem, el ) {
4090 // isHidden might be called from jQuery#filter function;
4091 // in that case, element will be second argument
4092 elem = el || elem;
4093 return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
4094 };
4095
4096var rcheckableType = (/^(?:checkbox|radio)$/i);
4097
4098
4099
4100(function() {
4101 var fragment = document.createDocumentFragment(),
4102 div = fragment.appendChild( document.createElement( "div" ) ),
4103 input = document.createElement( "input" );
4104
4105 // Support: Safari<=5.1
4106 // Check state lost if the name is set (#11217)
4107 // Support: Windows Web Apps (WWA)
4108 // `name` and `type` must use .setAttribute for WWA (#14901)
4109 input.setAttribute( "type", "radio" );
4110 input.setAttribute( "checked", "checked" );
4111 input.setAttribute( "name", "t" );
4112
4113 div.appendChild( input );
4114
4115 // Support: Safari<=5.1, Android<4.2
4116 // Older WebKit doesn't clone checked state correctly in fragments
4117 support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
4118
4119 // Support: IE<=11+
4120 // Make sure textarea (and checkbox) defaultValue is properly cloned
4121 div.innerHTML = "<textarea>x</textarea>";
4122 support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
4123})();
4124var strundefined = typeof undefined;
4125
4126
4127
4128support.focusinBubbles = "onfocusin" in window;
4129
4130
4131var
4132 rkeyEvent = /^key/,
4133 rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/,
4134 rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
4135 rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
4136
4137function returnTrue() {
4138 return true;
4139}
4140
4141function returnFalse() {
4142 return false;
4143}
4144
4145function safeActiveElement() {
4146 try {
4147 return document.activeElement;
4148 } catch ( err ) { }
4149}
4150
4151/*
4152 * Helper functions for managing events -- not part of the public interface.
4153 * Props to Dean Edwards' addEvent library for many of the ideas.
4154 */
4155jQuery.event = {
4156
4157 global: {},
4158
4159 add: function( elem, types, handler, data, selector ) {
4160
4161 var handleObjIn, eventHandle, tmp,
4162 events, t, handleObj,
4163 special, handlers, type, namespaces, origType,
4164 elemData = data_priv.get( elem );
4165
4166 // Don't attach events to noData or text/comment nodes (but allow plain objects)
4167 if ( !elemData ) {
4168 return;
4169 }
4170
4171 // Caller can pass in an object of custom data in lieu of the handler
4172 if ( handler.handler ) {
4173 handleObjIn = handler;
4174 handler = handleObjIn.handler;
4175 selector = handleObjIn.selector;
4176 }
4177
4178 // Make sure that the handler has a unique ID, used to find/remove it later
4179 if ( !handler.guid ) {
4180 handler.guid = jQuery.guid++;
4181 }
4182
4183 // Init the element's event structure and main handler, if this is the first
4184 if ( !(events = elemData.events) ) {
4185 events = elemData.events = {};
4186 }
4187 if ( !(eventHandle = elemData.handle) ) {
4188 eventHandle = elemData.handle = function( e ) {
4189 // Discard the second event of a jQuery.event.trigger() and
4190 // when an event is called after a page has unloaded
4191 return typeof jQuery !== strundefined && jQuery.event.triggered !== e.type ?
4192 jQuery.event.dispatch.apply( elem, arguments ) : undefined;
4193 };
4194 }
4195
4196 // Handle multiple events separated by a space
4197 types = ( types || "" ).match( rnotwhite ) || [ "" ];
4198 t = types.length;
4199 while ( t-- ) {
4200 tmp = rtypenamespace.exec( types[t] ) || [];
4201 type = origType = tmp[1];
4202 namespaces = ( tmp[2] || "" ).split( "." ).sort();
4203
4204 // There *must* be a type, no attaching namespace-only handlers
4205 if ( !type ) {
4206 continue;
4207 }
4208
4209 // If event changes its type, use the special event handlers for the changed type
4210 special = jQuery.event.special[ type ] || {};
4211
4212 // If selector defined, determine special event api type, otherwise given type
4213 type = ( selector ? special.delegateType : special.bindType ) || type;
4214
4215 // Update special based on newly reset type
4216 special = jQuery.event.special[ type ] || {};
4217
4218 // handleObj is passed to all event handlers
4219 handleObj = jQuery.extend({
4220 type: type,
4221 origType: origType,
4222 data: data,
4223 handler: handler,
4224 guid: handler.guid,
4225 selector: selector,
4226 needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
4227 namespace: namespaces.join(".")
4228 }, handleObjIn );
4229
4230 // Init the event handler queue if we're the first
4231 if ( !(handlers = events[ type ]) ) {
4232 handlers = events[ type ] = [];
4233 handlers.delegateCount = 0;
4234
4235 // Only use addEventListener if the special events handler returns false
4236 if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
4237 if ( elem.addEventListener ) {
4238 elem.addEventListener( type, eventHandle, false );
4239 }
4240 }
4241 }
4242
4243 if ( special.add ) {
4244 special.add.call( elem, handleObj );
4245
4246 if ( !handleObj.handler.guid ) {
4247 handleObj.handler.guid = handler.guid;
4248 }
4249 }
4250
4251 // Add to the element's handler list, delegates in front
4252 if ( selector ) {
4253 handlers.splice( handlers.delegateCount++, 0, handleObj );
4254 } else {
4255 handlers.push( handleObj );
4256 }
4257
4258 // Keep track of which events have ever been used, for event optimization
4259 jQuery.event.global[ type ] = true;
4260 }
4261
4262 },
4263
4264 // Detach an event or set of events from an element
4265 remove: function( elem, types, handler, selector, mappedTypes ) {
4266
4267 var j, origCount, tmp,
4268 events, t, handleObj,
4269 special, handlers, type, namespaces, origType,
4270 elemData = data_priv.hasData( elem ) && data_priv.get( elem );
4271
4272 if ( !elemData || !(events = elemData.events) ) {
4273 return;
4274 }
4275
4276 // Once for each type.namespace in types; type may be omitted
4277 types = ( types || "" ).match( rnotwhite ) || [ "" ];
4278 t = types.length;
4279 while ( t-- ) {
4280 tmp = rtypenamespace.exec( types[t] ) || [];
4281 type = origType = tmp[1];
4282 namespaces = ( tmp[2] || "" ).split( "." ).sort();
4283
4284 // Unbind all events (on this namespace, if provided) for the element
4285 if ( !type ) {
4286 for ( type in events ) {
4287 jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
4288 }
4289 continue;
4290 }
4291
4292 special = jQuery.event.special[ type ] || {};
4293 type = ( selector ? special.delegateType : special.bindType ) || type;
4294 handlers = events[ type ] || [];
4295 tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" );
4296
4297 // Remove matching events
4298 origCount = j = handlers.length;
4299 while ( j-- ) {
4300 handleObj = handlers[ j ];
4301
4302 if ( ( mappedTypes || origType === handleObj.origType ) &&
4303 ( !handler || handler.guid === handleObj.guid ) &&
4304 ( !tmp || tmp.test( handleObj.namespace ) ) &&
4305 ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
4306 handlers.splice( j, 1 );
4307
4308 if ( handleObj.selector ) {
4309 handlers.delegateCount--;
4310 }
4311 if ( special.remove ) {
4312 special.remove.call( elem, handleObj );
4313 }
4314 }
4315 }
4316
4317 // Remove generic event handler if we removed something and no more handlers exist
4318 // (avoids potential for endless recursion during removal of special event handlers)
4319 if ( origCount && !handlers.length ) {
4320 if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
4321 jQuery.removeEvent( elem, type, elemData.handle );
4322 }
4323
4324 delete events[ type ];
4325 }
4326 }
4327
4328 // Remove the expando if it's no longer used
4329 if ( jQuery.isEmptyObject( events ) ) {
4330 delete elemData.handle;
4331 data_priv.remove( elem, "events" );
4332 }
4333 },
4334
4335 trigger: function( event, data, elem, onlyHandlers ) {
4336
4337 var i, cur, tmp, bubbleType, ontype, handle, special,
4338 eventPath = [ elem || document ],
4339 type = hasOwn.call( event, "type" ) ? event.type : event,
4340 namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : [];
4341
4342 cur = tmp = elem = elem || document;
4343
4344 // Don't do events on text and comment nodes
4345 if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
4346 return;
4347 }
4348
4349 // focus/blur morphs to focusin/out; ensure we're not firing them right now
4350 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
4351 return;
4352 }
4353
4354 if ( type.indexOf(".") >= 0 ) {
4355 // Namespaced trigger; create a regexp to match event type in handle()
4356 namespaces = type.split(".");
4357 type = namespaces.shift();
4358 namespaces.sort();
4359 }
4360 ontype = type.indexOf(":") < 0 && "on" + type;
4361
4362 // Caller can pass in a jQuery.Event object, Object, or just an event type string
4363 event = event[ jQuery.expando ] ?
4364 event :
4365 new jQuery.Event( type, typeof event === "object" && event );
4366
4367 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
4368 event.isTrigger = onlyHandlers ? 2 : 3;
4369 event.namespace = namespaces.join(".");
4370 event.namespace_re = event.namespace ?
4371 new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) :
4372 null;
4373
4374 // Clean up the event in case it is being reused
4375 event.result = undefined;
4376 if ( !event.target ) {
4377 event.target = elem;
4378 }
4379
4380 // Clone any incoming data and prepend the event, creating the handler arg list
4381 data = data == null ?
4382 [ event ] :
4383 jQuery.makeArray( data, [ event ] );
4384
4385 // Allow special events to draw outside the lines
4386 special = jQuery.event.special[ type ] || {};
4387 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
4388 return;
4389 }
4390
4391 // Determine event propagation path in advance, per W3C events spec (#9951)
4392 // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
4393 if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
4394
4395 bubbleType = special.delegateType || type;
4396 if ( !rfocusMorph.test( bubbleType + type ) ) {
4397 cur = cur.parentNode;
4398 }
4399 for ( ; cur; cur = cur.parentNode ) {
4400 eventPath.push( cur );
4401 tmp = cur;
4402 }
4403
4404 // Only add window if we got to document (e.g., not plain obj or detached DOM)
4405 if ( tmp === (elem.ownerDocument || document) ) {
4406 eventPath.push( tmp.defaultView || tmp.parentWindow || window );
4407 }
4408 }
4409
4410 // Fire handlers on the event path
4411 i = 0;
4412 while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) {
4413
4414 event.type = i > 1 ?
4415 bubbleType :
4416 special.bindType || type;
4417
4418 // jQuery handler
4419 handle = ( data_priv.get( cur, "events" ) || {} )[ event.type ] && data_priv.get( cur, "handle" );
4420 if ( handle ) {
4421 handle.apply( cur, data );
4422 }
4423
4424 // Native handler
4425 handle = ontype && cur[ ontype ];
4426 if ( handle && handle.apply && jQuery.acceptData( cur ) ) {
4427 event.result = handle.apply( cur, data );
4428 if ( event.result === false ) {
4429 event.preventDefault();
4430 }
4431 }
4432 }
4433 event.type = type;
4434
4435 // If nobody prevented the default action, do it now
4436 if ( !onlyHandlers && !event.isDefaultPrevented() ) {
4437
4438 if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) &&
4439 jQuery.acceptData( elem ) ) {
4440
4441 // Call a native DOM method on the target with the same name name as the event.
4442 // Don't do default actions on window, that's where global variables be (#6170)
4443 if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) {
4444
4445 // Don't re-trigger an onFOO event when we call its FOO() method
4446 tmp = elem[ ontype ];
4447
4448 if ( tmp ) {
4449 elem[ ontype ] = null;
4450 }
4451
4452 // Prevent re-triggering of the same event, since we already bubbled it above
4453 jQuery.event.triggered = type;
4454 elem[ type ]();
4455 jQuery.event.triggered = undefined;
4456
4457 if ( tmp ) {
4458 elem[ ontype ] = tmp;
4459 }
4460 }
4461 }
4462 }
4463
4464 return event.result;
4465 },
4466
4467 dispatch: function( event ) {
4468
4469 // Make a writable jQuery.Event from the native event object
4470 event = jQuery.event.fix( event );
4471
4472 var i, j, ret, matched, handleObj,
4473 handlerQueue = [],
4474 args = slice.call( arguments ),
4475 handlers = ( data_priv.get( this, "events" ) || {} )[ event.type ] || [],
4476 special = jQuery.event.special[ event.type ] || {};
4477
4478 // Use the fix-ed jQuery.Event rather than the (read-only) native event
4479 args[0] = event;
4480 event.delegateTarget = this;
4481
4482 // Call the preDispatch hook for the mapped type, and let it bail if desired
4483 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
4484 return;
4485 }
4486
4487 // Determine handlers
4488 handlerQueue = jQuery.event.handlers.call( this, event, handlers );
4489
4490 // Run delegates first; they may want to stop propagation beneath us
4491 i = 0;
4492 while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) {
4493 event.currentTarget = matched.elem;
4494
4495 j = 0;
4496 while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) {
4497
4498 // Triggered event must either 1) have no namespace, or 2) have namespace(s)
4499 // a subset or equal to those in the bound event (both can have no namespace).
4500 if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) {
4501
4502 event.handleObj = handleObj;
4503 event.data = handleObj.data;
4504
4505 ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
4506 .apply( matched.elem, args );
4507
4508 if ( ret !== undefined ) {
4509 if ( (event.result = ret) === false ) {
4510 event.preventDefault();
4511 event.stopPropagation();
4512 }
4513 }
4514 }
4515 }
4516 }
4517
4518 // Call the postDispatch hook for the mapped type
4519 if ( special.postDispatch ) {
4520 special.postDispatch.call( this, event );
4521 }
4522
4523 return event.result;
4524 },
4525
4526 handlers: function( event, handlers ) {
4527 var i, matches, sel, handleObj,
4528 handlerQueue = [],
4529 delegateCount = handlers.delegateCount,
4530 cur = event.target;
4531
4532 // Find delegate handlers
4533 // Black-hole SVG <use> instance trees (#13180)
4534 // Avoid non-left-click bubbling in Firefox (#3861)
4535 if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) {
4536
4537 for ( ; cur !== this; cur = cur.parentNode || this ) {
4538
4539 // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
4540 if ( cur.disabled !== true || event.type !== "click" ) {
4541 matches = [];
4542 for ( i = 0; i < delegateCount; i++ ) {
4543 handleObj = handlers[ i ];
4544
4545 // Don't conflict with Object.prototype properties (#13203)
4546 sel = handleObj.selector + " ";
4547
4548 if ( matches[ sel ] === undefined ) {
4549 matches[ sel ] = handleObj.needsContext ?
4550 jQuery( sel, this ).index( cur ) >= 0 :
4551 jQuery.find( sel, this, null, [ cur ] ).length;
4552 }
4553 if ( matches[ sel ] ) {
4554 matches.push( handleObj );
4555 }
4556 }
4557 if ( matches.length ) {
4558 handlerQueue.push({ elem: cur, handlers: matches });
4559 }
4560 }
4561 }
4562 }
4563
4564 // Add the remaining (directly-bound) handlers
4565 if ( delegateCount < handlers.length ) {
4566 handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) });
4567 }
4568
4569 return handlerQueue;
4570 },
4571
4572 // Includes some event props shared by KeyEvent and MouseEvent
4573 props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
4574
4575 fixHooks: {},
4576
4577 keyHooks: {
4578 props: "char charCode key keyCode".split(" "),
4579 filter: function( event, original ) {
4580
4581 // Add which for key events
4582 if ( event.which == null ) {
4583 event.which = original.charCode != null ? original.charCode : original.keyCode;
4584 }
4585
4586 return event;
4587 }
4588 },
4589
4590 mouseHooks: {
4591 props: "button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
4592 filter: function( event, original ) {
4593 var eventDoc, doc, body,
4594 button = original.button;
4595
4596 // Calculate pageX/Y if missing and clientX/Y available
4597 if ( event.pageX == null && original.clientX != null ) {
4598 eventDoc = event.target.ownerDocument || document;
4599 doc = eventDoc.documentElement;
4600 body = eventDoc.body;
4601
4602 event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
4603 event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );
4604 }
4605
4606 // Add which for click: 1 === left; 2 === middle; 3 === right
4607 // Note: button is not normalized, so don't use it
4608 if ( !event.which && button !== undefined ) {
4609 event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
4610 }
4611
4612 return event;
4613 }
4614 },
4615
4616 fix: function( event ) {
4617 if ( event[ jQuery.expando ] ) {
4618 return event;
4619 }
4620
4621 // Create a writable copy of the event object and normalize some properties
4622 var i, prop, copy,
4623 type = event.type,
4624 originalEvent = event,
4625 fixHook = this.fixHooks[ type ];
4626
4627 if ( !fixHook ) {
4628 this.fixHooks[ type ] = fixHook =
4629 rmouseEvent.test( type ) ? this.mouseHooks :
4630 rkeyEvent.test( type ) ? this.keyHooks :
4631 {};
4632 }
4633 copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
4634
4635 event = new jQuery.Event( originalEvent );
4636
4637 i = copy.length;
4638 while ( i-- ) {
4639 prop = copy[ i ];
4640 event[ prop ] = originalEvent[ prop ];
4641 }
4642
4643 // Support: Cordova 2.5 (WebKit) (#13255)
4644 // All events should have a target; Cordova deviceready doesn't
4645 if ( !event.target ) {
4646 event.target = document;
4647 }
4648
4649 // Support: Safari 6.0+, Chrome<28
4650 // Target should not be a text node (#504, #13143)
4651 if ( event.target.nodeType === 3 ) {
4652 event.target = event.target.parentNode;
4653 }
4654
4655 return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
4656 },
4657
4658 special: {
4659 load: {
4660 // Prevent triggered image.load events from bubbling to window.load
4661 noBubble: true
4662 },
4663 focus: {
4664 // Fire native event if possible so blur/focus sequence is correct
4665 trigger: function() {
4666 if ( this !== safeActiveElement() && this.focus ) {
4667 this.focus();
4668 return false;
4669 }
4670 },
4671 delegateType: "focusin"
4672 },
4673 blur: {
4674 trigger: function() {
4675 if ( this === safeActiveElement() && this.blur ) {
4676 this.blur();
4677 return false;
4678 }
4679 },
4680 delegateType: "focusout"
4681 },
4682 click: {
4683 // For checkbox, fire native event so checked state will be right
4684 trigger: function() {
4685 if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) {
4686 this.click();
4687 return false;
4688 }
4689 },
4690
4691 // For cross-browser consistency, don't fire native .click() on links
4692 _default: function( event ) {
4693 return jQuery.nodeName( event.target, "a" );
4694 }
4695 },
4696
4697 beforeunload: {
4698 postDispatch: function( event ) {
4699
4700 // Support: Firefox 20+
4701 // Firefox doesn't alert if the returnValue field is not set.
4702 if ( event.result !== undefined && event.originalEvent ) {
4703 event.originalEvent.returnValue = event.result;
4704 }
4705 }
4706 }
4707 },
4708
4709 simulate: function( type, elem, event, bubble ) {
4710 // Piggyback on a donor event to simulate a different one.
4711 // Fake originalEvent to avoid donor's stopPropagation, but if the
4712 // simulated event prevents default then we do the same on the donor.
4713 var e = jQuery.extend(
4714 new jQuery.Event(),
4715 event,
4716 {
4717 type: type,
4718 isSimulated: true,
4719 originalEvent: {}
4720 }
4721 );
4722 if ( bubble ) {
4723 jQuery.event.trigger( e, null, elem );
4724 } else {
4725 jQuery.event.dispatch.call( elem, e );
4726 }
4727 if ( e.isDefaultPrevented() ) {
4728 event.preventDefault();
4729 }
4730 }
4731};
4732
4733jQuery.removeEvent = function( elem, type, handle ) {
4734 if ( elem.removeEventListener ) {
4735 elem.removeEventListener( type, handle, false );
4736 }
4737};
4738
4739jQuery.Event = function( src, props ) {
4740 // Allow instantiation without the 'new' keyword
4741 if ( !(this instanceof jQuery.Event) ) {
4742 return new jQuery.Event( src, props );
4743 }
4744
4745 // Event object
4746 if ( src && src.type ) {
4747 this.originalEvent = src;
4748 this.type = src.type;
4749
4750 // Events bubbling up the document may have been marked as prevented
4751 // by a handler lower down the tree; reflect the correct value.
4752 this.isDefaultPrevented = src.defaultPrevented ||
4753 src.defaultPrevented === undefined &&
4754 // Support: Android<4.0
4755 src.returnValue === false ?
4756 returnTrue :
4757 returnFalse;
4758
4759 // Event type
4760 } else {
4761 this.type = src;
4762 }
4763
4764 // Put explicitly provided properties onto the event object
4765 if ( props ) {
4766 jQuery.extend( this, props );
4767 }
4768
4769 // Create a timestamp if incoming event doesn't have one
4770 this.timeStamp = src && src.timeStamp || jQuery.now();
4771
4772 // Mark it as fixed
4773 this[ jQuery.expando ] = true;
4774};
4775
4776// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
4777// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
4778jQuery.Event.prototype = {
4779 isDefaultPrevented: returnFalse,
4780 isPropagationStopped: returnFalse,
4781 isImmediatePropagationStopped: returnFalse,
4782
4783 preventDefault: function() {
4784 var e = this.originalEvent;
4785
4786 this.isDefaultPrevented = returnTrue;
4787
4788 if ( e && e.preventDefault ) {
4789 e.preventDefault();
4790 }
4791 },
4792 stopPropagation: function() {
4793 var e = this.originalEvent;
4794
4795 this.isPropagationStopped = returnTrue;
4796
4797 if ( e && e.stopPropagation ) {
4798 e.stopPropagation();
4799 }
4800 },
4801 stopImmediatePropagation: function() {
4802 var e = this.originalEvent;
4803
4804 this.isImmediatePropagationStopped = returnTrue;
4805
4806 if ( e && e.stopImmediatePropagation ) {
4807 e.stopImmediatePropagation();
4808 }
4809
4810 this.stopPropagation();
4811 }
4812};
4813
4814// Create mouseenter/leave events using mouseover/out and event-time checks
4815// Support: Chrome 15+
4816jQuery.each({
4817 mouseenter: "mouseover",
4818 mouseleave: "mouseout",
4819 pointerenter: "pointerover",
4820 pointerleave: "pointerout"
4821}, function( orig, fix ) {
4822 jQuery.event.special[ orig ] = {
4823 delegateType: fix,
4824 bindType: fix,
4825
4826 handle: function( event ) {
4827 var ret,
4828 target = this,
4829 related = event.relatedTarget,
4830 handleObj = event.handleObj;
4831
4832 // For mousenter/leave call the handler if related is outside the target.
4833 // NB: No relatedTarget if the mouse left/entered the browser window
4834 if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
4835 event.type = handleObj.origType;
4836 ret = handleObj.handler.apply( this, arguments );
4837 event.type = fix;
4838 }
4839 return ret;
4840 }
4841 };
4842});
4843
4844// Support: Firefox, Chrome, Safari
4845// Create "bubbling" focus and blur events
4846if ( !support.focusinBubbles ) {
4847 jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
4848
4849 // Attach a single capturing handler on the document while someone wants focusin/focusout
4850 var handler = function( event ) {
4851 jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
4852 };
4853
4854 jQuery.event.special[ fix ] = {
4855 setup: function() {
4856 var doc = this.ownerDocument || this,
4857 attaches = data_priv.access( doc, fix );
4858
4859 if ( !attaches ) {
4860 doc.addEventListener( orig, handler, true );
4861 }
4862 data_priv.access( doc, fix, ( attaches || 0 ) + 1 );
4863 },
4864 teardown: function() {
4865 var doc = this.ownerDocument || this,
4866 attaches = data_priv.access( doc, fix ) - 1;
4867
4868 if ( !attaches ) {
4869 doc.removeEventListener( orig, handler, true );
4870 data_priv.remove( doc, fix );
4871
4872 } else {
4873 data_priv.access( doc, fix, attaches );
4874 }
4875 }
4876 };
4877 });
4878}
4879
4880jQuery.fn.extend({
4881
4882 on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
4883 var origFn, type;
4884
4885 // Types can be a map of types/handlers
4886 if ( typeof types === "object" ) {
4887 // ( types-Object, selector, data )
4888 if ( typeof selector !== "string" ) {
4889 // ( types-Object, data )
4890 data = data || selector;
4891 selector = undefined;
4892 }
4893 for ( type in types ) {
4894 this.on( type, selector, data, types[ type ], one );
4895 }
4896 return this;
4897 }
4898
4899 if ( data == null && fn == null ) {
4900 // ( types, fn )
4901 fn = selector;
4902 data = selector = undefined;
4903 } else if ( fn == null ) {
4904 if ( typeof selector === "string" ) {
4905 // ( types, selector, fn )
4906 fn = data;
4907 data = undefined;
4908 } else {
4909 // ( types, data, fn )
4910 fn = data;
4911 data = selector;
4912 selector = undefined;
4913 }
4914 }
4915 if ( fn === false ) {
4916 fn = returnFalse;
4917 } else if ( !fn ) {
4918 return this;
4919 }
4920
4921 if ( one === 1 ) {
4922 origFn = fn;
4923 fn = function( event ) {
4924 // Can use an empty set, since event contains the info
4925 jQuery().off( event );
4926 return origFn.apply( this, arguments );
4927 };
4928 // Use same guid so caller can remove using origFn
4929 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
4930 }
4931 return this.each( function() {
4932 jQuery.event.add( this, types, fn, data, selector );
4933 });
4934 },
4935 one: function( types, selector, data, fn ) {
4936 return this.on( types, selector, data, fn, 1 );
4937 },
4938 off: function( types, selector, fn ) {
4939 var handleObj, type;
4940 if ( types && types.preventDefault && types.handleObj ) {
4941 // ( event ) dispatched jQuery.Event
4942 handleObj = types.handleObj;
4943 jQuery( types.delegateTarget ).off(
4944 handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
4945 handleObj.selector,
4946 handleObj.handler
4947 );
4948 return this;
4949 }
4950 if ( typeof types === "object" ) {
4951 // ( types-object [, selector] )
4952 for ( type in types ) {
4953 this.off( type, selector, types[ type ] );
4954 }
4955 return this;
4956 }
4957 if ( selector === false || typeof selector === "function" ) {
4958 // ( types [, fn] )
4959 fn = selector;
4960 selector = undefined;
4961 }
4962 if ( fn === false ) {
4963 fn = returnFalse;
4964 }
4965 return this.each(function() {
4966 jQuery.event.remove( this, types, fn, selector );
4967 });
4968 },
4969
4970 trigger: function( type, data ) {
4971 return this.each(function() {
4972 jQuery.event.trigger( type, data, this );
4973 });
4974 },
4975 triggerHandler: function( type, data ) {
4976 var elem = this[0];
4977 if ( elem ) {
4978 return jQuery.event.trigger( type, data, elem, true );
4979 }
4980 }
4981});
4982
4983
4984var
4985 rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
4986 rtagName = /<([\w:]+)/,
4987 rhtml = /<|&#?\w+;/,
4988 rnoInnerhtml = /<(?:script|style|link)/i,
4989 // checked="checked" or checked
4990 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
4991 rscriptType = /^$|\/(?:java|ecma)script/i,
4992 rscriptTypeMasked = /^true\/(.*)/,
4993 rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
4994
4995 // We have to close these tags to support XHTML (#13200)
4996 wrapMap = {
4997
4998 // Support: IE9
4999 option: [ 1, "<select multiple='multiple'>", "</select>" ],
5000
5001 thead: [ 1, "<table>", "</table>" ],
5002 col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
5003 tr: [ 2, "<table><tbody>", "</tbody></table>" ],
5004 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
5005
5006 _default: [ 0, "", "" ]
5007 };
5008
5009// Support: IE9
5010wrapMap.optgroup = wrapMap.option;
5011
5012wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
5013wrapMap.th = wrapMap.td;
5014
5015// Support: 1.x compatibility
5016// Manipulating tables requires a tbody
5017function manipulationTarget( elem, content ) {
5018 return jQuery.nodeName( elem, "table" ) &&
5019 jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ?
5020
5021 elem.getElementsByTagName("tbody")[0] ||
5022 elem.appendChild( elem.ownerDocument.createElement("tbody") ) :
5023 elem;
5024}
5025
5026// Replace/restore the type attribute of script elements for safe DOM manipulation
5027function disableScript( elem ) {
5028 elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type;
5029 return elem;
5030}
5031function restoreScript( elem ) {
5032 var match = rscriptTypeMasked.exec( elem.type );
5033
5034 if ( match ) {
5035 elem.type = match[ 1 ];
5036 } else {
5037 elem.removeAttribute("type");
5038 }
5039
5040 return elem;
5041}
5042
5043// Mark scripts as having already been evaluated
5044function setGlobalEval( elems, refElements ) {
5045 var i = 0,
5046 l = elems.length;
5047
5048 for ( ; i < l; i++ ) {
5049 data_priv.set(
5050 elems[ i ], "globalEval", !refElements || data_priv.get( refElements[ i ], "globalEval" )
5051 );
5052 }
5053}
5054
5055function cloneCopyEvent( src, dest ) {
5056 var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
5057
5058 if ( dest.nodeType !== 1 ) {
5059 return;
5060 }
5061
5062 // 1. Copy private data: events, handlers, etc.
5063 if ( data_priv.hasData( src ) ) {
5064 pdataOld = data_priv.access( src );
5065 pdataCur = data_priv.set( dest, pdataOld );
5066 events = pdataOld.events;
5067
5068 if ( events ) {
5069 delete pdataCur.handle;
5070 pdataCur.events = {};
5071
5072 for ( type in events ) {
5073 for ( i = 0, l = events[ type ].length; i < l; i++ ) {
5074 jQuery.event.add( dest, type, events[ type ][ i ] );
5075 }
5076 }
5077 }
5078 }
5079
5080 // 2. Copy user data
5081 if ( data_user.hasData( src ) ) {
5082 udataOld = data_user.access( src );
5083 udataCur = jQuery.extend( {}, udataOld );
5084
5085 data_user.set( dest, udataCur );
5086 }
5087}
5088
5089function getAll( context, tag ) {
5090 var ret = context.getElementsByTagName ? context.getElementsByTagName( tag || "*" ) :
5091 context.querySelectorAll ? context.querySelectorAll( tag || "*" ) :
5092 [];
5093
5094 return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
5095 jQuery.merge( [ context ], ret ) :
5096 ret;
5097}
5098
5099// Fix IE bugs, see support tests
5100function fixInput( src, dest ) {
5101 var nodeName = dest.nodeName.toLowerCase();
5102
5103 // Fails to persist the checked state of a cloned checkbox or radio button.
5104 if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
5105 dest.checked = src.checked;
5106
5107 // Fails to return the selected option to the default selected state when cloning options
5108 } else if ( nodeName === "input" || nodeName === "textarea" ) {
5109 dest.defaultValue = src.defaultValue;
5110 }
5111}
5112
5113jQuery.extend({
5114 clone: function( elem, dataAndEvents, deepDataAndEvents ) {
5115 var i, l, srcElements, destElements,
5116 clone = elem.cloneNode( true ),
5117 inPage = jQuery.contains( elem.ownerDocument, elem );
5118
5119 // Fix IE cloning issues
5120 if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
5121 !jQuery.isXMLDoc( elem ) ) {
5122
5123 // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
5124 destElements = getAll( clone );
5125 srcElements = getAll( elem );
5126
5127 for ( i = 0, l = srcElements.length; i < l; i++ ) {
5128 fixInput( srcElements[ i ], destElements[ i ] );
5129 }
5130 }
5131
5132 // Copy the events from the original to the clone
5133 if ( dataAndEvents ) {
5134 if ( deepDataAndEvents ) {
5135 srcElements = srcElements || getAll( elem );
5136 destElements = destElements || getAll( clone );
5137
5138 for ( i = 0, l = srcElements.length; i < l; i++ ) {
5139 cloneCopyEvent( srcElements[ i ], destElements[ i ] );
5140 }
5141 } else {
5142 cloneCopyEvent( elem, clone );
5143 }
5144 }
5145
5146 // Preserve script evaluation history
5147 destElements = getAll( clone, "script" );
5148 if ( destElements.length > 0 ) {
5149 setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
5150 }
5151
5152 // Return the cloned set
5153 return clone;
5154 },
5155
5156 buildFragment: function( elems, context, scripts, selection ) {
5157 var elem, tmp, tag, wrap, contains, j,
5158 fragment = context.createDocumentFragment(),
5159 nodes = [],
5160 i = 0,
5161 l = elems.length;
5162
5163 for ( ; i < l; i++ ) {
5164 elem = elems[ i ];
5165
5166 if ( elem || elem === 0 ) {
5167
5168 // Add nodes directly
5169 if ( jQuery.type( elem ) === "object" ) {
5170 // Support: QtWebKit, PhantomJS
5171 // push.apply(_, arraylike) throws on ancient WebKit
5172 jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
5173
5174 // Convert non-html into a text node
5175 } else if ( !rhtml.test( elem ) ) {
5176 nodes.push( context.createTextNode( elem ) );
5177
5178 // Convert html into DOM nodes
5179 } else {
5180 tmp = tmp || fragment.appendChild( context.createElement("div") );
5181
5182 // Deserialize a standard representation
5183 tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
5184 wrap = wrapMap[ tag ] || wrapMap._default;
5185 tmp.innerHTML = wrap[ 1 ] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[ 2 ];
5186
5187 // Descend through wrappers to the right content
5188 j = wrap[ 0 ];
5189 while ( j-- ) {
5190 tmp = tmp.lastChild;
5191 }
5192
5193 // Support: QtWebKit, PhantomJS
5194 // push.apply(_, arraylike) throws on ancient WebKit
5195 jQuery.merge( nodes, tmp.childNodes );
5196
5197 // Remember the top-level container
5198 tmp = fragment.firstChild;
5199
5200 // Ensure the created nodes are orphaned (#12392)
5201 tmp.textContent = "";
5202 }
5203 }
5204 }
5205
5206 // Remove wrapper from fragment
5207 fragment.textContent = "";
5208
5209 i = 0;
5210 while ( (elem = nodes[ i++ ]) ) {
5211
5212 // #4087 - If origin and destination elements are the same, and this is
5213 // that element, do not do anything
5214 if ( selection && jQuery.inArray( elem, selection ) !== -1 ) {
5215 continue;
5216 }
5217
5218 contains = jQuery.contains( elem.ownerDocument, elem );
5219
5220 // Append to fragment
5221 tmp = getAll( fragment.appendChild( elem ), "script" );
5222
5223 // Preserve script evaluation history
5224 if ( contains ) {
5225 setGlobalEval( tmp );
5226 }
5227
5228 // Capture executables
5229 if ( scripts ) {
5230 j = 0;
5231 while ( (elem = tmp[ j++ ]) ) {
5232 if ( rscriptType.test( elem.type || "" ) ) {
5233 scripts.push( elem );
5234 }
5235 }
5236 }
5237 }
5238
5239 return fragment;
5240 },
5241
5242 cleanData: function( elems ) {
5243 var data, elem, type, key,
5244 special = jQuery.event.special,
5245 i = 0;
5246
5247 for ( ; (elem = elems[ i ]) !== undefined; i++ ) {
5248 if ( jQuery.acceptData( elem ) ) {
5249 key = elem[ data_priv.expando ];
5250
5251 if ( key && (data = data_priv.cache[ key ]) ) {
5252 if ( data.events ) {
5253 for ( type in data.events ) {
5254 if ( special[ type ] ) {
5255 jQuery.event.remove( elem, type );
5256
5257 // This is a shortcut to avoid jQuery.event.remove's overhead
5258 } else {
5259 jQuery.removeEvent( elem, type, data.handle );
5260 }
5261 }
5262 }
5263 if ( data_priv.cache[ key ] ) {
5264 // Discard any remaining `private` data
5265 delete data_priv.cache[ key ];
5266 }
5267 }
5268 }
5269 // Discard any remaining `user` data
5270 delete data_user.cache[ elem[ data_user.expando ] ];
5271 }
5272 }
5273});
5274
5275jQuery.fn.extend({
5276 text: function( value ) {
5277 return access( this, function( value ) {
5278 return value === undefined ?
5279 jQuery.text( this ) :
5280 this.empty().each(function() {
5281 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
5282 this.textContent = value;
5283 }
5284 });
5285 }, null, value, arguments.length );
5286 },
5287
5288 append: function() {
5289 return this.domManip( arguments, function( elem ) {
5290 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
5291 var target = manipulationTarget( this, elem );
5292 target.appendChild( elem );
5293 }
5294 });
5295 },
5296
5297 prepend: function() {
5298 return this.domManip( arguments, function( elem ) {
5299 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
5300 var target = manipulationTarget( this, elem );
5301 target.insertBefore( elem, target.firstChild );
5302 }
5303 });
5304 },
5305
5306 before: function() {
5307 return this.domManip( arguments, function( elem ) {
5308 if ( this.parentNode ) {
5309 this.parentNode.insertBefore( elem, this );
5310 }
5311 });
5312 },
5313
5314 after: function() {
5315 return this.domManip( arguments, function( elem ) {
5316 if ( this.parentNode ) {
5317 this.parentNode.insertBefore( elem, this.nextSibling );
5318 }
5319 });
5320 },
5321
5322 remove: function( selector, keepData /* Internal Use Only */ ) {
5323 var elem,
5324 elems = selector ? jQuery.filter( selector, this ) : this,
5325 i = 0;
5326
5327 for ( ; (elem = elems[i]) != null; i++ ) {
5328 if ( !keepData && elem.nodeType === 1 ) {
5329 jQuery.cleanData( getAll( elem ) );
5330 }
5331
5332 if ( elem.parentNode ) {
5333 if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) {
5334 setGlobalEval( getAll( elem, "script" ) );
5335 }
5336 elem.parentNode.removeChild( elem );
5337 }
5338 }
5339
5340 return this;
5341 },
5342
5343 empty: function() {
5344 var elem,
5345 i = 0;
5346
5347 for ( ; (elem = this[i]) != null; i++ ) {
5348 if ( elem.nodeType === 1 ) {
5349
5350 // Prevent memory leaks
5351 jQuery.cleanData( getAll( elem, false ) );
5352
5353 // Remove any remaining nodes
5354 elem.textContent = "";
5355 }
5356 }
5357
5358 return this;
5359 },
5360
5361 clone: function( dataAndEvents, deepDataAndEvents ) {
5362 dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
5363 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
5364
5365 return this.map(function() {
5366 return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
5367 });
5368 },
5369
5370 html: function( value ) {
5371 return access( this, function( value ) {
5372 var elem = this[ 0 ] || {},
5373 i = 0,
5374 l = this.length;
5375
5376 if ( value === undefined && elem.nodeType === 1 ) {
5377 return elem.innerHTML;
5378 }
5379
5380 // See if we can take a shortcut and just use innerHTML
5381 if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
5382 !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
5383
5384 value = value.replace( rxhtmlTag, "<$1></$2>" );
5385
5386 try {
5387 for ( ; i < l; i++ ) {
5388 elem = this[ i ] || {};
5389
5390 // Remove element nodes and prevent memory leaks
5391 if ( elem.nodeType === 1 ) {
5392 jQuery.cleanData( getAll( elem, false ) );
5393 elem.innerHTML = value;
5394 }
5395 }
5396
5397 elem = 0;
5398
5399 // If using innerHTML throws an exception, use the fallback method
5400 } catch( e ) {}
5401 }
5402
5403 if ( elem ) {
5404 this.empty().append( value );
5405 }
5406 }, null, value, arguments.length );
5407 },
5408
5409 replaceWith: function() {
5410 var arg = arguments[ 0 ];
5411
5412 // Make the changes, replacing each context element with the new content
5413 this.domManip( arguments, function( elem ) {
5414 arg = this.parentNode;
5415
5416 jQuery.cleanData( getAll( this ) );
5417
5418 if ( arg ) {
5419 arg.replaceChild( elem, this );
5420 }
5421 });
5422
5423 // Force removal if there was no new content (e.g., from empty arguments)
5424 return arg && (arg.length || arg.nodeType) ? this : this.remove();
5425 },
5426
5427 detach: function( selector ) {
5428 return this.remove( selector, true );
5429 },
5430
5431 domManip: function( args, callback ) {
5432
5433 // Flatten any nested arrays
5434 args = concat.apply( [], args );
5435
5436 var fragment, first, scripts, hasScripts, node, doc,
5437 i = 0,
5438 l = this.length,
5439 set = this,
5440 iNoClone = l - 1,
5441 value = args[ 0 ],
5442 isFunction = jQuery.isFunction( value );
5443
5444 // We can't cloneNode fragments that contain checked, in WebKit
5445 if ( isFunction ||
5446 ( l > 1 && typeof value === "string" &&
5447 !support.checkClone && rchecked.test( value ) ) ) {
5448 return this.each(function( index ) {
5449 var self = set.eq( index );
5450 if ( isFunction ) {
5451 args[ 0 ] = value.call( this, index, self.html() );
5452 }
5453 self.domManip( args, callback );
5454 });
5455 }
5456
5457 if ( l ) {
5458 fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this );
5459 first = fragment.firstChild;
5460
5461 if ( fragment.childNodes.length === 1 ) {
5462 fragment = first;
5463 }
5464
5465 if ( first ) {
5466 scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
5467 hasScripts = scripts.length;
5468
5469 // Use the original fragment for the last item instead of the first because it can end up
5470 // being emptied incorrectly in certain situations (#8070).
5471 for ( ; i < l; i++ ) {
5472 node = fragment;
5473
5474 if ( i !== iNoClone ) {
5475 node = jQuery.clone( node, true, true );
5476
5477 // Keep references to cloned scripts for later restoration
5478 if ( hasScripts ) {
5479 // Support: QtWebKit
5480 // jQuery.merge because push.apply(_, arraylike) throws
5481 jQuery.merge( scripts, getAll( node, "script" ) );
5482 }
5483 }
5484
5485 callback.call( this[ i ], node, i );
5486 }
5487
5488 if ( hasScripts ) {
5489 doc = scripts[ scripts.length - 1 ].ownerDocument;
5490
5491 // Reenable scripts
5492 jQuery.map( scripts, restoreScript );
5493
5494 // Evaluate executable scripts on first document insertion
5495 for ( i = 0; i < hasScripts; i++ ) {
5496 node = scripts[ i ];
5497 if ( rscriptType.test( node.type || "" ) &&
5498 !data_priv.access( node, "globalEval" ) && jQuery.contains( doc, node ) ) {
5499
5500 if ( node.src ) {
5501 // Optional AJAX dependency, but won't run scripts if not present
5502 if ( jQuery._evalUrl ) {
5503 jQuery._evalUrl( node.src );
5504 }
5505 } else {
5506 jQuery.globalEval( node.textContent.replace( rcleanScript, "" ) );
5507 }
5508 }
5509 }
5510 }
5511 }
5512 }
5513
5514 return this;
5515 }
5516});
5517
5518jQuery.each({
5519 appendTo: "append",
5520 prependTo: "prepend",
5521 insertBefore: "before",
5522 insertAfter: "after",
5523 replaceAll: "replaceWith"
5524}, function( name, original ) {
5525 jQuery.fn[ name ] = function( selector ) {
5526 var elems,
5527 ret = [],
5528 insert = jQuery( selector ),
5529 last = insert.length - 1,
5530 i = 0;
5531
5532 for ( ; i <= last; i++ ) {
5533 elems = i === last ? this : this.clone( true );
5534 jQuery( insert[ i ] )[ original ]( elems );
5535
5536 // Support: QtWebKit
5537 // .get() because push.apply(_, arraylike) throws
5538 push.apply( ret, elems.get() );
5539 }
5540
5541 return this.pushStack( ret );
5542 };
5543});
5544
5545
5546var iframe,
5547 elemdisplay = {};
5548
5549/**
5550 * Retrieve the actual display of a element
5551 * @param {String} name nodeName of the element
5552 * @param {Object} doc Document object
5553 */
5554// Called only from within defaultDisplay
5555function actualDisplay( name, doc ) {
5556 var style,
5557 elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
5558
5559 // getDefaultComputedStyle might be reliably used only on attached element
5560 display = window.getDefaultComputedStyle && ( style = window.getDefaultComputedStyle( elem[ 0 ] ) ) ?
5561
5562 // Use of this method is a temporary fix (more like optimization) until something better comes along,
5563 // since it was removed from specification and supported only in FF
5564 style.display : jQuery.css( elem[ 0 ], "display" );
5565
5566 // We don't have any data stored on the element,
5567 // so use "detach" method as fast way to get rid of the element
5568 elem.detach();
5569
5570 return display;
5571}
5572
5573/**
5574 * Try to determine the default display value of an element
5575 * @param {String} nodeName
5576 */
5577function defaultDisplay( nodeName ) {
5578 var doc = document,
5579 display = elemdisplay[ nodeName ];
5580
5581 if ( !display ) {
5582 display = actualDisplay( nodeName, doc );
5583
5584 // If the simple way fails, read from inside an iframe
5585 if ( display === "none" || !display ) {
5586
5587 // Use the already-created iframe if possible
5588 iframe = (iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" )).appendTo( doc.documentElement );
5589
5590 // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
5591 doc = iframe[ 0 ].contentDocument;
5592
5593 // Support: IE
5594 doc.write();
5595 doc.close();
5596
5597 display = actualDisplay( nodeName, doc );
5598 iframe.detach();
5599 }
5600
5601 // Store the correct default display
5602 elemdisplay[ nodeName ] = display;
5603 }
5604
5605 return display;
5606}
5607var rmargin = (/^margin/);
5608
5609var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
5610
5611var getStyles = function( elem ) {
5612 // Support: IE<=11+, Firefox<=30+ (#15098, #14150)
5613 // IE throws on elements created in popups
5614 // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
5615 if ( elem.ownerDocument.defaultView.opener ) {
5616 return elem.ownerDocument.defaultView.getComputedStyle( elem, null );
5617 }
5618
5619 return window.getComputedStyle( elem, null );
5620 };
5621
5622
5623
5624function curCSS( elem, name, computed ) {
5625 var width, minWidth, maxWidth, ret,
5626 style = elem.style;
5627
5628 computed = computed || getStyles( elem );
5629
5630 // Support: IE9
5631 // getPropertyValue is only needed for .css('filter') (#12537)
5632 if ( computed ) {
5633 ret = computed.getPropertyValue( name ) || computed[ name ];
5634 }
5635
5636 if ( computed ) {
5637
5638 if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
5639 ret = jQuery.style( elem, name );
5640 }
5641
5642 // Support: iOS < 6
5643 // A tribute to the "awesome hack by Dean Edwards"
5644 // iOS < 6 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
5645 // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
5646 if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
5647
5648 // Remember the original values
5649 width = style.width;
5650 minWidth = style.minWidth;
5651 maxWidth = style.maxWidth;
5652
5653 // Put in the new values to get a computed value out
5654 style.minWidth = style.maxWidth = style.width = ret;
5655 ret = computed.width;
5656
5657 // Revert the changed values
5658 style.width = width;
5659 style.minWidth = minWidth;
5660 style.maxWidth = maxWidth;
5661 }
5662 }
5663
5664 return ret !== undefined ?
5665 // Support: IE
5666 // IE returns zIndex value as an integer.
5667 ret + "" :
5668 ret;
5669}
5670
5671
5672function addGetHookIf( conditionFn, hookFn ) {
5673 // Define the hook, we'll check on the first run if it's really needed.
5674 return {
5675 get: function() {
5676 if ( conditionFn() ) {
5677 // Hook not needed (or it's not possible to use it due
5678 // to missing dependency), remove it.
5679 delete this.get;
5680 return;
5681 }
5682
5683 // Hook needed; redefine it so that the support test is not executed again.
5684 return (this.get = hookFn).apply( this, arguments );
5685 }
5686 };
5687}
5688
5689
5690(function() {
5691 var pixelPositionVal, boxSizingReliableVal,
5692 docElem = document.documentElement,
5693 container = document.createElement( "div" ),
5694 div = document.createElement( "div" );
5695
5696 if ( !div.style ) {
5697 return;
5698 }
5699
5700 // Support: IE9-11+
5701 // Style of cloned element affects source element cloned (#8908)
5702 div.style.backgroundClip = "content-box";
5703 div.cloneNode( true ).style.backgroundClip = "";
5704 support.clearCloneStyle = div.style.backgroundClip === "content-box";
5705
5706 container.style.cssText = "border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;" +
5707 "position:absolute";
5708 container.appendChild( div );
5709
5710 // Executing both pixelPosition & boxSizingReliable tests require only one layout
5711 // so they're executed at the same time to save the second computation.
5712 function computePixelPositionAndBoxSizingReliable() {
5713 div.style.cssText =
5714 // Support: Firefox<29, Android 2.3
5715 // Vendor-prefix box-sizing
5716 "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;" +
5717 "box-sizing:border-box;display:block;margin-top:1%;top:1%;" +
5718 "border:1px;padding:1px;width:4px;position:absolute";
5719 div.innerHTML = "";
5720 docElem.appendChild( container );
5721
5722 var divStyle = window.getComputedStyle( div, null );
5723 pixelPositionVal = divStyle.top !== "1%";
5724 boxSizingReliableVal = divStyle.width === "4px";
5725
5726 docElem.removeChild( container );
5727 }
5728
5729 // Support: node.js jsdom
5730 // Don't assume that getComputedStyle is a property of the global object
5731 if ( window.getComputedStyle ) {
5732 jQuery.extend( support, {
5733 pixelPosition: function() {
5734
5735 // This test is executed only once but we still do memoizing
5736 // since we can use the boxSizingReliable pre-computing.
5737 // No need to check if the test was already performed, though.
5738 computePixelPositionAndBoxSizingReliable();
5739 return pixelPositionVal;
5740 },
5741 boxSizingReliable: function() {
5742 if ( boxSizingReliableVal == null ) {
5743 computePixelPositionAndBoxSizingReliable();
5744 }
5745 return boxSizingReliableVal;
5746 },
5747 reliableMarginRight: function() {
5748
5749 // Support: Android 2.3
5750 // Check if div with explicit width and no margin-right incorrectly
5751 // gets computed margin-right based on width of container. (#3333)
5752 // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
5753 // This support function is only executed once so no memoizing is needed.
5754 var ret,
5755 marginDiv = div.appendChild( document.createElement( "div" ) );
5756
5757 // Reset CSS: box-sizing; display; margin; border; padding
5758 marginDiv.style.cssText = div.style.cssText =
5759 // Support: Firefox<29, Android 2.3
5760 // Vendor-prefix box-sizing
5761 "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" +
5762 "box-sizing:content-box;display:block;margin:0;border:0;padding:0";
5763 marginDiv.style.marginRight = marginDiv.style.width = "0";
5764 div.style.width = "1px";
5765 docElem.appendChild( container );
5766
5767 ret = !parseFloat( window.getComputedStyle( marginDiv, null ).marginRight );
5768
5769 docElem.removeChild( container );
5770 div.removeChild( marginDiv );
5771
5772 return ret;
5773 }
5774 });
5775 }
5776})();
5777
5778
5779// A method for quickly swapping in/out CSS properties to get correct calculations.
5780jQuery.swap = function( elem, options, callback, args ) {
5781 var ret, name,
5782 old = {};
5783
5784 // Remember the old values, and insert the new ones
5785 for ( name in options ) {
5786 old[ name ] = elem.style[ name ];
5787 elem.style[ name ] = options[ name ];
5788 }
5789
5790 ret = callback.apply( elem, args || [] );
5791
5792 // Revert the old values
5793 for ( name in options ) {
5794 elem.style[ name ] = old[ name ];
5795 }
5796
5797 return ret;
5798};
5799
5800
5801var
5802 // Swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
5803 // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
5804 rdisplayswap = /^(none|table(?!-c[ea]).+)/,
5805 rnumsplit = new RegExp( "^(" + pnum + ")(.*)$", "i" ),
5806 rrelNum = new RegExp( "^([+-])=(" + pnum + ")", "i" ),
5807
5808 cssShow = { position: "absolute", visibility: "hidden", display: "block" },
5809 cssNormalTransform = {
5810 letterSpacing: "0",
5811 fontWeight: "400"
5812 },
5813
5814 cssPrefixes = [ "Webkit", "O", "Moz", "ms" ];
5815
5816// Return a css property mapped to a potentially vendor prefixed property
5817function vendorPropName( style, name ) {
5818
5819 // Shortcut for names that are not vendor prefixed
5820 if ( name in style ) {
5821 return name;
5822 }
5823
5824 // Check for vendor prefixed names
5825 var capName = name[0].toUpperCase() + name.slice(1),
5826 origName = name,
5827 i = cssPrefixes.length;
5828
5829 while ( i-- ) {
5830 name = cssPrefixes[ i ] + capName;
5831 if ( name in style ) {
5832 return name;
5833 }
5834 }
5835
5836 return origName;
5837}
5838
5839function setPositiveNumber( elem, value, subtract ) {
5840 var matches = rnumsplit.exec( value );
5841 return matches ?
5842 // Guard against undefined "subtract", e.g., when used as in cssHooks
5843 Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
5844 value;
5845}
5846
5847function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
5848 var i = extra === ( isBorderBox ? "border" : "content" ) ?
5849 // If we already have the right measurement, avoid augmentation
5850 4 :
5851 // Otherwise initialize for horizontal or vertical properties
5852 name === "width" ? 1 : 0,
5853
5854 val = 0;
5855
5856 for ( ; i < 4; i += 2 ) {
5857 // Both box models exclude margin, so add it if we want it
5858 if ( extra === "margin" ) {
5859 val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
5860 }
5861
5862 if ( isBorderBox ) {
5863 // border-box includes padding, so remove it if we want content
5864 if ( extra === "content" ) {
5865 val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
5866 }
5867
5868 // At this point, extra isn't border nor margin, so remove border
5869 if ( extra !== "margin" ) {
5870 val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
5871 }
5872 } else {
5873 // At this point, extra isn't content, so add padding
5874 val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
5875
5876 // At this point, extra isn't content nor padding, so add border
5877 if ( extra !== "padding" ) {
5878 val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
5879 }
5880 }
5881 }
5882
5883 return val;
5884}
5885
5886function getWidthOrHeight( elem, name, extra ) {
5887
5888 // Start with offset property, which is equivalent to the border-box value
5889 var valueIsBorderBox = true,
5890 val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
5891 styles = getStyles( elem ),
5892 isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
5893
5894 // Some non-html elements return undefined for offsetWidth, so check for null/undefined
5895 // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
5896 // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
5897 if ( val <= 0 || val == null ) {
5898 // Fall back to computed then uncomputed css if necessary
5899 val = curCSS( elem, name, styles );
5900 if ( val < 0 || val == null ) {
5901 val = elem.style[ name ];
5902 }
5903
5904 // Computed unit is not pixels. Stop here and return.
5905 if ( rnumnonpx.test(val) ) {
5906 return val;
5907 }
5908
5909 // Check for style in case a browser which returns unreliable values
5910 // for getComputedStyle silently falls back to the reliable elem.style
5911 valueIsBorderBox = isBorderBox &&
5912 ( support.boxSizingReliable() || val === elem.style[ name ] );
5913
5914 // Normalize "", auto, and prepare for extra
5915 val = parseFloat( val ) || 0;
5916 }
5917
5918 // Use the active box-sizing model to add/subtract irrelevant styles
5919 return ( val +
5920 augmentWidthOrHeight(
5921 elem,
5922 name,
5923 extra || ( isBorderBox ? "border" : "content" ),
5924 valueIsBorderBox,
5925 styles
5926 )
5927 ) + "px";
5928}
5929
5930function showHide( elements, show ) {
5931 var display, elem, hidden,
5932 values = [],
5933 index = 0,
5934 length = elements.length;
5935
5936 for ( ; index < length; index++ ) {
5937 elem = elements[ index ];
5938 if ( !elem.style ) {
5939 continue;
5940 }
5941
5942 values[ index ] = data_priv.get( elem, "olddisplay" );
5943 display = elem.style.display;
5944 if ( show ) {
5945 // Reset the inline display of this element to learn if it is
5946 // being hidden by cascaded rules or not
5947 if ( !values[ index ] && display === "none" ) {
5948 elem.style.display = "";
5949 }
5950
5951 // Set elements which have been overridden with display: none
5952 // in a stylesheet to whatever the default browser style is
5953 // for such an element
5954 if ( elem.style.display === "" && isHidden( elem ) ) {
5955 values[ index ] = data_priv.access( elem, "olddisplay", defaultDisplay(elem.nodeName) );
5956 }
5957 } else {
5958 hidden = isHidden( elem );
5959
5960 if ( display !== "none" || !hidden ) {
5961 data_priv.set( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) );
5962 }
5963 }
5964 }
5965
5966 // Set the display of most of the elements in a second loop
5967 // to avoid the constant reflow
5968 for ( index = 0; index < length; index++ ) {
5969 elem = elements[ index ];
5970 if ( !elem.style ) {
5971 continue;
5972 }
5973 if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
5974 elem.style.display = show ? values[ index ] || "" : "none";
5975 }
5976 }
5977
5978 return elements;
5979}
5980
5981jQuery.extend({
5982
5983 // Add in style property hooks for overriding the default
5984 // behavior of getting and setting a style property
5985 cssHooks: {
5986 opacity: {
5987 get: function( elem, computed ) {
5988 if ( computed ) {
5989
5990 // We should always get a number back from opacity
5991 var ret = curCSS( elem, "opacity" );
5992 return ret === "" ? "1" : ret;
5993 }
5994 }
5995 }
5996 },
5997
5998 // Don't automatically add "px" to these possibly-unitless properties
5999 cssNumber: {
6000 "columnCount": true,
6001 "fillOpacity": true,
6002 "flexGrow": true,
6003 "flexShrink": true,
6004 "fontWeight": true,
6005 "lineHeight": true,
6006 "opacity": true,
6007 "order": true,
6008 "orphans": true,
6009 "widows": true,
6010 "zIndex": true,
6011 "zoom": true
6012 },
6013
6014 // Add in properties whose names you wish to fix before
6015 // setting or getting the value
6016 cssProps: {
6017 "float": "cssFloat"
6018 },
6019
6020 // Get and set the style property on a DOM Node
6021 style: function( elem, name, value, extra ) {
6022
6023 // Don't set styles on text and comment nodes
6024 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
6025 return;
6026 }
6027
6028 // Make sure that we're working with the right name
6029 var ret, type, hooks,
6030 origName = jQuery.camelCase( name ),
6031 style = elem.style;
6032
6033 name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );
6034
6035 // Gets hook for the prefixed version, then unprefixed version
6036 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
6037
6038 // Check if we're setting a value
6039 if ( value !== undefined ) {
6040 type = typeof value;
6041
6042 // Convert "+=" or "-=" to relative numbers (#7345)
6043 if ( type === "string" && (ret = rrelNum.exec( value )) ) {
6044 value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );
6045 // Fixes bug #9237
6046 type = "number";
6047 }
6048
6049 // Make sure that null and NaN values aren't set (#7116)
6050 if ( value == null || value !== value ) {
6051 return;
6052 }
6053
6054 // If a number, add 'px' to the (except for certain CSS properties)
6055 if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
6056 value += "px";
6057 }
6058
6059 // Support: IE9-11+
6060 // background-* props affect original clone's values
6061 if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
6062 style[ name ] = "inherit";
6063 }
6064
6065 // If a hook was provided, use that value, otherwise just set the specified value
6066 if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {
6067 style[ name ] = value;
6068 }
6069
6070 } else {
6071 // If a hook was provided get the non-computed value from there
6072 if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
6073 return ret;
6074 }
6075
6076 // Otherwise just get the value from the style object
6077 return style[ name ];
6078 }
6079 },
6080
6081 css: function( elem, name, extra, styles ) {
6082 var val, num, hooks,
6083 origName = jQuery.camelCase( name );
6084
6085 // Make sure that we're working with the right name
6086 name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );
6087
6088 // Try prefixed name followed by the unprefixed name
6089 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
6090
6091 // If a hook was provided get the computed value from there
6092 if ( hooks && "get" in hooks ) {
6093 val = hooks.get( elem, true, extra );
6094 }
6095
6096 // Otherwise, if a way to get the computed value exists, use that
6097 if ( val === undefined ) {
6098 val = curCSS( elem, name, styles );
6099 }
6100
6101 // Convert "normal" to computed value
6102 if ( val === "normal" && name in cssNormalTransform ) {
6103 val = cssNormalTransform[ name ];
6104 }
6105
6106 // Make numeric if forced or a qualifier was provided and val looks numeric
6107 if ( extra === "" || extra ) {
6108 num = parseFloat( val );
6109 return extra === true || jQuery.isNumeric( num ) ? num || 0 : val;
6110 }
6111 return val;
6112 }
6113});
6114
6115jQuery.each([ "height", "width" ], function( i, name ) {
6116 jQuery.cssHooks[ name ] = {
6117 get: function( elem, computed, extra ) {
6118 if ( computed ) {
6119
6120 // Certain elements can have dimension info if we invisibly show them
6121 // but it must have a current display style that would benefit
6122 return rdisplayswap.test( jQuery.css( elem, "display" ) ) && elem.offsetWidth === 0 ?
6123 jQuery.swap( elem, cssShow, function() {
6124 return getWidthOrHeight( elem, name, extra );
6125 }) :
6126 getWidthOrHeight( elem, name, extra );
6127 }
6128 },
6129
6130 set: function( elem, value, extra ) {
6131 var styles = extra && getStyles( elem );
6132 return setPositiveNumber( elem, value, extra ?
6133 augmentWidthOrHeight(
6134 elem,
6135 name,
6136 extra,
6137 jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
6138 styles
6139 ) : 0
6140 );
6141 }
6142 };
6143});
6144
6145// Support: Android 2.3
6146jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight,
6147 function( elem, computed ) {
6148 if ( computed ) {
6149 return jQuery.swap( elem, { "display": "inline-block" },
6150 curCSS, [ elem, "marginRight" ] );
6151 }
6152 }
6153);
6154
6155// These hooks are used by animate to expand properties
6156jQuery.each({
6157 margin: "",
6158 padding: "",
6159 border: "Width"
6160}, function( prefix, suffix ) {
6161 jQuery.cssHooks[ prefix + suffix ] = {
6162 expand: function( value ) {
6163 var i = 0,
6164 expanded = {},
6165
6166 // Assumes a single number if not a string
6167 parts = typeof value === "string" ? value.split(" ") : [ value ];
6168
6169 for ( ; i < 4; i++ ) {
6170 expanded[ prefix + cssExpand[ i ] + suffix ] =
6171 parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
6172 }
6173
6174 return expanded;
6175 }
6176 };
6177
6178 if ( !rmargin.test( prefix ) ) {
6179 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
6180 }
6181});
6182
6183jQuery.fn.extend({
6184 css: function( name, value ) {
6185 return access( this, function( elem, name, value ) {
6186 var styles, len,
6187 map = {},
6188 i = 0;
6189
6190 if ( jQuery.isArray( name ) ) {
6191 styles = getStyles( elem );
6192 len = name.length;
6193
6194 for ( ; i < len; i++ ) {
6195 map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
6196 }
6197
6198 return map;
6199 }
6200
6201 return value !== undefined ?
6202 jQuery.style( elem, name, value ) :
6203 jQuery.css( elem, name );
6204 }, name, value, arguments.length > 1 );
6205 },
6206 show: function() {
6207 return showHide( this, true );
6208 },
6209 hide: function() {
6210 return showHide( this );
6211 },
6212 toggle: function( state ) {
6213 if ( typeof state === "boolean" ) {
6214 return state ? this.show() : this.hide();
6215 }
6216
6217 return this.each(function() {
6218 if ( isHidden( this ) ) {
6219 jQuery( this ).show();
6220 } else {
6221 jQuery( this ).hide();
6222 }
6223 });
6224 }
6225});
6226
6227
6228function Tween( elem, options, prop, end, easing ) {
6229 return new Tween.prototype.init( elem, options, prop, end, easing );
6230}
6231jQuery.Tween = Tween;
6232
6233Tween.prototype = {
6234 constructor: Tween,
6235 init: function( elem, options, prop, end, easing, unit ) {
6236 this.elem = elem;
6237 this.prop = prop;
6238 this.easing = easing || "swing";
6239 this.options = options;
6240 this.start = this.now = this.cur();
6241 this.end = end;
6242 this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
6243 },
6244 cur: function() {
6245 var hooks = Tween.propHooks[ this.prop ];
6246
6247 return hooks && hooks.get ?
6248 hooks.get( this ) :
6249 Tween.propHooks._default.get( this );
6250 },
6251 run: function( percent ) {
6252 var eased,
6253 hooks = Tween.propHooks[ this.prop ];
6254
6255 if ( this.options.duration ) {
6256 this.pos = eased = jQuery.easing[ this.easing ](
6257 percent, this.options.duration * percent, 0, 1, this.options.duration
6258 );
6259 } else {
6260 this.pos = eased = percent;
6261 }
6262 this.now = ( this.end - this.start ) * eased + this.start;
6263
6264 if ( this.options.step ) {
6265 this.options.step.call( this.elem, this.now, this );
6266 }
6267
6268 if ( hooks && hooks.set ) {
6269 hooks.set( this );
6270 } else {
6271 Tween.propHooks._default.set( this );
6272 }
6273 return this;
6274 }
6275};
6276
6277Tween.prototype.init.prototype = Tween.prototype;
6278
6279Tween.propHooks = {
6280 _default: {
6281 get: function( tween ) {
6282 var result;
6283
6284 if ( tween.elem[ tween.prop ] != null &&
6285 (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
6286 return tween.elem[ tween.prop ];
6287 }
6288
6289 // Passing an empty string as a 3rd parameter to .css will automatically
6290 // attempt a parseFloat and fallback to a string if the parse fails.
6291 // Simple values such as "10px" are parsed to Float;
6292 // complex values such as "rotate(1rad)" are returned as-is.
6293 result = jQuery.css( tween.elem, tween.prop, "" );
6294 // Empty strings, null, undefined and "auto" are converted to 0.
6295 return !result || result === "auto" ? 0 : result;
6296 },
6297 set: function( tween ) {
6298 // Use step hook for back compat.
6299 // Use cssHook if its there.
6300 // Use .style if available and use plain properties where available.
6301 if ( jQuery.fx.step[ tween.prop ] ) {
6302 jQuery.fx.step[ tween.prop ]( tween );
6303 } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
6304 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
6305 } else {
6306 tween.elem[ tween.prop ] = tween.now;
6307 }
6308 }
6309 }
6310};
6311
6312// Support: IE9
6313// Panic based approach to setting things on disconnected nodes
6314Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
6315 set: function( tween ) {
6316 if ( tween.elem.nodeType && tween.elem.parentNode ) {
6317 tween.elem[ tween.prop ] = tween.now;
6318 }
6319 }
6320};
6321
6322jQuery.easing = {
6323 linear: function( p ) {
6324 return p;
6325 },
6326 swing: function( p ) {
6327 return 0.5 - Math.cos( p * Math.PI ) / 2;
6328 }
6329};
6330
6331jQuery.fx = Tween.prototype.init;
6332
6333// Back Compat <1.8 extension point
6334jQuery.fx.step = {};
6335
6336
6337
6338
6339var
6340 fxNow, timerId,
6341 rfxtypes = /^(?:toggle|show|hide)$/,
6342 rfxnum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ),
6343 rrun = /queueHooks$/,
6344 animationPrefilters = [ defaultPrefilter ],
6345 tweeners = {
6346 "*": [ function( prop, value ) {
6347 var tween = this.createTween( prop, value ),
6348 target = tween.cur(),
6349 parts = rfxnum.exec( value ),
6350 unit = parts && parts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
6351
6352 // Starting value computation is required for potential unit mismatches
6353 start = ( jQuery.cssNumber[ prop ] || unit !== "px" && +target ) &&
6354 rfxnum.exec( jQuery.css( tween.elem, prop ) ),
6355 scale = 1,
6356 maxIterations = 20;
6357
6358 if ( start && start[ 3 ] !== unit ) {
6359 // Trust units reported by jQuery.css
6360 unit = unit || start[ 3 ];
6361
6362 // Make sure we update the tween properties later on
6363 parts = parts || [];
6364
6365 // Iteratively approximate from a nonzero starting point
6366 start = +target || 1;
6367
6368 do {
6369 // If previous iteration zeroed out, double until we get *something*.
6370 // Use string for doubling so we don't accidentally see scale as unchanged below
6371 scale = scale || ".5";
6372
6373 // Adjust and apply
6374 start = start / scale;
6375 jQuery.style( tween.elem, prop, start + unit );
6376
6377 // Update scale, tolerating zero or NaN from tween.cur(),
6378 // break the loop if scale is unchanged or perfect, or if we've just had enough
6379 } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );
6380 }
6381
6382 // Update tween properties
6383 if ( parts ) {
6384 start = tween.start = +start || +target || 0;
6385 tween.unit = unit;
6386 // If a +=/-= token was provided, we're doing a relative animation
6387 tween.end = parts[ 1 ] ?
6388 start + ( parts[ 1 ] + 1 ) * parts[ 2 ] :
6389 +parts[ 2 ];
6390 }
6391
6392 return tween;
6393 } ]
6394 };
6395
6396// Animations created synchronously will run synchronously
6397function createFxNow() {
6398 setTimeout(function() {
6399 fxNow = undefined;
6400 });
6401 return ( fxNow = jQuery.now() );
6402}
6403
6404// Generate parameters to create a standard animation
6405function genFx( type, includeWidth ) {
6406 var which,
6407 i = 0,
6408 attrs = { height: type };
6409
6410 // If we include width, step value is 1 to do all cssExpand values,
6411 // otherwise step value is 2 to skip over Left and Right
6412 includeWidth = includeWidth ? 1 : 0;
6413 for ( ; i < 4 ; i += 2 - includeWidth ) {
6414 which = cssExpand[ i ];
6415 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
6416 }
6417
6418 if ( includeWidth ) {
6419 attrs.opacity = attrs.width = type;
6420 }
6421
6422 return attrs;
6423}
6424
6425function createTween( value, prop, animation ) {
6426 var tween,
6427 collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),
6428 index = 0,
6429 length = collection.length;
6430 for ( ; index < length; index++ ) {
6431 if ( (tween = collection[ index ].call( animation, prop, value )) ) {
6432
6433 // We're done with this property
6434 return tween;
6435 }
6436 }
6437}
6438
6439function defaultPrefilter( elem, props, opts ) {
6440 /* jshint validthis: true */
6441 var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay,
6442 anim = this,
6443 orig = {},
6444 style = elem.style,
6445 hidden = elem.nodeType && isHidden( elem ),
6446 dataShow = data_priv.get( elem, "fxshow" );
6447
6448 // Handle queue: false promises
6449 if ( !opts.queue ) {
6450 hooks = jQuery._queueHooks( elem, "fx" );
6451 if ( hooks.unqueued == null ) {
6452 hooks.unqueued = 0;
6453 oldfire = hooks.empty.fire;
6454 hooks.empty.fire = function() {
6455 if ( !hooks.unqueued ) {
6456 oldfire();
6457 }
6458 };
6459 }
6460 hooks.unqueued++;
6461
6462 anim.always(function() {
6463 // Ensure the complete handler is called before this completes
6464 anim.always(function() {
6465 hooks.unqueued--;
6466 if ( !jQuery.queue( elem, "fx" ).length ) {
6467 hooks.empty.fire();
6468 }
6469 });
6470 });
6471 }
6472
6473 // Height/width overflow pass
6474 if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
6475 // Make sure that nothing sneaks out
6476 // Record all 3 overflow attributes because IE9-10 do not
6477 // change the overflow attribute when overflowX and
6478 // overflowY are set to the same value
6479 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
6480
6481 // Set display property to inline-block for height/width
6482 // animations on inline elements that are having width/height animated
6483 display = jQuery.css( elem, "display" );
6484
6485 // Test default display if display is currently "none"
6486 checkDisplay = display === "none" ?
6487 data_priv.get( elem, "olddisplay" ) || defaultDisplay( elem.nodeName ) : display;
6488
6489 if ( checkDisplay === "inline" && jQuery.css( elem, "float" ) === "none" ) {
6490 style.display = "inline-block";
6491 }
6492 }
6493
6494 if ( opts.overflow ) {
6495 style.overflow = "hidden";
6496 anim.always(function() {
6497 style.overflow = opts.overflow[ 0 ];
6498 style.overflowX = opts.overflow[ 1 ];
6499 style.overflowY = opts.overflow[ 2 ];
6500 });
6501 }
6502
6503 // show/hide pass
6504 for ( prop in props ) {
6505 value = props[ prop ];
6506 if ( rfxtypes.exec( value ) ) {
6507 delete props[ prop ];
6508 toggle = toggle || value === "toggle";
6509 if ( value === ( hidden ? "hide" : "show" ) ) {
6510
6511 // If there is dataShow left over from a stopped hide or show and we are going to proceed with show, we should pretend to be hidden
6512 if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
6513 hidden = true;
6514 } else {
6515 continue;
6516 }
6517 }
6518 orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
6519
6520 // Any non-fx value stops us from restoring the original display value
6521 } else {
6522 display = undefined;
6523 }
6524 }
6525
6526 if ( !jQuery.isEmptyObject( orig ) ) {
6527 if ( dataShow ) {
6528 if ( "hidden" in dataShow ) {
6529 hidden = dataShow.hidden;
6530 }
6531 } else {
6532 dataShow = data_priv.access( elem, "fxshow", {} );
6533 }
6534
6535 // Store state if its toggle - enables .stop().toggle() to "reverse"
6536 if ( toggle ) {
6537 dataShow.hidden = !hidden;
6538 }
6539 if ( hidden ) {
6540 jQuery( elem ).show();
6541 } else {
6542 anim.done(function() {
6543 jQuery( elem ).hide();
6544 });
6545 }
6546 anim.done(function() {
6547 var prop;
6548
6549 data_priv.remove( elem, "fxshow" );
6550 for ( prop in orig ) {
6551 jQuery.style( elem, prop, orig[ prop ] );
6552 }
6553 });
6554 for ( prop in orig ) {
6555 tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
6556
6557 if ( !( prop in dataShow ) ) {
6558 dataShow[ prop ] = tween.start;
6559 if ( hidden ) {
6560 tween.end = tween.start;
6561 tween.start = prop === "width" || prop === "height" ? 1 : 0;
6562 }
6563 }
6564 }
6565
6566 // If this is a noop like .hide().hide(), restore an overwritten display value
6567 } else if ( (display === "none" ? defaultDisplay( elem.nodeName ) : display) === "inline" ) {
6568 style.display = display;
6569 }
6570}
6571
6572function propFilter( props, specialEasing ) {
6573 var index, name, easing, value, hooks;
6574
6575 // camelCase, specialEasing and expand cssHook pass
6576 for ( index in props ) {
6577 name = jQuery.camelCase( index );
6578 easing = specialEasing[ name ];
6579 value = props[ index ];
6580 if ( jQuery.isArray( value ) ) {
6581 easing = value[ 1 ];
6582 value = props[ index ] = value[ 0 ];
6583 }
6584
6585 if ( index !== name ) {
6586 props[ name ] = value;
6587 delete props[ index ];
6588 }
6589
6590 hooks = jQuery.cssHooks[ name ];
6591 if ( hooks && "expand" in hooks ) {
6592 value = hooks.expand( value );
6593 delete props[ name ];
6594
6595 // Not quite $.extend, this won't overwrite existing keys.
6596 // Reusing 'index' because we have the correct "name"
6597 for ( index in value ) {
6598 if ( !( index in props ) ) {
6599 props[ index ] = value[ index ];
6600 specialEasing[ index ] = easing;
6601 }
6602 }
6603 } else {
6604 specialEasing[ name ] = easing;
6605 }
6606 }
6607}
6608
6609function Animation( elem, properties, options ) {
6610 var result,
6611 stopped,
6612 index = 0,
6613 length = animationPrefilters.length,
6614 deferred = jQuery.Deferred().always( function() {
6615 // Don't match elem in the :animated selector
6616 delete tick.elem;
6617 }),
6618 tick = function() {
6619 if ( stopped ) {
6620 return false;
6621 }
6622 var currentTime = fxNow || createFxNow(),
6623 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
6624 // Support: Android 2.3
6625 // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
6626 temp = remaining / animation.duration || 0,
6627 percent = 1 - temp,
6628 index = 0,
6629 length = animation.tweens.length;
6630
6631 for ( ; index < length ; index++ ) {
6632 animation.tweens[ index ].run( percent );
6633 }
6634
6635 deferred.notifyWith( elem, [ animation, percent, remaining ]);
6636
6637 if ( percent < 1 && length ) {
6638 return remaining;
6639 } else {
6640 deferred.resolveWith( elem, [ animation ] );
6641 return false;
6642 }
6643 },
6644 animation = deferred.promise({
6645 elem: elem,
6646 props: jQuery.extend( {}, properties ),
6647 opts: jQuery.extend( true, { specialEasing: {} }, options ),
6648 originalProperties: properties,
6649 originalOptions: options,
6650 startTime: fxNow || createFxNow(),
6651 duration: options.duration,
6652 tweens: [],
6653 createTween: function( prop, end ) {
6654 var tween = jQuery.Tween( elem, animation.opts, prop, end,
6655 animation.opts.specialEasing[ prop ] || animation.opts.easing );
6656 animation.tweens.push( tween );
6657 return tween;
6658 },
6659 stop: function( gotoEnd ) {
6660 var index = 0,
6661 // If we are going to the end, we want to run all the tweens
6662 // otherwise we skip this part
6663 length = gotoEnd ? animation.tweens.length : 0;
6664 if ( stopped ) {
6665 return this;
6666 }
6667 stopped = true;
6668 for ( ; index < length ; index++ ) {
6669 animation.tweens[ index ].run( 1 );
6670 }
6671
6672 // Resolve when we played the last frame; otherwise, reject
6673 if ( gotoEnd ) {
6674 deferred.resolveWith( elem, [ animation, gotoEnd ] );
6675 } else {
6676 deferred.rejectWith( elem, [ animation, gotoEnd ] );
6677 }
6678 return this;
6679 }
6680 }),
6681 props = animation.props;
6682
6683 propFilter( props, animation.opts.specialEasing );
6684
6685 for ( ; index < length ; index++ ) {
6686 result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );
6687 if ( result ) {
6688 return result;
6689 }
6690 }
6691
6692 jQuery.map( props, createTween, animation );
6693
6694 if ( jQuery.isFunction( animation.opts.start ) ) {
6695 animation.opts.start.call( elem, animation );
6696 }
6697
6698 jQuery.fx.timer(
6699 jQuery.extend( tick, {
6700 elem: elem,
6701 anim: animation,
6702 queue: animation.opts.queue
6703 })
6704 );
6705
6706 // attach callbacks from options
6707 return animation.progress( animation.opts.progress )
6708 .done( animation.opts.done, animation.opts.complete )
6709 .fail( animation.opts.fail )
6710 .always( animation.opts.always );
6711}
6712
6713jQuery.Animation = jQuery.extend( Animation, {
6714
6715 tweener: function( props, callback ) {
6716 if ( jQuery.isFunction( props ) ) {
6717 callback = props;
6718 props = [ "*" ];
6719 } else {
6720 props = props.split(" ");
6721 }
6722
6723 var prop,
6724 index = 0,
6725 length = props.length;
6726
6727 for ( ; index < length ; index++ ) {
6728 prop = props[ index ];
6729 tweeners[ prop ] = tweeners[ prop ] || [];
6730 tweeners[ prop ].unshift( callback );
6731 }
6732 },
6733
6734 prefilter: function( callback, prepend ) {
6735 if ( prepend ) {
6736 animationPrefilters.unshift( callback );
6737 } else {
6738 animationPrefilters.push( callback );
6739 }
6740 }
6741});
6742
6743jQuery.speed = function( speed, easing, fn ) {
6744 var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
6745 complete: fn || !fn && easing ||
6746 jQuery.isFunction( speed ) && speed,
6747 duration: speed,
6748 easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
6749 };
6750
6751 opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
6752 opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
6753
6754 // Normalize opt.queue - true/undefined/null -> "fx"
6755 if ( opt.queue == null || opt.queue === true ) {
6756 opt.queue = "fx";
6757 }
6758
6759 // Queueing
6760 opt.old = opt.complete;
6761
6762 opt.complete = function() {
6763 if ( jQuery.isFunction( opt.old ) ) {
6764 opt.old.call( this );
6765 }
6766
6767 if ( opt.queue ) {
6768 jQuery.dequeue( this, opt.queue );
6769 }
6770 };
6771
6772 return opt;
6773};
6774
6775jQuery.fn.extend({
6776 fadeTo: function( speed, to, easing, callback ) {
6777
6778 // Show any hidden elements after setting opacity to 0
6779 return this.filter( isHidden ).css( "opacity", 0 ).show()
6780
6781 // Animate to the value specified
6782 .end().animate({ opacity: to }, speed, easing, callback );
6783 },
6784 animate: function( prop, speed, easing, callback ) {
6785 var empty = jQuery.isEmptyObject( prop ),
6786 optall = jQuery.speed( speed, easing, callback ),
6787 doAnimation = function() {
6788 // Operate on a copy of prop so per-property easing won't be lost
6789 var anim = Animation( this, jQuery.extend( {}, prop ), optall );
6790
6791 // Empty animations, or finishing resolves immediately
6792 if ( empty || data_priv.get( this, "finish" ) ) {
6793 anim.stop( true );
6794 }
6795 };
6796 doAnimation.finish = doAnimation;
6797
6798 return empty || optall.queue === false ?
6799 this.each( doAnimation ) :
6800 this.queue( optall.queue, doAnimation );
6801 },
6802 stop: function( type, clearQueue, gotoEnd ) {
6803 var stopQueue = function( hooks ) {
6804 var stop = hooks.stop;
6805 delete hooks.stop;
6806 stop( gotoEnd );
6807 };
6808
6809 if ( typeof type !== "string" ) {
6810 gotoEnd = clearQueue;
6811 clearQueue = type;
6812 type = undefined;
6813 }
6814 if ( clearQueue && type !== false ) {
6815 this.queue( type || "fx", [] );
6816 }
6817
6818 return this.each(function() {
6819 var dequeue = true,
6820 index = type != null && type + "queueHooks",
6821 timers = jQuery.timers,
6822 data = data_priv.get( this );
6823
6824 if ( index ) {
6825 if ( data[ index ] && data[ index ].stop ) {
6826 stopQueue( data[ index ] );
6827 }
6828 } else {
6829 for ( index in data ) {
6830 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
6831 stopQueue( data[ index ] );
6832 }
6833 }
6834 }
6835
6836 for ( index = timers.length; index--; ) {
6837 if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
6838 timers[ index ].anim.stop( gotoEnd );
6839 dequeue = false;
6840 timers.splice( index, 1 );
6841 }
6842 }
6843
6844 // Start the next in the queue if the last step wasn't forced.
6845 // Timers currently will call their complete callbacks, which
6846 // will dequeue but only if they were gotoEnd.
6847 if ( dequeue || !gotoEnd ) {
6848 jQuery.dequeue( this, type );
6849 }
6850 });
6851 },
6852 finish: function( type ) {
6853 if ( type !== false ) {
6854 type = type || "fx";
6855 }
6856 return this.each(function() {
6857 var index,
6858 data = data_priv.get( this ),
6859 queue = data[ type + "queue" ],
6860 hooks = data[ type + "queueHooks" ],
6861 timers = jQuery.timers,
6862 length = queue ? queue.length : 0;
6863
6864 // Enable finishing flag on private data
6865 data.finish = true;
6866
6867 // Empty the queue first
6868 jQuery.queue( this, type, [] );
6869
6870 if ( hooks && hooks.stop ) {
6871 hooks.stop.call( this, true );
6872 }
6873
6874 // Look for any active animations, and finish them
6875 for ( index = timers.length; index--; ) {
6876 if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
6877 timers[ index ].anim.stop( true );
6878 timers.splice( index, 1 );
6879 }
6880 }
6881
6882 // Look for any animations in the old queue and finish them
6883 for ( index = 0; index < length; index++ ) {
6884 if ( queue[ index ] && queue[ index ].finish ) {
6885 queue[ index ].finish.call( this );
6886 }
6887 }
6888
6889 // Turn off finishing flag
6890 delete data.finish;
6891 });
6892 }
6893});
6894
6895jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
6896 var cssFn = jQuery.fn[ name ];
6897 jQuery.fn[ name ] = function( speed, easing, callback ) {
6898 return speed == null || typeof speed === "boolean" ?
6899 cssFn.apply( this, arguments ) :
6900 this.animate( genFx( name, true ), speed, easing, callback );
6901 };
6902});
6903
6904// Generate shortcuts for custom animations
6905jQuery.each({
6906 slideDown: genFx("show"),
6907 slideUp: genFx("hide"),
6908 slideToggle: genFx("toggle"),
6909 fadeIn: { opacity: "show" },
6910 fadeOut: { opacity: "hide" },
6911 fadeToggle: { opacity: "toggle" }
6912}, function( name, props ) {
6913 jQuery.fn[ name ] = function( speed, easing, callback ) {
6914 return this.animate( props, speed, easing, callback );
6915 };
6916});
6917
6918jQuery.timers = [];
6919jQuery.fx.tick = function() {
6920 var timer,
6921 i = 0,
6922 timers = jQuery.timers;
6923
6924 fxNow = jQuery.now();
6925
6926 for ( ; i < timers.length; i++ ) {
6927 timer = timers[ i ];
6928 // Checks the timer has not already been removed
6929 if ( !timer() && timers[ i ] === timer ) {
6930 timers.splice( i--, 1 );
6931 }
6932 }
6933
6934 if ( !timers.length ) {
6935 jQuery.fx.stop();
6936 }
6937 fxNow = undefined;
6938};
6939
6940jQuery.fx.timer = function( timer ) {
6941 jQuery.timers.push( timer );
6942 if ( timer() ) {
6943 jQuery.fx.start();
6944 } else {
6945 jQuery.timers.pop();
6946 }
6947};
6948
6949jQuery.fx.interval = 13;
6950
6951jQuery.fx.start = function() {
6952 if ( !timerId ) {
6953 timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );
6954 }
6955};
6956
6957jQuery.fx.stop = function() {
6958 clearInterval( timerId );
6959 timerId = null;
6960};
6961
6962jQuery.fx.speeds = {
6963 slow: 600,
6964 fast: 200,
6965 // Default speed
6966 _default: 400
6967};
6968
6969
6970// Based off of the plugin by Clint Helfers, with permission.
6971// http://blindsignals.com/index.php/2009/07/jquery-delay/
6972jQuery.fn.delay = function( time, type ) {
6973 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
6974 type = type || "fx";
6975
6976 return this.queue( type, function( next, hooks ) {
6977 var timeout = setTimeout( next, time );
6978 hooks.stop = function() {
6979 clearTimeout( timeout );
6980 };
6981 });
6982};
6983
6984
6985(function() {
6986 var input = document.createElement( "input" ),
6987 select = document.createElement( "select" ),
6988 opt = select.appendChild( document.createElement( "option" ) );
6989
6990 input.type = "checkbox";
6991
6992 // Support: iOS<=5.1, Android<=4.2+
6993 // Default value for a checkbox should be "on"
6994 support.checkOn = input.value !== "";
6995
6996 // Support: IE<=11+
6997 // Must access selectedIndex to make default options select
6998 support.optSelected = opt.selected;
6999
7000 // Support: Android<=2.3
7001 // Options inside disabled selects are incorrectly marked as disabled
7002 select.disabled = true;
7003 support.optDisabled = !opt.disabled;
7004
7005 // Support: IE<=11+
7006 // An input loses its value after becoming a radio
7007 input = document.createElement( "input" );
7008 input.value = "t";
7009 input.type = "radio";
7010 support.radioValue = input.value === "t";
7011})();
7012
7013
7014var nodeHook, boolHook,
7015 attrHandle = jQuery.expr.attrHandle;
7016
7017jQuery.fn.extend({
7018 attr: function( name, value ) {
7019 return access( this, jQuery.attr, name, value, arguments.length > 1 );
7020 },
7021
7022 removeAttr: function( name ) {
7023 return this.each(function() {
7024 jQuery.removeAttr( this, name );
7025 });
7026 }
7027});
7028
7029jQuery.extend({
7030 attr: function( elem, name, value ) {
7031 var hooks, ret,
7032 nType = elem.nodeType;
7033
7034 // don't get/set attributes on text, comment and attribute nodes
7035 if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
7036 return;
7037 }
7038
7039 // Fallback to prop when attributes are not supported
7040 if ( typeof elem.getAttribute === strundefined ) {
7041 return jQuery.prop( elem, name, value );
7042 }
7043
7044 // All attributes are lowercase
7045 // Grab necessary hook if one is defined
7046 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
7047 name = name.toLowerCase();
7048 hooks = jQuery.attrHooks[ name ] ||
7049 ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook );
7050 }
7051
7052 if ( value !== undefined ) {
7053
7054 if ( value === null ) {
7055 jQuery.removeAttr( elem, name );
7056
7057 } else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
7058 return ret;
7059
7060 } else {
7061 elem.setAttribute( name, value + "" );
7062 return value;
7063 }
7064
7065 } else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
7066 return ret;
7067
7068 } else {
7069 ret = jQuery.find.attr( elem, name );
7070
7071 // Non-existent attributes return null, we normalize to undefined
7072 return ret == null ?
7073 undefined :
7074 ret;
7075 }
7076 },
7077
7078 removeAttr: function( elem, value ) {
7079 var name, propName,
7080 i = 0,
7081 attrNames = value && value.match( rnotwhite );
7082
7083 if ( attrNames && elem.nodeType === 1 ) {
7084 while ( (name = attrNames[i++]) ) {
7085 propName = jQuery.propFix[ name ] || name;
7086
7087 // Boolean attributes get special treatment (#10870)
7088 if ( jQuery.expr.match.bool.test( name ) ) {
7089 // Set corresponding property to false
7090 elem[ propName ] = false;
7091 }
7092
7093 elem.removeAttribute( name );
7094 }
7095 }
7096 },
7097
7098 attrHooks: {
7099 type: {
7100 set: function( elem, value ) {
7101 if ( !support.radioValue && value === "radio" &&
7102 jQuery.nodeName( elem, "input" ) ) {
7103 var val = elem.value;
7104 elem.setAttribute( "type", value );
7105 if ( val ) {
7106 elem.value = val;
7107 }
7108 return value;
7109 }
7110 }
7111 }
7112 }
7113});
7114
7115// Hooks for boolean attributes
7116boolHook = {
7117 set: function( elem, value, name ) {
7118 if ( value === false ) {
7119 // Remove boolean attributes when set to false
7120 jQuery.removeAttr( elem, name );
7121 } else {
7122 elem.setAttribute( name, name );
7123 }
7124 return name;
7125 }
7126};
7127jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
7128 var getter = attrHandle[ name ] || jQuery.find.attr;
7129
7130 attrHandle[ name ] = function( elem, name, isXML ) {
7131 var ret, handle;
7132 if ( !isXML ) {
7133 // Avoid an infinite loop by temporarily removing this function from the getter
7134 handle = attrHandle[ name ];
7135 attrHandle[ name ] = ret;
7136 ret = getter( elem, name, isXML ) != null ?
7137 name.toLowerCase() :
7138 null;
7139 attrHandle[ name ] = handle;
7140 }
7141 return ret;
7142 };
7143});
7144
7145
7146
7147
7148var rfocusable = /^(?:input|select|textarea|button)$/i;
7149
7150jQuery.fn.extend({
7151 prop: function( name, value ) {
7152 return access( this, jQuery.prop, name, value, arguments.length > 1 );
7153 },
7154
7155 removeProp: function( name ) {
7156 return this.each(function() {
7157 delete this[ jQuery.propFix[ name ] || name ];
7158 });
7159 }
7160});
7161
7162jQuery.extend({
7163 propFix: {
7164 "for": "htmlFor",
7165 "class": "className"
7166 },
7167
7168 prop: function( elem, name, value ) {
7169 var ret, hooks, notxml,
7170 nType = elem.nodeType;
7171
7172 // Don't get/set properties on text, comment and attribute nodes
7173 if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
7174 return;
7175 }
7176
7177 notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
7178
7179 if ( notxml ) {
7180 // Fix name and attach hooks
7181 name = jQuery.propFix[ name ] || name;
7182 hooks = jQuery.propHooks[ name ];
7183 }
7184
7185 if ( value !== undefined ) {
7186 return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ?
7187 ret :
7188 ( elem[ name ] = value );
7189
7190 } else {
7191 return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ?
7192 ret :
7193 elem[ name ];
7194 }
7195 },
7196
7197 propHooks: {
7198 tabIndex: {
7199 get: function( elem ) {
7200 return elem.hasAttribute( "tabindex" ) || rfocusable.test( elem.nodeName ) || elem.href ?
7201 elem.tabIndex :
7202 -1;
7203 }
7204 }
7205 }
7206});
7207
7208if ( !support.optSelected ) {
7209 jQuery.propHooks.selected = {
7210 get: function( elem ) {
7211 var parent = elem.parentNode;
7212 if ( parent && parent.parentNode ) {
7213 parent.parentNode.selectedIndex;
7214 }
7215 return null;
7216 }
7217 };
7218}
7219
7220jQuery.each([
7221 "tabIndex",
7222 "readOnly",
7223 "maxLength",
7224 "cellSpacing",
7225 "cellPadding",
7226 "rowSpan",
7227 "colSpan",
7228 "useMap",
7229 "frameBorder",
7230 "contentEditable"
7231], function() {
7232 jQuery.propFix[ this.toLowerCase() ] = this;
7233});
7234
7235
7236
7237
7238var rclass = /[\t\r\n\f]/g;
7239
7240jQuery.fn.extend({
7241 addClass: function( value ) {
7242 var classes, elem, cur, clazz, j, finalValue,
7243 proceed = typeof value === "string" && value,
7244 i = 0,
7245 len = this.length;
7246
7247 if ( jQuery.isFunction( value ) ) {
7248 return this.each(function( j ) {
7249 jQuery( this ).addClass( value.call( this, j, this.className ) );
7250 });
7251 }
7252
7253 if ( proceed ) {
7254 // The disjunction here is for better compressibility (see removeClass)
7255 classes = ( value || "" ).match( rnotwhite ) || [];
7256
7257 for ( ; i < len; i++ ) {
7258 elem = this[ i ];
7259 cur = elem.nodeType === 1 && ( elem.className ?
7260 ( " " + elem.className + " " ).replace( rclass, " " ) :
7261 " "
7262 );
7263
7264 if ( cur ) {
7265 j = 0;
7266 while ( (clazz = classes[j++]) ) {
7267 if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
7268 cur += clazz + " ";
7269 }
7270 }
7271
7272 // only assign if different to avoid unneeded rendering.
7273 finalValue = jQuery.trim( cur );
7274 if ( elem.className !== finalValue ) {
7275 elem.className = finalValue;
7276 }
7277 }
7278 }
7279 }
7280
7281 return this;
7282 },
7283
7284 removeClass: function( value ) {
7285 var classes, elem, cur, clazz, j, finalValue,
7286 proceed = arguments.length === 0 || typeof value === "string" && value,
7287 i = 0,
7288 len = this.length;
7289
7290 if ( jQuery.isFunction( value ) ) {
7291 return this.each(function( j ) {
7292 jQuery( this ).removeClass( value.call( this, j, this.className ) );
7293 });
7294 }
7295 if ( proceed ) {
7296 classes = ( value || "" ).match( rnotwhite ) || [];
7297
7298 for ( ; i < len; i++ ) {
7299 elem = this[ i ];
7300 // This expression is here for better compressibility (see addClass)
7301 cur = elem.nodeType === 1 && ( elem.className ?
7302 ( " " + elem.className + " " ).replace( rclass, " " ) :
7303 ""
7304 );
7305
7306 if ( cur ) {
7307 j = 0;
7308 while ( (clazz = classes[j++]) ) {
7309 // Remove *all* instances
7310 while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {
7311 cur = cur.replace( " " + clazz + " ", " " );
7312 }
7313 }
7314
7315 // Only assign if different to avoid unneeded rendering.
7316 finalValue = value ? jQuery.trim( cur ) : "";
7317 if ( elem.className !== finalValue ) {
7318 elem.className = finalValue;
7319 }
7320 }
7321 }
7322 }
7323
7324 return this;
7325 },
7326
7327 toggleClass: function( value, stateVal ) {
7328 var type = typeof value;
7329
7330 if ( typeof stateVal === "boolean" && type === "string" ) {
7331 return stateVal ? this.addClass( value ) : this.removeClass( value );
7332 }
7333
7334 if ( jQuery.isFunction( value ) ) {
7335 return this.each(function( i ) {
7336 jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
7337 });
7338 }
7339
7340 return this.each(function() {
7341 if ( type === "string" ) {
7342 // Toggle individual class names
7343 var className,
7344 i = 0,
7345 self = jQuery( this ),
7346 classNames = value.match( rnotwhite ) || [];
7347
7348 while ( (className = classNames[ i++ ]) ) {
7349 // Check each className given, space separated list
7350 if ( self.hasClass( className ) ) {
7351 self.removeClass( className );
7352 } else {
7353 self.addClass( className );
7354 }
7355 }
7356
7357 // Toggle whole class name
7358 } else if ( type === strundefined || type === "boolean" ) {
7359 if ( this.className ) {
7360 // store className if set
7361 data_priv.set( this, "__className__", this.className );
7362 }
7363
7364 // If the element has a class name or if we're passed `false`,
7365 // then remove the whole classname (if there was one, the above saved it).
7366 // Otherwise bring back whatever was previously saved (if anything),
7367 // falling back to the empty string if nothing was stored.
7368 this.className = this.className || value === false ? "" : data_priv.get( this, "__className__" ) || "";
7369 }
7370 });
7371 },
7372
7373 hasClass: function( selector ) {
7374 var className = " " + selector + " ",
7375 i = 0,
7376 l = this.length;
7377 for ( ; i < l; i++ ) {
7378 if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
7379 return true;
7380 }
7381 }
7382
7383 return false;
7384 }
7385});
7386
7387
7388
7389
7390var rreturn = /\r/g;
7391
7392jQuery.fn.extend({
7393 val: function( value ) {
7394 var hooks, ret, isFunction,
7395 elem = this[0];
7396
7397 if ( !arguments.length ) {
7398 if ( elem ) {
7399 hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
7400
7401 if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
7402 return ret;
7403 }
7404
7405 ret = elem.value;
7406
7407 return typeof ret === "string" ?
7408 // Handle most common string cases
7409 ret.replace(rreturn, "") :
7410 // Handle cases where value is null/undef or number
7411 ret == null ? "" : ret;
7412 }
7413
7414 return;
7415 }
7416
7417 isFunction = jQuery.isFunction( value );
7418
7419 return this.each(function( i ) {
7420 var val;
7421
7422 if ( this.nodeType !== 1 ) {
7423 return;
7424 }
7425
7426 if ( isFunction ) {
7427 val = value.call( this, i, jQuery( this ).val() );
7428 } else {
7429 val = value;
7430 }
7431
7432 // Treat null/undefined as ""; convert numbers to string
7433 if ( val == null ) {
7434 val = "";
7435
7436 } else if ( typeof val === "number" ) {
7437 val += "";
7438
7439 } else if ( jQuery.isArray( val ) ) {
7440 val = jQuery.map( val, function( value ) {
7441 return value == null ? "" : value + "";
7442 });
7443 }
7444
7445 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
7446
7447 // If set returns undefined, fall back to normal setting
7448 if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
7449 this.value = val;
7450 }
7451 });
7452 }
7453});
7454
7455jQuery.extend({
7456 valHooks: {
7457 option: {
7458 get: function( elem ) {
7459 var val = jQuery.find.attr( elem, "value" );
7460 return val != null ?
7461 val :
7462 // Support: IE10-11+
7463 // option.text throws exceptions (#14686, #14858)
7464 jQuery.trim( jQuery.text( elem ) );
7465 }
7466 },
7467 select: {
7468 get: function( elem ) {
7469 var value, option,
7470 options = elem.options,
7471 index = elem.selectedIndex,
7472 one = elem.type === "select-one" || index < 0,
7473 values = one ? null : [],
7474 max = one ? index + 1 : options.length,
7475 i = index < 0 ?
7476 max :
7477 one ? index : 0;
7478
7479 // Loop through all the selected options
7480 for ( ; i < max; i++ ) {
7481 option = options[ i ];
7482
7483 // IE6-9 doesn't update selected after form reset (#2551)
7484 if ( ( option.selected || i === index ) &&
7485 // Don't return options that are disabled or in a disabled optgroup
7486 ( support.optDisabled ? !option.disabled : option.getAttribute( "disabled" ) === null ) &&
7487 ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
7488
7489 // Get the specific value for the option
7490 value = jQuery( option ).val();
7491
7492 // We don't need an array for one selects
7493 if ( one ) {
7494 return value;
7495 }
7496
7497 // Multi-Selects return an array
7498 values.push( value );
7499 }
7500 }
7501
7502 return values;
7503 },
7504
7505 set: function( elem, value ) {
7506 var optionSet, option,
7507 options = elem.options,
7508 values = jQuery.makeArray( value ),
7509 i = options.length;
7510
7511 while ( i-- ) {
7512 option = options[ i ];
7513 if ( (option.selected = jQuery.inArray( option.value, values ) >= 0) ) {
7514 optionSet = true;
7515 }
7516 }
7517
7518 // Force browsers to behave consistently when non-matching value is set
7519 if ( !optionSet ) {
7520 elem.selectedIndex = -1;
7521 }
7522 return values;
7523 }
7524 }
7525 }
7526});
7527
7528// Radios and checkboxes getter/setter
7529jQuery.each([ "radio", "checkbox" ], function() {
7530 jQuery.valHooks[ this ] = {
7531 set: function( elem, value ) {
7532 if ( jQuery.isArray( value ) ) {
7533 return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
7534 }
7535 }
7536 };
7537 if ( !support.checkOn ) {
7538 jQuery.valHooks[ this ].get = function( elem ) {
7539 return elem.getAttribute("value") === null ? "on" : elem.value;
7540 };
7541 }
7542});
7543
7544
7545
7546
7547// Return jQuery for attributes-only inclusion
7548
7549
7550jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
7551 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
7552 "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
7553
7554 // Handle event binding
7555 jQuery.fn[ name ] = function( data, fn ) {
7556 return arguments.length > 0 ?
7557 this.on( name, null, data, fn ) :
7558 this.trigger( name );
7559 };
7560});
7561
7562jQuery.fn.extend({
7563 hover: function( fnOver, fnOut ) {
7564 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
7565 },
7566
7567 bind: function( types, data, fn ) {
7568 return this.on( types, null, data, fn );
7569 },
7570 unbind: function( types, fn ) {
7571 return this.off( types, null, fn );
7572 },
7573
7574 delegate: function( selector, types, data, fn ) {
7575 return this.on( types, selector, data, fn );
7576 },
7577 undelegate: function( selector, types, fn ) {
7578 // ( namespace ) or ( selector, types [, fn] )
7579 return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
7580 }
7581});
7582
7583
7584var nonce = jQuery.now();
7585
7586var rquery = (/\?/);
7587
7588
7589
7590// Support: Android 2.3
7591// Workaround failure to string-cast null input
7592jQuery.parseJSON = function( data ) {
7593 return JSON.parse( data + "" );
7594};
7595
7596
7597// Cross-browser xml parsing
7598jQuery.parseXML = function( data ) {
7599 var xml, tmp;
7600 if ( !data || typeof data !== "string" ) {
7601 return null;
7602 }
7603
7604 // Support: IE9
7605 try {
7606 tmp = new DOMParser();
7607 xml = tmp.parseFromString( data, "text/xml" );
7608 } catch ( e ) {
7609 xml = undefined;
7610 }
7611
7612 if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
7613 jQuery.error( "Invalid XML: " + data );
7614 }
7615 return xml;
7616};
7617
7618
7619var
7620 rhash = /#.*$/,
7621 rts = /([?&])_=[^&]*/,
7622 rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
7623 // #7653, #8125, #8152: local protocol detection
7624 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
7625 rnoContent = /^(?:GET|HEAD)$/,
7626 rprotocol = /^\/\//,
7627 rurl = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,
7628
7629 /* Prefilters
7630 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
7631 * 2) These are called:
7632 * - BEFORE asking for a transport
7633 * - AFTER param serialization (s.data is a string if s.processData is true)
7634 * 3) key is the dataType
7635 * 4) the catchall symbol "*" can be used
7636 * 5) execution will start with transport dataType and THEN continue down to "*" if needed
7637 */
7638 prefilters = {},
7639
7640 /* Transports bindings
7641 * 1) key is the dataType
7642 * 2) the catchall symbol "*" can be used
7643 * 3) selection will start with transport dataType and THEN go to "*" if needed
7644 */
7645 transports = {},
7646
7647 // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
7648 allTypes = "*/".concat( "*" ),
7649
7650 // Document location
7651 ajaxLocation = window.location.href,
7652
7653 // Segment location into parts
7654 ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
7655
7656// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
7657function addToPrefiltersOrTransports( structure ) {
7658
7659 // dataTypeExpression is optional and defaults to "*"
7660 return function( dataTypeExpression, func ) {
7661
7662 if ( typeof dataTypeExpression !== "string" ) {
7663 func = dataTypeExpression;
7664 dataTypeExpression = "*";
7665 }
7666
7667 var dataType,
7668 i = 0,
7669 dataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || [];
7670
7671 if ( jQuery.isFunction( func ) ) {
7672 // For each dataType in the dataTypeExpression
7673 while ( (dataType = dataTypes[i++]) ) {
7674 // Prepend if requested
7675 if ( dataType[0] === "+" ) {
7676 dataType = dataType.slice( 1 ) || "*";
7677 (structure[ dataType ] = structure[ dataType ] || []).unshift( func );
7678
7679 // Otherwise append
7680 } else {
7681 (structure[ dataType ] = structure[ dataType ] || []).push( func );
7682 }
7683 }
7684 }
7685 };
7686}
7687
7688// Base inspection function for prefilters and transports
7689function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
7690
7691 var inspected = {},
7692 seekingTransport = ( structure === transports );
7693
7694 function inspect( dataType ) {
7695 var selected;
7696 inspected[ dataType ] = true;
7697 jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
7698 var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
7699 if ( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
7700 options.dataTypes.unshift( dataTypeOrTransport );
7701 inspect( dataTypeOrTransport );
7702 return false;
7703 } else if ( seekingTransport ) {
7704 return !( selected = dataTypeOrTransport );
7705 }
7706 });
7707 return selected;
7708 }
7709
7710 return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
7711}
7712
7713// A special extend for ajax options
7714// that takes "flat" options (not to be deep extended)
7715// Fixes #9887
7716function ajaxExtend( target, src ) {
7717 var key, deep,
7718 flatOptions = jQuery.ajaxSettings.flatOptions || {};
7719
7720 for ( key in src ) {
7721 if ( src[ key ] !== undefined ) {
7722 ( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];
7723 }
7724 }
7725 if ( deep ) {
7726 jQuery.extend( true, target, deep );
7727 }
7728
7729 return target;
7730}
7731
7732/* Handles responses to an ajax request:
7733 * - finds the right dataType (mediates between content-type and expected dataType)
7734 * - returns the corresponding response
7735 */
7736function ajaxHandleResponses( s, jqXHR, responses ) {
7737
7738 var ct, type, finalDataType, firstDataType,
7739 contents = s.contents,
7740 dataTypes = s.dataTypes;
7741
7742 // Remove auto dataType and get content-type in the process
7743 while ( dataTypes[ 0 ] === "*" ) {
7744 dataTypes.shift();
7745 if ( ct === undefined ) {
7746 ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
7747 }
7748 }
7749
7750 // Check if we're dealing with a known content-type
7751 if ( ct ) {
7752 for ( type in contents ) {
7753 if ( contents[ type ] && contents[ type ].test( ct ) ) {
7754 dataTypes.unshift( type );
7755 break;
7756 }
7757 }
7758 }
7759
7760 // Check to see if we have a response for the expected dataType
7761 if ( dataTypes[ 0 ] in responses ) {
7762 finalDataType = dataTypes[ 0 ];
7763 } else {
7764 // Try convertible dataTypes
7765 for ( type in responses ) {
7766 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
7767 finalDataType = type;
7768 break;
7769 }
7770 if ( !firstDataType ) {
7771 firstDataType = type;
7772 }
7773 }
7774 // Or just use first one
7775 finalDataType = finalDataType || firstDataType;
7776 }
7777
7778 // If we found a dataType
7779 // We add the dataType to the list if needed
7780 // and return the corresponding response
7781 if ( finalDataType ) {
7782 if ( finalDataType !== dataTypes[ 0 ] ) {
7783 dataTypes.unshift( finalDataType );
7784 }
7785 return responses[ finalDataType ];
7786 }
7787}
7788
7789/* Chain conversions given the request and the original response
7790 * Also sets the responseXXX fields on the jqXHR instance
7791 */
7792function ajaxConvert( s, response, jqXHR, isSuccess ) {
7793 var conv2, current, conv, tmp, prev,
7794 converters = {},
7795 // Work with a copy of dataTypes in case we need to modify it for conversion
7796 dataTypes = s.dataTypes.slice();
7797
7798 // Create converters map with lowercased keys
7799 if ( dataTypes[ 1 ] ) {
7800 for ( conv in s.converters ) {
7801 converters[ conv.toLowerCase() ] = s.converters[ conv ];
7802 }
7803 }
7804
7805 current = dataTypes.shift();
7806
7807 // Convert to each sequential dataType
7808 while ( current ) {
7809
7810 if ( s.responseFields[ current ] ) {
7811 jqXHR[ s.responseFields[ current ] ] = response;
7812 }
7813
7814 // Apply the dataFilter if provided
7815 if ( !prev && isSuccess && s.dataFilter ) {
7816 response = s.dataFilter( response, s.dataType );
7817 }
7818
7819 prev = current;
7820 current = dataTypes.shift();
7821
7822 if ( current ) {
7823
7824 // There's only work to do if current dataType is non-auto
7825 if ( current === "*" ) {
7826
7827 current = prev;
7828
7829 // Convert response if prev dataType is non-auto and differs from current
7830 } else if ( prev !== "*" && prev !== current ) {
7831
7832 // Seek a direct converter
7833 conv = converters[ prev + " " + current ] || converters[ "* " + current ];
7834
7835 // If none found, seek a pair
7836 if ( !conv ) {
7837 for ( conv2 in converters ) {
7838
7839 // If conv2 outputs current
7840 tmp = conv2.split( " " );
7841 if ( tmp[ 1 ] === current ) {
7842
7843 // If prev can be converted to accepted input
7844 conv = converters[ prev + " " + tmp[ 0 ] ] ||
7845 converters[ "* " + tmp[ 0 ] ];
7846 if ( conv ) {
7847 // Condense equivalence converters
7848 if ( conv === true ) {
7849 conv = converters[ conv2 ];
7850
7851 // Otherwise, insert the intermediate dataType
7852 } else if ( converters[ conv2 ] !== true ) {
7853 current = tmp[ 0 ];
7854 dataTypes.unshift( tmp[ 1 ] );
7855 }
7856 break;
7857 }
7858 }
7859 }
7860 }
7861
7862 // Apply converter (if not an equivalence)
7863 if ( conv !== true ) {
7864
7865 // Unless errors are allowed to bubble, catch and return them
7866 if ( conv && s[ "throws" ] ) {
7867 response = conv( response );
7868 } else {
7869 try {
7870 response = conv( response );
7871 } catch ( e ) {
7872 return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
7873 }
7874 }
7875 }
7876 }
7877 }
7878 }
7879
7880 return { state: "success", data: response };
7881}
7882
7883jQuery.extend({
7884
7885 // Counter for holding the number of active queries
7886 active: 0,
7887
7888 // Last-Modified header cache for next request
7889 lastModified: {},
7890 etag: {},
7891
7892 ajaxSettings: {
7893 url: ajaxLocation,
7894 type: "GET",
7895 isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
7896 global: true,
7897 processData: true,
7898 async: true,
7899 contentType: "application/x-www-form-urlencoded; charset=UTF-8",
7900 /*
7901 timeout: 0,
7902 data: null,
7903 dataType: null,
7904 username: null,
7905 password: null,
7906 cache: null,
7907 throws: false,
7908 traditional: false,
7909 headers: {},
7910 */
7911
7912 accepts: {
7913 "*": allTypes,
7914 text: "text/plain",
7915 html: "text/html",
7916 xml: "application/xml, text/xml",
7917 json: "application/json, text/javascript"
7918 },
7919
7920 contents: {
7921 xml: /xml/,
7922 html: /html/,
7923 json: /json/
7924 },
7925
7926 responseFields: {
7927 xml: "responseXML",
7928 text: "responseText",
7929 json: "responseJSON"
7930 },
7931
7932 // Data converters
7933 // Keys separate source (or catchall "*") and destination types with a single space
7934 converters: {
7935
7936 // Convert anything to text
7937 "* text": String,
7938
7939 // Text to html (true = no transformation)
7940 "text html": true,
7941
7942 // Evaluate text as a json expression
7943 "text json": jQuery.parseJSON,
7944
7945 // Parse text as xml
7946 "text xml": jQuery.parseXML
7947 },
7948
7949 // For options that shouldn't be deep extended:
7950 // you can add your own custom options here if
7951 // and when you create one that shouldn't be
7952 // deep extended (see ajaxExtend)
7953 flatOptions: {
7954 url: true,
7955 context: true
7956 }
7957 },
7958
7959 // Creates a full fledged settings object into target
7960 // with both ajaxSettings and settings fields.
7961 // If target is omitted, writes into ajaxSettings.
7962 ajaxSetup: function( target, settings ) {
7963 return settings ?
7964
7965 // Building a settings object
7966 ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
7967
7968 // Extending ajaxSettings
7969 ajaxExtend( jQuery.ajaxSettings, target );
7970 },
7971
7972 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
7973 ajaxTransport: addToPrefiltersOrTransports( transports ),
7974
7975 // Main method
7976 ajax: function( url, options ) {
7977
7978 // If url is an object, simulate pre-1.5 signature
7979 if ( typeof url === "object" ) {
7980 options = url;
7981 url = undefined;
7982 }
7983
7984 // Force options to be an object
7985 options = options || {};
7986
7987 var transport,
7988 // URL without anti-cache param
7989 cacheURL,
7990 // Response headers
7991 responseHeadersString,
7992 responseHeaders,
7993 // timeout handle
7994 timeoutTimer,
7995 // Cross-domain detection vars
7996 parts,
7997 // To know if global events are to be dispatched
7998 fireGlobals,
7999 // Loop variable
8000 i,
8001 // Create the final options object
8002 s = jQuery.ajaxSetup( {}, options ),
8003 // Callbacks context
8004 callbackContext = s.context || s,
8005 // Context for global events is callbackContext if it is a DOM node or jQuery collection
8006 globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ?
8007 jQuery( callbackContext ) :
8008 jQuery.event,
8009 // Deferreds
8010 deferred = jQuery.Deferred(),
8011 completeDeferred = jQuery.Callbacks("once memory"),
8012 // Status-dependent callbacks
8013 statusCode = s.statusCode || {},
8014 // Headers (they are sent all at once)
8015 requestHeaders = {},
8016 requestHeadersNames = {},
8017 // The jqXHR state
8018 state = 0,
8019 // Default abort message
8020 strAbort = "canceled",
8021 // Fake xhr
8022 jqXHR = {
8023 readyState: 0,
8024
8025 // Builds headers hashtable if needed
8026 getResponseHeader: function( key ) {
8027 var match;
8028 if ( state === 2 ) {
8029 if ( !responseHeaders ) {
8030 responseHeaders = {};
8031 while ( (match = rheaders.exec( responseHeadersString )) ) {
8032 responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
8033 }
8034 }
8035 match = responseHeaders[ key.toLowerCase() ];
8036 }
8037 return match == null ? null : match;
8038 },
8039
8040 // Raw string
8041 getAllResponseHeaders: function() {
8042 return state === 2 ? responseHeadersString : null;
8043 },
8044
8045 // Caches the header
8046 setRequestHeader: function( name, value ) {
8047 var lname = name.toLowerCase();
8048 if ( !state ) {
8049 name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
8050 requestHeaders[ name ] = value;
8051 }
8052 return this;
8053 },
8054
8055 // Overrides response content-type header
8056 overrideMimeType: function( type ) {
8057 if ( !state ) {
8058 s.mimeType = type;
8059 }
8060 return this;
8061 },
8062
8063 // Status-dependent callbacks
8064 statusCode: function( map ) {
8065 var code;
8066 if ( map ) {
8067 if ( state < 2 ) {
8068 for ( code in map ) {
8069 // Lazy-add the new callback in a way that preserves old ones
8070 statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
8071 }
8072 } else {
8073 // Execute the appropriate callbacks
8074 jqXHR.always( map[ jqXHR.status ] );
8075 }
8076 }
8077 return this;
8078 },
8079
8080 // Cancel the request
8081 abort: function( statusText ) {
8082 var finalText = statusText || strAbort;
8083 if ( transport ) {
8084 transport.abort( finalText );
8085 }
8086 done( 0, finalText );
8087 return this;
8088 }
8089 };
8090
8091 // Attach deferreds
8092 deferred.promise( jqXHR ).complete = completeDeferred.add;
8093 jqXHR.success = jqXHR.done;
8094 jqXHR.error = jqXHR.fail;
8095
8096 // Remove hash character (#7531: and string promotion)
8097 // Add protocol if not provided (prefilters might expect it)
8098 // Handle falsy url in the settings object (#10093: consistency with old signature)
8099 // We also use the url parameter if available
8100 s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" )
8101 .replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
8102
8103 // Alias method option to type as per ticket #12004
8104 s.type = options.method || options.type || s.method || s.type;
8105
8106 // Extract dataTypes list
8107 s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ];
8108
8109 // A cross-domain request is in order when we have a protocol:host:port mismatch
8110 if ( s.crossDomain == null ) {
8111 parts = rurl.exec( s.url.toLowerCase() );
8112 s.crossDomain = !!( parts &&
8113 ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
8114 ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !==
8115 ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) )
8116 );
8117 }
8118
8119 // Convert data if not already a string
8120 if ( s.data && s.processData && typeof s.data !== "string" ) {
8121 s.data = jQuery.param( s.data, s.traditional );
8122 }
8123
8124 // Apply prefilters
8125 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
8126
8127 // If request was aborted inside a prefilter, stop there
8128 if ( state === 2 ) {
8129 return jqXHR;
8130 }
8131
8132 // We can fire global events as of now if asked to
8133 // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
8134 fireGlobals = jQuery.event && s.global;
8135
8136 // Watch for a new set of requests
8137 if ( fireGlobals && jQuery.active++ === 0 ) {
8138 jQuery.event.trigger("ajaxStart");
8139 }
8140
8141 // Uppercase the type
8142 s.type = s.type.toUpperCase();
8143
8144 // Determine if request has content
8145 s.hasContent = !rnoContent.test( s.type );
8146
8147 // Save the URL in case we're toying with the If-Modified-Since
8148 // and/or If-None-Match header later on
8149 cacheURL = s.url;
8150
8151 // More options handling for requests with no content
8152 if ( !s.hasContent ) {
8153
8154 // If data is available, append data to url
8155 if ( s.data ) {
8156 cacheURL = ( s.url += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
8157 // #9682: remove data so that it's not used in an eventual retry
8158 delete s.data;
8159 }
8160
8161 // Add anti-cache in url if needed
8162 if ( s.cache === false ) {
8163 s.url = rts.test( cacheURL ) ?
8164
8165 // If there is already a '_' parameter, set its value
8166 cacheURL.replace( rts, "$1_=" + nonce++ ) :
8167
8168 // Otherwise add one to the end
8169 cacheURL + ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + nonce++;
8170 }
8171 }
8172
8173 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
8174 if ( s.ifModified ) {
8175 if ( jQuery.lastModified[ cacheURL ] ) {
8176 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
8177 }
8178 if ( jQuery.etag[ cacheURL ] ) {
8179 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
8180 }
8181 }
8182
8183 // Set the correct header, if data is being sent
8184 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
8185 jqXHR.setRequestHeader( "Content-Type", s.contentType );
8186 }
8187
8188 // Set the Accepts header for the server, depending on the dataType
8189 jqXHR.setRequestHeader(
8190 "Accept",
8191 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
8192 s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
8193 s.accepts[ "*" ]
8194 );
8195
8196 // Check for headers option
8197 for ( i in s.headers ) {
8198 jqXHR.setRequestHeader( i, s.headers[ i ] );
8199 }
8200
8201 // Allow custom headers/mimetypes and early abort
8202 if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
8203 // Abort if not done already and return
8204 return jqXHR.abort();
8205 }
8206
8207 // Aborting is no longer a cancellation
8208 strAbort = "abort";
8209
8210 // Install callbacks on deferreds
8211 for ( i in { success: 1, error: 1, complete: 1 } ) {
8212 jqXHR[ i ]( s[ i ] );
8213 }
8214
8215 // Get transport
8216 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
8217
8218 // If no transport, we auto-abort
8219 if ( !transport ) {
8220 done( -1, "No Transport" );
8221 } else {
8222 jqXHR.readyState = 1;
8223
8224 // Send global event
8225 if ( fireGlobals ) {
8226 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
8227 }
8228 // Timeout
8229 if ( s.async && s.timeout > 0 ) {
8230 timeoutTimer = setTimeout(function() {
8231 jqXHR.abort("timeout");
8232 }, s.timeout );
8233 }
8234
8235 try {
8236 state = 1;
8237 transport.send( requestHeaders, done );
8238 } catch ( e ) {
8239 // Propagate exception as error if not done
8240 if ( state < 2 ) {
8241 done( -1, e );
8242 // Simply rethrow otherwise
8243 } else {
8244 throw e;
8245 }
8246 }
8247 }
8248
8249 // Callback for when everything is done
8250 function done( status, nativeStatusText, responses, headers ) {
8251 var isSuccess, success, error, response, modified,
8252 statusText = nativeStatusText;
8253
8254 // Called once
8255 if ( state === 2 ) {
8256 return;
8257 }
8258
8259 // State is "done" now
8260 state = 2;
8261
8262 // Clear timeout if it exists
8263 if ( timeoutTimer ) {
8264 clearTimeout( timeoutTimer );
8265 }
8266
8267 // Dereference transport for early garbage collection
8268 // (no matter how long the jqXHR object will be used)
8269 transport = undefined;
8270
8271 // Cache response headers
8272 responseHeadersString = headers || "";
8273
8274 // Set readyState
8275 jqXHR.readyState = status > 0 ? 4 : 0;
8276
8277 // Determine if successful
8278 isSuccess = status >= 200 && status < 300 || status === 304;
8279
8280 // Get response data
8281 if ( responses ) {
8282 response = ajaxHandleResponses( s, jqXHR, responses );
8283 }
8284
8285 // Convert no matter what (that way responseXXX fields are always set)
8286 response = ajaxConvert( s, response, jqXHR, isSuccess );
8287
8288 // If successful, handle type chaining
8289 if ( isSuccess ) {
8290
8291 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
8292 if ( s.ifModified ) {
8293 modified = jqXHR.getResponseHeader("Last-Modified");
8294 if ( modified ) {
8295 jQuery.lastModified[ cacheURL ] = modified;
8296 }
8297 modified = jqXHR.getResponseHeader("etag");
8298 if ( modified ) {
8299 jQuery.etag[ cacheURL ] = modified;
8300 }
8301 }
8302
8303 // if no content
8304 if ( status === 204 || s.type === "HEAD" ) {
8305 statusText = "nocontent";
8306
8307 // if not modified
8308 } else if ( status === 304 ) {
8309 statusText = "notmodified";
8310
8311 // If we have data, let's convert it
8312 } else {
8313 statusText = response.state;
8314 success = response.data;
8315 error = response.error;
8316 isSuccess = !error;
8317 }
8318 } else {
8319 // Extract error from statusText and normalize for non-aborts
8320 error = statusText;
8321 if ( status || !statusText ) {
8322 statusText = "error";
8323 if ( status < 0 ) {
8324 status = 0;
8325 }
8326 }
8327 }
8328
8329 // Set data for the fake xhr object
8330 jqXHR.status = status;
8331 jqXHR.statusText = ( nativeStatusText || statusText ) + "";
8332
8333 // Success/Error
8334 if ( isSuccess ) {
8335 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
8336 } else {
8337 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
8338 }
8339
8340 // Status-dependent callbacks
8341 jqXHR.statusCode( statusCode );
8342 statusCode = undefined;
8343
8344 if ( fireGlobals ) {
8345 globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
8346 [ jqXHR, s, isSuccess ? success : error ] );
8347 }
8348
8349 // Complete
8350 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
8351
8352 if ( fireGlobals ) {
8353 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
8354 // Handle the global AJAX counter
8355 if ( !( --jQuery.active ) ) {
8356 jQuery.event.trigger("ajaxStop");
8357 }
8358 }
8359 }
8360
8361 return jqXHR;
8362 },
8363
8364 getJSON: function( url, data, callback ) {
8365 return jQuery.get( url, data, callback, "json" );
8366 },
8367
8368 getScript: function( url, callback ) {
8369 return jQuery.get( url, undefined, callback, "script" );
8370 }
8371});
8372
8373jQuery.each( [ "get", "post" ], function( i, method ) {
8374 jQuery[ method ] = function( url, data, callback, type ) {
8375 // Shift arguments if data argument was omitted
8376 if ( jQuery.isFunction( data ) ) {
8377 type = type || callback;
8378 callback = data;
8379 data = undefined;
8380 }
8381
8382 return jQuery.ajax({
8383 url: url,
8384 type: method,
8385 dataType: type,
8386 data: data,
8387 success: callback
8388 });
8389 };
8390});
8391
8392
8393jQuery._evalUrl = function( url ) {
8394 return jQuery.ajax({
8395 url: url,
8396 type: "GET",
8397 dataType: "script",
8398 async: false,
8399 global: false,
8400 "throws": true
8401 });
8402};
8403
8404
8405jQuery.fn.extend({
8406 wrapAll: function( html ) {
8407 var wrap;
8408
8409 if ( jQuery.isFunction( html ) ) {
8410 return this.each(function( i ) {
8411 jQuery( this ).wrapAll( html.call(this, i) );
8412 });
8413 }
8414
8415 if ( this[ 0 ] ) {
8416
8417 // The elements to wrap the target around
8418 wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
8419
8420 if ( this[ 0 ].parentNode ) {
8421 wrap.insertBefore( this[ 0 ] );
8422 }
8423
8424 wrap.map(function() {
8425 var elem = this;
8426
8427 while ( elem.firstElementChild ) {
8428 elem = elem.firstElementChild;
8429 }
8430
8431 return elem;
8432 }).append( this );
8433 }
8434
8435 return this;
8436 },
8437
8438 wrapInner: function( html ) {
8439 if ( jQuery.isFunction( html ) ) {
8440 return this.each(function( i ) {
8441 jQuery( this ).wrapInner( html.call(this, i) );
8442 });
8443 }
8444
8445 return this.each(function() {
8446 var self = jQuery( this ),
8447 contents = self.contents();
8448
8449 if ( contents.length ) {
8450 contents.wrapAll( html );
8451
8452 } else {
8453 self.append( html );
8454 }
8455 });
8456 },
8457
8458 wrap: function( html ) {
8459 var isFunction = jQuery.isFunction( html );
8460
8461 return this.each(function( i ) {
8462 jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
8463 });
8464 },
8465
8466 unwrap: function() {
8467 return this.parent().each(function() {
8468 if ( !jQuery.nodeName( this, "body" ) ) {
8469 jQuery( this ).replaceWith( this.childNodes );
8470 }
8471 }).end();
8472 }
8473});
8474
8475
8476jQuery.expr.filters.hidden = function( elem ) {
8477 // Support: Opera <= 12.12
8478 // Opera reports offsetWidths and offsetHeights less than zero on some elements
8479 return elem.offsetWidth <= 0 && elem.offsetHeight <= 0;
8480};
8481jQuery.expr.filters.visible = function( elem ) {
8482 return !jQuery.expr.filters.hidden( elem );
8483};
8484
8485
8486
8487
8488var r20 = /%20/g,
8489 rbracket = /\[\]$/,
8490 rCRLF = /\r?\n/g,
8491 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
8492 rsubmittable = /^(?:input|select|textarea|keygen)/i;
8493
8494function buildParams( prefix, obj, traditional, add ) {
8495 var name;
8496
8497 if ( jQuery.isArray( obj ) ) {
8498 // Serialize array item.
8499 jQuery.each( obj, function( i, v ) {
8500 if ( traditional || rbracket.test( prefix ) ) {
8501 // Treat each array item as a scalar.
8502 add( prefix, v );
8503
8504 } else {
8505 // Item is non-scalar (array or object), encode its numeric index.
8506 buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
8507 }
8508 });
8509
8510 } else if ( !traditional && jQuery.type( obj ) === "object" ) {
8511 // Serialize object item.
8512 for ( name in obj ) {
8513 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
8514 }
8515
8516 } else {
8517 // Serialize scalar item.
8518 add( prefix, obj );
8519 }
8520}
8521
8522// Serialize an array of form elements or a set of
8523// key/values into a query string
8524jQuery.param = function( a, traditional ) {
8525 var prefix,
8526 s = [],
8527 add = function( key, value ) {
8528 // If value is a function, invoke it and return its value
8529 value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
8530 s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
8531 };
8532
8533 // Set traditional to true for jQuery <= 1.3.2 behavior.
8534 if ( traditional === undefined ) {
8535 traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
8536 }
8537
8538 // If an array was passed in, assume that it is an array of form elements.
8539 if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
8540 // Serialize the form elements
8541 jQuery.each( a, function() {
8542 add( this.name, this.value );
8543 });
8544
8545 } else {
8546 // If traditional, encode the "old" way (the way 1.3.2 or older
8547 // did it), otherwise encode params recursively.
8548 for ( prefix in a ) {
8549 buildParams( prefix, a[ prefix ], traditional, add );
8550 }
8551 }
8552
8553 // Return the resulting serialization
8554 return s.join( "&" ).replace( r20, "+" );
8555};
8556
8557jQuery.fn.extend({
8558 serialize: function() {
8559 return jQuery.param( this.serializeArray() );
8560 },
8561 serializeArray: function() {
8562 return this.map(function() {
8563 // Can add propHook for "elements" to filter or add form elements
8564 var elements = jQuery.prop( this, "elements" );
8565 return elements ? jQuery.makeArray( elements ) : this;
8566 })
8567 .filter(function() {
8568 var type = this.type;
8569
8570 // Use .is( ":disabled" ) so that fieldset[disabled] works
8571 return this.name && !jQuery( this ).is( ":disabled" ) &&
8572 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
8573 ( this.checked || !rcheckableType.test( type ) );
8574 })
8575 .map(function( i, elem ) {
8576 var val = jQuery( this ).val();
8577
8578 return val == null ?
8579 null :
8580 jQuery.isArray( val ) ?
8581 jQuery.map( val, function( val ) {
8582 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
8583 }) :
8584 { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
8585 }).get();
8586 }
8587});
8588
8589
8590jQuery.ajaxSettings.xhr = function() {
8591 try {
8592 return new XMLHttpRequest();
8593 } catch( e ) {}
8594};
8595
8596var xhrId = 0,
8597 xhrCallbacks = {},
8598 xhrSuccessStatus = {
8599 // file protocol always yields status code 0, assume 200
8600 0: 200,
8601 // Support: IE9
8602 // #1450: sometimes IE returns 1223 when it should be 204
8603 1223: 204
8604 },
8605 xhrSupported = jQuery.ajaxSettings.xhr();
8606
8607// Support: IE9
8608// Open requests must be manually aborted on unload (#5280)
8609// See https://support.microsoft.com/kb/2856746 for more info
8610if ( window.attachEvent ) {
8611 window.attachEvent( "onunload", function() {
8612 for ( var key in xhrCallbacks ) {
8613 xhrCallbacks[ key ]();
8614 }
8615 });
8616}
8617
8618support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
8619support.ajax = xhrSupported = !!xhrSupported;
8620
8621jQuery.ajaxTransport(function( options ) {
8622 var callback;
8623
8624 // Cross domain only allowed if supported through XMLHttpRequest
8625 if ( support.cors || xhrSupported && !options.crossDomain ) {
8626 return {
8627 send: function( headers, complete ) {
8628 var i,
8629 xhr = options.xhr(),
8630 id = ++xhrId;
8631
8632 xhr.open( options.type, options.url, options.async, options.username, options.password );
8633
8634 // Apply custom fields if provided
8635 if ( options.xhrFields ) {
8636 for ( i in options.xhrFields ) {
8637 xhr[ i ] = options.xhrFields[ i ];
8638 }
8639 }
8640
8641 // Override mime type if needed
8642 if ( options.mimeType && xhr.overrideMimeType ) {
8643 xhr.overrideMimeType( options.mimeType );
8644 }
8645
8646 // X-Requested-With header
8647 // For cross-domain requests, seeing as conditions for a preflight are
8648 // akin to a jigsaw puzzle, we simply never set it to be sure.
8649 // (it can always be set on a per-request basis or even using ajaxSetup)
8650 // For same-domain requests, won't change header if already provided.
8651 if ( !options.crossDomain && !headers["X-Requested-With"] ) {
8652 headers["X-Requested-With"] = "XMLHttpRequest";
8653 }
8654
8655 // Set headers
8656 for ( i in headers ) {
8657 xhr.setRequestHeader( i, headers[ i ] );
8658 }
8659
8660 // Callback
8661 callback = function( type ) {
8662 return function() {
8663 if ( callback ) {
8664 delete xhrCallbacks[ id ];
8665 callback = xhr.onload = xhr.onerror = null;
8666
8667 if ( type === "abort" ) {
8668 xhr.abort();
8669 } else if ( type === "error" ) {
8670 complete(
8671 // file: protocol always yields status 0; see #8605, #14207
8672 xhr.status,
8673 xhr.statusText
8674 );
8675 } else {
8676 complete(
8677 xhrSuccessStatus[ xhr.status ] || xhr.status,
8678 xhr.statusText,
8679 // Support: IE9
8680 // Accessing binary-data responseText throws an exception
8681 // (#11426)
8682 typeof xhr.responseText === "string" ? {
8683 text: xhr.responseText
8684 } : undefined,
8685 xhr.getAllResponseHeaders()
8686 );
8687 }
8688 }
8689 };
8690 };
8691
8692 // Listen to events
8693 xhr.onload = callback();
8694 xhr.onerror = callback("error");
8695
8696 // Create the abort callback
8697 callback = xhrCallbacks[ id ] = callback("abort");
8698
8699 try {
8700 // Do send the request (this may raise an exception)
8701 xhr.send( options.hasContent && options.data || null );
8702 } catch ( e ) {
8703 // #14683: Only rethrow if this hasn't been notified as an error yet
8704 if ( callback ) {
8705 throw e;
8706 }
8707 }
8708 },
8709
8710 abort: function() {
8711 if ( callback ) {
8712 callback();
8713 }
8714 }
8715 };
8716 }
8717});
8718
8719
8720
8721
8722// Install script dataType
8723jQuery.ajaxSetup({
8724 accepts: {
8725 script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
8726 },
8727 contents: {
8728 script: /(?:java|ecma)script/
8729 },
8730 converters: {
8731 "text script": function( text ) {
8732 jQuery.globalEval( text );
8733 return text;
8734 }
8735 }
8736});
8737
8738// Handle cache's special case and crossDomain
8739jQuery.ajaxPrefilter( "script", function( s ) {
8740 if ( s.cache === undefined ) {
8741 s.cache = false;
8742 }
8743 if ( s.crossDomain ) {
8744 s.type = "GET";
8745 }
8746});
8747
8748// Bind script tag hack transport
8749jQuery.ajaxTransport( "script", function( s ) {
8750 // This transport only deals with cross domain requests
8751 if ( s.crossDomain ) {
8752 var script, callback;
8753 return {
8754 send: function( _, complete ) {
8755 script = jQuery("<script>").prop({
8756 async: true,
8757 charset: s.scriptCharset,
8758 src: s.url
8759 }).on(
8760 "load error",
8761 callback = function( evt ) {
8762 script.remove();
8763 callback = null;
8764 if ( evt ) {
8765 complete( evt.type === "error" ? 404 : 200, evt.type );
8766 }
8767 }
8768 );
8769 document.head.appendChild( script[ 0 ] );
8770 },
8771 abort: function() {
8772 if ( callback ) {
8773 callback();
8774 }
8775 }
8776 };
8777 }
8778});
8779
8780
8781
8782
8783var oldCallbacks = [],
8784 rjsonp = /(=)\?(?=&|$)|\?\?/;
8785
8786// Default jsonp settings
8787jQuery.ajaxSetup({
8788 jsonp: "callback",
8789 jsonpCallback: function() {
8790 var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
8791 this[ callback ] = true;
8792 return callback;
8793 }
8794});
8795
8796// Detect, normalize options and install callbacks for jsonp requests
8797jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
8798
8799 var callbackName, overwritten, responseContainer,
8800 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
8801 "url" :
8802 typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"
8803 );
8804
8805 // Handle iff the expected data type is "jsonp" or we have a parameter to set
8806 if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
8807
8808 // Get callback name, remembering preexisting value associated with it
8809 callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
8810 s.jsonpCallback() :
8811 s.jsonpCallback;
8812
8813 // Insert callback into url or form data
8814 if ( jsonProp ) {
8815 s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
8816 } else if ( s.jsonp !== false ) {
8817 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
8818 }
8819
8820 // Use data converter to retrieve json after script execution
8821 s.converters["script json"] = function() {
8822 if ( !responseContainer ) {
8823 jQuery.error( callbackName + " was not called" );
8824 }
8825 return responseContainer[ 0 ];
8826 };
8827
8828 // force json dataType
8829 s.dataTypes[ 0 ] = "json";
8830
8831 // Install callback
8832 overwritten = window[ callbackName ];
8833 window[ callbackName ] = function() {
8834 responseContainer = arguments;
8835 };
8836
8837 // Clean-up function (fires after converters)
8838 jqXHR.always(function() {
8839 // Restore preexisting value
8840 window[ callbackName ] = overwritten;
8841
8842 // Save back as free
8843 if ( s[ callbackName ] ) {
8844 // make sure that re-using the options doesn't screw things around
8845 s.jsonpCallback = originalSettings.jsonpCallback;
8846
8847 // save the callback name for future use
8848 oldCallbacks.push( callbackName );
8849 }
8850
8851 // Call if it was a function and we have a response
8852 if ( responseContainer && jQuery.isFunction( overwritten ) ) {
8853 overwritten( responseContainer[ 0 ] );
8854 }
8855
8856 responseContainer = overwritten = undefined;
8857 });
8858
8859 // Delegate to script
8860 return "script";
8861 }
8862});
8863
8864
8865
8866
8867// data: string of html
8868// context (optional): If specified, the fragment will be created in this context, defaults to document
8869// keepScripts (optional): If true, will include scripts passed in the html string
8870jQuery.parseHTML = function( data, context, keepScripts ) {
8871 if ( !data || typeof data !== "string" ) {
8872 return null;
8873 }
8874 if ( typeof context === "boolean" ) {
8875 keepScripts = context;
8876 context = false;
8877 }
8878 context = context || document;
8879
8880 var parsed = rsingleTag.exec( data ),
8881 scripts = !keepScripts && [];
8882
8883 // Single tag
8884 if ( parsed ) {
8885 return [ context.createElement( parsed[1] ) ];
8886 }
8887
8888 parsed = jQuery.buildFragment( [ data ], context, scripts );
8889
8890 if ( scripts && scripts.length ) {
8891 jQuery( scripts ).remove();
8892 }
8893
8894 return jQuery.merge( [], parsed.childNodes );
8895};
8896
8897
8898// Keep a copy of the old load method
8899var _load = jQuery.fn.load;
8900
8901/**
8902 * Load a url into a page
8903 */
8904jQuery.fn.load = function( url, params, callback ) {
8905 if ( typeof url !== "string" && _load ) {
8906 return _load.apply( this, arguments );
8907 }
8908
8909 var selector, type, response,
8910 self = this,
8911 off = url.indexOf(" ");
8912
8913 if ( off >= 0 ) {
8914 selector = jQuery.trim( url.slice( off ) );
8915 url = url.slice( 0, off );
8916 }
8917
8918 // If it's a function
8919 if ( jQuery.isFunction( params ) ) {
8920
8921 // We assume that it's the callback
8922 callback = params;
8923 params = undefined;
8924
8925 // Otherwise, build a param string
8926 } else if ( params && typeof params === "object" ) {
8927 type = "POST";
8928 }
8929
8930 // If we have elements to modify, make the request
8931 if ( self.length > 0 ) {
8932 jQuery.ajax({
8933 url: url,
8934
8935 // if "type" variable is undefined, then "GET" method will be used
8936 type: type,
8937 dataType: "html",
8938 data: params
8939 }).done(function( responseText ) {
8940
8941 // Save response for use in complete callback
8942 response = arguments;
8943
8944 self.html( selector ?
8945
8946 // If a selector was specified, locate the right elements in a dummy div
8947 // Exclude scripts to avoid IE 'Permission Denied' errors
8948 jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) :
8949
8950 // Otherwise use the full result
8951 responseText );
8952
8953 }).complete( callback && function( jqXHR, status ) {
8954 self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
8955 });
8956 }
8957
8958 return this;
8959};
8960
8961
8962
8963
8964// Attach a bunch of functions for handling common AJAX events
8965jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ) {
8966 jQuery.fn[ type ] = function( fn ) {
8967 return this.on( type, fn );
8968 };
8969});
8970
8971
8972
8973
8974jQuery.expr.filters.animated = function( elem ) {
8975 return jQuery.grep(jQuery.timers, function( fn ) {
8976 return elem === fn.elem;
8977 }).length;
8978};
8979
8980
8981
8982
8983var docElem = window.document.documentElement;
8984
8985/**
8986 * Gets a window from an element
8987 */
8988function getWindow( elem ) {
8989 return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 && elem.defaultView;
8990}
8991
8992jQuery.offset = {
8993 setOffset: function( elem, options, i ) {
8994 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
8995 position = jQuery.css( elem, "position" ),
8996 curElem = jQuery( elem ),
8997 props = {};
8998
8999 // Set position first, in-case top/left are set even on static elem
9000 if ( position === "static" ) {
9001 elem.style.position = "relative";
9002 }
9003
9004 curOffset = curElem.offset();
9005 curCSSTop = jQuery.css( elem, "top" );
9006 curCSSLeft = jQuery.css( elem, "left" );
9007 calculatePosition = ( position === "absolute" || position === "fixed" ) &&
9008 ( curCSSTop + curCSSLeft ).indexOf("auto") > -1;
9009
9010 // Need to be able to calculate position if either
9011 // top or left is auto and position is either absolute or fixed
9012 if ( calculatePosition ) {
9013 curPosition = curElem.position();
9014 curTop = curPosition.top;
9015 curLeft = curPosition.left;
9016
9017 } else {
9018 curTop = parseFloat( curCSSTop ) || 0;
9019 curLeft = parseFloat( curCSSLeft ) || 0;
9020 }
9021
9022 if ( jQuery.isFunction( options ) ) {
9023 options = options.call( elem, i, curOffset );
9024 }
9025
9026 if ( options.top != null ) {
9027 props.top = ( options.top - curOffset.top ) + curTop;
9028 }
9029 if ( options.left != null ) {
9030 props.left = ( options.left - curOffset.left ) + curLeft;
9031 }
9032
9033 if ( "using" in options ) {
9034 options.using.call( elem, props );
9035
9036 } else {
9037 curElem.css( props );
9038 }
9039 }
9040};
9041
9042jQuery.fn.extend({
9043 offset: function( options ) {
9044 if ( arguments.length ) {
9045 return options === undefined ?
9046 this :
9047 this.each(function( i ) {
9048 jQuery.offset.setOffset( this, options, i );
9049 });
9050 }
9051
9052 var docElem, win,
9053 elem = this[ 0 ],
9054 box = { top: 0, left: 0 },
9055 doc = elem && elem.ownerDocument;
9056
9057 if ( !doc ) {
9058 return;
9059 }
9060
9061 docElem = doc.documentElement;
9062
9063 // Make sure it's not a disconnected DOM node
9064 if ( !jQuery.contains( docElem, elem ) ) {
9065 return box;
9066 }
9067
9068 // Support: BlackBerry 5, iOS 3 (original iPhone)
9069 // If we don't have gBCR, just use 0,0 rather than error
9070 if ( typeof elem.getBoundingClientRect !== strundefined ) {
9071 box = elem.getBoundingClientRect();
9072 }
9073 win = getWindow( doc );
9074 return {
9075 top: box.top + win.pageYOffset - docElem.clientTop,
9076 left: box.left + win.pageXOffset - docElem.clientLeft
9077 };
9078 },
9079
9080 position: function() {
9081 if ( !this[ 0 ] ) {
9082 return;
9083 }
9084
9085 var offsetParent, offset,
9086 elem = this[ 0 ],
9087 parentOffset = { top: 0, left: 0 };
9088
9089 // Fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is its only offset parent
9090 if ( jQuery.css( elem, "position" ) === "fixed" ) {
9091 // Assume getBoundingClientRect is there when computed position is fixed
9092 offset = elem.getBoundingClientRect();
9093
9094 } else {
9095 // Get *real* offsetParent
9096 offsetParent = this.offsetParent();
9097
9098 // Get correct offsets
9099 offset = this.offset();
9100 if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
9101 parentOffset = offsetParent.offset();
9102 }
9103
9104 // Add offsetParent borders
9105 parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
9106 parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
9107 }
9108
9109 // Subtract parent offsets and element margins
9110 return {
9111 top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
9112 left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
9113 };
9114 },
9115
9116 offsetParent: function() {
9117 return this.map(function() {
9118 var offsetParent = this.offsetParent || docElem;
9119
9120 while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position" ) === "static" ) ) {
9121 offsetParent = offsetParent.offsetParent;
9122 }
9123
9124 return offsetParent || docElem;
9125 });
9126 }
9127});
9128
9129// Create scrollLeft and scrollTop methods
9130jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
9131 var top = "pageYOffset" === prop;
9132
9133 jQuery.fn[ method ] = function( val ) {
9134 return access( this, function( elem, method, val ) {
9135 var win = getWindow( elem );
9136
9137 if ( val === undefined ) {
9138 return win ? win[ prop ] : elem[ method ];
9139 }
9140
9141 if ( win ) {
9142 win.scrollTo(
9143 !top ? val : window.pageXOffset,
9144 top ? val : window.pageYOffset
9145 );
9146
9147 } else {
9148 elem[ method ] = val;
9149 }
9150 }, method, val, arguments.length, null );
9151 };
9152});
9153
9154// Support: Safari<7+, Chrome<37+
9155// Add the top/left cssHooks using jQuery.fn.position
9156// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
9157// Blink bug: https://code.google.com/p/chromium/issues/detail?id=229280
9158// getComputedStyle returns percent when specified for top/left/bottom/right;
9159// rather than make the css module depend on the offset module, just check for it here
9160jQuery.each( [ "top", "left" ], function( i, prop ) {
9161 jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
9162 function( elem, computed ) {
9163 if ( computed ) {
9164 computed = curCSS( elem, prop );
9165 // If curCSS returns percentage, fallback to offset
9166 return rnumnonpx.test( computed ) ?
9167 jQuery( elem ).position()[ prop ] + "px" :
9168 computed;
9169 }
9170 }
9171 );
9172});
9173
9174
9175// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
9176jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
9177 jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {
9178 // Margin is only for outerHeight, outerWidth
9179 jQuery.fn[ funcName ] = function( margin, value ) {
9180 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
9181 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
9182
9183 return access( this, function( elem, type, value ) {
9184 var doc;
9185
9186 if ( jQuery.isWindow( elem ) ) {
9187 // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
9188 // isn't a whole lot we can do. See pull request at this URL for discussion:
9189 // https://github.com/jquery/jquery/pull/764
9190 return elem.document.documentElement[ "client" + name ];
9191 }
9192
9193 // Get document width or height
9194 if ( elem.nodeType === 9 ) {
9195 doc = elem.documentElement;
9196
9197 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
9198 // whichever is greatest
9199 return Math.max(
9200 elem.body[ "scroll" + name ], doc[ "scroll" + name ],
9201 elem.body[ "offset" + name ], doc[ "offset" + name ],
9202 doc[ "client" + name ]
9203 );
9204 }
9205
9206 return value === undefined ?
9207 // Get width or height on the element, requesting but not forcing parseFloat
9208 jQuery.css( elem, type, extra ) :
9209
9210 // Set width or height on the element
9211 jQuery.style( elem, type, value, extra );
9212 }, type, chainable ? margin : undefined, chainable, null );
9213 };
9214 });
9215});
9216
9217
9218// The number of elements contained in the matched element set
9219jQuery.fn.size = function() {
9220 return this.length;
9221};
9222
9223jQuery.fn.andSelf = jQuery.fn.addBack;
9224
9225
9226
9227
9228// Register as a named AMD module, since jQuery can be concatenated with other
9229// files that may use define, but not via a proper concatenation script that
9230// understands anonymous AMD modules. A named AMD is safest and most robust
9231// way to register. Lowercase jquery is used because AMD module names are
9232// derived from file names, and jQuery is normally delivered in a lowercase
9233// file name. Do this after creating the global so that if an AMD module wants
9234// to call noConflict to hide this version of jQuery, it will work.
9235
9236// Note that for maximum portability, libraries that are not jQuery should
9237// declare themselves as anonymous modules, and avoid setting a global if an
9238// AMD loader is present. jQuery is a special case. For more information, see
9239// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
9240
9241if ( typeof define === "function" && define.amd ) {
9242 define( "jquery", [], function() {
9243 return jQuery;
9244 });
9245}
9246
9247
9248
9249
9250var
9251 // Map over jQuery in case of overwrite
9252 _jQuery = window.jQuery,
9253
9254 // Map over the $ in case of overwrite
9255 _$ = window.$;
9256
9257jQuery.noConflict = function( deep ) {
9258 if ( window.$ === jQuery ) {
9259 window.$ = _$;
9260 }
9261
9262 if ( deep && window.jQuery === jQuery ) {
9263 window.jQuery = _jQuery;
9264 }
9265
9266 return jQuery;
9267};
9268
9269// Expose jQuery and $ identifiers, even in AMD
9270// (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
9271// and CommonJS for browser emulators (#13566)
9272if ( typeof noGlobal === strundefined ) {
9273 window.jQuery = window.$ = jQuery;
9274}
9275
9276
9277
9278
9279return jQuery;
9280
9281}));
9282
9283
9284// vim:ts=4:sts=4:sw=4:
9285/*!
9286 *
9287 * Copyright 2009-2012 Kris Kowal under the terms of the MIT
9288 * license found at http://github.com/kriskowal/q/raw/master/LICENSE
9289 *
9290 * With parts by Tyler Close
9291 * Copyright 2007-2009 Tyler Close under the terms of the MIT X license found
9292 * at http://www.opensource.org/licenses/mit-license.html
9293 * Forked at ref_send.js version: 2009-05-11
9294 *
9295 * With parts by Mark Miller
9296 * Copyright (C) 2011 Google Inc.
9297 *
9298 * Licensed under the Apache License, Version 2.0 (the "License");
9299 * you may not use this file except in compliance with the License.
9300 * You may obtain a copy of the License at
9301 *
9302 * http://www.apache.org/licenses/LICENSE-2.0
9303 *
9304 * Unless required by applicable law or agreed to in writing, software
9305 * distributed under the License is distributed on an "AS IS" BASIS,
9306 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9307 * See the License for the specific language governing permissions and
9308 * limitations under the License.
9309 *
9310 */
9311
9312(function (definition) {
9313 "use strict";
9314
9315 // This file will function properly as a <script> tag, or a module
9316 // using CommonJS and NodeJS or RequireJS module formats. In
9317 // Common/Node/RequireJS, the module exports the Q API and when
9318 // executed as a simple <script>, it creates a Q global instead.
9319
9320 // Montage Require
9321 if (typeof bootstrap === "function") {
9322 bootstrap("promise", definition);
9323
9324 // CommonJS
9325 } else if (typeof exports === "object" && typeof module === "object") {
9326 module.exports = definition();
9327
9328 // RequireJS
9329 } else if (typeof define === "function" && define.amd) {
9330 define(definition);
9331
9332 // SES (Secure EcmaScript)
9333 } else if (typeof ses !== "undefined") {
9334 if (!ses.ok()) {
9335 return;
9336 } else {
9337 ses.makeQ = definition;
9338 }
9339
9340 // <script>
9341 } else if (typeof self !== "undefined") {
9342 self.Q = definition();
9343
9344 } else {
9345 throw new Error("This environment was not anticiapted by Q. Please file a bug.");
9346 }
9347
9348})(function () {
9349"use strict";
9350
9351var hasStacks = false;
9352try {
9353 throw new Error();
9354} catch (e) {
9355 hasStacks = !!e.stack;
9356}
9357
9358// All code after this point will be filtered from stack traces reported
9359// by Q.
9360var qStartingLine = captureLine();
9361var qFileName;
9362
9363// shims
9364
9365// used for fallback in "allResolved"
9366var noop = function () {};
9367
9368// Use the fastest possible means to execute a task in a future turn
9369// of the event loop.
9370var nextTick =(function () {
9371 // linked list of tasks (single, with head node)
9372 var head = {task: void 0, next: null};
9373 var tail = head;
9374 var flushing = false;
9375 var requestTick = void 0;
9376 var isNodeJS = false;
9377
9378 function flush() {
9379 /* jshint loopfunc: true */
9380
9381 while (head.next) {
9382 head = head.next;
9383 var task = head.task;
9384 head.task = void 0;
9385 var domain = head.domain;
9386
9387 if (domain) {
9388 head.domain = void 0;
9389 domain.enter();
9390 }
9391
9392 try {
9393 task();
9394
9395 } catch (e) {
9396 if (isNodeJS) {
9397 // In node, uncaught exceptions are considered fatal errors.
9398 // Re-throw them synchronously to interrupt flushing!
9399
9400 // Ensure continuation if the uncaught exception is suppressed
9401 // listening "uncaughtException" events (as domains does).
9402 // Continue in next event to avoid tick recursion.
9403 if (domain) {
9404 domain.exit();
9405 }
9406 setTimeout(flush, 0);
9407 if (domain) {
9408 domain.enter();
9409 }
9410
9411 throw e;
9412
9413 } else {
9414 // In browsers, uncaught exceptions are not fatal.
9415 // Re-throw them asynchronously to avoid slow-downs.
9416 setTimeout(function() {
9417 throw e;
9418 }, 0);
9419 }
9420 }
9421
9422 if (domain) {
9423 domain.exit();
9424 }
9425 }
9426
9427 flushing = false;
9428 }
9429
9430 nextTick = function (task) {
9431 tail = tail.next = {
9432 task: task,
9433 domain: isNodeJS && process.domain,
9434 next: null
9435 };
9436
9437 if (!flushing) {
9438 flushing = true;
9439 requestTick();
9440 }
9441 };
9442
9443 if (typeof process !== "undefined" && process.nextTick) {
9444 // Node.js before 0.9. Note that some fake-Node environments, like the
9445 // Mocha test runner, introduce a `process` global without a `nextTick`.
9446 isNodeJS = true;
9447
9448 requestTick = function () {
9449 process.nextTick(flush);
9450 };
9451
9452 } else if (typeof setImmediate === "function") {
9453 // In IE10, Node.js 0.9+, or https://github.com/NobleJS/setImmediate
9454 if (typeof window !== "undefined") {
9455 requestTick = setImmediate.bind(window, flush);
9456 } else {
9457 requestTick = function () {
9458 setImmediate(flush);
9459 };
9460 }
9461
9462 } else if (typeof MessageChannel !== "undefined") {
9463 // modern browsers
9464 // http://www.nonblocking.io/2011/06/windownexttick.html
9465 var channel = new MessageChannel();
9466 // At least Safari Version 6.0.5 (8536.30.1) intermittently cannot create
9467 // working message ports the first time a page loads.
9468 channel.port1.onmessage = function () {
9469 requestTick = requestPortTick;
9470 channel.port1.onmessage = flush;
9471 flush();
9472 };
9473 var requestPortTick = function () {
9474 // Opera requires us to provide a message payload, regardless of
9475 // whether we use it.
9476 channel.port2.postMessage(0);
9477 };
9478 requestTick = function () {
9479 setTimeout(flush, 0);
9480 requestPortTick();
9481 };
9482
9483 } else {
9484 // old browsers
9485 requestTick = function () {
9486 setTimeout(flush, 0);
9487 };
9488 }
9489
9490 return nextTick;
9491})();
9492
9493// Attempt to make generics safe in the face of downstream
9494// modifications.
9495// There is no situation where this is necessary.
9496// If you need a security guarantee, these primordials need to be
9497// deeply frozen anyway, and if you don’t need a security guarantee,
9498// this is just plain paranoid.
9499// However, this **might** have the nice side-effect of reducing the size of
9500// the minified code by reducing x.call() to merely x()
9501// See Mark Miller’s explanation of what this does.
9502// http://wiki.ecmascript.org/doku.php?id=conventions:safe_meta_programming
9503var call = Function.call;
9504function uncurryThis(f) {
9505 return function () {
9506 return call.apply(f, arguments);
9507 };
9508}
9509// This is equivalent, but slower:
9510// uncurryThis = Function_bind.bind(Function_bind.call);
9511// http://jsperf.com/uncurrythis
9512
9513var array_slice = uncurryThis(Array.prototype.slice);
9514
9515var array_reduce = uncurryThis(
9516 Array.prototype.reduce || function (callback, basis) {
9517 var index = 0,
9518 length = this.length;
9519 // concerning the initial value, if one is not provided
9520 if (arguments.length === 1) {
9521 // seek to the first value in the array, accounting
9522 // for the possibility that is is a sparse array
9523 do {
9524 if (index in this) {
9525 basis = this[index++];
9526 break;
9527 }
9528 if (++index >= length) {
9529 throw new TypeError();
9530 }
9531 } while (1);
9532 }
9533 // reduce
9534 for (; index < length; index++) {
9535 // account for the possibility that the array is sparse
9536 if (index in this) {
9537 basis = callback(basis, this[index], index);
9538 }
9539 }
9540 return basis;
9541 }
9542);
9543
9544var array_indexOf = uncurryThis(
9545 Array.prototype.indexOf || function (value) {
9546 // not a very good shim, but good enough for our one use of it
9547 for (var i = 0; i < this.length; i++) {
9548 if (this[i] === value) {
9549 return i;
9550 }
9551 }
9552 return -1;
9553 }
9554);
9555
9556var array_map = uncurryThis(
9557 Array.prototype.map || function (callback, thisp) {
9558 var self = this;
9559 var collect = [];
9560 array_reduce(self, function (undefined, value, index) {
9561 collect.push(callback.call(thisp, value, index, self));
9562 }, void 0);
9563 return collect;
9564 }
9565);
9566
9567var object_create = Object.create || function (prototype) {
9568 function Type() { }
9569 Type.prototype = prototype;
9570 return new Type();
9571};
9572
9573var object_hasOwnProperty = uncurryThis(Object.prototype.hasOwnProperty);
9574
9575var object_keys = Object.keys || function (object) {
9576 var keys = [];
9577 for (var key in object) {
9578 if (object_hasOwnProperty(object, key)) {
9579 keys.push(key);
9580 }
9581 }
9582 return keys;
9583};
9584
9585var object_toString = uncurryThis(Object.prototype.toString);
9586
9587function isObject(value) {
9588 return value === Object(value);
9589}
9590
9591// generator related shims
9592
9593// FIXME: Remove this function once ES6 generators are in SpiderMonkey.
9594function isStopIteration(exception) {
9595 return (
9596 object_toString(exception) === "[object StopIteration]" ||
9597 exception instanceof QReturnValue
9598 );
9599}
9600
9601// FIXME: Remove this helper and Q.return once ES6 generators are in
9602// SpiderMonkey.
9603var QReturnValue;
9604if (typeof ReturnValue !== "undefined") {
9605 QReturnValue = ReturnValue;
9606} else {
9607 QReturnValue = function (value) {
9608 this.value = value;
9609 };
9610}
9611
9612// long stack traces
9613
9614var STACK_JUMP_SEPARATOR = "From previous event:";
9615
9616function makeStackTraceLong(error, promise) {
9617 // If possible, transform the error stack trace by removing Node and Q
9618 // cruft, then concatenating with the stack trace of `promise`. See #57.
9619 if (hasStacks &&
9620 promise.stack &&
9621 typeof error === "object" &&
9622 error !== null &&
9623 error.stack &&
9624 error.stack.indexOf(STACK_JUMP_SEPARATOR) === -1
9625 ) {
9626 var stacks = [];
9627 for (var p = promise; !!p; p = p.source) {
9628 if (p.stack) {
9629 stacks.unshift(p.stack);
9630 }
9631 }
9632 stacks.unshift(error.stack);
9633
9634 var concatedStacks = stacks.join("\n" + STACK_JUMP_SEPARATOR + "\n");
9635 error.stack = filterStackString(concatedStacks);
9636 }
9637}
9638
9639function filterStackString(stackString) {
9640 var lines = stackString.split("\n");
9641 var desiredLines = [];
9642 for (var i = 0; i < lines.length; ++i) {
9643 var line = lines[i];
9644
9645 if (!isInternalFrame(line) && !isNodeFrame(line) && line) {
9646 desiredLines.push(line);
9647 }
9648 }
9649 return desiredLines.join("\n");
9650}
9651
9652function isNodeFrame(stackLine) {
9653 return stackLine.indexOf("(module.js:") !== -1 ||
9654 stackLine.indexOf("(node.js:") !== -1;
9655}
9656
9657function getFileNameAndLineNumber(stackLine) {
9658 // Named functions: "at functionName (filename:lineNumber:columnNumber)"
9659 // In IE10 function name can have spaces ("Anonymous function") O_o
9660 var attempt1 = /at .+ \((.+):(\d+):(?:\d+)\)$/.exec(stackLine);
9661 if (attempt1) {
9662 return [attempt1[1], Number(attempt1[2])];
9663 }
9664
9665 // Anonymous functions: "at filename:lineNumber:columnNumber"
9666 var attempt2 = /at ([^ ]+):(\d+):(?:\d+)$/.exec(stackLine);
9667 if (attempt2) {
9668 return [attempt2[1], Number(attempt2[2])];
9669 }
9670
9671 // Firefox style: "function@filename:lineNumber or @filename:lineNumber"
9672 var attempt3 = /.*@(.+):(\d+)$/.exec(stackLine);
9673 if (attempt3) {
9674 return [attempt3[1], Number(attempt3[2])];
9675 }
9676}
9677
9678function isInternalFrame(stackLine) {
9679 var fileNameAndLineNumber = getFileNameAndLineNumber(stackLine);
9680
9681 if (!fileNameAndLineNumber) {
9682 return false;
9683 }
9684
9685 var fileName = fileNameAndLineNumber[0];
9686 var lineNumber = fileNameAndLineNumber[1];
9687
9688 return fileName === qFileName &&
9689 lineNumber >= qStartingLine &&
9690 lineNumber <= qEndingLine;
9691}
9692
9693// discover own file name and line number range for filtering stack
9694// traces
9695function captureLine() {
9696 if (!hasStacks) {
9697 return;
9698 }
9699
9700 try {
9701 throw new Error();
9702 } catch (e) {
9703 var lines = e.stack.split("\n");
9704 var firstLine = lines[0].indexOf("@") > 0 ? lines[1] : lines[2];
9705 var fileNameAndLineNumber = getFileNameAndLineNumber(firstLine);
9706 if (!fileNameAndLineNumber) {
9707 return;
9708 }
9709
9710 qFileName = fileNameAndLineNumber[0];
9711 return fileNameAndLineNumber[1];
9712 }
9713}
9714
9715function deprecate(callback, name, alternative) {
9716 return function () {
9717 if (typeof console !== "undefined" &&
9718 typeof console.warn === "function") {
9719 console.warn(name + " is deprecated, use " + alternative +
9720 " instead.", new Error("").stack);
9721 }
9722 return callback.apply(callback, arguments);
9723 };
9724}
9725
9726// end of shims
9727// beginning of real work
9728
9729/**
9730 * Constructs a promise for an immediate reference, passes promises through, or
9731 * coerces promises from different systems.
9732 * @param value immediate reference or promise
9733 */
9734function Q(value) {
9735 // If the object is already a Promise, return it directly. This enables
9736 // the resolve function to both be used to created references from objects,
9737 // but to tolerably coerce non-promises to promises.
9738 if (value instanceof Promise) {
9739 return value;
9740 }
9741
9742 // assimilate thenables
9743 if (isPromiseAlike(value)) {
9744 return coerce(value);
9745 } else {
9746 return fulfill(value);
9747 }
9748}
9749Q.resolve = Q;
9750
9751/**
9752 * Performs a task in a future turn of the event loop.
9753 * @param {Function} task
9754 */
9755Q.nextTick = nextTick;
9756
9757/**
9758 * Controls whether or not long stack traces will be on
9759 */
9760Q.longStackSupport = false;
9761
9762// enable long stacks if Q_DEBUG is set
9763if (typeof process === "object" && process && process.env && process.env.Q_DEBUG) {
9764 Q.longStackSupport = true;
9765}
9766
9767/**
9768 * Constructs a {promise, resolve, reject} object.
9769 *
9770 * `resolve` is a callback to invoke with a more resolved value for the
9771 * promise. To fulfill the promise, invoke `resolve` with any value that is
9772 * not a thenable. To reject the promise, invoke `resolve` with a rejected
9773 * thenable, or invoke `reject` with the reason directly. To resolve the
9774 * promise to another thenable, thus putting it in the same state, invoke
9775 * `resolve` with that other thenable.
9776 */
9777Q.defer = defer;
9778function defer() {
9779 // if "messages" is an "Array", that indicates that the promise has not yet
9780 // been resolved. If it is "undefined", it has been resolved. Each
9781 // element of the messages array is itself an array of complete arguments to
9782 // forward to the resolved promise. We coerce the resolution value to a
9783 // promise using the `resolve` function because it handles both fully
9784 // non-thenable values and other thenables gracefully.
9785 var messages = [], progressListeners = [], resolvedPromise;
9786
9787 var deferred = object_create(defer.prototype);
9788 var promise = object_create(Promise.prototype);
9789
9790 promise.promiseDispatch = function (resolve, op, operands) {
9791 var args = array_slice(arguments);
9792 if (messages) {
9793 messages.push(args);
9794 if (op === "when" && operands[1]) { // progress operand
9795 progressListeners.push(operands[1]);
9796 }
9797 } else {
9798 Q.nextTick(function () {
9799 resolvedPromise.promiseDispatch.apply(resolvedPromise, args);
9800 });
9801 }
9802 };
9803
9804 // XXX deprecated
9805 promise.valueOf = function () {
9806 if (messages) {
9807 return promise;
9808 }
9809 var nearerValue = nearer(resolvedPromise);
9810 if (isPromise(nearerValue)) {
9811 resolvedPromise = nearerValue; // shorten chain
9812 }
9813 return nearerValue;
9814 };
9815
9816 promise.inspect = function () {
9817 if (!resolvedPromise) {
9818 return { state: "pending" };
9819 }
9820 return resolvedPromise.inspect();
9821 };
9822
9823 if (Q.longStackSupport && hasStacks) {
9824 try {
9825 throw new Error();
9826 } catch (e) {
9827 // NOTE: don't try to use `Error.captureStackTrace` or transfer the
9828 // accessor around; that causes memory leaks as per GH-111. Just
9829 // reify the stack trace as a string ASAP.
9830 //
9831 // At the same time, cut off the first line; it's always just
9832 // "[object Promise]\n", as per the `toString`.
9833 promise.stack = e.stack.substring(e.stack.indexOf("\n") + 1);
9834 }
9835 }
9836
9837 // NOTE: we do the checks for `resolvedPromise` in each method, instead of
9838 // consolidating them into `become`, since otherwise we'd create new
9839 // promises with the lines `become(whatever(value))`. See e.g. GH-252.
9840
9841 function become(newPromise) {
9842 resolvedPromise = newPromise;
9843 promise.source = newPromise;
9844
9845 array_reduce(messages, function (undefined, message) {
9846 Q.nextTick(function () {
9847 newPromise.promiseDispatch.apply(newPromise, message);
9848 });
9849 }, void 0);
9850
9851 messages = void 0;
9852 progressListeners = void 0;
9853 }
9854
9855 deferred.promise = promise;
9856 deferred.resolve = function (value) {
9857 if (resolvedPromise) {
9858 return;
9859 }
9860
9861 become(Q(value));
9862 };
9863
9864 deferred.fulfill = function (value) {
9865 if (resolvedPromise) {
9866 return;
9867 }
9868
9869 become(fulfill(value));
9870 };
9871 deferred.reject = function (reason) {
9872 if (resolvedPromise) {
9873 return;
9874 }
9875
9876 become(reject(reason));
9877 };
9878 deferred.notify = function (progress) {
9879 if (resolvedPromise) {
9880 return;
9881 }
9882
9883 array_reduce(progressListeners, function (undefined, progressListener) {
9884 Q.nextTick(function () {
9885 progressListener(progress);
9886 });
9887 }, void 0);
9888 };
9889
9890 return deferred;
9891}
9892
9893/**
9894 * Creates a Node-style callback that will resolve or reject the deferred
9895 * promise.
9896 * @returns a nodeback
9897 */
9898defer.prototype.makeNodeResolver = function () {
9899 var self = this;
9900 return function (error, value) {
9901 if (error) {
9902 self.reject(error);
9903 } else if (arguments.length > 2) {
9904 self.resolve(array_slice(arguments, 1));
9905 } else {
9906 self.resolve(value);
9907 }
9908 };
9909};
9910
9911/**
9912 * @param resolver {Function} a function that returns nothing and accepts
9913 * the resolve, reject, and notify functions for a deferred.
9914 * @returns a promise that may be resolved with the given resolve and reject
9915 * functions, or rejected by a thrown exception in resolver
9916 */
9917Q.Promise = promise; // ES6
9918Q.promise = promise;
9919function promise(resolver) {
9920 if (typeof resolver !== "function") {
9921 throw new TypeError("resolver must be a function.");
9922 }
9923 var deferred = defer();
9924 try {
9925 resolver(deferred.resolve, deferred.reject, deferred.notify);
9926 } catch (reason) {
9927 deferred.reject(reason);
9928 }
9929 return deferred.promise;
9930}
9931
9932promise.race = race; // ES6
9933promise.all = all; // ES6
9934promise.reject = reject; // ES6
9935promise.resolve = Q; // ES6
9936
9937// XXX experimental. This method is a way to denote that a local value is
9938// serializable and should be immediately dispatched to a remote upon request,
9939// instead of passing a reference.
9940Q.passByCopy = function (object) {
9941 //freeze(object);
9942 //passByCopies.set(object, true);
9943 return object;
9944};
9945
9946Promise.prototype.passByCopy = function () {
9947 //freeze(object);
9948 //passByCopies.set(object, true);
9949 return this;
9950};
9951
9952/**
9953 * If two promises eventually fulfill to the same value, promises that value,
9954 * but otherwise rejects.
9955 * @param x {Any*}
9956 * @param y {Any*}
9957 * @returns {Any*} a promise for x and y if they are the same, but a rejection
9958 * otherwise.
9959 *
9960 */
9961Q.join = function (x, y) {
9962 return Q(x).join(y);
9963};
9964
9965Promise.prototype.join = function (that) {
9966 return Q([this, that]).spread(function (x, y) {
9967 if (x === y) {
9968 // TODO: "===" should be Object.is or equiv
9969 return x;
9970 } else {
9971 throw new Error("Can't join: not the same: " + x + " " + y);
9972 }
9973 });
9974};
9975
9976/**
9977 * Returns a promise for the first of an array of promises to become settled.
9978 * @param answers {Array[Any*]} promises to race
9979 * @returns {Any*} the first promise to be settled
9980 */
9981Q.race = race;
9982function race(answerPs) {
9983 return promise(function(resolve, reject) {
9984 // Switch to this once we can assume at least ES5
9985 // answerPs.forEach(function(answerP) {
9986 // Q(answerP).then(resolve, reject);
9987 // });
9988 // Use this in the meantime
9989 for (var i = 0, len = answerPs.length; i < len; i++) {
9990 Q(answerPs[i]).then(resolve, reject);
9991 }
9992 });
9993}
9994
9995Promise.prototype.race = function () {
9996 return this.then(Q.race);
9997};
9998
9999/**
10000 * Constructs a Promise with a promise descriptor object and optional fallback
10001 * function. The descriptor contains methods like when(rejected), get(name),
10002 * set(name, value), post(name, args), and delete(name), which all
10003 * return either a value, a promise for a value, or a rejection. The fallback
10004 * accepts the operation name, a resolver, and any further arguments that would
10005 * have been forwarded to the appropriate method above had a method been
10006 * provided with the proper name. The API makes no guarantees about the nature
10007 * of the returned object, apart from that it is usable whereever promises are
10008 * bought and sold.
10009 */
10010Q.makePromise = Promise;
10011function Promise(descriptor, fallback, inspect) {
10012 if (fallback === void 0) {
10013 fallback = function (op) {
10014 return reject(new Error(
10015 "Promise does not support operation: " + op
10016 ));
10017 };
10018 }
10019 if (inspect === void 0) {
10020 inspect = function () {
10021 return {state: "unknown"};
10022 };
10023 }
10024
10025 var promise = object_create(Promise.prototype);
10026
10027 promise.promiseDispatch = function (resolve, op, args) {
10028 var result;
10029 try {
10030 if (descriptor[op]) {
10031 result = descriptor[op].apply(promise, args);
10032 } else {
10033 result = fallback.call(promise, op, args);
10034 }
10035 } catch (exception) {
10036 result = reject(exception);
10037 }
10038 if (resolve) {
10039 resolve(result);
10040 }
10041 };
10042
10043 promise.inspect = inspect;
10044
10045 // XXX deprecated `valueOf` and `exception` support
10046 if (inspect) {
10047 var inspected = inspect();
10048 if (inspected.state === "rejected") {
10049 promise.exception = inspected.reason;
10050 }
10051
10052 promise.valueOf = function () {
10053 var inspected = inspect();
10054 if (inspected.state === "pending" ||
10055 inspected.state === "rejected") {
10056 return promise;
10057 }
10058 return inspected.value;
10059 };
10060 }
10061
10062 return promise;
10063}
10064
10065Promise.prototype.toString = function () {
10066 return "[object Promise]";
10067};
10068
10069Promise.prototype.then = function (fulfilled, rejected, progressed) {
10070 var self = this;
10071 var deferred = defer();
10072 var done = false; // ensure the untrusted promise makes at most a
10073 // single call to one of the callbacks
10074
10075 function _fulfilled(value) {
10076 try {
10077 return typeof fulfilled === "function" ? fulfilled(value) : value;
10078 } catch (exception) {
10079 return reject(exception);
10080 }
10081 }
10082
10083 function _rejected(exception) {
10084 if (typeof rejected === "function") {
10085 makeStackTraceLong(exception, self);
10086 try {
10087 return rejected(exception);
10088 } catch (newException) {
10089 return reject(newException);
10090 }
10091 }
10092 return reject(exception);
10093 }
10094
10095 function _progressed(value) {
10096 return typeof progressed === "function" ? progressed(value) : value;
10097 }
10098
10099 Q.nextTick(function () {
10100 self.promiseDispatch(function (value) {
10101 if (done) {
10102 return;
10103 }
10104 done = true;
10105
10106 deferred.resolve(_fulfilled(value));
10107 }, "when", [function (exception) {
10108 if (done) {
10109 return;
10110 }
10111 done = true;
10112
10113 deferred.resolve(_rejected(exception));
10114 }]);
10115 });
10116
10117 // Progress propagator need to be attached in the current tick.
10118 self.promiseDispatch(void 0, "when", [void 0, function (value) {
10119 var newValue;
10120 var threw = false;
10121 try {
10122 newValue = _progressed(value);
10123 } catch (e) {
10124 threw = true;
10125 if (Q.onerror) {
10126 Q.onerror(e);
10127 } else {
10128 throw e;
10129 }
10130 }
10131
10132 if (!threw) {
10133 deferred.notify(newValue);
10134 }
10135 }]);
10136
10137 return deferred.promise;
10138};
10139
10140Q.tap = function (promise, callback) {
10141 return Q(promise).tap(callback);
10142};
10143
10144/**
10145 * Works almost like "finally", but not called for rejections.
10146 * Original resolution value is passed through callback unaffected.
10147 * Callback may return a promise that will be awaited for.
10148 * @param {Function} callback
10149 * @returns {Q.Promise}
10150 * @example
10151 * doSomething()
10152 * .then(...)
10153 * .tap(console.log)
10154 * .then(...);
10155 */
10156Promise.prototype.tap = function (callback) {
10157 callback = Q(callback);
10158
10159 return this.then(function (value) {
10160 return callback.fcall(value).thenResolve(value);
10161 });
10162};
10163
10164/**
10165 * Registers an observer on a promise.
10166 *
10167 * Guarantees:
10168 *
10169 * 1. that fulfilled and rejected will be called only once.
10170 * 2. that either the fulfilled callback or the rejected callback will be
10171 * called, but not both.
10172 * 3. that fulfilled and rejected will not be called in this turn.
10173 *
10174 * @param value promise or immediate reference to observe
10175 * @param fulfilled function to be called with the fulfilled value
10176 * @param rejected function to be called with the rejection exception
10177 * @param progressed function to be called on any progress notifications
10178 * @return promise for the return value from the invoked callback
10179 */
10180Q.when = when;
10181function when(value, fulfilled, rejected, progressed) {
10182 return Q(value).then(fulfilled, rejected, progressed);
10183}
10184
10185Promise.prototype.thenResolve = function (value) {
10186 return this.then(function () { return value; });
10187};
10188
10189Q.thenResolve = function (promise, value) {
10190 return Q(promise).thenResolve(value);
10191};
10192
10193Promise.prototype.thenReject = function (reason) {
10194 return this.then(function () { throw reason; });
10195};
10196
10197Q.thenReject = function (promise, reason) {
10198 return Q(promise).thenReject(reason);
10199};
10200
10201/**
10202 * If an object is not a promise, it is as "near" as possible.
10203 * If a promise is rejected, it is as "near" as possible too.
10204 * If it’s a fulfilled promise, the fulfillment value is nearer.
10205 * If it’s a deferred promise and the deferred has been resolved, the
10206 * resolution is "nearer".
10207 * @param object
10208 * @returns most resolved (nearest) form of the object
10209 */
10210
10211// XXX should we re-do this?
10212Q.nearer = nearer;
10213function nearer(value) {
10214 if (isPromise(value)) {
10215 var inspected = value.inspect();
10216 if (inspected.state === "fulfilled") {
10217 return inspected.value;
10218 }
10219 }
10220 return value;
10221}
10222
10223/**
10224 * @returns whether the given object is a promise.
10225 * Otherwise it is a fulfilled value.
10226 */
10227Q.isPromise = isPromise;
10228function isPromise(object) {
10229 return object instanceof Promise;
10230}
10231
10232Q.isPromiseAlike = isPromiseAlike;
10233function isPromiseAlike(object) {
10234 return isObject(object) && typeof object.then === "function";
10235}
10236
10237/**
10238 * @returns whether the given object is a pending promise, meaning not
10239 * fulfilled or rejected.
10240 */
10241Q.isPending = isPending;
10242function isPending(object) {
10243 return isPromise(object) && object.inspect().state === "pending";
10244}
10245
10246Promise.prototype.isPending = function () {
10247 return this.inspect().state === "pending";
10248};
10249
10250/**
10251 * @returns whether the given object is a value or fulfilled
10252 * promise.
10253 */
10254Q.isFulfilled = isFulfilled;
10255function isFulfilled(object) {
10256 return !isPromise(object) || object.inspect().state === "fulfilled";
10257}
10258
10259Promise.prototype.isFulfilled = function () {
10260 return this.inspect().state === "fulfilled";
10261};
10262
10263/**
10264 * @returns whether the given object is a rejected promise.
10265 */
10266Q.isRejected = isRejected;
10267function isRejected(object) {
10268 return isPromise(object) && object.inspect().state === "rejected";
10269}
10270
10271Promise.prototype.isRejected = function () {
10272 return this.inspect().state === "rejected";
10273};
10274
10275//// BEGIN UNHANDLED REJECTION TRACKING
10276
10277// This promise library consumes exceptions thrown in handlers so they can be
10278// handled by a subsequent promise. The exceptions get added to this array when
10279// they are created, and removed when they are handled. Note that in ES6 or
10280// shimmed environments, this would naturally be a `Set`.
10281var unhandledReasons = [];
10282var unhandledRejections = [];
10283var trackUnhandledRejections = true;
10284
10285function resetUnhandledRejections() {
10286 unhandledReasons.length = 0;
10287 unhandledRejections.length = 0;
10288
10289 if (!trackUnhandledRejections) {
10290 trackUnhandledRejections = true;
10291 }
10292}
10293
10294function trackRejection(promise, reason) {
10295 if (!trackUnhandledRejections) {
10296 return;
10297 }
10298
10299 unhandledRejections.push(promise);
10300 if (reason && typeof reason.stack !== "undefined") {
10301 unhandledReasons.push(reason.stack);
10302 } else {
10303 unhandledReasons.push("(no stack) " + reason);
10304 }
10305}
10306
10307function untrackRejection(promise) {
10308 if (!trackUnhandledRejections) {
10309 return;
10310 }
10311
10312 var at = array_indexOf(unhandledRejections, promise);
10313 if (at !== -1) {
10314 unhandledRejections.splice(at, 1);
10315 unhandledReasons.splice(at, 1);
10316 }
10317}
10318
10319Q.resetUnhandledRejections = resetUnhandledRejections;
10320
10321Q.getUnhandledReasons = function () {
10322 // Make a copy so that consumers can't interfere with our internal state.
10323 return unhandledReasons.slice();
10324};
10325
10326Q.stopUnhandledRejectionTracking = function () {
10327 resetUnhandledRejections();
10328 trackUnhandledRejections = false;
10329};
10330
10331resetUnhandledRejections();
10332
10333//// END UNHANDLED REJECTION TRACKING
10334
10335/**
10336 * Constructs a rejected promise.
10337 * @param reason value describing the failure
10338 */
10339Q.reject = reject;
10340function reject(reason) {
10341 var rejection = Promise({
10342 "when": function (rejected) {
10343 // note that the error has been handled
10344 if (rejected) {
10345 untrackRejection(this);
10346 }
10347 return rejected ? rejected(reason) : this;
10348 }
10349 }, function fallback() {
10350 return this;
10351 }, function inspect() {
10352 return { state: "rejected", reason: reason };
10353 });
10354
10355 // Note that the reason has not been handled.
10356 trackRejection(rejection, reason);
10357
10358 return rejection;
10359}
10360
10361/**
10362 * Constructs a fulfilled promise for an immediate reference.
10363 * @param value immediate reference
10364 */
10365Q.fulfill = fulfill;
10366function fulfill(value) {
10367 return Promise({
10368 "when": function () {
10369 return value;
10370 },
10371 "get": function (name) {
10372 return value[name];
10373 },
10374 "set": function (name, rhs) {
10375 value[name] = rhs;
10376 },
10377 "delete": function (name) {
10378 delete value[name];
10379 },
10380 "post": function (name, args) {
10381 // Mark Miller proposes that post with no name should apply a
10382 // promised function.
10383 if (name === null || name === void 0) {
10384 return value.apply(void 0, args);
10385 } else {
10386 return value[name].apply(value, args);
10387 }
10388 },
10389 "apply": function (thisp, args) {
10390 return value.apply(thisp, args);
10391 },
10392 "keys": function () {
10393 return object_keys(value);
10394 }
10395 }, void 0, function inspect() {
10396 return { state: "fulfilled", value: value };
10397 });
10398}
10399
10400/**
10401 * Converts thenables to Q promises.
10402 * @param promise thenable promise
10403 * @returns a Q promise
10404 */
10405function coerce(promise) {
10406 var deferred = defer();
10407 Q.nextTick(function () {
10408 try {
10409 promise.then(deferred.resolve, deferred.reject, deferred.notify);
10410 } catch (exception) {
10411 deferred.reject(exception);
10412 }
10413 });
10414 return deferred.promise;
10415}
10416
10417/**
10418 * Annotates an object such that it will never be
10419 * transferred away from this process over any promise
10420 * communication channel.
10421 * @param object
10422 * @returns promise a wrapping of that object that
10423 * additionally responds to the "isDef" message
10424 * without a rejection.
10425 */
10426Q.master = master;
10427function master(object) {
10428 return Promise({
10429 "isDef": function () {}
10430 }, function fallback(op, args) {
10431 return dispatch(object, op, args);
10432 }, function () {
10433 return Q(object).inspect();
10434 });
10435}
10436
10437/**
10438 * Spreads the values of a promised array of arguments into the
10439 * fulfillment callback.
10440 * @param fulfilled callback that receives variadic arguments from the
10441 * promised array
10442 * @param rejected callback that receives the exception if the promise
10443 * is rejected.
10444 * @returns a promise for the return value or thrown exception of
10445 * either callback.
10446 */
10447Q.spread = spread;
10448function spread(value, fulfilled, rejected) {
10449 return Q(value).spread(fulfilled, rejected);
10450}
10451
10452Promise.prototype.spread = function (fulfilled, rejected) {
10453 return this.all().then(function (array) {
10454 return fulfilled.apply(void 0, array);
10455 }, rejected);
10456};
10457
10458/**
10459 * The async function is a decorator for generator functions, turning
10460 * them into asynchronous generators. Although generators are only part
10461 * of the newest ECMAScript 6 drafts, this code does not cause syntax
10462 * errors in older engines. This code should continue to work and will
10463 * in fact improve over time as the language improves.
10464 *
10465 * ES6 generators are currently part of V8 version 3.19 with the
10466 * --harmony-generators runtime flag enabled. SpiderMonkey has had them
10467 * for longer, but under an older Python-inspired form. This function
10468 * works on both kinds of generators.
10469 *
10470 * Decorates a generator function such that:
10471 * - it may yield promises
10472 * - execution will continue when that promise is fulfilled
10473 * - the value of the yield expression will be the fulfilled value
10474 * - it returns a promise for the return value (when the generator
10475 * stops iterating)
10476 * - the decorated function returns a promise for the return value
10477 * of the generator or the first rejected promise among those
10478 * yielded.
10479 * - if an error is thrown in the generator, it propagates through
10480 * every following yield until it is caught, or until it escapes
10481 * the generator function altogether, and is translated into a
10482 * rejection for the promise returned by the decorated generator.
10483 */
10484Q.async = async;
10485function async(makeGenerator) {
10486 return function () {
10487 // when verb is "send", arg is a value
10488 // when verb is "throw", arg is an exception
10489 function continuer(verb, arg) {
10490 var result;
10491
10492 // Until V8 3.19 / Chromium 29 is released, SpiderMonkey is the only
10493 // engine that has a deployed base of browsers that support generators.
10494 // However, SM's generators use the Python-inspired semantics of
10495 // outdated ES6 drafts. We would like to support ES6, but we'd also
10496 // like to make it possible to use generators in deployed browsers, so
10497 // we also support Python-style generators. At some point we can remove
10498 // this block.
10499
10500 if (typeof StopIteration === "undefined") {
10501 // ES6 Generators
10502 try {
10503 result = generator[verb](arg);
10504 } catch (exception) {
10505 return reject(exception);
10506 }
10507 if (result.done) {
10508 return Q(result.value);
10509 } else {
10510 return when(result.value, callback, errback);
10511 }
10512 } else {
10513 // SpiderMonkey Generators
10514 // FIXME: Remove this case when SM does ES6 generators.
10515 try {
10516 result = generator[verb](arg);
10517 } catch (exception) {
10518 if (isStopIteration(exception)) {
10519 return Q(exception.value);
10520 } else {
10521 return reject(exception);
10522 }
10523 }
10524 return when(result, callback, errback);
10525 }
10526 }
10527 var generator = makeGenerator.apply(this, arguments);
10528 var callback = continuer.bind(continuer, "next");
10529 var errback = continuer.bind(continuer, "throw");
10530 return callback();
10531 };
10532}
10533
10534/**
10535 * The spawn function is a small wrapper around async that immediately
10536 * calls the generator and also ends the promise chain, so that any
10537 * unhandled errors are thrown instead of forwarded to the error
10538 * handler. This is useful because it's extremely common to run
10539 * generators at the top-level to work with libraries.
10540 */
10541Q.spawn = spawn;
10542function spawn(makeGenerator) {
10543 Q.done(Q.async(makeGenerator)());
10544}
10545
10546// FIXME: Remove this interface once ES6 generators are in SpiderMonkey.
10547/**
10548 * Throws a ReturnValue exception to stop an asynchronous generator.
10549 *
10550 * This interface is a stop-gap measure to support generator return
10551 * values in older Firefox/SpiderMonkey. In browsers that support ES6
10552 * generators like Chromium 29, just use "return" in your generator
10553 * functions.
10554 *
10555 * @param value the return value for the surrounding generator
10556 * @throws ReturnValue exception with the value.
10557 * @example
10558 * // ES6 style
10559 * Q.async(function* () {
10560 * var foo = yield getFooPromise();
10561 * var bar = yield getBarPromise();
10562 * return foo + bar;
10563 * })
10564 * // Older SpiderMonkey style
10565 * Q.async(function () {
10566 * var foo = yield getFooPromise();
10567 * var bar = yield getBarPromise();
10568 * Q.return(foo + bar);
10569 * })
10570 */
10571Q["return"] = _return;
10572function _return(value) {
10573 throw new QReturnValue(value);
10574}
10575
10576/**
10577 * The promised function decorator ensures that any promise arguments
10578 * are settled and passed as values (`this` is also settled and passed
10579 * as a value). It will also ensure that the result of a function is
10580 * always a promise.
10581 *
10582 * @example
10583 * var add = Q.promised(function (a, b) {
10584 * return a + b;
10585 * });
10586 * add(Q(a), Q(B));
10587 *
10588 * @param {function} callback The function to decorate
10589 * @returns {function} a function that has been decorated.
10590 */
10591Q.promised = promised;
10592function promised(callback) {
10593 return function () {
10594 return spread([this, all(arguments)], function (self, args) {
10595 return callback.apply(self, args);
10596 });
10597 };
10598}
10599
10600/**
10601 * sends a message to a value in a future turn
10602 * @param object* the recipient
10603 * @param op the name of the message operation, e.g., "when",
10604 * @param args further arguments to be forwarded to the operation
10605 * @returns result {Promise} a promise for the result of the operation
10606 */
10607Q.dispatch = dispatch;
10608function dispatch(object, op, args) {
10609 return Q(object).dispatch(op, args);
10610}
10611
10612Promise.prototype.dispatch = function (op, args) {
10613 var self = this;
10614 var deferred = defer();
10615 Q.nextTick(function () {
10616 self.promiseDispatch(deferred.resolve, op, args);
10617 });
10618 return deferred.promise;
10619};
10620
10621/**
10622 * Gets the value of a property in a future turn.
10623 * @param object promise or immediate reference for target object
10624 * @param name name of property to get
10625 * @return promise for the property value
10626 */
10627Q.get = function (object, key) {
10628 return Q(object).dispatch("get", [key]);
10629};
10630
10631Promise.prototype.get = function (key) {
10632 return this.dispatch("get", [key]);
10633};
10634
10635/**
10636 * Sets the value of a property in a future turn.
10637 * @param object promise or immediate reference for object object
10638 * @param name name of property to set
10639 * @param value new value of property
10640 * @return promise for the return value
10641 */
10642Q.set = function (object, key, value) {
10643 return Q(object).dispatch("set", [key, value]);
10644};
10645
10646Promise.prototype.set = function (key, value) {
10647 return this.dispatch("set", [key, value]);
10648};
10649
10650/**
10651 * Deletes a property in a future turn.
10652 * @param object promise or immediate reference for target object
10653 * @param name name of property to delete
10654 * @return promise for the return value
10655 */
10656Q.del = // XXX legacy
10657Q["delete"] = function (object, key) {
10658 return Q(object).dispatch("delete", [key]);
10659};
10660
10661Promise.prototype.del = // XXX legacy
10662Promise.prototype["delete"] = function (key) {
10663 return this.dispatch("delete", [key]);
10664};
10665
10666/**
10667 * Invokes a method in a future turn.
10668 * @param object promise or immediate reference for target object
10669 * @param name name of method to invoke
10670 * @param value a value to post, typically an array of
10671 * invocation arguments for promises that
10672 * are ultimately backed with `resolve` values,
10673 * as opposed to those backed with URLs
10674 * wherein the posted value can be any
10675 * JSON serializable object.
10676 * @return promise for the return value
10677 */
10678// bound locally because it is used by other methods
10679Q.mapply = // XXX As proposed by "Redsandro"
10680Q.post = function (object, name, args) {
10681 return Q(object).dispatch("post", [name, args]);
10682};
10683
10684Promise.prototype.mapply = // XXX As proposed by "Redsandro"
10685Promise.prototype.post = function (name, args) {
10686 return this.dispatch("post", [name, args]);
10687};
10688
10689/**
10690 * Invokes a method in a future turn.
10691 * @param object promise or immediate reference for target object
10692 * @param name name of method to invoke
10693 * @param ...args array of invocation arguments
10694 * @return promise for the return value
10695 */
10696Q.send = // XXX Mark Miller's proposed parlance
10697Q.mcall = // XXX As proposed by "Redsandro"
10698Q.invoke = function (object, name /*...args*/) {
10699 return Q(object).dispatch("post", [name, array_slice(arguments, 2)]);
10700};
10701
10702Promise.prototype.send = // XXX Mark Miller's proposed parlance
10703Promise.prototype.mcall = // XXX As proposed by "Redsandro"
10704Promise.prototype.invoke = function (name /*...args*/) {
10705 return this.dispatch("post", [name, array_slice(arguments, 1)]);
10706};
10707
10708/**
10709 * Applies the promised function in a future turn.
10710 * @param object promise or immediate reference for target function
10711 * @param args array of application arguments
10712 */
10713Q.fapply = function (object, args) {
10714 return Q(object).dispatch("apply", [void 0, args]);
10715};
10716
10717Promise.prototype.fapply = function (args) {
10718 return this.dispatch("apply", [void 0, args]);
10719};
10720
10721/**
10722 * Calls the promised function in a future turn.
10723 * @param object promise or immediate reference for target function
10724 * @param ...args array of application arguments
10725 */
10726Q["try"] =
10727Q.fcall = function (object /* ...args*/) {
10728 return Q(object).dispatch("apply", [void 0, array_slice(arguments, 1)]);
10729};
10730
10731Promise.prototype.fcall = function (/*...args*/) {
10732 return this.dispatch("apply", [void 0, array_slice(arguments)]);
10733};
10734
10735/**
10736 * Binds the promised function, transforming return values into a fulfilled
10737 * promise and thrown errors into a rejected one.
10738 * @param object promise or immediate reference for target function
10739 * @param ...args array of application arguments
10740 */
10741Q.fbind = function (object /*...args*/) {
10742 var promise = Q(object);
10743 var args = array_slice(arguments, 1);
10744 return function fbound() {
10745 return promise.dispatch("apply", [
10746 this,
10747 args.concat(array_slice(arguments))
10748 ]);
10749 };
10750};
10751Promise.prototype.fbind = function (/*...args*/) {
10752 var promise = this;
10753 var args = array_slice(arguments);
10754 return function fbound() {
10755 return promise.dispatch("apply", [
10756 this,
10757 args.concat(array_slice(arguments))
10758 ]);
10759 };
10760};
10761
10762/**
10763 * Requests the names of the owned properties of a promised
10764 * object in a future turn.
10765 * @param object promise or immediate reference for target object
10766 * @return promise for the keys of the eventually settled object
10767 */
10768Q.keys = function (object) {
10769 return Q(object).dispatch("keys", []);
10770};
10771
10772Promise.prototype.keys = function () {
10773 return this.dispatch("keys", []);
10774};
10775
10776/**
10777 * Turns an array of promises into a promise for an array. If any of
10778 * the promises gets rejected, the whole array is rejected immediately.
10779 * @param {Array*} an array (or promise for an array) of values (or
10780 * promises for values)
10781 * @returns a promise for an array of the corresponding values
10782 */
10783// By Mark Miller
10784// http://wiki.ecmascript.org/doku.php?id=strawman:concurrency&rev=1308776521#allfulfilled
10785Q.all = all;
10786function all(promises) {
10787 return when(promises, function (promises) {
10788 var countDown = 0;
10789 var deferred = defer();
10790 array_reduce(promises, function (undefined, promise, index) {
10791 var snapshot;
10792 if (
10793 isPromise(promise) &&
10794 (snapshot = promise.inspect()).state === "fulfilled"
10795 ) {
10796 promises[index] = snapshot.value;
10797 } else {
10798 ++countDown;
10799 when(
10800 promise,
10801 function (value) {
10802 promises[index] = value;
10803 if (--countDown === 0) {
10804 deferred.resolve(promises);
10805 }
10806 },
10807 deferred.reject,
10808 function (progress) {
10809 deferred.notify({ index: index, value: progress });
10810 }
10811 );
10812 }
10813 }, void 0);
10814 if (countDown === 0) {
10815 deferred.resolve(promises);
10816 }
10817 return deferred.promise;
10818 });
10819}
10820
10821Promise.prototype.all = function () {
10822 return all(this);
10823};
10824
10825/**
10826 * Waits for all promises to be settled, either fulfilled or
10827 * rejected. This is distinct from `all` since that would stop
10828 * waiting at the first rejection. The promise returned by
10829 * `allResolved` will never be rejected.
10830 * @param promises a promise for an array (or an array) of promises
10831 * (or values)
10832 * @return a promise for an array of promises
10833 */
10834Q.allResolved = deprecate(allResolved, "allResolved", "allSettled");
10835function allResolved(promises) {
10836 return when(promises, function (promises) {
10837 promises = array_map(promises, Q);
10838 return when(all(array_map(promises, function (promise) {
10839 return when(promise, noop, noop);
10840 })), function () {
10841 return promises;
10842 });
10843 });
10844}
10845
10846Promise.prototype.allResolved = function () {
10847 return allResolved(this);
10848};
10849
10850/**
10851 * @see Promise#allSettled
10852 */
10853Q.allSettled = allSettled;
10854function allSettled(promises) {
10855 return Q(promises).allSettled();
10856}
10857
10858/**
10859 * Turns an array of promises into a promise for an array of their states (as
10860 * returned by `inspect`) when they have all settled.
10861 * @param {Array[Any*]} values an array (or promise for an array) of values (or
10862 * promises for values)
10863 * @returns {Array[State]} an array of states for the respective values.
10864 */
10865Promise.prototype.allSettled = function () {
10866 return this.then(function (promises) {
10867 return all(array_map(promises, function (promise) {
10868 promise = Q(promise);
10869 function regardless() {
10870 return promise.inspect();
10871 }
10872 return promise.then(regardless, regardless);
10873 }));
10874 });
10875};
10876
10877/**
10878 * Captures the failure of a promise, giving an oportunity to recover
10879 * with a callback. If the given promise is fulfilled, the returned
10880 * promise is fulfilled.
10881 * @param {Any*} promise for something
10882 * @param {Function} callback to fulfill the returned promise if the
10883 * given promise is rejected
10884 * @returns a promise for the return value of the callback
10885 */
10886Q.fail = // XXX legacy
10887Q["catch"] = function (object, rejected) {
10888 return Q(object).then(void 0, rejected);
10889};
10890
10891Promise.prototype.fail = // XXX legacy
10892Promise.prototype["catch"] = function (rejected) {
10893 return this.then(void 0, rejected);
10894};
10895
10896/**
10897 * Attaches a listener that can respond to progress notifications from a
10898 * promise's originating deferred. This listener receives the exact arguments
10899 * passed to ``deferred.notify``.
10900 * @param {Any*} promise for something
10901 * @param {Function} callback to receive any progress notifications
10902 * @returns the given promise, unchanged
10903 */
10904Q.progress = progress;
10905function progress(object, progressed) {
10906 return Q(object).then(void 0, void 0, progressed);
10907}
10908
10909Promise.prototype.progress = function (progressed) {
10910 return this.then(void 0, void 0, progressed);
10911};
10912
10913/**
10914 * Provides an opportunity to observe the settling of a promise,
10915 * regardless of whether the promise is fulfilled or rejected. Forwards
10916 * the resolution to the returned promise when the callback is done.
10917 * The callback can return a promise to defer completion.
10918 * @param {Any*} promise
10919 * @param {Function} callback to observe the resolution of the given
10920 * promise, takes no arguments.
10921 * @returns a promise for the resolution of the given promise when
10922 * ``fin`` is done.
10923 */
10924Q.fin = // XXX legacy
10925Q["finally"] = function (object, callback) {
10926 return Q(object)["finally"](callback);
10927};
10928
10929Promise.prototype.fin = // XXX legacy
10930Promise.prototype["finally"] = function (callback) {
10931 callback = Q(callback);
10932 return this.then(function (value) {
10933 return callback.fcall().then(function () {
10934 return value;
10935 });
10936 }, function (reason) {
10937 // TODO attempt to recycle the rejection with "this".
10938 return callback.fcall().then(function () {
10939 throw reason;
10940 });
10941 });
10942};
10943
10944/**
10945 * Terminates a chain of promises, forcing rejections to be
10946 * thrown as exceptions.
10947 * @param {Any*} promise at the end of a chain of promises
10948 * @returns nothing
10949 */
10950Q.done = function (object, fulfilled, rejected, progress) {
10951 return Q(object).done(fulfilled, rejected, progress);
10952};
10953
10954Promise.prototype.done = function (fulfilled, rejected, progress) {
10955 var onUnhandledError = function (error) {
10956 // forward to a future turn so that ``when``
10957 // does not catch it and turn it into a rejection.
10958 Q.nextTick(function () {
10959 makeStackTraceLong(error, promise);
10960 if (Q.onerror) {
10961 Q.onerror(error);
10962 } else {
10963 throw error;
10964 }
10965 });
10966 };
10967
10968 // Avoid unnecessary `nextTick`ing via an unnecessary `when`.
10969 var promise = fulfilled || rejected || progress ?
10970 this.then(fulfilled, rejected, progress) :
10971 this;
10972
10973 if (typeof process === "object" && process && process.domain) {
10974 onUnhandledError = process.domain.bind(onUnhandledError);
10975 }
10976
10977 promise.then(void 0, onUnhandledError);
10978};
10979
10980/**
10981 * Causes a promise to be rejected if it does not get fulfilled before
10982 * some milliseconds time out.
10983 * @param {Any*} promise
10984 * @param {Number} milliseconds timeout
10985 * @param {Any*} custom error message or Error object (optional)
10986 * @returns a promise for the resolution of the given promise if it is
10987 * fulfilled before the timeout, otherwise rejected.
10988 */
10989Q.timeout = function (object, ms, error) {
10990 return Q(object).timeout(ms, error);
10991};
10992
10993Promise.prototype.timeout = function (ms, error) {
10994 var deferred = defer();
10995 var timeoutId = setTimeout(function () {
10996 if (!error || "string" === typeof error) {
10997 error = new Error(error || "Timed out after " + ms + " ms");
10998 error.code = "ETIMEDOUT";
10999 }
11000 deferred.reject(error);
11001 }, ms);
11002
11003 this.then(function (value) {
11004 clearTimeout(timeoutId);
11005 deferred.resolve(value);
11006 }, function (exception) {
11007 clearTimeout(timeoutId);
11008 deferred.reject(exception);
11009 }, deferred.notify);
11010
11011 return deferred.promise;
11012};
11013
11014/**
11015 * Returns a promise for the given value (or promised value), some
11016 * milliseconds after it resolved. Passes rejections immediately.
11017 * @param {Any*} promise
11018 * @param {Number} milliseconds
11019 * @returns a promise for the resolution of the given promise after milliseconds
11020 * time has elapsed since the resolution of the given promise.
11021 * If the given promise rejects, that is passed immediately.
11022 */
11023Q.delay = function (object, timeout) {
11024 if (timeout === void 0) {
11025 timeout = object;
11026 object = void 0;
11027 }
11028 return Q(object).delay(timeout);
11029};
11030
11031Promise.prototype.delay = function (timeout) {
11032 return this.then(function (value) {
11033 var deferred = defer();
11034 setTimeout(function () {
11035 deferred.resolve(value);
11036 }, timeout);
11037 return deferred.promise;
11038 });
11039};
11040
11041/**
11042 * Passes a continuation to a Node function, which is called with the given
11043 * arguments provided as an array, and returns a promise.
11044 *
11045 * Q.nfapply(FS.readFile, [__filename])
11046 * .then(function (content) {
11047 * })
11048 *
11049 */
11050Q.nfapply = function (callback, args) {
11051 return Q(callback).nfapply(args);
11052};
11053
11054Promise.prototype.nfapply = function (args) {
11055 var deferred = defer();
11056 var nodeArgs = array_slice(args);
11057 nodeArgs.push(deferred.makeNodeResolver());
11058 this.fapply(nodeArgs).fail(deferred.reject);
11059 return deferred.promise;
11060};
11061
11062/**
11063 * Passes a continuation to a Node function, which is called with the given
11064 * arguments provided individually, and returns a promise.
11065 * @example
11066 * Q.nfcall(FS.readFile, __filename)
11067 * .then(function (content) {
11068 * })
11069 *
11070 */
11071Q.nfcall = function (callback /*...args*/) {
11072 var args = array_slice(arguments, 1);
11073 return Q(callback).nfapply(args);
11074};
11075
11076Promise.prototype.nfcall = function (/*...args*/) {
11077 var nodeArgs = array_slice(arguments);
11078 var deferred = defer();
11079 nodeArgs.push(deferred.makeNodeResolver());
11080 this.fapply(nodeArgs).fail(deferred.reject);
11081 return deferred.promise;
11082};
11083
11084/**
11085 * Wraps a NodeJS continuation passing function and returns an equivalent
11086 * version that returns a promise.
11087 * @example
11088 * Q.nfbind(FS.readFile, __filename)("utf-8")
11089 * .then(console.log)
11090 * .done()
11091 */
11092Q.nfbind =
11093Q.denodeify = function (callback /*...args*/) {
11094 var baseArgs = array_slice(arguments, 1);
11095 return function () {
11096 var nodeArgs = baseArgs.concat(array_slice(arguments));
11097 var deferred = defer();
11098 nodeArgs.push(deferred.makeNodeResolver());
11099 Q(callback).fapply(nodeArgs).fail(deferred.reject);
11100 return deferred.promise;
11101 };
11102};
11103
11104Promise.prototype.nfbind =
11105Promise.prototype.denodeify = function (/*...args*/) {
11106 var args = array_slice(arguments);
11107 args.unshift(this);
11108 return Q.denodeify.apply(void 0, args);
11109};
11110
11111Q.nbind = function (callback, thisp /*...args*/) {
11112 var baseArgs = array_slice(arguments, 2);
11113 return function () {
11114 var nodeArgs = baseArgs.concat(array_slice(arguments));
11115 var deferred = defer();
11116 nodeArgs.push(deferred.makeNodeResolver());
11117 function bound() {
11118 return callback.apply(thisp, arguments);
11119 }
11120 Q(bound).fapply(nodeArgs).fail(deferred.reject);
11121 return deferred.promise;
11122 };
11123};
11124
11125Promise.prototype.nbind = function (/*thisp, ...args*/) {
11126 var args = array_slice(arguments, 0);
11127 args.unshift(this);
11128 return Q.nbind.apply(void 0, args);
11129};
11130
11131/**
11132 * Calls a method of a Node-style object that accepts a Node-style
11133 * callback with a given array of arguments, plus a provided callback.
11134 * @param object an object that has the named method
11135 * @param {String} name name of the method of object
11136 * @param {Array} args arguments to pass to the method; the callback
11137 * will be provided by Q and appended to these arguments.
11138 * @returns a promise for the value or error
11139 */
11140Q.nmapply = // XXX As proposed by "Redsandro"
11141Q.npost = function (object, name, args) {
11142 return Q(object).npost(name, args);
11143};
11144
11145Promise.prototype.nmapply = // XXX As proposed by "Redsandro"
11146Promise.prototype.npost = function (name, args) {
11147 var nodeArgs = array_slice(args || []);
11148 var deferred = defer();
11149 nodeArgs.push(deferred.makeNodeResolver());
11150 this.dispatch("post", [name, nodeArgs]).fail(deferred.reject);
11151 return deferred.promise;
11152};
11153
11154/**
11155 * Calls a method of a Node-style object that accepts a Node-style
11156 * callback, forwarding the given variadic arguments, plus a provided
11157 * callback argument.
11158 * @param object an object that has the named method
11159 * @param {String} name name of the method of object
11160 * @param ...args arguments to pass to the method; the callback will
11161 * be provided by Q and appended to these arguments.
11162 * @returns a promise for the value or error
11163 */
11164Q.nsend = // XXX Based on Mark Miller's proposed "send"
11165Q.nmcall = // XXX Based on "Redsandro's" proposal
11166Q.ninvoke = function (object, name /*...args*/) {
11167 var nodeArgs = array_slice(arguments, 2);
11168 var deferred = defer();
11169 nodeArgs.push(deferred.makeNodeResolver());
11170 Q(object).dispatch("post", [name, nodeArgs]).fail(deferred.reject);
11171 return deferred.promise;
11172};
11173
11174Promise.prototype.nsend = // XXX Based on Mark Miller's proposed "send"
11175Promise.prototype.nmcall = // XXX Based on "Redsandro's" proposal
11176Promise.prototype.ninvoke = function (name /*...args*/) {
11177 var nodeArgs = array_slice(arguments, 1);
11178 var deferred = defer();
11179 nodeArgs.push(deferred.makeNodeResolver());
11180 this.dispatch("post", [name, nodeArgs]).fail(deferred.reject);
11181 return deferred.promise;
11182};
11183
11184/**
11185 * If a function would like to support both Node continuation-passing-style and
11186 * promise-returning-style, it can end its internal promise chain with
11187 * `nodeify(nodeback)`, forwarding the optional nodeback argument. If the user
11188 * elects to use a nodeback, the result will be sent there. If they do not
11189 * pass a nodeback, they will receive the result promise.
11190 * @param object a result (or a promise for a result)
11191 * @param {Function} nodeback a Node.js-style callback
11192 * @returns either the promise or nothing
11193 */
11194Q.nodeify = nodeify;
11195function nodeify(object, nodeback) {
11196 return Q(object).nodeify(nodeback);
11197}
11198
11199Promise.prototype.nodeify = function (nodeback) {
11200 if (nodeback) {
11201 this.then(function (value) {
11202 Q.nextTick(function () {
11203 nodeback(null, value);
11204 });
11205 }, function (error) {
11206 Q.nextTick(function () {
11207 nodeback(error);
11208 });
11209 });
11210 } else {
11211 return this;
11212 }
11213};
11214
11215// All code before this point will be filtered from stack traces.
11216var qEndingLine = captureLine();
11217
11218return Q;
11219
11220});
11221
11222
11223function type(v){
11224 return (typeof v).toLowerCase();
11225}
11226
11227function addSlashes(str, b){
11228 str = ''+str;
11229 if(b){
11230 return str
11231 .replace(/[\\"']/g,'\\$&')
11232 .replace(/\u0000/g, '\\0')
11233 .replace('\n','\\n');
11234 }else{
11235 return str
11236 .replace(/[\\"']/g,'\\$&')
11237 .replace(/\u0000/g, '\\0');
11238 }
11239}
11240
11241function inArray(arr, val){
11242 return arr.indexOf(val) >= 0;
11243}
11244
11245function unEscapeHtml(s) {
11246 return s
11247 .replace(/'/g, "'")
11248 .replace(/"/g, "\"")
11249 .replace(/>/g, ">")
11250 .replace(/</g, "<")
11251 .replace(/&/g, "&");
11252}
11253
11254function escapeHtml(s) {
11255 return s
11256 .replace(/&/g, "&")
11257 .replace(/</g, "<")
11258 .replace(/>/g, ">")
11259 .replace(/"/g, """)
11260 .replace(/'/g, "'");
11261}
11262
11263function escapeRegExp(s) {
11264 return s
11265 .replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
11266}
11267
11268function nl2br(s) {
11269 return (s+'')
11270 .replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1' + '<br />' + '$2');
11271}
11272
11273function injectJS(s,b){
11274 if(type(s)=='function'){s='('+s.toString()+').apply(window);';}
11275 var i = document.createElement('script');
11276 i.innerHTML=s;
11277 document.body.appendChild(i);
11278 if(!b){document.body.removeChild(i);}};
11279
11280
11281function injectStyle(str){
11282 $('<style>')
11283 .attr('type', 'text/css')
11284 .attr('rel', 'stylesheet')
11285 .text(str)
11286 .appendTo(document.body);
11287}
11288
11289
11290
11291var Efest = Eternalfest = function(){}
11292
11293Efest.injectUScripterCss = function(){
11294 for (var key in uScripter._CSS) {
11295 injectStyle(uScripter.getStyle(key));
11296 }
11297}
11298
11299
11300Efest.boot = function(){
11301 Efest.injectUScripterCss();
11302 Efest.buildDOM();
11303 Efest.removeFriends();
11304 console.log('Efest is ready');
11305}
11306
11307Efest.locales = function(){
11308 return Efest.locales[Efest.data.get('locale')];
11309}
11310
11311Efest.locales['fr-FR'] = {
11312 'allGames': 'Tous les jeux',
11313 categories: {
11314 'big': 'Aventure',
11315 'small': 'Contrée',
11316 'puzzle': 'Puzzle',
11317 'challenge': 'Défi',
11318 'fun': 'WTF',
11319 'lab': 'Expérimental',
11320 'other': 'Autre'
11321 },
11322 gameModes: {
11323 'solo': 'Aventure',
11324 'tutorial': 'Apprentissage',
11325 'timeattack': 'Time Attack',
11326 'multicoop': 'Multi Coopératif',
11327 'soccer': 'Soccerfest',
11328 'multitime': 'Multi Time',
11329 'bossrush': 'Boss Rush'
11330 },
11331 gameOptions: {
11332 'mirror': 'Miroir',
11333 'mirrormulti': 'Miroir (Multi Coopératif)',
11334 'nightmaremulti': 'Cauchemar (Multi Coopératif)',
11335 'nightmare': 'Cauchemar',
11336 'lifesharing': 'Partage de vies',
11337 'soccerbomb': 'Bombes (Soccerfest)',
11338 'kickcontrol': 'Contrôle avancé du ballon',
11339 'bombcontrol': 'Bombotopia!',
11340 'ninja': 'Ninjutsu',
11341 'bombexpert': 'Explosifs instables',
11342 'boost': 'Tornade'
11343 }
11344}
11345
11346Efest.data = function(){};
11347
11348Efest.data.defaults = {
11349 protocol: 'http',
11350 host: 'eternalfest.net',
11351 locale: 'fr-FR',
11352 categories: ['big', 'small', 'puzzle', 'challenge', 'fun', 'lab', 'other'],
11353 shake: 1,
11354 detail: 1,
11355 sound: 1,
11356 music: 1,
11357 volume: 100,
11358 verbose: 0
11359}
11360
11361Efest.data.get = function(name){
11362 return Efest.data.defaults[name];
11363}
11364
11365Efest.URI = function(){};
11366
11367Efest.URI.getMain = function(kind, params){
11368 var str = Efest.data.get('protocol')+'://'+Efest.data.get('host');
11369 switch(kind){
11370 case 'main':
11371 return str;
11372 }
11373 throw new Error('Unknown kind of uri');
11374};
11375
11376Efest.URI.getApi = function(kind, params){
11377 var str = Efest.data.get('protocol')+'://api.'+Efest.data.get('host');
11378 switch(kind){
11379 case 'games':
11380 return str+'/games';
11381 }
11382 throw new Error('Unknown kind of uri');
11383};
11384
11385Efest.URI.getFiles = function(kind, params){
11386 var str = Efest.data.get('protocol')+'://files.'+Efest.data.get('host');
11387 switch(kind){
11388 case 'file':
11389 return str+'/'+params.id;
11390 case 'loader':
11391 return str+'/loader.swf';
11392 }
11393 throw new Error('Unknown kind of uri');
11394};
11395
11396Efest.URI.getParams = (function(){
11397 var urlParams = null;
11398 return function(){
11399 if (urlParams !== null) {
11400 return urlParams;
11401 }
11402 var match,
11403 pl = /\+/g, // Regex for replacing addition symbol with a space
11404 search = /([^&=]+)=?([^&]*)/g,
11405 decode = function (s) { return decodeURIComponent(s.replace(pl, " ")); },
11406 query = window.location.search.substring(1);
11407
11408 urlParams = {};
11409 while (match = search.exec(query))
11410 urlParams[decode(match[1])] = decode(match[2]);
11411 return urlParams;
11412 };
11413})()
11414
11415Efest.xhr = function(){}
11416
11417Efest.xhr.get = function(url, data){
11418 data = data || {};
11419 var config = {
11420 method: 'GET',
11421 url: url,
11422 data: data
11423 };
11424
11425 var deferred = Q.defer();
11426
11427 config.onload = function(response){
11428 var res = {};
11429 res.data = JSON.parse(response.responseText);
11430 res.original = response;
11431 deferred.resolve(res);
11432 };
11433 config.onerror = function(res){deferred.reject(res);};
11434 config.onprogress = function(res){deferred.notify(res);};
11435
11436 GM_xmlhttpRequest(config);
11437
11438 return deferred.promise;
11439}
11440
11441Efest.xhr.post = function(url, data){
11442 data = data || {};
11443 var config = {
11444 method: 'POST',
11445 url: url,
11446 data: data
11447 };
11448
11449 var deferred = Q.defer();
11450
11451 config.onload = function(response){
11452 var res = {};
11453 res.data = JSON.parse(response.responseText);
11454 res.original = response;
11455 deferred.resolve(res);
11456 };
11457 config.onerror = function(res){deferred.reject(res);};
11458 config.onprogress = function(res){deferred.notify(res);};
11459
11460 GM_xmlhttpRequest(config);
11461
11462 return deferred.promise;
11463}
11464
11465Efest.Game = function(obj){
11466 this.gameModes = [];
11467 this.files = [];
11468 for(var key in obj){
11469 this[key] = obj[key];
11470 }
11471}
11472
11473Efest.Game.prototype.getFiles = function(tag){
11474 var res = [];
11475 for(var i=0, l=this.files.length; i<l; i++){
11476 var cur = this.files[i];
11477 if (cur.tag === tag) {
11478 res.push(cur);
11479 }
11480 }
11481}
11482
11483Efest.Game.prototype.getFirstFile = function(tag){
11484 for(var i=0, l=this.files.length; i<l; i++){
11485 var cur = this.files[i];
11486 if (cur.tag === tag) {
11487 return cur;
11488 }
11489 }
11490 return null;
11491}
11492
11493Efest.Game.list = null;
11494
11495Efest.Game.load = function(){
11496 console.log('loading games')
11497 Efest.xhr
11498 .get(Efest.URI.getApi('games'))
11499 .then(function(res){
11500 var games = res.data;
11501 Efest.Game.list = [];
11502 for (var i=0, l=games.length; i<l; i++) {
11503 Efest.Game.list.push(new Efest.Game(games[i]));
11504 }
11505 Efest.DOM.gamesList.update();
11506 })
11507 .fail(function(err){
11508 console.error(err);
11509 })
11510 .done();
11511};
11512
11513Efest.Game.getList = function(filter, sort){}
11514
11515Efest.Game.getById = function(id){
11516 for(var i=0, l=Efest.Game.list.length; i<l; i++){
11517 var cur = Efest.Game.list[i];
11518 if (cur._id === id) {
11519 return cur;
11520 }
11521 }
11522 return null;
11523}
11524
11525Efest.model = {
11526 details: {
11527 type: 'news'
11528 },
11529 game: null,
11530 curMode: null
11531};
11532
11533Efest.DOM = {};
11534
11535Efest.DOM.uid = 1;
11536Efest.DOM.getUid = function(){
11537 return 'efest-'+Efest.DOM.uid++;
11538}
11539
11540Efest.DOM.navIcon = function(){
11541 var res = {};
11542 res.DOM = $(uScripter.getHtml('html/icon_efest.html'));
11543
11544 return res;
11545}
11546
11547Efest.DOM.mainMenu = function(){
11548 var res = {};
11549 res.DOM = $(uScripter.getHtml('html/efest/main_menu.html'));
11550
11551 res.DOM.find('a').attr('href', Efest.URI.getMain('main'));
11552
11553 res.DOM.find('.all').text(Efest.locales().allGames);
11554
11555 var categoryTemplate = res.DOM.find('li._template');
11556
11557 var categories = Efest.data.get('categories');
11558 for (var i=0, l=categories.length; i<l; i++) {
11559 var cur = categories[i];
11560 var category = categoryTemplate.clone().removeClass('_template');
11561 category.find('span').text(Efest.locales().categories[cur]);
11562
11563 categoryTemplate.parent().append(category);
11564 }
11565
11566 return res;
11567}
11568
11569Efest.DOM.news = {
11570 DOM: null,
11571 get: function(){
11572 if (this.DOM) { return this.DOM; }
11573
11574 this.DOM = $(uScripter.getHtml('html/efest/main_news.html'));
11575
11576 return this.DOM;
11577 }
11578}
11579
11580Efest.DOM.gamesList = {
11581 DOM: null,
11582 get: function(){
11583 if (this.DOM) { return this.DOM; }
11584
11585 this.DOM = $(uScripter.getHtml('html/efest/main_gameslist.html'));
11586
11587 return this.DOM;
11588 },
11589 update: function(){
11590 var dom = this.get();
11591 dom.find('li:not(._template)').detach();
11592
11593 var games = Efest.Game.list;
11594
11595 if (games === null) {
11596 dom.find(ul).append($('<li>').text('Aucun game'));
11597 return;
11598 }
11599
11600 var template = dom.find('li._template');
11601
11602 for(var i=0, l=games.length; i<l; i++){
11603 var game = games[i];
11604
11605 var li = template.clone().removeClass('_template');
11606
11607 li.find('h1 span').text(game.title);
11608 li.find('p.description').text(game.description);
11609
11610 var icon = game.getFirstFile('icon');
11611
11612 if (icon) {
11613 li.find('img.icon').attr('src', Efest.URI.getFiles('file', {id: icon.file._id}));
11614 }else{
11615 li.find('img.icon').attr('src', uScripter.getImage('img/logo_efest-100.png'));
11616 }
11617
11618 li.find('button')
11619 .attr('title', game.title)
11620 .data('id', game._id)
11621 .click(function(ev){
11622 Efest.model.details = {type: 'game', id: $(this).data('id')};
11623 Efest.DOM.rightPane.update();
11624 var target = Math.max(100, Efest.DOM.rightPane.get().offset().top-30);
11625 target = Math.min(target, $(window).scrollTop());
11626 $('html, body')
11627 .stop()
11628 .animate({scrollTop: target}, '300', 'swing');
11629 })
11630
11631
11632 template.parent().append(li);
11633
11634 }
11635
11636 }
11637}
11638
11639Efest.DOM.gameDetails = {
11640 DOM: null,
11641 get: function(){
11642 if (this.DOM) { return this.DOM; }
11643
11644 this.DOM = $(uScripter.getHtml('html/efest/main_gamedetails.html'));
11645 this.DOM.find('form').on('submit', function(ev){
11646 // TODO
11647 });
11648
11649 return this.DOM;
11650 },
11651 update: function(){
11652 var dom = this.get();
11653 var game = Efest.model.game;
11654
11655 dom.find('h2').text(game.title);
11656 dom.find('.description').text(game.description);
11657
11658 var updateOptions = function(){
11659 var list = []
11660 dom.find('.mopt input:checked').each(function(i, e){
11661 list.push($(this).val());
11662 });
11663 dom.find('input[name=options]').val(list.join(','));
11664 }
11665
11666 updateOptions();
11667 dom.find('input[name=gid]').val(game._id);
11668
11669 var gameModes = [];
11670
11671 for(var i=0, l=game.gameModes.length; i<l; i++){
11672 var cur = game.gameModes[i];
11673 if (cur.value) {
11674 gameModes.push(cur);
11675 }
11676 }
11677
11678 if (gameModes.length === 0) {
11679 dom.find('form').hide();
11680 dom.find('p.error').show().text('Aucun mode de jeu n\'est disponible !');
11681 return;
11682 }else{
11683 dom.find('form').show();
11684 dom.find('p.error').hide();
11685 }
11686
11687 dom.find('.gmodes li:not(._template)').detach();
11688 var template = dom.find('.gmodes li._template');
11689
11690 for(var i=0, l=gameModes.length; i<l; i++){
11691 var cur = gameModes[i];
11692
11693 var li = template.clone().removeClass('_template');
11694
11695 var uid = Efest.DOM.getUid();
11696
11697 li.find('input')
11698 .attr('id', uid)
11699 .val(cur.name)
11700 .change(function(ev){
11701 if ($(this).is(':checked')) {
11702 var name = $(this).val();
11703 for(var i=0, l=Efest.model.game.gameModes.length; i<l; i++){
11704 if (Efest.model.game.gameModes[i].name === name) {
11705 Efest.model.curMode = Efest.model.game.gameModes[i]
11706 }
11707 }
11708 }
11709 Efest.DOM.gameDetails.update();
11710 })
11711 li.find('label').attr('for', uid);
11712
11713 var localName = Efest.locales().gameModes[cur.name] || cur.name;
11714
11715 li.find('span').text(localName);
11716
11717 if (Efest.model.curMode === null) {
11718 Efest.model.curMode = cur;
11719 li.find('input')[0].checked = true;
11720 }else if(Efest.model.curMode === cur){
11721 li.find('input')[0].checked = true;
11722 }
11723
11724
11725 template.parent().append(li);
11726
11727 }
11728
11729 if (!Efest.model.curMode || !Efest.model.curMode.options || !Efest.model.curMode.options.length) {
11730 dom.find('.mopt').hide();
11731 return;
11732 }else{
11733 dom.find('.mopt').show();
11734 }
11735
11736 var options = Efest.model.curMode.options;
11737 dom.find('.mopt li:not(._template)').detach();
11738 template = dom.find('.mopt li._template');
11739
11740 for(var i=0, l=options.length; i<l; i++){
11741 var cur = options[i];
11742 if (!cur.value) {
11743 continue;
11744 }
11745 li = template.clone().removeClass('_template');
11746
11747 uid = Efest.DOM.getUid();
11748
11749 li.find('input').attr('id', uid).val(cur.name).change(updateOptions);
11750 li.find('label').attr('for', uid);
11751
11752 var localName = Efest.locales().gameOptions[cur.name] || cur.name;
11753 li.find('span').text(localName);
11754
11755 if (cur.value === 2) {
11756 li.find('input').attr('disabled', 'disabled').attr('checked', 'checked');
11757 }
11758
11759 template.parent().append(li);
11760
11761 }
11762
11763 updateOptions();
11764
11765
11766 }
11767}
11768
11769Efest.DOM.rightPane = {
11770 DOM: null,
11771 get: function(){
11772 if (this.DOM) { return this.DOM; }
11773
11774 this.DOM = $('<div>').addClass('menuContRight');
11775 this.update();
11776
11777 return this.DOM;
11778 },
11779 update: function(){
11780 var dom = this.get();
11781 dom.empty()
11782
11783 if (Efest.model.details.type === 'game') {
11784 Efest.model.game = Efest.Game.getById(Efest.model.details.id);
11785 dom.append(Efest.DOM.gameDetails.get());
11786 Efest.DOM.gameDetails.update();
11787 }else{ // news
11788 dom.append(Efest.DOM.news.get());
11789 }
11790
11791 }
11792}
11793
11794Efest.DOM.main = function(){
11795 var res = {};
11796 res.DOM = $(uScripter.getHtml('html/efest/main.html'));
11797
11798 res.DOM
11799 .find('._main_menu')
11800 .replaceWith(Efest.DOM.mainMenu().DOM);
11801
11802 res.DOM
11803 .find('._main_rightpane')
11804 .replaceWith(Efest.DOM.rightPane.get());
11805
11806 res.DOM
11807 .find('._main_gameslist')
11808 .replaceWith(Efest.DOM.gamesList.get());
11809
11810 return res;
11811}
11812
11813Efest.DOM.flashGame = {
11814 DOM: null,
11815 get: function(){
11816 if (this.DOM) { return this.DOM; }
11817
11818 this.DOM = $(uScripter.getHtml('html/efest/game.html'));
11819
11820 return this.DOM;
11821 },
11822 update: function(){
11823 var dom = this.get();
11824
11825 var run = Efest.model.run;
11826 var embed = dom.find('embed');
11827
11828 var flashvars = {};
11829
11830 flashvars.lang = 'fr';
11831 flashvars.gid = run.gid; // game id
11832 flashvars.shake = Efest.data.get('shake');
11833 flashvars.detail = Efest.data.get('detail');
11834 flashvars.sound = Efest.data.get('sound');
11835 flashvars.music = Efest.data.get('music');
11836 flashvars.volume = Efest.data.get('volume');
11837 flashvars.mode = run.gamemode;
11838 flashvars.options = run.options;
11839 flashvars.verbose = Efest.data.get('verbose');
11840 flashvars.srv = Efest.data.get('host');
11841
11842 var arr = [];
11843 for(var key in flashvars){
11844 arr.push('$'+key+'='+encodeURIComponent(flashvars[key]))
11845 }
11846
11847 flashvars = arr.join('&')
11848
11849 embed
11850 .attr('src', Efest.URI.getFiles('loader'))
11851 .attr('id', Efest.DOM.getUid())
11852 .attr('quality', 'high')
11853 .attr('allowscriptaccess', 'always')
11854 .attr('flashvars', flashvars)
11855 .attr('height', '520')
11856 .attr('width', '420');
11857
11858 }
11859}
11860
11861var isEfestPage = /^\/play.html\/eternalfest/.test(document.location.pathname);
11862
11863Efest.patchEfestPage = function(){
11864 $('.lineMainBar')
11865 .detach();
11866 $('.playerInfo')
11867 .html(uScripter.getHtml('html/player_info.html'));
11868 $('.icons')
11869 .html(uScripter.getHtml('html/icons.html'));
11870 $('.bottomMenu')
11871 .empty()
11872 .html(uScripter.getHtml('html/bottom_menu.html'));
11873 $('.siteContent')
11874 .children('h1, h2, p, .minSpace')
11875 .detach();
11876 $('<div>').addClass('siteMinHeight').insertBefore('.bottomMenu');
11877}
11878
11879Efest.buildDOM = function(){
11880 var icons = $('.icons');
11881
11882 if (icons.size() === 0) {
11883 return true;
11884 }else if (icons.children().size() === 0){
11885 if(isEfestPage) {
11886 Efest.patchEfestPage();
11887 }else{
11888 return true;
11889 }
11890 }
11891
11892 icons.prepend(Efest.DOM.navIcon().DOM);
11893
11894 if (!isEfestPage) {
11895 return true; }
11896
11897 if (document.location.pathname === '/play.html/eternalfest') {
11898 Efest.buildMain();
11899 }else if (document.location.pathname === '/play.html/eternalfest/play') {
11900 Efest.buildPlay();
11901 }
11902}
11903
11904Efest.buildMain = function(){
11905 var root = $('.siteMinHeight').addClass('efest');
11906 root
11907 .append(Efest.DOM.main().DOM);
11908 Efest.Game.load();
11909}
11910
11911Efest.buildPlay = function(){
11912 Efest.model.run = Efest.URI.getParams();
11913 var root = $('.siteMinHeight').addClass('efest');
11914 Efest.DOM.flashGame.update();
11915 root
11916 .append(Efest.DOM.flashGame.get());
11917}
11918
11919
11920Efest.removeFriends = function(){
11921 $('.friends').hide();
11922}
11923
11924$(function(){
11925 try {
11926 Efest.boot();
11927 } catch(err) {
11928 console.error(err);
11929 }
11930})