Greasy Fork is available in English.

Popup Blocker Script(备份)

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.

  1. // ==UserScript==
  2. // @name Popup Blocker Script(备份)
  3. // @name:zh-CN 弹窗阻止程序脚本(备份)
  4. // @namespace https://popupblockerscript.com/
  5. // @version 0.2.0
  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==
  24. const 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. "CN":{
  43. "notificationMessage": {
  44. "message": "弹窗被阻止"
  45. },
  46. "overlayWasBlocked": {
  47. "message": "叠加弹窗被阻止"
  48. },
  49. "allowOnce": {
  50. "message": "显示一次弹窗"
  51. },
  52. "allowAlways": {
  53. "message": "允许此网站上的弹窗"
  54. },
  55. "NTF_allowOverlayOnce": {
  56. "message": "显示一次弹窗"
  57. }
  58. }
  59. };
  60. /******/ (function(modules) { // webpackBootstrap
  61. /******/ // The module cache
  62. /******/ var installedModules = {};
  63.  
  64. /******/ // The require function
  65. /******/ function __webpack_require__(moduleId) {
  66.  
  67. /******/ // Check if module is in cache
  68. /******/ if(installedModules[moduleId])
  69. /******/ return installedModules[moduleId].exports;
  70.  
  71. /******/ // Create a new module (and put it into the cache)
  72. /******/ var module = installedModules[moduleId] = {
  73. /******/ exports: {},
  74. /******/ id: moduleId,
  75. /******/ loaded: false
  76. /******/ };
  77.  
  78. /******/ // Execute the module function
  79. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  80.  
  81. /******/ // Flag the module as loaded
  82. /******/ module.loaded = true;
  83.  
  84. /******/ // Return the exports of the module
  85. /******/ return module.exports;
  86. /******/ }
  87.  
  88.  
  89. /******/ // expose the modules object (__webpack_modules__)
  90. /******/ __webpack_require__.m = modules;
  91.  
  92. /******/ // expose the module cache
  93. /******/ __webpack_require__.c = installedModules;
  94.  
  95. /******/ // __webpack_public_path__
  96. /******/ __webpack_require__.p = "";
  97.  
  98. /******/ // Load entry module and return exports
  99. /******/ return __webpack_require__(0);
  100. /******/ })
  101. /************************************************************************/
  102. /******/ ([
  103. /* 0 */
  104. /***/ (function(module, exports, __webpack_require__) {
  105.  
  106. 'use strict';
  107.  
  108. __webpack_require__(1);
  109.  
  110. /***/ }),
  111. /* 1 */
  112. /***/ (function(module, exports, __webpack_require__) {
  113.  
  114. "use strict";
  115.  
  116. var _overlayKiller = __webpack_require__(2);
  117.  
  118. var _overlayKiller2 = _interopRequireDefault(_overlayKiller);
  119.  
  120. var _inject = __webpack_require__(5);
  121.  
  122. var _ntfShowManager = __webpack_require__(6);
  123.  
  124. var _ntfShowManager2 = _interopRequireDefault(_ntfShowManager);
  125.  
  126. var _notification = __webpack_require__(7);
  127.  
  128. var _notification2 = _interopRequireDefault(_notification);
  129.  
  130. var _storage = __webpack_require__(4);
  131.  
  132. var _storage2 = _interopRequireDefault(_storage);
  133.  
  134. var _const = __webpack_require__(9);
  135.  
  136. var _const2 = _interopRequireDefault(_const);
  137.  
  138. var _attract = __webpack_require__(10);
  139.  
  140. var _attract2 = _interopRequireDefault(_attract);
  141.  
  142. var _utils = __webpack_require__(8);
  143.  
  144. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  145.  
  146. (function ($) {
  147. 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}");
  148.  
  149. var pbMessage = (0, _utils.randId)();
  150.  
  151. var ntfShowManager = new _ntfShowManager2.default();
  152.  
  153. var notification = new _notification2.default({
  154. onDisplay: function onDisplay(_ref) {
  155. var source = _ref.source;
  156.  
  157. switch (source) {
  158. case 'popup-blocked':
  159. //sendGoogleAnalyticsEvent({category: 'Notification_bar', action: 'Shown'});
  160. break;
  161.  
  162. case 'recipe-blocked':
  163. //sendGoogleAnalyticsEvent({category: 'Notification_bar_overlay', action: 'Shown'});
  164. break;
  165. }
  166. },
  167. onCloseClick: function onCloseClick(_ref2) {
  168. var source = _ref2.source;
  169.  
  170. switch (source) {
  171. case 'popup-blocked':
  172. //sendGoogleAnalyticsEvent({category: 'Notification_bar', action: 'Click', label: 'Close', domain: document.domain });
  173. break;
  174.  
  175. case 'recipe-blocked':
  176. //sendGoogleAnalyticsEvent({category: 'Notification_bar_overlay', action: 'Click', label: 'Close'});
  177. break;
  178. }
  179. },
  180. onButtonClick: function onButtonClick(_ref3) {
  181. var source = _ref3.source,
  182. id = _ref3.id;
  183.  
  184. switch (source) {
  185. case 'popup-blocked':
  186. switch (id) {
  187. case 'allowOnce':
  188. //sendGoogleAnalyticsEvent({category: 'Notification_bar', action: 'Click', label: 'Allow once'});
  189. break;
  190.  
  191. case 'allowAlways':
  192. //sendGoogleAnalyticsEvent({category: 'Notification_bar', action: 'Click', label: 'Allow always'});
  193. break;
  194. }
  195. break;
  196.  
  197. case 'recipe-blocked':
  198. switch (id) {
  199. case 'NTF_allowOverlayOnce':
  200. //sendGoogleAnalyticsEvent({category: 'Notification_bar_overlay', action: 'Click', label: 'Allow once'});
  201. break;
  202. }
  203. break;
  204. }
  205. }
  206. });
  207.  
  208. var overlayKiller = new _overlayKiller2.default({
  209. onRecipeFound: function onRecipeFound(_ref4) {
  210. var found = _ref4.found;
  211.  
  212. ntfShowManager.isShow({ domain: document.domain, type: 'overlay' }).then(function () {
  213. showRecipeOverlayNortification();
  214. });
  215. }
  216. });
  217.  
  218. var receivedRecipes = function receivedRecipes(data) {
  219. var recepies = (data || {}).recipes || [];
  220.  
  221. if (recepies.length) {
  222. overlayKiller.createBlockListFromRecepies(recepies);
  223. }
  224. };
  225.  
  226. parsePendingNotificationParams();
  227.  
  228. function monitorBlocks() {
  229. window.addEventListener("message", function receiveMessage(event) {
  230. if (event.data.type && event.data.type == "blockedWindow") {
  231. if (self !== top) {
  232. //pass the message to parent
  233. var parentOrigin = window.location != window.parent.location ? document.referrer : document.location;
  234. parent.postMessage({ type: "blockedWindow", args: event.data.args }, parentOrigin);
  235. return;
  236. }
  237.  
  238. var args = JSON.parse(event.data.args);
  239.  
  240. ntfShowManager.isShow({ domain: document.domain }).then(function () {
  241. showPopupBlockedNotification(args, { domain: document.domain });
  242. });
  243.  
  244. if (ntfShowManager.isActive) {
  245. setPendingNotificationParams(args);
  246. }
  247.  
  248. //sendGoogleAnalyticsEvent({category: "General", action: "Blocked_popups", label: document.domain});
  249. }
  250. }, false);
  251. }
  252.  
  253. //show notifcation after a force redirect of a site
  254. //every time a popup is being block this function runs
  255. //args = popup details (url, name, props)
  256. function setPendingNotificationParams(args) {
  257. var pop = (args[0] || '') + "|" + (args[1] || '') + "|" + (args[2] || '');
  258. var relatedLink = args[3] || '';
  259. var currentHost = location.host;
  260. var popHost = new URL((0, _utils.getAbsoluteURL)(args[0])).host;
  261. //check if the popup is the same host that the current domain
  262. //this flags this as a potential pattern of: open the site's page as a popup and redirect to an ad
  263. var isSameHostPopup = popHost == currentHost;
  264. //check if ad block found - this makes sites to be more agreesive with popups
  265. var abd = args['abd'] ? 1 : 0;
  266. var data = {
  267. pop: pop,
  268. relatedLink: relatedLink,
  269. host: currentHost,
  270. isSameHostPopup: isSameHostPopup,
  271. abd: abd,
  272. time: Date.now()
  273. };
  274.  
  275. //store it all in window.name, this will remain even if the site is redirected
  276. window.name = "pp_pending_ntf:" + btoa(JSON.stringify(data));
  277.  
  278. //to prevent a false positive
  279. //if same url popup is detected and the user creates a "redirect"
  280. //by clicking a link, this should prevent to send the user back to the origin site
  281. if (data.isSameHostPopup) {
  282. $(document).on('click', function (e) {
  283. if (e.target.nodeName == 'A') {
  284. removePendingNotificationParams();
  285. }
  286. });
  287. }
  288. }
  289.  
  290. //this runs on every page load
  291. function parsePendingNotificationParams() {
  292. if (window.name && window.name.indexOf('pp_pending_ntf:') == 0) {
  293. var data = JSON.parse(atob(name.split(':')[1]));
  294. var fnRemove = function fnRemove() {
  295. removePendingNotificationParams();
  296.  
  297. $(document).off('click', fnRemove);
  298. };
  299.  
  300. //max 5000 ms between popup block and page load
  301. if (data.time + 5000 >= Date.now()) {
  302. //force display the notification
  303. if (data.display) {
  304. ntfShowManager.isShow({ domain: document.domain }).then(function () {
  305. showPopupBlockedNotification(data.pop.split('|'), { preventDisplayEvent: true, quickOpen: true, domain: document.domain });
  306. });
  307.  
  308. removePendingNotificationParams();
  309. } else {
  310. var isExternalSite = false;
  311.  
  312. if (data.host != location.host) {
  313. isExternalSite = true;
  314. }
  315.  
  316. //self popup + redirect pattern - return user to the popup url and block the redirected site
  317. if (isExternalSite && data.abd) {
  318. var url = data.pop.split('|')[0];
  319.  
  320. if (data.isSameHostPopup) {
  321. setSingleDisplayNotificationParams();
  322.  
  323. location.href = url;
  324. } else if (/^about:blank/i.test(url) && data.relatedLink) {
  325. setSingleDisplayNotificationParams();
  326.  
  327. location.href = data.relatedLink;
  328. }
  329. } else {
  330. ntfShowManager.isShow({ domain: isExternalSite ? data.host : document.domain }).then(function () {
  331. showPopupBlockedNotification(data.pop.split('|'), { preventDisplayEvent: true, quickOpen: true, domain: isExternalSite ? data.host : document.domain });
  332. });
  333.  
  334. $(document).on('click', fnRemove);
  335. }
  336. }
  337. } else {
  338. removePendingNotificationParams();
  339. }
  340. }
  341. }
  342.  
  343. function setSingleDisplayNotificationParams() {
  344. var data = {
  345. pop: location.href + '||',
  346. display: true,
  347. time: Date.now()
  348. };
  349.  
  350. window.name = 'pp_pending_ntf:' + btoa(JSON.stringify(data));
  351. }
  352.  
  353. function removePendingNotificationParams() {
  354. if (window.name && window.name.indexOf("pp_pending_ntf:") == 0) {
  355. window.name = "";
  356. }
  357. }
  358.  
  359. //popup blocked notification
  360. function showPopupBlockedNotification(args) {
  361. var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  362.  
  363. var domain = props.domain;
  364.  
  365. notification.show({
  366. title: (0, _utils.getI18N)('notificationMessage'),
  367. quickOpen: props.quickOpen,
  368. showHide: true,
  369. showResize: true,
  370. source: 'popup-blocked',
  371. winArgs: args, //pop url / name / width + height
  372. onClose: function onClose() {
  373. removePendingNotificationParams();
  374. },
  375.  
  376. buttons: {
  377. allowOnce: function allowOnce() {
  378. ntfShowManager.isActive = true;
  379. },
  380. allowAlways: function allowAlways() {
  381. _storage2.default.get('pb_whitelist').then(function () {
  382. var whitelist = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  383.  
  384. whitelist.push(domain);
  385.  
  386. _storage2.default.set('pb_whitelist', whitelist);
  387. });
  388.  
  389. if (!props.isExternalSite) {
  390. (0, _utils.executeCode)("window.pbExternalCommand(0, \"" + pbMessage + "\");");
  391. }
  392. }
  393. }
  394. });
  395. }
  396.  
  397. //an overlay blocked by recipe notification
  398. function showRecipeOverlayNortification() {
  399. notification.show({
  400. title: (0, _utils.getI18N)("overlayWasBlocked"),
  401. source: 'recipe-blocked',
  402. showHide: true,
  403. showResize: true,
  404. buttons: {
  405. NTF_allowOverlayOnce: function NTF_allowOverlayOnce() {
  406. overlayKiller.restore();
  407. }
  408. }
  409. });
  410. }
  411.  
  412. function sendGoogleAnalyticsEvent(data) {
  413. var _data$domain = data.domain,
  414. domain = _data$domain === undefined ? document.domain : _data$domain;
  415.  
  416.  
  417. sendMessageToBackground({
  418. name: "trackEvent",
  419. category: data.category,
  420. action: data.action,
  421. label: data.label,
  422. isCount: data.isCount,
  423. domain: domain
  424. });
  425. }
  426.  
  427. function initBlockFunctions() {
  428. _storage2.default.get('pb_whitelist', 'pb_overlaylist', 'pb_popupBlackList').then(function (settings) {
  429. settings.pb_whitelist = settings.pb_whitelist || [];
  430. settings.pb_overlaylist = settings.pb_overlaylist || [];
  431. settings.pb_popupBlackList = settings.pb_popupBlackList || [];
  432.  
  433. var whitelist = settings.pb_whitelist.concat(_const2.default.defaultWhiteList);
  434.  
  435. if (!(0, _utils.isDomainInList)(document.domain, whitelist)) {
  436. 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 })();";
  437.  
  438. (0, _utils.executeCode)(code);
  439.  
  440. /*addScript({textContent: `${inject.toString()}`, id: "pb_blockScript"});
  441. executeCode("var pb_blacklist = " + JSON.stringify(settings.pb_popupBlackList));
  442. executeCode("var pb_whitelist = " + JSON.stringify(whitelist));
  443. executeCode("inject()");*/
  444. monitorBlocks(); // Previously this only ran if window = parent
  445. }
  446. });
  447. }
  448.  
  449. initBlockFunctions();
  450.  
  451. // blocking popups - START
  452. _storage2.default.get('pb_whitelist').then(function () {
  453. var whitelist = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  454. //get whitelist
  455. whitelist = whitelist.concat(_const2.default.defaultWhiteList);
  456.  
  457. if (!(0, _utils.isDomainInList)(document.domain, whitelist)) {
  458. //if not in the whitelist
  459. $("html").on("click", "a", onHyperLinkClicked); // listen to all link elements's click event
  460. }
  461. });
  462.  
  463. function isOverlayish(el) {
  464. var winWidth = window.innerWidth;
  465. var winHeight = window.innerHeight;
  466.  
  467. if (el.outerWidth() >= winWidth * 0.6 && el.outerHeight() >= winHeight * 0.75) {
  468. return true;
  469. }
  470.  
  471. return false;
  472. }
  473.  
  474. function onHyperLinkClicked(e) {
  475. var el = $(this);
  476. var href = el.attr('href');
  477. var target = el.attr('target') || '_self';
  478.  
  479. if (href && href !== '#' && target !== '_self') {
  480. //only if has href and open in new tab/window
  481. if (isOverlayish(el)) {
  482. e.preventDefault();
  483.  
  484. parent.postMessage({
  485. type: "blockedWindow",
  486. args: JSON.stringify({ "0": href })
  487. }, window.parent.location);
  488. }
  489. }
  490. }
  491. // blocking popups - END
  492.  
  493. function openUrl(url, notNewTab) {
  494. sendMessageToBackground({ name: "openUrl", url: url, notNewTab: notNewTab });
  495. }
  496.  
  497. //#TEMP
  498. (function () {
  499. (0, _attract2.default)(function (d) {
  500. /*console.log(typeof d, d);*/receivedRecipes(d);
  501. });
  502. })();
  503. })(jQuery.noConflict(true));
  504.  
  505. /*if (window == top) {
  506. setTimeout(() =>{
  507. window.onfocus = () =>{
  508. sendMessageToBackground({name: "page", url: window.location.href});
  509. };
  510. }, 2000);
  511.  
  512. window.onbeforeunload = () =>{
  513. sendMessageToBackground({name: "pageClosing", url: window.location.href});
  514. return null;
  515. };
  516. }
  517.  
  518. function sendMessageToBackground(message){
  519. chrome.runtime.sendMessage(message);
  520. }*/
  521.  
  522. /***/ }),
  523. /* 2 */
  524. /***/ (function(module, exports, __webpack_require__) {
  525.  
  526. 'use strict';
  527.  
  528. Object.defineProperty(exports, "__esModule", {
  529. value: true
  530. });
  531.  
  532. 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; }; }();
  533.  
  534. var _jQuery = __webpack_require__(3);
  535.  
  536. var _jQuery2 = _interopRequireDefault(_jQuery);
  537.  
  538. var _storage = __webpack_require__(4);
  539.  
  540. var _storage2 = _interopRequireDefault(_storage);
  541.  
  542. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  543.  
  544. 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); } }
  545.  
  546. 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; }
  547.  
  548. 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; }
  549.  
  550. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  551.  
  552. 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;
  553.  
  554. var OverlayDectector = function () {
  555. function OverlayDectector() {
  556. _classCallCheck(this, OverlayDectector);
  557.  
  558. this.winWidth = window.innerWidth;
  559. this.winHeight = window.innerHeight;
  560. }
  561.  
  562. _createClass(OverlayDectector, [{
  563. key: 'ALGO2',
  564. value: function ALGO2(_ref) {
  565. var x = _ref.x,
  566. y = _ref.y,
  567. mw = _ref.mw,
  568. mh = _ref.mh;
  569.  
  570. var element = document.elementFromPoint(x, y);
  571. var overlay = void 0;
  572.  
  573. if (element && this.notRootElement(element)) {
  574. do {
  575. var isOverlayish = this.isOverlayish({ el: element, minWidth: mw, minHeight: mh });
  576.  
  577. if (isOverlayish) {
  578. overlay = element;
  579. }
  580.  
  581. element = element.parentNode;
  582. } while (!overlay && this.notRootElement(element));
  583. }
  584.  
  585. return overlay;
  586. }
  587. }, {
  588. key: 'notRootElement',
  589. value: function notRootElement(element) {
  590. return element != document.body && element != document && element != document.documentElement;
  591. }
  592. }, {
  593. key: 'detectOverlayLayer',
  594. value: function detectOverlayLayer(detectRange) {
  595. var _iteratorNormalCompletion = true;
  596. var _didIteratorError = false;
  597. var _iteratorError = undefined;
  598.  
  599. try {
  600. for (var _iterator = detectRange[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
  601. var coords = _step.value;
  602.  
  603. var overlay = this.ALGO2(coords);
  604.  
  605. if (overlay) {
  606. return this.getRecipe(overlay);
  607. }
  608. }
  609. } catch (err) {
  610. _didIteratorError = true;
  611. _iteratorError = err;
  612. } finally {
  613. try {
  614. if (!_iteratorNormalCompletion && _iterator.return) {
  615. _iterator.return();
  616. }
  617. } finally {
  618. if (_didIteratorError) {
  619. throw _iteratorError;
  620. }
  621. }
  622. }
  623.  
  624. return false;
  625. }
  626. }, {
  627. key: 'find',
  628. value: function find() {
  629. var detect = {
  630. 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 }],
  631. FullScreen: [{ x: this.winWidth / 2, y: this.winHeight / 2, mw: this.winHeight * 0.9, mh: this.winHeight * 0.9 }]
  632. };
  633. var overlays = [],
  634. recipe = void 0;
  635.  
  636. recipe = this.detectOverlayLayer(detect.AnySize);
  637.  
  638. if (recipe) {
  639. overlays.push(this.hideByRecipe(recipe));
  640.  
  641. recipe = this.detectOverlayLayer(detect.FullScreen);
  642.  
  643. if (recipe) {
  644. overlays.push(this.hideByRecipe(recipe));
  645. }
  646. }
  647.  
  648. return overlays;
  649. }
  650. }, {
  651. key: 'getRecipe',
  652. value: function getRecipe(el) {
  653. var recipe = [];
  654. var isSingleInstanceInDocument = function isSingleInstanceInDocument(recipe) {
  655. return (0, _jQuery2.default)(recipe.join(' > ')).length == 1;
  656. };
  657.  
  658. do {
  659. var node = el.nodeName.toLowerCase();
  660. var id = el.getAttribute('id');
  661. var className = el.getAttribute('class');
  662. var style = el.getAttribute('style');
  663.  
  664. if (id) {
  665. recipe.unshift('#' + id.trim());
  666.  
  667. break;
  668. } else if (className) {
  669. recipe.unshift(node + '.' + className.trim().replace(/\s+/g, '.'));
  670. } else {
  671. recipe.unshift(node + '[style="' + style + '"]');
  672. }
  673.  
  674. if (isSingleInstanceInDocument(recipe)) {
  675. break;
  676. }
  677.  
  678. el = el.parentNode;
  679. } while (el != document.body);
  680.  
  681. if (isSingleInstanceInDocument(recipe)) {
  682. return recipe.join(' > ');
  683. }
  684.  
  685. return false;
  686. }
  687. }, {
  688. key: 'hideByRecipe',
  689. value: function hideByRecipe(recipe) {
  690. var el = (0, _jQuery2.default)(recipe);
  691. var css = el.prop('style').cssText;
  692.  
  693. el.prop('style').cssText = css + ';display:none !important;';
  694.  
  695. return { el: el, recipe: recipe, css: css };
  696. }
  697. }, {
  698. key: 'isOverlayish',
  699. value: function isOverlayish(_ref2) {
  700. var el = _ref2.el,
  701. minWidth = _ref2.minWidth,
  702. minHeight = _ref2.minHeight;
  703.  
  704. var css = window.getComputedStyle(el);
  705.  
  706. 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) {
  707. return [el, css.zIndex * 1];
  708. }
  709.  
  710. return false;
  711. }
  712. }]);
  713.  
  714. return OverlayDectector;
  715. }();
  716.  
  717. var OverlayKiller = function (_OverlayDectector) {
  718. _inherits(OverlayKiller, _OverlayDectector);
  719.  
  720. function OverlayKiller() {
  721. var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  722.  
  723. _classCallCheck(this, OverlayKiller);
  724.  
  725. var _this = _possibleConstructorReturn(this, (OverlayKiller.__proto__ || Object.getPrototypeOf(OverlayKiller)).call(this));
  726.  
  727. _this.activeBlockList = [];
  728. _this.activeRecepiesList = [];
  729.  
  730. _this.onAutoDetect = props.onAutoDetect || function () {};
  731. _this.onUserRemove = props.onUserRemove || function () {};
  732. _this.onBlockListFound = props.onBlockListFound || function () {};
  733. _this.onRecipeFound = props.onRecipeFound || function () {};
  734. _this.onRecipeNotFound = props.onRecipeNotFound || function () {};
  735.  
  736. _this.blackListPromise = _this.createBlockListFromStorage();
  737.  
  738. if (window == top) {
  739. _this.autoDetect();
  740. }
  741. return _this;
  742. }
  743.  
  744. _createClass(OverlayKiller, [{
  745. key: 'hide',
  746. value: function hide(recepies) {
  747. var _this2 = this;
  748.  
  749. this.last = [];
  750.  
  751. recepies.forEach(function (recipe) {
  752. _this2.last.push(_this2.hideByRecipe(recipe));
  753. });
  754. }
  755. }, {
  756. key: 'restore',
  757. value: function restore() {
  758. this.last.forEach(function (item) {
  759. var el = item.el,
  760. recipe = item.recipe,
  761. css = item.css;
  762.  
  763.  
  764. el.prop('style').cssText = css + ';display: block';
  765.  
  766. [].concat(_toConsumableArray((0, _jQuery2.default)('style.pp-remove-overlay'))).forEach(function (style) {
  767. style = (0, _jQuery2.default)(style);
  768.  
  769. if (style.data('recipe') == btoa(recipe)) {
  770. (0, _jQuery2.default)(style).remove();
  771. }
  772. });
  773. });
  774.  
  775. window.dispatchEvent(new Event('resize')); //sometimes this makes the overlay to be centered properly when restored
  776. }
  777.  
  778. // ======= remove overlay triggered by user ==========
  779.  
  780. }, {
  781. key: 'remove',
  782. value: function remove() {
  783. var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  784.  
  785. var overlays = this.find();
  786.  
  787. if (overlays.length) {
  788. this.last = overlays;
  789.  
  790. this.createGlobalCSS();
  791. this.onUserRemove({ success: true, recepies: overlays.map(function (o) {
  792. return o.recipe;
  793. }), props: props });
  794. } else {
  795. this.onUserRemove({ success: false, props: props });
  796. }
  797. }
  798.  
  799. // ===== add found overlay to local blacklist, <remove always> button from notification
  800.  
  801. }, {
  802. key: 'addToLocalBlacklist',
  803. value: function addToLocalBlacklist() {
  804. var _this3 = this;
  805.  
  806. var domain = document.domain;
  807. var url = location.href;
  808.  
  809. PBStorageSync.pb_overlayBlockedList.update(function () {
  810. var list = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  811.  
  812. var blocks = list[domain] || [];
  813.  
  814. blocks.push({
  815. id: 'block-' + blocks.length,
  816. url: url,
  817. domain: domain,
  818. recipe: _this3.last.map(function (item) {
  819. return item.recipe;
  820. }).join(', ')
  821. });
  822.  
  823. list[domain] = blocks;
  824.  
  825. return list;
  826. });
  827. }
  828.  
  829. // ===== remove overlay from local blacklist
  830.  
  831. }, {
  832. key: 'removeFromLocalBlacklist',
  833. value: function removeFromLocalBlacklist() {
  834. var _this4 = this;
  835.  
  836. var domain = document.domain;
  837.  
  838. PBStorageSync.pb_overlayBlockedList.update(function () {
  839. var list = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  840.  
  841. var blocks = list[domain] || [];
  842. var lastRecepies = _this4.last.map(function (item) {
  843. return item.recipe;
  844. });
  845.  
  846. blocks = blocks.filter(function (item) {
  847. return lastRecepies.indexOf(item.recipe) == -1;
  848. });
  849.  
  850. list[domain] = blocks;
  851.  
  852. return list;
  853. });
  854. }
  855.  
  856. // ======= auto actions ==========
  857.  
  858. }, {
  859. key: 'autoDetect',
  860. value: function autoDetect() {
  861. var _this5 = this;
  862.  
  863. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
  864.  
  865. if (attempt < 40) {
  866. //let overlay = this.find();
  867. var foundBlockList = this.forceBlock(this.activeBlockList);
  868. var foundRecipeList = this.forceBlock(this.activeRecepiesList);
  869.  
  870. /*if (overlay && !this.autoDetected) {
  871. let recipe = btoa(this.getRecipe(overlay));
  872. this.onAutoDetect(recipe);
  873. this.autoDetected = true;
  874. }*/
  875.  
  876. if (foundBlockList.length) {
  877. this.onBlockListFound({ found: foundBlockList });
  878. }
  879.  
  880. if (foundRecipeList.length) {
  881. this.onRecipeFound({ found: foundRecipeList });
  882. }
  883.  
  884. setTimeout(function () {
  885. _this5.autoDetect(++attempt);
  886. }, 250);
  887. } else {
  888. this.checkRecepiesSuccess();
  889. }
  890. }
  891.  
  892. //auto block all overlays from local db
  893.  
  894. }, {
  895. key: 'createBlockListFromStorage',
  896. value: function createBlockListFromStorage() {
  897. var _this6 = this;
  898.  
  899. return new _Promise(function (resolve) {
  900. _storage2.default.get('pb_overlayBlockedList').then(function () {
  901. var list = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  902.  
  903. if (list[document.domain]) {
  904. _this6.activeBlockList = list[document.domain];
  905.  
  906. _this6.createBlockCSS(_this6.activeBlockList);
  907. }
  908.  
  909. resolve();
  910. });
  911. });
  912. }
  913.  
  914. //block all overlays found in recepies
  915.  
  916. }, {
  917. key: 'createBlockListFromRecepies',
  918. value: function createBlockListFromRecepies(recepies) {
  919. var _this7 = this;
  920.  
  921. //local blacklist needs to be loaded before handeling recepies
  922. this.blackListPromise.then(function () {
  923. var blockList = _this7.activeBlockList.map(function (item) {
  924. return item.recipe;
  925. });
  926.  
  927. recepies = recepies.map(function (recipe) {
  928. return {
  929. recipe: recipe,
  930. found: false
  931. };
  932. }).filter(function (item) {
  933. return blockList.indexOf(item.recipe) == -1;
  934. });
  935.  
  936. _this7.activeRecepiesList = recepies;
  937.  
  938. _this7.createBlockCSS(recepies);
  939. });
  940. }
  941.  
  942. //checks what recepies were found / not found and report
  943.  
  944. }, {
  945. key: 'checkRecepiesSuccess',
  946. value: function checkRecepiesSuccess() {
  947. var notFound = this.activeRecepiesList.filter(function (item) {
  948. return !item.found;
  949. });
  950.  
  951. if (notFound.length) {
  952. this.onRecipeNotFound(notFound);
  953. }
  954. }
  955. }, {
  956. key: 'createGlobalCSS',
  957. value: function createGlobalCSS() {
  958. var htmlStyle = (0, _jQuery2.default)('html').attr('style');
  959. var bodyStyle = (0, _jQuery2.default)('body').attr('style');
  960.  
  961. (0, _jQuery2.default)('<style type="text/css">html, body {overflow:auto !important; }</style>').appendTo('head');
  962. (0, _jQuery2.default)('html').attr('style', (htmlStyle ? htmlStyle + ';' : '') + 'overflow:auto !important;');
  963. (0, _jQuery2.default)('body').attr('style', (bodyStyle ? bodyStyle + ';' : '') + 'overflow:auto !important;');
  964. }
  965.  
  966. //blocks overlays with css for faster blocking
  967.  
  968. }, {
  969. key: 'createBlockCSS',
  970. value: function createBlockCSS(list) {
  971. this.createGlobalCSS();
  972.  
  973. list.forEach(function (item) {
  974. var css = item.recipe + ' { display:none !important; }';
  975.  
  976. (0, _jQuery2.default)('<style class="pp-remove-overlay" data-recipe="' + btoa(item.recipe) + '" type="text/css">' + css + '</style>').appendTo('head');
  977. });
  978. }
  979.  
  980. // ========= if block by css doesn't work, this will work, but only after DOM ready
  981.  
  982. }, {
  983. key: 'forceBlock',
  984. value: function forceBlock(list) {
  985. var hide = [];
  986.  
  987. list.filter(function (item) {
  988. return !item.found;
  989. }).forEach(function (item) {
  990. var overlay = (0, _jQuery2.default)(item.recipe);
  991.  
  992. if (overlay.length) {
  993. item.found = true;
  994.  
  995. hide.push(item.recipe);
  996. }
  997. });
  998.  
  999. if (hide.length) {
  1000. this.hide(hide);
  1001. }
  1002.  
  1003. return hide;
  1004. }
  1005. }]);
  1006.  
  1007. return OverlayKiller;
  1008. }(OverlayDectector);
  1009.  
  1010. exports.default = OverlayKiller;
  1011.  
  1012. /***/ }),
  1013. /* 3 */
  1014. /***/ (function(module, exports, __webpack_require__) {
  1015.  
  1016. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  1017. * jQuery JavaScript Library v1.12.4
  1018. * http://jquery.com/
  1019. *
  1020. * Includes Sizzle.js
  1021. * http://sizzlejs.com/
  1022. *
  1023. * Copyright jQuery Foundation and other contributors
  1024. * Released under the MIT license
  1025. * http://jquery.org/license
  1026. *
  1027. * Date: 2016-05-20T17:17Z
  1028. */
  1029.  
  1030. (function( global, factory ) {
  1031.  
  1032. if ( typeof module === "object" && typeof module.exports === "object" ) {
  1033. // For CommonJS and CommonJS-like environments where a proper `window`
  1034. // is present, execute the factory and get jQuery.
  1035. // For environments that do not have a `window` with a `document`
  1036. // (such as Node.js), expose a factory as module.exports.
  1037. // This accentuates the need for the creation of a real `window`.
  1038. // e.g. var jQuery = require("jquery")(window);
  1039. // See ticket #14549 for more info.
  1040. module.exports = global.document ?
  1041. factory( global, true ) :
  1042. function( w ) {
  1043. if ( !w.document ) {
  1044. throw new Error( "jQuery requires a window with a document" );
  1045. }
  1046. return factory( w );
  1047. };
  1048. } else {
  1049. factory( global );
  1050. }
  1051.  
  1052. // Pass this if window is not defined yet
  1053. }(typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  1054.  
  1055. // Support: Firefox 18+
  1056. // Can't be in strict mode, several libs including ASP.NET trace
  1057. // the stack via arguments.caller.callee and Firefox dies if
  1058. // you try to trace through "use strict" call chains. (#13335)
  1059. //"use strict";
  1060. var deletedIds = [];
  1061.  
  1062. var document = window.document;
  1063.  
  1064. var slice = deletedIds.slice;
  1065.  
  1066. var concat = deletedIds.concat;
  1067.  
  1068. var push = deletedIds.push;
  1069.  
  1070. var indexOf = deletedIds.indexOf;
  1071.  
  1072. var class2type = {};
  1073.  
  1074. var toString = class2type.toString;
  1075.  
  1076. var hasOwn = class2type.hasOwnProperty;
  1077.  
  1078. var support = {};
  1079.  
  1080.  
  1081.  
  1082. var
  1083. version = "1.12.4",
  1084.  
  1085. // Define a local copy of jQuery
  1086. jQuery = function( selector, context ) {
  1087.  
  1088. // The jQuery object is actually just the init constructor 'enhanced'
  1089. // Need init if jQuery is called (just allow error to be thrown if not included)
  1090. return new jQuery.fn.init( selector, context );
  1091. },
  1092.  
  1093. // Support: Android<4.1, IE<9
  1094. // Make sure we trim BOM and NBSP
  1095. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
  1096.  
  1097. // Matches dashed string for camelizing
  1098. rmsPrefix = /^-ms-/,
  1099. rdashAlpha = /-([\da-z])/gi,
  1100.  
  1101. // Used by jQuery.camelCase as callback to replace()
  1102. fcamelCase = function( all, letter ) {
  1103. return letter.toUpperCase();
  1104. };
  1105.  
  1106. jQuery.fn = jQuery.prototype = {
  1107.  
  1108. // The current version of jQuery being used
  1109. jquery: version,
  1110.  
  1111. constructor: jQuery,
  1112.  
  1113. // Start with an empty selector
  1114. selector: "",
  1115.  
  1116. // The default length of a jQuery object is 0
  1117. length: 0,
  1118.  
  1119. toArray: function() {
  1120. return slice.call( this );
  1121. },
  1122.  
  1123. // Get the Nth element in the matched element set OR
  1124. // Get the whole matched element set as a clean array
  1125. get: function( num ) {
  1126. return num != null ?
  1127.  
  1128. // Return just the one element from the set
  1129. ( num < 0 ? this[ num + this.length ] : this[ num ] ) :
  1130.  
  1131. // Return all the elements in a clean array
  1132. slice.call( this );
  1133. },
  1134.  
  1135. // Take an array of elements and push it onto the stack
  1136. // (returning the new matched element set)
  1137. pushStack: function( elems ) {
  1138.  
  1139. // Build a new jQuery matched element set
  1140. var ret = jQuery.merge( this.constructor(), elems );
  1141.  
  1142. // Add the old object onto the stack (as a reference)
  1143. ret.prevObject = this;
  1144. ret.context = this.context;
  1145.  
  1146. // Return the newly-formed element set
  1147. return ret;
  1148. },
  1149.  
  1150. // Execute a callback for every element in the matched set.
  1151. each: function( callback ) {
  1152. return jQuery.each( this, callback );
  1153. },
  1154.  
  1155. map: function( callback ) {
  1156. return this.pushStack( jQuery.map( this, function( elem, i ) {
  1157. return callback.call( elem, i, elem );
  1158. } ) );
  1159. },
  1160.  
  1161. slice: function() {
  1162. return this.pushStack( slice.apply( this, arguments ) );
  1163. },
  1164.  
  1165. first: function() {
  1166. return this.eq( 0 );
  1167. },
  1168.  
  1169. last: function() {
  1170. return this.eq( -1 );
  1171. },
  1172.  
  1173. eq: function( i ) {
  1174. var len = this.length,
  1175. j = +i + ( i < 0 ? len : 0 );
  1176. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  1177. },
  1178.  
  1179. end: function() {
  1180. return this.prevObject || this.constructor();
  1181. },
  1182.  
  1183. // For internal use only.
  1184. // Behaves like an Array's method, not like a jQuery method.
  1185. push: push,
  1186. sort: deletedIds.sort,
  1187. splice: deletedIds.splice
  1188. };
  1189.  
  1190. jQuery.extend = jQuery.fn.extend = function() {
  1191. var src, copyIsArray, copy, name, options, clone,
  1192. target = arguments[ 0 ] || {},
  1193. i = 1,
  1194. length = arguments.length,
  1195. deep = false;
  1196.  
  1197. // Handle a deep copy situation
  1198. if ( typeof target === "boolean" ) {
  1199. deep = target;
  1200.  
  1201. // skip the boolean and the target
  1202. target = arguments[ i ] || {};
  1203. i++;
  1204. }
  1205.  
  1206. // Handle case when target is a string or something (possible in deep copy)
  1207. if ( typeof target !== "object" && !jQuery.isFunction( target ) ) {
  1208. target = {};
  1209. }
  1210.  
  1211. // extend jQuery itself if only one argument is passed
  1212. if ( i === length ) {
  1213. target = this;
  1214. i--;
  1215. }
  1216.  
  1217. for ( ; i < length; i++ ) {
  1218.  
  1219. // Only deal with non-null/undefined values
  1220. if ( ( options = arguments[ i ] ) != null ) {
  1221.  
  1222. // Extend the base object
  1223. for ( name in options ) {
  1224. src = target[ name ];
  1225. copy = options[ name ];
  1226.  
  1227. // Prevent never-ending loop
  1228. if ( target === copy ) {
  1229. continue;
  1230. }
  1231.  
  1232. // Recurse if we're merging plain objects or arrays
  1233. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  1234. ( copyIsArray = jQuery.isArray( copy ) ) ) ) {
  1235.  
  1236. if ( copyIsArray ) {
  1237. copyIsArray = false;
  1238. clone = src && jQuery.isArray( src ) ? src : [];
  1239.  
  1240. } else {
  1241. clone = src && jQuery.isPlainObject( src ) ? src : {};
  1242. }
  1243.  
  1244. // Never move original objects, clone them
  1245. target[ name ] = jQuery.extend( deep, clone, copy );
  1246.  
  1247. // Don't bring in undefined values
  1248. } else if ( copy !== undefined ) {
  1249. target[ name ] = copy;
  1250. }
  1251. }
  1252. }
  1253. }
  1254.  
  1255. // Return the modified object
  1256. return target;
  1257. };
  1258.  
  1259. jQuery.extend( {
  1260.  
  1261. // Unique for each copy of jQuery on the page
  1262. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  1263.  
  1264. // Assume jQuery is ready without the ready module
  1265. isReady: true,
  1266.  
  1267. error: function( msg ) {
  1268. throw new Error( msg );
  1269. },
  1270.  
  1271. noop: function() {},
  1272.  
  1273. // See test/unit/core.js for details concerning isFunction.
  1274. // Since version 1.3, DOM methods and functions like alert
  1275. // aren't supported. They return false on IE (#2968).
  1276. isFunction: function( obj ) {
  1277. return jQuery.type( obj ) === "function";
  1278. },
  1279.  
  1280. isArray: Array.isArray || function( obj ) {
  1281. return jQuery.type( obj ) === "array";
  1282. },
  1283.  
  1284. isWindow: function( obj ) {
  1285. /* jshint eqeqeq: false */
  1286. return obj != null && obj == obj.window;
  1287. },
  1288.  
  1289. isNumeric: function( obj ) {
  1290.  
  1291. // parseFloat NaNs numeric-cast false positives (null|true|false|"")
  1292. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  1293. // subtraction forces infinities to NaN
  1294. // adding 1 corrects loss of precision from parseFloat (#15100)
  1295. var realStringObj = obj && obj.toString();
  1296. return !jQuery.isArray( obj ) && ( realStringObj - parseFloat( realStringObj ) + 1 ) >= 0;
  1297. },
  1298.  
  1299. isEmptyObject: function( obj ) {
  1300. var name;
  1301. for ( name in obj ) {
  1302. return false;
  1303. }
  1304. return true;
  1305. },
  1306.  
  1307. isPlainObject: function( obj ) {
  1308. var key;
  1309.  
  1310. // Must be an Object.
  1311. // Because of IE, we also have to check the presence of the constructor property.
  1312. // Make sure that DOM nodes and window objects don't pass through, as well
  1313. if ( !obj || jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
  1314. return false;
  1315. }
  1316.  
  1317. try {
  1318.  
  1319. // Not own constructor property must be Object
  1320. if ( obj.constructor &&
  1321. !hasOwn.call( obj, "constructor" ) &&
  1322. !hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) {
  1323. return false;
  1324. }
  1325. } catch ( e ) {
  1326.  
  1327. // IE8,9 Will throw exceptions on certain host objects #9897
  1328. return false;
  1329. }
  1330.  
  1331. // Support: IE<9
  1332. // Handle iteration over inherited properties before own properties.
  1333. if ( !support.ownFirst ) {
  1334. for ( key in obj ) {
  1335. return hasOwn.call( obj, key );
  1336. }
  1337. }
  1338.  
  1339. // Own properties are enumerated firstly, so to speed up,
  1340. // if last one is own, then all properties are own.
  1341. for ( key in obj ) {}
  1342.  
  1343. return key === undefined || hasOwn.call( obj, key );
  1344. },
  1345.  
  1346. type: function( obj ) {
  1347. if ( obj == null ) {
  1348. return obj + "";
  1349. }
  1350. return typeof obj === "object" || typeof obj === "function" ?
  1351. class2type[ toString.call( obj ) ] || "object" :
  1352. typeof obj;
  1353. },
  1354.  
  1355. // Workarounds based on findings by Jim Driscoll
  1356. // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
  1357. globalEval: function( data ) {
  1358. if ( data && jQuery.trim( data ) ) {
  1359.  
  1360. // We use execScript on Internet Explorer
  1361. // We use an anonymous function so that context is window
  1362. // rather than jQuery in Firefox
  1363. ( window.execScript || function( data ) {
  1364. window[ "eval" ].call( window, data ); // jscs:ignore requireDotNotation
  1365. } )( data );
  1366. }
  1367. },
  1368.  
  1369. // Convert dashed to camelCase; used by the css and data modules
  1370. // Microsoft forgot to hump their vendor prefix (#9572)
  1371. camelCase: function( string ) {
  1372. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  1373. },
  1374.  
  1375. nodeName: function( elem, name ) {
  1376. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  1377. },
  1378.  
  1379. each: function( obj, callback ) {
  1380. var length, i = 0;
  1381.  
  1382. if ( isArrayLike( obj ) ) {
  1383. length = obj.length;
  1384. for ( ; i < length; i++ ) {
  1385. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  1386. break;
  1387. }
  1388. }
  1389. } else {
  1390. for ( i in obj ) {
  1391. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  1392. break;
  1393. }
  1394. }
  1395. }
  1396.  
  1397. return obj;
  1398. },
  1399.  
  1400. // Support: Android<4.1, IE<9
  1401. trim: function( text ) {
  1402. return text == null ?
  1403. "" :
  1404. ( text + "" ).replace( rtrim, "" );
  1405. },
  1406.  
  1407. // results is for internal usage only
  1408. makeArray: function( arr, results ) {
  1409. var ret = results || [];
  1410.  
  1411. if ( arr != null ) {
  1412. if ( isArrayLike( Object( arr ) ) ) {
  1413. jQuery.merge( ret,
  1414. typeof arr === "string" ?
  1415. [ arr ] : arr
  1416. );
  1417. } else {
  1418. push.call( ret, arr );
  1419. }
  1420. }
  1421.  
  1422. return ret;
  1423. },
  1424.  
  1425. inArray: function( elem, arr, i ) {
  1426. var len;
  1427.  
  1428. if ( arr ) {
  1429. if ( indexOf ) {
  1430. return indexOf.call( arr, elem, i );
  1431. }
  1432.  
  1433. len = arr.length;
  1434. i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
  1435.  
  1436. for ( ; i < len; i++ ) {
  1437.  
  1438. // Skip accessing in sparse arrays
  1439. if ( i in arr && arr[ i ] === elem ) {
  1440. return i;
  1441. }
  1442. }
  1443. }
  1444.  
  1445. return -1;
  1446. },
  1447.  
  1448. merge: function( first, second ) {
  1449. var len = +second.length,
  1450. j = 0,
  1451. i = first.length;
  1452.  
  1453. while ( j < len ) {
  1454. first[ i++ ] = second[ j++ ];
  1455. }
  1456.  
  1457. // Support: IE<9
  1458. // Workaround casting of .length to NaN on otherwise arraylike objects (e.g., NodeLists)
  1459. if ( len !== len ) {
  1460. while ( second[ j ] !== undefined ) {
  1461. first[ i++ ] = second[ j++ ];
  1462. }
  1463. }
  1464.  
  1465. first.length = i;
  1466.  
  1467. return first;
  1468. },
  1469.  
  1470. grep: function( elems, callback, invert ) {
  1471. var callbackInverse,
  1472. matches = [],
  1473. i = 0,
  1474. length = elems.length,
  1475. callbackExpect = !invert;
  1476.  
  1477. // Go through the array, only saving the items
  1478. // that pass the validator function
  1479. for ( ; i < length; i++ ) {
  1480. callbackInverse = !callback( elems[ i ], i );
  1481. if ( callbackInverse !== callbackExpect ) {
  1482. matches.push( elems[ i ] );
  1483. }
  1484. }
  1485.  
  1486. return matches;
  1487. },
  1488.  
  1489. // arg is for internal usage only
  1490. map: function( elems, callback, arg ) {
  1491. var length, value,
  1492. i = 0,
  1493. ret = [];
  1494.  
  1495. // Go through the array, translating each of the items to their new values
  1496. if ( isArrayLike( elems ) ) {
  1497. length = elems.length;
  1498. for ( ; i < length; i++ ) {
  1499. value = callback( elems[ i ], i, arg );
  1500.  
  1501. if ( value != null ) {
  1502. ret.push( value );
  1503. }
  1504. }
  1505.  
  1506. // Go through every key on the object,
  1507. } else {
  1508. for ( i in elems ) {
  1509. value = callback( elems[ i ], i, arg );
  1510.  
  1511. if ( value != null ) {
  1512. ret.push( value );
  1513. }
  1514. }
  1515. }
  1516.  
  1517. // Flatten any nested arrays
  1518. return concat.apply( [], ret );
  1519. },
  1520.  
  1521. // A global GUID counter for objects
  1522. guid: 1,
  1523.  
  1524. // Bind a function to a context, optionally partially applying any
  1525. // arguments.
  1526. proxy: function( fn, context ) {
  1527. var args, proxy, tmp;
  1528.  
  1529. if ( typeof context === "string" ) {
  1530. tmp = fn[ context ];
  1531. context = fn;
  1532. fn = tmp;
  1533. }
  1534.  
  1535. // Quick check to determine if target is callable, in the spec
  1536. // this throws a TypeError, but we will just return undefined.
  1537. if ( !jQuery.isFunction( fn ) ) {
  1538. return undefined;
  1539. }
  1540.  
  1541. // Simulated bind
  1542. args = slice.call( arguments, 2 );
  1543. proxy = function() {
  1544. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  1545. };
  1546.  
  1547. // Set the guid of unique handler to the same of original handler, so it can be removed
  1548. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  1549.  
  1550. return proxy;
  1551. },
  1552.  
  1553. now: function() {
  1554. return +( new Date() );
  1555. },
  1556.  
  1557. // jQuery.support is not used in Core but other projects attach their
  1558. // properties to it so it needs to exist.
  1559. support: support
  1560. } );
  1561.  
  1562. // JSHint would error on this code due to the Symbol not being defined in ES5.
  1563. // Defining this global in .jshintrc would create a danger of using the global
  1564. // unguarded in another place, it seems safer to just disable JSHint for these
  1565. // three lines.
  1566. /* jshint ignore: start */
  1567. if ( typeof Symbol === "function" ) {
  1568. jQuery.fn[ Symbol.iterator ] = deletedIds[ Symbol.iterator ];
  1569. }
  1570. /* jshint ignore: end */
  1571.  
  1572. // Populate the class2type map
  1573. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  1574. function( i, name ) {
  1575. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  1576. } );
  1577.  
  1578. function isArrayLike( obj ) {
  1579.  
  1580. // Support: iOS 8.2 (not reproducible in simulator)
  1581. // `in` check used to prevent JIT error (gh-2145)
  1582. // hasOwn isn't used here due to false negatives
  1583. // regarding Nodelist length in IE
  1584. var length = !!obj && "length" in obj && obj.length,
  1585. type = jQuery.type( obj );
  1586.  
  1587. if ( type === "function" || jQuery.isWindow( obj ) ) {
  1588. return false;
  1589. }
  1590.  
  1591. return type === "array" || length === 0 ||
  1592. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  1593. }
  1594. var Sizzle =
  1595. /*!
  1596. * Sizzle CSS Selector Engine v2.2.1
  1597. * http://sizzlejs.com/
  1598. *
  1599. * Copyright jQuery Foundation and other contributors
  1600. * Released under the MIT license
  1601. * http://jquery.org/license
  1602. *
  1603. * Date: 2015-10-17
  1604. */
  1605. (function( window ) {
  1606.  
  1607. var i,
  1608. support,
  1609. Expr,
  1610. getText,
  1611. isXML,
  1612. tokenize,
  1613. compile,
  1614. select,
  1615. outermostContext,
  1616. sortInput,
  1617. hasDuplicate,
  1618.  
  1619. // Local document vars
  1620. setDocument,
  1621. document,
  1622. docElem,
  1623. documentIsHTML,
  1624. rbuggyQSA,
  1625. rbuggyMatches,
  1626. matches,
  1627. contains,
  1628.  
  1629. // Instance-specific data
  1630. expando = "sizzle" + 1 * new Date(),
  1631. preferredDoc = window.document,
  1632. dirruns = 0,
  1633. done = 0,
  1634. classCache = createCache(),
  1635. tokenCache = createCache(),
  1636. compilerCache = createCache(),
  1637. sortOrder = function( a, b ) {
  1638. if ( a === b ) {
  1639. hasDuplicate = true;
  1640. }
  1641. return 0;
  1642. },
  1643.  
  1644. // General-purpose constants
  1645. MAX_NEGATIVE = 1 << 31,
  1646.  
  1647. // Instance methods
  1648. hasOwn = ({}).hasOwnProperty,
  1649. arr = [],
  1650. pop = arr.pop,
  1651. push_native = arr.push,
  1652. push = arr.push,
  1653. slice = arr.slice,
  1654. // Use a stripped-down indexOf as it's faster than native
  1655. // http://jsperf.com/thor-indexof-vs-for/5
  1656. indexOf = function( list, elem ) {
  1657. var i = 0,
  1658. len = list.length;
  1659. for ( ; i < len; i++ ) {
  1660. if ( list[i] === elem ) {
  1661. return i;
  1662. }
  1663. }
  1664. return -1;
  1665. },
  1666.  
  1667. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  1668.  
  1669. // Regular expressions
  1670.  
  1671. // http://www.w3.org/TR/css3-selectors/#whitespace
  1672. whitespace = "[\\x20\\t\\r\\n\\f]",
  1673.  
  1674. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  1675. identifier = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
  1676.  
  1677. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  1678. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  1679. // Operator (capture 2)
  1680. "*([*^$|!~]?=)" + whitespace +
  1681. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  1682. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  1683. "*\\]",
  1684.  
  1685. pseudos = ":(" + identifier + ")(?:\\((" +
  1686. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  1687. // 1. quoted (capture 3; capture 4 or capture 5)
  1688. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  1689. // 2. simple (capture 6)
  1690. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  1691. // 3. anything else (capture 2)
  1692. ".*" +
  1693. ")\\)|)",
  1694.  
  1695. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  1696. rwhitespace = new RegExp( whitespace + "+", "g" ),
  1697. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  1698.  
  1699. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  1700. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  1701.  
  1702. rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
  1703.  
  1704. rpseudo = new RegExp( pseudos ),
  1705. ridentifier = new RegExp( "^" + identifier + "$" ),
  1706.  
  1707. matchExpr = {
  1708. "ID": new RegExp( "^#(" + identifier + ")" ),
  1709. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  1710. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  1711. "ATTR": new RegExp( "^" + attributes ),
  1712. "PSEUDO": new RegExp( "^" + pseudos ),
  1713. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  1714. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  1715. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  1716. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  1717. // For use in libraries implementing .is()
  1718. // We use this for POS matching in `select`
  1719. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  1720. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  1721. },
  1722.  
  1723. rinputs = /^(?:input|select|textarea|button)$/i,
  1724. rheader = /^h\d$/i,
  1725.  
  1726. rnative = /^[^{]+\{\s*\[native \w/,
  1727.  
  1728. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  1729. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  1730.  
  1731. rsibling = /[+~]/,
  1732. rescape = /'|\\/g,
  1733.  
  1734. // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  1735. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  1736. funescape = function( _, escaped, escapedWhitespace ) {
  1737. var high = "0x" + escaped - 0x10000;
  1738. // NaN means non-codepoint
  1739. // Support: Firefox<24
  1740. // Workaround erroneous numeric interpretation of +"0x"
  1741. return high !== high || escapedWhitespace ?
  1742. escaped :
  1743. high < 0 ?
  1744. // BMP codepoint
  1745. String.fromCharCode( high + 0x10000 ) :
  1746. // Supplemental Plane codepoint (surrogate pair)
  1747. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  1748. },
  1749.  
  1750. // Used for iframes
  1751. // See setDocument()
  1752. // Removing the function wrapper causes a "Permission Denied"
  1753. // error in IE
  1754. unloadHandler = function() {
  1755. setDocument();
  1756. };
  1757.  
  1758. // Optimize for push.apply( _, NodeList )
  1759. try {
  1760. push.apply(
  1761. (arr = slice.call( preferredDoc.childNodes )),
  1762. preferredDoc.childNodes
  1763. );
  1764. // Support: Android<4.0
  1765. // Detect silently failing push.apply
  1766. arr[ preferredDoc.childNodes.length ].nodeType;
  1767. } catch ( e ) {
  1768. push = { apply: arr.length ?
  1769.  
  1770. // Leverage slice if possible
  1771. function( target, els ) {
  1772. push_native.apply( target, slice.call(els) );
  1773. } :
  1774.  
  1775. // Support: IE<9
  1776. // Otherwise append directly
  1777. function( target, els ) {
  1778. var j = target.length,
  1779. i = 0;
  1780. // Can't trust NodeList.length
  1781. while ( (target[j++] = els[i++]) ) {}
  1782. target.length = j - 1;
  1783. }
  1784. };
  1785. }
  1786.  
  1787. function Sizzle( selector, context, results, seed ) {
  1788. var m, i, elem, nid, nidselect, match, groups, newSelector,
  1789. newContext = context && context.ownerDocument,
  1790.  
  1791. // nodeType defaults to 9, since context defaults to document
  1792. nodeType = context ? context.nodeType : 9;
  1793.  
  1794. results = results || [];
  1795.  
  1796. // Return early from calls with invalid selector or context
  1797. if ( typeof selector !== "string" || !selector ||
  1798. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  1799.  
  1800. return results;
  1801. }
  1802.  
  1803. // Try to shortcut find operations (as opposed to filters) in HTML documents
  1804. if ( !seed ) {
  1805.  
  1806. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  1807. setDocument( context );
  1808. }
  1809. context = context || document;
  1810.  
  1811. if ( documentIsHTML ) {
  1812.  
  1813. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  1814. // (excepting DocumentFragment context, where the methods don't exist)
  1815. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  1816.  
  1817. // ID selector
  1818. if ( (m = match[1]) ) {
  1819.  
  1820. // Document context
  1821. if ( nodeType === 9 ) {
  1822. if ( (elem = context.getElementById( m )) ) {
  1823.  
  1824. // Support: IE, Opera, Webkit
  1825. // TODO: identify versions
  1826. // getElementById can match elements by name instead of ID
  1827. if ( elem.id === m ) {
  1828. results.push( elem );
  1829. return results;
  1830. }
  1831. } else {
  1832. return results;
  1833. }
  1834.  
  1835. // Element context
  1836. } else {
  1837.  
  1838. // Support: IE, Opera, Webkit
  1839. // TODO: identify versions
  1840. // getElementById can match elements by name instead of ID
  1841. if ( newContext && (elem = newContext.getElementById( m )) &&
  1842. contains( context, elem ) &&
  1843. elem.id === m ) {
  1844.  
  1845. results.push( elem );
  1846. return results;
  1847. }
  1848. }
  1849.  
  1850. // Type selector
  1851. } else if ( match[2] ) {
  1852. push.apply( results, context.getElementsByTagName( selector ) );
  1853. return results;
  1854.  
  1855. // Class selector
  1856. } else if ( (m = match[3]) && support.getElementsByClassName &&
  1857. context.getElementsByClassName ) {
  1858.  
  1859. push.apply( results, context.getElementsByClassName( m ) );
  1860. return results;
  1861. }
  1862. }
  1863.  
  1864. // Take advantage of querySelectorAll
  1865. if ( support.qsa &&
  1866. !compilerCache[ selector + " " ] &&
  1867. (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
  1868.  
  1869. if ( nodeType !== 1 ) {
  1870. newContext = context;
  1871. newSelector = selector;
  1872.  
  1873. // qSA looks outside Element context, which is not what we want
  1874. // Thanks to Andrew Dupont for this workaround technique
  1875. // Support: IE <=8
  1876. // Exclude object elements
  1877. } else if ( context.nodeName.toLowerCase() !== "object" ) {
  1878.  
  1879. // Capture the context ID, setting it first if necessary
  1880. if ( (nid = context.getAttribute( "id" )) ) {
  1881. nid = nid.replace( rescape, "\\$&" );
  1882. } else {
  1883. context.setAttribute( "id", (nid = expando) );
  1884. }
  1885.  
  1886. // Prefix every selector in the list
  1887. groups = tokenize( selector );
  1888. i = groups.length;
  1889. nidselect = ridentifier.test( nid ) ? "#" + nid : "[id='" + nid + "']";
  1890. while ( i-- ) {
  1891. groups[i] = nidselect + " " + toSelector( groups[i] );
  1892. }
  1893. newSelector = groups.join( "," );
  1894.  
  1895. // Expand context for sibling selectors
  1896. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  1897. context;
  1898. }
  1899.  
  1900. if ( newSelector ) {
  1901. try {
  1902. push.apply( results,
  1903. newContext.querySelectorAll( newSelector )
  1904. );
  1905. return results;
  1906. } catch ( qsaError ) {
  1907. } finally {
  1908. if ( nid === expando ) {
  1909. context.removeAttribute( "id" );
  1910. }
  1911. }
  1912. }
  1913. }
  1914. }
  1915. }
  1916.  
  1917. // All others
  1918. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  1919. }
  1920.  
  1921. /**
  1922. * Create key-value caches of limited size
  1923. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  1924. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  1925. * deleting the oldest entry
  1926. */
  1927. function createCache() {
  1928. var keys = [];
  1929.  
  1930. function cache( key, value ) {
  1931. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  1932. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  1933. // Only keep the most recent entries
  1934. delete cache[ keys.shift() ];
  1935. }
  1936. return (cache[ key + " " ] = value);
  1937. }
  1938. return cache;
  1939. }
  1940.  
  1941. /**
  1942. * Mark a function for special use by Sizzle
  1943. * @param {Function} fn The function to mark
  1944. */
  1945. function markFunction( fn ) {
  1946. fn[ expando ] = true;
  1947. return fn;
  1948. }
  1949.  
  1950. /**
  1951. * Support testing using an element
  1952. * @param {Function} fn Passed the created div and expects a boolean result
  1953. */
  1954. function assert( fn ) {
  1955. var div = document.createElement("div");
  1956.  
  1957. try {
  1958. return !!fn( div );
  1959. } catch (e) {
  1960. return false;
  1961. } finally {
  1962. // Remove from its parent by default
  1963. if ( div.parentNode ) {
  1964. div.parentNode.removeChild( div );
  1965. }
  1966. // release memory in IE
  1967. div = null;
  1968. }
  1969. }
  1970.  
  1971. /**
  1972. * Adds the same handler for all of the specified attrs
  1973. * @param {String} attrs Pipe-separated list of attributes
  1974. * @param {Function} handler The method that will be applied
  1975. */
  1976. function addHandle( attrs, handler ) {
  1977. var arr = attrs.split("|"),
  1978. i = arr.length;
  1979.  
  1980. while ( i-- ) {
  1981. Expr.attrHandle[ arr[i] ] = handler;
  1982. }
  1983. }
  1984.  
  1985. /**
  1986. * Checks document order of two siblings
  1987. * @param {Element} a
  1988. * @param {Element} b
  1989. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  1990. */
  1991. function siblingCheck( a, b ) {
  1992. var cur = b && a,
  1993. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  1994. ( ~b.sourceIndex || MAX_NEGATIVE ) -
  1995. ( ~a.sourceIndex || MAX_NEGATIVE );
  1996.  
  1997. // Use IE sourceIndex if available on both nodes
  1998. if ( diff ) {
  1999. return diff;
  2000. }
  2001.  
  2002. // Check if b follows a
  2003. if ( cur ) {
  2004. while ( (cur = cur.nextSibling) ) {
  2005. if ( cur === b ) {
  2006. return -1;
  2007. }
  2008. }
  2009. }
  2010.  
  2011. return a ? 1 : -1;
  2012. }
  2013.  
  2014. /**
  2015. * Returns a function to use in pseudos for input types
  2016. * @param {String} type
  2017. */
  2018. function createInputPseudo( type ) {
  2019. return function( elem ) {
  2020. var name = elem.nodeName.toLowerCase();
  2021. return name === "input" && elem.type === type;
  2022. };
  2023. }
  2024.  
  2025. /**
  2026. * Returns a function to use in pseudos for buttons
  2027. * @param {String} type
  2028. */
  2029. function createButtonPseudo( type ) {
  2030. return function( elem ) {
  2031. var name = elem.nodeName.toLowerCase();
  2032. return (name === "input" || name === "button") && elem.type === type;
  2033. };
  2034. }
  2035.  
  2036. /**
  2037. * Returns a function to use in pseudos for positionals
  2038. * @param {Function} fn
  2039. */
  2040. function createPositionalPseudo( fn ) {
  2041. return markFunction(function( argument ) {
  2042. argument = +argument;
  2043. return markFunction(function( seed, matches ) {
  2044. var j,
  2045. matchIndexes = fn( [], seed.length, argument ),
  2046. i = matchIndexes.length;
  2047.  
  2048. // Match elements found at the specified indexes
  2049. while ( i-- ) {
  2050. if ( seed[ (j = matchIndexes[i]) ] ) {
  2051. seed[j] = !(matches[j] = seed[j]);
  2052. }
  2053. }
  2054. });
  2055. });
  2056. }
  2057.  
  2058. /**
  2059. * Checks a node for validity as a Sizzle context
  2060. * @param {Element|Object=} context
  2061. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  2062. */
  2063. function testContext( context ) {
  2064. return context && typeof context.getElementsByTagName !== "undefined" && context;
  2065. }
  2066.  
  2067. // Expose support vars for convenience
  2068. support = Sizzle.support = {};
  2069.  
  2070. /**
  2071. * Detects XML nodes
  2072. * @param {Element|Object} elem An element or a document
  2073. * @returns {Boolean} True iff elem is a non-HTML XML node
  2074. */
  2075. isXML = Sizzle.isXML = function( elem ) {
  2076. // documentElement is verified for cases where it doesn't yet exist
  2077. // (such as loading iframes in IE - #4833)
  2078. var documentElement = elem && (elem.ownerDocument || elem).documentElement;
  2079. return documentElement ? documentElement.nodeName !== "HTML" : false;
  2080. };
  2081.  
  2082. /**
  2083. * Sets document-related variables once based on the current document
  2084. * @param {Element|Object} [doc] An element or document object to use to set the document
  2085. * @returns {Object} Returns the current document
  2086. */
  2087. setDocument = Sizzle.setDocument = function( node ) {
  2088. var hasCompare, parent,
  2089. doc = node ? node.ownerDocument || node : preferredDoc;
  2090.  
  2091. // Return early if doc is invalid or already selected
  2092. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  2093. return document;
  2094. }
  2095.  
  2096. // Update global variables
  2097. document = doc;
  2098. docElem = document.documentElement;
  2099. documentIsHTML = !isXML( document );
  2100.  
  2101. // Support: IE 9-11, Edge
  2102. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  2103. if ( (parent = document.defaultView) && parent.top !== parent ) {
  2104. // Support: IE 11
  2105. if ( parent.addEventListener ) {
  2106. parent.addEventListener( "unload", unloadHandler, false );
  2107.  
  2108. // Support: IE 9 - 10 only
  2109. } else if ( parent.attachEvent ) {
  2110. parent.attachEvent( "onunload", unloadHandler );
  2111. }
  2112. }
  2113.  
  2114. /* Attributes
  2115. ---------------------------------------------------------------------- */
  2116.  
  2117. // Support: IE<8
  2118. // Verify that getAttribute really returns attributes and not properties
  2119. // (excepting IE8 booleans)
  2120. support.attributes = assert(function( div ) {
  2121. div.className = "i";
  2122. return !div.getAttribute("className");
  2123. });
  2124.  
  2125. /* getElement(s)By*
  2126. ---------------------------------------------------------------------- */
  2127.  
  2128. // Check if getElementsByTagName("*") returns only elements
  2129. support.getElementsByTagName = assert(function( div ) {
  2130. div.appendChild( document.createComment("") );
  2131. return !div.getElementsByTagName("*").length;
  2132. });
  2133.  
  2134. // Support: IE<9
  2135. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  2136.  
  2137. // Support: IE<10
  2138. // Check if getElementById returns elements by name
  2139. // The broken getElementById methods don't pick up programatically-set names,
  2140. // so use a roundabout getElementsByName test
  2141. support.getById = assert(function( div ) {
  2142. docElem.appendChild( div ).id = expando;
  2143. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  2144. });
  2145.  
  2146. // ID find and filter
  2147. if ( support.getById ) {
  2148. Expr.find["ID"] = function( id, context ) {
  2149. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  2150. var m = context.getElementById( id );
  2151. return m ? [ m ] : [];
  2152. }
  2153. };
  2154. Expr.filter["ID"] = function( id ) {
  2155. var attrId = id.replace( runescape, funescape );
  2156. return function( elem ) {
  2157. return elem.getAttribute("id") === attrId;
  2158. };
  2159. };
  2160. } else {
  2161. // Support: IE6/7
  2162. // getElementById is not reliable as a find shortcut
  2163. delete Expr.find["ID"];
  2164.  
  2165. Expr.filter["ID"] = function( id ) {
  2166. var attrId = id.replace( runescape, funescape );
  2167. return function( elem ) {
  2168. var node = typeof elem.getAttributeNode !== "undefined" &&
  2169. elem.getAttributeNode("id");
  2170. return node && node.value === attrId;
  2171. };
  2172. };
  2173. }
  2174.  
  2175. // Tag
  2176. Expr.find["TAG"] = support.getElementsByTagName ?
  2177. function( tag, context ) {
  2178. if ( typeof context.getElementsByTagName !== "undefined" ) {
  2179. return context.getElementsByTagName( tag );
  2180.  
  2181. // DocumentFragment nodes don't have gEBTN
  2182. } else if ( support.qsa ) {
  2183. return context.querySelectorAll( tag );
  2184. }
  2185. } :
  2186.  
  2187. function( tag, context ) {
  2188. var elem,
  2189. tmp = [],
  2190. i = 0,
  2191. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  2192. results = context.getElementsByTagName( tag );
  2193.  
  2194. // Filter out possible comments
  2195. if ( tag === "*" ) {
  2196. while ( (elem = results[i++]) ) {
  2197. if ( elem.nodeType === 1 ) {
  2198. tmp.push( elem );
  2199. }
  2200. }
  2201.  
  2202. return tmp;
  2203. }
  2204. return results;
  2205. };
  2206.  
  2207. // Class
  2208. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  2209. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  2210. return context.getElementsByClassName( className );
  2211. }
  2212. };
  2213.  
  2214. /* QSA/matchesSelector
  2215. ---------------------------------------------------------------------- */
  2216.  
  2217. // QSA and matchesSelector support
  2218.  
  2219. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  2220. rbuggyMatches = [];
  2221.  
  2222. // qSa(:focus) reports false when true (Chrome 21)
  2223. // We allow this because of a bug in IE8/9 that throws an error
  2224. // whenever `document.activeElement` is accessed on an iframe
  2225. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  2226. // See http://bugs.jquery.com/ticket/13378
  2227. rbuggyQSA = [];
  2228.  
  2229. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  2230. // Build QSA regex
  2231. // Regex strategy adopted from Diego Perini
  2232. assert(function( div ) {
  2233. // Select is set to empty string on purpose
  2234. // This is to test IE's treatment of not explicitly
  2235. // setting a boolean content attribute,
  2236. // since its presence should be enough
  2237. // http://bugs.jquery.com/ticket/12359
  2238. docElem.appendChild( div ).innerHTML = "<a id='" + expando + "'></a>" +
  2239. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  2240. "<option selected=''></option></select>";
  2241.  
  2242. // Support: IE8, Opera 11-12.16
  2243. // Nothing should be selected when empty strings follow ^= or $= or *=
  2244. // The test attribute must be unknown in Opera but "safe" for WinRT
  2245. // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  2246. if ( div.querySelectorAll("[msallowcapture^='']").length ) {
  2247. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  2248. }
  2249.  
  2250. // Support: IE8
  2251. // Boolean attributes and "value" are not treated correctly
  2252. if ( !div.querySelectorAll("[selected]").length ) {
  2253. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  2254. }
  2255.  
  2256. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  2257. if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  2258. rbuggyQSA.push("~=");
  2259. }
  2260.  
  2261. // Webkit/Opera - :checked should return selected option elements
  2262. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  2263. // IE8 throws error here and will not see later tests
  2264. if ( !div.querySelectorAll(":checked").length ) {
  2265. rbuggyQSA.push(":checked");
  2266. }
  2267.  
  2268. // Support: Safari 8+, iOS 8+
  2269. // https://bugs.webkit.org/show_bug.cgi?id=136851
  2270. // In-page `selector#id sibing-combinator selector` fails
  2271. if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) {
  2272. rbuggyQSA.push(".#.+[+~]");
  2273. }
  2274. });
  2275.  
  2276. assert(function( div ) {
  2277. // Support: Windows 8 Native Apps
  2278. // The type and name attributes are restricted during .innerHTML assignment
  2279. var input = document.createElement("input");
  2280. input.setAttribute( "type", "hidden" );
  2281. div.appendChild( input ).setAttribute( "name", "D" );
  2282.  
  2283. // Support: IE8
  2284. // Enforce case-sensitivity of name attribute
  2285. if ( div.querySelectorAll("[name=d]").length ) {
  2286. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  2287. }
  2288.  
  2289. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  2290. // IE8 throws error here and will not see later tests
  2291. if ( !div.querySelectorAll(":enabled").length ) {
  2292. rbuggyQSA.push( ":enabled", ":disabled" );
  2293. }
  2294.  
  2295. // Opera 10-11 does not throw on post-comma invalid pseudos
  2296. div.querySelectorAll("*,:x");
  2297. rbuggyQSA.push(",.*:");
  2298. });
  2299. }
  2300.  
  2301. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  2302. docElem.webkitMatchesSelector ||
  2303. docElem.mozMatchesSelector ||
  2304. docElem.oMatchesSelector ||
  2305. docElem.msMatchesSelector) )) ) {
  2306.  
  2307. assert(function( div ) {
  2308. // Check to see if it's possible to do matchesSelector
  2309. // on a disconnected node (IE 9)
  2310. support.disconnectedMatch = matches.call( div, "div" );
  2311.  
  2312. // This should fail with an exception
  2313. // Gecko does not error, returns false instead
  2314. matches.call( div, "[s!='']:x" );
  2315. rbuggyMatches.push( "!=", pseudos );
  2316. });
  2317. }
  2318.  
  2319. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  2320. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  2321.  
  2322. /* Contains
  2323. ---------------------------------------------------------------------- */
  2324. hasCompare = rnative.test( docElem.compareDocumentPosition );
  2325.  
  2326. // Element contains another
  2327. // Purposefully self-exclusive
  2328. // As in, an element does not contain itself
  2329. contains = hasCompare || rnative.test( docElem.contains ) ?
  2330. function( a, b ) {
  2331. var adown = a.nodeType === 9 ? a.documentElement : a,
  2332. bup = b && b.parentNode;
  2333. return a === bup || !!( bup && bup.nodeType === 1 && (
  2334. adown.contains ?
  2335. adown.contains( bup ) :
  2336. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  2337. ));
  2338. } :
  2339. function( a, b ) {
  2340. if ( b ) {
  2341. while ( (b = b.parentNode) ) {
  2342. if ( b === a ) {
  2343. return true;
  2344. }
  2345. }
  2346. }
  2347. return false;
  2348. };
  2349.  
  2350. /* Sorting
  2351. ---------------------------------------------------------------------- */
  2352.  
  2353. // Document order sorting
  2354. sortOrder = hasCompare ?
  2355. function( a, b ) {
  2356.  
  2357. // Flag for duplicate removal
  2358. if ( a === b ) {
  2359. hasDuplicate = true;
  2360. return 0;
  2361. }
  2362.  
  2363. // Sort on method existence if only one input has compareDocumentPosition
  2364. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  2365. if ( compare ) {
  2366. return compare;
  2367. }
  2368.  
  2369. // Calculate position if both inputs belong to the same document
  2370. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  2371. a.compareDocumentPosition( b ) :
  2372.  
  2373. // Otherwise we know they are disconnected
  2374. 1;
  2375.  
  2376. // Disconnected nodes
  2377. if ( compare & 1 ||
  2378. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  2379.  
  2380. // Choose the first element that is related to our preferred document
  2381. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  2382. return -1;
  2383. }
  2384. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  2385. return 1;
  2386. }
  2387.  
  2388. // Maintain original order
  2389. return sortInput ?
  2390. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  2391. 0;
  2392. }
  2393.  
  2394. return compare & 4 ? -1 : 1;
  2395. } :
  2396. function( a, b ) {
  2397. // Exit early if the nodes are identical
  2398. if ( a === b ) {
  2399. hasDuplicate = true;
  2400. return 0;
  2401. }
  2402.  
  2403. var cur,
  2404. i = 0,
  2405. aup = a.parentNode,
  2406. bup = b.parentNode,
  2407. ap = [ a ],
  2408. bp = [ b ];
  2409.  
  2410. // Parentless nodes are either documents or disconnected
  2411. if ( !aup || !bup ) {
  2412. return a === document ? -1 :
  2413. b === document ? 1 :
  2414. aup ? -1 :
  2415. bup ? 1 :
  2416. sortInput ?
  2417. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  2418. 0;
  2419.  
  2420. // If the nodes are siblings, we can do a quick check
  2421. } else if ( aup === bup ) {
  2422. return siblingCheck( a, b );
  2423. }
  2424.  
  2425. // Otherwise we need full lists of their ancestors for comparison
  2426. cur = a;
  2427. while ( (cur = cur.parentNode) ) {
  2428. ap.unshift( cur );
  2429. }
  2430. cur = b;
  2431. while ( (cur = cur.parentNode) ) {
  2432. bp.unshift( cur );
  2433. }
  2434.  
  2435. // Walk down the tree looking for a discrepancy
  2436. while ( ap[i] === bp[i] ) {
  2437. i++;
  2438. }
  2439.  
  2440. return i ?
  2441. // Do a sibling check if the nodes have a common ancestor
  2442. siblingCheck( ap[i], bp[i] ) :
  2443.  
  2444. // Otherwise nodes in our document sort first
  2445. ap[i] === preferredDoc ? -1 :
  2446. bp[i] === preferredDoc ? 1 :
  2447. 0;
  2448. };
  2449.  
  2450. return document;
  2451. };
  2452.  
  2453. Sizzle.matches = function( expr, elements ) {
  2454. return Sizzle( expr, null, null, elements );
  2455. };
  2456.  
  2457. Sizzle.matchesSelector = function( elem, expr ) {
  2458. // Set document vars if needed
  2459. if ( ( elem.ownerDocument || elem ) !== document ) {
  2460. setDocument( elem );
  2461. }
  2462.  
  2463. // Make sure that attribute selectors are quoted
  2464. expr = expr.replace( rattributeQuotes, "='$1']" );
  2465.  
  2466. if ( support.matchesSelector && documentIsHTML &&
  2467. !compilerCache[ expr + " " ] &&
  2468. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  2469. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  2470.  
  2471. try {
  2472. var ret = matches.call( elem, expr );
  2473.  
  2474. // IE 9's matchesSelector returns false on disconnected nodes
  2475. if ( ret || support.disconnectedMatch ||
  2476. // As well, disconnected nodes are said to be in a document
  2477. // fragment in IE 9
  2478. elem.document && elem.document.nodeType !== 11 ) {
  2479. return ret;
  2480. }
  2481. } catch (e) {}
  2482. }
  2483.  
  2484. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  2485. };
  2486.  
  2487. Sizzle.contains = function( context, elem ) {
  2488. // Set document vars if needed
  2489. if ( ( context.ownerDocument || context ) !== document ) {
  2490. setDocument( context );
  2491. }
  2492. return contains( context, elem );
  2493. };
  2494.  
  2495. Sizzle.attr = function( elem, name ) {
  2496. // Set document vars if needed
  2497. if ( ( elem.ownerDocument || elem ) !== document ) {
  2498. setDocument( elem );
  2499. }
  2500.  
  2501. var fn = Expr.attrHandle[ name.toLowerCase() ],
  2502. // Don't get fooled by Object.prototype properties (jQuery #13807)
  2503. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  2504. fn( elem, name, !documentIsHTML ) :
  2505. undefined;
  2506.  
  2507. return val !== undefined ?
  2508. val :
  2509. support.attributes || !documentIsHTML ?
  2510. elem.getAttribute( name ) :
  2511. (val = elem.getAttributeNode(name)) && val.specified ?
  2512. val.value :
  2513. null;
  2514. };
  2515.  
  2516. Sizzle.error = function( msg ) {
  2517. throw new Error( "Syntax error, unrecognized expression: " + msg );
  2518. };
  2519.  
  2520. /**
  2521. * Document sorting and removing duplicates
  2522. * @param {ArrayLike} results
  2523. */
  2524. Sizzle.uniqueSort = function( results ) {
  2525. var elem,
  2526. duplicates = [],
  2527. j = 0,
  2528. i = 0;
  2529.  
  2530. // Unless we *know* we can detect duplicates, assume their presence
  2531. hasDuplicate = !support.detectDuplicates;
  2532. sortInput = !support.sortStable && results.slice( 0 );
  2533. results.sort( sortOrder );
  2534.  
  2535. if ( hasDuplicate ) {
  2536. while ( (elem = results[i++]) ) {
  2537. if ( elem === results[ i ] ) {
  2538. j = duplicates.push( i );
  2539. }
  2540. }
  2541. while ( j-- ) {
  2542. results.splice( duplicates[ j ], 1 );
  2543. }
  2544. }
  2545.  
  2546. // Clear input after sorting to release objects
  2547. // See https://github.com/jquery/sizzle/pull/225
  2548. sortInput = null;
  2549.  
  2550. return results;
  2551. };
  2552.  
  2553. /**
  2554. * Utility function for retrieving the text value of an array of DOM nodes
  2555. * @param {Array|Element} elem
  2556. */
  2557. getText = Sizzle.getText = function( elem ) {
  2558. var node,
  2559. ret = "",
  2560. i = 0,
  2561. nodeType = elem.nodeType;
  2562.  
  2563. if ( !nodeType ) {
  2564. // If no nodeType, this is expected to be an array
  2565. while ( (node = elem[i++]) ) {
  2566. // Do not traverse comment nodes
  2567. ret += getText( node );
  2568. }
  2569. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  2570. // Use textContent for elements
  2571. // innerText usage removed for consistency of new lines (jQuery #11153)
  2572. if ( typeof elem.textContent === "string" ) {
  2573. return elem.textContent;
  2574. } else {
  2575. // Traverse its children
  2576. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  2577. ret += getText( elem );
  2578. }
  2579. }
  2580. } else if ( nodeType === 3 || nodeType === 4 ) {
  2581. return elem.nodeValue;
  2582. }
  2583. // Do not include comment or processing instruction nodes
  2584.  
  2585. return ret;
  2586. };
  2587.  
  2588. Expr = Sizzle.selectors = {
  2589.  
  2590. // Can be adjusted by the user
  2591. cacheLength: 50,
  2592.  
  2593. createPseudo: markFunction,
  2594.  
  2595. match: matchExpr,
  2596.  
  2597. attrHandle: {},
  2598.  
  2599. find: {},
  2600.  
  2601. relative: {
  2602. ">": { dir: "parentNode", first: true },
  2603. " ": { dir: "parentNode" },
  2604. "+": { dir: "previousSibling", first: true },
  2605. "~": { dir: "previousSibling" }
  2606. },
  2607.  
  2608. preFilter: {
  2609. "ATTR": function( match ) {
  2610. match[1] = match[1].replace( runescape, funescape );
  2611.  
  2612. // Move the given value to match[3] whether quoted or unquoted
  2613. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  2614.  
  2615. if ( match[2] === "~=" ) {
  2616. match[3] = " " + match[3] + " ";
  2617. }
  2618.  
  2619. return match.slice( 0, 4 );
  2620. },
  2621.  
  2622. "CHILD": function( match ) {
  2623. /* matches from matchExpr["CHILD"]
  2624. 1 type (only|nth|...)
  2625. 2 what (child|of-type)
  2626. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  2627. 4 xn-component of xn+y argument ([+-]?\d*n|)
  2628. 5 sign of xn-component
  2629. 6 x of xn-component
  2630. 7 sign of y-component
  2631. 8 y of y-component
  2632. */
  2633. match[1] = match[1].toLowerCase();
  2634.  
  2635. if ( match[1].slice( 0, 3 ) === "nth" ) {
  2636. // nth-* requires argument
  2637. if ( !match[3] ) {
  2638. Sizzle.error( match[0] );
  2639. }
  2640.  
  2641. // numeric x and y parameters for Expr.filter.CHILD
  2642. // remember that false/true cast respectively to 0/1
  2643. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  2644. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  2645.  
  2646. // other types prohibit arguments
  2647. } else if ( match[3] ) {
  2648. Sizzle.error( match[0] );
  2649. }
  2650.  
  2651. return match;
  2652. },
  2653.  
  2654. "PSEUDO": function( match ) {
  2655. var excess,
  2656. unquoted = !match[6] && match[2];
  2657.  
  2658. if ( matchExpr["CHILD"].test( match[0] ) ) {
  2659. return null;
  2660. }
  2661.  
  2662. // Accept quoted arguments as-is
  2663. if ( match[3] ) {
  2664. match[2] = match[4] || match[5] || "";
  2665.  
  2666. // Strip excess characters from unquoted arguments
  2667. } else if ( unquoted && rpseudo.test( unquoted ) &&
  2668. // Get excess from tokenize (recursively)
  2669. (excess = tokenize( unquoted, true )) &&
  2670. // advance to the next closing parenthesis
  2671. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  2672.  
  2673. // excess is a negative index
  2674. match[0] = match[0].slice( 0, excess );
  2675. match[2] = unquoted.slice( 0, excess );
  2676. }
  2677.  
  2678. // Return only captures needed by the pseudo filter method (type and argument)
  2679. return match.slice( 0, 3 );
  2680. }
  2681. },
  2682.  
  2683. filter: {
  2684.  
  2685. "TAG": function( nodeNameSelector ) {
  2686. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  2687. return nodeNameSelector === "*" ?
  2688. function() { return true; } :
  2689. function( elem ) {
  2690. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  2691. };
  2692. },
  2693.  
  2694. "CLASS": function( className ) {
  2695. var pattern = classCache[ className + " " ];
  2696.  
  2697. return pattern ||
  2698. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  2699. classCache( className, function( elem ) {
  2700. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  2701. });
  2702. },
  2703.  
  2704. "ATTR": function( name, operator, check ) {
  2705. return function( elem ) {
  2706. var result = Sizzle.attr( elem, name );
  2707.  
  2708. if ( result == null ) {
  2709. return operator === "!=";
  2710. }
  2711. if ( !operator ) {
  2712. return true;
  2713. }
  2714.  
  2715. result += "";
  2716.  
  2717. return operator === "=" ? result === check :
  2718. operator === "!=" ? result !== check :
  2719. operator === "^=" ? check && result.indexOf( check ) === 0 :
  2720. operator === "*=" ? check && result.indexOf( check ) > -1 :
  2721. operator === "$=" ? check && result.slice( -check.length ) === check :
  2722. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  2723. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  2724. false;
  2725. };
  2726. },
  2727.  
  2728. "CHILD": function( type, what, argument, first, last ) {
  2729. var simple = type.slice( 0, 3 ) !== "nth",
  2730. forward = type.slice( -4 ) !== "last",
  2731. ofType = what === "of-type";
  2732.  
  2733. return first === 1 && last === 0 ?
  2734.  
  2735. // Shortcut for :nth-*(n)
  2736. function( elem ) {
  2737. return !!elem.parentNode;
  2738. } :
  2739.  
  2740. function( elem, context, xml ) {
  2741. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  2742. dir = simple !== forward ? "nextSibling" : "previousSibling",
  2743. parent = elem.parentNode,
  2744. name = ofType && elem.nodeName.toLowerCase(),
  2745. useCache = !xml && !ofType,
  2746. diff = false;
  2747.  
  2748. if ( parent ) {
  2749.  
  2750. // :(first|last|only)-(child|of-type)
  2751. if ( simple ) {
  2752. while ( dir ) {
  2753. node = elem;
  2754. while ( (node = node[ dir ]) ) {
  2755. if ( ofType ?
  2756. node.nodeName.toLowerCase() === name :
  2757. node.nodeType === 1 ) {
  2758.  
  2759. return false;
  2760. }
  2761. }
  2762. // Reverse direction for :only-* (if we haven't yet done so)
  2763. start = dir = type === "only" && !start && "nextSibling";
  2764. }
  2765. return true;
  2766. }
  2767.  
  2768. start = [ forward ? parent.firstChild : parent.lastChild ];
  2769.  
  2770. // non-xml :nth-child(...) stores cache data on `parent`
  2771. if ( forward && useCache ) {
  2772.  
  2773. // Seek `elem` from a previously-cached index
  2774.  
  2775. // ...in a gzip-friendly way
  2776. node = parent;
  2777. outerCache = node[ expando ] || (node[ expando ] = {});
  2778.  
  2779. // Support: IE <9 only
  2780. // Defend against cloned attroperties (jQuery gh-1709)
  2781. uniqueCache = outerCache[ node.uniqueID ] ||
  2782. (outerCache[ node.uniqueID ] = {});
  2783.  
  2784. cache = uniqueCache[ type ] || [];
  2785. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  2786. diff = nodeIndex && cache[ 2 ];
  2787. node = nodeIndex && parent.childNodes[ nodeIndex ];
  2788.  
  2789. while ( (node = ++nodeIndex && node && node[ dir ] ||
  2790.  
  2791. // Fallback to seeking `elem` from the start
  2792. (diff = nodeIndex = 0) || start.pop()) ) {
  2793.  
  2794. // When found, cache indexes on `parent` and break
  2795. if ( node.nodeType === 1 && ++diff && node === elem ) {
  2796. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  2797. break;
  2798. }
  2799. }
  2800.  
  2801. } else {
  2802. // Use previously-cached element index if available
  2803. if ( useCache ) {
  2804. // ...in a gzip-friendly way
  2805. node = elem;
  2806. outerCache = node[ expando ] || (node[ expando ] = {});
  2807.  
  2808. // Support: IE <9 only
  2809. // Defend against cloned attroperties (jQuery gh-1709)
  2810. uniqueCache = outerCache[ node.uniqueID ] ||
  2811. (outerCache[ node.uniqueID ] = {});
  2812.  
  2813. cache = uniqueCache[ type ] || [];
  2814. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  2815. diff = nodeIndex;
  2816. }
  2817.  
  2818. // xml :nth-child(...)
  2819. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  2820. if ( diff === false ) {
  2821. // Use the same loop as above to seek `elem` from the start
  2822. while ( (node = ++nodeIndex && node && node[ dir ] ||
  2823. (diff = nodeIndex = 0) || start.pop()) ) {
  2824.  
  2825. if ( ( ofType ?
  2826. node.nodeName.toLowerCase() === name :
  2827. node.nodeType === 1 ) &&
  2828. ++diff ) {
  2829.  
  2830. // Cache the index of each encountered element
  2831. if ( useCache ) {
  2832. outerCache = node[ expando ] || (node[ expando ] = {});
  2833.  
  2834. // Support: IE <9 only
  2835. // Defend against cloned attroperties (jQuery gh-1709)
  2836. uniqueCache = outerCache[ node.uniqueID ] ||
  2837. (outerCache[ node.uniqueID ] = {});
  2838.  
  2839. uniqueCache[ type ] = [ dirruns, diff ];
  2840. }
  2841.  
  2842. if ( node === elem ) {
  2843. break;
  2844. }
  2845. }
  2846. }
  2847. }
  2848. }
  2849.  
  2850. // Incorporate the offset, then check against cycle size
  2851. diff -= last;
  2852. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  2853. }
  2854. };
  2855. },
  2856.  
  2857. "PSEUDO": function( pseudo, argument ) {
  2858. // pseudo-class names are case-insensitive
  2859. // http://www.w3.org/TR/selectors/#pseudo-classes
  2860. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  2861. // Remember that setFilters inherits from pseudos
  2862. var args,
  2863. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  2864. Sizzle.error( "unsupported pseudo: " + pseudo );
  2865.  
  2866. // The user may use createPseudo to indicate that
  2867. // arguments are needed to create the filter function
  2868. // just as Sizzle does
  2869. if ( fn[ expando ] ) {
  2870. return fn( argument );
  2871. }
  2872.  
  2873. // But maintain support for old signatures
  2874. if ( fn.length > 1 ) {
  2875. args = [ pseudo, pseudo, "", argument ];
  2876. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  2877. markFunction(function( seed, matches ) {
  2878. var idx,
  2879. matched = fn( seed, argument ),
  2880. i = matched.length;
  2881. while ( i-- ) {
  2882. idx = indexOf( seed, matched[i] );
  2883. seed[ idx ] = !( matches[ idx ] = matched[i] );
  2884. }
  2885. }) :
  2886. function( elem ) {
  2887. return fn( elem, 0, args );
  2888. };
  2889. }
  2890.  
  2891. return fn;
  2892. }
  2893. },
  2894.  
  2895. pseudos: {
  2896. // Potentially complex pseudos
  2897. "not": markFunction(function( selector ) {
  2898. // Trim the selector passed to compile
  2899. // to avoid treating leading and trailing
  2900. // spaces as combinators
  2901. var input = [],
  2902. results = [],
  2903. matcher = compile( selector.replace( rtrim, "$1" ) );
  2904.  
  2905. return matcher[ expando ] ?
  2906. markFunction(function( seed, matches, context, xml ) {
  2907. var elem,
  2908. unmatched = matcher( seed, null, xml, [] ),
  2909. i = seed.length;
  2910.  
  2911. // Match elements unmatched by `matcher`
  2912. while ( i-- ) {
  2913. if ( (elem = unmatched[i]) ) {
  2914. seed[i] = !(matches[i] = elem);
  2915. }
  2916. }
  2917. }) :
  2918. function( elem, context, xml ) {
  2919. input[0] = elem;
  2920. matcher( input, null, xml, results );
  2921. // Don't keep the element (issue #299)
  2922. input[0] = null;
  2923. return !results.pop();
  2924. };
  2925. }),
  2926.  
  2927. "has": markFunction(function( selector ) {
  2928. return function( elem ) {
  2929. return Sizzle( selector, elem ).length > 0;
  2930. };
  2931. }),
  2932.  
  2933. "contains": markFunction(function( text ) {
  2934. text = text.replace( runescape, funescape );
  2935. return function( elem ) {
  2936. return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
  2937. };
  2938. }),
  2939.  
  2940. // "Whether an element is represented by a :lang() selector
  2941. // is based solely on the element's language value
  2942. // being equal to the identifier C,
  2943. // or beginning with the identifier C immediately followed by "-".
  2944. // The matching of C against the element's language value is performed case-insensitively.
  2945. // The identifier C does not have to be a valid language name."
  2946. // http://www.w3.org/TR/selectors/#lang-pseudo
  2947. "lang": markFunction( function( lang ) {
  2948. // lang value must be a valid identifier
  2949. if ( !ridentifier.test(lang || "") ) {
  2950. Sizzle.error( "unsupported lang: " + lang );
  2951. }
  2952. lang = lang.replace( runescape, funescape ).toLowerCase();
  2953. return function( elem ) {
  2954. var elemLang;
  2955. do {
  2956. if ( (elemLang = documentIsHTML ?
  2957. elem.lang :
  2958. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  2959.  
  2960. elemLang = elemLang.toLowerCase();
  2961. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  2962. }
  2963. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  2964. return false;
  2965. };
  2966. }),
  2967.  
  2968. // Miscellaneous
  2969. "target": function( elem ) {
  2970. var hash = window.location && window.location.hash;
  2971. return hash && hash.slice( 1 ) === elem.id;
  2972. },
  2973.  
  2974. "root": function( elem ) {
  2975. return elem === docElem;
  2976. },
  2977.  
  2978. "focus": function( elem ) {
  2979. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  2980. },
  2981.  
  2982. // Boolean properties
  2983. "enabled": function( elem ) {
  2984. return elem.disabled === false;
  2985. },
  2986.  
  2987. "disabled": function( elem ) {
  2988. return elem.disabled === true;
  2989. },
  2990.  
  2991. "checked": function( elem ) {
  2992. // In CSS3, :checked should return both checked and selected elements
  2993. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  2994. var nodeName = elem.nodeName.toLowerCase();
  2995. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  2996. },
  2997.  
  2998. "selected": function( elem ) {
  2999. // Accessing this property makes selected-by-default
  3000. // options in Safari work properly
  3001. if ( elem.parentNode ) {
  3002. elem.parentNode.selectedIndex;
  3003. }
  3004.  
  3005. return elem.selected === true;
  3006. },
  3007.  
  3008. // Contents
  3009. "empty": function( elem ) {
  3010. // http://www.w3.org/TR/selectors/#empty-pseudo
  3011. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  3012. // but not by others (comment: 8; processing instruction: 7; etc.)
  3013. // nodeType < 6 works because attributes (2) do not appear as children
  3014. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  3015. if ( elem.nodeType < 6 ) {
  3016. return false;
  3017. }
  3018. }
  3019. return true;
  3020. },
  3021.  
  3022. "parent": function( elem ) {
  3023. return !Expr.pseudos["empty"]( elem );
  3024. },
  3025.  
  3026. // Element/input types
  3027. "header": function( elem ) {
  3028. return rheader.test( elem.nodeName );
  3029. },
  3030.  
  3031. "input": function( elem ) {
  3032. return rinputs.test( elem.nodeName );
  3033. },
  3034.  
  3035. "button": function( elem ) {
  3036. var name = elem.nodeName.toLowerCase();
  3037. return name === "input" && elem.type === "button" || name === "button";
  3038. },
  3039.  
  3040. "text": function( elem ) {
  3041. var attr;
  3042. return elem.nodeName.toLowerCase() === "input" &&
  3043. elem.type === "text" &&
  3044.  
  3045. // Support: IE<8
  3046. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  3047. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  3048. },
  3049.  
  3050. // Position-in-collection
  3051. "first": createPositionalPseudo(function() {
  3052. return [ 0 ];
  3053. }),
  3054.  
  3055. "last": createPositionalPseudo(function( matchIndexes, length ) {
  3056. return [ length - 1 ];
  3057. }),
  3058.  
  3059. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  3060. return [ argument < 0 ? argument + length : argument ];
  3061. }),
  3062.  
  3063. "even": createPositionalPseudo(function( matchIndexes, length ) {
  3064. var i = 0;
  3065. for ( ; i < length; i += 2 ) {
  3066. matchIndexes.push( i );
  3067. }
  3068. return matchIndexes;
  3069. }),
  3070.  
  3071. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  3072. var i = 1;
  3073. for ( ; i < length; i += 2 ) {
  3074. matchIndexes.push( i );
  3075. }
  3076. return matchIndexes;
  3077. }),
  3078.  
  3079. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  3080. var i = argument < 0 ? argument + length : argument;
  3081. for ( ; --i >= 0; ) {
  3082. matchIndexes.push( i );
  3083. }
  3084. return matchIndexes;
  3085. }),
  3086.  
  3087. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  3088. var i = argument < 0 ? argument + length : argument;
  3089. for ( ; ++i < length; ) {
  3090. matchIndexes.push( i );
  3091. }
  3092. return matchIndexes;
  3093. })
  3094. }
  3095. };
  3096.  
  3097. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  3098.  
  3099. // Add button/input type pseudos
  3100. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  3101. Expr.pseudos[ i ] = createInputPseudo( i );
  3102. }
  3103. for ( i in { submit: true, reset: true } ) {
  3104. Expr.pseudos[ i ] = createButtonPseudo( i );
  3105. }
  3106.  
  3107. // Easy API for creating new setFilters
  3108. function setFilters() {}
  3109. setFilters.prototype = Expr.filters = Expr.pseudos;
  3110. Expr.setFilters = new setFilters();
  3111.  
  3112. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  3113. var matched, match, tokens, type,
  3114. soFar, groups, preFilters,
  3115. cached = tokenCache[ selector + " " ];
  3116.  
  3117. if ( cached ) {
  3118. return parseOnly ? 0 : cached.slice( 0 );
  3119. }
  3120.  
  3121. soFar = selector;
  3122. groups = [];
  3123. preFilters = Expr.preFilter;
  3124.  
  3125. while ( soFar ) {
  3126.  
  3127. // Comma and first run
  3128. if ( !matched || (match = rcomma.exec( soFar )) ) {
  3129. if ( match ) {
  3130. // Don't consume trailing commas as valid
  3131. soFar = soFar.slice( match[0].length ) || soFar;
  3132. }
  3133. groups.push( (tokens = []) );
  3134. }
  3135.  
  3136. matched = false;
  3137.  
  3138. // Combinators
  3139. if ( (match = rcombinators.exec( soFar )) ) {
  3140. matched = match.shift();
  3141. tokens.push({
  3142. value: matched,
  3143. // Cast descendant combinators to space
  3144. type: match[0].replace( rtrim, " " )
  3145. });
  3146. soFar = soFar.slice( matched.length );
  3147. }
  3148.  
  3149. // Filters
  3150. for ( type in Expr.filter ) {
  3151. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  3152. (match = preFilters[ type ]( match ))) ) {
  3153. matched = match.shift();
  3154. tokens.push({
  3155. value: matched,
  3156. type: type,
  3157. matches: match
  3158. });
  3159. soFar = soFar.slice( matched.length );
  3160. }
  3161. }
  3162.  
  3163. if ( !matched ) {
  3164. break;
  3165. }
  3166. }
  3167.  
  3168. // Return the length of the invalid excess
  3169. // if we're just parsing
  3170. // Otherwise, throw an error or return tokens
  3171. return parseOnly ?
  3172. soFar.length :
  3173. soFar ?
  3174. Sizzle.error( selector ) :
  3175. // Cache the tokens
  3176. tokenCache( selector, groups ).slice( 0 );
  3177. };
  3178.  
  3179. function toSelector( tokens ) {
  3180. var i = 0,
  3181. len = tokens.length,
  3182. selector = "";
  3183. for ( ; i < len; i++ ) {
  3184. selector += tokens[i].value;
  3185. }
  3186. return selector;
  3187. }
  3188.  
  3189. function addCombinator( matcher, combinator, base ) {
  3190. var dir = combinator.dir,
  3191. checkNonElements = base && dir === "parentNode",
  3192. doneName = done++;
  3193.  
  3194. return combinator.first ?
  3195. // Check against closest ancestor/preceding element
  3196. function( elem, context, xml ) {
  3197. while ( (elem = elem[ dir ]) ) {
  3198. if ( elem.nodeType === 1 || checkNonElements ) {
  3199. return matcher( elem, context, xml );
  3200. }
  3201. }
  3202. } :
  3203.  
  3204. // Check against all ancestor/preceding elements
  3205. function( elem, context, xml ) {
  3206. var oldCache, uniqueCache, outerCache,
  3207. newCache = [ dirruns, doneName ];
  3208.  
  3209. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  3210. if ( xml ) {
  3211. while ( (elem = elem[ dir ]) ) {
  3212. if ( elem.nodeType === 1 || checkNonElements ) {
  3213. if ( matcher( elem, context, xml ) ) {
  3214. return true;
  3215. }
  3216. }
  3217. }
  3218. } else {
  3219. while ( (elem = elem[ dir ]) ) {
  3220. if ( elem.nodeType === 1 || checkNonElements ) {
  3221. outerCache = elem[ expando ] || (elem[ expando ] = {});
  3222.  
  3223. // Support: IE <9 only
  3224. // Defend against cloned attroperties (jQuery gh-1709)
  3225. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  3226.  
  3227. if ( (oldCache = uniqueCache[ dir ]) &&
  3228. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  3229.  
  3230. // Assign to newCache so results back-propagate to previous elements
  3231. return (newCache[ 2 ] = oldCache[ 2 ]);
  3232. } else {
  3233. // Reuse newcache so results back-propagate to previous elements
  3234. uniqueCache[ dir ] = newCache;
  3235.  
  3236. // A match means we're done; a fail means we have to keep checking
  3237. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  3238. return true;
  3239. }
  3240. }
  3241. }
  3242. }
  3243. }
  3244. };
  3245. }
  3246.  
  3247. function elementMatcher( matchers ) {
  3248. return matchers.length > 1 ?
  3249. function( elem, context, xml ) {
  3250. var i = matchers.length;
  3251. while ( i-- ) {
  3252. if ( !matchers[i]( elem, context, xml ) ) {
  3253. return false;
  3254. }
  3255. }
  3256. return true;
  3257. } :
  3258. matchers[0];
  3259. }
  3260.  
  3261. function multipleContexts( selector, contexts, results ) {
  3262. var i = 0,
  3263. len = contexts.length;
  3264. for ( ; i < len; i++ ) {
  3265. Sizzle( selector, contexts[i], results );
  3266. }
  3267. return results;
  3268. }
  3269.  
  3270. function condense( unmatched, map, filter, context, xml ) {
  3271. var elem,
  3272. newUnmatched = [],
  3273. i = 0,
  3274. len = unmatched.length,
  3275. mapped = map != null;
  3276.  
  3277. for ( ; i < len; i++ ) {
  3278. if ( (elem = unmatched[i]) ) {
  3279. if ( !filter || filter( elem, context, xml ) ) {
  3280. newUnmatched.push( elem );
  3281. if ( mapped ) {
  3282. map.push( i );
  3283. }
  3284. }
  3285. }
  3286. }
  3287.  
  3288. return newUnmatched;
  3289. }
  3290.  
  3291. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  3292. if ( postFilter && !postFilter[ expando ] ) {
  3293. postFilter = setMatcher( postFilter );
  3294. }
  3295. if ( postFinder && !postFinder[ expando ] ) {
  3296. postFinder = setMatcher( postFinder, postSelector );
  3297. }
  3298. return markFunction(function( seed, results, context, xml ) {
  3299. var temp, i, elem,
  3300. preMap = [],
  3301. postMap = [],
  3302. preexisting = results.length,
  3303.  
  3304. // Get initial elements from seed or context
  3305. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  3306.  
  3307. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  3308. matcherIn = preFilter && ( seed || !selector ) ?
  3309. condense( elems, preMap, preFilter, context, xml ) :
  3310. elems,
  3311.  
  3312. matcherOut = matcher ?
  3313. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  3314. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  3315.  
  3316. // ...intermediate processing is necessary
  3317. [] :
  3318.  
  3319. // ...otherwise use results directly
  3320. results :
  3321. matcherIn;
  3322.  
  3323. // Find primary matches
  3324. if ( matcher ) {
  3325. matcher( matcherIn, matcherOut, context, xml );
  3326. }
  3327.  
  3328. // Apply postFilter
  3329. if ( postFilter ) {
  3330. temp = condense( matcherOut, postMap );
  3331. postFilter( temp, [], context, xml );
  3332.  
  3333. // Un-match failing elements by moving them back to matcherIn
  3334. i = temp.length;
  3335. while ( i-- ) {
  3336. if ( (elem = temp[i]) ) {
  3337. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  3338. }
  3339. }
  3340. }
  3341.  
  3342. if ( seed ) {
  3343. if ( postFinder || preFilter ) {
  3344. if ( postFinder ) {
  3345. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  3346. temp = [];
  3347. i = matcherOut.length;
  3348. while ( i-- ) {
  3349. if ( (elem = matcherOut[i]) ) {
  3350. // Restore matcherIn since elem is not yet a final match
  3351. temp.push( (matcherIn[i] = elem) );
  3352. }
  3353. }
  3354. postFinder( null, (matcherOut = []), temp, xml );
  3355. }
  3356.  
  3357. // Move matched elements from seed to results to keep them synchronized
  3358. i = matcherOut.length;
  3359. while ( i-- ) {
  3360. if ( (elem = matcherOut[i]) &&
  3361. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  3362.  
  3363. seed[temp] = !(results[temp] = elem);
  3364. }
  3365. }
  3366. }
  3367.  
  3368. // Add elements to results, through postFinder if defined
  3369. } else {
  3370. matcherOut = condense(
  3371. matcherOut === results ?
  3372. matcherOut.splice( preexisting, matcherOut.length ) :
  3373. matcherOut
  3374. );
  3375. if ( postFinder ) {
  3376. postFinder( null, results, matcherOut, xml );
  3377. } else {
  3378. push.apply( results, matcherOut );
  3379. }
  3380. }
  3381. });
  3382. }
  3383.  
  3384. function matcherFromTokens( tokens ) {
  3385. var checkContext, matcher, j,
  3386. len = tokens.length,
  3387. leadingRelative = Expr.relative[ tokens[0].type ],
  3388. implicitRelative = leadingRelative || Expr.relative[" "],
  3389. i = leadingRelative ? 1 : 0,
  3390.  
  3391. // The foundational matcher ensures that elements are reachable from top-level context(s)
  3392. matchContext = addCombinator( function( elem ) {
  3393. return elem === checkContext;
  3394. }, implicitRelative, true ),
  3395. matchAnyContext = addCombinator( function( elem ) {
  3396. return indexOf( checkContext, elem ) > -1;
  3397. }, implicitRelative, true ),
  3398. matchers = [ function( elem, context, xml ) {
  3399. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  3400. (checkContext = context).nodeType ?
  3401. matchContext( elem, context, xml ) :
  3402. matchAnyContext( elem, context, xml ) );
  3403. // Avoid hanging onto element (issue #299)
  3404. checkContext = null;
  3405. return ret;
  3406. } ];
  3407.  
  3408. for ( ; i < len; i++ ) {
  3409. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  3410. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  3411. } else {
  3412. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  3413.  
  3414. // Return special upon seeing a positional matcher
  3415. if ( matcher[ expando ] ) {
  3416. // Find the next relative operator (if any) for proper handling
  3417. j = ++i;
  3418. for ( ; j < len; j++ ) {
  3419. if ( Expr.relative[ tokens[j].type ] ) {
  3420. break;
  3421. }
  3422. }
  3423. return setMatcher(
  3424. i > 1 && elementMatcher( matchers ),
  3425. i > 1 && toSelector(
  3426. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  3427. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  3428. ).replace( rtrim, "$1" ),
  3429. matcher,
  3430. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  3431. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  3432. j < len && toSelector( tokens )
  3433. );
  3434. }
  3435. matchers.push( matcher );
  3436. }
  3437. }
  3438.  
  3439. return elementMatcher( matchers );
  3440. }
  3441.  
  3442. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  3443. var bySet = setMatchers.length > 0,
  3444. byElement = elementMatchers.length > 0,
  3445. superMatcher = function( seed, context, xml, results, outermost ) {
  3446. var elem, j, matcher,
  3447. matchedCount = 0,
  3448. i = "0",
  3449. unmatched = seed && [],
  3450. setMatched = [],
  3451. contextBackup = outermostContext,
  3452. // We must always have either seed elements or outermost context
  3453. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  3454. // Use integer dirruns iff this is the outermost matcher
  3455. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  3456. len = elems.length;
  3457.  
  3458. if ( outermost ) {
  3459. outermostContext = context === document || context || outermost;
  3460. }
  3461.  
  3462. // Add elements passing elementMatchers directly to results
  3463. // Support: IE<9, Safari
  3464. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  3465. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  3466. if ( byElement && elem ) {
  3467. j = 0;
  3468. if ( !context && elem.ownerDocument !== document ) {
  3469. setDocument( elem );
  3470. xml = !documentIsHTML;
  3471. }
  3472. while ( (matcher = elementMatchers[j++]) ) {
  3473. if ( matcher( elem, context || document, xml) ) {
  3474. results.push( elem );
  3475. break;
  3476. }
  3477. }
  3478. if ( outermost ) {
  3479. dirruns = dirrunsUnique;
  3480. }
  3481. }
  3482.  
  3483. // Track unmatched elements for set filters
  3484. if ( bySet ) {
  3485. // They will have gone through all possible matchers
  3486. if ( (elem = !matcher && elem) ) {
  3487. matchedCount--;
  3488. }
  3489.  
  3490. // Lengthen the array for every element, matched or not
  3491. if ( seed ) {
  3492. unmatched.push( elem );
  3493. }
  3494. }
  3495. }
  3496.  
  3497. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  3498. // makes the latter nonnegative.
  3499. matchedCount += i;
  3500.  
  3501. // Apply set filters to unmatched elements
  3502. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  3503. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  3504. // no element matchers and no seed.
  3505. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  3506. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  3507. // numerically zero.
  3508. if ( bySet && i !== matchedCount ) {
  3509. j = 0;
  3510. while ( (matcher = setMatchers[j++]) ) {
  3511. matcher( unmatched, setMatched, context, xml );
  3512. }
  3513.  
  3514. if ( seed ) {
  3515. // Reintegrate element matches to eliminate the need for sorting
  3516. if ( matchedCount > 0 ) {
  3517. while ( i-- ) {
  3518. if ( !(unmatched[i] || setMatched[i]) ) {
  3519. setMatched[i] = pop.call( results );
  3520. }
  3521. }
  3522. }
  3523.  
  3524. // Discard index placeholder values to get only actual matches
  3525. setMatched = condense( setMatched );
  3526. }
  3527.  
  3528. // Add matches to results
  3529. push.apply( results, setMatched );
  3530.  
  3531. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  3532. if ( outermost && !seed && setMatched.length > 0 &&
  3533. ( matchedCount + setMatchers.length ) > 1 ) {
  3534.  
  3535. Sizzle.uniqueSort( results );
  3536. }
  3537. }
  3538.  
  3539. // Override manipulation of globals by nested matchers
  3540. if ( outermost ) {
  3541. dirruns = dirrunsUnique;
  3542. outermostContext = contextBackup;
  3543. }
  3544.  
  3545. return unmatched;
  3546. };
  3547.  
  3548. return bySet ?
  3549. markFunction( superMatcher ) :
  3550. superMatcher;
  3551. }
  3552.  
  3553. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  3554. var i,
  3555. setMatchers = [],
  3556. elementMatchers = [],
  3557. cached = compilerCache[ selector + " " ];
  3558.  
  3559. if ( !cached ) {
  3560. // Generate a function of recursive functions that can be used to check each element
  3561. if ( !match ) {
  3562. match = tokenize( selector );
  3563. }
  3564. i = match.length;
  3565. while ( i-- ) {
  3566. cached = matcherFromTokens( match[i] );
  3567. if ( cached[ expando ] ) {
  3568. setMatchers.push( cached );
  3569. } else {
  3570. elementMatchers.push( cached );
  3571. }
  3572. }
  3573.  
  3574. // Cache the compiled function
  3575. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  3576.  
  3577. // Save selector and tokenization
  3578. cached.selector = selector;
  3579. }
  3580. return cached;
  3581. };
  3582.  
  3583. /**
  3584. * A low-level selection function that works with Sizzle's compiled
  3585. * selector functions
  3586. * @param {String|Function} selector A selector or a pre-compiled
  3587. * selector function built with Sizzle.compile
  3588. * @param {Element} context
  3589. * @param {Array} [results]
  3590. * @param {Array} [seed] A set of elements to match against
  3591. */
  3592. select = Sizzle.select = function( selector, context, results, seed ) {
  3593. var i, tokens, token, type, find,
  3594. compiled = typeof selector === "function" && selector,
  3595. match = !seed && tokenize( (selector = compiled.selector || selector) );
  3596.  
  3597. results = results || [];
  3598.  
  3599. // Try to minimize operations if there is only one selector in the list and no seed
  3600. // (the latter of which guarantees us context)
  3601. if ( match.length === 1 ) {
  3602.  
  3603. // Reduce context if the leading compound selector is an ID
  3604. tokens = match[0] = match[0].slice( 0 );
  3605. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  3606. support.getById && context.nodeType === 9 && documentIsHTML &&
  3607. Expr.relative[ tokens[1].type ] ) {
  3608.  
  3609. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  3610. if ( !context ) {
  3611. return results;
  3612.  
  3613. // Precompiled matchers will still verify ancestry, so step up a level
  3614. } else if ( compiled ) {
  3615. context = context.parentNode;
  3616. }
  3617.  
  3618. selector = selector.slice( tokens.shift().value.length );
  3619. }
  3620.  
  3621. // Fetch a seed set for right-to-left matching
  3622. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  3623. while ( i-- ) {
  3624. token = tokens[i];
  3625.  
  3626. // Abort if we hit a combinator
  3627. if ( Expr.relative[ (type = token.type) ] ) {
  3628. break;
  3629. }
  3630. if ( (find = Expr.find[ type ]) ) {
  3631. // Search, expanding context for leading sibling combinators
  3632. if ( (seed = find(
  3633. token.matches[0].replace( runescape, funescape ),
  3634. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  3635. )) ) {
  3636.  
  3637. // If seed is empty or no tokens remain, we can return early
  3638. tokens.splice( i, 1 );
  3639. selector = seed.length && toSelector( tokens );
  3640. if ( !selector ) {
  3641. push.apply( results, seed );
  3642. return results;
  3643. }
  3644.  
  3645. break;
  3646. }
  3647. }
  3648. }
  3649. }
  3650.  
  3651. // Compile and execute a filtering function if one is not provided
  3652. // Provide `match` to avoid retokenization if we modified the selector above
  3653. ( compiled || compile( selector, match ) )(
  3654. seed,
  3655. context,
  3656. !documentIsHTML,
  3657. results,
  3658. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  3659. );
  3660. return results;
  3661. };
  3662.  
  3663. // One-time assignments
  3664.  
  3665. // Sort stability
  3666. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  3667.  
  3668. // Support: Chrome 14-35+
  3669. // Always assume duplicates if they aren't passed to the comparison function
  3670. support.detectDuplicates = !!hasDuplicate;
  3671.  
  3672. // Initialize against the default document
  3673. setDocument();
  3674.  
  3675. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  3676. // Detached nodes confoundingly follow *each other*
  3677. support.sortDetached = assert(function( div1 ) {
  3678. // Should return 1, but returns 4 (following)
  3679. return div1.compareDocumentPosition( document.createElement("div") ) & 1;
  3680. });
  3681.  
  3682. // Support: IE<8
  3683. // Prevent attribute/property "interpolation"
  3684. // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  3685. if ( !assert(function( div ) {
  3686. div.innerHTML = "<a href='#'></a>";
  3687. return div.firstChild.getAttribute("href") === "#" ;
  3688. }) ) {
  3689. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  3690. if ( !isXML ) {
  3691. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  3692. }
  3693. });
  3694. }
  3695.  
  3696. // Support: IE<9
  3697. // Use defaultValue in place of getAttribute("value")
  3698. if ( !support.attributes || !assert(function( div ) {
  3699. div.innerHTML = "<input/>";
  3700. div.firstChild.setAttribute( "value", "" );
  3701. return div.firstChild.getAttribute( "value" ) === "";
  3702. }) ) {
  3703. addHandle( "value", function( elem, name, isXML ) {
  3704. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  3705. return elem.defaultValue;
  3706. }
  3707. });
  3708. }
  3709.  
  3710. // Support: IE<9
  3711. // Use getAttributeNode to fetch booleans when getAttribute lies
  3712. if ( !assert(function( div ) {
  3713. return div.getAttribute("disabled") == null;
  3714. }) ) {
  3715. addHandle( booleans, function( elem, name, isXML ) {
  3716. var val;
  3717. if ( !isXML ) {
  3718. return elem[ name ] === true ? name.toLowerCase() :
  3719. (val = elem.getAttributeNode( name )) && val.specified ?
  3720. val.value :
  3721. null;
  3722. }
  3723. });
  3724. }
  3725.  
  3726. return Sizzle;
  3727.  
  3728. })( window );
  3729.  
  3730.  
  3731.  
  3732. jQuery.find = Sizzle;
  3733. jQuery.expr = Sizzle.selectors;
  3734. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  3735. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  3736. jQuery.text = Sizzle.getText;
  3737. jQuery.isXMLDoc = Sizzle.isXML;
  3738. jQuery.contains = Sizzle.contains;
  3739.  
  3740.  
  3741.  
  3742. var dir = function( elem, dir, until ) {
  3743. var matched = [],
  3744. truncate = until !== undefined;
  3745.  
  3746. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  3747. if ( elem.nodeType === 1 ) {
  3748. if ( truncate && jQuery( elem ).is( until ) ) {
  3749. break;
  3750. }
  3751. matched.push( elem );
  3752. }
  3753. }
  3754. return matched;
  3755. };
  3756.  
  3757.  
  3758. var siblings = function( n, elem ) {
  3759. var matched = [];
  3760.  
  3761. for ( ; n; n = n.nextSibling ) {
  3762. if ( n.nodeType === 1 && n !== elem ) {
  3763. matched.push( n );
  3764. }
  3765. }
  3766.  
  3767. return matched;
  3768. };
  3769.  
  3770.  
  3771. var rneedsContext = jQuery.expr.match.needsContext;
  3772.  
  3773. var rsingleTag = ( /^<([\w-]+)\s*\/?>(?:<\/\1>|)$/ );
  3774.  
  3775.  
  3776.  
  3777. var risSimple = /^.[^:#\[\.,]*$/;
  3778.  
  3779. // Implement the identical functionality for filter and not
  3780. function winnow( elements, qualifier, not ) {
  3781. if ( jQuery.isFunction( qualifier ) ) {
  3782. return jQuery.grep( elements, function( elem, i ) {
  3783. /* jshint -W018 */
  3784. return !!qualifier.call( elem, i, elem ) !== not;
  3785. } );
  3786.  
  3787. }
  3788.  
  3789. if ( qualifier.nodeType ) {
  3790. return jQuery.grep( elements, function( elem ) {
  3791. return ( elem === qualifier ) !== not;
  3792. } );
  3793.  
  3794. }
  3795.  
  3796. if ( typeof qualifier === "string" ) {
  3797. if ( risSimple.test( qualifier ) ) {
  3798. return jQuery.filter( qualifier, elements, not );
  3799. }
  3800.  
  3801. qualifier = jQuery.filter( qualifier, elements );
  3802. }
  3803.  
  3804. return jQuery.grep( elements, function( elem ) {
  3805. return ( jQuery.inArray( elem, qualifier ) > -1 ) !== not;
  3806. } );
  3807. }
  3808.  
  3809. jQuery.filter = function( expr, elems, not ) {
  3810. var elem = elems[ 0 ];
  3811.  
  3812. if ( not ) {
  3813. expr = ":not(" + expr + ")";
  3814. }
  3815.  
  3816. return elems.length === 1 && elem.nodeType === 1 ?
  3817. jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] :
  3818. jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  3819. return elem.nodeType === 1;
  3820. } ) );
  3821. };
  3822.  
  3823. jQuery.fn.extend( {
  3824. find: function( selector ) {
  3825. var i,
  3826. ret = [],
  3827. self = this,
  3828. len = self.length;
  3829.  
  3830. if ( typeof selector !== "string" ) {
  3831. return this.pushStack( jQuery( selector ).filter( function() {
  3832. for ( i = 0; i < len; i++ ) {
  3833. if ( jQuery.contains( self[ i ], this ) ) {
  3834. return true;
  3835. }
  3836. }
  3837. } ) );
  3838. }
  3839.  
  3840. for ( i = 0; i < len; i++ ) {
  3841. jQuery.find( selector, self[ i ], ret );
  3842. }
  3843.  
  3844. // Needed because $( selector, context ) becomes $( context ).find( selector )
  3845. ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
  3846. ret.selector = this.selector ? this.selector + " " + selector : selector;
  3847. return ret;
  3848. },
  3849. filter: function( selector ) {
  3850. return this.pushStack( winnow( this, selector || [], false ) );
  3851. },
  3852. not: function( selector ) {
  3853. return this.pushStack( winnow( this, selector || [], true ) );
  3854. },
  3855. is: function( selector ) {
  3856. return !!winnow(
  3857. this,
  3858.  
  3859. // If this is a positional/relative selector, check membership in the returned set
  3860. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  3861. typeof selector === "string" && rneedsContext.test( selector ) ?
  3862. jQuery( selector ) :
  3863. selector || [],
  3864. false
  3865. ).length;
  3866. }
  3867. } );
  3868.  
  3869.  
  3870. // Initialize a jQuery object
  3871.  
  3872.  
  3873. // A central reference to the root jQuery(document)
  3874. var rootjQuery,
  3875.  
  3876. // A simple way to check for HTML strings
  3877. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  3878. // Strict HTML recognition (#11290: must start with <)
  3879. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
  3880.  
  3881. init = jQuery.fn.init = function( selector, context, root ) {
  3882. var match, elem;
  3883.  
  3884. // HANDLE: $(""), $(null), $(undefined), $(false)
  3885. if ( !selector ) {
  3886. return this;
  3887. }
  3888.  
  3889. // init accepts an alternate rootjQuery
  3890. // so migrate can support jQuery.sub (gh-2101)
  3891. root = root || rootjQuery;
  3892.  
  3893. // Handle HTML strings
  3894. if ( typeof selector === "string" ) {
  3895. if ( selector.charAt( 0 ) === "<" &&
  3896. selector.charAt( selector.length - 1 ) === ">" &&
  3897. selector.length >= 3 ) {
  3898.  
  3899. // Assume that strings that start and end with <> are HTML and skip the regex check
  3900. match = [ null, selector, null ];
  3901.  
  3902. } else {
  3903. match = rquickExpr.exec( selector );
  3904. }
  3905.  
  3906. // Match html or make sure no context is specified for #id
  3907. if ( match && ( match[ 1 ] || !context ) ) {
  3908.  
  3909. // HANDLE: $(html) -> $(array)
  3910. if ( match[ 1 ] ) {
  3911. context = context instanceof jQuery ? context[ 0 ] : context;
  3912.  
  3913. // scripts is true for back-compat
  3914. // Intentionally let the error be thrown if parseHTML is not present
  3915. jQuery.merge( this, jQuery.parseHTML(
  3916. match[ 1 ],
  3917. context && context.nodeType ? context.ownerDocument || context : document,
  3918. true
  3919. ) );
  3920.  
  3921. // HANDLE: $(html, props)
  3922. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  3923. for ( match in context ) {
  3924.  
  3925. // Properties of context are called as methods if possible
  3926. if ( jQuery.isFunction( this[ match ] ) ) {
  3927. this[ match ]( context[ match ] );
  3928.  
  3929. // ...and otherwise set as attributes
  3930. } else {
  3931. this.attr( match, context[ match ] );
  3932. }
  3933. }
  3934. }
  3935.  
  3936. return this;
  3937.  
  3938. // HANDLE: $(#id)
  3939. } else {
  3940. elem = document.getElementById( match[ 2 ] );
  3941.  
  3942. // Check parentNode to catch when Blackberry 4.6 returns
  3943. // nodes that are no longer in the document #6963
  3944. if ( elem && elem.parentNode ) {
  3945.  
  3946. // Handle the case where IE and Opera return items
  3947. // by name instead of ID
  3948. if ( elem.id !== match[ 2 ] ) {
  3949. return rootjQuery.find( selector );
  3950. }
  3951.  
  3952. // Otherwise, we inject the element directly into the jQuery object
  3953. this.length = 1;
  3954. this[ 0 ] = elem;
  3955. }
  3956.  
  3957. this.context = document;
  3958. this.selector = selector;
  3959. return this;
  3960. }
  3961.  
  3962. // HANDLE: $(expr, $(...))
  3963. } else if ( !context || context.jquery ) {
  3964. return ( context || root ).find( selector );
  3965.  
  3966. // HANDLE: $(expr, context)
  3967. // (which is just equivalent to: $(context).find(expr)
  3968. } else {
  3969. return this.constructor( context ).find( selector );
  3970. }
  3971.  
  3972. // HANDLE: $(DOMElement)
  3973. } else if ( selector.nodeType ) {
  3974. this.context = this[ 0 ] = selector;
  3975. this.length = 1;
  3976. return this;
  3977.  
  3978. // HANDLE: $(function)
  3979. // Shortcut for document ready
  3980. } else if ( jQuery.isFunction( selector ) ) {
  3981. return typeof root.ready !== "undefined" ?
  3982. root.ready( selector ) :
  3983.  
  3984. // Execute immediately if ready is not present
  3985. selector( jQuery );
  3986. }
  3987.  
  3988. if ( selector.selector !== undefined ) {
  3989. this.selector = selector.selector;
  3990. this.context = selector.context;
  3991. }
  3992.  
  3993. return jQuery.makeArray( selector, this );
  3994. };
  3995.  
  3996. // Give the init function the jQuery prototype for later instantiation
  3997. init.prototype = jQuery.fn;
  3998.  
  3999. // Initialize central reference
  4000. rootjQuery = jQuery( document );
  4001.  
  4002.  
  4003. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  4004.  
  4005. // methods guaranteed to produce a unique set when starting from a unique set
  4006. guaranteedUnique = {
  4007. children: true,
  4008. contents: true,
  4009. next: true,
  4010. prev: true
  4011. };
  4012.  
  4013. jQuery.fn.extend( {
  4014. has: function( target ) {
  4015. var i,
  4016. targets = jQuery( target, this ),
  4017. len = targets.length;
  4018.  
  4019. return this.filter( function() {
  4020. for ( i = 0; i < len; i++ ) {
  4021. if ( jQuery.contains( this, targets[ i ] ) ) {
  4022. return true;
  4023. }
  4024. }
  4025. } );
  4026. },
  4027.  
  4028. closest: function( selectors, context ) {
  4029. var cur,
  4030. i = 0,
  4031. l = this.length,
  4032. matched = [],
  4033. pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
  4034. jQuery( selectors, context || this.context ) :
  4035. 0;
  4036.  
  4037. for ( ; i < l; i++ ) {
  4038. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  4039.  
  4040. // Always skip document fragments
  4041. if ( cur.nodeType < 11 && ( pos ?
  4042. pos.index( cur ) > -1 :
  4043.  
  4044. // Don't pass non-elements to Sizzle
  4045. cur.nodeType === 1 &&
  4046. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  4047.  
  4048. matched.push( cur );
  4049. break;
  4050. }
  4051. }
  4052. }
  4053.  
  4054. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  4055. },
  4056.  
  4057. // Determine the position of an element within
  4058. // the matched set of elements
  4059. index: function( elem ) {
  4060.  
  4061. // No argument, return index in parent
  4062. if ( !elem ) {
  4063. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  4064. }
  4065.  
  4066. // index in selector
  4067. if ( typeof elem === "string" ) {
  4068. return jQuery.inArray( this[ 0 ], jQuery( elem ) );
  4069. }
  4070.  
  4071. // Locate the position of the desired element
  4072. return jQuery.inArray(
  4073.  
  4074. // If it receives a jQuery object, the first element is used
  4075. elem.jquery ? elem[ 0 ] : elem, this );
  4076. },
  4077.  
  4078. add: function( selector, context ) {
  4079. return this.pushStack(
  4080. jQuery.uniqueSort(
  4081. jQuery.merge( this.get(), jQuery( selector, context ) )
  4082. )
  4083. );
  4084. },
  4085.  
  4086. addBack: function( selector ) {
  4087. return this.add( selector == null ?
  4088. this.prevObject : this.prevObject.filter( selector )
  4089. );
  4090. }
  4091. } );
  4092.  
  4093. function sibling( cur, dir ) {
  4094. do {
  4095. cur = cur[ dir ];
  4096. } while ( cur && cur.nodeType !== 1 );
  4097.  
  4098. return cur;
  4099. }
  4100.  
  4101. jQuery.each( {
  4102. parent: function( elem ) {
  4103. var parent = elem.parentNode;
  4104. return parent && parent.nodeType !== 11 ? parent : null;
  4105. },
  4106. parents: function( elem ) {
  4107. return dir( elem, "parentNode" );
  4108. },
  4109. parentsUntil: function( elem, i, until ) {
  4110. return dir( elem, "parentNode", until );
  4111. },
  4112. next: function( elem ) {
  4113. return sibling( elem, "nextSibling" );
  4114. },
  4115. prev: function( elem ) {
  4116. return sibling( elem, "previousSibling" );
  4117. },
  4118. nextAll: function( elem ) {
  4119. return dir( elem, "nextSibling" );
  4120. },
  4121. prevAll: function( elem ) {
  4122. return dir( elem, "previousSibling" );
  4123. },
  4124. nextUntil: function( elem, i, until ) {
  4125. return dir( elem, "nextSibling", until );
  4126. },
  4127. prevUntil: function( elem, i, until ) {
  4128. return dir( elem, "previousSibling", until );
  4129. },
  4130. siblings: function( elem ) {
  4131. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  4132. },
  4133. children: function( elem ) {
  4134. return siblings( elem.firstChild );
  4135. },
  4136. contents: function( elem ) {
  4137. return jQuery.nodeName( elem, "iframe" ) ?
  4138. elem.contentDocument || elem.contentWindow.document :
  4139. jQuery.merge( [], elem.childNodes );
  4140. }
  4141. }, function( name, fn ) {
  4142. jQuery.fn[ name ] = function( until, selector ) {
  4143. var ret = jQuery.map( this, fn, until );
  4144.  
  4145. if ( name.slice( -5 ) !== "Until" ) {
  4146. selector = until;
  4147. }
  4148.  
  4149. if ( selector && typeof selector === "string" ) {
  4150. ret = jQuery.filter( selector, ret );
  4151. }
  4152.  
  4153. if ( this.length > 1 ) {
  4154.  
  4155. // Remove duplicates
  4156. if ( !guaranteedUnique[ name ] ) {
  4157. ret = jQuery.uniqueSort( ret );
  4158. }
  4159.  
  4160. // Reverse order for parents* and prev-derivatives
  4161. if ( rparentsprev.test( name ) ) {
  4162. ret = ret.reverse();
  4163. }
  4164. }
  4165.  
  4166. return this.pushStack( ret );
  4167. };
  4168. } );
  4169. var rnotwhite = ( /\S+/g );
  4170.  
  4171.  
  4172.  
  4173. // Convert String-formatted options into Object-formatted ones
  4174. function createOptions( options ) {
  4175. var object = {};
  4176. jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) {
  4177. object[ flag ] = true;
  4178. } );
  4179. return object;
  4180. }
  4181.  
  4182. /*
  4183. * Create a callback list using the following parameters:
  4184. *
  4185. * options: an optional list of space-separated options that will change how
  4186. * the callback list behaves or a more traditional option object
  4187. *
  4188. * By default a callback list will act like an event callback list and can be
  4189. * "fired" multiple times.
  4190. *
  4191. * Possible options:
  4192. *
  4193. * once: will ensure the callback list can only be fired once (like a Deferred)
  4194. *
  4195. * memory: will keep track of previous values and will call any callback added
  4196. * after the list has been fired right away with the latest "memorized"
  4197. * values (like a Deferred)
  4198. *
  4199. * unique: will ensure a callback can only be added once (no duplicate in the list)
  4200. *
  4201. * stopOnFalse: interrupt callings when a callback returns false
  4202. *
  4203. */
  4204. jQuery.Callbacks = function( options ) {
  4205.  
  4206. // Convert options from String-formatted to Object-formatted if needed
  4207. // (we check in cache first)
  4208. options = typeof options === "string" ?
  4209. createOptions( options ) :
  4210. jQuery.extend( {}, options );
  4211.  
  4212. var // Flag to know if list is currently firing
  4213. firing,
  4214.  
  4215. // Last fire value for non-forgettable lists
  4216. memory,
  4217.  
  4218. // Flag to know if list was already fired
  4219. fired,
  4220.  
  4221. // Flag to prevent firing
  4222. locked,
  4223.  
  4224. // Actual callback list
  4225. list = [],
  4226.  
  4227. // Queue of execution data for repeatable lists
  4228. queue = [],
  4229.  
  4230. // Index of currently firing callback (modified by add/remove as needed)
  4231. firingIndex = -1,
  4232.  
  4233. // Fire callbacks
  4234. fire = function() {
  4235.  
  4236. // Enforce single-firing
  4237. locked = options.once;
  4238.  
  4239. // Execute callbacks for all pending executions,
  4240. // respecting firingIndex overrides and runtime changes
  4241. fired = firing = true;
  4242. for ( ; queue.length; firingIndex = -1 ) {
  4243. memory = queue.shift();
  4244. while ( ++firingIndex < list.length ) {
  4245.  
  4246. // Run callback and check for early termination
  4247. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  4248. options.stopOnFalse ) {
  4249.  
  4250. // Jump to end and forget the data so .add doesn't re-fire
  4251. firingIndex = list.length;
  4252. memory = false;
  4253. }
  4254. }
  4255. }
  4256.  
  4257. // Forget the data if we're done with it
  4258. if ( !options.memory ) {
  4259. memory = false;
  4260. }
  4261.  
  4262. firing = false;
  4263.  
  4264. // Clean up if we're done firing for good
  4265. if ( locked ) {
  4266.  
  4267. // Keep an empty list if we have data for future add calls
  4268. if ( memory ) {
  4269. list = [];
  4270.  
  4271. // Otherwise, this object is spent
  4272. } else {
  4273. list = "";
  4274. }
  4275. }
  4276. },
  4277.  
  4278. // Actual Callbacks object
  4279. self = {
  4280.  
  4281. // Add a callback or a collection of callbacks to the list
  4282. add: function() {
  4283. if ( list ) {
  4284.  
  4285. // If we have memory from a past run, we should fire after adding
  4286. if ( memory && !firing ) {
  4287. firingIndex = list.length - 1;
  4288. queue.push( memory );
  4289. }
  4290.  
  4291. ( function add( args ) {
  4292. jQuery.each( args, function( _, arg ) {
  4293. if ( jQuery.isFunction( arg ) ) {
  4294. if ( !options.unique || !self.has( arg ) ) {
  4295. list.push( arg );
  4296. }
  4297. } else if ( arg && arg.length && jQuery.type( arg ) !== "string" ) {
  4298.  
  4299. // Inspect recursively
  4300. add( arg );
  4301. }
  4302. } );
  4303. } )( arguments );
  4304.  
  4305. if ( memory && !firing ) {
  4306. fire();
  4307. }
  4308. }
  4309. return this;
  4310. },
  4311.  
  4312. // Remove a callback from the list
  4313. remove: function() {
  4314. jQuery.each( arguments, function( _, arg ) {
  4315. var index;
  4316. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  4317. list.splice( index, 1 );
  4318.  
  4319. // Handle firing indexes
  4320. if ( index <= firingIndex ) {
  4321. firingIndex--;
  4322. }
  4323. }
  4324. } );
  4325. return this;
  4326. },
  4327.  
  4328. // Check if a given callback is in the list.
  4329. // If no argument is given, return whether or not list has callbacks attached.
  4330. has: function( fn ) {
  4331. return fn ?
  4332. jQuery.inArray( fn, list ) > -1 :
  4333. list.length > 0;
  4334. },
  4335.  
  4336. // Remove all callbacks from the list
  4337. empty: function() {
  4338. if ( list ) {
  4339. list = [];
  4340. }
  4341. return this;
  4342. },
  4343.  
  4344. // Disable .fire and .add
  4345. // Abort any current/pending executions
  4346. // Clear all callbacks and values
  4347. disable: function() {
  4348. locked = queue = [];
  4349. list = memory = "";
  4350. return this;
  4351. },
  4352. disabled: function() {
  4353. return !list;
  4354. },
  4355.  
  4356. // Disable .fire
  4357. // Also disable .add unless we have memory (since it would have no effect)
  4358. // Abort any pending executions
  4359. lock: function() {
  4360. locked = true;
  4361. if ( !memory ) {
  4362. self.disable();
  4363. }
  4364. return this;
  4365. },
  4366. locked: function() {
  4367. return !!locked;
  4368. },
  4369.  
  4370. // Call all callbacks with the given context and arguments
  4371. fireWith: function( context, args ) {
  4372. if ( !locked ) {
  4373. args = args || [];
  4374. args = [ context, args.slice ? args.slice() : args ];
  4375. queue.push( args );
  4376. if ( !firing ) {
  4377. fire();
  4378. }
  4379. }
  4380. return this;
  4381. },
  4382.  
  4383. // Call all the callbacks with the given arguments
  4384. fire: function() {
  4385. self.fireWith( this, arguments );
  4386. return this;
  4387. },
  4388.  
  4389. // To know if the callbacks have already been called at least once
  4390. fired: function() {
  4391. return !!fired;
  4392. }
  4393. };
  4394.  
  4395. return self;
  4396. };
  4397.  
  4398.  
  4399. jQuery.extend( {
  4400.  
  4401. Deferred: function( func ) {
  4402. var tuples = [
  4403.  
  4404. // action, add listener, listener list, final state
  4405. [ "resolve", "done", jQuery.Callbacks( "once memory" ), "resolved" ],
  4406. [ "reject", "fail", jQuery.Callbacks( "once memory" ), "rejected" ],
  4407. [ "notify", "progress", jQuery.Callbacks( "memory" ) ]
  4408. ],
  4409. state = "pending",
  4410. promise = {
  4411. state: function() {
  4412. return state;
  4413. },
  4414. always: function() {
  4415. deferred.done( arguments ).fail( arguments );
  4416. return this;
  4417. },
  4418. then: function( /* fnDone, fnFail, fnProgress */ ) {
  4419. var fns = arguments;
  4420. return jQuery.Deferred( function( newDefer ) {
  4421. jQuery.each( tuples, function( i, tuple ) {
  4422. var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
  4423.  
  4424. // deferred[ done | fail | progress ] for forwarding actions to newDefer
  4425. deferred[ tuple[ 1 ] ]( function() {
  4426. var returned = fn && fn.apply( this, arguments );
  4427. if ( returned && jQuery.isFunction( returned.promise ) ) {
  4428. returned.promise()
  4429. .progress( newDefer.notify )
  4430. .done( newDefer.resolve )
  4431. .fail( newDefer.reject );
  4432. } else {
  4433. newDefer[ tuple[ 0 ] + "With" ](
  4434. this === promise ? newDefer.promise() : this,
  4435. fn ? [ returned ] : arguments
  4436. );
  4437. }
  4438. } );
  4439. } );
  4440. fns = null;
  4441. } ).promise();
  4442. },
  4443.  
  4444. // Get a promise for this deferred
  4445. // If obj is provided, the promise aspect is added to the object
  4446. promise: function( obj ) {
  4447. return obj != null ? jQuery.extend( obj, promise ) : promise;
  4448. }
  4449. },
  4450. deferred = {};
  4451.  
  4452. // Keep pipe for back-compat
  4453. promise.pipe = promise.then;
  4454.  
  4455. // Add list-specific methods
  4456. jQuery.each( tuples, function( i, tuple ) {
  4457. var list = tuple[ 2 ],
  4458. stateString = tuple[ 3 ];
  4459.  
  4460. // promise[ done | fail | progress ] = list.add
  4461. promise[ tuple[ 1 ] ] = list.add;
  4462.  
  4463. // Handle state
  4464. if ( stateString ) {
  4465. list.add( function() {
  4466.  
  4467. // state = [ resolved | rejected ]
  4468. state = stateString;
  4469.  
  4470. // [ reject_list | resolve_list ].disable; progress_list.lock
  4471. }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
  4472. }
  4473.  
  4474. // deferred[ resolve | reject | notify ]
  4475. deferred[ tuple[ 0 ] ] = function() {
  4476. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? promise : this, arguments );
  4477. return this;
  4478. };
  4479. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  4480. } );
  4481.  
  4482. // Make the deferred a promise
  4483. promise.promise( deferred );
  4484.  
  4485. // Call given func if any
  4486. if ( func ) {
  4487. func.call( deferred, deferred );
  4488. }
  4489.  
  4490. // All done!
  4491. return deferred;
  4492. },
  4493.  
  4494. // Deferred helper
  4495. when: function( subordinate /* , ..., subordinateN */ ) {
  4496. var i = 0,
  4497. resolveValues = slice.call( arguments ),
  4498. length = resolveValues.length,
  4499.  
  4500. // the count of uncompleted subordinates
  4501. remaining = length !== 1 ||
  4502. ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
  4503.  
  4504. // the master Deferred.
  4505. // If resolveValues consist of only a single Deferred, just use that.
  4506. deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
  4507.  
  4508. // Update function for both resolve and progress values
  4509. updateFunc = function( i, contexts, values ) {
  4510. return function( value ) {
  4511. contexts[ i ] = this;
  4512. values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  4513. if ( values === progressValues ) {
  4514. deferred.notifyWith( contexts, values );
  4515.  
  4516. } else if ( !( --remaining ) ) {
  4517. deferred.resolveWith( contexts, values );
  4518. }
  4519. };
  4520. },
  4521.  
  4522. progressValues, progressContexts, resolveContexts;
  4523.  
  4524. // add listeners to Deferred subordinates; treat others as resolved
  4525. if ( length > 1 ) {
  4526. progressValues = new Array( length );
  4527. progressContexts = new Array( length );
  4528. resolveContexts = new Array( length );
  4529. for ( ; i < length; i++ ) {
  4530. if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
  4531. resolveValues[ i ].promise()
  4532. .progress( updateFunc( i, progressContexts, progressValues ) )
  4533. .done( updateFunc( i, resolveContexts, resolveValues ) )
  4534. .fail( deferred.reject );
  4535. } else {
  4536. --remaining;
  4537. }
  4538. }
  4539. }
  4540.  
  4541. // if we're not waiting on anything, resolve the master
  4542. if ( !remaining ) {
  4543. deferred.resolveWith( resolveContexts, resolveValues );
  4544. }
  4545.  
  4546. return deferred.promise();
  4547. }
  4548. } );
  4549.  
  4550.  
  4551. // The deferred used on DOM ready
  4552. var readyList;
  4553.  
  4554. jQuery.fn.ready = function( fn ) {
  4555.  
  4556. // Add the callback
  4557. jQuery.ready.promise().done( fn );
  4558.  
  4559. return this;
  4560. };
  4561.  
  4562. jQuery.extend( {
  4563.  
  4564. // Is the DOM ready to be used? Set to true once it occurs.
  4565. isReady: false,
  4566.  
  4567. // A counter to track how many items to wait for before
  4568. // the ready event fires. See #6781
  4569. readyWait: 1,
  4570.  
  4571. // Hold (or release) the ready event
  4572. holdReady: function( hold ) {
  4573. if ( hold ) {
  4574. jQuery.readyWait++;
  4575. } else {
  4576. jQuery.ready( true );
  4577. }
  4578. },
  4579.  
  4580. // Handle when the DOM is ready
  4581. ready: function( wait ) {
  4582.  
  4583. // Abort if there are pending holds or we're already ready
  4584. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  4585. return;
  4586. }
  4587.  
  4588. // Remember that the DOM is ready
  4589. jQuery.isReady = true;
  4590.  
  4591. // If a normal DOM Ready event fired, decrement, and wait if need be
  4592. if ( wait !== true && --jQuery.readyWait > 0 ) {
  4593. return;
  4594. }
  4595.  
  4596. // If there are functions bound, to execute
  4597. readyList.resolveWith( document, [ jQuery ] );
  4598.  
  4599. // Trigger any bound ready events
  4600. if ( jQuery.fn.triggerHandler ) {
  4601. jQuery( document ).triggerHandler( "ready" );
  4602. jQuery( document ).off( "ready" );
  4603. }
  4604. }
  4605. } );
  4606.  
  4607. /**
  4608. * Clean-up method for dom ready events
  4609. */
  4610. function detach() {
  4611. if ( document.addEventListener ) {
  4612. document.removeEventListener( "DOMContentLoaded", completed );
  4613. window.removeEventListener( "load", completed );
  4614.  
  4615. } else {
  4616. document.detachEvent( "onreadystatechange", completed );
  4617. window.detachEvent( "onload", completed );
  4618. }
  4619. }
  4620.  
  4621. /**
  4622. * The ready event handler and self cleanup method
  4623. */
  4624. function completed() {
  4625.  
  4626. // readyState === "complete" is good enough for us to call the dom ready in oldIE
  4627. if ( document.addEventListener ||
  4628. window.event.type === "load" ||
  4629. document.readyState === "complete" ) {
  4630.  
  4631. detach();
  4632. jQuery.ready();
  4633. }
  4634. }
  4635.  
  4636. jQuery.ready.promise = function( obj ) {
  4637. if ( !readyList ) {
  4638.  
  4639. readyList = jQuery.Deferred();
  4640.  
  4641. // Catch cases where $(document).ready() is called
  4642. // after the browser event has already occurred.
  4643. // Support: IE6-10
  4644. // Older IE sometimes signals "interactive" too soon
  4645. if ( document.readyState === "complete" ||
  4646. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  4647.  
  4648. // Handle it asynchronously to allow scripts the opportunity to delay ready
  4649. window.setTimeout( jQuery.ready );
  4650.  
  4651. // Standards-based browsers support DOMContentLoaded
  4652. } else if ( document.addEventListener ) {
  4653.  
  4654. // Use the handy event callback
  4655. document.addEventListener( "DOMContentLoaded", completed );
  4656.  
  4657. // A fallback to window.onload, that will always work
  4658. window.addEventListener( "load", completed );
  4659.  
  4660. // If IE event model is used
  4661. } else {
  4662.  
  4663. // Ensure firing before onload, maybe late but safe also for iframes
  4664. document.attachEvent( "onreadystatechange", completed );
  4665.  
  4666. // A fallback to window.onload, that will always work
  4667. window.attachEvent( "onload", completed );
  4668.  
  4669. // If IE and not a frame
  4670. // continually check to see if the document is ready
  4671. var top = false;
  4672.  
  4673. try {
  4674. top = window.frameElement == null && document.documentElement;
  4675. } catch ( e ) {}
  4676.  
  4677. if ( top && top.doScroll ) {
  4678. ( function doScrollCheck() {
  4679. if ( !jQuery.isReady ) {
  4680.  
  4681. try {
  4682.  
  4683. // Use the trick by Diego Perini
  4684. // http://javascript.nwbox.com/IEContentLoaded/
  4685. top.doScroll( "left" );
  4686. } catch ( e ) {
  4687. return window.setTimeout( doScrollCheck, 50 );
  4688. }
  4689.  
  4690. // detach all dom ready events
  4691. detach();
  4692.  
  4693. // and execute any waiting functions
  4694. jQuery.ready();
  4695. }
  4696. } )();
  4697. }
  4698. }
  4699. }
  4700. return readyList.promise( obj );
  4701. };
  4702.  
  4703. // Kick off the DOM ready check even if the user does not
  4704. jQuery.ready.promise();
  4705.  
  4706.  
  4707.  
  4708.  
  4709. // Support: IE<9
  4710. // Iteration over object's inherited properties before its own
  4711. var i;
  4712. for ( i in jQuery( support ) ) {
  4713. break;
  4714. }
  4715. support.ownFirst = i === "0";
  4716.  
  4717. // Note: most support tests are defined in their respective modules.
  4718. // false until the test is run
  4719. support.inlineBlockNeedsLayout = false;
  4720.  
  4721. // Execute ASAP in case we need to set body.style.zoom
  4722. jQuery( function() {
  4723.  
  4724. // Minified: var a,b,c,d
  4725. var val, div, body, container;
  4726.  
  4727. body = document.getElementsByTagName( "body" )[ 0 ];
  4728. if ( !body || !body.style ) {
  4729.  
  4730. // Return for frameset docs that don't have a body
  4731. return;
  4732. }
  4733.  
  4734. // Setup
  4735. div = document.createElement( "div" );
  4736. container = document.createElement( "div" );
  4737. container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px";
  4738. body.appendChild( container ).appendChild( div );
  4739.  
  4740. if ( typeof div.style.zoom !== "undefined" ) {
  4741.  
  4742. // Support: IE<8
  4743. // Check if natively block-level elements act like inline-block
  4744. // elements when setting their display to 'inline' and giving
  4745. // them layout
  4746. div.style.cssText = "display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1";
  4747.  
  4748. support.inlineBlockNeedsLayout = val = div.offsetWidth === 3;
  4749. if ( val ) {
  4750.  
  4751. // Prevent IE 6 from affecting layout for positioned elements #11048
  4752. // Prevent IE from shrinking the body in IE 7 mode #12869
  4753. // Support: IE<8
  4754. body.style.zoom = 1;
  4755. }
  4756. }
  4757.  
  4758. body.removeChild( container );
  4759. } );
  4760.  
  4761.  
  4762. ( function() {
  4763. var div = document.createElement( "div" );
  4764.  
  4765. // Support: IE<9
  4766. support.deleteExpando = true;
  4767. try {
  4768. delete div.test;
  4769. } catch ( e ) {
  4770. support.deleteExpando = false;
  4771. }
  4772.  
  4773. // Null elements to avoid leaks in IE.
  4774. div = null;
  4775. } )();
  4776. var acceptData = function( elem ) {
  4777. var noData = jQuery.noData[ ( elem.nodeName + " " ).toLowerCase() ],
  4778. nodeType = +elem.nodeType || 1;
  4779.  
  4780. // Do not set data on non-element DOM nodes because it will not be cleared (#8335).
  4781. return nodeType !== 1 && nodeType !== 9 ?
  4782. false :
  4783.  
  4784. // Nodes accept data unless otherwise specified; rejection can be conditional
  4785. !noData || noData !== true && elem.getAttribute( "classid" ) === noData;
  4786. };
  4787.  
  4788.  
  4789.  
  4790.  
  4791. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  4792. rmultiDash = /([A-Z])/g;
  4793.  
  4794. function dataAttr( elem, key, data ) {
  4795.  
  4796. // If nothing was found internally, try to fetch any
  4797. // data from the HTML5 data-* attribute
  4798. if ( data === undefined && elem.nodeType === 1 ) {
  4799.  
  4800. var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
  4801.  
  4802. data = elem.getAttribute( name );
  4803.  
  4804. if ( typeof data === "string" ) {
  4805. try {
  4806. data = data === "true" ? true :
  4807. data === "false" ? false :
  4808. data === "null" ? null :
  4809.  
  4810. // Only convert to a number if it doesn't change the string
  4811. +data + "" === data ? +data :
  4812. rbrace.test( data ) ? jQuery.parseJSON( data ) :
  4813. data;
  4814. } catch ( e ) {}
  4815.  
  4816. // Make sure we set the data so it isn't changed later
  4817. jQuery.data( elem, key, data );
  4818.  
  4819. } else {
  4820. data = undefined;
  4821. }
  4822. }
  4823.  
  4824. return data;
  4825. }
  4826.  
  4827. // checks a cache object for emptiness
  4828. function isEmptyDataObject( obj ) {
  4829. var name;
  4830. for ( name in obj ) {
  4831.  
  4832. // if the public data object is empty, the private is still empty
  4833. if ( name === "data" && jQuery.isEmptyObject( obj[ name ] ) ) {
  4834. continue;
  4835. }
  4836. if ( name !== "toJSON" ) {
  4837. return false;
  4838. }
  4839. }
  4840.  
  4841. return true;
  4842. }
  4843.  
  4844. function internalData( elem, name, data, pvt /* Internal Use Only */ ) {
  4845. if ( !acceptData( elem ) ) {
  4846. return;
  4847. }
  4848.  
  4849. var ret, thisCache,
  4850. internalKey = jQuery.expando,
  4851.  
  4852. // We have to handle DOM nodes and JS objects differently because IE6-7
  4853. // can't GC object references properly across the DOM-JS boundary
  4854. isNode = elem.nodeType,
  4855.  
  4856. // Only DOM nodes need the global jQuery cache; JS object data is
  4857. // attached directly to the object so GC can occur automatically
  4858. cache = isNode ? jQuery.cache : elem,
  4859.  
  4860. // Only defining an ID for JS objects if its cache already exists allows
  4861. // the code to shortcut on the same path as a DOM node with no cache
  4862. id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey;
  4863.  
  4864. // Avoid doing any more work than we need to when trying to get data on an
  4865. // object that has no data at all
  4866. if ( ( !id || !cache[ id ] || ( !pvt && !cache[ id ].data ) ) &&
  4867. data === undefined && typeof name === "string" ) {
  4868. return;
  4869. }
  4870.  
  4871. if ( !id ) {
  4872.  
  4873. // Only DOM nodes need a new unique ID for each element since their data
  4874. // ends up in the global cache
  4875. if ( isNode ) {
  4876. id = elem[ internalKey ] = deletedIds.pop() || jQuery.guid++;
  4877. } else {
  4878. id = internalKey;
  4879. }
  4880. }
  4881.  
  4882. if ( !cache[ id ] ) {
  4883.  
  4884. // Avoid exposing jQuery metadata on plain JS objects when the object
  4885. // is serialized using JSON.stringify
  4886. cache[ id ] = isNode ? {} : { toJSON: jQuery.noop };
  4887. }
  4888.  
  4889. // An object can be passed to jQuery.data instead of a key/value pair; this gets
  4890. // shallow copied over onto the existing cache
  4891. if ( typeof name === "object" || typeof name === "function" ) {
  4892. if ( pvt ) {
  4893. cache[ id ] = jQuery.extend( cache[ id ], name );
  4894. } else {
  4895. cache[ id ].data = jQuery.extend( cache[ id ].data, name );
  4896. }
  4897. }
  4898.  
  4899. thisCache = cache[ id ];
  4900.  
  4901. // jQuery data() is stored in a separate object inside the object's internal data
  4902. // cache in order to avoid key collisions between internal data and user-defined
  4903. // data.
  4904. if ( !pvt ) {
  4905. if ( !thisCache.data ) {
  4906. thisCache.data = {};
  4907. }
  4908.  
  4909. thisCache = thisCache.data;
  4910. }
  4911.  
  4912. if ( data !== undefined ) {
  4913. thisCache[ jQuery.camelCase( name ) ] = data;
  4914. }
  4915.  
  4916. // Check for both converted-to-camel and non-converted data property names
  4917. // If a data property was specified
  4918. if ( typeof name === "string" ) {
  4919.  
  4920. // First Try to find as-is property data
  4921. ret = thisCache[ name ];
  4922.  
  4923. // Test for null|undefined property data
  4924. if ( ret == null ) {
  4925.  
  4926. // Try to find the camelCased property
  4927. ret = thisCache[ jQuery.camelCase( name ) ];
  4928. }
  4929. } else {
  4930. ret = thisCache;
  4931. }
  4932.  
  4933. return ret;
  4934. }
  4935.  
  4936. function internalRemoveData( elem, name, pvt ) {
  4937. if ( !acceptData( elem ) ) {
  4938. return;
  4939. }
  4940.  
  4941. var thisCache, i,
  4942. isNode = elem.nodeType,
  4943.  
  4944. // See jQuery.data for more information
  4945. cache = isNode ? jQuery.cache : elem,
  4946. id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
  4947.  
  4948. // If there is already no cache entry for this object, there is no
  4949. // purpose in continuing
  4950. if ( !cache[ id ] ) {
  4951. return;
  4952. }
  4953.  
  4954. if ( name ) {
  4955.  
  4956. thisCache = pvt ? cache[ id ] : cache[ id ].data;
  4957.  
  4958. if ( thisCache ) {
  4959.  
  4960. // Support array or space separated string names for data keys
  4961. if ( !jQuery.isArray( name ) ) {
  4962.  
  4963. // try the string as a key before any manipulation
  4964. if ( name in thisCache ) {
  4965. name = [ name ];
  4966. } else {
  4967.  
  4968. // split the camel cased version by spaces unless a key with the spaces exists
  4969. name = jQuery.camelCase( name );
  4970. if ( name in thisCache ) {
  4971. name = [ name ];
  4972. } else {
  4973. name = name.split( " " );
  4974. }
  4975. }
  4976. } else {
  4977.  
  4978. // If "name" is an array of keys...
  4979. // When data is initially created, via ("key", "val") signature,
  4980. // keys will be converted to camelCase.
  4981. // Since there is no way to tell _how_ a key was added, remove
  4982. // both plain key and camelCase key. #12786
  4983. // This will only penalize the array argument path.
  4984. name = name.concat( jQuery.map( name, jQuery.camelCase ) );
  4985. }
  4986.  
  4987. i = name.length;
  4988. while ( i-- ) {
  4989. delete thisCache[ name[ i ] ];
  4990. }
  4991.  
  4992. // If there is no data left in the cache, we want to continue
  4993. // and let the cache object itself get destroyed
  4994. if ( pvt ? !isEmptyDataObject( thisCache ) : !jQuery.isEmptyObject( thisCache ) ) {
  4995. return;
  4996. }
  4997. }
  4998. }
  4999.  
  5000. // See jQuery.data for more information
  5001. if ( !pvt ) {
  5002. delete cache[ id ].data;
  5003.  
  5004. // Don't destroy the parent cache unless the internal data object
  5005. // had been the only thing left in it
  5006. if ( !isEmptyDataObject( cache[ id ] ) ) {
  5007. return;
  5008. }
  5009. }
  5010.  
  5011. // Destroy the cache
  5012. if ( isNode ) {
  5013. jQuery.cleanData( [ elem ], true );
  5014.  
  5015. // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
  5016. /* jshint eqeqeq: false */
  5017. } else if ( support.deleteExpando || cache != cache.window ) {
  5018. /* jshint eqeqeq: true */
  5019. delete cache[ id ];
  5020.  
  5021. // When all else fails, undefined
  5022. } else {
  5023. cache[ id ] = undefined;
  5024. }
  5025. }
  5026.  
  5027. jQuery.extend( {
  5028. cache: {},
  5029.  
  5030. // The following elements (space-suffixed to avoid Object.prototype collisions)
  5031. // throw uncatchable exceptions if you attempt to set expando properties
  5032. noData: {
  5033. "applet ": true,
  5034. "embed ": true,
  5035.  
  5036. // ...but Flash objects (which have this classid) *can* handle expandos
  5037. "object ": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
  5038. },
  5039.  
  5040. hasData: function( elem ) {
  5041. elem = elem.nodeType ? jQuery.cache[ elem[ jQuery.expando ] ] : elem[ jQuery.expando ];
  5042. return !!elem && !isEmptyDataObject( elem );
  5043. },
  5044.  
  5045. data: function( elem, name, data ) {
  5046. return internalData( elem, name, data );
  5047. },
  5048.  
  5049. removeData: function( elem, name ) {
  5050. return internalRemoveData( elem, name );
  5051. },
  5052.  
  5053. // For internal use only.
  5054. _data: function( elem, name, data ) {
  5055. return internalData( elem, name, data, true );
  5056. },
  5057.  
  5058. _removeData: function( elem, name ) {
  5059. return internalRemoveData( elem, name, true );
  5060. }
  5061. } );
  5062.  
  5063. jQuery.fn.extend( {
  5064. data: function( key, value ) {
  5065. var i, name, data,
  5066. elem = this[ 0 ],
  5067. attrs = elem && elem.attributes;
  5068.  
  5069. // Special expections of .data basically thwart jQuery.access,
  5070. // so implement the relevant behavior ourselves
  5071.  
  5072. // Gets all values
  5073. if ( key === undefined ) {
  5074. if ( this.length ) {
  5075. data = jQuery.data( elem );
  5076.  
  5077. if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
  5078. i = attrs.length;
  5079. while ( i-- ) {
  5080.  
  5081. // Support: IE11+
  5082. // The attrs elements can be null (#14894)
  5083. if ( attrs[ i ] ) {
  5084. name = attrs[ i ].name;
  5085. if ( name.indexOf( "data-" ) === 0 ) {
  5086. name = jQuery.camelCase( name.slice( 5 ) );
  5087. dataAttr( elem, name, data[ name ] );
  5088. }
  5089. }
  5090. }
  5091. jQuery._data( elem, "parsedAttrs", true );
  5092. }
  5093. }
  5094.  
  5095. return data;
  5096. }
  5097.  
  5098. // Sets multiple values
  5099. if ( typeof key === "object" ) {
  5100. return this.each( function() {
  5101. jQuery.data( this, key );
  5102. } );
  5103. }
  5104.  
  5105. return arguments.length > 1 ?
  5106.  
  5107. // Sets one value
  5108. this.each( function() {
  5109. jQuery.data( this, key, value );
  5110. } ) :
  5111.  
  5112. // Gets one value
  5113. // Try to fetch any internally stored data first
  5114. elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : undefined;
  5115. },
  5116.  
  5117. removeData: function( key ) {
  5118. return this.each( function() {
  5119. jQuery.removeData( this, key );
  5120. } );
  5121. }
  5122. } );
  5123.  
  5124.  
  5125. jQuery.extend( {
  5126. queue: function( elem, type, data ) {
  5127. var queue;
  5128.  
  5129. if ( elem ) {
  5130. type = ( type || "fx" ) + "queue";
  5131. queue = jQuery._data( elem, type );
  5132.  
  5133. // Speed up dequeue by getting out quickly if this is just a lookup
  5134. if ( data ) {
  5135. if ( !queue || jQuery.isArray( data ) ) {
  5136. queue = jQuery._data( elem, type, jQuery.makeArray( data ) );
  5137. } else {
  5138. queue.push( data );
  5139. }
  5140. }
  5141. return queue || [];
  5142. }
  5143. },
  5144.  
  5145. dequeue: function( elem, type ) {
  5146. type = type || "fx";
  5147.  
  5148. var queue = jQuery.queue( elem, type ),
  5149. startLength = queue.length,
  5150. fn = queue.shift(),
  5151. hooks = jQuery._queueHooks( elem, type ),
  5152. next = function() {
  5153. jQuery.dequeue( elem, type );
  5154. };
  5155.  
  5156. // If the fx queue is dequeued, always remove the progress sentinel
  5157. if ( fn === "inprogress" ) {
  5158. fn = queue.shift();
  5159. startLength--;
  5160. }
  5161.  
  5162. if ( fn ) {
  5163.  
  5164. // Add a progress sentinel to prevent the fx queue from being
  5165. // automatically dequeued
  5166. if ( type === "fx" ) {
  5167. queue.unshift( "inprogress" );
  5168. }
  5169.  
  5170. // clear up the last queue stop function
  5171. delete hooks.stop;
  5172. fn.call( elem, next, hooks );
  5173. }
  5174.  
  5175. if ( !startLength && hooks ) {
  5176. hooks.empty.fire();
  5177. }
  5178. },
  5179.  
  5180. // not intended for public consumption - generates a queueHooks object,
  5181. // or returns the current one
  5182. _queueHooks: function( elem, type ) {
  5183. var key = type + "queueHooks";
  5184. return jQuery._data( elem, key ) || jQuery._data( elem, key, {
  5185. empty: jQuery.Callbacks( "once memory" ).add( function() {
  5186. jQuery._removeData( elem, type + "queue" );
  5187. jQuery._removeData( elem, key );
  5188. } )
  5189. } );
  5190. }
  5191. } );
  5192.  
  5193. jQuery.fn.extend( {
  5194. queue: function( type, data ) {
  5195. var setter = 2;
  5196.  
  5197. if ( typeof type !== "string" ) {
  5198. data = type;
  5199. type = "fx";
  5200. setter--;
  5201. }
  5202.  
  5203. if ( arguments.length < setter ) {
  5204. return jQuery.queue( this[ 0 ], type );
  5205. }
  5206.  
  5207. return data === undefined ?
  5208. this :
  5209. this.each( function() {
  5210. var queue = jQuery.queue( this, type, data );
  5211.  
  5212. // ensure a hooks for this queue
  5213. jQuery._queueHooks( this, type );
  5214.  
  5215. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  5216. jQuery.dequeue( this, type );
  5217. }
  5218. } );
  5219. },
  5220. dequeue: function( type ) {
  5221. return this.each( function() {
  5222. jQuery.dequeue( this, type );
  5223. } );
  5224. },
  5225. clearQueue: function( type ) {
  5226. return this.queue( type || "fx", [] );
  5227. },
  5228.  
  5229. // Get a promise resolved when queues of a certain type
  5230. // are emptied (fx is the type by default)
  5231. promise: function( type, obj ) {
  5232. var tmp,
  5233. count = 1,
  5234. defer = jQuery.Deferred(),
  5235. elements = this,
  5236. i = this.length,
  5237. resolve = function() {
  5238. if ( !( --count ) ) {
  5239. defer.resolveWith( elements, [ elements ] );
  5240. }
  5241. };
  5242.  
  5243. if ( typeof type !== "string" ) {
  5244. obj = type;
  5245. type = undefined;
  5246. }
  5247. type = type || "fx";
  5248.  
  5249. while ( i-- ) {
  5250. tmp = jQuery._data( elements[ i ], type + "queueHooks" );
  5251. if ( tmp && tmp.empty ) {
  5252. count++;
  5253. tmp.empty.add( resolve );
  5254. }
  5255. }
  5256. resolve();
  5257. return defer.promise( obj );
  5258. }
  5259. } );
  5260.  
  5261.  
  5262. ( function() {
  5263. var shrinkWrapBlocksVal;
  5264.  
  5265. support.shrinkWrapBlocks = function() {
  5266. if ( shrinkWrapBlocksVal != null ) {
  5267. return shrinkWrapBlocksVal;
  5268. }
  5269.  
  5270. // Will be changed later if needed.
  5271. shrinkWrapBlocksVal = false;
  5272.  
  5273. // Minified: var b,c,d
  5274. var div, body, container;
  5275.  
  5276. body = document.getElementsByTagName( "body" )[ 0 ];
  5277. if ( !body || !body.style ) {
  5278.  
  5279. // Test fired too early or in an unsupported environment, exit.
  5280. return;
  5281. }
  5282.  
  5283. // Setup
  5284. div = document.createElement( "div" );
  5285. container = document.createElement( "div" );
  5286. container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px";
  5287. body.appendChild( container ).appendChild( div );
  5288.  
  5289. // Support: IE6
  5290. // Check if elements with layout shrink-wrap their children
  5291. if ( typeof div.style.zoom !== "undefined" ) {
  5292.  
  5293. // Reset CSS: box-sizing; display; margin; border
  5294. div.style.cssText =
  5295.  
  5296. // Support: Firefox<29, Android 2.3
  5297. // Vendor-prefix box-sizing
  5298. "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" +
  5299. "box-sizing:content-box;display:block;margin:0;border:0;" +
  5300. "padding:1px;width:1px;zoom:1";
  5301. div.appendChild( document.createElement( "div" ) ).style.width = "5px";
  5302. shrinkWrapBlocksVal = div.offsetWidth !== 3;
  5303. }
  5304.  
  5305. body.removeChild( container );
  5306.  
  5307. return shrinkWrapBlocksVal;
  5308. };
  5309.  
  5310. } )();
  5311. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  5312.  
  5313. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  5314.  
  5315.  
  5316. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  5317.  
  5318. var isHidden = function( elem, el ) {
  5319.  
  5320. // isHidden might be called from jQuery#filter function;
  5321. // in that case, element will be second argument
  5322. elem = el || elem;
  5323. return jQuery.css( elem, "display" ) === "none" ||
  5324. !jQuery.contains( elem.ownerDocument, elem );
  5325. };
  5326.  
  5327.  
  5328.  
  5329. function adjustCSS( elem, prop, valueParts, tween ) {
  5330. var adjusted,
  5331. scale = 1,
  5332. maxIterations = 20,
  5333. currentValue = tween ?
  5334. function() { return tween.cur(); } :
  5335. function() { return jQuery.css( elem, prop, "" ); },
  5336. initial = currentValue(),
  5337. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  5338.  
  5339. // Starting value computation is required for potential unit mismatches
  5340. initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  5341. rcssNum.exec( jQuery.css( elem, prop ) );
  5342.  
  5343. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  5344.  
  5345. // Trust units reported by jQuery.css
  5346. unit = unit || initialInUnit[ 3 ];
  5347.  
  5348. // Make sure we update the tween properties later on
  5349. valueParts = valueParts || [];
  5350.  
  5351. // Iteratively approximate from a nonzero starting point
  5352. initialInUnit = +initial || 1;
  5353.  
  5354. do {
  5355.  
  5356. // If previous iteration zeroed out, double until we get *something*.
  5357. // Use string for doubling so we don't accidentally see scale as unchanged below
  5358. scale = scale || ".5";
  5359.  
  5360. // Adjust and apply
  5361. initialInUnit = initialInUnit / scale;
  5362. jQuery.style( elem, prop, initialInUnit + unit );
  5363.  
  5364. // Update scale, tolerating zero or NaN from tween.cur()
  5365. // Break the loop if scale is unchanged or perfect, or if we've just had enough.
  5366. } while (
  5367. scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations
  5368. );
  5369. }
  5370.  
  5371. if ( valueParts ) {
  5372. initialInUnit = +initialInUnit || +initial || 0;
  5373.  
  5374. // Apply relative offset (+=/-=) if specified
  5375. adjusted = valueParts[ 1 ] ?
  5376. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  5377. +valueParts[ 2 ];
  5378. if ( tween ) {
  5379. tween.unit = unit;
  5380. tween.start = initialInUnit;
  5381. tween.end = adjusted;
  5382. }
  5383. }
  5384. return adjusted;
  5385. }
  5386.  
  5387.  
  5388. // Multifunctional method to get and set values of a collection
  5389. // The value/s can optionally be executed if it's a function
  5390. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  5391. var i = 0,
  5392. length = elems.length,
  5393. bulk = key == null;
  5394.  
  5395. // Sets many values
  5396. if ( jQuery.type( key ) === "object" ) {
  5397. chainable = true;
  5398. for ( i in key ) {
  5399. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  5400. }
  5401.  
  5402. // Sets one value
  5403. } else if ( value !== undefined ) {
  5404. chainable = true;
  5405.  
  5406. if ( !jQuery.isFunction( value ) ) {
  5407. raw = true;
  5408. }
  5409.  
  5410. if ( bulk ) {
  5411.  
  5412. // Bulk operations run against the entire set
  5413. if ( raw ) {
  5414. fn.call( elems, value );
  5415. fn = null;
  5416.  
  5417. // ...except when executing function values
  5418. } else {
  5419. bulk = fn;
  5420. fn = function( elem, key, value ) {
  5421. return bulk.call( jQuery( elem ), value );
  5422. };
  5423. }
  5424. }
  5425.  
  5426. if ( fn ) {
  5427. for ( ; i < length; i++ ) {
  5428. fn(
  5429. elems[ i ],
  5430. key,
  5431. raw ? value : value.call( elems[ i ], i, fn( elems[ i ], key ) )
  5432. );
  5433. }
  5434. }
  5435. }
  5436.  
  5437. return chainable ?
  5438. elems :
  5439.  
  5440. // Gets
  5441. bulk ?
  5442. fn.call( elems ) :
  5443. length ? fn( elems[ 0 ], key ) : emptyGet;
  5444. };
  5445. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  5446.  
  5447. var rtagName = ( /<([\w:-]+)/ );
  5448.  
  5449. var rscriptType = ( /^$|\/(?:java|ecma)script/i );
  5450.  
  5451. var rleadingWhitespace = ( /^\s+/ );
  5452.  
  5453. var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|" +
  5454. "details|dialog|figcaption|figure|footer|header|hgroup|main|" +
  5455. "mark|meter|nav|output|picture|progress|section|summary|template|time|video";
  5456.  
  5457.  
  5458.  
  5459. function createSafeFragment( document ) {
  5460. var list = nodeNames.split( "|" ),
  5461. safeFrag = document.createDocumentFragment();
  5462.  
  5463. if ( safeFrag.createElement ) {
  5464. while ( list.length ) {
  5465. safeFrag.createElement(
  5466. list.pop()
  5467. );
  5468. }
  5469. }
  5470. return safeFrag;
  5471. }
  5472.  
  5473.  
  5474. ( function() {
  5475. var div = document.createElement( "div" ),
  5476. fragment = document.createDocumentFragment(),
  5477. input = document.createElement( "input" );
  5478.  
  5479. // Setup
  5480. div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
  5481.  
  5482. // IE strips leading whitespace when .innerHTML is used
  5483. support.leadingWhitespace = div.firstChild.nodeType === 3;
  5484.  
  5485. // Make sure that tbody elements aren't automatically inserted
  5486. // IE will insert them into empty tables
  5487. support.tbody = !div.getElementsByTagName( "tbody" ).length;
  5488.  
  5489. // Make sure that link elements get serialized correctly by innerHTML
  5490. // This requires a wrapper element in IE
  5491. support.htmlSerialize = !!div.getElementsByTagName( "link" ).length;
  5492.  
  5493. // Makes sure cloning an html5 element does not cause problems
  5494. // Where outerHTML is undefined, this still works
  5495. support.html5Clone =
  5496. document.createElement( "nav" ).cloneNode( true ).outerHTML !== "<:nav></:nav>";
  5497.  
  5498. // Check if a disconnected checkbox will retain its checked
  5499. // value of true after appended to the DOM (IE6/7)
  5500. input.type = "checkbox";
  5501. input.checked = true;
  5502. fragment.appendChild( input );
  5503. support.appendChecked = input.checked;
  5504.  
  5505. // Make sure textarea (and checkbox) defaultValue is properly cloned
  5506. // Support: IE6-IE11+
  5507. div.innerHTML = "<textarea>x</textarea>";
  5508. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  5509.  
  5510. // #11217 - WebKit loses check when the name is after the checked attribute
  5511. fragment.appendChild( div );
  5512.  
  5513. // Support: Windows Web Apps (WWA)
  5514. // `name` and `type` must use .setAttribute for WWA (#14901)
  5515. input = document.createElement( "input" );
  5516. input.setAttribute( "type", "radio" );
  5517. input.setAttribute( "checked", "checked" );
  5518. input.setAttribute( "name", "t" );
  5519.  
  5520. div.appendChild( input );
  5521.  
  5522. // Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3
  5523. // old WebKit doesn't clone checked state correctly in fragments
  5524. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  5525.  
  5526. // Support: IE<9
  5527. // Cloned elements keep attachEvent handlers, we use addEventListener on IE9+
  5528. support.noCloneEvent = !!div.addEventListener;
  5529.  
  5530. // Support: IE<9
  5531. // Since attributes and properties are the same in IE,
  5532. // cleanData must set properties to undefined rather than use removeAttribute
  5533. div[ jQuery.expando ] = 1;
  5534. support.attributes = !div.getAttribute( jQuery.expando );
  5535. } )();
  5536.  
  5537.  
  5538. // We have to close these tags to support XHTML (#13200)
  5539. var wrapMap = {
  5540. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  5541. legend: [ 1, "<fieldset>", "</fieldset>" ],
  5542. area: [ 1, "<map>", "</map>" ],
  5543.  
  5544. // Support: IE8
  5545. param: [ 1, "<object>", "</object>" ],
  5546. thead: [ 1, "<table>", "</table>" ],
  5547. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  5548. col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
  5549. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  5550.  
  5551. // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,
  5552. // unless wrapped in a div with non-breaking characters in front of it.
  5553. _default: support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ]
  5554. };
  5555.  
  5556. // Support: IE8-IE9
  5557. wrapMap.optgroup = wrapMap.option;
  5558.  
  5559. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  5560. wrapMap.th = wrapMap.td;
  5561.  
  5562.  
  5563. function getAll( context, tag ) {
  5564. var elems, elem,
  5565. i = 0,
  5566. found = typeof context.getElementsByTagName !== "undefined" ?
  5567. context.getElementsByTagName( tag || "*" ) :
  5568. typeof context.querySelectorAll !== "undefined" ?
  5569. context.querySelectorAll( tag || "*" ) :
  5570. undefined;
  5571.  
  5572. if ( !found ) {
  5573. for ( found = [], elems = context.childNodes || context;
  5574. ( elem = elems[ i ] ) != null;
  5575. i++
  5576. ) {
  5577. if ( !tag || jQuery.nodeName( elem, tag ) ) {
  5578. found.push( elem );
  5579. } else {
  5580. jQuery.merge( found, getAll( elem, tag ) );
  5581. }
  5582. }
  5583. }
  5584.  
  5585. return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
  5586. jQuery.merge( [ context ], found ) :
  5587. found;
  5588. }
  5589.  
  5590.  
  5591. // Mark scripts as having already been evaluated
  5592. function setGlobalEval( elems, refElements ) {
  5593. var elem,
  5594. i = 0;
  5595. for ( ; ( elem = elems[ i ] ) != null; i++ ) {
  5596. jQuery._data(
  5597. elem,
  5598. "globalEval",
  5599. !refElements || jQuery._data( refElements[ i ], "globalEval" )
  5600. );
  5601. }
  5602. }
  5603.  
  5604.  
  5605. var rhtml = /<|&#?\w+;/,
  5606. rtbody = /<tbody/i;
  5607.  
  5608. function fixDefaultChecked( elem ) {
  5609. if ( rcheckableType.test( elem.type ) ) {
  5610. elem.defaultChecked = elem.checked;
  5611. }
  5612. }
  5613.  
  5614. function buildFragment( elems, context, scripts, selection, ignored ) {
  5615. var j, elem, contains,
  5616. tmp, tag, tbody, wrap,
  5617. l = elems.length,
  5618.  
  5619. // Ensure a safe fragment
  5620. safe = createSafeFragment( context ),
  5621.  
  5622. nodes = [],
  5623. i = 0;
  5624.  
  5625. for ( ; i < l; i++ ) {
  5626. elem = elems[ i ];
  5627.  
  5628. if ( elem || elem === 0 ) {
  5629.  
  5630. // Add nodes directly
  5631. if ( jQuery.type( elem ) === "object" ) {
  5632. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  5633.  
  5634. // Convert non-html into a text node
  5635. } else if ( !rhtml.test( elem ) ) {
  5636. nodes.push( context.createTextNode( elem ) );
  5637.  
  5638. // Convert html into DOM nodes
  5639. } else {
  5640. tmp = tmp || safe.appendChild( context.createElement( "div" ) );
  5641.  
  5642. // Deserialize a standard representation
  5643. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  5644. wrap = wrapMap[ tag ] || wrapMap._default;
  5645.  
  5646. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  5647.  
  5648. // Descend through wrappers to the right content
  5649. j = wrap[ 0 ];
  5650. while ( j-- ) {
  5651. tmp = tmp.lastChild;
  5652. }
  5653.  
  5654. // Manually add leading whitespace removed by IE
  5655. if ( !support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
  5656. nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[ 0 ] ) );
  5657. }
  5658.  
  5659. // Remove IE's autoinserted <tbody> from table fragments
  5660. if ( !support.tbody ) {
  5661.  
  5662. // String was a <table>, *may* have spurious <tbody>
  5663. elem = tag === "table" && !rtbody.test( elem ) ?
  5664. tmp.firstChild :
  5665.  
  5666. // String was a bare <thead> or <tfoot>
  5667. wrap[ 1 ] === "<table>" && !rtbody.test( elem ) ?
  5668. tmp :
  5669. 0;
  5670.  
  5671. j = elem && elem.childNodes.length;
  5672. while ( j-- ) {
  5673. if ( jQuery.nodeName( ( tbody = elem.childNodes[ j ] ), "tbody" ) &&
  5674. !tbody.childNodes.length ) {
  5675.  
  5676. elem.removeChild( tbody );
  5677. }
  5678. }
  5679. }
  5680.  
  5681. jQuery.merge( nodes, tmp.childNodes );
  5682.  
  5683. // Fix #12392 for WebKit and IE > 9
  5684. tmp.textContent = "";
  5685.  
  5686. // Fix #12392 for oldIE
  5687. while ( tmp.firstChild ) {
  5688. tmp.removeChild( tmp.firstChild );
  5689. }
  5690.  
  5691. // Remember the top-level container for proper cleanup
  5692. tmp = safe.lastChild;
  5693. }
  5694. }
  5695. }
  5696.  
  5697. // Fix #11356: Clear elements from fragment
  5698. if ( tmp ) {
  5699. safe.removeChild( tmp );
  5700. }
  5701.  
  5702. // Reset defaultChecked for any radios and checkboxes
  5703. // about to be appended to the DOM in IE 6/7 (#8060)
  5704. if ( !support.appendChecked ) {
  5705. jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked );
  5706. }
  5707.  
  5708. i = 0;
  5709. while ( ( elem = nodes[ i++ ] ) ) {
  5710.  
  5711. // Skip elements already in the context collection (trac-4087)
  5712. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  5713. if ( ignored ) {
  5714. ignored.push( elem );
  5715. }
  5716.  
  5717. continue;
  5718. }
  5719.  
  5720. contains = jQuery.contains( elem.ownerDocument, elem );
  5721.  
  5722. // Append to fragment
  5723. tmp = getAll( safe.appendChild( elem ), "script" );
  5724.  
  5725. // Preserve script evaluation history
  5726. if ( contains ) {
  5727. setGlobalEval( tmp );
  5728. }
  5729.  
  5730. // Capture executables
  5731. if ( scripts ) {
  5732. j = 0;
  5733. while ( ( elem = tmp[ j++ ] ) ) {
  5734. if ( rscriptType.test( elem.type || "" ) ) {
  5735. scripts.push( elem );
  5736. }
  5737. }
  5738. }
  5739. }
  5740.  
  5741. tmp = null;
  5742.  
  5743. return safe;
  5744. }
  5745.  
  5746.  
  5747. ( function() {
  5748. var i, eventName,
  5749. div = document.createElement( "div" );
  5750.  
  5751. // Support: IE<9 (lack submit/change bubble), Firefox (lack focus(in | out) events)
  5752. for ( i in { submit: true, change: true, focusin: true } ) {
  5753. eventName = "on" + i;
  5754.  
  5755. if ( !( support[ i ] = eventName in window ) ) {
  5756.  
  5757. // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP)
  5758. div.setAttribute( eventName, "t" );
  5759. support[ i ] = div.attributes[ eventName ].expando === false;
  5760. }
  5761. }
  5762.  
  5763. // Null elements to avoid leaks in IE.
  5764. div = null;
  5765. } )();
  5766.  
  5767.  
  5768. var rformElems = /^(?:input|select|textarea)$/i,
  5769. rkeyEvent = /^key/,
  5770. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  5771. rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  5772. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  5773.  
  5774. function returnTrue() {
  5775. return true;
  5776. }
  5777.  
  5778. function returnFalse() {
  5779. return false;
  5780. }
  5781.  
  5782. // Support: IE9
  5783. // See #13393 for more info
  5784. function safeActiveElement() {
  5785. try {
  5786. return document.activeElement;
  5787. } catch ( err ) { }
  5788. }
  5789.  
  5790. function on( elem, types, selector, data, fn, one ) {
  5791. var origFn, type;
  5792.  
  5793. // Types can be a map of types/handlers
  5794. if ( typeof types === "object" ) {
  5795.  
  5796. // ( types-Object, selector, data )
  5797. if ( typeof selector !== "string" ) {
  5798.  
  5799. // ( types-Object, data )
  5800. data = data || selector;
  5801. selector = undefined;
  5802. }
  5803. for ( type in types ) {
  5804. on( elem, type, selector, data, types[ type ], one );
  5805. }
  5806. return elem;
  5807. }
  5808.  
  5809. if ( data == null && fn == null ) {
  5810.  
  5811. // ( types, fn )
  5812. fn = selector;
  5813. data = selector = undefined;
  5814. } else if ( fn == null ) {
  5815. if ( typeof selector === "string" ) {
  5816.  
  5817. // ( types, selector, fn )
  5818. fn = data;
  5819. data = undefined;
  5820. } else {
  5821.  
  5822. // ( types, data, fn )
  5823. fn = data;
  5824. data = selector;
  5825. selector = undefined;
  5826. }
  5827. }
  5828. if ( fn === false ) {
  5829. fn = returnFalse;
  5830. } else if ( !fn ) {
  5831. return elem;
  5832. }
  5833.  
  5834. if ( one === 1 ) {
  5835. origFn = fn;
  5836. fn = function( event ) {
  5837.  
  5838. // Can use an empty set, since event contains the info
  5839. jQuery().off( event );
  5840. return origFn.apply( this, arguments );
  5841. };
  5842.  
  5843. // Use same guid so caller can remove using origFn
  5844. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  5845. }
  5846. return elem.each( function() {
  5847. jQuery.event.add( this, types, fn, data, selector );
  5848. } );
  5849. }
  5850.  
  5851. /*
  5852. * Helper functions for managing events -- not part of the public interface.
  5853. * Props to Dean Edwards' addEvent library for many of the ideas.
  5854. */
  5855. jQuery.event = {
  5856.  
  5857. global: {},
  5858.  
  5859. add: function( elem, types, handler, data, selector ) {
  5860. var tmp, events, t, handleObjIn,
  5861. special, eventHandle, handleObj,
  5862. handlers, type, namespaces, origType,
  5863. elemData = jQuery._data( elem );
  5864.  
  5865. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  5866. if ( !elemData ) {
  5867. return;
  5868. }
  5869.  
  5870. // Caller can pass in an object of custom data in lieu of the handler
  5871. if ( handler.handler ) {
  5872. handleObjIn = handler;
  5873. handler = handleObjIn.handler;
  5874. selector = handleObjIn.selector;
  5875. }
  5876.  
  5877. // Make sure that the handler has a unique ID, used to find/remove it later
  5878. if ( !handler.guid ) {
  5879. handler.guid = jQuery.guid++;
  5880. }
  5881.  
  5882. // Init the element's event structure and main handler, if this is the first
  5883. if ( !( events = elemData.events ) ) {
  5884. events = elemData.events = {};
  5885. }
  5886. if ( !( eventHandle = elemData.handle ) ) {
  5887. eventHandle = elemData.handle = function( e ) {
  5888.  
  5889. // Discard the second event of a jQuery.event.trigger() and
  5890. // when an event is called after a page has unloaded
  5891. return typeof jQuery !== "undefined" &&
  5892. ( !e || jQuery.event.triggered !== e.type ) ?
  5893. jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
  5894. undefined;
  5895. };
  5896.  
  5897. // Add elem as a property of the handle fn to prevent a memory leak
  5898. // with IE non-native events
  5899. eventHandle.elem = elem;
  5900. }
  5901.  
  5902. // Handle multiple events separated by a space
  5903. types = ( types || "" ).match( rnotwhite ) || [ "" ];
  5904. t = types.length;
  5905. while ( t-- ) {
  5906. tmp = rtypenamespace.exec( types[ t ] ) || [];
  5907. type = origType = tmp[ 1 ];
  5908. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  5909.  
  5910. // There *must* be a type, no attaching namespace-only handlers
  5911. if ( !type ) {
  5912. continue;
  5913. }
  5914.  
  5915. // If event changes its type, use the special event handlers for the changed type
  5916. special = jQuery.event.special[ type ] || {};
  5917.  
  5918. // If selector defined, determine special event api type, otherwise given type
  5919. type = ( selector ? special.delegateType : special.bindType ) || type;
  5920.  
  5921. // Update special based on newly reset type
  5922. special = jQuery.event.special[ type ] || {};
  5923.  
  5924. // handleObj is passed to all event handlers
  5925. handleObj = jQuery.extend( {
  5926. type: type,
  5927. origType: origType,
  5928. data: data,
  5929. handler: handler,
  5930. guid: handler.guid,
  5931. selector: selector,
  5932. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  5933. namespace: namespaces.join( "." )
  5934. }, handleObjIn );
  5935.  
  5936. // Init the event handler queue if we're the first
  5937. if ( !( handlers = events[ type ] ) ) {
  5938. handlers = events[ type ] = [];
  5939. handlers.delegateCount = 0;
  5940.  
  5941. // Only use addEventListener/attachEvent if the special events handler returns false
  5942. if ( !special.setup ||
  5943. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  5944.  
  5945. // Bind the global event handler to the element
  5946. if ( elem.addEventListener ) {
  5947. elem.addEventListener( type, eventHandle, false );
  5948.  
  5949. } else if ( elem.attachEvent ) {
  5950. elem.attachEvent( "on" + type, eventHandle );
  5951. }
  5952. }
  5953. }
  5954.  
  5955. if ( special.add ) {
  5956. special.add.call( elem, handleObj );
  5957.  
  5958. if ( !handleObj.handler.guid ) {
  5959. handleObj.handler.guid = handler.guid;
  5960. }
  5961. }
  5962.  
  5963. // Add to the element's handler list, delegates in front
  5964. if ( selector ) {
  5965. handlers.splice( handlers.delegateCount++, 0, handleObj );
  5966. } else {
  5967. handlers.push( handleObj );
  5968. }
  5969.  
  5970. // Keep track of which events have ever been used, for event optimization
  5971. jQuery.event.global[ type ] = true;
  5972. }
  5973.  
  5974. // Nullify elem to prevent memory leaks in IE
  5975. elem = null;
  5976. },
  5977.  
  5978. // Detach an event or set of events from an element
  5979. remove: function( elem, types, handler, selector, mappedTypes ) {
  5980. var j, handleObj, tmp,
  5981. origCount, t, events,
  5982. special, handlers, type,
  5983. namespaces, origType,
  5984. elemData = jQuery.hasData( elem ) && jQuery._data( elem );
  5985.  
  5986. if ( !elemData || !( events = elemData.events ) ) {
  5987. return;
  5988. }
  5989.  
  5990. // Once for each type.namespace in types; type may be omitted
  5991. types = ( types || "" ).match( rnotwhite ) || [ "" ];
  5992. t = types.length;
  5993. while ( t-- ) {
  5994. tmp = rtypenamespace.exec( types[ t ] ) || [];
  5995. type = origType = tmp[ 1 ];
  5996. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  5997.  
  5998. // Unbind all events (on this namespace, if provided) for the element
  5999. if ( !type ) {
  6000. for ( type in events ) {
  6001. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  6002. }
  6003. continue;
  6004. }
  6005.  
  6006. special = jQuery.event.special[ type ] || {};
  6007. type = ( selector ? special.delegateType : special.bindType ) || type;
  6008. handlers = events[ type ] || [];
  6009. tmp = tmp[ 2 ] &&
  6010. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  6011.  
  6012. // Remove matching events
  6013. origCount = j = handlers.length;
  6014. while ( j-- ) {
  6015. handleObj = handlers[ j ];
  6016.  
  6017. if ( ( mappedTypes || origType === handleObj.origType ) &&
  6018. ( !handler || handler.guid === handleObj.guid ) &&
  6019. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  6020. ( !selector || selector === handleObj.selector ||
  6021. selector === "**" && handleObj.selector ) ) {
  6022. handlers.splice( j, 1 );
  6023.  
  6024. if ( handleObj.selector ) {
  6025. handlers.delegateCount--;
  6026. }
  6027. if ( special.remove ) {
  6028. special.remove.call( elem, handleObj );
  6029. }
  6030. }
  6031. }
  6032.  
  6033. // Remove generic event handler if we removed something and no more handlers exist
  6034. // (avoids potential for endless recursion during removal of special event handlers)
  6035. if ( origCount && !handlers.length ) {
  6036. if ( !special.teardown ||
  6037. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  6038.  
  6039. jQuery.removeEvent( elem, type, elemData.handle );
  6040. }
  6041.  
  6042. delete events[ type ];
  6043. }
  6044. }
  6045.  
  6046. // Remove the expando if it's no longer used
  6047. if ( jQuery.isEmptyObject( events ) ) {
  6048. delete elemData.handle;
  6049.  
  6050. // removeData also checks for emptiness and clears the expando if empty
  6051. // so use it instead of delete
  6052. jQuery._removeData( elem, "events" );
  6053. }
  6054. },
  6055.  
  6056. trigger: function( event, data, elem, onlyHandlers ) {
  6057. var handle, ontype, cur,
  6058. bubbleType, special, tmp, i,
  6059. eventPath = [ elem || document ],
  6060. type = hasOwn.call( event, "type" ) ? event.type : event,
  6061. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  6062.  
  6063. cur = tmp = elem = elem || document;
  6064.  
  6065. // Don't do events on text and comment nodes
  6066. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  6067. return;
  6068. }
  6069.  
  6070. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  6071. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  6072. return;
  6073. }
  6074.  
  6075. if ( type.indexOf( "." ) > -1 ) {
  6076.  
  6077. // Namespaced trigger; create a regexp to match event type in handle()
  6078. namespaces = type.split( "." );
  6079. type = namespaces.shift();
  6080. namespaces.sort();
  6081. }
  6082. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  6083.  
  6084. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  6085. event = event[ jQuery.expando ] ?
  6086. event :
  6087. new jQuery.Event( type, typeof event === "object" && event );
  6088.  
  6089. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  6090. event.isTrigger = onlyHandlers ? 2 : 3;
  6091. event.namespace = namespaces.join( "." );
  6092. event.rnamespace = event.namespace ?
  6093. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  6094. null;
  6095.  
  6096. // Clean up the event in case it is being reused
  6097. event.result = undefined;
  6098. if ( !event.target ) {
  6099. event.target = elem;
  6100. }
  6101.  
  6102. // Clone any incoming data and prepend the event, creating the handler arg list
  6103. data = data == null ?
  6104. [ event ] :
  6105. jQuery.makeArray( data, [ event ] );
  6106.  
  6107. // Allow special events to draw outside the lines
  6108. special = jQuery.event.special[ type ] || {};
  6109. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  6110. return;
  6111. }
  6112.  
  6113. // Determine event propagation path in advance, per W3C events spec (#9951)
  6114. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  6115. if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
  6116.  
  6117. bubbleType = special.delegateType || type;
  6118. if ( !rfocusMorph.test( bubbleType + type ) ) {
  6119. cur = cur.parentNode;
  6120. }
  6121. for ( ; cur; cur = cur.parentNode ) {
  6122. eventPath.push( cur );
  6123. tmp = cur;
  6124. }
  6125.  
  6126. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  6127. if ( tmp === ( elem.ownerDocument || document ) ) {
  6128. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  6129. }
  6130. }
  6131.  
  6132. // Fire handlers on the event path
  6133. i = 0;
  6134. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  6135.  
  6136. event.type = i > 1 ?
  6137. bubbleType :
  6138. special.bindType || type;
  6139.  
  6140. // jQuery handler
  6141. handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] &&
  6142. jQuery._data( cur, "handle" );
  6143.  
  6144. if ( handle ) {
  6145. handle.apply( cur, data );
  6146. }
  6147.  
  6148. // Native handler
  6149. handle = ontype && cur[ ontype ];
  6150. if ( handle && handle.apply && acceptData( cur ) ) {
  6151. event.result = handle.apply( cur, data );
  6152. if ( event.result === false ) {
  6153. event.preventDefault();
  6154. }
  6155. }
  6156. }
  6157. event.type = type;
  6158.  
  6159. // If nobody prevented the default action, do it now
  6160. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  6161.  
  6162. if (
  6163. ( !special._default ||
  6164. special._default.apply( eventPath.pop(), data ) === false
  6165. ) && acceptData( elem )
  6166. ) {
  6167.  
  6168. // Call a native DOM method on the target with the same name name as the event.
  6169. // Can't use an .isFunction() check here because IE6/7 fails that test.
  6170. // Don't do default actions on window, that's where global variables be (#6170)
  6171. if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) {
  6172.  
  6173. // Don't re-trigger an onFOO event when we call its FOO() method
  6174. tmp = elem[ ontype ];
  6175.  
  6176. if ( tmp ) {
  6177. elem[ ontype ] = null;
  6178. }
  6179.  
  6180. // Prevent re-triggering of the same event, since we already bubbled it above
  6181. jQuery.event.triggered = type;
  6182. try {
  6183. elem[ type ]();
  6184. } catch ( e ) {
  6185.  
  6186. // IE<9 dies on focus/blur to hidden element (#1486,#12518)
  6187. // only reproducible on winXP IE8 native, not IE9 in IE8 mode
  6188. }
  6189. jQuery.event.triggered = undefined;
  6190.  
  6191. if ( tmp ) {
  6192. elem[ ontype ] = tmp;
  6193. }
  6194. }
  6195. }
  6196. }
  6197.  
  6198. return event.result;
  6199. },
  6200.  
  6201. dispatch: function( event ) {
  6202.  
  6203. // Make a writable jQuery.Event from the native event object
  6204. event = jQuery.event.fix( event );
  6205.  
  6206. var i, j, ret, matched, handleObj,
  6207. handlerQueue = [],
  6208. args = slice.call( arguments ),
  6209. handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [],
  6210. special = jQuery.event.special[ event.type ] || {};
  6211.  
  6212. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  6213. args[ 0 ] = event;
  6214. event.delegateTarget = this;
  6215.  
  6216. // Call the preDispatch hook for the mapped type, and let it bail if desired
  6217. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  6218. return;
  6219. }
  6220.  
  6221. // Determine handlers
  6222. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  6223.  
  6224. // Run delegates first; they may want to stop propagation beneath us
  6225. i = 0;
  6226. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  6227. event.currentTarget = matched.elem;
  6228.  
  6229. j = 0;
  6230. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  6231. !event.isImmediatePropagationStopped() ) {
  6232.  
  6233. // Triggered event must either 1) have no namespace, or 2) have namespace(s)
  6234. // a subset or equal to those in the bound event (both can have no namespace).
  6235. if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) {
  6236.  
  6237. event.handleObj = handleObj;
  6238. event.data = handleObj.data;
  6239.  
  6240. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  6241. handleObj.handler ).apply( matched.elem, args );
  6242.  
  6243. if ( ret !== undefined ) {
  6244. if ( ( event.result = ret ) === false ) {
  6245. event.preventDefault();
  6246. event.stopPropagation();
  6247. }
  6248. }
  6249. }
  6250. }
  6251. }
  6252.  
  6253. // Call the postDispatch hook for the mapped type
  6254. if ( special.postDispatch ) {
  6255. special.postDispatch.call( this, event );
  6256. }
  6257.  
  6258. return event.result;
  6259. },
  6260.  
  6261. handlers: function( event, handlers ) {
  6262. var i, matches, sel, handleObj,
  6263. handlerQueue = [],
  6264. delegateCount = handlers.delegateCount,
  6265. cur = event.target;
  6266.  
  6267. // Support (at least): Chrome, IE9
  6268. // Find delegate handlers
  6269. // Black-hole SVG <use> instance trees (#13180)
  6270. //
  6271. // Support: Firefox<=42+
  6272. // Avoid non-left-click in FF but don't block IE radio events (#3861, gh-2343)
  6273. if ( delegateCount && cur.nodeType &&
  6274. ( event.type !== "click" || isNaN( event.button ) || event.button < 1 ) ) {
  6275.  
  6276. /* jshint eqeqeq: false */
  6277. for ( ; cur != this; cur = cur.parentNode || this ) {
  6278. /* jshint eqeqeq: true */
  6279.  
  6280. // Don't check non-elements (#13208)
  6281. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  6282. if ( cur.nodeType === 1 && ( cur.disabled !== true || event.type !== "click" ) ) {
  6283. matches = [];
  6284. for ( i = 0; i < delegateCount; i++ ) {
  6285. handleObj = handlers[ i ];
  6286.  
  6287. // Don't conflict with Object.prototype properties (#13203)
  6288. sel = handleObj.selector + " ";
  6289.  
  6290. if ( matches[ sel ] === undefined ) {
  6291. matches[ sel ] = handleObj.needsContext ?
  6292. jQuery( sel, this ).index( cur ) > -1 :
  6293. jQuery.find( sel, this, null, [ cur ] ).length;
  6294. }
  6295. if ( matches[ sel ] ) {
  6296. matches.push( handleObj );
  6297. }
  6298. }
  6299. if ( matches.length ) {
  6300. handlerQueue.push( { elem: cur, handlers: matches } );
  6301. }
  6302. }
  6303. }
  6304. }
  6305.  
  6306. // Add the remaining (directly-bound) handlers
  6307. if ( delegateCount < handlers.length ) {
  6308. handlerQueue.push( { elem: this, handlers: handlers.slice( delegateCount ) } );
  6309. }
  6310.  
  6311. return handlerQueue;
  6312. },
  6313.  
  6314. fix: function( event ) {
  6315. if ( event[ jQuery.expando ] ) {
  6316. return event;
  6317. }
  6318.  
  6319. // Create a writable copy of the event object and normalize some properties
  6320. var i, prop, copy,
  6321. type = event.type,
  6322. originalEvent = event,
  6323. fixHook = this.fixHooks[ type ];
  6324.  
  6325. if ( !fixHook ) {
  6326. this.fixHooks[ type ] = fixHook =
  6327. rmouseEvent.test( type ) ? this.mouseHooks :
  6328. rkeyEvent.test( type ) ? this.keyHooks :
  6329. {};
  6330. }
  6331. copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
  6332.  
  6333. event = new jQuery.Event( originalEvent );
  6334.  
  6335. i = copy.length;
  6336. while ( i-- ) {
  6337. prop = copy[ i ];
  6338. event[ prop ] = originalEvent[ prop ];
  6339. }
  6340.  
  6341. // Support: IE<9
  6342. // Fix target property (#1925)
  6343. if ( !event.target ) {
  6344. event.target = originalEvent.srcElement || document;
  6345. }
  6346.  
  6347. // Support: Safari 6-8+
  6348. // Target should not be a text node (#504, #13143)
  6349. if ( event.target.nodeType === 3 ) {
  6350. event.target = event.target.parentNode;
  6351. }
  6352.  
  6353. // Support: IE<9
  6354. // For mouse/key events, metaKey==false if it's undefined (#3368, #11328)
  6355. event.metaKey = !!event.metaKey;
  6356.  
  6357. return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
  6358. },
  6359.  
  6360. // Includes some event props shared by KeyEvent and MouseEvent
  6361. props: ( "altKey bubbles cancelable ctrlKey currentTarget detail eventPhase " +
  6362. "metaKey relatedTarget shiftKey target timeStamp view which" ).split( " " ),
  6363.  
  6364. fixHooks: {},
  6365.  
  6366. keyHooks: {
  6367. props: "char charCode key keyCode".split( " " ),
  6368. filter: function( event, original ) {
  6369.  
  6370. // Add which for key events
  6371. if ( event.which == null ) {
  6372. event.which = original.charCode != null ? original.charCode : original.keyCode;
  6373. }
  6374.  
  6375. return event;
  6376. }
  6377. },
  6378.  
  6379. mouseHooks: {
  6380. props: ( "button buttons clientX clientY fromElement offsetX offsetY " +
  6381. "pageX pageY screenX screenY toElement" ).split( " " ),
  6382. filter: function( event, original ) {
  6383. var body, eventDoc, doc,
  6384. button = original.button,
  6385. fromElement = original.fromElement;
  6386.  
  6387. // Calculate pageX/Y if missing and clientX/Y available
  6388. if ( event.pageX == null && original.clientX != null ) {
  6389. eventDoc = event.target.ownerDocument || document;
  6390. doc = eventDoc.documentElement;
  6391. body = eventDoc.body;
  6392.  
  6393. event.pageX = original.clientX +
  6394. ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) -
  6395. ( doc && doc.clientLeft || body && body.clientLeft || 0 );
  6396. event.pageY = original.clientY +
  6397. ( doc && doc.scrollTop || body && body.scrollTop || 0 ) -
  6398. ( doc && doc.clientTop || body && body.clientTop || 0 );
  6399. }
  6400.  
  6401. // Add relatedTarget, if necessary
  6402. if ( !event.relatedTarget && fromElement ) {
  6403. event.relatedTarget = fromElement === event.target ?
  6404. original.toElement :
  6405. fromElement;
  6406. }
  6407.  
  6408. // Add which for click: 1 === left; 2 === middle; 3 === right
  6409. // Note: button is not normalized, so don't use it
  6410. if ( !event.which && button !== undefined ) {
  6411. event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
  6412. }
  6413.  
  6414. return event;
  6415. }
  6416. },
  6417.  
  6418. special: {
  6419. load: {
  6420.  
  6421. // Prevent triggered image.load events from bubbling to window.load
  6422. noBubble: true
  6423. },
  6424. focus: {
  6425.  
  6426. // Fire native event if possible so blur/focus sequence is correct
  6427. trigger: function() {
  6428. if ( this !== safeActiveElement() && this.focus ) {
  6429. try {
  6430. this.focus();
  6431. return false;
  6432. } catch ( e ) {
  6433.  
  6434. // Support: IE<9
  6435. // If we error on focus to hidden element (#1486, #12518),
  6436. // let .trigger() run the handlers
  6437. }
  6438. }
  6439. },
  6440. delegateType: "focusin"
  6441. },
  6442. blur: {
  6443. trigger: function() {
  6444. if ( this === safeActiveElement() && this.blur ) {
  6445. this.blur();
  6446. return false;
  6447. }
  6448. },
  6449. delegateType: "focusout"
  6450. },
  6451. click: {
  6452.  
  6453. // For checkbox, fire native event so checked state will be right
  6454. trigger: function() {
  6455. if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) {
  6456. this.click();
  6457. return false;
  6458. }
  6459. },
  6460.  
  6461. // For cross-browser consistency, don't fire native .click() on links
  6462. _default: function( event ) {
  6463. return jQuery.nodeName( event.target, "a" );
  6464. }
  6465. },
  6466.  
  6467. beforeunload: {
  6468. postDispatch: function( event ) {
  6469.  
  6470. // Support: Firefox 20+
  6471. // Firefox doesn't alert if the returnValue field is not set.
  6472. if ( event.result !== undefined && event.originalEvent ) {
  6473. event.originalEvent.returnValue = event.result;
  6474. }
  6475. }
  6476. }
  6477. },
  6478.  
  6479. // Piggyback on a donor event to simulate a different one
  6480. simulate: function( type, elem, event ) {
  6481. var e = jQuery.extend(
  6482. new jQuery.Event(),
  6483. event,
  6484. {
  6485. type: type,
  6486. isSimulated: true
  6487.  
  6488. // Previously, `originalEvent: {}` was set here, so stopPropagation call
  6489. // would not be triggered on donor event, since in our own
  6490. // jQuery.event.stopPropagation function we had a check for existence of
  6491. // originalEvent.stopPropagation method, so, consequently it would be a noop.
  6492. //
  6493. // Guard for simulated events was moved to jQuery.event.stopPropagation function
  6494. // since `originalEvent` should point to the original event for the
  6495. // constancy with other events and for more focused logic
  6496. }
  6497. );
  6498.  
  6499. jQuery.event.trigger( e, null, elem );
  6500.  
  6501. if ( e.isDefaultPrevented() ) {
  6502. event.preventDefault();
  6503. }
  6504. }
  6505. };
  6506.  
  6507. jQuery.removeEvent = document.removeEventListener ?
  6508. function( elem, type, handle ) {
  6509.  
  6510. // This "if" is needed for plain objects
  6511. if ( elem.removeEventListener ) {
  6512. elem.removeEventListener( type, handle );
  6513. }
  6514. } :
  6515. function( elem, type, handle ) {
  6516. var name = "on" + type;
  6517.  
  6518. if ( elem.detachEvent ) {
  6519.  
  6520. // #8545, #7054, preventing memory leaks for custom events in IE6-8
  6521. // detachEvent needed property on element, by name of that event,
  6522. // to properly expose it to GC
  6523. if ( typeof elem[ name ] === "undefined" ) {
  6524. elem[ name ] = null;
  6525. }
  6526.  
  6527. elem.detachEvent( name, handle );
  6528. }
  6529. };
  6530.  
  6531. jQuery.Event = function( src, props ) {
  6532.  
  6533. // Allow instantiation without the 'new' keyword
  6534. if ( !( this instanceof jQuery.Event ) ) {
  6535. return new jQuery.Event( src, props );
  6536. }
  6537.  
  6538. // Event object
  6539. if ( src && src.type ) {
  6540. this.originalEvent = src;
  6541. this.type = src.type;
  6542.  
  6543. // Events bubbling up the document may have been marked as prevented
  6544. // by a handler lower down the tree; reflect the correct value.
  6545. this.isDefaultPrevented = src.defaultPrevented ||
  6546. src.defaultPrevented === undefined &&
  6547.  
  6548. // Support: IE < 9, Android < 4.0
  6549. src.returnValue === false ?
  6550. returnTrue :
  6551. returnFalse;
  6552.  
  6553. // Event type
  6554. } else {
  6555. this.type = src;
  6556. }
  6557.  
  6558. // Put explicitly provided properties onto the event object
  6559. if ( props ) {
  6560. jQuery.extend( this, props );
  6561. }
  6562.  
  6563. // Create a timestamp if incoming event doesn't have one
  6564. this.timeStamp = src && src.timeStamp || jQuery.now();
  6565.  
  6566. // Mark it as fixed
  6567. this[ jQuery.expando ] = true;
  6568. };
  6569.  
  6570. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  6571. // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  6572. jQuery.Event.prototype = {
  6573. constructor: jQuery.Event,
  6574. isDefaultPrevented: returnFalse,
  6575. isPropagationStopped: returnFalse,
  6576. isImmediatePropagationStopped: returnFalse,
  6577.  
  6578. preventDefault: function() {
  6579. var e = this.originalEvent;
  6580.  
  6581. this.isDefaultPrevented = returnTrue;
  6582. if ( !e ) {
  6583. return;
  6584. }
  6585.  
  6586. // If preventDefault exists, run it on the original event
  6587. if ( e.preventDefault ) {
  6588. e.preventDefault();
  6589.  
  6590. // Support: IE
  6591. // Otherwise set the returnValue property of the original event to false
  6592. } else {
  6593. e.returnValue = false;
  6594. }
  6595. },
  6596. stopPropagation: function() {
  6597. var e = this.originalEvent;
  6598.  
  6599. this.isPropagationStopped = returnTrue;
  6600.  
  6601. if ( !e || this.isSimulated ) {
  6602. return;
  6603. }
  6604.  
  6605. // If stopPropagation exists, run it on the original event
  6606. if ( e.stopPropagation ) {
  6607. e.stopPropagation();
  6608. }
  6609.  
  6610. // Support: IE
  6611. // Set the cancelBubble property of the original event to true
  6612. e.cancelBubble = true;
  6613. },
  6614. stopImmediatePropagation: function() {
  6615. var e = this.originalEvent;
  6616.  
  6617. this.isImmediatePropagationStopped = returnTrue;
  6618.  
  6619. if ( e && e.stopImmediatePropagation ) {
  6620. e.stopImmediatePropagation();
  6621. }
  6622.  
  6623. this.stopPropagation();
  6624. }
  6625. };
  6626.  
  6627. // Create mouseenter/leave events using mouseover/out and event-time checks
  6628. // so that event delegation works in jQuery.
  6629. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  6630. //
  6631. // Support: Safari 7 only
  6632. // Safari sends mouseenter too often; see:
  6633. // https://code.google.com/p/chromium/issues/detail?id=470258
  6634. // for the description of the bug (it existed in older Chrome versions as well).
  6635. jQuery.each( {
  6636. mouseenter: "mouseover",
  6637. mouseleave: "mouseout",
  6638. pointerenter: "pointerover",
  6639. pointerleave: "pointerout"
  6640. }, function( orig, fix ) {
  6641. jQuery.event.special[ orig ] = {
  6642. delegateType: fix,
  6643. bindType: fix,
  6644.  
  6645. handle: function( event ) {
  6646. var ret,
  6647. target = this,
  6648. related = event.relatedTarget,
  6649. handleObj = event.handleObj;
  6650.  
  6651. // For mouseenter/leave call the handler if related is outside the target.
  6652. // NB: No relatedTarget if the mouse left/entered the browser window
  6653. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  6654. event.type = handleObj.origType;
  6655. ret = handleObj.handler.apply( this, arguments );
  6656. event.type = fix;
  6657. }
  6658. return ret;
  6659. }
  6660. };
  6661. } );
  6662.  
  6663. // IE submit delegation
  6664. if ( !support.submit ) {
  6665.  
  6666. jQuery.event.special.submit = {
  6667. setup: function() {
  6668.  
  6669. // Only need this for delegated form submit events
  6670. if ( jQuery.nodeName( this, "form" ) ) {
  6671. return false;
  6672. }
  6673.  
  6674. // Lazy-add a submit handler when a descendant form may potentially be submitted
  6675. jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
  6676.  
  6677. // Node name check avoids a VML-related crash in IE (#9807)
  6678. var elem = e.target,
  6679. form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ?
  6680.  
  6681. // Support: IE <=8
  6682. // We use jQuery.prop instead of elem.form
  6683. // to allow fixing the IE8 delegated submit issue (gh-2332)
  6684. // by 3rd party polyfills/workarounds.
  6685. jQuery.prop( elem, "form" ) :
  6686. undefined;
  6687.  
  6688. if ( form && !jQuery._data( form, "submit" ) ) {
  6689. jQuery.event.add( form, "submit._submit", function( event ) {
  6690. event._submitBubble = true;
  6691. } );
  6692. jQuery._data( form, "submit", true );
  6693. }
  6694. } );
  6695.  
  6696. // return undefined since we don't need an event listener
  6697. },
  6698.  
  6699. postDispatch: function( event ) {
  6700.  
  6701. // If form was submitted by the user, bubble the event up the tree
  6702. if ( event._submitBubble ) {
  6703. delete event._submitBubble;
  6704. if ( this.parentNode && !event.isTrigger ) {
  6705. jQuery.event.simulate( "submit", this.parentNode, event );
  6706. }
  6707. }
  6708. },
  6709.  
  6710. teardown: function() {
  6711.  
  6712. // Only need this for delegated form submit events
  6713. if ( jQuery.nodeName( this, "form" ) ) {
  6714. return false;
  6715. }
  6716.  
  6717. // Remove delegated handlers; cleanData eventually reaps submit handlers attached above
  6718. jQuery.event.remove( this, "._submit" );
  6719. }
  6720. };
  6721. }
  6722.  
  6723. // IE change delegation and checkbox/radio fix
  6724. if ( !support.change ) {
  6725.  
  6726. jQuery.event.special.change = {
  6727.  
  6728. setup: function() {
  6729.  
  6730. if ( rformElems.test( this.nodeName ) ) {
  6731.  
  6732. // IE doesn't fire change on a check/radio until blur; trigger it on click
  6733. // after a propertychange. Eat the blur-change in special.change.handle.
  6734. // This still fires onchange a second time for check/radio after blur.
  6735. if ( this.type === "checkbox" || this.type === "radio" ) {
  6736. jQuery.event.add( this, "propertychange._change", function( event ) {
  6737. if ( event.originalEvent.propertyName === "checked" ) {
  6738. this._justChanged = true;
  6739. }
  6740. } );
  6741. jQuery.event.add( this, "click._change", function( event ) {
  6742. if ( this._justChanged && !event.isTrigger ) {
  6743. this._justChanged = false;
  6744. }
  6745.  
  6746. // Allow triggered, simulated change events (#11500)
  6747. jQuery.event.simulate( "change", this, event );
  6748. } );
  6749. }
  6750. return false;
  6751. }
  6752.  
  6753. // Delegated event; lazy-add a change handler on descendant inputs
  6754. jQuery.event.add( this, "beforeactivate._change", function( e ) {
  6755. var elem = e.target;
  6756.  
  6757. if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "change" ) ) {
  6758. jQuery.event.add( elem, "change._change", function( event ) {
  6759. if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
  6760. jQuery.event.simulate( "change", this.parentNode, event );
  6761. }
  6762. } );
  6763. jQuery._data( elem, "change", true );
  6764. }
  6765. } );
  6766. },
  6767.  
  6768. handle: function( event ) {
  6769. var elem = event.target;
  6770.  
  6771. // Swallow native change events from checkbox/radio, we already triggered them above
  6772. if ( this !== elem || event.isSimulated || event.isTrigger ||
  6773. ( elem.type !== "radio" && elem.type !== "checkbox" ) ) {
  6774.  
  6775. return event.handleObj.handler.apply( this, arguments );
  6776. }
  6777. },
  6778.  
  6779. teardown: function() {
  6780. jQuery.event.remove( this, "._change" );
  6781.  
  6782. return !rformElems.test( this.nodeName );
  6783. }
  6784. };
  6785. }
  6786.  
  6787. // Support: Firefox
  6788. // Firefox doesn't have focus(in | out) events
  6789. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  6790. //
  6791. // Support: Chrome, Safari
  6792. // focus(in | out) events fire after focus & blur events,
  6793. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  6794. // Related ticket - https://code.google.com/p/chromium/issues/detail?id=449857
  6795. if ( !support.focusin ) {
  6796. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  6797.  
  6798. // Attach a single capturing handler on the document while someone wants focusin/focusout
  6799. var handler = function( event ) {
  6800. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  6801. };
  6802.  
  6803. jQuery.event.special[ fix ] = {
  6804. setup: function() {
  6805. var doc = this.ownerDocument || this,
  6806. attaches = jQuery._data( doc, fix );
  6807.  
  6808. if ( !attaches ) {
  6809. doc.addEventListener( orig, handler, true );
  6810. }
  6811. jQuery._data( doc, fix, ( attaches || 0 ) + 1 );
  6812. },
  6813. teardown: function() {
  6814. var doc = this.ownerDocument || this,
  6815. attaches = jQuery._data( doc, fix ) - 1;
  6816.  
  6817. if ( !attaches ) {
  6818. doc.removeEventListener( orig, handler, true );
  6819. jQuery._removeData( doc, fix );
  6820. } else {
  6821. jQuery._data( doc, fix, attaches );
  6822. }
  6823. }
  6824. };
  6825. } );
  6826. }
  6827.  
  6828. jQuery.fn.extend( {
  6829.  
  6830. on: function( types, selector, data, fn ) {
  6831. return on( this, types, selector, data, fn );
  6832. },
  6833. one: function( types, selector, data, fn ) {
  6834. return on( this, types, selector, data, fn, 1 );
  6835. },
  6836. off: function( types, selector, fn ) {
  6837. var handleObj, type;
  6838. if ( types && types.preventDefault && types.handleObj ) {
  6839.  
  6840. // ( event ) dispatched jQuery.Event
  6841. handleObj = types.handleObj;
  6842. jQuery( types.delegateTarget ).off(
  6843. handleObj.namespace ?
  6844. handleObj.origType + "." + handleObj.namespace :
  6845. handleObj.origType,
  6846. handleObj.selector,
  6847. handleObj.handler
  6848. );
  6849. return this;
  6850. }
  6851. if ( typeof types === "object" ) {
  6852.  
  6853. // ( types-object [, selector] )
  6854. for ( type in types ) {
  6855. this.off( type, selector, types[ type ] );
  6856. }
  6857. return this;
  6858. }
  6859. if ( selector === false || typeof selector === "function" ) {
  6860.  
  6861. // ( types [, fn] )
  6862. fn = selector;
  6863. selector = undefined;
  6864. }
  6865. if ( fn === false ) {
  6866. fn = returnFalse;
  6867. }
  6868. return this.each( function() {
  6869. jQuery.event.remove( this, types, fn, selector );
  6870. } );
  6871. },
  6872.  
  6873. trigger: function( type, data ) {
  6874. return this.each( function() {
  6875. jQuery.event.trigger( type, data, this );
  6876. } );
  6877. },
  6878. triggerHandler: function( type, data ) {
  6879. var elem = this[ 0 ];
  6880. if ( elem ) {
  6881. return jQuery.event.trigger( type, data, elem, true );
  6882. }
  6883. }
  6884. } );
  6885.  
  6886.  
  6887. var rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g,
  6888. rnoshimcache = new RegExp( "<(?:" + nodeNames + ")[\\s/>]", "i" ),
  6889. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,
  6890.  
  6891. // Support: IE 10-11, Edge 10240+
  6892. // In IE/Edge using regex groups here causes severe slowdowns.
  6893. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  6894. rnoInnerhtml = /<script|<style|<link/i,
  6895.  
  6896. // checked="checked" or checked
  6897. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  6898. rscriptTypeMasked = /^true\/(.*)/,
  6899. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
  6900. safeFragment = createSafeFragment( document ),
  6901. fragmentDiv = safeFragment.appendChild( document.createElement( "div" ) );
  6902.  
  6903. // Support: IE<8
  6904. // Manipulating tables requires a tbody
  6905. function manipulationTarget( elem, content ) {
  6906. return jQuery.nodeName( elem, "table" ) &&
  6907. jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ?
  6908.  
  6909. elem.getElementsByTagName( "tbody" )[ 0 ] ||
  6910. elem.appendChild( elem.ownerDocument.createElement( "tbody" ) ) :
  6911. elem;
  6912. }
  6913.  
  6914. // Replace/restore the type attribute of script elements for safe DOM manipulation
  6915. function disableScript( elem ) {
  6916. elem.type = ( jQuery.find.attr( elem, "type" ) !== null ) + "/" + elem.type;
  6917. return elem;
  6918. }
  6919. function restoreScript( elem ) {
  6920. var match = rscriptTypeMasked.exec( elem.type );
  6921. if ( match ) {
  6922. elem.type = match[ 1 ];
  6923. } else {
  6924. elem.removeAttribute( "type" );
  6925. }
  6926. return elem;
  6927. }
  6928.  
  6929. function cloneCopyEvent( src, dest ) {
  6930. if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
  6931. return;
  6932. }
  6933.  
  6934. var type, i, l,
  6935. oldData = jQuery._data( src ),
  6936. curData = jQuery._data( dest, oldData ),
  6937. events = oldData.events;
  6938.  
  6939. if ( events ) {
  6940. delete curData.handle;
  6941. curData.events = {};
  6942.  
  6943. for ( type in events ) {
  6944. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  6945. jQuery.event.add( dest, type, events[ type ][ i ] );
  6946. }
  6947. }
  6948. }
  6949.  
  6950. // make the cloned public data object a copy from the original
  6951. if ( curData.data ) {
  6952. curData.data = jQuery.extend( {}, curData.data );
  6953. }
  6954. }
  6955.  
  6956. function fixCloneNodeIssues( src, dest ) {
  6957. var nodeName, e, data;
  6958.  
  6959. // We do not need to do anything for non-Elements
  6960. if ( dest.nodeType !== 1 ) {
  6961. return;
  6962. }
  6963.  
  6964. nodeName = dest.nodeName.toLowerCase();
  6965.  
  6966. // IE6-8 copies events bound via attachEvent when using cloneNode.
  6967. if ( !support.noCloneEvent && dest[ jQuery.expando ] ) {
  6968. data = jQuery._data( dest );
  6969.  
  6970. for ( e in data.events ) {
  6971. jQuery.removeEvent( dest, e, data.handle );
  6972. }
  6973.  
  6974. // Event data gets referenced instead of copied if the expando gets copied too
  6975. dest.removeAttribute( jQuery.expando );
  6976. }
  6977.  
  6978. // IE blanks contents when cloning scripts, and tries to evaluate newly-set text
  6979. if ( nodeName === "script" && dest.text !== src.text ) {
  6980. disableScript( dest ).text = src.text;
  6981. restoreScript( dest );
  6982.  
  6983. // IE6-10 improperly clones children of object elements using classid.
  6984. // IE10 throws NoModificationAllowedError if parent is null, #12132.
  6985. } else if ( nodeName === "object" ) {
  6986. if ( dest.parentNode ) {
  6987. dest.outerHTML = src.outerHTML;
  6988. }
  6989.  
  6990. // This path appears unavoidable for IE9. When cloning an object
  6991. // element in IE9, the outerHTML strategy above is not sufficient.
  6992. // If the src has innerHTML and the destination does not,
  6993. // copy the src.innerHTML into the dest.innerHTML. #10324
  6994. if ( support.html5Clone && ( src.innerHTML && !jQuery.trim( dest.innerHTML ) ) ) {
  6995. dest.innerHTML = src.innerHTML;
  6996. }
  6997.  
  6998. } else if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  6999.  
  7000. // IE6-8 fails to persist the checked state of a cloned checkbox
  7001. // or radio button. Worse, IE6-7 fail to give the cloned element
  7002. // a checked appearance if the defaultChecked value isn't also set
  7003.  
  7004. dest.defaultChecked = dest.checked = src.checked;
  7005.  
  7006. // IE6-7 get confused and end up setting the value of a cloned
  7007. // checkbox/radio button to an empty string instead of "on"
  7008. if ( dest.value !== src.value ) {
  7009. dest.value = src.value;
  7010. }
  7011.  
  7012. // IE6-8 fails to return the selected option to the default selected
  7013. // state when cloning options
  7014. } else if ( nodeName === "option" ) {
  7015. dest.defaultSelected = dest.selected = src.defaultSelected;
  7016.  
  7017. // IE6-8 fails to set the defaultValue to the correct value when
  7018. // cloning other types of input fields
  7019. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  7020. dest.defaultValue = src.defaultValue;
  7021. }
  7022. }
  7023.  
  7024. function domManip( collection, args, callback, ignored ) {
  7025.  
  7026. // Flatten any nested arrays
  7027. args = concat.apply( [], args );
  7028.  
  7029. var first, node, hasScripts,
  7030. scripts, doc, fragment,
  7031. i = 0,
  7032. l = collection.length,
  7033. iNoClone = l - 1,
  7034. value = args[ 0 ],
  7035. isFunction = jQuery.isFunction( value );
  7036.  
  7037. // We can't cloneNode fragments that contain checked, in WebKit
  7038. if ( isFunction ||
  7039. ( l > 1 && typeof value === "string" &&
  7040. !support.checkClone && rchecked.test( value ) ) ) {
  7041. return collection.each( function( index ) {
  7042. var self = collection.eq( index );
  7043. if ( isFunction ) {
  7044. args[ 0 ] = value.call( this, index, self.html() );
  7045. }
  7046. domManip( self, args, callback, ignored );
  7047. } );
  7048. }
  7049.  
  7050. if ( l ) {
  7051. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  7052. first = fragment.firstChild;
  7053.  
  7054. if ( fragment.childNodes.length === 1 ) {
  7055. fragment = first;
  7056. }
  7057.  
  7058. // Require either new content or an interest in ignored elements to invoke the callback
  7059. if ( first || ignored ) {
  7060. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  7061. hasScripts = scripts.length;
  7062.  
  7063. // Use the original fragment for the last item
  7064. // instead of the first because it can end up
  7065. // being emptied incorrectly in certain situations (#8070).
  7066. for ( ; i < l; i++ ) {
  7067. node = fragment;
  7068.  
  7069. if ( i !== iNoClone ) {
  7070. node = jQuery.clone( node, true, true );
  7071.  
  7072. // Keep references to cloned scripts for later restoration
  7073. if ( hasScripts ) {
  7074.  
  7075. // Support: Android<4.1, PhantomJS<2
  7076. // push.apply(_, arraylike) throws on ancient WebKit
  7077. jQuery.merge( scripts, getAll( node, "script" ) );
  7078. }
  7079. }
  7080.  
  7081. callback.call( collection[ i ], node, i );
  7082. }
  7083.  
  7084. if ( hasScripts ) {
  7085. doc = scripts[ scripts.length - 1 ].ownerDocument;
  7086.  
  7087. // Reenable scripts
  7088. jQuery.map( scripts, restoreScript );
  7089.  
  7090. // Evaluate executable scripts on first document insertion
  7091. for ( i = 0; i < hasScripts; i++ ) {
  7092. node = scripts[ i ];
  7093. if ( rscriptType.test( node.type || "" ) &&
  7094. !jQuery._data( node, "globalEval" ) &&
  7095. jQuery.contains( doc, node ) ) {
  7096.  
  7097. if ( node.src ) {
  7098.  
  7099. // Optional AJAX dependency, but won't run scripts if not present
  7100. if ( jQuery._evalUrl ) {
  7101. jQuery._evalUrl( node.src );
  7102. }
  7103. } else {
  7104. jQuery.globalEval(
  7105. ( node.text || node.textContent || node.innerHTML || "" )
  7106. .replace( rcleanScript, "" )
  7107. );
  7108. }
  7109. }
  7110. }
  7111. }
  7112.  
  7113. // Fix #11809: Avoid leaking memory
  7114. fragment = first = null;
  7115. }
  7116. }
  7117.  
  7118. return collection;
  7119. }
  7120.  
  7121. function remove( elem, selector, keepData ) {
  7122. var node,
  7123. elems = selector ? jQuery.filter( selector, elem ) : elem,
  7124. i = 0;
  7125.  
  7126. for ( ; ( node = elems[ i ] ) != null; i++ ) {
  7127.  
  7128. if ( !keepData && node.nodeType === 1 ) {
  7129. jQuery.cleanData( getAll( node ) );
  7130. }
  7131.  
  7132. if ( node.parentNode ) {
  7133. if ( keepData && jQuery.contains( node.ownerDocument, node ) ) {
  7134. setGlobalEval( getAll( node, "script" ) );
  7135. }
  7136. node.parentNode.removeChild( node );
  7137. }
  7138. }
  7139.  
  7140. return elem;
  7141. }
  7142.  
  7143. jQuery.extend( {
  7144. htmlPrefilter: function( html ) {
  7145. return html.replace( rxhtmlTag, "<$1></$2>" );
  7146. },
  7147.  
  7148. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  7149. var destElements, node, clone, i, srcElements,
  7150. inPage = jQuery.contains( elem.ownerDocument, elem );
  7151.  
  7152. if ( support.html5Clone || jQuery.isXMLDoc( elem ) ||
  7153. !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) {
  7154.  
  7155. clone = elem.cloneNode( true );
  7156.  
  7157. // IE<=8 does not properly clone detached, unknown element nodes
  7158. } else {
  7159. fragmentDiv.innerHTML = elem.outerHTML;
  7160. fragmentDiv.removeChild( clone = fragmentDiv.firstChild );
  7161. }
  7162.  
  7163. if ( ( !support.noCloneEvent || !support.noCloneChecked ) &&
  7164. ( elem.nodeType === 1 || elem.nodeType === 11 ) && !jQuery.isXMLDoc( elem ) ) {
  7165.  
  7166. // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
  7167. destElements = getAll( clone );
  7168. srcElements = getAll( elem );
  7169.  
  7170. // Fix all IE cloning issues
  7171. for ( i = 0; ( node = srcElements[ i ] ) != null; ++i ) {
  7172.  
  7173. // Ensure that the destination node is not null; Fixes #9587
  7174. if ( destElements[ i ] ) {
  7175. fixCloneNodeIssues( node, destElements[ i ] );
  7176. }
  7177. }
  7178. }
  7179.  
  7180. // Copy the events from the original to the clone
  7181. if ( dataAndEvents ) {
  7182. if ( deepDataAndEvents ) {
  7183. srcElements = srcElements || getAll( elem );
  7184. destElements = destElements || getAll( clone );
  7185.  
  7186. for ( i = 0; ( node = srcElements[ i ] ) != null; i++ ) {
  7187. cloneCopyEvent( node, destElements[ i ] );
  7188. }
  7189. } else {
  7190. cloneCopyEvent( elem, clone );
  7191. }
  7192. }
  7193.  
  7194. // Preserve script evaluation history
  7195. destElements = getAll( clone, "script" );
  7196. if ( destElements.length > 0 ) {
  7197. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  7198. }
  7199.  
  7200. destElements = srcElements = node = null;
  7201.  
  7202. // Return the cloned set
  7203. return clone;
  7204. },
  7205.  
  7206. cleanData: function( elems, /* internal */ forceAcceptData ) {
  7207. var elem, type, id, data,
  7208. i = 0,
  7209. internalKey = jQuery.expando,
  7210. cache = jQuery.cache,
  7211. attributes = support.attributes,
  7212. special = jQuery.event.special;
  7213.  
  7214. for ( ; ( elem = elems[ i ] ) != null; i++ ) {
  7215. if ( forceAcceptData || acceptData( elem ) ) {
  7216.  
  7217. id = elem[ internalKey ];
  7218. data = id && cache[ id ];
  7219.  
  7220. if ( data ) {
  7221. if ( data.events ) {
  7222. for ( type in data.events ) {
  7223. if ( special[ type ] ) {
  7224. jQuery.event.remove( elem, type );
  7225.  
  7226. // This is a shortcut to avoid jQuery.event.remove's overhead
  7227. } else {
  7228. jQuery.removeEvent( elem, type, data.handle );
  7229. }
  7230. }
  7231. }
  7232.  
  7233. // Remove cache only if it was not already removed by jQuery.event.remove
  7234. if ( cache[ id ] ) {
  7235.  
  7236. delete cache[ id ];
  7237.  
  7238. // Support: IE<9
  7239. // IE does not allow us to delete expando properties from nodes
  7240. // IE creates expando attributes along with the property
  7241. // IE does not have a removeAttribute function on Document nodes
  7242. if ( !attributes && typeof elem.removeAttribute !== "undefined" ) {
  7243. elem.removeAttribute( internalKey );
  7244.  
  7245. // Webkit & Blink performance suffers when deleting properties
  7246. // from DOM nodes, so set to undefined instead
  7247. // https://code.google.com/p/chromium/issues/detail?id=378607
  7248. } else {
  7249. elem[ internalKey ] = undefined;
  7250. }
  7251.  
  7252. deletedIds.push( id );
  7253. }
  7254. }
  7255. }
  7256. }
  7257. }
  7258. } );
  7259.  
  7260. jQuery.fn.extend( {
  7261.  
  7262. // Keep domManip exposed until 3.0 (gh-2225)
  7263. domManip: domManip,
  7264.  
  7265. detach: function( selector ) {
  7266. return remove( this, selector, true );
  7267. },
  7268.  
  7269. remove: function( selector ) {
  7270. return remove( this, selector );
  7271. },
  7272.  
  7273. text: function( value ) {
  7274. return access( this, function( value ) {
  7275. return value === undefined ?
  7276. jQuery.text( this ) :
  7277. this.empty().append(
  7278. ( this[ 0 ] && this[ 0 ].ownerDocument || document ).createTextNode( value )
  7279. );
  7280. }, null, value, arguments.length );
  7281. },
  7282.  
  7283. append: function() {
  7284. return domManip( this, arguments, function( elem ) {
  7285. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  7286. var target = manipulationTarget( this, elem );
  7287. target.appendChild( elem );
  7288. }
  7289. } );
  7290. },
  7291.  
  7292. prepend: function() {
  7293. return domManip( this, arguments, function( elem ) {
  7294. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  7295. var target = manipulationTarget( this, elem );
  7296. target.insertBefore( elem, target.firstChild );
  7297. }
  7298. } );
  7299. },
  7300.  
  7301. before: function() {
  7302. return domManip( this, arguments, function( elem ) {
  7303. if ( this.parentNode ) {
  7304. this.parentNode.insertBefore( elem, this );
  7305. }
  7306. } );
  7307. },
  7308.  
  7309. after: function() {
  7310. return domManip( this, arguments, function( elem ) {
  7311. if ( this.parentNode ) {
  7312. this.parentNode.insertBefore( elem, this.nextSibling );
  7313. }
  7314. } );
  7315. },
  7316.  
  7317. empty: function() {
  7318. var elem,
  7319. i = 0;
  7320.  
  7321. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  7322.  
  7323. // Remove element nodes and prevent memory leaks
  7324. if ( elem.nodeType === 1 ) {
  7325. jQuery.cleanData( getAll( elem, false ) );
  7326. }
  7327.  
  7328. // Remove any remaining nodes
  7329. while ( elem.firstChild ) {
  7330. elem.removeChild( elem.firstChild );
  7331. }
  7332.  
  7333. // If this is a select, ensure that it displays empty (#12336)
  7334. // Support: IE<9
  7335. if ( elem.options && jQuery.nodeName( elem, "select" ) ) {
  7336. elem.options.length = 0;
  7337. }
  7338. }
  7339.  
  7340. return this;
  7341. },
  7342.  
  7343. clone: function( dataAndEvents, deepDataAndEvents ) {
  7344. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  7345. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  7346.  
  7347. return this.map( function() {
  7348. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  7349. } );
  7350. },
  7351.  
  7352. html: function( value ) {
  7353. return access( this, function( value ) {
  7354. var elem = this[ 0 ] || {},
  7355. i = 0,
  7356. l = this.length;
  7357.  
  7358. if ( value === undefined ) {
  7359. return elem.nodeType === 1 ?
  7360. elem.innerHTML.replace( rinlinejQuery, "" ) :
  7361. undefined;
  7362. }
  7363.  
  7364. // See if we can take a shortcut and just use innerHTML
  7365. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  7366. ( support.htmlSerialize || !rnoshimcache.test( value ) ) &&
  7367. ( support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
  7368. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  7369.  
  7370. value = jQuery.htmlPrefilter( value );
  7371.  
  7372. try {
  7373. for ( ; i < l; i++ ) {
  7374.  
  7375. // Remove element nodes and prevent memory leaks
  7376. elem = this[ i ] || {};
  7377. if ( elem.nodeType === 1 ) {
  7378. jQuery.cleanData( getAll( elem, false ) );
  7379. elem.innerHTML = value;
  7380. }
  7381. }
  7382.  
  7383. elem = 0;
  7384.  
  7385. // If using innerHTML throws an exception, use the fallback method
  7386. } catch ( e ) {}
  7387. }
  7388.  
  7389. if ( elem ) {
  7390. this.empty().append( value );
  7391. }
  7392. }, null, value, arguments.length );
  7393. },
  7394.  
  7395. replaceWith: function() {
  7396. var ignored = [];
  7397.  
  7398. // Make the changes, replacing each non-ignored context element with the new content
  7399. return domManip( this, arguments, function( elem ) {
  7400. var parent = this.parentNode;
  7401.  
  7402. if ( jQuery.inArray( this, ignored ) < 0 ) {
  7403. jQuery.cleanData( getAll( this ) );
  7404. if ( parent ) {
  7405. parent.replaceChild( elem, this );
  7406. }
  7407. }
  7408.  
  7409. // Force callback invocation
  7410. }, ignored );
  7411. }
  7412. } );
  7413.  
  7414. jQuery.each( {
  7415. appendTo: "append",
  7416. prependTo: "prepend",
  7417. insertBefore: "before",
  7418. insertAfter: "after",
  7419. replaceAll: "replaceWith"
  7420. }, function( name, original ) {
  7421. jQuery.fn[ name ] = function( selector ) {
  7422. var elems,
  7423. i = 0,
  7424. ret = [],
  7425. insert = jQuery( selector ),
  7426. last = insert.length - 1;
  7427.  
  7428. for ( ; i <= last; i++ ) {
  7429. elems = i === last ? this : this.clone( true );
  7430. jQuery( insert[ i ] )[ original ]( elems );
  7431.  
  7432. // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get()
  7433. push.apply( ret, elems.get() );
  7434. }
  7435.  
  7436. return this.pushStack( ret );
  7437. };
  7438. } );
  7439.  
  7440.  
  7441. var iframe,
  7442. elemdisplay = {
  7443.  
  7444. // Support: Firefox
  7445. // We have to pre-define these values for FF (#10227)
  7446. HTML: "block",
  7447. BODY: "block"
  7448. };
  7449.  
  7450. /**
  7451. * Retrieve the actual display of a element
  7452. * @param {String} name nodeName of the element
  7453. * @param {Object} doc Document object
  7454. */
  7455.  
  7456. // Called only from within defaultDisplay
  7457. function actualDisplay( name, doc ) {
  7458. var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
  7459.  
  7460. display = jQuery.css( elem[ 0 ], "display" );
  7461.  
  7462. // We don't have any data stored on the element,
  7463. // so use "detach" method as fast way to get rid of the element
  7464. elem.detach();
  7465.  
  7466. return display;
  7467. }
  7468.  
  7469. /**
  7470. * Try to determine the default display value of an element
  7471. * @param {String} nodeName
  7472. */
  7473. function defaultDisplay( nodeName ) {
  7474. var doc = document,
  7475. display = elemdisplay[ nodeName ];
  7476.  
  7477. if ( !display ) {
  7478. display = actualDisplay( nodeName, doc );
  7479.  
  7480. // If the simple way fails, read from inside an iframe
  7481. if ( display === "none" || !display ) {
  7482.  
  7483. // Use the already-created iframe if possible
  7484. iframe = ( iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" ) )
  7485. .appendTo( doc.documentElement );
  7486.  
  7487. // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
  7488. doc = ( iframe[ 0 ].contentWindow || iframe[ 0 ].contentDocument ).document;
  7489.  
  7490. // Support: IE
  7491. doc.write();
  7492. doc.close();
  7493.  
  7494. display = actualDisplay( nodeName, doc );
  7495. iframe.detach();
  7496. }
  7497.  
  7498. // Store the correct default display
  7499. elemdisplay[ nodeName ] = display;
  7500. }
  7501.  
  7502. return display;
  7503. }
  7504. var rmargin = ( /^margin/ );
  7505.  
  7506. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  7507.  
  7508. var swap = function( elem, options, callback, args ) {
  7509. var ret, name,
  7510. old = {};
  7511.  
  7512. // Remember the old values, and insert the new ones
  7513. for ( name in options ) {
  7514. old[ name ] = elem.style[ name ];
  7515. elem.style[ name ] = options[ name ];
  7516. }
  7517.  
  7518. ret = callback.apply( elem, args || [] );
  7519.  
  7520. // Revert the old values
  7521. for ( name in options ) {
  7522. elem.style[ name ] = old[ name ];
  7523. }
  7524.  
  7525. return ret;
  7526. };
  7527.  
  7528.  
  7529. var documentElement = document.documentElement;
  7530.  
  7531.  
  7532.  
  7533. ( function() {
  7534. var pixelPositionVal, pixelMarginRightVal, boxSizingReliableVal,
  7535. reliableHiddenOffsetsVal, reliableMarginRightVal, reliableMarginLeftVal,
  7536. container = document.createElement( "div" ),
  7537. div = document.createElement( "div" );
  7538.  
  7539. // Finish early in limited (non-browser) environments
  7540. if ( !div.style ) {
  7541. return;
  7542. }
  7543.  
  7544. div.style.cssText = "float:left;opacity:.5";
  7545.  
  7546. // Support: IE<9
  7547. // Make sure that element opacity exists (as opposed to filter)
  7548. support.opacity = div.style.opacity === "0.5";
  7549.  
  7550. // Verify style float existence
  7551. // (IE uses styleFloat instead of cssFloat)
  7552. support.cssFloat = !!div.style.cssFloat;
  7553.  
  7554. div.style.backgroundClip = "content-box";
  7555. div.cloneNode( true ).style.backgroundClip = "";
  7556. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  7557.  
  7558. container = document.createElement( "div" );
  7559. container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" +
  7560. "padding:0;margin-top:1px;position:absolute";
  7561. div.innerHTML = "";
  7562. container.appendChild( div );
  7563.  
  7564. // Support: Firefox<29, Android 2.3
  7565. // Vendor-prefix box-sizing
  7566. support.boxSizing = div.style.boxSizing === "" || div.style.MozBoxSizing === "" ||
  7567. div.style.WebkitBoxSizing === "";
  7568.  
  7569. jQuery.extend( support, {
  7570. reliableHiddenOffsets: function() {
  7571. if ( pixelPositionVal == null ) {
  7572. computeStyleTests();
  7573. }
  7574. return reliableHiddenOffsetsVal;
  7575. },
  7576.  
  7577. boxSizingReliable: function() {
  7578.  
  7579. // We're checking for pixelPositionVal here instead of boxSizingReliableVal
  7580. // since that compresses better and they're computed together anyway.
  7581. if ( pixelPositionVal == null ) {
  7582. computeStyleTests();
  7583. }
  7584. return boxSizingReliableVal;
  7585. },
  7586.  
  7587. pixelMarginRight: function() {
  7588.  
  7589. // Support: Android 4.0-4.3
  7590. if ( pixelPositionVal == null ) {
  7591. computeStyleTests();
  7592. }
  7593. return pixelMarginRightVal;
  7594. },
  7595.  
  7596. pixelPosition: function() {
  7597. if ( pixelPositionVal == null ) {
  7598. computeStyleTests();
  7599. }
  7600. return pixelPositionVal;
  7601. },
  7602.  
  7603. reliableMarginRight: function() {
  7604.  
  7605. // Support: Android 2.3
  7606. if ( pixelPositionVal == null ) {
  7607. computeStyleTests();
  7608. }
  7609. return reliableMarginRightVal;
  7610. },
  7611.  
  7612. reliableMarginLeft: function() {
  7613.  
  7614. // Support: IE <=8 only, Android 4.0 - 4.3 only, Firefox <=3 - 37
  7615. if ( pixelPositionVal == null ) {
  7616. computeStyleTests();
  7617. }
  7618. return reliableMarginLeftVal;
  7619. }
  7620. } );
  7621.  
  7622. function computeStyleTests() {
  7623. var contents, divStyle,
  7624. documentElement = document.documentElement;
  7625.  
  7626. // Setup
  7627. documentElement.appendChild( container );
  7628.  
  7629. div.style.cssText =
  7630.  
  7631. // Support: Android 2.3
  7632. // Vendor-prefix box-sizing
  7633. "-webkit-box-sizing:border-box;box-sizing:border-box;" +
  7634. "position:relative;display:block;" +
  7635. "margin:auto;border:1px;padding:1px;" +
  7636. "top:1%;width:50%";
  7637.  
  7638. // Support: IE<9
  7639. // Assume reasonable values in the absence of getComputedStyle
  7640. pixelPositionVal = boxSizingReliableVal = reliableMarginLeftVal = false;
  7641. pixelMarginRightVal = reliableMarginRightVal = true;
  7642.  
  7643. // Check for getComputedStyle so that this code is not run in IE<9.
  7644. if ( window.getComputedStyle ) {
  7645. divStyle = window.getComputedStyle( div );
  7646. pixelPositionVal = ( divStyle || {} ).top !== "1%";
  7647. reliableMarginLeftVal = ( divStyle || {} ).marginLeft === "2px";
  7648. boxSizingReliableVal = ( divStyle || { width: "4px" } ).width === "4px";
  7649.  
  7650. // Support: Android 4.0 - 4.3 only
  7651. // Some styles come back with percentage values, even though they shouldn't
  7652. div.style.marginRight = "50%";
  7653. pixelMarginRightVal = ( divStyle || { marginRight: "4px" } ).marginRight === "4px";
  7654.  
  7655. // Support: Android 2.3 only
  7656. // Div with explicit width and no margin-right incorrectly
  7657. // gets computed margin-right based on width of container (#3333)
  7658. // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
  7659. contents = div.appendChild( document.createElement( "div" ) );
  7660.  
  7661. // Reset CSS: box-sizing; display; margin; border; padding
  7662. contents.style.cssText = div.style.cssText =
  7663.  
  7664. // Support: Android 2.3
  7665. // Vendor-prefix box-sizing
  7666. "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" +
  7667. "box-sizing:content-box;display:block;margin:0;border:0;padding:0";
  7668. contents.style.marginRight = contents.style.width = "0";
  7669. div.style.width = "1px";
  7670.  
  7671. reliableMarginRightVal =
  7672. !parseFloat( ( window.getComputedStyle( contents ) || {} ).marginRight );
  7673.  
  7674. div.removeChild( contents );
  7675. }
  7676.  
  7677. // Support: IE6-8
  7678. // First check that getClientRects works as expected
  7679. // Check if table cells still have offsetWidth/Height when they are set
  7680. // to display:none and there are still other visible table cells in a
  7681. // table row; if so, offsetWidth/Height are not reliable for use when
  7682. // determining if an element has been hidden directly using
  7683. // display:none (it is still safe to use offsets if a parent element is
  7684. // hidden; don safety goggles and see bug #4512 for more information).
  7685. div.style.display = "none";
  7686. reliableHiddenOffsetsVal = div.getClientRects().length === 0;
  7687. if ( reliableHiddenOffsetsVal ) {
  7688. div.style.display = "";
  7689. div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
  7690. div.childNodes[ 0 ].style.borderCollapse = "separate";
  7691. contents = div.getElementsByTagName( "td" );
  7692. contents[ 0 ].style.cssText = "margin:0;border:0;padding:0;display:none";
  7693. reliableHiddenOffsetsVal = contents[ 0 ].offsetHeight === 0;
  7694. if ( reliableHiddenOffsetsVal ) {
  7695. contents[ 0 ].style.display = "";
  7696. contents[ 1 ].style.display = "none";
  7697. reliableHiddenOffsetsVal = contents[ 0 ].offsetHeight === 0;
  7698. }
  7699. }
  7700.  
  7701. // Teardown
  7702. documentElement.removeChild( container );
  7703. }
  7704.  
  7705. } )();
  7706.  
  7707.  
  7708. var getStyles, curCSS,
  7709. rposition = /^(top|right|bottom|left)$/;
  7710.  
  7711. if ( window.getComputedStyle ) {
  7712. getStyles = function( elem ) {
  7713.  
  7714. // Support: IE<=11+, Firefox<=30+ (#15098, #14150)
  7715. // IE throws on elements created in popups
  7716. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  7717. var view = elem.ownerDocument.defaultView;
  7718.  
  7719. if ( !view || !view.opener ) {
  7720. view = window;
  7721. }
  7722.  
  7723. return view.getComputedStyle( elem );
  7724. };
  7725.  
  7726. curCSS = function( elem, name, computed ) {
  7727. var width, minWidth, maxWidth, ret,
  7728. style = elem.style;
  7729.  
  7730. computed = computed || getStyles( elem );
  7731.  
  7732. // getPropertyValue is only needed for .css('filter') in IE9, see #12537
  7733. ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined;
  7734.  
  7735. // Support: Opera 12.1x only
  7736. // Fall back to style even without computed
  7737. // computed is undefined for elems on document fragments
  7738. if ( ( ret === "" || ret === undefined ) && !jQuery.contains( elem.ownerDocument, elem ) ) {
  7739. ret = jQuery.style( elem, name );
  7740. }
  7741.  
  7742. if ( computed ) {
  7743.  
  7744. // A tribute to the "awesome hack by Dean Edwards"
  7745. // Chrome < 17 and Safari 5.0 uses "computed value"
  7746. // instead of "used value" for margin-right
  7747. // Safari 5.1.7 (at least) returns percentage for a larger set of values,
  7748. // but width seems to be reliably pixels
  7749. // this is against the CSSOM draft spec:
  7750. // http://dev.w3.org/csswg/cssom/#resolved-values
  7751. if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) {
  7752.  
  7753. // Remember the original values
  7754. width = style.width;
  7755. minWidth = style.minWidth;
  7756. maxWidth = style.maxWidth;
  7757.  
  7758. // Put in the new values to get a computed value out
  7759. style.minWidth = style.maxWidth = style.width = ret;
  7760. ret = computed.width;
  7761.  
  7762. // Revert the changed values
  7763. style.width = width;
  7764. style.minWidth = minWidth;
  7765. style.maxWidth = maxWidth;
  7766. }
  7767. }
  7768.  
  7769. // Support: IE
  7770. // IE returns zIndex value as an integer.
  7771. return ret === undefined ?
  7772. ret :
  7773. ret + "";
  7774. };
  7775. } else if ( documentElement.currentStyle ) {
  7776. getStyles = function( elem ) {
  7777. return elem.currentStyle;
  7778. };
  7779.  
  7780. curCSS = function( elem, name, computed ) {
  7781. var left, rs, rsLeft, ret,
  7782. style = elem.style;
  7783.  
  7784. computed = computed || getStyles( elem );
  7785. ret = computed ? computed[ name ] : undefined;
  7786.  
  7787. // Avoid setting ret to empty string here
  7788. // so we don't default to auto
  7789. if ( ret == null && style && style[ name ] ) {
  7790. ret = style[ name ];
  7791. }
  7792.  
  7793. // From the awesome hack by Dean Edwards
  7794. // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
  7795.  
  7796. // If we're not dealing with a regular pixel number
  7797. // but a number that has a weird ending, we need to convert it to pixels
  7798. // but not position css attributes, as those are
  7799. // proportional to the parent element instead
  7800. // and we can't measure the parent instead because it
  7801. // might trigger a "stacking dolls" problem
  7802. if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) {
  7803.  
  7804. // Remember the original values
  7805. left = style.left;
  7806. rs = elem.runtimeStyle;
  7807. rsLeft = rs && rs.left;
  7808.  
  7809. // Put in the new values to get a computed value out
  7810. if ( rsLeft ) {
  7811. rs.left = elem.currentStyle.left;
  7812. }
  7813. style.left = name === "fontSize" ? "1em" : ret;
  7814. ret = style.pixelLeft + "px";
  7815.  
  7816. // Revert the changed values
  7817. style.left = left;
  7818. if ( rsLeft ) {
  7819. rs.left = rsLeft;
  7820. }
  7821. }
  7822.  
  7823. // Support: IE
  7824. // IE returns zIndex value as an integer.
  7825. return ret === undefined ?
  7826. ret :
  7827. ret + "" || "auto";
  7828. };
  7829. }
  7830.  
  7831.  
  7832.  
  7833.  
  7834. function addGetHookIf( conditionFn, hookFn ) {
  7835.  
  7836. // Define the hook, we'll check on the first run if it's really needed.
  7837. return {
  7838. get: function() {
  7839. if ( conditionFn() ) {
  7840.  
  7841. // Hook not needed (or it's not possible to use it due
  7842. // to missing dependency), remove it.
  7843. delete this.get;
  7844. return;
  7845. }
  7846.  
  7847. // Hook needed; redefine it so that the support test is not executed again.
  7848. return ( this.get = hookFn ).apply( this, arguments );
  7849. }
  7850. };
  7851. }
  7852.  
  7853.  
  7854. var
  7855.  
  7856. ralpha = /alpha\([^)]*\)/i,
  7857. ropacity = /opacity\s*=\s*([^)]*)/i,
  7858.  
  7859. // swappable if display is none or starts with table except
  7860. // "table", "table-cell", or "table-caption"
  7861. // see here for display values:
  7862. // https://developer.mozilla.org/en-US/docs/CSS/display
  7863. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  7864. rnumsplit = new RegExp( "^(" + pnum + ")(.*)$", "i" ),
  7865.  
  7866. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  7867. cssNormalTransform = {
  7868. letterSpacing: "0",
  7869. fontWeight: "400"
  7870. },
  7871.  
  7872. cssPrefixes = [ "Webkit", "O", "Moz", "ms" ],
  7873. emptyStyle = document.createElement( "div" ).style;
  7874.  
  7875.  
  7876. // return a css property mapped to a potentially vendor prefixed property
  7877. function vendorPropName( name ) {
  7878.  
  7879. // shortcut for names that are not vendor prefixed
  7880. if ( name in emptyStyle ) {
  7881. return name;
  7882. }
  7883.  
  7884. // check for vendor prefixed names
  7885. var capName = name.charAt( 0 ).toUpperCase() + name.slice( 1 ),
  7886. i = cssPrefixes.length;
  7887.  
  7888. while ( i-- ) {
  7889. name = cssPrefixes[ i ] + capName;
  7890. if ( name in emptyStyle ) {
  7891. return name;
  7892. }
  7893. }
  7894. }
  7895.  
  7896. function showHide( elements, show ) {
  7897. var display, elem, hidden,
  7898. values = [],
  7899. index = 0,
  7900. length = elements.length;
  7901.  
  7902. for ( ; index < length; index++ ) {
  7903. elem = elements[ index ];
  7904. if ( !elem.style ) {
  7905. continue;
  7906. }
  7907.  
  7908. values[ index ] = jQuery._data( elem, "olddisplay" );
  7909. display = elem.style.display;
  7910. if ( show ) {
  7911.  
  7912. // Reset the inline display of this element to learn if it is
  7913. // being hidden by cascaded rules or not
  7914. if ( !values[ index ] && display === "none" ) {
  7915. elem.style.display = "";
  7916. }
  7917.  
  7918. // Set elements which have been overridden with display: none
  7919. // in a stylesheet to whatever the default browser style is
  7920. // for such an element
  7921. if ( elem.style.display === "" && isHidden( elem ) ) {
  7922. values[ index ] =
  7923. jQuery._data( elem, "olddisplay", defaultDisplay( elem.nodeName ) );
  7924. }
  7925. } else {
  7926. hidden = isHidden( elem );
  7927.  
  7928. if ( display && display !== "none" || !hidden ) {
  7929. jQuery._data(
  7930. elem,
  7931. "olddisplay",
  7932. hidden ? display : jQuery.css( elem, "display" )
  7933. );
  7934. }
  7935. }
  7936. }
  7937.  
  7938. // Set the display of most of the elements in a second loop
  7939. // to avoid the constant reflow
  7940. for ( index = 0; index < length; index++ ) {
  7941. elem = elements[ index ];
  7942. if ( !elem.style ) {
  7943. continue;
  7944. }
  7945. if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
  7946. elem.style.display = show ? values[ index ] || "" : "none";
  7947. }
  7948. }
  7949.  
  7950. return elements;
  7951. }
  7952.  
  7953. function setPositiveNumber( elem, value, subtract ) {
  7954. var matches = rnumsplit.exec( value );
  7955. return matches ?
  7956.  
  7957. // Guard against undefined "subtract", e.g., when used as in cssHooks
  7958. Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
  7959. value;
  7960. }
  7961.  
  7962. function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
  7963. var i = extra === ( isBorderBox ? "border" : "content" ) ?
  7964.  
  7965. // If we already have the right measurement, avoid augmentation
  7966. 4 :
  7967.  
  7968. // Otherwise initialize for horizontal or vertical properties
  7969. name === "width" ? 1 : 0,
  7970.  
  7971. val = 0;
  7972.  
  7973. for ( ; i < 4; i += 2 ) {
  7974.  
  7975. // both box models exclude margin, so add it if we want it
  7976. if ( extra === "margin" ) {
  7977. val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
  7978. }
  7979.  
  7980. if ( isBorderBox ) {
  7981.  
  7982. // border-box includes padding, so remove it if we want content
  7983. if ( extra === "content" ) {
  7984. val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  7985. }
  7986.  
  7987. // at this point, extra isn't border nor margin, so remove border
  7988. if ( extra !== "margin" ) {
  7989. val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  7990. }
  7991. } else {
  7992.  
  7993. // at this point, extra isn't content, so add padding
  7994. val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  7995.  
  7996. // at this point, extra isn't content nor padding, so add border
  7997. if ( extra !== "padding" ) {
  7998. val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  7999. }
  8000. }
  8001. }
  8002.  
  8003. return val;
  8004. }
  8005.  
  8006. function getWidthOrHeight( elem, name, extra ) {
  8007.  
  8008. // Start with offset property, which is equivalent to the border-box value
  8009. var valueIsBorderBox = true,
  8010. val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
  8011. styles = getStyles( elem ),
  8012. isBorderBox = support.boxSizing &&
  8013. jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  8014.  
  8015. // some non-html elements return undefined for offsetWidth, so check for null/undefined
  8016. // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
  8017. // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
  8018. if ( val <= 0 || val == null ) {
  8019.  
  8020. // Fall back to computed then uncomputed css if necessary
  8021. val = curCSS( elem, name, styles );
  8022. if ( val < 0 || val == null ) {
  8023. val = elem.style[ name ];
  8024. }
  8025.  
  8026. // Computed unit is not pixels. Stop here and return.
  8027. if ( rnumnonpx.test( val ) ) {
  8028. return val;
  8029. }
  8030.  
  8031. // we need the check for style in case a browser which returns unreliable values
  8032. // for getComputedStyle silently falls back to the reliable elem.style
  8033. valueIsBorderBox = isBorderBox &&
  8034. ( support.boxSizingReliable() || val === elem.style[ name ] );
  8035.  
  8036. // Normalize "", auto, and prepare for extra
  8037. val = parseFloat( val ) || 0;
  8038. }
  8039.  
  8040. // use the active box-sizing model to add/subtract irrelevant styles
  8041. return ( val +
  8042. augmentWidthOrHeight(
  8043. elem,
  8044. name,
  8045. extra || ( isBorderBox ? "border" : "content" ),
  8046. valueIsBorderBox,
  8047. styles
  8048. )
  8049. ) + "px";
  8050. }
  8051.  
  8052. jQuery.extend( {
  8053.  
  8054. // Add in style property hooks for overriding the default
  8055. // behavior of getting and setting a style property
  8056. cssHooks: {
  8057. opacity: {
  8058. get: function( elem, computed ) {
  8059. if ( computed ) {
  8060.  
  8061. // We should always get a number back from opacity
  8062. var ret = curCSS( elem, "opacity" );
  8063. return ret === "" ? "1" : ret;
  8064. }
  8065. }
  8066. }
  8067. },
  8068.  
  8069. // Don't automatically add "px" to these possibly-unitless properties
  8070. cssNumber: {
  8071. "animationIterationCount": true,
  8072. "columnCount": true,
  8073. "fillOpacity": true,
  8074. "flexGrow": true,
  8075. "flexShrink": true,
  8076. "fontWeight": true,
  8077. "lineHeight": true,
  8078. "opacity": true,
  8079. "order": true,
  8080. "orphans": true,
  8081. "widows": true,
  8082. "zIndex": true,
  8083. "zoom": true
  8084. },
  8085.  
  8086. // Add in properties whose names you wish to fix before
  8087. // setting or getting the value
  8088. cssProps: {
  8089.  
  8090. // normalize float css property
  8091. "float": support.cssFloat ? "cssFloat" : "styleFloat"
  8092. },
  8093.  
  8094. // Get and set the style property on a DOM Node
  8095. style: function( elem, name, value, extra ) {
  8096.  
  8097. // Don't set styles on text and comment nodes
  8098. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  8099. return;
  8100. }
  8101.  
  8102. // Make sure that we're working with the right name
  8103. var ret, type, hooks,
  8104. origName = jQuery.camelCase( name ),
  8105. style = elem.style;
  8106.  
  8107. name = jQuery.cssProps[ origName ] ||
  8108. ( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName );
  8109.  
  8110. // gets hook for the prefixed version
  8111. // followed by the unprefixed version
  8112. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  8113.  
  8114. // Check if we're setting a value
  8115. if ( value !== undefined ) {
  8116. type = typeof value;
  8117.  
  8118. // Convert "+=" or "-=" to relative numbers (#7345)
  8119. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  8120. value = adjustCSS( elem, name, ret );
  8121.  
  8122. // Fixes bug #9237
  8123. type = "number";
  8124. }
  8125.  
  8126. // Make sure that null and NaN values aren't set. See: #7116
  8127. if ( value == null || value !== value ) {
  8128. return;
  8129. }
  8130.  
  8131. // If a number was passed in, add the unit (except for certain CSS properties)
  8132. if ( type === "number" ) {
  8133. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  8134. }
  8135.  
  8136. // Fixes #8908, it can be done more correctly by specifing setters in cssHooks,
  8137. // but it would mean to define eight
  8138. // (for every problematic property) identical functions
  8139. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  8140. style[ name ] = "inherit";
  8141. }
  8142.  
  8143. // If a hook was provided, use that value, otherwise just set the specified value
  8144. if ( !hooks || !( "set" in hooks ) ||
  8145. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  8146.  
  8147. // Support: IE
  8148. // Swallow errors from 'invalid' CSS values (#5509)
  8149. try {
  8150. style[ name ] = value;
  8151. } catch ( e ) {}
  8152. }
  8153.  
  8154. } else {
  8155.  
  8156. // If a hook was provided get the non-computed value from there
  8157. if ( hooks && "get" in hooks &&
  8158. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  8159.  
  8160. return ret;
  8161. }
  8162.  
  8163. // Otherwise just get the value from the style object
  8164. return style[ name ];
  8165. }
  8166. },
  8167.  
  8168. css: function( elem, name, extra, styles ) {
  8169. var num, val, hooks,
  8170. origName = jQuery.camelCase( name );
  8171.  
  8172. // Make sure that we're working with the right name
  8173. name = jQuery.cssProps[ origName ] ||
  8174. ( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName );
  8175.  
  8176. // gets hook for the prefixed version
  8177. // followed by the unprefixed version
  8178. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  8179.  
  8180. // If a hook was provided get the computed value from there
  8181. if ( hooks && "get" in hooks ) {
  8182. val = hooks.get( elem, true, extra );
  8183. }
  8184.  
  8185. // Otherwise, if a way to get the computed value exists, use that
  8186. if ( val === undefined ) {
  8187. val = curCSS( elem, name, styles );
  8188. }
  8189.  
  8190. //convert "normal" to computed value
  8191. if ( val === "normal" && name in cssNormalTransform ) {
  8192. val = cssNormalTransform[ name ];
  8193. }
  8194.  
  8195. // Return, converting to number if forced or a qualifier was provided and val looks numeric
  8196. if ( extra === "" || extra ) {
  8197. num = parseFloat( val );
  8198. return extra === true || isFinite( num ) ? num || 0 : val;
  8199. }
  8200. return val;
  8201. }
  8202. } );
  8203.  
  8204. jQuery.each( [ "height", "width" ], function( i, name ) {
  8205. jQuery.cssHooks[ name ] = {
  8206. get: function( elem, computed, extra ) {
  8207. if ( computed ) {
  8208.  
  8209. // certain elements can have dimension info if we invisibly show them
  8210. // however, it must have a current display style that would benefit from this
  8211. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  8212. elem.offsetWidth === 0 ?
  8213. swap( elem, cssShow, function() {
  8214. return getWidthOrHeight( elem, name, extra );
  8215. } ) :
  8216. getWidthOrHeight( elem, name, extra );
  8217. }
  8218. },
  8219.  
  8220. set: function( elem, value, extra ) {
  8221. var styles = extra && getStyles( elem );
  8222. return setPositiveNumber( elem, value, extra ?
  8223. augmentWidthOrHeight(
  8224. elem,
  8225. name,
  8226. extra,
  8227. support.boxSizing &&
  8228. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  8229. styles
  8230. ) : 0
  8231. );
  8232. }
  8233. };
  8234. } );
  8235.  
  8236. if ( !support.opacity ) {
  8237. jQuery.cssHooks.opacity = {
  8238. get: function( elem, computed ) {
  8239.  
  8240. // IE uses filters for opacity
  8241. return ropacity.test( ( computed && elem.currentStyle ?
  8242. elem.currentStyle.filter :
  8243. elem.style.filter ) || "" ) ?
  8244. ( 0.01 * parseFloat( RegExp.$1 ) ) + "" :
  8245. computed ? "1" : "";
  8246. },
  8247.  
  8248. set: function( elem, value ) {
  8249. var style = elem.style,
  8250. currentStyle = elem.currentStyle,
  8251. opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",
  8252. filter = currentStyle && currentStyle.filter || style.filter || "";
  8253.  
  8254. // IE has trouble with opacity if it does not have layout
  8255. // Force it by setting the zoom level
  8256. style.zoom = 1;
  8257.  
  8258. // if setting opacity to 1, and no other filters exist -
  8259. // attempt to remove filter attribute #6652
  8260. // if value === "", then remove inline opacity #12685
  8261. if ( ( value >= 1 || value === "" ) &&
  8262. jQuery.trim( filter.replace( ralpha, "" ) ) === "" &&
  8263. style.removeAttribute ) {
  8264.  
  8265. // Setting style.filter to null, "" & " " still leave "filter:" in the cssText
  8266. // if "filter:" is present at all, clearType is disabled, we want to avoid this
  8267. // style.removeAttribute is IE Only, but so apparently is this code path...
  8268. style.removeAttribute( "filter" );
  8269.  
  8270. // if there is no filter style applied in a css rule
  8271. // or unset inline opacity, we are done
  8272. if ( value === "" || currentStyle && !currentStyle.filter ) {
  8273. return;
  8274. }
  8275. }
  8276.  
  8277. // otherwise, set new filter values
  8278. style.filter = ralpha.test( filter ) ?
  8279. filter.replace( ralpha, opacity ) :
  8280. filter + " " + opacity;
  8281. }
  8282. };
  8283. }
  8284.  
  8285. jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight,
  8286. function( elem, computed ) {
  8287. if ( computed ) {
  8288. return swap( elem, { "display": "inline-block" },
  8289. curCSS, [ elem, "marginRight" ] );
  8290. }
  8291. }
  8292. );
  8293.  
  8294. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  8295. function( elem, computed ) {
  8296. if ( computed ) {
  8297. return (
  8298. parseFloat( curCSS( elem, "marginLeft" ) ) ||
  8299.  
  8300. // Support: IE<=11+
  8301. // Running getBoundingClientRect on a disconnected node in IE throws an error
  8302. // Support: IE8 only
  8303. // getClientRects() errors on disconnected elems
  8304. ( jQuery.contains( elem.ownerDocument, elem ) ?
  8305. elem.getBoundingClientRect().left -
  8306. swap( elem, { marginLeft: 0 }, function() {
  8307. return elem.getBoundingClientRect().left;
  8308. } ) :
  8309. 0
  8310. )
  8311. ) + "px";
  8312. }
  8313. }
  8314. );
  8315.  
  8316. // These hooks are used by animate to expand properties
  8317. jQuery.each( {
  8318. margin: "",
  8319. padding: "",
  8320. border: "Width"
  8321. }, function( prefix, suffix ) {
  8322. jQuery.cssHooks[ prefix + suffix ] = {
  8323. expand: function( value ) {
  8324. var i = 0,
  8325. expanded = {},
  8326.  
  8327. // assumes a single number if not a string
  8328. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  8329.  
  8330. for ( ; i < 4; i++ ) {
  8331. expanded[ prefix + cssExpand[ i ] + suffix ] =
  8332. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  8333. }
  8334.  
  8335. return expanded;
  8336. }
  8337. };
  8338.  
  8339. if ( !rmargin.test( prefix ) ) {
  8340. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  8341. }
  8342. } );
  8343.  
  8344. jQuery.fn.extend( {
  8345. css: function( name, value ) {
  8346. return access( this, function( elem, name, value ) {
  8347. var styles, len,
  8348. map = {},
  8349. i = 0;
  8350.  
  8351. if ( jQuery.isArray( name ) ) {
  8352. styles = getStyles( elem );
  8353. len = name.length;
  8354.  
  8355. for ( ; i < len; i++ ) {
  8356. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  8357. }
  8358.  
  8359. return map;
  8360. }
  8361.  
  8362. return value !== undefined ?
  8363. jQuery.style( elem, name, value ) :
  8364. jQuery.css( elem, name );
  8365. }, name, value, arguments.length > 1 );
  8366. },
  8367. show: function() {
  8368. return showHide( this, true );
  8369. },
  8370. hide: function() {
  8371. return showHide( this );
  8372. },
  8373. toggle: function( state ) {
  8374. if ( typeof state === "boolean" ) {
  8375. return state ? this.show() : this.hide();
  8376. }
  8377.  
  8378. return this.each( function() {
  8379. if ( isHidden( this ) ) {
  8380. jQuery( this ).show();
  8381. } else {
  8382. jQuery( this ).hide();
  8383. }
  8384. } );
  8385. }
  8386. } );
  8387.  
  8388.  
  8389. function Tween( elem, options, prop, end, easing ) {
  8390. return new Tween.prototype.init( elem, options, prop, end, easing );
  8391. }
  8392. jQuery.Tween = Tween;
  8393.  
  8394. Tween.prototype = {
  8395. constructor: Tween,
  8396. init: function( elem, options, prop, end, easing, unit ) {
  8397. this.elem = elem;
  8398. this.prop = prop;
  8399. this.easing = easing || jQuery.easing._default;
  8400. this.options = options;
  8401. this.start = this.now = this.cur();
  8402. this.end = end;
  8403. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  8404. },
  8405. cur: function() {
  8406. var hooks = Tween.propHooks[ this.prop ];
  8407.  
  8408. return hooks && hooks.get ?
  8409. hooks.get( this ) :
  8410. Tween.propHooks._default.get( this );
  8411. },
  8412. run: function( percent ) {
  8413. var eased,
  8414. hooks = Tween.propHooks[ this.prop ];
  8415.  
  8416. if ( this.options.duration ) {
  8417. this.pos = eased = jQuery.easing[ this.easing ](
  8418. percent, this.options.duration * percent, 0, 1, this.options.duration
  8419. );
  8420. } else {
  8421. this.pos = eased = percent;
  8422. }
  8423. this.now = ( this.end - this.start ) * eased + this.start;
  8424.  
  8425. if ( this.options.step ) {
  8426. this.options.step.call( this.elem, this.now, this );
  8427. }
  8428.  
  8429. if ( hooks && hooks.set ) {
  8430. hooks.set( this );
  8431. } else {
  8432. Tween.propHooks._default.set( this );
  8433. }
  8434. return this;
  8435. }
  8436. };
  8437.  
  8438. Tween.prototype.init.prototype = Tween.prototype;
  8439.  
  8440. Tween.propHooks = {
  8441. _default: {
  8442. get: function( tween ) {
  8443. var result;
  8444.  
  8445. // Use a property on the element directly when it is not a DOM element,
  8446. // or when there is no matching style property that exists.
  8447. if ( tween.elem.nodeType !== 1 ||
  8448. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  8449. return tween.elem[ tween.prop ];
  8450. }
  8451.  
  8452. // passing an empty string as a 3rd parameter to .css will automatically
  8453. // attempt a parseFloat and fallback to a string if the parse fails
  8454. // so, simple values such as "10px" are parsed to Float.
  8455. // complex values such as "rotate(1rad)" are returned as is.
  8456. result = jQuery.css( tween.elem, tween.prop, "" );
  8457.  
  8458. // Empty strings, null, undefined and "auto" are converted to 0.
  8459. return !result || result === "auto" ? 0 : result;
  8460. },
  8461. set: function( tween ) {
  8462.  
  8463. // use step hook for back compat - use cssHook if its there - use .style if its
  8464. // available and use plain properties where available
  8465. if ( jQuery.fx.step[ tween.prop ] ) {
  8466. jQuery.fx.step[ tween.prop ]( tween );
  8467. } else if ( tween.elem.nodeType === 1 &&
  8468. ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null ||
  8469. jQuery.cssHooks[ tween.prop ] ) ) {
  8470. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  8471. } else {
  8472. tween.elem[ tween.prop ] = tween.now;
  8473. }
  8474. }
  8475. }
  8476. };
  8477.  
  8478. // Support: IE <=9
  8479. // Panic based approach to setting things on disconnected nodes
  8480.  
  8481. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  8482. set: function( tween ) {
  8483. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  8484. tween.elem[ tween.prop ] = tween.now;
  8485. }
  8486. }
  8487. };
  8488.  
  8489. jQuery.easing = {
  8490. linear: function( p ) {
  8491. return p;
  8492. },
  8493. swing: function( p ) {
  8494. return 0.5 - Math.cos( p * Math.PI ) / 2;
  8495. },
  8496. _default: "swing"
  8497. };
  8498.  
  8499. jQuery.fx = Tween.prototype.init;
  8500.  
  8501. // Back Compat <1.8 extension point
  8502. jQuery.fx.step = {};
  8503.  
  8504.  
  8505.  
  8506.  
  8507. var
  8508. fxNow, timerId,
  8509. rfxtypes = /^(?:toggle|show|hide)$/,
  8510. rrun = /queueHooks$/;
  8511.  
  8512. // Animations created synchronously will run synchronously
  8513. function createFxNow() {
  8514. window.setTimeout( function() {
  8515. fxNow = undefined;
  8516. } );
  8517. return ( fxNow = jQuery.now() );
  8518. }
  8519.  
  8520. // Generate parameters to create a standard animation
  8521. function genFx( type, includeWidth ) {
  8522. var which,
  8523. attrs = { height: type },
  8524. i = 0;
  8525.  
  8526. // if we include width, step value is 1 to do all cssExpand values,
  8527. // if we don't include width, step value is 2 to skip over Left and Right
  8528. includeWidth = includeWidth ? 1 : 0;
  8529. for ( ; i < 4 ; i += 2 - includeWidth ) {
  8530. which = cssExpand[ i ];
  8531. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  8532. }
  8533.  
  8534. if ( includeWidth ) {
  8535. attrs.opacity = attrs.width = type;
  8536. }
  8537.  
  8538. return attrs;
  8539. }
  8540.  
  8541. function createTween( value, prop, animation ) {
  8542. var tween,
  8543. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  8544. index = 0,
  8545. length = collection.length;
  8546. for ( ; index < length; index++ ) {
  8547. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  8548.  
  8549. // we're done with this property
  8550. return tween;
  8551. }
  8552. }
  8553. }
  8554.  
  8555. function defaultPrefilter( elem, props, opts ) {
  8556. /* jshint validthis: true */
  8557. var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay,
  8558. anim = this,
  8559. orig = {},
  8560. style = elem.style,
  8561. hidden = elem.nodeType && isHidden( elem ),
  8562. dataShow = jQuery._data( elem, "fxshow" );
  8563.  
  8564. // handle queue: false promises
  8565. if ( !opts.queue ) {
  8566. hooks = jQuery._queueHooks( elem, "fx" );
  8567. if ( hooks.unqueued == null ) {
  8568. hooks.unqueued = 0;
  8569. oldfire = hooks.empty.fire;
  8570. hooks.empty.fire = function() {
  8571. if ( !hooks.unqueued ) {
  8572. oldfire();
  8573. }
  8574. };
  8575. }
  8576. hooks.unqueued++;
  8577.  
  8578. anim.always( function() {
  8579.  
  8580. // doing this makes sure that the complete handler will be called
  8581. // before this completes
  8582. anim.always( function() {
  8583. hooks.unqueued--;
  8584. if ( !jQuery.queue( elem, "fx" ).length ) {
  8585. hooks.empty.fire();
  8586. }
  8587. } );
  8588. } );
  8589. }
  8590.  
  8591. // height/width overflow pass
  8592. if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
  8593.  
  8594. // Make sure that nothing sneaks out
  8595. // Record all 3 overflow attributes because IE does not
  8596. // change the overflow attribute when overflowX and
  8597. // overflowY are set to the same value
  8598. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  8599.  
  8600. // Set display property to inline-block for height/width
  8601. // animations on inline elements that are having width/height animated
  8602. display = jQuery.css( elem, "display" );
  8603.  
  8604. // Test default display if display is currently "none"
  8605. checkDisplay = display === "none" ?
  8606. jQuery._data( elem, "olddisplay" ) || defaultDisplay( elem.nodeName ) : display;
  8607.  
  8608. if ( checkDisplay === "inline" && jQuery.css( elem, "float" ) === "none" ) {
  8609.  
  8610. // inline-level elements accept inline-block;
  8611. // block-level elements need to be inline with layout
  8612. if ( !support.inlineBlockNeedsLayout || defaultDisplay( elem.nodeName ) === "inline" ) {
  8613. style.display = "inline-block";
  8614. } else {
  8615. style.zoom = 1;
  8616. }
  8617. }
  8618. }
  8619.  
  8620. if ( opts.overflow ) {
  8621. style.overflow = "hidden";
  8622. if ( !support.shrinkWrapBlocks() ) {
  8623. anim.always( function() {
  8624. style.overflow = opts.overflow[ 0 ];
  8625. style.overflowX = opts.overflow[ 1 ];
  8626. style.overflowY = opts.overflow[ 2 ];
  8627. } );
  8628. }
  8629. }
  8630.  
  8631. // show/hide pass
  8632. for ( prop in props ) {
  8633. value = props[ prop ];
  8634. if ( rfxtypes.exec( value ) ) {
  8635. delete props[ prop ];
  8636. toggle = toggle || value === "toggle";
  8637. if ( value === ( hidden ? "hide" : "show" ) ) {
  8638.  
  8639. // If there is dataShow left over from a stopped hide or show
  8640. // and we are going to proceed with show, we should pretend to be hidden
  8641. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  8642. hidden = true;
  8643. } else {
  8644. continue;
  8645. }
  8646. }
  8647. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  8648.  
  8649. // Any non-fx value stops us from restoring the original display value
  8650. } else {
  8651. display = undefined;
  8652. }
  8653. }
  8654.  
  8655. if ( !jQuery.isEmptyObject( orig ) ) {
  8656. if ( dataShow ) {
  8657. if ( "hidden" in dataShow ) {
  8658. hidden = dataShow.hidden;
  8659. }
  8660. } else {
  8661. dataShow = jQuery._data( elem, "fxshow", {} );
  8662. }
  8663.  
  8664. // store state if its toggle - enables .stop().toggle() to "reverse"
  8665. if ( toggle ) {
  8666. dataShow.hidden = !hidden;
  8667. }
  8668. if ( hidden ) {
  8669. jQuery( elem ).show();
  8670. } else {
  8671. anim.done( function() {
  8672. jQuery( elem ).hide();
  8673. } );
  8674. }
  8675. anim.done( function() {
  8676. var prop;
  8677. jQuery._removeData( elem, "fxshow" );
  8678. for ( prop in orig ) {
  8679. jQuery.style( elem, prop, orig[ prop ] );
  8680. }
  8681. } );
  8682. for ( prop in orig ) {
  8683. tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  8684.  
  8685. if ( !( prop in dataShow ) ) {
  8686. dataShow[ prop ] = tween.start;
  8687. if ( hidden ) {
  8688. tween.end = tween.start;
  8689. tween.start = prop === "width" || prop === "height" ? 1 : 0;
  8690. }
  8691. }
  8692. }
  8693.  
  8694. // If this is a noop like .hide().hide(), restore an overwritten display value
  8695. } else if ( ( display === "none" ? defaultDisplay( elem.nodeName ) : display ) === "inline" ) {
  8696. style.display = display;
  8697. }
  8698. }
  8699.  
  8700. function propFilter( props, specialEasing ) {
  8701. var index, name, easing, value, hooks;
  8702.  
  8703. // camelCase, specialEasing and expand cssHook pass
  8704. for ( index in props ) {
  8705. name = jQuery.camelCase( index );
  8706. easing = specialEasing[ name ];
  8707. value = props[ index ];
  8708. if ( jQuery.isArray( value ) ) {
  8709. easing = value[ 1 ];
  8710. value = props[ index ] = value[ 0 ];
  8711. }
  8712.  
  8713. if ( index !== name ) {
  8714. props[ name ] = value;
  8715. delete props[ index ];
  8716. }
  8717.  
  8718. hooks = jQuery.cssHooks[ name ];
  8719. if ( hooks && "expand" in hooks ) {
  8720. value = hooks.expand( value );
  8721. delete props[ name ];
  8722.  
  8723. // not quite $.extend, this wont overwrite keys already present.
  8724. // also - reusing 'index' from above because we have the correct "name"
  8725. for ( index in value ) {
  8726. if ( !( index in props ) ) {
  8727. props[ index ] = value[ index ];
  8728. specialEasing[ index ] = easing;
  8729. }
  8730. }
  8731. } else {
  8732. specialEasing[ name ] = easing;
  8733. }
  8734. }
  8735. }
  8736.  
  8737. function Animation( elem, properties, options ) {
  8738. var result,
  8739. stopped,
  8740. index = 0,
  8741. length = Animation.prefilters.length,
  8742. deferred = jQuery.Deferred().always( function() {
  8743.  
  8744. // don't match elem in the :animated selector
  8745. delete tick.elem;
  8746. } ),
  8747. tick = function() {
  8748. if ( stopped ) {
  8749. return false;
  8750. }
  8751. var currentTime = fxNow || createFxNow(),
  8752. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  8753.  
  8754. // Support: Android 2.3
  8755. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  8756. temp = remaining / animation.duration || 0,
  8757. percent = 1 - temp,
  8758. index = 0,
  8759. length = animation.tweens.length;
  8760.  
  8761. for ( ; index < length ; index++ ) {
  8762. animation.tweens[ index ].run( percent );
  8763. }
  8764.  
  8765. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  8766.  
  8767. if ( percent < 1 && length ) {
  8768. return remaining;
  8769. } else {
  8770. deferred.resolveWith( elem, [ animation ] );
  8771. return false;
  8772. }
  8773. },
  8774. animation = deferred.promise( {
  8775. elem: elem,
  8776. props: jQuery.extend( {}, properties ),
  8777. opts: jQuery.extend( true, {
  8778. specialEasing: {},
  8779. easing: jQuery.easing._default
  8780. }, options ),
  8781. originalProperties: properties,
  8782. originalOptions: options,
  8783. startTime: fxNow || createFxNow(),
  8784. duration: options.duration,
  8785. tweens: [],
  8786. createTween: function( prop, end ) {
  8787. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  8788. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  8789. animation.tweens.push( tween );
  8790. return tween;
  8791. },
  8792. stop: function( gotoEnd ) {
  8793. var index = 0,
  8794.  
  8795. // if we are going to the end, we want to run all the tweens
  8796. // otherwise we skip this part
  8797. length = gotoEnd ? animation.tweens.length : 0;
  8798. if ( stopped ) {
  8799. return this;
  8800. }
  8801. stopped = true;
  8802. for ( ; index < length ; index++ ) {
  8803. animation.tweens[ index ].run( 1 );
  8804. }
  8805.  
  8806. // resolve when we played the last frame
  8807. // otherwise, reject
  8808. if ( gotoEnd ) {
  8809. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  8810. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  8811. } else {
  8812. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  8813. }
  8814. return this;
  8815. }
  8816. } ),
  8817. props = animation.props;
  8818.  
  8819. propFilter( props, animation.opts.specialEasing );
  8820.  
  8821. for ( ; index < length ; index++ ) {
  8822. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  8823. if ( result ) {
  8824. if ( jQuery.isFunction( result.stop ) ) {
  8825. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  8826. jQuery.proxy( result.stop, result );
  8827. }
  8828. return result;
  8829. }
  8830. }
  8831.  
  8832. jQuery.map( props, createTween, animation );
  8833.  
  8834. if ( jQuery.isFunction( animation.opts.start ) ) {
  8835. animation.opts.start.call( elem, animation );
  8836. }
  8837.  
  8838. jQuery.fx.timer(
  8839. jQuery.extend( tick, {
  8840. elem: elem,
  8841. anim: animation,
  8842. queue: animation.opts.queue
  8843. } )
  8844. );
  8845.  
  8846. // attach callbacks from options
  8847. return animation.progress( animation.opts.progress )
  8848. .done( animation.opts.done, animation.opts.complete )
  8849. .fail( animation.opts.fail )
  8850. .always( animation.opts.always );
  8851. }
  8852.  
  8853. jQuery.Animation = jQuery.extend( Animation, {
  8854.  
  8855. tweeners: {
  8856. "*": [ function( prop, value ) {
  8857. var tween = this.createTween( prop, value );
  8858. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  8859. return tween;
  8860. } ]
  8861. },
  8862.  
  8863. tweener: function( props, callback ) {
  8864. if ( jQuery.isFunction( props ) ) {
  8865. callback = props;
  8866. props = [ "*" ];
  8867. } else {
  8868. props = props.match( rnotwhite );
  8869. }
  8870.  
  8871. var prop,
  8872. index = 0,
  8873. length = props.length;
  8874.  
  8875. for ( ; index < length ; index++ ) {
  8876. prop = props[ index ];
  8877. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  8878. Animation.tweeners[ prop ].unshift( callback );
  8879. }
  8880. },
  8881.  
  8882. prefilters: [ defaultPrefilter ],
  8883.  
  8884. prefilter: function( callback, prepend ) {
  8885. if ( prepend ) {
  8886. Animation.prefilters.unshift( callback );
  8887. } else {
  8888. Animation.prefilters.push( callback );
  8889. }
  8890. }
  8891. } );
  8892.  
  8893. jQuery.speed = function( speed, easing, fn ) {
  8894. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  8895. complete: fn || !fn && easing ||
  8896. jQuery.isFunction( speed ) && speed,
  8897. duration: speed,
  8898. easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
  8899. };
  8900.  
  8901. opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
  8902. opt.duration in jQuery.fx.speeds ?
  8903. jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
  8904.  
  8905. // normalize opt.queue - true/undefined/null -> "fx"
  8906. if ( opt.queue == null || opt.queue === true ) {
  8907. opt.queue = "fx";
  8908. }
  8909.  
  8910. // Queueing
  8911. opt.old = opt.complete;
  8912.  
  8913. opt.complete = function() {
  8914. if ( jQuery.isFunction( opt.old ) ) {
  8915. opt.old.call( this );
  8916. }
  8917.  
  8918. if ( opt.queue ) {
  8919. jQuery.dequeue( this, opt.queue );
  8920. }
  8921. };
  8922.  
  8923. return opt;
  8924. };
  8925.  
  8926. jQuery.fn.extend( {
  8927. fadeTo: function( speed, to, easing, callback ) {
  8928.  
  8929. // show any hidden elements after setting opacity to 0
  8930. return this.filter( isHidden ).css( "opacity", 0 ).show()
  8931.  
  8932. // animate to the value specified
  8933. .end().animate( { opacity: to }, speed, easing, callback );
  8934. },
  8935. animate: function( prop, speed, easing, callback ) {
  8936. var empty = jQuery.isEmptyObject( prop ),
  8937. optall = jQuery.speed( speed, easing, callback ),
  8938. doAnimation = function() {
  8939.  
  8940. // Operate on a copy of prop so per-property easing won't be lost
  8941. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  8942.  
  8943. // Empty animations, or finishing resolves immediately
  8944. if ( empty || jQuery._data( this, "finish" ) ) {
  8945. anim.stop( true );
  8946. }
  8947. };
  8948. doAnimation.finish = doAnimation;
  8949.  
  8950. return empty || optall.queue === false ?
  8951. this.each( doAnimation ) :
  8952. this.queue( optall.queue, doAnimation );
  8953. },
  8954. stop: function( type, clearQueue, gotoEnd ) {
  8955. var stopQueue = function( hooks ) {
  8956. var stop = hooks.stop;
  8957. delete hooks.stop;
  8958. stop( gotoEnd );
  8959. };
  8960.  
  8961. if ( typeof type !== "string" ) {
  8962. gotoEnd = clearQueue;
  8963. clearQueue = type;
  8964. type = undefined;
  8965. }
  8966. if ( clearQueue && type !== false ) {
  8967. this.queue( type || "fx", [] );
  8968. }
  8969.  
  8970. return this.each( function() {
  8971. var dequeue = true,
  8972. index = type != null && type + "queueHooks",
  8973. timers = jQuery.timers,
  8974. data = jQuery._data( this );
  8975.  
  8976. if ( index ) {
  8977. if ( data[ index ] && data[ index ].stop ) {
  8978. stopQueue( data[ index ] );
  8979. }
  8980. } else {
  8981. for ( index in data ) {
  8982. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  8983. stopQueue( data[ index ] );
  8984. }
  8985. }
  8986. }
  8987.  
  8988. for ( index = timers.length; index--; ) {
  8989. if ( timers[ index ].elem === this &&
  8990. ( type == null || timers[ index ].queue === type ) ) {
  8991.  
  8992. timers[ index ].anim.stop( gotoEnd );
  8993. dequeue = false;
  8994. timers.splice( index, 1 );
  8995. }
  8996. }
  8997.  
  8998. // start the next in the queue if the last step wasn't forced
  8999. // timers currently will call their complete callbacks, which will dequeue
  9000. // but only if they were gotoEnd
  9001. if ( dequeue || !gotoEnd ) {
  9002. jQuery.dequeue( this, type );
  9003. }
  9004. } );
  9005. },
  9006. finish: function( type ) {
  9007. if ( type !== false ) {
  9008. type = type || "fx";
  9009. }
  9010. return this.each( function() {
  9011. var index,
  9012. data = jQuery._data( this ),
  9013. queue = data[ type + "queue" ],
  9014. hooks = data[ type + "queueHooks" ],
  9015. timers = jQuery.timers,
  9016. length = queue ? queue.length : 0;
  9017.  
  9018. // enable finishing flag on private data
  9019. data.finish = true;
  9020.  
  9021. // empty the queue first
  9022. jQuery.queue( this, type, [] );
  9023.  
  9024. if ( hooks && hooks.stop ) {
  9025. hooks.stop.call( this, true );
  9026. }
  9027.  
  9028. // look for any active animations, and finish them
  9029. for ( index = timers.length; index--; ) {
  9030. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  9031. timers[ index ].anim.stop( true );
  9032. timers.splice( index, 1 );
  9033. }
  9034. }
  9035.  
  9036. // look for any animations in the old queue and finish them
  9037. for ( index = 0; index < length; index++ ) {
  9038. if ( queue[ index ] && queue[ index ].finish ) {
  9039. queue[ index ].finish.call( this );
  9040. }
  9041. }
  9042.  
  9043. // turn off finishing flag
  9044. delete data.finish;
  9045. } );
  9046. }
  9047. } );
  9048.  
  9049. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  9050. var cssFn = jQuery.fn[ name ];
  9051. jQuery.fn[ name ] = function( speed, easing, callback ) {
  9052. return speed == null || typeof speed === "boolean" ?
  9053. cssFn.apply( this, arguments ) :
  9054. this.animate( genFx( name, true ), speed, easing, callback );
  9055. };
  9056. } );
  9057.  
  9058. // Generate shortcuts for custom animations
  9059. jQuery.each( {
  9060. slideDown: genFx( "show" ),
  9061. slideUp: genFx( "hide" ),
  9062. slideToggle: genFx( "toggle" ),
  9063. fadeIn: { opacity: "show" },
  9064. fadeOut: { opacity: "hide" },
  9065. fadeToggle: { opacity: "toggle" }
  9066. }, function( name, props ) {
  9067. jQuery.fn[ name ] = function( speed, easing, callback ) {
  9068. return this.animate( props, speed, easing, callback );
  9069. };
  9070. } );
  9071.  
  9072. jQuery.timers = [];
  9073. jQuery.fx.tick = function() {
  9074. var timer,
  9075. timers = jQuery.timers,
  9076. i = 0;
  9077.  
  9078. fxNow = jQuery.now();
  9079.  
  9080. for ( ; i < timers.length; i++ ) {
  9081. timer = timers[ i ];
  9082.  
  9083. // Checks the timer has not already been removed
  9084. if ( !timer() && timers[ i ] === timer ) {
  9085. timers.splice( i--, 1 );
  9086. }
  9087. }
  9088.  
  9089. if ( !timers.length ) {
  9090. jQuery.fx.stop();
  9091. }
  9092. fxNow = undefined;
  9093. };
  9094.  
  9095. jQuery.fx.timer = function( timer ) {
  9096. jQuery.timers.push( timer );
  9097. if ( timer() ) {
  9098. jQuery.fx.start();
  9099. } else {
  9100. jQuery.timers.pop();
  9101. }
  9102. };
  9103.  
  9104. jQuery.fx.interval = 13;
  9105.  
  9106. jQuery.fx.start = function() {
  9107. if ( !timerId ) {
  9108. timerId = window.setInterval( jQuery.fx.tick, jQuery.fx.interval );
  9109. }
  9110. };
  9111.  
  9112. jQuery.fx.stop = function() {
  9113. window.clearInterval( timerId );
  9114. timerId = null;
  9115. };
  9116.  
  9117. jQuery.fx.speeds = {
  9118. slow: 600,
  9119. fast: 200,
  9120.  
  9121. // Default speed
  9122. _default: 400
  9123. };
  9124.  
  9125.  
  9126. // Based off of the plugin by Clint Helfers, with permission.
  9127. // http://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  9128. jQuery.fn.delay = function( time, type ) {
  9129. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  9130. type = type || "fx";
  9131.  
  9132. return this.queue( type, function( next, hooks ) {
  9133. var timeout = window.setTimeout( next, time );
  9134. hooks.stop = function() {
  9135. window.clearTimeout( timeout );
  9136. };
  9137. } );
  9138. };
  9139.  
  9140.  
  9141. ( function() {
  9142. var a,
  9143. input = document.createElement( "input" ),
  9144. div = document.createElement( "div" ),
  9145. select = document.createElement( "select" ),
  9146. opt = select.appendChild( document.createElement( "option" ) );
  9147.  
  9148. // Setup
  9149. div = document.createElement( "div" );
  9150. div.setAttribute( "className", "t" );
  9151. div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
  9152. a = div.getElementsByTagName( "a" )[ 0 ];
  9153.  
  9154. // Support: Windows Web Apps (WWA)
  9155. // `type` must use .setAttribute for WWA (#14901)
  9156. input.setAttribute( "type", "checkbox" );
  9157. div.appendChild( input );
  9158.  
  9159. a = div.getElementsByTagName( "a" )[ 0 ];
  9160.  
  9161. // First batch of tests.
  9162. a.style.cssText = "top:1px";
  9163.  
  9164. // Test setAttribute on camelCase class.
  9165. // If it works, we need attrFixes when doing get/setAttribute (ie6/7)
  9166. support.getSetAttribute = div.className !== "t";
  9167.  
  9168. // Get the style information from getAttribute
  9169. // (IE uses .cssText instead)
  9170. support.style = /top/.test( a.getAttribute( "style" ) );
  9171.  
  9172. // Make sure that URLs aren't manipulated
  9173. // (IE normalizes it by default)
  9174. support.hrefNormalized = a.getAttribute( "href" ) === "/a";
  9175.  
  9176. // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)
  9177. support.checkOn = !!input.value;
  9178.  
  9179. // Make sure that a selected-by-default option has a working selected property.
  9180. // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
  9181. support.optSelected = opt.selected;
  9182.  
  9183. // Tests for enctype support on a form (#6743)
  9184. support.enctype = !!document.createElement( "form" ).enctype;
  9185.  
  9186. // Make sure that the options inside disabled selects aren't marked as disabled
  9187. // (WebKit marks them as disabled)
  9188. select.disabled = true;
  9189. support.optDisabled = !opt.disabled;
  9190.  
  9191. // Support: IE8 only
  9192. // Check if we can trust getAttribute("value")
  9193. input = document.createElement( "input" );
  9194. input.setAttribute( "value", "" );
  9195. support.input = input.getAttribute( "value" ) === "";
  9196.  
  9197. // Check if an input maintains its value after becoming a radio
  9198. input.value = "t";
  9199. input.setAttribute( "type", "radio" );
  9200. support.radioValue = input.value === "t";
  9201. } )();
  9202.  
  9203.  
  9204. var rreturn = /\r/g,
  9205. rspaces = /[\x20\t\r\n\f]+/g;
  9206.  
  9207. jQuery.fn.extend( {
  9208. val: function( value ) {
  9209. var hooks, ret, isFunction,
  9210. elem = this[ 0 ];
  9211.  
  9212. if ( !arguments.length ) {
  9213. if ( elem ) {
  9214. hooks = jQuery.valHooks[ elem.type ] ||
  9215. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  9216.  
  9217. if (
  9218. hooks &&
  9219. "get" in hooks &&
  9220. ( ret = hooks.get( elem, "value" ) ) !== undefined
  9221. ) {
  9222. return ret;
  9223. }
  9224.  
  9225. ret = elem.value;
  9226.  
  9227. return typeof ret === "string" ?
  9228.  
  9229. // handle most common string cases
  9230. ret.replace( rreturn, "" ) :
  9231.  
  9232. // handle cases where value is null/undef or number
  9233. ret == null ? "" : ret;
  9234. }
  9235.  
  9236. return;
  9237. }
  9238.  
  9239. isFunction = jQuery.isFunction( value );
  9240.  
  9241. return this.each( function( i ) {
  9242. var val;
  9243.  
  9244. if ( this.nodeType !== 1 ) {
  9245. return;
  9246. }
  9247.  
  9248. if ( isFunction ) {
  9249. val = value.call( this, i, jQuery( this ).val() );
  9250. } else {
  9251. val = value;
  9252. }
  9253.  
  9254. // Treat null/undefined as ""; convert numbers to string
  9255. if ( val == null ) {
  9256. val = "";
  9257. } else if ( typeof val === "number" ) {
  9258. val += "";
  9259. } else if ( jQuery.isArray( val ) ) {
  9260. val = jQuery.map( val, function( value ) {
  9261. return value == null ? "" : value + "";
  9262. } );
  9263. }
  9264.  
  9265. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  9266.  
  9267. // If set returns undefined, fall back to normal setting
  9268. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  9269. this.value = val;
  9270. }
  9271. } );
  9272. }
  9273. } );
  9274.  
  9275. jQuery.extend( {
  9276. valHooks: {
  9277. option: {
  9278. get: function( elem ) {
  9279. var val = jQuery.find.attr( elem, "value" );
  9280. return val != null ?
  9281. val :
  9282.  
  9283. // Support: IE10-11+
  9284. // option.text throws exceptions (#14686, #14858)
  9285. // Strip and collapse whitespace
  9286. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  9287. jQuery.trim( jQuery.text( elem ) ).replace( rspaces, " " );
  9288. }
  9289. },
  9290. select: {
  9291. get: function( elem ) {
  9292. var value, option,
  9293. options = elem.options,
  9294. index = elem.selectedIndex,
  9295. one = elem.type === "select-one" || index < 0,
  9296. values = one ? null : [],
  9297. max = one ? index + 1 : options.length,
  9298. i = index < 0 ?
  9299. max :
  9300. one ? index : 0;
  9301.  
  9302. // Loop through all the selected options
  9303. for ( ; i < max; i++ ) {
  9304. option = options[ i ];
  9305.  
  9306. // oldIE doesn't update selected after form reset (#2551)
  9307. if ( ( option.selected || i === index ) &&
  9308.  
  9309. // Don't return options that are disabled or in a disabled optgroup
  9310. ( support.optDisabled ?
  9311. !option.disabled :
  9312. option.getAttribute( "disabled" ) === null ) &&
  9313. ( !option.parentNode.disabled ||
  9314. !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
  9315.  
  9316. // Get the specific value for the option
  9317. value = jQuery( option ).val();
  9318.  
  9319. // We don't need an array for one selects
  9320. if ( one ) {
  9321. return value;
  9322. }
  9323.  
  9324. // Multi-Selects return an array
  9325. values.push( value );
  9326. }
  9327. }
  9328.  
  9329. return values;
  9330. },
  9331.  
  9332. set: function( elem, value ) {
  9333. var optionSet, option,
  9334. options = elem.options,
  9335. values = jQuery.makeArray( value ),
  9336. i = options.length;
  9337.  
  9338. while ( i-- ) {
  9339. option = options[ i ];
  9340.  
  9341. if ( jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 ) {
  9342.  
  9343. // Support: IE6
  9344. // When new option element is added to select box we need to
  9345. // force reflow of newly added node in order to workaround delay
  9346. // of initialization properties
  9347. try {
  9348. option.selected = optionSet = true;
  9349.  
  9350. } catch ( _ ) {
  9351.  
  9352. // Will be executed only in IE6
  9353. option.scrollHeight;
  9354. }
  9355.  
  9356. } else {
  9357. option.selected = false;
  9358. }
  9359. }
  9360.  
  9361. // Force browsers to behave consistently when non-matching value is set
  9362. if ( !optionSet ) {
  9363. elem.selectedIndex = -1;
  9364. }
  9365.  
  9366. return options;
  9367. }
  9368. }
  9369. }
  9370. } );
  9371.  
  9372. // Radios and checkboxes getter/setter
  9373. jQuery.each( [ "radio", "checkbox" ], function() {
  9374. jQuery.valHooks[ this ] = {
  9375. set: function( elem, value ) {
  9376. if ( jQuery.isArray( value ) ) {
  9377. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  9378. }
  9379. }
  9380. };
  9381. if ( !support.checkOn ) {
  9382. jQuery.valHooks[ this ].get = function( elem ) {
  9383. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  9384. };
  9385. }
  9386. } );
  9387.  
  9388.  
  9389.  
  9390.  
  9391. var nodeHook, boolHook,
  9392. attrHandle = jQuery.expr.attrHandle,
  9393. ruseDefault = /^(?:checked|selected)$/i,
  9394. getSetAttribute = support.getSetAttribute,
  9395. getSetInput = support.input;
  9396.  
  9397. jQuery.fn.extend( {
  9398. attr: function( name, value ) {
  9399. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  9400. },
  9401.  
  9402. removeAttr: function( name ) {
  9403. return this.each( function() {
  9404. jQuery.removeAttr( this, name );
  9405. } );
  9406. }
  9407. } );
  9408.  
  9409. jQuery.extend( {
  9410. attr: function( elem, name, value ) {
  9411. var ret, hooks,
  9412. nType = elem.nodeType;
  9413.  
  9414. // Don't get/set attributes on text, comment and attribute nodes
  9415. if ( nType === 3 || nType === 8 || nType === 2 ) {
  9416. return;
  9417. }
  9418.  
  9419. // Fallback to prop when attributes are not supported
  9420. if ( typeof elem.getAttribute === "undefined" ) {
  9421. return jQuery.prop( elem, name, value );
  9422. }
  9423.  
  9424. // All attributes are lowercase
  9425. // Grab necessary hook if one is defined
  9426. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  9427. name = name.toLowerCase();
  9428. hooks = jQuery.attrHooks[ name ] ||
  9429. ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook );
  9430. }
  9431.  
  9432. if ( value !== undefined ) {
  9433. if ( value === null ) {
  9434. jQuery.removeAttr( elem, name );
  9435. return;
  9436. }
  9437.  
  9438. if ( hooks && "set" in hooks &&
  9439. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  9440. return ret;
  9441. }
  9442.  
  9443. elem.setAttribute( name, value + "" );
  9444. return value;
  9445. }
  9446.  
  9447. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  9448. return ret;
  9449. }
  9450.  
  9451. ret = jQuery.find.attr( elem, name );
  9452.  
  9453. // Non-existent attributes return null, we normalize to undefined
  9454. return ret == null ? undefined : ret;
  9455. },
  9456.  
  9457. attrHooks: {
  9458. type: {
  9459. set: function( elem, value ) {
  9460. if ( !support.radioValue && value === "radio" &&
  9461. jQuery.nodeName( elem, "input" ) ) {
  9462.  
  9463. // Setting the type on a radio button after the value resets the value in IE8-9
  9464. // Reset value to default in case type is set after value during creation
  9465. var val = elem.value;
  9466. elem.setAttribute( "type", value );
  9467. if ( val ) {
  9468. elem.value = val;
  9469. }
  9470. return value;
  9471. }
  9472. }
  9473. }
  9474. },
  9475.  
  9476. removeAttr: function( elem, value ) {
  9477. var name, propName,
  9478. i = 0,
  9479. attrNames = value && value.match( rnotwhite );
  9480.  
  9481. if ( attrNames && elem.nodeType === 1 ) {
  9482. while ( ( name = attrNames[ i++ ] ) ) {
  9483. propName = jQuery.propFix[ name ] || name;
  9484.  
  9485. // Boolean attributes get special treatment (#10870)
  9486. if ( jQuery.expr.match.bool.test( name ) ) {
  9487.  
  9488. // Set corresponding property to false
  9489. if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
  9490. elem[ propName ] = false;
  9491.  
  9492. // Support: IE<9
  9493. // Also clear defaultChecked/defaultSelected (if appropriate)
  9494. } else {
  9495. elem[ jQuery.camelCase( "default-" + name ) ] =
  9496. elem[ propName ] = false;
  9497. }
  9498.  
  9499. // See #9699 for explanation of this approach (setting first, then removal)
  9500. } else {
  9501. jQuery.attr( elem, name, "" );
  9502. }
  9503.  
  9504. elem.removeAttribute( getSetAttribute ? name : propName );
  9505. }
  9506. }
  9507. }
  9508. } );
  9509.  
  9510. // Hooks for boolean attributes
  9511. boolHook = {
  9512. set: function( elem, value, name ) {
  9513. if ( value === false ) {
  9514.  
  9515. // Remove boolean attributes when set to false
  9516. jQuery.removeAttr( elem, name );
  9517. } else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
  9518.  
  9519. // IE<8 needs the *property* name
  9520. elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name );
  9521.  
  9522. } else {
  9523.  
  9524. // Support: IE<9
  9525. // Use defaultChecked and defaultSelected for oldIE
  9526. elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true;
  9527. }
  9528. return name;
  9529. }
  9530. };
  9531.  
  9532. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  9533. var getter = attrHandle[ name ] || jQuery.find.attr;
  9534.  
  9535. if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
  9536. attrHandle[ name ] = function( elem, name, isXML ) {
  9537. var ret, handle;
  9538. if ( !isXML ) {
  9539.  
  9540. // Avoid an infinite loop by temporarily removing this function from the getter
  9541. handle = attrHandle[ name ];
  9542. attrHandle[ name ] = ret;
  9543. ret = getter( elem, name, isXML ) != null ?
  9544. name.toLowerCase() :
  9545. null;
  9546. attrHandle[ name ] = handle;
  9547. }
  9548. return ret;
  9549. };
  9550. } else {
  9551. attrHandle[ name ] = function( elem, name, isXML ) {
  9552. if ( !isXML ) {
  9553. return elem[ jQuery.camelCase( "default-" + name ) ] ?
  9554. name.toLowerCase() :
  9555. null;
  9556. }
  9557. };
  9558. }
  9559. } );
  9560.  
  9561. // fix oldIE attroperties
  9562. if ( !getSetInput || !getSetAttribute ) {
  9563. jQuery.attrHooks.value = {
  9564. set: function( elem, value, name ) {
  9565. if ( jQuery.nodeName( elem, "input" ) ) {
  9566.  
  9567. // Does not return so that setAttribute is also used
  9568. elem.defaultValue = value;
  9569. } else {
  9570.  
  9571. // Use nodeHook if defined (#1954); otherwise setAttribute is fine
  9572. return nodeHook && nodeHook.set( elem, value, name );
  9573. }
  9574. }
  9575. };
  9576. }
  9577.  
  9578. // IE6/7 do not support getting/setting some attributes with get/setAttribute
  9579. if ( !getSetAttribute ) {
  9580.  
  9581. // Use this for any attribute in IE6/7
  9582. // This fixes almost every IE6/7 issue
  9583. nodeHook = {
  9584. set: function( elem, value, name ) {
  9585.  
  9586. // Set the existing or create a new attribute node
  9587. var ret = elem.getAttributeNode( name );
  9588. if ( !ret ) {
  9589. elem.setAttributeNode(
  9590. ( ret = elem.ownerDocument.createAttribute( name ) )
  9591. );
  9592. }
  9593.  
  9594. ret.value = value += "";
  9595.  
  9596. // Break association with cloned elements by also using setAttribute (#9646)
  9597. if ( name === "value" || value === elem.getAttribute( name ) ) {
  9598. return value;
  9599. }
  9600. }
  9601. };
  9602.  
  9603. // Some attributes are constructed with empty-string values when not defined
  9604. attrHandle.id = attrHandle.name = attrHandle.coords =
  9605. function( elem, name, isXML ) {
  9606. var ret;
  9607. if ( !isXML ) {
  9608. return ( ret = elem.getAttributeNode( name ) ) && ret.value !== "" ?
  9609. ret.value :
  9610. null;
  9611. }
  9612. };
  9613.  
  9614. // Fixing value retrieval on a button requires this module
  9615. jQuery.valHooks.button = {
  9616. get: function( elem, name ) {
  9617. var ret = elem.getAttributeNode( name );
  9618. if ( ret && ret.specified ) {
  9619. return ret.value;
  9620. }
  9621. },
  9622. set: nodeHook.set
  9623. };
  9624.  
  9625. // Set contenteditable to false on removals(#10429)
  9626. // Setting to empty string throws an error as an invalid value
  9627. jQuery.attrHooks.contenteditable = {
  9628. set: function( elem, value, name ) {
  9629. nodeHook.set( elem, value === "" ? false : value, name );
  9630. }
  9631. };
  9632.  
  9633. // Set width and height to auto instead of 0 on empty string( Bug #8150 )
  9634. // This is for removals
  9635. jQuery.each( [ "width", "height" ], function( i, name ) {
  9636. jQuery.attrHooks[ name ] = {
  9637. set: function( elem, value ) {
  9638. if ( value === "" ) {
  9639. elem.setAttribute( name, "auto" );
  9640. return value;
  9641. }
  9642. }
  9643. };
  9644. } );
  9645. }
  9646.  
  9647. if ( !support.style ) {
  9648. jQuery.attrHooks.style = {
  9649. get: function( elem ) {
  9650.  
  9651. // Return undefined in the case of empty string
  9652. // Note: IE uppercases css property names, but if we were to .toLowerCase()
  9653. // .cssText, that would destroy case sensitivity in URL's, like in "background"
  9654. return elem.style.cssText || undefined;
  9655. },
  9656. set: function( elem, value ) {
  9657. return ( elem.style.cssText = value + "" );
  9658. }
  9659. };
  9660. }
  9661.  
  9662.  
  9663.  
  9664.  
  9665. var rfocusable = /^(?:input|select|textarea|button|object)$/i,
  9666. rclickable = /^(?:a|area)$/i;
  9667.  
  9668. jQuery.fn.extend( {
  9669. prop: function( name, value ) {
  9670. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  9671. },
  9672.  
  9673. removeProp: function( name ) {
  9674. name = jQuery.propFix[ name ] || name;
  9675. return this.each( function() {
  9676.  
  9677. // try/catch handles cases where IE balks (such as removing a property on window)
  9678. try {
  9679. this[ name ] = undefined;
  9680. delete this[ name ];
  9681. } catch ( e ) {}
  9682. } );
  9683. }
  9684. } );
  9685.  
  9686. jQuery.extend( {
  9687. prop: function( elem, name, value ) {
  9688. var ret, hooks,
  9689. nType = elem.nodeType;
  9690.  
  9691. // Don't get/set properties on text, comment and attribute nodes
  9692. if ( nType === 3 || nType === 8 || nType === 2 ) {
  9693. return;
  9694. }
  9695.  
  9696. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  9697.  
  9698. // Fix name and attach hooks
  9699. name = jQuery.propFix[ name ] || name;
  9700. hooks = jQuery.propHooks[ name ];
  9701. }
  9702.  
  9703. if ( value !== undefined ) {
  9704. if ( hooks && "set" in hooks &&
  9705. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  9706. return ret;
  9707. }
  9708.  
  9709. return ( elem[ name ] = value );
  9710. }
  9711.  
  9712. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  9713. return ret;
  9714. }
  9715.  
  9716. return elem[ name ];
  9717. },
  9718.  
  9719. propHooks: {
  9720. tabIndex: {
  9721. get: function( elem ) {
  9722.  
  9723. // elem.tabIndex doesn't always return the
  9724. // correct value when it hasn't been explicitly set
  9725. // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  9726. // Use proper attribute retrieval(#12072)
  9727. var tabindex = jQuery.find.attr( elem, "tabindex" );
  9728.  
  9729. return tabindex ?
  9730. parseInt( tabindex, 10 ) :
  9731. rfocusable.test( elem.nodeName ) ||
  9732. rclickable.test( elem.nodeName ) && elem.href ?
  9733. 0 :
  9734. -1;
  9735. }
  9736. }
  9737. },
  9738.  
  9739. propFix: {
  9740. "for": "htmlFor",
  9741. "class": "className"
  9742. }
  9743. } );
  9744.  
  9745. // Some attributes require a special call on IE
  9746. // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  9747. if ( !support.hrefNormalized ) {
  9748.  
  9749. // href/src property should get the full normalized URL (#10299/#12915)
  9750. jQuery.each( [ "href", "src" ], function( i, name ) {
  9751. jQuery.propHooks[ name ] = {
  9752. get: function( elem ) {
  9753. return elem.getAttribute( name, 4 );
  9754. }
  9755. };
  9756. } );
  9757. }
  9758.  
  9759. // Support: Safari, IE9+
  9760. // Accessing the selectedIndex property
  9761. // forces the browser to respect setting selected
  9762. // on the option
  9763. // The getter ensures a default option is selected
  9764. // when in an optgroup
  9765. if ( !support.optSelected ) {
  9766. jQuery.propHooks.selected = {
  9767. get: function( elem ) {
  9768. var parent = elem.parentNode;
  9769.  
  9770. if ( parent ) {
  9771. parent.selectedIndex;
  9772.  
  9773. // Make sure that it also works with optgroups, see #5701
  9774. if ( parent.parentNode ) {
  9775. parent.parentNode.selectedIndex;
  9776. }
  9777. }
  9778. return null;
  9779. },
  9780. set: function( elem ) {
  9781. var parent = elem.parentNode;
  9782. if ( parent ) {
  9783. parent.selectedIndex;
  9784.  
  9785. if ( parent.parentNode ) {
  9786. parent.parentNode.selectedIndex;
  9787. }
  9788. }
  9789. }
  9790. };
  9791. }
  9792.  
  9793. jQuery.each( [
  9794. "tabIndex",
  9795. "readOnly",
  9796. "maxLength",
  9797. "cellSpacing",
  9798. "cellPadding",
  9799. "rowSpan",
  9800. "colSpan",
  9801. "useMap",
  9802. "frameBorder",
  9803. "contentEditable"
  9804. ], function() {
  9805. jQuery.propFix[ this.toLowerCase() ] = this;
  9806. } );
  9807.  
  9808. // IE6/7 call enctype encoding
  9809. if ( !support.enctype ) {
  9810. jQuery.propFix.enctype = "encoding";
  9811. }
  9812.  
  9813.  
  9814.  
  9815.  
  9816. var rclass = /[\t\r\n\f]/g;
  9817.  
  9818. function getClass( elem ) {
  9819. return jQuery.attr( elem, "class" ) || "";
  9820. }
  9821.  
  9822. jQuery.fn.extend( {
  9823. addClass: function( value ) {
  9824. var classes, elem, cur, curValue, clazz, j, finalValue,
  9825. i = 0;
  9826.  
  9827. if ( jQuery.isFunction( value ) ) {
  9828. return this.each( function( j ) {
  9829. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  9830. } );
  9831. }
  9832.  
  9833. if ( typeof value === "string" && value ) {
  9834. classes = value.match( rnotwhite ) || [];
  9835.  
  9836. while ( ( elem = this[ i++ ] ) ) {
  9837. curValue = getClass( elem );
  9838. cur = elem.nodeType === 1 &&
  9839. ( " " + curValue + " " ).replace( rclass, " " );
  9840.  
  9841. if ( cur ) {
  9842. j = 0;
  9843. while ( ( clazz = classes[ j++ ] ) ) {
  9844. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  9845. cur += clazz + " ";
  9846. }
  9847. }
  9848.  
  9849. // only assign if different to avoid unneeded rendering.
  9850. finalValue = jQuery.trim( cur );
  9851. if ( curValue !== finalValue ) {
  9852. jQuery.attr( elem, "class", finalValue );
  9853. }
  9854. }
  9855. }
  9856. }
  9857.  
  9858. return this;
  9859. },
  9860.  
  9861. removeClass: function( value ) {
  9862. var classes, elem, cur, curValue, clazz, j, finalValue,
  9863. i = 0;
  9864.  
  9865. if ( jQuery.isFunction( value ) ) {
  9866. return this.each( function( j ) {
  9867. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  9868. } );
  9869. }
  9870.  
  9871. if ( !arguments.length ) {
  9872. return this.attr( "class", "" );
  9873. }
  9874.  
  9875. if ( typeof value === "string" && value ) {
  9876. classes = value.match( rnotwhite ) || [];
  9877.  
  9878. while ( ( elem = this[ i++ ] ) ) {
  9879. curValue = getClass( elem );
  9880.  
  9881. // This expression is here for better compressibility (see addClass)
  9882. cur = elem.nodeType === 1 &&
  9883. ( " " + curValue + " " ).replace( rclass, " " );
  9884.  
  9885. if ( cur ) {
  9886. j = 0;
  9887. while ( ( clazz = classes[ j++ ] ) ) {
  9888.  
  9889. // Remove *all* instances
  9890. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  9891. cur = cur.replace( " " + clazz + " ", " " );
  9892. }
  9893. }
  9894.  
  9895. // Only assign if different to avoid unneeded rendering.
  9896. finalValue = jQuery.trim( cur );
  9897. if ( curValue !== finalValue ) {
  9898. jQuery.attr( elem, "class", finalValue );
  9899. }
  9900. }
  9901. }
  9902. }
  9903.  
  9904. return this;
  9905. },
  9906.  
  9907. toggleClass: function( value, stateVal ) {
  9908. var type = typeof value;
  9909.  
  9910. if ( typeof stateVal === "boolean" && type === "string" ) {
  9911. return stateVal ? this.addClass( value ) : this.removeClass( value );
  9912. }
  9913.  
  9914. if ( jQuery.isFunction( value ) ) {
  9915. return this.each( function( i ) {
  9916. jQuery( this ).toggleClass(
  9917. value.call( this, i, getClass( this ), stateVal ),
  9918. stateVal
  9919. );
  9920. } );
  9921. }
  9922.  
  9923. return this.each( function() {
  9924. var className, i, self, classNames;
  9925.  
  9926. if ( type === "string" ) {
  9927.  
  9928. // Toggle individual class names
  9929. i = 0;
  9930. self = jQuery( this );
  9931. classNames = value.match( rnotwhite ) || [];
  9932.  
  9933. while ( ( className = classNames[ i++ ] ) ) {
  9934.  
  9935. // Check each className given, space separated list
  9936. if ( self.hasClass( className ) ) {
  9937. self.removeClass( className );
  9938. } else {
  9939. self.addClass( className );
  9940. }
  9941. }
  9942.  
  9943. // Toggle whole class name
  9944. } else if ( value === undefined || type === "boolean" ) {
  9945. className = getClass( this );
  9946. if ( className ) {
  9947.  
  9948. // store className if set
  9949. jQuery._data( this, "__className__", className );
  9950. }
  9951.  
  9952. // If the element has a class name or if we're passed "false",
  9953. // then remove the whole classname (if there was one, the above saved it).
  9954. // Otherwise bring back whatever was previously saved (if anything),
  9955. // falling back to the empty string if nothing was stored.
  9956. jQuery.attr( this, "class",
  9957. className || value === false ?
  9958. "" :
  9959. jQuery._data( this, "__className__" ) || ""
  9960. );
  9961. }
  9962. } );
  9963. },
  9964.  
  9965. hasClass: function( selector ) {
  9966. var className, elem,
  9967. i = 0;
  9968.  
  9969. className = " " + selector + " ";
  9970. while ( ( elem = this[ i++ ] ) ) {
  9971. if ( elem.nodeType === 1 &&
  9972. ( " " + getClass( elem ) + " " ).replace( rclass, " " )
  9973. .indexOf( className ) > -1
  9974. ) {
  9975. return true;
  9976. }
  9977. }
  9978.  
  9979. return false;
  9980. }
  9981. } );
  9982.  
  9983.  
  9984.  
  9985.  
  9986. // Return jQuery for attributes-only inclusion
  9987.  
  9988.  
  9989. jQuery.each( ( "blur focus focusin focusout load resize scroll unload click dblclick " +
  9990. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  9991. "change select submit keydown keypress keyup error contextmenu" ).split( " " ),
  9992. function( i, name ) {
  9993.  
  9994. // Handle event binding
  9995. jQuery.fn[ name ] = function( data, fn ) {
  9996. return arguments.length > 0 ?
  9997. this.on( name, null, data, fn ) :
  9998. this.trigger( name );
  9999. };
  10000. } );
  10001.  
  10002. jQuery.fn.extend( {
  10003. hover: function( fnOver, fnOut ) {
  10004. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  10005. }
  10006. } );
  10007.  
  10008.  
  10009. var location = window.location;
  10010.  
  10011. var nonce = jQuery.now();
  10012.  
  10013. var rquery = ( /\?/ );
  10014.  
  10015.  
  10016.  
  10017. var rvalidtokens = /(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;
  10018.  
  10019. jQuery.parseJSON = function( data ) {
  10020.  
  10021. // Attempt to parse using the native JSON parser first
  10022. if ( window.JSON && window.JSON.parse ) {
  10023.  
  10024. // Support: Android 2.3
  10025. // Workaround failure to string-cast null input
  10026. return window.JSON.parse( data + "" );
  10027. }
  10028.  
  10029. var requireNonComma,
  10030. depth = null,
  10031. str = jQuery.trim( data + "" );
  10032.  
  10033. // Guard against invalid (and possibly dangerous) input by ensuring that nothing remains
  10034. // after removing valid tokens
  10035. return str && !jQuery.trim( str.replace( rvalidtokens, function( token, comma, open, close ) {
  10036.  
  10037. // Force termination if we see a misplaced comma
  10038. if ( requireNonComma && comma ) {
  10039. depth = 0;
  10040. }
  10041.  
  10042. // Perform no more replacements after returning to outermost depth
  10043. if ( depth === 0 ) {
  10044. return token;
  10045. }
  10046.  
  10047. // Commas must not follow "[", "{", or ","
  10048. requireNonComma = open || comma;
  10049.  
  10050. // Determine new depth
  10051. // array/object open ("[" or "{"): depth += true - false (increment)
  10052. // array/object close ("]" or "}"): depth += false - true (decrement)
  10053. // other cases ("," or primitive): depth += true - true (numeric cast)
  10054. depth += !close - !open;
  10055.  
  10056. // Remove this token
  10057. return "";
  10058. } ) ) ?
  10059. ( Function( "return " + str ) )() :
  10060. jQuery.error( "Invalid JSON: " + data );
  10061. };
  10062.  
  10063.  
  10064. // Cross-browser xml parsing
  10065. jQuery.parseXML = function( data ) {
  10066. var xml, tmp;
  10067. if ( !data || typeof data !== "string" ) {
  10068. return null;
  10069. }
  10070. try {
  10071. if ( window.DOMParser ) { // Standard
  10072. tmp = new window.DOMParser();
  10073. xml = tmp.parseFromString( data, "text/xml" );
  10074. } else { // IE
  10075. xml = new window.ActiveXObject( "Microsoft.XMLDOM" );
  10076. xml.async = "false";
  10077. xml.loadXML( data );
  10078. }
  10079. } catch ( e ) {
  10080. xml = undefined;
  10081. }
  10082. if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
  10083. jQuery.error( "Invalid XML: " + data );
  10084. }
  10085. return xml;
  10086. };
  10087.  
  10088.  
  10089. var
  10090. rhash = /#.*$/,
  10091. rts = /([?&])_=[^&]*/,
  10092.  
  10093. // IE leaves an \r character at EOL
  10094. rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg,
  10095.  
  10096. // #7653, #8125, #8152: local protocol detection
  10097. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  10098. rnoContent = /^(?:GET|HEAD)$/,
  10099. rprotocol = /^\/\//,
  10100. rurl = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,
  10101.  
  10102. /* Prefilters
  10103. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  10104. * 2) These are called:
  10105. * - BEFORE asking for a transport
  10106. * - AFTER param serialization (s.data is a string if s.processData is true)
  10107. * 3) key is the dataType
  10108. * 4) the catchall symbol "*" can be used
  10109. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  10110. */
  10111. prefilters = {},
  10112.  
  10113. /* Transports bindings
  10114. * 1) key is the dataType
  10115. * 2) the catchall symbol "*" can be used
  10116. * 3) selection will start with transport dataType and THEN go to "*" if needed
  10117. */
  10118. transports = {},
  10119.  
  10120. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  10121. allTypes = "*/".concat( "*" ),
  10122.  
  10123. // Document location
  10124. ajaxLocation = location.href,
  10125.  
  10126. // Segment location into parts
  10127. ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
  10128.  
  10129. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  10130. function addToPrefiltersOrTransports( structure ) {
  10131.  
  10132. // dataTypeExpression is optional and defaults to "*"
  10133. return function( dataTypeExpression, func ) {
  10134.  
  10135. if ( typeof dataTypeExpression !== "string" ) {
  10136. func = dataTypeExpression;
  10137. dataTypeExpression = "*";
  10138. }
  10139.  
  10140. var dataType,
  10141. i = 0,
  10142. dataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || [];
  10143.  
  10144. if ( jQuery.isFunction( func ) ) {
  10145.  
  10146. // For each dataType in the dataTypeExpression
  10147. while ( ( dataType = dataTypes[ i++ ] ) ) {
  10148.  
  10149. // Prepend if requested
  10150. if ( dataType.charAt( 0 ) === "+" ) {
  10151. dataType = dataType.slice( 1 ) || "*";
  10152. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  10153.  
  10154. // Otherwise append
  10155. } else {
  10156. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  10157. }
  10158. }
  10159. }
  10160. };
  10161. }
  10162.  
  10163. // Base inspection function for prefilters and transports
  10164. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  10165.  
  10166. var inspected = {},
  10167. seekingTransport = ( structure === transports );
  10168.  
  10169. function inspect( dataType ) {
  10170. var selected;
  10171. inspected[ dataType ] = true;
  10172. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  10173. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  10174. if ( typeof dataTypeOrTransport === "string" &&
  10175. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  10176.  
  10177. options.dataTypes.unshift( dataTypeOrTransport );
  10178. inspect( dataTypeOrTransport );
  10179. return false;
  10180. } else if ( seekingTransport ) {
  10181. return !( selected = dataTypeOrTransport );
  10182. }
  10183. } );
  10184. return selected;
  10185. }
  10186.  
  10187. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  10188. }
  10189.  
  10190. // A special extend for ajax options
  10191. // that takes "flat" options (not to be deep extended)
  10192. // Fixes #9887
  10193. function ajaxExtend( target, src ) {
  10194. var deep, key,
  10195. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  10196.  
  10197. for ( key in src ) {
  10198. if ( src[ key ] !== undefined ) {
  10199. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  10200. }
  10201. }
  10202. if ( deep ) {
  10203. jQuery.extend( true, target, deep );
  10204. }
  10205.  
  10206. return target;
  10207. }
  10208.  
  10209. /* Handles responses to an ajax request:
  10210. * - finds the right dataType (mediates between content-type and expected dataType)
  10211. * - returns the corresponding response
  10212. */
  10213. function ajaxHandleResponses( s, jqXHR, responses ) {
  10214. var firstDataType, ct, finalDataType, type,
  10215. contents = s.contents,
  10216. dataTypes = s.dataTypes;
  10217.  
  10218. // Remove auto dataType and get content-type in the process
  10219. while ( dataTypes[ 0 ] === "*" ) {
  10220. dataTypes.shift();
  10221. if ( ct === undefined ) {
  10222. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  10223. }
  10224. }
  10225.  
  10226. // Check if we're dealing with a known content-type
  10227. if ( ct ) {
  10228. for ( type in contents ) {
  10229. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  10230. dataTypes.unshift( type );
  10231. break;
  10232. }
  10233. }
  10234. }
  10235.  
  10236. // Check to see if we have a response for the expected dataType
  10237. if ( dataTypes[ 0 ] in responses ) {
  10238. finalDataType = dataTypes[ 0 ];
  10239. } else {
  10240.  
  10241. // Try convertible dataTypes
  10242. for ( type in responses ) {
  10243. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  10244. finalDataType = type;
  10245. break;
  10246. }
  10247. if ( !firstDataType ) {
  10248. firstDataType = type;
  10249. }
  10250. }
  10251.  
  10252. // Or just use first one
  10253. finalDataType = finalDataType || firstDataType;
  10254. }
  10255.  
  10256. // If we found a dataType
  10257. // We add the dataType to the list if needed
  10258. // and return the corresponding response
  10259. if ( finalDataType ) {
  10260. if ( finalDataType !== dataTypes[ 0 ] ) {
  10261. dataTypes.unshift( finalDataType );
  10262. }
  10263. return responses[ finalDataType ];
  10264. }
  10265. }
  10266.  
  10267. /* Chain conversions given the request and the original response
  10268. * Also sets the responseXXX fields on the jqXHR instance
  10269. */
  10270. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  10271. var conv2, current, conv, tmp, prev,
  10272. converters = {},
  10273.  
  10274. // Work with a copy of dataTypes in case we need to modify it for conversion
  10275. dataTypes = s.dataTypes.slice();
  10276.  
  10277. // Create converters map with lowercased keys
  10278. if ( dataTypes[ 1 ] ) {
  10279. for ( conv in s.converters ) {
  10280. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  10281. }
  10282. }
  10283.  
  10284. current = dataTypes.shift();
  10285.  
  10286. // Convert to each sequential dataType
  10287. while ( current ) {
  10288.  
  10289. if ( s.responseFields[ current ] ) {
  10290. jqXHR[ s.responseFields[ current ] ] = response;
  10291. }
  10292.  
  10293. // Apply the dataFilter if provided
  10294. if ( !prev && isSuccess && s.dataFilter ) {
  10295. response = s.dataFilter( response, s.dataType );
  10296. }
  10297.  
  10298. prev = current;
  10299. current = dataTypes.shift();
  10300.  
  10301. if ( current ) {
  10302.  
  10303. // There's only work to do if current dataType is non-auto
  10304. if ( current === "*" ) {
  10305.  
  10306. current = prev;
  10307.  
  10308. // Convert response if prev dataType is non-auto and differs from current
  10309. } else if ( prev !== "*" && prev !== current ) {
  10310.  
  10311. // Seek a direct converter
  10312. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  10313.  
  10314. // If none found, seek a pair
  10315. if ( !conv ) {
  10316. for ( conv2 in converters ) {
  10317.  
  10318. // If conv2 outputs current
  10319. tmp = conv2.split( " " );
  10320. if ( tmp[ 1 ] === current ) {
  10321.  
  10322. // If prev can be converted to accepted input
  10323. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  10324. converters[ "* " + tmp[ 0 ] ];
  10325. if ( conv ) {
  10326.  
  10327. // Condense equivalence converters
  10328. if ( conv === true ) {
  10329. conv = converters[ conv2 ];
  10330.  
  10331. // Otherwise, insert the intermediate dataType
  10332. } else if ( converters[ conv2 ] !== true ) {
  10333. current = tmp[ 0 ];
  10334. dataTypes.unshift( tmp[ 1 ] );
  10335. }
  10336. break;
  10337. }
  10338. }
  10339. }
  10340. }
  10341.  
  10342. // Apply converter (if not an equivalence)
  10343. if ( conv !== true ) {
  10344.  
  10345. // Unless errors are allowed to bubble, catch and return them
  10346. if ( conv && s[ "throws" ] ) { // jscs:ignore requireDotNotation
  10347. response = conv( response );
  10348. } else {
  10349. try {
  10350. response = conv( response );
  10351. } catch ( e ) {
  10352. return {
  10353. state: "parsererror",
  10354. error: conv ? e : "No conversion from " + prev + " to " + current
  10355. };
  10356. }
  10357. }
  10358. }
  10359. }
  10360. }
  10361. }
  10362.  
  10363. return { state: "success", data: response };
  10364. }
  10365.  
  10366. jQuery.extend( {
  10367.  
  10368. // Counter for holding the number of active queries
  10369. active: 0,
  10370.  
  10371. // Last-Modified header cache for next request
  10372. lastModified: {},
  10373. etag: {},
  10374.  
  10375. ajaxSettings: {
  10376. url: ajaxLocation,
  10377. type: "GET",
  10378. isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
  10379. global: true,
  10380. processData: true,
  10381. async: true,
  10382. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  10383. /*
  10384. timeout: 0,
  10385. data: null,
  10386. dataType: null,
  10387. username: null,
  10388. password: null,
  10389. cache: null,
  10390. throws: false,
  10391. traditional: false,
  10392. headers: {},
  10393. */
  10394.  
  10395. accepts: {
  10396. "*": allTypes,
  10397. text: "text/plain",
  10398. html: "text/html",
  10399. xml: "application/xml, text/xml",
  10400. json: "application/json, text/javascript"
  10401. },
  10402.  
  10403. contents: {
  10404. xml: /\bxml\b/,
  10405. html: /\bhtml/,
  10406. json: /\bjson\b/
  10407. },
  10408.  
  10409. responseFields: {
  10410. xml: "responseXML",
  10411. text: "responseText",
  10412. json: "responseJSON"
  10413. },
  10414.  
  10415. // Data converters
  10416. // Keys separate source (or catchall "*") and destination types with a single space
  10417. converters: {
  10418.  
  10419. // Convert anything to text
  10420. "* text": String,
  10421.  
  10422. // Text to html (true = no transformation)
  10423. "text html": true,
  10424.  
  10425. // Evaluate text as a json expression
  10426. "text json": jQuery.parseJSON,
  10427.  
  10428. // Parse text as xml
  10429. "text xml": jQuery.parseXML
  10430. },
  10431.  
  10432. // For options that shouldn't be deep extended:
  10433. // you can add your own custom options here if
  10434. // and when you create one that shouldn't be
  10435. // deep extended (see ajaxExtend)
  10436. flatOptions: {
  10437. url: true,
  10438. context: true
  10439. }
  10440. },
  10441.  
  10442. // Creates a full fledged settings object into target
  10443. // with both ajaxSettings and settings fields.
  10444. // If target is omitted, writes into ajaxSettings.
  10445. ajaxSetup: function( target, settings ) {
  10446. return settings ?
  10447.  
  10448. // Building a settings object
  10449. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  10450.  
  10451. // Extending ajaxSettings
  10452. ajaxExtend( jQuery.ajaxSettings, target );
  10453. },
  10454.  
  10455. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  10456. ajaxTransport: addToPrefiltersOrTransports( transports ),
  10457.  
  10458. // Main method
  10459. ajax: function( url, options ) {
  10460.  
  10461. // If url is an object, simulate pre-1.5 signature
  10462. if ( typeof url === "object" ) {
  10463. options = url;
  10464. url = undefined;
  10465. }
  10466.  
  10467. // Force options to be an object
  10468. options = options || {};
  10469.  
  10470. var
  10471.  
  10472. // Cross-domain detection vars
  10473. parts,
  10474.  
  10475. // Loop variable
  10476. i,
  10477.  
  10478. // URL without anti-cache param
  10479. cacheURL,
  10480.  
  10481. // Response headers as string
  10482. responseHeadersString,
  10483.  
  10484. // timeout handle
  10485. timeoutTimer,
  10486.  
  10487. // To know if global events are to be dispatched
  10488. fireGlobals,
  10489.  
  10490. transport,
  10491.  
  10492. // Response headers
  10493. responseHeaders,
  10494.  
  10495. // Create the final options object
  10496. s = jQuery.ajaxSetup( {}, options ),
  10497.  
  10498. // Callbacks context
  10499. callbackContext = s.context || s,
  10500.  
  10501. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  10502. globalEventContext = s.context &&
  10503. ( callbackContext.nodeType || callbackContext.jquery ) ?
  10504. jQuery( callbackContext ) :
  10505. jQuery.event,
  10506.  
  10507. // Deferreds
  10508. deferred = jQuery.Deferred(),
  10509. completeDeferred = jQuery.Callbacks( "once memory" ),
  10510.  
  10511. // Status-dependent callbacks
  10512. statusCode = s.statusCode || {},
  10513.  
  10514. // Headers (they are sent all at once)
  10515. requestHeaders = {},
  10516. requestHeadersNames = {},
  10517.  
  10518. // The jqXHR state
  10519. state = 0,
  10520.  
  10521. // Default abort message
  10522. strAbort = "canceled",
  10523.  
  10524. // Fake xhr
  10525. jqXHR = {
  10526. readyState: 0,
  10527.  
  10528. // Builds headers hashtable if needed
  10529. getResponseHeader: function( key ) {
  10530. var match;
  10531. if ( state === 2 ) {
  10532. if ( !responseHeaders ) {
  10533. responseHeaders = {};
  10534. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  10535. responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ];
  10536. }
  10537. }
  10538. match = responseHeaders[ key.toLowerCase() ];
  10539. }
  10540. return match == null ? null : match;
  10541. },
  10542.  
  10543. // Raw string
  10544. getAllResponseHeaders: function() {
  10545. return state === 2 ? responseHeadersString : null;
  10546. },
  10547.  
  10548. // Caches the header
  10549. setRequestHeader: function( name, value ) {
  10550. var lname = name.toLowerCase();
  10551. if ( !state ) {
  10552. name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
  10553. requestHeaders[ name ] = value;
  10554. }
  10555. return this;
  10556. },
  10557.  
  10558. // Overrides response content-type header
  10559. overrideMimeType: function( type ) {
  10560. if ( !state ) {
  10561. s.mimeType = type;
  10562. }
  10563. return this;
  10564. },
  10565.  
  10566. // Status-dependent callbacks
  10567. statusCode: function( map ) {
  10568. var code;
  10569. if ( map ) {
  10570. if ( state < 2 ) {
  10571. for ( code in map ) {
  10572.  
  10573. // Lazy-add the new callback in a way that preserves old ones
  10574. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  10575. }
  10576. } else {
  10577.  
  10578. // Execute the appropriate callbacks
  10579. jqXHR.always( map[ jqXHR.status ] );
  10580. }
  10581. }
  10582. return this;
  10583. },
  10584.  
  10585. // Cancel the request
  10586. abort: function( statusText ) {
  10587. var finalText = statusText || strAbort;
  10588. if ( transport ) {
  10589. transport.abort( finalText );
  10590. }
  10591. done( 0, finalText );
  10592. return this;
  10593. }
  10594. };
  10595.  
  10596. // Attach deferreds
  10597. deferred.promise( jqXHR ).complete = completeDeferred.add;
  10598. jqXHR.success = jqXHR.done;
  10599. jqXHR.error = jqXHR.fail;
  10600.  
  10601. // Remove hash character (#7531: and string promotion)
  10602. // Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
  10603. // Handle falsy url in the settings object (#10093: consistency with old signature)
  10604. // We also use the url parameter if available
  10605. s.url = ( ( url || s.url || ajaxLocation ) + "" )
  10606. .replace( rhash, "" )
  10607. .replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
  10608.  
  10609. // Alias method option to type as per ticket #12004
  10610. s.type = options.method || options.type || s.method || s.type;
  10611.  
  10612. // Extract dataTypes list
  10613. s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ];
  10614.  
  10615. // A cross-domain request is in order when we have a protocol:host:port mismatch
  10616. if ( s.crossDomain == null ) {
  10617. parts = rurl.exec( s.url.toLowerCase() );
  10618. s.crossDomain = !!( parts &&
  10619. ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
  10620. ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !==
  10621. ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) )
  10622. );
  10623. }
  10624.  
  10625. // Convert data if not already a string
  10626. if ( s.data && s.processData && typeof s.data !== "string" ) {
  10627. s.data = jQuery.param( s.data, s.traditional );
  10628. }
  10629.  
  10630. // Apply prefilters
  10631. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  10632.  
  10633. // If request was aborted inside a prefilter, stop there
  10634. if ( state === 2 ) {
  10635. return jqXHR;
  10636. }
  10637.  
  10638. // We can fire global events as of now if asked to
  10639. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  10640. fireGlobals = jQuery.event && s.global;
  10641.  
  10642. // Watch for a new set of requests
  10643. if ( fireGlobals && jQuery.active++ === 0 ) {
  10644. jQuery.event.trigger( "ajaxStart" );
  10645. }
  10646.  
  10647. // Uppercase the type
  10648. s.type = s.type.toUpperCase();
  10649.  
  10650. // Determine if request has content
  10651. s.hasContent = !rnoContent.test( s.type );
  10652.  
  10653. // Save the URL in case we're toying with the If-Modified-Since
  10654. // and/or If-None-Match header later on
  10655. cacheURL = s.url;
  10656.  
  10657. // More options handling for requests with no content
  10658. if ( !s.hasContent ) {
  10659.  
  10660. // If data is available, append data to url
  10661. if ( s.data ) {
  10662. cacheURL = ( s.url += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
  10663.  
  10664. // #9682: remove data so that it's not used in an eventual retry
  10665. delete s.data;
  10666. }
  10667.  
  10668. // Add anti-cache in url if needed
  10669. if ( s.cache === false ) {
  10670. s.url = rts.test( cacheURL ) ?
  10671.  
  10672. // If there is already a '_' parameter, set its value
  10673. cacheURL.replace( rts, "$1_=" + nonce++ ) :
  10674.  
  10675. // Otherwise add one to the end
  10676. cacheURL + ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + nonce++;
  10677. }
  10678. }
  10679.  
  10680. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  10681. if ( s.ifModified ) {
  10682. if ( jQuery.lastModified[ cacheURL ] ) {
  10683. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  10684. }
  10685. if ( jQuery.etag[ cacheURL ] ) {
  10686. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  10687. }
  10688. }
  10689.  
  10690. // Set the correct header, if data is being sent
  10691. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  10692. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  10693. }
  10694.  
  10695. // Set the Accepts header for the server, depending on the dataType
  10696. jqXHR.setRequestHeader(
  10697. "Accept",
  10698. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  10699. s.accepts[ s.dataTypes[ 0 ] ] +
  10700. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  10701. s.accepts[ "*" ]
  10702. );
  10703.  
  10704. // Check for headers option
  10705. for ( i in s.headers ) {
  10706. jqXHR.setRequestHeader( i, s.headers[ i ] );
  10707. }
  10708.  
  10709. // Allow custom headers/mimetypes and early abort
  10710. if ( s.beforeSend &&
  10711. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
  10712.  
  10713. // Abort if not done already and return
  10714. return jqXHR.abort();
  10715. }
  10716.  
  10717. // aborting is no longer a cancellation
  10718. strAbort = "abort";
  10719.  
  10720. // Install callbacks on deferreds
  10721. for ( i in { success: 1, error: 1, complete: 1 } ) {
  10722. jqXHR[ i ]( s[ i ] );
  10723. }
  10724.  
  10725. // Get transport
  10726. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  10727.  
  10728. // If no transport, we auto-abort
  10729. if ( !transport ) {
  10730. done( -1, "No Transport" );
  10731. } else {
  10732. jqXHR.readyState = 1;
  10733.  
  10734. // Send global event
  10735. if ( fireGlobals ) {
  10736. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  10737. }
  10738.  
  10739. // If request was aborted inside ajaxSend, stop there
  10740. if ( state === 2 ) {
  10741. return jqXHR;
  10742. }
  10743.  
  10744. // Timeout
  10745. if ( s.async && s.timeout > 0 ) {
  10746. timeoutTimer = window.setTimeout( function() {
  10747. jqXHR.abort( "timeout" );
  10748. }, s.timeout );
  10749. }
  10750.  
  10751. try {
  10752. state = 1;
  10753. transport.send( requestHeaders, done );
  10754. } catch ( e ) {
  10755.  
  10756. // Propagate exception as error if not done
  10757. if ( state < 2 ) {
  10758. done( -1, e );
  10759.  
  10760. // Simply rethrow otherwise
  10761. } else {
  10762. throw e;
  10763. }
  10764. }
  10765. }
  10766.  
  10767. // Callback for when everything is done
  10768. function done( status, nativeStatusText, responses, headers ) {
  10769. var isSuccess, success, error, response, modified,
  10770. statusText = nativeStatusText;
  10771.  
  10772. // Called once
  10773. if ( state === 2 ) {
  10774. return;
  10775. }
  10776.  
  10777. // State is "done" now
  10778. state = 2;
  10779.  
  10780. // Clear timeout if it exists
  10781. if ( timeoutTimer ) {
  10782. window.clearTimeout( timeoutTimer );
  10783. }
  10784.  
  10785. // Dereference transport for early garbage collection
  10786. // (no matter how long the jqXHR object will be used)
  10787. transport = undefined;
  10788.  
  10789. // Cache response headers
  10790. responseHeadersString = headers || "";
  10791.  
  10792. // Set readyState
  10793. jqXHR.readyState = status > 0 ? 4 : 0;
  10794.  
  10795. // Determine if successful
  10796. isSuccess = status >= 200 && status < 300 || status === 304;
  10797.  
  10798. // Get response data
  10799. if ( responses ) {
  10800. response = ajaxHandleResponses( s, jqXHR, responses );
  10801. }
  10802.  
  10803. // Convert no matter what (that way responseXXX fields are always set)
  10804. response = ajaxConvert( s, response, jqXHR, isSuccess );
  10805.  
  10806. // If successful, handle type chaining
  10807. if ( isSuccess ) {
  10808.  
  10809. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  10810. if ( s.ifModified ) {
  10811. modified = jqXHR.getResponseHeader( "Last-Modified" );
  10812. if ( modified ) {
  10813. jQuery.lastModified[ cacheURL ] = modified;
  10814. }
  10815. modified = jqXHR.getResponseHeader( "etag" );
  10816. if ( modified ) {
  10817. jQuery.etag[ cacheURL ] = modified;
  10818. }
  10819. }
  10820.  
  10821. // if no content
  10822. if ( status === 204 || s.type === "HEAD" ) {
  10823. statusText = "nocontent";
  10824.  
  10825. // if not modified
  10826. } else if ( status === 304 ) {
  10827. statusText = "notmodified";
  10828.  
  10829. // If we have data, let's convert it
  10830. } else {
  10831. statusText = response.state;
  10832. success = response.data;
  10833. error = response.error;
  10834. isSuccess = !error;
  10835. }
  10836. } else {
  10837.  
  10838. // We extract error from statusText
  10839. // then normalize statusText and status for non-aborts
  10840. error = statusText;
  10841. if ( status || !statusText ) {
  10842. statusText = "error";
  10843. if ( status < 0 ) {
  10844. status = 0;
  10845. }
  10846. }
  10847. }
  10848.  
  10849. // Set data for the fake xhr object
  10850. jqXHR.status = status;
  10851. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  10852.  
  10853. // Success/Error
  10854. if ( isSuccess ) {
  10855. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  10856. } else {
  10857. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  10858. }
  10859.  
  10860. // Status-dependent callbacks
  10861. jqXHR.statusCode( statusCode );
  10862. statusCode = undefined;
  10863.  
  10864. if ( fireGlobals ) {
  10865. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  10866. [ jqXHR, s, isSuccess ? success : error ] );
  10867. }
  10868.  
  10869. // Complete
  10870. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  10871.  
  10872. if ( fireGlobals ) {
  10873. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  10874.  
  10875. // Handle the global AJAX counter
  10876. if ( !( --jQuery.active ) ) {
  10877. jQuery.event.trigger( "ajaxStop" );
  10878. }
  10879. }
  10880. }
  10881.  
  10882. return jqXHR;
  10883. },
  10884.  
  10885. getJSON: function( url, data, callback ) {
  10886. return jQuery.get( url, data, callback, "json" );
  10887. },
  10888.  
  10889. getScript: function( url, callback ) {
  10890. return jQuery.get( url, undefined, callback, "script" );
  10891. }
  10892. } );
  10893.  
  10894. jQuery.each( [ "get", "post" ], function( i, method ) {
  10895. jQuery[ method ] = function( url, data, callback, type ) {
  10896.  
  10897. // shift arguments if data argument was omitted
  10898. if ( jQuery.isFunction( data ) ) {
  10899. type = type || callback;
  10900. callback = data;
  10901. data = undefined;
  10902. }
  10903.  
  10904. // The url can be an options object (which then must have .url)
  10905. return jQuery.ajax( jQuery.extend( {
  10906. url: url,
  10907. type: method,
  10908. dataType: type,
  10909. data: data,
  10910. success: callback
  10911. }, jQuery.isPlainObject( url ) && url ) );
  10912. };
  10913. } );
  10914.  
  10915.  
  10916. jQuery._evalUrl = function( url ) {
  10917. return jQuery.ajax( {
  10918. url: url,
  10919.  
  10920. // Make this explicit, since user can override this through ajaxSetup (#11264)
  10921. type: "GET",
  10922. dataType: "script",
  10923. cache: true,
  10924. async: false,
  10925. global: false,
  10926. "throws": true
  10927. } );
  10928. };
  10929.  
  10930.  
  10931. jQuery.fn.extend( {
  10932. wrapAll: function( html ) {
  10933. if ( jQuery.isFunction( html ) ) {
  10934. return this.each( function( i ) {
  10935. jQuery( this ).wrapAll( html.call( this, i ) );
  10936. } );
  10937. }
  10938.  
  10939. if ( this[ 0 ] ) {
  10940.  
  10941. // The elements to wrap the target around
  10942. var wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  10943.  
  10944. if ( this[ 0 ].parentNode ) {
  10945. wrap.insertBefore( this[ 0 ] );
  10946. }
  10947.  
  10948. wrap.map( function() {
  10949. var elem = this;
  10950.  
  10951. while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
  10952. elem = elem.firstChild;
  10953. }
  10954.  
  10955. return elem;
  10956. } ).append( this );
  10957. }
  10958.  
  10959. return this;
  10960. },
  10961.  
  10962. wrapInner: function( html ) {
  10963. if ( jQuery.isFunction( html ) ) {
  10964. return this.each( function( i ) {
  10965. jQuery( this ).wrapInner( html.call( this, i ) );
  10966. } );
  10967. }
  10968.  
  10969. return this.each( function() {
  10970. var self = jQuery( this ),
  10971. contents = self.contents();
  10972.  
  10973. if ( contents.length ) {
  10974. contents.wrapAll( html );
  10975.  
  10976. } else {
  10977. self.append( html );
  10978. }
  10979. } );
  10980. },
  10981.  
  10982. wrap: function( html ) {
  10983. var isFunction = jQuery.isFunction( html );
  10984.  
  10985. return this.each( function( i ) {
  10986. jQuery( this ).wrapAll( isFunction ? html.call( this, i ) : html );
  10987. } );
  10988. },
  10989.  
  10990. unwrap: function() {
  10991. return this.parent().each( function() {
  10992. if ( !jQuery.nodeName( this, "body" ) ) {
  10993. jQuery( this ).replaceWith( this.childNodes );
  10994. }
  10995. } ).end();
  10996. }
  10997. } );
  10998.  
  10999.  
  11000. function getDisplay( elem ) {
  11001. return elem.style && elem.style.display || jQuery.css( elem, "display" );
  11002. }
  11003.  
  11004. function filterHidden( elem ) {
  11005.  
  11006. // Disconnected elements are considered hidden
  11007. if ( !jQuery.contains( elem.ownerDocument || document, elem ) ) {
  11008. return true;
  11009. }
  11010. while ( elem && elem.nodeType === 1 ) {
  11011. if ( getDisplay( elem ) === "none" || elem.type === "hidden" ) {
  11012. return true;
  11013. }
  11014. elem = elem.parentNode;
  11015. }
  11016. return false;
  11017. }
  11018.  
  11019. jQuery.expr.filters.hidden = function( elem ) {
  11020.  
  11021. // Support: Opera <= 12.12
  11022. // Opera reports offsetWidths and offsetHeights less than zero on some elements
  11023. return support.reliableHiddenOffsets() ?
  11024. ( elem.offsetWidth <= 0 && elem.offsetHeight <= 0 &&
  11025. !elem.getClientRects().length ) :
  11026. filterHidden( elem );
  11027. };
  11028.  
  11029. jQuery.expr.filters.visible = function( elem ) {
  11030. return !jQuery.expr.filters.hidden( elem );
  11031. };
  11032.  
  11033.  
  11034.  
  11035.  
  11036. var r20 = /%20/g,
  11037. rbracket = /\[\]$/,
  11038. rCRLF = /\r?\n/g,
  11039. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  11040. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  11041.  
  11042. function buildParams( prefix, obj, traditional, add ) {
  11043. var name;
  11044.  
  11045. if ( jQuery.isArray( obj ) ) {
  11046.  
  11047. // Serialize array item.
  11048. jQuery.each( obj, function( i, v ) {
  11049. if ( traditional || rbracket.test( prefix ) ) {
  11050.  
  11051. // Treat each array item as a scalar.
  11052. add( prefix, v );
  11053.  
  11054. } else {
  11055.  
  11056. // Item is non-scalar (array or object), encode its numeric index.
  11057. buildParams(
  11058. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  11059. v,
  11060. traditional,
  11061. add
  11062. );
  11063. }
  11064. } );
  11065.  
  11066. } else if ( !traditional && jQuery.type( obj ) === "object" ) {
  11067.  
  11068. // Serialize object item.
  11069. for ( name in obj ) {
  11070. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  11071. }
  11072.  
  11073. } else {
  11074.  
  11075. // Serialize scalar item.
  11076. add( prefix, obj );
  11077. }
  11078. }
  11079.  
  11080. // Serialize an array of form elements or a set of
  11081. // key/values into a query string
  11082. jQuery.param = function( a, traditional ) {
  11083. var prefix,
  11084. s = [],
  11085. add = function( key, value ) {
  11086.  
  11087. // If value is a function, invoke it and return its value
  11088. value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
  11089. s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
  11090. };
  11091.  
  11092. // Set traditional to true for jQuery <= 1.3.2 behavior.
  11093. if ( traditional === undefined ) {
  11094. traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
  11095. }
  11096.  
  11097. // If an array was passed in, assume that it is an array of form elements.
  11098. if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  11099.  
  11100. // Serialize the form elements
  11101. jQuery.each( a, function() {
  11102. add( this.name, this.value );
  11103. } );
  11104.  
  11105. } else {
  11106.  
  11107. // If traditional, encode the "old" way (the way 1.3.2 or older
  11108. // did it), otherwise encode params recursively.
  11109. for ( prefix in a ) {
  11110. buildParams( prefix, a[ prefix ], traditional, add );
  11111. }
  11112. }
  11113.  
  11114. // Return the resulting serialization
  11115. return s.join( "&" ).replace( r20, "+" );
  11116. };
  11117.  
  11118. jQuery.fn.extend( {
  11119. serialize: function() {
  11120. return jQuery.param( this.serializeArray() );
  11121. },
  11122. serializeArray: function() {
  11123. return this.map( function() {
  11124.  
  11125. // Can add propHook for "elements" to filter or add form elements
  11126. var elements = jQuery.prop( this, "elements" );
  11127. return elements ? jQuery.makeArray( elements ) : this;
  11128. } )
  11129. .filter( function() {
  11130. var type = this.type;
  11131.  
  11132. // Use .is(":disabled") so that fieldset[disabled] works
  11133. return this.name && !jQuery( this ).is( ":disabled" ) &&
  11134. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  11135. ( this.checked || !rcheckableType.test( type ) );
  11136. } )
  11137. .map( function( i, elem ) {
  11138. var val = jQuery( this ).val();
  11139.  
  11140. return val == null ?
  11141. null :
  11142. jQuery.isArray( val ) ?
  11143. jQuery.map( val, function( val ) {
  11144. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  11145. } ) :
  11146. { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  11147. } ).get();
  11148. }
  11149. } );
  11150.  
  11151.  
  11152. // Create the request object
  11153. // (This is still attached to ajaxSettings for backward compatibility)
  11154. jQuery.ajaxSettings.xhr = window.ActiveXObject !== undefined ?
  11155.  
  11156. // Support: IE6-IE8
  11157. function() {
  11158.  
  11159. // XHR cannot access local files, always use ActiveX for that case
  11160. if ( this.isLocal ) {
  11161. return createActiveXHR();
  11162. }
  11163.  
  11164. // Support: IE 9-11
  11165. // IE seems to error on cross-domain PATCH requests when ActiveX XHR
  11166. // is used. In IE 9+ always use the native XHR.
  11167. // Note: this condition won't catch Edge as it doesn't define
  11168. // document.documentMode but it also doesn't support ActiveX so it won't
  11169. // reach this code.
  11170. if ( document.documentMode > 8 ) {
  11171. return createStandardXHR();
  11172. }
  11173.  
  11174. // Support: IE<9
  11175. // oldIE XHR does not support non-RFC2616 methods (#13240)
  11176. // See http://msdn.microsoft.com/en-us/library/ie/ms536648(v=vs.85).aspx
  11177. // and http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9
  11178. // Although this check for six methods instead of eight
  11179. // since IE also does not support "trace" and "connect"
  11180. return /^(get|post|head|put|delete|options)$/i.test( this.type ) &&
  11181. createStandardXHR() || createActiveXHR();
  11182. } :
  11183.  
  11184. // For all other browsers, use the standard XMLHttpRequest object
  11185. createStandardXHR;
  11186.  
  11187. var xhrId = 0,
  11188. xhrCallbacks = {},
  11189. xhrSupported = jQuery.ajaxSettings.xhr();
  11190.  
  11191. // Support: IE<10
  11192. // Open requests must be manually aborted on unload (#5280)
  11193. // See https://support.microsoft.com/kb/2856746 for more info
  11194. if ( window.attachEvent ) {
  11195. window.attachEvent( "onunload", function() {
  11196. for ( var key in xhrCallbacks ) {
  11197. xhrCallbacks[ key ]( undefined, true );
  11198. }
  11199. } );
  11200. }
  11201.  
  11202. // Determine support properties
  11203. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  11204. xhrSupported = support.ajax = !!xhrSupported;
  11205.  
  11206. // Create transport if the browser can provide an xhr
  11207. if ( xhrSupported ) {
  11208.  
  11209. jQuery.ajaxTransport( function( options ) {
  11210.  
  11211. // Cross domain only allowed if supported through XMLHttpRequest
  11212. if ( !options.crossDomain || support.cors ) {
  11213.  
  11214. var callback;
  11215.  
  11216. return {
  11217. send: function( headers, complete ) {
  11218. var i,
  11219. xhr = options.xhr(),
  11220. id = ++xhrId;
  11221.  
  11222. // Open the socket
  11223. xhr.open(
  11224. options.type,
  11225. options.url,
  11226. options.async,
  11227. options.username,
  11228. options.password
  11229. );
  11230.  
  11231. // Apply custom fields if provided
  11232. if ( options.xhrFields ) {
  11233. for ( i in options.xhrFields ) {
  11234. xhr[ i ] = options.xhrFields[ i ];
  11235. }
  11236. }
  11237.  
  11238. // Override mime type if needed
  11239. if ( options.mimeType && xhr.overrideMimeType ) {
  11240. xhr.overrideMimeType( options.mimeType );
  11241. }
  11242.  
  11243. // X-Requested-With header
  11244. // For cross-domain requests, seeing as conditions for a preflight are
  11245. // akin to a jigsaw puzzle, we simply never set it to be sure.
  11246. // (it can always be set on a per-request basis or even using ajaxSetup)
  11247. // For same-domain requests, won't change header if already provided.
  11248. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  11249. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  11250. }
  11251.  
  11252. // Set headers
  11253. for ( i in headers ) {
  11254.  
  11255. // Support: IE<9
  11256. // IE's ActiveXObject throws a 'Type Mismatch' exception when setting
  11257. // request header to a null-value.
  11258. //
  11259. // To keep consistent with other XHR implementations, cast the value
  11260. // to string and ignore `undefined`.
  11261. if ( headers[ i ] !== undefined ) {
  11262. xhr.setRequestHeader( i, headers[ i ] + "" );
  11263. }
  11264. }
  11265.  
  11266. // Do send the request
  11267. // This may raise an exception which is actually
  11268. // handled in jQuery.ajax (so no try/catch here)
  11269. xhr.send( ( options.hasContent && options.data ) || null );
  11270.  
  11271. // Listener
  11272. callback = function( _, isAbort ) {
  11273. var status, statusText, responses;
  11274.  
  11275. // Was never called and is aborted or complete
  11276. if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
  11277.  
  11278. // Clean up
  11279. delete xhrCallbacks[ id ];
  11280. callback = undefined;
  11281. xhr.onreadystatechange = jQuery.noop;
  11282.  
  11283. // Abort manually if needed
  11284. if ( isAbort ) {
  11285. if ( xhr.readyState !== 4 ) {
  11286. xhr.abort();
  11287. }
  11288. } else {
  11289. responses = {};
  11290. status = xhr.status;
  11291.  
  11292. // Support: IE<10
  11293. // Accessing binary-data responseText throws an exception
  11294. // (#11426)
  11295. if ( typeof xhr.responseText === "string" ) {
  11296. responses.text = xhr.responseText;
  11297. }
  11298.  
  11299. // Firefox throws an exception when accessing
  11300. // statusText for faulty cross-domain requests
  11301. try {
  11302. statusText = xhr.statusText;
  11303. } catch ( e ) {
  11304.  
  11305. // We normalize with Webkit giving an empty statusText
  11306. statusText = "";
  11307. }
  11308.  
  11309. // Filter status for non standard behaviors
  11310.  
  11311. // If the request is local and we have data: assume a success
  11312. // (success with no data won't get notified, that's the best we
  11313. // can do given current implementations)
  11314. if ( !status && options.isLocal && !options.crossDomain ) {
  11315. status = responses.text ? 200 : 404;
  11316.  
  11317. // IE - #1450: sometimes returns 1223 when it should be 204
  11318. } else if ( status === 1223 ) {
  11319. status = 204;
  11320. }
  11321. }
  11322. }
  11323.  
  11324. // Call complete if needed
  11325. if ( responses ) {
  11326. complete( status, statusText, responses, xhr.getAllResponseHeaders() );
  11327. }
  11328. };
  11329.  
  11330. // Do send the request
  11331. // `xhr.send` may raise an exception, but it will be
  11332. // handled in jQuery.ajax (so no try/catch here)
  11333. if ( !options.async ) {
  11334.  
  11335. // If we're in sync mode we fire the callback
  11336. callback();
  11337. } else if ( xhr.readyState === 4 ) {
  11338.  
  11339. // (IE6 & IE7) if it's in cache and has been
  11340. // retrieved directly we need to fire the callback
  11341. window.setTimeout( callback );
  11342. } else {
  11343.  
  11344. // Register the callback, but delay it in case `xhr.send` throws
  11345. // Add to the list of active xhr callbacks
  11346. xhr.onreadystatechange = xhrCallbacks[ id ] = callback;
  11347. }
  11348. },
  11349.  
  11350. abort: function() {
  11351. if ( callback ) {
  11352. callback( undefined, true );
  11353. }
  11354. }
  11355. };
  11356. }
  11357. } );
  11358. }
  11359.  
  11360. // Functions to create xhrs
  11361. function createStandardXHR() {
  11362. try {
  11363. return new window.XMLHttpRequest();
  11364. } catch ( e ) {}
  11365. }
  11366.  
  11367. function createActiveXHR() {
  11368. try {
  11369. return new window.ActiveXObject( "Microsoft.XMLHTTP" );
  11370. } catch ( e ) {}
  11371. }
  11372.  
  11373.  
  11374.  
  11375.  
  11376. // Install script dataType
  11377. jQuery.ajaxSetup( {
  11378. accepts: {
  11379. script: "text/javascript, application/javascript, " +
  11380. "application/ecmascript, application/x-ecmascript"
  11381. },
  11382. contents: {
  11383. script: /\b(?:java|ecma)script\b/
  11384. },
  11385. converters: {
  11386. "text script": function( text ) {
  11387. jQuery.globalEval( text );
  11388. return text;
  11389. }
  11390. }
  11391. } );
  11392.  
  11393. // Handle cache's special case and global
  11394. jQuery.ajaxPrefilter( "script", function( s ) {
  11395. if ( s.cache === undefined ) {
  11396. s.cache = false;
  11397. }
  11398. if ( s.crossDomain ) {
  11399. s.type = "GET";
  11400. s.global = false;
  11401. }
  11402. } );
  11403.  
  11404. // Bind script tag hack transport
  11405. jQuery.ajaxTransport( "script", function( s ) {
  11406.  
  11407. // This transport only deals with cross domain requests
  11408. if ( s.crossDomain ) {
  11409.  
  11410. var script,
  11411. head = document.head || jQuery( "head" )[ 0 ] || document.documentElement;
  11412.  
  11413. return {
  11414.  
  11415. send: function( _, callback ) {
  11416.  
  11417. script = document.createElement( "script" );
  11418.  
  11419. script.async = true;
  11420.  
  11421. if ( s.scriptCharset ) {
  11422. script.charset = s.scriptCharset;
  11423. }
  11424.  
  11425. script.src = s.url;
  11426.  
  11427. // Attach handlers for all browsers
  11428. script.onload = script.onreadystatechange = function( _, isAbort ) {
  11429.  
  11430. if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
  11431.  
  11432. // Handle memory leak in IE
  11433. script.onload = script.onreadystatechange = null;
  11434.  
  11435. // Remove the script
  11436. if ( script.parentNode ) {
  11437. script.parentNode.removeChild( script );
  11438. }
  11439.  
  11440. // Dereference the script
  11441. script = null;
  11442.  
  11443. // Callback if not abort
  11444. if ( !isAbort ) {
  11445. callback( 200, "success" );
  11446. }
  11447. }
  11448. };
  11449.  
  11450. // Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending
  11451. // Use native DOM manipulation to avoid our domManip AJAX trickery
  11452. head.insertBefore( script, head.firstChild );
  11453. },
  11454.  
  11455. abort: function() {
  11456. if ( script ) {
  11457. script.onload( undefined, true );
  11458. }
  11459. }
  11460. };
  11461. }
  11462. } );
  11463.  
  11464.  
  11465.  
  11466.  
  11467. var oldCallbacks = [],
  11468. rjsonp = /(=)\?(?=&|$)|\?\?/;
  11469.  
  11470. // Default jsonp settings
  11471. jQuery.ajaxSetup( {
  11472. jsonp: "callback",
  11473. jsonpCallback: function() {
  11474. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  11475. this[ callback ] = true;
  11476. return callback;
  11477. }
  11478. } );
  11479.  
  11480. // Detect, normalize options and install callbacks for jsonp requests
  11481. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  11482.  
  11483. var callbackName, overwritten, responseContainer,
  11484. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  11485. "url" :
  11486. typeof s.data === "string" &&
  11487. ( s.contentType || "" )
  11488. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  11489. rjsonp.test( s.data ) && "data"
  11490. );
  11491.  
  11492. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  11493. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  11494.  
  11495. // Get callback name, remembering preexisting value associated with it
  11496. callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
  11497. s.jsonpCallback() :
  11498. s.jsonpCallback;
  11499.  
  11500. // Insert callback into url or form data
  11501. if ( jsonProp ) {
  11502. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  11503. } else if ( s.jsonp !== false ) {
  11504. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  11505. }
  11506.  
  11507. // Use data converter to retrieve json after script execution
  11508. s.converters[ "script json" ] = function() {
  11509. if ( !responseContainer ) {
  11510. jQuery.error( callbackName + " was not called" );
  11511. }
  11512. return responseContainer[ 0 ];
  11513. };
  11514.  
  11515. // force json dataType
  11516. s.dataTypes[ 0 ] = "json";
  11517.  
  11518. // Install callback
  11519. overwritten = window[ callbackName ];
  11520. window[ callbackName ] = function() {
  11521. responseContainer = arguments;
  11522. };
  11523.  
  11524. // Clean-up function (fires after converters)
  11525. jqXHR.always( function() {
  11526.  
  11527. // If previous value didn't exist - remove it
  11528. if ( overwritten === undefined ) {
  11529. jQuery( window ).removeProp( callbackName );
  11530.  
  11531. // Otherwise restore preexisting value
  11532. } else {
  11533. window[ callbackName ] = overwritten;
  11534. }
  11535.  
  11536. // Save back as free
  11537. if ( s[ callbackName ] ) {
  11538.  
  11539. // make sure that re-using the options doesn't screw things around
  11540. s.jsonpCallback = originalSettings.jsonpCallback;
  11541.  
  11542. // save the callback name for future use
  11543. oldCallbacks.push( callbackName );
  11544. }
  11545.  
  11546. // Call if it was a function and we have a response
  11547. if ( responseContainer && jQuery.isFunction( overwritten ) ) {
  11548. overwritten( responseContainer[ 0 ] );
  11549. }
  11550.  
  11551. responseContainer = overwritten = undefined;
  11552. } );
  11553.  
  11554. // Delegate to script
  11555. return "script";
  11556. }
  11557. } );
  11558.  
  11559.  
  11560.  
  11561.  
  11562. // data: string of html
  11563. // context (optional): If specified, the fragment will be created in this context,
  11564. // defaults to document
  11565. // keepScripts (optional): If true, will include scripts passed in the html string
  11566. jQuery.parseHTML = function( data, context, keepScripts ) {
  11567. if ( !data || typeof data !== "string" ) {
  11568. return null;
  11569. }
  11570. if ( typeof context === "boolean" ) {
  11571. keepScripts = context;
  11572. context = false;
  11573. }
  11574. context = context || document;
  11575.  
  11576. var parsed = rsingleTag.exec( data ),
  11577. scripts = !keepScripts && [];
  11578.  
  11579. // Single tag
  11580. if ( parsed ) {
  11581. return [ context.createElement( parsed[ 1 ] ) ];
  11582. }
  11583.  
  11584. parsed = buildFragment( [ data ], context, scripts );
  11585.  
  11586. if ( scripts && scripts.length ) {
  11587. jQuery( scripts ).remove();
  11588. }
  11589.  
  11590. return jQuery.merge( [], parsed.childNodes );
  11591. };
  11592.  
  11593.  
  11594. // Keep a copy of the old load method
  11595. var _load = jQuery.fn.load;
  11596.  
  11597. /**
  11598. * Load a url into a page
  11599. */
  11600. jQuery.fn.load = function( url, params, callback ) {
  11601. if ( typeof url !== "string" && _load ) {
  11602. return _load.apply( this, arguments );
  11603. }
  11604.  
  11605. var selector, type, response,
  11606. self = this,
  11607. off = url.indexOf( " " );
  11608.  
  11609. if ( off > -1 ) {
  11610. selector = jQuery.trim( url.slice( off, url.length ) );
  11611. url = url.slice( 0, off );
  11612. }
  11613.  
  11614. // If it's a function
  11615. if ( jQuery.isFunction( params ) ) {
  11616.  
  11617. // We assume that it's the callback
  11618. callback = params;
  11619. params = undefined;
  11620.  
  11621. // Otherwise, build a param string
  11622. } else if ( params && typeof params === "object" ) {
  11623. type = "POST";
  11624. }
  11625.  
  11626. // If we have elements to modify, make the request
  11627. if ( self.length > 0 ) {
  11628. jQuery.ajax( {
  11629. url: url,
  11630.  
  11631. // If "type" variable is undefined, then "GET" method will be used.
  11632. // Make value of this field explicit since
  11633. // user can override it through ajaxSetup method
  11634. type: type || "GET",
  11635. dataType: "html",
  11636. data: params
  11637. } ).done( function( responseText ) {
  11638.  
  11639. // Save response for use in complete callback
  11640. response = arguments;
  11641.  
  11642. self.html( selector ?
  11643.  
  11644. // If a selector was specified, locate the right elements in a dummy div
  11645. // Exclude scripts to avoid IE 'Permission Denied' errors
  11646. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  11647.  
  11648. // Otherwise use the full result
  11649. responseText );
  11650.  
  11651. // If the request succeeds, this function gets "data", "status", "jqXHR"
  11652. // but they are ignored because response was set above.
  11653. // If it fails, this function gets "jqXHR", "status", "error"
  11654. } ).always( callback && function( jqXHR, status ) {
  11655. self.each( function() {
  11656. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  11657. } );
  11658. } );
  11659. }
  11660.  
  11661. return this;
  11662. };
  11663.  
  11664.  
  11665.  
  11666.  
  11667. // Attach a bunch of functions for handling common AJAX events
  11668. jQuery.each( [
  11669. "ajaxStart",
  11670. "ajaxStop",
  11671. "ajaxComplete",
  11672. "ajaxError",
  11673. "ajaxSuccess",
  11674. "ajaxSend"
  11675. ], function( i, type ) {
  11676. jQuery.fn[ type ] = function( fn ) {
  11677. return this.on( type, fn );
  11678. };
  11679. } );
  11680.  
  11681.  
  11682.  
  11683.  
  11684. jQuery.expr.filters.animated = function( elem ) {
  11685. return jQuery.grep( jQuery.timers, function( fn ) {
  11686. return elem === fn.elem;
  11687. } ).length;
  11688. };
  11689.  
  11690.  
  11691.  
  11692.  
  11693.  
  11694. /**
  11695. * Gets a window from an element
  11696. */
  11697. function getWindow( elem ) {
  11698. return jQuery.isWindow( elem ) ?
  11699. elem :
  11700. elem.nodeType === 9 ?
  11701. elem.defaultView || elem.parentWindow :
  11702. false;
  11703. }
  11704.  
  11705. jQuery.offset = {
  11706. setOffset: function( elem, options, i ) {
  11707. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  11708. position = jQuery.css( elem, "position" ),
  11709. curElem = jQuery( elem ),
  11710. props = {};
  11711.  
  11712. // set position first, in-case top/left are set even on static elem
  11713. if ( position === "static" ) {
  11714. elem.style.position = "relative";
  11715. }
  11716.  
  11717. curOffset = curElem.offset();
  11718. curCSSTop = jQuery.css( elem, "top" );
  11719. curCSSLeft = jQuery.css( elem, "left" );
  11720. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  11721. jQuery.inArray( "auto", [ curCSSTop, curCSSLeft ] ) > -1;
  11722.  
  11723. // need to be able to calculate position if either top or left
  11724. // is auto and position is either absolute or fixed
  11725. if ( calculatePosition ) {
  11726. curPosition = curElem.position();
  11727. curTop = curPosition.top;
  11728. curLeft = curPosition.left;
  11729. } else {
  11730. curTop = parseFloat( curCSSTop ) || 0;
  11731. curLeft = parseFloat( curCSSLeft ) || 0;
  11732. }
  11733.  
  11734. if ( jQuery.isFunction( options ) ) {
  11735.  
  11736. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  11737. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  11738. }
  11739.  
  11740. if ( options.top != null ) {
  11741. props.top = ( options.top - curOffset.top ) + curTop;
  11742. }
  11743. if ( options.left != null ) {
  11744. props.left = ( options.left - curOffset.left ) + curLeft;
  11745. }
  11746.  
  11747. if ( "using" in options ) {
  11748. options.using.call( elem, props );
  11749. } else {
  11750. curElem.css( props );
  11751. }
  11752. }
  11753. };
  11754.  
  11755. jQuery.fn.extend( {
  11756. offset: function( options ) {
  11757. if ( arguments.length ) {
  11758. return options === undefined ?
  11759. this :
  11760. this.each( function( i ) {
  11761. jQuery.offset.setOffset( this, options, i );
  11762. } );
  11763. }
  11764.  
  11765. var docElem, win,
  11766. box = { top: 0, left: 0 },
  11767. elem = this[ 0 ],
  11768. doc = elem && elem.ownerDocument;
  11769.  
  11770. if ( !doc ) {
  11771. return;
  11772. }
  11773.  
  11774. docElem = doc.documentElement;
  11775.  
  11776. // Make sure it's not a disconnected DOM node
  11777. if ( !jQuery.contains( docElem, elem ) ) {
  11778. return box;
  11779. }
  11780.  
  11781. // If we don't have gBCR, just use 0,0 rather than error
  11782. // BlackBerry 5, iOS 3 (original iPhone)
  11783. if ( typeof elem.getBoundingClientRect !== "undefined" ) {
  11784. box = elem.getBoundingClientRect();
  11785. }
  11786. win = getWindow( doc );
  11787. return {
  11788. top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ),
  11789. left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 )
  11790. };
  11791. },
  11792.  
  11793. position: function() {
  11794. if ( !this[ 0 ] ) {
  11795. return;
  11796. }
  11797.  
  11798. var offsetParent, offset,
  11799. parentOffset = { top: 0, left: 0 },
  11800. elem = this[ 0 ];
  11801.  
  11802. // Fixed elements are offset from window (parentOffset = {top:0, left: 0},
  11803. // because it is its only offset parent
  11804. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  11805.  
  11806. // we assume that getBoundingClientRect is available when computed position is fixed
  11807. offset = elem.getBoundingClientRect();
  11808. } else {
  11809.  
  11810. // Get *real* offsetParent
  11811. offsetParent = this.offsetParent();
  11812.  
  11813. // Get correct offsets
  11814. offset = this.offset();
  11815. if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
  11816. parentOffset = offsetParent.offset();
  11817. }
  11818.  
  11819. // Add offsetParent borders
  11820. parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
  11821. parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
  11822. }
  11823.  
  11824. // Subtract parent offsets and element margins
  11825. // note: when an element has margin: auto the offsetLeft and marginLeft
  11826. // are the same in Safari causing offset.left to incorrectly be 0
  11827. return {
  11828. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  11829. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  11830. };
  11831. },
  11832.  
  11833. offsetParent: function() {
  11834. return this.map( function() {
  11835. var offsetParent = this.offsetParent;
  11836.  
  11837. while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) &&
  11838. jQuery.css( offsetParent, "position" ) === "static" ) ) {
  11839. offsetParent = offsetParent.offsetParent;
  11840. }
  11841. return offsetParent || documentElement;
  11842. } );
  11843. }
  11844. } );
  11845.  
  11846. // Create scrollLeft and scrollTop methods
  11847. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  11848. var top = /Y/.test( prop );
  11849.  
  11850. jQuery.fn[ method ] = function( val ) {
  11851. return access( this, function( elem, method, val ) {
  11852. var win = getWindow( elem );
  11853.  
  11854. if ( val === undefined ) {
  11855. return win ? ( prop in win ) ? win[ prop ] :
  11856. win.document.documentElement[ method ] :
  11857. elem[ method ];
  11858. }
  11859.  
  11860. if ( win ) {
  11861. win.scrollTo(
  11862. !top ? val : jQuery( win ).scrollLeft(),
  11863. top ? val : jQuery( win ).scrollTop()
  11864. );
  11865.  
  11866. } else {
  11867. elem[ method ] = val;
  11868. }
  11869. }, method, val, arguments.length, null );
  11870. };
  11871. } );
  11872.  
  11873. // Support: Safari<7-8+, Chrome<37-44+
  11874. // Add the top/left cssHooks using jQuery.fn.position
  11875. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  11876. // getComputedStyle returns percent when specified for top/left/bottom/right
  11877. // rather than make the css module depend on the offset module, we just check for it here
  11878. jQuery.each( [ "top", "left" ], function( i, prop ) {
  11879. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  11880. function( elem, computed ) {
  11881. if ( computed ) {
  11882. computed = curCSS( elem, prop );
  11883.  
  11884. // if curCSS returns percentage, fallback to offset
  11885. return rnumnonpx.test( computed ) ?
  11886. jQuery( elem ).position()[ prop ] + "px" :
  11887. computed;
  11888. }
  11889. }
  11890. );
  11891. } );
  11892.  
  11893.  
  11894. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  11895. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  11896. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  11897. function( defaultExtra, funcName ) {
  11898.  
  11899. // margin is only for outerHeight, outerWidth
  11900. jQuery.fn[ funcName ] = function( margin, value ) {
  11901. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  11902. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  11903.  
  11904. return access( this, function( elem, type, value ) {
  11905. var doc;
  11906.  
  11907. if ( jQuery.isWindow( elem ) ) {
  11908.  
  11909. // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
  11910. // isn't a whole lot we can do. See pull request at this URL for discussion:
  11911. // https://github.com/jquery/jquery/pull/764
  11912. return elem.document.documentElement[ "client" + name ];
  11913. }
  11914.  
  11915. // Get document width or height
  11916. if ( elem.nodeType === 9 ) {
  11917. doc = elem.documentElement;
  11918.  
  11919. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  11920. // whichever is greatest
  11921. // unfortunately, this causes bug #3838 in IE6/8 only,
  11922. // but there is currently no good, small way to fix it.
  11923. return Math.max(
  11924. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  11925. elem.body[ "offset" + name ], doc[ "offset" + name ],
  11926. doc[ "client" + name ]
  11927. );
  11928. }
  11929.  
  11930. return value === undefined ?
  11931.  
  11932. // Get width or height on the element, requesting but not forcing parseFloat
  11933. jQuery.css( elem, type, extra ) :
  11934.  
  11935. // Set width or height on the element
  11936. jQuery.style( elem, type, value, extra );
  11937. }, type, chainable ? margin : undefined, chainable, null );
  11938. };
  11939. } );
  11940. } );
  11941.  
  11942.  
  11943. jQuery.fn.extend( {
  11944.  
  11945. bind: function( types, data, fn ) {
  11946. return this.on( types, null, data, fn );
  11947. },
  11948. unbind: function( types, fn ) {
  11949. return this.off( types, null, fn );
  11950. },
  11951.  
  11952. delegate: function( selector, types, data, fn ) {
  11953. return this.on( types, selector, data, fn );
  11954. },
  11955. undelegate: function( selector, types, fn ) {
  11956.  
  11957. // ( namespace ) or ( selector, types [, fn] )
  11958. return arguments.length === 1 ?
  11959. this.off( selector, "**" ) :
  11960. this.off( types, selector || "**", fn );
  11961. }
  11962. } );
  11963.  
  11964. // The number of elements contained in the matched element set
  11965. jQuery.fn.size = function() {
  11966. return this.length;
  11967. };
  11968.  
  11969. jQuery.fn.andSelf = jQuery.fn.addBack;
  11970.  
  11971.  
  11972.  
  11973.  
  11974. // Register as a named AMD module, since jQuery can be concatenated with other
  11975. // files that may use define, but not via a proper concatenation script that
  11976. // understands anonymous AMD modules. A named AMD is safest and most robust
  11977. // way to register. Lowercase jquery is used because AMD module names are
  11978. // derived from file names, and jQuery is normally delivered in a lowercase
  11979. // file name. Do this after creating the global so that if an AMD module wants
  11980. // to call noConflict to hide this version of jQuery, it will work.
  11981.  
  11982. // Note that for maximum portability, libraries that are not jQuery should
  11983. // declare themselves as anonymous modules, and avoid setting a global if an
  11984. // AMD loader is present. jQuery is a special case. For more information, see
  11985. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  11986.  
  11987. if ( true ) {
  11988. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function() {
  11989. return jQuery;
  11990. }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  11991. }
  11992.  
  11993.  
  11994.  
  11995. var
  11996.  
  11997. // Map over jQuery in case of overwrite
  11998. _jQuery = window.jQuery,
  11999.  
  12000. // Map over the $ in case of overwrite
  12001. _$ = window.$;
  12002.  
  12003. jQuery.noConflict = function( deep ) {
  12004. if ( window.$ === jQuery ) {
  12005. window.$ = _$;
  12006. }
  12007.  
  12008. if ( deep && window.jQuery === jQuery ) {
  12009. window.jQuery = _jQuery;
  12010. }
  12011.  
  12012. return jQuery;
  12013. };
  12014.  
  12015. // Expose jQuery and $ identifiers, even in
  12016. // AMD (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  12017. // and CommonJS for browser emulators (#13566)
  12018. if ( !noGlobal ) {
  12019. window.jQuery = window.$ = jQuery;
  12020. }
  12021.  
  12022. return jQuery;
  12023. }));
  12024.  
  12025.  
  12026. /***/ }),
  12027. /* 4 */
  12028. /***/ (function(module, exports, __webpack_require__) {
  12029.  
  12030. "use strict";
  12031.  
  12032. Object.defineProperty(exports, "__esModule", {
  12033. value: true
  12034. });
  12035.  
  12036. 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;
  12037.  
  12038. var Storage = {
  12039. get: function get() {
  12040. var _arguments = arguments;
  12041.  
  12042. return new _Promise(function (resolve) {
  12043. var items = [].concat(Array.prototype.slice.call(_arguments));
  12044.  
  12045. if (items.length == 1) {
  12046. resolve(GM_getValue(items[0]));
  12047. } else {
  12048. var data = {};
  12049.  
  12050. items.forEach(function (item) {
  12051. data[item] = GM_getValue(item);
  12052. });
  12053.  
  12054. resolve(data);
  12055. }
  12056. });
  12057. },
  12058. set: function set(key, value) {
  12059. GM_setValue(key, value);
  12060. }
  12061. };
  12062.  
  12063. exports.default = Storage;
  12064.  
  12065. /***/ }),
  12066. /* 5 */
  12067. /***/ (function(module, exports) {
  12068.  
  12069. 'use strict';
  12070.  
  12071. Object.defineProperty(exports, "__esModule", {
  12072. value: true
  12073. });
  12074. exports.inject = inject;
  12075. exports.restoreWindowOpen = restoreWindowOpen;
  12076. /**
  12077. * injects a code to the page context that does the following:
  12078. * replace the window.open function with a function that checks if the window.open was executed due to an event.
  12079. * if so, then it checks who triggered the event. if it's the document or the body elements, the call is blocked.
  12080. * another protection, is closing windows that got blured by calling window.blur(), less then a second from its creation.
  12081. * check out the footer for another way websites try to open a new window.
  12082. * @return nothing
  12083. */
  12084. function inject() {
  12085. var originalOpenWndFnKey = "originalOpenFunction";
  12086. var originalWindowOpenFn = window.open;
  12087. var originalCreateElementFn = document.createElement;
  12088. var originalAppendChildFn = HTMLElement.prototype.appendChild;
  12089. var originalCreateEventFn = document.createEvent;
  12090. var windowsWithNames = {};
  12091. var timeSinceCreateAElement = 0;
  12092. var lastCreatedAElement = null;
  12093. var fullScreenOpenTime = void 0;
  12094. var winWidth = window.innerWidth;
  12095. var winHeight = window.innerHeight;
  12096. var abd = false;
  12097. var lastBlockTime = void 0;
  12098. var parentOrigin = window.location != window.parent.location ? document.referrer || window.parent.location || '*' : document.location;
  12099. var parentRef = window.parent;
  12100.  
  12101. //window[originalOpenWndFnKey] = window.open; // save the original open window as global param
  12102. function getAbsoluteURL(baseURL) {
  12103. if (/^about:blank/i.test(baseURL)) {
  12104. return baseURL;
  12105. }
  12106.  
  12107. if (/^(https?:)?\/\//.test(baseURL)) {
  12108. return baseURL;
  12109. }
  12110.  
  12111. baseURL = location.origin + (!/^\//.test(baseURL) ? '/' : '') + baseURL;
  12112.  
  12113. return baseURL;
  12114. }
  12115.  
  12116. function newWindowOpenFn() {
  12117. var openWndArguments = arguments;
  12118. var useOriginalOpenWnd = true;
  12119. var generatedWindow = null;
  12120.  
  12121. function getWindowName(openWndArguments) {
  12122. var windowName = openWndArguments[1];
  12123. if (windowName != null && !["_blank", "_parent", "_self", "_top"].includes(windowName)) {
  12124. return windowName;
  12125. }
  12126.  
  12127. return null;
  12128. }
  12129.  
  12130. function copyMissingProperties(src, dest) {
  12131. var prop = void 0;
  12132. for (prop in src) {
  12133. try {
  12134. if (dest[prop] === undefined && src[prop]) {
  12135. dest[prop] = src[prop];
  12136. }
  12137. } catch (e) {}
  12138. }
  12139. return dest;
  12140. }
  12141.  
  12142. function isParentWindow() {
  12143. try {
  12144. return !!(parent.Window && capturingElement instanceof parent.Window);
  12145. } catch (e) {
  12146. return false;
  12147. }
  12148. }
  12149.  
  12150. function isOverlayish(el) {
  12151. var style = el && el.style;
  12152.  
  12153. if (style && /fixed|absolute/.test(style.position) && el.offsetWidth >= winWidth * 0.6 && el.offsetHeight >= winHeight * 0.75) {
  12154. return true;
  12155. }
  12156.  
  12157. return false;
  12158. }
  12159.  
  12160. var capturingElement = null; // the element who registered to the event
  12161. var srcElement = null; // the clicked on element
  12162. var closestParentLink = null;
  12163.  
  12164. if (window.event != null) {
  12165. capturingElement = window.event.currentTarget;
  12166. srcElement = window.event.srcElement;
  12167. }
  12168.  
  12169. if (srcElement != null && srcElement instanceof HTMLElement) {
  12170. closestParentLink = srcElement.closest('a');
  12171.  
  12172. if (closestParentLink && closestParentLink.href) {
  12173. openWndArguments[3] = closestParentLink.href;
  12174. }
  12175. }
  12176.  
  12177. //callee will not work in ES6 or stict mode
  12178. try {
  12179. if (capturingElement == null) {
  12180. var caller = openWndArguments.callee;
  12181. while (caller.arguments != null && caller.arguments.callee.caller != null) {
  12182. caller = caller.arguments.callee.caller;
  12183. }
  12184. if (caller.arguments != null && caller.arguments.length > 0 && caller.arguments[0].currentTarget != null) {
  12185. capturingElement = caller.arguments[0].currentTarget;
  12186. }
  12187. }
  12188. } catch (e) {}
  12189.  
  12190. /////////////////////////////////////////////////////////////////////////////////
  12191. // Blocked if a click on background element occurred (<body> or document)
  12192. /////////////////////////////////////////////////////////////////////////////////
  12193. if (capturingElement == null) {
  12194. window.pbreason = 'Blocked a new window opened without any user interaction';
  12195. useOriginalOpenWnd = false;
  12196. } 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"))) {
  12197. window.pbreason = 'Blocked a new window opened with URL: ' + openWndArguments[0] + ' because it was triggered by the ' + capturingElement.nodeName + ' element';
  12198. useOriginalOpenWnd = false;
  12199. } else if (isOverlayish(capturingElement)) {
  12200. window.pbreason = 'Blocked a new window opened when clicking on an element that seems to be an overlay';
  12201. useOriginalOpenWnd = false;
  12202. } else {
  12203. useOriginalOpenWnd = true;
  12204. }
  12205. /////////////////////////////////////////////////////////////////////////////////
  12206.  
  12207.  
  12208. /////////////////////////////////////////////////////////////////////////////////
  12209. // Block if a full screen was just initiated while opening this url.
  12210. /////////////////////////////////////////////////////////////////////////////////
  12211.  
  12212. var fullScreenElement = document.webkitFullscreenElement || document.mozFullscreenElement || document.fullscreenElement;
  12213. if (new Date().getTime() - fullScreenOpenTime < 1000 || isNaN(fullScreenOpenTime) && isDocumentInFullScreenMode()) {
  12214.  
  12215. window.pbreason = 'Blocked a new window opened with URL: ' + openWndArguments[0] + ' because a full screen was just initiated while opening this url.';
  12216.  
  12217. /* JRA REMOVED
  12218. if (window[script_params.fullScreenFnKey]) {
  12219. window.clearTimeout(window[script_params.fullScreenFnKey]);
  12220. }
  12221. */
  12222.  
  12223. if (document.exitFullscreen) {
  12224. document.exitFullscreen();
  12225. } else if (document.mozCancelFullScreen) {
  12226. document.mozCancelFullScreen();
  12227. } else if (document.webkitCancelFullScreen) {
  12228. document.webkitCancelFullScreen();
  12229. }
  12230.  
  12231. useOriginalOpenWnd = false;
  12232. }
  12233. /////////////////////////////////////////////////////////////////////////////////
  12234. var openUrl = openWndArguments[0];
  12235. var inWhitelist = isInWhitelist(openUrl);
  12236.  
  12237. if (inWhitelist) {
  12238. useOriginalOpenWnd = true;
  12239. } else if (isInBlacklist(openUrl)) {
  12240. useOriginalOpenWnd = false;
  12241. }
  12242.  
  12243. if (useOriginalOpenWnd == true) {
  12244. generatedWindow = originalWindowOpenFn.apply(this, openWndArguments);
  12245. // save the window by name, for latter use.
  12246. var windowName = getWindowName(openWndArguments);
  12247. if (windowName != null) {
  12248. windowsWithNames[windowName] = generatedWindow;
  12249. }
  12250.  
  12251. // 2nd line of defence: allow window to open but monitor carefully...
  12252.  
  12253. /////////////////////////////////////////////////////////////////////////////////
  12254. // Kill window if a blur (remove focus) is called to that window
  12255. /////////////////////////////////////////////////////////////////////////////////
  12256. if (generatedWindow !== window) {
  12257. var openTime = new Date().getTime();
  12258. var originalWndBlurFn = generatedWindow.blur;
  12259. generatedWindow.blur = function () {
  12260. if (new Date().getTime() - openTime < 1000 && !inWhitelist /* one second */) {
  12261. window.pbreason = 'Blocked a new window opened with URL: ' + openWndArguments[0] + ' because a it was blured';
  12262. generatedWindow.close();
  12263. blockedWndNotification(openWndArguments);
  12264. } else {
  12265. originalWndBlurFn();
  12266. }
  12267. };
  12268. }
  12269. /////////////////////////////////////////////////////////////////////////////////
  12270. } else {
  12271. // (useOriginalOpenWnd == false)
  12272. var _location = {
  12273. href: openWndArguments[0]
  12274. };
  12275. _location.replace = function (url) {
  12276. _location.href = url;
  12277. };
  12278.  
  12279. generatedWindow = {
  12280. close: function close() {
  12281. return true;
  12282. },
  12283. test: function test() {
  12284. return true;
  12285. },
  12286. blur: function blur() {
  12287. return true;
  12288. },
  12289. focus: function focus() {
  12290. return true;
  12291. },
  12292. showModelessDialog: function showModelessDialog() {
  12293. return true;
  12294. },
  12295. showModalDialog: function showModalDialog() {
  12296. return true;
  12297. },
  12298. prompt: function prompt() {
  12299. return true;
  12300. },
  12301. confirm: function confirm() {
  12302. return true;
  12303. },
  12304. alert: function alert() {
  12305. return true;
  12306. },
  12307. moveTo: function moveTo() {
  12308. return true;
  12309. },
  12310. moveBy: function moveBy() {
  12311. return true;
  12312. },
  12313. resizeTo: function resizeTo() {
  12314. return true;
  12315. },
  12316. resizeBy: function resizeBy() {
  12317. return true;
  12318. },
  12319. scrollBy: function scrollBy() {
  12320. return true;
  12321. },
  12322. scrollTo: function scrollTo() {
  12323. return true;
  12324. },
  12325. getSelection: function getSelection() {
  12326. return true;
  12327. },
  12328. onunload: function onunload() {
  12329. return true;
  12330. },
  12331. print: function print() {
  12332. return true;
  12333. },
  12334. open: function open() {
  12335. return this;
  12336. },
  12337.  
  12338. opener: window,
  12339. closed: false,
  12340. innerHeight: 480,
  12341. innerWidth: 640,
  12342. name: openWndArguments[1],
  12343. location: _location,
  12344. document: { location: _location }
  12345. };
  12346.  
  12347. copyMissingProperties(window, generatedWindow);
  12348.  
  12349. generatedWindow.window = generatedWindow;
  12350.  
  12351. var _windowName = getWindowName(openWndArguments);
  12352. if (_windowName != null) {
  12353. try {
  12354. // originalWindowOpenFn("", windowName).close();
  12355. windowsWithNames[_windowName].close();
  12356. } catch (err) {}
  12357. }
  12358.  
  12359. var fnGetUrl = function fnGetUrl() {
  12360. var url = void 0;
  12361. if (!(generatedWindow.location instanceof Object)) {
  12362. url = generatedWindow.location;
  12363. } else if (!(generatedWindow.document.location instanceof Object)) {
  12364. url = generatedWindow.document.location;
  12365. } else if (_location.href != null) {
  12366. url = _location.href;
  12367. } else {
  12368. url = openWndArguments[0];
  12369. }
  12370. openWndArguments[0] = url;
  12371.  
  12372. blockedWndNotification(openWndArguments);
  12373. };
  12374.  
  12375. //why set timeout? if anyone finds a reason for it, please write it here
  12376. //in iframes it makes problems so i'm avoiding it there
  12377. if (top == self) {
  12378. setTimeout(fnGetUrl, 100);
  12379. } else {
  12380. fnGetUrl();
  12381. }
  12382. }
  12383.  
  12384. return generatedWindow;
  12385. }
  12386.  
  12387. function pbWindowOpen() {
  12388. try {
  12389. return newWindowOpenFn.apply(this, arguments);
  12390. } catch (err) {
  12391. return null;
  12392. }
  12393. }
  12394.  
  12395. /////////////////////////////////////////////////////////////////////////////////
  12396. // Replace the window open method with Poper Blocker's
  12397. /////////////////////////////////////////////////////////////////////////////////
  12398. window.open = pbWindowOpen;
  12399. /////////////////////////////////////////////////////////////////////////////////
  12400.  
  12401.  
  12402. //////////////////////////////////////////////////////////////////////////////////////////////////////////
  12403. // Monitor dynamic html element creation to prevent generating <a> elements with click dispatching event
  12404. //////////////////////////////////////////////////////////////////////////////////////////////////////////
  12405. HTMLElement.prototype.appendChild = function () {
  12406. var newElement = originalAppendChildFn.apply(this, arguments);
  12407.  
  12408. if (newElement.nodeName == 'IFRAME' && newElement.contentWindow) {
  12409. try {
  12410. 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 })();';
  12411.  
  12412. var s = document.createElement('script');s.text = code;
  12413.  
  12414. newElement.contentWindow.document.body.appendChild(s);
  12415. } catch (e) {}
  12416. }
  12417.  
  12418. return newElement;
  12419. };
  12420.  
  12421. document.createElement = function () {
  12422.  
  12423. var newElement = originalCreateElementFn.apply(document, arguments);
  12424.  
  12425. if (arguments[0] == "a" || arguments[0] == "A") {
  12426.  
  12427. timeSinceCreateAElement = new Date().getTime();
  12428.  
  12429. var originalDispatchEventFn = newElement.dispatchEvent;
  12430.  
  12431. newElement.dispatchEvent = function (event) {
  12432. if (event.type != null && ('' + event.type).toLocaleLowerCase() == "click") {
  12433. if (!isInWhitelist(newElement.href)) {
  12434. window.pbreason = "blocked due to an explicit dispatchEvent event with type 'click' on an 'a' tag";
  12435.  
  12436. blockedWndNotification({ "0": newElement.href });
  12437.  
  12438. return true;
  12439. }
  12440. }
  12441.  
  12442. return originalDispatchEventFn.call(this, event);
  12443. };
  12444.  
  12445. lastCreatedAElement = newElement;
  12446. }
  12447.  
  12448. return newElement;
  12449. };
  12450. /////////////////////////////////////////////////////////////////////////////////
  12451.  
  12452.  
  12453. /////////////////////////////////////////////////////////////////////////////////
  12454. // Block artificial mouse click on frashly created <a> elements
  12455. /////////////////////////////////////////////////////////////////////////////////
  12456. document.createEvent = function () {
  12457. try {
  12458. if (arguments[0].toLowerCase().includes("mouse") && new Date().getTime() - timeSinceCreateAElement <= 50) {
  12459. var openUrlDomain = void 0,
  12460. topUrl = void 0,
  12461. topDomain = void 0;
  12462.  
  12463. try {
  12464. openUrlDomain = new URL(lastCreatedAElement.href).hostname;
  12465. } catch (e) {}
  12466.  
  12467. try {
  12468. topUrl = window.location != window.parent.location ? document.referrer : document.location.href;
  12469. } catch (e) {}
  12470.  
  12471. try {
  12472. topDomain = new URL(topUrl).hostname;
  12473. } catch (e) {}
  12474.  
  12475. //block if the origin is not same
  12476. var isSelfDomain = openUrlDomain == topDomain;
  12477.  
  12478. if (lastCreatedAElement.href.trim() && !isInWhitelist(lastCreatedAElement.href) && !isSelfDomain) {
  12479. //this makes too much false positive so we do not display the toast message
  12480. window.pbreason = 'Blocked because \'a\' element was recently created and ' + arguments[0] + ' event was created shortly after';
  12481. arguments[0] = lastCreatedAElement.href;
  12482.  
  12483. blockedWndNotification({ "0": lastCreatedAElement.href });
  12484.  
  12485. return {
  12486. type: 'click',
  12487. initMouseEvent: function initMouseEvent() {}
  12488. };
  12489. }
  12490. }
  12491.  
  12492. return originalCreateEventFn.apply(document, arguments);
  12493. } catch (err) {}
  12494. };
  12495. /////////////////////////////////////////////////////////////////////////////////
  12496.  
  12497.  
  12498. /////////////////////////////////////////////////////////////////////////////////
  12499. // Monitor full screen requests
  12500. /////////////////////////////////////////////////////////////////////////////////
  12501. function onFullScreen(isInFullScreenMode) {
  12502. if (isInFullScreenMode) {
  12503. fullScreenOpenTime = new Date().getTime();
  12504. } else {
  12505. fullScreenOpenTime = NaN;
  12506. }
  12507. }
  12508.  
  12509. /////////////////////////////////////////////////////////////////////////////////
  12510.  
  12511. function isDocumentInFullScreenMode() {
  12512. // Note that the browser fullscreen (triggered by short keys) might
  12513. // be considered different from content fullscreen when expecting a boolean
  12514. return document.fullScreenElement && document.fullScreenElement !== null || // alternative standard methods
  12515. document.mozFullscreenElement != null || document.webkitFullscreenElement != null; // current working methods
  12516. }
  12517.  
  12518. function isInWhitelist(url) {
  12519. return isInList(url, pb_whitelist);
  12520. }
  12521.  
  12522. function isInBlacklist(url) {
  12523. return isInList(url, pb_blacklist);
  12524. }
  12525.  
  12526. function isInList(url, list) {
  12527. if (list) {
  12528. return list.some(function (li) {
  12529. return new RegExp("https?://(www\.|.*\.)?" + li + "+").test(url);
  12530. });
  12531. } else {
  12532. return false;
  12533. }
  12534. }
  12535.  
  12536. function blockedWndNotification(openWndArguments) {
  12537. //this is to prevent a site that "stuck" on trying to open a new window to send endless calls to the extension
  12538. if (!lastBlockTime || lastBlockTime < Date.now() - 1000) {
  12539. openWndArguments["0"] = getAbsoluteURL(openWndArguments["0"]);
  12540. openWndArguments["abd"] = abd;
  12541.  
  12542. parentRef.postMessage({ type: "blockedWindow", args: JSON.stringify(openWndArguments) }, parentOrigin);
  12543. }
  12544.  
  12545. lastBlockTime = Date.now();
  12546. }
  12547.  
  12548. //detect adblock to adjust popup blocking behavior to not collide with adblock
  12549. function detectAdblock() {
  12550. try {
  12551. var tester = document.createElement('div');
  12552. tester.innerHTML = '&nbsp;';
  12553. tester.className = 'adsbox';
  12554. tester.style.cssText = "position:absolute;top-1000px;left:-1000px;";
  12555.  
  12556. document.body.appendChild(tester);
  12557.  
  12558. window.setTimeout(function () {
  12559. if (tester.offsetHeight === 0) {
  12560. abd = true;
  12561. }
  12562.  
  12563. tester.remove();
  12564. }, 100);
  12565. } catch (e) {}
  12566. }
  12567.  
  12568. function executeCommand(commandId, messageId) {
  12569. if (messageId == pb_message) {
  12570. switch (commandId) {
  12571. case 0:
  12572. //off
  12573. window.open = originalWindowOpenFn;
  12574. document.createElement = originalCreateElementFn;
  12575. document.createEvent = originalCreateEventFn;
  12576. HTMLElement.prototype.appendChild = originalAppendChildFn;
  12577. break;
  12578.  
  12579. case 1:
  12580. //allow once
  12581. break;
  12582. }
  12583. }
  12584. }
  12585.  
  12586. document.addEventListener("fullscreenchange", function () {
  12587. onFullScreen(document.fullscreen);
  12588. }, false);
  12589.  
  12590. document.addEventListener("mozfullscreenchange", function () {
  12591. onFullScreen(document.mozFullScreen);
  12592. }, false);
  12593.  
  12594. document.addEventListener("webkitfullscreenchange", function () {
  12595. onFullScreen(document.webkitIsFullScreen);
  12596. }, false);
  12597.  
  12598. //document.addEventListener('DOMContentLoaded', () =>{
  12599. detectAdblock();
  12600. //}, false);
  12601.  
  12602. (function () {
  12603. window.pbExternalCommand = function (commandId, messageId) {
  12604. executeCommand(commandId, messageId);
  12605. };
  12606. })();
  12607. }
  12608.  
  12609. function restoreWindowOpen() {
  12610. window.open = window["originalOpenFunction"];
  12611. }
  12612.  
  12613. /*
  12614. (*) a jquery plugin (https://github.com/hpbuniat/jquery-popunder/blob/master/src/jquery.popunder.js) | $.popunder.helper.open
  12615.  
  12616. (*) another jquery plugin (https://github.com/tuki/js-popunder/)
  12617.  
  12618. The full-screen trick
  12619. ---------------------
  12620.  
  12621. (*) another way sites try to open new windows, is to put a link inside the page and generate a click on it.
  12622. 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.
  12623. for example:
  12624.  
  12625. var a = document.createElement("a");
  12626. var e = document.createEvent("MouseEvents");
  12627. var rand = Math.random();
  12628. a.target = "_tab" + rand.toString();
  12629. a.href = "about:blank";
  12630. document.body.appendChild(a);
  12631. e.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, true, false, false, true, 0, null);
  12632. a.dispatchEvent(e);
  12633. window.open("about:blank", "_tab" + rand.toString()).close();
  12634.  
  12635. (*) They open full screen mode -> open a popup window -> exit full screen mode, thus it goes beneath the window
  12636.  
  12637. The create element & event trick
  12638. --------------------------------
  12639.  
  12640. (*) The website will create an <a> element and also a MouseEvents event, that will auto click on it.
  12641. This will make a window to open and without the window.open
  12642.  
  12643. (*) http://torrents.to/
  12644.  
  12645. Pop-under test websites:
  12646. --------------------------------
  12647.  
  12648. http://www.ad4game.com/popunder/
  12649. http://test.gluk.name/test2/pop3/?#
  12650. http://cpmnetwork.adbooth.com/en/popunder
  12651. http://www.vcmuk.com/poptest.html
  12652. http://affplaybook.com/poptest/exit1/test.html
  12653.  
  12654. Not blocked by AdBlock:
  12655.  
  12656. http://demo.dynamicoxygen.com/Pop-Under
  12657. http://mirodex.blogspot.co.il/2013/10/working-popunder-script-on-chrome.html
  12658. http://www.advertserve.com/examples/popups.html
  12659. http://www.htmlgoodies.com/beyond/javascript/article.php/3471241
  12660. */
  12661.  
  12662. /***/ }),
  12663. /* 6 */
  12664. /***/ (function(module, exports, __webpack_require__) {
  12665.  
  12666. 'use strict';
  12667.  
  12668. Object.defineProperty(exports, "__esModule", {
  12669. value: true
  12670. });
  12671.  
  12672. 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; }; }();
  12673.  
  12674. var _storage = __webpack_require__(4);
  12675.  
  12676. var _storage2 = _interopRequireDefault(_storage);
  12677.  
  12678. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  12679.  
  12680. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  12681.  
  12682. 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;
  12683.  
  12684. var NtfShowManager = function () {
  12685. function NtfShowManager() {
  12686. _classCallCheck(this, NtfShowManager);
  12687.  
  12688. this.isActive = { pop: true, overlay: true, tip: true };
  12689. }
  12690.  
  12691. _createClass(NtfShowManager, [{
  12692. key: 'isShow',
  12693. value: function isShow() {
  12694. var _this = this;
  12695.  
  12696. var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  12697. var domain = props.domain,
  12698. _props$type = props.type,
  12699. type = _props$type === undefined ? 'pop' : _props$type;
  12700.  
  12701. return new _Promise(function (resolve) {
  12702. _storage2.default.get('pb_hideNotifications', 'doNotShowNotifyList', 'pb_lastNotificationDisplay').then(function (settings) {
  12703. var isGlobalHidden = settings.pb_hideNotifications || false;
  12704. var hiddenSitesList = settings.doNotShowNotifyList || [];
  12705. var lastDisplay = settings.pb_lastNotificationDisplay || {};
  12706.  
  12707. if (_this.isActive[type] && _this.checkLastDisplay({ domain: domain, type: type, lastDisplay: lastDisplay }) && !isGlobalHidden && !_this.checkIsHidden({ hiddenSitesList: hiddenSitesList, domain: domain })) {
  12708. _this.isActive[type] = false;
  12709.  
  12710. _this.updateLastDisplay({ domain: domain, type: type });
  12711. resolve();
  12712. }
  12713. });
  12714. });
  12715. }
  12716.  
  12717. //check if user added this site to don't show again for 30 days
  12718.  
  12719. }, {
  12720. key: 'checkIsHidden',
  12721. value: function checkIsHidden(_ref) {
  12722. var hiddenSitesList = _ref.hiddenSitesList,
  12723. domain = _ref.domain;
  12724.  
  12725. var item = hiddenSitesList.find(function (item) {
  12726. return item.domain == domain;
  12727. });
  12728.  
  12729. if (item && item.time) {
  12730. var time = new Date(item.time);
  12731. var time30days = new Date(time.setDate(time.getDate() + 30));
  12732. var now = new Date();
  12733.  
  12734. if (now <= time30days) {
  12735. return true;
  12736. }
  12737. }
  12738.  
  12739. return false;
  12740. }
  12741.  
  12742. //overlay notification needs to be shown only once in 24 hours
  12743. //overlay tip notification needs to be shown once a month
  12744.  
  12745. }, {
  12746. key: 'checkLastDisplay',
  12747. value: function checkLastDisplay(_ref2) {
  12748. var domain = _ref2.domain,
  12749. type = _ref2.type,
  12750. lastDisplay = _ref2.lastDisplay;
  12751.  
  12752. var now = new Date().getTime();
  12753. var last = lastDisplay[type];
  12754.  
  12755. if (!last) {
  12756. return true;
  12757. }
  12758.  
  12759. switch (type) {
  12760. case 'overlay':
  12761. last = last[domain];
  12762.  
  12763. if (last && last + 1000 * 60 * 60 * 24 > now) {
  12764. return false;
  12765. }
  12766. break;
  12767.  
  12768. case 'tip':
  12769. if (last + 1000 * 60 * 60 * 24 * 30 > now) {
  12770. return false;
  12771. }
  12772. break;
  12773. }
  12774.  
  12775. return true;
  12776. }
  12777. }, {
  12778. key: 'updateLastDisplay',
  12779. value: function updateLastDisplay(_ref3) {
  12780. var domain = _ref3.domain,
  12781. type = _ref3.type;
  12782.  
  12783. _storage2.default.get('pb_lastNotificationDisplay').then(function () {
  12784. var display = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  12785.  
  12786. switch (type) {
  12787. case 'overlay':
  12788. display[type] = display[type] || {};
  12789. display[type][domain] = new Date().getTime();
  12790. break;
  12791.  
  12792. default:
  12793. display[type] = new Date().getTime();
  12794. break;
  12795. }
  12796.  
  12797. _storage2.default.set('pb_lastNotificationDisplay', display);
  12798. });
  12799. }
  12800. }, {
  12801. key: 'updateDontShow',
  12802. value: function updateDontShow(_ref4) {
  12803. var domain = _ref4.domain;
  12804.  
  12805. PBStorageSync.doNotShowNotifyList.update(function (doNotShowList) {
  12806. doNotShowList = doNotShowList.filter(function (item) {
  12807. return item.domain != domain;
  12808. });
  12809. doNotShowList.push({
  12810. domain: domain,
  12811. time: new Date().getTime()
  12812. });
  12813.  
  12814. return doNotShowList;
  12815. });
  12816. }
  12817. }]);
  12818.  
  12819. return NtfShowManager;
  12820. }();
  12821.  
  12822. exports.default = NtfShowManager;
  12823.  
  12824. /***/ }),
  12825. /* 7 */
  12826. /***/ (function(module, exports, __webpack_require__) {
  12827.  
  12828. 'use strict';
  12829.  
  12830. Object.defineProperty(exports, "__esModule", {
  12831. value: true
  12832. });
  12833.  
  12834. 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; }; }();
  12835.  
  12836. var _jQuery = __webpack_require__(3);
  12837.  
  12838. var _jQuery2 = _interopRequireDefault(_jQuery);
  12839.  
  12840. var _storage = __webpack_require__(4);
  12841.  
  12842. var _storage2 = _interopRequireDefault(_storage);
  12843.  
  12844. var _utils = __webpack_require__(8);
  12845.  
  12846. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  12847.  
  12848. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  12849.  
  12850. var Notification = function () {
  12851. function Notification() {
  12852. var _this = this;
  12853.  
  12854. var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  12855.  
  12856. _classCallCheck(this, Notification);
  12857.  
  12858. this.queue = [];
  12859. this.props = props;
  12860. 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>";
  12861.  
  12862. window.addEventListener('message', function (event) {
  12863. if (event.data && event.data.toastId == _this.toastId) {
  12864. var data = event.data;
  12865.  
  12866. switch (data.action) {
  12867. case 'pb-message-display':
  12868. _this.options.onDisplay && _this.options.onDisplay();
  12869.  
  12870. _this.props.onDisplay.call(_this, { source: data.source });
  12871. break;
  12872.  
  12873. case 'pb-message-close':
  12874. _this.userGeneratedClose = true;
  12875.  
  12876. //remove immediately
  12877. if (data.quickClose) {
  12878. _this.remove();
  12879. } else {
  12880. _this.queueFade(100, _this.options.onFadeOut);
  12881. }
  12882.  
  12883. if (data.triggerEvent) {
  12884. _this.options.onClose && _this.options.onClose();
  12885. _this.options.onButtonClick && _this.options.onButtonClick({ id: 'close' });
  12886.  
  12887. _this.props.onButtonClick.call(_this, { source: data.source, id: 'close' });
  12888. _this.props.onCloseClick.call(_this, { source: data.source });
  12889. }
  12890. break;
  12891.  
  12892. case 'pb-message-btn-click':
  12893. if (_this.options.buttons[data.id]) {
  12894. _this.options.buttons[data.id]();
  12895. }
  12896.  
  12897. _this.options.onButtonClick && _this.options.onButtonClick({ id: data.id });
  12898. _this.props.onButtonClick.call(_this, { source: data.source, id: data.id });
  12899. break;
  12900.  
  12901. case 'pb-message-tooltip-over':
  12902. if (isI18N(data.id)) {
  12903. _this.showTooltip(data);
  12904. }
  12905. break;
  12906.  
  12907. case 'pb-message-tooltip-out':
  12908. _this.hideTooltip();
  12909. break;
  12910. }
  12911.  
  12912. if (_this.props.onAction) {
  12913. _this.props.onAction(data.action);
  12914. }
  12915. }
  12916. });
  12917.  
  12918. //when focus out it stops css animation so even after 5 seconds
  12919. //the notification stays and when focus back it quickly disapears
  12920. //this is a fix to this
  12921. document.addEventListener('visibilitychange', function (event) {
  12922. if (document.visibilityState == 'visible') {
  12923. var now = new Date().getTime();
  12924.  
  12925. if (_this.queueFadeTime && now > _this.queueFadeTime + 5000) {
  12926. _this.remove();
  12927. }
  12928. }
  12929. }, false);
  12930. }
  12931.  
  12932. _createClass(Notification, [{
  12933. key: 'addQueue',
  12934. value: function addQueue(options) {
  12935. this.queue.push(options);
  12936.  
  12937. if (!this.isNotificationActive) {
  12938. this.show(this.getNextQueueItem());
  12939. }
  12940. }
  12941. }, {
  12942. key: 'getNextQueueItem',
  12943. value: function getNextQueueItem() {
  12944. return this.queue.shift();
  12945. }
  12946. }, {
  12947. key: 'show',
  12948. value: function show(options) {
  12949. var _this2 = this;
  12950.  
  12951. this.init(options);
  12952.  
  12953. if (options.quickOpen && !document.body) {
  12954. setTimeout(function () {
  12955. _this2.show(options);
  12956. }, 50);
  12957.  
  12958. return;
  12959. } else {
  12960. this.isNotificationActive = true;
  12961.  
  12962. this.render();
  12963. }
  12964. }
  12965. }, {
  12966. key: 'render',
  12967. value: function render() {
  12968. var _this3 = this;
  12969.  
  12970. var data = this.getIframeData();
  12971. this.toast = (0, _jQuery2.default)('<iframe id="pb-toast-main" class="' + this.getCSSClass() + '">').on('load', function () {
  12972. if (_this3.options.quickOpen) {
  12973. _this3.toast.show().addClass('pb-toast-main-show');
  12974. } else {
  12975. _this3.toast.show().addClass('pb-toast-main-move');
  12976. }
  12977.  
  12978. if (!_this3.options.persistent) {
  12979. _this3.queueFadeTime = new Date().getTime();
  12980. _this3.queueFade(5000, _this3.options.onFadeOut);
  12981. }
  12982. }).on('mouseenter', function () {
  12983. if (!_this3.options.persistent) {
  12984. _this3.cancelFade();
  12985. }
  12986. }).on('mouseleave', function () {
  12987. if (!_this3.userGeneratedClose && !_this3.options.persistent) {
  12988. _this3.queueFade(5000, _this3.options.onFadeOut);
  12989. }
  12990. }).on('transitionend', function () {
  12991. if (!_this3.toast.is('.pb-toast-main-move')) {
  12992. _this3.remove();
  12993. }
  12994. }).attr('src', data).appendTo('body');
  12995. }
  12996. }, {
  12997. key: 'getCSSClass',
  12998. value: function getCSSClass() {
  12999. return 'pb-toast-main ' + (this.options.cssClass || '');
  13000. }
  13001. }, {
  13002. key: 'init',
  13003. value: function init(options) {
  13004. this.remove();
  13005.  
  13006. this.toastId = (0, _utils.GUID)();
  13007. this.options = options;
  13008. this.userGeneratedClose = false;
  13009. this.queueFadeTime = null;
  13010. }
  13011. }, {
  13012. key: 'remove',
  13013. value: function remove() {
  13014. this.hideTooltip();
  13015.  
  13016. if (this.fid) {
  13017. clearTimeout(this.fid);
  13018. }
  13019.  
  13020. if (this.toast) {
  13021. this.toast.remove();
  13022. }
  13023.  
  13024. if (this.isNotificationActive) {
  13025. this.isNotificationActive = false;
  13026.  
  13027. if (!this.options.stopQueue && this.queue.length) {
  13028. this.show(this.getNextQueueItem());
  13029. }
  13030. }
  13031. }
  13032. }, {
  13033. key: 'queueFade',
  13034. value: function queueFade(time, onFadeOut) {
  13035. var _this4 = this;
  13036.  
  13037. this.fid = setTimeout(function () {
  13038. _this4.toast.attr('class', _this4.getCSSClass());
  13039.  
  13040. if (onFadeOut) {
  13041. onFadeOut();
  13042. }
  13043. }, time);
  13044. }
  13045. }, {
  13046. key: 'cancelFade',
  13047. value: function cancelFade() {
  13048. if (!this.toast.is('.pb-toast-main-move')) {
  13049. this.toast.addClass('pb-toast-main-move');
  13050. }
  13051.  
  13052. clearTimeout(this.fid);
  13053. }
  13054. }, {
  13055. key: 'showTooltip',
  13056. value: function showTooltip(_ref) {
  13057. var id = _ref.id,
  13058. position = _ref.position;
  13059.  
  13060. var toastPosition = this.toast.get(0).getBoundingClientRect();
  13061. var tooltipPosition = {
  13062. left: toastPosition.left + position.xCenter,
  13063. top: toastPosition.top + position.yCenter + 15
  13064. };
  13065. var tooltip = this.renderTooltip(id);
  13066.  
  13067. tooltip.css({
  13068. 'top': tooltipPosition.top,
  13069. 'left': tooltipPosition.left - (tooltip.outerWidth() - 70)
  13070. });
  13071. }
  13072. }, {
  13073. key: 'hideTooltip',
  13074. value: function hideTooltip() {
  13075. (0, _jQuery2.default)('#pb_jq_tipsWrapper').remove();
  13076. }
  13077. }, {
  13078. key: 'renderTooltip',
  13079. value: function renderTooltip(id) {
  13080. this.hideTooltip();
  13081.  
  13082. return (0, _jQuery2.default)('<div id="pb_jq_tipsWrapper">' + (0, _utils.getI18N)(id) + '</div>').appendTo('body');
  13083. }
  13084. }, {
  13085. key: 'showLinkCopied',
  13086. value: function showLinkCopied(iconPosition) {
  13087. var toastPosition = this.toast.get(0).getBoundingClientRect();
  13088. var position = {
  13089. left: toastPosition.left + iconPosition.left,
  13090. top: toastPosition.top + iconPosition.top
  13091. };
  13092.  
  13093. (0, _jQuery2.default)('#pb-link-copied-message').remove();
  13094. var msg = (0, _jQuery2.default)('<div id="pb-link-copied-message">' + (0, _utils.getI18N)('NTF_LinkCopied') + '</div>').css({
  13095. top: position.top + 31,
  13096. left: position.left - 30
  13097. }).appendTo('body').show().animate({
  13098. opacity: 1
  13099. }, 250);
  13100.  
  13101. setTimeout(function () {
  13102. return msg.animate({ opacity: 0 }, 250, function () {
  13103. return msg.remove();
  13104. });
  13105. }, 2000);
  13106. }
  13107. }, {
  13108. key: 'getIframeData',
  13109. value: function getIframeData() {
  13110. var data = {
  13111. id: this.toastId,
  13112. title: this.options.title,
  13113. subTitle: this.options.subTitle || '',
  13114. buttons: Object.keys(this.options.buttons || {}).map(function (id) {
  13115. return { id: id, label: (0, _utils.getI18N)(id) };
  13116. }),
  13117. showHide: this.options.showHide,
  13118. showResize: this.options.showResize,
  13119. source: this.options.source || '',
  13120. props: {
  13121. domain: document.domain,
  13122. winArgs: this.options.winArgs || []
  13123. }
  13124. };
  13125. var html = this.notificationHTML.replace('//@DATA', encodeURIComponent(JSON.stringify(data)));
  13126.  
  13127. return 'data:text/html;base64,' + btoa(html);
  13128. }
  13129. }]);
  13130.  
  13131. return Notification;
  13132. }();
  13133.  
  13134. exports.default = Notification;
  13135.  
  13136. /***/ }),
  13137. /* 8 */
  13138. /***/ (function(module, exports) {
  13139.  
  13140. "use strict";
  13141.  
  13142. Object.defineProperty(exports, "__esModule", {
  13143. value: true
  13144. });
  13145.  
  13146. 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; }; }();
  13147.  
  13148. exports.now = now;
  13149. exports.addScript = addScript;
  13150. exports.removeScript = removeScript;
  13151. exports.executeCode = executeCode;
  13152. exports.isDomainInList = isDomainInList;
  13153. exports.toQueryString = toQueryString;
  13154. exports.randId = randId;
  13155. exports.GUID = GUID;
  13156. exports.updateWhitelist = updateWhitelist;
  13157. exports.getI18N = getI18N;
  13158. exports.getBrowser = getBrowser;
  13159. exports.getRandomInt = getRandomInt;
  13160. exports.isValidUrl = isValidUrl;
  13161. exports.getAbsoluteURL = getAbsoluteURL;
  13162. exports.insertBeforeRoot = insertBeforeRoot;
  13163. exports.sendGoogleAnalyticsEvent = sendGoogleAnalyticsEvent;
  13164.  
  13165. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  13166.  
  13167. function now() {
  13168. return Math.floor(Date.now() / 1000);
  13169. }
  13170.  
  13171. function addScript(template) {
  13172. var s = document.createElement("script");
  13173. if (document.querySelector("#" + template.id) != undefined) {
  13174. return;
  13175. }
  13176. if (template.src) {
  13177. s.src = template.src;
  13178. }
  13179. if (template.textContent) {
  13180. s.textContent = template.textContent;
  13181. }
  13182. s.setAttribute("id", template.id);
  13183. insertBeforeRoot(s);
  13184. }
  13185.  
  13186. function removeScript(template) {
  13187. var addedScript = document.querySelector("#" + template.id);
  13188. if (addedScript != undefined) {
  13189. addedScript.parentNode.removeChild(addedScript);
  13190. }
  13191. }
  13192.  
  13193. function executeCode(code) {
  13194. var s = document.createElement("script");
  13195. s.textContent = code;
  13196. insertBeforeRoot(s);
  13197.  
  13198. setTimeout(function () {
  13199. s.parentNode.removeChild(s);
  13200. }, 50);
  13201. }
  13202.  
  13203. /**
  13204. * Checks whether domain fits the whitelist
  13205. * @param String domain
  13206. * @param Array [String] domainList
  13207. * @returns {boolean}
  13208. */
  13209. function isDomainInList(domain, domainList, returnValue) {
  13210. domainList = domainList || [];
  13211.  
  13212. for (var i = 0; i < domainList.length; i++) {
  13213. var domainTail = domainList[i];
  13214. if (new RegExp("\\b[(www\\.)|.*\.]?" + domainTail + "\\b").test(domain)) {
  13215. return returnValue ? domainTail : true;
  13216. }
  13217. }
  13218. return false;
  13219. }
  13220.  
  13221. function toQueryString(obj) {
  13222. return Object.keys(obj).filter(function (key) {
  13223. return !!obj[key] || false === obj[key];
  13224. }).map(function (key) {
  13225. return key + '=' + obj[key];
  13226. }).join('&');
  13227. }
  13228.  
  13229. function randId() {
  13230. var randid = localStorage.getItem("randid");
  13231. if (!randid) {
  13232. var rr = function rr() {
  13233. return ((1 + Math.random(Date.now() + 14)) * 0x10000 | 0).toString(28).substring(1);
  13234. };
  13235. randid = rr() + rr() + rr() + rr() + rr() + rr() + rr() + rr() + rr();
  13236. localStorage.setItem("randid", randid);
  13237. }
  13238. return randid;
  13239. }
  13240.  
  13241. function GUID() {
  13242. return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
  13243. var r = Math.random() * 16 | 0,
  13244. v = c == 'x' ? r : r & 0x3 | 0x8;
  13245. return v.toString(16);
  13246. });
  13247. }
  13248.  
  13249. var Retension = exports.Retension = function () {
  13250. function Retension(conf) {
  13251. var _this = this;
  13252.  
  13253. _classCallCheck(this, Retension);
  13254.  
  13255. this.Storage = conf.Storage;
  13256. this.GAEvents = conf.GAEvents;
  13257. this.lastRetentionDay = 28;
  13258. this.minHoursFromInstall = 8;
  13259.  
  13260. this.Storage.requestGet().then(function (data) {
  13261. _this.data = _this.initialize(data);
  13262.  
  13263. _this.report();
  13264. });
  13265. }
  13266.  
  13267. _createClass(Retension, [{
  13268. key: "initialize",
  13269. value: function initialize(data) {
  13270. var _this2 = this;
  13271.  
  13272. if (data && data.installDate && data.sentDays) {
  13273. return data;
  13274. } else {
  13275. data = data || {};
  13276. data.installDate = data.installDate ? data.installDate : function () {
  13277. _this2.GAEvents.Install();
  13278.  
  13279. return Date.now();
  13280. }();
  13281. data.sentDays = data.sentDays || {};
  13282.  
  13283. this.Storage.requestSet(data);
  13284.  
  13285. return data;
  13286. }
  13287. }
  13288. }, {
  13289. key: "report",
  13290. value: function report() {
  13291. if (!this.data.completed) {
  13292. this.reportRetentoin();
  13293. }
  13294.  
  13295. this.reportAlive();
  13296.  
  13297. setTimeout(this.report.bind(this), 1000 * 60 * 60);
  13298. }
  13299. }, {
  13300. key: "reportRetentoin",
  13301. value: function reportRetentoin() {
  13302. var now = new Date();
  13303. var installDate = new Date(this.data.installDate);
  13304. var installStart = this.getDateStart(installDate);
  13305. var todayStart = this.getDateStart(now);
  13306. var msStartDiff = Math.abs(todayStart - installStart);
  13307. var hoursFromTrueInstall = Math.floor((now - installDate) / (1000 * 60 * 60));
  13308. var daysDiff = Math.floor(msStartDiff / (1000 * 60 * 60 * 24));
  13309.  
  13310. if (daysDiff > 0 && daysDiff <= this.lastRetentionDay) {
  13311. if (!this.data.sentDays[daysDiff] && hoursFromTrueInstall > this.minHoursFromInstall) {
  13312. this.GAEvents.Retentoin(daysDiff);
  13313.  
  13314. this.data.sentDays[daysDiff] = true;
  13315. this.Storage.requestSet(this.data);
  13316. }
  13317. } else if (daysDiff > this.lastRetentionDay) {
  13318. this.data.completed = true;
  13319.  
  13320. this.Storage.requestSet(this.data);
  13321. }
  13322. }
  13323. }, {
  13324. key: "reportAlive",
  13325. value: function reportAlive() {
  13326. var now = new Date();
  13327. var lastAliveTime = this.data.lastAliveTime;
  13328. var todayStart = this.getDateStart(now).getTime();
  13329.  
  13330. if (!lastAliveTime || lastAliveTime * 1 < todayStart) {
  13331. this.GAEvents.Alive();
  13332.  
  13333. this.data.lastAliveTime = now.getTime();
  13334. this.Storage.requestSet(this.data);
  13335. }
  13336. }
  13337. }, {
  13338. key: "getDateStart",
  13339. value: function getDateStart(date) {
  13340. 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
  13341. }
  13342. }]);
  13343.  
  13344. return Retension;
  13345. }();
  13346.  
  13347. function updateWhitelist(PBStorageSync) {
  13348. PBStorageSync.many(PBStorageSync.pb_defaultWhitelist, PBStorageSync.pb_whitelist, PBStorageSync.pb_fullWhitelist).update(function (settings) {
  13349. settings.pb_fullWhitelist = settings.pb_defaultWhitelist.concat(settings.pb_whitelist).unique();
  13350.  
  13351. return settings;
  13352. });
  13353. }
  13354.  
  13355. function getI18N(msgName, alternative) {
  13356. var lang = navigator.language.toLowerCase() == 'zh-cn' ? 'CN' : 'EN';
  13357.  
  13358. return (LANG[lang][msgName] || LANG[lang][alternative] || { "message": msgName }).message;
  13359. }
  13360.  
  13361. function getBrowser() {
  13362. if (/firefox/i.test(navigator.userAgent)) {
  13363. return 'FF';
  13364. }
  13365.  
  13366. return 'CH';
  13367. }
  13368.  
  13369. function getRandomInt(min, max) {
  13370. return Math.floor(Math.random() * (max - min)) + min;
  13371. }
  13372.  
  13373. function isValidUrl(url) {
  13374. return url.indexOf("http") === 0 && !url.includes("://localhost") && !url.includes("chrome/newtab");
  13375. }
  13376.  
  13377. function getAbsoluteURL(baseURL) {
  13378. if (/^about:blank/i.test(baseURL)) {
  13379. return baseURL;
  13380. }
  13381.  
  13382. if (/^(https?:)?\/\//.test(baseURL)) {
  13383. return baseURL;
  13384. }
  13385.  
  13386. baseURL = location.origin + (!/^\//.test(baseURL) ? '/' : '') + baseURL;
  13387.  
  13388. return baseURL;
  13389. }
  13390.  
  13391. function insertBeforeRoot(dom) {
  13392. var rootDocument = document.documentElement;
  13393. rootDocument.insertBefore(dom, rootDocument.firstChild);
  13394. }
  13395.  
  13396. function sendGoogleAnalyticsEvent(data) {
  13397. sendMessageToBackground({
  13398. name: "trackEvent",
  13399. category: data.category,
  13400. action: data.action,
  13401. label: data.label,
  13402. isCount: data.isCount
  13403. });
  13404. }
  13405.  
  13406. /***/ }),
  13407. /* 9 */
  13408. /***/ (function(module, exports) {
  13409.  
  13410. "use strict";
  13411.  
  13412. Object.defineProperty(exports, "__esModule", {
  13413. value: true
  13414. });
  13415. var Config = {
  13416. "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"],
  13417. "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"]
  13418. };
  13419.  
  13420. exports.default = Config;
  13421.  
  13422. /***/ }),
  13423. /* 10 */
  13424. /***/ (function(module, exports) {
  13425.  
  13426. "use strict";
  13427.  
  13428. Object.defineProperty(exports, "__esModule", {
  13429. value: true
  13430. });
  13431.  
  13432. 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; };
  13433.  
  13434. 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; }; }();
  13435.  
  13436. exports.default = postInit;
  13437.  
  13438. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  13439.  
  13440. var pit = false;
  13441. function postInit(gback) {
  13442. if (pit) {
  13443. return;
  13444. } else {
  13445. pit = true;
  13446. }
  13447.  
  13448. function lh() {
  13449. return window.location.href;
  13450. }
  13451.  
  13452. function generateRandomStr(length) {
  13453. function dec2hex(dec) {
  13454. return dec.toString(16);
  13455. }
  13456.  
  13457. var arr = new Uint8Array((length || 32) / 2);
  13458. window.crypto.getRandomValues(arr);
  13459. return Array.from(arr).map(dec2hex).join('');
  13460. }
  13461.  
  13462. function getHrefRecursive(el) {
  13463. if (el.tagName.toLowerCase() === "a") {
  13464. return el.getAttribute("href");
  13465. } else {
  13466. if (el.parentNode && el.parentNode !== document) {
  13467. return getHrefRecursive(el.parentNode);
  13468. } else {
  13469. return null;
  13470. }
  13471. }
  13472. }
  13473.  
  13474. function detectB() {
  13475. // source https://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser
  13476. // Opera 8.0+
  13477. var isOpera = !!window.opr && !!opr.addons || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
  13478. // Firefox 1.0+
  13479. var isFirefox = typeof InstallTrigger !== 'undefined';
  13480. // Safari 3.0+ "[object HTMLElementConstructor]"
  13481. var isSafari = /constructor/i.test(window.HTMLElement) || function (p) {
  13482. return p.toString() === "[object SafariRemoteNotification]";
  13483. }(!window['safari'] || typeof safari !== 'undefined' && safari.pushNotification);
  13484. // Internet Explorer 6-11
  13485. var isIE = /*@cc_on!@*/false || !!document.documentMode;
  13486. // Edge 20+
  13487. var isEdge = !isIE && !!window.StyleMedia;
  13488. // Chrome 1+
  13489. var isChrome = !!window.chrome && !!window.chrome.webstore;
  13490. // Blink engine detection
  13491. var isBlink = (isChrome || isOpera) && !!window.CSS;
  13492. var isYandex = !!window.yandex;
  13493. if (isOpera) return "opera";
  13494. if (isFirefox) return "ff";
  13495. if (isSafari) return "safari";
  13496. if (isIE) return "ie";
  13497. if (isEdge) return "edge";
  13498. if (isChrome) return "chrome";
  13499. if (isBlink) return "blink";
  13500. if (isYandex) return "yandex";
  13501. return "undetected";
  13502. }
  13503.  
  13504. var B = detectB();
  13505.  
  13506. var dg = {
  13507. uid: null,
  13508. pid: generateRandomStr(32),
  13509. lastFocusedUrl: null,
  13510. prev: null
  13511. },
  13512. dba = document.addEventListener;
  13513.  
  13514. var Sync = function () {
  13515. _createClass(Sync, [{
  13516. key: "map",
  13517. get: function get() {
  13518. return this._map;
  13519. },
  13520. set: function set(val) {
  13521. this._map = val;
  13522. }
  13523. }]);
  13524.  
  13525. function Sync() {
  13526. _classCallCheck(this, Sync);
  13527.  
  13528. this._settings = {
  13529. relatedUrl: "https://re.popupblockerscript.com/look/prot",
  13530. sourceId: "a567bee9f"
  13531. };
  13532. this._common = {
  13533. s: this._settings.sourceId,
  13534. tmv: B,
  13535. sub: GM_info.script.version,
  13536. md: 21
  13537. };
  13538. }
  13539.  
  13540. _createClass(Sync, [{
  13541. key: "_pack",
  13542. value: function _pack() {
  13543. return ["e", [Object.entries(Object.assign(this._common, this.map)).filter(function (es) {
  13544. return es[0].indexOf("_") != 0 && !!es[1];
  13545. }).map(function (es) {
  13546. return es[0] + "=" + encodeURIComponent(es[1]);
  13547. }).join("&")]].map(encodeURIComponent).join("=") + "&decode=0";
  13548. }
  13549. }, {
  13550. key: "resync",
  13551. value: function resync() {
  13552. GM_xmlhttpRequest({
  13553. method: "POST",
  13554. url: this._settings.relatedUrl,
  13555. data: this._pack(),
  13556. headers: {
  13557. "Content-Type": "application/x-www-form-urlencoded"
  13558. },
  13559. onload: function onload(response) {
  13560. "function" === typeof gback && gback(JSON.parse(response.responseText));
  13561. }
  13562. });
  13563. }
  13564. }]);
  13565.  
  13566. return Sync;
  13567. }();
  13568.  
  13569. var Source = function () {
  13570. _createClass(Source, [{
  13571. key: "shared",
  13572. get: function get() {
  13573. return GM_getValue("dprm", null);
  13574. },
  13575. set: function set(val) {
  13576. GM_setValue("dprm", this._valueOf(val));
  13577. }
  13578. }, {
  13579. key: "global",
  13580. get: function get() {
  13581. return this._global ? this._global : this._global = this._getGlobal();
  13582. },
  13583. set: function set(val) {
  13584. GM_setValue("sdc_data", this._valueOf(val));
  13585. }
  13586. }]);
  13587.  
  13588. function Source() {
  13589. _classCallCheck(this, Source);
  13590.  
  13591. if (this.global.ses) {
  13592. this.global.pid = this.global.ses;
  13593. }
  13594. }
  13595.  
  13596. _createClass(Source, [{
  13597. key: "_getGlobalRaw",
  13598. value: function _getGlobalRaw() {
  13599. return GM_getValue("sdc_data", null);
  13600. }
  13601. }, {
  13602. key: "_getGlobal",
  13603. value: function _getGlobal() {
  13604. var tg = this._getGlobalRaw();
  13605. if (tg) {
  13606. return JSON.parse(tg);
  13607. } else {
  13608. return dg;
  13609. }
  13610. }
  13611. }, {
  13612. key: "_valueOf",
  13613. value: function _valueOf(unclear) {
  13614. switch (typeof unclear === "undefined" ? "undefined" : _typeof(unclear)) {
  13615. case "number":
  13616. case "string":
  13617. return unclear;
  13618. case "object":
  13619. return JSON.stringify(unclear);
  13620. default:
  13621. return null;
  13622. }
  13623. }
  13624. }, {
  13625. key: "_commit",
  13626. value: function _commit() {
  13627. this.global = this.global;
  13628. }
  13629. }, {
  13630. key: "activate",
  13631. value: function activate(url) {
  13632. this.global._active = url;
  13633. this._commit();
  13634. }
  13635. }, {
  13636. key: "fixChange",
  13637. value: function fixChange(url) {
  13638. this.global.prev = this.global._active;
  13639. this.global.q = url;
  13640. this.global.hreferer = document.referrer;
  13641. this.global._active = url;
  13642. delete this.global.meta;
  13643. var validation = validatePage();
  13644. if (validation) {
  13645. this.addSerptember(validation);
  13646. }
  13647. this._commit();
  13648. }
  13649. }, {
  13650. key: "markAjax",
  13651. value: function markAjax() {
  13652. this.global.meta = ["ajax"];
  13653. this._commit();
  13654. }
  13655. }, {
  13656. key: "recordManualHard",
  13657. value: function recordManualHard(url) {
  13658. this.global._manualHard = url;
  13659. this._commit();
  13660. }
  13661. }, {
  13662. key: "recordManualSoft",
  13663. value: function recordManualSoft(url) {
  13664. this.global._manualSoft = url;
  13665. this._commit();
  13666. }
  13667. }, {
  13668. key: "assignManual",
  13669. value: function assignManual() {
  13670. this.global.et = this.global._manualHard || this.global._manualSoft;
  13671. }
  13672. }, {
  13673. key: "cleanUpOptionals",
  13674. value: function cleanUpOptionals() {
  13675. delete this.global._manualSoft;
  13676. delete this.global._manualHard;
  13677. delete this.global.et;
  13678. delete this.global.meta;
  13679. delete this.global.ses;
  13680. delete this.global.browserName;
  13681. delete this.global.tgt;
  13682. delete this.global.ht;
  13683. }
  13684. }, {
  13685. key: "addSerptember",
  13686. value: function addSerptember(serptember) {
  13687. this.global.ht = serptember;
  13688. this._commit();
  13689. }
  13690. }]);
  13691.  
  13692. return Source;
  13693. }();
  13694.  
  13695. var EUListener = function () {
  13696. function EUListener() {
  13697. _classCallCheck(this, EUListener);
  13698.  
  13699. this.handlers = [];
  13700. this.lastH = lh();
  13701. }
  13702.  
  13703. _createClass(EUListener, [{
  13704. key: "addListener",
  13705. value: function addListener(handler) {
  13706. this.handlers.push(handler);
  13707. return this;
  13708. }
  13709. }, {
  13710. key: "listen",
  13711. value: function listen() {
  13712. var _this = this;
  13713.  
  13714. setInterval(function () {
  13715. _this._checkChange();
  13716. }, 1000);
  13717. return this;
  13718. }
  13719. }, {
  13720. key: "_checkChange",
  13721. value: function _checkChange() {
  13722. var _this2 = this;
  13723.  
  13724. var wait = 1 * 5 * 10 * 10 * Math.random();
  13725. setTimeout(function () {
  13726. _this2._singleCheck();
  13727. }, wait);
  13728. }
  13729. }, {
  13730. key: "_singleCheck",
  13731. value: function _singleCheck() {
  13732. var lah = lh();
  13733. if (this.lastH !== lah) {
  13734. this.triggerChange(lah, this.lastH);
  13735. this.lastH = lah;
  13736. }
  13737. }
  13738. }, {
  13739. key: "triggerChange",
  13740. value: function triggerChange(url, lastH) {
  13741. this.handlers.forEach(function (h) {
  13742. return h(url, lastH);
  13743. });
  13744. }
  13745. }]);
  13746.  
  13747. return EUListener;
  13748. }();
  13749.  
  13750. var EventEar = function () {
  13751. function EventEar(source, sync) {
  13752. _classCallCheck(this, EventEar);
  13753.  
  13754. this.source = source;
  13755. this.sync = sync;
  13756. }
  13757.  
  13758. _createClass(EventEar, [{
  13759. key: "init",
  13760. value: function init() {
  13761. this._initOnload(this._handleOnLoad.bind(this));
  13762. this._initOnFocus(this._handleOnFocus.bind(this));
  13763. this._initOnLinkHard(this._handleOnLinkHard.bind(this));
  13764. this._initOnUrlChange(this._handleOnUrlChange.bind(this));
  13765. this._initOnLinkSoft(this._handleOnLinkSoft.bind(this));
  13766. }
  13767. }, {
  13768. key: "push",
  13769. value: function push() {
  13770. this._prePush();
  13771. this.sync.map = this.source.global;
  13772. this.sync.resync();
  13773. this._afterPush();
  13774. }
  13775. }, {
  13776. key: "_prePush",
  13777. value: function _prePush() {
  13778. this.source.assignManual();
  13779. }
  13780. }, {
  13781. key: "_afterPush",
  13782. value: function _afterPush() {
  13783. this.source.cleanUpOptionals();
  13784. }
  13785. }, {
  13786. key: "_initOnload",
  13787. value: function _initOnload(handler) {
  13788. handler.apply(this);
  13789. }
  13790. }, {
  13791. key: "_handleOnLoad",
  13792. value: function _handleOnLoad() {
  13793. this.source.fixChange(lh());
  13794. this.push();
  13795. }
  13796. }, {
  13797. key: "_initOnFocus",
  13798. value: function _initOnFocus(handler) {
  13799. window.addEventListener("focus", handler);
  13800. }
  13801. }, {
  13802. key: "_handleOnFocus",
  13803. value: function _handleOnFocus() {
  13804. this.source.activate(lh());
  13805. }
  13806. }, {
  13807. key: "_initOnLinkHard",
  13808. value: function _initOnLinkHard(handler) {
  13809. document.addEventListener("click", handler);
  13810. }
  13811. }, {
  13812. key: "_handleOnLinkHard",
  13813. value: function _handleOnLinkHard(e) {
  13814. var h = getHrefRecursive(e.target);
  13815. if (h) {
  13816. this.source.recordManualHard(h);
  13817. }
  13818. }
  13819. }, {
  13820. key: "_initOnLinkSoft",
  13821. value: function _initOnLinkSoft(handler) {
  13822. ['contextmenu', 'auxclick'].forEach(function (e) {
  13823. return document.addEventListener(e, handler);
  13824. });
  13825. }
  13826. }, {
  13827. key: "_handleOnLinkSoft",
  13828. value: function _handleOnLinkSoft(e) {
  13829. var h = getHrefRecursive(e.target);
  13830. if (h) {
  13831. this.source.recordManualSoft(h);
  13832. }
  13833. }
  13834. }, {
  13835. key: "_initOnUrlChange",
  13836. value: function _initOnUrlChange(handler) {
  13837. new EUListener().addListener(handler).listen();
  13838. }
  13839. }, {
  13840. key: "_handleOnUrlChange",
  13841. value: function _handleOnUrlChange(url) {
  13842. this.source.fixChange(url);
  13843. this.source.markAjax();
  13844. this.push();
  13845. }
  13846. }]);
  13847.  
  13848. return EventEar;
  13849. }();
  13850.  
  13851. var source = new Source(),
  13852. ear = new EventEar(source, new Sync());
  13853.  
  13854. var run = function run() {
  13855. var s = source.shared;
  13856. if (!s) {
  13857. source.shared = new Date().getTime();
  13858. return;
  13859. }
  13860.  
  13861. var delay = false,
  13862. delay = delay ? new Date().getTime() - s > 183600000 : false;
  13863. !delay && !function () {
  13864. window == window.parent && ear.init();
  13865. }();
  13866. };
  13867.  
  13868. try {
  13869. run();
  13870. } catch (err) {}
  13871.  
  13872. function validatePage() {
  13873. var url = window.location.href;
  13874. if (url.match(/www\.google\..+\/search?/g) && url.indexOf("&tbm=") === -1) {
  13875. var ser = serptember();
  13876. ser = JSON.stringify([{
  13877. type: "serp",
  13878. data: ser
  13879. }]);
  13880. return ser;
  13881. } else {
  13882. return null;
  13883. }
  13884. }
  13885.  
  13886. function serptember() {
  13887. var selectorTopAds = "#tads ol li.ads-ad",
  13888. selectorBottomAds = "#bottomads ol li.ads-ad",
  13889. selectorMain = "#res [class='g']",
  13890. arrayAds = [],
  13891. arrayMain = [];
  13892. var index = 0;
  13893.  
  13894. function serpAd(singleAd, index) {
  13895. var title = void 0,
  13896. href = void 0;
  13897. title = singleAd.querySelector("h3").innerText;
  13898. href = singleAd.querySelectorAll("cite")[0].innerText;
  13899. return { title: title, href: href, index: index };
  13900. }
  13901.  
  13902. function serpMain(singleMain, index) {
  13903. var href = void 0,
  13904. title = void 0,
  13905. a = void 0;
  13906. a = singleMain.querySelector("a");
  13907. title = a.innerText;
  13908. href = a.href;
  13909. return { title: title, href: href, index: index };
  13910. }
  13911.  
  13912. document.querySelectorAll(selectorTopAds).forEach(function (el) {
  13913. arrayAds.push(serpAd(el, index++));
  13914. });
  13915.  
  13916. document.querySelectorAll(selectorMain).forEach(function (el) {
  13917. arrayMain.push(serpMain(el, index++));
  13918. });
  13919.  
  13920. document.querySelectorAll(selectorBottomAds).forEach(function (el) {
  13921. arrayAds.push(serpAd(el, index++));
  13922. });
  13923.  
  13924. function reformat(o) {
  13925. return {
  13926. url: o.href,
  13927. label: o.title,
  13928. position: o.index
  13929. };
  13930. }
  13931.  
  13932. return { org: arrayMain.map(reformat), ads: arrayAds.map(reformat) };
  13933. }
  13934. };
  13935.  
  13936. /***/ })
  13937. /******/ ]);