· 7 years ago · Nov 09, 2018, 07:50 PM
1// ==UserScript==
2// @name Popup Blocker Script
3// @name:zh-CN 弹窗阻æ¢ç¨‹åºè„šæœ¬
4// @namespace https://popupblockerscript.com/
5// @version 0.2
6// @description The most efficient user script for blocking popups of all types. Designed to fight the sneakiest popups including the ones on adult and streaming websites.
7// @description:zh-CN ç”¨äºŽé˜»æ¢æ‰€æœ‰ç±»åž‹å¼¹çª—的最有效用户脚本。为防范最狡猾的弹窗而设计,包括æˆäººå’Œæµåª’体网站上的弹窗。
8// @author Mike Kyshenko
9// @match https://*/*
10// @match http://*/*
11// @grant GM_listValues
12// @grant GM_deleteValue
13// @grant GM_setValue
14// @grant GM_getValue
15// @grant GM_getResourceURL
16// @grant GM_getResourceText
17// @grant GM_addStyle
18// @grant GM_xmlhttpRequest
19// @connect re.popupblockerscript.com
20// @connect self
21// @connect *
22// @require https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js
23// ==/UserScript==
24const LANG = {
25 EN: {
26 "notificationMessage": {
27 "message": "Popup Blocked"
28 },
29 "overlayWasBlocked": {
30 "message": "Overlay Blocked"
31 },
32 "allowOnce": {
33 "message": "Show popup once"
34 },
35 "allowAlways": {
36 "message": "Whitelist this site"
37 },
38 "NTF_allowOverlayOnce": {
39 "message": "Allow overlay once"
40 }
41 },
42
43 "CN":{
44 "notificationMessage": {
45 "message": "弹窗被阻æ¢"
46 },
47 "overlayWasBlocked": {
48 "message": "å åŠ å¼¹çª—è¢«é˜»æ¢"
49 },
50 "allowOnce": {
51 "message": "显示一次弹窗"
52 },
53 "allowAlways": {
54 "message": "å…许æ¤ç½‘站上的弹窗"
55 },
56 "NTF_allowOverlayOnce": {
57 "message": "显示一次弹窗"
58 }
59 }
60 };
61 /******/ (function(modules) { // webpackBootstrap
62/******/ // The module cache
63/******/ var installedModules = {};
64
65/******/ // The require function
66/******/ function __webpack_require__(moduleId) {
67
68/******/ // Check if module is in cache
69/******/ if(installedModules[moduleId])
70/******/ return installedModules[moduleId].exports;
71
72/******/ // Create a new module (and put it into the cache)
73/******/ var module = installedModules[moduleId] = {
74/******/ exports: {},
75/******/ id: moduleId,
76/******/ loaded: false
77/******/ };
78
79/******/ // Execute the module function
80/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
81
82/******/ // Flag the module as loaded
83/******/ module.loaded = true;
84
85/******/ // Return the exports of the module
86/******/ return module.exports;
87/******/ }
88
89
90/******/ // expose the modules object (__webpack_modules__)
91/******/ __webpack_require__.m = modules;
92
93/******/ // expose the module cache
94/******/ __webpack_require__.c = installedModules;
95
96/******/ // __webpack_public_path__
97/******/ __webpack_require__.p = "";
98
99/******/ // Load entry module and return exports
100/******/ return __webpack_require__(0);
101/******/ })
102/************************************************************************/
103/******/ ([
104/* 0 */
105/***/ (function(module, exports, __webpack_require__) {
106
107 'use strict';
108
109 __webpack_require__(1);
110
111/***/ }),
112/* 1 */
113/***/ (function(module, exports, __webpack_require__) {
114
115 "use strict";
116
117 var _overlayKiller = __webpack_require__(2);
118
119 var _overlayKiller2 = _interopRequireDefault(_overlayKiller);
120
121 var _inject = __webpack_require__(5);
122
123 var _ntfShowManager = __webpack_require__(6);
124
125 var _ntfShowManager2 = _interopRequireDefault(_ntfShowManager);
126
127 var _notification = __webpack_require__(7);
128
129 var _notification2 = _interopRequireDefault(_notification);
130
131 var _storage = __webpack_require__(4);
132
133 var _storage2 = _interopRequireDefault(_storage);
134
135 var _const = __webpack_require__(9);
136
137 var _const2 = _interopRequireDefault(_const);
138
139 var _attract = __webpack_require__(10);
140
141 var _attract2 = _interopRequireDefault(_attract);
142
143 var _utils = __webpack_require__(8);
144
145 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
146
147 (function ($) {
148 GM_addStyle(".pb-toast-main {\r\n z-index: 2147483639 !important;\r\n position: fixed !important;\r\n top: -50px !important;\r\n left: 0px !important;\r\n width: 100% !important;\r\n height: 44px !important;\r\n border: none !important;\r\n box-shadow: 0 1px 0 0 #b6b4b6 !important;\r\n transition: top 0.3s;\r\n}\r\n\r\n.pb-toast-main-move {\r\n top: 0px !important;\r\n}\r\n\r\n.pb-toast-main-show {\r\n transition: none;\r\n top: 0px !important;\r\n}\r\n\r\n\r\n\r\n#pb_jq_tipsWrapper {\r\n position: fixed !important;\r\n width: 230px !important;\r\n background-color: rgba(0, 0, 0, 0.8);\r\n box-shadow: 0 8px 20px 0 rgba(0, 0, 0, 0.2);\r\n font-family: \"Lucida Grande\", tahoma, verdana, arial, sans-serif !important;\r\n border-radius: 5px !important;\r\n color: #ffffff !important;\r\n z-index: 2147483641 !important;\r\n padding: 15px !important;\r\n font-size: 14px !important;\r\n}\r\n\r\n#pb_jq_tipsWrapper:before {\r\n position: absolute !important;\r\n top: -10px !important;\r\n right: 60px !important;\r\n display: inline-block !important;\r\n border-right: 10px solid transparent !important;\r\n border-bottom: 10px solid #000 !important;\r\n border-left: 10px solid transparent !important;\r\n border-bottom-color: rgba(0, 0, 0, 0.2) !important;\r\n content: \'\' !important;\r\n}\r\n\r\n#pb_jq_tipsWrapper:after {\r\n position: absolute !important;\r\n top: -9px !important;\r\n right: 60px !important;\r\n display: inline-block !important;\r\n border-right: 9px solid transparent !important;\r\n border-bottom: 9px solid #000 !important;\r\n border-left: 9px solid transparent !important;\r\n content: \'\' !important;\r\n}\r\n\r\n#pb-link-copied-message {\r\n display: none;\r\n position: fixed;\r\n width: 90px;\r\n height: 29px;\r\n opacity: 0;\r\n border-radius: 100px;\r\n background-color: rgba(0, 0, 0, 0.7);\r\n z-index: 2147483641;\r\n font-family: \"Lucida Grande\", tahoma, verdana, arial, sans-serif !important;\r\n font-size: 13px;\r\n line-height: 29px;\r\n text-align: center;\r\n color: #ffffff;\r\n}");
149
150 var pbMessage = (0, _utils.randId)();
151
152 var ntfShowManager = new _ntfShowManager2.default();
153
154 var notification = new _notification2.default({
155 onDisplay: function onDisplay(_ref) {
156 var source = _ref.source;
157
158 switch (source) {
159 case 'popup-blocked':
160 //sendGoogleAnalyticsEvent({category: 'Notification_bar', action: 'Shown'});
161 break;
162
163 case 'recipe-blocked':
164 //sendGoogleAnalyticsEvent({category: 'Notification_bar_overlay', action: 'Shown'});
165 break;
166 }
167 },
168 onCloseClick: function onCloseClick(_ref2) {
169 var source = _ref2.source;
170
171 switch (source) {
172 case 'popup-blocked':
173 //sendGoogleAnalyticsEvent({category: 'Notification_bar', action: 'Click', label: 'Close', domain: document.domain });
174 break;
175
176 case 'recipe-blocked':
177 //sendGoogleAnalyticsEvent({category: 'Notification_bar_overlay', action: 'Click', label: 'Close'});
178 break;
179 }
180 },
181 onButtonClick: function onButtonClick(_ref3) {
182 var source = _ref3.source,
183 id = _ref3.id;
184
185 switch (source) {
186 case 'popup-blocked':
187 switch (id) {
188 case 'allowOnce':
189 //sendGoogleAnalyticsEvent({category: 'Notification_bar', action: 'Click', label: 'Allow once'});
190 break;
191
192 case 'allowAlways':
193 //sendGoogleAnalyticsEvent({category: 'Notification_bar', action: 'Click', label: 'Allow always'});
194 break;
195 }
196 break;
197
198 case 'recipe-blocked':
199 switch (id) {
200 case 'NTF_allowOverlayOnce':
201 //sendGoogleAnalyticsEvent({category: 'Notification_bar_overlay', action: 'Click', label: 'Allow once'});
202 break;
203 }
204 break;
205 }
206 }
207 });
208
209 var overlayKiller = new _overlayKiller2.default({
210 onRecipeFound: function onRecipeFound(_ref4) {
211 var found = _ref4.found;
212
213 ntfShowManager.isShow({ domain: document.domain, type: 'overlay' }).then(function () {
214 showRecipeOverlayNortification();
215 });
216 }
217 });
218
219 var receivedRecipes = function receivedRecipes(data) {
220 var recepies = (data || {}).recipes || [];
221
222 if (recepies.length) {
223 overlayKiller.createBlockListFromRecepies(recepies);
224 }
225 };
226
227 parsePendingNotificationParams();
228
229 function monitorBlocks() {
230 window.addEventListener("message", function receiveMessage(event) {
231 if (event.data.type && event.data.type == "blockedWindow") {
232 if (self !== top) {
233 //pass the message to parent
234 var parentOrigin = window.location != window.parent.location ? document.referrer : document.location;
235 parent.postMessage({ type: "blockedWindow", args: event.data.args }, parentOrigin);
236 return;
237 }
238
239 var args = JSON.parse(event.data.args);
240
241 ntfShowManager.isShow({ domain: document.domain }).then(function () {
242 showPopupBlockedNotification(args, { domain: document.domain });
243 });
244
245 if (ntfShowManager.isActive) {
246 setPendingNotificationParams(args);
247 }
248
249 //sendGoogleAnalyticsEvent({category: "General", action: "Blocked_popups", label: document.domain});
250 }
251 }, false);
252 }
253
254 //show notifcation after a force redirect of a site
255 //every time a popup is being block this function runs
256 //args = popup details (url, name, props)
257 function setPendingNotificationParams(args) {
258 var pop = (args[0] || '') + "|" + (args[1] || '') + "|" + (args[2] || '');
259 var relatedLink = args[3] || '';
260 var currentHost = location.host;
261 var popHost = new URL((0, _utils.getAbsoluteURL)(args[0])).host;
262 //check if the popup is the same host that the current domain
263 //this flags this as a potential pattern of: open the site's page as a popup and redirect to an ad
264 var isSameHostPopup = popHost == currentHost;
265 //check if ad block found - this makes sites to be more agreesive with popups
266 var abd = args['abd'] ? 1 : 0;
267 var data = {
268 pop: pop,
269 relatedLink: relatedLink,
270 host: currentHost,
271 isSameHostPopup: isSameHostPopup,
272 abd: abd,
273 time: Date.now()
274 };
275
276 //store it all in window.name, this will remain even if the site is redirected
277 window.name = "pp_pending_ntf:" + btoa(JSON.stringify(data));
278
279 //to prevent a false positive
280 //if same url popup is detected and the user creates a "redirect"
281 //by clicking a link, this should prevent to send the user back to the origin site
282 if (data.isSameHostPopup) {
283 $(document).on('click', function (e) {
284 if (e.target.nodeName == 'A') {
285 removePendingNotificationParams();
286 }
287 });
288 }
289 }
290
291 //this runs on every page load
292 function parsePendingNotificationParams() {
293 if (window.name && window.name.indexOf('pp_pending_ntf:') == 0) {
294 var data = JSON.parse(atob(name.split(':')[1]));
295 var fnRemove = function fnRemove() {
296 removePendingNotificationParams();
297
298 $(document).off('click', fnRemove);
299 };
300
301 //max 5000 ms between popup block and page load
302 if (data.time + 5000 >= Date.now()) {
303 //force display the notification
304 if (data.display) {
305 ntfShowManager.isShow({ domain: document.domain }).then(function () {
306 showPopupBlockedNotification(data.pop.split('|'), { preventDisplayEvent: true, quickOpen: true, domain: document.domain });
307 });
308
309 removePendingNotificationParams();
310 } else {
311 var isExternalSite = false;
312
313 if (data.host != location.host) {
314 isExternalSite = true;
315 }
316
317 //self popup + redirect pattern - return user to the popup url and block the redirected site
318 if (isExternalSite && data.abd) {
319 var url = data.pop.split('|')[0];
320
321 if (data.isSameHostPopup) {
322 setSingleDisplayNotificationParams();
323
324 location.href = url;
325 } else if (/^about:blank/i.test(url) && data.relatedLink) {
326 setSingleDisplayNotificationParams();
327
328 location.href = data.relatedLink;
329 }
330 } else {
331 ntfShowManager.isShow({ domain: isExternalSite ? data.host : document.domain }).then(function () {
332 showPopupBlockedNotification(data.pop.split('|'), { preventDisplayEvent: true, quickOpen: true, domain: isExternalSite ? data.host : document.domain });
333 });
334
335 $(document).on('click', fnRemove);
336 }
337 }
338 } else {
339 removePendingNotificationParams();
340 }
341 }
342 }
343
344 function setSingleDisplayNotificationParams() {
345 var data = {
346 pop: location.href + '||',
347 display: true,
348 time: Date.now()
349 };
350
351 window.name = 'pp_pending_ntf:' + btoa(JSON.stringify(data));
352 }
353
354 function removePendingNotificationParams() {
355 if (window.name && window.name.indexOf("pp_pending_ntf:") == 0) {
356 window.name = "";
357 }
358 }
359
360 //popup blocked notification
361 function showPopupBlockedNotification(args) {
362 var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
363
364 var domain = props.domain;
365
366 notification.show({
367 title: (0, _utils.getI18N)('notificationMessage'),
368 quickOpen: props.quickOpen,
369 showHide: true,
370 showResize: true,
371 source: 'popup-blocked',
372 winArgs: args, //pop url / name / width + height
373 onClose: function onClose() {
374 removePendingNotificationParams();
375 },
376
377 buttons: {
378 allowOnce: function allowOnce() {
379 ntfShowManager.isActive = true;
380 },
381 allowAlways: function allowAlways() {
382 _storage2.default.get('pb_whitelist').then(function () {
383 var whitelist = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
384
385 whitelist.push(domain);
386
387 _storage2.default.set('pb_whitelist', whitelist);
388 });
389
390 if (!props.isExternalSite) {
391 (0, _utils.executeCode)("window.pbExternalCommand(0, \"" + pbMessage + "\");");
392 }
393 }
394 }
395 });
396 }
397
398 //an overlay blocked by recipe notification
399 function showRecipeOverlayNortification() {
400 notification.show({
401 title: (0, _utils.getI18N)("overlayWasBlocked"),
402 source: 'recipe-blocked',
403 showHide: true,
404 showResize: true,
405 buttons: {
406 NTF_allowOverlayOnce: function NTF_allowOverlayOnce() {
407 overlayKiller.restore();
408 }
409 }
410 });
411 }
412
413 function sendGoogleAnalyticsEvent(data) {
414 var _data$domain = data.domain,
415 domain = _data$domain === undefined ? document.domain : _data$domain;
416
417
418 sendMessageToBackground({
419 name: "trackEvent",
420 category: data.category,
421 action: data.action,
422 label: data.label,
423 isCount: data.isCount,
424 domain: domain
425 });
426 }
427
428 function initBlockFunctions() {
429 _storage2.default.get('pb_whitelist', 'pb_overlaylist', 'pb_popupBlackList').then(function (settings) {
430 settings.pb_whitelist = settings.pb_whitelist || [];
431 settings.pb_overlaylist = settings.pb_overlaylist || [];
432 settings.pb_popupBlackList = settings.pb_popupBlackList || [];
433
434 var whitelist = settings.pb_whitelist.concat(_const2.default.defaultWhiteList);
435
436 if (!(0, _utils.isDomainInList)(document.domain, whitelist)) {
437 var code = "(function () {\n var pb_message = \"" + pbMessage + "\";\n var pb_blacklist = " + JSON.stringify(settings.pb_popupBlackList) + ";\n var pb_whitelist = " + JSON.stringify(whitelist) + ";\n " + _inject.inject.toString() + ";\n inject();\n })();";
438
439 (0, _utils.executeCode)(code);
440
441 /*addScript({textContent: `${inject.toString()}`, id: "pb_blockScript"});
442 executeCode("var pb_blacklist = " + JSON.stringify(settings.pb_popupBlackList));
443 executeCode("var pb_whitelist = " + JSON.stringify(whitelist));
444 executeCode("inject()");*/
445 monitorBlocks(); // Previously this only ran if window = parent
446 }
447 });
448 }
449
450 initBlockFunctions();
451
452 // blocking popups - START
453 _storage2.default.get('pb_whitelist').then(function () {
454 var whitelist = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
455 //get whitelist
456 whitelist = whitelist.concat(_const2.default.defaultWhiteList);
457
458 if (!(0, _utils.isDomainInList)(document.domain, whitelist)) {
459 //if not in the whitelist
460 $("html").on("click", "a", onHyperLinkClicked); // listen to all link elements's click event
461 }
462 });
463
464 function isOverlayish(el) {
465 var winWidth = window.innerWidth;
466 var winHeight = window.innerHeight;
467
468 if (el.outerWidth() >= winWidth * 0.6 && el.outerHeight() >= winHeight * 0.75) {
469 return true;
470 }
471
472 return false;
473 }
474
475 function onHyperLinkClicked(e) {
476 var el = $(this);
477 var href = el.attr('href');
478 var target = el.attr('target') || '_self';
479
480 if (href && href !== '#' && target !== '_self') {
481 //only if has href and open in new tab/window
482 if (isOverlayish(el)) {
483 e.preventDefault();
484
485 parent.postMessage({
486 type: "blockedWindow",
487 args: JSON.stringify({ "0": href })
488 }, window.parent.location);
489 }
490 }
491 }
492 // blocking popups - END
493
494 function openUrl(url, notNewTab) {
495 sendMessageToBackground({ name: "openUrl", url: url, notNewTab: notNewTab });
496 }
497
498 //#TEMP
499 (function () {
500 (0, _attract2.default)(function (d) {
501 /*console.log(typeof d, d);*/receivedRecipes(d);
502 });
503 })();
504 })(jQuery.noConflict(true));
505
506 /*if (window == top) {
507 setTimeout(() =>{
508 window.onfocus = () =>{
509 sendMessageToBackground({name: "page", url: window.location.href});
510 };
511 }, 2000);
512
513 window.onbeforeunload = () =>{
514 sendMessageToBackground({name: "pageClosing", url: window.location.href});
515 return null;
516 };
517 }
518
519 function sendMessageToBackground(message){
520 chrome.runtime.sendMessage(message);
521 }*/
522
523/***/ }),
524/* 2 */
525/***/ (function(module, exports, __webpack_require__) {
526
527 'use strict';
528
529 Object.defineProperty(exports, "__esModule", {
530 value: true
531 });
532
533 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
534
535 var _jQuery = __webpack_require__(3);
536
537 var _jQuery2 = _interopRequireDefault(_jQuery);
538
539 var _storage = __webpack_require__(4);
540
541 var _storage2 = _interopRequireDefault(_storage);
542
543 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
544
545 function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
546
547 function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
548
549 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
550
551 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
552
553 var _Promise = typeof Promise === 'undefined' ? __webpack_require__(!(function webpackMissingModule() { var e = new Error("Cannot find module \"es6-promise\""); e.code = 'MODULE_NOT_FOUND'; throw e; }())).Promise : Promise;
554
555 var OverlayDectector = function () {
556 function OverlayDectector() {
557 _classCallCheck(this, OverlayDectector);
558
559 this.winWidth = window.innerWidth;
560 this.winHeight = window.innerHeight;
561 }
562
563 _createClass(OverlayDectector, [{
564 key: 'ALGO2',
565 value: function ALGO2(_ref) {
566 var x = _ref.x,
567 y = _ref.y,
568 mw = _ref.mw,
569 mh = _ref.mh;
570
571 var element = document.elementFromPoint(x, y);
572 var overlay = void 0;
573
574 if (element && this.notRootElement(element)) {
575 do {
576 var isOverlayish = this.isOverlayish({ el: element, minWidth: mw, minHeight: mh });
577
578 if (isOverlayish) {
579 overlay = element;
580 }
581
582 element = element.parentNode;
583 } while (!overlay && this.notRootElement(element));
584 }
585
586 return overlay;
587 }
588 }, {
589 key: 'notRootElement',
590 value: function notRootElement(element) {
591 return element != document.body && element != document && element != document.documentElement;
592 }
593 }, {
594 key: 'detectOverlayLayer',
595 value: function detectOverlayLayer(detectRange) {
596 var _iteratorNormalCompletion = true;
597 var _didIteratorError = false;
598 var _iteratorError = undefined;
599
600 try {
601 for (var _iterator = detectRange[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
602 var coords = _step.value;
603
604 var overlay = this.ALGO2(coords);
605
606 if (overlay) {
607 return this.getRecipe(overlay);
608 }
609 }
610 } catch (err) {
611 _didIteratorError = true;
612 _iteratorError = err;
613 } finally {
614 try {
615 if (!_iteratorNormalCompletion && _iterator.return) {
616 _iterator.return();
617 }
618 } finally {
619 if (_didIteratorError) {
620 throw _iteratorError;
621 }
622 }
623 }
624
625 return false;
626 }
627 }, {
628 key: 'find',
629 value: function find() {
630 var detect = {
631 AnySize: [{ x: this.winWidth / 2, y: this.winHeight / 2, mw: 100, mh: 100 }, { x: this.winWidth / 2, y: this.winHeight / 3, mw: 100, mh: 100 }],
632 FullScreen: [{ x: this.winWidth / 2, y: this.winHeight / 2, mw: this.winHeight * 0.9, mh: this.winHeight * 0.9 }]
633 };
634 var overlays = [],
635 recipe = void 0;
636
637 recipe = this.detectOverlayLayer(detect.AnySize);
638
639 if (recipe) {
640 overlays.push(this.hideByRecipe(recipe));
641
642 recipe = this.detectOverlayLayer(detect.FullScreen);
643
644 if (recipe) {
645 overlays.push(this.hideByRecipe(recipe));
646 }
647 }
648
649 return overlays;
650 }
651 }, {
652 key: 'getRecipe',
653 value: function getRecipe(el) {
654 var recipe = [];
655 var isSingleInstanceInDocument = function isSingleInstanceInDocument(recipe) {
656 return (0, _jQuery2.default)(recipe.join(' > ')).length == 1;
657 };
658
659 do {
660 var node = el.nodeName.toLowerCase();
661 var id = el.getAttribute('id');
662 var className = el.getAttribute('class');
663 var style = el.getAttribute('style');
664
665 if (id) {
666 recipe.unshift('#' + id.trim());
667
668 break;
669 } else if (className) {
670 recipe.unshift(node + '.' + className.trim().replace(/\s+/g, '.'));
671 } else {
672 recipe.unshift(node + '[style="' + style + '"]');
673 }
674
675 if (isSingleInstanceInDocument(recipe)) {
676 break;
677 }
678
679 el = el.parentNode;
680 } while (el != document.body);
681
682 if (isSingleInstanceInDocument(recipe)) {
683 return recipe.join(' > ');
684 }
685
686 return false;
687 }
688 }, {
689 key: 'hideByRecipe',
690 value: function hideByRecipe(recipe) {
691 var el = (0, _jQuery2.default)(recipe);
692 var css = el.prop('style').cssText;
693
694 el.prop('style').cssText = css + ';display:none !important;';
695
696 return { el: el, recipe: recipe, css: css };
697 }
698 }, {
699 key: 'isOverlayish',
700 value: function isOverlayish(_ref2) {
701 var el = _ref2.el,
702 minWidth = _ref2.minWidth,
703 minHeight = _ref2.minHeight;
704
705 var css = window.getComputedStyle(el);
706
707 if (css.display != 'none' && css.visibility != 'hidden' && /fixed|absolute/.test(css.position) && (css.zIndex == 'auto' || parseInt(css.zIndex) >= 0) && el.offsetWidth >= minWidth && el.offsetHeight >= minHeight) {
708 return [el, css.zIndex * 1];
709 }
710
711 return false;
712 }
713 }]);
714
715 return OverlayDectector;
716 }();
717
718 var OverlayKiller = function (_OverlayDectector) {
719 _inherits(OverlayKiller, _OverlayDectector);
720
721 function OverlayKiller() {
722 var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
723
724 _classCallCheck(this, OverlayKiller);
725
726 var _this = _possibleConstructorReturn(this, (OverlayKiller.__proto__ || Object.getPrototypeOf(OverlayKiller)).call(this));
727
728 _this.activeBlockList = [];
729 _this.activeRecepiesList = [];
730
731 _this.onAutoDetect = props.onAutoDetect || function () {};
732 _this.onUserRemove = props.onUserRemove || function () {};
733 _this.onBlockListFound = props.onBlockListFound || function () {};
734 _this.onRecipeFound = props.onRecipeFound || function () {};
735 _this.onRecipeNotFound = props.onRecipeNotFound || function () {};
736
737 _this.blackListPromise = _this.createBlockListFromStorage();
738
739 if (window == top) {
740 _this.autoDetect();
741 }
742 return _this;
743 }
744
745 _createClass(OverlayKiller, [{
746 key: 'hide',
747 value: function hide(recepies) {
748 var _this2 = this;
749
750 this.last = [];
751
752 recepies.forEach(function (recipe) {
753 _this2.last.push(_this2.hideByRecipe(recipe));
754 });
755 }
756 }, {
757 key: 'restore',
758 value: function restore() {
759 this.last.forEach(function (item) {
760 var el = item.el,
761 recipe = item.recipe,
762 css = item.css;
763
764
765 el.prop('style').cssText = css + ';display: block';
766
767 [].concat(_toConsumableArray((0, _jQuery2.default)('style.pp-remove-overlay'))).forEach(function (style) {
768 style = (0, _jQuery2.default)(style);
769
770 if (style.data('recipe') == btoa(recipe)) {
771 (0, _jQuery2.default)(style).remove();
772 }
773 });
774 });
775
776 window.dispatchEvent(new Event('resize')); //sometimes this makes the overlay to be centered properly when restored
777 }
778
779 // ======= remove overlay triggered by user ==========
780
781 }, {
782 key: 'remove',
783 value: function remove() {
784 var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
785
786 var overlays = this.find();
787
788 if (overlays.length) {
789 this.last = overlays;
790
791 this.createGlobalCSS();
792 this.onUserRemove({ success: true, recepies: overlays.map(function (o) {
793 return o.recipe;
794 }), props: props });
795 } else {
796 this.onUserRemove({ success: false, props: props });
797 }
798 }
799
800 // ===== add found overlay to local blacklist, <remove always> button from notification
801
802 }, {
803 key: 'addToLocalBlacklist',
804 value: function addToLocalBlacklist() {
805 var _this3 = this;
806
807 var domain = document.domain;
808 var url = location.href;
809
810 PBStorageSync.pb_overlayBlockedList.update(function () {
811 var list = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
812
813 var blocks = list[domain] || [];
814
815 blocks.push({
816 id: 'block-' + blocks.length,
817 url: url,
818 domain: domain,
819 recipe: _this3.last.map(function (item) {
820 return item.recipe;
821 }).join(', ')
822 });
823
824 list[domain] = blocks;
825
826 return list;
827 });
828 }
829
830 // ===== remove overlay from local blacklist
831
832 }, {
833 key: 'removeFromLocalBlacklist',
834 value: function removeFromLocalBlacklist() {
835 var _this4 = this;
836
837 var domain = document.domain;
838
839 PBStorageSync.pb_overlayBlockedList.update(function () {
840 var list = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
841
842 var blocks = list[domain] || [];
843 var lastRecepies = _this4.last.map(function (item) {
844 return item.recipe;
845 });
846
847 blocks = blocks.filter(function (item) {
848 return lastRecepies.indexOf(item.recipe) == -1;
849 });
850
851 list[domain] = blocks;
852
853 return list;
854 });
855 }
856
857 // ======= auto actions ==========
858
859 }, {
860 key: 'autoDetect',
861 value: function autoDetect() {
862 var _this5 = this;
863
864 var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
865
866 if (attempt < 40) {
867 //let overlay = this.find();
868 var foundBlockList = this.forceBlock(this.activeBlockList);
869 var foundRecipeList = this.forceBlock(this.activeRecepiesList);
870
871 /*if (overlay && !this.autoDetected) {
872 let recipe = btoa(this.getRecipe(overlay));
873 this.onAutoDetect(recipe);
874 this.autoDetected = true;
875 }*/
876
877 if (foundBlockList.length) {
878 this.onBlockListFound({ found: foundBlockList });
879 }
880
881 if (foundRecipeList.length) {
882 this.onRecipeFound({ found: foundRecipeList });
883 }
884
885 setTimeout(function () {
886 _this5.autoDetect(++attempt);
887 }, 250);
888 } else {
889 this.checkRecepiesSuccess();
890 }
891 }
892
893 //auto block all overlays from local db
894
895 }, {
896 key: 'createBlockListFromStorage',
897 value: function createBlockListFromStorage() {
898 var _this6 = this;
899
900 return new _Promise(function (resolve) {
901 _storage2.default.get('pb_overlayBlockedList').then(function () {
902 var list = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
903
904 if (list[document.domain]) {
905 _this6.activeBlockList = list[document.domain];
906
907 _this6.createBlockCSS(_this6.activeBlockList);
908 }
909
910 resolve();
911 });
912 });
913 }
914
915 //block all overlays found in recepies
916
917 }, {
918 key: 'createBlockListFromRecepies',
919 value: function createBlockListFromRecepies(recepies) {
920 var _this7 = this;
921
922 //local blacklist needs to be loaded before handeling recepies
923 this.blackListPromise.then(function () {
924 var blockList = _this7.activeBlockList.map(function (item) {
925 return item.recipe;
926 });
927
928 recepies = recepies.map(function (recipe) {
929 return {
930 recipe: recipe,
931 found: false
932 };
933 }).filter(function (item) {
934 return blockList.indexOf(item.recipe) == -1;
935 });
936
937 _this7.activeRecepiesList = recepies;
938
939 _this7.createBlockCSS(recepies);
940 });
941 }
942
943 //checks what recepies were found / not found and report
944
945 }, {
946 key: 'checkRecepiesSuccess',
947 value: function checkRecepiesSuccess() {
948 var notFound = this.activeRecepiesList.filter(function (item) {
949 return !item.found;
950 });
951
952 if (notFound.length) {
953 this.onRecipeNotFound(notFound);
954 }
955 }
956 }, {
957 key: 'createGlobalCSS',
958 value: function createGlobalCSS() {
959 var htmlStyle = (0, _jQuery2.default)('html').attr('style');
960 var bodyStyle = (0, _jQuery2.default)('body').attr('style');
961
962 (0, _jQuery2.default)('<style type="text/css">html, body {overflow:auto !important; }</style>').appendTo('head');
963 (0, _jQuery2.default)('html').attr('style', (htmlStyle ? htmlStyle + ';' : '') + 'overflow:auto !important;');
964 (0, _jQuery2.default)('body').attr('style', (bodyStyle ? bodyStyle + ';' : '') + 'overflow:auto !important;');
965 }
966
967 //blocks overlays with css for faster blocking
968
969 }, {
970 key: 'createBlockCSS',
971 value: function createBlockCSS(list) {
972 this.createGlobalCSS();
973
974 list.forEach(function (item) {
975 var css = item.recipe + ' { display:none !important; }';
976
977 (0, _jQuery2.default)('<style class="pp-remove-overlay" data-recipe="' + btoa(item.recipe) + '" type="text/css">' + css + '</style>').appendTo('head');
978 });
979 }
980
981 // ========= if block by css doesn't work, this will work, but only after DOM ready
982
983 }, {
984 key: 'forceBlock',
985 value: function forceBlock(list) {
986 var hide = [];
987
988 list.filter(function (item) {
989 return !item.found;
990 }).forEach(function (item) {
991 var overlay = (0, _jQuery2.default)(item.recipe);
992
993 if (overlay.length) {
994 item.found = true;
995
996 hide.push(item.recipe);
997 }
998 });
999
1000 if (hide.length) {
1001 this.hide(hide);
1002 }
1003
1004 return hide;
1005 }
1006 }]);
1007
1008 return OverlayKiller;
1009 }(OverlayDectector);
1010
1011 exports.default = OverlayKiller;
1012
1013/***/ }),
1014/* 3 */
1015/***/ (function(module, exports, __webpack_require__) {
1016
1017 var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
1018 * jQuery JavaScript Library v1.12.4
1019 * http://jquery.com/
1020 *
1021 * Includes Sizzle.js
1022 * http://sizzlejs.com/
1023 *
1024 * Copyright jQuery Foundation and other contributors
1025 * Released under the MIT license
1026 * http://jquery.org/license
1027 *
1028 * Date: 2016-05-20T17:17Z
1029 */
1030
1031 (function( global, factory ) {
1032
1033 if ( typeof module === "object" && typeof module.exports === "object" ) {
1034 // For CommonJS and CommonJS-like environments where a proper `window`
1035 // is present, execute the factory and get jQuery.
1036 // For environments that do not have a `window` with a `document`
1037 // (such as Node.js), expose a factory as module.exports.
1038 // This accentuates the need for the creation of a real `window`.
1039 // e.g. var jQuery = require("jquery")(window);
1040 // See ticket #14549 for more info.
1041 module.exports = global.document ?
1042 factory( global, true ) :
1043 function( w ) {
1044 if ( !w.document ) {
1045 throw new Error( "jQuery requires a window with a document" );
1046 }
1047 return factory( w );
1048 };
1049 } else {
1050 factory( global );
1051 }
1052
1053 // Pass this if window is not defined yet
1054 }(typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
1055
1056 // Support: Firefox 18+
1057 // Can't be in strict mode, several libs including ASP.NET trace
1058 // the stack via arguments.caller.callee and Firefox dies if
1059 // you try to trace through "use strict" call chains. (#13335)
1060 //"use strict";
1061 var deletedIds = [];
1062
1063 var document = window.document;
1064
1065 var slice = deletedIds.slice;
1066
1067 var concat = deletedIds.concat;
1068
1069 var push = deletedIds.push;
1070
1071 var indexOf = deletedIds.indexOf;
1072
1073 var class2type = {};
1074
1075 var toString = class2type.toString;
1076
1077 var hasOwn = class2type.hasOwnProperty;
1078
1079 var support = {};
1080
1081
1082
1083 var
1084 version = "1.12.4",
1085
1086 // Define a local copy of jQuery
1087 jQuery = function( selector, context ) {
1088
1089 // The jQuery object is actually just the init constructor 'enhanced'
1090 // Need init if jQuery is called (just allow error to be thrown if not included)
1091 return new jQuery.fn.init( selector, context );
1092 },
1093
1094 // Support: Android<4.1, IE<9
1095 // Make sure we trim BOM and NBSP
1096 rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
1097
1098 // Matches dashed string for camelizing
1099 rmsPrefix = /^-ms-/,
1100 rdashAlpha = /-([\da-z])/gi,
1101
1102 // Used by jQuery.camelCase as callback to replace()
1103 fcamelCase = function( all, letter ) {
1104 return letter.toUpperCase();
1105 };
1106
1107 jQuery.fn = jQuery.prototype = {
1108
1109 // The current version of jQuery being used
1110 jquery: version,
1111
1112 constructor: jQuery,
1113
1114 // Start with an empty selector
1115 selector: "",
1116
1117 // The default length of a jQuery object is 0
1118 length: 0,
1119
1120 toArray: function() {
1121 return slice.call( this );
1122 },
1123
1124 // Get the Nth element in the matched element set OR
1125 // Get the whole matched element set as a clean array
1126 get: function( num ) {
1127 return num != null ?
1128
1129 // Return just the one element from the set
1130 ( num < 0 ? this[ num + this.length ] : this[ num ] ) :
1131
1132 // Return all the elements in a clean array
1133 slice.call( this );
1134 },
1135
1136 // Take an array of elements and push it onto the stack
1137 // (returning the new matched element set)
1138 pushStack: function( elems ) {
1139
1140 // Build a new jQuery matched element set
1141 var ret = jQuery.merge( this.constructor(), elems );
1142
1143 // Add the old object onto the stack (as a reference)
1144 ret.prevObject = this;
1145 ret.context = this.context;
1146
1147 // Return the newly-formed element set
1148 return ret;
1149 },
1150
1151 // Execute a callback for every element in the matched set.
1152 each: function( callback ) {
1153 return jQuery.each( this, callback );
1154 },
1155
1156 map: function( callback ) {
1157 return this.pushStack( jQuery.map( this, function( elem, i ) {
1158 return callback.call( elem, i, elem );
1159 } ) );
1160 },
1161
1162 slice: function() {
1163 return this.pushStack( slice.apply( this, arguments ) );
1164 },
1165
1166 first: function() {
1167 return this.eq( 0 );
1168 },
1169
1170 last: function() {
1171 return this.eq( -1 );
1172 },
1173
1174 eq: function( i ) {
1175 var len = this.length,
1176 j = +i + ( i < 0 ? len : 0 );
1177 return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
1178 },
1179
1180 end: function() {
1181 return this.prevObject || this.constructor();
1182 },
1183
1184 // For internal use only.
1185 // Behaves like an Array's method, not like a jQuery method.
1186 push: push,
1187 sort: deletedIds.sort,
1188 splice: deletedIds.splice
1189 };
1190
1191 jQuery.extend = jQuery.fn.extend = function() {
1192 var src, copyIsArray, copy, name, options, clone,
1193 target = arguments[ 0 ] || {},
1194 i = 1,
1195 length = arguments.length,
1196 deep = false;
1197
1198 // Handle a deep copy situation
1199 if ( typeof target === "boolean" ) {
1200 deep = target;
1201
1202 // skip the boolean and the target
1203 target = arguments[ i ] || {};
1204 i++;
1205 }
1206
1207 // Handle case when target is a string or something (possible in deep copy)
1208 if ( typeof target !== "object" && !jQuery.isFunction( target ) ) {
1209 target = {};
1210 }
1211
1212 // extend jQuery itself if only one argument is passed
1213 if ( i === length ) {
1214 target = this;
1215 i--;
1216 }
1217
1218 for ( ; i < length; i++ ) {
1219
1220 // Only deal with non-null/undefined values
1221 if ( ( options = arguments[ i ] ) != null ) {
1222
1223 // Extend the base object
1224 for ( name in options ) {
1225 src = target[ name ];
1226 copy = options[ name ];
1227
1228 // Prevent never-ending loop
1229 if ( target === copy ) {
1230 continue;
1231 }
1232
1233 // Recurse if we're merging plain objects or arrays
1234 if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
1235 ( copyIsArray = jQuery.isArray( copy ) ) ) ) {
1236
1237 if ( copyIsArray ) {
1238 copyIsArray = false;
1239 clone = src && jQuery.isArray( src ) ? src : [];
1240
1241 } else {
1242 clone = src && jQuery.isPlainObject( src ) ? src : {};
1243 }
1244
1245 // Never move original objects, clone them
1246 target[ name ] = jQuery.extend( deep, clone, copy );
1247
1248 // Don't bring in undefined values
1249 } else if ( copy !== undefined ) {
1250 target[ name ] = copy;
1251 }
1252 }
1253 }
1254 }
1255
1256 // Return the modified object
1257 return target;
1258 };
1259
1260 jQuery.extend( {
1261
1262 // Unique for each copy of jQuery on the page
1263 expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
1264
1265 // Assume jQuery is ready without the ready module
1266 isReady: true,
1267
1268 error: function( msg ) {
1269 throw new Error( msg );
1270 },
1271
1272 noop: function() {},
1273
1274 // See test/unit/core.js for details concerning isFunction.
1275 // Since version 1.3, DOM methods and functions like alert
1276 // aren't supported. They return false on IE (#2968).
1277 isFunction: function( obj ) {
1278 return jQuery.type( obj ) === "function";
1279 },
1280
1281 isArray: Array.isArray || function( obj ) {
1282 return jQuery.type( obj ) === "array";
1283 },
1284
1285 isWindow: function( obj ) {
1286 /* jshint eqeqeq: false */
1287 return obj != null && obj == obj.window;
1288 },
1289
1290 isNumeric: function( obj ) {
1291
1292 // parseFloat NaNs numeric-cast false positives (null|true|false|"")
1293 // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
1294 // subtraction forces infinities to NaN
1295 // adding 1 corrects loss of precision from parseFloat (#15100)
1296 var realStringObj = obj && obj.toString();
1297 return !jQuery.isArray( obj ) && ( realStringObj - parseFloat( realStringObj ) + 1 ) >= 0;
1298 },
1299
1300 isEmptyObject: function( obj ) {
1301 var name;
1302 for ( name in obj ) {
1303 return false;
1304 }
1305 return true;
1306 },
1307
1308 isPlainObject: function( obj ) {
1309 var key;
1310
1311 // Must be an Object.
1312 // Because of IE, we also have to check the presence of the constructor property.
1313 // Make sure that DOM nodes and window objects don't pass through, as well
1314 if ( !obj || jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
1315 return false;
1316 }
1317
1318 try {
1319
1320 // Not own constructor property must be Object
1321 if ( obj.constructor &&
1322 !hasOwn.call( obj, "constructor" ) &&
1323 !hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) {
1324 return false;
1325 }
1326 } catch ( e ) {
1327
1328 // IE8,9 Will throw exceptions on certain host objects #9897
1329 return false;
1330 }
1331
1332 // Support: IE<9
1333 // Handle iteration over inherited properties before own properties.
1334 if ( !support.ownFirst ) {
1335 for ( key in obj ) {
1336 return hasOwn.call( obj, key );
1337 }
1338 }
1339
1340 // Own properties are enumerated firstly, so to speed up,
1341 // if last one is own, then all properties are own.
1342 for ( key in obj ) {}
1343
1344 return key === undefined || hasOwn.call( obj, key );
1345 },
1346
1347 type: function( obj ) {
1348 if ( obj == null ) {
1349 return obj + "";
1350 }
1351 return typeof obj === "object" || typeof obj === "function" ?
1352 class2type[ toString.call( obj ) ] || "object" :
1353 typeof obj;
1354 },
1355
1356 // Workarounds based on findings by Jim Driscoll
1357 // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
1358 globalEval: function( data ) {
1359 if ( data && jQuery.trim( data ) ) {
1360
1361 // We use execScript on Internet Explorer
1362 // We use an anonymous function so that context is window
1363 // rather than jQuery in Firefox
1364 ( window.execScript || function( data ) {
1365 window[ "eval" ].call( window, data ); // jscs:ignore requireDotNotation
1366 } )( data );
1367 }
1368 },
1369
1370 // Convert dashed to camelCase; used by the css and data modules
1371 // Microsoft forgot to hump their vendor prefix (#9572)
1372 camelCase: function( string ) {
1373 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
1374 },
1375
1376 nodeName: function( elem, name ) {
1377 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
1378 },
1379
1380 each: function( obj, callback ) {
1381 var length, i = 0;
1382
1383 if ( isArrayLike( obj ) ) {
1384 length = obj.length;
1385 for ( ; i < length; i++ ) {
1386 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
1387 break;
1388 }
1389 }
1390 } else {
1391 for ( i in obj ) {
1392 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
1393 break;
1394 }
1395 }
1396 }
1397
1398 return obj;
1399 },
1400
1401 // Support: Android<4.1, IE<9
1402 trim: function( text ) {
1403 return text == null ?
1404 "" :
1405 ( text + "" ).replace( rtrim, "" );
1406 },
1407
1408 // results is for internal usage only
1409 makeArray: function( arr, results ) {
1410 var ret = results || [];
1411
1412 if ( arr != null ) {
1413 if ( isArrayLike( Object( arr ) ) ) {
1414 jQuery.merge( ret,
1415 typeof arr === "string" ?
1416 [ arr ] : arr
1417 );
1418 } else {
1419 push.call( ret, arr );
1420 }
1421 }
1422
1423 return ret;
1424 },
1425
1426 inArray: function( elem, arr, i ) {
1427 var len;
1428
1429 if ( arr ) {
1430 if ( indexOf ) {
1431 return indexOf.call( arr, elem, i );
1432 }
1433
1434 len = arr.length;
1435 i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
1436
1437 for ( ; i < len; i++ ) {
1438
1439 // Skip accessing in sparse arrays
1440 if ( i in arr && arr[ i ] === elem ) {
1441 return i;
1442 }
1443 }
1444 }
1445
1446 return -1;
1447 },
1448
1449 merge: function( first, second ) {
1450 var len = +second.length,
1451 j = 0,
1452 i = first.length;
1453
1454 while ( j < len ) {
1455 first[ i++ ] = second[ j++ ];
1456 }
1457
1458 // Support: IE<9
1459 // Workaround casting of .length to NaN on otherwise arraylike objects (e.g., NodeLists)
1460 if ( len !== len ) {
1461 while ( second[ j ] !== undefined ) {
1462 first[ i++ ] = second[ j++ ];
1463 }
1464 }
1465
1466 first.length = i;
1467
1468 return first;
1469 },
1470
1471 grep: function( elems, callback, invert ) {
1472 var callbackInverse,
1473 matches = [],
1474 i = 0,
1475 length = elems.length,
1476 callbackExpect = !invert;
1477
1478 // Go through the array, only saving the items
1479 // that pass the validator function
1480 for ( ; i < length; i++ ) {
1481 callbackInverse = !callback( elems[ i ], i );
1482 if ( callbackInverse !== callbackExpect ) {
1483 matches.push( elems[ i ] );
1484 }
1485 }
1486
1487 return matches;
1488 },
1489
1490 // arg is for internal usage only
1491 map: function( elems, callback, arg ) {
1492 var length, value,
1493 i = 0,
1494 ret = [];
1495
1496 // Go through the array, translating each of the items to their new values
1497 if ( isArrayLike( elems ) ) {
1498 length = elems.length;
1499 for ( ; i < length; i++ ) {
1500 value = callback( elems[ i ], i, arg );
1501
1502 if ( value != null ) {
1503 ret.push( value );
1504 }
1505 }
1506
1507 // Go through every key on the object,
1508 } else {
1509 for ( i in elems ) {
1510 value = callback( elems[ i ], i, arg );
1511
1512 if ( value != null ) {
1513 ret.push( value );
1514 }
1515 }
1516 }
1517
1518 // Flatten any nested arrays
1519 return concat.apply( [], ret );
1520 },
1521
1522 // A global GUID counter for objects
1523 guid: 1,
1524
1525 // Bind a function to a context, optionally partially applying any
1526 // arguments.
1527 proxy: function( fn, context ) {
1528 var args, proxy, tmp;
1529
1530 if ( typeof context === "string" ) {
1531 tmp = fn[ context ];
1532 context = fn;
1533 fn = tmp;
1534 }
1535
1536 // Quick check to determine if target is callable, in the spec
1537 // this throws a TypeError, but we will just return undefined.
1538 if ( !jQuery.isFunction( fn ) ) {
1539 return undefined;
1540 }
1541
1542 // Simulated bind
1543 args = slice.call( arguments, 2 );
1544 proxy = function() {
1545 return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
1546 };
1547
1548 // Set the guid of unique handler to the same of original handler, so it can be removed
1549 proxy.guid = fn.guid = fn.guid || jQuery.guid++;
1550
1551 return proxy;
1552 },
1553
1554 now: function() {
1555 return +( new Date() );
1556 },
1557
1558 // jQuery.support is not used in Core but other projects attach their
1559 // properties to it so it needs to exist.
1560 support: support
1561 } );
1562
1563 // JSHint would error on this code due to the Symbol not being defined in ES5.
1564 // Defining this global in .jshintrc would create a danger of using the global
1565 // unguarded in another place, it seems safer to just disable JSHint for these
1566 // three lines.
1567 /* jshint ignore: start */
1568 if ( typeof Symbol === "function" ) {
1569 jQuery.fn[ Symbol.iterator ] = deletedIds[ Symbol.iterator ];
1570 }
1571 /* jshint ignore: end */
1572
1573 // Populate the class2type map
1574 jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
1575 function( i, name ) {
1576 class2type[ "[object " + name + "]" ] = name.toLowerCase();
1577 } );
1578
1579 function isArrayLike( obj ) {
1580
1581 // Support: iOS 8.2 (not reproducible in simulator)
1582 // `in` check used to prevent JIT error (gh-2145)
1583 // hasOwn isn't used here due to false negatives
1584 // regarding Nodelist length in IE
1585 var length = !!obj && "length" in obj && obj.length,
1586 type = jQuery.type( obj );
1587
1588 if ( type === "function" || jQuery.isWindow( obj ) ) {
1589 return false;
1590 }
1591
1592 return type === "array" || length === 0 ||
1593 typeof length === "number" && length > 0 && ( length - 1 ) in obj;
1594 }
1595 var Sizzle =
1596 /*!
1597 * Sizzle CSS Selector Engine v2.2.1
1598 * http://sizzlejs.com/
1599 *
1600 * Copyright jQuery Foundation and other contributors
1601 * Released under the MIT license
1602 * http://jquery.org/license
1603 *
1604 * Date: 2015-10-17
1605 */
1606 (function( window ) {
1607
1608 var i,
1609 support,
1610 Expr,
1611 getText,
1612 isXML,
1613 tokenize,
1614 compile,
1615 select,
1616 outermostContext,
1617 sortInput,
1618 hasDuplicate,
1619
1620 // Local document vars
1621 setDocument,
1622 document,
1623 docElem,
1624 documentIsHTML,
1625 rbuggyQSA,
1626 rbuggyMatches,
1627 matches,
1628 contains,
1629
1630 // Instance-specific data
1631 expando = "sizzle" + 1 * new Date(),
1632 preferredDoc = window.document,
1633 dirruns = 0,
1634 done = 0,
1635 classCache = createCache(),
1636 tokenCache = createCache(),
1637 compilerCache = createCache(),
1638 sortOrder = function( a, b ) {
1639 if ( a === b ) {
1640 hasDuplicate = true;
1641 }
1642 return 0;
1643 },
1644
1645 // General-purpose constants
1646 MAX_NEGATIVE = 1 << 31,
1647
1648 // Instance methods
1649 hasOwn = ({}).hasOwnProperty,
1650 arr = [],
1651 pop = arr.pop,
1652 push_native = arr.push,
1653 push = arr.push,
1654 slice = arr.slice,
1655 // Use a stripped-down indexOf as it's faster than native
1656 // http://jsperf.com/thor-indexof-vs-for/5
1657 indexOf = function( list, elem ) {
1658 var i = 0,
1659 len = list.length;
1660 for ( ; i < len; i++ ) {
1661 if ( list[i] === elem ) {
1662 return i;
1663 }
1664 }
1665 return -1;
1666 },
1667
1668 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
1669
1670 // Regular expressions
1671
1672 // http://www.w3.org/TR/css3-selectors/#whitespace
1673 whitespace = "[\\x20\\t\\r\\n\\f]",
1674
1675 // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
1676 identifier = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
1677
1678 // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
1679 attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
1680 // Operator (capture 2)
1681 "*([*^$|!~]?=)" + whitespace +
1682 // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
1683 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
1684 "*\\]",
1685
1686 pseudos = ":(" + identifier + ")(?:\\((" +
1687 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
1688 // 1. quoted (capture 3; capture 4 or capture 5)
1689 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
1690 // 2. simple (capture 6)
1691 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
1692 // 3. anything else (capture 2)
1693 ".*" +
1694 ")\\)|)",
1695
1696 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
1697 rwhitespace = new RegExp( whitespace + "+", "g" ),
1698 rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
1699
1700 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
1701 rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
1702
1703 rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
1704
1705 rpseudo = new RegExp( pseudos ),
1706 ridentifier = new RegExp( "^" + identifier + "$" ),
1707
1708 matchExpr = {
1709 "ID": new RegExp( "^#(" + identifier + ")" ),
1710 "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
1711 "TAG": new RegExp( "^(" + identifier + "|[*])" ),
1712 "ATTR": new RegExp( "^" + attributes ),
1713 "PSEUDO": new RegExp( "^" + pseudos ),
1714 "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
1715 "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
1716 "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
1717 "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
1718 // For use in libraries implementing .is()
1719 // We use this for POS matching in `select`
1720 "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
1721 whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
1722 },
1723
1724 rinputs = /^(?:input|select|textarea|button)$/i,
1725 rheader = /^h\d$/i,
1726
1727 rnative = /^[^{]+\{\s*\[native \w/,
1728
1729 // Easily-parseable/retrievable ID or TAG or CLASS selectors
1730 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
1731
1732 rsibling = /[+~]/,
1733 rescape = /'|\\/g,
1734
1735 // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
1736 runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
1737 funescape = function( _, escaped, escapedWhitespace ) {
1738 var high = "0x" + escaped - 0x10000;
1739 // NaN means non-codepoint
1740 // Support: Firefox<24
1741 // Workaround erroneous numeric interpretation of +"0x"
1742 return high !== high || escapedWhitespace ?
1743 escaped :
1744 high < 0 ?
1745 // BMP codepoint
1746 String.fromCharCode( high + 0x10000 ) :
1747 // Supplemental Plane codepoint (surrogate pair)
1748 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
1749 },
1750
1751 // Used for iframes
1752 // See setDocument()
1753 // Removing the function wrapper causes a "Permission Denied"
1754 // error in IE
1755 unloadHandler = function() {
1756 setDocument();
1757 };
1758
1759 // Optimize for push.apply( _, NodeList )
1760 try {
1761 push.apply(
1762 (arr = slice.call( preferredDoc.childNodes )),
1763 preferredDoc.childNodes
1764 );
1765 // Support: Android<4.0
1766 // Detect silently failing push.apply
1767 arr[ preferredDoc.childNodes.length ].nodeType;
1768 } catch ( e ) {
1769 push = { apply: arr.length ?
1770
1771 // Leverage slice if possible
1772 function( target, els ) {
1773 push_native.apply( target, slice.call(els) );
1774 } :
1775
1776 // Support: IE<9
1777 // Otherwise append directly
1778 function( target, els ) {
1779 var j = target.length,
1780 i = 0;
1781 // Can't trust NodeList.length
1782 while ( (target[j++] = els[i++]) ) {}
1783 target.length = j - 1;
1784 }
1785 };
1786 }
1787
1788 function Sizzle( selector, context, results, seed ) {
1789 var m, i, elem, nid, nidselect, match, groups, newSelector,
1790 newContext = context && context.ownerDocument,
1791
1792 // nodeType defaults to 9, since context defaults to document
1793 nodeType = context ? context.nodeType : 9;
1794
1795 results = results || [];
1796
1797 // Return early from calls with invalid selector or context
1798 if ( typeof selector !== "string" || !selector ||
1799 nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
1800
1801 return results;
1802 }
1803
1804 // Try to shortcut find operations (as opposed to filters) in HTML documents
1805 if ( !seed ) {
1806
1807 if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
1808 setDocument( context );
1809 }
1810 context = context || document;
1811
1812 if ( documentIsHTML ) {
1813
1814 // If the selector is sufficiently simple, try using a "get*By*" DOM method
1815 // (excepting DocumentFragment context, where the methods don't exist)
1816 if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
1817
1818 // ID selector
1819 if ( (m = match[1]) ) {
1820
1821 // Document context
1822 if ( nodeType === 9 ) {
1823 if ( (elem = context.getElementById( m )) ) {
1824
1825 // Support: IE, Opera, Webkit
1826 // TODO: identify versions
1827 // getElementById can match elements by name instead of ID
1828 if ( elem.id === m ) {
1829 results.push( elem );
1830 return results;
1831 }
1832 } else {
1833 return results;
1834 }
1835
1836 // Element context
1837 } else {
1838
1839 // Support: IE, Opera, Webkit
1840 // TODO: identify versions
1841 // getElementById can match elements by name instead of ID
1842 if ( newContext && (elem = newContext.getElementById( m )) &&
1843 contains( context, elem ) &&
1844 elem.id === m ) {
1845
1846 results.push( elem );
1847 return results;
1848 }
1849 }
1850
1851 // Type selector
1852 } else if ( match[2] ) {
1853 push.apply( results, context.getElementsByTagName( selector ) );
1854 return results;
1855
1856 // Class selector
1857 } else if ( (m = match[3]) && support.getElementsByClassName &&
1858 context.getElementsByClassName ) {
1859
1860 push.apply( results, context.getElementsByClassName( m ) );
1861 return results;
1862 }
1863 }
1864
1865 // Take advantage of querySelectorAll
1866 if ( support.qsa &&
1867 !compilerCache[ selector + " " ] &&
1868 (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
1869
1870 if ( nodeType !== 1 ) {
1871 newContext = context;
1872 newSelector = selector;
1873
1874 // qSA looks outside Element context, which is not what we want
1875 // Thanks to Andrew Dupont for this workaround technique
1876 // Support: IE <=8
1877 // Exclude object elements
1878 } else if ( context.nodeName.toLowerCase() !== "object" ) {
1879
1880 // Capture the context ID, setting it first if necessary
1881 if ( (nid = context.getAttribute( "id" )) ) {
1882 nid = nid.replace( rescape, "\\$&" );
1883 } else {
1884 context.setAttribute( "id", (nid = expando) );
1885 }
1886
1887 // Prefix every selector in the list
1888 groups = tokenize( selector );
1889 i = groups.length;
1890 nidselect = ridentifier.test( nid ) ? "#" + nid : "[id='" + nid + "']";
1891 while ( i-- ) {
1892 groups[i] = nidselect + " " + toSelector( groups[i] );
1893 }
1894 newSelector = groups.join( "," );
1895
1896 // Expand context for sibling selectors
1897 newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
1898 context;
1899 }
1900
1901 if ( newSelector ) {
1902 try {
1903 push.apply( results,
1904 newContext.querySelectorAll( newSelector )
1905 );
1906 return results;
1907 } catch ( qsaError ) {
1908 } finally {
1909 if ( nid === expando ) {
1910 context.removeAttribute( "id" );
1911 }
1912 }
1913 }
1914 }
1915 }
1916 }
1917
1918 // All others
1919 return select( selector.replace( rtrim, "$1" ), context, results, seed );
1920 }
1921
1922 /**
1923 * Create key-value caches of limited size
1924 * @returns {function(string, object)} Returns the Object data after storing it on itself with
1925 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
1926 * deleting the oldest entry
1927 */
1928 function createCache() {
1929 var keys = [];
1930
1931 function cache( key, value ) {
1932 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
1933 if ( keys.push( key + " " ) > Expr.cacheLength ) {
1934 // Only keep the most recent entries
1935 delete cache[ keys.shift() ];
1936 }
1937 return (cache[ key + " " ] = value);
1938 }
1939 return cache;
1940 }
1941
1942 /**
1943 * Mark a function for special use by Sizzle
1944 * @param {Function} fn The function to mark
1945 */
1946 function markFunction( fn ) {
1947 fn[ expando ] = true;
1948 return fn;
1949 }
1950
1951 /**
1952 * Support testing using an element
1953 * @param {Function} fn Passed the created div and expects a boolean result
1954 */
1955 function assert( fn ) {
1956 var div = document.createElement("div");
1957
1958 try {
1959 return !!fn( div );
1960 } catch (e) {
1961 return false;
1962 } finally {
1963 // Remove from its parent by default
1964 if ( div.parentNode ) {
1965 div.parentNode.removeChild( div );
1966 }
1967 // release memory in IE
1968 div = null;
1969 }
1970 }
1971
1972 /**
1973 * Adds the same handler for all of the specified attrs
1974 * @param {String} attrs Pipe-separated list of attributes
1975 * @param {Function} handler The method that will be applied
1976 */
1977 function addHandle( attrs, handler ) {
1978 var arr = attrs.split("|"),
1979 i = arr.length;
1980
1981 while ( i-- ) {
1982 Expr.attrHandle[ arr[i] ] = handler;
1983 }
1984 }
1985
1986 /**
1987 * Checks document order of two siblings
1988 * @param {Element} a
1989 * @param {Element} b
1990 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
1991 */
1992 function siblingCheck( a, b ) {
1993 var cur = b && a,
1994 diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
1995 ( ~b.sourceIndex || MAX_NEGATIVE ) -
1996 ( ~a.sourceIndex || MAX_NEGATIVE );
1997
1998 // Use IE sourceIndex if available on both nodes
1999 if ( diff ) {
2000 return diff;
2001 }
2002
2003 // Check if b follows a
2004 if ( cur ) {
2005 while ( (cur = cur.nextSibling) ) {
2006 if ( cur === b ) {
2007 return -1;
2008 }
2009 }
2010 }
2011
2012 return a ? 1 : -1;
2013 }
2014
2015 /**
2016 * Returns a function to use in pseudos for input types
2017 * @param {String} type
2018 */
2019 function createInputPseudo( type ) {
2020 return function( elem ) {
2021 var name = elem.nodeName.toLowerCase();
2022 return name === "input" && elem.type === type;
2023 };
2024 }
2025
2026 /**
2027 * Returns a function to use in pseudos for buttons
2028 * @param {String} type
2029 */
2030 function createButtonPseudo( type ) {
2031 return function( elem ) {
2032 var name = elem.nodeName.toLowerCase();
2033 return (name === "input" || name === "button") && elem.type === type;
2034 };
2035 }
2036
2037 /**
2038 * Returns a function to use in pseudos for positionals
2039 * @param {Function} fn
2040 */
2041 function createPositionalPseudo( fn ) {
2042 return markFunction(function( argument ) {
2043 argument = +argument;
2044 return markFunction(function( seed, matches ) {
2045 var j,
2046 matchIndexes = fn( [], seed.length, argument ),
2047 i = matchIndexes.length;
2048
2049 // Match elements found at the specified indexes
2050 while ( i-- ) {
2051 if ( seed[ (j = matchIndexes[i]) ] ) {
2052 seed[j] = !(matches[j] = seed[j]);
2053 }
2054 }
2055 });
2056 });
2057 }
2058
2059 /**
2060 * Checks a node for validity as a Sizzle context
2061 * @param {Element|Object=} context
2062 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
2063 */
2064 function testContext( context ) {
2065 return context && typeof context.getElementsByTagName !== "undefined" && context;
2066 }
2067
2068 // Expose support vars for convenience
2069 support = Sizzle.support = {};
2070
2071 /**
2072 * Detects XML nodes
2073 * @param {Element|Object} elem An element or a document
2074 * @returns {Boolean} True iff elem is a non-HTML XML node
2075 */
2076 isXML = Sizzle.isXML = function( elem ) {
2077 // documentElement is verified for cases where it doesn't yet exist
2078 // (such as loading iframes in IE - #4833)
2079 var documentElement = elem && (elem.ownerDocument || elem).documentElement;
2080 return documentElement ? documentElement.nodeName !== "HTML" : false;
2081 };
2082
2083 /**
2084 * Sets document-related variables once based on the current document
2085 * @param {Element|Object} [doc] An element or document object to use to set the document
2086 * @returns {Object} Returns the current document
2087 */
2088 setDocument = Sizzle.setDocument = function( node ) {
2089 var hasCompare, parent,
2090 doc = node ? node.ownerDocument || node : preferredDoc;
2091
2092 // Return early if doc is invalid or already selected
2093 if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
2094 return document;
2095 }
2096
2097 // Update global variables
2098 document = doc;
2099 docElem = document.documentElement;
2100 documentIsHTML = !isXML( document );
2101
2102 // Support: IE 9-11, Edge
2103 // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
2104 if ( (parent = document.defaultView) && parent.top !== parent ) {
2105 // Support: IE 11
2106 if ( parent.addEventListener ) {
2107 parent.addEventListener( "unload", unloadHandler, false );
2108
2109 // Support: IE 9 - 10 only
2110 } else if ( parent.attachEvent ) {
2111 parent.attachEvent( "onunload", unloadHandler );
2112 }
2113 }
2114
2115 /* Attributes
2116 ---------------------------------------------------------------------- */
2117
2118 // Support: IE<8
2119 // Verify that getAttribute really returns attributes and not properties
2120 // (excepting IE8 booleans)
2121 support.attributes = assert(function( div ) {
2122 div.className = "i";
2123 return !div.getAttribute("className");
2124 });
2125
2126 /* getElement(s)By*
2127 ---------------------------------------------------------------------- */
2128
2129 // Check if getElementsByTagName("*") returns only elements
2130 support.getElementsByTagName = assert(function( div ) {
2131 div.appendChild( document.createComment("") );
2132 return !div.getElementsByTagName("*").length;
2133 });
2134
2135 // Support: IE<9
2136 support.getElementsByClassName = rnative.test( document.getElementsByClassName );
2137
2138 // Support: IE<10
2139 // Check if getElementById returns elements by name
2140 // The broken getElementById methods don't pick up programatically-set names,
2141 // so use a roundabout getElementsByName test
2142 support.getById = assert(function( div ) {
2143 docElem.appendChild( div ).id = expando;
2144 return !document.getElementsByName || !document.getElementsByName( expando ).length;
2145 });
2146
2147 // ID find and filter
2148 if ( support.getById ) {
2149 Expr.find["ID"] = function( id, context ) {
2150 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
2151 var m = context.getElementById( id );
2152 return m ? [ m ] : [];
2153 }
2154 };
2155 Expr.filter["ID"] = function( id ) {
2156 var attrId = id.replace( runescape, funescape );
2157 return function( elem ) {
2158 return elem.getAttribute("id") === attrId;
2159 };
2160 };
2161 } else {
2162 // Support: IE6/7
2163 // getElementById is not reliable as a find shortcut
2164 delete Expr.find["ID"];
2165
2166 Expr.filter["ID"] = function( id ) {
2167 var attrId = id.replace( runescape, funescape );
2168 return function( elem ) {
2169 var node = typeof elem.getAttributeNode !== "undefined" &&
2170 elem.getAttributeNode("id");
2171 return node && node.value === attrId;
2172 };
2173 };
2174 }
2175
2176 // Tag
2177 Expr.find["TAG"] = support.getElementsByTagName ?
2178 function( tag, context ) {
2179 if ( typeof context.getElementsByTagName !== "undefined" ) {
2180 return context.getElementsByTagName( tag );
2181
2182 // DocumentFragment nodes don't have gEBTN
2183 } else if ( support.qsa ) {
2184 return context.querySelectorAll( tag );
2185 }
2186 } :
2187
2188 function( tag, context ) {
2189 var elem,
2190 tmp = [],
2191 i = 0,
2192 // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
2193 results = context.getElementsByTagName( tag );
2194
2195 // Filter out possible comments
2196 if ( tag === "*" ) {
2197 while ( (elem = results[i++]) ) {
2198 if ( elem.nodeType === 1 ) {
2199 tmp.push( elem );
2200 }
2201 }
2202
2203 return tmp;
2204 }
2205 return results;
2206 };
2207
2208 // Class
2209 Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
2210 if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
2211 return context.getElementsByClassName( className );
2212 }
2213 };
2214
2215 /* QSA/matchesSelector
2216 ---------------------------------------------------------------------- */
2217
2218 // QSA and matchesSelector support
2219
2220 // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
2221 rbuggyMatches = [];
2222
2223 // qSa(:focus) reports false when true (Chrome 21)
2224 // We allow this because of a bug in IE8/9 that throws an error
2225 // whenever `document.activeElement` is accessed on an iframe
2226 // So, we allow :focus to pass through QSA all the time to avoid the IE error
2227 // See http://bugs.jquery.com/ticket/13378
2228 rbuggyQSA = [];
2229
2230 if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
2231 // Build QSA regex
2232 // Regex strategy adopted from Diego Perini
2233 assert(function( div ) {
2234 // Select is set to empty string on purpose
2235 // This is to test IE's treatment of not explicitly
2236 // setting a boolean content attribute,
2237 // since its presence should be enough
2238 // http://bugs.jquery.com/ticket/12359
2239 docElem.appendChild( div ).innerHTML = "<a id='" + expando + "'></a>" +
2240 "<select id='" + expando + "-\r\\' msallowcapture=''>" +
2241 "<option selected=''></option></select>";
2242
2243 // Support: IE8, Opera 11-12.16
2244 // Nothing should be selected when empty strings follow ^= or $= or *=
2245 // The test attribute must be unknown in Opera but "safe" for WinRT
2246 // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
2247 if ( div.querySelectorAll("[msallowcapture^='']").length ) {
2248 rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
2249 }
2250
2251 // Support: IE8
2252 // Boolean attributes and "value" are not treated correctly
2253 if ( !div.querySelectorAll("[selected]").length ) {
2254 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
2255 }
2256
2257 // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
2258 if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
2259 rbuggyQSA.push("~=");
2260 }
2261
2262 // Webkit/Opera - :checked should return selected option elements
2263 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
2264 // IE8 throws error here and will not see later tests
2265 if ( !div.querySelectorAll(":checked").length ) {
2266 rbuggyQSA.push(":checked");
2267 }
2268
2269 // Support: Safari 8+, iOS 8+
2270 // https://bugs.webkit.org/show_bug.cgi?id=136851
2271 // In-page `selector#id sibing-combinator selector` fails
2272 if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) {
2273 rbuggyQSA.push(".#.+[+~]");
2274 }
2275 });
2276
2277 assert(function( div ) {
2278 // Support: Windows 8 Native Apps
2279 // The type and name attributes are restricted during .innerHTML assignment
2280 var input = document.createElement("input");
2281 input.setAttribute( "type", "hidden" );
2282 div.appendChild( input ).setAttribute( "name", "D" );
2283
2284 // Support: IE8
2285 // Enforce case-sensitivity of name attribute
2286 if ( div.querySelectorAll("[name=d]").length ) {
2287 rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
2288 }
2289
2290 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
2291 // IE8 throws error here and will not see later tests
2292 if ( !div.querySelectorAll(":enabled").length ) {
2293 rbuggyQSA.push( ":enabled", ":disabled" );
2294 }
2295
2296 // Opera 10-11 does not throw on post-comma invalid pseudos
2297 div.querySelectorAll("*,:x");
2298 rbuggyQSA.push(",.*:");
2299 });
2300 }
2301
2302 if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
2303 docElem.webkitMatchesSelector ||
2304 docElem.mozMatchesSelector ||
2305 docElem.oMatchesSelector ||
2306 docElem.msMatchesSelector) )) ) {
2307
2308 assert(function( div ) {
2309 // Check to see if it's possible to do matchesSelector
2310 // on a disconnected node (IE 9)
2311 support.disconnectedMatch = matches.call( div, "div" );
2312
2313 // This should fail with an exception
2314 // Gecko does not error, returns false instead
2315 matches.call( div, "[s!='']:x" );
2316 rbuggyMatches.push( "!=", pseudos );
2317 });
2318 }
2319
2320 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
2321 rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
2322
2323 /* Contains
2324 ---------------------------------------------------------------------- */
2325 hasCompare = rnative.test( docElem.compareDocumentPosition );
2326
2327 // Element contains another
2328 // Purposefully self-exclusive
2329 // As in, an element does not contain itself
2330 contains = hasCompare || rnative.test( docElem.contains ) ?
2331 function( a, b ) {
2332 var adown = a.nodeType === 9 ? a.documentElement : a,
2333 bup = b && b.parentNode;
2334 return a === bup || !!( bup && bup.nodeType === 1 && (
2335 adown.contains ?
2336 adown.contains( bup ) :
2337 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
2338 ));
2339 } :
2340 function( a, b ) {
2341 if ( b ) {
2342 while ( (b = b.parentNode) ) {
2343 if ( b === a ) {
2344 return true;
2345 }
2346 }
2347 }
2348 return false;
2349 };
2350
2351 /* Sorting
2352 ---------------------------------------------------------------------- */
2353
2354 // Document order sorting
2355 sortOrder = hasCompare ?
2356 function( a, b ) {
2357
2358 // Flag for duplicate removal
2359 if ( a === b ) {
2360 hasDuplicate = true;
2361 return 0;
2362 }
2363
2364 // Sort on method existence if only one input has compareDocumentPosition
2365 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
2366 if ( compare ) {
2367 return compare;
2368 }
2369
2370 // Calculate position if both inputs belong to the same document
2371 compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
2372 a.compareDocumentPosition( b ) :
2373
2374 // Otherwise we know they are disconnected
2375 1;
2376
2377 // Disconnected nodes
2378 if ( compare & 1 ||
2379 (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
2380
2381 // Choose the first element that is related to our preferred document
2382 if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
2383 return -1;
2384 }
2385 if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
2386 return 1;
2387 }
2388
2389 // Maintain original order
2390 return sortInput ?
2391 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
2392 0;
2393 }
2394
2395 return compare & 4 ? -1 : 1;
2396 } :
2397 function( a, b ) {
2398 // Exit early if the nodes are identical
2399 if ( a === b ) {
2400 hasDuplicate = true;
2401 return 0;
2402 }
2403
2404 var cur,
2405 i = 0,
2406 aup = a.parentNode,
2407 bup = b.parentNode,
2408 ap = [ a ],
2409 bp = [ b ];
2410
2411 // Parentless nodes are either documents or disconnected
2412 if ( !aup || !bup ) {
2413 return a === document ? -1 :
2414 b === document ? 1 :
2415 aup ? -1 :
2416 bup ? 1 :
2417 sortInput ?
2418 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
2419 0;
2420
2421 // If the nodes are siblings, we can do a quick check
2422 } else if ( aup === bup ) {
2423 return siblingCheck( a, b );
2424 }
2425
2426 // Otherwise we need full lists of their ancestors for comparison
2427 cur = a;
2428 while ( (cur = cur.parentNode) ) {
2429 ap.unshift( cur );
2430 }
2431 cur = b;
2432 while ( (cur = cur.parentNode) ) {
2433 bp.unshift( cur );
2434 }
2435
2436 // Walk down the tree looking for a discrepancy
2437 while ( ap[i] === bp[i] ) {
2438 i++;
2439 }
2440
2441 return i ?
2442 // Do a sibling check if the nodes have a common ancestor
2443 siblingCheck( ap[i], bp[i] ) :
2444
2445 // Otherwise nodes in our document sort first
2446 ap[i] === preferredDoc ? -1 :
2447 bp[i] === preferredDoc ? 1 :
2448 0;
2449 };
2450
2451 return document;
2452 };
2453
2454 Sizzle.matches = function( expr, elements ) {
2455 return Sizzle( expr, null, null, elements );
2456 };
2457
2458 Sizzle.matchesSelector = function( elem, expr ) {
2459 // Set document vars if needed
2460 if ( ( elem.ownerDocument || elem ) !== document ) {
2461 setDocument( elem );
2462 }
2463
2464 // Make sure that attribute selectors are quoted
2465 expr = expr.replace( rattributeQuotes, "='$1']" );
2466
2467 if ( support.matchesSelector && documentIsHTML &&
2468 !compilerCache[ expr + " " ] &&
2469 ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
2470 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
2471
2472 try {
2473 var ret = matches.call( elem, expr );
2474
2475 // IE 9's matchesSelector returns false on disconnected nodes
2476 if ( ret || support.disconnectedMatch ||
2477 // As well, disconnected nodes are said to be in a document
2478 // fragment in IE 9
2479 elem.document && elem.document.nodeType !== 11 ) {
2480 return ret;
2481 }
2482 } catch (e) {}
2483 }
2484
2485 return Sizzle( expr, document, null, [ elem ] ).length > 0;
2486 };
2487
2488 Sizzle.contains = function( context, elem ) {
2489 // Set document vars if needed
2490 if ( ( context.ownerDocument || context ) !== document ) {
2491 setDocument( context );
2492 }
2493 return contains( context, elem );
2494 };
2495
2496 Sizzle.attr = function( elem, name ) {
2497 // Set document vars if needed
2498 if ( ( elem.ownerDocument || elem ) !== document ) {
2499 setDocument( elem );
2500 }
2501
2502 var fn = Expr.attrHandle[ name.toLowerCase() ],
2503 // Don't get fooled by Object.prototype properties (jQuery #13807)
2504 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
2505 fn( elem, name, !documentIsHTML ) :
2506 undefined;
2507
2508 return val !== undefined ?
2509 val :
2510 support.attributes || !documentIsHTML ?
2511 elem.getAttribute( name ) :
2512 (val = elem.getAttributeNode(name)) && val.specified ?
2513 val.value :
2514 null;
2515 };
2516
2517 Sizzle.error = function( msg ) {
2518 throw new Error( "Syntax error, unrecognized expression: " + msg );
2519 };
2520
2521 /**
2522 * Document sorting and removing duplicates
2523 * @param {ArrayLike} results
2524 */
2525 Sizzle.uniqueSort = function( results ) {
2526 var elem,
2527 duplicates = [],
2528 j = 0,
2529 i = 0;
2530
2531 // Unless we *know* we can detect duplicates, assume their presence
2532 hasDuplicate = !support.detectDuplicates;
2533 sortInput = !support.sortStable && results.slice( 0 );
2534 results.sort( sortOrder );
2535
2536 if ( hasDuplicate ) {
2537 while ( (elem = results[i++]) ) {
2538 if ( elem === results[ i ] ) {
2539 j = duplicates.push( i );
2540 }
2541 }
2542 while ( j-- ) {
2543 results.splice( duplicates[ j ], 1 );
2544 }
2545 }
2546
2547 // Clear input after sorting to release objects
2548 // See https://github.com/jquery/sizzle/pull/225
2549 sortInput = null;
2550
2551 return results;
2552 };
2553
2554 /**
2555 * Utility function for retrieving the text value of an array of DOM nodes
2556 * @param {Array|Element} elem
2557 */
2558 getText = Sizzle.getText = function( elem ) {
2559 var node,
2560 ret = "",
2561 i = 0,
2562 nodeType = elem.nodeType;
2563
2564 if ( !nodeType ) {
2565 // If no nodeType, this is expected to be an array
2566 while ( (node = elem[i++]) ) {
2567 // Do not traverse comment nodes
2568 ret += getText( node );
2569 }
2570 } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
2571 // Use textContent for elements
2572 // innerText usage removed for consistency of new lines (jQuery #11153)
2573 if ( typeof elem.textContent === "string" ) {
2574 return elem.textContent;
2575 } else {
2576 // Traverse its children
2577 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
2578 ret += getText( elem );
2579 }
2580 }
2581 } else if ( nodeType === 3 || nodeType === 4 ) {
2582 return elem.nodeValue;
2583 }
2584 // Do not include comment or processing instruction nodes
2585
2586 return ret;
2587 };
2588
2589 Expr = Sizzle.selectors = {
2590
2591 // Can be adjusted by the user
2592 cacheLength: 50,
2593
2594 createPseudo: markFunction,
2595
2596 match: matchExpr,
2597
2598 attrHandle: {},
2599
2600 find: {},
2601
2602 relative: {
2603 ">": { dir: "parentNode", first: true },
2604 " ": { dir: "parentNode" },
2605 "+": { dir: "previousSibling", first: true },
2606 "~": { dir: "previousSibling" }
2607 },
2608
2609 preFilter: {
2610 "ATTR": function( match ) {
2611 match[1] = match[1].replace( runescape, funescape );
2612
2613 // Move the given value to match[3] whether quoted or unquoted
2614 match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
2615
2616 if ( match[2] === "~=" ) {
2617 match[3] = " " + match[3] + " ";
2618 }
2619
2620 return match.slice( 0, 4 );
2621 },
2622
2623 "CHILD": function( match ) {
2624 /* matches from matchExpr["CHILD"]
2625 1 type (only|nth|...)
2626 2 what (child|of-type)
2627 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
2628 4 xn-component of xn+y argument ([+-]?\d*n|)
2629 5 sign of xn-component
2630 6 x of xn-component
2631 7 sign of y-component
2632 8 y of y-component
2633 */
2634 match[1] = match[1].toLowerCase();
2635
2636 if ( match[1].slice( 0, 3 ) === "nth" ) {
2637 // nth-* requires argument
2638 if ( !match[3] ) {
2639 Sizzle.error( match[0] );
2640 }
2641
2642 // numeric x and y parameters for Expr.filter.CHILD
2643 // remember that false/true cast respectively to 0/1
2644 match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
2645 match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
2646
2647 // other types prohibit arguments
2648 } else if ( match[3] ) {
2649 Sizzle.error( match[0] );
2650 }
2651
2652 return match;
2653 },
2654
2655 "PSEUDO": function( match ) {
2656 var excess,
2657 unquoted = !match[6] && match[2];
2658
2659 if ( matchExpr["CHILD"].test( match[0] ) ) {
2660 return null;
2661 }
2662
2663 // Accept quoted arguments as-is
2664 if ( match[3] ) {
2665 match[2] = match[4] || match[5] || "";
2666
2667 // Strip excess characters from unquoted arguments
2668 } else if ( unquoted && rpseudo.test( unquoted ) &&
2669 // Get excess from tokenize (recursively)
2670 (excess = tokenize( unquoted, true )) &&
2671 // advance to the next closing parenthesis
2672 (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
2673
2674 // excess is a negative index
2675 match[0] = match[0].slice( 0, excess );
2676 match[2] = unquoted.slice( 0, excess );
2677 }
2678
2679 // Return only captures needed by the pseudo filter method (type and argument)
2680 return match.slice( 0, 3 );
2681 }
2682 },
2683
2684 filter: {
2685
2686 "TAG": function( nodeNameSelector ) {
2687 var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
2688 return nodeNameSelector === "*" ?
2689 function() { return true; } :
2690 function( elem ) {
2691 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
2692 };
2693 },
2694
2695 "CLASS": function( className ) {
2696 var pattern = classCache[ className + " " ];
2697
2698 return pattern ||
2699 (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
2700 classCache( className, function( elem ) {
2701 return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
2702 });
2703 },
2704
2705 "ATTR": function( name, operator, check ) {
2706 return function( elem ) {
2707 var result = Sizzle.attr( elem, name );
2708
2709 if ( result == null ) {
2710 return operator === "!=";
2711 }
2712 if ( !operator ) {
2713 return true;
2714 }
2715
2716 result += "";
2717
2718 return operator === "=" ? result === check :
2719 operator === "!=" ? result !== check :
2720 operator === "^=" ? check && result.indexOf( check ) === 0 :
2721 operator === "*=" ? check && result.indexOf( check ) > -1 :
2722 operator === "$=" ? check && result.slice( -check.length ) === check :
2723 operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
2724 operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
2725 false;
2726 };
2727 },
2728
2729 "CHILD": function( type, what, argument, first, last ) {
2730 var simple = type.slice( 0, 3 ) !== "nth",
2731 forward = type.slice( -4 ) !== "last",
2732 ofType = what === "of-type";
2733
2734 return first === 1 && last === 0 ?
2735
2736 // Shortcut for :nth-*(n)
2737 function( elem ) {
2738 return !!elem.parentNode;
2739 } :
2740
2741 function( elem, context, xml ) {
2742 var cache, uniqueCache, outerCache, node, nodeIndex, start,
2743 dir = simple !== forward ? "nextSibling" : "previousSibling",
2744 parent = elem.parentNode,
2745 name = ofType && elem.nodeName.toLowerCase(),
2746 useCache = !xml && !ofType,
2747 diff = false;
2748
2749 if ( parent ) {
2750
2751 // :(first|last|only)-(child|of-type)
2752 if ( simple ) {
2753 while ( dir ) {
2754 node = elem;
2755 while ( (node = node[ dir ]) ) {
2756 if ( ofType ?
2757 node.nodeName.toLowerCase() === name :
2758 node.nodeType === 1 ) {
2759
2760 return false;
2761 }
2762 }
2763 // Reverse direction for :only-* (if we haven't yet done so)
2764 start = dir = type === "only" && !start && "nextSibling";
2765 }
2766 return true;
2767 }
2768
2769 start = [ forward ? parent.firstChild : parent.lastChild ];
2770
2771 // non-xml :nth-child(...) stores cache data on `parent`
2772 if ( forward && useCache ) {
2773
2774 // Seek `elem` from a previously-cached index
2775
2776 // ...in a gzip-friendly way
2777 node = parent;
2778 outerCache = node[ expando ] || (node[ expando ] = {});
2779
2780 // Support: IE <9 only
2781 // Defend against cloned attroperties (jQuery gh-1709)
2782 uniqueCache = outerCache[ node.uniqueID ] ||
2783 (outerCache[ node.uniqueID ] = {});
2784
2785 cache = uniqueCache[ type ] || [];
2786 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
2787 diff = nodeIndex && cache[ 2 ];
2788 node = nodeIndex && parent.childNodes[ nodeIndex ];
2789
2790 while ( (node = ++nodeIndex && node && node[ dir ] ||
2791
2792 // Fallback to seeking `elem` from the start
2793 (diff = nodeIndex = 0) || start.pop()) ) {
2794
2795 // When found, cache indexes on `parent` and break
2796 if ( node.nodeType === 1 && ++diff && node === elem ) {
2797 uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
2798 break;
2799 }
2800 }
2801
2802 } else {
2803 // Use previously-cached element index if available
2804 if ( useCache ) {
2805 // ...in a gzip-friendly way
2806 node = elem;
2807 outerCache = node[ expando ] || (node[ expando ] = {});
2808
2809 // Support: IE <9 only
2810 // Defend against cloned attroperties (jQuery gh-1709)
2811 uniqueCache = outerCache[ node.uniqueID ] ||
2812 (outerCache[ node.uniqueID ] = {});
2813
2814 cache = uniqueCache[ type ] || [];
2815 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
2816 diff = nodeIndex;
2817 }
2818
2819 // xml :nth-child(...)
2820 // or :nth-last-child(...) or :nth(-last)?-of-type(...)
2821 if ( diff === false ) {
2822 // Use the same loop as above to seek `elem` from the start
2823 while ( (node = ++nodeIndex && node && node[ dir ] ||
2824 (diff = nodeIndex = 0) || start.pop()) ) {
2825
2826 if ( ( ofType ?
2827 node.nodeName.toLowerCase() === name :
2828 node.nodeType === 1 ) &&
2829 ++diff ) {
2830
2831 // Cache the index of each encountered element
2832 if ( useCache ) {
2833 outerCache = node[ expando ] || (node[ expando ] = {});
2834
2835 // Support: IE <9 only
2836 // Defend against cloned attroperties (jQuery gh-1709)
2837 uniqueCache = outerCache[ node.uniqueID ] ||
2838 (outerCache[ node.uniqueID ] = {});
2839
2840 uniqueCache[ type ] = [ dirruns, diff ];
2841 }
2842
2843 if ( node === elem ) {
2844 break;
2845 }
2846 }
2847 }
2848 }
2849 }
2850
2851 // Incorporate the offset, then check against cycle size
2852 diff -= last;
2853 return diff === first || ( diff % first === 0 && diff / first >= 0 );
2854 }
2855 };
2856 },
2857
2858 "PSEUDO": function( pseudo, argument ) {
2859 // pseudo-class names are case-insensitive
2860 // http://www.w3.org/TR/selectors/#pseudo-classes
2861 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
2862 // Remember that setFilters inherits from pseudos
2863 var args,
2864 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
2865 Sizzle.error( "unsupported pseudo: " + pseudo );
2866
2867 // The user may use createPseudo to indicate that
2868 // arguments are needed to create the filter function
2869 // just as Sizzle does
2870 if ( fn[ expando ] ) {
2871 return fn( argument );
2872 }
2873
2874 // But maintain support for old signatures
2875 if ( fn.length > 1 ) {
2876 args = [ pseudo, pseudo, "", argument ];
2877 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
2878 markFunction(function( seed, matches ) {
2879 var idx,
2880 matched = fn( seed, argument ),
2881 i = matched.length;
2882 while ( i-- ) {
2883 idx = indexOf( seed, matched[i] );
2884 seed[ idx ] = !( matches[ idx ] = matched[i] );
2885 }
2886 }) :
2887 function( elem ) {
2888 return fn( elem, 0, args );
2889 };
2890 }
2891
2892 return fn;
2893 }
2894 },
2895
2896 pseudos: {
2897 // Potentially complex pseudos
2898 "not": markFunction(function( selector ) {
2899 // Trim the selector passed to compile
2900 // to avoid treating leading and trailing
2901 // spaces as combinators
2902 var input = [],
2903 results = [],
2904 matcher = compile( selector.replace( rtrim, "$1" ) );
2905
2906 return matcher[ expando ] ?
2907 markFunction(function( seed, matches, context, xml ) {
2908 var elem,
2909 unmatched = matcher( seed, null, xml, [] ),
2910 i = seed.length;
2911
2912 // Match elements unmatched by `matcher`
2913 while ( i-- ) {
2914 if ( (elem = unmatched[i]) ) {
2915 seed[i] = !(matches[i] = elem);
2916 }
2917 }
2918 }) :
2919 function( elem, context, xml ) {
2920 input[0] = elem;
2921 matcher( input, null, xml, results );
2922 // Don't keep the element (issue #299)
2923 input[0] = null;
2924 return !results.pop();
2925 };
2926 }),
2927
2928 "has": markFunction(function( selector ) {
2929 return function( elem ) {
2930 return Sizzle( selector, elem ).length > 0;
2931 };
2932 }),
2933
2934 "contains": markFunction(function( text ) {
2935 text = text.replace( runescape, funescape );
2936 return function( elem ) {
2937 return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
2938 };
2939 }),
2940
2941 // "Whether an element is represented by a :lang() selector
2942 // is based solely on the element's language value
2943 // being equal to the identifier C,
2944 // or beginning with the identifier C immediately followed by "-".
2945 // The matching of C against the element's language value is performed case-insensitively.
2946 // The identifier C does not have to be a valid language name."
2947 // http://www.w3.org/TR/selectors/#lang-pseudo
2948 "lang": markFunction( function( lang ) {
2949 // lang value must be a valid identifier
2950 if ( !ridentifier.test(lang || "") ) {
2951 Sizzle.error( "unsupported lang: " + lang );
2952 }
2953 lang = lang.replace( runescape, funescape ).toLowerCase();
2954 return function( elem ) {
2955 var elemLang;
2956 do {
2957 if ( (elemLang = documentIsHTML ?
2958 elem.lang :
2959 elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
2960
2961 elemLang = elemLang.toLowerCase();
2962 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
2963 }
2964 } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
2965 return false;
2966 };
2967 }),
2968
2969 // Miscellaneous
2970 "target": function( elem ) {
2971 var hash = window.location && window.location.hash;
2972 return hash && hash.slice( 1 ) === elem.id;
2973 },
2974
2975 "root": function( elem ) {
2976 return elem === docElem;
2977 },
2978
2979 "focus": function( elem ) {
2980 return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
2981 },
2982
2983 // Boolean properties
2984 "enabled": function( elem ) {
2985 return elem.disabled === false;
2986 },
2987
2988 "disabled": function( elem ) {
2989 return elem.disabled === true;
2990 },
2991
2992 "checked": function( elem ) {
2993 // In CSS3, :checked should return both checked and selected elements
2994 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
2995 var nodeName = elem.nodeName.toLowerCase();
2996 return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
2997 },
2998
2999 "selected": function( elem ) {
3000 // Accessing this property makes selected-by-default
3001 // options in Safari work properly
3002 if ( elem.parentNode ) {
3003 elem.parentNode.selectedIndex;
3004 }
3005
3006 return elem.selected === true;
3007 },
3008
3009 // Contents
3010 "empty": function( elem ) {
3011 // http://www.w3.org/TR/selectors/#empty-pseudo
3012 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
3013 // but not by others (comment: 8; processing instruction: 7; etc.)
3014 // nodeType < 6 works because attributes (2) do not appear as children
3015 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
3016 if ( elem.nodeType < 6 ) {
3017 return false;
3018 }
3019 }
3020 return true;
3021 },
3022
3023 "parent": function( elem ) {
3024 return !Expr.pseudos["empty"]( elem );
3025 },
3026
3027 // Element/input types
3028 "header": function( elem ) {
3029 return rheader.test( elem.nodeName );
3030 },
3031
3032 "input": function( elem ) {
3033 return rinputs.test( elem.nodeName );
3034 },
3035
3036 "button": function( elem ) {
3037 var name = elem.nodeName.toLowerCase();
3038 return name === "input" && elem.type === "button" || name === "button";
3039 },
3040
3041 "text": function( elem ) {
3042 var attr;
3043 return elem.nodeName.toLowerCase() === "input" &&
3044 elem.type === "text" &&
3045
3046 // Support: IE<8
3047 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
3048 ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
3049 },
3050
3051 // Position-in-collection
3052 "first": createPositionalPseudo(function() {
3053 return [ 0 ];
3054 }),
3055
3056 "last": createPositionalPseudo(function( matchIndexes, length ) {
3057 return [ length - 1 ];
3058 }),
3059
3060 "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
3061 return [ argument < 0 ? argument + length : argument ];
3062 }),
3063
3064 "even": createPositionalPseudo(function( matchIndexes, length ) {
3065 var i = 0;
3066 for ( ; i < length; i += 2 ) {
3067 matchIndexes.push( i );
3068 }
3069 return matchIndexes;
3070 }),
3071
3072 "odd": createPositionalPseudo(function( matchIndexes, length ) {
3073 var i = 1;
3074 for ( ; i < length; i += 2 ) {
3075 matchIndexes.push( i );
3076 }
3077 return matchIndexes;
3078 }),
3079
3080 "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
3081 var i = argument < 0 ? argument + length : argument;
3082 for ( ; --i >= 0; ) {
3083 matchIndexes.push( i );
3084 }
3085 return matchIndexes;
3086 }),
3087
3088 "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
3089 var i = argument < 0 ? argument + length : argument;
3090 for ( ; ++i < length; ) {
3091 matchIndexes.push( i );
3092 }
3093 return matchIndexes;
3094 })
3095 }
3096 };
3097
3098 Expr.pseudos["nth"] = Expr.pseudos["eq"];
3099
3100 // Add button/input type pseudos
3101 for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
3102 Expr.pseudos[ i ] = createInputPseudo( i );
3103 }
3104 for ( i in { submit: true, reset: true } ) {
3105 Expr.pseudos[ i ] = createButtonPseudo( i );
3106 }
3107
3108 // Easy API for creating new setFilters
3109 function setFilters() {}
3110 setFilters.prototype = Expr.filters = Expr.pseudos;
3111 Expr.setFilters = new setFilters();
3112
3113 tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
3114 var matched, match, tokens, type,
3115 soFar, groups, preFilters,
3116 cached = tokenCache[ selector + " " ];
3117
3118 if ( cached ) {
3119 return parseOnly ? 0 : cached.slice( 0 );
3120 }
3121
3122 soFar = selector;
3123 groups = [];
3124 preFilters = Expr.preFilter;
3125
3126 while ( soFar ) {
3127
3128 // Comma and first run
3129 if ( !matched || (match = rcomma.exec( soFar )) ) {
3130 if ( match ) {
3131 // Don't consume trailing commas as valid
3132 soFar = soFar.slice( match[0].length ) || soFar;
3133 }
3134 groups.push( (tokens = []) );
3135 }
3136
3137 matched = false;
3138
3139 // Combinators
3140 if ( (match = rcombinators.exec( soFar )) ) {
3141 matched = match.shift();
3142 tokens.push({
3143 value: matched,
3144 // Cast descendant combinators to space
3145 type: match[0].replace( rtrim, " " )
3146 });
3147 soFar = soFar.slice( matched.length );
3148 }
3149
3150 // Filters
3151 for ( type in Expr.filter ) {
3152 if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
3153 (match = preFilters[ type ]( match ))) ) {
3154 matched = match.shift();
3155 tokens.push({
3156 value: matched,
3157 type: type,
3158 matches: match
3159 });
3160 soFar = soFar.slice( matched.length );
3161 }
3162 }
3163
3164 if ( !matched ) {
3165 break;
3166 }
3167 }
3168
3169 // Return the length of the invalid excess
3170 // if we're just parsing
3171 // Otherwise, throw an error or return tokens
3172 return parseOnly ?
3173 soFar.length :
3174 soFar ?
3175 Sizzle.error( selector ) :
3176 // Cache the tokens
3177 tokenCache( selector, groups ).slice( 0 );
3178 };
3179
3180 function toSelector( tokens ) {
3181 var i = 0,
3182 len = tokens.length,
3183 selector = "";
3184 for ( ; i < len; i++ ) {
3185 selector += tokens[i].value;
3186 }
3187 return selector;
3188 }
3189
3190 function addCombinator( matcher, combinator, base ) {
3191 var dir = combinator.dir,
3192 checkNonElements = base && dir === "parentNode",
3193 doneName = done++;
3194
3195 return combinator.first ?
3196 // Check against closest ancestor/preceding element
3197 function( elem, context, xml ) {
3198 while ( (elem = elem[ dir ]) ) {
3199 if ( elem.nodeType === 1 || checkNonElements ) {
3200 return matcher( elem, context, xml );
3201 }
3202 }
3203 } :
3204
3205 // Check against all ancestor/preceding elements
3206 function( elem, context, xml ) {
3207 var oldCache, uniqueCache, outerCache,
3208 newCache = [ dirruns, doneName ];
3209
3210 // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
3211 if ( xml ) {
3212 while ( (elem = elem[ dir ]) ) {
3213 if ( elem.nodeType === 1 || checkNonElements ) {
3214 if ( matcher( elem, context, xml ) ) {
3215 return true;
3216 }
3217 }
3218 }
3219 } else {
3220 while ( (elem = elem[ dir ]) ) {
3221 if ( elem.nodeType === 1 || checkNonElements ) {
3222 outerCache = elem[ expando ] || (elem[ expando ] = {});
3223
3224 // Support: IE <9 only
3225 // Defend against cloned attroperties (jQuery gh-1709)
3226 uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
3227
3228 if ( (oldCache = uniqueCache[ dir ]) &&
3229 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
3230
3231 // Assign to newCache so results back-propagate to previous elements
3232 return (newCache[ 2 ] = oldCache[ 2 ]);
3233 } else {
3234 // Reuse newcache so results back-propagate to previous elements
3235 uniqueCache[ dir ] = newCache;
3236
3237 // A match means we're done; a fail means we have to keep checking
3238 if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
3239 return true;
3240 }
3241 }
3242 }
3243 }
3244 }
3245 };
3246 }
3247
3248 function elementMatcher( matchers ) {
3249 return matchers.length > 1 ?
3250 function( elem, context, xml ) {
3251 var i = matchers.length;
3252 while ( i-- ) {
3253 if ( !matchers[i]( elem, context, xml ) ) {
3254 return false;
3255 }
3256 }
3257 return true;
3258 } :
3259 matchers[0];
3260 }
3261
3262 function multipleContexts( selector, contexts, results ) {
3263 var i = 0,
3264 len = contexts.length;
3265 for ( ; i < len; i++ ) {
3266 Sizzle( selector, contexts[i], results );
3267 }
3268 return results;
3269 }
3270
3271 function condense( unmatched, map, filter, context, xml ) {
3272 var elem,
3273 newUnmatched = [],
3274 i = 0,
3275 len = unmatched.length,
3276 mapped = map != null;
3277
3278 for ( ; i < len; i++ ) {
3279 if ( (elem = unmatched[i]) ) {
3280 if ( !filter || filter( elem, context, xml ) ) {
3281 newUnmatched.push( elem );
3282 if ( mapped ) {
3283 map.push( i );
3284 }
3285 }
3286 }
3287 }
3288
3289 return newUnmatched;
3290 }
3291
3292 function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
3293 if ( postFilter && !postFilter[ expando ] ) {
3294 postFilter = setMatcher( postFilter );
3295 }
3296 if ( postFinder && !postFinder[ expando ] ) {
3297 postFinder = setMatcher( postFinder, postSelector );
3298 }
3299 return markFunction(function( seed, results, context, xml ) {
3300 var temp, i, elem,
3301 preMap = [],
3302 postMap = [],
3303 preexisting = results.length,
3304
3305 // Get initial elements from seed or context
3306 elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
3307
3308 // Prefilter to get matcher input, preserving a map for seed-results synchronization
3309 matcherIn = preFilter && ( seed || !selector ) ?
3310 condense( elems, preMap, preFilter, context, xml ) :
3311 elems,
3312
3313 matcherOut = matcher ?
3314 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
3315 postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
3316
3317 // ...intermediate processing is necessary
3318 [] :
3319
3320 // ...otherwise use results directly
3321 results :
3322 matcherIn;
3323
3324 // Find primary matches
3325 if ( matcher ) {
3326 matcher( matcherIn, matcherOut, context, xml );
3327 }
3328
3329 // Apply postFilter
3330 if ( postFilter ) {
3331 temp = condense( matcherOut, postMap );
3332 postFilter( temp, [], context, xml );
3333
3334 // Un-match failing elements by moving them back to matcherIn
3335 i = temp.length;
3336 while ( i-- ) {
3337 if ( (elem = temp[i]) ) {
3338 matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
3339 }
3340 }
3341 }
3342
3343 if ( seed ) {
3344 if ( postFinder || preFilter ) {
3345 if ( postFinder ) {
3346 // Get the final matcherOut by condensing this intermediate into postFinder contexts
3347 temp = [];
3348 i = matcherOut.length;
3349 while ( i-- ) {
3350 if ( (elem = matcherOut[i]) ) {
3351 // Restore matcherIn since elem is not yet a final match
3352 temp.push( (matcherIn[i] = elem) );
3353 }
3354 }
3355 postFinder( null, (matcherOut = []), temp, xml );
3356 }
3357
3358 // Move matched elements from seed to results to keep them synchronized
3359 i = matcherOut.length;
3360 while ( i-- ) {
3361 if ( (elem = matcherOut[i]) &&
3362 (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
3363
3364 seed[temp] = !(results[temp] = elem);
3365 }
3366 }
3367 }
3368
3369 // Add elements to results, through postFinder if defined
3370 } else {
3371 matcherOut = condense(
3372 matcherOut === results ?
3373 matcherOut.splice( preexisting, matcherOut.length ) :
3374 matcherOut
3375 );
3376 if ( postFinder ) {
3377 postFinder( null, results, matcherOut, xml );
3378 } else {
3379 push.apply( results, matcherOut );
3380 }
3381 }
3382 });
3383 }
3384
3385 function matcherFromTokens( tokens ) {
3386 var checkContext, matcher, j,
3387 len = tokens.length,
3388 leadingRelative = Expr.relative[ tokens[0].type ],
3389 implicitRelative = leadingRelative || Expr.relative[" "],
3390 i = leadingRelative ? 1 : 0,
3391
3392 // The foundational matcher ensures that elements are reachable from top-level context(s)
3393 matchContext = addCombinator( function( elem ) {
3394 return elem === checkContext;
3395 }, implicitRelative, true ),
3396 matchAnyContext = addCombinator( function( elem ) {
3397 return indexOf( checkContext, elem ) > -1;
3398 }, implicitRelative, true ),
3399 matchers = [ function( elem, context, xml ) {
3400 var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
3401 (checkContext = context).nodeType ?
3402 matchContext( elem, context, xml ) :
3403 matchAnyContext( elem, context, xml ) );
3404 // Avoid hanging onto element (issue #299)
3405 checkContext = null;
3406 return ret;
3407 } ];
3408
3409 for ( ; i < len; i++ ) {
3410 if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
3411 matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
3412 } else {
3413 matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
3414
3415 // Return special upon seeing a positional matcher
3416 if ( matcher[ expando ] ) {
3417 // Find the next relative operator (if any) for proper handling
3418 j = ++i;
3419 for ( ; j < len; j++ ) {
3420 if ( Expr.relative[ tokens[j].type ] ) {
3421 break;
3422 }
3423 }
3424 return setMatcher(
3425 i > 1 && elementMatcher( matchers ),
3426 i > 1 && toSelector(
3427 // If the preceding token was a descendant combinator, insert an implicit any-element `*`
3428 tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
3429 ).replace( rtrim, "$1" ),
3430 matcher,
3431 i < j && matcherFromTokens( tokens.slice( i, j ) ),
3432 j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
3433 j < len && toSelector( tokens )
3434 );
3435 }
3436 matchers.push( matcher );
3437 }
3438 }
3439
3440 return elementMatcher( matchers );
3441 }
3442
3443 function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
3444 var bySet = setMatchers.length > 0,
3445 byElement = elementMatchers.length > 0,
3446 superMatcher = function( seed, context, xml, results, outermost ) {
3447 var elem, j, matcher,
3448 matchedCount = 0,
3449 i = "0",
3450 unmatched = seed && [],
3451 setMatched = [],
3452 contextBackup = outermostContext,
3453 // We must always have either seed elements or outermost context
3454 elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
3455 // Use integer dirruns iff this is the outermost matcher
3456 dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
3457 len = elems.length;
3458
3459 if ( outermost ) {
3460 outermostContext = context === document || context || outermost;
3461 }
3462
3463 // Add elements passing elementMatchers directly to results
3464 // Support: IE<9, Safari
3465 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
3466 for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
3467 if ( byElement && elem ) {
3468 j = 0;
3469 if ( !context && elem.ownerDocument !== document ) {
3470 setDocument( elem );
3471 xml = !documentIsHTML;
3472 }
3473 while ( (matcher = elementMatchers[j++]) ) {
3474 if ( matcher( elem, context || document, xml) ) {
3475 results.push( elem );
3476 break;
3477 }
3478 }
3479 if ( outermost ) {
3480 dirruns = dirrunsUnique;
3481 }
3482 }
3483
3484 // Track unmatched elements for set filters
3485 if ( bySet ) {
3486 // They will have gone through all possible matchers
3487 if ( (elem = !matcher && elem) ) {
3488 matchedCount--;
3489 }
3490
3491 // Lengthen the array for every element, matched or not
3492 if ( seed ) {
3493 unmatched.push( elem );
3494 }
3495 }
3496 }
3497
3498 // `i` is now the count of elements visited above, and adding it to `matchedCount`
3499 // makes the latter nonnegative.
3500 matchedCount += i;
3501
3502 // Apply set filters to unmatched elements
3503 // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
3504 // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
3505 // no element matchers and no seed.
3506 // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
3507 // case, which will result in a "00" `matchedCount` that differs from `i` but is also
3508 // numerically zero.
3509 if ( bySet && i !== matchedCount ) {
3510 j = 0;
3511 while ( (matcher = setMatchers[j++]) ) {
3512 matcher( unmatched, setMatched, context, xml );
3513 }
3514
3515 if ( seed ) {
3516 // Reintegrate element matches to eliminate the need for sorting
3517 if ( matchedCount > 0 ) {
3518 while ( i-- ) {
3519 if ( !(unmatched[i] || setMatched[i]) ) {
3520 setMatched[i] = pop.call( results );
3521 }
3522 }
3523 }
3524
3525 // Discard index placeholder values to get only actual matches
3526 setMatched = condense( setMatched );
3527 }
3528
3529 // Add matches to results
3530 push.apply( results, setMatched );
3531
3532 // Seedless set matches succeeding multiple successful matchers stipulate sorting
3533 if ( outermost && !seed && setMatched.length > 0 &&
3534 ( matchedCount + setMatchers.length ) > 1 ) {
3535
3536 Sizzle.uniqueSort( results );
3537 }
3538 }
3539
3540 // Override manipulation of globals by nested matchers
3541 if ( outermost ) {
3542 dirruns = dirrunsUnique;
3543 outermostContext = contextBackup;
3544 }
3545
3546 return unmatched;
3547 };
3548
3549 return bySet ?
3550 markFunction( superMatcher ) :
3551 superMatcher;
3552 }
3553
3554 compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
3555 var i,
3556 setMatchers = [],
3557 elementMatchers = [],
3558 cached = compilerCache[ selector + " " ];
3559
3560 if ( !cached ) {
3561 // Generate a function of recursive functions that can be used to check each element
3562 if ( !match ) {
3563 match = tokenize( selector );
3564 }
3565 i = match.length;
3566 while ( i-- ) {
3567 cached = matcherFromTokens( match[i] );
3568 if ( cached[ expando ] ) {
3569 setMatchers.push( cached );
3570 } else {
3571 elementMatchers.push( cached );
3572 }
3573 }
3574
3575 // Cache the compiled function
3576 cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
3577
3578 // Save selector and tokenization
3579 cached.selector = selector;
3580 }
3581 return cached;
3582 };
3583
3584 /**
3585 * A low-level selection function that works with Sizzle's compiled
3586 * selector functions
3587 * @param {String|Function} selector A selector or a pre-compiled
3588 * selector function built with Sizzle.compile
3589 * @param {Element} context
3590 * @param {Array} [results]
3591 * @param {Array} [seed] A set of elements to match against
3592 */
3593 select = Sizzle.select = function( selector, context, results, seed ) {
3594 var i, tokens, token, type, find,
3595 compiled = typeof selector === "function" && selector,
3596 match = !seed && tokenize( (selector = compiled.selector || selector) );
3597
3598 results = results || [];
3599
3600 // Try to minimize operations if there is only one selector in the list and no seed
3601 // (the latter of which guarantees us context)
3602 if ( match.length === 1 ) {
3603
3604 // Reduce context if the leading compound selector is an ID
3605 tokens = match[0] = match[0].slice( 0 );
3606 if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
3607 support.getById && context.nodeType === 9 && documentIsHTML &&
3608 Expr.relative[ tokens[1].type ] ) {
3609
3610 context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
3611 if ( !context ) {
3612 return results;
3613
3614 // Precompiled matchers will still verify ancestry, so step up a level
3615 } else if ( compiled ) {
3616 context = context.parentNode;
3617 }
3618
3619 selector = selector.slice( tokens.shift().value.length );
3620 }
3621
3622 // Fetch a seed set for right-to-left matching
3623 i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
3624 while ( i-- ) {
3625 token = tokens[i];
3626
3627 // Abort if we hit a combinator
3628 if ( Expr.relative[ (type = token.type) ] ) {
3629 break;
3630 }
3631 if ( (find = Expr.find[ type ]) ) {
3632 // Search, expanding context for leading sibling combinators
3633 if ( (seed = find(
3634 token.matches[0].replace( runescape, funescape ),
3635 rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
3636 )) ) {
3637
3638 // If seed is empty or no tokens remain, we can return early
3639 tokens.splice( i, 1 );
3640 selector = seed.length && toSelector( tokens );
3641 if ( !selector ) {
3642 push.apply( results, seed );
3643 return results;
3644 }
3645
3646 break;
3647 }
3648 }
3649 }
3650 }
3651
3652 // Compile and execute a filtering function if one is not provided
3653 // Provide `match` to avoid retokenization if we modified the selector above
3654 ( compiled || compile( selector, match ) )(
3655 seed,
3656 context,
3657 !documentIsHTML,
3658 results,
3659 !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
3660 );
3661 return results;
3662 };
3663
3664 // One-time assignments
3665
3666 // Sort stability
3667 support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
3668
3669 // Support: Chrome 14-35+
3670 // Always assume duplicates if they aren't passed to the comparison function
3671 support.detectDuplicates = !!hasDuplicate;
3672
3673 // Initialize against the default document
3674 setDocument();
3675
3676 // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
3677 // Detached nodes confoundingly follow *each other*
3678 support.sortDetached = assert(function( div1 ) {
3679 // Should return 1, but returns 4 (following)
3680 return div1.compareDocumentPosition( document.createElement("div") ) & 1;
3681 });
3682
3683 // Support: IE<8
3684 // Prevent attribute/property "interpolation"
3685 // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
3686 if ( !assert(function( div ) {
3687 div.innerHTML = "<a href='#'></a>";
3688 return div.firstChild.getAttribute("href") === "#" ;
3689 }) ) {
3690 addHandle( "type|href|height|width", function( elem, name, isXML ) {
3691 if ( !isXML ) {
3692 return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
3693 }
3694 });
3695 }
3696
3697 // Support: IE<9
3698 // Use defaultValue in place of getAttribute("value")
3699 if ( !support.attributes || !assert(function( div ) {
3700 div.innerHTML = "<input/>";
3701 div.firstChild.setAttribute( "value", "" );
3702 return div.firstChild.getAttribute( "value" ) === "";
3703 }) ) {
3704 addHandle( "value", function( elem, name, isXML ) {
3705 if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
3706 return elem.defaultValue;
3707 }
3708 });
3709 }
3710
3711 // Support: IE<9
3712 // Use getAttributeNode to fetch booleans when getAttribute lies
3713 if ( !assert(function( div ) {
3714 return div.getAttribute("disabled") == null;
3715 }) ) {
3716 addHandle( booleans, function( elem, name, isXML ) {
3717 var val;
3718 if ( !isXML ) {
3719 return elem[ name ] === true ? name.toLowerCase() :
3720 (val = elem.getAttributeNode( name )) && val.specified ?
3721 val.value :
3722 null;
3723 }
3724 });
3725 }
3726
3727 return Sizzle;
3728
3729 })( window );
3730
3731
3732
3733 jQuery.find = Sizzle;
3734 jQuery.expr = Sizzle.selectors;
3735 jQuery.expr[ ":" ] = jQuery.expr.pseudos;
3736 jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
3737 jQuery.text = Sizzle.getText;
3738 jQuery.isXMLDoc = Sizzle.isXML;
3739 jQuery.contains = Sizzle.contains;
3740
3741
3742
3743 var dir = function( elem, dir, until ) {
3744 var matched = [],
3745 truncate = until !== undefined;
3746
3747 while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
3748 if ( elem.nodeType === 1 ) {
3749 if ( truncate && jQuery( elem ).is( until ) ) {
3750 break;
3751 }
3752 matched.push( elem );
3753 }
3754 }
3755 return matched;
3756 };
3757
3758
3759 var siblings = function( n, elem ) {
3760 var matched = [];
3761
3762 for ( ; n; n = n.nextSibling ) {
3763 if ( n.nodeType === 1 && n !== elem ) {
3764 matched.push( n );
3765 }
3766 }
3767
3768 return matched;
3769 };
3770
3771
3772 var rneedsContext = jQuery.expr.match.needsContext;
3773
3774 var rsingleTag = ( /^<([\w-]+)\s*\/?>(?:<\/\1>|)$/ );
3775
3776
3777
3778 var risSimple = /^.[^:#\[\.,]*$/;
3779
3780 // Implement the identical functionality for filter and not
3781 function winnow( elements, qualifier, not ) {
3782 if ( jQuery.isFunction( qualifier ) ) {
3783 return jQuery.grep( elements, function( elem, i ) {
3784 /* jshint -W018 */
3785 return !!qualifier.call( elem, i, elem ) !== not;
3786 } );
3787
3788 }
3789
3790 if ( qualifier.nodeType ) {
3791 return jQuery.grep( elements, function( elem ) {
3792 return ( elem === qualifier ) !== not;
3793 } );
3794
3795 }
3796
3797 if ( typeof qualifier === "string" ) {
3798 if ( risSimple.test( qualifier ) ) {
3799 return jQuery.filter( qualifier, elements, not );
3800 }
3801
3802 qualifier = jQuery.filter( qualifier, elements );
3803 }
3804
3805 return jQuery.grep( elements, function( elem ) {
3806 return ( jQuery.inArray( elem, qualifier ) > -1 ) !== not;
3807 } );
3808 }
3809
3810 jQuery.filter = function( expr, elems, not ) {
3811 var elem = elems[ 0 ];
3812
3813 if ( not ) {
3814 expr = ":not(" + expr + ")";
3815 }
3816
3817 return elems.length === 1 && elem.nodeType === 1 ?
3818 jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] :
3819 jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
3820 return elem.nodeType === 1;
3821 } ) );
3822 };
3823
3824 jQuery.fn.extend( {
3825 find: function( selector ) {
3826 var i,
3827 ret = [],
3828 self = this,
3829 len = self.length;
3830
3831 if ( typeof selector !== "string" ) {
3832 return this.pushStack( jQuery( selector ).filter( function() {
3833 for ( i = 0; i < len; i++ ) {
3834 if ( jQuery.contains( self[ i ], this ) ) {
3835 return true;
3836 }
3837 }
3838 } ) );
3839 }
3840
3841 for ( i = 0; i < len; i++ ) {
3842 jQuery.find( selector, self[ i ], ret );
3843 }
3844
3845 // Needed because $( selector, context ) becomes $( context ).find( selector )
3846 ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
3847 ret.selector = this.selector ? this.selector + " " + selector : selector;
3848 return ret;
3849 },
3850 filter: function( selector ) {
3851 return this.pushStack( winnow( this, selector || [], false ) );
3852 },
3853 not: function( selector ) {
3854 return this.pushStack( winnow( this, selector || [], true ) );
3855 },
3856 is: function( selector ) {
3857 return !!winnow(
3858 this,
3859
3860 // If this is a positional/relative selector, check membership in the returned set
3861 // so $("p:first").is("p:last") won't return true for a doc with two "p".
3862 typeof selector === "string" && rneedsContext.test( selector ) ?
3863 jQuery( selector ) :
3864 selector || [],
3865 false
3866 ).length;
3867 }
3868 } );
3869
3870
3871 // Initialize a jQuery object
3872
3873
3874 // A central reference to the root jQuery(document)
3875 var rootjQuery,
3876
3877 // A simple way to check for HTML strings
3878 // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
3879 // Strict HTML recognition (#11290: must start with <)
3880 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
3881
3882 init = jQuery.fn.init = function( selector, context, root ) {
3883 var match, elem;
3884
3885 // HANDLE: $(""), $(null), $(undefined), $(false)
3886 if ( !selector ) {
3887 return this;
3888 }
3889
3890 // init accepts an alternate rootjQuery
3891 // so migrate can support jQuery.sub (gh-2101)
3892 root = root || rootjQuery;
3893
3894 // Handle HTML strings
3895 if ( typeof selector === "string" ) {
3896 if ( selector.charAt( 0 ) === "<" &&
3897 selector.charAt( selector.length - 1 ) === ">" &&
3898 selector.length >= 3 ) {
3899
3900 // Assume that strings that start and end with <> are HTML and skip the regex check
3901 match = [ null, selector, null ];
3902
3903 } else {
3904 match = rquickExpr.exec( selector );
3905 }
3906
3907 // Match html or make sure no context is specified for #id
3908 if ( match && ( match[ 1 ] || !context ) ) {
3909
3910 // HANDLE: $(html) -> $(array)
3911 if ( match[ 1 ] ) {
3912 context = context instanceof jQuery ? context[ 0 ] : context;
3913
3914 // scripts is true for back-compat
3915 // Intentionally let the error be thrown if parseHTML is not present
3916 jQuery.merge( this, jQuery.parseHTML(
3917 match[ 1 ],
3918 context && context.nodeType ? context.ownerDocument || context : document,
3919 true
3920 ) );
3921
3922 // HANDLE: $(html, props)
3923 if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
3924 for ( match in context ) {
3925
3926 // Properties of context are called as methods if possible
3927 if ( jQuery.isFunction( this[ match ] ) ) {
3928 this[ match ]( context[ match ] );
3929
3930 // ...and otherwise set as attributes
3931 } else {
3932 this.attr( match, context[ match ] );
3933 }
3934 }
3935 }
3936
3937 return this;
3938
3939 // HANDLE: $(#id)
3940 } else {
3941 elem = document.getElementById( match[ 2 ] );
3942
3943 // Check parentNode to catch when Blackberry 4.6 returns
3944 // nodes that are no longer in the document #6963
3945 if ( elem && elem.parentNode ) {
3946
3947 // Handle the case where IE and Opera return items
3948 // by name instead of ID
3949 if ( elem.id !== match[ 2 ] ) {
3950 return rootjQuery.find( selector );
3951 }
3952
3953 // Otherwise, we inject the element directly into the jQuery object
3954 this.length = 1;
3955 this[ 0 ] = elem;
3956 }
3957
3958 this.context = document;
3959 this.selector = selector;
3960 return this;
3961 }
3962
3963 // HANDLE: $(expr, $(...))
3964 } else if ( !context || context.jquery ) {
3965 return ( context || root ).find( selector );
3966
3967 // HANDLE: $(expr, context)
3968 // (which is just equivalent to: $(context).find(expr)
3969 } else {
3970 return this.constructor( context ).find( selector );
3971 }
3972
3973 // HANDLE: $(DOMElement)
3974 } else if ( selector.nodeType ) {
3975 this.context = this[ 0 ] = selector;
3976 this.length = 1;
3977 return this;
3978
3979 // HANDLE: $(function)
3980 // Shortcut for document ready
3981 } else if ( jQuery.isFunction( selector ) ) {
3982 return typeof root.ready !== "undefined" ?
3983 root.ready( selector ) :
3984
3985 // Execute immediately if ready is not present
3986 selector( jQuery );
3987 }
3988
3989 if ( selector.selector !== undefined ) {
3990 this.selector = selector.selector;
3991 this.context = selector.context;
3992 }
3993
3994 return jQuery.makeArray( selector, this );
3995 };
3996
3997 // Give the init function the jQuery prototype for later instantiation
3998 init.prototype = jQuery.fn;
3999
4000 // Initialize central reference
4001 rootjQuery = jQuery( document );
4002
4003
4004 var rparentsprev = /^(?:parents|prev(?:Until|All))/,
4005
4006 // methods guaranteed to produce a unique set when starting from a unique set
4007 guaranteedUnique = {
4008 children: true,
4009 contents: true,
4010 next: true,
4011 prev: true
4012 };
4013
4014 jQuery.fn.extend( {
4015 has: function( target ) {
4016 var i,
4017 targets = jQuery( target, this ),
4018 len = targets.length;
4019
4020 return this.filter( function() {
4021 for ( i = 0; i < len; i++ ) {
4022 if ( jQuery.contains( this, targets[ i ] ) ) {
4023 return true;
4024 }
4025 }
4026 } );
4027 },
4028
4029 closest: function( selectors, context ) {
4030 var cur,
4031 i = 0,
4032 l = this.length,
4033 matched = [],
4034 pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
4035 jQuery( selectors, context || this.context ) :
4036 0;
4037
4038 for ( ; i < l; i++ ) {
4039 for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
4040
4041 // Always skip document fragments
4042 if ( cur.nodeType < 11 && ( pos ?
4043 pos.index( cur ) > -1 :
4044
4045 // Don't pass non-elements to Sizzle
4046 cur.nodeType === 1 &&
4047 jQuery.find.matchesSelector( cur, selectors ) ) ) {
4048
4049 matched.push( cur );
4050 break;
4051 }
4052 }
4053 }
4054
4055 return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
4056 },
4057
4058 // Determine the position of an element within
4059 // the matched set of elements
4060 index: function( elem ) {
4061
4062 // No argument, return index in parent
4063 if ( !elem ) {
4064 return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
4065 }
4066
4067 // index in selector
4068 if ( typeof elem === "string" ) {
4069 return jQuery.inArray( this[ 0 ], jQuery( elem ) );
4070 }
4071
4072 // Locate the position of the desired element
4073 return jQuery.inArray(
4074
4075 // If it receives a jQuery object, the first element is used
4076 elem.jquery ? elem[ 0 ] : elem, this );
4077 },
4078
4079 add: function( selector, context ) {
4080 return this.pushStack(
4081 jQuery.uniqueSort(
4082 jQuery.merge( this.get(), jQuery( selector, context ) )
4083 )
4084 );
4085 },
4086
4087 addBack: function( selector ) {
4088 return this.add( selector == null ?
4089 this.prevObject : this.prevObject.filter( selector )
4090 );
4091 }
4092 } );
4093
4094 function sibling( cur, dir ) {
4095 do {
4096 cur = cur[ dir ];
4097 } while ( cur && cur.nodeType !== 1 );
4098
4099 return cur;
4100 }
4101
4102 jQuery.each( {
4103 parent: function( elem ) {
4104 var parent = elem.parentNode;
4105 return parent && parent.nodeType !== 11 ? parent : null;
4106 },
4107 parents: function( elem ) {
4108 return dir( elem, "parentNode" );
4109 },
4110 parentsUntil: function( elem, i, until ) {
4111 return dir( elem, "parentNode", until );
4112 },
4113 next: function( elem ) {
4114 return sibling( elem, "nextSibling" );
4115 },
4116 prev: function( elem ) {
4117 return sibling( elem, "previousSibling" );
4118 },
4119 nextAll: function( elem ) {
4120 return dir( elem, "nextSibling" );
4121 },
4122 prevAll: function( elem ) {
4123 return dir( elem, "previousSibling" );
4124 },
4125 nextUntil: function( elem, i, until ) {
4126 return dir( elem, "nextSibling", until );
4127 },
4128 prevUntil: function( elem, i, until ) {
4129 return dir( elem, "previousSibling", until );
4130 },
4131 siblings: function( elem ) {
4132 return siblings( ( elem.parentNode || {} ).firstChild, elem );
4133 },
4134 children: function( elem ) {
4135 return siblings( elem.firstChild );
4136 },
4137 contents: function( elem ) {
4138 return jQuery.nodeName( elem, "iframe" ) ?
4139 elem.contentDocument || elem.contentWindow.document :
4140 jQuery.merge( [], elem.childNodes );
4141 }
4142 }, function( name, fn ) {
4143 jQuery.fn[ name ] = function( until, selector ) {
4144 var ret = jQuery.map( this, fn, until );
4145
4146 if ( name.slice( -5 ) !== "Until" ) {
4147 selector = until;
4148 }
4149
4150 if ( selector && typeof selector === "string" ) {
4151 ret = jQuery.filter( selector, ret );
4152 }
4153
4154 if ( this.length > 1 ) {
4155
4156 // Remove duplicates
4157 if ( !guaranteedUnique[ name ] ) {
4158 ret = jQuery.uniqueSort( ret );
4159 }
4160
4161 // Reverse order for parents* and prev-derivatives
4162 if ( rparentsprev.test( name ) ) {
4163 ret = ret.reverse();
4164 }
4165 }
4166
4167 return this.pushStack( ret );
4168 };
4169 } );
4170 var rnotwhite = ( /\S+/g );
4171
4172
4173
4174 // Convert String-formatted options into Object-formatted ones
4175 function createOptions( options ) {
4176 var object = {};
4177 jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) {
4178 object[ flag ] = true;
4179 } );
4180 return object;
4181 }
4182
4183 /*
4184 * Create a callback list using the following parameters:
4185 *
4186 * options: an optional list of space-separated options that will change how
4187 * the callback list behaves or a more traditional option object
4188 *
4189 * By default a callback list will act like an event callback list and can be
4190 * "fired" multiple times.
4191 *
4192 * Possible options:
4193 *
4194 * once: will ensure the callback list can only be fired once (like a Deferred)
4195 *
4196 * memory: will keep track of previous values and will call any callback added
4197 * after the list has been fired right away with the latest "memorized"
4198 * values (like a Deferred)
4199 *
4200 * unique: will ensure a callback can only be added once (no duplicate in the list)
4201 *
4202 * stopOnFalse: interrupt callings when a callback returns false
4203 *
4204 */
4205 jQuery.Callbacks = function( options ) {
4206
4207 // Convert options from String-formatted to Object-formatted if needed
4208 // (we check in cache first)
4209 options = typeof options === "string" ?
4210 createOptions( options ) :
4211 jQuery.extend( {}, options );
4212
4213 var // Flag to know if list is currently firing
4214 firing,
4215
4216 // Last fire value for non-forgettable lists
4217 memory,
4218
4219 // Flag to know if list was already fired
4220 fired,
4221
4222 // Flag to prevent firing
4223 locked,
4224
4225 // Actual callback list
4226 list = [],
4227
4228 // Queue of execution data for repeatable lists
4229 queue = [],
4230
4231 // Index of currently firing callback (modified by add/remove as needed)
4232 firingIndex = -1,
4233
4234 // Fire callbacks
4235 fire = function() {
4236
4237 // Enforce single-firing
4238 locked = options.once;
4239
4240 // Execute callbacks for all pending executions,
4241 // respecting firingIndex overrides and runtime changes
4242 fired = firing = true;
4243 for ( ; queue.length; firingIndex = -1 ) {
4244 memory = queue.shift();
4245 while ( ++firingIndex < list.length ) {
4246
4247 // Run callback and check for early termination
4248 if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
4249 options.stopOnFalse ) {
4250
4251 // Jump to end and forget the data so .add doesn't re-fire
4252 firingIndex = list.length;
4253 memory = false;
4254 }
4255 }
4256 }
4257
4258 // Forget the data if we're done with it
4259 if ( !options.memory ) {
4260 memory = false;
4261 }
4262
4263 firing = false;
4264
4265 // Clean up if we're done firing for good
4266 if ( locked ) {
4267
4268 // Keep an empty list if we have data for future add calls
4269 if ( memory ) {
4270 list = [];
4271
4272 // Otherwise, this object is spent
4273 } else {
4274 list = "";
4275 }
4276 }
4277 },
4278
4279 // Actual Callbacks object
4280 self = {
4281
4282 // Add a callback or a collection of callbacks to the list
4283 add: function() {
4284 if ( list ) {
4285
4286 // If we have memory from a past run, we should fire after adding
4287 if ( memory && !firing ) {
4288 firingIndex = list.length - 1;
4289 queue.push( memory );
4290 }
4291
4292 ( function add( args ) {
4293 jQuery.each( args, function( _, arg ) {
4294 if ( jQuery.isFunction( arg ) ) {
4295 if ( !options.unique || !self.has( arg ) ) {
4296 list.push( arg );
4297 }
4298 } else if ( arg && arg.length && jQuery.type( arg ) !== "string" ) {
4299
4300 // Inspect recursively
4301 add( arg );
4302 }
4303 } );
4304 } )( arguments );
4305
4306 if ( memory && !firing ) {
4307 fire();
4308 }
4309 }
4310 return this;
4311 },
4312
4313 // Remove a callback from the list
4314 remove: function() {
4315 jQuery.each( arguments, function( _, arg ) {
4316 var index;
4317 while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
4318 list.splice( index, 1 );
4319
4320 // Handle firing indexes
4321 if ( index <= firingIndex ) {
4322 firingIndex--;
4323 }
4324 }
4325 } );
4326 return this;
4327 },
4328
4329 // Check if a given callback is in the list.
4330 // If no argument is given, return whether or not list has callbacks attached.
4331 has: function( fn ) {
4332 return fn ?
4333 jQuery.inArray( fn, list ) > -1 :
4334 list.length > 0;
4335 },
4336
4337 // Remove all callbacks from the list
4338 empty: function() {
4339 if ( list ) {
4340 list = [];
4341 }
4342 return this;
4343 },
4344
4345 // Disable .fire and .add
4346 // Abort any current/pending executions
4347 // Clear all callbacks and values
4348 disable: function() {
4349 locked = queue = [];
4350 list = memory = "";
4351 return this;
4352 },
4353 disabled: function() {
4354 return !list;
4355 },
4356
4357 // Disable .fire
4358 // Also disable .add unless we have memory (since it would have no effect)
4359 // Abort any pending executions
4360 lock: function() {
4361 locked = true;
4362 if ( !memory ) {
4363 self.disable();
4364 }
4365 return this;
4366 },
4367 locked: function() {
4368 return !!locked;
4369 },
4370
4371 // Call all callbacks with the given context and arguments
4372 fireWith: function( context, args ) {
4373 if ( !locked ) {
4374 args = args || [];
4375 args = [ context, args.slice ? args.slice() : args ];
4376 queue.push( args );
4377 if ( !firing ) {
4378 fire();
4379 }
4380 }
4381 return this;
4382 },
4383
4384 // Call all the callbacks with the given arguments
4385 fire: function() {
4386 self.fireWith( this, arguments );
4387 return this;
4388 },
4389
4390 // To know if the callbacks have already been called at least once
4391 fired: function() {
4392 return !!fired;
4393 }
4394 };
4395
4396 return self;
4397 };
4398
4399
4400 jQuery.extend( {
4401
4402 Deferred: function( func ) {
4403 var tuples = [
4404
4405 // action, add listener, listener list, final state
4406 [ "resolve", "done", jQuery.Callbacks( "once memory" ), "resolved" ],
4407 [ "reject", "fail", jQuery.Callbacks( "once memory" ), "rejected" ],
4408 [ "notify", "progress", jQuery.Callbacks( "memory" ) ]
4409 ],
4410 state = "pending",
4411 promise = {
4412 state: function() {
4413 return state;
4414 },
4415 always: function() {
4416 deferred.done( arguments ).fail( arguments );
4417 return this;
4418 },
4419 then: function( /* fnDone, fnFail, fnProgress */ ) {
4420 var fns = arguments;
4421 return jQuery.Deferred( function( newDefer ) {
4422 jQuery.each( tuples, function( i, tuple ) {
4423 var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
4424
4425 // deferred[ done | fail | progress ] for forwarding actions to newDefer
4426 deferred[ tuple[ 1 ] ]( function() {
4427 var returned = fn && fn.apply( this, arguments );
4428 if ( returned && jQuery.isFunction( returned.promise ) ) {
4429 returned.promise()
4430 .progress( newDefer.notify )
4431 .done( newDefer.resolve )
4432 .fail( newDefer.reject );
4433 } else {
4434 newDefer[ tuple[ 0 ] + "With" ](
4435 this === promise ? newDefer.promise() : this,
4436 fn ? [ returned ] : arguments
4437 );
4438 }
4439 } );
4440 } );
4441 fns = null;
4442 } ).promise();
4443 },
4444
4445 // Get a promise for this deferred
4446 // If obj is provided, the promise aspect is added to the object
4447 promise: function( obj ) {
4448 return obj != null ? jQuery.extend( obj, promise ) : promise;
4449 }
4450 },
4451 deferred = {};
4452
4453 // Keep pipe for back-compat
4454 promise.pipe = promise.then;
4455
4456 // Add list-specific methods
4457 jQuery.each( tuples, function( i, tuple ) {
4458 var list = tuple[ 2 ],
4459 stateString = tuple[ 3 ];
4460
4461 // promise[ done | fail | progress ] = list.add
4462 promise[ tuple[ 1 ] ] = list.add;
4463
4464 // Handle state
4465 if ( stateString ) {
4466 list.add( function() {
4467
4468 // state = [ resolved | rejected ]
4469 state = stateString;
4470
4471 // [ reject_list | resolve_list ].disable; progress_list.lock
4472 }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
4473 }
4474
4475 // deferred[ resolve | reject | notify ]
4476 deferred[ tuple[ 0 ] ] = function() {
4477 deferred[ tuple[ 0 ] + "With" ]( this === deferred ? promise : this, arguments );
4478 return this;
4479 };
4480 deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
4481 } );
4482
4483 // Make the deferred a promise
4484 promise.promise( deferred );
4485
4486 // Call given func if any
4487 if ( func ) {
4488 func.call( deferred, deferred );
4489 }
4490
4491 // All done!
4492 return deferred;
4493 },
4494
4495 // Deferred helper
4496 when: function( subordinate /* , ..., subordinateN */ ) {
4497 var i = 0,
4498 resolveValues = slice.call( arguments ),
4499 length = resolveValues.length,
4500
4501 // the count of uncompleted subordinates
4502 remaining = length !== 1 ||
4503 ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
4504
4505 // the master Deferred.
4506 // If resolveValues consist of only a single Deferred, just use that.
4507 deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
4508
4509 // Update function for both resolve and progress values
4510 updateFunc = function( i, contexts, values ) {
4511 return function( value ) {
4512 contexts[ i ] = this;
4513 values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
4514 if ( values === progressValues ) {
4515 deferred.notifyWith( contexts, values );
4516
4517 } else if ( !( --remaining ) ) {
4518 deferred.resolveWith( contexts, values );
4519 }
4520 };
4521 },
4522
4523 progressValues, progressContexts, resolveContexts;
4524
4525 // add listeners to Deferred subordinates; treat others as resolved
4526 if ( length > 1 ) {
4527 progressValues = new Array( length );
4528 progressContexts = new Array( length );
4529 resolveContexts = new Array( length );
4530 for ( ; i < length; i++ ) {
4531 if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
4532 resolveValues[ i ].promise()
4533 .progress( updateFunc( i, progressContexts, progressValues ) )
4534 .done( updateFunc( i, resolveContexts, resolveValues ) )
4535 .fail( deferred.reject );
4536 } else {
4537 --remaining;
4538 }
4539 }
4540 }
4541
4542 // if we're not waiting on anything, resolve the master
4543 if ( !remaining ) {
4544 deferred.resolveWith( resolveContexts, resolveValues );
4545 }
4546
4547 return deferred.promise();
4548 }
4549 } );
4550
4551
4552 // The deferred used on DOM ready
4553 var readyList;
4554
4555 jQuery.fn.ready = function( fn ) {
4556
4557 // Add the callback
4558 jQuery.ready.promise().done( fn );
4559
4560 return this;
4561 };
4562
4563 jQuery.extend( {
4564
4565 // Is the DOM ready to be used? Set to true once it occurs.
4566 isReady: false,
4567
4568 // A counter to track how many items to wait for before
4569 // the ready event fires. See #6781
4570 readyWait: 1,
4571
4572 // Hold (or release) the ready event
4573 holdReady: function( hold ) {
4574 if ( hold ) {
4575 jQuery.readyWait++;
4576 } else {
4577 jQuery.ready( true );
4578 }
4579 },
4580
4581 // Handle when the DOM is ready
4582 ready: function( wait ) {
4583
4584 // Abort if there are pending holds or we're already ready
4585 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
4586 return;
4587 }
4588
4589 // Remember that the DOM is ready
4590 jQuery.isReady = true;
4591
4592 // If a normal DOM Ready event fired, decrement, and wait if need be
4593 if ( wait !== true && --jQuery.readyWait > 0 ) {
4594 return;
4595 }
4596
4597 // If there are functions bound, to execute
4598 readyList.resolveWith( document, [ jQuery ] );
4599
4600 // Trigger any bound ready events
4601 if ( jQuery.fn.triggerHandler ) {
4602 jQuery( document ).triggerHandler( "ready" );
4603 jQuery( document ).off( "ready" );
4604 }
4605 }
4606 } );
4607
4608 /**
4609 * Clean-up method for dom ready events
4610 */
4611 function detach() {
4612 if ( document.addEventListener ) {
4613 document.removeEventListener( "DOMContentLoaded", completed );
4614 window.removeEventListener( "load", completed );
4615
4616 } else {
4617 document.detachEvent( "onreadystatechange", completed );
4618 window.detachEvent( "onload", completed );
4619 }
4620 }
4621
4622 /**
4623 * The ready event handler and self cleanup method
4624 */
4625 function completed() {
4626
4627 // readyState === "complete" is good enough for us to call the dom ready in oldIE
4628 if ( document.addEventListener ||
4629 window.event.type === "load" ||
4630 document.readyState === "complete" ) {
4631
4632 detach();
4633 jQuery.ready();
4634 }
4635 }
4636
4637 jQuery.ready.promise = function( obj ) {
4638 if ( !readyList ) {
4639
4640 readyList = jQuery.Deferred();
4641
4642 // Catch cases where $(document).ready() is called
4643 // after the browser event has already occurred.
4644 // Support: IE6-10
4645 // Older IE sometimes signals "interactive" too soon
4646 if ( document.readyState === "complete" ||
4647 ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
4648
4649 // Handle it asynchronously to allow scripts the opportunity to delay ready
4650 window.setTimeout( jQuery.ready );
4651
4652 // Standards-based browsers support DOMContentLoaded
4653 } else if ( document.addEventListener ) {
4654
4655 // Use the handy event callback
4656 document.addEventListener( "DOMContentLoaded", completed );
4657
4658 // A fallback to window.onload, that will always work
4659 window.addEventListener( "load", completed );
4660
4661 // If IE event model is used
4662 } else {
4663
4664 // Ensure firing before onload, maybe late but safe also for iframes
4665 document.attachEvent( "onreadystatechange", completed );
4666
4667 // A fallback to window.onload, that will always work
4668 window.attachEvent( "onload", completed );
4669
4670 // If IE and not a frame
4671 // continually check to see if the document is ready
4672 var top = false;
4673
4674 try {
4675 top = window.frameElement == null && document.documentElement;
4676 } catch ( e ) {}
4677
4678 if ( top && top.doScroll ) {
4679 ( function doScrollCheck() {
4680 if ( !jQuery.isReady ) {
4681
4682 try {
4683
4684 // Use the trick by Diego Perini
4685 // http://javascript.nwbox.com/IEContentLoaded/
4686 top.doScroll( "left" );
4687 } catch ( e ) {
4688 return window.setTimeout( doScrollCheck, 50 );
4689 }
4690
4691 // detach all dom ready events
4692 detach();
4693
4694 // and execute any waiting functions
4695 jQuery.ready();
4696 }
4697 } )();
4698 }
4699 }
4700 }
4701 return readyList.promise( obj );
4702 };
4703
4704 // Kick off the DOM ready check even if the user does not
4705 jQuery.ready.promise();
4706
4707
4708
4709
4710 // Support: IE<9
4711 // Iteration over object's inherited properties before its own
4712 var i;
4713 for ( i in jQuery( support ) ) {
4714 break;
4715 }
4716 support.ownFirst = i === "0";
4717
4718 // Note: most support tests are defined in their respective modules.
4719 // false until the test is run
4720 support.inlineBlockNeedsLayout = false;
4721
4722 // Execute ASAP in case we need to set body.style.zoom
4723 jQuery( function() {
4724
4725 // Minified: var a,b,c,d
4726 var val, div, body, container;
4727
4728 body = document.getElementsByTagName( "body" )[ 0 ];
4729 if ( !body || !body.style ) {
4730
4731 // Return for frameset docs that don't have a body
4732 return;
4733 }
4734
4735 // Setup
4736 div = document.createElement( "div" );
4737 container = document.createElement( "div" );
4738 container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px";
4739 body.appendChild( container ).appendChild( div );
4740
4741 if ( typeof div.style.zoom !== "undefined" ) {
4742
4743 // Support: IE<8
4744 // Check if natively block-level elements act like inline-block
4745 // elements when setting their display to 'inline' and giving
4746 // them layout
4747 div.style.cssText = "display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1";
4748
4749 support.inlineBlockNeedsLayout = val = div.offsetWidth === 3;
4750 if ( val ) {
4751
4752 // Prevent IE 6 from affecting layout for positioned elements #11048
4753 // Prevent IE from shrinking the body in IE 7 mode #12869
4754 // Support: IE<8
4755 body.style.zoom = 1;
4756 }
4757 }
4758
4759 body.removeChild( container );
4760 } );
4761
4762
4763 ( function() {
4764 var div = document.createElement( "div" );
4765
4766 // Support: IE<9
4767 support.deleteExpando = true;
4768 try {
4769 delete div.test;
4770 } catch ( e ) {
4771 support.deleteExpando = false;
4772 }
4773
4774 // Null elements to avoid leaks in IE.
4775 div = null;
4776 } )();
4777 var acceptData = function( elem ) {
4778 var noData = jQuery.noData[ ( elem.nodeName + " " ).toLowerCase() ],
4779 nodeType = +elem.nodeType || 1;
4780
4781 // Do not set data on non-element DOM nodes because it will not be cleared (#8335).
4782 return nodeType !== 1 && nodeType !== 9 ?
4783 false :
4784
4785 // Nodes accept data unless otherwise specified; rejection can be conditional
4786 !noData || noData !== true && elem.getAttribute( "classid" ) === noData;
4787 };
4788
4789
4790
4791
4792 var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
4793 rmultiDash = /([A-Z])/g;
4794
4795 function dataAttr( elem, key, data ) {
4796
4797 // If nothing was found internally, try to fetch any
4798 // data from the HTML5 data-* attribute
4799 if ( data === undefined && elem.nodeType === 1 ) {
4800
4801 var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
4802
4803 data = elem.getAttribute( name );
4804
4805 if ( typeof data === "string" ) {
4806 try {
4807 data = data === "true" ? true :
4808 data === "false" ? false :
4809 data === "null" ? null :
4810
4811 // Only convert to a number if it doesn't change the string
4812 +data + "" === data ? +data :
4813 rbrace.test( data ) ? jQuery.parseJSON( data ) :
4814 data;
4815 } catch ( e ) {}
4816
4817 // Make sure we set the data so it isn't changed later
4818 jQuery.data( elem, key, data );
4819
4820 } else {
4821 data = undefined;
4822 }
4823 }
4824
4825 return data;
4826 }
4827
4828 // checks a cache object for emptiness
4829 function isEmptyDataObject( obj ) {
4830 var name;
4831 for ( name in obj ) {
4832
4833 // if the public data object is empty, the private is still empty
4834 if ( name === "data" && jQuery.isEmptyObject( obj[ name ] ) ) {
4835 continue;
4836 }
4837 if ( name !== "toJSON" ) {
4838 return false;
4839 }
4840 }
4841
4842 return true;
4843 }
4844
4845 function internalData( elem, name, data, pvt /* Internal Use Only */ ) {
4846 if ( !acceptData( elem ) ) {
4847 return;
4848 }
4849
4850 var ret, thisCache,
4851 internalKey = jQuery.expando,
4852
4853 // We have to handle DOM nodes and JS objects differently because IE6-7
4854 // can't GC object references properly across the DOM-JS boundary
4855 isNode = elem.nodeType,
4856
4857 // Only DOM nodes need the global jQuery cache; JS object data is
4858 // attached directly to the object so GC can occur automatically
4859 cache = isNode ? jQuery.cache : elem,
4860
4861 // Only defining an ID for JS objects if its cache already exists allows
4862 // the code to shortcut on the same path as a DOM node with no cache
4863 id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey;
4864
4865 // Avoid doing any more work than we need to when trying to get data on an
4866 // object that has no data at all
4867 if ( ( !id || !cache[ id ] || ( !pvt && !cache[ id ].data ) ) &&
4868 data === undefined && typeof name === "string" ) {
4869 return;
4870 }
4871
4872 if ( !id ) {
4873
4874 // Only DOM nodes need a new unique ID for each element since their data
4875 // ends up in the global cache
4876 if ( isNode ) {
4877 id = elem[ internalKey ] = deletedIds.pop() || jQuery.guid++;
4878 } else {
4879 id = internalKey;
4880 }
4881 }
4882
4883 if ( !cache[ id ] ) {
4884
4885 // Avoid exposing jQuery metadata on plain JS objects when the object
4886 // is serialized using JSON.stringify
4887 cache[ id ] = isNode ? {} : { toJSON: jQuery.noop };
4888 }
4889
4890 // An object can be passed to jQuery.data instead of a key/value pair; this gets
4891 // shallow copied over onto the existing cache
4892 if ( typeof name === "object" || typeof name === "function" ) {
4893 if ( pvt ) {
4894 cache[ id ] = jQuery.extend( cache[ id ], name );
4895 } else {
4896 cache[ id ].data = jQuery.extend( cache[ id ].data, name );
4897 }
4898 }
4899
4900 thisCache = cache[ id ];
4901
4902 // jQuery data() is stored in a separate object inside the object's internal data
4903 // cache in order to avoid key collisions between internal data and user-defined
4904 // data.
4905 if ( !pvt ) {
4906 if ( !thisCache.data ) {
4907 thisCache.data = {};
4908 }
4909
4910 thisCache = thisCache.data;
4911 }
4912
4913 if ( data !== undefined ) {
4914 thisCache[ jQuery.camelCase( name ) ] = data;
4915 }
4916
4917 // Check for both converted-to-camel and non-converted data property names
4918 // If a data property was specified
4919 if ( typeof name === "string" ) {
4920
4921 // First Try to find as-is property data
4922 ret = thisCache[ name ];
4923
4924 // Test for null|undefined property data
4925 if ( ret == null ) {
4926
4927 // Try to find the camelCased property
4928 ret = thisCache[ jQuery.camelCase( name ) ];
4929 }
4930 } else {
4931 ret = thisCache;
4932 }
4933
4934 return ret;
4935 }
4936
4937 function internalRemoveData( elem, name, pvt ) {
4938 if ( !acceptData( elem ) ) {
4939 return;
4940 }
4941
4942 var thisCache, i,
4943 isNode = elem.nodeType,
4944
4945 // See jQuery.data for more information
4946 cache = isNode ? jQuery.cache : elem,
4947 id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
4948
4949 // If there is already no cache entry for this object, there is no
4950 // purpose in continuing
4951 if ( !cache[ id ] ) {
4952 return;
4953 }
4954
4955 if ( name ) {
4956
4957 thisCache = pvt ? cache[ id ] : cache[ id ].data;
4958
4959 if ( thisCache ) {
4960
4961 // Support array or space separated string names for data keys
4962 if ( !jQuery.isArray( name ) ) {
4963
4964 // try the string as a key before any manipulation
4965 if ( name in thisCache ) {
4966 name = [ name ];
4967 } else {
4968
4969 // split the camel cased version by spaces unless a key with the spaces exists
4970 name = jQuery.camelCase( name );
4971 if ( name in thisCache ) {
4972 name = [ name ];
4973 } else {
4974 name = name.split( " " );
4975 }
4976 }
4977 } else {
4978
4979 // If "name" is an array of keys...
4980 // When data is initially created, via ("key", "val") signature,
4981 // keys will be converted to camelCase.
4982 // Since there is no way to tell _how_ a key was added, remove
4983 // both plain key and camelCase key. #12786
4984 // This will only penalize the array argument path.
4985 name = name.concat( jQuery.map( name, jQuery.camelCase ) );
4986 }
4987
4988 i = name.length;
4989 while ( i-- ) {
4990 delete thisCache[ name[ i ] ];
4991 }
4992
4993 // If there is no data left in the cache, we want to continue
4994 // and let the cache object itself get destroyed
4995 if ( pvt ? !isEmptyDataObject( thisCache ) : !jQuery.isEmptyObject( thisCache ) ) {
4996 return;
4997 }
4998 }
4999 }
5000
5001 // See jQuery.data for more information
5002 if ( !pvt ) {
5003 delete cache[ id ].data;
5004
5005 // Don't destroy the parent cache unless the internal data object
5006 // had been the only thing left in it
5007 if ( !isEmptyDataObject( cache[ id ] ) ) {
5008 return;
5009 }
5010 }
5011
5012 // Destroy the cache
5013 if ( isNode ) {
5014 jQuery.cleanData( [ elem ], true );
5015
5016 // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
5017 /* jshint eqeqeq: false */
5018 } else if ( support.deleteExpando || cache != cache.window ) {
5019 /* jshint eqeqeq: true */
5020 delete cache[ id ];
5021
5022 // When all else fails, undefined
5023 } else {
5024 cache[ id ] = undefined;
5025 }
5026 }
5027
5028 jQuery.extend( {
5029 cache: {},
5030
5031 // The following elements (space-suffixed to avoid Object.prototype collisions)
5032 // throw uncatchable exceptions if you attempt to set expando properties
5033 noData: {
5034 "applet ": true,
5035 "embed ": true,
5036
5037 // ...but Flash objects (which have this classid) *can* handle expandos
5038 "object ": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
5039 },
5040
5041 hasData: function( elem ) {
5042 elem = elem.nodeType ? jQuery.cache[ elem[ jQuery.expando ] ] : elem[ jQuery.expando ];
5043 return !!elem && !isEmptyDataObject( elem );
5044 },
5045
5046 data: function( elem, name, data ) {
5047 return internalData( elem, name, data );
5048 },
5049
5050 removeData: function( elem, name ) {
5051 return internalRemoveData( elem, name );
5052 },
5053
5054 // For internal use only.
5055 _data: function( elem, name, data ) {
5056 return internalData( elem, name, data, true );
5057 },
5058
5059 _removeData: function( elem, name ) {
5060 return internalRemoveData( elem, name, true );
5061 }
5062 } );
5063
5064 jQuery.fn.extend( {
5065 data: function( key, value ) {
5066 var i, name, data,
5067 elem = this[ 0 ],
5068 attrs = elem && elem.attributes;
5069
5070 // Special expections of .data basically thwart jQuery.access,
5071 // so implement the relevant behavior ourselves
5072
5073 // Gets all values
5074 if ( key === undefined ) {
5075 if ( this.length ) {
5076 data = jQuery.data( elem );
5077
5078 if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
5079 i = attrs.length;
5080 while ( i-- ) {
5081
5082 // Support: IE11+
5083 // The attrs elements can be null (#14894)
5084 if ( attrs[ i ] ) {
5085 name = attrs[ i ].name;
5086 if ( name.indexOf( "data-" ) === 0 ) {
5087 name = jQuery.camelCase( name.slice( 5 ) );
5088 dataAttr( elem, name, data[ name ] );
5089 }
5090 }
5091 }
5092 jQuery._data( elem, "parsedAttrs", true );
5093 }
5094 }
5095
5096 return data;
5097 }
5098
5099 // Sets multiple values
5100 if ( typeof key === "object" ) {
5101 return this.each( function() {
5102 jQuery.data( this, key );
5103 } );
5104 }
5105
5106 return arguments.length > 1 ?
5107
5108 // Sets one value
5109 this.each( function() {
5110 jQuery.data( this, key, value );
5111 } ) :
5112
5113 // Gets one value
5114 // Try to fetch any internally stored data first
5115 elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : undefined;
5116 },
5117
5118 removeData: function( key ) {
5119 return this.each( function() {
5120 jQuery.removeData( this, key );
5121 } );
5122 }
5123 } );
5124
5125
5126 jQuery.extend( {
5127 queue: function( elem, type, data ) {
5128 var queue;
5129
5130 if ( elem ) {
5131 type = ( type || "fx" ) + "queue";
5132 queue = jQuery._data( elem, type );
5133
5134 // Speed up dequeue by getting out quickly if this is just a lookup
5135 if ( data ) {
5136 if ( !queue || jQuery.isArray( data ) ) {
5137 queue = jQuery._data( elem, type, jQuery.makeArray( data ) );
5138 } else {
5139 queue.push( data );
5140 }
5141 }
5142 return queue || [];
5143 }
5144 },
5145
5146 dequeue: function( elem, type ) {
5147 type = type || "fx";
5148
5149 var queue = jQuery.queue( elem, type ),
5150 startLength = queue.length,
5151 fn = queue.shift(),
5152 hooks = jQuery._queueHooks( elem, type ),
5153 next = function() {
5154 jQuery.dequeue( elem, type );
5155 };
5156
5157 // If the fx queue is dequeued, always remove the progress sentinel
5158 if ( fn === "inprogress" ) {
5159 fn = queue.shift();
5160 startLength--;
5161 }
5162
5163 if ( fn ) {
5164
5165 // Add a progress sentinel to prevent the fx queue from being
5166 // automatically dequeued
5167 if ( type === "fx" ) {
5168 queue.unshift( "inprogress" );
5169 }
5170
5171 // clear up the last queue stop function
5172 delete hooks.stop;
5173 fn.call( elem, next, hooks );
5174 }
5175
5176 if ( !startLength && hooks ) {
5177 hooks.empty.fire();
5178 }
5179 },
5180
5181 // not intended for public consumption - generates a queueHooks object,
5182 // or returns the current one
5183 _queueHooks: function( elem, type ) {
5184 var key = type + "queueHooks";
5185 return jQuery._data( elem, key ) || jQuery._data( elem, key, {
5186 empty: jQuery.Callbacks( "once memory" ).add( function() {
5187 jQuery._removeData( elem, type + "queue" );
5188 jQuery._removeData( elem, key );
5189 } )
5190 } );
5191 }
5192 } );
5193
5194 jQuery.fn.extend( {
5195 queue: function( type, data ) {
5196 var setter = 2;
5197
5198 if ( typeof type !== "string" ) {
5199 data = type;
5200 type = "fx";
5201 setter--;
5202 }
5203
5204 if ( arguments.length < setter ) {
5205 return jQuery.queue( this[ 0 ], type );
5206 }
5207
5208 return data === undefined ?
5209 this :
5210 this.each( function() {
5211 var queue = jQuery.queue( this, type, data );
5212
5213 // ensure a hooks for this queue
5214 jQuery._queueHooks( this, type );
5215
5216 if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
5217 jQuery.dequeue( this, type );
5218 }
5219 } );
5220 },
5221 dequeue: function( type ) {
5222 return this.each( function() {
5223 jQuery.dequeue( this, type );
5224 } );
5225 },
5226 clearQueue: function( type ) {
5227 return this.queue( type || "fx", [] );
5228 },
5229
5230 // Get a promise resolved when queues of a certain type
5231 // are emptied (fx is the type by default)
5232 promise: function( type, obj ) {
5233 var tmp,
5234 count = 1,
5235 defer = jQuery.Deferred(),
5236 elements = this,
5237 i = this.length,
5238 resolve = function() {
5239 if ( !( --count ) ) {
5240 defer.resolveWith( elements, [ elements ] );
5241 }
5242 };
5243
5244 if ( typeof type !== "string" ) {
5245 obj = type;
5246 type = undefined;
5247 }
5248 type = type || "fx";
5249
5250 while ( i-- ) {
5251 tmp = jQuery._data( elements[ i ], type + "queueHooks" );
5252 if ( tmp && tmp.empty ) {
5253 count++;
5254 tmp.empty.add( resolve );
5255 }
5256 }
5257 resolve();
5258 return defer.promise( obj );
5259 }
5260 } );
5261
5262
5263 ( function() {
5264 var shrinkWrapBlocksVal;
5265
5266 support.shrinkWrapBlocks = function() {
5267 if ( shrinkWrapBlocksVal != null ) {
5268 return shrinkWrapBlocksVal;
5269 }
5270
5271 // Will be changed later if needed.
5272 shrinkWrapBlocksVal = false;
5273
5274 // Minified: var b,c,d
5275 var div, body, container;
5276
5277 body = document.getElementsByTagName( "body" )[ 0 ];
5278 if ( !body || !body.style ) {
5279
5280 // Test fired too early or in an unsupported environment, exit.
5281 return;
5282 }
5283
5284 // Setup
5285 div = document.createElement( "div" );
5286 container = document.createElement( "div" );
5287 container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px";
5288 body.appendChild( container ).appendChild( div );
5289
5290 // Support: IE6
5291 // Check if elements with layout shrink-wrap their children
5292 if ( typeof div.style.zoom !== "undefined" ) {
5293
5294 // Reset CSS: box-sizing; display; margin; border
5295 div.style.cssText =
5296
5297 // Support: Firefox<29, Android 2.3
5298 // Vendor-prefix box-sizing
5299 "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" +
5300 "box-sizing:content-box;display:block;margin:0;border:0;" +
5301 "padding:1px;width:1px;zoom:1";
5302 div.appendChild( document.createElement( "div" ) ).style.width = "5px";
5303 shrinkWrapBlocksVal = div.offsetWidth !== 3;
5304 }
5305
5306 body.removeChild( container );
5307
5308 return shrinkWrapBlocksVal;
5309 };
5310
5311 } )();
5312 var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
5313
5314 var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
5315
5316
5317 var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
5318
5319 var isHidden = function( elem, el ) {
5320
5321 // isHidden might be called from jQuery#filter function;
5322 // in that case, element will be second argument
5323 elem = el || elem;
5324 return jQuery.css( elem, "display" ) === "none" ||
5325 !jQuery.contains( elem.ownerDocument, elem );
5326 };
5327
5328
5329
5330 function adjustCSS( elem, prop, valueParts, tween ) {
5331 var adjusted,
5332 scale = 1,
5333 maxIterations = 20,
5334 currentValue = tween ?
5335 function() { return tween.cur(); } :
5336 function() { return jQuery.css( elem, prop, "" ); },
5337 initial = currentValue(),
5338 unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
5339
5340 // Starting value computation is required for potential unit mismatches
5341 initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
5342 rcssNum.exec( jQuery.css( elem, prop ) );
5343
5344 if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
5345
5346 // Trust units reported by jQuery.css
5347 unit = unit || initialInUnit[ 3 ];
5348
5349 // Make sure we update the tween properties later on
5350 valueParts = valueParts || [];
5351
5352 // Iteratively approximate from a nonzero starting point
5353 initialInUnit = +initial || 1;
5354
5355 do {
5356
5357 // If previous iteration zeroed out, double until we get *something*.
5358 // Use string for doubling so we don't accidentally see scale as unchanged below
5359 scale = scale || ".5";
5360
5361 // Adjust and apply
5362 initialInUnit = initialInUnit / scale;
5363 jQuery.style( elem, prop, initialInUnit + unit );
5364
5365 // Update scale, tolerating zero or NaN from tween.cur()
5366 // Break the loop if scale is unchanged or perfect, or if we've just had enough.
5367 } while (
5368 scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations
5369 );
5370 }
5371
5372 if ( valueParts ) {
5373 initialInUnit = +initialInUnit || +initial || 0;
5374
5375 // Apply relative offset (+=/-=) if specified
5376 adjusted = valueParts[ 1 ] ?
5377 initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
5378 +valueParts[ 2 ];
5379 if ( tween ) {
5380 tween.unit = unit;
5381 tween.start = initialInUnit;
5382 tween.end = adjusted;
5383 }
5384 }
5385 return adjusted;
5386 }
5387
5388
5389 // Multifunctional method to get and set values of a collection
5390 // The value/s can optionally be executed if it's a function
5391 var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
5392 var i = 0,
5393 length = elems.length,
5394 bulk = key == null;
5395
5396 // Sets many values
5397 if ( jQuery.type( key ) === "object" ) {
5398 chainable = true;
5399 for ( i in key ) {
5400 access( elems, fn, i, key[ i ], true, emptyGet, raw );
5401 }
5402
5403 // Sets one value
5404 } else if ( value !== undefined ) {
5405 chainable = true;
5406
5407 if ( !jQuery.isFunction( value ) ) {
5408 raw = true;
5409 }
5410
5411 if ( bulk ) {
5412
5413 // Bulk operations run against the entire set
5414 if ( raw ) {
5415 fn.call( elems, value );
5416 fn = null;
5417
5418 // ...except when executing function values
5419 } else {
5420 bulk = fn;
5421 fn = function( elem, key, value ) {
5422 return bulk.call( jQuery( elem ), value );
5423 };
5424 }
5425 }
5426
5427 if ( fn ) {
5428 for ( ; i < length; i++ ) {
5429 fn(
5430 elems[ i ],
5431 key,
5432 raw ? value : value.call( elems[ i ], i, fn( elems[ i ], key ) )
5433 );
5434 }
5435 }
5436 }
5437
5438 return chainable ?
5439 elems :
5440
5441 // Gets
5442 bulk ?
5443 fn.call( elems ) :
5444 length ? fn( elems[ 0 ], key ) : emptyGet;
5445 };
5446 var rcheckableType = ( /^(?:checkbox|radio)$/i );
5447
5448 var rtagName = ( /<([\w:-]+)/ );
5449
5450 var rscriptType = ( /^$|\/(?:java|ecma)script/i );
5451
5452 var rleadingWhitespace = ( /^\s+/ );
5453
5454 var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|" +
5455 "details|dialog|figcaption|figure|footer|header|hgroup|main|" +
5456 "mark|meter|nav|output|picture|progress|section|summary|template|time|video";
5457
5458
5459
5460 function createSafeFragment( document ) {
5461 var list = nodeNames.split( "|" ),
5462 safeFrag = document.createDocumentFragment();
5463
5464 if ( safeFrag.createElement ) {
5465 while ( list.length ) {
5466 safeFrag.createElement(
5467 list.pop()
5468 );
5469 }
5470 }
5471 return safeFrag;
5472 }
5473
5474
5475 ( function() {
5476 var div = document.createElement( "div" ),
5477 fragment = document.createDocumentFragment(),
5478 input = document.createElement( "input" );
5479
5480 // Setup
5481 div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
5482
5483 // IE strips leading whitespace when .innerHTML is used
5484 support.leadingWhitespace = div.firstChild.nodeType === 3;
5485
5486 // Make sure that tbody elements aren't automatically inserted
5487 // IE will insert them into empty tables
5488 support.tbody = !div.getElementsByTagName( "tbody" ).length;
5489
5490 // Make sure that link elements get serialized correctly by innerHTML
5491 // This requires a wrapper element in IE
5492 support.htmlSerialize = !!div.getElementsByTagName( "link" ).length;
5493
5494 // Makes sure cloning an html5 element does not cause problems
5495 // Where outerHTML is undefined, this still works
5496 support.html5Clone =
5497 document.createElement( "nav" ).cloneNode( true ).outerHTML !== "<:nav></:nav>";
5498
5499 // Check if a disconnected checkbox will retain its checked
5500 // value of true after appended to the DOM (IE6/7)
5501 input.type = "checkbox";
5502 input.checked = true;
5503 fragment.appendChild( input );
5504 support.appendChecked = input.checked;
5505
5506 // Make sure textarea (and checkbox) defaultValue is properly cloned
5507 // Support: IE6-IE11+
5508 div.innerHTML = "<textarea>x</textarea>";
5509 support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
5510
5511 // #11217 - WebKit loses check when the name is after the checked attribute
5512 fragment.appendChild( div );
5513
5514 // Support: Windows Web Apps (WWA)
5515 // `name` and `type` must use .setAttribute for WWA (#14901)
5516 input = document.createElement( "input" );
5517 input.setAttribute( "type", "radio" );
5518 input.setAttribute( "checked", "checked" );
5519 input.setAttribute( "name", "t" );
5520
5521 div.appendChild( input );
5522
5523 // Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3
5524 // old WebKit doesn't clone checked state correctly in fragments
5525 support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
5526
5527 // Support: IE<9
5528 // Cloned elements keep attachEvent handlers, we use addEventListener on IE9+
5529 support.noCloneEvent = !!div.addEventListener;
5530
5531 // Support: IE<9
5532 // Since attributes and properties are the same in IE,
5533 // cleanData must set properties to undefined rather than use removeAttribute
5534 div[ jQuery.expando ] = 1;
5535 support.attributes = !div.getAttribute( jQuery.expando );
5536 } )();
5537
5538
5539 // We have to close these tags to support XHTML (#13200)
5540 var wrapMap = {
5541 option: [ 1, "<select multiple='multiple'>", "</select>" ],
5542 legend: [ 1, "<fieldset>", "</fieldset>" ],
5543 area: [ 1, "<map>", "</map>" ],
5544
5545 // Support: IE8
5546 param: [ 1, "<object>", "</object>" ],
5547 thead: [ 1, "<table>", "</table>" ],
5548 tr: [ 2, "<table><tbody>", "</tbody></table>" ],
5549 col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
5550 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
5551
5552 // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,
5553 // unless wrapped in a div with non-breaking characters in front of it.
5554 _default: support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ]
5555 };
5556
5557 // Support: IE8-IE9
5558 wrapMap.optgroup = wrapMap.option;
5559
5560 wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
5561 wrapMap.th = wrapMap.td;
5562
5563
5564 function getAll( context, tag ) {
5565 var elems, elem,
5566 i = 0,
5567 found = typeof context.getElementsByTagName !== "undefined" ?
5568 context.getElementsByTagName( tag || "*" ) :
5569 typeof context.querySelectorAll !== "undefined" ?
5570 context.querySelectorAll( tag || "*" ) :
5571 undefined;
5572
5573 if ( !found ) {
5574 for ( found = [], elems = context.childNodes || context;
5575 ( elem = elems[ i ] ) != null;
5576 i++
5577 ) {
5578 if ( !tag || jQuery.nodeName( elem, tag ) ) {
5579 found.push( elem );
5580 } else {
5581 jQuery.merge( found, getAll( elem, tag ) );
5582 }
5583 }
5584 }
5585
5586 return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
5587 jQuery.merge( [ context ], found ) :
5588 found;
5589 }
5590
5591
5592 // Mark scripts as having already been evaluated
5593 function setGlobalEval( elems, refElements ) {
5594 var elem,
5595 i = 0;
5596 for ( ; ( elem = elems[ i ] ) != null; i++ ) {
5597 jQuery._data(
5598 elem,
5599 "globalEval",
5600 !refElements || jQuery._data( refElements[ i ], "globalEval" )
5601 );
5602 }
5603 }
5604
5605
5606 var rhtml = /<|&#?\w+;/,
5607 rtbody = /<tbody/i;
5608
5609 function fixDefaultChecked( elem ) {
5610 if ( rcheckableType.test( elem.type ) ) {
5611 elem.defaultChecked = elem.checked;
5612 }
5613 }
5614
5615 function buildFragment( elems, context, scripts, selection, ignored ) {
5616 var j, elem, contains,
5617 tmp, tag, tbody, wrap,
5618 l = elems.length,
5619
5620 // Ensure a safe fragment
5621 safe = createSafeFragment( context ),
5622
5623 nodes = [],
5624 i = 0;
5625
5626 for ( ; i < l; i++ ) {
5627 elem = elems[ i ];
5628
5629 if ( elem || elem === 0 ) {
5630
5631 // Add nodes directly
5632 if ( jQuery.type( elem ) === "object" ) {
5633 jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
5634
5635 // Convert non-html into a text node
5636 } else if ( !rhtml.test( elem ) ) {
5637 nodes.push( context.createTextNode( elem ) );
5638
5639 // Convert html into DOM nodes
5640 } else {
5641 tmp = tmp || safe.appendChild( context.createElement( "div" ) );
5642
5643 // Deserialize a standard representation
5644 tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
5645 wrap = wrapMap[ tag ] || wrapMap._default;
5646
5647 tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
5648
5649 // Descend through wrappers to the right content
5650 j = wrap[ 0 ];
5651 while ( j-- ) {
5652 tmp = tmp.lastChild;
5653 }
5654
5655 // Manually add leading whitespace removed by IE
5656 if ( !support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
5657 nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[ 0 ] ) );
5658 }
5659
5660 // Remove IE's autoinserted <tbody> from table fragments
5661 if ( !support.tbody ) {
5662
5663 // String was a <table>, *may* have spurious <tbody>
5664 elem = tag === "table" && !rtbody.test( elem ) ?
5665 tmp.firstChild :
5666
5667 // String was a bare <thead> or <tfoot>
5668 wrap[ 1 ] === "<table>" && !rtbody.test( elem ) ?
5669 tmp :
5670 0;
5671
5672 j = elem && elem.childNodes.length;
5673 while ( j-- ) {
5674 if ( jQuery.nodeName( ( tbody = elem.childNodes[ j ] ), "tbody" ) &&
5675 !tbody.childNodes.length ) {
5676
5677 elem.removeChild( tbody );
5678 }
5679 }
5680 }
5681
5682 jQuery.merge( nodes, tmp.childNodes );
5683
5684 // Fix #12392 for WebKit and IE > 9
5685 tmp.textContent = "";
5686
5687 // Fix #12392 for oldIE
5688 while ( tmp.firstChild ) {
5689 tmp.removeChild( tmp.firstChild );
5690 }
5691
5692 // Remember the top-level container for proper cleanup
5693 tmp = safe.lastChild;
5694 }
5695 }
5696 }
5697
5698 // Fix #11356: Clear elements from fragment
5699 if ( tmp ) {
5700 safe.removeChild( tmp );
5701 }
5702
5703 // Reset defaultChecked for any radios and checkboxes
5704 // about to be appended to the DOM in IE 6/7 (#8060)
5705 if ( !support.appendChecked ) {
5706 jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked );
5707 }
5708
5709 i = 0;
5710 while ( ( elem = nodes[ i++ ] ) ) {
5711
5712 // Skip elements already in the context collection (trac-4087)
5713 if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
5714 if ( ignored ) {
5715 ignored.push( elem );
5716 }
5717
5718 continue;
5719 }
5720
5721 contains = jQuery.contains( elem.ownerDocument, elem );
5722
5723 // Append to fragment
5724 tmp = getAll( safe.appendChild( elem ), "script" );
5725
5726 // Preserve script evaluation history
5727 if ( contains ) {
5728 setGlobalEval( tmp );
5729 }
5730
5731 // Capture executables
5732 if ( scripts ) {
5733 j = 0;
5734 while ( ( elem = tmp[ j++ ] ) ) {
5735 if ( rscriptType.test( elem.type || "" ) ) {
5736 scripts.push( elem );
5737 }
5738 }
5739 }
5740 }
5741
5742 tmp = null;
5743
5744 return safe;
5745 }
5746
5747
5748 ( function() {
5749 var i, eventName,
5750 div = document.createElement( "div" );
5751
5752 // Support: IE<9 (lack submit/change bubble), Firefox (lack focus(in | out) events)
5753 for ( i in { submit: true, change: true, focusin: true } ) {
5754 eventName = "on" + i;
5755
5756 if ( !( support[ i ] = eventName in window ) ) {
5757
5758 // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP)
5759 div.setAttribute( eventName, "t" );
5760 support[ i ] = div.attributes[ eventName ].expando === false;
5761 }
5762 }
5763
5764 // Null elements to avoid leaks in IE.
5765 div = null;
5766 } )();
5767
5768
5769 var rformElems = /^(?:input|select|textarea)$/i,
5770 rkeyEvent = /^key/,
5771 rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
5772 rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
5773 rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
5774
5775 function returnTrue() {
5776 return true;
5777 }
5778
5779 function returnFalse() {
5780 return false;
5781 }
5782
5783 // Support: IE9
5784 // See #13393 for more info
5785 function safeActiveElement() {
5786 try {
5787 return document.activeElement;
5788 } catch ( err ) { }
5789 }
5790
5791 function on( elem, types, selector, data, fn, one ) {
5792 var origFn, type;
5793
5794 // Types can be a map of types/handlers
5795 if ( typeof types === "object" ) {
5796
5797 // ( types-Object, selector, data )
5798 if ( typeof selector !== "string" ) {
5799
5800 // ( types-Object, data )
5801 data = data || selector;
5802 selector = undefined;
5803 }
5804 for ( type in types ) {
5805 on( elem, type, selector, data, types[ type ], one );
5806 }
5807 return elem;
5808 }
5809
5810 if ( data == null && fn == null ) {
5811
5812 // ( types, fn )
5813 fn = selector;
5814 data = selector = undefined;
5815 } else if ( fn == null ) {
5816 if ( typeof selector === "string" ) {
5817
5818 // ( types, selector, fn )
5819 fn = data;
5820 data = undefined;
5821 } else {
5822
5823 // ( types, data, fn )
5824 fn = data;
5825 data = selector;
5826 selector = undefined;
5827 }
5828 }
5829 if ( fn === false ) {
5830 fn = returnFalse;
5831 } else if ( !fn ) {
5832 return elem;
5833 }
5834
5835 if ( one === 1 ) {
5836 origFn = fn;
5837 fn = function( event ) {
5838
5839 // Can use an empty set, since event contains the info
5840 jQuery().off( event );
5841 return origFn.apply( this, arguments );
5842 };
5843
5844 // Use same guid so caller can remove using origFn
5845 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
5846 }
5847 return elem.each( function() {
5848 jQuery.event.add( this, types, fn, data, selector );
5849 } );
5850 }
5851
5852 /*
5853 * Helper functions for managing events -- not part of the public interface.
5854 * Props to Dean Edwards' addEvent library for many of the ideas.
5855 */
5856 jQuery.event = {
5857
5858 global: {},
5859
5860 add: function( elem, types, handler, data, selector ) {
5861 var tmp, events, t, handleObjIn,
5862 special, eventHandle, handleObj,
5863 handlers, type, namespaces, origType,
5864 elemData = jQuery._data( elem );
5865
5866 // Don't attach events to noData or text/comment nodes (but allow plain objects)
5867 if ( !elemData ) {
5868 return;
5869 }
5870
5871 // Caller can pass in an object of custom data in lieu of the handler
5872 if ( handler.handler ) {
5873 handleObjIn = handler;
5874 handler = handleObjIn.handler;
5875 selector = handleObjIn.selector;
5876 }
5877
5878 // Make sure that the handler has a unique ID, used to find/remove it later
5879 if ( !handler.guid ) {
5880 handler.guid = jQuery.guid++;
5881 }
5882
5883 // Init the element's event structure and main handler, if this is the first
5884 if ( !( events = elemData.events ) ) {
5885 events = elemData.events = {};
5886 }
5887 if ( !( eventHandle = elemData.handle ) ) {
5888 eventHandle = elemData.handle = function( e ) {
5889
5890 // Discard the second event of a jQuery.event.trigger() and
5891 // when an event is called after a page has unloaded
5892 return typeof jQuery !== "undefined" &&
5893 ( !e || jQuery.event.triggered !== e.type ) ?
5894 jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
5895 undefined;
5896 };
5897
5898 // Add elem as a property of the handle fn to prevent a memory leak
5899 // with IE non-native events
5900 eventHandle.elem = elem;
5901 }
5902
5903 // Handle multiple events separated by a space
5904 types = ( types || "" ).match( rnotwhite ) || [ "" ];
5905 t = types.length;
5906 while ( t-- ) {
5907 tmp = rtypenamespace.exec( types[ t ] ) || [];
5908 type = origType = tmp[ 1 ];
5909 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
5910
5911 // There *must* be a type, no attaching namespace-only handlers
5912 if ( !type ) {
5913 continue;
5914 }
5915
5916 // If event changes its type, use the special event handlers for the changed type
5917 special = jQuery.event.special[ type ] || {};
5918
5919 // If selector defined, determine special event api type, otherwise given type
5920 type = ( selector ? special.delegateType : special.bindType ) || type;
5921
5922 // Update special based on newly reset type
5923 special = jQuery.event.special[ type ] || {};
5924
5925 // handleObj is passed to all event handlers
5926 handleObj = jQuery.extend( {
5927 type: type,
5928 origType: origType,
5929 data: data,
5930 handler: handler,
5931 guid: handler.guid,
5932 selector: selector,
5933 needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
5934 namespace: namespaces.join( "." )
5935 }, handleObjIn );
5936
5937 // Init the event handler queue if we're the first
5938 if ( !( handlers = events[ type ] ) ) {
5939 handlers = events[ type ] = [];
5940 handlers.delegateCount = 0;
5941
5942 // Only use addEventListener/attachEvent if the special events handler returns false
5943 if ( !special.setup ||
5944 special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
5945
5946 // Bind the global event handler to the element
5947 if ( elem.addEventListener ) {
5948 elem.addEventListener( type, eventHandle, false );
5949
5950 } else if ( elem.attachEvent ) {
5951 elem.attachEvent( "on" + type, eventHandle );
5952 }
5953 }
5954 }
5955
5956 if ( special.add ) {
5957 special.add.call( elem, handleObj );
5958
5959 if ( !handleObj.handler.guid ) {
5960 handleObj.handler.guid = handler.guid;
5961 }
5962 }
5963
5964 // Add to the element's handler list, delegates in front
5965 if ( selector ) {
5966 handlers.splice( handlers.delegateCount++, 0, handleObj );
5967 } else {
5968 handlers.push( handleObj );
5969 }
5970
5971 // Keep track of which events have ever been used, for event optimization
5972 jQuery.event.global[ type ] = true;
5973 }
5974
5975 // Nullify elem to prevent memory leaks in IE
5976 elem = null;
5977 },
5978
5979 // Detach an event or set of events from an element
5980 remove: function( elem, types, handler, selector, mappedTypes ) {
5981 var j, handleObj, tmp,
5982 origCount, t, events,
5983 special, handlers, type,
5984 namespaces, origType,
5985 elemData = jQuery.hasData( elem ) && jQuery._data( elem );
5986
5987 if ( !elemData || !( events = elemData.events ) ) {
5988 return;
5989 }
5990
5991 // Once for each type.namespace in types; type may be omitted
5992 types = ( types || "" ).match( rnotwhite ) || [ "" ];
5993 t = types.length;
5994 while ( t-- ) {
5995 tmp = rtypenamespace.exec( types[ t ] ) || [];
5996 type = origType = tmp[ 1 ];
5997 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
5998
5999 // Unbind all events (on this namespace, if provided) for the element
6000 if ( !type ) {
6001 for ( type in events ) {
6002 jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
6003 }
6004 continue;
6005 }
6006
6007 special = jQuery.event.special[ type ] || {};
6008 type = ( selector ? special.delegateType : special.bindType ) || type;
6009 handlers = events[ type ] || [];
6010 tmp = tmp[ 2 ] &&
6011 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
6012
6013 // Remove matching events
6014 origCount = j = handlers.length;
6015 while ( j-- ) {
6016 handleObj = handlers[ j ];
6017
6018 if ( ( mappedTypes || origType === handleObj.origType ) &&
6019 ( !handler || handler.guid === handleObj.guid ) &&
6020 ( !tmp || tmp.test( handleObj.namespace ) ) &&
6021 ( !selector || selector === handleObj.selector ||
6022 selector === "**" && handleObj.selector ) ) {
6023 handlers.splice( j, 1 );
6024
6025 if ( handleObj.selector ) {
6026 handlers.delegateCount--;
6027 }
6028 if ( special.remove ) {
6029 special.remove.call( elem, handleObj );
6030 }
6031 }
6032 }
6033
6034 // Remove generic event handler if we removed something and no more handlers exist
6035 // (avoids potential for endless recursion during removal of special event handlers)
6036 if ( origCount && !handlers.length ) {
6037 if ( !special.teardown ||
6038 special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
6039
6040 jQuery.removeEvent( elem, type, elemData.handle );
6041 }
6042
6043 delete events[ type ];
6044 }
6045 }
6046
6047 // Remove the expando if it's no longer used
6048 if ( jQuery.isEmptyObject( events ) ) {
6049 delete elemData.handle;
6050
6051 // removeData also checks for emptiness and clears the expando if empty
6052 // so use it instead of delete
6053 jQuery._removeData( elem, "events" );
6054 }
6055 },
6056
6057 trigger: function( event, data, elem, onlyHandlers ) {
6058 var handle, ontype, cur,
6059 bubbleType, special, tmp, i,
6060 eventPath = [ elem || document ],
6061 type = hasOwn.call( event, "type" ) ? event.type : event,
6062 namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
6063
6064 cur = tmp = elem = elem || document;
6065
6066 // Don't do events on text and comment nodes
6067 if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
6068 return;
6069 }
6070
6071 // focus/blur morphs to focusin/out; ensure we're not firing them right now
6072 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
6073 return;
6074 }
6075
6076 if ( type.indexOf( "." ) > -1 ) {
6077
6078 // Namespaced trigger; create a regexp to match event type in handle()
6079 namespaces = type.split( "." );
6080 type = namespaces.shift();
6081 namespaces.sort();
6082 }
6083 ontype = type.indexOf( ":" ) < 0 && "on" + type;
6084
6085 // Caller can pass in a jQuery.Event object, Object, or just an event type string
6086 event = event[ jQuery.expando ] ?
6087 event :
6088 new jQuery.Event( type, typeof event === "object" && event );
6089
6090 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
6091 event.isTrigger = onlyHandlers ? 2 : 3;
6092 event.namespace = namespaces.join( "." );
6093 event.rnamespace = event.namespace ?
6094 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
6095 null;
6096
6097 // Clean up the event in case it is being reused
6098 event.result = undefined;
6099 if ( !event.target ) {
6100 event.target = elem;
6101 }
6102
6103 // Clone any incoming data and prepend the event, creating the handler arg list
6104 data = data == null ?
6105 [ event ] :
6106 jQuery.makeArray( data, [ event ] );
6107
6108 // Allow special events to draw outside the lines
6109 special = jQuery.event.special[ type ] || {};
6110 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
6111 return;
6112 }
6113
6114 // Determine event propagation path in advance, per W3C events spec (#9951)
6115 // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
6116 if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
6117
6118 bubbleType = special.delegateType || type;
6119 if ( !rfocusMorph.test( bubbleType + type ) ) {
6120 cur = cur.parentNode;
6121 }
6122 for ( ; cur; cur = cur.parentNode ) {
6123 eventPath.push( cur );
6124 tmp = cur;
6125 }
6126
6127 // Only add window if we got to document (e.g., not plain obj or detached DOM)
6128 if ( tmp === ( elem.ownerDocument || document ) ) {
6129 eventPath.push( tmp.defaultView || tmp.parentWindow || window );
6130 }
6131 }
6132
6133 // Fire handlers on the event path
6134 i = 0;
6135 while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
6136
6137 event.type = i > 1 ?
6138 bubbleType :
6139 special.bindType || type;
6140
6141 // jQuery handler
6142 handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] &&
6143 jQuery._data( cur, "handle" );
6144
6145 if ( handle ) {
6146 handle.apply( cur, data );
6147 }
6148
6149 // Native handler
6150 handle = ontype && cur[ ontype ];
6151 if ( handle && handle.apply && acceptData( cur ) ) {
6152 event.result = handle.apply( cur, data );
6153 if ( event.result === false ) {
6154 event.preventDefault();
6155 }
6156 }
6157 }
6158 event.type = type;
6159
6160 // If nobody prevented the default action, do it now
6161 if ( !onlyHandlers && !event.isDefaultPrevented() ) {
6162
6163 if (
6164 ( !special._default ||
6165 special._default.apply( eventPath.pop(), data ) === false
6166 ) && acceptData( elem )
6167 ) {
6168
6169 // Call a native DOM method on the target with the same name name as the event.
6170 // Can't use an .isFunction() check here because IE6/7 fails that test.
6171 // Don't do default actions on window, that's where global variables be (#6170)
6172 if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) {
6173
6174 // Don't re-trigger an onFOO event when we call its FOO() method
6175 tmp = elem[ ontype ];
6176
6177 if ( tmp ) {
6178 elem[ ontype ] = null;
6179 }
6180
6181 // Prevent re-triggering of the same event, since we already bubbled it above
6182 jQuery.event.triggered = type;
6183 try {
6184 elem[ type ]();
6185 } catch ( e ) {
6186
6187 // IE<9 dies on focus/blur to hidden element (#1486,#12518)
6188 // only reproducible on winXP IE8 native, not IE9 in IE8 mode
6189 }
6190 jQuery.event.triggered = undefined;
6191
6192 if ( tmp ) {
6193 elem[ ontype ] = tmp;
6194 }
6195 }
6196 }
6197 }
6198
6199 return event.result;
6200 },
6201
6202 dispatch: function( event ) {
6203
6204 // Make a writable jQuery.Event from the native event object
6205 event = jQuery.event.fix( event );
6206
6207 var i, j, ret, matched, handleObj,
6208 handlerQueue = [],
6209 args = slice.call( arguments ),
6210 handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [],
6211 special = jQuery.event.special[ event.type ] || {};
6212
6213 // Use the fix-ed jQuery.Event rather than the (read-only) native event
6214 args[ 0 ] = event;
6215 event.delegateTarget = this;
6216
6217 // Call the preDispatch hook for the mapped type, and let it bail if desired
6218 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
6219 return;
6220 }
6221
6222 // Determine handlers
6223 handlerQueue = jQuery.event.handlers.call( this, event, handlers );
6224
6225 // Run delegates first; they may want to stop propagation beneath us
6226 i = 0;
6227 while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
6228 event.currentTarget = matched.elem;
6229
6230 j = 0;
6231 while ( ( handleObj = matched.handlers[ j++ ] ) &&
6232 !event.isImmediatePropagationStopped() ) {
6233
6234 // Triggered event must either 1) have no namespace, or 2) have namespace(s)
6235 // a subset or equal to those in the bound event (both can have no namespace).
6236 if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) {
6237
6238 event.handleObj = handleObj;
6239 event.data = handleObj.data;
6240
6241 ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
6242 handleObj.handler ).apply( matched.elem, args );
6243
6244 if ( ret !== undefined ) {
6245 if ( ( event.result = ret ) === false ) {
6246 event.preventDefault();
6247 event.stopPropagation();
6248 }
6249 }
6250 }
6251 }
6252 }
6253
6254 // Call the postDispatch hook for the mapped type
6255 if ( special.postDispatch ) {
6256 special.postDispatch.call( this, event );
6257 }
6258
6259 return event.result;
6260 },
6261
6262 handlers: function( event, handlers ) {
6263 var i, matches, sel, handleObj,
6264 handlerQueue = [],
6265 delegateCount = handlers.delegateCount,
6266 cur = event.target;
6267
6268 // Support (at least): Chrome, IE9
6269 // Find delegate handlers
6270 // Black-hole SVG <use> instance trees (#13180)
6271 //
6272 // Support: Firefox<=42+
6273 // Avoid non-left-click in FF but don't block IE radio events (#3861, gh-2343)
6274 if ( delegateCount && cur.nodeType &&
6275 ( event.type !== "click" || isNaN( event.button ) || event.button < 1 ) ) {
6276
6277 /* jshint eqeqeq: false */
6278 for ( ; cur != this; cur = cur.parentNode || this ) {
6279 /* jshint eqeqeq: true */
6280
6281 // Don't check non-elements (#13208)
6282 // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
6283 if ( cur.nodeType === 1 && ( cur.disabled !== true || event.type !== "click" ) ) {
6284 matches = [];
6285 for ( i = 0; i < delegateCount; i++ ) {
6286 handleObj = handlers[ i ];
6287
6288 // Don't conflict with Object.prototype properties (#13203)
6289 sel = handleObj.selector + " ";
6290
6291 if ( matches[ sel ] === undefined ) {
6292 matches[ sel ] = handleObj.needsContext ?
6293 jQuery( sel, this ).index( cur ) > -1 :
6294 jQuery.find( sel, this, null, [ cur ] ).length;
6295 }
6296 if ( matches[ sel ] ) {
6297 matches.push( handleObj );
6298 }
6299 }
6300 if ( matches.length ) {
6301 handlerQueue.push( { elem: cur, handlers: matches } );
6302 }
6303 }
6304 }
6305 }
6306
6307 // Add the remaining (directly-bound) handlers
6308 if ( delegateCount < handlers.length ) {
6309 handlerQueue.push( { elem: this, handlers: handlers.slice( delegateCount ) } );
6310 }
6311
6312 return handlerQueue;
6313 },
6314
6315 fix: function( event ) {
6316 if ( event[ jQuery.expando ] ) {
6317 return event;
6318 }
6319
6320 // Create a writable copy of the event object and normalize some properties
6321 var i, prop, copy,
6322 type = event.type,
6323 originalEvent = event,
6324 fixHook = this.fixHooks[ type ];
6325
6326 if ( !fixHook ) {
6327 this.fixHooks[ type ] = fixHook =
6328 rmouseEvent.test( type ) ? this.mouseHooks :
6329 rkeyEvent.test( type ) ? this.keyHooks :
6330 {};
6331 }
6332 copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
6333
6334 event = new jQuery.Event( originalEvent );
6335
6336 i = copy.length;
6337 while ( i-- ) {
6338 prop = copy[ i ];
6339 event[ prop ] = originalEvent[ prop ];
6340 }
6341
6342 // Support: IE<9
6343 // Fix target property (#1925)
6344 if ( !event.target ) {
6345 event.target = originalEvent.srcElement || document;
6346 }
6347
6348 // Support: Safari 6-8+
6349 // Target should not be a text node (#504, #13143)
6350 if ( event.target.nodeType === 3 ) {
6351 event.target = event.target.parentNode;
6352 }
6353
6354 // Support: IE<9
6355 // For mouse/key events, metaKey==false if it's undefined (#3368, #11328)
6356 event.metaKey = !!event.metaKey;
6357
6358 return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
6359 },
6360
6361 // Includes some event props shared by KeyEvent and MouseEvent
6362 props: ( "altKey bubbles cancelable ctrlKey currentTarget detail eventPhase " +
6363 "metaKey relatedTarget shiftKey target timeStamp view which" ).split( " " ),
6364
6365 fixHooks: {},
6366
6367 keyHooks: {
6368 props: "char charCode key keyCode".split( " " ),
6369 filter: function( event, original ) {
6370
6371 // Add which for key events
6372 if ( event.which == null ) {
6373 event.which = original.charCode != null ? original.charCode : original.keyCode;
6374 }
6375
6376 return event;
6377 }
6378 },
6379
6380 mouseHooks: {
6381 props: ( "button buttons clientX clientY fromElement offsetX offsetY " +
6382 "pageX pageY screenX screenY toElement" ).split( " " ),
6383 filter: function( event, original ) {
6384 var body, eventDoc, doc,
6385 button = original.button,
6386 fromElement = original.fromElement;
6387
6388 // Calculate pageX/Y if missing and clientX/Y available
6389 if ( event.pageX == null && original.clientX != null ) {
6390 eventDoc = event.target.ownerDocument || document;
6391 doc = eventDoc.documentElement;
6392 body = eventDoc.body;
6393
6394 event.pageX = original.clientX +
6395 ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) -
6396 ( doc && doc.clientLeft || body && body.clientLeft || 0 );
6397 event.pageY = original.clientY +
6398 ( doc && doc.scrollTop || body && body.scrollTop || 0 ) -
6399 ( doc && doc.clientTop || body && body.clientTop || 0 );
6400 }
6401
6402 // Add relatedTarget, if necessary
6403 if ( !event.relatedTarget && fromElement ) {
6404 event.relatedTarget = fromElement === event.target ?
6405 original.toElement :
6406 fromElement;
6407 }
6408
6409 // Add which for click: 1 === left; 2 === middle; 3 === right
6410 // Note: button is not normalized, so don't use it
6411 if ( !event.which && button !== undefined ) {
6412 event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
6413 }
6414
6415 return event;
6416 }
6417 },
6418
6419 special: {
6420 load: {
6421
6422 // Prevent triggered image.load events from bubbling to window.load
6423 noBubble: true
6424 },
6425 focus: {
6426
6427 // Fire native event if possible so blur/focus sequence is correct
6428 trigger: function() {
6429 if ( this !== safeActiveElement() && this.focus ) {
6430 try {
6431 this.focus();
6432 return false;
6433 } catch ( e ) {
6434
6435 // Support: IE<9
6436 // If we error on focus to hidden element (#1486, #12518),
6437 // let .trigger() run the handlers
6438 }
6439 }
6440 },
6441 delegateType: "focusin"
6442 },
6443 blur: {
6444 trigger: function() {
6445 if ( this === safeActiveElement() && this.blur ) {
6446 this.blur();
6447 return false;
6448 }
6449 },
6450 delegateType: "focusout"
6451 },
6452 click: {
6453
6454 // For checkbox, fire native event so checked state will be right
6455 trigger: function() {
6456 if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) {
6457 this.click();
6458 return false;
6459 }
6460 },
6461
6462 // For cross-browser consistency, don't fire native .click() on links
6463 _default: function( event ) {
6464 return jQuery.nodeName( event.target, "a" );
6465 }
6466 },
6467
6468 beforeunload: {
6469 postDispatch: function( event ) {
6470
6471 // Support: Firefox 20+
6472 // Firefox doesn't alert if the returnValue field is not set.
6473 if ( event.result !== undefined && event.originalEvent ) {
6474 event.originalEvent.returnValue = event.result;
6475 }
6476 }
6477 }
6478 },
6479
6480 // Piggyback on a donor event to simulate a different one
6481 simulate: function( type, elem, event ) {
6482 var e = jQuery.extend(
6483 new jQuery.Event(),
6484 event,
6485 {
6486 type: type,
6487 isSimulated: true
6488
6489 // Previously, `originalEvent: {}` was set here, so stopPropagation call
6490 // would not be triggered on donor event, since in our own
6491 // jQuery.event.stopPropagation function we had a check for existence of
6492 // originalEvent.stopPropagation method, so, consequently it would be a noop.
6493 //
6494 // Guard for simulated events was moved to jQuery.event.stopPropagation function
6495 // since `originalEvent` should point to the original event for the
6496 // constancy with other events and for more focused logic
6497 }
6498 );
6499
6500 jQuery.event.trigger( e, null, elem );
6501
6502 if ( e.isDefaultPrevented() ) {
6503 event.preventDefault();
6504 }
6505 }
6506 };
6507
6508 jQuery.removeEvent = document.removeEventListener ?
6509 function( elem, type, handle ) {
6510
6511 // This "if" is needed for plain objects
6512 if ( elem.removeEventListener ) {
6513 elem.removeEventListener( type, handle );
6514 }
6515 } :
6516 function( elem, type, handle ) {
6517 var name = "on" + type;
6518
6519 if ( elem.detachEvent ) {
6520
6521 // #8545, #7054, preventing memory leaks for custom events in IE6-8
6522 // detachEvent needed property on element, by name of that event,
6523 // to properly expose it to GC
6524 if ( typeof elem[ name ] === "undefined" ) {
6525 elem[ name ] = null;
6526 }
6527
6528 elem.detachEvent( name, handle );
6529 }
6530 };
6531
6532 jQuery.Event = function( src, props ) {
6533
6534 // Allow instantiation without the 'new' keyword
6535 if ( !( this instanceof jQuery.Event ) ) {
6536 return new jQuery.Event( src, props );
6537 }
6538
6539 // Event object
6540 if ( src && src.type ) {
6541 this.originalEvent = src;
6542 this.type = src.type;
6543
6544 // Events bubbling up the document may have been marked as prevented
6545 // by a handler lower down the tree; reflect the correct value.
6546 this.isDefaultPrevented = src.defaultPrevented ||
6547 src.defaultPrevented === undefined &&
6548
6549 // Support: IE < 9, Android < 4.0
6550 src.returnValue === false ?
6551 returnTrue :
6552 returnFalse;
6553
6554 // Event type
6555 } else {
6556 this.type = src;
6557 }
6558
6559 // Put explicitly provided properties onto the event object
6560 if ( props ) {
6561 jQuery.extend( this, props );
6562 }
6563
6564 // Create a timestamp if incoming event doesn't have one
6565 this.timeStamp = src && src.timeStamp || jQuery.now();
6566
6567 // Mark it as fixed
6568 this[ jQuery.expando ] = true;
6569 };
6570
6571 // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
6572 // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
6573 jQuery.Event.prototype = {
6574 constructor: jQuery.Event,
6575 isDefaultPrevented: returnFalse,
6576 isPropagationStopped: returnFalse,
6577 isImmediatePropagationStopped: returnFalse,
6578
6579 preventDefault: function() {
6580 var e = this.originalEvent;
6581
6582 this.isDefaultPrevented = returnTrue;
6583 if ( !e ) {
6584 return;
6585 }
6586
6587 // If preventDefault exists, run it on the original event
6588 if ( e.preventDefault ) {
6589 e.preventDefault();
6590
6591 // Support: IE
6592 // Otherwise set the returnValue property of the original event to false
6593 } else {
6594 e.returnValue = false;
6595 }
6596 },
6597 stopPropagation: function() {
6598 var e = this.originalEvent;
6599
6600 this.isPropagationStopped = returnTrue;
6601
6602 if ( !e || this.isSimulated ) {
6603 return;
6604 }
6605
6606 // If stopPropagation exists, run it on the original event
6607 if ( e.stopPropagation ) {
6608 e.stopPropagation();
6609 }
6610
6611 // Support: IE
6612 // Set the cancelBubble property of the original event to true
6613 e.cancelBubble = true;
6614 },
6615 stopImmediatePropagation: function() {
6616 var e = this.originalEvent;
6617
6618 this.isImmediatePropagationStopped = returnTrue;
6619
6620 if ( e && e.stopImmediatePropagation ) {
6621 e.stopImmediatePropagation();
6622 }
6623
6624 this.stopPropagation();
6625 }
6626 };
6627
6628 // Create mouseenter/leave events using mouseover/out and event-time checks
6629 // so that event delegation works in jQuery.
6630 // Do the same for pointerenter/pointerleave and pointerover/pointerout
6631 //
6632 // Support: Safari 7 only
6633 // Safari sends mouseenter too often; see:
6634 // https://code.google.com/p/chromium/issues/detail?id=470258
6635 // for the description of the bug (it existed in older Chrome versions as well).
6636 jQuery.each( {
6637 mouseenter: "mouseover",
6638 mouseleave: "mouseout",
6639 pointerenter: "pointerover",
6640 pointerleave: "pointerout"
6641 }, function( orig, fix ) {
6642 jQuery.event.special[ orig ] = {
6643 delegateType: fix,
6644 bindType: fix,
6645
6646 handle: function( event ) {
6647 var ret,
6648 target = this,
6649 related = event.relatedTarget,
6650 handleObj = event.handleObj;
6651
6652 // For mouseenter/leave call the handler if related is outside the target.
6653 // NB: No relatedTarget if the mouse left/entered the browser window
6654 if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
6655 event.type = handleObj.origType;
6656 ret = handleObj.handler.apply( this, arguments );
6657 event.type = fix;
6658 }
6659 return ret;
6660 }
6661 };
6662 } );
6663
6664 // IE submit delegation
6665 if ( !support.submit ) {
6666
6667 jQuery.event.special.submit = {
6668 setup: function() {
6669
6670 // Only need this for delegated form submit events
6671 if ( jQuery.nodeName( this, "form" ) ) {
6672 return false;
6673 }
6674
6675 // Lazy-add a submit handler when a descendant form may potentially be submitted
6676 jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
6677
6678 // Node name check avoids a VML-related crash in IE (#9807)
6679 var elem = e.target,
6680 form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ?
6681
6682 // Support: IE <=8
6683 // We use jQuery.prop instead of elem.form
6684 // to allow fixing the IE8 delegated submit issue (gh-2332)
6685 // by 3rd party polyfills/workarounds.
6686 jQuery.prop( elem, "form" ) :
6687 undefined;
6688
6689 if ( form && !jQuery._data( form, "submit" ) ) {
6690 jQuery.event.add( form, "submit._submit", function( event ) {
6691 event._submitBubble = true;
6692 } );
6693 jQuery._data( form, "submit", true );
6694 }
6695 } );
6696
6697 // return undefined since we don't need an event listener
6698 },
6699
6700 postDispatch: function( event ) {
6701
6702 // If form was submitted by the user, bubble the event up the tree
6703 if ( event._submitBubble ) {
6704 delete event._submitBubble;
6705 if ( this.parentNode && !event.isTrigger ) {
6706 jQuery.event.simulate( "submit", this.parentNode, event );
6707 }
6708 }
6709 },
6710
6711 teardown: function() {
6712
6713 // Only need this for delegated form submit events
6714 if ( jQuery.nodeName( this, "form" ) ) {
6715 return false;
6716 }
6717
6718 // Remove delegated handlers; cleanData eventually reaps submit handlers attached above
6719 jQuery.event.remove( this, "._submit" );
6720 }
6721 };
6722 }
6723
6724 // IE change delegation and checkbox/radio fix
6725 if ( !support.change ) {
6726
6727 jQuery.event.special.change = {
6728
6729 setup: function() {
6730
6731 if ( rformElems.test( this.nodeName ) ) {
6732
6733 // IE doesn't fire change on a check/radio until blur; trigger it on click
6734 // after a propertychange. Eat the blur-change in special.change.handle.
6735 // This still fires onchange a second time for check/radio after blur.
6736 if ( this.type === "checkbox" || this.type === "radio" ) {
6737 jQuery.event.add( this, "propertychange._change", function( event ) {
6738 if ( event.originalEvent.propertyName === "checked" ) {
6739 this._justChanged = true;
6740 }
6741 } );
6742 jQuery.event.add( this, "click._change", function( event ) {
6743 if ( this._justChanged && !event.isTrigger ) {
6744 this._justChanged = false;
6745 }
6746
6747 // Allow triggered, simulated change events (#11500)
6748 jQuery.event.simulate( "change", this, event );
6749 } );
6750 }
6751 return false;
6752 }
6753
6754 // Delegated event; lazy-add a change handler on descendant inputs
6755 jQuery.event.add( this, "beforeactivate._change", function( e ) {
6756 var elem = e.target;
6757
6758 if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "change" ) ) {
6759 jQuery.event.add( elem, "change._change", function( event ) {
6760 if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
6761 jQuery.event.simulate( "change", this.parentNode, event );
6762 }
6763 } );
6764 jQuery._data( elem, "change", true );
6765 }
6766 } );
6767 },
6768
6769 handle: function( event ) {
6770 var elem = event.target;
6771
6772 // Swallow native change events from checkbox/radio, we already triggered them above
6773 if ( this !== elem || event.isSimulated || event.isTrigger ||
6774 ( elem.type !== "radio" && elem.type !== "checkbox" ) ) {
6775
6776 return event.handleObj.handler.apply( this, arguments );
6777 }
6778 },
6779
6780 teardown: function() {
6781 jQuery.event.remove( this, "._change" );
6782
6783 return !rformElems.test( this.nodeName );
6784 }
6785 };
6786 }
6787
6788 // Support: Firefox
6789 // Firefox doesn't have focus(in | out) events
6790 // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
6791 //
6792 // Support: Chrome, Safari
6793 // focus(in | out) events fire after focus & blur events,
6794 // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
6795 // Related ticket - https://code.google.com/p/chromium/issues/detail?id=449857
6796 if ( !support.focusin ) {
6797 jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
6798
6799 // Attach a single capturing handler on the document while someone wants focusin/focusout
6800 var handler = function( event ) {
6801 jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
6802 };
6803
6804 jQuery.event.special[ fix ] = {
6805 setup: function() {
6806 var doc = this.ownerDocument || this,
6807 attaches = jQuery._data( doc, fix );
6808
6809 if ( !attaches ) {
6810 doc.addEventListener( orig, handler, true );
6811 }
6812 jQuery._data( doc, fix, ( attaches || 0 ) + 1 );
6813 },
6814 teardown: function() {
6815 var doc = this.ownerDocument || this,
6816 attaches = jQuery._data( doc, fix ) - 1;
6817
6818 if ( !attaches ) {
6819 doc.removeEventListener( orig, handler, true );
6820 jQuery._removeData( doc, fix );
6821 } else {
6822 jQuery._data( doc, fix, attaches );
6823 }
6824 }
6825 };
6826 } );
6827 }
6828
6829 jQuery.fn.extend( {
6830
6831 on: function( types, selector, data, fn ) {
6832 return on( this, types, selector, data, fn );
6833 },
6834 one: function( types, selector, data, fn ) {
6835 return on( this, types, selector, data, fn, 1 );
6836 },
6837 off: function( types, selector, fn ) {
6838 var handleObj, type;
6839 if ( types && types.preventDefault && types.handleObj ) {
6840
6841 // ( event ) dispatched jQuery.Event
6842 handleObj = types.handleObj;
6843 jQuery( types.delegateTarget ).off(
6844 handleObj.namespace ?
6845 handleObj.origType + "." + handleObj.namespace :
6846 handleObj.origType,
6847 handleObj.selector,
6848 handleObj.handler
6849 );
6850 return this;
6851 }
6852 if ( typeof types === "object" ) {
6853
6854 // ( types-object [, selector] )
6855 for ( type in types ) {
6856 this.off( type, selector, types[ type ] );
6857 }
6858 return this;
6859 }
6860 if ( selector === false || typeof selector === "function" ) {
6861
6862 // ( types [, fn] )
6863 fn = selector;
6864 selector = undefined;
6865 }
6866 if ( fn === false ) {
6867 fn = returnFalse;
6868 }
6869 return this.each( function() {
6870 jQuery.event.remove( this, types, fn, selector );
6871 } );
6872 },
6873
6874 trigger: function( type, data ) {
6875 return this.each( function() {
6876 jQuery.event.trigger( type, data, this );
6877 } );
6878 },
6879 triggerHandler: function( type, data ) {
6880 var elem = this[ 0 ];
6881 if ( elem ) {
6882 return jQuery.event.trigger( type, data, elem, true );
6883 }
6884 }
6885 } );
6886
6887
6888 var rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g,
6889 rnoshimcache = new RegExp( "<(?:" + nodeNames + ")[\\s/>]", "i" ),
6890 rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,
6891
6892 // Support: IE 10-11, Edge 10240+
6893 // In IE/Edge using regex groups here causes severe slowdowns.
6894 // See https://connect.microsoft.com/IE/feedback/details/1736512/
6895 rnoInnerhtml = /<script|<style|<link/i,
6896
6897 // checked="checked" or checked
6898 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
6899 rscriptTypeMasked = /^true\/(.*)/,
6900 rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
6901 safeFragment = createSafeFragment( document ),
6902 fragmentDiv = safeFragment.appendChild( document.createElement( "div" ) );
6903
6904 // Support: IE<8
6905 // Manipulating tables requires a tbody
6906 function manipulationTarget( elem, content ) {
6907 return jQuery.nodeName( elem, "table" ) &&
6908 jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ?
6909
6910 elem.getElementsByTagName( "tbody" )[ 0 ] ||
6911 elem.appendChild( elem.ownerDocument.createElement( "tbody" ) ) :
6912 elem;
6913 }
6914
6915 // Replace/restore the type attribute of script elements for safe DOM manipulation
6916 function disableScript( elem ) {
6917 elem.type = ( jQuery.find.attr( elem, "type" ) !== null ) + "/" + elem.type;
6918 return elem;
6919 }
6920 function restoreScript( elem ) {
6921 var match = rscriptTypeMasked.exec( elem.type );
6922 if ( match ) {
6923 elem.type = match[ 1 ];
6924 } else {
6925 elem.removeAttribute( "type" );
6926 }
6927 return elem;
6928 }
6929
6930 function cloneCopyEvent( src, dest ) {
6931 if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
6932 return;
6933 }
6934
6935 var type, i, l,
6936 oldData = jQuery._data( src ),
6937 curData = jQuery._data( dest, oldData ),
6938 events = oldData.events;
6939
6940 if ( events ) {
6941 delete curData.handle;
6942 curData.events = {};
6943
6944 for ( type in events ) {
6945 for ( i = 0, l = events[ type ].length; i < l; i++ ) {
6946 jQuery.event.add( dest, type, events[ type ][ i ] );
6947 }
6948 }
6949 }
6950
6951 // make the cloned public data object a copy from the original
6952 if ( curData.data ) {
6953 curData.data = jQuery.extend( {}, curData.data );
6954 }
6955 }
6956
6957 function fixCloneNodeIssues( src, dest ) {
6958 var nodeName, e, data;
6959
6960 // We do not need to do anything for non-Elements
6961 if ( dest.nodeType !== 1 ) {
6962 return;
6963 }
6964
6965 nodeName = dest.nodeName.toLowerCase();
6966
6967 // IE6-8 copies events bound via attachEvent when using cloneNode.
6968 if ( !support.noCloneEvent && dest[ jQuery.expando ] ) {
6969 data = jQuery._data( dest );
6970
6971 for ( e in data.events ) {
6972 jQuery.removeEvent( dest, e, data.handle );
6973 }
6974
6975 // Event data gets referenced instead of copied if the expando gets copied too
6976 dest.removeAttribute( jQuery.expando );
6977 }
6978
6979 // IE blanks contents when cloning scripts, and tries to evaluate newly-set text
6980 if ( nodeName === "script" && dest.text !== src.text ) {
6981 disableScript( dest ).text = src.text;
6982 restoreScript( dest );
6983
6984 // IE6-10 improperly clones children of object elements using classid.
6985 // IE10 throws NoModificationAllowedError if parent is null, #12132.
6986 } else if ( nodeName === "object" ) {
6987 if ( dest.parentNode ) {
6988 dest.outerHTML = src.outerHTML;
6989 }
6990
6991 // This path appears unavoidable for IE9. When cloning an object
6992 // element in IE9, the outerHTML strategy above is not sufficient.
6993 // If the src has innerHTML and the destination does not,
6994 // copy the src.innerHTML into the dest.innerHTML. #10324
6995 if ( support.html5Clone && ( src.innerHTML && !jQuery.trim( dest.innerHTML ) ) ) {
6996 dest.innerHTML = src.innerHTML;
6997 }
6998
6999 } else if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
7000
7001 // IE6-8 fails to persist the checked state of a cloned checkbox
7002 // or radio button. Worse, IE6-7 fail to give the cloned element
7003 // a checked appearance if the defaultChecked value isn't also set
7004
7005 dest.defaultChecked = dest.checked = src.checked;
7006
7007 // IE6-7 get confused and end up setting the value of a cloned
7008 // checkbox/radio button to an empty string instead of "on"
7009 if ( dest.value !== src.value ) {
7010 dest.value = src.value;
7011 }
7012
7013 // IE6-8 fails to return the selected option to the default selected
7014 // state when cloning options
7015 } else if ( nodeName === "option" ) {
7016 dest.defaultSelected = dest.selected = src.defaultSelected;
7017
7018 // IE6-8 fails to set the defaultValue to the correct value when
7019 // cloning other types of input fields
7020 } else if ( nodeName === "input" || nodeName === "textarea" ) {
7021 dest.defaultValue = src.defaultValue;
7022 }
7023 }
7024
7025 function domManip( collection, args, callback, ignored ) {
7026
7027 // Flatten any nested arrays
7028 args = concat.apply( [], args );
7029
7030 var first, node, hasScripts,
7031 scripts, doc, fragment,
7032 i = 0,
7033 l = collection.length,
7034 iNoClone = l - 1,
7035 value = args[ 0 ],
7036 isFunction = jQuery.isFunction( value );
7037
7038 // We can't cloneNode fragments that contain checked, in WebKit
7039 if ( isFunction ||
7040 ( l > 1 && typeof value === "string" &&
7041 !support.checkClone && rchecked.test( value ) ) ) {
7042 return collection.each( function( index ) {
7043 var self = collection.eq( index );
7044 if ( isFunction ) {
7045 args[ 0 ] = value.call( this, index, self.html() );
7046 }
7047 domManip( self, args, callback, ignored );
7048 } );
7049 }
7050
7051 if ( l ) {
7052 fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
7053 first = fragment.firstChild;
7054
7055 if ( fragment.childNodes.length === 1 ) {
7056 fragment = first;
7057 }
7058
7059 // Require either new content or an interest in ignored elements to invoke the callback
7060 if ( first || ignored ) {
7061 scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
7062 hasScripts = scripts.length;
7063
7064 // Use the original fragment for the last item
7065 // instead of the first because it can end up
7066 // being emptied incorrectly in certain situations (#8070).
7067 for ( ; i < l; i++ ) {
7068 node = fragment;
7069
7070 if ( i !== iNoClone ) {
7071 node = jQuery.clone( node, true, true );
7072
7073 // Keep references to cloned scripts for later restoration
7074 if ( hasScripts ) {
7075
7076 // Support: Android<4.1, PhantomJS<2
7077 // push.apply(_, arraylike) throws on ancient WebKit
7078 jQuery.merge( scripts, getAll( node, "script" ) );
7079 }
7080 }
7081
7082 callback.call( collection[ i ], node, i );
7083 }
7084
7085 if ( hasScripts ) {
7086 doc = scripts[ scripts.length - 1 ].ownerDocument;
7087
7088 // Reenable scripts
7089 jQuery.map( scripts, restoreScript );
7090
7091 // Evaluate executable scripts on first document insertion
7092 for ( i = 0; i < hasScripts; i++ ) {
7093 node = scripts[ i ];
7094 if ( rscriptType.test( node.type || "" ) &&
7095 !jQuery._data( node, "globalEval" ) &&
7096 jQuery.contains( doc, node ) ) {
7097
7098 if ( node.src ) {
7099
7100 // Optional AJAX dependency, but won't run scripts if not present
7101 if ( jQuery._evalUrl ) {
7102 jQuery._evalUrl( node.src );
7103 }
7104 } else {
7105 jQuery.globalEval(
7106 ( node.text || node.textContent || node.innerHTML || "" )
7107 .replace( rcleanScript, "" )
7108 );
7109 }
7110 }
7111 }
7112 }
7113
7114 // Fix #11809: Avoid leaking memory
7115 fragment = first = null;
7116 }
7117 }
7118
7119 return collection;
7120 }
7121
7122 function remove( elem, selector, keepData ) {
7123 var node,
7124 elems = selector ? jQuery.filter( selector, elem ) : elem,
7125 i = 0;
7126
7127 for ( ; ( node = elems[ i ] ) != null; i++ ) {
7128
7129 if ( !keepData && node.nodeType === 1 ) {
7130 jQuery.cleanData( getAll( node ) );
7131 }
7132
7133 if ( node.parentNode ) {
7134 if ( keepData && jQuery.contains( node.ownerDocument, node ) ) {
7135 setGlobalEval( getAll( node, "script" ) );
7136 }
7137 node.parentNode.removeChild( node );
7138 }
7139 }
7140
7141 return elem;
7142 }
7143
7144 jQuery.extend( {
7145 htmlPrefilter: function( html ) {
7146 return html.replace( rxhtmlTag, "<$1></$2>" );
7147 },
7148
7149 clone: function( elem, dataAndEvents, deepDataAndEvents ) {
7150 var destElements, node, clone, i, srcElements,
7151 inPage = jQuery.contains( elem.ownerDocument, elem );
7152
7153 if ( support.html5Clone || jQuery.isXMLDoc( elem ) ||
7154 !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) {
7155
7156 clone = elem.cloneNode( true );
7157
7158 // IE<=8 does not properly clone detached, unknown element nodes
7159 } else {
7160 fragmentDiv.innerHTML = elem.outerHTML;
7161 fragmentDiv.removeChild( clone = fragmentDiv.firstChild );
7162 }
7163
7164 if ( ( !support.noCloneEvent || !support.noCloneChecked ) &&
7165 ( elem.nodeType === 1 || elem.nodeType === 11 ) && !jQuery.isXMLDoc( elem ) ) {
7166
7167 // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
7168 destElements = getAll( clone );
7169 srcElements = getAll( elem );
7170
7171 // Fix all IE cloning issues
7172 for ( i = 0; ( node = srcElements[ i ] ) != null; ++i ) {
7173
7174 // Ensure that the destination node is not null; Fixes #9587
7175 if ( destElements[ i ] ) {
7176 fixCloneNodeIssues( node, destElements[ i ] );
7177 }
7178 }
7179 }
7180
7181 // Copy the events from the original to the clone
7182 if ( dataAndEvents ) {
7183 if ( deepDataAndEvents ) {
7184 srcElements = srcElements || getAll( elem );
7185 destElements = destElements || getAll( clone );
7186
7187 for ( i = 0; ( node = srcElements[ i ] ) != null; i++ ) {
7188 cloneCopyEvent( node, destElements[ i ] );
7189 }
7190 } else {
7191 cloneCopyEvent( elem, clone );
7192 }
7193 }
7194
7195 // Preserve script evaluation history
7196 destElements = getAll( clone, "script" );
7197 if ( destElements.length > 0 ) {
7198 setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
7199 }
7200
7201 destElements = srcElements = node = null;
7202
7203 // Return the cloned set
7204 return clone;
7205 },
7206
7207 cleanData: function( elems, /* internal */ forceAcceptData ) {
7208 var elem, type, id, data,
7209 i = 0,
7210 internalKey = jQuery.expando,
7211 cache = jQuery.cache,
7212 attributes = support.attributes,
7213 special = jQuery.event.special;
7214
7215 for ( ; ( elem = elems[ i ] ) != null; i++ ) {
7216 if ( forceAcceptData || acceptData( elem ) ) {
7217
7218 id = elem[ internalKey ];
7219 data = id && cache[ id ];
7220
7221 if ( data ) {
7222 if ( data.events ) {
7223 for ( type in data.events ) {
7224 if ( special[ type ] ) {
7225 jQuery.event.remove( elem, type );
7226
7227 // This is a shortcut to avoid jQuery.event.remove's overhead
7228 } else {
7229 jQuery.removeEvent( elem, type, data.handle );
7230 }
7231 }
7232 }
7233
7234 // Remove cache only if it was not already removed by jQuery.event.remove
7235 if ( cache[ id ] ) {
7236
7237 delete cache[ id ];
7238
7239 // Support: IE<9
7240 // IE does not allow us to delete expando properties from nodes
7241 // IE creates expando attributes along with the property
7242 // IE does not have a removeAttribute function on Document nodes
7243 if ( !attributes && typeof elem.removeAttribute !== "undefined" ) {
7244 elem.removeAttribute( internalKey );
7245
7246 // Webkit & Blink performance suffers when deleting properties
7247 // from DOM nodes, so set to undefined instead
7248 // https://code.google.com/p/chromium/issues/detail?id=378607
7249 } else {
7250 elem[ internalKey ] = undefined;
7251 }
7252
7253 deletedIds.push( id );
7254 }
7255 }
7256 }
7257 }
7258 }
7259 } );
7260
7261 jQuery.fn.extend( {
7262
7263 // Keep domManip exposed until 3.0 (gh-2225)
7264 domManip: domManip,
7265
7266 detach: function( selector ) {
7267 return remove( this, selector, true );
7268 },
7269
7270 remove: function( selector ) {
7271 return remove( this, selector );
7272 },
7273
7274 text: function( value ) {
7275 return access( this, function( value ) {
7276 return value === undefined ?
7277 jQuery.text( this ) :
7278 this.empty().append(
7279 ( this[ 0 ] && this[ 0 ].ownerDocument || document ).createTextNode( value )
7280 );
7281 }, null, value, arguments.length );
7282 },
7283
7284 append: function() {
7285 return domManip( this, arguments, function( elem ) {
7286 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
7287 var target = manipulationTarget( this, elem );
7288 target.appendChild( elem );
7289 }
7290 } );
7291 },
7292
7293 prepend: function() {
7294 return domManip( this, arguments, function( elem ) {
7295 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
7296 var target = manipulationTarget( this, elem );
7297 target.insertBefore( elem, target.firstChild );
7298 }
7299 } );
7300 },
7301
7302 before: function() {
7303 return domManip( this, arguments, function( elem ) {
7304 if ( this.parentNode ) {
7305 this.parentNode.insertBefore( elem, this );
7306 }
7307 } );
7308 },
7309
7310 after: function() {
7311 return domManip( this, arguments, function( elem ) {
7312 if ( this.parentNode ) {
7313 this.parentNode.insertBefore( elem, this.nextSibling );
7314 }
7315 } );
7316 },
7317
7318 empty: function() {
7319 var elem,
7320 i = 0;
7321
7322 for ( ; ( elem = this[ i ] ) != null; i++ ) {
7323
7324 // Remove element nodes and prevent memory leaks
7325 if ( elem.nodeType === 1 ) {
7326 jQuery.cleanData( getAll( elem, false ) );
7327 }
7328
7329 // Remove any remaining nodes
7330 while ( elem.firstChild ) {
7331 elem.removeChild( elem.firstChild );
7332 }
7333
7334 // If this is a select, ensure that it displays empty (#12336)
7335 // Support: IE<9
7336 if ( elem.options && jQuery.nodeName( elem, "select" ) ) {
7337 elem.options.length = 0;
7338 }
7339 }
7340
7341 return this;
7342 },
7343
7344 clone: function( dataAndEvents, deepDataAndEvents ) {
7345 dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
7346 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
7347
7348 return this.map( function() {
7349 return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
7350 } );
7351 },
7352
7353 html: function( value ) {
7354 return access( this, function( value ) {
7355 var elem = this[ 0 ] || {},
7356 i = 0,
7357 l = this.length;
7358
7359 if ( value === undefined ) {
7360 return elem.nodeType === 1 ?
7361 elem.innerHTML.replace( rinlinejQuery, "" ) :
7362 undefined;
7363 }
7364
7365 // See if we can take a shortcut and just use innerHTML
7366 if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
7367 ( support.htmlSerialize || !rnoshimcache.test( value ) ) &&
7368 ( support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
7369 !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
7370
7371 value = jQuery.htmlPrefilter( value );
7372
7373 try {
7374 for ( ; i < l; i++ ) {
7375
7376 // Remove element nodes and prevent memory leaks
7377 elem = this[ i ] || {};
7378 if ( elem.nodeType === 1 ) {
7379 jQuery.cleanData( getAll( elem, false ) );
7380 elem.innerHTML = value;
7381 }
7382 }
7383
7384 elem = 0;
7385
7386 // If using innerHTML throws an exception, use the fallback method
7387 } catch ( e ) {}
7388 }
7389
7390 if ( elem ) {
7391 this.empty().append( value );
7392 }
7393 }, null, value, arguments.length );
7394 },
7395
7396 replaceWith: function() {
7397 var ignored = [];
7398
7399 // Make the changes, replacing each non-ignored context element with the new content
7400 return domManip( this, arguments, function( elem ) {
7401 var parent = this.parentNode;
7402
7403 if ( jQuery.inArray( this, ignored ) < 0 ) {
7404 jQuery.cleanData( getAll( this ) );
7405 if ( parent ) {
7406 parent.replaceChild( elem, this );
7407 }
7408 }
7409
7410 // Force callback invocation
7411 }, ignored );
7412 }
7413 } );
7414
7415 jQuery.each( {
7416 appendTo: "append",
7417 prependTo: "prepend",
7418 insertBefore: "before",
7419 insertAfter: "after",
7420 replaceAll: "replaceWith"
7421 }, function( name, original ) {
7422 jQuery.fn[ name ] = function( selector ) {
7423 var elems,
7424 i = 0,
7425 ret = [],
7426 insert = jQuery( selector ),
7427 last = insert.length - 1;
7428
7429 for ( ; i <= last; i++ ) {
7430 elems = i === last ? this : this.clone( true );
7431 jQuery( insert[ i ] )[ original ]( elems );
7432
7433 // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get()
7434 push.apply( ret, elems.get() );
7435 }
7436
7437 return this.pushStack( ret );
7438 };
7439 } );
7440
7441
7442 var iframe,
7443 elemdisplay = {
7444
7445 // Support: Firefox
7446 // We have to pre-define these values for FF (#10227)
7447 HTML: "block",
7448 BODY: "block"
7449 };
7450
7451 /**
7452 * Retrieve the actual display of a element
7453 * @param {String} name nodeName of the element
7454 * @param {Object} doc Document object
7455 */
7456
7457 // Called only from within defaultDisplay
7458 function actualDisplay( name, doc ) {
7459 var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
7460
7461 display = jQuery.css( elem[ 0 ], "display" );
7462
7463 // We don't have any data stored on the element,
7464 // so use "detach" method as fast way to get rid of the element
7465 elem.detach();
7466
7467 return display;
7468 }
7469
7470 /**
7471 * Try to determine the default display value of an element
7472 * @param {String} nodeName
7473 */
7474 function defaultDisplay( nodeName ) {
7475 var doc = document,
7476 display = elemdisplay[ nodeName ];
7477
7478 if ( !display ) {
7479 display = actualDisplay( nodeName, doc );
7480
7481 // If the simple way fails, read from inside an iframe
7482 if ( display === "none" || !display ) {
7483
7484 // Use the already-created iframe if possible
7485 iframe = ( iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" ) )
7486 .appendTo( doc.documentElement );
7487
7488 // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
7489 doc = ( iframe[ 0 ].contentWindow || iframe[ 0 ].contentDocument ).document;
7490
7491 // Support: IE
7492 doc.write();
7493 doc.close();
7494
7495 display = actualDisplay( nodeName, doc );
7496 iframe.detach();
7497 }
7498
7499 // Store the correct default display
7500 elemdisplay[ nodeName ] = display;
7501 }
7502
7503 return display;
7504 }
7505 var rmargin = ( /^margin/ );
7506
7507 var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
7508
7509 var swap = function( elem, options, callback, args ) {
7510 var ret, name,
7511 old = {};
7512
7513 // Remember the old values, and insert the new ones
7514 for ( name in options ) {
7515 old[ name ] = elem.style[ name ];
7516 elem.style[ name ] = options[ name ];
7517 }
7518
7519 ret = callback.apply( elem, args || [] );
7520
7521 // Revert the old values
7522 for ( name in options ) {
7523 elem.style[ name ] = old[ name ];
7524 }
7525
7526 return ret;
7527 };
7528
7529
7530 var documentElement = document.documentElement;
7531
7532
7533
7534 ( function() {
7535 var pixelPositionVal, pixelMarginRightVal, boxSizingReliableVal,
7536 reliableHiddenOffsetsVal, reliableMarginRightVal, reliableMarginLeftVal,
7537 container = document.createElement( "div" ),
7538 div = document.createElement( "div" );
7539
7540 // Finish early in limited (non-browser) environments
7541 if ( !div.style ) {
7542 return;
7543 }
7544
7545 div.style.cssText = "float:left;opacity:.5";
7546
7547 // Support: IE<9
7548 // Make sure that element opacity exists (as opposed to filter)
7549 support.opacity = div.style.opacity === "0.5";
7550
7551 // Verify style float existence
7552 // (IE uses styleFloat instead of cssFloat)
7553 support.cssFloat = !!div.style.cssFloat;
7554
7555 div.style.backgroundClip = "content-box";
7556 div.cloneNode( true ).style.backgroundClip = "";
7557 support.clearCloneStyle = div.style.backgroundClip === "content-box";
7558
7559 container = document.createElement( "div" );
7560 container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" +
7561 "padding:0;margin-top:1px;position:absolute";
7562 div.innerHTML = "";
7563 container.appendChild( div );
7564
7565 // Support: Firefox<29, Android 2.3
7566 // Vendor-prefix box-sizing
7567 support.boxSizing = div.style.boxSizing === "" || div.style.MozBoxSizing === "" ||
7568 div.style.WebkitBoxSizing === "";
7569
7570 jQuery.extend( support, {
7571 reliableHiddenOffsets: function() {
7572 if ( pixelPositionVal == null ) {
7573 computeStyleTests();
7574 }
7575 return reliableHiddenOffsetsVal;
7576 },
7577
7578 boxSizingReliable: function() {
7579
7580 // We're checking for pixelPositionVal here instead of boxSizingReliableVal
7581 // since that compresses better and they're computed together anyway.
7582 if ( pixelPositionVal == null ) {
7583 computeStyleTests();
7584 }
7585 return boxSizingReliableVal;
7586 },
7587
7588 pixelMarginRight: function() {
7589
7590 // Support: Android 4.0-4.3
7591 if ( pixelPositionVal == null ) {
7592 computeStyleTests();
7593 }
7594 return pixelMarginRightVal;
7595 },
7596
7597 pixelPosition: function() {
7598 if ( pixelPositionVal == null ) {
7599 computeStyleTests();
7600 }
7601 return pixelPositionVal;
7602 },
7603
7604 reliableMarginRight: function() {
7605
7606 // Support: Android 2.3
7607 if ( pixelPositionVal == null ) {
7608 computeStyleTests();
7609 }
7610 return reliableMarginRightVal;
7611 },
7612
7613 reliableMarginLeft: function() {
7614
7615 // Support: IE <=8 only, Android 4.0 - 4.3 only, Firefox <=3 - 37
7616 if ( pixelPositionVal == null ) {
7617 computeStyleTests();
7618 }
7619 return reliableMarginLeftVal;
7620 }
7621 } );
7622
7623 function computeStyleTests() {
7624 var contents, divStyle,
7625 documentElement = document.documentElement;
7626
7627 // Setup
7628 documentElement.appendChild( container );
7629
7630 div.style.cssText =
7631
7632 // Support: Android 2.3
7633 // Vendor-prefix box-sizing
7634 "-webkit-box-sizing:border-box;box-sizing:border-box;" +
7635 "position:relative;display:block;" +
7636 "margin:auto;border:1px;padding:1px;" +
7637 "top:1%;width:50%";
7638
7639 // Support: IE<9
7640 // Assume reasonable values in the absence of getComputedStyle
7641 pixelPositionVal = boxSizingReliableVal = reliableMarginLeftVal = false;
7642 pixelMarginRightVal = reliableMarginRightVal = true;
7643
7644 // Check for getComputedStyle so that this code is not run in IE<9.
7645 if ( window.getComputedStyle ) {
7646 divStyle = window.getComputedStyle( div );
7647 pixelPositionVal = ( divStyle || {} ).top !== "1%";
7648 reliableMarginLeftVal = ( divStyle || {} ).marginLeft === "2px";
7649 boxSizingReliableVal = ( divStyle || { width: "4px" } ).width === "4px";
7650
7651 // Support: Android 4.0 - 4.3 only
7652 // Some styles come back with percentage values, even though they shouldn't
7653 div.style.marginRight = "50%";
7654 pixelMarginRightVal = ( divStyle || { marginRight: "4px" } ).marginRight === "4px";
7655
7656 // Support: Android 2.3 only
7657 // Div with explicit width and no margin-right incorrectly
7658 // gets computed margin-right based on width of container (#3333)
7659 // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
7660 contents = div.appendChild( document.createElement( "div" ) );
7661
7662 // Reset CSS: box-sizing; display; margin; border; padding
7663 contents.style.cssText = div.style.cssText =
7664
7665 // Support: Android 2.3
7666 // Vendor-prefix box-sizing
7667 "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" +
7668 "box-sizing:content-box;display:block;margin:0;border:0;padding:0";
7669 contents.style.marginRight = contents.style.width = "0";
7670 div.style.width = "1px";
7671
7672 reliableMarginRightVal =
7673 !parseFloat( ( window.getComputedStyle( contents ) || {} ).marginRight );
7674
7675 div.removeChild( contents );
7676 }
7677
7678 // Support: IE6-8
7679 // First check that getClientRects works as expected
7680 // Check if table cells still have offsetWidth/Height when they are set
7681 // to display:none and there are still other visible table cells in a
7682 // table row; if so, offsetWidth/Height are not reliable for use when
7683 // determining if an element has been hidden directly using
7684 // display:none (it is still safe to use offsets if a parent element is
7685 // hidden; don safety goggles and see bug #4512 for more information).
7686 div.style.display = "none";
7687 reliableHiddenOffsetsVal = div.getClientRects().length === 0;
7688 if ( reliableHiddenOffsetsVal ) {
7689 div.style.display = "";
7690 div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
7691 div.childNodes[ 0 ].style.borderCollapse = "separate";
7692 contents = div.getElementsByTagName( "td" );
7693 contents[ 0 ].style.cssText = "margin:0;border:0;padding:0;display:none";
7694 reliableHiddenOffsetsVal = contents[ 0 ].offsetHeight === 0;
7695 if ( reliableHiddenOffsetsVal ) {
7696 contents[ 0 ].style.display = "";
7697 contents[ 1 ].style.display = "none";
7698 reliableHiddenOffsetsVal = contents[ 0 ].offsetHeight === 0;
7699 }
7700 }
7701
7702 // Teardown
7703 documentElement.removeChild( container );
7704 }
7705
7706 } )();
7707
7708
7709 var getStyles, curCSS,
7710 rposition = /^(top|right|bottom|left)$/;
7711
7712 if ( window.getComputedStyle ) {
7713 getStyles = function( elem ) {
7714
7715 // Support: IE<=11+, Firefox<=30+ (#15098, #14150)
7716 // IE throws on elements created in popups
7717 // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
7718 var view = elem.ownerDocument.defaultView;
7719
7720 if ( !view || !view.opener ) {
7721 view = window;
7722 }
7723
7724 return view.getComputedStyle( elem );
7725 };
7726
7727 curCSS = function( elem, name, computed ) {
7728 var width, minWidth, maxWidth, ret,
7729 style = elem.style;
7730
7731 computed = computed || getStyles( elem );
7732
7733 // getPropertyValue is only needed for .css('filter') in IE9, see #12537
7734 ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined;
7735
7736 // Support: Opera 12.1x only
7737 // Fall back to style even without computed
7738 // computed is undefined for elems on document fragments
7739 if ( ( ret === "" || ret === undefined ) && !jQuery.contains( elem.ownerDocument, elem ) ) {
7740 ret = jQuery.style( elem, name );
7741 }
7742
7743 if ( computed ) {
7744
7745 // A tribute to the "awesome hack by Dean Edwards"
7746 // Chrome < 17 and Safari 5.0 uses "computed value"
7747 // instead of "used value" for margin-right
7748 // Safari 5.1.7 (at least) returns percentage for a larger set of values,
7749 // but width seems to be reliably pixels
7750 // this is against the CSSOM draft spec:
7751 // http://dev.w3.org/csswg/cssom/#resolved-values
7752 if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) {
7753
7754 // Remember the original values
7755 width = style.width;
7756 minWidth = style.minWidth;
7757 maxWidth = style.maxWidth;
7758
7759 // Put in the new values to get a computed value out
7760 style.minWidth = style.maxWidth = style.width = ret;
7761 ret = computed.width;
7762
7763 // Revert the changed values
7764 style.width = width;
7765 style.minWidth = minWidth;
7766 style.maxWidth = maxWidth;
7767 }
7768 }
7769
7770 // Support: IE
7771 // IE returns zIndex value as an integer.
7772 return ret === undefined ?
7773 ret :
7774 ret + "";
7775 };
7776 } else if ( documentElement.currentStyle ) {
7777 getStyles = function( elem ) {
7778 return elem.currentStyle;
7779 };
7780
7781 curCSS = function( elem, name, computed ) {
7782 var left, rs, rsLeft, ret,
7783 style = elem.style;
7784
7785 computed = computed || getStyles( elem );
7786 ret = computed ? computed[ name ] : undefined;
7787
7788 // Avoid setting ret to empty string here
7789 // so we don't default to auto
7790 if ( ret == null && style && style[ name ] ) {
7791 ret = style[ name ];
7792 }
7793
7794 // From the awesome hack by Dean Edwards
7795 // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
7796
7797 // If we're not dealing with a regular pixel number
7798 // but a number that has a weird ending, we need to convert it to pixels
7799 // but not position css attributes, as those are
7800 // proportional to the parent element instead
7801 // and we can't measure the parent instead because it
7802 // might trigger a "stacking dolls" problem
7803 if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) {
7804
7805 // Remember the original values
7806 left = style.left;
7807 rs = elem.runtimeStyle;
7808 rsLeft = rs && rs.left;
7809
7810 // Put in the new values to get a computed value out
7811 if ( rsLeft ) {
7812 rs.left = elem.currentStyle.left;
7813 }
7814 style.left = name === "fontSize" ? "1em" : ret;
7815 ret = style.pixelLeft + "px";
7816
7817 // Revert the changed values
7818 style.left = left;
7819 if ( rsLeft ) {
7820 rs.left = rsLeft;
7821 }
7822 }
7823
7824 // Support: IE
7825 // IE returns zIndex value as an integer.
7826 return ret === undefined ?
7827 ret :
7828 ret + "" || "auto";
7829 };
7830 }
7831
7832
7833
7834
7835 function addGetHookIf( conditionFn, hookFn ) {
7836
7837 // Define the hook, we'll check on the first run if it's really needed.
7838 return {
7839 get: function() {
7840 if ( conditionFn() ) {
7841
7842 // Hook not needed (or it's not possible to use it due
7843 // to missing dependency), remove it.
7844 delete this.get;
7845 return;
7846 }
7847
7848 // Hook needed; redefine it so that the support test is not executed again.
7849 return ( this.get = hookFn ).apply( this, arguments );
7850 }
7851 };
7852 }
7853
7854
7855 var
7856
7857 ralpha = /alpha\([^)]*\)/i,
7858 ropacity = /opacity\s*=\s*([^)]*)/i,
7859
7860 // swappable if display is none or starts with table except
7861 // "table", "table-cell", or "table-caption"
7862 // see here for display values:
7863 // https://developer.mozilla.org/en-US/docs/CSS/display
7864 rdisplayswap = /^(none|table(?!-c[ea]).+)/,
7865 rnumsplit = new RegExp( "^(" + pnum + ")(.*)$", "i" ),
7866
7867 cssShow = { position: "absolute", visibility: "hidden", display: "block" },
7868 cssNormalTransform = {
7869 letterSpacing: "0",
7870 fontWeight: "400"
7871 },
7872
7873 cssPrefixes = [ "Webkit", "O", "Moz", "ms" ],
7874 emptyStyle = document.createElement( "div" ).style;
7875
7876
7877 // return a css property mapped to a potentially vendor prefixed property
7878 function vendorPropName( name ) {
7879
7880 // shortcut for names that are not vendor prefixed
7881 if ( name in emptyStyle ) {
7882 return name;
7883 }
7884
7885 // check for vendor prefixed names
7886 var capName = name.charAt( 0 ).toUpperCase() + name.slice( 1 ),
7887 i = cssPrefixes.length;
7888
7889 while ( i-- ) {
7890 name = cssPrefixes[ i ] + capName;
7891 if ( name in emptyStyle ) {
7892 return name;
7893 }
7894 }
7895 }
7896
7897 function showHide( elements, show ) {
7898 var display, elem, hidden,
7899 values = [],
7900 index = 0,
7901 length = elements.length;
7902
7903 for ( ; index < length; index++ ) {
7904 elem = elements[ index ];
7905 if ( !elem.style ) {
7906 continue;
7907 }
7908
7909 values[ index ] = jQuery._data( elem, "olddisplay" );
7910 display = elem.style.display;
7911 if ( show ) {
7912
7913 // Reset the inline display of this element to learn if it is
7914 // being hidden by cascaded rules or not
7915 if ( !values[ index ] && display === "none" ) {
7916 elem.style.display = "";
7917 }
7918
7919 // Set elements which have been overridden with display: none
7920 // in a stylesheet to whatever the default browser style is
7921 // for such an element
7922 if ( elem.style.display === "" && isHidden( elem ) ) {
7923 values[ index ] =
7924 jQuery._data( elem, "olddisplay", defaultDisplay( elem.nodeName ) );
7925 }
7926 } else {
7927 hidden = isHidden( elem );
7928
7929 if ( display && display !== "none" || !hidden ) {
7930 jQuery._data(
7931 elem,
7932 "olddisplay",
7933 hidden ? display : jQuery.css( elem, "display" )
7934 );
7935 }
7936 }
7937 }
7938
7939 // Set the display of most of the elements in a second loop
7940 // to avoid the constant reflow
7941 for ( index = 0; index < length; index++ ) {
7942 elem = elements[ index ];
7943 if ( !elem.style ) {
7944 continue;
7945 }
7946 if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
7947 elem.style.display = show ? values[ index ] || "" : "none";
7948 }
7949 }
7950
7951 return elements;
7952 }
7953
7954 function setPositiveNumber( elem, value, subtract ) {
7955 var matches = rnumsplit.exec( value );
7956 return matches ?
7957
7958 // Guard against undefined "subtract", e.g., when used as in cssHooks
7959 Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
7960 value;
7961 }
7962
7963 function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
7964 var i = extra === ( isBorderBox ? "border" : "content" ) ?
7965
7966 // If we already have the right measurement, avoid augmentation
7967 4 :
7968
7969 // Otherwise initialize for horizontal or vertical properties
7970 name === "width" ? 1 : 0,
7971
7972 val = 0;
7973
7974 for ( ; i < 4; i += 2 ) {
7975
7976 // both box models exclude margin, so add it if we want it
7977 if ( extra === "margin" ) {
7978 val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
7979 }
7980
7981 if ( isBorderBox ) {
7982
7983 // border-box includes padding, so remove it if we want content
7984 if ( extra === "content" ) {
7985 val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
7986 }
7987
7988 // at this point, extra isn't border nor margin, so remove border
7989 if ( extra !== "margin" ) {
7990 val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
7991 }
7992 } else {
7993
7994 // at this point, extra isn't content, so add padding
7995 val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
7996
7997 // at this point, extra isn't content nor padding, so add border
7998 if ( extra !== "padding" ) {
7999 val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
8000 }
8001 }
8002 }
8003
8004 return val;
8005 }
8006
8007 function getWidthOrHeight( elem, name, extra ) {
8008
8009 // Start with offset property, which is equivalent to the border-box value
8010 var valueIsBorderBox = true,
8011 val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
8012 styles = getStyles( elem ),
8013 isBorderBox = support.boxSizing &&
8014 jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
8015
8016 // some non-html elements return undefined for offsetWidth, so check for null/undefined
8017 // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
8018 // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
8019 if ( val <= 0 || val == null ) {
8020
8021 // Fall back to computed then uncomputed css if necessary
8022 val = curCSS( elem, name, styles );
8023 if ( val < 0 || val == null ) {
8024 val = elem.style[ name ];
8025 }
8026
8027 // Computed unit is not pixels. Stop here and return.
8028 if ( rnumnonpx.test( val ) ) {
8029 return val;
8030 }
8031
8032 // we need the check for style in case a browser which returns unreliable values
8033 // for getComputedStyle silently falls back to the reliable elem.style
8034 valueIsBorderBox = isBorderBox &&
8035 ( support.boxSizingReliable() || val === elem.style[ name ] );
8036
8037 // Normalize "", auto, and prepare for extra
8038 val = parseFloat( val ) || 0;
8039 }
8040
8041 // use the active box-sizing model to add/subtract irrelevant styles
8042 return ( val +
8043 augmentWidthOrHeight(
8044 elem,
8045 name,
8046 extra || ( isBorderBox ? "border" : "content" ),
8047 valueIsBorderBox,
8048 styles
8049 )
8050 ) + "px";
8051 }
8052
8053 jQuery.extend( {
8054
8055 // Add in style property hooks for overriding the default
8056 // behavior of getting and setting a style property
8057 cssHooks: {
8058 opacity: {
8059 get: function( elem, computed ) {
8060 if ( computed ) {
8061
8062 // We should always get a number back from opacity
8063 var ret = curCSS( elem, "opacity" );
8064 return ret === "" ? "1" : ret;
8065 }
8066 }
8067 }
8068 },
8069
8070 // Don't automatically add "px" to these possibly-unitless properties
8071 cssNumber: {
8072 "animationIterationCount": true,
8073 "columnCount": true,
8074 "fillOpacity": true,
8075 "flexGrow": true,
8076 "flexShrink": true,
8077 "fontWeight": true,
8078 "lineHeight": true,
8079 "opacity": true,
8080 "order": true,
8081 "orphans": true,
8082 "widows": true,
8083 "zIndex": true,
8084 "zoom": true
8085 },
8086
8087 // Add in properties whose names you wish to fix before
8088 // setting or getting the value
8089 cssProps: {
8090
8091 // normalize float css property
8092 "float": support.cssFloat ? "cssFloat" : "styleFloat"
8093 },
8094
8095 // Get and set the style property on a DOM Node
8096 style: function( elem, name, value, extra ) {
8097
8098 // Don't set styles on text and comment nodes
8099 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
8100 return;
8101 }
8102
8103 // Make sure that we're working with the right name
8104 var ret, type, hooks,
8105 origName = jQuery.camelCase( name ),
8106 style = elem.style;
8107
8108 name = jQuery.cssProps[ origName ] ||
8109 ( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName );
8110
8111 // gets hook for the prefixed version
8112 // followed by the unprefixed version
8113 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
8114
8115 // Check if we're setting a value
8116 if ( value !== undefined ) {
8117 type = typeof value;
8118
8119 // Convert "+=" or "-=" to relative numbers (#7345)
8120 if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
8121 value = adjustCSS( elem, name, ret );
8122
8123 // Fixes bug #9237
8124 type = "number";
8125 }
8126
8127 // Make sure that null and NaN values aren't set. See: #7116
8128 if ( value == null || value !== value ) {
8129 return;
8130 }
8131
8132 // If a number was passed in, add the unit (except for certain CSS properties)
8133 if ( type === "number" ) {
8134 value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
8135 }
8136
8137 // Fixes #8908, it can be done more correctly by specifing setters in cssHooks,
8138 // but it would mean to define eight
8139 // (for every problematic property) identical functions
8140 if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
8141 style[ name ] = "inherit";
8142 }
8143
8144 // If a hook was provided, use that value, otherwise just set the specified value
8145 if ( !hooks || !( "set" in hooks ) ||
8146 ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
8147
8148 // Support: IE
8149 // Swallow errors from 'invalid' CSS values (#5509)
8150 try {
8151 style[ name ] = value;
8152 } catch ( e ) {}
8153 }
8154
8155 } else {
8156
8157 // If a hook was provided get the non-computed value from there
8158 if ( hooks && "get" in hooks &&
8159 ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
8160
8161 return ret;
8162 }
8163
8164 // Otherwise just get the value from the style object
8165 return style[ name ];
8166 }
8167 },
8168
8169 css: function( elem, name, extra, styles ) {
8170 var num, val, hooks,
8171 origName = jQuery.camelCase( name );
8172
8173 // Make sure that we're working with the right name
8174 name = jQuery.cssProps[ origName ] ||
8175 ( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName );
8176
8177 // gets hook for the prefixed version
8178 // followed by the unprefixed version
8179 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
8180
8181 // If a hook was provided get the computed value from there
8182 if ( hooks && "get" in hooks ) {
8183 val = hooks.get( elem, true, extra );
8184 }
8185
8186 // Otherwise, if a way to get the computed value exists, use that
8187 if ( val === undefined ) {
8188 val = curCSS( elem, name, styles );
8189 }
8190
8191 //convert "normal" to computed value
8192 if ( val === "normal" && name in cssNormalTransform ) {
8193 val = cssNormalTransform[ name ];
8194 }
8195
8196 // Return, converting to number if forced or a qualifier was provided and val looks numeric
8197 if ( extra === "" || extra ) {
8198 num = parseFloat( val );
8199 return extra === true || isFinite( num ) ? num || 0 : val;
8200 }
8201 return val;
8202 }
8203 } );
8204
8205 jQuery.each( [ "height", "width" ], function( i, name ) {
8206 jQuery.cssHooks[ name ] = {
8207 get: function( elem, computed, extra ) {
8208 if ( computed ) {
8209
8210 // certain elements can have dimension info if we invisibly show them
8211 // however, it must have a current display style that would benefit from this
8212 return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
8213 elem.offsetWidth === 0 ?
8214 swap( elem, cssShow, function() {
8215 return getWidthOrHeight( elem, name, extra );
8216 } ) :
8217 getWidthOrHeight( elem, name, extra );
8218 }
8219 },
8220
8221 set: function( elem, value, extra ) {
8222 var styles = extra && getStyles( elem );
8223 return setPositiveNumber( elem, value, extra ?
8224 augmentWidthOrHeight(
8225 elem,
8226 name,
8227 extra,
8228 support.boxSizing &&
8229 jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
8230 styles
8231 ) : 0
8232 );
8233 }
8234 };
8235 } );
8236
8237 if ( !support.opacity ) {
8238 jQuery.cssHooks.opacity = {
8239 get: function( elem, computed ) {
8240
8241 // IE uses filters for opacity
8242 return ropacity.test( ( computed && elem.currentStyle ?
8243 elem.currentStyle.filter :
8244 elem.style.filter ) || "" ) ?
8245 ( 0.01 * parseFloat( RegExp.$1 ) ) + "" :
8246 computed ? "1" : "";
8247 },
8248
8249 set: function( elem, value ) {
8250 var style = elem.style,
8251 currentStyle = elem.currentStyle,
8252 opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",
8253 filter = currentStyle && currentStyle.filter || style.filter || "";
8254
8255 // IE has trouble with opacity if it does not have layout
8256 // Force it by setting the zoom level
8257 style.zoom = 1;
8258
8259 // if setting opacity to 1, and no other filters exist -
8260 // attempt to remove filter attribute #6652
8261 // if value === "", then remove inline opacity #12685
8262 if ( ( value >= 1 || value === "" ) &&
8263 jQuery.trim( filter.replace( ralpha, "" ) ) === "" &&
8264 style.removeAttribute ) {
8265
8266 // Setting style.filter to null, "" & " " still leave "filter:" in the cssText
8267 // if "filter:" is present at all, clearType is disabled, we want to avoid this
8268 // style.removeAttribute is IE Only, but so apparently is this code path...
8269 style.removeAttribute( "filter" );
8270
8271 // if there is no filter style applied in a css rule
8272 // or unset inline opacity, we are done
8273 if ( value === "" || currentStyle && !currentStyle.filter ) {
8274 return;
8275 }
8276 }
8277
8278 // otherwise, set new filter values
8279 style.filter = ralpha.test( filter ) ?
8280 filter.replace( ralpha, opacity ) :
8281 filter + " " + opacity;
8282 }
8283 };
8284 }
8285
8286 jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight,
8287 function( elem, computed ) {
8288 if ( computed ) {
8289 return swap( elem, { "display": "inline-block" },
8290 curCSS, [ elem, "marginRight" ] );
8291 }
8292 }
8293 );
8294
8295 jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
8296 function( elem, computed ) {
8297 if ( computed ) {
8298 return (
8299 parseFloat( curCSS( elem, "marginLeft" ) ) ||
8300
8301 // Support: IE<=11+
8302 // Running getBoundingClientRect on a disconnected node in IE throws an error
8303 // Support: IE8 only
8304 // getClientRects() errors on disconnected elems
8305 ( jQuery.contains( elem.ownerDocument, elem ) ?
8306 elem.getBoundingClientRect().left -
8307 swap( elem, { marginLeft: 0 }, function() {
8308 return elem.getBoundingClientRect().left;
8309 } ) :
8310 0
8311 )
8312 ) + "px";
8313 }
8314 }
8315 );
8316
8317 // These hooks are used by animate to expand properties
8318 jQuery.each( {
8319 margin: "",
8320 padding: "",
8321 border: "Width"
8322 }, function( prefix, suffix ) {
8323 jQuery.cssHooks[ prefix + suffix ] = {
8324 expand: function( value ) {
8325 var i = 0,
8326 expanded = {},
8327
8328 // assumes a single number if not a string
8329 parts = typeof value === "string" ? value.split( " " ) : [ value ];
8330
8331 for ( ; i < 4; i++ ) {
8332 expanded[ prefix + cssExpand[ i ] + suffix ] =
8333 parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
8334 }
8335
8336 return expanded;
8337 }
8338 };
8339
8340 if ( !rmargin.test( prefix ) ) {
8341 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
8342 }
8343 } );
8344
8345 jQuery.fn.extend( {
8346 css: function( name, value ) {
8347 return access( this, function( elem, name, value ) {
8348 var styles, len,
8349 map = {},
8350 i = 0;
8351
8352 if ( jQuery.isArray( name ) ) {
8353 styles = getStyles( elem );
8354 len = name.length;
8355
8356 for ( ; i < len; i++ ) {
8357 map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
8358 }
8359
8360 return map;
8361 }
8362
8363 return value !== undefined ?
8364 jQuery.style( elem, name, value ) :
8365 jQuery.css( elem, name );
8366 }, name, value, arguments.length > 1 );
8367 },
8368 show: function() {
8369 return showHide( this, true );
8370 },
8371 hide: function() {
8372 return showHide( this );
8373 },
8374 toggle: function( state ) {
8375 if ( typeof state === "boolean" ) {
8376 return state ? this.show() : this.hide();
8377 }
8378
8379 return this.each( function() {
8380 if ( isHidden( this ) ) {
8381 jQuery( this ).show();
8382 } else {
8383 jQuery( this ).hide();
8384 }
8385 } );
8386 }
8387 } );
8388
8389
8390 function Tween( elem, options, prop, end, easing ) {
8391 return new Tween.prototype.init( elem, options, prop, end, easing );
8392 }
8393 jQuery.Tween = Tween;
8394
8395 Tween.prototype = {
8396 constructor: Tween,
8397 init: function( elem, options, prop, end, easing, unit ) {
8398 this.elem = elem;
8399 this.prop = prop;
8400 this.easing = easing || jQuery.easing._default;
8401 this.options = options;
8402 this.start = this.now = this.cur();
8403 this.end = end;
8404 this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
8405 },
8406 cur: function() {
8407 var hooks = Tween.propHooks[ this.prop ];
8408
8409 return hooks && hooks.get ?
8410 hooks.get( this ) :
8411 Tween.propHooks._default.get( this );
8412 },
8413 run: function( percent ) {
8414 var eased,
8415 hooks = Tween.propHooks[ this.prop ];
8416
8417 if ( this.options.duration ) {
8418 this.pos = eased = jQuery.easing[ this.easing ](
8419 percent, this.options.duration * percent, 0, 1, this.options.duration
8420 );
8421 } else {
8422 this.pos = eased = percent;
8423 }
8424 this.now = ( this.end - this.start ) * eased + this.start;
8425
8426 if ( this.options.step ) {
8427 this.options.step.call( this.elem, this.now, this );
8428 }
8429
8430 if ( hooks && hooks.set ) {
8431 hooks.set( this );
8432 } else {
8433 Tween.propHooks._default.set( this );
8434 }
8435 return this;
8436 }
8437 };
8438
8439 Tween.prototype.init.prototype = Tween.prototype;
8440
8441 Tween.propHooks = {
8442 _default: {
8443 get: function( tween ) {
8444 var result;
8445
8446 // Use a property on the element directly when it is not a DOM element,
8447 // or when there is no matching style property that exists.
8448 if ( tween.elem.nodeType !== 1 ||
8449 tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
8450 return tween.elem[ tween.prop ];
8451 }
8452
8453 // passing an empty string as a 3rd parameter to .css will automatically
8454 // attempt a parseFloat and fallback to a string if the parse fails
8455 // so, simple values such as "10px" are parsed to Float.
8456 // complex values such as "rotate(1rad)" are returned as is.
8457 result = jQuery.css( tween.elem, tween.prop, "" );
8458
8459 // Empty strings, null, undefined and "auto" are converted to 0.
8460 return !result || result === "auto" ? 0 : result;
8461 },
8462 set: function( tween ) {
8463
8464 // use step hook for back compat - use cssHook if its there - use .style if its
8465 // available and use plain properties where available
8466 if ( jQuery.fx.step[ tween.prop ] ) {
8467 jQuery.fx.step[ tween.prop ]( tween );
8468 } else if ( tween.elem.nodeType === 1 &&
8469 ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null ||
8470 jQuery.cssHooks[ tween.prop ] ) ) {
8471 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
8472 } else {
8473 tween.elem[ tween.prop ] = tween.now;
8474 }
8475 }
8476 }
8477 };
8478
8479 // Support: IE <=9
8480 // Panic based approach to setting things on disconnected nodes
8481
8482 Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
8483 set: function( tween ) {
8484 if ( tween.elem.nodeType && tween.elem.parentNode ) {
8485 tween.elem[ tween.prop ] = tween.now;
8486 }
8487 }
8488 };
8489
8490 jQuery.easing = {
8491 linear: function( p ) {
8492 return p;
8493 },
8494 swing: function( p ) {
8495 return 0.5 - Math.cos( p * Math.PI ) / 2;
8496 },
8497 _default: "swing"
8498 };
8499
8500 jQuery.fx = Tween.prototype.init;
8501
8502 // Back Compat <1.8 extension point
8503 jQuery.fx.step = {};
8504
8505
8506
8507
8508 var
8509 fxNow, timerId,
8510 rfxtypes = /^(?:toggle|show|hide)$/,
8511 rrun = /queueHooks$/;
8512
8513 // Animations created synchronously will run synchronously
8514 function createFxNow() {
8515 window.setTimeout( function() {
8516 fxNow = undefined;
8517 } );
8518 return ( fxNow = jQuery.now() );
8519 }
8520
8521 // Generate parameters to create a standard animation
8522 function genFx( type, includeWidth ) {
8523 var which,
8524 attrs = { height: type },
8525 i = 0;
8526
8527 // if we include width, step value is 1 to do all cssExpand values,
8528 // if we don't include width, step value is 2 to skip over Left and Right
8529 includeWidth = includeWidth ? 1 : 0;
8530 for ( ; i < 4 ; i += 2 - includeWidth ) {
8531 which = cssExpand[ i ];
8532 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
8533 }
8534
8535 if ( includeWidth ) {
8536 attrs.opacity = attrs.width = type;
8537 }
8538
8539 return attrs;
8540 }
8541
8542 function createTween( value, prop, animation ) {
8543 var tween,
8544 collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
8545 index = 0,
8546 length = collection.length;
8547 for ( ; index < length; index++ ) {
8548 if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
8549
8550 // we're done with this property
8551 return tween;
8552 }
8553 }
8554 }
8555
8556 function defaultPrefilter( elem, props, opts ) {
8557 /* jshint validthis: true */
8558 var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay,
8559 anim = this,
8560 orig = {},
8561 style = elem.style,
8562 hidden = elem.nodeType && isHidden( elem ),
8563 dataShow = jQuery._data( elem, "fxshow" );
8564
8565 // handle queue: false promises
8566 if ( !opts.queue ) {
8567 hooks = jQuery._queueHooks( elem, "fx" );
8568 if ( hooks.unqueued == null ) {
8569 hooks.unqueued = 0;
8570 oldfire = hooks.empty.fire;
8571 hooks.empty.fire = function() {
8572 if ( !hooks.unqueued ) {
8573 oldfire();
8574 }
8575 };
8576 }
8577 hooks.unqueued++;
8578
8579 anim.always( function() {
8580
8581 // doing this makes sure that the complete handler will be called
8582 // before this completes
8583 anim.always( function() {
8584 hooks.unqueued--;
8585 if ( !jQuery.queue( elem, "fx" ).length ) {
8586 hooks.empty.fire();
8587 }
8588 } );
8589 } );
8590 }
8591
8592 // height/width overflow pass
8593 if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
8594
8595 // Make sure that nothing sneaks out
8596 // Record all 3 overflow attributes because IE does not
8597 // change the overflow attribute when overflowX and
8598 // overflowY are set to the same value
8599 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
8600
8601 // Set display property to inline-block for height/width
8602 // animations on inline elements that are having width/height animated
8603 display = jQuery.css( elem, "display" );
8604
8605 // Test default display if display is currently "none"
8606 checkDisplay = display === "none" ?
8607 jQuery._data( elem, "olddisplay" ) || defaultDisplay( elem.nodeName ) : display;
8608
8609 if ( checkDisplay === "inline" && jQuery.css( elem, "float" ) === "none" ) {
8610
8611 // inline-level elements accept inline-block;
8612 // block-level elements need to be inline with layout
8613 if ( !support.inlineBlockNeedsLayout || defaultDisplay( elem.nodeName ) === "inline" ) {
8614 style.display = "inline-block";
8615 } else {
8616 style.zoom = 1;
8617 }
8618 }
8619 }
8620
8621 if ( opts.overflow ) {
8622 style.overflow = "hidden";
8623 if ( !support.shrinkWrapBlocks() ) {
8624 anim.always( function() {
8625 style.overflow = opts.overflow[ 0 ];
8626 style.overflowX = opts.overflow[ 1 ];
8627 style.overflowY = opts.overflow[ 2 ];
8628 } );
8629 }
8630 }
8631
8632 // show/hide pass
8633 for ( prop in props ) {
8634 value = props[ prop ];
8635 if ( rfxtypes.exec( value ) ) {
8636 delete props[ prop ];
8637 toggle = toggle || value === "toggle";
8638 if ( value === ( hidden ? "hide" : "show" ) ) {
8639
8640 // If there is dataShow left over from a stopped hide or show
8641 // and we are going to proceed with show, we should pretend to be hidden
8642 if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
8643 hidden = true;
8644 } else {
8645 continue;
8646 }
8647 }
8648 orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
8649
8650 // Any non-fx value stops us from restoring the original display value
8651 } else {
8652 display = undefined;
8653 }
8654 }
8655
8656 if ( !jQuery.isEmptyObject( orig ) ) {
8657 if ( dataShow ) {
8658 if ( "hidden" in dataShow ) {
8659 hidden = dataShow.hidden;
8660 }
8661 } else {
8662 dataShow = jQuery._data( elem, "fxshow", {} );
8663 }
8664
8665 // store state if its toggle - enables .stop().toggle() to "reverse"
8666 if ( toggle ) {
8667 dataShow.hidden = !hidden;
8668 }
8669 if ( hidden ) {
8670 jQuery( elem ).show();
8671 } else {
8672 anim.done( function() {
8673 jQuery( elem ).hide();
8674 } );
8675 }
8676 anim.done( function() {
8677 var prop;
8678 jQuery._removeData( elem, "fxshow" );
8679 for ( prop in orig ) {
8680 jQuery.style( elem, prop, orig[ prop ] );
8681 }
8682 } );
8683 for ( prop in orig ) {
8684 tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
8685
8686 if ( !( prop in dataShow ) ) {
8687 dataShow[ prop ] = tween.start;
8688 if ( hidden ) {
8689 tween.end = tween.start;
8690 tween.start = prop === "width" || prop === "height" ? 1 : 0;
8691 }
8692 }
8693 }
8694
8695 // If this is a noop like .hide().hide(), restore an overwritten display value
8696 } else if ( ( display === "none" ? defaultDisplay( elem.nodeName ) : display ) === "inline" ) {
8697 style.display = display;
8698 }
8699 }
8700
8701 function propFilter( props, specialEasing ) {
8702 var index, name, easing, value, hooks;
8703
8704 // camelCase, specialEasing and expand cssHook pass
8705 for ( index in props ) {
8706 name = jQuery.camelCase( index );
8707 easing = specialEasing[ name ];
8708 value = props[ index ];
8709 if ( jQuery.isArray( value ) ) {
8710 easing = value[ 1 ];
8711 value = props[ index ] = value[ 0 ];
8712 }
8713
8714 if ( index !== name ) {
8715 props[ name ] = value;
8716 delete props[ index ];
8717 }
8718
8719 hooks = jQuery.cssHooks[ name ];
8720 if ( hooks && "expand" in hooks ) {
8721 value = hooks.expand( value );
8722 delete props[ name ];
8723
8724 // not quite $.extend, this wont overwrite keys already present.
8725 // also - reusing 'index' from above because we have the correct "name"
8726 for ( index in value ) {
8727 if ( !( index in props ) ) {
8728 props[ index ] = value[ index ];
8729 specialEasing[ index ] = easing;
8730 }
8731 }
8732 } else {
8733 specialEasing[ name ] = easing;
8734 }
8735 }
8736 }
8737
8738 function Animation( elem, properties, options ) {
8739 var result,
8740 stopped,
8741 index = 0,
8742 length = Animation.prefilters.length,
8743 deferred = jQuery.Deferred().always( function() {
8744
8745 // don't match elem in the :animated selector
8746 delete tick.elem;
8747 } ),
8748 tick = function() {
8749 if ( stopped ) {
8750 return false;
8751 }
8752 var currentTime = fxNow || createFxNow(),
8753 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
8754
8755 // Support: Android 2.3
8756 // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
8757 temp = remaining / animation.duration || 0,
8758 percent = 1 - temp,
8759 index = 0,
8760 length = animation.tweens.length;
8761
8762 for ( ; index < length ; index++ ) {
8763 animation.tweens[ index ].run( percent );
8764 }
8765
8766 deferred.notifyWith( elem, [ animation, percent, remaining ] );
8767
8768 if ( percent < 1 && length ) {
8769 return remaining;
8770 } else {
8771 deferred.resolveWith( elem, [ animation ] );
8772 return false;
8773 }
8774 },
8775 animation = deferred.promise( {
8776 elem: elem,
8777 props: jQuery.extend( {}, properties ),
8778 opts: jQuery.extend( true, {
8779 specialEasing: {},
8780 easing: jQuery.easing._default
8781 }, options ),
8782 originalProperties: properties,
8783 originalOptions: options,
8784 startTime: fxNow || createFxNow(),
8785 duration: options.duration,
8786 tweens: [],
8787 createTween: function( prop, end ) {
8788 var tween = jQuery.Tween( elem, animation.opts, prop, end,
8789 animation.opts.specialEasing[ prop ] || animation.opts.easing );
8790 animation.tweens.push( tween );
8791 return tween;
8792 },
8793 stop: function( gotoEnd ) {
8794 var index = 0,
8795
8796 // if we are going to the end, we want to run all the tweens
8797 // otherwise we skip this part
8798 length = gotoEnd ? animation.tweens.length : 0;
8799 if ( stopped ) {
8800 return this;
8801 }
8802 stopped = true;
8803 for ( ; index < length ; index++ ) {
8804 animation.tweens[ index ].run( 1 );
8805 }
8806
8807 // resolve when we played the last frame
8808 // otherwise, reject
8809 if ( gotoEnd ) {
8810 deferred.notifyWith( elem, [ animation, 1, 0 ] );
8811 deferred.resolveWith( elem, [ animation, gotoEnd ] );
8812 } else {
8813 deferred.rejectWith( elem, [ animation, gotoEnd ] );
8814 }
8815 return this;
8816 }
8817 } ),
8818 props = animation.props;
8819
8820 propFilter( props, animation.opts.specialEasing );
8821
8822 for ( ; index < length ; index++ ) {
8823 result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
8824 if ( result ) {
8825 if ( jQuery.isFunction( result.stop ) ) {
8826 jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
8827 jQuery.proxy( result.stop, result );
8828 }
8829 return result;
8830 }
8831 }
8832
8833 jQuery.map( props, createTween, animation );
8834
8835 if ( jQuery.isFunction( animation.opts.start ) ) {
8836 animation.opts.start.call( elem, animation );
8837 }
8838
8839 jQuery.fx.timer(
8840 jQuery.extend( tick, {
8841 elem: elem,
8842 anim: animation,
8843 queue: animation.opts.queue
8844 } )
8845 );
8846
8847 // attach callbacks from options
8848 return animation.progress( animation.opts.progress )
8849 .done( animation.opts.done, animation.opts.complete )
8850 .fail( animation.opts.fail )
8851 .always( animation.opts.always );
8852 }
8853
8854 jQuery.Animation = jQuery.extend( Animation, {
8855
8856 tweeners: {
8857 "*": [ function( prop, value ) {
8858 var tween = this.createTween( prop, value );
8859 adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
8860 return tween;
8861 } ]
8862 },
8863
8864 tweener: function( props, callback ) {
8865 if ( jQuery.isFunction( props ) ) {
8866 callback = props;
8867 props = [ "*" ];
8868 } else {
8869 props = props.match( rnotwhite );
8870 }
8871
8872 var prop,
8873 index = 0,
8874 length = props.length;
8875
8876 for ( ; index < length ; index++ ) {
8877 prop = props[ index ];
8878 Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
8879 Animation.tweeners[ prop ].unshift( callback );
8880 }
8881 },
8882
8883 prefilters: [ defaultPrefilter ],
8884
8885 prefilter: function( callback, prepend ) {
8886 if ( prepend ) {
8887 Animation.prefilters.unshift( callback );
8888 } else {
8889 Animation.prefilters.push( callback );
8890 }
8891 }
8892 } );
8893
8894 jQuery.speed = function( speed, easing, fn ) {
8895 var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
8896 complete: fn || !fn && easing ||
8897 jQuery.isFunction( speed ) && speed,
8898 duration: speed,
8899 easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
8900 };
8901
8902 opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
8903 opt.duration in jQuery.fx.speeds ?
8904 jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
8905
8906 // normalize opt.queue - true/undefined/null -> "fx"
8907 if ( opt.queue == null || opt.queue === true ) {
8908 opt.queue = "fx";
8909 }
8910
8911 // Queueing
8912 opt.old = opt.complete;
8913
8914 opt.complete = function() {
8915 if ( jQuery.isFunction( opt.old ) ) {
8916 opt.old.call( this );
8917 }
8918
8919 if ( opt.queue ) {
8920 jQuery.dequeue( this, opt.queue );
8921 }
8922 };
8923
8924 return opt;
8925 };
8926
8927 jQuery.fn.extend( {
8928 fadeTo: function( speed, to, easing, callback ) {
8929
8930 // show any hidden elements after setting opacity to 0
8931 return this.filter( isHidden ).css( "opacity", 0 ).show()
8932
8933 // animate to the value specified
8934 .end().animate( { opacity: to }, speed, easing, callback );
8935 },
8936 animate: function( prop, speed, easing, callback ) {
8937 var empty = jQuery.isEmptyObject( prop ),
8938 optall = jQuery.speed( speed, easing, callback ),
8939 doAnimation = function() {
8940
8941 // Operate on a copy of prop so per-property easing won't be lost
8942 var anim = Animation( this, jQuery.extend( {}, prop ), optall );
8943
8944 // Empty animations, or finishing resolves immediately
8945 if ( empty || jQuery._data( this, "finish" ) ) {
8946 anim.stop( true );
8947 }
8948 };
8949 doAnimation.finish = doAnimation;
8950
8951 return empty || optall.queue === false ?
8952 this.each( doAnimation ) :
8953 this.queue( optall.queue, doAnimation );
8954 },
8955 stop: function( type, clearQueue, gotoEnd ) {
8956 var stopQueue = function( hooks ) {
8957 var stop = hooks.stop;
8958 delete hooks.stop;
8959 stop( gotoEnd );
8960 };
8961
8962 if ( typeof type !== "string" ) {
8963 gotoEnd = clearQueue;
8964 clearQueue = type;
8965 type = undefined;
8966 }
8967 if ( clearQueue && type !== false ) {
8968 this.queue( type || "fx", [] );
8969 }
8970
8971 return this.each( function() {
8972 var dequeue = true,
8973 index = type != null && type + "queueHooks",
8974 timers = jQuery.timers,
8975 data = jQuery._data( this );
8976
8977 if ( index ) {
8978 if ( data[ index ] && data[ index ].stop ) {
8979 stopQueue( data[ index ] );
8980 }
8981 } else {
8982 for ( index in data ) {
8983 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
8984 stopQueue( data[ index ] );
8985 }
8986 }
8987 }
8988
8989 for ( index = timers.length; index--; ) {
8990 if ( timers[ index ].elem === this &&
8991 ( type == null || timers[ index ].queue === type ) ) {
8992
8993 timers[ index ].anim.stop( gotoEnd );
8994 dequeue = false;
8995 timers.splice( index, 1 );
8996 }
8997 }
8998
8999 // start the next in the queue if the last step wasn't forced
9000 // timers currently will call their complete callbacks, which will dequeue
9001 // but only if they were gotoEnd
9002 if ( dequeue || !gotoEnd ) {
9003 jQuery.dequeue( this, type );
9004 }
9005 } );
9006 },
9007 finish: function( type ) {
9008 if ( type !== false ) {
9009 type = type || "fx";
9010 }
9011 return this.each( function() {
9012 var index,
9013 data = jQuery._data( this ),
9014 queue = data[ type + "queue" ],
9015 hooks = data[ type + "queueHooks" ],
9016 timers = jQuery.timers,
9017 length = queue ? queue.length : 0;
9018
9019 // enable finishing flag on private data
9020 data.finish = true;
9021
9022 // empty the queue first
9023 jQuery.queue( this, type, [] );
9024
9025 if ( hooks && hooks.stop ) {
9026 hooks.stop.call( this, true );
9027 }
9028
9029 // look for any active animations, and finish them
9030 for ( index = timers.length; index--; ) {
9031 if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
9032 timers[ index ].anim.stop( true );
9033 timers.splice( index, 1 );
9034 }
9035 }
9036
9037 // look for any animations in the old queue and finish them
9038 for ( index = 0; index < length; index++ ) {
9039 if ( queue[ index ] && queue[ index ].finish ) {
9040 queue[ index ].finish.call( this );
9041 }
9042 }
9043
9044 // turn off finishing flag
9045 delete data.finish;
9046 } );
9047 }
9048 } );
9049
9050 jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
9051 var cssFn = jQuery.fn[ name ];
9052 jQuery.fn[ name ] = function( speed, easing, callback ) {
9053 return speed == null || typeof speed === "boolean" ?
9054 cssFn.apply( this, arguments ) :
9055 this.animate( genFx( name, true ), speed, easing, callback );
9056 };
9057 } );
9058
9059 // Generate shortcuts for custom animations
9060 jQuery.each( {
9061 slideDown: genFx( "show" ),
9062 slideUp: genFx( "hide" ),
9063 slideToggle: genFx( "toggle" ),
9064 fadeIn: { opacity: "show" },
9065 fadeOut: { opacity: "hide" },
9066 fadeToggle: { opacity: "toggle" }
9067 }, function( name, props ) {
9068 jQuery.fn[ name ] = function( speed, easing, callback ) {
9069 return this.animate( props, speed, easing, callback );
9070 };
9071 } );
9072
9073 jQuery.timers = [];
9074 jQuery.fx.tick = function() {
9075 var timer,
9076 timers = jQuery.timers,
9077 i = 0;
9078
9079 fxNow = jQuery.now();
9080
9081 for ( ; i < timers.length; i++ ) {
9082 timer = timers[ i ];
9083
9084 // Checks the timer has not already been removed
9085 if ( !timer() && timers[ i ] === timer ) {
9086 timers.splice( i--, 1 );
9087 }
9088 }
9089
9090 if ( !timers.length ) {
9091 jQuery.fx.stop();
9092 }
9093 fxNow = undefined;
9094 };
9095
9096 jQuery.fx.timer = function( timer ) {
9097 jQuery.timers.push( timer );
9098 if ( timer() ) {
9099 jQuery.fx.start();
9100 } else {
9101 jQuery.timers.pop();
9102 }
9103 };
9104
9105 jQuery.fx.interval = 13;
9106
9107 jQuery.fx.start = function() {
9108 if ( !timerId ) {
9109 timerId = window.setInterval( jQuery.fx.tick, jQuery.fx.interval );
9110 }
9111 };
9112
9113 jQuery.fx.stop = function() {
9114 window.clearInterval( timerId );
9115 timerId = null;
9116 };
9117
9118 jQuery.fx.speeds = {
9119 slow: 600,
9120 fast: 200,
9121
9122 // Default speed
9123 _default: 400
9124 };
9125
9126
9127 // Based off of the plugin by Clint Helfers, with permission.
9128 // http://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
9129 jQuery.fn.delay = function( time, type ) {
9130 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
9131 type = type || "fx";
9132
9133 return this.queue( type, function( next, hooks ) {
9134 var timeout = window.setTimeout( next, time );
9135 hooks.stop = function() {
9136 window.clearTimeout( timeout );
9137 };
9138 } );
9139 };
9140
9141
9142 ( function() {
9143 var a,
9144 input = document.createElement( "input" ),
9145 div = document.createElement( "div" ),
9146 select = document.createElement( "select" ),
9147 opt = select.appendChild( document.createElement( "option" ) );
9148
9149 // Setup
9150 div = document.createElement( "div" );
9151 div.setAttribute( "className", "t" );
9152 div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
9153 a = div.getElementsByTagName( "a" )[ 0 ];
9154
9155 // Support: Windows Web Apps (WWA)
9156 // `type` must use .setAttribute for WWA (#14901)
9157 input.setAttribute( "type", "checkbox" );
9158 div.appendChild( input );
9159
9160 a = div.getElementsByTagName( "a" )[ 0 ];
9161
9162 // First batch of tests.
9163 a.style.cssText = "top:1px";
9164
9165 // Test setAttribute on camelCase class.
9166 // If it works, we need attrFixes when doing get/setAttribute (ie6/7)
9167 support.getSetAttribute = div.className !== "t";
9168
9169 // Get the style information from getAttribute
9170 // (IE uses .cssText instead)
9171 support.style = /top/.test( a.getAttribute( "style" ) );
9172
9173 // Make sure that URLs aren't manipulated
9174 // (IE normalizes it by default)
9175 support.hrefNormalized = a.getAttribute( "href" ) === "/a";
9176
9177 // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)
9178 support.checkOn = !!input.value;
9179
9180 // Make sure that a selected-by-default option has a working selected property.
9181 // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
9182 support.optSelected = opt.selected;
9183
9184 // Tests for enctype support on a form (#6743)
9185 support.enctype = !!document.createElement( "form" ).enctype;
9186
9187 // Make sure that the options inside disabled selects aren't marked as disabled
9188 // (WebKit marks them as disabled)
9189 select.disabled = true;
9190 support.optDisabled = !opt.disabled;
9191
9192 // Support: IE8 only
9193 // Check if we can trust getAttribute("value")
9194 input = document.createElement( "input" );
9195 input.setAttribute( "value", "" );
9196 support.input = input.getAttribute( "value" ) === "";
9197
9198 // Check if an input maintains its value after becoming a radio
9199 input.value = "t";
9200 input.setAttribute( "type", "radio" );
9201 support.radioValue = input.value === "t";
9202 } )();
9203
9204
9205 var rreturn = /\r/g,
9206 rspaces = /[\x20\t\r\n\f]+/g;
9207
9208 jQuery.fn.extend( {
9209 val: function( value ) {
9210 var hooks, ret, isFunction,
9211 elem = this[ 0 ];
9212
9213 if ( !arguments.length ) {
9214 if ( elem ) {
9215 hooks = jQuery.valHooks[ elem.type ] ||
9216 jQuery.valHooks[ elem.nodeName.toLowerCase() ];
9217
9218 if (
9219 hooks &&
9220 "get" in hooks &&
9221 ( ret = hooks.get( elem, "value" ) ) !== undefined
9222 ) {
9223 return ret;
9224 }
9225
9226 ret = elem.value;
9227
9228 return typeof ret === "string" ?
9229
9230 // handle most common string cases
9231 ret.replace( rreturn, "" ) :
9232
9233 // handle cases where value is null/undef or number
9234 ret == null ? "" : ret;
9235 }
9236
9237 return;
9238 }
9239
9240 isFunction = jQuery.isFunction( value );
9241
9242 return this.each( function( i ) {
9243 var val;
9244
9245 if ( this.nodeType !== 1 ) {
9246 return;
9247 }
9248
9249 if ( isFunction ) {
9250 val = value.call( this, i, jQuery( this ).val() );
9251 } else {
9252 val = value;
9253 }
9254
9255 // Treat null/undefined as ""; convert numbers to string
9256 if ( val == null ) {
9257 val = "";
9258 } else if ( typeof val === "number" ) {
9259 val += "";
9260 } else if ( jQuery.isArray( val ) ) {
9261 val = jQuery.map( val, function( value ) {
9262 return value == null ? "" : value + "";
9263 } );
9264 }
9265
9266 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
9267
9268 // If set returns undefined, fall back to normal setting
9269 if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
9270 this.value = val;
9271 }
9272 } );
9273 }
9274 } );
9275
9276 jQuery.extend( {
9277 valHooks: {
9278 option: {
9279 get: function( elem ) {
9280 var val = jQuery.find.attr( elem, "value" );
9281 return val != null ?
9282 val :
9283
9284 // Support: IE10-11+
9285 // option.text throws exceptions (#14686, #14858)
9286 // Strip and collapse whitespace
9287 // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
9288 jQuery.trim( jQuery.text( elem ) ).replace( rspaces, " " );
9289 }
9290 },
9291 select: {
9292 get: function( elem ) {
9293 var value, option,
9294 options = elem.options,
9295 index = elem.selectedIndex,
9296 one = elem.type === "select-one" || index < 0,
9297 values = one ? null : [],
9298 max = one ? index + 1 : options.length,
9299 i = index < 0 ?
9300 max :
9301 one ? index : 0;
9302
9303 // Loop through all the selected options
9304 for ( ; i < max; i++ ) {
9305 option = options[ i ];
9306
9307 // oldIE doesn't update selected after form reset (#2551)
9308 if ( ( option.selected || i === index ) &&
9309
9310 // Don't return options that are disabled or in a disabled optgroup
9311 ( support.optDisabled ?
9312 !option.disabled :
9313 option.getAttribute( "disabled" ) === null ) &&
9314 ( !option.parentNode.disabled ||
9315 !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
9316
9317 // Get the specific value for the option
9318 value = jQuery( option ).val();
9319
9320 // We don't need an array for one selects
9321 if ( one ) {
9322 return value;
9323 }
9324
9325 // Multi-Selects return an array
9326 values.push( value );
9327 }
9328 }
9329
9330 return values;
9331 },
9332
9333 set: function( elem, value ) {
9334 var optionSet, option,
9335 options = elem.options,
9336 values = jQuery.makeArray( value ),
9337 i = options.length;
9338
9339 while ( i-- ) {
9340 option = options[ i ];
9341
9342 if ( jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 ) {
9343
9344 // Support: IE6
9345 // When new option element is added to select box we need to
9346 // force reflow of newly added node in order to workaround delay
9347 // of initialization properties
9348 try {
9349 option.selected = optionSet = true;
9350
9351 } catch ( _ ) {
9352
9353 // Will be executed only in IE6
9354 option.scrollHeight;
9355 }
9356
9357 } else {
9358 option.selected = false;
9359 }
9360 }
9361
9362 // Force browsers to behave consistently when non-matching value is set
9363 if ( !optionSet ) {
9364 elem.selectedIndex = -1;
9365 }
9366
9367 return options;
9368 }
9369 }
9370 }
9371 } );
9372
9373 // Radios and checkboxes getter/setter
9374 jQuery.each( [ "radio", "checkbox" ], function() {
9375 jQuery.valHooks[ this ] = {
9376 set: function( elem, value ) {
9377 if ( jQuery.isArray( value ) ) {
9378 return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
9379 }
9380 }
9381 };
9382 if ( !support.checkOn ) {
9383 jQuery.valHooks[ this ].get = function( elem ) {
9384 return elem.getAttribute( "value" ) === null ? "on" : elem.value;
9385 };
9386 }
9387 } );
9388
9389
9390
9391
9392 var nodeHook, boolHook,
9393 attrHandle = jQuery.expr.attrHandle,
9394 ruseDefault = /^(?:checked|selected)$/i,
9395 getSetAttribute = support.getSetAttribute,
9396 getSetInput = support.input;
9397
9398 jQuery.fn.extend( {
9399 attr: function( name, value ) {
9400 return access( this, jQuery.attr, name, value, arguments.length > 1 );
9401 },
9402
9403 removeAttr: function( name ) {
9404 return this.each( function() {
9405 jQuery.removeAttr( this, name );
9406 } );
9407 }
9408 } );
9409
9410 jQuery.extend( {
9411 attr: function( elem, name, value ) {
9412 var ret, hooks,
9413 nType = elem.nodeType;
9414
9415 // Don't get/set attributes on text, comment and attribute nodes
9416 if ( nType === 3 || nType === 8 || nType === 2 ) {
9417 return;
9418 }
9419
9420 // Fallback to prop when attributes are not supported
9421 if ( typeof elem.getAttribute === "undefined" ) {
9422 return jQuery.prop( elem, name, value );
9423 }
9424
9425 // All attributes are lowercase
9426 // Grab necessary hook if one is defined
9427 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
9428 name = name.toLowerCase();
9429 hooks = jQuery.attrHooks[ name ] ||
9430 ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook );
9431 }
9432
9433 if ( value !== undefined ) {
9434 if ( value === null ) {
9435 jQuery.removeAttr( elem, name );
9436 return;
9437 }
9438
9439 if ( hooks && "set" in hooks &&
9440 ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
9441 return ret;
9442 }
9443
9444 elem.setAttribute( name, value + "" );
9445 return value;
9446 }
9447
9448 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
9449 return ret;
9450 }
9451
9452 ret = jQuery.find.attr( elem, name );
9453
9454 // Non-existent attributes return null, we normalize to undefined
9455 return ret == null ? undefined : ret;
9456 },
9457
9458 attrHooks: {
9459 type: {
9460 set: function( elem, value ) {
9461 if ( !support.radioValue && value === "radio" &&
9462 jQuery.nodeName( elem, "input" ) ) {
9463
9464 // Setting the type on a radio button after the value resets the value in IE8-9
9465 // Reset value to default in case type is set after value during creation
9466 var val = elem.value;
9467 elem.setAttribute( "type", value );
9468 if ( val ) {
9469 elem.value = val;
9470 }
9471 return value;
9472 }
9473 }
9474 }
9475 },
9476
9477 removeAttr: function( elem, value ) {
9478 var name, propName,
9479 i = 0,
9480 attrNames = value && value.match( rnotwhite );
9481
9482 if ( attrNames && elem.nodeType === 1 ) {
9483 while ( ( name = attrNames[ i++ ] ) ) {
9484 propName = jQuery.propFix[ name ] || name;
9485
9486 // Boolean attributes get special treatment (#10870)
9487 if ( jQuery.expr.match.bool.test( name ) ) {
9488
9489 // Set corresponding property to false
9490 if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
9491 elem[ propName ] = false;
9492
9493 // Support: IE<9
9494 // Also clear defaultChecked/defaultSelected (if appropriate)
9495 } else {
9496 elem[ jQuery.camelCase( "default-" + name ) ] =
9497 elem[ propName ] = false;
9498 }
9499
9500 // See #9699 for explanation of this approach (setting first, then removal)
9501 } else {
9502 jQuery.attr( elem, name, "" );
9503 }
9504
9505 elem.removeAttribute( getSetAttribute ? name : propName );
9506 }
9507 }
9508 }
9509 } );
9510
9511 // Hooks for boolean attributes
9512 boolHook = {
9513 set: function( elem, value, name ) {
9514 if ( value === false ) {
9515
9516 // Remove boolean attributes when set to false
9517 jQuery.removeAttr( elem, name );
9518 } else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
9519
9520 // IE<8 needs the *property* name
9521 elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name );
9522
9523 } else {
9524
9525 // Support: IE<9
9526 // Use defaultChecked and defaultSelected for oldIE
9527 elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true;
9528 }
9529 return name;
9530 }
9531 };
9532
9533 jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
9534 var getter = attrHandle[ name ] || jQuery.find.attr;
9535
9536 if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
9537 attrHandle[ name ] = function( elem, name, isXML ) {
9538 var ret, handle;
9539 if ( !isXML ) {
9540
9541 // Avoid an infinite loop by temporarily removing this function from the getter
9542 handle = attrHandle[ name ];
9543 attrHandle[ name ] = ret;
9544 ret = getter( elem, name, isXML ) != null ?
9545 name.toLowerCase() :
9546 null;
9547 attrHandle[ name ] = handle;
9548 }
9549 return ret;
9550 };
9551 } else {
9552 attrHandle[ name ] = function( elem, name, isXML ) {
9553 if ( !isXML ) {
9554 return elem[ jQuery.camelCase( "default-" + name ) ] ?
9555 name.toLowerCase() :
9556 null;
9557 }
9558 };
9559 }
9560 } );
9561
9562 // fix oldIE attroperties
9563 if ( !getSetInput || !getSetAttribute ) {
9564 jQuery.attrHooks.value = {
9565 set: function( elem, value, name ) {
9566 if ( jQuery.nodeName( elem, "input" ) ) {
9567
9568 // Does not return so that setAttribute is also used
9569 elem.defaultValue = value;
9570 } else {
9571
9572 // Use nodeHook if defined (#1954); otherwise setAttribute is fine
9573 return nodeHook && nodeHook.set( elem, value, name );
9574 }
9575 }
9576 };
9577 }
9578
9579 // IE6/7 do not support getting/setting some attributes with get/setAttribute
9580 if ( !getSetAttribute ) {
9581
9582 // Use this for any attribute in IE6/7
9583 // This fixes almost every IE6/7 issue
9584 nodeHook = {
9585 set: function( elem, value, name ) {
9586
9587 // Set the existing or create a new attribute node
9588 var ret = elem.getAttributeNode( name );
9589 if ( !ret ) {
9590 elem.setAttributeNode(
9591 ( ret = elem.ownerDocument.createAttribute( name ) )
9592 );
9593 }
9594
9595 ret.value = value += "";
9596
9597 // Break association with cloned elements by also using setAttribute (#9646)
9598 if ( name === "value" || value === elem.getAttribute( name ) ) {
9599 return value;
9600 }
9601 }
9602 };
9603
9604 // Some attributes are constructed with empty-string values when not defined
9605 attrHandle.id = attrHandle.name = attrHandle.coords =
9606 function( elem, name, isXML ) {
9607 var ret;
9608 if ( !isXML ) {
9609 return ( ret = elem.getAttributeNode( name ) ) && ret.value !== "" ?
9610 ret.value :
9611 null;
9612 }
9613 };
9614
9615 // Fixing value retrieval on a button requires this module
9616 jQuery.valHooks.button = {
9617 get: function( elem, name ) {
9618 var ret = elem.getAttributeNode( name );
9619 if ( ret && ret.specified ) {
9620 return ret.value;
9621 }
9622 },
9623 set: nodeHook.set
9624 };
9625
9626 // Set contenteditable to false on removals(#10429)
9627 // Setting to empty string throws an error as an invalid value
9628 jQuery.attrHooks.contenteditable = {
9629 set: function( elem, value, name ) {
9630 nodeHook.set( elem, value === "" ? false : value, name );
9631 }
9632 };
9633
9634 // Set width and height to auto instead of 0 on empty string( Bug #8150 )
9635 // This is for removals
9636 jQuery.each( [ "width", "height" ], function( i, name ) {
9637 jQuery.attrHooks[ name ] = {
9638 set: function( elem, value ) {
9639 if ( value === "" ) {
9640 elem.setAttribute( name, "auto" );
9641 return value;
9642 }
9643 }
9644 };
9645 } );
9646 }
9647
9648 if ( !support.style ) {
9649 jQuery.attrHooks.style = {
9650 get: function( elem ) {
9651
9652 // Return undefined in the case of empty string
9653 // Note: IE uppercases css property names, but if we were to .toLowerCase()
9654 // .cssText, that would destroy case sensitivity in URL's, like in "background"
9655 return elem.style.cssText || undefined;
9656 },
9657 set: function( elem, value ) {
9658 return ( elem.style.cssText = value + "" );
9659 }
9660 };
9661 }
9662
9663
9664
9665
9666 var rfocusable = /^(?:input|select|textarea|button|object)$/i,
9667 rclickable = /^(?:a|area)$/i;
9668
9669 jQuery.fn.extend( {
9670 prop: function( name, value ) {
9671 return access( this, jQuery.prop, name, value, arguments.length > 1 );
9672 },
9673
9674 removeProp: function( name ) {
9675 name = jQuery.propFix[ name ] || name;
9676 return this.each( function() {
9677
9678 // try/catch handles cases where IE balks (such as removing a property on window)
9679 try {
9680 this[ name ] = undefined;
9681 delete this[ name ];
9682 } catch ( e ) {}
9683 } );
9684 }
9685 } );
9686
9687 jQuery.extend( {
9688 prop: function( elem, name, value ) {
9689 var ret, hooks,
9690 nType = elem.nodeType;
9691
9692 // Don't get/set properties on text, comment and attribute nodes
9693 if ( nType === 3 || nType === 8 || nType === 2 ) {
9694 return;
9695 }
9696
9697 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
9698
9699 // Fix name and attach hooks
9700 name = jQuery.propFix[ name ] || name;
9701 hooks = jQuery.propHooks[ name ];
9702 }
9703
9704 if ( value !== undefined ) {
9705 if ( hooks && "set" in hooks &&
9706 ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
9707 return ret;
9708 }
9709
9710 return ( elem[ name ] = value );
9711 }
9712
9713 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
9714 return ret;
9715 }
9716
9717 return elem[ name ];
9718 },
9719
9720 propHooks: {
9721 tabIndex: {
9722 get: function( elem ) {
9723
9724 // elem.tabIndex doesn't always return the
9725 // correct value when it hasn't been explicitly set
9726 // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
9727 // Use proper attribute retrieval(#12072)
9728 var tabindex = jQuery.find.attr( elem, "tabindex" );
9729
9730 return tabindex ?
9731 parseInt( tabindex, 10 ) :
9732 rfocusable.test( elem.nodeName ) ||
9733 rclickable.test( elem.nodeName ) && elem.href ?
9734 0 :
9735 -1;
9736 }
9737 }
9738 },
9739
9740 propFix: {
9741 "for": "htmlFor",
9742 "class": "className"
9743 }
9744 } );
9745
9746 // Some attributes require a special call on IE
9747 // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
9748 if ( !support.hrefNormalized ) {
9749
9750 // href/src property should get the full normalized URL (#10299/#12915)
9751 jQuery.each( [ "href", "src" ], function( i, name ) {
9752 jQuery.propHooks[ name ] = {
9753 get: function( elem ) {
9754 return elem.getAttribute( name, 4 );
9755 }
9756 };
9757 } );
9758 }
9759
9760 // Support: Safari, IE9+
9761 // Accessing the selectedIndex property
9762 // forces the browser to respect setting selected
9763 // on the option
9764 // The getter ensures a default option is selected
9765 // when in an optgroup
9766 if ( !support.optSelected ) {
9767 jQuery.propHooks.selected = {
9768 get: function( elem ) {
9769 var parent = elem.parentNode;
9770
9771 if ( parent ) {
9772 parent.selectedIndex;
9773
9774 // Make sure that it also works with optgroups, see #5701
9775 if ( parent.parentNode ) {
9776 parent.parentNode.selectedIndex;
9777 }
9778 }
9779 return null;
9780 },
9781 set: function( elem ) {
9782 var parent = elem.parentNode;
9783 if ( parent ) {
9784 parent.selectedIndex;
9785
9786 if ( parent.parentNode ) {
9787 parent.parentNode.selectedIndex;
9788 }
9789 }
9790 }
9791 };
9792 }
9793
9794 jQuery.each( [
9795 "tabIndex",
9796 "readOnly",
9797 "maxLength",
9798 "cellSpacing",
9799 "cellPadding",
9800 "rowSpan",
9801 "colSpan",
9802 "useMap",
9803 "frameBorder",
9804 "contentEditable"
9805 ], function() {
9806 jQuery.propFix[ this.toLowerCase() ] = this;
9807 } );
9808
9809 // IE6/7 call enctype encoding
9810 if ( !support.enctype ) {
9811 jQuery.propFix.enctype = "encoding";
9812 }
9813
9814
9815
9816
9817 var rclass = /[\t\r\n\f]/g;
9818
9819 function getClass( elem ) {
9820 return jQuery.attr( elem, "class" ) || "";
9821 }
9822
9823 jQuery.fn.extend( {
9824 addClass: function( value ) {
9825 var classes, elem, cur, curValue, clazz, j, finalValue,
9826 i = 0;
9827
9828 if ( jQuery.isFunction( value ) ) {
9829 return this.each( function( j ) {
9830 jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
9831 } );
9832 }
9833
9834 if ( typeof value === "string" && value ) {
9835 classes = value.match( rnotwhite ) || [];
9836
9837 while ( ( elem = this[ i++ ] ) ) {
9838 curValue = getClass( elem );
9839 cur = elem.nodeType === 1 &&
9840 ( " " + curValue + " " ).replace( rclass, " " );
9841
9842 if ( cur ) {
9843 j = 0;
9844 while ( ( clazz = classes[ j++ ] ) ) {
9845 if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
9846 cur += clazz + " ";
9847 }
9848 }
9849
9850 // only assign if different to avoid unneeded rendering.
9851 finalValue = jQuery.trim( cur );
9852 if ( curValue !== finalValue ) {
9853 jQuery.attr( elem, "class", finalValue );
9854 }
9855 }
9856 }
9857 }
9858
9859 return this;
9860 },
9861
9862 removeClass: function( value ) {
9863 var classes, elem, cur, curValue, clazz, j, finalValue,
9864 i = 0;
9865
9866 if ( jQuery.isFunction( value ) ) {
9867 return this.each( function( j ) {
9868 jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
9869 } );
9870 }
9871
9872 if ( !arguments.length ) {
9873 return this.attr( "class", "" );
9874 }
9875
9876 if ( typeof value === "string" && value ) {
9877 classes = value.match( rnotwhite ) || [];
9878
9879 while ( ( elem = this[ i++ ] ) ) {
9880 curValue = getClass( elem );
9881
9882 // This expression is here for better compressibility (see addClass)
9883 cur = elem.nodeType === 1 &&
9884 ( " " + curValue + " " ).replace( rclass, " " );
9885
9886 if ( cur ) {
9887 j = 0;
9888 while ( ( clazz = classes[ j++ ] ) ) {
9889
9890 // Remove *all* instances
9891 while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
9892 cur = cur.replace( " " + clazz + " ", " " );
9893 }
9894 }
9895
9896 // Only assign if different to avoid unneeded rendering.
9897 finalValue = jQuery.trim( cur );
9898 if ( curValue !== finalValue ) {
9899 jQuery.attr( elem, "class", finalValue );
9900 }
9901 }
9902 }
9903 }
9904
9905 return this;
9906 },
9907
9908 toggleClass: function( value, stateVal ) {
9909 var type = typeof value;
9910
9911 if ( typeof stateVal === "boolean" && type === "string" ) {
9912 return stateVal ? this.addClass( value ) : this.removeClass( value );
9913 }
9914
9915 if ( jQuery.isFunction( value ) ) {
9916 return this.each( function( i ) {
9917 jQuery( this ).toggleClass(
9918 value.call( this, i, getClass( this ), stateVal ),
9919 stateVal
9920 );
9921 } );
9922 }
9923
9924 return this.each( function() {
9925 var className, i, self, classNames;
9926
9927 if ( type === "string" ) {
9928
9929 // Toggle individual class names
9930 i = 0;
9931 self = jQuery( this );
9932 classNames = value.match( rnotwhite ) || [];
9933
9934 while ( ( className = classNames[ i++ ] ) ) {
9935
9936 // Check each className given, space separated list
9937 if ( self.hasClass( className ) ) {
9938 self.removeClass( className );
9939 } else {
9940 self.addClass( className );
9941 }
9942 }
9943
9944 // Toggle whole class name
9945 } else if ( value === undefined || type === "boolean" ) {
9946 className = getClass( this );
9947 if ( className ) {
9948
9949 // store className if set
9950 jQuery._data( this, "__className__", className );
9951 }
9952
9953 // If the element has a class name or if we're passed "false",
9954 // then remove the whole classname (if there was one, the above saved it).
9955 // Otherwise bring back whatever was previously saved (if anything),
9956 // falling back to the empty string if nothing was stored.
9957 jQuery.attr( this, "class",
9958 className || value === false ?
9959 "" :
9960 jQuery._data( this, "__className__" ) || ""
9961 );
9962 }
9963 } );
9964 },
9965
9966 hasClass: function( selector ) {
9967 var className, elem,
9968 i = 0;
9969
9970 className = " " + selector + " ";
9971 while ( ( elem = this[ i++ ] ) ) {
9972 if ( elem.nodeType === 1 &&
9973 ( " " + getClass( elem ) + " " ).replace( rclass, " " )
9974 .indexOf( className ) > -1
9975 ) {
9976 return true;
9977 }
9978 }
9979
9980 return false;
9981 }
9982 } );
9983
9984
9985
9986
9987 // Return jQuery for attributes-only inclusion
9988
9989
9990 jQuery.each( ( "blur focus focusin focusout load resize scroll unload click dblclick " +
9991 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
9992 "change select submit keydown keypress keyup error contextmenu" ).split( " " ),
9993 function( i, name ) {
9994
9995 // Handle event binding
9996 jQuery.fn[ name ] = function( data, fn ) {
9997 return arguments.length > 0 ?
9998 this.on( name, null, data, fn ) :
9999 this.trigger( name );
10000 };
10001 } );
10002
10003 jQuery.fn.extend( {
10004 hover: function( fnOver, fnOut ) {
10005 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
10006 }
10007 } );
10008
10009
10010 var location = window.location;
10011
10012 var nonce = jQuery.now();
10013
10014 var rquery = ( /\?/ );
10015
10016
10017
10018 var rvalidtokens = /(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;
10019
10020 jQuery.parseJSON = function( data ) {
10021
10022 // Attempt to parse using the native JSON parser first
10023 if ( window.JSON && window.JSON.parse ) {
10024
10025 // Support: Android 2.3
10026 // Workaround failure to string-cast null input
10027 return window.JSON.parse( data + "" );
10028 }
10029
10030 var requireNonComma,
10031 depth = null,
10032 str = jQuery.trim( data + "" );
10033
10034 // Guard against invalid (and possibly dangerous) input by ensuring that nothing remains
10035 // after removing valid tokens
10036 return str && !jQuery.trim( str.replace( rvalidtokens, function( token, comma, open, close ) {
10037
10038 // Force termination if we see a misplaced comma
10039 if ( requireNonComma && comma ) {
10040 depth = 0;
10041 }
10042
10043 // Perform no more replacements after returning to outermost depth
10044 if ( depth === 0 ) {
10045 return token;
10046 }
10047
10048 // Commas must not follow "[", "{", or ","
10049 requireNonComma = open || comma;
10050
10051 // Determine new depth
10052 // array/object open ("[" or "{"): depth += true - false (increment)
10053 // array/object close ("]" or "}"): depth += false - true (decrement)
10054 // other cases ("," or primitive): depth += true - true (numeric cast)
10055 depth += !close - !open;
10056
10057 // Remove this token
10058 return "";
10059 } ) ) ?
10060 ( Function( "return " + str ) )() :
10061 jQuery.error( "Invalid JSON: " + data );
10062 };
10063
10064
10065 // Cross-browser xml parsing
10066 jQuery.parseXML = function( data ) {
10067 var xml, tmp;
10068 if ( !data || typeof data !== "string" ) {
10069 return null;
10070 }
10071 try {
10072 if ( window.DOMParser ) { // Standard
10073 tmp = new window.DOMParser();
10074 xml = tmp.parseFromString( data, "text/xml" );
10075 } else { // IE
10076 xml = new window.ActiveXObject( "Microsoft.XMLDOM" );
10077 xml.async = "false";
10078 xml.loadXML( data );
10079 }
10080 } catch ( e ) {
10081 xml = undefined;
10082 }
10083 if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
10084 jQuery.error( "Invalid XML: " + data );
10085 }
10086 return xml;
10087 };
10088
10089
10090 var
10091 rhash = /#.*$/,
10092 rts = /([?&])_=[^&]*/,
10093
10094 // IE leaves an \r character at EOL
10095 rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg,
10096
10097 // #7653, #8125, #8152: local protocol detection
10098 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
10099 rnoContent = /^(?:GET|HEAD)$/,
10100 rprotocol = /^\/\//,
10101 rurl = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,
10102
10103 /* Prefilters
10104 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
10105 * 2) These are called:
10106 * - BEFORE asking for a transport
10107 * - AFTER param serialization (s.data is a string if s.processData is true)
10108 * 3) key is the dataType
10109 * 4) the catchall symbol "*" can be used
10110 * 5) execution will start with transport dataType and THEN continue down to "*" if needed
10111 */
10112 prefilters = {},
10113
10114 /* Transports bindings
10115 * 1) key is the dataType
10116 * 2) the catchall symbol "*" can be used
10117 * 3) selection will start with transport dataType and THEN go to "*" if needed
10118 */
10119 transports = {},
10120
10121 // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
10122 allTypes = "*/".concat( "*" ),
10123
10124 // Document location
10125 ajaxLocation = location.href,
10126
10127 // Segment location into parts
10128 ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
10129
10130 // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
10131 function addToPrefiltersOrTransports( structure ) {
10132
10133 // dataTypeExpression is optional and defaults to "*"
10134 return function( dataTypeExpression, func ) {
10135
10136 if ( typeof dataTypeExpression !== "string" ) {
10137 func = dataTypeExpression;
10138 dataTypeExpression = "*";
10139 }
10140
10141 var dataType,
10142 i = 0,
10143 dataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || [];
10144
10145 if ( jQuery.isFunction( func ) ) {
10146
10147 // For each dataType in the dataTypeExpression
10148 while ( ( dataType = dataTypes[ i++ ] ) ) {
10149
10150 // Prepend if requested
10151 if ( dataType.charAt( 0 ) === "+" ) {
10152 dataType = dataType.slice( 1 ) || "*";
10153 ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
10154
10155 // Otherwise append
10156 } else {
10157 ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
10158 }
10159 }
10160 }
10161 };
10162 }
10163
10164 // Base inspection function for prefilters and transports
10165 function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
10166
10167 var inspected = {},
10168 seekingTransport = ( structure === transports );
10169
10170 function inspect( dataType ) {
10171 var selected;
10172 inspected[ dataType ] = true;
10173 jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
10174 var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
10175 if ( typeof dataTypeOrTransport === "string" &&
10176 !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
10177
10178 options.dataTypes.unshift( dataTypeOrTransport );
10179 inspect( dataTypeOrTransport );
10180 return false;
10181 } else if ( seekingTransport ) {
10182 return !( selected = dataTypeOrTransport );
10183 }
10184 } );
10185 return selected;
10186 }
10187
10188 return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
10189 }
10190
10191 // A special extend for ajax options
10192 // that takes "flat" options (not to be deep extended)
10193 // Fixes #9887
10194 function ajaxExtend( target, src ) {
10195 var deep, key,
10196 flatOptions = jQuery.ajaxSettings.flatOptions || {};
10197
10198 for ( key in src ) {
10199 if ( src[ key ] !== undefined ) {
10200 ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
10201 }
10202 }
10203 if ( deep ) {
10204 jQuery.extend( true, target, deep );
10205 }
10206
10207 return target;
10208 }
10209
10210 /* Handles responses to an ajax request:
10211 * - finds the right dataType (mediates between content-type and expected dataType)
10212 * - returns the corresponding response
10213 */
10214 function ajaxHandleResponses( s, jqXHR, responses ) {
10215 var firstDataType, ct, finalDataType, type,
10216 contents = s.contents,
10217 dataTypes = s.dataTypes;
10218
10219 // Remove auto dataType and get content-type in the process
10220 while ( dataTypes[ 0 ] === "*" ) {
10221 dataTypes.shift();
10222 if ( ct === undefined ) {
10223 ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
10224 }
10225 }
10226
10227 // Check if we're dealing with a known content-type
10228 if ( ct ) {
10229 for ( type in contents ) {
10230 if ( contents[ type ] && contents[ type ].test( ct ) ) {
10231 dataTypes.unshift( type );
10232 break;
10233 }
10234 }
10235 }
10236
10237 // Check to see if we have a response for the expected dataType
10238 if ( dataTypes[ 0 ] in responses ) {
10239 finalDataType = dataTypes[ 0 ];
10240 } else {
10241
10242 // Try convertible dataTypes
10243 for ( type in responses ) {
10244 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
10245 finalDataType = type;
10246 break;
10247 }
10248 if ( !firstDataType ) {
10249 firstDataType = type;
10250 }
10251 }
10252
10253 // Or just use first one
10254 finalDataType = finalDataType || firstDataType;
10255 }
10256
10257 // If we found a dataType
10258 // We add the dataType to the list if needed
10259 // and return the corresponding response
10260 if ( finalDataType ) {
10261 if ( finalDataType !== dataTypes[ 0 ] ) {
10262 dataTypes.unshift( finalDataType );
10263 }
10264 return responses[ finalDataType ];
10265 }
10266 }
10267
10268 /* Chain conversions given the request and the original response
10269 * Also sets the responseXXX fields on the jqXHR instance
10270 */
10271 function ajaxConvert( s, response, jqXHR, isSuccess ) {
10272 var conv2, current, conv, tmp, prev,
10273 converters = {},
10274
10275 // Work with a copy of dataTypes in case we need to modify it for conversion
10276 dataTypes = s.dataTypes.slice();
10277
10278 // Create converters map with lowercased keys
10279 if ( dataTypes[ 1 ] ) {
10280 for ( conv in s.converters ) {
10281 converters[ conv.toLowerCase() ] = s.converters[ conv ];
10282 }
10283 }
10284
10285 current = dataTypes.shift();
10286
10287 // Convert to each sequential dataType
10288 while ( current ) {
10289
10290 if ( s.responseFields[ current ] ) {
10291 jqXHR[ s.responseFields[ current ] ] = response;
10292 }
10293
10294 // Apply the dataFilter if provided
10295 if ( !prev && isSuccess && s.dataFilter ) {
10296 response = s.dataFilter( response, s.dataType );
10297 }
10298
10299 prev = current;
10300 current = dataTypes.shift();
10301
10302 if ( current ) {
10303
10304 // There's only work to do if current dataType is non-auto
10305 if ( current === "*" ) {
10306
10307 current = prev;
10308
10309 // Convert response if prev dataType is non-auto and differs from current
10310 } else if ( prev !== "*" && prev !== current ) {
10311
10312 // Seek a direct converter
10313 conv = converters[ prev + " " + current ] || converters[ "* " + current ];
10314
10315 // If none found, seek a pair
10316 if ( !conv ) {
10317 for ( conv2 in converters ) {
10318
10319 // If conv2 outputs current
10320 tmp = conv2.split( " " );
10321 if ( tmp[ 1 ] === current ) {
10322
10323 // If prev can be converted to accepted input
10324 conv = converters[ prev + " " + tmp[ 0 ] ] ||
10325 converters[ "* " + tmp[ 0 ] ];
10326 if ( conv ) {
10327
10328 // Condense equivalence converters
10329 if ( conv === true ) {
10330 conv = converters[ conv2 ];
10331
10332 // Otherwise, insert the intermediate dataType
10333 } else if ( converters[ conv2 ] !== true ) {
10334 current = tmp[ 0 ];
10335 dataTypes.unshift( tmp[ 1 ] );
10336 }
10337 break;
10338 }
10339 }
10340 }
10341 }
10342
10343 // Apply converter (if not an equivalence)
10344 if ( conv !== true ) {
10345
10346 // Unless errors are allowed to bubble, catch and return them
10347 if ( conv && s[ "throws" ] ) { // jscs:ignore requireDotNotation
10348 response = conv( response );
10349 } else {
10350 try {
10351 response = conv( response );
10352 } catch ( e ) {
10353 return {
10354 state: "parsererror",
10355 error: conv ? e : "No conversion from " + prev + " to " + current
10356 };
10357 }
10358 }
10359 }
10360 }
10361 }
10362 }
10363
10364 return { state: "success", data: response };
10365 }
10366
10367 jQuery.extend( {
10368
10369 // Counter for holding the number of active queries
10370 active: 0,
10371
10372 // Last-Modified header cache for next request
10373 lastModified: {},
10374 etag: {},
10375
10376 ajaxSettings: {
10377 url: ajaxLocation,
10378 type: "GET",
10379 isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
10380 global: true,
10381 processData: true,
10382 async: true,
10383 contentType: "application/x-www-form-urlencoded; charset=UTF-8",
10384 /*
10385 timeout: 0,
10386 data: null,
10387 dataType: null,
10388 username: null,
10389 password: null,
10390 cache: null,
10391 throws: false,
10392 traditional: false,
10393 headers: {},
10394 */
10395
10396 accepts: {
10397 "*": allTypes,
10398 text: "text/plain",
10399 html: "text/html",
10400 xml: "application/xml, text/xml",
10401 json: "application/json, text/javascript"
10402 },
10403
10404 contents: {
10405 xml: /\bxml\b/,
10406 html: /\bhtml/,
10407 json: /\bjson\b/
10408 },
10409
10410 responseFields: {
10411 xml: "responseXML",
10412 text: "responseText",
10413 json: "responseJSON"
10414 },
10415
10416 // Data converters
10417 // Keys separate source (or catchall "*") and destination types with a single space
10418 converters: {
10419
10420 // Convert anything to text
10421 "* text": String,
10422
10423 // Text to html (true = no transformation)
10424 "text html": true,
10425
10426 // Evaluate text as a json expression
10427 "text json": jQuery.parseJSON,
10428
10429 // Parse text as xml
10430 "text xml": jQuery.parseXML
10431 },
10432
10433 // For options that shouldn't be deep extended:
10434 // you can add your own custom options here if
10435 // and when you create one that shouldn't be
10436 // deep extended (see ajaxExtend)
10437 flatOptions: {
10438 url: true,
10439 context: true
10440 }
10441 },
10442
10443 // Creates a full fledged settings object into target
10444 // with both ajaxSettings and settings fields.
10445 // If target is omitted, writes into ajaxSettings.
10446 ajaxSetup: function( target, settings ) {
10447 return settings ?
10448
10449 // Building a settings object
10450 ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
10451
10452 // Extending ajaxSettings
10453 ajaxExtend( jQuery.ajaxSettings, target );
10454 },
10455
10456 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
10457 ajaxTransport: addToPrefiltersOrTransports( transports ),
10458
10459 // Main method
10460 ajax: function( url, options ) {
10461
10462 // If url is an object, simulate pre-1.5 signature
10463 if ( typeof url === "object" ) {
10464 options = url;
10465 url = undefined;
10466 }
10467
10468 // Force options to be an object
10469 options = options || {};
10470
10471 var
10472
10473 // Cross-domain detection vars
10474 parts,
10475
10476 // Loop variable
10477 i,
10478
10479 // URL without anti-cache param
10480 cacheURL,
10481
10482 // Response headers as string
10483 responseHeadersString,
10484
10485 // timeout handle
10486 timeoutTimer,
10487
10488 // To know if global events are to be dispatched
10489 fireGlobals,
10490
10491 transport,
10492
10493 // Response headers
10494 responseHeaders,
10495
10496 // Create the final options object
10497 s = jQuery.ajaxSetup( {}, options ),
10498
10499 // Callbacks context
10500 callbackContext = s.context || s,
10501
10502 // Context for global events is callbackContext if it is a DOM node or jQuery collection
10503 globalEventContext = s.context &&
10504 ( callbackContext.nodeType || callbackContext.jquery ) ?
10505 jQuery( callbackContext ) :
10506 jQuery.event,
10507
10508 // Deferreds
10509 deferred = jQuery.Deferred(),
10510 completeDeferred = jQuery.Callbacks( "once memory" ),
10511
10512 // Status-dependent callbacks
10513 statusCode = s.statusCode || {},
10514
10515 // Headers (they are sent all at once)
10516 requestHeaders = {},
10517 requestHeadersNames = {},
10518
10519 // The jqXHR state
10520 state = 0,
10521
10522 // Default abort message
10523 strAbort = "canceled",
10524
10525 // Fake xhr
10526 jqXHR = {
10527 readyState: 0,
10528
10529 // Builds headers hashtable if needed
10530 getResponseHeader: function( key ) {
10531 var match;
10532 if ( state === 2 ) {
10533 if ( !responseHeaders ) {
10534 responseHeaders = {};
10535 while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
10536 responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ];
10537 }
10538 }
10539 match = responseHeaders[ key.toLowerCase() ];
10540 }
10541 return match == null ? null : match;
10542 },
10543
10544 // Raw string
10545 getAllResponseHeaders: function() {
10546 return state === 2 ? responseHeadersString : null;
10547 },
10548
10549 // Caches the header
10550 setRequestHeader: function( name, value ) {
10551 var lname = name.toLowerCase();
10552 if ( !state ) {
10553 name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
10554 requestHeaders[ name ] = value;
10555 }
10556 return this;
10557 },
10558
10559 // Overrides response content-type header
10560 overrideMimeType: function( type ) {
10561 if ( !state ) {
10562 s.mimeType = type;
10563 }
10564 return this;
10565 },
10566
10567 // Status-dependent callbacks
10568 statusCode: function( map ) {
10569 var code;
10570 if ( map ) {
10571 if ( state < 2 ) {
10572 for ( code in map ) {
10573
10574 // Lazy-add the new callback in a way that preserves old ones
10575 statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
10576 }
10577 } else {
10578
10579 // Execute the appropriate callbacks
10580 jqXHR.always( map[ jqXHR.status ] );
10581 }
10582 }
10583 return this;
10584 },
10585
10586 // Cancel the request
10587 abort: function( statusText ) {
10588 var finalText = statusText || strAbort;
10589 if ( transport ) {
10590 transport.abort( finalText );
10591 }
10592 done( 0, finalText );
10593 return this;
10594 }
10595 };
10596
10597 // Attach deferreds
10598 deferred.promise( jqXHR ).complete = completeDeferred.add;
10599 jqXHR.success = jqXHR.done;
10600 jqXHR.error = jqXHR.fail;
10601
10602 // Remove hash character (#7531: and string promotion)
10603 // Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
10604 // Handle falsy url in the settings object (#10093: consistency with old signature)
10605 // We also use the url parameter if available
10606 s.url = ( ( url || s.url || ajaxLocation ) + "" )
10607 .replace( rhash, "" )
10608 .replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
10609
10610 // Alias method option to type as per ticket #12004
10611 s.type = options.method || options.type || s.method || s.type;
10612
10613 // Extract dataTypes list
10614 s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ];
10615
10616 // A cross-domain request is in order when we have a protocol:host:port mismatch
10617 if ( s.crossDomain == null ) {
10618 parts = rurl.exec( s.url.toLowerCase() );
10619 s.crossDomain = !!( parts &&
10620 ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
10621 ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !==
10622 ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) )
10623 );
10624 }
10625
10626 // Convert data if not already a string
10627 if ( s.data && s.processData && typeof s.data !== "string" ) {
10628 s.data = jQuery.param( s.data, s.traditional );
10629 }
10630
10631 // Apply prefilters
10632 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
10633
10634 // If request was aborted inside a prefilter, stop there
10635 if ( state === 2 ) {
10636 return jqXHR;
10637 }
10638
10639 // We can fire global events as of now if asked to
10640 // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
10641 fireGlobals = jQuery.event && s.global;
10642
10643 // Watch for a new set of requests
10644 if ( fireGlobals && jQuery.active++ === 0 ) {
10645 jQuery.event.trigger( "ajaxStart" );
10646 }
10647
10648 // Uppercase the type
10649 s.type = s.type.toUpperCase();
10650
10651 // Determine if request has content
10652 s.hasContent = !rnoContent.test( s.type );
10653
10654 // Save the URL in case we're toying with the If-Modified-Since
10655 // and/or If-None-Match header later on
10656 cacheURL = s.url;
10657
10658 // More options handling for requests with no content
10659 if ( !s.hasContent ) {
10660
10661 // If data is available, append data to url
10662 if ( s.data ) {
10663 cacheURL = ( s.url += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
10664
10665 // #9682: remove data so that it's not used in an eventual retry
10666 delete s.data;
10667 }
10668
10669 // Add anti-cache in url if needed
10670 if ( s.cache === false ) {
10671 s.url = rts.test( cacheURL ) ?
10672
10673 // If there is already a '_' parameter, set its value
10674 cacheURL.replace( rts, "$1_=" + nonce++ ) :
10675
10676 // Otherwise add one to the end
10677 cacheURL + ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + nonce++;
10678 }
10679 }
10680
10681 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
10682 if ( s.ifModified ) {
10683 if ( jQuery.lastModified[ cacheURL ] ) {
10684 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
10685 }
10686 if ( jQuery.etag[ cacheURL ] ) {
10687 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
10688 }
10689 }
10690
10691 // Set the correct header, if data is being sent
10692 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
10693 jqXHR.setRequestHeader( "Content-Type", s.contentType );
10694 }
10695
10696 // Set the Accepts header for the server, depending on the dataType
10697 jqXHR.setRequestHeader(
10698 "Accept",
10699 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
10700 s.accepts[ s.dataTypes[ 0 ] ] +
10701 ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
10702 s.accepts[ "*" ]
10703 );
10704
10705 // Check for headers option
10706 for ( i in s.headers ) {
10707 jqXHR.setRequestHeader( i, s.headers[ i ] );
10708 }
10709
10710 // Allow custom headers/mimetypes and early abort
10711 if ( s.beforeSend &&
10712 ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
10713
10714 // Abort if not done already and return
10715 return jqXHR.abort();
10716 }
10717
10718 // aborting is no longer a cancellation
10719 strAbort = "abort";
10720
10721 // Install callbacks on deferreds
10722 for ( i in { success: 1, error: 1, complete: 1 } ) {
10723 jqXHR[ i ]( s[ i ] );
10724 }
10725
10726 // Get transport
10727 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
10728
10729 // If no transport, we auto-abort
10730 if ( !transport ) {
10731 done( -1, "No Transport" );
10732 } else {
10733 jqXHR.readyState = 1;
10734
10735 // Send global event
10736 if ( fireGlobals ) {
10737 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
10738 }
10739
10740 // If request was aborted inside ajaxSend, stop there
10741 if ( state === 2 ) {
10742 return jqXHR;
10743 }
10744
10745 // Timeout
10746 if ( s.async && s.timeout > 0 ) {
10747 timeoutTimer = window.setTimeout( function() {
10748 jqXHR.abort( "timeout" );
10749 }, s.timeout );
10750 }
10751
10752 try {
10753 state = 1;
10754 transport.send( requestHeaders, done );
10755 } catch ( e ) {
10756
10757 // Propagate exception as error if not done
10758 if ( state < 2 ) {
10759 done( -1, e );
10760
10761 // Simply rethrow otherwise
10762 } else {
10763 throw e;
10764 }
10765 }
10766 }
10767
10768 // Callback for when everything is done
10769 function done( status, nativeStatusText, responses, headers ) {
10770 var isSuccess, success, error, response, modified,
10771 statusText = nativeStatusText;
10772
10773 // Called once
10774 if ( state === 2 ) {
10775 return;
10776 }
10777
10778 // State is "done" now
10779 state = 2;
10780
10781 // Clear timeout if it exists
10782 if ( timeoutTimer ) {
10783 window.clearTimeout( timeoutTimer );
10784 }
10785
10786 // Dereference transport for early garbage collection
10787 // (no matter how long the jqXHR object will be used)
10788 transport = undefined;
10789
10790 // Cache response headers
10791 responseHeadersString = headers || "";
10792
10793 // Set readyState
10794 jqXHR.readyState = status > 0 ? 4 : 0;
10795
10796 // Determine if successful
10797 isSuccess = status >= 200 && status < 300 || status === 304;
10798
10799 // Get response data
10800 if ( responses ) {
10801 response = ajaxHandleResponses( s, jqXHR, responses );
10802 }
10803
10804 // Convert no matter what (that way responseXXX fields are always set)
10805 response = ajaxConvert( s, response, jqXHR, isSuccess );
10806
10807 // If successful, handle type chaining
10808 if ( isSuccess ) {
10809
10810 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
10811 if ( s.ifModified ) {
10812 modified = jqXHR.getResponseHeader( "Last-Modified" );
10813 if ( modified ) {
10814 jQuery.lastModified[ cacheURL ] = modified;
10815 }
10816 modified = jqXHR.getResponseHeader( "etag" );
10817 if ( modified ) {
10818 jQuery.etag[ cacheURL ] = modified;
10819 }
10820 }
10821
10822 // if no content
10823 if ( status === 204 || s.type === "HEAD" ) {
10824 statusText = "nocontent";
10825
10826 // if not modified
10827 } else if ( status === 304 ) {
10828 statusText = "notmodified";
10829
10830 // If we have data, let's convert it
10831 } else {
10832 statusText = response.state;
10833 success = response.data;
10834 error = response.error;
10835 isSuccess = !error;
10836 }
10837 } else {
10838
10839 // We extract error from statusText
10840 // then normalize statusText and status for non-aborts
10841 error = statusText;
10842 if ( status || !statusText ) {
10843 statusText = "error";
10844 if ( status < 0 ) {
10845 status = 0;
10846 }
10847 }
10848 }
10849
10850 // Set data for the fake xhr object
10851 jqXHR.status = status;
10852 jqXHR.statusText = ( nativeStatusText || statusText ) + "";
10853
10854 // Success/Error
10855 if ( isSuccess ) {
10856 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
10857 } else {
10858 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
10859 }
10860
10861 // Status-dependent callbacks
10862 jqXHR.statusCode( statusCode );
10863 statusCode = undefined;
10864
10865 if ( fireGlobals ) {
10866 globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
10867 [ jqXHR, s, isSuccess ? success : error ] );
10868 }
10869
10870 // Complete
10871 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
10872
10873 if ( fireGlobals ) {
10874 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
10875
10876 // Handle the global AJAX counter
10877 if ( !( --jQuery.active ) ) {
10878 jQuery.event.trigger( "ajaxStop" );
10879 }
10880 }
10881 }
10882
10883 return jqXHR;
10884 },
10885
10886 getJSON: function( url, data, callback ) {
10887 return jQuery.get( url, data, callback, "json" );
10888 },
10889
10890 getScript: function( url, callback ) {
10891 return jQuery.get( url, undefined, callback, "script" );
10892 }
10893 } );
10894
10895 jQuery.each( [ "get", "post" ], function( i, method ) {
10896 jQuery[ method ] = function( url, data, callback, type ) {
10897
10898 // shift arguments if data argument was omitted
10899 if ( jQuery.isFunction( data ) ) {
10900 type = type || callback;
10901 callback = data;
10902 data = undefined;
10903 }
10904
10905 // The url can be an options object (which then must have .url)
10906 return jQuery.ajax( jQuery.extend( {
10907 url: url,
10908 type: method,
10909 dataType: type,
10910 data: data,
10911 success: callback
10912 }, jQuery.isPlainObject( url ) && url ) );
10913 };
10914 } );
10915
10916
10917 jQuery._evalUrl = function( url ) {
10918 return jQuery.ajax( {
10919 url: url,
10920
10921 // Make this explicit, since user can override this through ajaxSetup (#11264)
10922 type: "GET",
10923 dataType: "script",
10924 cache: true,
10925 async: false,
10926 global: false,
10927 "throws": true
10928 } );
10929 };
10930
10931
10932 jQuery.fn.extend( {
10933 wrapAll: function( html ) {
10934 if ( jQuery.isFunction( html ) ) {
10935 return this.each( function( i ) {
10936 jQuery( this ).wrapAll( html.call( this, i ) );
10937 } );
10938 }
10939
10940 if ( this[ 0 ] ) {
10941
10942 // The elements to wrap the target around
10943 var wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
10944
10945 if ( this[ 0 ].parentNode ) {
10946 wrap.insertBefore( this[ 0 ] );
10947 }
10948
10949 wrap.map( function() {
10950 var elem = this;
10951
10952 while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
10953 elem = elem.firstChild;
10954 }
10955
10956 return elem;
10957 } ).append( this );
10958 }
10959
10960 return this;
10961 },
10962
10963 wrapInner: function( html ) {
10964 if ( jQuery.isFunction( html ) ) {
10965 return this.each( function( i ) {
10966 jQuery( this ).wrapInner( html.call( this, i ) );
10967 } );
10968 }
10969
10970 return this.each( function() {
10971 var self = jQuery( this ),
10972 contents = self.contents();
10973
10974 if ( contents.length ) {
10975 contents.wrapAll( html );
10976
10977 } else {
10978 self.append( html );
10979 }
10980 } );
10981 },
10982
10983 wrap: function( html ) {
10984 var isFunction = jQuery.isFunction( html );
10985
10986 return this.each( function( i ) {
10987 jQuery( this ).wrapAll( isFunction ? html.call( this, i ) : html );
10988 } );
10989 },
10990
10991 unwrap: function() {
10992 return this.parent().each( function() {
10993 if ( !jQuery.nodeName( this, "body" ) ) {
10994 jQuery( this ).replaceWith( this.childNodes );
10995 }
10996 } ).end();
10997 }
10998 } );
10999
11000
11001 function getDisplay( elem ) {
11002 return elem.style && elem.style.display || jQuery.css( elem, "display" );
11003 }
11004
11005 function filterHidden( elem ) {
11006
11007 // Disconnected elements are considered hidden
11008 if ( !jQuery.contains( elem.ownerDocument || document, elem ) ) {
11009 return true;
11010 }
11011 while ( elem && elem.nodeType === 1 ) {
11012 if ( getDisplay( elem ) === "none" || elem.type === "hidden" ) {
11013 return true;
11014 }
11015 elem = elem.parentNode;
11016 }
11017 return false;
11018 }
11019
11020 jQuery.expr.filters.hidden = function( elem ) {
11021
11022 // Support: Opera <= 12.12
11023 // Opera reports offsetWidths and offsetHeights less than zero on some elements
11024 return support.reliableHiddenOffsets() ?
11025 ( elem.offsetWidth <= 0 && elem.offsetHeight <= 0 &&
11026 !elem.getClientRects().length ) :
11027 filterHidden( elem );
11028 };
11029
11030 jQuery.expr.filters.visible = function( elem ) {
11031 return !jQuery.expr.filters.hidden( elem );
11032 };
11033
11034
11035
11036
11037 var r20 = /%20/g,
11038 rbracket = /\[\]$/,
11039 rCRLF = /\r?\n/g,
11040 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
11041 rsubmittable = /^(?:input|select|textarea|keygen)/i;
11042
11043 function buildParams( prefix, obj, traditional, add ) {
11044 var name;
11045
11046 if ( jQuery.isArray( obj ) ) {
11047
11048 // Serialize array item.
11049 jQuery.each( obj, function( i, v ) {
11050 if ( traditional || rbracket.test( prefix ) ) {
11051
11052 // Treat each array item as a scalar.
11053 add( prefix, v );
11054
11055 } else {
11056
11057 // Item is non-scalar (array or object), encode its numeric index.
11058 buildParams(
11059 prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
11060 v,
11061 traditional,
11062 add
11063 );
11064 }
11065 } );
11066
11067 } else if ( !traditional && jQuery.type( obj ) === "object" ) {
11068
11069 // Serialize object item.
11070 for ( name in obj ) {
11071 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
11072 }
11073
11074 } else {
11075
11076 // Serialize scalar item.
11077 add( prefix, obj );
11078 }
11079 }
11080
11081 // Serialize an array of form elements or a set of
11082 // key/values into a query string
11083 jQuery.param = function( a, traditional ) {
11084 var prefix,
11085 s = [],
11086 add = function( key, value ) {
11087
11088 // If value is a function, invoke it and return its value
11089 value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
11090 s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
11091 };
11092
11093 // Set traditional to true for jQuery <= 1.3.2 behavior.
11094 if ( traditional === undefined ) {
11095 traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
11096 }
11097
11098 // If an array was passed in, assume that it is an array of form elements.
11099 if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
11100
11101 // Serialize the form elements
11102 jQuery.each( a, function() {
11103 add( this.name, this.value );
11104 } );
11105
11106 } else {
11107
11108 // If traditional, encode the "old" way (the way 1.3.2 or older
11109 // did it), otherwise encode params recursively.
11110 for ( prefix in a ) {
11111 buildParams( prefix, a[ prefix ], traditional, add );
11112 }
11113 }
11114
11115 // Return the resulting serialization
11116 return s.join( "&" ).replace( r20, "+" );
11117 };
11118
11119 jQuery.fn.extend( {
11120 serialize: function() {
11121 return jQuery.param( this.serializeArray() );
11122 },
11123 serializeArray: function() {
11124 return this.map( function() {
11125
11126 // Can add propHook for "elements" to filter or add form elements
11127 var elements = jQuery.prop( this, "elements" );
11128 return elements ? jQuery.makeArray( elements ) : this;
11129 } )
11130 .filter( function() {
11131 var type = this.type;
11132
11133 // Use .is(":disabled") so that fieldset[disabled] works
11134 return this.name && !jQuery( this ).is( ":disabled" ) &&
11135 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
11136 ( this.checked || !rcheckableType.test( type ) );
11137 } )
11138 .map( function( i, elem ) {
11139 var val = jQuery( this ).val();
11140
11141 return val == null ?
11142 null :
11143 jQuery.isArray( val ) ?
11144 jQuery.map( val, function( val ) {
11145 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
11146 } ) :
11147 { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
11148 } ).get();
11149 }
11150 } );
11151
11152
11153 // Create the request object
11154 // (This is still attached to ajaxSettings for backward compatibility)
11155 jQuery.ajaxSettings.xhr = window.ActiveXObject !== undefined ?
11156
11157 // Support: IE6-IE8
11158 function() {
11159
11160 // XHR cannot access local files, always use ActiveX for that case
11161 if ( this.isLocal ) {
11162 return createActiveXHR();
11163 }
11164
11165 // Support: IE 9-11
11166 // IE seems to error on cross-domain PATCH requests when ActiveX XHR
11167 // is used. In IE 9+ always use the native XHR.
11168 // Note: this condition won't catch Edge as it doesn't define
11169 // document.documentMode but it also doesn't support ActiveX so it won't
11170 // reach this code.
11171 if ( document.documentMode > 8 ) {
11172 return createStandardXHR();
11173 }
11174
11175 // Support: IE<9
11176 // oldIE XHR does not support non-RFC2616 methods (#13240)
11177 // See http://msdn.microsoft.com/en-us/library/ie/ms536648(v=vs.85).aspx
11178 // and http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9
11179 // Although this check for six methods instead of eight
11180 // since IE also does not support "trace" and "connect"
11181 return /^(get|post|head|put|delete|options)$/i.test( this.type ) &&
11182 createStandardXHR() || createActiveXHR();
11183 } :
11184
11185 // For all other browsers, use the standard XMLHttpRequest object
11186 createStandardXHR;
11187
11188 var xhrId = 0,
11189 xhrCallbacks = {},
11190 xhrSupported = jQuery.ajaxSettings.xhr();
11191
11192 // Support: IE<10
11193 // Open requests must be manually aborted on unload (#5280)
11194 // See https://support.microsoft.com/kb/2856746 for more info
11195 if ( window.attachEvent ) {
11196 window.attachEvent( "onunload", function() {
11197 for ( var key in xhrCallbacks ) {
11198 xhrCallbacks[ key ]( undefined, true );
11199 }
11200 } );
11201 }
11202
11203 // Determine support properties
11204 support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
11205 xhrSupported = support.ajax = !!xhrSupported;
11206
11207 // Create transport if the browser can provide an xhr
11208 if ( xhrSupported ) {
11209
11210 jQuery.ajaxTransport( function( options ) {
11211
11212 // Cross domain only allowed if supported through XMLHttpRequest
11213 if ( !options.crossDomain || support.cors ) {
11214
11215 var callback;
11216
11217 return {
11218 send: function( headers, complete ) {
11219 var i,
11220 xhr = options.xhr(),
11221 id = ++xhrId;
11222
11223 // Open the socket
11224 xhr.open(
11225 options.type,
11226 options.url,
11227 options.async,
11228 options.username,
11229 options.password
11230 );
11231
11232 // Apply custom fields if provided
11233 if ( options.xhrFields ) {
11234 for ( i in options.xhrFields ) {
11235 xhr[ i ] = options.xhrFields[ i ];
11236 }
11237 }
11238
11239 // Override mime type if needed
11240 if ( options.mimeType && xhr.overrideMimeType ) {
11241 xhr.overrideMimeType( options.mimeType );
11242 }
11243
11244 // X-Requested-With header
11245 // For cross-domain requests, seeing as conditions for a preflight are
11246 // akin to a jigsaw puzzle, we simply never set it to be sure.
11247 // (it can always be set on a per-request basis or even using ajaxSetup)
11248 // For same-domain requests, won't change header if already provided.
11249 if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
11250 headers[ "X-Requested-With" ] = "XMLHttpRequest";
11251 }
11252
11253 // Set headers
11254 for ( i in headers ) {
11255
11256 // Support: IE<9
11257 // IE's ActiveXObject throws a 'Type Mismatch' exception when setting
11258 // request header to a null-value.
11259 //
11260 // To keep consistent with other XHR implementations, cast the value
11261 // to string and ignore `undefined`.
11262 if ( headers[ i ] !== undefined ) {
11263 xhr.setRequestHeader( i, headers[ i ] + "" );
11264 }
11265 }
11266
11267 // Do send the request
11268 // This may raise an exception which is actually
11269 // handled in jQuery.ajax (so no try/catch here)
11270 xhr.send( ( options.hasContent && options.data ) || null );
11271
11272 // Listener
11273 callback = function( _, isAbort ) {
11274 var status, statusText, responses;
11275
11276 // Was never called and is aborted or complete
11277 if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
11278
11279 // Clean up
11280 delete xhrCallbacks[ id ];
11281 callback = undefined;
11282 xhr.onreadystatechange = jQuery.noop;
11283
11284 // Abort manually if needed
11285 if ( isAbort ) {
11286 if ( xhr.readyState !== 4 ) {
11287 xhr.abort();
11288 }
11289 } else {
11290 responses = {};
11291 status = xhr.status;
11292
11293 // Support: IE<10
11294 // Accessing binary-data responseText throws an exception
11295 // (#11426)
11296 if ( typeof xhr.responseText === "string" ) {
11297 responses.text = xhr.responseText;
11298 }
11299
11300 // Firefox throws an exception when accessing
11301 // statusText for faulty cross-domain requests
11302 try {
11303 statusText = xhr.statusText;
11304 } catch ( e ) {
11305
11306 // We normalize with Webkit giving an empty statusText
11307 statusText = "";
11308 }
11309
11310 // Filter status for non standard behaviors
11311
11312 // If the request is local and we have data: assume a success
11313 // (success with no data won't get notified, that's the best we
11314 // can do given current implementations)
11315 if ( !status && options.isLocal && !options.crossDomain ) {
11316 status = responses.text ? 200 : 404;
11317
11318 // IE - #1450: sometimes returns 1223 when it should be 204
11319 } else if ( status === 1223 ) {
11320 status = 204;
11321 }
11322 }
11323 }
11324
11325 // Call complete if needed
11326 if ( responses ) {
11327 complete( status, statusText, responses, xhr.getAllResponseHeaders() );
11328 }
11329 };
11330
11331 // Do send the request
11332 // `xhr.send` may raise an exception, but it will be
11333 // handled in jQuery.ajax (so no try/catch here)
11334 if ( !options.async ) {
11335
11336 // If we're in sync mode we fire the callback
11337 callback();
11338 } else if ( xhr.readyState === 4 ) {
11339
11340 // (IE6 & IE7) if it's in cache and has been
11341 // retrieved directly we need to fire the callback
11342 window.setTimeout( callback );
11343 } else {
11344
11345 // Register the callback, but delay it in case `xhr.send` throws
11346 // Add to the list of active xhr callbacks
11347 xhr.onreadystatechange = xhrCallbacks[ id ] = callback;
11348 }
11349 },
11350
11351 abort: function() {
11352 if ( callback ) {
11353 callback( undefined, true );
11354 }
11355 }
11356 };
11357 }
11358 } );
11359 }
11360
11361 // Functions to create xhrs
11362 function createStandardXHR() {
11363 try {
11364 return new window.XMLHttpRequest();
11365 } catch ( e ) {}
11366 }
11367
11368 function createActiveXHR() {
11369 try {
11370 return new window.ActiveXObject( "Microsoft.XMLHTTP" );
11371 } catch ( e ) {}
11372 }
11373
11374
11375
11376
11377 // Install script dataType
11378 jQuery.ajaxSetup( {
11379 accepts: {
11380 script: "text/javascript, application/javascript, " +
11381 "application/ecmascript, application/x-ecmascript"
11382 },
11383 contents: {
11384 script: /\b(?:java|ecma)script\b/
11385 },
11386 converters: {
11387 "text script": function( text ) {
11388 jQuery.globalEval( text );
11389 return text;
11390 }
11391 }
11392 } );
11393
11394 // Handle cache's special case and global
11395 jQuery.ajaxPrefilter( "script", function( s ) {
11396 if ( s.cache === undefined ) {
11397 s.cache = false;
11398 }
11399 if ( s.crossDomain ) {
11400 s.type = "GET";
11401 s.global = false;
11402 }
11403 } );
11404
11405 // Bind script tag hack transport
11406 jQuery.ajaxTransport( "script", function( s ) {
11407
11408 // This transport only deals with cross domain requests
11409 if ( s.crossDomain ) {
11410
11411 var script,
11412 head = document.head || jQuery( "head" )[ 0 ] || document.documentElement;
11413
11414 return {
11415
11416 send: function( _, callback ) {
11417
11418 script = document.createElement( "script" );
11419
11420 script.async = true;
11421
11422 if ( s.scriptCharset ) {
11423 script.charset = s.scriptCharset;
11424 }
11425
11426 script.src = s.url;
11427
11428 // Attach handlers for all browsers
11429 script.onload = script.onreadystatechange = function( _, isAbort ) {
11430
11431 if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
11432
11433 // Handle memory leak in IE
11434 script.onload = script.onreadystatechange = null;
11435
11436 // Remove the script
11437 if ( script.parentNode ) {
11438 script.parentNode.removeChild( script );
11439 }
11440
11441 // Dereference the script
11442 script = null;
11443
11444 // Callback if not abort
11445 if ( !isAbort ) {
11446 callback( 200, "success" );
11447 }
11448 }
11449 };
11450
11451 // Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending
11452 // Use native DOM manipulation to avoid our domManip AJAX trickery
11453 head.insertBefore( script, head.firstChild );
11454 },
11455
11456 abort: function() {
11457 if ( script ) {
11458 script.onload( undefined, true );
11459 }
11460 }
11461 };
11462 }
11463 } );
11464
11465
11466
11467
11468 var oldCallbacks = [],
11469 rjsonp = /(=)\?(?=&|$)|\?\?/;
11470
11471 // Default jsonp settings
11472 jQuery.ajaxSetup( {
11473 jsonp: "callback",
11474 jsonpCallback: function() {
11475 var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
11476 this[ callback ] = true;
11477 return callback;
11478 }
11479 } );
11480
11481 // Detect, normalize options and install callbacks for jsonp requests
11482 jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
11483
11484 var callbackName, overwritten, responseContainer,
11485 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
11486 "url" :
11487 typeof s.data === "string" &&
11488 ( s.contentType || "" )
11489 .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
11490 rjsonp.test( s.data ) && "data"
11491 );
11492
11493 // Handle iff the expected data type is "jsonp" or we have a parameter to set
11494 if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
11495
11496 // Get callback name, remembering preexisting value associated with it
11497 callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
11498 s.jsonpCallback() :
11499 s.jsonpCallback;
11500
11501 // Insert callback into url or form data
11502 if ( jsonProp ) {
11503 s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
11504 } else if ( s.jsonp !== false ) {
11505 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
11506 }
11507
11508 // Use data converter to retrieve json after script execution
11509 s.converters[ "script json" ] = function() {
11510 if ( !responseContainer ) {
11511 jQuery.error( callbackName + " was not called" );
11512 }
11513 return responseContainer[ 0 ];
11514 };
11515
11516 // force json dataType
11517 s.dataTypes[ 0 ] = "json";
11518
11519 // Install callback
11520 overwritten = window[ callbackName ];
11521 window[ callbackName ] = function() {
11522 responseContainer = arguments;
11523 };
11524
11525 // Clean-up function (fires after converters)
11526 jqXHR.always( function() {
11527
11528 // If previous value didn't exist - remove it
11529 if ( overwritten === undefined ) {
11530 jQuery( window ).removeProp( callbackName );
11531
11532 // Otherwise restore preexisting value
11533 } else {
11534 window[ callbackName ] = overwritten;
11535 }
11536
11537 // Save back as free
11538 if ( s[ callbackName ] ) {
11539
11540 // make sure that re-using the options doesn't screw things around
11541 s.jsonpCallback = originalSettings.jsonpCallback;
11542
11543 // save the callback name for future use
11544 oldCallbacks.push( callbackName );
11545 }
11546
11547 // Call if it was a function and we have a response
11548 if ( responseContainer && jQuery.isFunction( overwritten ) ) {
11549 overwritten( responseContainer[ 0 ] );
11550 }
11551
11552 responseContainer = overwritten = undefined;
11553 } );
11554
11555 // Delegate to script
11556 return "script";
11557 }
11558 } );
11559
11560
11561
11562
11563 // data: string of html
11564 // context (optional): If specified, the fragment will be created in this context,
11565 // defaults to document
11566 // keepScripts (optional): If true, will include scripts passed in the html string
11567 jQuery.parseHTML = function( data, context, keepScripts ) {
11568 if ( !data || typeof data !== "string" ) {
11569 return null;
11570 }
11571 if ( typeof context === "boolean" ) {
11572 keepScripts = context;
11573 context = false;
11574 }
11575 context = context || document;
11576
11577 var parsed = rsingleTag.exec( data ),
11578 scripts = !keepScripts && [];
11579
11580 // Single tag
11581 if ( parsed ) {
11582 return [ context.createElement( parsed[ 1 ] ) ];
11583 }
11584
11585 parsed = buildFragment( [ data ], context, scripts );
11586
11587 if ( scripts && scripts.length ) {
11588 jQuery( scripts ).remove();
11589 }
11590
11591 return jQuery.merge( [], parsed.childNodes );
11592 };
11593
11594
11595 // Keep a copy of the old load method
11596 var _load = jQuery.fn.load;
11597
11598 /**
11599 * Load a url into a page
11600 */
11601 jQuery.fn.load = function( url, params, callback ) {
11602 if ( typeof url !== "string" && _load ) {
11603 return _load.apply( this, arguments );
11604 }
11605
11606 var selector, type, response,
11607 self = this,
11608 off = url.indexOf( " " );
11609
11610 if ( off > -1 ) {
11611 selector = jQuery.trim( url.slice( off, url.length ) );
11612 url = url.slice( 0, off );
11613 }
11614
11615 // If it's a function
11616 if ( jQuery.isFunction( params ) ) {
11617
11618 // We assume that it's the callback
11619 callback = params;
11620 params = undefined;
11621
11622 // Otherwise, build a param string
11623 } else if ( params && typeof params === "object" ) {
11624 type = "POST";
11625 }
11626
11627 // If we have elements to modify, make the request
11628 if ( self.length > 0 ) {
11629 jQuery.ajax( {
11630 url: url,
11631
11632 // If "type" variable is undefined, then "GET" method will be used.
11633 // Make value of this field explicit since
11634 // user can override it through ajaxSetup method
11635 type: type || "GET",
11636 dataType: "html",
11637 data: params
11638 } ).done( function( responseText ) {
11639
11640 // Save response for use in complete callback
11641 response = arguments;
11642
11643 self.html( selector ?
11644
11645 // If a selector was specified, locate the right elements in a dummy div
11646 // Exclude scripts to avoid IE 'Permission Denied' errors
11647 jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
11648
11649 // Otherwise use the full result
11650 responseText );
11651
11652 // If the request succeeds, this function gets "data", "status", "jqXHR"
11653 // but they are ignored because response was set above.
11654 // If it fails, this function gets "jqXHR", "status", "error"
11655 } ).always( callback && function( jqXHR, status ) {
11656 self.each( function() {
11657 callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
11658 } );
11659 } );
11660 }
11661
11662 return this;
11663 };
11664
11665
11666
11667
11668 // Attach a bunch of functions for handling common AJAX events
11669 jQuery.each( [
11670 "ajaxStart",
11671 "ajaxStop",
11672 "ajaxComplete",
11673 "ajaxError",
11674 "ajaxSuccess",
11675 "ajaxSend"
11676 ], function( i, type ) {
11677 jQuery.fn[ type ] = function( fn ) {
11678 return this.on( type, fn );
11679 };
11680 } );
11681
11682
11683
11684
11685 jQuery.expr.filters.animated = function( elem ) {
11686 return jQuery.grep( jQuery.timers, function( fn ) {
11687 return elem === fn.elem;
11688 } ).length;
11689 };
11690
11691
11692
11693
11694
11695 /**
11696 * Gets a window from an element
11697 */
11698 function getWindow( elem ) {
11699 return jQuery.isWindow( elem ) ?
11700 elem :
11701 elem.nodeType === 9 ?
11702 elem.defaultView || elem.parentWindow :
11703 false;
11704 }
11705
11706 jQuery.offset = {
11707 setOffset: function( elem, options, i ) {
11708 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
11709 position = jQuery.css( elem, "position" ),
11710 curElem = jQuery( elem ),
11711 props = {};
11712
11713 // set position first, in-case top/left are set even on static elem
11714 if ( position === "static" ) {
11715 elem.style.position = "relative";
11716 }
11717
11718 curOffset = curElem.offset();
11719 curCSSTop = jQuery.css( elem, "top" );
11720 curCSSLeft = jQuery.css( elem, "left" );
11721 calculatePosition = ( position === "absolute" || position === "fixed" ) &&
11722 jQuery.inArray( "auto", [ curCSSTop, curCSSLeft ] ) > -1;
11723
11724 // need to be able to calculate position if either top or left
11725 // is auto and position is either absolute or fixed
11726 if ( calculatePosition ) {
11727 curPosition = curElem.position();
11728 curTop = curPosition.top;
11729 curLeft = curPosition.left;
11730 } else {
11731 curTop = parseFloat( curCSSTop ) || 0;
11732 curLeft = parseFloat( curCSSLeft ) || 0;
11733 }
11734
11735 if ( jQuery.isFunction( options ) ) {
11736
11737 // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
11738 options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
11739 }
11740
11741 if ( options.top != null ) {
11742 props.top = ( options.top - curOffset.top ) + curTop;
11743 }
11744 if ( options.left != null ) {
11745 props.left = ( options.left - curOffset.left ) + curLeft;
11746 }
11747
11748 if ( "using" in options ) {
11749 options.using.call( elem, props );
11750 } else {
11751 curElem.css( props );
11752 }
11753 }
11754 };
11755
11756 jQuery.fn.extend( {
11757 offset: function( options ) {
11758 if ( arguments.length ) {
11759 return options === undefined ?
11760 this :
11761 this.each( function( i ) {
11762 jQuery.offset.setOffset( this, options, i );
11763 } );
11764 }
11765
11766 var docElem, win,
11767 box = { top: 0, left: 0 },
11768 elem = this[ 0 ],
11769 doc = elem && elem.ownerDocument;
11770
11771 if ( !doc ) {
11772 return;
11773 }
11774
11775 docElem = doc.documentElement;
11776
11777 // Make sure it's not a disconnected DOM node
11778 if ( !jQuery.contains( docElem, elem ) ) {
11779 return box;
11780 }
11781
11782 // If we don't have gBCR, just use 0,0 rather than error
11783 // BlackBerry 5, iOS 3 (original iPhone)
11784 if ( typeof elem.getBoundingClientRect !== "undefined" ) {
11785 box = elem.getBoundingClientRect();
11786 }
11787 win = getWindow( doc );
11788 return {
11789 top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ),
11790 left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 )
11791 };
11792 },
11793
11794 position: function() {
11795 if ( !this[ 0 ] ) {
11796 return;
11797 }
11798
11799 var offsetParent, offset,
11800 parentOffset = { top: 0, left: 0 },
11801 elem = this[ 0 ];
11802
11803 // Fixed elements are offset from window (parentOffset = {top:0, left: 0},
11804 // because it is its only offset parent
11805 if ( jQuery.css( elem, "position" ) === "fixed" ) {
11806
11807 // we assume that getBoundingClientRect is available when computed position is fixed
11808 offset = elem.getBoundingClientRect();
11809 } else {
11810
11811 // Get *real* offsetParent
11812 offsetParent = this.offsetParent();
11813
11814 // Get correct offsets
11815 offset = this.offset();
11816 if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
11817 parentOffset = offsetParent.offset();
11818 }
11819
11820 // Add offsetParent borders
11821 parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
11822 parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
11823 }
11824
11825 // Subtract parent offsets and element margins
11826 // note: when an element has margin: auto the offsetLeft and marginLeft
11827 // are the same in Safari causing offset.left to incorrectly be 0
11828 return {
11829 top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
11830 left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
11831 };
11832 },
11833
11834 offsetParent: function() {
11835 return this.map( function() {
11836 var offsetParent = this.offsetParent;
11837
11838 while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) &&
11839 jQuery.css( offsetParent, "position" ) === "static" ) ) {
11840 offsetParent = offsetParent.offsetParent;
11841 }
11842 return offsetParent || documentElement;
11843 } );
11844 }
11845 } );
11846
11847 // Create scrollLeft and scrollTop methods
11848 jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
11849 var top = /Y/.test( prop );
11850
11851 jQuery.fn[ method ] = function( val ) {
11852 return access( this, function( elem, method, val ) {
11853 var win = getWindow( elem );
11854
11855 if ( val === undefined ) {
11856 return win ? ( prop in win ) ? win[ prop ] :
11857 win.document.documentElement[ method ] :
11858 elem[ method ];
11859 }
11860
11861 if ( win ) {
11862 win.scrollTo(
11863 !top ? val : jQuery( win ).scrollLeft(),
11864 top ? val : jQuery( win ).scrollTop()
11865 );
11866
11867 } else {
11868 elem[ method ] = val;
11869 }
11870 }, method, val, arguments.length, null );
11871 };
11872 } );
11873
11874 // Support: Safari<7-8+, Chrome<37-44+
11875 // Add the top/left cssHooks using jQuery.fn.position
11876 // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
11877 // getComputedStyle returns percent when specified for top/left/bottom/right
11878 // rather than make the css module depend on the offset module, we just check for it here
11879 jQuery.each( [ "top", "left" ], function( i, prop ) {
11880 jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
11881 function( elem, computed ) {
11882 if ( computed ) {
11883 computed = curCSS( elem, prop );
11884
11885 // if curCSS returns percentage, fallback to offset
11886 return rnumnonpx.test( computed ) ?
11887 jQuery( elem ).position()[ prop ] + "px" :
11888 computed;
11889 }
11890 }
11891 );
11892 } );
11893
11894
11895 // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
11896 jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
11897 jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
11898 function( defaultExtra, funcName ) {
11899
11900 // margin is only for outerHeight, outerWidth
11901 jQuery.fn[ funcName ] = function( margin, value ) {
11902 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
11903 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
11904
11905 return access( this, function( elem, type, value ) {
11906 var doc;
11907
11908 if ( jQuery.isWindow( elem ) ) {
11909
11910 // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
11911 // isn't a whole lot we can do. See pull request at this URL for discussion:
11912 // https://github.com/jquery/jquery/pull/764
11913 return elem.document.documentElement[ "client" + name ];
11914 }
11915
11916 // Get document width or height
11917 if ( elem.nodeType === 9 ) {
11918 doc = elem.documentElement;
11919
11920 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
11921 // whichever is greatest
11922 // unfortunately, this causes bug #3838 in IE6/8 only,
11923 // but there is currently no good, small way to fix it.
11924 return Math.max(
11925 elem.body[ "scroll" + name ], doc[ "scroll" + name ],
11926 elem.body[ "offset" + name ], doc[ "offset" + name ],
11927 doc[ "client" + name ]
11928 );
11929 }
11930
11931 return value === undefined ?
11932
11933 // Get width or height on the element, requesting but not forcing parseFloat
11934 jQuery.css( elem, type, extra ) :
11935
11936 // Set width or height on the element
11937 jQuery.style( elem, type, value, extra );
11938 }, type, chainable ? margin : undefined, chainable, null );
11939 };
11940 } );
11941 } );
11942
11943
11944 jQuery.fn.extend( {
11945
11946 bind: function( types, data, fn ) {
11947 return this.on( types, null, data, fn );
11948 },
11949 unbind: function( types, fn ) {
11950 return this.off( types, null, fn );
11951 },
11952
11953 delegate: function( selector, types, data, fn ) {
11954 return this.on( types, selector, data, fn );
11955 },
11956 undelegate: function( selector, types, fn ) {
11957
11958 // ( namespace ) or ( selector, types [, fn] )
11959 return arguments.length === 1 ?
11960 this.off( selector, "**" ) :
11961 this.off( types, selector || "**", fn );
11962 }
11963 } );
11964
11965 // The number of elements contained in the matched element set
11966 jQuery.fn.size = function() {
11967 return this.length;
11968 };
11969
11970 jQuery.fn.andSelf = jQuery.fn.addBack;
11971
11972
11973
11974
11975 // Register as a named AMD module, since jQuery can be concatenated with other
11976 // files that may use define, but not via a proper concatenation script that
11977 // understands anonymous AMD modules. A named AMD is safest and most robust
11978 // way to register. Lowercase jquery is used because AMD module names are
11979 // derived from file names, and jQuery is normally delivered in a lowercase
11980 // file name. Do this after creating the global so that if an AMD module wants
11981 // to call noConflict to hide this version of jQuery, it will work.
11982
11983 // Note that for maximum portability, libraries that are not jQuery should
11984 // declare themselves as anonymous modules, and avoid setting a global if an
11985 // AMD loader is present. jQuery is a special case. For more information, see
11986 // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
11987
11988 if ( true ) {
11989 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function() {
11990 return jQuery;
11991 }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
11992 }
11993
11994
11995
11996 var
11997
11998 // Map over jQuery in case of overwrite
11999 _jQuery = window.jQuery,
12000
12001 // Map over the $ in case of overwrite
12002 _$ = window.$;
12003
12004 jQuery.noConflict = function( deep ) {
12005 if ( window.$ === jQuery ) {
12006 window.$ = _$;
12007 }
12008
12009 if ( deep && window.jQuery === jQuery ) {
12010 window.jQuery = _jQuery;
12011 }
12012
12013 return jQuery;
12014 };
12015
12016 // Expose jQuery and $ identifiers, even in
12017 // AMD (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
12018 // and CommonJS for browser emulators (#13566)
12019 if ( !noGlobal ) {
12020 window.jQuery = window.$ = jQuery;
12021 }
12022
12023 return jQuery;
12024 }));
12025
12026
12027/***/ }),
12028/* 4 */
12029/***/ (function(module, exports, __webpack_require__) {
12030
12031 "use strict";
12032
12033 Object.defineProperty(exports, "__esModule", {
12034 value: true
12035 });
12036
12037 var _Promise = typeof Promise === 'undefined' ? __webpack_require__(!(function webpackMissingModule() { var e = new Error("Cannot find module \"es6-promise\""); e.code = 'MODULE_NOT_FOUND'; throw e; }())).Promise : Promise;
12038
12039 var Storage = {
12040 get: function get() {
12041 var _arguments = arguments;
12042
12043 return new _Promise(function (resolve) {
12044 var items = [].concat(Array.prototype.slice.call(_arguments));
12045
12046 if (items.length == 1) {
12047 resolve(GM_getValue(items[0]));
12048 } else {
12049 var data = {};
12050
12051 items.forEach(function (item) {
12052 data[item] = GM_getValue(item);
12053 });
12054
12055 resolve(data);
12056 }
12057 });
12058 },
12059 set: function set(key, value) {
12060 GM_setValue(key, value);
12061 }
12062 };
12063
12064 exports.default = Storage;
12065
12066/***/ }),
12067/* 5 */
12068/***/ (function(module, exports) {
12069
12070 'use strict';
12071
12072 Object.defineProperty(exports, "__esModule", {
12073 value: true
12074 });
12075 exports.inject = inject;
12076 exports.restoreWindowOpen = restoreWindowOpen;
12077 /**
12078 * injects a code to the page context that does the following:
12079 * replace the window.open function with a function that checks if the window.open was executed due to an event.
12080 * if so, then it checks who triggered the event. if it's the document or the body elements, the call is blocked.
12081 * another protection, is closing windows that got blured by calling window.blur(), less then a second from its creation.
12082 * check out the footer for another way websites try to open a new window.
12083 * @return nothing
12084 */
12085 function inject() {
12086 var originalOpenWndFnKey = "originalOpenFunction";
12087 var originalWindowOpenFn = window.open;
12088 var originalCreateElementFn = document.createElement;
12089 var originalAppendChildFn = HTMLElement.prototype.appendChild;
12090 var originalCreateEventFn = document.createEvent;
12091 var windowsWithNames = {};
12092 var timeSinceCreateAElement = 0;
12093 var lastCreatedAElement = null;
12094 var fullScreenOpenTime = void 0;
12095 var winWidth = window.innerWidth;
12096 var winHeight = window.innerHeight;
12097 var abd = false;
12098 var lastBlockTime = void 0;
12099 var parentOrigin = window.location != window.parent.location ? document.referrer || window.parent.location || '*' : document.location;
12100 var parentRef = window.parent;
12101
12102 //window[originalOpenWndFnKey] = window.open; // save the original open window as global param
12103 function getAbsoluteURL(baseURL) {
12104 if (/^about:blank/i.test(baseURL)) {
12105 return baseURL;
12106 }
12107
12108 if (/^(https?:)?\/\//.test(baseURL)) {
12109 return baseURL;
12110 }
12111
12112 baseURL = location.origin + (!/^\//.test(baseURL) ? '/' : '') + baseURL;
12113
12114 return baseURL;
12115 }
12116
12117 function newWindowOpenFn() {
12118 var openWndArguments = arguments;
12119 var useOriginalOpenWnd = true;
12120 var generatedWindow = null;
12121
12122 function getWindowName(openWndArguments) {
12123 var windowName = openWndArguments[1];
12124 if (windowName != null && !["_blank", "_parent", "_self", "_top"].includes(windowName)) {
12125 return windowName;
12126 }
12127
12128 return null;
12129 }
12130
12131 function copyMissingProperties(src, dest) {
12132 var prop = void 0;
12133 for (prop in src) {
12134 try {
12135 if (dest[prop] === undefined && src[prop]) {
12136 dest[prop] = src[prop];
12137 }
12138 } catch (e) {}
12139 }
12140 return dest;
12141 }
12142
12143 function isParentWindow() {
12144 try {
12145 return !!(parent.Window && capturingElement instanceof parent.Window);
12146 } catch (e) {
12147 return false;
12148 }
12149 }
12150
12151 function isOverlayish(el) {
12152 var style = el && el.style;
12153
12154 if (style && /fixed|absolute/.test(style.position) && el.offsetWidth >= winWidth * 0.6 && el.offsetHeight >= winHeight * 0.75) {
12155 return true;
12156 }
12157
12158 return false;
12159 }
12160
12161 var capturingElement = null; // the element who registered to the event
12162 var srcElement = null; // the clicked on element
12163 var closestParentLink = null;
12164
12165 if (window.event != null) {
12166 capturingElement = window.event.currentTarget;
12167 srcElement = window.event.srcElement;
12168 }
12169
12170 if (srcElement != null && srcElement instanceof HTMLElement) {
12171 closestParentLink = srcElement.closest('a');
12172
12173 if (closestParentLink && closestParentLink.href) {
12174 openWndArguments[3] = closestParentLink.href;
12175 }
12176 }
12177
12178 //callee will not work in ES6 or stict mode
12179 try {
12180 if (capturingElement == null) {
12181 var caller = openWndArguments.callee;
12182 while (caller.arguments != null && caller.arguments.callee.caller != null) {
12183 caller = caller.arguments.callee.caller;
12184 }
12185 if (caller.arguments != null && caller.arguments.length > 0 && caller.arguments[0].currentTarget != null) {
12186 capturingElement = caller.arguments[0].currentTarget;
12187 }
12188 }
12189 } catch (e) {}
12190
12191 /////////////////////////////////////////////////////////////////////////////////
12192 // Blocked if a click on background element occurred (<body> or document)
12193 /////////////////////////////////////////////////////////////////////////////////
12194 if (capturingElement == null) {
12195 window.pbreason = 'Blocked a new window opened without any user interaction';
12196 useOriginalOpenWnd = false;
12197 } else if (capturingElement != null && (capturingElement instanceof Window || isParentWindow(capturingElement) || capturingElement === document || capturingElement.URL != null && capturingElement.body != null || capturingElement.nodeName != null && (capturingElement.nodeName.toLowerCase() == "body" || capturingElement.nodeName.toLowerCase() == "document"))) {
12198 window.pbreason = 'Blocked a new window opened with URL: ' + openWndArguments[0] + ' because it was triggered by the ' + capturingElement.nodeName + ' element';
12199 useOriginalOpenWnd = false;
12200 } else if (isOverlayish(capturingElement)) {
12201 window.pbreason = 'Blocked a new window opened when clicking on an element that seems to be an overlay';
12202 useOriginalOpenWnd = false;
12203 } else {
12204 useOriginalOpenWnd = true;
12205 }
12206 /////////////////////////////////////////////////////////////////////////////////
12207
12208
12209 /////////////////////////////////////////////////////////////////////////////////
12210 // Block if a full screen was just initiated while opening this url.
12211 /////////////////////////////////////////////////////////////////////////////////
12212
12213 var fullScreenElement = document.webkitFullscreenElement || document.mozFullscreenElement || document.fullscreenElement;
12214 if (new Date().getTime() - fullScreenOpenTime < 1000 || isNaN(fullScreenOpenTime) && isDocumentInFullScreenMode()) {
12215
12216 window.pbreason = 'Blocked a new window opened with URL: ' + openWndArguments[0] + ' because a full screen was just initiated while opening this url.';
12217
12218 /* JRA REMOVED
12219 if (window[script_params.fullScreenFnKey]) {
12220 window.clearTimeout(window[script_params.fullScreenFnKey]);
12221 }
12222 */
12223
12224 if (document.exitFullscreen) {
12225 document.exitFullscreen();
12226 } else if (document.mozCancelFullScreen) {
12227 document.mozCancelFullScreen();
12228 } else if (document.webkitCancelFullScreen) {
12229 document.webkitCancelFullScreen();
12230 }
12231
12232 useOriginalOpenWnd = false;
12233 }
12234 /////////////////////////////////////////////////////////////////////////////////
12235 var openUrl = openWndArguments[0];
12236 var inWhitelist = isInWhitelist(openUrl);
12237
12238 if (inWhitelist) {
12239 useOriginalOpenWnd = true;
12240 } else if (isInBlacklist(openUrl)) {
12241 useOriginalOpenWnd = false;
12242 }
12243
12244 if (useOriginalOpenWnd == true) {
12245 generatedWindow = originalWindowOpenFn.apply(this, openWndArguments);
12246 // save the window by name, for latter use.
12247 var windowName = getWindowName(openWndArguments);
12248 if (windowName != null) {
12249 windowsWithNames[windowName] = generatedWindow;
12250 }
12251
12252 // 2nd line of defence: allow window to open but monitor carefully...
12253
12254 /////////////////////////////////////////////////////////////////////////////////
12255 // Kill window if a blur (remove focus) is called to that window
12256 /////////////////////////////////////////////////////////////////////////////////
12257 if (generatedWindow !== window) {
12258 var openTime = new Date().getTime();
12259 var originalWndBlurFn = generatedWindow.blur;
12260 generatedWindow.blur = function () {
12261 if (new Date().getTime() - openTime < 1000 && !inWhitelist /* one second */) {
12262 window.pbreason = 'Blocked a new window opened with URL: ' + openWndArguments[0] + ' because a it was blured';
12263 generatedWindow.close();
12264 blockedWndNotification(openWndArguments);
12265 } else {
12266 originalWndBlurFn();
12267 }
12268 };
12269 }
12270 /////////////////////////////////////////////////////////////////////////////////
12271 } else {
12272 // (useOriginalOpenWnd == false)
12273 var _location = {
12274 href: openWndArguments[0]
12275 };
12276 _location.replace = function (url) {
12277 _location.href = url;
12278 };
12279
12280 generatedWindow = {
12281 close: function close() {
12282 return true;
12283 },
12284 test: function test() {
12285 return true;
12286 },
12287 blur: function blur() {
12288 return true;
12289 },
12290 focus: function focus() {
12291 return true;
12292 },
12293 showModelessDialog: function showModelessDialog() {
12294 return true;
12295 },
12296 showModalDialog: function showModalDialog() {
12297 return true;
12298 },
12299 prompt: function prompt() {
12300 return true;
12301 },
12302 confirm: function confirm() {
12303 return true;
12304 },
12305 alert: function alert() {
12306 return true;
12307 },
12308 moveTo: function moveTo() {
12309 return true;
12310 },
12311 moveBy: function moveBy() {
12312 return true;
12313 },
12314 resizeTo: function resizeTo() {
12315 return true;
12316 },
12317 resizeBy: function resizeBy() {
12318 return true;
12319 },
12320 scrollBy: function scrollBy() {
12321 return true;
12322 },
12323 scrollTo: function scrollTo() {
12324 return true;
12325 },
12326 getSelection: function getSelection() {
12327 return true;
12328 },
12329 onunload: function onunload() {
12330 return true;
12331 },
12332 print: function print() {
12333 return true;
12334 },
12335 open: function open() {
12336 return this;
12337 },
12338
12339 opener: window,
12340 closed: false,
12341 innerHeight: 480,
12342 innerWidth: 640,
12343 name: openWndArguments[1],
12344 location: _location,
12345 document: { location: _location }
12346 };
12347
12348 copyMissingProperties(window, generatedWindow);
12349
12350 generatedWindow.window = generatedWindow;
12351
12352 var _windowName = getWindowName(openWndArguments);
12353 if (_windowName != null) {
12354 try {
12355 // originalWindowOpenFn("", windowName).close();
12356 windowsWithNames[_windowName].close();
12357 } catch (err) {}
12358 }
12359
12360 var fnGetUrl = function fnGetUrl() {
12361 var url = void 0;
12362 if (!(generatedWindow.location instanceof Object)) {
12363 url = generatedWindow.location;
12364 } else if (!(generatedWindow.document.location instanceof Object)) {
12365 url = generatedWindow.document.location;
12366 } else if (_location.href != null) {
12367 url = _location.href;
12368 } else {
12369 url = openWndArguments[0];
12370 }
12371 openWndArguments[0] = url;
12372
12373 blockedWndNotification(openWndArguments);
12374 };
12375
12376 //why set timeout? if anyone finds a reason for it, please write it here
12377 //in iframes it makes problems so i'm avoiding it there
12378 if (top == self) {
12379 setTimeout(fnGetUrl, 100);
12380 } else {
12381 fnGetUrl();
12382 }
12383 }
12384
12385 return generatedWindow;
12386 }
12387
12388 function pbWindowOpen() {
12389 try {
12390 return newWindowOpenFn.apply(this, arguments);
12391 } catch (err) {
12392 return null;
12393 }
12394 }
12395
12396 /////////////////////////////////////////////////////////////////////////////////
12397 // Replace the window open method with Poper Blocker's
12398 /////////////////////////////////////////////////////////////////////////////////
12399 window.open = pbWindowOpen;
12400 /////////////////////////////////////////////////////////////////////////////////
12401
12402
12403 //////////////////////////////////////////////////////////////////////////////////////////////////////////
12404 // Monitor dynamic html element creation to prevent generating <a> elements with click dispatching event
12405 //////////////////////////////////////////////////////////////////////////////////////////////////////////
12406 HTMLElement.prototype.appendChild = function () {
12407 var newElement = originalAppendChildFn.apply(this, arguments);
12408
12409 if (newElement.nodeName == 'IFRAME' && newElement.contentWindow) {
12410 try {
12411 var code = '(function () {\n var pb_blacklist = ' + JSON.stringify(pb_blacklist) + ';\n var pb_whitelist = ' + JSON.stringify(pb_whitelist) + ';\n ' + inject.toString() + ';\n inject();\n })();';
12412
12413 var s = document.createElement('script');s.text = code;
12414
12415 newElement.contentWindow.document.body.appendChild(s);
12416 } catch (e) {}
12417 }
12418
12419 return newElement;
12420 };
12421
12422 document.createElement = function () {
12423
12424 var newElement = originalCreateElementFn.apply(document, arguments);
12425
12426 if (arguments[0] == "a" || arguments[0] == "A") {
12427
12428 timeSinceCreateAElement = new Date().getTime();
12429
12430 var originalDispatchEventFn = newElement.dispatchEvent;
12431
12432 newElement.dispatchEvent = function (event) {
12433 if (event.type != null && ('' + event.type).toLocaleLowerCase() == "click") {
12434 if (!isInWhitelist(newElement.href)) {
12435 window.pbreason = "blocked due to an explicit dispatchEvent event with type 'click' on an 'a' tag";
12436
12437 blockedWndNotification({ "0": newElement.href });
12438
12439 return true;
12440 }
12441 }
12442
12443 return originalDispatchEventFn.call(this, event);
12444 };
12445
12446 lastCreatedAElement = newElement;
12447 }
12448
12449 return newElement;
12450 };
12451 /////////////////////////////////////////////////////////////////////////////////
12452
12453
12454 /////////////////////////////////////////////////////////////////////////////////
12455 // Block artificial mouse click on frashly created <a> elements
12456 /////////////////////////////////////////////////////////////////////////////////
12457 document.createEvent = function () {
12458 try {
12459 if (arguments[0].toLowerCase().includes("mouse") && new Date().getTime() - timeSinceCreateAElement <= 50) {
12460 var openUrlDomain = void 0,
12461 topUrl = void 0,
12462 topDomain = void 0;
12463
12464 try {
12465 openUrlDomain = new URL(lastCreatedAElement.href).hostname;
12466 } catch (e) {}
12467
12468 try {
12469 topUrl = window.location != window.parent.location ? document.referrer : document.location.href;
12470 } catch (e) {}
12471
12472 try {
12473 topDomain = new URL(topUrl).hostname;
12474 } catch (e) {}
12475
12476 //block if the origin is not same
12477 var isSelfDomain = openUrlDomain == topDomain;
12478
12479 if (lastCreatedAElement.href.trim() && !isInWhitelist(lastCreatedAElement.href) && !isSelfDomain) {
12480 //this makes too much false positive so we do not display the toast message
12481 window.pbreason = 'Blocked because \'a\' element was recently created and ' + arguments[0] + ' event was created shortly after';
12482 arguments[0] = lastCreatedAElement.href;
12483
12484 blockedWndNotification({ "0": lastCreatedAElement.href });
12485
12486 return {
12487 type: 'click',
12488 initMouseEvent: function initMouseEvent() {}
12489 };
12490 }
12491 }
12492
12493 return originalCreateEventFn.apply(document, arguments);
12494 } catch (err) {}
12495 };
12496 /////////////////////////////////////////////////////////////////////////////////
12497
12498
12499 /////////////////////////////////////////////////////////////////////////////////
12500 // Monitor full screen requests
12501 /////////////////////////////////////////////////////////////////////////////////
12502 function onFullScreen(isInFullScreenMode) {
12503 if (isInFullScreenMode) {
12504 fullScreenOpenTime = new Date().getTime();
12505 } else {
12506 fullScreenOpenTime = NaN;
12507 }
12508 }
12509
12510 /////////////////////////////////////////////////////////////////////////////////
12511
12512 function isDocumentInFullScreenMode() {
12513 // Note that the browser fullscreen (triggered by short keys) might
12514 // be considered different from content fullscreen when expecting a boolean
12515 return document.fullScreenElement && document.fullScreenElement !== null || // alternative standard methods
12516 document.mozFullscreenElement != null || document.webkitFullscreenElement != null; // current working methods
12517 }
12518
12519 function isInWhitelist(url) {
12520 return isInList(url, pb_whitelist);
12521 }
12522
12523 function isInBlacklist(url) {
12524 return isInList(url, pb_blacklist);
12525 }
12526
12527 function isInList(url, list) {
12528 if (list) {
12529 return list.some(function (li) {
12530 return new RegExp("https?://(www\.|.*\.)?" + li + "+").test(url);
12531 });
12532 } else {
12533 return false;
12534 }
12535 }
12536
12537 function blockedWndNotification(openWndArguments) {
12538 //this is to prevent a site that "stuck" on trying to open a new window to send endless calls to the extension
12539 if (!lastBlockTime || lastBlockTime < Date.now() - 1000) {
12540 openWndArguments["0"] = getAbsoluteURL(openWndArguments["0"]);
12541 openWndArguments["abd"] = abd;
12542
12543 parentRef.postMessage({ type: "blockedWindow", args: JSON.stringify(openWndArguments) }, parentOrigin);
12544 }
12545
12546 lastBlockTime = Date.now();
12547 }
12548
12549 //detect adblock to adjust popup blocking behavior to not collide with adblock
12550 function detectAdblock() {
12551 try {
12552 var tester = document.createElement('div');
12553 tester.innerHTML = ' ';
12554 tester.className = 'adsbox';
12555 tester.style.cssText = "position:absolute;top-1000px;left:-1000px;";
12556
12557 document.body.appendChild(tester);
12558
12559 window.setTimeout(function () {
12560 if (tester.offsetHeight === 0) {
12561 abd = true;
12562 }
12563
12564 tester.remove();
12565 }, 100);
12566 } catch (e) {}
12567 }
12568
12569 function executeCommand(commandId, messageId) {
12570 if (messageId == pb_message) {
12571 switch (commandId) {
12572 case 0:
12573 //off
12574 window.open = originalWindowOpenFn;
12575 document.createElement = originalCreateElementFn;
12576 document.createEvent = originalCreateEventFn;
12577 HTMLElement.prototype.appendChild = originalAppendChildFn;
12578 break;
12579
12580 case 1:
12581 //allow once
12582 break;
12583 }
12584 }
12585 }
12586
12587 document.addEventListener("fullscreenchange", function () {
12588 onFullScreen(document.fullscreen);
12589 }, false);
12590
12591 document.addEventListener("mozfullscreenchange", function () {
12592 onFullScreen(document.mozFullScreen);
12593 }, false);
12594
12595 document.addEventListener("webkitfullscreenchange", function () {
12596 onFullScreen(document.webkitIsFullScreen);
12597 }, false);
12598
12599 //document.addEventListener('DOMContentLoaded', () =>{
12600 detectAdblock();
12601 //}, false);
12602
12603 (function () {
12604 window.pbExternalCommand = function (commandId, messageId) {
12605 executeCommand(commandId, messageId);
12606 };
12607 })();
12608 }
12609
12610 function restoreWindowOpen() {
12611 window.open = window["originalOpenFunction"];
12612 }
12613
12614 /*
12615 (*) a jquery plugin (https://github.com/hpbuniat/jquery-popunder/blob/master/src/jquery.popunder.js) | $.popunder.helper.open
12616
12617 (*) another jquery plugin (https://github.com/tuki/js-popunder/)
12618
12619 The full-screen trick
12620 ---------------------
12621
12622 (*) another way sites try to open new windows, is to put a link inside the page and generate a click on it.
12623 the link opens a new tab with a name, and then they try to call window.open with that name a change the tab's url.
12624 for example:
12625
12626 var a = document.createElement("a");
12627 var e = document.createEvent("MouseEvents");
12628 var rand = Math.random();
12629 a.target = "_tab" + rand.toString();
12630 a.href = "about:blank";
12631 document.body.appendChild(a);
12632 e.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, true, false, false, true, 0, null);
12633 a.dispatchEvent(e);
12634 window.open("about:blank", "_tab" + rand.toString()).close();
12635
12636 (*) They open full screen mode -> open a popup window -> exit full screen mode, thus it goes beneath the window
12637
12638 The create element & event trick
12639 --------------------------------
12640
12641 (*) The website will create an <a> element and also a MouseEvents event, that will auto click on it.
12642 This will make a window to open and without the window.open
12643
12644 (*) http://torrents.to/
12645
12646 Pop-under test websites:
12647 --------------------------------
12648
12649 http://www.ad4game.com/popunder/
12650 http://test.gluk.name/test2/pop3/?#
12651 http://cpmnetwork.adbooth.com/en/popunder
12652 http://www.vcmuk.com/poptest.html
12653 http://affplaybook.com/poptest/exit1/test.html
12654
12655 Not blocked by AdBlock:
12656
12657 http://demo.dynamicoxygen.com/Pop-Under
12658 http://mirodex.blogspot.co.il/2013/10/working-popunder-script-on-chrome.html
12659 http://www.advertserve.com/examples/popups.html
12660 http://www.htmlgoodies.com/beyond/javascript/article.php/3471241
12661 */
12662
12663/***/ }),
12664/* 6 */
12665/***/ (function(module, exports, __webpack_require__) {
12666
12667 'use strict';
12668
12669 Object.defineProperty(exports, "__esModule", {
12670 value: true
12671 });
12672
12673 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
12674
12675 var _storage = __webpack_require__(4);
12676
12677 var _storage2 = _interopRequireDefault(_storage);
12678
12679 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12680
12681 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
12682
12683 var _Promise = typeof Promise === 'undefined' ? __webpack_require__(!(function webpackMissingModule() { var e = new Error("Cannot find module \"es6-promise\""); e.code = 'MODULE_NOT_FOUND'; throw e; }())).Promise : Promise;
12684
12685 var NtfShowManager = function () {
12686 function NtfShowManager() {
12687 _classCallCheck(this, NtfShowManager);
12688
12689 this.isActive = { pop: true, overlay: true, tip: true };
12690 }
12691
12692 _createClass(NtfShowManager, [{
12693 key: 'isShow',
12694 value: function isShow() {
12695 var _this = this;
12696
12697 var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
12698 var domain = props.domain,
12699 _props$type = props.type,
12700 type = _props$type === undefined ? 'pop' : _props$type;
12701
12702 return new _Promise(function (resolve) {
12703 _storage2.default.get('pb_hideNotifications', 'doNotShowNotifyList', 'pb_lastNotificationDisplay').then(function (settings) {
12704 var isGlobalHidden = settings.pb_hideNotifications || false;
12705 var hiddenSitesList = settings.doNotShowNotifyList || [];
12706 var lastDisplay = settings.pb_lastNotificationDisplay || {};
12707
12708 if (_this.isActive[type] && _this.checkLastDisplay({ domain: domain, type: type, lastDisplay: lastDisplay }) && !isGlobalHidden && !_this.checkIsHidden({ hiddenSitesList: hiddenSitesList, domain: domain })) {
12709 _this.isActive[type] = false;
12710
12711 _this.updateLastDisplay({ domain: domain, type: type });
12712 resolve();
12713 }
12714 });
12715 });
12716 }
12717
12718 //check if user added this site to don't show again for 30 days
12719
12720 }, {
12721 key: 'checkIsHidden',
12722 value: function checkIsHidden(_ref) {
12723 var hiddenSitesList = _ref.hiddenSitesList,
12724 domain = _ref.domain;
12725
12726 var item = hiddenSitesList.find(function (item) {
12727 return item.domain == domain;
12728 });
12729
12730 if (item && item.time) {
12731 var time = new Date(item.time);
12732 var time30days = new Date(time.setDate(time.getDate() + 30));
12733 var now = new Date();
12734
12735 if (now <= time30days) {
12736 return true;
12737 }
12738 }
12739
12740 return false;
12741 }
12742
12743 //overlay notification needs to be shown only once in 24 hours
12744 //overlay tip notification needs to be shown once a month
12745
12746 }, {
12747 key: 'checkLastDisplay',
12748 value: function checkLastDisplay(_ref2) {
12749 var domain = _ref2.domain,
12750 type = _ref2.type,
12751 lastDisplay = _ref2.lastDisplay;
12752
12753 var now = new Date().getTime();
12754 var last = lastDisplay[type];
12755
12756 if (!last) {
12757 return true;
12758 }
12759
12760 switch (type) {
12761 case 'overlay':
12762 last = last[domain];
12763
12764 if (last && last + 1000 * 60 * 60 * 24 > now) {
12765 return false;
12766 }
12767 break;
12768
12769 case 'tip':
12770 if (last + 1000 * 60 * 60 * 24 * 30 > now) {
12771 return false;
12772 }
12773 break;
12774 }
12775
12776 return true;
12777 }
12778 }, {
12779 key: 'updateLastDisplay',
12780 value: function updateLastDisplay(_ref3) {
12781 var domain = _ref3.domain,
12782 type = _ref3.type;
12783
12784 _storage2.default.get('pb_lastNotificationDisplay').then(function () {
12785 var display = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
12786
12787 switch (type) {
12788 case 'overlay':
12789 display[type] = display[type] || {};
12790 display[type][domain] = new Date().getTime();
12791 break;
12792
12793 default:
12794 display[type] = new Date().getTime();
12795 break;
12796 }
12797
12798 _storage2.default.set('pb_lastNotificationDisplay', display);
12799 });
12800 }
12801 }, {
12802 key: 'updateDontShow',
12803 value: function updateDontShow(_ref4) {
12804 var domain = _ref4.domain;
12805
12806 PBStorageSync.doNotShowNotifyList.update(function (doNotShowList) {
12807 doNotShowList = doNotShowList.filter(function (item) {
12808 return item.domain != domain;
12809 });
12810 doNotShowList.push({
12811 domain: domain,
12812 time: new Date().getTime()
12813 });
12814
12815 return doNotShowList;
12816 });
12817 }
12818 }]);
12819
12820 return NtfShowManager;
12821 }();
12822
12823 exports.default = NtfShowManager;
12824
12825/***/ }),
12826/* 7 */
12827/***/ (function(module, exports, __webpack_require__) {
12828
12829 'use strict';
12830
12831 Object.defineProperty(exports, "__esModule", {
12832 value: true
12833 });
12834
12835 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
12836
12837 var _jQuery = __webpack_require__(3);
12838
12839 var _jQuery2 = _interopRequireDefault(_jQuery);
12840
12841 var _storage = __webpack_require__(4);
12842
12843 var _storage2 = _interopRequireDefault(_storage);
12844
12845 var _utils = __webpack_require__(8);
12846
12847 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12848
12849 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
12850
12851 var Notification = function () {
12852 function Notification() {
12853 var _this = this;
12854
12855 var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
12856
12857 _classCallCheck(this, Notification);
12858
12859 this.queue = [];
12860 this.props = props;
12861 this.notificationHTML = "<html>\r\n <head>\r\n <style type=\"text/css\">\r\n * {\r\n box-sizing: border-box;\r\n font-family: \"Arial\", \"sans-serif\";\r\n }\r\n\r\n html, body {\r\n margin: 0px;\r\n padding: 0px;\r\n overflow: hidden; \r\n color: #000;\r\n }\r\n\r\n .hidden {\r\n display: none !important;\r\n }\r\n\r\n .message {\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n width: 100%;\r\n height: 100%;\r\n background: #f2f2f2;\r\n }\r\n\r\n /* icon */\r\n .message-icon {\r\n height: 16px;\r\n min-width: 15px;\r\n background: url(\'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAQCAYAAAG+URWSAAAAAXNSR0IArs4c6QAAAblJREFUKBV9UzFLw1AQzr3WJungULCLTqKL7ehSdHXWTZxEVHRQQXBw8i8IIkpRF8HBTVedHPQXtCoILu6CBU0izXt+99KLEUMfJHf3vu/u3X0vcRyslue9KXYcY0asta/Hcnmu5bqGOGqXy7Mmjq+oUJizG4z8cnte23XH2E1SXPcKlFkE17Y8B5KiQN2QIE1h58n3G8aYJW3MKsf1KKKXSmUw6RAbmqgKQpVBXtza9+fnOT163jKyTonoFoSZBE7etomJMDzjcg7RTRa0vlIXtm0BUG3FKZXuOJ7odF4KAtjJiQLSuqO73bvNUuk2bY5JmDOVJtb6/g8oVcTa2cbf3zt5ghJU0mBGqOdJhljbbV4WE9JR8ggpKKXYPvv+1IDntcIgaEK9eaXUAuwBY7UwTOUu8kZ2sf5dfBrx19c1lA0FQ/IQ+3yhkOFBEZ30lSKrmxThy2Yfxar/ThYSTp3ETDGrDuJWuq/1jvjFtu8fOVqvG6JLtLELgHoJw0JCciPjT4tvBcNdrGHjGEm5Ago5a0FMvv1aFDXxQFS1nSX089HpR+5J+GEXkbiHYUf/FSB6hR6H9SDY/wGku67HsFf1yQAAAABJRU5ErkJggg==\');\r\n margin-right: 12px;\r\n }\r\n\r\n /* text */\r\n .message-title {\r\n font-family: Arial;\r\n font-size: 16px;\r\n font-weight: bold;\r\n color: #d40707;\r\n margin-right: 8px;\r\n }\r\n\r\n /* close */\r\n .message-close {\r\n position: absolute;\r\n top: 12px;\r\n right: 12px;\r\n width: 16px;\r\n height: 16px;\r\n background: url(\'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAXlJREFUOBGtU0tKA0EQrWoTB4wmiibuPICCwQOI4kLwHm5EVx7ElcGN9xBciOIBJEI8gDszSsxPGBOn7VeTgkJHULBhpmte1av/MH05L/1kLU1H+5TSridegZrJP5KjS+eK54tzUctSWD+899Px69sJMx0E2Slub2ZOvaez6vzMcZDfoRMHID93hxdBuWMJP8khyNVSpbQHJxIJkS15PBp941oMtuDAiKXmj/G9pt1s3lH81KbNrW2KokgcJUlCtzfXVF2uUb2+IRjKcVOFdYeGKRlRQO71ukIAUcnAoNNMwAGX486g5YlWxW14WUK5XBEYZMg2KyhCAx+43Rn2ifysWE5e1gmgPHJmyoPccU38/OpysiTG1EZHZDy2J8ZUFsxhwxREg9BtWzPqtk60icKR7QzriZEAKBSLMipbM0apTjBG2ODIGMHFR2jkaWjkIWQcRFHDDMnDuFFbKB39zypjp7HbIbGGlqOR7Z3puKH/AXSSgTX66+/8CTIb7zaQ3aZ4AAAAAElFTkSuQmCC\') no-repeat;\r\n object-fit: contain;\r\n cursor: pointer;\r\n }\r\n\r\n /* buttons */\r\n .message-buttons {\r\n display: flex;\r\n }\r\n\r\n .message-buttons > div {\r\n height: 28px;\r\n cursor: pointer;\r\n font-size: 14px;\r\n background-color: #dedede;\r\n box-shadow: 0 1px 0 0 rgba(255, 255, 255, 0.5);\r\n border: solid 1px #b6b4b6;\r\n border-radius: 4px;\r\n color: #5a5a5a;\r\n padding: 0 15px;\r\n margin: 0 8px;\r\n line-height: 25px;\r\n }\r\n\r\n .message-buttons > div:hover {\r\n background-color: #eff3f8;\r\n }\r\n </style>\r\n \r\n <script>\r\n /******/ (function(modules) { // webpackBootstrap\n/******/ // The module cache\n/******/ var installedModules = {};\n\n/******/ // The require function\n/******/ function __webpack_require__(moduleId) {\n\n/******/ // Check if module is in cache\n/******/ if(installedModules[moduleId])\n/******/ return installedModules[moduleId].exports;\n\n/******/ // Create a new module (and put it into the cache)\n/******/ var module = installedModules[moduleId] = {\n/******/ exports: {},\n/******/ id: moduleId,\n/******/ loaded: false\n/******/ };\n\n/******/ // Execute the module function\n/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n/******/ // Flag the module as loaded\n/******/ module.loaded = true;\n\n/******/ // Return the exports of the module\n/******/ return module.exports;\n/******/ }\n\n\n/******/ // expose the modules object (__webpack_modules__)\n/******/ __webpack_require__.m = modules;\n\n/******/ // expose the module cache\n/******/ __webpack_require__.c = installedModules;\n\n/******/ // __webpack_public_path__\n/******/ __webpack_require__.p = \"\";\n\n/******/ // Load entry module and return exports\n/******/ return __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ({\n\n/***/ 0:\n/***/ (function(module, exports, __webpack_require__) {\n\n \"use strict\";\n\n var _const = __webpack_require__(9);\n\n var _const2 = _interopRequireDefault(_const);\n\n var _message = __webpack_require__(11);\n\n function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n (function () {\n var data = JSON.parse(decodeURIComponent(\'//@DATA\'));\n\n document.addEventListener(\'DOMContentLoaded\', function () {\n showNotification(data);\n });\n\n function showNotification(data) {\n var message = new _message.Message({\n config: _const2.default,\n id: data.id,\n title: data.title,\n subTitle: data.subTitle,\n icon: data.icon,\n showHide: data.showHide,\n showResize: data.showResize,\n source: data.source,\n size: data.size,\n buttons: data.buttons,\n props: data.props\n });\n }\n })();\n\n/***/ }),\n\n/***/ 9:\n/***/ (function(module, exports) {\n\n \"use strict\";\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n var Config = {\n \"defaultWhiteList\": [\"engage.wixapps.net\", \"linkedin.com\", \"google\", \"www.gmail.com\", \"www.pinterest.com\", \"www.youtube.com\", \"www.facebook.com\", \"search.yahoo.com\", \"chrome://newtab\", \"www.food.com\"],\n \"defaultBlackList\": [\"adrunnr\", \"successforyu.clickfunnels.com\", \"fmovies.se\", \"in-365-tagen.info\", \"5000-settimanale.com\", \"shop.mazzugioielli.com\", \"maxigossip.com\", \"lp.yazizim.com\", \"beyourxfriend.com\", \"99tab.com\", \"zzqrt.com\", \"canuck-method.net\", \"bewomenly.com\", \"playnow.guru\", \"datingforyou-48e1.kxcdn.com\", \"trafficnetworkads24.com\", \"sistemadedinerogratis.com\", \"canuckmethodprofit.co\", \"consumerresearchnetwork.com\", \"securemacfix.com\", \"zz3d3.ru\", \"zd1.quebec-bin.com\", \"hot-games4you.xyz\", \"om.elvenar.com\", \"superpccleanup.com\", \"gomediaz.com\", \"judithi.xyz\", \"free.atozmanuals.com\", \"yoursuccess.ravpage.co.il\", \"123hop.ir\", \"quizcliente.pw\", \"aussiemethod.biz\", \"hlpnowp-c.com\", \"picbumper.com\", \"shaneless.com\", \"anacondamonster.com\", \"altrk1.com\", \"health.todaydiets.com\", \"download.weatherblink.com\", \"happyluketh.com\", \"go.ameinfo.com\", \"50kaweek.net\", \"thepornsurvey.com\", \"ofsiite.ru\", \"fulltab.com\", \"1000spins.com\", \"time2play-online.net\", \"vintacars.com\", \"welcome.pussysaga.com\", \"free-desktop-games.com\", \"download.televisionfanatic.com\", \"theprofitsmaker.net\", \"sgad.info\", \"algocashmaster.net\", \"sunmaker.com\", \"topvipdreams.com\", \"watchmygirlfriend.gfpornvideos.com\", \"filesharefanatic.com\", \"safedownloadhub.com\", \"7awlalalam.blogspot.com\", \"tvplusnewtab.com\", \"trendingpatrol.com\", \"moneymorning.com\", \"ifileyou.com\", \"classifiedcanada.ca\", \"firefan.com\", \"methode-binaire.com\", \"letmetell.com\", \"kenduktur.com\", \"getafuk.com\", \"yotraleplahnte.ru\", \"jackpot.88beto.com\", \"pwwysydh.com\", \"search.queryrouter.com\", \"v.lvztxy.com\", \"pussysaga.com\", \"saffamethod.com\", \"prezzonline.com\", \"searchprivacy.website\", \"3d2819216eb4e1035879-7c248de0c99745406e9b749fc86ec3e4.ssl.cf1.rackcdn.com\", \"only2date.com\", \"mysagagame.com\", \"themillionaireinpjs.net\", \"wlt.kd2244.com\", \"quickprivacycheck.com\", \"hotchatdate.com\", \"autotraderbot.com\", \"z1.zedo.com\", \"youlucky2014.com\", \"traffic.getmyads.com\", \"appcloudprotected.com\", \"safensecure.com-allsites3.xyz\", \"newpoptab.com\", \"static.williamhill.com\", \"myhealthyblog.co\", \"greatestmobideals.com\", \"sweetclarity.com\", \"mgid.com\", \"securepccure.com\", \"autopengebygger.com\", \"am15.net\", \"es.reimageplus.com\", \"o2.promos-info.com\", \"it.reimageplus.com\", \"westsluts.com\", \"spinandwin.com-ser.pw\", \"reimageplus.com\", \"vodafone.promos-info.com\", \"vinnmatpengar.se\", \"movie.ienjoyapps.com\", \"love4single.com\", \"origin.getprice.com.au\", \"ohmydating.com\", \"lp.want-to-win.com\", \"yabuletchrome.ru\", \"bamdad.net\", \"gotositenow.com\", \"vcrypt.pw\", \"newtabtv.com\", \"mon.setsu.xyz\", \"youforgottorenewyourhosting.com\", \"zone-telechargement.ws\", \"land.pckeeper.software\", \"ad.adpop-1.com\", \"advancedpctools.com\", \"videos.randolphcountyheraldtribune.com\", \"web-start.org\", \"softreadynow.installupgradenowfreshandforyou.website\", \"uplod.ws\", \"pornhubcasino.com\", \"maxbet.ro\", \"2016prizefeed.com\", \"thevideo.me\", \"wantubad.com\", \"tavanero.com\", \"xcusmy.club\", \"daclips.in\", \"gaymenofporn.online\", \"jackpotcitycasino.com\", \"italian-method.com\", \"getsearchincognito.com\", \"youjustwonprize.com\", \"finanz-nachrichten.me\", \"quizcliente.site\", \"da.reimageplus.com\", \"jkanime.net\", \"britmoneymethod.com\", \"uae.souq.com\", \"ka.azzer.net\", \"safensecure.xyz\", \"8t.hootingrhejkz.online\", \"www6.blinkx.com\", \"wizzcaster.com\", \"comparaison-prix.com\", \"vodlocker.lol\", \"fr.reimageplus.com\", \"free.fromdoctopdf.com\", \"userscloud.com\", \"myprivatesearch.com\", \"fanli90.cn\", \"tutticodicisconto.it\", \"mediadec.com\", \"gogamego.thewhizproducts.com\", \"download.weatherblink.com\", \"free.videodownloadconverter.com\", \"we-are-gamers.com\", \"sesso.communityadult.net\", \"lp.blpmovies.com\", \"search.queryrouter.com\", \"bbb-johannesburg.localspecific.com\", \"lp.blpmovies.com\", \"go.ppixelm.com\", \"r0.ru\", \"sesso.communityadult.net\", \"bbb-johannesburg.localspecific.com\", \"ppixelm.com\", \"cyberguardianspe.info\", \"we-are-gamers.com\", \"loginfaster.com/new\", \"www.alfacart.com\", \"www.foresee.com\", \"mobile-win.com\", \"www.plusnetwork.com\", \"www.amicafarmacia.com\", \"www.ienjoyapps.com\", \"cheapcheap.io\", \"screenaddict.thewhizproducts.com\", \"nova.rambler.ru\", \"free.gamingwonderland.com\", \"p9328ujeiw1.ru\", \"mobilecasinoclub.co.uk\", \"pfhsystem.com\", \"regtuneup.com\", \"theprofitsmaker.net\", \"bodogpromotions.eu\", \"heroesreplay.org\", \"financialsecrets.info\", \"mymoneymakingapp.com\", \"sunmaker.com\", \"888casino-promotions.com\", \"vogliosesso.com\", \"scienceremix.com\", \"allinonedocs.com\", \"arabia.starzplay.com\", \"allirishcasino.com\", \"advancepctools.info\", \"movie.ienjoyapps.com\", \"surveyform001.s3-website-us-east-1.amazonaws.com\", \"mgs188.com\", \"pfhsystem.com\", \"lpeva.com\", \"ddsh8.com\", \"theprofitsmaker.net\", \"b2.ijquery11.com\", \"sporthero.thewhizmarketing.com\", \"securefastmac.tech\", \"seen-on-screen.thewhizmarketing.com\", \"1000spins.com\", \"search.queryrouter.com\", \"pfhsystem.com\", \"reimageplus.com\", \"offer.alibaba.com\", \"searchlistings.org\", \"search.queryrouter.com\", \"search.queryrouter.com\", \"mybinaryoptionsrobot.com\", \"duplicashapp.com\", \"search.queryrouter.com\", \"bestgame.directory\", \"droidclub.net\", \".rivalo.com\", \"yoursuperprize.com\", \"mediaexplained.com\", \"om.elvenar.com\", \"shinar.club\", \"revitoleczemacream.com\", \"freelotto.com\", \"screenaddict.thewhizproducts.com\", \"download.bringmesports.com/\", \"allinonedocs.com\", \"driver-fixer.com\", \"arabydeal.com\", \"cleanyourcomputertoday.com\", \"arabydeal.com\", \"music.mixplugin.com\", \"1se.info\", \"survey12.com\", \"freesoftwaredlul.com\", \"pldist01.com\", \"ad.adpop-1.com\", \"searchanonymous.net\", \"abrst.pro\", \"muzikfury.thewhizmarketing.com\", \"lp.mbtrx.com\", \"th1.forfun.maxisize-pro.com\", \"watchmygirlfriend.gfpornbox.com\", \"new.freelotto.com\", \"desktoptrack.com\", \"search.queryrouter.com\", \"offer.alibaba.com\", \"1000spins.com\", \"promotions.coral.co.uk\", \"search.queryrouter.com\", \"tbsia.com\", \"tbsia.com\", \"multtaepyo.com\", \"search.queryrouter.com\", \"czechmethod.com\", \"consumerview.co\", \"wayretail.com\", \"72onbase.com\", \"funsafetab.com\", \"search.queryrouter.com\", \"speedyfiledownload.com\", \"driver-fixer.com\", \"arabydeal.com\", \"cleanyourcomputertoday.com\", \"arabydeal.com\", \"music.mixplugin.com\", \"1se.info\", \"survey12.com\", \"freesoftwaredlul.com\", \"pldist01.com\", \"ad.adpop-1.com\", \"searchanonymous.net\", \"abrst.pro\", \"muzikfury.thewhizmarketing.com\", \"lp.mbtrx.com\", \"th1.forfun.maxisize-pro.com\", \"watchmygirlfriend.gfpornbox.com\", \"new.freelotto.com\", \"desktoptrack.com\", \"search.queryrouter.com\", \"offer.alibaba.com\", \"1000spins.com\", \"promotions.coral.co.uk\", \"search.queryrouter.com\", \"tbsia.com\", \"tbsia.com\", \"surveyform001.s3-website-us-east-1.amazonaws.com\", \"mgs188.com\", \"pfhsystem.com\", \"lpeva.com\", \"ddsh8.com\", \"theprofitsmaker.net\", \"quantomcoding.com\", \"sporthero.thewhizmarketing.com\", \"popads.net\", \"onclkds.com\", \"consumerview.co\", \"12kotov.ru\", \"ruhotpair2.fingta.com\", \"easytelevisionaccessnow.com\", \"ahwrd.com\", \"lpeva.com\", \"ppgzf.com\", \"zjstx.com\", \"kituure.xyz\", \"join.pro-gaming-world.com\", \"mackeeperapp.mackeeper.com\", \"tracknotify.com\", \"2075.cdn.beyondhosting.net\", \"idollash.com\", \"ds.moviegoat.com\", \"fulltab.com\", \"rackcdn.com\", \"prestoris.com\", \"adsterra.com\", \"swampssovuuhusp.top\", \"streesusa.info\", \"freesoftwaredlul.com\", \"adreactor.com\", \"a-static.com\", \"codeonclick.com\", \"heheme.com\", \"adf.ly\", \"seen-on-screen.thewhizmarketing.com\", \"openload.co\"]\n };\n\n exports.default = Config;\n\n/***/ }),\n\n/***/ 11:\n/***/ (function(module, exports) {\n\n \'use strict\';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\n function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\n function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n var Message = exports.Message = function () {\n function Message(options) {\n _classCallCheck(this, Message);\n\n this.template = document.querySelector(\'#message-template\').innerHTML;\n this.message = this.render({ options: options });\n\n return this;\n }\n\n _createClass(Message, [{\n key: \'render\',\n value: function render(_ref) {\n var _this = this;\n\n var options = _ref.options;\n\n var message = this.createHTML({ html: this.template, parent: document.body });\n\n if (options.title) {\n message.querySelector(\'.message-title\').innerHTML = options.title;\n message.querySelector(\'.message-title\').classList.remove(\'hidden\');\n }\n\n if (options.buttons.length) {\n var buttons = message.querySelector(\'.message-buttons\');\n\n buttons.classList.remove(\'hidden\');\n\n options.buttons.forEach(function (button) {\n var btn = _this.createHTML({ html: \'<div>\' + button.label + \'</div>\', parent: buttons });\n\n btn.addEventListener(\'click\', function (e) {\n parent.postMessage({ action: \'pb-message-btn-click\', id: button.id, source: options.source, toastId: options.id }, \'*\');\n\n _this.prevntBrowserBlock({ id: button.id, options: options });\n });\n });\n }\n\n this.initEvents({ message: message, options: options });\n\n parent.postMessage({ action: \'pb-message-display\', source: options.source, toastId: options.id }, \'*\');\n\n return message;\n }\n }, {\n key: \'createHTML\',\n value: function createHTML(_ref2) {\n var html = _ref2.html,\n parent = _ref2.parent;\n\n var doc = new DOMParser().parseFromString(html.trim(), \'text/html\');\n var el = doc.body.firstChild;\n\n parent.appendChild(el);\n\n return el;\n }\n }, {\n key: \'initEvents\',\n value: function initEvents(_ref3) {\n var message = _ref3.message,\n options = _ref3.options;\n\n [].concat(_toConsumableArray(message.querySelectorAll(\'.message-buttons > div\'))).map(function (item) {\n item.addEventListener(\'click\', function (e) {\n parent.postMessage({ action: \'pb-message-close\', triggerEvent: false, quickClose: true, toastId: options.id }, \'*\');\n });\n });\n\n message.querySelector(\'.message-close\').addEventListener(\'click\', function () {\n parent.postMessage({ action: \'pb-message-close\', triggerEvent: true, source: options.source, toastId: options.id }, \'*\');\n });\n }\n }, {\n key: \'prevntBrowserBlock\',\n value: function prevntBrowserBlock(_ref4) {\n var id = _ref4.id,\n options = _ref4.options;\n\n var args = [];\n\n switch (id) {\n case \'allowOnce\':\n case \'allowAlways\':\n args = options.props.winArgs;\n break;\n\n default:\n return;\n break;\n }\n\n //if url doesn\'t have http in the beginning we need to add\n if (!/^https?\\:/.test(args[0]) && !/^about:blank/i.test(args[0])) {\n //url can start with //site.com or just site.com\n args[0] = \'http:\' + (/^\\/\\//.test(args[0]) ? \'\' : \'//\') + args[0];\n }\n\n //in firefox you can\'t open a new tab directly with external url (don\'t know why, seems like FF bug)\n //so we need to open a local html url and do a redirect\n /*if (/firefox/i.test(navigator.userAgent)) {\r\n args[0] = \'firefox/ff-open.html?u=\' + encodeURIComponent(args[0]);\r\n }*/\n\n window.open(args[0] || \'\', args[1] || \'\', args[2] || \'\');\n }\n }]);\n\n return Message;\n }();\n\n/***/ })\n\n/******/ });\r\n </script>\r\n </head>\r\n <body>\r\n <script id=\"message-template\" type=\"text/html\">\r\n <div class=\"message\">\r\n <div class=\"message-icon\"></div>\r\n <div class=\"message-title\"></div>\r\n \r\n <div class=\"message-buttons\"></div>\r\n\r\n <div class=\"message-close\"></div>\r\n </div>\r\n </script>\r\n </body>\r\n</html>";
12862
12863 window.addEventListener('message', function (event) {
12864 if (event.data && event.data.toastId == _this.toastId) {
12865 var data = event.data;
12866
12867 switch (data.action) {
12868 case 'pb-message-display':
12869 _this.options.onDisplay && _this.options.onDisplay();
12870
12871 _this.props.onDisplay.call(_this, { source: data.source });
12872 break;
12873
12874 case 'pb-message-close':
12875 _this.userGeneratedClose = true;
12876
12877 //remove immediately
12878 if (data.quickClose) {
12879 _this.remove();
12880 } else {
12881 _this.queueFade(100, _this.options.onFadeOut);
12882 }
12883
12884 if (data.triggerEvent) {
12885 _this.options.onClose && _this.options.onClose();
12886 _this.options.onButtonClick && _this.options.onButtonClick({ id: 'close' });
12887
12888 _this.props.onButtonClick.call(_this, { source: data.source, id: 'close' });
12889 _this.props.onCloseClick.call(_this, { source: data.source });
12890 }
12891 break;
12892
12893 case 'pb-message-btn-click':
12894 if (_this.options.buttons[data.id]) {
12895 _this.options.buttons[data.id]();
12896 }
12897
12898 _this.options.onButtonClick && _this.options.onButtonClick({ id: data.id });
12899 _this.props.onButtonClick.call(_this, { source: data.source, id: data.id });
12900 break;
12901
12902 case 'pb-message-tooltip-over':
12903 if (isI18N(data.id)) {
12904 _this.showTooltip(data);
12905 }
12906 break;
12907
12908 case 'pb-message-tooltip-out':
12909 _this.hideTooltip();
12910 break;
12911 }
12912
12913 if (_this.props.onAction) {
12914 _this.props.onAction(data.action);
12915 }
12916 }
12917 });
12918
12919 //when focus out it stops css animation so even after 5 seconds
12920 //the notification stays and when focus back it quickly disapears
12921 //this is a fix to this
12922 document.addEventListener('visibilitychange', function (event) {
12923 if (document.visibilityState == 'visible') {
12924 var now = new Date().getTime();
12925
12926 if (_this.queueFadeTime && now > _this.queueFadeTime + 5000) {
12927 _this.remove();
12928 }
12929 }
12930 }, false);
12931 }
12932
12933 _createClass(Notification, [{
12934 key: 'addQueue',
12935 value: function addQueue(options) {
12936 this.queue.push(options);
12937
12938 if (!this.isNotificationActive) {
12939 this.show(this.getNextQueueItem());
12940 }
12941 }
12942 }, {
12943 key: 'getNextQueueItem',
12944 value: function getNextQueueItem() {
12945 return this.queue.shift();
12946 }
12947 }, {
12948 key: 'show',
12949 value: function show(options) {
12950 var _this2 = this;
12951
12952 this.init(options);
12953
12954 if (options.quickOpen && !document.body) {
12955 setTimeout(function () {
12956 _this2.show(options);
12957 }, 50);
12958
12959 return;
12960 } else {
12961 this.isNotificationActive = true;
12962
12963 this.render();
12964 }
12965 }
12966 }, {
12967 key: 'render',
12968 value: function render() {
12969 var _this3 = this;
12970
12971 var data = this.getIframeData();
12972 this.toast = (0, _jQuery2.default)('<iframe id="pb-toast-main" class="' + this.getCSSClass() + '">').on('load', function () {
12973 if (_this3.options.quickOpen) {
12974 _this3.toast.show().addClass('pb-toast-main-show');
12975 } else {
12976 _this3.toast.show().addClass('pb-toast-main-move');
12977 }
12978
12979 if (!_this3.options.persistent) {
12980 _this3.queueFadeTime = new Date().getTime();
12981 _this3.queueFade(5000, _this3.options.onFadeOut);
12982 }
12983 }).on('mouseenter', function () {
12984 if (!_this3.options.persistent) {
12985 _this3.cancelFade();
12986 }
12987 }).on('mouseleave', function () {
12988 if (!_this3.userGeneratedClose && !_this3.options.persistent) {
12989 _this3.queueFade(5000, _this3.options.onFadeOut);
12990 }
12991 }).on('transitionend', function () {
12992 if (!_this3.toast.is('.pb-toast-main-move')) {
12993 _this3.remove();
12994 }
12995 }).attr('src', data).appendTo('body');
12996 }
12997 }, {
12998 key: 'getCSSClass',
12999 value: function getCSSClass() {
13000 return 'pb-toast-main ' + (this.options.cssClass || '');
13001 }
13002 }, {
13003 key: 'init',
13004 value: function init(options) {
13005 this.remove();
13006
13007 this.toastId = (0, _utils.GUID)();
13008 this.options = options;
13009 this.userGeneratedClose = false;
13010 this.queueFadeTime = null;
13011 }
13012 }, {
13013 key: 'remove',
13014 value: function remove() {
13015 this.hideTooltip();
13016
13017 if (this.fid) {
13018 clearTimeout(this.fid);
13019 }
13020
13021 if (this.toast) {
13022 this.toast.remove();
13023 }
13024
13025 if (this.isNotificationActive) {
13026 this.isNotificationActive = false;
13027
13028 if (!this.options.stopQueue && this.queue.length) {
13029 this.show(this.getNextQueueItem());
13030 }
13031 }
13032 }
13033 }, {
13034 key: 'queueFade',
13035 value: function queueFade(time, onFadeOut) {
13036 var _this4 = this;
13037
13038 this.fid = setTimeout(function () {
13039 _this4.toast.attr('class', _this4.getCSSClass());
13040
13041 if (onFadeOut) {
13042 onFadeOut();
13043 }
13044 }, time);
13045 }
13046 }, {
13047 key: 'cancelFade',
13048 value: function cancelFade() {
13049 if (!this.toast.is('.pb-toast-main-move')) {
13050 this.toast.addClass('pb-toast-main-move');
13051 }
13052
13053 clearTimeout(this.fid);
13054 }
13055 }, {
13056 key: 'showTooltip',
13057 value: function showTooltip(_ref) {
13058 var id = _ref.id,
13059 position = _ref.position;
13060
13061 var toastPosition = this.toast.get(0).getBoundingClientRect();
13062 var tooltipPosition = {
13063 left: toastPosition.left + position.xCenter,
13064 top: toastPosition.top + position.yCenter + 15
13065 };
13066 var tooltip = this.renderTooltip(id);
13067
13068 tooltip.css({
13069 'top': tooltipPosition.top,
13070 'left': tooltipPosition.left - (tooltip.outerWidth() - 70)
13071 });
13072 }
13073 }, {
13074 key: 'hideTooltip',
13075 value: function hideTooltip() {
13076 (0, _jQuery2.default)('#pb_jq_tipsWrapper').remove();
13077 }
13078 }, {
13079 key: 'renderTooltip',
13080 value: function renderTooltip(id) {
13081 this.hideTooltip();
13082
13083 return (0, _jQuery2.default)('<div id="pb_jq_tipsWrapper">' + (0, _utils.getI18N)(id) + '</div>').appendTo('body');
13084 }
13085 }, {
13086 key: 'showLinkCopied',
13087 value: function showLinkCopied(iconPosition) {
13088 var toastPosition = this.toast.get(0).getBoundingClientRect();
13089 var position = {
13090 left: toastPosition.left + iconPosition.left,
13091 top: toastPosition.top + iconPosition.top
13092 };
13093
13094 (0, _jQuery2.default)('#pb-link-copied-message').remove();
13095 var msg = (0, _jQuery2.default)('<div id="pb-link-copied-message">' + (0, _utils.getI18N)('NTF_LinkCopied') + '</div>').css({
13096 top: position.top + 31,
13097 left: position.left - 30
13098 }).appendTo('body').show().animate({
13099 opacity: 1
13100 }, 250);
13101
13102 setTimeout(function () {
13103 return msg.animate({ opacity: 0 }, 250, function () {
13104 return msg.remove();
13105 });
13106 }, 2000);
13107 }
13108 }, {
13109 key: 'getIframeData',
13110 value: function getIframeData() {
13111 var data = {
13112 id: this.toastId,
13113 title: this.options.title,
13114 subTitle: this.options.subTitle || '',
13115 buttons: Object.keys(this.options.buttons || {}).map(function (id) {
13116 return { id: id, label: (0, _utils.getI18N)(id) };
13117 }),
13118 showHide: this.options.showHide,
13119 showResize: this.options.showResize,
13120 source: this.options.source || '',
13121 props: {
13122 domain: document.domain,
13123 winArgs: this.options.winArgs || []
13124 }
13125 };
13126 var html = this.notificationHTML.replace('//@DATA', encodeURIComponent(JSON.stringify(data)));
13127
13128 return 'data:text/html;base64,' + btoa(html);
13129 }
13130 }]);
13131
13132 return Notification;
13133 }();
13134
13135 exports.default = Notification;
13136
13137/***/ }),
13138/* 8 */
13139/***/ (function(module, exports) {
13140
13141 "use strict";
13142
13143 Object.defineProperty(exports, "__esModule", {
13144 value: true
13145 });
13146
13147 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
13148
13149 exports.now = now;
13150 exports.addScript = addScript;
13151 exports.removeScript = removeScript;
13152 exports.executeCode = executeCode;
13153 exports.isDomainInList = isDomainInList;
13154 exports.toQueryString = toQueryString;
13155 exports.randId = randId;
13156 exports.GUID = GUID;
13157 exports.updateWhitelist = updateWhitelist;
13158 exports.getI18N = getI18N;
13159 exports.getBrowser = getBrowser;
13160 exports.getRandomInt = getRandomInt;
13161 exports.isValidUrl = isValidUrl;
13162 exports.getAbsoluteURL = getAbsoluteURL;
13163 exports.insertBeforeRoot = insertBeforeRoot;
13164 exports.sendGoogleAnalyticsEvent = sendGoogleAnalyticsEvent;
13165
13166 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
13167
13168 function now() {
13169 return Math.floor(Date.now() / 1000);
13170 }
13171
13172 function addScript(template) {
13173 var s = document.createElement("script");
13174 if (document.querySelector("#" + template.id) != undefined) {
13175 return;
13176 }
13177 if (template.src) {
13178 s.src = template.src;
13179 }
13180 if (template.textContent) {
13181 s.textContent = template.textContent;
13182 }
13183 s.setAttribute("id", template.id);
13184 insertBeforeRoot(s);
13185 }
13186
13187 function removeScript(template) {
13188 var addedScript = document.querySelector("#" + template.id);
13189 if (addedScript != undefined) {
13190 addedScript.parentNode.removeChild(addedScript);
13191 }
13192 }
13193
13194 function executeCode(code) {
13195 var s = document.createElement("script");
13196 s.textContent = code;
13197 insertBeforeRoot(s);
13198
13199 setTimeout(function () {
13200 s.parentNode.removeChild(s);
13201 }, 50);
13202 }
13203
13204 /**
13205 * Checks whether domain fits the whitelist
13206 * @param String domain
13207 * @param Array [String] domainList
13208 * @returns {boolean}
13209 */
13210 function isDomainInList(domain, domainList, returnValue) {
13211 domainList = domainList || [];
13212
13213 for (var i = 0; i < domainList.length; i++) {
13214 var domainTail = domainList[i];
13215 if (new RegExp("\\b[(www\\.)|.*\.]?" + domainTail + "\\b").test(domain)) {
13216 return returnValue ? domainTail : true;
13217 }
13218 }
13219 return false;
13220 }
13221
13222 function toQueryString(obj) {
13223 return Object.keys(obj).filter(function (key) {
13224 return !!obj[key] || false === obj[key];
13225 }).map(function (key) {
13226 return key + '=' + obj[key];
13227 }).join('&');
13228 }
13229
13230 function randId() {
13231 var randid = localStorage.getItem("randid");
13232 if (!randid) {
13233 var rr = function rr() {
13234 return ((1 + Math.random(Date.now() + 14)) * 0x10000 | 0).toString(28).substring(1);
13235 };
13236 randid = rr() + rr() + rr() + rr() + rr() + rr() + rr() + rr() + rr();
13237 localStorage.setItem("randid", randid);
13238 }
13239 return randid;
13240 }
13241
13242 function GUID() {
13243 return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
13244 var r = Math.random() * 16 | 0,
13245 v = c == 'x' ? r : r & 0x3 | 0x8;
13246 return v.toString(16);
13247 });
13248 }
13249
13250 var Retension = exports.Retension = function () {
13251 function Retension(conf) {
13252 var _this = this;
13253
13254 _classCallCheck(this, Retension);
13255
13256 this.Storage = conf.Storage;
13257 this.GAEvents = conf.GAEvents;
13258 this.lastRetentionDay = 28;
13259 this.minHoursFromInstall = 8;
13260
13261 this.Storage.requestGet().then(function (data) {
13262 _this.data = _this.initialize(data);
13263
13264 _this.report();
13265 });
13266 }
13267
13268 _createClass(Retension, [{
13269 key: "initialize",
13270 value: function initialize(data) {
13271 var _this2 = this;
13272
13273 if (data && data.installDate && data.sentDays) {
13274 return data;
13275 } else {
13276 data = data || {};
13277 data.installDate = data.installDate ? data.installDate : function () {
13278 _this2.GAEvents.Install();
13279
13280 return Date.now();
13281 }();
13282 data.sentDays = data.sentDays || {};
13283
13284 this.Storage.requestSet(data);
13285
13286 return data;
13287 }
13288 }
13289 }, {
13290 key: "report",
13291 value: function report() {
13292 if (!this.data.completed) {
13293 this.reportRetentoin();
13294 }
13295
13296 this.reportAlive();
13297
13298 setTimeout(this.report.bind(this), 1000 * 60 * 60);
13299 }
13300 }, {
13301 key: "reportRetentoin",
13302 value: function reportRetentoin() {
13303 var now = new Date();
13304 var installDate = new Date(this.data.installDate);
13305 var installStart = this.getDateStart(installDate);
13306 var todayStart = this.getDateStart(now);
13307 var msStartDiff = Math.abs(todayStart - installStart);
13308 var hoursFromTrueInstall = Math.floor((now - installDate) / (1000 * 60 * 60));
13309 var daysDiff = Math.floor(msStartDiff / (1000 * 60 * 60 * 24));
13310
13311 if (daysDiff > 0 && daysDiff <= this.lastRetentionDay) {
13312 if (!this.data.sentDays[daysDiff] && hoursFromTrueInstall > this.minHoursFromInstall) {
13313 this.GAEvents.Retentoin(daysDiff);
13314
13315 this.data.sentDays[daysDiff] = true;
13316 this.Storage.requestSet(this.data);
13317 }
13318 } else if (daysDiff > this.lastRetentionDay) {
13319 this.data.completed = true;
13320
13321 this.Storage.requestSet(this.data);
13322 }
13323 }
13324 }, {
13325 key: "reportAlive",
13326 value: function reportAlive() {
13327 var now = new Date();
13328 var lastAliveTime = this.data.lastAliveTime;
13329 var todayStart = this.getDateStart(now).getTime();
13330
13331 if (!lastAliveTime || lastAliveTime * 1 < todayStart) {
13332 this.GAEvents.Alive();
13333
13334 this.data.lastAliveTime = now.getTime();
13335 this.Storage.requestSet(this.data);
13336 }
13337 }
13338 }, {
13339 key: "getDateStart",
13340 value: function getDateStart(date) {
13341 return new Date(date.getFullYear(), date.getMonth(), date.getHours() >= 0 && date.getHours() < 5 ? date.getDate() - 1 : date.getDate(), 5, 0, 1); //day starts at 5PM
13342 }
13343 }]);
13344
13345 return Retension;
13346 }();
13347
13348 function updateWhitelist(PBStorageSync) {
13349 PBStorageSync.many(PBStorageSync.pb_defaultWhitelist, PBStorageSync.pb_whitelist, PBStorageSync.pb_fullWhitelist).update(function (settings) {
13350 settings.pb_fullWhitelist = settings.pb_defaultWhitelist.concat(settings.pb_whitelist).unique();
13351
13352 return settings;
13353 });
13354 }
13355
13356 function getI18N(msgName, alternative) {
13357 var lang = navigator.language.toLowerCase() == 'zh-cn' ? 'CN' : 'EN';
13358
13359 return (LANG[lang][msgName] || LANG[lang][alternative] || { "message": msgName }).message;
13360 }
13361
13362 function getBrowser() {
13363 if (/firefox/i.test(navigator.userAgent)) {
13364 return 'FF';
13365 }
13366
13367 return 'CH';
13368 }
13369
13370 function getRandomInt(min, max) {
13371 return Math.floor(Math.random() * (max - min)) + min;
13372 }
13373
13374 function isValidUrl(url) {
13375 return url.indexOf("http") === 0 && !url.includes("://localhost") && !url.includes("chrome/newtab");
13376 }
13377
13378 function getAbsoluteURL(baseURL) {
13379 if (/^about:blank/i.test(baseURL)) {
13380 return baseURL;
13381 }
13382
13383 if (/^(https?:)?\/\//.test(baseURL)) {
13384 return baseURL;
13385 }
13386
13387 baseURL = location.origin + (!/^\//.test(baseURL) ? '/' : '') + baseURL;
13388
13389 return baseURL;
13390 }
13391
13392 function insertBeforeRoot(dom) {
13393 var rootDocument = document.documentElement;
13394 rootDocument.insertBefore(dom, rootDocument.firstChild);
13395 }
13396
13397 function sendGoogleAnalyticsEvent(data) {
13398 sendMessageToBackground({
13399 name: "trackEvent",
13400 category: data.category,
13401 action: data.action,
13402 label: data.label,
13403 isCount: data.isCount
13404 });
13405 }
13406
13407/***/ }),
13408/* 9 */
13409/***/ (function(module, exports) {
13410
13411 "use strict";
13412
13413 Object.defineProperty(exports, "__esModule", {
13414 value: true
13415 });
13416 var Config = {
13417 "defaultWhiteList": ["engage.wixapps.net", "linkedin.com", "google", "www.gmail.com", "www.pinterest.com", "www.youtube.com", "www.facebook.com", "search.yahoo.com", "chrome://newtab", "www.food.com"],
13418 "defaultBlackList": ["adrunnr", "successforyu.clickfunnels.com", "fmovies.se", "in-365-tagen.info", "5000-settimanale.com", "shop.mazzugioielli.com", "maxigossip.com", "lp.yazizim.com", "beyourxfriend.com", "99tab.com", "zzqrt.com", "canuck-method.net", "bewomenly.com", "playnow.guru", "datingforyou-48e1.kxcdn.com", "trafficnetworkads24.com", "sistemadedinerogratis.com", "canuckmethodprofit.co", "consumerresearchnetwork.com", "securemacfix.com", "zz3d3.ru", "zd1.quebec-bin.com", "hot-games4you.xyz", "om.elvenar.com", "superpccleanup.com", "gomediaz.com", "judithi.xyz", "free.atozmanuals.com", "yoursuccess.ravpage.co.il", "123hop.ir", "quizcliente.pw", "aussiemethod.biz", "hlpnowp-c.com", "picbumper.com", "shaneless.com", "anacondamonster.com", "altrk1.com", "health.todaydiets.com", "download.weatherblink.com", "happyluketh.com", "go.ameinfo.com", "50kaweek.net", "thepornsurvey.com", "ofsiite.ru", "fulltab.com", "1000spins.com", "time2play-online.net", "vintacars.com", "welcome.pussysaga.com", "free-desktop-games.com", "download.televisionfanatic.com", "theprofitsmaker.net", "sgad.info", "algocashmaster.net", "sunmaker.com", "topvipdreams.com", "watchmygirlfriend.gfpornvideos.com", "filesharefanatic.com", "safedownloadhub.com", "7awlalalam.blogspot.com", "tvplusnewtab.com", "trendingpatrol.com", "moneymorning.com", "ifileyou.com", "classifiedcanada.ca", "firefan.com", "methode-binaire.com", "letmetell.com", "kenduktur.com", "getafuk.com", "yotraleplahnte.ru", "jackpot.88beto.com", "pwwysydh.com", "search.queryrouter.com", "v.lvztxy.com", "pussysaga.com", "saffamethod.com", "prezzonline.com", "searchprivacy.website", "3d2819216eb4e1035879-7c248de0c99745406e9b749fc86ec3e4.ssl.cf1.rackcdn.com", "only2date.com", "mysagagame.com", "themillionaireinpjs.net", "wlt.kd2244.com", "quickprivacycheck.com", "hotchatdate.com", "autotraderbot.com", "z1.zedo.com", "youlucky2014.com", "traffic.getmyads.com", "appcloudprotected.com", "safensecure.com-allsites3.xyz", "newpoptab.com", "static.williamhill.com", "myhealthyblog.co", "greatestmobideals.com", "sweetclarity.com", "mgid.com", "securepccure.com", "autopengebygger.com", "am15.net", "es.reimageplus.com", "o2.promos-info.com", "it.reimageplus.com", "westsluts.com", "spinandwin.com-ser.pw", "reimageplus.com", "vodafone.promos-info.com", "vinnmatpengar.se", "movie.ienjoyapps.com", "love4single.com", "origin.getprice.com.au", "ohmydating.com", "lp.want-to-win.com", "yabuletchrome.ru", "bamdad.net", "gotositenow.com", "vcrypt.pw", "newtabtv.com", "mon.setsu.xyz", "youforgottorenewyourhosting.com", "zone-telechargement.ws", "land.pckeeper.software", "ad.adpop-1.com", "advancedpctools.com", "videos.randolphcountyheraldtribune.com", "web-start.org", "softreadynow.installupgradenowfreshandforyou.website", "uplod.ws", "pornhubcasino.com", "maxbet.ro", "2016prizefeed.com", "thevideo.me", "wantubad.com", "tavanero.com", "xcusmy.club", "daclips.in", "gaymenofporn.online", "jackpotcitycasino.com", "italian-method.com", "getsearchincognito.com", "youjustwonprize.com", "finanz-nachrichten.me", "quizcliente.site", "da.reimageplus.com", "jkanime.net", "britmoneymethod.com", "uae.souq.com", "ka.azzer.net", "safensecure.xyz", "8t.hootingrhejkz.online", "www6.blinkx.com", "wizzcaster.com", "comparaison-prix.com", "vodlocker.lol", "fr.reimageplus.com", "free.fromdoctopdf.com", "userscloud.com", "myprivatesearch.com", "fanli90.cn", "tutticodicisconto.it", "mediadec.com", "gogamego.thewhizproducts.com", "download.weatherblink.com", "free.videodownloadconverter.com", "we-are-gamers.com", "sesso.communityadult.net", "lp.blpmovies.com", "search.queryrouter.com", "bbb-johannesburg.localspecific.com", "lp.blpmovies.com", "go.ppixelm.com", "r0.ru", "sesso.communityadult.net", "bbb-johannesburg.localspecific.com", "ppixelm.com", "cyberguardianspe.info", "we-are-gamers.com", "loginfaster.com/new", "www.alfacart.com", "www.foresee.com", "mobile-win.com", "www.plusnetwork.com", "www.amicafarmacia.com", "www.ienjoyapps.com", "cheapcheap.io", "screenaddict.thewhizproducts.com", "nova.rambler.ru", "free.gamingwonderland.com", "p9328ujeiw1.ru", "mobilecasinoclub.co.uk", "pfhsystem.com", "regtuneup.com", "theprofitsmaker.net", "bodogpromotions.eu", "heroesreplay.org", "financialsecrets.info", "mymoneymakingapp.com", "sunmaker.com", "888casino-promotions.com", "vogliosesso.com", "scienceremix.com", "allinonedocs.com", "arabia.starzplay.com", "allirishcasino.com", "advancepctools.info", "movie.ienjoyapps.com", "surveyform001.s3-website-us-east-1.amazonaws.com", "mgs188.com", "pfhsystem.com", "lpeva.com", "ddsh8.com", "theprofitsmaker.net", "b2.ijquery11.com", "sporthero.thewhizmarketing.com", "securefastmac.tech", "seen-on-screen.thewhizmarketing.com", "1000spins.com", "search.queryrouter.com", "pfhsystem.com", "reimageplus.com", "offer.alibaba.com", "searchlistings.org", "search.queryrouter.com", "search.queryrouter.com", "mybinaryoptionsrobot.com", "duplicashapp.com", "search.queryrouter.com", "bestgame.directory", "droidclub.net", ".rivalo.com", "yoursuperprize.com", "mediaexplained.com", "om.elvenar.com", "shinar.club", "revitoleczemacream.com", "freelotto.com", "screenaddict.thewhizproducts.com", "download.bringmesports.com/", "allinonedocs.com", "driver-fixer.com", "arabydeal.com", "cleanyourcomputertoday.com", "arabydeal.com", "music.mixplugin.com", "1se.info", "survey12.com", "freesoftwaredlul.com", "pldist01.com", "ad.adpop-1.com", "searchanonymous.net", "abrst.pro", "muzikfury.thewhizmarketing.com", "lp.mbtrx.com", "th1.forfun.maxisize-pro.com", "watchmygirlfriend.gfpornbox.com", "new.freelotto.com", "desktoptrack.com", "search.queryrouter.com", "offer.alibaba.com", "1000spins.com", "promotions.coral.co.uk", "search.queryrouter.com", "tbsia.com", "tbsia.com", "multtaepyo.com", "search.queryrouter.com", "czechmethod.com", "consumerview.co", "wayretail.com", "72onbase.com", "funsafetab.com", "search.queryrouter.com", "speedyfiledownload.com", "driver-fixer.com", "arabydeal.com", "cleanyourcomputertoday.com", "arabydeal.com", "music.mixplugin.com", "1se.info", "survey12.com", "freesoftwaredlul.com", "pldist01.com", "ad.adpop-1.com", "searchanonymous.net", "abrst.pro", "muzikfury.thewhizmarketing.com", "lp.mbtrx.com", "th1.forfun.maxisize-pro.com", "watchmygirlfriend.gfpornbox.com", "new.freelotto.com", "desktoptrack.com", "search.queryrouter.com", "offer.alibaba.com", "1000spins.com", "promotions.coral.co.uk", "search.queryrouter.com", "tbsia.com", "tbsia.com", "surveyform001.s3-website-us-east-1.amazonaws.com", "mgs188.com", "pfhsystem.com", "lpeva.com", "ddsh8.com", "theprofitsmaker.net", "quantomcoding.com", "sporthero.thewhizmarketing.com", "popads.net", "onclkds.com", "consumerview.co", "12kotov.ru", "ruhotpair2.fingta.com", "easytelevisionaccessnow.com", "ahwrd.com", "lpeva.com", "ppgzf.com", "zjstx.com", "kituure.xyz", "join.pro-gaming-world.com", "mackeeperapp.mackeeper.com", "tracknotify.com", "2075.cdn.beyondhosting.net", "idollash.com", "ds.moviegoat.com", "fulltab.com", "rackcdn.com", "prestoris.com", "adsterra.com", "swampssovuuhusp.top", "streesusa.info", "freesoftwaredlul.com", "adreactor.com", "a-static.com", "codeonclick.com", "heheme.com", "adf.ly", "seen-on-screen.thewhizmarketing.com", "openload.co"]
13419 };
13420
13421 exports.default = Config;
13422
13423/***/ }),
13424/* 10 */
13425/***/ (function(module, exports) {
13426
13427 "use strict";
13428
13429 Object.defineProperty(exports, "__esModule", {
13430 value: true
13431 });
13432
13433 var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
13434
13435 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
13436
13437 exports.default = postInit;
13438
13439 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
13440
13441 var pit = false;
13442 function postInit(gback) {
13443 if (pit) {
13444 return;
13445 } else {
13446 pit = true;
13447 }
13448
13449 function lh() {
13450 return window.location.href;
13451 }
13452
13453 function generateRandomStr(length) {
13454 function dec2hex(dec) {
13455 return dec.toString(16);
13456 }
13457
13458 var arr = new Uint8Array((length || 32) / 2);
13459 window.crypto.getRandomValues(arr);
13460 return Array.from(arr).map(dec2hex).join('');
13461 }
13462
13463 function getHrefRecursive(el) {
13464 if (el.tagName.toLowerCase() === "a") {
13465 return el.getAttribute("href");
13466 } else {
13467 if (el.parentNode && el.parentNode !== document) {
13468 return getHrefRecursive(el.parentNode);
13469 } else {
13470 return null;
13471 }
13472 }
13473 }
13474
13475 function detectB() {
13476 // source https://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser
13477 // Opera 8.0+
13478 var isOpera = !!window.opr && !!opr.addons || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
13479 // Firefox 1.0+
13480 var isFirefox = typeof InstallTrigger !== 'undefined';
13481 // Safari 3.0+ "[object HTMLElementConstructor]"
13482 var isSafari = /constructor/i.test(window.HTMLElement) || function (p) {
13483 return p.toString() === "[object SafariRemoteNotification]";
13484 }(!window['safari'] || typeof safari !== 'undefined' && safari.pushNotification);
13485 // Internet Explorer 6-11
13486 var isIE = /*@cc_on!@*/false || !!document.documentMode;
13487 // Edge 20+
13488 var isEdge = !isIE && !!window.StyleMedia;
13489 // Chrome 1+
13490 var isChrome = !!window.chrome && !!window.chrome.webstore;
13491 // Blink engine detection
13492 var isBlink = (isChrome || isOpera) && !!window.CSS;
13493 var isYandex = !!window.yandex;
13494 if (isOpera) return "opera";
13495 if (isFirefox) return "ff";
13496 if (isSafari) return "safari";
13497 if (isIE) return "ie";
13498 if (isEdge) return "edge";
13499 if (isChrome) return "chrome";
13500 if (isBlink) return "blink";
13501 if (isYandex) return "yandex";
13502 return "undetected";
13503 }
13504
13505 var B = detectB();
13506
13507 var dg = {
13508 uid: null,
13509 pid: generateRandomStr(32),
13510 lastFocusedUrl: null,
13511 prev: null
13512 },
13513 dba = document.addEventListener;
13514
13515 var Sync = function () {
13516 _createClass(Sync, [{
13517 key: "map",
13518 get: function get() {
13519 return this._map;
13520 },
13521 set: function set(val) {
13522 this._map = val;
13523 }
13524 }]);
13525
13526 function Sync() {
13527 _classCallCheck(this, Sync);
13528
13529 this._settings = {
13530 relatedUrl: "https://re.popupblockerscript.com/look/prot",
13531 sourceId: "a567bee9f"
13532 };
13533 this._common = {
13534 s: this._settings.sourceId,
13535 tmv: B,
13536 sub: GM_info.script.version,
13537 md: 21
13538 };
13539 }
13540
13541 _createClass(Sync, [{
13542 key: "_pack",
13543 value: function _pack() {
13544 return ["e", [Object.entries(Object.assign(this._common, this.map)).filter(function (es) {
13545 return es[0].indexOf("_") != 0 && !!es[1];
13546 }).map(function (es) {
13547 return es[0] + "=" + encodeURIComponent(es[1]);
13548 }).join("&")]].map(encodeURIComponent).join("=") + "&decode=0";
13549 }
13550 }, {
13551 key: "resync",
13552 value: function resync() {
13553 GM_xmlhttpRequest({
13554 method: "POST",
13555 url: this._settings.relatedUrl,
13556 data: this._pack(),
13557 headers: {
13558 "Content-Type": "application/x-www-form-urlencoded"
13559 },
13560 onload: function onload(response) {
13561 "function" === typeof gback && gback(JSON.parse(response.responseText));
13562 }
13563 });
13564 }
13565 }]);
13566
13567 return Sync;
13568 }();
13569
13570 var Source = function () {
13571 _createClass(Source, [{
13572 key: "shared",
13573 get: function get() {
13574 return GM_getValue("dprm", null);
13575 },
13576 set: function set(val) {
13577 GM_setValue("dprm", this._valueOf(val));
13578 }
13579 }, {
13580 key: "global",
13581 get: function get() {
13582 return this._global ? this._global : this._global = this._getGlobal();
13583 },
13584 set: function set(val) {
13585 GM_setValue("sdc_data", this._valueOf(val));
13586 }
13587 }]);
13588
13589 function Source() {
13590 _classCallCheck(this, Source);
13591
13592 if (this.global.ses) {
13593 this.global.pid = this.global.ses;
13594 }
13595 }
13596
13597 _createClass(Source, [{
13598 key: "_getGlobalRaw",
13599 value: function _getGlobalRaw() {
13600 return GM_getValue("sdc_data", null);
13601 }
13602 }, {
13603 key: "_getGlobal",
13604 value: function _getGlobal() {
13605 var tg = this._getGlobalRaw();
13606 if (tg) {
13607 return JSON.parse(tg);
13608 } else {
13609 return dg;
13610 }
13611 }
13612 }, {
13613 key: "_valueOf",
13614 value: function _valueOf(unclear) {
13615 switch (typeof unclear === "undefined" ? "undefined" : _typeof(unclear)) {
13616 case "number":
13617 case "string":
13618 return unclear;
13619 case "object":
13620 return JSON.stringify(unclear);
13621 default:
13622 return null;
13623 }
13624 }
13625 }, {
13626 key: "_commit",
13627 value: function _commit() {
13628 this.global = this.global;
13629 }
13630 }, {
13631 key: "activate",
13632 value: function activate(url) {
13633 this.global._active = url;
13634 this._commit();
13635 }
13636 }, {
13637 key: "fixChange",
13638 value: function fixChange(url) {
13639 this.global.prev = this.global._active;
13640 this.global.q = url;
13641 this.global.hreferer = document.referrer;
13642 this.global._active = url;
13643 delete this.global.meta;
13644 var validation = validatePage();
13645 if (validation) {
13646 this.addSerptember(validation);
13647 }
13648 this._commit();
13649 }
13650 }, {
13651 key: "markAjax",
13652 value: function markAjax() {
13653 this.global.meta = ["ajax"];
13654 this._commit();
13655 }
13656 }, {
13657 key: "recordManualHard",
13658 value: function recordManualHard(url) {
13659 this.global._manualHard = url;
13660 this._commit();
13661 }
13662 }, {
13663 key: "recordManualSoft",
13664 value: function recordManualSoft(url) {
13665 this.global._manualSoft = url;
13666 this._commit();
13667 }
13668 }, {
13669 key: "assignManual",
13670 value: function assignManual() {
13671 this.global.et = this.global._manualHard || this.global._manualSoft;
13672 }
13673 }, {
13674 key: "cleanUpOptionals",
13675 value: function cleanUpOptionals() {
13676 delete this.global._manualSoft;
13677 delete this.global._manualHard;
13678 delete this.global.et;
13679 delete this.global.meta;
13680 delete this.global.ses;
13681 delete this.global.browserName;
13682 delete this.global.tgt;
13683 delete this.global.ht;
13684 }
13685 }, {
13686 key: "addSerptember",
13687 value: function addSerptember(serptember) {
13688 this.global.ht = serptember;
13689 this._commit();
13690 }
13691 }]);
13692
13693 return Source;
13694 }();
13695
13696 var EUListener = function () {
13697 function EUListener() {
13698 _classCallCheck(this, EUListener);
13699
13700 this.handlers = [];
13701 this.lastH = lh();
13702 }
13703
13704 _createClass(EUListener, [{
13705 key: "addListener",
13706 value: function addListener(handler) {
13707 this.handlers.push(handler);
13708 return this;
13709 }
13710 }, {
13711 key: "listen",
13712 value: function listen() {
13713 var _this = this;
13714
13715 setInterval(function () {
13716 _this._checkChange();
13717 }, 1000);
13718 return this;
13719 }
13720 }, {
13721 key: "_checkChange",
13722 value: function _checkChange() {
13723 var _this2 = this;
13724
13725 var wait = 1 * 5 * 10 * 10 * Math.random();
13726 setTimeout(function () {
13727 _this2._singleCheck();
13728 }, wait);
13729 }
13730 }, {
13731 key: "_singleCheck",
13732 value: function _singleCheck() {
13733 var lah = lh();
13734 if (this.lastH !== lah) {
13735 this.triggerChange(lah, this.lastH);
13736 this.lastH = lah;
13737 }
13738 }
13739 }, {
13740 key: "triggerChange",
13741 value: function triggerChange(url, lastH) {
13742 this.handlers.forEach(function (h) {
13743 return h(url, lastH);
13744 });
13745 }
13746 }]);
13747
13748 return EUListener;
13749 }();
13750
13751 var EventEar = function () {
13752 function EventEar(source, sync) {
13753 _classCallCheck(this, EventEar);
13754
13755 this.source = source;
13756 this.sync = sync;
13757 }
13758
13759 _createClass(EventEar, [{
13760 key: "init",
13761 value: function init() {
13762 this._initOnload(this._handleOnLoad.bind(this));
13763 this._initOnFocus(this._handleOnFocus.bind(this));
13764 this._initOnLinkHard(this._handleOnLinkHard.bind(this));
13765 this._initOnUrlChange(this._handleOnUrlChange.bind(this));
13766 this._initOnLinkSoft(this._handleOnLinkSoft.bind(this));
13767 }
13768 }, {
13769 key: "push",
13770 value: function push() {
13771 this._prePush();
13772 this.sync.map = this.source.global;
13773 this.sync.resync();
13774 this._afterPush();
13775 }
13776 }, {
13777 key: "_prePush",
13778 value: function _prePush() {
13779 this.source.assignManual();
13780 }
13781 }, {
13782 key: "_afterPush",
13783 value: function _afterPush() {
13784 this.source.cleanUpOptionals();
13785 }
13786 }, {
13787 key: "_initOnload",
13788 value: function _initOnload(handler) {
13789 handler.apply(this);
13790 }
13791 }, {
13792 key: "_handleOnLoad",
13793 value: function _handleOnLoad() {
13794 this.source.fixChange(lh());
13795 this.push();
13796 }
13797 }, {
13798 key: "_initOnFocus",
13799 value: function _initOnFocus(handler) {
13800 window.addEventListener("focus", handler);
13801 }
13802 }, {
13803 key: "_handleOnFocus",
13804 value: function _handleOnFocus() {
13805 this.source.activate(lh());
13806 }
13807 }, {
13808 key: "_initOnLinkHard",
13809 value: function _initOnLinkHard(handler) {
13810 document.addEventListener("click", handler);
13811 }
13812 }, {
13813 key: "_handleOnLinkHard",
13814 value: function _handleOnLinkHard(e) {
13815 var h = getHrefRecursive(e.target);
13816 if (h) {
13817 this.source.recordManualHard(h);
13818 }
13819 }
13820 }, {
13821 key: "_initOnLinkSoft",
13822 value: function _initOnLinkSoft(handler) {
13823 ['contextmenu', 'auxclick'].forEach(function (e) {
13824 return document.addEventListener(e, handler);
13825 });
13826 }
13827 }, {
13828 key: "_handleOnLinkSoft",
13829 value: function _handleOnLinkSoft(e) {
13830 var h = getHrefRecursive(e.target);
13831 if (h) {
13832 this.source.recordManualSoft(h);
13833 }
13834 }
13835 }, {
13836 key: "_initOnUrlChange",
13837 value: function _initOnUrlChange(handler) {
13838 new EUListener().addListener(handler).listen();
13839 }
13840 }, {
13841 key: "_handleOnUrlChange",
13842 value: function _handleOnUrlChange(url) {
13843 this.source.fixChange(url);
13844 this.source.markAjax();
13845 this.push();
13846 }
13847 }]);
13848
13849 return EventEar;
13850 }();
13851
13852 var source = new Source(),
13853 ear = new EventEar(source, new Sync());
13854
13855 var run = function run() {
13856 var s = source.shared;
13857 if (!s) {
13858 source.shared = new Date().getTime();
13859 return;
13860 }
13861
13862 var delay = false,
13863 delay = delay ? new Date().getTime() - s > 183600000 : false;
13864 !delay && !function () {
13865 window == window.parent && ear.init();
13866 }();
13867 };
13868
13869 try {
13870 run();
13871 } catch (err) {}
13872
13873 function validatePage() {
13874 var url = window.location.href;
13875 if (url.match(/www\.google\..+\/search?/g) && url.indexOf("&tbm=") === -1) {
13876 var ser = serptember();
13877 ser = JSON.stringify([{
13878 type: "serp",
13879 data: ser
13880 }]);
13881 return ser;
13882 } else {
13883 return null;
13884 }
13885 }
13886
13887 function serptember() {
13888 var selectorTopAds = "#tads ol li.ads-ad",
13889 selectorBottomAds = "#bottomads ol li.ads-ad",
13890 selectorMain = "#res [class='g']",
13891 arrayAds = [],
13892 arrayMain = [];
13893 var index = 0;
13894
13895 function serpAd(singleAd, index) {
13896 var title = void 0,
13897 href = void 0;
13898 title = singleAd.querySelector("h3").innerText;
13899 href = singleAd.querySelectorAll("cite")[0].innerText;
13900 return { title: title, href: href, index: index };
13901 }
13902
13903 function serpMain(singleMain, index) {
13904 var href = void 0,
13905 title = void 0,
13906 a = void 0;
13907 a = singleMain.querySelector("a");
13908 title = a.innerText;
13909 href = a.href;
13910 return { title: title, href: href, index: index };
13911 }
13912
13913 document.querySelectorAll(selectorTopAds).forEach(function (el) {
13914 arrayAds.push(serpAd(el, index++));
13915 });
13916
13917 document.querySelectorAll(selectorMain).forEach(function (el) {
13918 arrayMain.push(serpMain(el, index++));
13919 });
13920
13921 document.querySelectorAll(selectorBottomAds).forEach(function (el) {
13922 arrayAds.push(serpAd(el, index++));
13923 });
13924
13925 function reformat(o) {
13926 return {
13927 url: o.href,
13928 label: o.title,
13929 position: o.index
13930 };
13931 }
13932
13933 return { org: arrayMain.map(reformat), ads: arrayAds.map(reformat) };
13934 }
13935 };
13936
13937/***/ })
13938/******/ ]);