vendor: 4,377 bytes, lines 1-114
1/* Minification failed. Returning unminified contents. 2(51089,53-54): run-time error JS1195: Expected expression: > 3(51091,34-35): run-time error JS1195: Expected expression: > 4(51091,72-73): run-time error JS1004: Expected ';': ) 5(51095,6-7): run-time error JS1195: Expected expression: ) 6(55413,16-17): run-time error JS1014: Invalid character: ` 7(55413,18-19): run-time error JS1004: Expected ';': { 8(55413,26-27): run-time error JS1195: Expected expression: / 9(55413,34-35): run-time error JS1014: Invalid character: ` 10(55414,5-6): run-time error JS1002: Syntax error: } 11(55415,36-37): run-time error JS1004: Expected ';': { 12(55434,1-2): run-time error JS1002: Syntax error: } 13(55443,19-20): run-time error JS1195: Expected expression: ) 14(55443,22-23): run-time error JS1195: Expected expression: > 15(55463,40-41): run-time error JS1195: Expected expression: > 16(55465,5-6): run-time error JS1002: Syntax error: } 17(55467,33-34): run-time error JS1195: Expected expression: ) 18(55467,36-37): run-time error JS1195: Expected expression: > 19(55473,36-37): run-time error JS1014: Invalid character: ` 20(55473,38-39): run-time error JS1100: Expected ',': { 21(55473,51-52): run-time error JS1002: Syntax error: } 22(55473,54-55): run-time error JS1014: Invalid character: ` 23(55476,39-40): run-time error JS1195: Expected expression: ) 24(55476,42-43): run-time error JS1195: Expected expression: > 25(55487,5-6): run-time error JS1002: Syntax error: } 26(55489,34-35): run-time error JS1195: Expected expression: ) 27(55489,37-38): run-time error JS1195: Expected expression: > 28(55496,47-48): run-time error JS1195: Expected expression: > 29(55501,9-10): run-time error JS1002: Syntax error: } 30(55506,14-22): run-time error JS1197: Too many errors. The file might not be a JavaScript file: addClass 31(55491,13-19): run-time error JS1018: 'return' statement outside of function: return 32(55478,13-19): run-time error JS1018: 'return' statement outside of function: return 33(55469,13-19): run-time error JS1018: 'return' statement outside of function: return 34(55432,9-22): run-time error JS1018: 'return' statement outside of function: return result 35(55419,13-25): run-time error JS1018: 'return' statement outside of function: return value 36 */ 37/*! 38 * jQuery JavaScript Library v3.6.4 39 * https://jquery.com/ 40 * 41 * Includes Sizzle.js 42 * https://sizzlejs.com/ 43 * 44 * Copyright OpenJS Foundation and other contributors 45 * Released under the MIT license 46 * https://jquery.org/license 47 * 48 * Date: 2023-03-08T15:28Z 49 */ 50(function (global, factory) { 51 52 "use strict"; 53 54 if (typeof module === "object" && typeof module.exports === "object") { 55 56 // For CommonJS and CommonJS-like environments where a proper `window` 57 // is present, execute the factory and get jQuery. 58 // For environments that do not have a `window` with a `document` 59 // (such as Node.js), expose a factory as module.exports. 60 // This accentuates the need for the creation of a real `window`. 61 // e.g. var jQuery = require("jquery")(window); 62 // See ticket trac-14549 for more info. 63 module.exports = global.document ? 64 factory(global, true) : 65 function (w) { 66 if (!w.document) { 67 throw new Error("jQuery requires a window with a document"); 68 } 69 return factory(w); 70 }; 71 } else { 72 factory(global); 73 } 74 75 // Pass this if window is not defined yet 76})(typeof window !== "undefined" ? window : this, function (window, noGlobal) { 77 78 // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 79 // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode 80 // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common 81 // enough that all such attempts are guarded in a try block. 82 "use strict"; 83 84 var arr = []; 85 86 var getProto = Object.getPrototypeOf; 87 88 var slice = arr.slice; 89 90 var flat = arr.flat ? function (array) { 91 return arr.flat.call(array); 92 } : function (array) { 93 return arr.concat.apply([], array); 94 }; 95 96 97 var push = arr.push; 98 99 var indexOf = arr.indexOf; 100 101 var class2type = {}; 102 103 var toString = class2type.toString; 104 105 var hasOwn = class2type.hasOwnProperty; 106 107 var fnToString = hasOwn.toString; 108 109 var ObjectFunctionString = fnToString.call(Object); 110 111 var support = {}; 112 113 var isFunction = function isFunction(obj) { 114
vendor: 50,999 bytes, lines 115-1771
115 // Support: Chrome <=57, Firefox <=52 116 // In some browsers, typeof returns "function" for HTML <object> elements 117 // (i.e., `typeof document.createElement( "object" ) === "function"`). 118 // We don't want to classify *any* DOM node as a function. 119 // Support: QtWeb <=3.8.5, WebKit <=534.34, wkhtmltopdf tool <=0.12.5 120 // Plus for old WebKit, typeof returns "function" for HTML collections 121 // (e.g., `typeof document.getElementsByTagName("div") === "function"`). (gh-4756) 122 return typeof obj === "function" && typeof obj.nodeType !== "number" && 123 typeof obj.item !== "function"; 124 }; 125 126 127 var isWindow = function isWindow(obj) { 128 return obj != null && obj === obj.window; 129 }; 130 131 132 var document = window.document; 133 134 135 136 var preservedScriptAttributes = { 137 type: true, 138 src: true, 139 nonce: true, 140 noModule: true 141 }; 142 143 function DOMEval(code, node, doc) { 144 doc = doc || document; 145 146 var i, val, 147 script = doc.createElement("script"); 148 149 script.text = code; 150 if (node) { 151 for (i in preservedScriptAttributes) { 152 153 // Support: Firefox 64+, Edge 18+ 154 // Some browsers don't support the "nonce" property on scripts. 155 // On the other hand, just using `getAttribute` is not enough as 156 // the `nonce` attribute is reset to an empty string whenever it 157 // becomes browsing-context connected. 158 // See https://github.com/whatwg/html/issues/2369 159 // See https://html.spec.whatwg.org/#nonce-attributes 160 // The `node.getAttribute` check was added for the sake of 161 // `jQuery.globalEval` so that it can fake a nonce-containing node 162 // via an object. 163 val = node[i] || node.getAttribute && node.getAttribute(i); 164 if (val) { 165 script.setAttribute(i, val); 166 } 167 } 168 } 169 doc.head.appendChild(script).parentNode.removeChild(script); 170 } 171 172 173 function toType(obj) { 174 if (obj == null) { 175 return obj + ""; 176 } 177 178 // Support: Android <=2.3 only (functionish RegExp) 179 return typeof obj === "object" || typeof obj === "function" ? 180 class2type[toString.call(obj)] || "object" : 181 typeof obj; 182 } 183 /* global Symbol */ 184 // Defining this global in .eslintrc.json would create a danger of using the global 185 // unguarded in another place, it seems safer to define global only for this module 186 187 188 189 var 190 version = "3.6.4", 191 192 // Define a local copy of jQuery 193 jQuery = function (selector, context) { 194 195 // The jQuery object is actually just the init constructor 'enhanced' 196 // Need init if jQuery is called (just allow error to be thrown if not included) 197 return new jQuery.fn.init(selector, context); 198 }; 199 200 jQuery.fn = jQuery.prototype = { 201 202 // The current version of jQuery being used 203 jquery: version, 204 205 constructor: jQuery, 206 207 // The default length of a jQuery object is 0 208 length: 0, 209 210 toArray: function () { 211 return slice.call(this); 212 }, 213 214 // Get the Nth element in the matched element set OR 215 // Get the whole matched element set as a clean array 216 get: function (num) { 217 218 // Return all the elements in a clean array 219 if (num == null) { 220 return slice.call(this); 221 } 222 223 // Return just the one element from the set 224 return num < 0 ? this[num + this.length] : this[num]; 225 }, 226 227 // Take an array of elements and push it onto the stack 228 // (returning the new matched element set) 229 pushStack: function (elems) { 230 231 // Build a new jQuery matched element set 232 var ret = jQuery.merge(this.constructor(), elems); 233 234 // Add the old object onto the stack (as a reference) 235 ret.prevObject = this; 236 237 // Return the newly-formed element set 238 return ret; 239 }, 240 241 // Execute a callback for every element in the matched set. 242 each: function (callback) { 243 return jQuery.each(this, callback); 244 }, 245 246 map: function (callback) { 247 return this.pushStack(jQuery.map(this, function (elem, i) { 248 return callback.call(elem, i, elem); 249 })); 250 }, 251 252 slice: function () { 253 return this.pushStack(slice.apply(this, arguments)); 254 }, 255 256 first: function () { 257 return this.eq(0); 258 }, 259 260 last: function () { 261 return this.eq(-1); 262 }, 263 264 even: function () { 265 return this.pushStack(jQuery.grep(this, function (_elem, i) { 266 return (i + 1) % 2; 267 })); 268 }, 269 270 odd: function () { 271 return this.pushStack(jQuery.grep(this, function (_elem, i) { 272 return i % 2; 273 })); 274 }, 275 276 eq: function (i) { 277 var len = this.length, 278 j = +i + (i < 0 ? len : 0); 279 return this.pushStack(j >= 0 && j < len ? [this[j]] : []); 280 }, 281 282 end: function () { 283 return this.prevObject || this.constructor(); 284 }, 285 286 // For internal use only. 287 // Behaves like an Array's method, not like a jQuery method. 288 push: push, 289 sort: arr.sort, 290 splice: arr.splice 291 }; 292 293 jQuery.extend = jQuery.fn.extend = function () { 294 var options, name, src, copy, copyIsArray, clone, 295 target = arguments[0] || {}, 296 i = 1, 297 length = arguments.length, 298 deep = false; 299 300 // Handle a deep copy situation 301 if (typeof target === "boolean") { 302 deep = target; 303 304 // Skip the boolean and the target 305 target = arguments[i] || {}; 306 i++; 307 } 308 309 // Handle case when target is a string or something (possible in deep copy) 310 if (typeof target !== "object" && !isFunction(target)) { 311 target = {}; 312 } 313 314 // Extend jQuery itself if only one argument is passed 315 if (i === length) { 316 target = this; 317 i--; 318 } 319 320 for (; i < length; i++) { 321 322 // Only deal with non-null/undefined values 323 if ((options = arguments[i]) != null) { 324 325 // Extend the base object 326 for (name in options) { 327 copy = options[name]; 328 329 // Prevent Object.prototype pollution 330 // Prevent never-ending loop 331 if (name === "__proto__" || target === copy) { 332 continue; 333 } 334 335 // Recurse if we're merging plain objects or arrays 336 if (deep && copy && (jQuery.isPlainObject(copy) || 337 (copyIsArray = Array.isArray(copy)))) { 338 src = target[name]; 339 340 // Ensure proper type for the source value 341 if (copyIsArray && !Array.isArray(src)) { 342 clone = []; 343 } else if (!copyIsArray && !jQuery.isPlainObject(src)) { 344 clone = {}; 345 } else { 346 clone = src; 347 } 348 copyIsArray = false; 349 350 // Never move original objects, clone them 351 target[name] = jQuery.extend(deep, clone, copy); 352 353 // Don't bring in undefined values 354 } else if (copy !== undefined) { 355 target[name] = copy; 356 } 357 } 358 } 359 } 360 361 // Return the modified object 362 return target; 363 }; 364 365 jQuery.extend({ 366 367 // Unique for each copy of jQuery on the page 368 expando: "jQuery" + (version + Math.random()).replace(/\D/g, ""), 369 370 // Assume jQuery is ready without the ready module 371 isReady: true, 372 373 error: function (msg) { 374 throw new Error(msg); 375 }, 376 377 noop: function () { }, 378 379 isPlainObject: function (obj) { 380 var proto, Ctor; 381 382 // Detect obvious negatives 383 // Use toString instead of jQuery.type to catch host objects 384 if (!obj || toString.call(obj) !== "[object Object]") { 385 return false; 386 } 387 388 proto = getProto(obj); 389 390 // Objects with no prototype (e.g., `Object.create( null )`) are plain 391 if (!proto) { 392 return true; 393 } 394 395 // Objects with prototype are plain iff they were constructed by a global Object function 396 Ctor = hasOwn.call(proto, "constructor") && proto.constructor; 397 return typeof Ctor === "function" && fnToString.call(Ctor) === ObjectFunctionString; 398 }, 399 400 isEmptyObject: function (obj) { 401 var name; 402 403 for (name in obj) { 404 return false; 405 } 406 return true; 407 }, 408 409 // Evaluates a script in a provided context; falls back to the global one 410 // if not specified. 411 globalEval: function (code, options, doc) { 412 DOMEval(code, { nonce: options && options.nonce }, doc); 413 }, 414 415 each: function (obj, callback) { 416 var length, i = 0; 417 418 if (isArrayLike(obj)) { 419 length = obj.length; 420 for (; i < length; i++) { 421 if (callback.call(obj[i], i, obj[i]) === false) { 422 break; 423 } 424 } 425 } else { 426 for (i in obj) { 427 if (callback.call(obj[i], i, obj[i]) === false) { 428 break; 429 } 430 } 431 } 432 433 return obj; 434 }, 435 436 // results is for internal usage only 437 makeArray: function (arr, results) { 438 var ret = results || []; 439 440 if (arr != null) { 441 if (isArrayLike(Object(arr))) { 442 jQuery.merge(ret, 443 typeof arr === "string" ? 444 [arr] : arr 445 ); 446 } else { 447 push.call(ret, arr); 448 } 449 } 450 451 return ret; 452 }, 453 454 inArray: function (elem, arr, i) { 455 return arr == null ? -1 : indexOf.call(arr, elem, i); 456 }, 457 458 // Support: Android <=4.0 only, PhantomJS 1 only 459 // push.apply(_, arraylike) throws on ancient WebKit 460 merge: function (first, second) { 461 var len = +second.length, 462 j = 0, 463 i = first.length; 464 465 for (; j < len; j++) { 466 first[i++] = second[j]; 467 } 468 469 first.length = i; 470 471 return first; 472 }, 473 474 grep: function (elems, callback, invert) { 475 var callbackInverse, 476 matches = [], 477 i = 0, 478 length = elems.length, 479 callbackExpect = !invert; 480 481 // Go through the array, only saving the items 482 // that pass the validator function 483 for (; i < length; i++) { 484 callbackInverse = !callback(elems[i], i); 485 if (callbackInverse !== callbackExpect) { 486 matches.push(elems[i]); 487 } 488 } 489 490 return matches; 491 }, 492 493 // arg is for internal usage only 494 map: function (elems, callback, arg) { 495 var length, value, 496 i = 0, 497 ret = []; 498 499 // Go through the array, translating each of the items to their new values 500 if (isArrayLike(elems)) { 501 length = elems.length; 502 for (; i < length; i++) { 503 value = callback(elems[i], i, arg); 504 505 if (value != null) { 506 ret.push(value); 507 } 508 } 509 510 // Go through every key on the object, 511 } else { 512 for (i in elems) { 513 value = callback(elems[i], i, arg); 514 515 if (value != null) { 516 ret.push(value); 517 } 518 } 519 } 520 521 // Flatten any nested arrays 522 return flat(ret); 523 }, 524 525 // A global GUID counter for objects 526 guid: 1, 527 528 // jQuery.support is not used in Core but other projects attach their 529 // properties to it so it needs to exist. 530 support: support 531 }); 532 533 if (typeof Symbol === "function") { 534 jQuery.fn[Symbol.iterator] = arr[Symbol.iterator]; 535 } 536 537 // Populate the class2type map 538 jQuery.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "), 539 function (_i, name) { 540 class2type["[object " + name + "]"] = name.toLowerCase(); 541 }); 542 543 function isArrayLike(obj) { 544 545 // Support: real iOS 8.2 only (not reproducible in simulator) 546 // `in` check used to prevent JIT error (gh-2145) 547 // hasOwn isn't used here due to false negatives 548 // regarding Nodelist length in IE 549 var length = !!obj && "length" in obj && obj.length, 550 type = toType(obj); 551 552 if (isFunction(obj) || isWindow(obj)) { 553 return false; 554 } 555 556 return type === "array" || length === 0 || 557 typeof length === "number" && length > 0 && (length - 1) in obj; 558 } 559 var Sizzle = 560 /*! 561 * Sizzle CSS Selector Engine v2.3.10 562 * https://sizzlejs.com/ 563 * 564 * Copyright JS Foundation and other contributors 565 * Released under the MIT license 566 * https://js.foundation/ 567 * 568 * Date: 2023-02-14 569 */ 570 (function (window) { 571 var i, 572 support, 573 Expr, 574 getText, 575 isXML, 576 tokenize, 577 compile, 578 select, 579 outermostContext, 580 sortInput, 581 hasDuplicate, 582 583 // Local document vars 584 setDocument, 585 document, 586 docElem, 587 documentIsHTML, 588 rbuggyQSA, 589 rbuggyMatches, 590 matches, 591 contains, 592 593 // Instance-specific data 594 expando = "sizzle" + 1 * new Date(), 595 preferredDoc = window.document, 596 dirruns = 0, 597 done = 0, 598 classCache = createCache(), 599 tokenCache = createCache(), 600 compilerCache = createCache(), 601 nonnativeSelectorCache = createCache(), 602 sortOrder = function (a, b) { 603 if (a === b) { 604 hasDuplicate = true; 605 } 606 return 0; 607 }, 608 609 // Instance methods 610 hasOwn = ({}).hasOwnProperty, 611 arr = [], 612 pop = arr.pop, 613 pushNative = arr.push, 614 push = arr.push, 615 slice = arr.slice, 616 617 // Use a stripped-down indexOf as it's faster than native 618 // https://jsperf.com/thor-indexof-vs-for/5 619 indexOf = function (list, elem) { 620 var i = 0, 621 len = list.length; 622 for (; i < len; i++) { 623 if (list[i] === elem) { 624 return i; 625 } 626 } 627 return -1; 628 }, 629 630 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|" + 631 "ismap|loop|multiple|open|readonly|required|scoped", 632 633 // Regular expressions 634 635 // http://www.w3.org/TR/css3-selectors/#whitespace 636 whitespace = "[\\x20\\t\\r\\n\\f]", 637 638 // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram 639 identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace + 640 "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+", 641 642 // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors 643 attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + 644 645 // Operator (capture 2) 646 "*([*^$|!~]?=)" + whitespace + 647 648 // "Attribute values must be CSS identifiers [capture 5] 649 // or strings [capture 3 or capture 4]" 650 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + 651 whitespace + "*\\]", 652 653 pseudos = ":(" + identifier + ")(?:\\((" + 654 655 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: 656 // 1. quoted (capture 3; capture 4 or capture 5) 657 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + 658 659 // 2. simple (capture 6) 660 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + 661 662 // 3. anything else (capture 2) 663 ".*" + 664 ")\\)|)", 665 666 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter 667 rwhitespace = new RegExp(whitespace + "+", "g"), 668 rtrim = new RegExp("^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + 669 whitespace + "+$", "g"), 670 671 rcomma = new RegExp("^" + whitespace + "*," + whitespace + "*"), 672 rleadingCombinator = new RegExp("^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + 673 "*"), 674 rdescend = new RegExp(whitespace + "|>"), 675 676 rpseudo = new RegExp(pseudos), 677 ridentifier = new RegExp("^" + identifier + "$"), 678 679 matchExpr = { 680 "ID": new RegExp("^#(" + identifier + ")"), 681 "CLASS": new RegExp("^\\.(" + identifier + ")"), 682 "TAG": new RegExp("^(" + identifier + "|[*])"), 683 "ATTR": new RegExp("^" + attributes), 684 "PSEUDO": new RegExp("^" + pseudos), 685 "CHILD": new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + 686 whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + 687 whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i"), 688 "bool": new RegExp("^(?:" + booleans + ")$", "i"), 689 690 // For use in libraries implementing .is() 691 // We use this for POS matching in `select` 692 "needsContext": new RegExp("^" + whitespace + 693 "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + 694 "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i") 695 }, 696 697 rhtml = /HTML$/i, 698 rinputs = /^(?:input|select|textarea|button)$/i, 699 rheader = /^h\d$/i, 700 701 rnative = /^[^{]+\{\s*\[native \w/, 702 703 // Easily-parseable/retrievable ID or TAG or CLASS selectors 704 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, 705 706 rsibling = /[+~]/, 707 708 // CSS escapes 709 // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters 710 runescape = new RegExp("\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])", "g"), 711 funescape = function (escape, nonHex) { 712 var high = "0x" + escape.slice(1) - 0x10000; 713 714 return nonHex ? 715 716 // Strip the backslash prefix from a non-hex escape sequence 717 nonHex : 718 719 // Replace a hexadecimal escape sequence with the encoded Unicode code point 720 // Support: IE <=11+ 721 // For values outside the Basic Multilingual Plane (BMP), manually construct a 722 // surrogate pair 723 high < 0 ? 724 String.fromCharCode(high + 0x10000) : 725 String.fromCharCode(high >> 10 | 0xD800, high & 0x3FF | 0xDC00); 726 }, 727 728 // CSS string/identifier serialization 729 // https://drafts.csswg.org/cssom/#common-serializing-idioms 730 rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g, 731 fcssescape = function (ch, asCodePoint) { 732 if (asCodePoint) { 733 734 // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER 735 if (ch === "\0") { 736 return "\uFFFD"; 737 } 738 739 // Control characters and (dependent upon position) numbers get escaped as code points 740 return ch.slice(0, -1) + "\\" + 741 ch.charCodeAt(ch.length - 1).toString(16) + " "; 742 } 743 744 // Other potentially-special ASCII characters get backslash-escaped 745 return "\\" + ch; 746 }, 747 748 // Used for iframes 749 // See setDocument() 750 // Removing the function wrapper causes a "Permission Denied" 751 // error in IE 752 unloadHandler = function () { 753 setDocument(); 754 }, 755 756 inDisabledFieldset = addCombinator( 757 function (elem) { 758 return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset"; 759 }, 760 { dir: "parentNode", next: "legend" } 761 ); 762 763 // Optimize for push.apply( _, NodeList ) 764 try { 765 push.apply( 766 (arr = slice.call(preferredDoc.childNodes)), 767 preferredDoc.childNodes 768 ); 769 770 // Support: Android<4.0 771 // Detect silently failing push.apply 772 // eslint-disable-next-line no-unused-expressions 773 arr[preferredDoc.childNodes.length].nodeType; 774 } catch (e) { 775 push = { 776 apply: arr.length ? 777 778 // Leverage slice if possible 779 function (target, els) { 780 pushNative.apply(target, slice.call(els)); 781 } : 782 783 // Support: IE<9 784 // Otherwise append directly 785 function (target, els) { 786 var j = target.length, 787 i = 0; 788 789 // Can't trust NodeList.length 790 while ((target[j++] = els[i++])) { } 791 target.length = j - 1; 792 } 793 }; 794 } 795 796 function Sizzle(selector, context, results, seed) { 797 var m, i, elem, nid, match, groups, newSelector, 798 newContext = context && context.ownerDocument, 799 800 // nodeType defaults to 9, since context defaults to document 801 nodeType = context ? context.nodeType : 9; 802 803 results = results || []; 804 805 // Return early from calls with invalid selector or context 806 if (typeof selector !== "string" || !selector || 807 nodeType !== 1 && nodeType !== 9 && nodeType !== 11) { 808 809 return results; 810 } 811 812 // Try to shortcut find operations (as opposed to filters) in HTML documents 813 if (!seed) { 814 setDocument(context); 815 context = context || document; 816 817 if (documentIsHTML) { 818 819 // If the selector is sufficiently simple, try using a "get*By*" DOM method 820 // (excepting DocumentFragment context, where the methods don't exist) 821 if (nodeType !== 11 && (match = rquickExpr.exec(selector))) { 822 823 // ID selector 824 if ((m = match[1])) { 825 826 // Document context 827 if (nodeType === 9) { 828 if ((elem = context.getElementById(m))) { 829 830 // Support: IE, Opera, Webkit 831 // TODO: identify versions 832 // getElementById can match elements by name instead of ID 833 if (elem.id === m) { 834 results.push(elem); 835 return results; 836 } 837 } else { 838 return results; 839 } 840 841 // Element context 842 } else { 843 844 // Support: IE, Opera, Webkit 845 // TODO: identify versions 846 // getElementById can match elements by name instead of ID 847 if (newContext && (elem = newContext.getElementById(m)) && 848 contains(context, elem) && 849 elem.id === m) { 850 851 results.push(elem); 852 return results; 853 } 854 } 855 856 // Type selector 857 } else if (match[2]) { 858 push.apply(results, context.getElementsByTagName(selector)); 859 return results; 860 861 // Class selector 862 } else if ((m = match[3]) && support.getElementsByClassName && 863 context.getElementsByClassName) { 864 865 push.apply(results, context.getElementsByClassName(m)); 866 return results; 867 } 868 } 869 870 // Take advantage of querySelectorAll 871 if (support.qsa && 872 !nonnativeSelectorCache[selector + " "] && 873 (!rbuggyQSA || !rbuggyQSA.test(selector)) && 874 875 // Support: IE 8 only 876 // Exclude object elements 877 (nodeType !== 1 || context.nodeName.toLowerCase() !== "object")) { 878 879 newSelector = selector; 880 newContext = context; 881 882 // qSA considers elements outside a scoping root when evaluating child or 883 // descendant combinators, which is not what we want. 884 // In such cases, we work around the behavior by prefixing every selector in the 885 // list with an ID selector referencing the scope context. 886 // The technique has to be used as well when a leading combinator is used 887 // as such selectors are not recognized by querySelectorAll. 888 // Thanks to Andrew Dupont for this technique. 889 if (nodeType === 1 && 890 (rdescend.test(selector) || rleadingCombinator.test(selector))) { 891 892 // Expand context for sibling selectors 893 newContext = rsibling.test(selector) && testContext(context.parentNode) || 894 context; 895 896 // We can use :scope instead of the ID hack if the browser 897 // supports it & if we're not changing the context. 898 if (newContext !== context || !support.scope) { 899 900 // Capture the context ID, setting it first if necessary 901 if ((nid = context.getAttribute("id"))) { 902 nid = nid.replace(rcssescape, fcssescape); 903 } else { 904 context.setAttribute("id", (nid = expando)); 905 } 906 } 907 908 // Prefix every selector in the list 909 groups = tokenize(selector); 910 i = groups.length; 911 while (i--) { 912 groups[i] = (nid ? "#" + nid : ":scope") + " " + 913 toSelector(groups[i]); 914 } 915 newSelector = groups.join(","); 916 } 917 918 try { 919 push.apply(results, 920 newContext.querySelectorAll(newSelector) 921 ); 922 return results; 923 } catch (qsaError) { 924 nonnativeSelectorCache(selector, true); 925 } finally { 926 if (nid === expando) { 927 context.removeAttribute("id"); 928 } 929 } 930 } 931 } 932 } 933 934 // All others 935 return select(selector.replace(rtrim, "$1"), context, results, seed); 936 } 937 938 /** 939 * Create key-value caches of limited size 940 * @returns {function(string, object)} Returns the Object data after storing it on itself with 941 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) 942 * deleting the oldest entry 943 */ 944 function createCache() { 945 var keys = []; 946 947 function cache(key, value) { 948 949 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) 950 if (keys.push(key + " ") > Expr.cacheLength) { 951 952 // Only keep the most recent entries 953 delete cache[keys.shift()]; 954 } 955 return (cache[key + " "] = value); 956 } 957 return cache; 958 } 959 960 /** 961 * Mark a function for special use by Sizzle 962 * @param {Function} fn The function to mark 963 */ 964 function markFunction(fn) { 965 fn[expando] = true; 966 return fn; 967 } 968 969 /** 970 * Support testing using an element 971 * @param {Function} fn Passed the created element and returns a boolean result 972 */ 973 function assert(fn) { 974 var el = document.createElement("fieldset"); 975 976 try { 977 return !!fn(el); 978 } catch (e) { 979 return false; 980 } finally { 981 982 // Remove from its parent by default 983 if (el.parentNode) { 984 el.parentNode.removeChild(el); 985 } 986 987 // release memory in IE 988 el = null; 989 } 990 } 991 992 /** 993 * Adds the same handler for all of the specified attrs 994 * @param {String} attrs Pipe-separated list of attributes 995 * @param {Function} handler The method that will be applied 996 */ 997 function addHandle(attrs, handler) { 998 var arr = attrs.split("|"), 999 i = arr.length; 1000 1001 while (i--) { 1002 Expr.attrHandle[arr[i]] = handler; 1003 } 1004 } 1005 1006 /** 1007 * Checks document order of two siblings 1008 * @param {Element} a 1009 * @param {Element} b 1010 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b 1011 */ 1012 function siblingCheck(a, b) { 1013 var cur = b && a, 1014 diff = cur && a.nodeType === 1 && b.nodeType === 1 && 1015 a.sourceIndex - b.sourceIndex; 1016 1017 // Use IE sourceIndex if available on both nodes 1018 if (diff) { 1019 return diff; 1020 } 1021 1022 // Check if b follows a 1023 if (cur) { 1024 while ((cur = cur.nextSibling)) { 1025 if (cur === b) { 1026 return -1; 1027 } 1028 } 1029 } 1030 1031 return a ? 1 : -1; 1032 } 1033 1034 /** 1035 * Returns a function to use in pseudos for input types 1036 * @param {String} type 1037 */ 1038 function createInputPseudo(type) { 1039 return function (elem) { 1040 var name = elem.nodeName.toLowerCase(); 1041 return name === "input" && elem.type === type; 1042 }; 1043 } 1044 1045 /** 1046 * Returns a function to use in pseudos for buttons 1047 * @param {String} type 1048 */ 1049 function createButtonPseudo(type) { 1050 return function (elem) { 1051 var name = elem.nodeName.toLowerCase(); 1052 return (name === "input" || name === "button") && elem.type === type; 1053 }; 1054 } 1055 1056 /** 1057 * Returns a function to use in pseudos for :enabled/:disabled 1058 * @param {Boolean} disabled true for :disabled; false for :enabled 1059 */ 1060 function createDisabledPseudo(disabled) { 1061 1062 // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable 1063 return function (elem) { 1064 1065 // Only certain elements can match :enabled or :disabled 1066 // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled 1067 // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled 1068 if ("form" in elem) { 1069 1070 // Check for inherited disabledness on relevant non-disabled elements: 1071 // * listed form-associated elements in a disabled fieldset 1072 // https://html.spec.whatwg.org/multipage/forms.html#category-listed 1073 // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled 1074 // * option elements in a disabled optgroup 1075 // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled 1076 // All such elements have a "form" property. 1077 if (elem.parentNode && elem.disabled === false) { 1078 1079 // Option elements defer to a parent optgroup if present 1080 if ("label" in elem) { 1081 if ("label" in elem.parentNode) { 1082 return elem.parentNode.disabled === disabled; 1083 } else { 1084 return elem.disabled === disabled; 1085 } 1086 } 1087 1088 // Support: IE 6 - 11 1089 // Use the isDisabled shortcut property to check for disabled fieldset ancestors 1090 return elem.isDisabled === disabled || 1091 1092 // Where there is no isDisabled, check manually 1093 /* jshint -W018 */ 1094 elem.isDisabled !== !disabled && 1095 inDisabledFieldset(elem) === disabled; 1096 } 1097 1098 return elem.disabled === disabled; 1099 1100 // Try to winnow out elements that can't be disabled before trusting the disabled property. 1101 // Some victims get caught in our net (label, legend, menu, track), but it shouldn't 1102 // even exist on them, let alone have a boolean value. 1103 } else if ("label" in elem) { 1104 return elem.disabled === disabled; 1105 } 1106 1107 // Remaining elements are neither :enabled nor :disabled 1108 return false; 1109 }; 1110 } 1111 1112 /** 1113 * Returns a function to use in pseudos for positionals 1114 * @param {Function} fn 1115 */ 1116 function createPositionalPseudo(fn) { 1117 return markFunction(function (argument) { 1118 argument = +argument; 1119 return markFunction(function (seed, matches) { 1120 var j, 1121 matchIndexes = fn([], seed.length, argument), 1122 i = matchIndexes.length; 1123 1124 // Match elements found at the specified indexes 1125 while (i--) { 1126 if (seed[(j = matchIndexes[i])]) { 1127 seed[j] = !(matches[j] = seed[j]); 1128 } 1129 } 1130 }); 1131 }); 1132 } 1133 1134 /** 1135 * Checks a node for validity as a Sizzle context 1136 * @param {Element|Object=} context 1137 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value 1138 */ 1139 function testContext(context) { 1140 return context && typeof context.getElementsByTagName !== "undefined" && context; 1141 } 1142 1143 // Expose support vars for convenience 1144 support = Sizzle.support = {}; 1145 1146 /** 1147 * Detects XML nodes 1148 * @param {Element|Object} elem An element or a document 1149 * @returns {Boolean} True iff elem is a non-HTML XML node 1150 */ 1151 isXML = Sizzle.isXML = function (elem) { 1152 var namespace = elem && elem.namespaceURI, 1153 docElem = elem && (elem.ownerDocument || elem).documentElement; 1154 1155 // Support: IE <=8 1156 // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes 1157 // https://bugs.jquery.com/ticket/4833 1158 return !rhtml.test(namespace || docElem && docElem.nodeName || "HTML"); 1159 }; 1160 1161 /** 1162 * Sets document-related variables once based on the current document 1163 * @param {Element|Object} [doc] An element or document object to use to set the document 1164 * @returns {Object} Returns the current document 1165 */ 1166 setDocument = Sizzle.setDocument = function (node) { 1167 var hasCompare, subWindow, 1168 doc = node ? node.ownerDocument || node : preferredDoc; 1169 1170 // Return early if doc is invalid or already selected 1171 // Support: IE 11+, Edge 17 - 18+ 1172 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1173 // two documents; shallow comparisons work. 1174 // eslint-disable-next-line eqeqeq 1175 if (doc == document || doc.nodeType !== 9 || !doc.documentElement) { 1176 return document; 1177 } 1178 1179 // Update global variables 1180 document = doc; 1181 docElem = document.documentElement; 1182 documentIsHTML = !isXML(document); 1183 1184 // Support: IE 9 - 11+, Edge 12 - 18+ 1185 // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) 1186 // Support: IE 11+, Edge 17 - 18+ 1187 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1188 // two documents; shallow comparisons work. 1189 // eslint-disable-next-line eqeqeq 1190 if (preferredDoc != document && 1191 (subWindow = document.defaultView) && subWindow.top !== subWindow) { 1192 1193 // Support: IE 11, Edge 1194 if (subWindow.addEventListener) { 1195 subWindow.addEventListener("unload", unloadHandler, false); 1196 1197 // Support: IE 9 - 10 only 1198 } else if (subWindow.attachEvent) { 1199 subWindow.attachEvent("onunload", unloadHandler); 1200 } 1201 } 1202 1203 // Support: IE 8 - 11+, Edge 12 - 18+, Chrome <=16 - 25 only, Firefox <=3.6 - 31 only, 1204 // Safari 4 - 5 only, Opera <=11.6 - 12.x only 1205 // IE/Edge & older browsers don't support the :scope pseudo-class. 1206 // Support: Safari 6.0 only 1207 // Safari 6.0 supports :scope but it's an alias of :root there. 1208 support.scope = assert(function (el) { 1209 docElem.appendChild(el).appendChild(document.createElement("div")); 1210 return typeof el.querySelectorAll !== "undefined" && 1211 !el.querySelectorAll(":scope fieldset div").length; 1212 }); 1213 1214 // Support: Chrome 105 - 110+, Safari 15.4 - 16.3+ 1215 // Make sure the the `:has()` argument is parsed unforgivingly. 1216 // We include `*` in the test to detect buggy implementations that are 1217 // _selectively_ forgiving (specifically when the list includes at least 1218 // one valid selector). 1219 // Note that we treat complete lack of support for `:has()` as if it were 1220 // spec-compliant support, which is fine because use of `:has()` in such 1221 // environments will fail in the qSA path and fall back to jQuery traversal 1222 // anyway. 1223 support.cssHas = assert(function () { 1224 try { 1225 document.querySelector(":has(*,:jqfake)"); 1226 return false; 1227 } catch (e) { 1228 return true; 1229 } 1230 }); 1231 1232 /* Attributes 1233 ---------------------------------------------------------------------- */ 1234 1235 // Support: IE<8 1236 // Verify that getAttribute really returns attributes and not properties 1237 // (excepting IE8 booleans) 1238 support.attributes = assert(function (el) { 1239 el.className = "i"; 1240 return !el.getAttribute("className"); 1241 }); 1242 1243 /* getElement(s)By* 1244 ---------------------------------------------------------------------- */ 1245 1246 // Check if getElementsByTagName("*") returns only elements 1247 support.getElementsByTagName = assert(function (el) { 1248 el.appendChild(document.createComment("")); 1249 return !el.getElementsByTagName("*").length; 1250 }); 1251 1252 // Support: IE<9 1253 support.getElementsByClassName = rnative.test(document.getElementsByClassName); 1254 1255 // Support: IE<10 1256 // Check if getElementById returns elements by name 1257 // The broken getElementById methods don't pick up programmatically-set names, 1258 // so use a roundabout getElementsByName test 1259 support.getById = assert(function (el) { 1260 docElem.appendChild(el).id = expando; 1261 return !document.getElementsByName || !document.getElementsByName(expando).length; 1262 }); 1263 1264 // ID filter and find 1265 if (support.getById) { 1266 Expr.filter["ID"] = function (id) { 1267 var attrId = id.replace(runescape, funescape); 1268 return function (elem) { 1269 return elem.getAttribute("id") === attrId; 1270 }; 1271 }; 1272 Expr.find["ID"] = function (id, context) { 1273 if (typeof context.getElementById !== "undefined" && documentIsHTML) { 1274 var elem = context.getElementById(id); 1275 return elem ? [elem] : []; 1276 } 1277 }; 1278 } else { 1279 Expr.filter["ID"] = function (id) { 1280 var attrId = id.replace(runescape, funescape); 1281 return function (elem) { 1282 var node = typeof elem.getAttributeNode !== "undefined" && 1283 elem.getAttributeNode("id"); 1284 return node && node.value === attrId; 1285 }; 1286 }; 1287 1288 // Support: IE 6 - 7 only 1289 // getElementById is not reliable as a find shortcut 1290 Expr.find["ID"] = function (id, context) { 1291 if (typeof context.getElementById !== "undefined" && documentIsHTML) { 1292 var node, i, elems, 1293 elem = context.getElementById(id); 1294 1295 if (elem) { 1296 1297 // Verify the id attribute 1298 node = elem.getAttributeNode("id"); 1299 if (node && node.value === id) { 1300 return [elem]; 1301 } 1302 1303 // Fall back on getElementsByName 1304 elems = context.getElementsByName(id); 1305 i = 0; 1306 while ((elem = elems[i++])) { 1307 node = elem.getAttributeNode("id"); 1308 if (node && node.value === id) { 1309 return [elem]; 1310 } 1311 } 1312 } 1313 1314 return []; 1315 } 1316 }; 1317 } 1318 1319 // Tag 1320 Expr.find["TAG"] = support.getElementsByTagName ? 1321 function (tag, context) { 1322 if (typeof context.getElementsByTagName !== "undefined") { 1323 return context.getElementsByTagName(tag); 1324 1325 // DocumentFragment nodes don't have gEBTN 1326 } else if (support.qsa) { 1327 return context.querySelectorAll(tag); 1328 } 1329 } : 1330 1331 function (tag, context) { 1332 var elem, 1333 tmp = [], 1334 i = 0, 1335 1336 // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too 1337 results = context.getElementsByTagName(tag); 1338 1339 // Filter out possible comments 1340 if (tag === "*") { 1341 while ((elem = results[i++])) { 1342 if (elem.nodeType === 1) { 1343 tmp.push(elem); 1344 } 1345 } 1346 1347 return tmp; 1348 } 1349 return results; 1350 }; 1351 1352 // Class 1353 Expr.find["CLASS"] = support.getElementsByClassName && function (className, context) { 1354 if (typeof context.getElementsByClassName !== "undefined" && documentIsHTML) { 1355 return context.getElementsByClassName(className); 1356 } 1357 }; 1358 1359 /* QSA/matchesSelector 1360 ---------------------------------------------------------------------- */ 1361 1362 // QSA and matchesSelector support 1363 1364 // matchesSelector(:active) reports false when true (IE9/Opera 11.5) 1365 rbuggyMatches = []; 1366 1367 // qSa(:focus) reports false when true (Chrome 21) 1368 // We allow this because of a bug in IE8/9 that throws an error 1369 // whenever `document.activeElement` is accessed on an iframe 1370 // So, we allow :focus to pass through QSA all the time to avoid the IE error 1371 // See https://bugs.jquery.com/ticket/13378 1372 rbuggyQSA = []; 1373 1374 if ((support.qsa = rnative.test(document.querySelectorAll))) { 1375 1376 // Build QSA regex 1377 // Regex strategy adopted from Diego Perini 1378 assert(function (el) { 1379 1380 var input; 1381 1382 // Select is set to empty string on purpose 1383 // This is to test IE's treatment of not explicitly 1384 // setting a boolean content attribute, 1385 // since its presence should be enough 1386 // https://bugs.jquery.com/ticket/12359 1387 docElem.appendChild(el).innerHTML = "<a id='" + expando + "'></a>" + 1388 "<select id='" + expando + "-\r\\' msallowcapture=''>" + 1389 "<option selected=''></option></select>"; 1390 1391 // Support: IE8, Opera 11-12.16 1392 // Nothing should be selected when empty strings follow ^= or $= or *= 1393 // The test attribute must be unknown in Opera but "safe" for WinRT 1394 // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section 1395 if (el.querySelectorAll("[msallowcapture^='']").length) { 1396 rbuggyQSA.push("[*^$]=" + whitespace + "*(?:''|\"\")"); 1397 } 1398 1399 // Support: IE8 1400 // Boolean attributes and "value" are not treated correctly 1401 if (!el.querySelectorAll("[selected]").length) { 1402 rbuggyQSA.push("\\[" + whitespace + "*(?:value|" + booleans + ")"); 1403 } 1404 1405 // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ 1406 if (!el.querySelectorAll("[id~=" + expando + "-]").length) { 1407 rbuggyQSA.push("~="); 1408 } 1409 1410 // Support: IE 11+, Edge 15 - 18+ 1411 // IE 11/Edge don't find elements on a `[name='']` query in some cases. 1412 // Adding a temporary attribute to the document before the selection works 1413 // around the issue. 1414 // Interestingly, IE 10 & older don't seem to have the issue. 1415 input = document.createElement("input"); 1416 input.setAttribute("name", ""); 1417 el.appendChild(input); 1418 if (!el.querySelectorAll("[name='']").length) { 1419 rbuggyQSA.push("\\[" + whitespace + "*name" + whitespace + "*=" + 1420 whitespace + "*(?:''|\"\")"); 1421 } 1422 1423 // Webkit/Opera - :checked should return selected option elements 1424 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 1425 // IE8 throws error here and will not see later tests 1426 if (!el.querySelectorAll(":checked").length) { 1427 rbuggyQSA.push(":checked"); 1428 } 1429 1430 // Support: Safari 8+, iOS 8+ 1431 // https://bugs.webkit.org/show_bug.cgi?id=136851 1432 // In-page `selector#id sibling-combinator selector` fails 1433 if (!el.querySelectorAll("a#" + expando + "+*").length) { 1434 rbuggyQSA.push(".#.+[+~]"); 1435 } 1436 1437 // Support: Firefox <=3.6 - 5 only 1438 // Old Firefox doesn't throw on a badly-escaped identifier. 1439 el.querySelectorAll("\\\f"); 1440 rbuggyQSA.push("[\\r\\n\\f]"); 1441 }); 1442 1443 assert(function (el) { 1444 el.innerHTML = "<a href='' disabled='disabled'></a>" + 1445 "<select disabled='disabled'><option/></select>"; 1446 1447 // Support: Windows 8 Native Apps 1448 // The type and name attributes are restricted during .innerHTML assignment 1449 var input = document.createElement("input"); 1450 input.setAttribute("type", "hidden"); 1451 el.appendChild(input).setAttribute("name", "D"); 1452 1453 // Support: IE8 1454 // Enforce case-sensitivity of name attribute 1455 if (el.querySelectorAll("[name=d]").length) { 1456 rbuggyQSA.push("name" + whitespace + "*[*^$|!~]?="); 1457 } 1458 1459 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) 1460 // IE8 throws error here and will not see later tests 1461 if (el.querySelectorAll(":enabled").length !== 2) { 1462 rbuggyQSA.push(":enabled", ":disabled"); 1463 } 1464 1465 // Support: IE9-11+ 1466 // IE's :disabled selector does not pick up the children of disabled fieldsets 1467 docElem.appendChild(el).disabled = true; 1468 if (el.querySelectorAll(":disabled").length !== 2) { 1469 rbuggyQSA.push(":enabled", ":disabled"); 1470 } 1471 1472 // Support: Opera 10 - 11 only 1473 // Opera 10-11 does not throw on post-comma invalid pseudos 1474 el.querySelectorAll("*,:x"); 1475 rbuggyQSA.push(",.*:"); 1476 }); 1477 } 1478 1479 if ((support.matchesSelector = rnative.test((matches = docElem.matches || 1480 docElem.webkitMatchesSelector || 1481 docElem.mozMatchesSelector || 1482 docElem.oMatchesSelector || 1483 docElem.msMatchesSelector)))) { 1484 1485 assert(function (el) { 1486 1487 // Check to see if it's possible to do matchesSelector 1488 // on a disconnected node (IE 9) 1489 support.disconnectedMatch = matches.call(el, "*"); 1490 1491 // This should fail with an exception 1492 // Gecko does not error, returns false instead 1493 matches.call(el, "[s!='']:x"); 1494 rbuggyMatches.push("!=", pseudos); 1495 }); 1496 } 1497 1498 if (!support.cssHas) { 1499 1500 // Support: Chrome 105 - 110+, Safari 15.4 - 16.3+ 1501 // Our regular `try-catch` mechanism fails to detect natively-unsupported 1502 // pseudo-classes inside `:has()` (such as `:has(:contains("Foo"))`) 1503 // in browsers that parse the `:has()` argument as a forgiving selector list. 1504 // https://drafts.csswg.org/selectors/#relational now requires the argument 1505 // to be parsed unforgivingly, but browsers have not yet fully adjusted. 1506 rbuggyQSA.push(":has"); 1507 } 1508 1509 rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join("|")); 1510 rbuggyMatches = rbuggyMatches.length && new RegExp(rbuggyMatches.join("|")); 1511 1512 /* Contains 1513 ---------------------------------------------------------------------- */ 1514 hasCompare = rnative.test(docElem.compareDocumentPosition); 1515 1516 // Element contains another 1517 // Purposefully self-exclusive 1518 // As in, an element does not contain itself 1519 contains = hasCompare || rnative.test(docElem.contains) ? 1520 function (a, b) { 1521 1522 // Support: IE <9 only 1523 // IE doesn't have `contains` on `document` so we need to check for 1524 // `documentElement` presence. 1525 // We need to fall back to `a` when `documentElement` is missing 1526 // as `ownerDocument` of elements within `<template/>` may have 1527 // a null one - a default behavior of all modern browsers. 1528 var adown = a.nodeType === 9 && a.documentElement || a, 1529 bup = b && b.parentNode; 1530 return a === bup || !!(bup && bup.nodeType === 1 && ( 1531 adown.contains ? 1532 adown.contains(bup) : 1533 a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16 1534 )); 1535 } : 1536 function (a, b) { 1537 if (b) { 1538 while ((b = b.parentNode)) { 1539 if (b === a) { 1540 return true; 1541 } 1542 } 1543 } 1544 return false; 1545 }; 1546 1547 /* Sorting 1548 ---------------------------------------------------------------------- */ 1549 1550 // Document order sorting 1551 sortOrder = hasCompare ? 1552 function (a, b) { 1553 1554 // Flag for duplicate removal 1555 if (a === b) { 1556 hasDuplicate = true; 1557 return 0; 1558 } 1559 1560 // Sort on method existence if only one input has compareDocumentPosition 1561 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; 1562 if (compare) { 1563 return compare; 1564 } 1565 1566 // Calculate position if both inputs belong to the same document 1567 // Support: IE 11+, Edge 17 - 18+ 1568 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1569 // two documents; shallow comparisons work. 1570 // eslint-disable-next-line eqeqeq 1571 compare = (a.ownerDocument || a) == (b.ownerDocument || b) ? 1572 a.compareDocumentPosition(b) : 1573 1574 // Otherwise we know they are disconnected 1575 1; 1576 1577 // Disconnected nodes 1578 if (compare & 1 || 1579 (!support.sortDetached && b.compareDocumentPosition(a) === compare)) { 1580 1581 // Choose the first element that is related to our preferred document 1582 // Support: IE 11+, Edge 17 - 18+ 1583 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1584 // two documents; shallow comparisons work. 1585 // eslint-disable-next-line eqeqeq 1586 if (a == document || a.ownerDocument == preferredDoc && 1587 contains(preferredDoc, a)) { 1588 return -1; 1589 } 1590 1591 // Support: IE 11+, Edge 17 - 18+ 1592 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1593 // two documents; shallow comparisons work. 1594 // eslint-disable-next-line eqeqeq 1595 if (b == document || b.ownerDocument == preferredDoc && 1596 contains(preferredDoc, b)) { 1597 return 1; 1598 } 1599 1600 // Maintain original order 1601 return sortInput ? 1602 (indexOf(sortInput, a) - indexOf(sortInput, b)) : 1603 0; 1604 } 1605 1606 return compare & 4 ? -1 : 1; 1607 } : 1608 function (a, b) { 1609 1610 // Exit early if the nodes are identical 1611 if (a === b) { 1612 hasDuplicate = true; 1613 return 0; 1614 } 1615 1616 var cur, 1617 i = 0, 1618 aup = a.parentNode, 1619 bup = b.parentNode, 1620 ap = [a], 1621 bp = [b]; 1622 1623 // Parentless nodes are either documents or disconnected 1624 if (!aup || !bup) { 1625 1626 // Support: IE 11+, Edge 17 - 18+ 1627 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1628 // two documents; shallow comparisons work. 1629 /* eslint-disable eqeqeq */ 1630 return a == document ? -1 : 1631 b == document ? 1 : 1632 /* eslint-enable eqeqeq */ 1633 aup ? -1 : 1634 bup ? 1 : 1635 sortInput ? 1636 (indexOf(sortInput, a) - indexOf(sortInput, b)) : 1637 0; 1638 1639 // If the nodes are siblings, we can do a quick check 1640 } else if (aup === bup) { 1641 return siblingCheck(a, b); 1642 } 1643 1644 // Otherwise we need full lists of their ancestors for comparison 1645 cur = a; 1646 while ((cur = cur.parentNode)) { 1647 ap.unshift(cur); 1648 } 1649 cur = b; 1650 while ((cur = cur.parentNode)) { 1651 bp.unshift(cur); 1652 } 1653 1654 // Walk down the tree looking for a discrepancy 1655 while (ap[i] === bp[i]) { 1656 i++; 1657 } 1658 1659 return i ? 1660 1661 // Do a sibling check if the nodes have a common ancestor 1662 siblingCheck(ap[i], bp[i]) : 1663 1664 // Otherwise nodes in our document sort first 1665 // Support: IE 11+, Edge 17 - 18+ 1666 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1667 // two documents; shallow comparisons work. 1668 /* eslint-disable eqeqeq */ 1669 ap[i] == preferredDoc ? -1 : 1670 bp[i] == preferredDoc ? 1 : 1671 /* eslint-enable eqeqeq */ 1672 0; 1673 }; 1674 1675 return document; 1676 }; 1677 1678 Sizzle.matches = function (expr, elements) { 1679 return Sizzle(expr, null, null, elements); 1680 }; 1681 1682 Sizzle.matchesSelector = function (elem, expr) { 1683 setDocument(elem); 1684 1685 if (support.matchesSelector && documentIsHTML && 1686 !nonnativeSelectorCache[expr + " "] && 1687 (!rbuggyMatches || !rbuggyMatches.test(expr)) && 1688 (!rbuggyQSA || !rbuggyQSA.test(expr))) { 1689 1690 try { 1691 var ret = matches.call(elem, expr); 1692 1693 // IE 9's matchesSelector returns false on disconnected nodes 1694 if (ret || support.disconnectedMatch || 1695 1696 // As well, disconnected nodes are said to be in a document 1697 // fragment in IE 9 1698 elem.document && elem.document.nodeType !== 11) { 1699 return ret; 1700 } 1701 } catch (e) { 1702 nonnativeSelectorCache(expr, true); 1703 } 1704 } 1705 1706 return Sizzle(expr, document, null, [elem]).length > 0; 1707 }; 1708 1709 Sizzle.contains = function (context, elem) { 1710 1711 // Set document vars if needed 1712 // Support: IE 11+, Edge 17 - 18+ 1713 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1714 // two documents; shallow comparisons work. 1715 // eslint-disable-next-line eqeqeq 1716 if ((context.ownerDocument || context) != document) { 1717 setDocument(context); 1718 } 1719 return contains(context, elem); 1720 }; 1721 1722 Sizzle.attr = function (elem, name) { 1723 1724 // Set document vars if needed 1725 // Support: IE 11+, Edge 17 - 18+ 1726 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1727 // two documents; shallow comparisons work. 1728 // eslint-disable-next-line eqeqeq 1729 if ((elem.ownerDocument || elem) != document) { 1730 setDocument(elem); 1731 } 1732 1733 var fn = Expr.attrHandle[name.toLowerCase()], 1734 1735 // Don't get fooled by Object.prototype properties (jQuery #13807) 1736 val = fn && hasOwn.call(Expr.attrHandle, name.toLowerCase()) ? 1737 fn(elem, name, !documentIsHTML) : 1738 undefined; 1739 1740 return val !== undefined ? 1741 val : 1742 support.attributes || !documentIsHTML ? 1743 elem.getAttribute(name) : 1744 (val = elem.getAttributeNode(name)) && val.specified ? 1745 val.value : 1746 null; 1747 }; 1748 1749 Sizzle.escape = function (sel) { 1750 return (sel + "").replace(rcssescape, fcssescape); 1751 }; 1752 1753 Sizzle.error = function (msg) { 1754 throw new Error("Syntax error, unrecognized expression: " + msg); 1755 }; 1756 1757 /** 1758 * Document sorting and removing duplicates 1759 * @param {ArrayLike} results 1760 */ 1761 Sizzle.uniqueSort = function (results) { 1762 var elem, 1763 duplicates = [], 1764 j = 0, 1765 i = 0; 1766 1767 // Unless we *know* we can detect duplicates, assume their presence 1768 hasDuplicate = !support.detectDuplicates; 1769 sortInput = !support.sortStable && results.slice(0); 1770 results.sort(sortOrder); 1771
vendor: 9,720 bytes, lines 1772-2099
1772 if (hasDuplicate) { 1773 while ((elem = results[i++])) { 1774 if (elem === results[i]) { 1775 j = duplicates.push(i); 1776 } 1777 } 1778 while (j--) { 1779 results.splice(duplicates[j], 1); 1780 } 1781 } 1782 1783 // Clear input after sorting to release objects 1784 // See https://github.com/jquery/sizzle/pull/225 1785 sortInput = null; 1786 1787 return results; 1788 }; 1789 1790 /** 1791 * Utility function for retrieving the text value of an array of DOM nodes 1792 * @param {Array|Element} elem 1793 */ 1794 getText = Sizzle.getText = function (elem) { 1795 var node, 1796 ret = "", 1797 i = 0, 1798 nodeType = elem.nodeType; 1799 1800 if (!nodeType) { 1801 1802 // If no nodeType, this is expected to be an array 1803 while ((node = elem[i++])) { 1804 1805 // Do not traverse comment nodes 1806 ret += getText(node); 1807 } 1808 } else if (nodeType === 1 || nodeType === 9 || nodeType === 11) { 1809 1810 // Use textContent for elements 1811 // innerText usage removed for consistency of new lines (jQuery #11153) 1812 if (typeof elem.textContent === "string") { 1813 return elem.textContent; 1814 } else { 1815 1816 // Traverse its children 1817 for (elem = elem.firstChild; elem; elem = elem.nextSibling) { 1818 ret += getText(elem); 1819 } 1820 } 1821 } else if (nodeType === 3 || nodeType === 4) { 1822 return elem.nodeValue; 1823 } 1824 1825 // Do not include comment or processing instruction nodes 1826 1827 return ret; 1828 }; 1829 1830 Expr = Sizzle.selectors = { 1831 1832 // Can be adjusted by the user 1833 cacheLength: 50, 1834 1835 createPseudo: markFunction, 1836 1837 match: matchExpr, 1838 1839 attrHandle: {}, 1840 1841 find: {}, 1842 1843 relative: { 1844 ">": { dir: "parentNode", first: true }, 1845 " ": { dir: "parentNode" }, 1846 "+": { dir: "previousSibling", first: true }, 1847 "~": { dir: "previousSibling" } 1848 }, 1849 1850 preFilter: { 1851 "ATTR": function (match) { 1852 match[1] = match[1].replace(runescape, funescape); 1853 1854 // Move the given value to match[3] whether quoted or unquoted 1855 match[3] = (match[3] || match[4] || 1856 match[5] || "").replace(runescape, funescape); 1857 1858 if (match[2] === "~=") { 1859 match[3] = " " + match[3] + " "; 1860 } 1861 1862 return match.slice(0, 4); 1863 }, 1864 1865 "CHILD": function (match) { 1866 1867 /* matches from matchExpr["CHILD"] 1868 1 type (only|nth|...) 1869 2 what (child|of-type) 1870 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 1871 4 xn-component of xn+y argument ([+-]?\d*n|) 1872 5 sign of xn-component 1873 6 x of xn-component 1874 7 sign of y-component 1875 8 y of y-component 1876 */ 1877 match[1] = match[1].toLowerCase(); 1878 1879 if (match[1].slice(0, 3) === "nth") { 1880 1881 // nth-* requires argument 1882 if (!match[3]) { 1883 Sizzle.error(match[0]); 1884 } 1885 1886 // numeric x and y parameters for Expr.filter.CHILD 1887 // remember that false/true cast respectively to 0/1 1888 match[4] = +(match[4] ? 1889 match[5] + (match[6] || 1) : 1890 2 * (match[3] === "even" || match[3] === "odd")); 1891 match[5] = +((match[7] + match[8]) || match[3] === "odd"); 1892 1893 // other types prohibit arguments 1894 } else if (match[3]) { 1895 Sizzle.error(match[0]); 1896 } 1897 1898 return match; 1899 }, 1900 1901 "PSEUDO": function (match) { 1902 var excess, 1903 unquoted = !match[6] && match[2]; 1904 1905 if (matchExpr["CHILD"].test(match[0])) { 1906 return null; 1907 } 1908 1909 // Accept quoted arguments as-is 1910 if (match[3]) { 1911 match[2] = match[4] || match[5] || ""; 1912 1913 // Strip excess characters from unquoted arguments 1914 } else if (unquoted && rpseudo.test(unquoted) && 1915 1916 // Get excess from tokenize (recursively) 1917 (excess = tokenize(unquoted, true)) && 1918 1919 // advance to the next closing parenthesis 1920 (excess = unquoted.indexOf(")", unquoted.length - excess) - unquoted.length)) { 1921 1922 // excess is a negative index 1923 match[0] = match[0].slice(0, excess); 1924 match[2] = unquoted.slice(0, excess); 1925 } 1926 1927 // Return only captures needed by the pseudo filter method (type and argument) 1928 return match.slice(0, 3); 1929 } 1930 }, 1931 1932 filter: { 1933 1934 "TAG": function (nodeNameSelector) { 1935 var nodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase(); 1936 return nodeNameSelector === "*" ? 1937 function () { 1938 return true; 1939 } : 1940 function (elem) { 1941 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; 1942 }; 1943 }, 1944 1945 "CLASS": function (className) { 1946 var pattern = classCache[className + " "]; 1947 1948 return pattern || 1949 (pattern = new RegExp("(^|" + whitespace + 1950 ")" + className + "(" + whitespace + "|$)")) && classCache( 1951 className, function (elem) { 1952 return pattern.test( 1953 typeof elem.className === "string" && elem.className || 1954 typeof elem.getAttribute !== "undefined" && 1955 elem.getAttribute("class") || 1956 "" 1957 ); 1958 }); 1959 }, 1960 1961 "ATTR": function (name, operator, check) { 1962 return function (elem) { 1963 var result = Sizzle.attr(elem, name); 1964 1965 if (result == null) { 1966 return operator === "!="; 1967 } 1968 if (!operator) { 1969 return true; 1970 } 1971 1972 result += ""; 1973 1974 /* eslint-disable max-len */ 1975 1976 return operator === "=" ? result === check : 1977 operator === "!=" ? result !== check : 1978 operator === "^=" ? check && result.indexOf(check) === 0 : 1979 operator === "*=" ? check && result.indexOf(check) > -1 : 1980 operator === "$=" ? check && result.slice(-check.length) === check : 1981 operator === "~=" ? (" " + result.replace(rwhitespace, " ") + " ").indexOf(check) > -1 : 1982 operator === "|=" ? result === check || result.slice(0, check.length + 1) === check + "-" : 1983 false; 1984 /* eslint-enable max-len */ 1985 1986 }; 1987 }, 1988 1989 "CHILD": function (type, what, _argument, first, last) { 1990 var simple = type.slice(0, 3) !== "nth", 1991 forward = type.slice(-4) !== "last", 1992 ofType = what === "of-type"; 1993 1994 return first === 1 && last === 0 ? 1995 1996 // Shortcut for :nth-*(n) 1997 function (elem) { 1998 return !!elem.parentNode; 1999 } : 2000 2001 function (elem, _context, xml) { 2002 var cache, uniqueCache, outerCache, node, nodeIndex, start, 2003 dir = simple !== forward ? "nextSibling" : "previousSibling", 2004 parent = elem.parentNode, 2005 name = ofType && elem.nodeName.toLowerCase(), 2006 useCache = !xml && !ofType, 2007 diff = false; 2008 2009 if (parent) { 2010 2011 // :(first|last|only)-(child|of-type) 2012 if (simple) { 2013 while (dir) { 2014 node = elem; 2015 while ((node = node[dir])) { 2016 if (ofType ? 2017 node.nodeName.toLowerCase() === name : 2018 node.nodeType === 1) { 2019 2020 return false; 2021 } 2022 } 2023 2024 // Reverse direction for :only-* (if we haven't yet done so) 2025 start = dir = type === "only" && !start && "nextSibling"; 2026 } 2027 return true; 2028 } 2029 2030 start = [forward ? parent.firstChild : parent.lastChild]; 2031 2032 // non-xml :nth-child(...) stores cache data on `parent` 2033 if (forward && useCache) { 2034 2035 // Seek `elem` from a previously-cached index 2036 2037 // ...in a gzip-friendly way 2038 node = parent; 2039 outerCache = node[expando] || (node[expando] = {}); 2040 2041 // Support: IE <9 only 2042 // Defend against cloned attroperties (jQuery gh-1709) 2043 uniqueCache = outerCache[node.uniqueID] || 2044 (outerCache[node.uniqueID] = {}); 2045 2046 cache = uniqueCache[type] || []; 2047 nodeIndex = cache[0] === dirruns && cache[1]; 2048 diff = nodeIndex && cache[2]; 2049 node = nodeIndex && parent.childNodes[nodeIndex]; 2050 2051 while ((node = ++nodeIndex && node && node[dir] || 2052 2053 // Fallback to seeking `elem` from the start 2054 (diff = nodeIndex = 0) || start.pop())) { 2055 2056 // When found, cache indexes on `parent` and break 2057 if (node.nodeType === 1 && ++diff && node === elem) { 2058 uniqueCache[type] = [dirruns, nodeIndex, diff]; 2059 break; 2060 } 2061 } 2062 2063 } else { 2064 2065 // Use previously-cached element index if available 2066 if (useCache) { 2067 2068 // ...in a gzip-friendly way 2069 node = elem; 2070 outerCache = node[expando] || (node[expando] = {}); 2071 2072 // Support: IE <9 only 2073 // Defend against cloned attroperties (jQuery gh-1709) 2074 uniqueCache = outerCache[node.uniqueID] || 2075 (outerCache[node.uniqueID] = {}); 2076 2077 cache = uniqueCache[type] || []; 2078 nodeIndex = cache[0] === dirruns && cache[1]; 2079 diff = nodeIndex; 2080 } 2081 2082 // xml :nth-child(...) 2083 // or :nth-last-child(...) or :nth(-last)?-of-type(...) 2084 if (diff === false) { 2085 2086 // Use the same loop as above to seek `elem` from the start 2087 while ((node = ++nodeIndex && node && node[dir] || 2088 (diff = nodeIndex = 0) || start.pop())) { 2089 2090 if ((ofType ? 2091 node.nodeName.toLowerCase() === name : 2092 node.nodeType === 1) && 2093 ++diff) { 2094 2095 // Cache the index of each encountered element 2096 if (useCache) { 2097 outerCache = node[expando] || 2098 (node[expando] = {}); 2099
vendor: 9,793 bytes, lines 2100-2425
2100 // Support: IE <9 only 2101 // Defend against cloned attroperties (jQuery gh-1709) 2102 uniqueCache = outerCache[node.uniqueID] || 2103 (outerCache[node.uniqueID] = {}); 2104 2105 uniqueCache[type] = [dirruns, diff]; 2106 } 2107 2108 if (node === elem) { 2109 break; 2110 } 2111 } 2112 } 2113 } 2114 } 2115 2116 // Incorporate the offset, then check against cycle size 2117 diff -= last; 2118 return diff === first || (diff % first === 0 && diff / first >= 0); 2119 } 2120 }; 2121 }, 2122 2123 "PSEUDO": function (pseudo, argument) { 2124 2125 // pseudo-class names are case-insensitive 2126 // http://www.w3.org/TR/selectors/#pseudo-classes 2127 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters 2128 // Remember that setFilters inherits from pseudos 2129 var args, 2130 fn = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] || 2131 Sizzle.error("unsupported pseudo: " + pseudo); 2132 2133 // The user may use createPseudo to indicate that 2134 // arguments are needed to create the filter function 2135 // just as Sizzle does 2136 if (fn[expando]) { 2137 return fn(argument); 2138 } 2139 2140 // But maintain support for old signatures 2141 if (fn.length > 1) { 2142 args = [pseudo, pseudo, "", argument]; 2143 return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ? 2144 markFunction(function (seed, matches) { 2145 var idx, 2146 matched = fn(seed, argument), 2147 i = matched.length; 2148 while (i--) { 2149 idx = indexOf(seed, matched[i]); 2150 seed[idx] = !(matches[idx] = matched[i]); 2151 } 2152 }) : 2153 function (elem) { 2154 return fn(elem, 0, args); 2155 }; 2156 } 2157 2158 return fn; 2159 } 2160 }, 2161 2162 pseudos: { 2163 2164 // Potentially complex pseudos 2165 "not": markFunction(function (selector) { 2166 2167 // Trim the selector passed to compile 2168 // to avoid treating leading and trailing 2169 // spaces as combinators 2170 var input = [], 2171 results = [], 2172 matcher = compile(selector.replace(rtrim, "$1")); 2173 2174 return matcher[expando] ? 2175 markFunction(function (seed, matches, _context, xml) { 2176 var elem, 2177 unmatched = matcher(seed, null, xml, []), 2178 i = seed.length; 2179 2180 // Match elements unmatched by `matcher` 2181 while (i--) { 2182 if ((elem = unmatched[i])) { 2183 seed[i] = !(matches[i] = elem); 2184 } 2185 } 2186 }) : 2187 function (elem, _context, xml) { 2188 input[0] = elem; 2189 matcher(input, null, xml, results); 2190 2191 // Don't keep the element (issue #299) 2192 input[0] = null; 2193 return !results.pop(); 2194 }; 2195 }), 2196 2197 "has": markFunction(function (selector) { 2198 return function (elem) { 2199 return Sizzle(selector, elem).length > 0; 2200 }; 2201 }), 2202 2203 "contains": markFunction(function (text) { 2204 text = text.replace(runescape, funescape); 2205 return function (elem) { 2206 return (elem.textContent || getText(elem)).indexOf(text) > -1; 2207 }; 2208 }), 2209 2210 // "Whether an element is represented by a :lang() selector 2211 // is based solely on the element's language value 2212 // being equal to the identifier C, 2213 // or beginning with the identifier C immediately followed by "-". 2214 // The matching of C against the element's language value is performed case-insensitively. 2215 // The identifier C does not have to be a valid language name." 2216 // http://www.w3.org/TR/selectors/#lang-pseudo 2217 "lang": markFunction(function (lang) { 2218 2219 // lang value must be a valid identifier 2220 if (!ridentifier.test(lang || "")) { 2221 Sizzle.error("unsupported lang: " + lang); 2222 } 2223 lang = lang.replace(runescape, funescape).toLowerCase(); 2224 return function (elem) { 2225 var elemLang; 2226 do { 2227 if ((elemLang = documentIsHTML ? 2228 elem.lang : 2229 elem.getAttribute("xml:lang") || elem.getAttribute("lang"))) { 2230 2231 elemLang = elemLang.toLowerCase(); 2232 return elemLang === lang || elemLang.indexOf(lang + "-") === 0; 2233 } 2234 } while ((elem = elem.parentNode) && elem.nodeType === 1); 2235 return false; 2236 }; 2237 }), 2238 2239 // Miscellaneous 2240 "target": function (elem) { 2241 var hash = window.location && window.location.hash; 2242 return hash && hash.slice(1) === elem.id; 2243 }, 2244 2245 "root": function (elem) { 2246 return elem === docElem; 2247 }, 2248 2249 "focus": function (elem) { 2250 return elem === document.activeElement && 2251 (!document.hasFocus || document.hasFocus()) && 2252 !!(elem.type || elem.href || ~elem.tabIndex); 2253 }, 2254 2255 // Boolean properties 2256 "enabled": createDisabledPseudo(false), 2257 "disabled": createDisabledPseudo(true), 2258 2259 "checked": function (elem) { 2260 2261 // In CSS3, :checked should return both checked and selected elements 2262 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 2263 var nodeName = elem.nodeName.toLowerCase(); 2264 return (nodeName === "input" && !!elem.checked) || 2265 (nodeName === "option" && !!elem.selected); 2266 }, 2267 2268 "selected": function (elem) { 2269 2270 // Accessing this property makes selected-by-default 2271 // options in Safari work properly 2272 if (elem.parentNode) { 2273 // eslint-disable-next-line no-unused-expressions 2274 elem.parentNode.selectedIndex; 2275 } 2276 2277 return elem.selected === true; 2278 }, 2279 2280 // Contents 2281 "empty": function (elem) { 2282 2283 // http://www.w3.org/TR/selectors/#empty-pseudo 2284 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), 2285 // but not by others (comment: 8; processing instruction: 7; etc.) 2286 // nodeType < 6 works because attributes (2) do not appear as children 2287 for (elem = elem.firstChild; elem; elem = elem.nextSibling) { 2288 if (elem.nodeType < 6) { 2289 return false; 2290 } 2291 } 2292 return true; 2293 }, 2294 2295 "parent": function (elem) { 2296 return !Expr.pseudos["empty"](elem); 2297 }, 2298 2299 // Element/input types 2300 "header": function (elem) { 2301 return rheader.test(elem.nodeName); 2302 }, 2303 2304 "input": function (elem) { 2305 return rinputs.test(elem.nodeName); 2306 }, 2307 2308 "button": function (elem) { 2309 var name = elem.nodeName.toLowerCase(); 2310 return name === "input" && elem.type === "button" || name === "button"; 2311 }, 2312 2313 "text": function (elem) { 2314 var attr; 2315 return elem.nodeName.toLowerCase() === "input" && 2316 elem.type === "text" && 2317 2318 // Support: IE <10 only 2319 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" 2320 ((attr = elem.getAttribute("type")) == null || 2321 attr.toLowerCase() === "text"); 2322 }, 2323 2324 // Position-in-collection 2325 "first": createPositionalPseudo(function () { 2326 return [0]; 2327 }), 2328 2329 "last": createPositionalPseudo(function (_matchIndexes, length) { 2330 return [length - 1]; 2331 }), 2332 2333 "eq": createPositionalPseudo(function (_matchIndexes, length, argument) { 2334 return [argument < 0 ? argument + length : argument]; 2335 }), 2336 2337 "even": createPositionalPseudo(function (matchIndexes, length) { 2338 var i = 0; 2339 for (; i < length; i += 2) { 2340 matchIndexes.push(i); 2341 } 2342 return matchIndexes; 2343 }), 2344 2345 "odd": createPositionalPseudo(function (matchIndexes, length) { 2346 var i = 1; 2347 for (; i < length; i += 2) { 2348 matchIndexes.push(i); 2349 } 2350 return matchIndexes; 2351 }), 2352 2353 "lt": createPositionalPseudo(function (matchIndexes, length, argument) { 2354 var i = argument < 0 ? 2355 argument + length : 2356 argument > length ? 2357 length : 2358 argument; 2359 for (; --i >= 0;) { 2360 matchIndexes.push(i); 2361 } 2362 return matchIndexes; 2363 }), 2364 2365 "gt": createPositionalPseudo(function (matchIndexes, length, argument) { 2366 var i = argument < 0 ? argument + length : argument; 2367 for (; ++i < length;) { 2368 matchIndexes.push(i); 2369 } 2370 return matchIndexes; 2371 }) 2372 } 2373 }; 2374 2375 Expr.pseudos["nth"] = Expr.pseudos["eq"]; 2376 2377 // Add button/input type pseudos 2378 for (i in { radio: true, checkbox: true, file: true, password: true, image: true }) { 2379 Expr.pseudos[i] = createInputPseudo(i); 2380 } 2381 for (i in { submit: true, reset: true }) { 2382 Expr.pseudos[i] = createButtonPseudo(i); 2383 } 2384 2385 // Easy API for creating new setFilters 2386 function setFilters() { } 2387 setFilters.prototype = Expr.filters = Expr.pseudos; 2388 Expr.setFilters = new setFilters(); 2389 2390 tokenize = Sizzle.tokenize = function (selector, parseOnly) { 2391 var matched, match, tokens, type, 2392 soFar, groups, preFilters, 2393 cached = tokenCache[selector + " "]; 2394 2395 if (cached) { 2396 return parseOnly ? 0 : cached.slice(0); 2397 } 2398 2399 soFar = selector; 2400 groups = []; 2401 preFilters = Expr.preFilter; 2402 2403 while (soFar) { 2404 2405 // Comma and first run 2406 if (!matched || (match = rcomma.exec(soFar))) { 2407 if (match) { 2408 2409 // Don't consume trailing commas as valid 2410 soFar = soFar.slice(match[0].length) || soFar; 2411 } 2412 groups.push((tokens = [])); 2413 } 2414 2415 matched = false; 2416 2417 // Combinators 2418 if ((match = rleadingCombinator.exec(soFar))) { 2419 matched = match.shift(); 2420 tokens.push({ 2421 value: matched, 2422 2423 // Cast descendant combinators to space 2424 type: match[0].replace(rtrim, " ") 2425 });
vendor: 9,356 bytes, lines 2426-2745
2426 soFar = soFar.slice(matched.length); 2427 } 2428 2429 // Filters 2430 for (type in Expr.filter) { 2431 if ((match = matchExpr[type].exec(soFar)) && (!preFilters[type] || 2432 (match = preFilters[type](match)))) { 2433 matched = match.shift(); 2434 tokens.push({ 2435 value: matched, 2436 type: type, 2437 matches: match 2438 }); 2439 soFar = soFar.slice(matched.length); 2440 } 2441 } 2442 2443 if (!matched) { 2444 break; 2445 } 2446 } 2447 2448 // Return the length of the invalid excess 2449 // if we're just parsing 2450 // Otherwise, throw an error or return tokens 2451 return parseOnly ? 2452 soFar.length : 2453 soFar ? 2454 Sizzle.error(selector) : 2455 2456 // Cache the tokens 2457 tokenCache(selector, groups).slice(0); 2458 }; 2459 2460 function toSelector(tokens) { 2461 var i = 0, 2462 len = tokens.length, 2463 selector = ""; 2464 for (; i < len; i++) { 2465 selector += tokens[i].value; 2466 } 2467 return selector; 2468 } 2469 2470 function addCombinator(matcher, combinator, base) { 2471 var dir = combinator.dir, 2472 skip = combinator.next, 2473 key = skip || dir, 2474 checkNonElements = base && key === "parentNode", 2475 doneName = done++; 2476 2477 return combinator.first ? 2478 2479 // Check against closest ancestor/preceding element 2480 function (elem, context, xml) { 2481 while ((elem = elem[dir])) { 2482 if (elem.nodeType === 1 || checkNonElements) { 2483 return matcher(elem, context, xml); 2484 } 2485 } 2486 return false; 2487 } : 2488 2489 // Check against all ancestor/preceding elements 2490 function (elem, context, xml) { 2491 var oldCache, uniqueCache, outerCache, 2492 newCache = [dirruns, doneName]; 2493 2494 // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching 2495 if (xml) { 2496 while ((elem = elem[dir])) { 2497 if (elem.nodeType === 1 || checkNonElements) { 2498 if (matcher(elem, context, xml)) { 2499 return true; 2500 } 2501 } 2502 } 2503 } else { 2504 while ((elem = elem[dir])) { 2505 if (elem.nodeType === 1 || checkNonElements) { 2506 outerCache = elem[expando] || (elem[expando] = {}); 2507 2508 // Support: IE <9 only 2509 // Defend against cloned attroperties (jQuery gh-1709) 2510 uniqueCache = outerCache[elem.uniqueID] || 2511 (outerCache[elem.uniqueID] = {}); 2512 2513 if (skip && skip === elem.nodeName.toLowerCase()) { 2514 elem = elem[dir] || elem; 2515 } else if ((oldCache = uniqueCache[key]) && 2516 oldCache[0] === dirruns && oldCache[1] === doneName) { 2517 2518 // Assign to newCache so results back-propagate to previous elements 2519 return (newCache[2] = oldCache[2]); 2520 } else { 2521 2522 // Reuse newcache so results back-propagate to previous elements 2523 uniqueCache[key] = newCache; 2524 2525 // A match means we're done; a fail means we have to keep checking 2526 if ((newCache[2] = matcher(elem, context, xml))) { 2527 return true; 2528 } 2529 } 2530 } 2531 } 2532 } 2533 return false; 2534 }; 2535 } 2536 2537 function elementMatcher(matchers) { 2538 return matchers.length > 1 ? 2539 function (elem, context, xml) { 2540 var i = matchers.length; 2541 while (i--) { 2542 if (!matchers[i](elem, context, xml)) { 2543 return false; 2544 } 2545 } 2546 return true; 2547 } : 2548 matchers[0]; 2549 } 2550 2551 function multipleContexts(selector, contexts, results) { 2552 var i = 0, 2553 len = contexts.length; 2554 for (; i < len; i++) { 2555 Sizzle(selector, contexts[i], results); 2556 } 2557 return results; 2558 } 2559 2560 function condense(unmatched, map, filter, context, xml) { 2561 var elem, 2562 newUnmatched = [], 2563 i = 0, 2564 len = unmatched.length, 2565 mapped = map != null; 2566 2567 for (; i < len; i++) { 2568 if ((elem = unmatched[i])) { 2569 if (!filter || filter(elem, context, xml)) { 2570 newUnmatched.push(elem); 2571 if (mapped) { 2572 map.push(i); 2573 } 2574 } 2575 } 2576 } 2577 2578 return newUnmatched; 2579 } 2580 2581 function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) { 2582 if (postFilter && !postFilter[expando]) { 2583 postFilter = setMatcher(postFilter); 2584 } 2585 if (postFinder && !postFinder[expando]) { 2586 postFinder = setMatcher(postFinder, postSelector); 2587 } 2588 return markFunction(function (seed, results, context, xml) { 2589 var temp, i, elem, 2590 preMap = [], 2591 postMap = [], 2592 preexisting = results.length, 2593 2594 // Get initial elements from seed or context 2595 elems = seed || multipleContexts( 2596 selector || "*", 2597 context.nodeType ? [context] : context, 2598 [] 2599 ), 2600 2601 // Prefilter to get matcher input, preserving a map for seed-results synchronization 2602 matcherIn = preFilter && (seed || !selector) ? 2603 condense(elems, preMap, preFilter, context, xml) : 2604 elems, 2605 2606 matcherOut = matcher ? 2607 2608 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, 2609 postFinder || (seed ? preFilter : preexisting || postFilter) ? 2610 2611 // ...intermediate processing is necessary 2612 [] : 2613 2614 // ...otherwise use results directly 2615 results : 2616 matcherIn; 2617 2618 // Find primary matches 2619 if (matcher) { 2620 matcher(matcherIn, matcherOut, context, xml); 2621 } 2622 2623 // Apply postFilter 2624 if (postFilter) { 2625 temp = condense(matcherOut, postMap); 2626 postFilter(temp, [], context, xml); 2627 2628 // Un-match failing elements by moving them back to matcherIn 2629 i = temp.length; 2630 while (i--) { 2631 if ((elem = temp[i])) { 2632 matcherOut[postMap[i]] = !(matcherIn[postMap[i]] = elem); 2633 } 2634 } 2635 } 2636 2637 if (seed) { 2638 if (postFinder || preFilter) { 2639 if (postFinder) { 2640 2641 // Get the final matcherOut by condensing this intermediate into postFinder contexts 2642 temp = []; 2643 i = matcherOut.length; 2644 while (i--) { 2645 if ((elem = matcherOut[i])) { 2646 2647 // Restore matcherIn since elem is not yet a final match 2648 temp.push((matcherIn[i] = elem)); 2649 } 2650 } 2651 postFinder(null, (matcherOut = []), temp, xml); 2652 } 2653 2654 // Move matched elements from seed to results to keep them synchronized 2655 i = matcherOut.length; 2656 while (i--) { 2657 if ((elem = matcherOut[i]) && 2658 (temp = postFinder ? indexOf(seed, elem) : preMap[i]) > -1) { 2659 2660 seed[temp] = !(results[temp] = elem); 2661 } 2662 } 2663 } 2664 2665 // Add elements to results, through postFinder if defined 2666 } else { 2667 matcherOut = condense( 2668 matcherOut === results ? 2669 matcherOut.splice(preexisting, matcherOut.length) : 2670 matcherOut 2671 ); 2672 if (postFinder) { 2673 postFinder(null, results, matcherOut, xml); 2674 } else { 2675 push.apply(results, matcherOut); 2676 } 2677 } 2678 }); 2679 } 2680 2681 function matcherFromTokens(tokens) { 2682 var checkContext, matcher, j, 2683 len = tokens.length, 2684 leadingRelative = Expr.relative[tokens[0].type], 2685 implicitRelative = leadingRelative || Expr.relative[" "], 2686 i = leadingRelative ? 1 : 0, 2687 2688 // The foundational matcher ensures that elements are reachable from top-level context(s) 2689 matchContext = addCombinator(function (elem) { 2690 return elem === checkContext; 2691 }, implicitRelative, true), 2692 matchAnyContext = addCombinator(function (elem) { 2693 return indexOf(checkContext, elem) > -1; 2694 }, implicitRelative, true), 2695 matchers = [function (elem, context, xml) { 2696 var ret = (!leadingRelative && (xml || context !== outermostContext)) || ( 2697 (checkContext = context).nodeType ? 2698 matchContext(elem, context, xml) : 2699 matchAnyContext(elem, context, xml)); 2700 2701 // Avoid hanging onto element (issue #299) 2702 checkContext = null; 2703 return ret; 2704 }]; 2705 2706 for (; i < len; i++) { 2707 if ((matcher = Expr.relative[tokens[i].type])) { 2708 matchers = [addCombinator(elementMatcher(matchers), matcher)]; 2709 } else { 2710 matcher = Expr.filter[tokens[i].type].apply(null, tokens[i].matches); 2711 2712 // Return special upon seeing a positional matcher 2713 if (matcher[expando]) { 2714 2715 // Find the next relative operator (if any) for proper handling 2716 j = ++i; 2717 for (; j < len; j++) { 2718 if (Expr.relative[tokens[j].type]) { 2719 break; 2720 } 2721 } 2722 return setMatcher( 2723 i > 1 && elementMatcher(matchers), 2724 i > 1 && toSelector( 2725 2726 // If the preceding token was a descendant combinator, insert an implicit any-element `*` 2727 tokens 2728 .slice(0, i - 1) 2729 .concat({ value: tokens[i - 2].type === " " ? "*" : "" }) 2730 ).replace(rtrim, "$1"), 2731 matcher, 2732 i < j && matcherFromTokens(tokens.slice(i, j)), 2733 j < len && matcherFromTokens((tokens = tokens.slice(j))), 2734 j < len && toSelector(tokens) 2735 ); 2736 } 2737 matchers.push(matcher); 2738 } 2739 } 2740 2741 return elementMatcher(matchers); 2742 } 2743 2744 function matcherFromGroupMatchers(elementMatchers, setMatchers) { 2745 var bySet = setMatchers.length > 0,
vendor: 13,414 bytes, lines 2746-3205
2746 byElement = elementMatchers.length > 0, 2747 superMatcher = function (seed, context, xml, results, outermost) { 2748 var elem, j, matcher, 2749 matchedCount = 0, 2750 i = "0", 2751 unmatched = seed && [], 2752 setMatched = [], 2753 contextBackup = outermostContext, 2754 2755 // We must always have either seed elements or outermost context 2756 elems = seed || byElement && Expr.find["TAG"]("*", outermost), 2757 2758 // Use integer dirruns iff this is the outermost matcher 2759 dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), 2760 len = elems.length; 2761 2762 if (outermost) { 2763 2764 // Support: IE 11+, Edge 17 - 18+ 2765 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 2766 // two documents; shallow comparisons work. 2767 // eslint-disable-next-line eqeqeq 2768 outermostContext = context == document || context || outermost; 2769 } 2770 2771 // Add elements passing elementMatchers directly to results 2772 // Support: IE<9, Safari 2773 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id 2774 for (; i !== len && (elem = elems[i]) != null; i++) { 2775 if (byElement && elem) { 2776 j = 0; 2777 2778 // Support: IE 11+, Edge 17 - 18+ 2779 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 2780 // two documents; shallow comparisons work. 2781 // eslint-disable-next-line eqeqeq 2782 if (!context && elem.ownerDocument != document) { 2783 setDocument(elem); 2784 xml = !documentIsHTML; 2785 } 2786 while ((matcher = elementMatchers[j++])) { 2787 if (matcher(elem, context || document, xml)) { 2788 results.push(elem); 2789 break; 2790 } 2791 } 2792 if (outermost) { 2793 dirruns = dirrunsUnique; 2794 } 2795 } 2796 2797 // Track unmatched elements for set filters 2798 if (bySet) { 2799 2800 // They will have gone through all possible matchers 2801 if ((elem = !matcher && elem)) { 2802 matchedCount--; 2803 } 2804 2805 // Lengthen the array for every element, matched or not 2806 if (seed) { 2807 unmatched.push(elem); 2808 } 2809 } 2810 } 2811 2812 // `i` is now the count of elements visited above, and adding it to `matchedCount` 2813 // makes the latter nonnegative. 2814 matchedCount += i; 2815 2816 // Apply set filters to unmatched elements 2817 // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` 2818 // equals `i`), unless we didn't visit _any_ elements in the above loop because we have 2819 // no element matchers and no seed. 2820 // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that 2821 // case, which will result in a "00" `matchedCount` that differs from `i` but is also 2822 // numerically zero. 2823 if (bySet && i !== matchedCount) { 2824 j = 0; 2825 while ((matcher = setMatchers[j++])) { 2826 matcher(unmatched, setMatched, context, xml); 2827 } 2828 2829 if (seed) { 2830 2831 // Reintegrate element matches to eliminate the need for sorting 2832 if (matchedCount > 0) { 2833 while (i--) { 2834 if (!(unmatched[i] || setMatched[i])) { 2835 setMatched[i] = pop.call(results); 2836 } 2837 } 2838 } 2839 2840 // Discard index placeholder values to get only actual matches 2841 setMatched = condense(setMatched); 2842 } 2843 2844 // Add matches to results 2845 push.apply(results, setMatched); 2846 2847 // Seedless set matches succeeding multiple successful matchers stipulate sorting 2848 if (outermost && !seed && setMatched.length > 0 && 2849 (matchedCount + setMatchers.length) > 1) { 2850 2851 Sizzle.uniqueSort(results); 2852 } 2853 } 2854 2855 // Override manipulation of globals by nested matchers 2856 if (outermost) { 2857 dirruns = dirrunsUnique; 2858 outermostContext = contextBackup; 2859 } 2860 2861 return unmatched; 2862 }; 2863 2864 return bySet ? 2865 markFunction(superMatcher) : 2866 superMatcher; 2867 } 2868 2869 compile = Sizzle.compile = function (selector, match /* Internal Use Only */) { 2870 var i, 2871 setMatchers = [], 2872 elementMatchers = [], 2873 cached = compilerCache[selector + " "]; 2874 2875 if (!cached) { 2876 2877 // Generate a function of recursive functions that can be used to check each element 2878 if (!match) { 2879 match = tokenize(selector); 2880 } 2881 i = match.length; 2882 while (i--) { 2883 cached = matcherFromTokens(match[i]); 2884 if (cached[expando]) { 2885 setMatchers.push(cached); 2886 } else { 2887 elementMatchers.push(cached); 2888 } 2889 } 2890 2891 // Cache the compiled function 2892 cached = compilerCache( 2893 selector, 2894 matcherFromGroupMatchers(elementMatchers, setMatchers) 2895 ); 2896 2897 // Save selector and tokenization 2898 cached.selector = selector; 2899 } 2900 return cached; 2901 }; 2902 2903 /** 2904 * A low-level selection function that works with Sizzle's compiled 2905 * selector functions 2906 * @param {String|Function} selector A selector or a pre-compiled 2907 * selector function built with Sizzle.compile 2908 * @param {Element} context 2909 * @param {Array} [results] 2910 * @param {Array} [seed] A set of elements to match against 2911 */ 2912 select = Sizzle.select = function (selector, context, results, seed) { 2913 var i, tokens, token, type, find, 2914 compiled = typeof selector === "function" && selector, 2915 match = !seed && tokenize((selector = compiled.selector || selector)); 2916 2917 results = results || []; 2918 2919 // Try to minimize operations if there is only one selector in the list and no seed 2920 // (the latter of which guarantees us context) 2921 if (match.length === 1) { 2922 2923 // Reduce context if the leading compound selector is an ID 2924 tokens = match[0] = match[0].slice(0); 2925 if (tokens.length > 2 && (token = tokens[0]).type === "ID" && 2926 context.nodeType === 9 && documentIsHTML && Expr.relative[tokens[1].type]) { 2927 2928 context = (Expr.find["ID"](token.matches[0] 2929 .replace(runescape, funescape), context) || [])[0]; 2930 if (!context) { 2931 return results; 2932 2933 // Precompiled matchers will still verify ancestry, so step up a level 2934 } else if (compiled) { 2935 context = context.parentNode; 2936 } 2937 2938 selector = selector.slice(tokens.shift().value.length); 2939 } 2940 2941 // Fetch a seed set for right-to-left matching 2942 i = matchExpr["needsContext"].test(selector) ? 0 : tokens.length; 2943 while (i--) { 2944 token = tokens[i]; 2945 2946 // Abort if we hit a combinator 2947 if (Expr.relative[(type = token.type)]) { 2948 break; 2949 } 2950 if ((find = Expr.find[type])) { 2951 2952 // Search, expanding context for leading sibling combinators 2953 if ((seed = find( 2954 token.matches[0].replace(runescape, funescape), 2955 rsibling.test(tokens[0].type) && testContext(context.parentNode) || 2956 context 2957 ))) { 2958 2959 // If seed is empty or no tokens remain, we can return early 2960 tokens.splice(i, 1); 2961 selector = seed.length && toSelector(tokens); 2962 if (!selector) { 2963 push.apply(results, seed); 2964 return results; 2965 } 2966 2967 break; 2968 } 2969 } 2970 } 2971 } 2972 2973 // Compile and execute a filtering function if one is not provided 2974 // Provide `match` to avoid retokenization if we modified the selector above 2975 (compiled || compile(selector, match))( 2976 seed, 2977 context, 2978 !documentIsHTML, 2979 results, 2980 !context || rsibling.test(selector) && testContext(context.parentNode) || context 2981 ); 2982 return results; 2983 }; 2984 2985 // One-time assignments 2986 2987 // Sort stability 2988 support.sortStable = expando.split("").sort(sortOrder).join("") === expando; 2989 2990 // Support: Chrome 14-35+ 2991 // Always assume duplicates if they aren't passed to the comparison function 2992 support.detectDuplicates = !!hasDuplicate; 2993 2994 // Initialize against the default document 2995 setDocument(); 2996 2997 // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) 2998 // Detached nodes confoundingly follow *each other* 2999 support.sortDetached = assert(function (el) { 3000 3001 // Should return 1, but returns 4 (following) 3002 return el.compareDocumentPosition(document.createElement("fieldset")) & 1; 3003 }); 3004 3005 // Support: IE<8 3006 // Prevent attribute/property "interpolation" 3007 // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx 3008 if (!assert(function (el) { 3009 el.innerHTML = "<a href='#'></a>"; 3010 return el.firstChild.getAttribute("href") === "#"; 3011 })) { 3012 addHandle("type|href|height|width", function (elem, name, isXML) { 3013 if (!isXML) { 3014 return elem.getAttribute(name, name.toLowerCase() === "type" ? 1 : 2); 3015 } 3016 }); 3017 } 3018 3019 // Support: IE<9 3020 // Use defaultValue in place of getAttribute("value") 3021 if (!support.attributes || !assert(function (el) { 3022 el.innerHTML = "<input/>"; 3023 el.firstChild.setAttribute("value", ""); 3024 return el.firstChild.getAttribute("value") === ""; 3025 })) { 3026 addHandle("value", function (elem, _name, isXML) { 3027 if (!isXML && elem.nodeName.toLowerCase() === "input") { 3028 return elem.defaultValue; 3029 } 3030 }); 3031 } 3032 3033 // Support: IE<9 3034 // Use getAttributeNode to fetch booleans when getAttribute lies 3035 if (!assert(function (el) { 3036 return el.getAttribute("disabled") == null; 3037 })) { 3038 addHandle(booleans, function (elem, name, isXML) { 3039 var val; 3040 if (!isXML) { 3041 return elem[name] === true ? name.toLowerCase() : 3042 (val = elem.getAttributeNode(name)) && val.specified ? 3043 val.value : 3044 null; 3045 } 3046 }); 3047 } 3048 3049 return Sizzle; 3050 3051 })(window); 3052 3053 3054 3055 jQuery.find = Sizzle; 3056 jQuery.expr = Sizzle.selectors; 3057 3058 // Deprecated 3059 jQuery.expr[":"] = jQuery.expr.pseudos; 3060 jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; 3061 jQuery.text = Sizzle.getText; 3062 jQuery.isXMLDoc = Sizzle.isXML; 3063 jQuery.contains = Sizzle.contains; 3064 jQuery.escapeSelector = Sizzle.escape; 3065 3066 3067 3068 3069 var dir = function (elem, dir, until) { 3070 var matched = [], 3071 truncate = until !== undefined; 3072 3073 while ((elem = elem[dir]) && elem.nodeType !== 9) { 3074 if (elem.nodeType === 1) { 3075 if (truncate && jQuery(elem).is(until)) { 3076 break; 3077 } 3078 matched.push(elem); 3079 } 3080 } 3081 return matched; 3082 }; 3083 3084 3085 var siblings = function (n, elem) { 3086 var matched = []; 3087 3088 for (; n; n = n.nextSibling) { 3089 if (n.nodeType === 1 && n !== elem) { 3090 matched.push(n); 3091 } 3092 } 3093 3094 return matched; 3095 }; 3096 3097 3098 var rneedsContext = jQuery.expr.match.needsContext; 3099 3100 3101 3102 function nodeName(elem, name) { 3103 3104 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); 3105 3106 } 3107 var rsingleTag = (/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i); 3108 3109 3110 3111 // Implement the identical functionality for filter and not 3112 function winnow(elements, qualifier, not) { 3113 if (isFunction(qualifier)) { 3114 return jQuery.grep(elements, function (elem, i) { 3115 return !!qualifier.call(elem, i, elem) !== not; 3116 }); 3117 } 3118 3119 // Single element 3120 if (qualifier.nodeType) { 3121 return jQuery.grep(elements, function (elem) { 3122 return (elem === qualifier) !== not; 3123 }); 3124 } 3125 3126 // Arraylike of elements (jQuery, arguments, Array) 3127 if (typeof qualifier !== "string") { 3128 return jQuery.grep(elements, function (elem) { 3129 return (indexOf.call(qualifier, elem) > -1) !== not; 3130 }); 3131 } 3132 3133 // Filtered directly for both simple and complex selectors 3134 return jQuery.filter(qualifier, elements, not); 3135 } 3136 3137 jQuery.filter = function (expr, elems, not) { 3138 var elem = elems[0]; 3139 3140 if (not) { 3141 expr = ":not(" + expr + ")"; 3142 } 3143 3144 if (elems.length === 1 && elem.nodeType === 1) { 3145 return jQuery.find.matchesSelector(elem, expr) ? [elem] : []; 3146 } 3147 3148 return jQuery.find.matches(expr, jQuery.grep(elems, function (elem) { 3149 return elem.nodeType === 1; 3150 })); 3151 }; 3152 3153 jQuery.fn.extend({ 3154 find: function (selector) { 3155 var i, ret, 3156 len = this.length, 3157 self = this; 3158 3159 if (typeof selector !== "string") { 3160 return this.pushStack(jQuery(selector).filter(function () { 3161 for (i = 0; i < len; i++) { 3162 if (jQuery.contains(self[i], this)) { 3163 return true; 3164 } 3165 } 3166 })); 3167 } 3168 3169 ret = this.pushStack([]); 3170 3171 for (i = 0; i < len; i++) { 3172 jQuery.find(selector, self[i], ret); 3173 } 3174 3175 return len > 1 ? jQuery.uniqueSort(ret) : ret; 3176 }, 3177 filter: function (selector) { 3178 return this.pushStack(winnow(this, selector || [], false)); 3179 }, 3180 not: function (selector) { 3181 return this.pushStack(winnow(this, selector || [], true)); 3182 }, 3183 is: function (selector) { 3184 return !!winnow( 3185 this, 3186 3187 // If this is a positional/relative selector, check membership in the returned set 3188 // so $("p:first").is("p:last") won't return true for a doc with two "p". 3189 typeof selector === "string" && rneedsContext.test(selector) ? 3190 jQuery(selector) : 3191 selector || [], 3192 false 3193 ).length; 3194 } 3195 }); 3196 3197 3198 // Initialize a jQuery object 3199 3200 3201 // A central reference to the root jQuery(document) 3202 var rootjQuery, 3203 3204 // A simple way to check for HTML strings 3205 // Prioritize #id over <tag>
vendor: 30,337 bytes, lines 3205-4343
3205 to avoid XSS via location.hash (trac-9521) 3206 // Strict HTML recognition (trac-11290: must start with <) 3207 // Shortcut simple #id case for speed 3208 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, 3209 3210 init = jQuery.fn.init = function (selector, context, root) { 3211 var match, elem; 3212 3213 // HANDLE: $(""), $(null), $(undefined), $(false) 3214 if (!selector) { 3215 return this; 3216 } 3217 3218 // Method init() accepts an alternate rootjQuery 3219 // so migrate can support jQuery.sub (gh-2101) 3220 root = root || rootjQuery; 3221 3222 // Handle HTML strings 3223 if (typeof selector === "string") { 3224 if (selector[0] === "<" && 3225 selector[selector.length - 1] === ">" && 3226 selector.length >= 3) { 3227 3228 // Assume that strings that start and end with <> are HTML and skip the regex check 3229 match = [null, selector, null]; 3230 3231 } else { 3232 match = rquickExpr.exec(selector); 3233 } 3234 3235 // Match html or make sure no context is specified for #id 3236 if (match && (match[1] || !context)) { 3237 3238 // HANDLE: $(html) -> $(array) 3239 if (match[1]) { 3240 context = context instanceof jQuery ? context[0] : context; 3241 3242 // Option to run scripts is true for back-compat 3243 // Intentionally let the error be thrown if parseHTML is not present 3244 jQuery.merge(this, jQuery.parseHTML( 3245 match[1], 3246 context && context.nodeType ? context.ownerDocument || context : document, 3247 true 3248 )); 3249 3250 // HANDLE: $(html, props) 3251 if (rsingleTag.test(match[1]) && jQuery.isPlainObject(context)) { 3252 for (match in context) { 3253 3254 // Properties of context are called as methods if possible 3255 if (isFunction(this[match])) { 3256 this[match](context[match]); 3257 3258 // ...and otherwise set as attributes 3259 } else { 3260 this.attr(match, context[match]); 3261 } 3262 } 3263 } 3264 3265 return this; 3266 3267 // HANDLE: $(#id) 3268 } else { 3269 elem = document.getElementById(match[2]); 3270 3271 if (elem) { 3272 3273 // Inject the element directly into the jQuery object 3274 this[0] = elem; 3275 this.length = 1; 3276 } 3277 return this; 3278 } 3279 3280 // HANDLE: $(expr, $(...)) 3281 } else if (!context || context.jquery) { 3282 return (context || root).find(selector); 3283 3284 // HANDLE: $(expr, context) 3285 // (which is just equivalent to: $(context).find(expr) 3286 } else { 3287 return this.constructor(context).find(selector); 3288 } 3289 3290 // HANDLE: $(DOMElement) 3291 } else if (selector.nodeType) { 3292 this[0] = selector; 3293 this.length = 1; 3294 return this; 3295 3296 // HANDLE: $(function) 3297 // Shortcut for document ready 3298 } else if (isFunction(selector)) { 3299 return root.ready !== undefined ? 3300 root.ready(selector) : 3301 3302 // Execute immediately if ready is not present 3303 selector(jQuery); 3304 } 3305 3306 return jQuery.makeArray(selector, this); 3307 }; 3308 3309 // Give the init function the jQuery prototype for later instantiation 3310 init.prototype = jQuery.fn; 3311 3312 // Initialize central reference 3313 rootjQuery = jQuery(document); 3314 3315 3316 var rparentsprev = /^(?:parents|prev(?:Until|All))/, 3317 3318 // Methods guaranteed to produce a unique set when starting from a unique set 3319 guaranteedUnique = { 3320 children: true, 3321 contents: true, 3322 next: true, 3323 prev: true 3324 }; 3325 3326 jQuery.fn.extend({ 3327 has: function (target) { 3328 var targets = jQuery(target, this), 3329 l = targets.length; 3330 3331 return this.filter(function () { 3332 var i = 0; 3333 for (; i < l; i++) { 3334 if (jQuery.contains(this, targets[i])) { 3335 return true; 3336 } 3337 } 3338 }); 3339 }, 3340 3341 closest: function (selectors, context) { 3342 var cur, 3343 i = 0, 3344 l = this.length, 3345 matched = [], 3346 targets = typeof selectors !== "string" && jQuery(selectors); 3347 3348 // Positional selectors never match, since there's no _selection_ context 3349 if (!rneedsContext.test(selectors)) { 3350 for (; i < l; i++) { 3351 for (cur = this[i]; cur && cur !== context; cur = cur.parentNode) { 3352 3353 // Always skip document fragments 3354 if (cur.nodeType < 11 && (targets ? 3355 targets.index(cur) > -1 : 3356 3357 // Don't pass non-elements to Sizzle 3358 cur.nodeType === 1 && 3359 jQuery.find.matchesSelector(cur, selectors))) { 3360 3361 matched.push(cur); 3362 break; 3363 } 3364 } 3365 } 3366 } 3367 3368 return this.pushStack(matched.length > 1 ? jQuery.uniqueSort(matched) : matched); 3369 }, 3370 3371 // Determine the position of an element within the set 3372 index: function (elem) { 3373 3374 // No argument, return index in parent 3375 if (!elem) { 3376 return (this[0] && this[0].parentNode) ? this.first().prevAll().length : -1; 3377 } 3378 3379 // Index in selector 3380 if (typeof elem === "string") { 3381 return indexOf.call(jQuery(elem), this[0]); 3382 } 3383 3384 // Locate the position of the desired element 3385 return indexOf.call(this, 3386 3387 // If it receives a jQuery object, the first element is used 3388 elem.jquery ? elem[0] : elem 3389 ); 3390 }, 3391 3392 add: function (selector, context) { 3393 return this.pushStack( 3394 jQuery.uniqueSort( 3395 jQuery.merge(this.get(), jQuery(selector, context)) 3396 ) 3397 ); 3398 }, 3399 3400 addBack: function (selector) { 3401 return this.add(selector == null ? 3402 this.prevObject : this.prevObject.filter(selector) 3403 ); 3404 } 3405 }); 3406 3407 function sibling(cur, dir) { 3408 while ((cur = cur[dir]) && cur.nodeType !== 1) { } 3409 return cur; 3410 } 3411 3412 jQuery.each({ 3413 parent: function (elem) { 3414 var parent = elem.parentNode; 3415 return parent && parent.nodeType !== 11 ? parent : null; 3416 }, 3417 parents: function (elem) { 3418 return dir(elem, "parentNode"); 3419 }, 3420 parentsUntil: function (elem, _i, until) { 3421 return dir(elem, "parentNode", until); 3422 }, 3423 next: function (elem) { 3424 return sibling(elem, "nextSibling"); 3425 }, 3426 prev: function (elem) { 3427 return sibling(elem, "previousSibling"); 3428 }, 3429 nextAll: function (elem) { 3430 return dir(elem, "nextSibling"); 3431 }, 3432 prevAll: function (elem) { 3433 return dir(elem, "previousSibling"); 3434 }, 3435 nextUntil: function (elem, _i, until) { 3436 return dir(elem, "nextSibling", until); 3437 }, 3438 prevUntil: function (elem, _i, until) { 3439 return dir(elem, "previousSibling", until); 3440 }, 3441 siblings: function (elem) { 3442 return siblings((elem.parentNode || {}).firstChild, elem); 3443 }, 3444 children: function (elem) { 3445 return siblings(elem.firstChild); 3446 }, 3447 contents: function (elem) { 3448 if (elem.contentDocument != null && 3449 3450 // Support: IE 11+ 3451 // <object> elements with no `data` attribute has an object 3452 // `contentDocument` with a `null` prototype. 3453 getProto(elem.contentDocument)) { 3454 3455 return elem.contentDocument; 3456 } 3457 3458 // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only 3459 // Treat the template element as a regular one in browsers that 3460 // don't support it. 3461 if (nodeName(elem, "template")) { 3462 elem = elem.content || elem; 3463 } 3464 3465 return jQuery.merge([], elem.childNodes); 3466 } 3467 }, function (name, fn) { 3468 jQuery.fn[name] = function (until, selector) { 3469 var matched = jQuery.map(this, fn, until); 3470 3471 if (name.slice(-5) !== "Until") { 3472 selector = until; 3473 } 3474 3475 if (selector && typeof selector === "string") { 3476 matched = jQuery.filter(selector, matched); 3477 } 3478 3479 if (this.length > 1) { 3480 3481 // Remove duplicates 3482 if (!guaranteedUnique[name]) { 3483 jQuery.uniqueSort(matched); 3484 } 3485 3486 // Reverse order for parents* and prev-derivatives 3487 if (rparentsprev.test(name)) { 3488 matched.reverse(); 3489 } 3490 } 3491 3492 return this.pushStack(matched); 3493 }; 3494 }); 3495 var rnothtmlwhite = (/[^\x20\t\r\n\f]+/g); 3496 3497 3498 3499 // Convert String-formatted options into Object-formatted ones 3500 function createOptions(options) { 3501 var object = {}; 3502 jQuery.each(options.match(rnothtmlwhite) || [], function (_, flag) { 3503 object[flag] = true; 3504 }); 3505 return object; 3506 } 3507 3508 /* 3509 * Create a callback list using the following parameters: 3510 * 3511 * options: an optional list of space-separated options that will change how 3512 * the callback list behaves or a more traditional option object 3513 * 3514 * By default a callback list will act like an event callback list and can be 3515 * "fired" multiple times. 3516 * 3517 * Possible options: 3518 * 3519 * once: will ensure the callback list can only be fired once (like a Deferred) 3520 * 3521 * memory: will keep track of previous values and will call any callback added 3522 * after the list has been fired right away with the latest "memorized" 3523 * values (like a Deferred) 3524 * 3525 * unique: will ensure a callback can only be added once (no duplicate in the list) 3526 * 3527 * stopOnFalse: interrupt callings when a callback returns false 3528 * 3529 */ 3530 jQuery.Callbacks = function (options) { 3531 3532 // Convert options from String-formatted to Object-formatted if needed 3533 // (we check in cache first) 3534 options = typeof options === "string" ? 3535 createOptions(options) : 3536 jQuery.extend({}, options); 3537 3538 var // Flag to know if list is currently firing 3539 firing, 3540 3541 // Last fire value for non-forgettable lists 3542 memory, 3543 3544 // Flag to know if list was already fired 3545 fired, 3546 3547 // Flag to prevent firing 3548 locked, 3549 3550 // Actual callback list 3551 list = [], 3552 3553 // Queue of execution data for repeatable lists 3554 queue = [], 3555 3556 // Index of currently firing callback (modified by add/remove as needed) 3557 firingIndex = -1, 3558 3559 // Fire callbacks 3560 fire = function () { 3561 3562 // Enforce single-firing 3563 locked = locked || options.once; 3564 3565 // Execute callbacks for all pending executions, 3566 // respecting firingIndex overrides and runtime changes 3567 fired = firing = true; 3568 for (; queue.length; firingIndex = -1) { 3569 memory = queue.shift(); 3570 while (++firingIndex < list.length) { 3571 3572 // Run callback and check for early termination 3573 if (list[firingIndex].apply(memory[0], memory[1]) === false && 3574 options.stopOnFalse) { 3575 3576 // Jump to end and forget the data so .add doesn't re-fire 3577 firingIndex = list.length; 3578 memory = false; 3579 } 3580 } 3581 } 3582 3583 // Forget the data if we're done with it 3584 if (!options.memory) { 3585 memory = false; 3586 } 3587 3588 firing = false; 3589 3590 // Clean up if we're done firing for good 3591 if (locked) { 3592 3593 // Keep an empty list if we have data for future add calls 3594 if (memory) { 3595 list = []; 3596 3597 // Otherwise, this object is spent 3598 } else { 3599 list = ""; 3600 } 3601 } 3602 }, 3603 3604 // Actual Callbacks object 3605 self = { 3606 3607 // Add a callback or a collection of callbacks to the list 3608 add: function () { 3609 if (list) { 3610 3611 // If we have memory from a past run, we should fire after adding 3612 if (memory && !firing) { 3613 firingIndex = list.length - 1; 3614 queue.push(memory); 3615 } 3616 3617 (function add(args) { 3618 jQuery.each(args, function (_, arg) { 3619 if (isFunction(arg)) { 3620 if (!options.unique || !self.has(arg)) { 3621 list.push(arg); 3622 } 3623 } else if (arg && arg.length && toType(arg) !== "string") { 3624 3625 // Inspect recursively 3626 add(arg); 3627 } 3628 }); 3629 })(arguments); 3630 3631 if (memory && !firing) { 3632 fire(); 3633 } 3634 } 3635 return this; 3636 }, 3637 3638 // Remove a callback from the list 3639 remove: function () { 3640 jQuery.each(arguments, function (_, arg) { 3641 var index; 3642 while ((index = jQuery.inArray(arg, list, index)) > -1) { 3643 list.splice(index, 1); 3644 3645 // Handle firing indexes 3646 if (index <= firingIndex) { 3647 firingIndex--; 3648 } 3649 } 3650 }); 3651 return this; 3652 }, 3653 3654 // Check if a given callback is in the list. 3655 // If no argument is given, return whether or not list has callbacks attached. 3656 has: function (fn) { 3657 return fn ? 3658 jQuery.inArray(fn, list) > -1 : 3659 list.length > 0; 3660 }, 3661 3662 // Remove all callbacks from the list 3663 empty: function () { 3664 if (list) { 3665 list = []; 3666 } 3667 return this; 3668 }, 3669 3670 // Disable .fire and .add 3671 // Abort any current/pending executions 3672 // Clear all callbacks and values 3673 disable: function () { 3674 locked = queue = []; 3675 list = memory = ""; 3676 return this; 3677 }, 3678 disabled: function () { 3679 return !list; 3680 }, 3681 3682 // Disable .fire 3683 // Also disable .add unless we have memory (since it would have no effect) 3684 // Abort any pending executions 3685 lock: function () { 3686 locked = queue = []; 3687 if (!memory && !firing) { 3688 list = memory = ""; 3689 } 3690 return this; 3691 }, 3692 locked: function () { 3693 return !!locked; 3694 }, 3695 3696 // Call all callbacks with the given context and arguments 3697 fireWith: function (context, args) { 3698 if (!locked) { 3699 args = args || []; 3700 args = [context, args.slice ? args.slice() : args]; 3701 queue.push(args); 3702 if (!firing) { 3703 fire(); 3704 } 3705 } 3706 return this; 3707 }, 3708 3709 // Call all the callbacks with the given arguments 3710 fire: function () { 3711 self.fireWith(this, arguments); 3712 return this; 3713 }, 3714 3715 // To know if the callbacks have already been called at least once 3716 fired: function () { 3717 return !!fired; 3718 } 3719 }; 3720 3721 return self; 3722 }; 3723 3724 3725 function Identity(v) { 3726 return v; 3727 } 3728 function Thrower(ex) { 3729 throw ex; 3730 } 3731 3732 function adoptValue(value, resolve, reject, noValue) { 3733 var method; 3734 3735 try { 3736 3737 // Check for promise aspect first to privilege synchronous behavior 3738 if (value && isFunction((method = value.promise))) { 3739 method.call(value).done(resolve).fail(reject); 3740 3741 // Other thenables 3742 } else if (value && isFunction((method = value.then))) { 3743 method.call(value, resolve, reject); 3744 3745 // Other non-thenables 3746 } else { 3747 3748 // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer: 3749 // * false: [ value ].slice( 0 ) => resolve( value ) 3750 // * true: [ value ].slice( 1 ) => resolve() 3751 resolve.apply(undefined, [value].slice(noValue)); 3752 } 3753 3754 // For Promises/A+, convert exceptions into rejections 3755 // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in 3756 // Deferred#then to conditionally suppress rejection. 3757 } catch (value) { 3758 3759 // Support: Android 4.0 only 3760 // Strict mode functions invoked without .call/.apply get global-object context 3761 reject.apply(undefined, [value]); 3762 } 3763 } 3764 3765 jQuery.extend({ 3766 3767 Deferred: function (func) { 3768 var tuples = [ 3769 3770 // action, add listener, callbacks, 3771 // ... .then handlers, argument index, [final state] 3772 ["notify", "progress", jQuery.Callbacks("memory"), 3773 jQuery.Callbacks("memory"), 2], 3774 ["resolve", "done", jQuery.Callbacks("once memory"), 3775 jQuery.Callbacks("once memory"), 0, "resolved"], 3776 ["reject", "fail", jQuery.Callbacks("once memory"), 3777 jQuery.Callbacks("once memory"), 1, "rejected"] 3778 ], 3779 state = "pending", 3780 promise = { 3781 state: function () { 3782 return state; 3783 }, 3784 always: function () { 3785 deferred.done(arguments).fail(arguments); 3786 return this; 3787 }, 3788 "catch": function (fn) { 3789 return promise.then(null, fn); 3790 }, 3791 3792 // Keep pipe for back-compat 3793 pipe: function ( /* fnDone, fnFail, fnProgress */) { 3794 var fns = arguments; 3795 3796 return jQuery.Deferred(function (newDefer) { 3797 jQuery.each(tuples, function (_i, tuple) { 3798 3799 // Map tuples (progress, done, fail) to arguments (done, fail, progress) 3800 var fn = isFunction(fns[tuple[4]]) && fns[tuple[4]]; 3801 3802 // deferred.progress(function() { bind to newDefer or newDefer.notify }) 3803 // deferred.done(function() { bind to newDefer or newDefer.resolve }) 3804 // deferred.fail(function() { bind to newDefer or newDefer.reject }) 3805 deferred[tuple[1]](function () { 3806 var returned = fn && fn.apply(this, arguments); 3807 if (returned && isFunction(returned.promise)) { 3808 returned.promise() 3809 .progress(newDefer.notify) 3810 .done(newDefer.resolve) 3811 .fail(newDefer.reject); 3812 } else { 3813 newDefer[tuple[0] + "With"]( 3814 this, 3815 fn ? [returned] : arguments 3816 ); 3817 } 3818 }); 3819 }); 3820 fns = null; 3821 }).promise(); 3822 }, 3823 then: function (onFulfilled, onRejected, onProgress) { 3824 var maxDepth = 0; 3825 function resolve(depth, deferred, handler, special) { 3826 return function () { 3827 var that = this, 3828 args = arguments, 3829 mightThrow = function () { 3830 var returned, then; 3831 3832 // Support: Promises/A+ section 2.3.3.3.3 3833 // https://promisesaplus.com/#point-59 3834 // Ignore double-resolution attempts 3835 if (depth < maxDepth) { 3836 return; 3837 } 3838 3839 returned = handler.apply(that, args); 3840 3841 // Support: Promises/A+ section 2.3.1 3842 // https://promisesaplus.com/#point-48 3843 if (returned === deferred.promise()) { 3844 throw new TypeError("Thenable self-resolution"); 3845 } 3846 3847 // Support: Promises/A+ sections 2.3.3.1, 3.5 3848 // https://promisesaplus.com/#point-54 3849 // https://promisesaplus.com/#point-75 3850 // Retrieve `then` only once 3851 then = returned && 3852 3853 // Support: Promises/A+ section 2.3.4 3854 // https://promisesaplus.com/#point-64 3855 // Only check objects and functions for thenability 3856 (typeof returned === "object" || 3857 typeof returned === "function") && 3858 returned.then; 3859 3860 // Handle a returned thenable 3861 if (isFunction(then)) { 3862 3863 // Special processors (notify) just wait for resolution 3864 if (special) { 3865 then.call( 3866 returned, 3867 resolve(maxDepth, deferred, Identity, special), 3868 resolve(maxDepth, deferred, Thrower, special) 3869 ); 3870 3871 // Normal processors (resolve) also hook into progress 3872 } else { 3873 3874 // ...and disregard older resolution values 3875 maxDepth++; 3876 3877 then.call( 3878 returned, 3879 resolve(maxDepth, deferred, Identity, special), 3880 resolve(maxDepth, deferred, Thrower, special), 3881 resolve(maxDepth, deferred, Identity, 3882 deferred.notifyWith) 3883 ); 3884 } 3885 3886 // Handle all other returned values 3887 } else { 3888 3889 // Only substitute handlers pass on context 3890 // and multiple values (non-spec behavior) 3891 if (handler !== Identity) { 3892 that = undefined; 3893 args = [returned]; 3894 } 3895 3896 // Process the value(s) 3897 // Default process is resolve 3898 (special || deferred.resolveWith)(that, args); 3899 } 3900 }, 3901 3902 // Only normal processors (resolve) catch and reject exceptions 3903 process = special ? 3904 mightThrow : 3905 function () { 3906 try { 3907 mightThrow(); 3908 } catch (e) { 3909 3910 if (jQuery.Deferred.exceptionHook) { 3911 jQuery.Deferred.exceptionHook(e, 3912 process.stackTrace); 3913 } 3914 3915 // Support: Promises/A+ section 2.3.3.3.4.1 3916 // https://promisesaplus.com/#point-61 3917 // Ignore post-resolution exceptions 3918 if (depth + 1 >= maxDepth) { 3919 3920 // Only substitute handlers pass on context 3921 // and multiple values (non-spec behavior) 3922 if (handler !== Thrower) { 3923 that = undefined; 3924 args = [e]; 3925 } 3926 3927 deferred.rejectWith(that, args); 3928 } 3929 } 3930 }; 3931 3932 // Support: Promises/A+ section 2.3.3.3.1 3933 // https://promisesaplus.com/#point-57 3934 // Re-resolve promises immediately to dodge false rejection from 3935 // subsequent errors 3936 if (depth) { 3937 process(); 3938 } else { 3939 3940 // Call an optional hook to record the stack, in case of exception 3941 // since it's otherwise lost when execution goes async 3942 if (jQuery.Deferred.getStackHook) { 3943 process.stackTrace = jQuery.Deferred.getStackHook(); 3944 } 3945 window.setTimeout(process); 3946 } 3947 }; 3948 } 3949 3950 return jQuery.Deferred(function (newDefer) { 3951 3952 // progress_handlers.add( ... ) 3953 tuples[0][3].add( 3954 resolve( 3955 0, 3956 newDefer, 3957 isFunction(onProgress) ? 3958 onProgress : 3959 Identity, 3960 newDefer.notifyWith 3961 ) 3962 ); 3963 3964 // fulfilled_handlers.add( ... ) 3965 tuples[1][3].add( 3966 resolve( 3967 0, 3968 newDefer, 3969 isFunction(onFulfilled) ? 3970 onFulfilled : 3971 Identity 3972 ) 3973 ); 3974 3975 // rejected_handlers.add( ... ) 3976 tuples[2][3].add( 3977 resolve( 3978 0, 3979 newDefer, 3980 isFunction(onRejected) ? 3981 onRejected : 3982 Thrower 3983 ) 3984 ); 3985 }).promise(); 3986 }, 3987 3988 // Get a promise for this deferred 3989 // If obj is provided, the promise aspect is added to the object 3990 promise: function (obj) { 3991 return obj != null ? jQuery.extend(obj, promise) : promise; 3992 } 3993 }, 3994 deferred = {}; 3995 3996 // Add list-specific methods 3997 jQuery.each(tuples, function (i, tuple) { 3998 var list = tuple[2], 3999 stateString = tuple[5]; 4000 4001 // promise.progress = list.add 4002 // promise.done = list.add 4003 // promise.fail = list.add 4004 promise[tuple[1]] = list.add; 4005 4006 // Handle state 4007 if (stateString) { 4008 list.add( 4009 function () { 4010 4011 // state = "resolved" (i.e., fulfilled) 4012 // state = "rejected" 4013 state = stateString; 4014 }, 4015 4016 // rejected_callbacks.disable 4017 // fulfilled_callbacks.disable 4018 tuples[3 - i][2].disable, 4019 4020 // rejected_handlers.disable 4021 // fulfilled_handlers.disable 4022 tuples[3 - i][3].disable, 4023 4024 // progress_callbacks.lock 4025 tuples[0][2].lock, 4026 4027 // progress_handlers.lock 4028 tuples[0][3].lock 4029 ); 4030 } 4031 4032 // progress_handlers.fire 4033 // fulfilled_handlers.fire 4034 // rejected_handlers.fire 4035 list.add(tuple[3].fire); 4036 4037 // deferred.notify = function() { deferred.notifyWith(...) } 4038 // deferred.resolve = function() { deferred.resolveWith(...) } 4039 // deferred.reject = function() { deferred.rejectWith(...) } 4040 deferred[tuple[0]] = function () { 4041 deferred[tuple[0] + "With"](this === deferred ? undefined : this, arguments); 4042 return this; 4043 }; 4044 4045 // deferred.notifyWith = list.fireWith 4046 // deferred.resolveWith = list.fireWith 4047 // deferred.rejectWith = list.fireWith 4048 deferred[tuple[0] + "With"] = list.fireWith; 4049 }); 4050 4051 // Make the deferred a promise 4052 promise.promise(deferred); 4053 4054 // Call given func if any 4055 if (func) { 4056 func.call(deferred, deferred); 4057 } 4058 4059 // All done! 4060 return deferred; 4061 }, 4062 4063 // Deferred helper 4064 when: function (singleValue) { 4065 var 4066 4067 // count of uncompleted subordinates 4068 remaining = arguments.length, 4069 4070 // count of unprocessed arguments 4071 i = remaining, 4072 4073 // subordinate fulfillment data 4074 resolveContexts = Array(i), 4075 resolveValues = slice.call(arguments), 4076 4077 // the primary Deferred 4078 primary = jQuery.Deferred(), 4079 4080 // subordinate callback factory 4081 updateFunc = function (i) { 4082 return function (value) { 4083 resolveContexts[i] = this; 4084 resolveValues[i] = arguments.length > 1 ? slice.call(arguments) : value; 4085 if (!(--remaining)) { 4086 primary.resolveWith(resolveContexts, resolveValues); 4087 } 4088 }; 4089 }; 4090 4091 // Single- and empty arguments are adopted like Promise.resolve 4092 if (remaining <= 1) { 4093 adoptValue(singleValue, primary.done(updateFunc(i)).resolve, primary.reject, 4094 !remaining); 4095 4096 // Use .then() to unwrap secondary thenables (cf. gh-3000) 4097 if (primary.state() === "pending" || 4098 isFunction(resolveValues[i] && resolveValues[i].then)) { 4099 4100 return primary.then(); 4101 } 4102 } 4103 4104 // Multiple arguments are aggregated like Promise.all array elements 4105 while (i--) { 4106 adoptValue(resolveValues[i], updateFunc(i), primary.reject); 4107 } 4108 4109 return primary.promise(); 4110 } 4111 }); 4112 4113 4114 // These usually indicate a programmer mistake during development, 4115 // warn about them ASAP rather than swallowing them by default. 4116 var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; 4117 4118 jQuery.Deferred.exceptionHook = function (error, stack) { 4119 4120 // Support: IE 8 - 9 only 4121 // Console exists when dev tools are open, which can happen at any time 4122 if (window.console && window.console.warn && error && rerrorNames.test(error.name)) { 4123 window.console.warn("jQuery.Deferred exception: " + error.message, error.stack, stack); 4124 } 4125 }; 4126 4127 4128 4129 4130 jQuery.readyException = function (error) { 4131 window.setTimeout(function () { 4132 throw error; 4133 }); 4134 }; 4135 4136 4137 4138 4139 // The deferred used on DOM ready 4140 var readyList = jQuery.Deferred(); 4141 4142 jQuery.fn.ready = function (fn) { 4143 4144 readyList 4145 .then(fn) 4146 4147 // Wrap jQuery.readyException in a function so that the lookup 4148 // happens at the time of error handling instead of callback 4149 // registration. 4150 .catch(function (error) { 4151 jQuery.readyException(error); 4152 }); 4153 4154 return this; 4155 }; 4156 4157 jQuery.extend({ 4158 4159 // Is the DOM ready to be used? Set to true once it occurs. 4160 isReady: false, 4161 4162 // A counter to track how many items to wait for before 4163 // the ready event fires. See trac-6781 4164 readyWait: 1, 4165 4166 // Handle when the DOM is ready 4167 ready: function (wait) { 4168 4169 // Abort if there are pending holds or we're already ready 4170 if (wait === true ? --jQuery.readyWait : jQuery.isReady) { 4171 return; 4172 } 4173 4174 // Remember that the DOM is ready 4175 jQuery.isReady = true; 4176 4177 // If a normal DOM Ready event fired, decrement, and wait if need be 4178 if (wait !== true && --jQuery.readyWait > 0) { 4179 return; 4180 } 4181 4182 // If there are functions bound, to execute 4183 readyList.resolveWith(document, [jQuery]); 4184 } 4185 }); 4186 4187 jQuery.ready.then = readyList.then; 4188 4189 // The ready event handler and self cleanup method 4190 function completed() { 4191 document.removeEventListener("DOMContentLoaded", completed); 4192 window.removeEventListener("load", completed); 4193 jQuery.ready(); 4194 } 4195 4196 // Catch cases where $(document).ready() is called 4197 // after the browser event has already occurred. 4198 // Support: IE <=9 - 10 only 4199 // Older IE sometimes signals "interactive" too soon 4200 if (document.readyState === "complete" || 4201 (document.readyState !== "loading" && !document.documentElement.doScroll)) { 4202 4203 // Handle it asynchronously to allow scripts the opportunity to delay ready 4204 window.setTimeout(jQuery.ready); 4205 4206 } else { 4207 4208 // Use the handy event callback 4209 document.addEventListener("DOMContentLoaded", completed); 4210 4211 // A fallback to window.onload, that will always work 4212 window.addEventListener("load", completed); 4213 } 4214 4215 4216 4217 4218 // Multifunctional method to get and set values of a collection 4219 // The value/s can optionally be executed if it's a function 4220 var access = function (elems, fn, key, value, chainable, emptyGet, raw) { 4221 var i = 0, 4222 len = elems.length, 4223 bulk = key == null; 4224 4225 // Sets many values 4226 if (toType(key) === "object") { 4227 chainable = true; 4228 for (i in key) { 4229 access(elems, fn, i, key[i], true, emptyGet, raw); 4230 } 4231 4232 // Sets one value 4233 } else if (value !== undefined) { 4234 chainable = true; 4235 4236 if (!isFunction(value)) { 4237 raw = true; 4238 } 4239 4240 if (bulk) { 4241 4242 // Bulk operations run against the entire set 4243 if (raw) { 4244 fn.call(elems, value); 4245 fn = null; 4246 4247 // ...except when executing function values 4248 } else { 4249 bulk = fn; 4250 fn = function (elem, _key, value) { 4251 return bulk.call(jQuery(elem), value); 4252 }; 4253 } 4254 } 4255 4256 if (fn) { 4257 for (; i < len; i++) { 4258 fn( 4259 elems[i], key, raw ? 4260 value : 4261 value.call(elems[i], i, fn(elems[i], key)) 4262 ); 4263 } 4264 } 4265 } 4266 4267 if (chainable) { 4268 return elems; 4269 } 4270 4271 // Gets 4272 if (bulk) { 4273 return fn.call(elems); 4274 } 4275 4276 return len ? fn(elems[0], key) : emptyGet; 4277 }; 4278 4279 4280 // Matches dashed string for camelizing 4281 var rmsPrefix = /^-ms-/, 4282 rdashAlpha = /-([a-z])/g; 4283 4284 // Used by camelCase as callback to replace() 4285 function fcamelCase(_all, letter) { 4286 return letter.toUpperCase(); 4287 } 4288 4289 // Convert dashed to camelCase; used by the css and data modules 4290 // Support: IE <=9 - 11, Edge 12 - 15 4291 // Microsoft forgot to hump their vendor prefix (trac-9572) 4292 function camelCase(string) { 4293 return string.replace(rmsPrefix, "ms-").replace(rdashAlpha, fcamelCase); 4294 } 4295 var acceptData = function (owner) { 4296 4297 // Accepts only: 4298 // - Node 4299 // - Node.ELEMENT_NODE 4300 // - Node.DOCUMENT_NODE 4301 // - Object 4302 // - Any 4303 return owner.nodeType === 1 || owner.nodeType === 9 || !(+owner.nodeType); 4304 }; 4305 4306 4307 4308 4309 function Data() { 4310 this.expando = jQuery.expando + Data.uid++; 4311 } 4312 4313 Data.uid = 1; 4314 4315 Data.prototype = { 4316 4317 cache: function (owner) { 4318 4319 // Check if the owner object already has a cache 4320 var value = owner[this.expando]; 4321 4322 // If not, create one 4323 if (!value) { 4324 value = {}; 4325 4326 // We can accept data for non-element nodes in modern browsers, 4327 // but we should not, see trac-8335. 4328 // Always return an empty object. 4329 if (acceptData(owner)) { 4330 4331 // If it is a node unlikely to be stringify-ed or looped over 4332 // use plain assignment 4333 if (owner.nodeType) { 4334 owner[this.expando] = value; 4335 4336 // Otherwise secure it in a non-enumerable property 4337 // configurable must be true to allow the property to be 4338 // deleted when data is removed 4339 } else { 4340 Object.defineProperty(owner, this.expando, { 4341 value: value, 4342 configurable: true 4343 });
vendor: 5,631 bytes, lines 4344-4564
4344 } 4345 } 4346 } 4347 4348 return value; 4349 }, 4350 set: function (owner, data, value) { 4351 var prop, 4352 cache = this.cache(owner); 4353 4354 // Handle: [ owner, key, value ] args 4355 // Always use camelCase key (gh-2257) 4356 if (typeof data === "string") { 4357 cache[camelCase(data)] = value; 4358 4359 // Handle: [ owner, { properties } ] args 4360 } else { 4361 4362 // Copy the properties one-by-one to the cache object 4363 for (prop in data) { 4364 cache[camelCase(prop)] = data[prop]; 4365 } 4366 } 4367 return cache; 4368 }, 4369 get: function (owner, key) { 4370 return key === undefined ? 4371 this.cache(owner) : 4372 4373 // Always use camelCase key (gh-2257) 4374 owner[this.expando] && owner[this.expando][camelCase(key)]; 4375 }, 4376 access: function (owner, key, value) { 4377 4378 // In cases where either: 4379 // 4380 // 1. No key was specified 4381 // 2. A string key was specified, but no value provided 4382 // 4383 // Take the "read" path and allow the get method to determine 4384 // which value to return, respectively either: 4385 // 4386 // 1. The entire cache object 4387 // 2. The data stored at the key 4388 // 4389 if (key === undefined || 4390 ((key && typeof key === "string") && value === undefined)) { 4391 4392 return this.get(owner, key); 4393 } 4394 4395 // When the key is not a string, or both a key and value 4396 // are specified, set or extend (existing objects) with either: 4397 // 4398 // 1. An object of properties 4399 // 2. A key and value 4400 // 4401 this.set(owner, key, value); 4402 4403 // Since the "set" path can have two possible entry points 4404 // return the expected data based on which path was taken[*] 4405 return value !== undefined ? value : key; 4406 }, 4407 remove: function (owner, key) { 4408 var i, 4409 cache = owner[this.expando]; 4410 4411 if (cache === undefined) { 4412 return; 4413 } 4414 4415 if (key !== undefined) { 4416 4417 // Support array or space separated string of keys 4418 if (Array.isArray(key)) { 4419 4420 // If key is an array of keys... 4421 // We always set camelCase keys, so remove that. 4422 key = key.map(camelCase); 4423 } else { 4424 key = camelCase(key); 4425 4426 // If a key with the spaces exists, use it. 4427 // Otherwise, create an array by matching non-whitespace 4428 key = key in cache ? 4429 [key] : 4430 (key.match(rnothtmlwhite) || []); 4431 } 4432 4433 i = key.length; 4434 4435 while (i--) { 4436 delete cache[key[i]]; 4437 } 4438 } 4439 4440 // Remove the expando if there's no more data 4441 if (key === undefined || jQuery.isEmptyObject(cache)) { 4442 4443 // Support: Chrome <=35 - 45 4444 // Webkit & Blink performance suffers when deleting properties 4445 // from DOM nodes, so set to undefined instead 4446 // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) 4447 if (owner.nodeType) { 4448 owner[this.expando] = undefined; 4449 } else { 4450 delete owner[this.expando]; 4451 } 4452 } 4453 }, 4454 hasData: function (owner) { 4455 var cache = owner[this.expando]; 4456 return cache !== undefined && !jQuery.isEmptyObject(cache); 4457 } 4458 }; 4459 var dataPriv = new Data(); 4460 4461 var dataUser = new Data(); 4462 4463 4464 4465 // Implementation Summary 4466 // 4467 // 1. Enforce API surface and semantic compatibility with 1.9.x branch 4468 // 2. Improve the module's maintainability by reducing the storage 4469 // paths to a single mechanism. 4470 // 3. Use the same single mechanism to support "private" and "user" data. 4471 // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) 4472 // 5. Avoid exposing implementation details on user objects (eg. expando properties) 4473 // 6. Provide a clear path for implementation upgrade to WeakMap in 2014 4474 4475 var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, 4476 rmultiDash = /[A-Z]/g; 4477 4478 function getData(data) { 4479 if (data === "true") { 4480 return true; 4481 } 4482 4483 if (data === "false") { 4484 return false; 4485 } 4486 4487 if (data === "null") { 4488 return null; 4489 } 4490 4491 // Only convert to a number if it doesn't change the string 4492 if (data === +data + "") { 4493 return +data; 4494 } 4495 4496 if (rbrace.test(data)) { 4497 return JSON.parse(data); 4498 } 4499 4500 return data; 4501 } 4502 4503 function dataAttr(elem, key, data) { 4504 var name; 4505 4506 // If nothing was found internally, try to fetch any 4507 // data from the HTML5 data-* attribute 4508 if (data === undefined && elem.nodeType === 1) { 4509 name = "data-" + key.replace(rmultiDash, "-$&").toLowerCase(); 4510 data = elem.getAttribute(name); 4511 4512 if (typeof data === "string") { 4513 try { 4514 data = getData(data); 4515 } catch (e) { } 4516 4517 // Make sure we set the data so it isn't changed later 4518 dataUser.set(elem, key, data); 4519 } else { 4520 data = undefined; 4521 } 4522 } 4523 return data; 4524 } 4525 4526 jQuery.extend({ 4527 hasData: function (elem) { 4528 return dataUser.hasData(elem) || dataPriv.hasData(elem); 4529 }, 4530 4531 data: function (elem, name, data) { 4532 return dataUser.access(elem, name, data); 4533 }, 4534 4535 removeData: function (elem, name) { 4536 dataUser.remove(elem, name); 4537 }, 4538 4539 // TODO: Now that all calls to _data and _removeData have been replaced 4540 // with direct calls to dataPriv methods, these can be deprecated. 4541 _data: function (elem, name, data) { 4542 return dataPriv.access(elem, name, data); 4543 }, 4544 4545 _removeData: function (elem, name) { 4546 dataPriv.remove(elem, name); 4547 } 4548 }); 4549 4550 jQuery.fn.extend({ 4551 data: function (key, value) { 4552 var i, name, data, 4553 elem = this[0], 4554 attrs = elem && elem.attributes; 4555 4556 // Gets all values 4557 if (key === undefined) { 4558 if (this.length) { 4559 data = dataUser.get(elem); 4560 4561 if (elem.nodeType === 1 && !dataPriv.get(elem, "hasDataAttrs")) { 4562 i = attrs.length; 4563 while (i--) { 4564
vendor: 11,233 bytes, lines 4565-4998
4565 // Support: IE 11 only 4566 // The attrs elements can be null (trac-14894) 4567 if (attrs[i]) { 4568 name = attrs[i].name; 4569 if (name.indexOf("data-") === 0) { 4570 name = camelCase(name.slice(5)); 4571 dataAttr(elem, name, data[name]); 4572 } 4573 } 4574 } 4575 dataPriv.set(elem, "hasDataAttrs", true); 4576 } 4577 } 4578 4579 return data; 4580 } 4581 4582 // Sets multiple values 4583 if (typeof key === "object") { 4584 return this.each(function () { 4585 dataUser.set(this, key); 4586 }); 4587 } 4588 4589 return access(this, function (value) { 4590 var data; 4591 4592 // The calling jQuery object (element matches) is not empty 4593 // (and therefore has an element appears at this[ 0 ]) and the 4594 // `value` parameter was not undefined. An empty jQuery object 4595 // will result in `undefined` for elem = this[ 0 ] which will 4596 // throw an exception if an attempt to read a data cache is made. 4597 if (elem && value === undefined) { 4598 4599 // Attempt to get data from the cache 4600 // The key will always be camelCased in Data 4601 data = dataUser.get(elem, key); 4602 if (data !== undefined) { 4603 return data; 4604 } 4605 4606 // Attempt to "discover" the data in 4607 // HTML5 custom data-* attrs 4608 data = dataAttr(elem, key); 4609 if (data !== undefined) { 4610 return data; 4611 } 4612 4613 // We tried really hard, but the data doesn't exist. 4614 return; 4615 } 4616 4617 // Set the data... 4618 this.each(function () { 4619 4620 // We always store the camelCased key 4621 dataUser.set(this, key, value); 4622 }); 4623 }, null, value, arguments.length > 1, null, true); 4624 }, 4625 4626 removeData: function (key) { 4627 return this.each(function () { 4628 dataUser.remove(this, key); 4629 }); 4630 } 4631 }); 4632 4633 4634 jQuery.extend({ 4635 queue: function (elem, type, data) { 4636 var queue; 4637 4638 if (elem) { 4639 type = (type || "fx") + "queue"; 4640 queue = dataPriv.get(elem, type); 4641 4642 // Speed up dequeue by getting out quickly if this is just a lookup 4643 if (data) { 4644 if (!queue || Array.isArray(data)) { 4645 queue = dataPriv.access(elem, type, jQuery.makeArray(data)); 4646 } else { 4647 queue.push(data); 4648 } 4649 } 4650 return queue || []; 4651 } 4652 }, 4653 4654 dequeue: function (elem, type) { 4655 type = type || "fx"; 4656 4657 var queue = jQuery.queue(elem, type), 4658 startLength = queue.length, 4659 fn = queue.shift(), 4660 hooks = jQuery._queueHooks(elem, type), 4661 next = function () { 4662 jQuery.dequeue(elem, type); 4663 }; 4664 4665 // If the fx queue is dequeued, always remove the progress sentinel 4666 if (fn === "inprogress") { 4667 fn = queue.shift(); 4668 startLength--; 4669 } 4670 4671 if (fn) { 4672 4673 // Add a progress sentinel to prevent the fx queue from being 4674 // automatically dequeued 4675 if (type === "fx") { 4676 queue.unshift("inprogress"); 4677 } 4678 4679 // Clear up the last queue stop function 4680 delete hooks.stop; 4681 fn.call(elem, next, hooks); 4682 } 4683 4684 if (!startLength && hooks) { 4685 hooks.empty.fire(); 4686 } 4687 }, 4688 4689 // Not public - generate a queueHooks object, or return the current one 4690 _queueHooks: function (elem, type) { 4691 var key = type + "queueHooks"; 4692 return dataPriv.get(elem, key) || dataPriv.access(elem, key, { 4693 empty: jQuery.Callbacks("once memory").add(function () { 4694 dataPriv.remove(elem, [type + "queue", key]); 4695 }) 4696 }); 4697 } 4698 }); 4699 4700 jQuery.fn.extend({ 4701 queue: function (type, data) { 4702 var setter = 2; 4703 4704 if (typeof type !== "string") { 4705 data = type; 4706 type = "fx"; 4707 setter--; 4708 } 4709 4710 if (arguments.length < setter) { 4711 return jQuery.queue(this[0], type); 4712 } 4713 4714 return data === undefined ? 4715 this : 4716 this.each(function () { 4717 var queue = jQuery.queue(this, type, data); 4718 4719 // Ensure a hooks for this queue 4720 jQuery._queueHooks(this, type); 4721 4722 if (type === "fx" && queue[0] !== "inprogress") { 4723 jQuery.dequeue(this, type); 4724 } 4725 }); 4726 }, 4727 dequeue: function (type) { 4728 return this.each(function () { 4729 jQuery.dequeue(this, type); 4730 }); 4731 }, 4732 clearQueue: function (type) { 4733 return this.queue(type || "fx", []); 4734 }, 4735 4736 // Get a promise resolved when queues of a certain type 4737 // are emptied (fx is the type by default) 4738 promise: function (type, obj) { 4739 var tmp, 4740 count = 1, 4741 defer = jQuery.Deferred(), 4742 elements = this, 4743 i = this.length, 4744 resolve = function () { 4745 if (!(--count)) { 4746 defer.resolveWith(elements, [elements]); 4747 } 4748 }; 4749 4750 if (typeof type !== "string") { 4751 obj = type; 4752 type = undefined; 4753 } 4754 type = type || "fx"; 4755 4756 while (i--) { 4757 tmp = dataPriv.get(elements[i], type + "queueHooks"); 4758 if (tmp && tmp.empty) { 4759 count++; 4760 tmp.empty.add(resolve); 4761 } 4762 } 4763 resolve(); 4764 return defer.promise(obj); 4765 } 4766 }); 4767 var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source; 4768 4769 var rcssNum = new RegExp("^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i"); 4770 4771 4772 var cssExpand = ["Top", "Right", "Bottom", "Left"]; 4773 4774 var documentElement = document.documentElement; 4775 4776 4777 4778 var isAttached = function (elem) { 4779 return jQuery.contains(elem.ownerDocument, elem); 4780 }, 4781 composed = { composed: true }; 4782 4783 // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only 4784 // Check attachment across shadow DOM boundaries when possible (gh-3504) 4785 // Support: iOS 10.0-10.2 only 4786 // Early iOS 10 versions support `attachShadow` but not `getRootNode`, 4787 // leading to errors. We need to check for `getRootNode`. 4788 if (documentElement.getRootNode) { 4789 isAttached = function (elem) { 4790 return jQuery.contains(elem.ownerDocument, elem) || 4791 elem.getRootNode(composed) === elem.ownerDocument; 4792 }; 4793 } 4794 var isHiddenWithinTree = function (elem, el) { 4795 4796 // isHiddenWithinTree might be called from jQuery#filter function; 4797 // in that case, element will be second argument 4798 elem = el || elem; 4799 4800 // Inline style trumps all 4801 return elem.style.display === "none" || 4802 elem.style.display === "" && 4803 4804 // Otherwise, check computed style 4805 // Support: Firefox <=43 - 45 4806 // Disconnected elements can have computed display: none, so first confirm that elem is 4807 // in the document. 4808 isAttached(elem) && 4809 4810 jQuery.css(elem, "display") === "none"; 4811 }; 4812 4813 4814 4815 function adjustCSS(elem, prop, valueParts, tween) { 4816 var adjusted, scale, 4817 maxIterations = 20, 4818 currentValue = tween ? 4819 function () { 4820 return tween.cur(); 4821 } : 4822 function () { 4823 return jQuery.css(elem, prop, ""); 4824 }, 4825 initial = currentValue(), 4826 unit = valueParts && valueParts[3] || (jQuery.cssNumber[prop] ? "" : "px"), 4827 4828 // Starting value computation is required for potential unit mismatches 4829 initialInUnit = elem.nodeType && 4830 (jQuery.cssNumber[prop] || unit !== "px" && +initial) && 4831 rcssNum.exec(jQuery.css(elem, prop)); 4832 4833 if (initialInUnit && initialInUnit[3] !== unit) { 4834 4835 // Support: Firefox <=54 4836 // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144) 4837 initial = initial / 2; 4838 4839 // Trust units reported by jQuery.css 4840 unit = unit || initialInUnit[3]; 4841 4842 // Iteratively approximate from a nonzero starting point 4843 initialInUnit = +initial || 1; 4844 4845 while (maxIterations--) { 4846 4847 // Evaluate and update our best guess (doubling guesses that zero out). 4848 // Finish if the scale equals or crosses 1 (making the old*new product non-positive). 4849 jQuery.style(elem, prop, initialInUnit + unit); 4850 if ((1 - scale) * (1 - (scale = currentValue() / initial || 0.5)) <= 0) { 4851 maxIterations = 0; 4852 } 4853 initialInUnit = initialInUnit / scale; 4854 4855 } 4856 4857 initialInUnit = initialInUnit * 2; 4858 jQuery.style(elem, prop, initialInUnit + unit); 4859 4860 // Make sure we update the tween properties later on 4861 valueParts = valueParts || []; 4862 } 4863 4864 if (valueParts) { 4865 initialInUnit = +initialInUnit || +initial || 0; 4866 4867 // Apply relative offset (+=/-=) if specified 4868 adjusted = valueParts[1] ? 4869 initialInUnit + (valueParts[1] + 1) * valueParts[2] : 4870 +valueParts[2]; 4871 if (tween) { 4872 tween.unit = unit; 4873 tween.start = initialInUnit; 4874 tween.end = adjusted; 4875 } 4876 } 4877 return adjusted; 4878 } 4879 4880 4881 var defaultDisplayMap = {}; 4882 4883 function getDefaultDisplay(elem) { 4884 var temp, 4885 doc = elem.ownerDocument, 4886 nodeName = elem.nodeName, 4887 display = defaultDisplayMap[nodeName]; 4888 4889 if (display) { 4890 return display; 4891 } 4892 4893 temp = doc.body.appendChild(doc.createElement(nodeName)); 4894 display = jQuery.css(temp, "display"); 4895 4896 temp.parentNode.removeChild(temp); 4897 4898 if (display === "none") { 4899 display = "block"; 4900 } 4901 defaultDisplayMap[nodeName] = display; 4902 4903 return display; 4904 } 4905 4906 function showHide(elements, show) { 4907 var display, elem, 4908 values = [], 4909 index = 0, 4910 length = elements.length; 4911 4912 // Determine new display value for elements that need to change 4913 for (; index < length; index++) { 4914 elem = elements[index]; 4915 if (!elem.style) { 4916 continue; 4917 } 4918 4919 display = elem.style.display; 4920 if (show) { 4921 4922 // Since we force visibility upon cascade-hidden elements, an immediate (and slow) 4923 // check is required in this first loop unless we have a nonempty display value (either 4924 // inline or about-to-be-restored) 4925 if (display === "none") { 4926 values[index] = dataPriv.get(elem, "display") || null; 4927 if (!values[index]) { 4928 elem.style.display = ""; 4929 } 4930 } 4931 if (elem.style.display === "" && isHiddenWithinTree(elem)) { 4932 values[index] = getDefaultDisplay(elem); 4933 } 4934 } else { 4935 if (display !== "none") { 4936 values[index] = "none"; 4937 4938 // Remember what we're overwriting 4939 dataPriv.set(elem, "display", display); 4940 } 4941 } 4942 } 4943 4944 // Set the display of the elements in a second loop to avoid constant reflow 4945 for (index = 0; index < length; index++) { 4946 if (values[index] != null) { 4947 elements[index].style.display = values[index]; 4948 } 4949 } 4950 4951 return elements; 4952 } 4953 4954 jQuery.fn.extend({ 4955 show: function () { 4956 return showHide(this, true); 4957 }, 4958 hide: function () { 4959 return showHide(this); 4960 }, 4961 toggle: function (state) { 4962 if (typeof state === "boolean") { 4963 return state ? this.show() : this.hide(); 4964 } 4965 4966 return this.each(function () { 4967 if (isHiddenWithinTree(this)) { 4968 jQuery(this).show(); 4969 } else { 4970 jQuery(this).hide(); 4971 } 4972 }); 4973 } 4974 }); 4975 var rcheckableType = (/^(?:checkbox|radio)$/i); 4976 4977 var rtagName = (/<([a-z][^\/\0>\x20\t\r\n\f]*)/i); 4978 4979 var rscriptType = (/^$|^module$|\/(?:java|ecma)script/i); 4980 4981 4982 4983 (function () { 4984 var fragment = document.createDocumentFragment(), 4985 div = fragment.appendChild(document.createElement("div")), 4986 input = document.createElement("input"); 4987 4988 // Support: Android 4.0 - 4.3 only 4989 // Check state lost if the name is set (trac-11217) 4990 // Support: Windows Web Apps (WWA) 4991 // `name` and `type` must use .setAttribute for WWA (trac-14901) 4992 input.setAttribute("type", "radio"); 4993 input.setAttribute("checked", "checked"); 4994 input.setAttribute("name", "t"); 4995 4996 div.appendChild(input); 4997 4998 // Support: Android <=4.1 only
vendor: 10,857 bytes, lines 4999-5392
4999 // Older WebKit doesn't clone checked state correctly in fragments 5000 support.checkClone = div.cloneNode(true).cloneNode(true).lastChild.checked; 5001 5002 // Support: IE <=11 only 5003 // Make sure textarea (and checkbox) defaultValue is properly cloned 5004 div.innerHTML = "<textarea>x</textarea>"; 5005 support.noCloneChecked = !!div.cloneNode(true).lastChild.defaultValue; 5006 5007 // Support: IE <=9 only 5008 // IE <=9 replaces <option> tags with their contents when inserted outside of 5009 // the select element. 5010 div.innerHTML = "<option></option>"; 5011 support.option = !!div.lastChild; 5012 })(); 5013 5014 5015 // We have to close these tags to support XHTML (trac-13200) 5016 var wrapMap = { 5017 5018 // XHTML parsers do not magically insert elements in the 5019 // same way that tag soup parsers do. So we cannot shorten 5020 // this by omitting <tbody> or other required elements. 5021 thead: [1, "<table>", "</table>"], 5022 col: [2, "<table><colgroup>", "</colgroup></table>"], 5023 tr: [2, "<table><tbody>", "</tbody></table>"], 5024 td: [3, "<table><tbody><tr>", "</tr></tbody></table>"], 5025 5026 _default: [0, "", ""] 5027 }; 5028 5029 wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; 5030 wrapMap.th = wrapMap.td; 5031 5032 // Support: IE <=9 only 5033 if (!support.option) { 5034 wrapMap.optgroup = wrapMap.option = [1, "<select multiple='multiple'>", "</select>"]; 5035 } 5036 5037 5038 function getAll(context, tag) { 5039 5040 // Support: IE <=9 - 11 only 5041 // Use typeof to avoid zero-argument method invocation on host objects (trac-15151) 5042 var ret; 5043 5044 if (typeof context.getElementsByTagName !== "undefined") { 5045 ret = context.getElementsByTagName(tag || "*"); 5046 5047 } else if (typeof context.querySelectorAll !== "undefined") { 5048 ret = context.querySelectorAll(tag || "*"); 5049 5050 } else { 5051 ret = []; 5052 } 5053 5054 if (tag === undefined || tag && nodeName(context, tag)) { 5055 return jQuery.merge([context], ret); 5056 } 5057 5058 return ret; 5059 } 5060 5061 5062 // Mark scripts as having already been evaluated 5063 function setGlobalEval(elems, refElements) { 5064 var i = 0, 5065 l = elems.length; 5066 5067 for (; i < l; i++) { 5068 dataPriv.set( 5069 elems[i], 5070 "globalEval", 5071 !refElements || dataPriv.get(refElements[i], "globalEval") 5072 ); 5073 } 5074 } 5075 5076 5077 var rhtml = /<|&#?\w+;/; 5078 5079 function buildFragment(elems, context, scripts, selection, ignored) { 5080 var elem, tmp, tag, wrap, attached, j, 5081 fragment = context.createDocumentFragment(), 5082 nodes = [], 5083 i = 0, 5084 l = elems.length; 5085 5086 for (; i < l; i++) { 5087 elem = elems[i]; 5088 5089 if (elem || elem === 0) { 5090 5091 // Add nodes directly 5092 if (toType(elem) === "object") { 5093 5094 // Support: Android <=4.0 only, PhantomJS 1 only 5095 // push.apply(_, arraylike) throws on ancient WebKit 5096 jQuery.merge(nodes, elem.nodeType ? [elem] : elem); 5097 5098 // Convert non-html into a text node 5099 } else if (!rhtml.test(elem)) { 5100 nodes.push(context.createTextNode(elem)); 5101 5102 // Convert html into DOM nodes 5103 } else { 5104 tmp = tmp || fragment.appendChild(context.createElement("div")); 5105 5106 // Deserialize a standard representation 5107 tag = (rtagName.exec(elem) || ["", ""])[1].toLowerCase(); 5108 wrap = wrapMap[tag] || wrapMap._default; 5109 tmp.innerHTML = wrap[1] + jQuery.htmlPrefilter(elem) + wrap[2]; 5110 5111 // Descend through wrappers to the right content 5112 j = wrap[0]; 5113 while (j--) { 5114 tmp = tmp.lastChild; 5115 } 5116 5117 // Support: Android <=4.0 only, PhantomJS 1 only 5118 // push.apply(_, arraylike) throws on ancient WebKit 5119 jQuery.merge(nodes, tmp.childNodes); 5120 5121 // Remember the top-level container 5122 tmp = fragment.firstChild; 5123 5124 // Ensure the created nodes are orphaned (trac-12392) 5125 tmp.textContent = ""; 5126 } 5127 } 5128 } 5129 5130 // Remove wrapper from fragment 5131 fragment.textContent = ""; 5132 5133 i = 0; 5134 while ((elem = nodes[i++])) { 5135 5136 // Skip elements already in the context collection (trac-4087) 5137 if (selection && jQuery.inArray(elem, selection) > -1) { 5138 if (ignored) { 5139 ignored.push(elem); 5140 } 5141 continue; 5142 } 5143 5144 attached = isAttached(elem); 5145 5146 // Append to fragment 5147 tmp = getAll(fragment.appendChild(elem), "script"); 5148 5149 // Preserve script evaluation history 5150 if (attached) { 5151 setGlobalEval(tmp); 5152 } 5153 5154 // Capture executables 5155 if (scripts) { 5156 j = 0; 5157 while ((elem = tmp[j++])) { 5158 if (rscriptType.test(elem.type || "")) { 5159 scripts.push(elem); 5160 } 5161 } 5162 } 5163 } 5164 5165 return fragment; 5166 } 5167 5168 5169 var rtypenamespace = /^([^.]*)(?:\.(.+)|)/; 5170 5171 function returnTrue() { 5172 return true; 5173 } 5174 5175 function returnFalse() { 5176 return false; 5177 } 5178 5179 // Support: IE <=9 - 11+ 5180 // focus() and blur() are asynchronous, except when they are no-op. 5181 // So expect focus to be synchronous when the element is already active, 5182 // and blur to be synchronous when the element is not already active. 5183 // (focus and blur are always synchronous in other supported browsers, 5184 // this just defines when we can count on it). 5185 function expectSync(elem, type) { 5186 return (elem === safeActiveElement()) === (type === "focus"); 5187 } 5188 5189 // Support: IE <=9 only 5190 // Accessing document.activeElement can throw unexpectedly 5191 // https://bugs.jquery.com/ticket/13393 5192 function safeActiveElement() { 5193 try { 5194 return document.activeElement; 5195 } catch (err) { } 5196 } 5197 5198 function on(elem, types, selector, data, fn, one) { 5199 var origFn, type; 5200 5201 // Types can be a map of types/handlers 5202 if (typeof types === "object") { 5203 5204 // ( types-Object, selector, data ) 5205 if (typeof selector !== "string") { 5206 5207 // ( types-Object, data ) 5208 data = data || selector; 5209 selector = undefined; 5210 } 5211 for (type in types) { 5212 on(elem, type, selector, data, types[type], one); 5213 } 5214 return elem; 5215 } 5216 5217 if (data == null && fn == null) { 5218 5219 // ( types, fn ) 5220 fn = selector; 5221 data = selector = undefined; 5222 } else if (fn == null) { 5223 if (typeof selector === "string") { 5224 5225 // ( types, selector, fn ) 5226 fn = data; 5227 data = undefined; 5228 } else { 5229 5230 // ( types, data, fn ) 5231 fn = data; 5232 data = selector; 5233 selector = undefined; 5234 } 5235 } 5236 if (fn === false) { 5237 fn = returnFalse; 5238 } else if (!fn) { 5239 return elem; 5240 } 5241 5242 if (one === 1) { 5243 origFn = fn; 5244 fn = function (event) { 5245 5246 // Can use an empty set, since event contains the info 5247 jQuery().off(event); 5248 return origFn.apply(this, arguments); 5249 }; 5250 5251 // Use same guid so caller can remove using origFn 5252 fn.guid = origFn.guid || (origFn.guid = jQuery.guid++); 5253 } 5254 return elem.each(function () { 5255 jQuery.event.add(this, types, fn, data, selector); 5256 }); 5257 } 5258 5259 /* 5260 * Helper functions for managing events -- not part of the public interface. 5261 * Props to Dean Edwards' addEvent library for many of the ideas. 5262 */ 5263 jQuery.event = { 5264 5265 global: {}, 5266 5267 add: function (elem, types, handler, data, selector) { 5268 5269 var handleObjIn, eventHandle, tmp, 5270 events, t, handleObj, 5271 special, handlers, type, namespaces, origType, 5272 elemData = dataPriv.get(elem); 5273 5274 // Only attach events to objects that accept data 5275 if (!acceptData(elem)) { 5276 return; 5277 } 5278 5279 // Caller can pass in an object of custom data in lieu of the handler 5280 if (handler.handler) { 5281 handleObjIn = handler; 5282 handler = handleObjIn.handler; 5283 selector = handleObjIn.selector; 5284 } 5285 5286 // Ensure that invalid selectors throw exceptions at attach time 5287 // Evaluate against documentElement in case elem is a non-element node (e.g., document) 5288 if (selector) { 5289 jQuery.find.matchesSelector(documentElement, selector); 5290 } 5291 5292 // Make sure that the handler has a unique ID, used to find/remove it later 5293 if (!handler.guid) { 5294 handler.guid = jQuery.guid++; 5295 } 5296 5297 // Init the element's event structure and main handler, if this is the first 5298 if (!(events = elemData.events)) { 5299 events = elemData.events = Object.create(null); 5300 } 5301 if (!(eventHandle = elemData.handle)) { 5302 eventHandle = elemData.handle = function (e) { 5303 5304 // Discard the second event of a jQuery.event.trigger() and 5305 // when an event is called after a page has unloaded 5306 return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? 5307 jQuery.event.dispatch.apply(elem, arguments) : undefined; 5308 }; 5309 } 5310 5311 // Handle multiple events separated by a space 5312 types = (types || "").match(rnothtmlwhite) || [""]; 5313 t = types.length; 5314 while (t--) { 5315 tmp = rtypenamespace.exec(types[t]) || []; 5316 type = origType = tmp[1]; 5317 namespaces = (tmp[2] || "").split(".").sort(); 5318 5319 // There *must* be a type, no attaching namespace-only handlers 5320 if (!type) { 5321 continue; 5322 } 5323 5324 // If event changes its type, use the special event handlers for the changed type 5325 special = jQuery.event.special[type] || {}; 5326 5327 // If selector defined, determine special event api type, otherwise given type 5328 type = (selector ? special.delegateType : special.bindType) || type; 5329 5330 // Update special based on newly reset type 5331 special = jQuery.event.special[type] || {}; 5332 5333 // handleObj is passed to all event handlers 5334 handleObj = jQuery.extend({ 5335 type: type, 5336 origType: origType, 5337 data: data, 5338 handler: handler, 5339 guid: handler.guid, 5340 selector: selector, 5341 needsContext: selector && jQuery.expr.match.needsContext.test(selector), 5342 namespace: namespaces.join(".") 5343 }, handleObjIn); 5344 5345 // Init the event handler queue if we're the first 5346 if (!(handlers = events[type])) { 5347 handlers = events[type] = []; 5348 handlers.delegateCount = 0; 5349 5350 // Only use addEventListener if the special events handler returns false 5351 if (!special.setup || 5352 special.setup.call(elem, data, namespaces, eventHandle) === false) { 5353 5354 if (elem.addEventListener) { 5355 elem.addEventListener(type, eventHandle); 5356 } 5357 } 5358 } 5359 5360 if (special.add) { 5361 special.add.call(elem, handleObj); 5362 5363 if (!handleObj.handler.guid) { 5364 handleObj.handler.guid = handler.guid; 5365 } 5366 } 5367 5368 // Add to the element's handler list, delegates in front 5369 if (selector) { 5370 handlers.splice(handlers.delegateCount++, 0, handleObj); 5371 } else { 5372 handlers.push(handleObj); 5373 } 5374 5375 // Keep track of which events have ever been used, for event optimization 5376 jQuery.event.global[type] = true; 5377 } 5378 5379 }, 5380 5381 // Detach an event or set of events from an element 5382 remove: function (elem, types, handler, selector, mappedTypes) { 5383 5384 var j, origCount, tmp, 5385 events, t, handleObj, 5386 special, handlers, type, namespaces, origType, 5387 elemData = dataPriv.hasData(elem) && dataPriv.get(elem); 5388 5389 if (!elemData || !(events = elemData.events)) { 5390 return; 5391 } 5392
vendor: 4,303 bytes, lines 5393-5531
5393 // Once for each type.namespace in types; type may be omitted 5394 types = (types || "").match(rnothtmlwhite) || [""]; 5395 t = types.length; 5396 while (t--) { 5397 tmp = rtypenamespace.exec(types[t]) || []; 5398 type = origType = tmp[1]; 5399 namespaces = (tmp[2] || "").split(".").sort(); 5400 5401 // Unbind all events (on this namespace, if provided) for the element 5402 if (!type) { 5403 for (type in events) { 5404 jQuery.event.remove(elem, type + types[t], handler, selector, true); 5405 } 5406 continue; 5407 } 5408 5409 special = jQuery.event.special[type] || {}; 5410 type = (selector ? special.delegateType : special.bindType) || type; 5411 handlers = events[type] || []; 5412 tmp = tmp[2] && 5413 new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)"); 5414 5415 // Remove matching events 5416 origCount = j = handlers.length; 5417 while (j--) { 5418 handleObj = handlers[j]; 5419 5420 if ((mappedTypes || origType === handleObj.origType) && 5421 (!handler || handler.guid === handleObj.guid) && 5422 (!tmp || tmp.test(handleObj.namespace)) && 5423 (!selector || selector === handleObj.selector || 5424 selector === "**" && handleObj.selector)) { 5425 handlers.splice(j, 1); 5426 5427 if (handleObj.selector) { 5428 handlers.delegateCount--; 5429 } 5430 if (special.remove) { 5431 special.remove.call(elem, handleObj); 5432 } 5433 } 5434 } 5435 5436 // Remove generic event handler if we removed something and no more handlers exist 5437 // (avoids potential for endless recursion during removal of special event handlers) 5438 if (origCount && !handlers.length) { 5439 if (!special.teardown || 5440 special.teardown.call(elem, namespaces, elemData.handle) === false) { 5441 5442 jQuery.removeEvent(elem, type, elemData.handle); 5443 } 5444 5445 delete events[type]; 5446 } 5447 } 5448 5449 // Remove data and the expando if it's no longer used 5450 if (jQuery.isEmptyObject(events)) { 5451 dataPriv.remove(elem, "handle events"); 5452 } 5453 }, 5454 5455 dispatch: function (nativeEvent) { 5456 5457 var i, j, ret, matched, handleObj, handlerQueue, 5458 args = new Array(arguments.length), 5459 5460 // Make a writable jQuery.Event from the native event object 5461 event = jQuery.event.fix(nativeEvent), 5462 5463 handlers = ( 5464 dataPriv.get(this, "events") || Object.create(null) 5465 )[event.type] || [], 5466 special = jQuery.event.special[event.type] || {}; 5467 5468 // Use the fix-ed jQuery.Event rather than the (read-only) native event 5469 args[0] = event; 5470 5471 for (i = 1; i < arguments.length; i++) { 5472 args[i] = arguments[i]; 5473 } 5474 5475 event.delegateTarget = this; 5476 5477 // Call the preDispatch hook for the mapped type, and let it bail if desired 5478 if (special.preDispatch && special.preDispatch.call(this, event) === false) { 5479 return; 5480 } 5481 5482 // Determine handlers 5483 handlerQueue = jQuery.event.handlers.call(this, event, handlers); 5484 5485 // Run delegates first; they may want to stop propagation beneath us 5486 i = 0; 5487 while ((matched = handlerQueue[i++]) && !event.isPropagationStopped()) { 5488 event.currentTarget = matched.elem; 5489 5490 j = 0; 5491 while ((handleObj = matched.handlers[j++]) && 5492 !event.isImmediatePropagationStopped()) { 5493 5494 // If the event is namespaced, then each handler is only invoked if it is 5495 // specially universal or its namespaces are a superset of the event's. 5496 if (!event.rnamespace || handleObj.namespace === false || 5497 event.rnamespace.test(handleObj.namespace)) { 5498 5499 event.handleObj = handleObj; 5500 event.data = handleObj.data; 5501 5502 ret = ((jQuery.event.special[handleObj.origType] || {}).handle || 5503 handleObj.handler).apply(matched.elem, args); 5504 5505 if (ret !== undefined) { 5506 if ((event.result = ret) === false) { 5507 event.preventDefault(); 5508 event.stopPropagation(); 5509 } 5510 } 5511 } 5512 } 5513 } 5514 5515 // Call the postDispatch hook for the mapped type 5516 if (special.postDispatch) { 5517 special.postDispatch.call(this, event); 5518 } 5519 5520 return event.result; 5521 }, 5522 5523 handlers: function (event, handlers) { 5524 var i, handleObj, sel, matchedHandlers, matchedSelectors, 5525 handlerQueue = [], 5526 delegateCount = handlers.delegateCount, 5527 cur = event.target; 5528 5529 // Find delegate handlers 5530 if (delegateCount && 5531
vendor: 14,474 bytes, lines 5532-6024
5532 // Support: IE <=9 5533 // Black-hole SVG <use> instance trees (trac-13180) 5534 cur.nodeType && 5535 5536 // Support: Firefox <=42 5537 // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) 5538 // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click 5539 // Support: IE 11 only 5540 // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) 5541 !(event.type === "click" && event.button >= 1)) { 5542 5543 for (; cur !== this; cur = cur.parentNode || this) { 5544 5545 // Don't check non-elements (trac-13208) 5546 // Don't process clicks on disabled elements (trac-6911, trac-8165, trac-11382, trac-11764) 5547 if (cur.nodeType === 1 && !(event.type === "click" && cur.disabled === true)) { 5548 matchedHandlers = []; 5549 matchedSelectors = {}; 5550 for (i = 0; i < delegateCount; i++) { 5551 handleObj = handlers[i]; 5552 5553 // Don't conflict with Object.prototype properties (trac-13203) 5554 sel = handleObj.selector + " "; 5555 5556 if (matchedSelectors[sel] === undefined) { 5557 matchedSelectors[sel] = handleObj.needsContext ? 5558 jQuery(sel, this).index(cur) > -1 : 5559 jQuery.find(sel, this, null, [cur]).length; 5560 } 5561 if (matchedSelectors[sel]) { 5562 matchedHandlers.push(handleObj); 5563 } 5564 } 5565 if (matchedHandlers.length) { 5566 handlerQueue.push({ elem: cur, handlers: matchedHandlers }); 5567 } 5568 } 5569 } 5570 } 5571 5572 // Add the remaining (directly-bound) handlers 5573 cur = this; 5574 if (delegateCount < handlers.length) { 5575 handlerQueue.push({ elem: cur, handlers: handlers.slice(delegateCount) }); 5576 } 5577 5578 return handlerQueue; 5579 }, 5580 5581 addProp: function (name, hook) { 5582 Object.defineProperty(jQuery.Event.prototype, name, { 5583 enumerable: true, 5584 configurable: true, 5585 5586 get: isFunction(hook) ? 5587 function () { 5588 if (this.originalEvent) { 5589 return hook(this.originalEvent); 5590 } 5591 } : 5592 function () { 5593 if (this.originalEvent) { 5594 return this.originalEvent[name]; 5595 } 5596 }, 5597 5598 set: function (value) { 5599 Object.defineProperty(this, name, { 5600 enumerable: true, 5601 configurable: true, 5602 writable: true, 5603 value: value 5604 }); 5605 } 5606 }); 5607 }, 5608 5609 fix: function (originalEvent) { 5610 return originalEvent[jQuery.expando] ? 5611 originalEvent : 5612 new jQuery.Event(originalEvent); 5613 }, 5614 5615 special: { 5616 load: { 5617 5618 // Prevent triggered image.load events from bubbling to window.load 5619 noBubble: true 5620 }, 5621 click: { 5622 5623 // Utilize native event to ensure correct state for checkable inputs 5624 setup: function (data) { 5625 5626 // For mutual compressibility with _default, replace `this` access with a local var. 5627 // `|| data` is dead code meant only to preserve the variable through minification. 5628 var el = this || data; 5629 5630 // Claim the first handler 5631 if (rcheckableType.test(el.type) && 5632 el.click && nodeName(el, "input")) { 5633 5634 // dataPriv.set( el, "click", ... ) 5635 leverageNative(el, "click", returnTrue); 5636 } 5637 5638 // Return false to allow normal processing in the caller 5639 return false; 5640 }, 5641 trigger: function (data) { 5642 5643 // For mutual compressibility with _default, replace `this` access with a local var. 5644 // `|| data` is dead code meant only to preserve the variable through minification. 5645 var el = this || data; 5646 5647 // Force setup before triggering a click 5648 if (rcheckableType.test(el.type) && 5649 el.click && nodeName(el, "input")) { 5650 5651 leverageNative(el, "click"); 5652 } 5653 5654 // Return non-false to allow normal event-path propagation 5655 return true; 5656 }, 5657 5658 // For cross-browser consistency, suppress native .click() on links 5659 // Also prevent it if we're currently inside a leveraged native-event stack 5660 _default: function (event) { 5661 var target = event.target; 5662 return rcheckableType.test(target.type) && 5663 target.click && nodeName(target, "input") && 5664 dataPriv.get(target, "click") || 5665 nodeName(target, "a"); 5666 } 5667 }, 5668 5669 beforeunload: { 5670 postDispatch: function (event) { 5671 5672 // Support: Firefox 20+ 5673 // Firefox doesn't alert if the returnValue field is not set. 5674 if (event.result !== undefined && event.originalEvent) { 5675 event.originalEvent.returnValue = event.result; 5676 } 5677 } 5678 } 5679 } 5680 }; 5681 5682 // Ensure the presence of an event listener that handles manually-triggered 5683 // synthetic events by interrupting progress until reinvoked in response to 5684 // *native* events that it fires directly, ensuring that state changes have 5685 // already occurred before other listeners are invoked. 5686 function leverageNative(el, type, expectSync) { 5687 5688 // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add 5689 if (!expectSync) { 5690 if (dataPriv.get(el, type) === undefined) { 5691 jQuery.event.add(el, type, returnTrue); 5692 } 5693 return; 5694 } 5695 5696 // Register the controller as a special universal handler for all event namespaces 5697 dataPriv.set(el, type, false); 5698 jQuery.event.add(el, type, { 5699 namespace: false, 5700 handler: function (event) { 5701 var notAsync, result, 5702 saved = dataPriv.get(this, type); 5703 5704 if ((event.isTrigger & 1) && this[type]) { 5705 5706 // Interrupt processing of the outer synthetic .trigger()ed event 5707 // Saved data should be false in such cases, but might be a leftover capture object 5708 // from an async native handler (gh-4350) 5709 if (!saved.length) { 5710 5711 // Store arguments for use when handling the inner native event 5712 // There will always be at least one argument (an event object), so this array 5713 // will not be confused with a leftover capture object. 5714 saved = slice.call(arguments); 5715 dataPriv.set(this, type, saved); 5716 5717 // Trigger the native event and capture its result 5718 // Support: IE <=9 - 11+ 5719 // focus() and blur() are asynchronous 5720 notAsync = expectSync(this, type); 5721 this[type](); 5722 result = dataPriv.get(this, type); 5723 if (saved !== result || notAsync) { 5724 dataPriv.set(this, type, false); 5725 } else { 5726 result = {}; 5727 } 5728 if (saved !== result) { 5729 5730 // Cancel the outer synthetic event 5731 event.stopImmediatePropagation(); 5732 event.preventDefault(); 5733 5734 // Support: Chrome 86+ 5735 // In Chrome, if an element having a focusout handler is blurred by 5736 // clicking outside of it, it invokes the handler synchronously. If 5737 // that handler calls `.remove()` on the element, the data is cleared, 5738 // leaving `result` undefined. We need to guard against this. 5739 return result && result.value; 5740 } 5741 5742 // If this is an inner synthetic event for an event with a bubbling surrogate 5743 // (focus or blur), assume that the surrogate already propagated from triggering the 5744 // native event and prevent that from happening again here. 5745 // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the 5746 // bubbling surrogate propagates *after* the non-bubbling base), but that seems 5747 // less bad than duplication. 5748 } else if ((jQuery.event.special[type] || {}).delegateType) { 5749 event.stopPropagation(); 5750 } 5751 5752 // If this is a native event triggered above, everything is now in order 5753 // Fire an inner synthetic event with the original arguments 5754 } else if (saved.length) { 5755 5756 // ...and capture the result 5757 dataPriv.set(this, type, { 5758 value: jQuery.event.trigger( 5759 5760 // Support: IE <=9 - 11+ 5761 // Extend with the prototype to reset the above stopImmediatePropagation() 5762 jQuery.extend(saved[0], jQuery.Event.prototype), 5763 saved.slice(1), 5764 this 5765 ) 5766 }); 5767 5768 // Abort handling of the native event 5769 event.stopImmediatePropagation(); 5770 } 5771 } 5772 }); 5773 } 5774 5775 jQuery.removeEvent = function (elem, type, handle) { 5776 5777 // This "if" is needed for plain objects 5778 if (elem.removeEventListener) { 5779 elem.removeEventListener(type, handle); 5780 } 5781 }; 5782 5783 jQuery.Event = function (src, props) { 5784 5785 // Allow instantiation without the 'new' keyword 5786 if (!(this instanceof jQuery.Event)) { 5787 return new jQuery.Event(src, props); 5788 } 5789 5790 // Event object 5791 if (src && src.type) { 5792 this.originalEvent = src; 5793 this.type = src.type; 5794 5795 // Events bubbling up the document may have been marked as prevented 5796 // by a handler lower down the tree; reflect the correct value. 5797 this.isDefaultPrevented = src.defaultPrevented || 5798 src.defaultPrevented === undefined && 5799 5800 // Support: Android <=2.3 only 5801 src.returnValue === false ? 5802 returnTrue : 5803 returnFalse; 5804 5805 // Create target properties 5806 // Support: Safari <=6 - 7 only 5807 // Target should not be a text node (trac-504, trac-13143) 5808 this.target = (src.target && src.target.nodeType === 3) ? 5809 src.target.parentNode : 5810 src.target; 5811 5812 this.currentTarget = src.currentTarget; 5813 this.relatedTarget = src.relatedTarget; 5814 5815 // Event type 5816 } else { 5817 this.type = src; 5818 } 5819 5820 // Put explicitly provided properties onto the event object 5821 if (props) { 5822 jQuery.extend(this, props); 5823 } 5824 5825 // Create a timestamp if incoming event doesn't have one 5826 this.timeStamp = src && src.timeStamp || Date.now(); 5827 5828 // Mark it as fixed 5829 this[jQuery.expando] = true; 5830 }; 5831 5832 // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding 5833 // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html 5834 jQuery.Event.prototype = { 5835 constructor: jQuery.Event, 5836 isDefaultPrevented: returnFalse, 5837 isPropagationStopped: returnFalse, 5838 isImmediatePropagationStopped: returnFalse, 5839 isSimulated: false, 5840 5841 preventDefault: function () { 5842 var e = this.originalEvent; 5843 5844 this.isDefaultPrevented = returnTrue; 5845 5846 if (e && !this.isSimulated) { 5847 e.preventDefault(); 5848 } 5849 }, 5850 stopPropagation: function () { 5851 var e = this.originalEvent; 5852 5853 this.isPropagationStopped = returnTrue; 5854 5855 if (e && !this.isSimulated) { 5856 e.stopPropagation(); 5857 } 5858 }, 5859 stopImmediatePropagation: function () { 5860 var e = this.originalEvent; 5861 5862 this.isImmediatePropagationStopped = returnTrue; 5863 5864 if (e && !this.isSimulated) { 5865 e.stopImmediatePropagation(); 5866 } 5867 5868 this.stopPropagation(); 5869 } 5870 }; 5871 5872 // Includes all common event props including KeyEvent and MouseEvent specific props 5873 jQuery.each({ 5874 altKey: true, 5875 bubbles: true, 5876 cancelable: true, 5877 changedTouches: true, 5878 ctrlKey: true, 5879 detail: true, 5880 eventPhase: true, 5881 metaKey: true, 5882 pageX: true, 5883 pageY: true, 5884 shiftKey: true, 5885 view: true, 5886 "char": true, 5887 code: true, 5888 charCode: true, 5889 key: true, 5890 keyCode: true, 5891 button: true, 5892 buttons: true, 5893 clientX: true, 5894 clientY: true, 5895 offsetX: true, 5896 offsetY: true, 5897 pointerId: true, 5898 pointerType: true, 5899 screenX: true, 5900 screenY: true, 5901 targetTouches: true, 5902 toElement: true, 5903 touches: true, 5904 which: true 5905 }, jQuery.event.addProp); 5906 5907 jQuery.each({ focus: "focusin", blur: "focusout" }, function (type, delegateType) { 5908 jQuery.event.special[type] = { 5909 5910 // Utilize native event if possible so blur/focus sequence is correct 5911 setup: function () { 5912 5913 // Claim the first handler 5914 // dataPriv.set( this, "focus", ... ) 5915 // dataPriv.set( this, "blur", ... ) 5916 leverageNative(this, type, expectSync); 5917 5918 // Return false to allow normal processing in the caller 5919 return false; 5920 }, 5921 trigger: function () { 5922 5923 // Force setup before trigger 5924 leverageNative(this, type); 5925 5926 // Return non-false to allow normal event-path propagation 5927 return true; 5928 }, 5929 5930 // Suppress native focus or blur if we're currently inside 5931 // a leveraged native-event stack 5932 _default: function (event) { 5933 return dataPriv.get(event.target, type); 5934 }, 5935 5936 delegateType: delegateType 5937 }; 5938 }); 5939 5940 // Create mouseenter/leave events using mouseover/out and event-time checks 5941 // so that event delegation works in jQuery. 5942 // Do the same for pointerenter/pointerleave and pointerover/pointerout 5943 // 5944 // Support: Safari 7 only 5945 // Safari sends mouseenter too often; see: 5946 // https://bugs.chromium.org/p/chromium/issues/detail?id=470258 5947 // for the description of the bug (it existed in older Chrome versions as well). 5948 jQuery.each({ 5949 mouseenter: "mouseover", 5950 mouseleave: "mouseout", 5951 pointerenter: "pointerover", 5952 pointerleave: "pointerout" 5953 }, function (orig, fix) { 5954 jQuery.event.special[orig] = { 5955 delegateType: fix, 5956 bindType: fix, 5957 5958 handle: function (event) { 5959 var ret, 5960 target = this, 5961 related = event.relatedTarget, 5962 handleObj = event.handleObj; 5963 5964 // For mouseenter/leave call the handler if related is outside the target. 5965 // NB: No relatedTarget if the mouse left/entered the browser window 5966 if (!related || (related !== target && !jQuery.contains(target, related))) { 5967 event.type = handleObj.origType; 5968 ret = handleObj.handler.apply(this, arguments); 5969 event.type = fix; 5970 } 5971 return ret; 5972 } 5973 }; 5974 }); 5975 5976 jQuery.fn.extend({ 5977 5978 on: function (types, selector, data, fn) { 5979 return on(this, types, selector, data, fn); 5980 }, 5981 one: function (types, selector, data, fn) { 5982 return on(this, types, selector, data, fn, 1); 5983 }, 5984 off: function (types, selector, fn) { 5985 var handleObj, type; 5986 if (types && types.preventDefault && types.handleObj) { 5987 5988 // ( event ) dispatched jQuery.Event 5989 handleObj = types.handleObj; 5990 jQuery(types.delegateTarget).off( 5991 handleObj.namespace ? 5992 handleObj.origType + "." + handleObj.namespace : 5993 handleObj.origType, 5994 handleObj.selector, 5995 handleObj.handler 5996 ); 5997 return this; 5998 } 5999 if (typeof types === "object") { 6000 6001 // ( types-object [, selector] ) 6002 for (type in types) { 6003 this.off(type, selector, types[type]); 6004 } 6005 return this; 6006 } 6007 if (selector === false || typeof selector === "function") { 6008 6009 // ( types [, fn] ) 6010 fn = selector; 6011 selector = undefined; 6012 } 6013 if (fn === false) { 6014 fn = returnFalse; 6015 } 6016 return this.each(function () { 6017 jQuery.event.remove(this, types, fn, selector); 6018 }); 6019 } 6020 }); 6021 6022 6023 var 6024
vendor: 10,547 bytes, lines 6025-6401
6025 // Support: IE <=10 - 11, Edge 12 - 13 only 6026 // In IE/Edge using regex groups here causes severe slowdowns. 6027 // See https://connect.microsoft.com/IE/feedback/details/1736512/ 6028 rnoInnerhtml = /<script|<style|<link/i, 6029 6030 // checked="checked" or checked 6031 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, 6032 6033 rcleanScript = /^\s*<!\[CDATA\[|\]\]>\s*$/g; 6034 6035 // Prefer a tbody over its parent table for containing new rows 6036 function manipulationTarget(elem, content) { 6037 if (nodeName(elem, "table") && 6038 nodeName(content.nodeType !== 11 ? content : content.firstChild, "tr")) { 6039 6040 return jQuery(elem).children("tbody")[0] || elem; 6041 } 6042 6043 return elem; 6044 } 6045 6046 // Replace/restore the type attribute of script elements for safe DOM manipulation 6047 function disableScript(elem) { 6048 elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type; 6049 return elem; 6050 } 6051 function restoreScript(elem) { 6052 if ((elem.type || "").slice(0, 5) === "true/") { 6053 elem.type = elem.type.slice(5); 6054 } else { 6055 elem.removeAttribute("type"); 6056 } 6057 6058 return elem; 6059 } 6060 6061 function cloneCopyEvent(src, dest) { 6062 var i, l, type, pdataOld, udataOld, udataCur, events; 6063 6064 if (dest.nodeType !== 1) { 6065 return; 6066 } 6067 6068 // 1. Copy private data: events, handlers, etc. 6069 if (dataPriv.hasData(src)) { 6070 pdataOld = dataPriv.get(src); 6071 events = pdataOld.events; 6072 6073 if (events) { 6074 dataPriv.remove(dest, "handle events"); 6075 6076 for (type in events) { 6077 for (i = 0, l = events[type].length; i < l; i++) { 6078 jQuery.event.add(dest, type, events[type][i]); 6079 } 6080 } 6081 } 6082 } 6083 6084 // 2. Copy user data 6085 if (dataUser.hasData(src)) { 6086 udataOld = dataUser.access(src); 6087 udataCur = jQuery.extend({}, udataOld); 6088 6089 dataUser.set(dest, udataCur); 6090 } 6091 } 6092 6093 // Fix IE bugs, see support tests 6094 function fixInput(src, dest) { 6095 var nodeName = dest.nodeName.toLowerCase(); 6096 6097 // Fails to persist the checked state of a cloned checkbox or radio button. 6098 if (nodeName === "input" && rcheckableType.test(src.type)) { 6099 dest.checked = src.checked; 6100 6101 // Fails to return the selected option to the default selected state when cloning options 6102 } else if (nodeName === "input" || nodeName === "textarea") { 6103 dest.defaultValue = src.defaultValue; 6104 } 6105 } 6106 6107 function domManip(collection, args, callback, ignored) { 6108 6109 // Flatten any nested arrays 6110 args = flat(args); 6111 6112 var fragment, first, scripts, hasScripts, node, doc, 6113 i = 0, 6114 l = collection.length, 6115 iNoClone = l - 1, 6116 value = args[0], 6117 valueIsFunction = isFunction(value); 6118 6119 // We can't cloneNode fragments that contain checked, in WebKit 6120 if (valueIsFunction || 6121 (l > 1 && typeof value === "string" && 6122 !support.checkClone && rchecked.test(value))) { 6123 return collection.each(function (index) { 6124 var self = collection.eq(index); 6125 if (valueIsFunction) { 6126 args[0] = value.call(this, index, self.html()); 6127 } 6128 domManip(self, args, callback, ignored); 6129 }); 6130 } 6131 6132 if (l) { 6133 fragment = buildFragment(args, collection[0].ownerDocument, false, collection, ignored); 6134 first = fragment.firstChild; 6135 6136 if (fragment.childNodes.length === 1) { 6137 fragment = first; 6138 } 6139 6140 // Require either new content or an interest in ignored elements to invoke the callback 6141 if (first || ignored) { 6142 scripts = jQuery.map(getAll(fragment, "script"), disableScript); 6143 hasScripts = scripts.length; 6144 6145 // Use the original fragment for the last item 6146 // instead of the first because it can end up 6147 // being emptied incorrectly in certain situations (trac-8070). 6148 for (; i < l; i++) { 6149 node = fragment; 6150 6151 if (i !== iNoClone) { 6152 node = jQuery.clone(node, true, true); 6153 6154 // Keep references to cloned scripts for later restoration 6155 if (hasScripts) { 6156 6157 // Support: Android <=4.0 only, PhantomJS 1 only 6158 // push.apply(_, arraylike) throws on ancient WebKit 6159 jQuery.merge(scripts, getAll(node, "script")); 6160 } 6161 } 6162 6163 callback.call(collection[i], node, i); 6164 } 6165 6166 if (hasScripts) { 6167 doc = scripts[scripts.length - 1].ownerDocument; 6168 6169 // Reenable scripts 6170 jQuery.map(scripts, restoreScript); 6171 6172 // Evaluate executable scripts on first document insertion 6173 for (i = 0; i < hasScripts; i++) { 6174 node = scripts[i]; 6175 if (rscriptType.test(node.type || "") && 6176 !dataPriv.access(node, "globalEval") && 6177 jQuery.contains(doc, node)) { 6178 6179 if (node.src && (node.type || "").toLowerCase() !== "module") { 6180 6181 // Optional AJAX dependency, but won't run scripts if not present 6182 if (jQuery._evalUrl && !node.noModule) { 6183 jQuery._evalUrl(node.src, { 6184 nonce: node.nonce || node.getAttribute("nonce") 6185 }, doc); 6186 } 6187 } else { 6188 6189 // Unwrap a CDATA section containing script contents. This shouldn't be 6190 // needed as in XML documents they're already not visible when 6191 // inspecting element contents and in HTML documents they have no 6192 // meaning but we're preserving that logic for backwards compatibility. 6193 // This will be removed completely in 4.0. See gh-4904. 6194 DOMEval(node.textContent.replace(rcleanScript, ""), node, doc); 6195 } 6196 } 6197 } 6198 } 6199 } 6200 } 6201 6202 return collection; 6203 } 6204 6205 function remove(elem, selector, keepData) { 6206 var node, 6207 nodes = selector ? jQuery.filter(selector, elem) : elem, 6208 i = 0; 6209 6210 for (; (node = nodes[i]) != null; i++) { 6211 if (!keepData && node.nodeType === 1) { 6212 jQuery.cleanData(getAll(node)); 6213 } 6214 6215 if (node.parentNode) { 6216 if (keepData && isAttached(node)) { 6217 setGlobalEval(getAll(node, "script")); 6218 } 6219 node.parentNode.removeChild(node); 6220 } 6221 } 6222 6223 return elem; 6224 } 6225 6226 jQuery.extend({ 6227 htmlPrefilter: function (html) { 6228 return html; 6229 }, 6230 6231 clone: function (elem, dataAndEvents, deepDataAndEvents) { 6232 var i, l, srcElements, destElements, 6233 clone = elem.cloneNode(true), 6234 inPage = isAttached(elem); 6235 6236 // Fix IE cloning issues 6237 if (!support.noCloneChecked && (elem.nodeType === 1 || elem.nodeType === 11) && 6238 !jQuery.isXMLDoc(elem)) { 6239 6240 // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2 6241 destElements = getAll(clone); 6242 srcElements = getAll(elem); 6243 6244 for (i = 0, l = srcElements.length; i < l; i++) { 6245 fixInput(srcElements[i], destElements[i]); 6246 } 6247 } 6248 6249 // Copy the events from the original to the clone 6250 if (dataAndEvents) { 6251 if (deepDataAndEvents) { 6252 srcElements = srcElements || getAll(elem); 6253 destElements = destElements || getAll(clone); 6254 6255 for (i = 0, l = srcElements.length; i < l; i++) { 6256 cloneCopyEvent(srcElements[i], destElements[i]); 6257 } 6258 } else { 6259 cloneCopyEvent(elem, clone); 6260 } 6261 } 6262 6263 // Preserve script evaluation history 6264 destElements = getAll(clone, "script"); 6265 if (destElements.length > 0) { 6266 setGlobalEval(destElements, !inPage && getAll(elem, "script")); 6267 } 6268 6269 // Return the cloned set 6270 return clone; 6271 }, 6272 6273 cleanData: function (elems) { 6274 var data, elem, type, 6275 special = jQuery.event.special, 6276 i = 0; 6277 6278 for (; (elem = elems[i]) !== undefined; i++) { 6279 if (acceptData(elem)) { 6280 if ((data = elem[dataPriv.expando])) { 6281 if (data.events) { 6282 for (type in data.events) { 6283 if (special[type]) { 6284 jQuery.event.remove(elem, type); 6285 6286 // This is a shortcut to avoid jQuery.event.remove's overhead 6287 } else { 6288 jQuery.removeEvent(elem, type, data.handle); 6289 } 6290 } 6291 } 6292 6293 // Support: Chrome <=35 - 45+ 6294 // Assign undefined instead of using delete, see Data#remove 6295 elem[dataPriv.expando] = undefined; 6296 } 6297 if (elem[dataUser.expando]) { 6298 6299 // Support: Chrome <=35 - 45+ 6300 // Assign undefined instead of using delete, see Data#remove 6301 elem[dataUser.expando] = undefined; 6302 } 6303 } 6304 } 6305 } 6306 }); 6307 6308 jQuery.fn.extend({ 6309 detach: function (selector) { 6310 return remove(this, selector, true); 6311 }, 6312 6313 remove: function (selector) { 6314 return remove(this, selector); 6315 }, 6316 6317 text: function (value) { 6318 return access(this, function (value) { 6319 return value === undefined ? 6320 jQuery.text(this) : 6321 this.empty().each(function () { 6322 if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) { 6323 this.textContent = value; 6324 } 6325 }); 6326 }, null, value, arguments.length); 6327 }, 6328 6329 append: function () { 6330 return domManip(this, arguments, function (elem) { 6331 if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) { 6332 var target = manipulationTarget(this, elem); 6333 target.appendChild(elem); 6334 } 6335 }); 6336 }, 6337 6338 prepend: function () { 6339 return domManip(this, arguments, function (elem) { 6340 if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) { 6341 var target = manipulationTarget(this, elem); 6342 target.insertBefore(elem, target.firstChild); 6343 } 6344 }); 6345 }, 6346 6347 before: function () { 6348 return domManip(this, arguments, function (elem) { 6349 if (this.parentNode) { 6350 this.parentNode.insertBefore(elem, this); 6351 } 6352 }); 6353 }, 6354 6355 after: function () { 6356 return domManip(this, arguments, function (elem) { 6357 if (this.parentNode) { 6358 this.parentNode.insertBefore(elem, this.nextSibling); 6359 } 6360 }); 6361 }, 6362 6363 empty: function () { 6364 var elem, 6365 i = 0; 6366 6367 for (; (elem = this[i]) != null; i++) { 6368 if (elem.nodeType === 1) { 6369 6370 // Prevent memory leaks 6371 jQuery.cleanData(getAll(elem, false)); 6372 6373 // Remove any remaining nodes 6374 elem.textContent = ""; 6375 } 6376 } 6377 6378 return this; 6379 }, 6380 6381 clone: function (dataAndEvents, deepDataAndEvents) { 6382 dataAndEvents = dataAndEvents == null ? false : dataAndEvents; 6383 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; 6384 6385 return this.map(function () { 6386 return jQuery.clone(this, dataAndEvents, deepDataAndEvents); 6387 }); 6388 }, 6389 6390 html: function (value) { 6391 return access(this, function (value) { 6392 var elem = this[0] || {}, 6393 i = 0, 6394 l = this.length; 6395 6396 if (value === undefined && elem.nodeType === 1) { 6397 return elem.innerHTML; 6398 } 6399 6400 // See if we can take a shortcut and just use innerHTML 6401 if (typeof value === "string" && !rnoInnerhtml.test(value) &&
vendor: 4,191 bytes, lines 6402-6560
6402 !wrapMap[(rtagName.exec(value) || ["", ""])[1].toLowerCase()]) { 6403 6404 value = jQuery.htmlPrefilter(value); 6405 6406 try { 6407 for (; i < l; i++) { 6408 elem = this[i] || {}; 6409 6410 // Remove element nodes and prevent memory leaks 6411 if (elem.nodeType === 1) { 6412 jQuery.cleanData(getAll(elem, false)); 6413 elem.innerHTML = value; 6414 } 6415 } 6416 6417 elem = 0; 6418 6419 // If using innerHTML throws an exception, use the fallback method 6420 } catch (e) { } 6421 } 6422 6423 if (elem) { 6424 this.empty().append(value); 6425 } 6426 }, null, value, arguments.length); 6427 }, 6428 6429 replaceWith: function () { 6430 var ignored = []; 6431 6432 // Make the changes, replacing each non-ignored context element with the new content 6433 return domManip(this, arguments, function (elem) { 6434 var parent = this.parentNode; 6435 6436 if (jQuery.inArray(this, ignored) < 0) { 6437 jQuery.cleanData(getAll(this)); 6438 if (parent) { 6439 parent.replaceChild(elem, this); 6440 } 6441 } 6442 6443 // Force callback invocation 6444 }, ignored); 6445 } 6446 }); 6447 6448 jQuery.each({ 6449 appendTo: "append", 6450 prependTo: "prepend", 6451 insertBefore: "before", 6452 insertAfter: "after", 6453 replaceAll: "replaceWith" 6454 }, function (name, original) { 6455 jQuery.fn[name] = function (selector) { 6456 var elems, 6457 ret = [], 6458 insert = jQuery(selector), 6459 last = insert.length - 1, 6460 i = 0; 6461 6462 for (; i <= last; i++) { 6463 elems = i === last ? this : this.clone(true); 6464 jQuery(insert[i])[original](elems); 6465 6466 // Support: Android <=4.0 only, PhantomJS 1 only 6467 // .get() because push.apply(_, arraylike) throws on ancient WebKit 6468 push.apply(ret, elems.get()); 6469 } 6470 6471 return this.pushStack(ret); 6472 }; 6473 }); 6474 var rnumnonpx = new RegExp("^(" + pnum + ")(?!px)[a-z%]+$", "i"); 6475 6476 var rcustomProp = /^--/; 6477 6478 6479 var getStyles = function (elem) { 6480 6481 // Support: IE <=11 only, Firefox <=30 (trac-15098, trac-14150) 6482 // IE throws on elements created in popups 6483 // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" 6484 var view = elem.ownerDocument.defaultView; 6485 6486 if (!view || !view.opener) { 6487 view = window; 6488 } 6489 6490 return view.getComputedStyle(elem); 6491 }; 6492 6493 var swap = function (elem, options, callback) { 6494 var ret, name, 6495 old = {}; 6496 6497 // Remember the old values, and insert the new ones 6498 for (name in options) { 6499 old[name] = elem.style[name]; 6500 elem.style[name] = options[name]; 6501 } 6502 6503 ret = callback.call(elem); 6504 6505 // Revert the old values 6506 for (name in options) { 6507 elem.style[name] = old[name]; 6508 } 6509 6510 return ret; 6511 }; 6512 6513 6514 var rboxStyle = new RegExp(cssExpand.join("|"), "i"); 6515 6516 var whitespace = "[\\x20\\t\\r\\n\\f]"; 6517 6518 6519 var rtrimCSS = new RegExp( 6520 "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", 6521 "g" 6522 ); 6523 6524 6525 6526 6527 (function () { 6528 6529 // Executing both pixelPosition & boxSizingReliable tests require only one layout 6530 // so they're executed at the same time to save the second computation. 6531 function computeStyleTests() { 6532 6533 // This is a singleton, we need to execute it only once 6534 if (!div) { 6535 return; 6536 } 6537 6538 container.style.cssText = "position:absolute;left:-11111px;width:60px;" + 6539 "margin-top:1px;padding:0;border:0"; 6540 div.style.cssText = 6541 "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + 6542 "margin:auto;border:1px;padding:1px;" + 6543 "width:60%;top:1%"; 6544 documentElement.appendChild(container).appendChild(div); 6545 6546 var divStyle = window.getComputedStyle(div); 6547 pixelPositionVal = divStyle.top !== "1%"; 6548 6549 // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 6550 reliableMarginLeftVal = roundPixelMeasures(divStyle.marginLeft) === 12; 6551 6552 // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3 6553 // Some styles come back with percentage values, even though they shouldn't 6554 div.style.right = "60%"; 6555 pixelBoxStylesVal = roundPixelMeasures(divStyle.right) === 36; 6556 6557 // Support: IE 9 - 11 only 6558 // Detect misreporting of content dimensions for box-sizing:border-box elements 6559 boxSizingReliableVal = roundPixelMeasures(divStyle.width) === 36; 6560
vendor: 4,698 bytes, lines 6561-6697
6561 // Support: IE 9 only 6562 // Detect overflow:scroll screwiness (gh-3699) 6563 // Support: Chrome <=64 6564 // Don't get tricked when zoom affects offsetWidth (gh-4029) 6565 div.style.position = "absolute"; 6566 scrollboxSizeVal = roundPixelMeasures(div.offsetWidth / 3) === 12; 6567 6568 documentElement.removeChild(container); 6569 6570 // Nullify the div so it wouldn't be stored in the memory and 6571 // it will also be a sign that checks already performed 6572 div = null; 6573 } 6574 6575 function roundPixelMeasures(measure) { 6576 return Math.round(parseFloat(measure)); 6577 } 6578 6579 var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, 6580 reliableTrDimensionsVal, reliableMarginLeftVal, 6581 container = document.createElement("div"), 6582 div = document.createElement("div"); 6583 6584 // Finish early in limited (non-browser) environments 6585 if (!div.style) { 6586 return; 6587 } 6588 6589 // Support: IE <=9 - 11 only 6590 // Style of cloned element affects source element cloned (trac-8908) 6591 div.style.backgroundClip = "content-box"; 6592 div.cloneNode(true).style.backgroundClip = ""; 6593 support.clearCloneStyle = div.style.backgroundClip === "content-box"; 6594 6595 jQuery.extend(support, { 6596 boxSizingReliable: function () { 6597 computeStyleTests(); 6598 return boxSizingReliableVal; 6599 }, 6600 pixelBoxStyles: function () { 6601 computeStyleTests(); 6602 return pixelBoxStylesVal; 6603 }, 6604 pixelPosition: function () { 6605 computeStyleTests(); 6606 return pixelPositionVal; 6607 }, 6608 reliableMarginLeft: function () { 6609 computeStyleTests(); 6610 return reliableMarginLeftVal; 6611 }, 6612 scrollboxSize: function () { 6613 computeStyleTests(); 6614 return scrollboxSizeVal; 6615 }, 6616 6617 // Support: IE 9 - 11+, Edge 15 - 18+ 6618 // IE/Edge misreport `getComputedStyle` of table rows with width/height 6619 // set in CSS while `offset*` properties report correct values. 6620 // Behavior in IE 9 is more subtle than in newer versions & it passes 6621 // some versions of this test; make sure not to make it pass there! 6622 // 6623 // Support: Firefox 70+ 6624 // Only Firefox includes border widths 6625 // in computed dimensions. (gh-4529) 6626 reliableTrDimensions: function () { 6627 var table, tr, trChild, trStyle; 6628 if (reliableTrDimensionsVal == null) { 6629 table = document.createElement("table"); 6630 tr = document.createElement("tr"); 6631 trChild = document.createElement("div"); 6632 6633 table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate"; 6634 tr.style.cssText = "border:1px solid"; 6635 6636 // Support: Chrome 86+ 6637 // Height set through cssText does not get applied. 6638 // Computed height then comes back as 0. 6639 tr.style.height = "1px"; 6640 trChild.style.height = "9px"; 6641 6642 // Support: Android 8 Chrome 86+ 6643 // In our bodyBackground.html iframe, 6644 // display for all div elements is set to "inline", 6645 // which causes a problem only in Android 8 Chrome 86. 6646 // Ensuring the div is display: block 6647 // gets around this issue. 6648 trChild.style.display = "block"; 6649 6650 documentElement 6651 .appendChild(table) 6652 .appendChild(tr) 6653 .appendChild(trChild); 6654 6655 trStyle = window.getComputedStyle(tr); 6656 reliableTrDimensionsVal = (parseInt(trStyle.height, 10) + 6657 parseInt(trStyle.borderTopWidth, 10) + 6658 parseInt(trStyle.borderBottomWidth, 10)) === tr.offsetHeight; 6659 6660 documentElement.removeChild(table); 6661 } 6662 return reliableTrDimensionsVal; 6663 } 6664 }); 6665 })(); 6666 6667 6668 function curCSS(elem, name, computed) { 6669 var width, minWidth, maxWidth, ret, 6670 isCustomProp = rcustomProp.test(name), 6671 6672 // Support: Firefox 51+ 6673 // Retrieving style before computed somehow 6674 // fixes an issue with getting wrong values 6675 // on detached elements 6676 style = elem.style; 6677 6678 computed = computed || getStyles(elem); 6679 6680 // getPropertyValue is needed for: 6681 // .css('filter') (IE 9 only, trac-12537) 6682 // .css('--customProperty) (gh-3144) 6683 if (computed) { 6684 6685 // Support: IE <=9 - 11+ 6686 // IE only supports `"float"` in `getPropertyValue`; in computed styles 6687 // it's only available as `"cssFloat"`. We no longer modify properties 6688 // sent to `.css()` apart from camelCasing, so we need to check both. 6689 // Normally, this would create difference in behavior: if 6690 // `getPropertyValue` returns an empty string, the value returned 6691 // by `.css()` would be `undefined`. This is usually the case for 6692 // disconnected elements. However, in IE even disconnected elements 6693 // with no styles return `"none"` for `getPropertyValue( "float" )` 6694 ret = computed.getPropertyValue(name) || computed[name]; 6695 6696 if (isCustomProp && ret) { 6697
vendor: 13,724 bytes, lines 6698-7143
6698 // Support: Firefox 105+, Chrome <=105+ 6699 // Spec requires trimming whitespace for custom properties (gh-4926). 6700 // Firefox only trims leading whitespace. Chrome just collapses 6701 // both leading & trailing whitespace to a single space. 6702 // 6703 // Fall back to `undefined` if empty string returned. 6704 // This collapses a missing definition with property defined 6705 // and set to an empty string but there's no standard API 6706 // allowing us to differentiate them without a performance penalty 6707 // and returning `undefined` aligns with older jQuery. 6708 // 6709 // rtrimCSS treats U+000D CARRIAGE RETURN and U+000C FORM FEED 6710 // as whitespace while CSS does not, but this is not a problem 6711 // because CSS preprocessing replaces them with U+000A LINE FEED 6712 // (which *is* CSS whitespace) 6713 // https://www.w3.org/TR/css-syntax-3/#input-preprocessing 6714 ret = ret.replace(rtrimCSS, "$1") || undefined; 6715 } 6716 6717 if (ret === "" && !isAttached(elem)) { 6718 ret = jQuery.style(elem, name); 6719 } 6720 6721 // A tribute to the "awesome hack by Dean Edwards" 6722 // Android Browser returns percentage for some values, 6723 // but width seems to be reliably pixels. 6724 // This is against the CSSOM draft spec: 6725 // https://drafts.csswg.org/cssom/#resolved-values 6726 if (!support.pixelBoxStyles() && rnumnonpx.test(ret) && rboxStyle.test(name)) { 6727 6728 // Remember the original values 6729 width = style.width; 6730 minWidth = style.minWidth; 6731 maxWidth = style.maxWidth; 6732 6733 // Put in the new values to get a computed value out 6734 style.minWidth = style.maxWidth = style.width = ret; 6735 ret = computed.width; 6736 6737 // Revert the changed values 6738 style.width = width; 6739 style.minWidth = minWidth; 6740 style.maxWidth = maxWidth; 6741 } 6742 } 6743 6744 return ret !== undefined ? 6745 6746 // Support: IE <=9 - 11 only 6747 // IE returns zIndex value as an integer. 6748 ret + "" : 6749 ret; 6750 } 6751 6752 6753 function addGetHookIf(conditionFn, hookFn) { 6754 6755 // Define the hook, we'll check on the first run if it's really needed. 6756 return { 6757 get: function () { 6758 if (conditionFn()) { 6759 6760 // Hook not needed (or it's not possible to use it due 6761 // to missing dependency), remove it. 6762 delete this.get; 6763 return; 6764 } 6765 6766 // Hook needed; redefine it so that the support test is not executed again. 6767 return (this.get = hookFn).apply(this, arguments); 6768 } 6769 }; 6770 } 6771 6772 6773 var cssPrefixes = ["Webkit", "Moz", "ms"], 6774 emptyStyle = document.createElement("div").style, 6775 vendorProps = {}; 6776 6777 // Return a vendor-prefixed property or undefined 6778 function vendorPropName(name) { 6779 6780 // Check for vendor prefixed names 6781 var capName = name[0].toUpperCase() + name.slice(1), 6782 i = cssPrefixes.length; 6783 6784 while (i--) { 6785 name = cssPrefixes[i] + capName; 6786 if (name in emptyStyle) { 6787 return name; 6788 } 6789 } 6790 } 6791 6792 // Return a potentially-mapped jQuery.cssProps or vendor prefixed property 6793 function finalPropName(name) { 6794 var final = jQuery.cssProps[name] || vendorProps[name]; 6795 6796 if (final) { 6797 return final; 6798 } 6799 if (name in emptyStyle) { 6800 return name; 6801 } 6802 return vendorProps[name] = vendorPropName(name) || name; 6803 } 6804 6805 6806 var 6807 6808 // Swappable if display is none or starts with table 6809 // except "table", "table-cell", or "table-caption" 6810 // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display 6811 rdisplayswap = /^(none|table(?!-c[ea]).+)/, 6812 cssShow = { position: "absolute", visibility: "hidden", display: "block" }, 6813 cssNormalTransform = { 6814 letterSpacing: "0", 6815 fontWeight: "400" 6816 }; 6817 6818 function setPositiveNumber(_elem, value, subtract) { 6819 6820 // Any relative (+/-) values have already been 6821 // normalized at this point 6822 var matches = rcssNum.exec(value); 6823 return matches ? 6824 6825 // Guard against undefined "subtract", e.g., when used as in cssHooks 6826 Math.max(0, matches[2] - (subtract || 0)) + (matches[3] || "px") : 6827 value; 6828 } 6829 6830 function boxModelAdjustment(elem, dimension, box, isBorderBox, styles, computedVal) { 6831 var i = dimension === "width" ? 1 : 0, 6832 extra = 0, 6833 delta = 0; 6834 6835 // Adjustment may not be necessary 6836 if (box === (isBorderBox ? "border" : "content")) { 6837 return 0; 6838 } 6839 6840 for (; i < 4; i += 2) { 6841 6842 // Both box models exclude margin 6843 if (box === "margin") { 6844 delta += jQuery.css(elem, box + cssExpand[i], true, styles); 6845 } 6846 6847 // If we get here with a content-box, we're seeking "padding" or "border" or "margin" 6848 if (!isBorderBox) { 6849 6850 // Add padding 6851 delta += jQuery.css(elem, "padding" + cssExpand[i], true, styles); 6852 6853 // For "border" or "margin", add border 6854 if (box !== "padding") { 6855 delta += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles); 6856 6857 // But still keep track of it otherwise 6858 } else { 6859 extra += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles); 6860 } 6861 6862 // If we get here with a border-box (content + padding + border), we're seeking "content" or 6863 // "padding" or "margin" 6864 } else { 6865 6866 // For "content", subtract padding 6867 if (box === "content") { 6868 delta -= jQuery.css(elem, "padding" + cssExpand[i], true, styles); 6869 } 6870 6871 // For "content" or "padding", subtract border 6872 if (box !== "margin") { 6873 delta -= jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles); 6874 } 6875 } 6876 } 6877 6878 // Account for positive content-box scroll gutter when requested by providing computedVal 6879 if (!isBorderBox && computedVal >= 0) { 6880 6881 // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border 6882 // Assuming integer scroll gutter, subtract the rest and round down 6883 delta += Math.max(0, Math.ceil( 6884 elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - 6885 computedVal - 6886 delta - 6887 extra - 6888 0.5 6889 6890 // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter 6891 // Use an explicit zero to avoid NaN (gh-3964) 6892 )) || 0; 6893 } 6894 6895 return delta; 6896 } 6897 6898 function getWidthOrHeight(elem, dimension, extra) { 6899 6900 // Start with computed style 6901 var styles = getStyles(elem), 6902 6903 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322). 6904 // Fake content-box until we know it's needed to know the true value. 6905 boxSizingNeeded = !support.boxSizingReliable() || extra, 6906 isBorderBox = boxSizingNeeded && 6907 jQuery.css(elem, "boxSizing", false, styles) === "border-box", 6908 valueIsBorderBox = isBorderBox, 6909 6910 val = curCSS(elem, dimension, styles), 6911 offsetProp = "offset" + dimension[0].toUpperCase() + dimension.slice(1); 6912 6913 // Support: Firefox <=54 6914 // Return a confounding non-pixel value or feign ignorance, as appropriate. 6915 if (rnumnonpx.test(val)) { 6916 if (!extra) { 6917 return val; 6918 } 6919 val = "auto"; 6920 } 6921 6922 6923 // Support: IE 9 - 11 only 6924 // Use offsetWidth/offsetHeight for when box sizing is unreliable. 6925 // In those cases, the computed value can be trusted to be border-box. 6926 if ((!support.boxSizingReliable() && isBorderBox || 6927 6928 // Support: IE 10 - 11+, Edge 15 - 18+ 6929 // IE/Edge misreport `getComputedStyle` of table rows with width/height 6930 // set in CSS while `offset*` properties report correct values. 6931 // Interestingly, in some cases IE 9 doesn't suffer from this issue. 6932 !support.reliableTrDimensions() && nodeName(elem, "tr") || 6933 6934 // Fall back to offsetWidth/offsetHeight when value is "auto" 6935 // This happens for inline elements with no explicit setting (gh-3571) 6936 val === "auto" || 6937 6938 // Support: Android <=4.1 - 4.3 only 6939 // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602) 6940 !parseFloat(val) && jQuery.css(elem, "display", false, styles) === "inline") && 6941 6942 // Make sure the element is visible & connected 6943 elem.getClientRects().length) { 6944 6945 isBorderBox = jQuery.css(elem, "boxSizing", false, styles) === "border-box"; 6946 6947 // Where available, offsetWidth/offsetHeight approximate border box dimensions. 6948 // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the 6949 // retrieved value as a content box dimension. 6950 valueIsBorderBox = offsetProp in elem; 6951 if (valueIsBorderBox) { 6952 val = elem[offsetProp]; 6953 } 6954 } 6955 6956 // Normalize "" and auto 6957 val = parseFloat(val) || 0; 6958 6959 // Adjust for the element's box model 6960 return (val + 6961 boxModelAdjustment( 6962 elem, 6963 dimension, 6964 extra || (isBorderBox ? "border" : "content"), 6965 valueIsBorderBox, 6966 styles, 6967 6968 // Provide the current computed size to request scroll gutter calculation (gh-3589) 6969 val 6970 ) 6971 ) + "px"; 6972 } 6973 6974 jQuery.extend({ 6975 6976 // Add in style property hooks for overriding the default 6977 // behavior of getting and setting a style property 6978 cssHooks: { 6979 opacity: { 6980 get: function (elem, computed) { 6981 if (computed) { 6982 6983 // We should always get a number back from opacity 6984 var ret = curCSS(elem, "opacity"); 6985 return ret === "" ? "1" : ret; 6986 } 6987 } 6988 } 6989 }, 6990 6991 // Don't automatically add "px" to these possibly-unitless properties 6992 cssNumber: { 6993 "animationIterationCount": true, 6994 "columnCount": true, 6995 "fillOpacity": true, 6996 "flexGrow": true, 6997 "flexShrink": true, 6998 "fontWeight": true, 6999 "gridArea": true, 7000 "gridColumn": true, 7001 "gridColumnEnd": true, 7002 "gridColumnStart": true, 7003 "gridRow": true, 7004 "gridRowEnd": true, 7005 "gridRowStart": true, 7006 "lineHeight": true, 7007 "opacity": true, 7008 "order": true, 7009 "orphans": true, 7010 "widows": true, 7011 "zIndex": true, 7012 "zoom": true 7013 }, 7014 7015 // Add in properties whose names you wish to fix before 7016 // setting or getting the value 7017 cssProps: {}, 7018 7019 // Get and set the style property on a DOM Node 7020 style: function (elem, name, value, extra) { 7021 7022 // Don't set styles on text and comment nodes 7023 if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style) { 7024 return; 7025 } 7026 7027 // Make sure that we're working with the right name 7028 var ret, type, hooks, 7029 origName = camelCase(name), 7030 isCustomProp = rcustomProp.test(name), 7031 style = elem.style; 7032 7033 // Make sure that we're working with the right name. We don't 7034 // want to query the value if it is a CSS custom property 7035 // since they are user-defined. 7036 if (!isCustomProp) { 7037 name = finalPropName(origName); 7038 } 7039 7040 // Gets hook for the prefixed version, then unprefixed version 7041 hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName]; 7042 7043 // Check if we're setting a value 7044 if (value !== undefined) { 7045 type = typeof value; 7046 7047 // Convert "+=" or "-=" to relative numbers (trac-7345) 7048 if (type === "string" && (ret = rcssNum.exec(value)) && ret[1]) { 7049 value = adjustCSS(elem, name, ret); 7050 7051 // Fixes bug trac-9237 7052 type = "number"; 7053 } 7054 7055 // Make sure that null and NaN values aren't set (trac-7116) 7056 if (value == null || value !== value) { 7057 return; 7058 } 7059 7060 // If a number was passed in, add the unit (except for certain CSS properties) 7061 // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append 7062 // "px" to a few hardcoded values. 7063 if (type === "number" && !isCustomProp) { 7064 value += ret && ret[3] || (jQuery.cssNumber[origName] ? "" : "px"); 7065 } 7066 7067 // background-* props affect original clone's values 7068 if (!support.clearCloneStyle && value === "" && name.indexOf("background") === 0) { 7069 style[name] = "inherit"; 7070 } 7071 7072 // If a hook was provided, use that value, otherwise just set the specified value 7073 if (!hooks || !("set" in hooks) || 7074 (value = hooks.set(elem, value, extra)) !== undefined) { 7075 7076 if (isCustomProp) { 7077 style.setProperty(name, value); 7078 } else { 7079 style[name] = value; 7080 } 7081 } 7082 7083 } else { 7084 7085 // If a hook was provided get the non-computed value from there 7086 if (hooks && "get" in hooks && 7087 (ret = hooks.get(elem, false, extra)) !== undefined) { 7088 7089 return ret; 7090 } 7091 7092 // Otherwise just get the value from the style object 7093 return style[name]; 7094 } 7095 }, 7096 7097 css: function (elem, name, extra, styles) { 7098 var val, num, hooks, 7099 origName = camelCase(name), 7100 isCustomProp = rcustomProp.test(name); 7101 7102 // Make sure that we're working with the right name. We don't 7103 // want to modify the value if it is a CSS custom property 7104 // since they are user-defined. 7105 if (!isCustomProp) { 7106 name = finalPropName(origName); 7107 } 7108 7109 // Try prefixed name followed by the unprefixed name 7110 hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName]; 7111 7112 // If a hook was provided get the computed value from there 7113 if (hooks && "get" in hooks) { 7114 val = hooks.get(elem, true, extra); 7115 } 7116 7117 // Otherwise, if a way to get the computed value exists, use that 7118 if (val === undefined) { 7119 val = curCSS(elem, name, styles); 7120 } 7121 7122 // Convert "normal" to computed value 7123 if (val === "normal" && name in cssNormalTransform) { 7124 val = cssNormalTransform[name]; 7125 } 7126 7127 // Make numeric if forced or a qualifier was provided and val looks numeric 7128 if (extra === "" || extra) { 7129 num = parseFloat(val); 7130 return extra === true || isFinite(num) ? num || 0 : val; 7131 } 7132 7133 return val; 7134 } 7135 }); 7136 7137 jQuery.each(["height", "width"], function (_i, dimension) { 7138 jQuery.cssHooks[dimension] = { 7139 get: function (elem, computed, extra) { 7140 if (computed) { 7141 7142 // Certain elements can have dimension info if we invisibly show them 7143 // but it must have a current display style that would benefit
vendor: 10,269 bytes, lines 7144-7517
7144 return rdisplayswap.test(jQuery.css(elem, "display")) && 7145 7146 // Support: Safari 8+ 7147 // Table columns in Safari have non-zero offsetWidth & zero 7148 // getBoundingClientRect().width unless display is changed. 7149 // Support: IE <=11 only 7150 // Running getBoundingClientRect on a disconnected node 7151 // in IE throws an error. 7152 (!elem.getClientRects().length || !elem.getBoundingClientRect().width) ? 7153 swap(elem, cssShow, function () { 7154 return getWidthOrHeight(elem, dimension, extra); 7155 }) : 7156 getWidthOrHeight(elem, dimension, extra); 7157 } 7158 }, 7159 7160 set: function (elem, value, extra) { 7161 var matches, 7162 styles = getStyles(elem), 7163 7164 // Only read styles.position if the test has a chance to fail 7165 // to avoid forcing a reflow. 7166 scrollboxSizeBuggy = !support.scrollboxSize() && 7167 styles.position === "absolute", 7168 7169 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991) 7170 boxSizingNeeded = scrollboxSizeBuggy || extra, 7171 isBorderBox = boxSizingNeeded && 7172 jQuery.css(elem, "boxSizing", false, styles) === "border-box", 7173 subtract = extra ? 7174 boxModelAdjustment( 7175 elem, 7176 dimension, 7177 extra, 7178 isBorderBox, 7179 styles 7180 ) : 7181 0; 7182 7183 // Account for unreliable border-box dimensions by comparing offset* to computed and 7184 // faking a content-box to get border and padding (gh-3699) 7185 if (isBorderBox && scrollboxSizeBuggy) { 7186 subtract -= Math.ceil( 7187 elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - 7188 parseFloat(styles[dimension]) - 7189 boxModelAdjustment(elem, dimension, "border", false, styles) - 7190 0.5 7191 ); 7192 } 7193 7194 // Convert to pixels if value adjustment is needed 7195 if (subtract && (matches = rcssNum.exec(value)) && 7196 (matches[3] || "px") !== "px") { 7197 7198 elem.style[dimension] = value; 7199 value = jQuery.css(elem, dimension); 7200 } 7201 7202 return setPositiveNumber(elem, value, subtract); 7203 } 7204 }; 7205 }); 7206 7207 jQuery.cssHooks.marginLeft = addGetHookIf(support.reliableMarginLeft, 7208 function (elem, computed) { 7209 if (computed) { 7210 return (parseFloat(curCSS(elem, "marginLeft")) || 7211 elem.getBoundingClientRect().left - 7212 swap(elem, { marginLeft: 0 }, function () { 7213 return elem.getBoundingClientRect().left; 7214 }) 7215 ) + "px"; 7216 } 7217 } 7218 ); 7219 7220 // These hooks are used by animate to expand properties 7221 jQuery.each({ 7222 margin: "", 7223 padding: "", 7224 border: "Width" 7225 }, function (prefix, suffix) { 7226 jQuery.cssHooks[prefix + suffix] = { 7227 expand: function (value) { 7228 var i = 0, 7229 expanded = {}, 7230 7231 // Assumes a single number if not a string 7232 parts = typeof value === "string" ? value.split(" ") : [value]; 7233 7234 for (; i < 4; i++) { 7235 expanded[prefix + cssExpand[i] + suffix] = 7236 parts[i] || parts[i - 2] || parts[0]; 7237 } 7238 7239 return expanded; 7240 } 7241 }; 7242 7243 if (prefix !== "margin") { 7244 jQuery.cssHooks[prefix + suffix].set = setPositiveNumber; 7245 } 7246 }); 7247 7248 jQuery.fn.extend({ 7249 css: function (name, value) { 7250 return access(this, function (elem, name, value) { 7251 var styles, len, 7252 map = {}, 7253 i = 0; 7254 7255 if (Array.isArray(name)) { 7256 styles = getStyles(elem); 7257 len = name.length; 7258 7259 for (; i < len; i++) { 7260 map[name[i]] = jQuery.css(elem, name[i], false, styles); 7261 } 7262 7263 return map; 7264 } 7265 7266 return value !== undefined ? 7267 jQuery.style(elem, name, value) : 7268 jQuery.css(elem, name); 7269 }, name, value, arguments.length > 1); 7270 } 7271 }); 7272 7273 7274 function Tween(elem, options, prop, end, easing) { 7275 return new Tween.prototype.init(elem, options, prop, end, easing); 7276 } 7277 jQuery.Tween = Tween; 7278 7279 Tween.prototype = { 7280 constructor: Tween, 7281 init: function (elem, options, prop, end, easing, unit) { 7282 this.elem = elem; 7283 this.prop = prop; 7284 this.easing = easing || jQuery.easing._default; 7285 this.options = options; 7286 this.start = this.now = this.cur(); 7287 this.end = end; 7288 this.unit = unit || (jQuery.cssNumber[prop] ? "" : "px"); 7289 }, 7290 cur: function () { 7291 var hooks = Tween.propHooks[this.prop]; 7292 7293 return hooks && hooks.get ? 7294 hooks.get(this) : 7295 Tween.propHooks._default.get(this); 7296 }, 7297 run: function (percent) { 7298 var eased, 7299 hooks = Tween.propHooks[this.prop]; 7300 7301 if (this.options.duration) { 7302 this.pos = eased = jQuery.easing[this.easing]( 7303 percent, this.options.duration * percent, 0, 1, this.options.duration 7304 ); 7305 } else { 7306 this.pos = eased = percent; 7307 } 7308 this.now = (this.end - this.start) * eased + this.start; 7309 7310 if (this.options.step) { 7311 this.options.step.call(this.elem, this.now, this); 7312 } 7313 7314 if (hooks && hooks.set) { 7315 hooks.set(this); 7316 } else { 7317 Tween.propHooks._default.set(this); 7318 } 7319 return this; 7320 } 7321 }; 7322 7323 Tween.prototype.init.prototype = Tween.prototype; 7324 7325 Tween.propHooks = { 7326 _default: { 7327 get: function (tween) { 7328 var result; 7329 7330 // Use a property on the element directly when it is not a DOM element, 7331 // or when there is no matching style property that exists. 7332 if (tween.elem.nodeType !== 1 || 7333 tween.elem[tween.prop] != null && tween.elem.style[tween.prop] == null) { 7334 return tween.elem[tween.prop]; 7335 } 7336 7337 // Passing an empty string as a 3rd parameter to .css will automatically 7338 // attempt a parseFloat and fallback to a string if the parse fails. 7339 // Simple values such as "10px" are parsed to Float; 7340 // complex values such as "rotate(1rad)" are returned as-is. 7341 result = jQuery.css(tween.elem, tween.prop, ""); 7342 7343 // Empty strings, null, undefined and "auto" are converted to 0. 7344 return !result || result === "auto" ? 0 : result; 7345 }, 7346 set: function (tween) { 7347 7348 // Use step hook for back compat. 7349 // Use cssHook if its there. 7350 // Use .style if available and use plain properties where available. 7351 if (jQuery.fx.step[tween.prop]) { 7352 jQuery.fx.step[tween.prop](tween); 7353 } else if (tween.elem.nodeType === 1 && ( 7354 jQuery.cssHooks[tween.prop] || 7355 tween.elem.style[finalPropName(tween.prop)] != null)) { 7356 jQuery.style(tween.elem, tween.prop, tween.now + tween.unit); 7357 } else { 7358 tween.elem[tween.prop] = tween.now; 7359 } 7360 } 7361 } 7362 }; 7363 7364 // Support: IE <=9 only 7365 // Panic based approach to setting things on disconnected nodes 7366 Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { 7367 set: function (tween) { 7368 if (tween.elem.nodeType && tween.elem.parentNode) { 7369 tween.elem[tween.prop] = tween.now; 7370 } 7371 } 7372 }; 7373 7374 jQuery.easing = { 7375 linear: function (p) { 7376 return p; 7377 }, 7378 swing: function (p) { 7379 return 0.5 - Math.cos(p * Math.PI) / 2; 7380 }, 7381 _default: "swing" 7382 }; 7383 7384 jQuery.fx = Tween.prototype.init; 7385 7386 // Back compat <1.8 extension point 7387 jQuery.fx.step = {}; 7388 7389 7390 7391 7392 var 7393 fxNow, inProgress, 7394 rfxtypes = /^(?:toggle|show|hide)$/, 7395 rrun = /queueHooks$/; 7396 7397 function schedule() { 7398 if (inProgress) { 7399 if (document.hidden === false && window.requestAnimationFrame) { 7400 window.requestAnimationFrame(schedule); 7401 } else { 7402 window.setTimeout(schedule, jQuery.fx.interval); 7403 } 7404 7405 jQuery.fx.tick(); 7406 } 7407 } 7408 7409 // Animations created synchronously will run synchronously 7410 function createFxNow() { 7411 window.setTimeout(function () { 7412 fxNow = undefined; 7413 }); 7414 return (fxNow = Date.now()); 7415 } 7416 7417 // Generate parameters to create a standard animation 7418 function genFx(type, includeWidth) { 7419 var which, 7420 i = 0, 7421 attrs = { height: type }; 7422 7423 // If we include width, step value is 1 to do all cssExpand values, 7424 // otherwise step value is 2 to skip over Left and Right 7425 includeWidth = includeWidth ? 1 : 0; 7426 for (; i < 4; i += 2 - includeWidth) { 7427 which = cssExpand[i]; 7428 attrs["margin" + which] = attrs["padding" + which] = type; 7429 } 7430 7431 if (includeWidth) { 7432 attrs.opacity = attrs.width = type; 7433 } 7434 7435 return attrs; 7436 } 7437 7438 function createTween(value, prop, animation) { 7439 var tween, 7440 collection = (Animation.tweeners[prop] || []).concat(Animation.tweeners["*"]), 7441 index = 0, 7442 length = collection.length; 7443 for (; index < length; index++) { 7444 if ((tween = collection[index].call(animation, prop, value))) { 7445 7446 // We're done with this property 7447 return tween; 7448 } 7449 } 7450 } 7451 7452 function defaultPrefilter(elem, props, opts) { 7453 var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, 7454 isBox = "width" in props || "height" in props, 7455 anim = this, 7456 orig = {}, 7457 style = elem.style, 7458 hidden = elem.nodeType && isHiddenWithinTree(elem), 7459 dataShow = dataPriv.get(elem, "fxshow"); 7460 7461 // Queue-skipping animations hijack the fx hooks 7462 if (!opts.queue) { 7463 hooks = jQuery._queueHooks(elem, "fx"); 7464 if (hooks.unqueued == null) { 7465 hooks.unqueued = 0; 7466 oldfire = hooks.empty.fire; 7467 hooks.empty.fire = function () { 7468 if (!hooks.unqueued) { 7469 oldfire(); 7470 } 7471 }; 7472 } 7473 hooks.unqueued++; 7474 7475 anim.always(function () { 7476 7477 // Ensure the complete handler is called before this completes 7478 anim.always(function () { 7479 hooks.unqueued--; 7480 if (!jQuery.queue(elem, "fx").length) { 7481 hooks.empty.fire(); 7482 } 7483 }); 7484 }); 7485 } 7486 7487 // Detect show/hide animations 7488 for (prop in props) { 7489 value = props[prop]; 7490 if (rfxtypes.test(value)) { 7491 delete props[prop]; 7492 toggle = toggle || value === "toggle"; 7493 if (value === (hidden ? "hide" : "show")) { 7494 7495 // Pretend to be hidden if this is a "show" and 7496 // there is still data from a stopped show/hide 7497 if (value === "show" && dataShow && dataShow[prop] !== undefined) { 7498 hidden = true; 7499 7500 // Ignore all other no-op show/hide data 7501 } else { 7502 continue; 7503 } 7504 } 7505 orig[prop] = dataShow && dataShow[prop] || jQuery.style(elem, prop); 7506 } 7507 } 7508 7509 // Bail out if this is a no-op like .hide().hide() 7510 propTween = !jQuery.isEmptyObject(props); 7511 if (!propTween && jQuery.isEmptyObject(orig)) { 7512 return; 7513 } 7514 7515 // Restrict "overflow" and "display" styles during box animations 7516 if (isBox && elem.nodeType === 1) { 7517
vendor: 3,179 bytes, lines 7518-7629
7518 // Support: IE <=9 - 11, Edge 12 - 15 7519 // Record all 3 overflow attributes because IE does not infer the shorthand 7520 // from identically-valued overflowX and overflowY and Edge just mirrors 7521 // the overflowX value there. 7522 opts.overflow = [style.overflow, style.overflowX, style.overflowY]; 7523 7524 // Identify a display type, preferring old show/hide data over the CSS cascade 7525 restoreDisplay = dataShow && dataShow.display; 7526 if (restoreDisplay == null) { 7527 restoreDisplay = dataPriv.get(elem, "display"); 7528 } 7529 display = jQuery.css(elem, "display"); 7530 if (display === "none") { 7531 if (restoreDisplay) { 7532 display = restoreDisplay; 7533 } else { 7534 7535 // Get nonempty value(s) by temporarily forcing visibility 7536 showHide([elem], true); 7537 restoreDisplay = elem.style.display || restoreDisplay; 7538 display = jQuery.css(elem, "display"); 7539 showHide([elem]); 7540 } 7541 } 7542 7543 // Animate inline elements as inline-block 7544 if (display === "inline" || display === "inline-block" && restoreDisplay != null) { 7545 if (jQuery.css(elem, "float") === "none") { 7546 7547 // Restore the original display value at the end of pure show/hide animations 7548 if (!propTween) { 7549 anim.done(function () { 7550 style.display = restoreDisplay; 7551 }); 7552 if (restoreDisplay == null) { 7553 display = style.display; 7554 restoreDisplay = display === "none" ? "" : display; 7555 } 7556 } 7557 style.display = "inline-block"; 7558 } 7559 } 7560 } 7561 7562 if (opts.overflow) { 7563 style.overflow = "hidden"; 7564 anim.always(function () { 7565 style.overflow = opts.overflow[0]; 7566 style.overflowX = opts.overflow[1]; 7567 style.overflowY = opts.overflow[2]; 7568 }); 7569 } 7570 7571 // Implement show/hide animations 7572 propTween = false; 7573 for (prop in orig) { 7574 7575 // General show/hide setup for this element animation 7576 if (!propTween) { 7577 if (dataShow) { 7578 if ("hidden" in dataShow) { 7579 hidden = dataShow.hidden; 7580 } 7581 } else { 7582 dataShow = dataPriv.access(elem, "fxshow", { display: restoreDisplay }); 7583 } 7584 7585 // Store hidden/visible for toggle so `.stop().toggle()` "reverses" 7586 if (toggle) { 7587 dataShow.hidden = !hidden; 7588 } 7589 7590 // Show elements before animating them 7591 if (hidden) { 7592 showHide([elem], true); 7593 } 7594 7595 /* eslint-disable no-loop-func */ 7596 7597 anim.done(function () { 7598 7599 /* eslint-enable no-loop-func */ 7600 7601 // The final step of a "hide" animation is actually hiding the element 7602 if (!hidden) { 7603 showHide([elem]); 7604 } 7605 dataPriv.remove(elem, "fxshow"); 7606 for (prop in orig) { 7607 jQuery.style(elem, prop, orig[prop]); 7608 } 7609 }); 7610 } 7611 7612 // Per-property setup 7613 propTween = createTween(hidden ? dataShow[prop] : 0, prop, anim); 7614 if (!(prop in dataShow)) { 7615 dataShow[prop] = propTween.start; 7616 if (hidden) { 7617 propTween.end = propTween.start; 7618 propTween.start = 0; 7619 } 7620 } 7621 } 7622 } 7623 7624 function propFilter(props, specialEasing) { 7625 var index, name, easing, value, hooks; 7626 7627 // camelCase, specialEasing and expand cssHook pass 7628 for (index in props) { 7629 name = camelCase(index);
vendor: 23,939 bytes, lines 7630-8604
7630 easing = specialEasing[name]; 7631 value = props[index]; 7632 if (Array.isArray(value)) { 7633 easing = value[1]; 7634 value = props[index] = value[0]; 7635 } 7636 7637 if (index !== name) { 7638 props[name] = value; 7639 delete props[index]; 7640 } 7641 7642 hooks = jQuery.cssHooks[name]; 7643 if (hooks && "expand" in hooks) { 7644 value = hooks.expand(value); 7645 delete props[name]; 7646 7647 // Not quite $.extend, this won't overwrite existing keys. 7648 // Reusing 'index' because we have the correct "name" 7649 for (index in value) { 7650 if (!(index in props)) { 7651 props[index] = value[index]; 7652 specialEasing[index] = easing; 7653 } 7654 } 7655 } else { 7656 specialEasing[name] = easing; 7657 } 7658 } 7659 } 7660 7661 function Animation(elem, properties, options) { 7662 var result, 7663 stopped, 7664 index = 0, 7665 length = Animation.prefilters.length, 7666 deferred = jQuery.Deferred().always(function () { 7667 7668 // Don't match elem in the :animated selector 7669 delete tick.elem; 7670 }), 7671 tick = function () { 7672 if (stopped) { 7673 return false; 7674 } 7675 var currentTime = fxNow || createFxNow(), 7676 remaining = Math.max(0, animation.startTime + animation.duration - currentTime), 7677 7678 // Support: Android 2.3 only 7679 // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (trac-12497) 7680 temp = remaining / animation.duration || 0, 7681 percent = 1 - temp, 7682 index = 0, 7683 length = animation.tweens.length; 7684 7685 for (; index < length; index++) { 7686 animation.tweens[index].run(percent); 7687 } 7688 7689 deferred.notifyWith(elem, [animation, percent, remaining]); 7690 7691 // If there's more to do, yield 7692 if (percent < 1 && length) { 7693 return remaining; 7694 } 7695 7696 // If this was an empty animation, synthesize a final progress notification 7697 if (!length) { 7698 deferred.notifyWith(elem, [animation, 1, 0]); 7699 } 7700 7701 // Resolve the animation and report its conclusion 7702 deferred.resolveWith(elem, [animation]); 7703 return false; 7704 }, 7705 animation = deferred.promise({ 7706 elem: elem, 7707 props: jQuery.extend({}, properties), 7708 opts: jQuery.extend(true, { 7709 specialEasing: {}, 7710 easing: jQuery.easing._default 7711 }, options), 7712 originalProperties: properties, 7713 originalOptions: options, 7714 startTime: fxNow || createFxNow(), 7715 duration: options.duration, 7716 tweens: [], 7717 createTween: function (prop, end) { 7718 var tween = jQuery.Tween(elem, animation.opts, prop, end, 7719 animation.opts.specialEasing[prop] || animation.opts.easing); 7720 animation.tweens.push(tween); 7721 return tween; 7722 }, 7723 stop: function (gotoEnd) { 7724 var index = 0, 7725 7726 // If we are going to the end, we want to run all the tweens 7727 // otherwise we skip this part 7728 length = gotoEnd ? animation.tweens.length : 0; 7729 if (stopped) { 7730 return this; 7731 } 7732 stopped = true; 7733 for (; index < length; index++) { 7734 animation.tweens[index].run(1); 7735 } 7736 7737 // Resolve when we played the last frame; otherwise, reject 7738 if (gotoEnd) { 7739 deferred.notifyWith(elem, [animation, 1, 0]); 7740 deferred.resolveWith(elem, [animation, gotoEnd]); 7741 } else { 7742 deferred.rejectWith(elem, [animation, gotoEnd]); 7743 } 7744 return this; 7745 } 7746 }), 7747 props = animation.props; 7748 7749 propFilter(props, animation.opts.specialEasing); 7750 7751 for (; index < length; index++) { 7752 result = Animation.prefilters[index].call(animation, elem, props, animation.opts); 7753 if (result) { 7754 if (isFunction(result.stop)) { 7755 jQuery._queueHooks(animation.elem, animation.opts.queue).stop = 7756 result.stop.bind(result); 7757 } 7758 return result; 7759 } 7760 } 7761 7762 jQuery.map(props, createTween, animation); 7763 7764 if (isFunction(animation.opts.start)) { 7765 animation.opts.start.call(elem, animation); 7766 } 7767 7768 // Attach callbacks from options 7769 animation 7770 .progress(animation.opts.progress) 7771 .done(animation.opts.done, animation.opts.complete) 7772 .fail(animation.opts.fail) 7773 .always(animation.opts.always); 7774 7775 jQuery.fx.timer( 7776 jQuery.extend(tick, { 7777 elem: elem, 7778 anim: animation, 7779 queue: animation.opts.queue 7780 }) 7781 ); 7782 7783 return animation; 7784 } 7785 7786 jQuery.Animation = jQuery.extend(Animation, { 7787 7788 tweeners: { 7789 "*": [function (prop, value) { 7790 var tween = this.createTween(prop, value); 7791 adjustCSS(tween.elem, prop, rcssNum.exec(value), tween); 7792 return tween; 7793 }] 7794 }, 7795 7796 tweener: function (props, callback) { 7797 if (isFunction(props)) { 7798 callback = props; 7799 props = ["*"]; 7800 } else { 7801 props = props.match(rnothtmlwhite); 7802 } 7803 7804 var prop, 7805 index = 0, 7806 length = props.length; 7807 7808 for (; index < length; index++) { 7809 prop = props[index]; 7810 Animation.tweeners[prop] = Animation.tweeners[prop] || []; 7811 Animation.tweeners[prop].unshift(callback); 7812 } 7813 }, 7814 7815 prefilters: [defaultPrefilter], 7816 7817 prefilter: function (callback, prepend) { 7818 if (prepend) { 7819 Animation.prefilters.unshift(callback); 7820 } else { 7821 Animation.prefilters.push(callback); 7822 } 7823 } 7824 }); 7825 7826 jQuery.speed = function (speed, easing, fn) { 7827 var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : { 7828 complete: fn || !fn && easing || 7829 isFunction(speed) && speed, 7830 duration: speed, 7831 easing: fn && easing || easing && !isFunction(easing) && easing 7832 }; 7833 7834 // Go to the end state if fx are off 7835 if (jQuery.fx.off) { 7836 opt.duration = 0; 7837 7838 } else { 7839 if (typeof opt.duration !== "number") { 7840 if (opt.duration in jQuery.fx.speeds) { 7841 opt.duration = jQuery.fx.speeds[opt.duration]; 7842 7843 } else { 7844 opt.duration = jQuery.fx.speeds._default; 7845 } 7846 } 7847 } 7848 7849 // Normalize opt.queue - true/undefined/null -> "fx" 7850 if (opt.queue == null || opt.queue === true) { 7851 opt.queue = "fx"; 7852 } 7853 7854 // Queueing 7855 opt.old = opt.complete; 7856 7857 opt.complete = function () { 7858 if (isFunction(opt.old)) { 7859 opt.old.call(this); 7860 } 7861 7862 if (opt.queue) { 7863 jQuery.dequeue(this, opt.queue); 7864 } 7865 }; 7866 7867 return opt; 7868 }; 7869 7870 jQuery.fn.extend({ 7871 fadeTo: function (speed, to, easing, callback) { 7872 7873 // Show any hidden elements after setting opacity to 0 7874 return this.filter(isHiddenWithinTree).css("opacity", 0).show() 7875 7876 // Animate to the value specified 7877 .end().animate({ opacity: to }, speed, easing, callback); 7878 }, 7879 animate: function (prop, speed, easing, callback) { 7880 var empty = jQuery.isEmptyObject(prop), 7881 optall = jQuery.speed(speed, easing, callback), 7882 doAnimation = function () { 7883 7884 // Operate on a copy of prop so per-property easing won't be lost 7885 var anim = Animation(this, jQuery.extend({}, prop), optall); 7886 7887 // Empty animations, or finishing resolves immediately 7888 if (empty || dataPriv.get(this, "finish")) { 7889 anim.stop(true); 7890 } 7891 }; 7892 7893 doAnimation.finish = doAnimation; 7894 7895 return empty || optall.queue === false ? 7896 this.each(doAnimation) : 7897 this.queue(optall.queue, doAnimation); 7898 }, 7899 stop: function (type, clearQueue, gotoEnd) { 7900 var stopQueue = function (hooks) { 7901 var stop = hooks.stop; 7902 delete hooks.stop; 7903 stop(gotoEnd); 7904 }; 7905 7906 if (typeof type !== "string") { 7907 gotoEnd = clearQueue; 7908 clearQueue = type; 7909 type = undefined; 7910 } 7911 if (clearQueue) { 7912 this.queue(type || "fx", []); 7913 } 7914 7915 return this.each(function () { 7916 var dequeue = true, 7917 index = type != null && type + "queueHooks", 7918 timers = jQuery.timers, 7919 data = dataPriv.get(this); 7920 7921 if (index) { 7922 if (data[index] && data[index].stop) { 7923 stopQueue(data[index]); 7924 } 7925 } else { 7926 for (index in data) { 7927 if (data[index] && data[index].stop && rrun.test(index)) { 7928 stopQueue(data[index]); 7929 } 7930 } 7931 } 7932 7933 for (index = timers.length; index--;) { 7934 if (timers[index].elem === this && 7935 (type == null || timers[index].queue === type)) { 7936 7937 timers[index].anim.stop(gotoEnd); 7938 dequeue = false; 7939 timers.splice(index, 1); 7940 } 7941 } 7942 7943 // Start the next in the queue if the last step wasn't forced. 7944 // Timers currently will call their complete callbacks, which 7945 // will dequeue but only if they were gotoEnd. 7946 if (dequeue || !gotoEnd) { 7947 jQuery.dequeue(this, type); 7948 } 7949 }); 7950 }, 7951 finish: function (type) { 7952 if (type !== false) { 7953 type = type || "fx"; 7954 } 7955 return this.each(function () { 7956 var index, 7957 data = dataPriv.get(this), 7958 queue = data[type + "queue"], 7959 hooks = data[type + "queueHooks"], 7960 timers = jQuery.timers, 7961 length = queue ? queue.length : 0; 7962 7963 // Enable finishing flag on private data 7964 data.finish = true; 7965 7966 // Empty the queue first 7967 jQuery.queue(this, type, []); 7968 7969 if (hooks && hooks.stop) { 7970 hooks.stop.call(this, true); 7971 } 7972 7973 // Look for any active animations, and finish them 7974 for (index = timers.length; index--;) { 7975 if (timers[index].elem === this && timers[index].queue === type) { 7976 timers[index].anim.stop(true); 7977 timers.splice(index, 1); 7978 } 7979 } 7980 7981 // Look for any animations in the old queue and finish them 7982 for (index = 0; index < length; index++) { 7983 if (queue[index] && queue[index].finish) { 7984 queue[index].finish.call(this); 7985 } 7986 } 7987 7988 // Turn off finishing flag 7989 delete data.finish; 7990 }); 7991 } 7992 }); 7993 7994 jQuery.each(["toggle", "show", "hide"], function (_i, name) { 7995 var cssFn = jQuery.fn[name]; 7996 jQuery.fn[name] = function (speed, easing, callback) { 7997 return speed == null || typeof speed === "boolean" ? 7998 cssFn.apply(this, arguments) : 7999 this.animate(genFx(name, true), speed, easing, callback); 8000 }; 8001 }); 8002 8003 // Generate shortcuts for custom animations 8004 jQuery.each({ 8005 slideDown: genFx("show"), 8006 slideUp: genFx("hide"), 8007 slideToggle: genFx("toggle"), 8008 fadeIn: { opacity: "show" }, 8009 fadeOut: { opacity: "hide" }, 8010 fadeToggle: { opacity: "toggle" } 8011 }, function (name, props) { 8012 jQuery.fn[name] = function (speed, easing, callback) { 8013 return this.animate(props, speed, easing, callback); 8014 }; 8015 }); 8016 8017 jQuery.timers = []; 8018 jQuery.fx.tick = function () { 8019 var timer, 8020 i = 0, 8021 timers = jQuery.timers; 8022 8023 fxNow = Date.now(); 8024 8025 for (; i < timers.length; i++) { 8026 timer = timers[i]; 8027 8028 // Run the timer and safely remove it when done (allowing for external removal) 8029 if (!timer() && timers[i] === timer) { 8030 timers.splice(i--, 1); 8031 } 8032 } 8033 8034 if (!timers.length) { 8035 jQuery.fx.stop(); 8036 } 8037 fxNow = undefined; 8038 }; 8039 8040 jQuery.fx.timer = function (timer) { 8041 jQuery.timers.push(timer); 8042 jQuery.fx.start(); 8043 }; 8044 8045 jQuery.fx.interval = 13; 8046 jQuery.fx.start = function () { 8047 if (inProgress) { 8048 return; 8049 } 8050 8051 inProgress = true; 8052 schedule(); 8053 }; 8054 8055 jQuery.fx.stop = function () { 8056 inProgress = null; 8057 }; 8058 8059 jQuery.fx.speeds = { 8060 slow: 600, 8061 fast: 200, 8062 8063 // Default speed 8064 _default: 400 8065 }; 8066 8067 8068 // Based off of the plugin by Clint Helfers, with permission. 8069 jQuery.fn.delay = function (time, type) { 8070 time = jQuery.fx ? jQuery.fx.speeds[time] || time : time; 8071 type = type || "fx"; 8072 8073 return this.queue(type, function (next, hooks) { 8074 var timeout = window.setTimeout(next, time); 8075 hooks.stop = function () { 8076 window.clearTimeout(timeout); 8077 }; 8078 }); 8079 }; 8080 8081 8082 (function () { 8083 var input = document.createElement("input"), 8084 select = document.createElement("select"), 8085 opt = select.appendChild(document.createElement("option")); 8086 8087 input.type = "checkbox"; 8088 8089 // Support: Android <=4.3 only 8090 // Default value for a checkbox should be "on" 8091 support.checkOn = input.value !== ""; 8092 8093 // Support: IE <=11 only 8094 // Must access selectedIndex to make default options select 8095 support.optSelected = opt.selected; 8096 8097 // Support: IE <=11 only 8098 // An input loses its value after becoming a radio 8099 input = document.createElement("input"); 8100 input.value = "t"; 8101 input.type = "radio"; 8102 support.radioValue = input.value === "t"; 8103 })(); 8104 8105 8106 var boolHook, 8107 attrHandle = jQuery.expr.attrHandle; 8108 8109 jQuery.fn.extend({ 8110 attr: function (name, value) { 8111 return access(this, jQuery.attr, name, value, arguments.length > 1); 8112 }, 8113 8114 removeAttr: function (name) { 8115 return this.each(function () { 8116 jQuery.removeAttr(this, name); 8117 }); 8118 } 8119 }); 8120 8121 jQuery.extend({ 8122 attr: function (elem, name, value) { 8123 var ret, hooks, 8124 nType = elem.nodeType; 8125 8126 // Don't get/set attributes on text, comment and attribute nodes 8127 if (nType === 3 || nType === 8 || nType === 2) { 8128 return; 8129 } 8130 8131 // Fallback to prop when attributes are not supported 8132 if (typeof elem.getAttribute === "undefined") { 8133 return jQuery.prop(elem, name, value); 8134 } 8135 8136 // Attribute hooks are determined by the lowercase version 8137 // Grab necessary hook if one is defined 8138 if (nType !== 1 || !jQuery.isXMLDoc(elem)) { 8139 hooks = jQuery.attrHooks[name.toLowerCase()] || 8140 (jQuery.expr.match.bool.test(name) ? boolHook : undefined); 8141 } 8142 8143 if (value !== undefined) { 8144 if (value === null) { 8145 jQuery.removeAttr(elem, name); 8146 return; 8147 } 8148 8149 if (hooks && "set" in hooks && 8150 (ret = hooks.set(elem, value, name)) !== undefined) { 8151 return ret; 8152 } 8153 8154 elem.setAttribute(name, value + ""); 8155 return value; 8156 } 8157 8158 if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) { 8159 return ret; 8160 } 8161 8162 ret = jQuery.find.attr(elem, name); 8163 8164 // Non-existent attributes return null, we normalize to undefined 8165 return ret == null ? undefined : ret; 8166 }, 8167 8168 attrHooks: { 8169 type: { 8170 set: function (elem, value) { 8171 if (!support.radioValue && value === "radio" && 8172 nodeName(elem, "input")) { 8173 var val = elem.value; 8174 elem.setAttribute("type", value); 8175 if (val) { 8176 elem.value = val; 8177 } 8178 return value; 8179 } 8180 } 8181 } 8182 }, 8183 8184 removeAttr: function (elem, value) { 8185 var name, 8186 i = 0, 8187 8188 // Attribute names can contain non-HTML whitespace characters 8189 // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 8190 attrNames = value && value.match(rnothtmlwhite); 8191 8192 if (attrNames && elem.nodeType === 1) { 8193 while ((name = attrNames[i++])) { 8194 elem.removeAttribute(name); 8195 } 8196 } 8197 } 8198 }); 8199 8200 // Hooks for boolean attributes 8201 boolHook = { 8202 set: function (elem, value, name) { 8203 if (value === false) { 8204 8205 // Remove boolean attributes when set to false 8206 jQuery.removeAttr(elem, name); 8207 } else { 8208 elem.setAttribute(name, name); 8209 } 8210 return name; 8211 } 8212 }; 8213 8214 jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g), function (_i, name) { 8215 var getter = attrHandle[name] || jQuery.find.attr; 8216 8217 attrHandle[name] = function (elem, name, isXML) { 8218 var ret, handle, 8219 lowercaseName = name.toLowerCase(); 8220 8221 if (!isXML) { 8222 8223 // Avoid an infinite loop by temporarily removing this function from the getter 8224 handle = attrHandle[lowercaseName]; 8225 attrHandle[lowercaseName] = ret; 8226 ret = getter(elem, name, isXML) != null ? 8227 lowercaseName : 8228 null; 8229 attrHandle[lowercaseName] = handle; 8230 } 8231 return ret; 8232 }; 8233 }); 8234 8235 8236 8237 8238 var rfocusable = /^(?:input|select|textarea|button)$/i, 8239 rclickable = /^(?:a|area)$/i; 8240 8241 jQuery.fn.extend({ 8242 prop: function (name, value) { 8243 return access(this, jQuery.prop, name, value, arguments.length > 1); 8244 }, 8245 8246 removeProp: function (name) { 8247 return this.each(function () { 8248 delete this[jQuery.propFix[name] || name]; 8249 }); 8250 } 8251 }); 8252 8253 jQuery.extend({ 8254 prop: function (elem, name, value) { 8255 var ret, hooks, 8256 nType = elem.nodeType; 8257 8258 // Don't get/set properties on text, comment and attribute nodes 8259 if (nType === 3 || nType === 8 || nType === 2) { 8260 return; 8261 } 8262 8263 if (nType !== 1 || !jQuery.isXMLDoc(elem)) { 8264 8265 // Fix name and attach hooks 8266 name = jQuery.propFix[name] || name; 8267 hooks = jQuery.propHooks[name]; 8268 } 8269 8270 if (value !== undefined) { 8271 if (hooks && "set" in hooks && 8272 (ret = hooks.set(elem, value, name)) !== undefined) { 8273 return ret; 8274 } 8275 8276 return (elem[name] = value); 8277 } 8278 8279 if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) { 8280 return ret; 8281 } 8282 8283 return elem[name]; 8284 }, 8285 8286 propHooks: { 8287 tabIndex: { 8288 get: function (elem) { 8289 8290 // Support: IE <=9 - 11 only 8291 // elem.tabIndex doesn't always return the 8292 // correct value when it hasn't been explicitly set 8293 // Use proper attribute retrieval (trac-12072) 8294 var tabindex = jQuery.find.attr(elem, "tabindex"); 8295 8296 if (tabindex) { 8297 return parseInt(tabindex, 10); 8298 } 8299 8300 if ( 8301 rfocusable.test(elem.nodeName) || 8302 rclickable.test(elem.nodeName) && 8303 elem.href 8304 ) { 8305 return 0; 8306 } 8307 8308 return -1; 8309 } 8310 } 8311 }, 8312 8313 propFix: { 8314 "for": "htmlFor", 8315 "class": "className" 8316 } 8317 }); 8318 8319 // Support: IE <=11 only 8320 // Accessing the selectedIndex property 8321 // forces the browser to respect setting selected 8322 // on the option 8323 // The getter ensures a default option is selected 8324 // when in an optgroup 8325 // eslint rule "no-unused-expressions" is disabled for this code 8326 // since it considers such accessions noop 8327 if (!support.optSelected) { 8328 jQuery.propHooks.selected = { 8329 get: function (elem) { 8330 8331 /* eslint no-unused-expressions: "off" */ 8332 8333 var parent = elem.parentNode; 8334 if (parent && parent.parentNode) { 8335 parent.parentNode.selectedIndex; 8336 } 8337 return null; 8338 }, 8339 set: function (elem) { 8340 8341 /* eslint no-unused-expressions: "off" */ 8342 8343 var parent = elem.parentNode; 8344 if (parent) { 8345 parent.selectedIndex; 8346 8347 if (parent.parentNode) { 8348 parent.parentNode.selectedIndex; 8349 } 8350 } 8351 } 8352 }; 8353 } 8354 8355 jQuery.each([ 8356 "tabIndex", 8357 "readOnly", 8358 "maxLength", 8359 "cellSpacing", 8360 "cellPadding", 8361 "rowSpan", 8362 "colSpan", 8363 "useMap", 8364 "frameBorder", 8365 "contentEditable" 8366 ], function () { 8367 jQuery.propFix[this.toLowerCase()] = this; 8368 }); 8369 8370 8371 8372 8373 // Strip and collapse whitespace according to HTML spec 8374 // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace 8375 function stripAndCollapse(value) { 8376 var tokens = value.match(rnothtmlwhite) || []; 8377 return tokens.join(" "); 8378 } 8379 8380 8381 function getClass(elem) { 8382 return elem.getAttribute && elem.getAttribute("class") || ""; 8383 } 8384 8385 function classesToArray(value) { 8386 if (Array.isArray(value)) { 8387 return value; 8388 } 8389 if (typeof value === "string") { 8390 return value.match(rnothtmlwhite) || []; 8391 } 8392 return []; 8393 } 8394 8395 jQuery.fn.extend({ 8396 addClass: function (value) { 8397 var classNames, cur, curValue, className, i, finalValue; 8398 8399 if (isFunction(value)) { 8400 return this.each(function (j) { 8401 jQuery(this).addClass(value.call(this, j, getClass(this))); 8402 }); 8403 } 8404 8405 classNames = classesToArray(value); 8406 8407 if (classNames.length) { 8408 return this.each(function () { 8409 curValue = getClass(this); 8410 cur = this.nodeType === 1 && (" " + stripAndCollapse(curValue) + " "); 8411 8412 if (cur) { 8413 for (i = 0; i < classNames.length; i++) { 8414 className = classNames[i]; 8415 if (cur.indexOf(" " + className + " ") < 0) { 8416 cur += className + " "; 8417 } 8418 } 8419 8420 // Only assign if different to avoid unneeded rendering. 8421 finalValue = stripAndCollapse(cur); 8422 if (curValue !== finalValue) { 8423 this.setAttribute("class", finalValue); 8424 } 8425 } 8426 }); 8427 } 8428 8429 return this; 8430 }, 8431 8432 removeClass: function (value) { 8433 var classNames, cur, curValue, className, i, finalValue; 8434 8435 if (isFunction(value)) { 8436 return this.each(function (j) { 8437 jQuery(this).removeClass(value.call(this, j, getClass(this))); 8438 }); 8439 } 8440 8441 if (!arguments.length) { 8442 return this.attr("class", ""); 8443 } 8444 8445 classNames = classesToArray(value); 8446 8447 if (classNames.length) { 8448 return this.each(function () { 8449 curValue = getClass(this); 8450 8451 // This expression is here for better compressibility (see addClass) 8452 cur = this.nodeType === 1 && (" " + stripAndCollapse(curValue) + " "); 8453 8454 if (cur) { 8455 for (i = 0; i < classNames.length; i++) { 8456 className = classNames[i]; 8457 8458 // Remove *all* instances 8459 while (cur.indexOf(" " + className + " ") > -1) { 8460 cur = cur.replace(" " + className + " ", " "); 8461 } 8462 } 8463 8464 // Only assign if different to avoid unneeded rendering. 8465 finalValue = stripAndCollapse(cur); 8466 if (curValue !== finalValue) { 8467 this.setAttribute("class", finalValue); 8468 } 8469 } 8470 }); 8471 } 8472 8473 return this; 8474 }, 8475 8476 toggleClass: function (value, stateVal) { 8477 var classNames, className, i, self, 8478 type = typeof value, 8479 isValidValue = type === "string" || Array.isArray(value); 8480 8481 if (isFunction(value)) { 8482 return this.each(function (i) { 8483 jQuery(this).toggleClass( 8484 value.call(this, i, getClass(this), stateVal), 8485 stateVal 8486 ); 8487 }); 8488 } 8489 8490 if (typeof stateVal === "boolean" && isValidValue) { 8491 return stateVal ? this.addClass(value) : this.removeClass(value); 8492 } 8493 8494 classNames = classesToArray(value); 8495 8496 return this.each(function () { 8497 if (isValidValue) { 8498 8499 // Toggle individual class names 8500 self = jQuery(this); 8501 8502 for (i = 0; i < classNames.length; i++) { 8503 className = classNames[i]; 8504 8505 // Check each className given, space separated list 8506 if (self.hasClass(className)) { 8507 self.removeClass(className); 8508 } else { 8509 self.addClass(className); 8510 } 8511 } 8512 8513 // Toggle whole class name 8514 } else if (value === undefined || type === "boolean") { 8515 className = getClass(this); 8516 if (className) { 8517 8518 // Store className if set 8519 dataPriv.set(this, "__className__", className); 8520 } 8521 8522 // If the element has a class name or if we're passed `false`, 8523 // then remove the whole classname (if there was one, the above saved it). 8524 // Otherwise bring back whatever was previously saved (if anything), 8525 // falling back to the empty string if nothing was stored. 8526 if (this.setAttribute) { 8527 this.setAttribute("class", 8528 className || value === false ? 8529 "" : 8530 dataPriv.get(this, "__className__") || "" 8531 ); 8532 } 8533 } 8534 }); 8535 }, 8536 8537 hasClass: function (selector) { 8538 var className, elem, 8539 i = 0; 8540 8541 className = " " + selector + " "; 8542 while ((elem = this[i++])) { 8543 if (elem.nodeType === 1 && 8544 (" " + stripAndCollapse(getClass(elem)) + " ").indexOf(className) > -1) { 8545 return true; 8546 } 8547 } 8548 8549 return false; 8550 } 8551 }); 8552 8553 8554 8555 8556 var rreturn = /\r/g; 8557 8558 jQuery.fn.extend({ 8559 val: function (value) { 8560 var hooks, ret, valueIsFunction, 8561 elem = this[0]; 8562 8563 if (!arguments.length) { 8564 if (elem) { 8565 hooks = jQuery.valHooks[elem.type] || 8566 jQuery.valHooks[elem.nodeName.toLowerCase()]; 8567 8568 if (hooks && 8569 "get" in hooks && 8570 (ret = hooks.get(elem, "value")) !== undefined 8571 ) { 8572 return ret; 8573 } 8574 8575 ret = elem.value; 8576 8577 // Handle most common string cases 8578 if (typeof ret === "string") { 8579 return ret.replace(rreturn, ""); 8580 } 8581 8582 // Handle cases where value is null/undef or number 8583 return ret == null ? "" : ret; 8584 } 8585 8586 return; 8587 } 8588 8589 valueIsFunction = isFunction(value); 8590 8591 return this.each(function (i) { 8592 var val; 8593 8594 if (this.nodeType !== 1) { 8595 return; 8596 } 8597 8598 if (valueIsFunction) { 8599 val = value.call(this, i, jQuery(this).val()); 8600 } else { 8601 val = value; 8602 } 8603 8604 // Treat null/undefined as "";
vendor: 4,371 bytes, lines 8604-8775
8604 convert numbers to string 8605 if (val == null) { 8606 val = ""; 8607 8608 } else if (typeof val === "number") { 8609 val += ""; 8610 8611 } else if (Array.isArray(val)) { 8612 val = jQuery.map(val, function (value) { 8613 return value == null ? "" : value + ""; 8614 }); 8615 } 8616 8617 hooks = jQuery.valHooks[this.type] || jQuery.valHooks[this.nodeName.toLowerCase()]; 8618 8619 // If set returns undefined, fall back to normal setting 8620 if (!hooks || !("set" in hooks) || hooks.set(this, val, "value") === undefined) { 8621 this.value = val; 8622 } 8623 }); 8624 } 8625 }); 8626 8627 jQuery.extend({ 8628 valHooks: { 8629 option: { 8630 get: function (elem) { 8631 8632 var val = jQuery.find.attr(elem, "value"); 8633 return val != null ? 8634 val : 8635 8636 // Support: IE <=10 - 11 only 8637 // option.text throws exceptions (trac-14686, trac-14858) 8638 // Strip and collapse whitespace 8639 // https://html.spec.whatwg.org/#strip-and-collapse-whitespace 8640 stripAndCollapse(jQuery.text(elem)); 8641 } 8642 }, 8643 select: { 8644 get: function (elem) { 8645 var value, option, i, 8646 options = elem.options, 8647 index = elem.selectedIndex, 8648 one = elem.type === "select-one", 8649 values = one ? null : [], 8650 max = one ? index + 1 : options.length; 8651 8652 if (index < 0) { 8653 i = max; 8654 8655 } else { 8656 i = one ? index : 0; 8657 } 8658 8659 // Loop through all the selected options 8660 for (; i < max; i++) { 8661 option = options[i]; 8662 8663 // Support: IE <=9 only 8664 // IE8-9 doesn't update selected after form reset (trac-2551) 8665 if ((option.selected || i === index) && 8666 8667 // Don't return options that are disabled or in a disabled optgroup 8668 !option.disabled && 8669 (!option.parentNode.disabled || 8670 !nodeName(option.parentNode, "optgroup"))) { 8671 8672 // Get the specific value for the option 8673 value = jQuery(option).val(); 8674 8675 // We don't need an array for one selects 8676 if (one) { 8677 return value; 8678 } 8679 8680 // Multi-Selects return an array 8681 values.push(value); 8682 } 8683 } 8684 8685 return values; 8686 }, 8687 8688 set: function (elem, value) { 8689 var optionSet, option, 8690 options = elem.options, 8691 values = jQuery.makeArray(value), 8692 i = options.length; 8693 8694 while (i--) { 8695 option = options[i]; 8696 8697 /* eslint-disable no-cond-assign */ 8698 8699 if (option.selected = 8700 jQuery.inArray(jQuery.valHooks.option.get(option), values) > -1 8701 ) { 8702 optionSet = true; 8703 } 8704 8705 /* eslint-enable no-cond-assign */ 8706 } 8707 8708 // Force browsers to behave consistently when non-matching value is set 8709 if (!optionSet) { 8710 elem.selectedIndex = -1; 8711 } 8712 return values; 8713 } 8714 } 8715 } 8716 }); 8717 8718 // Radios and checkboxes getter/setter 8719 jQuery.each(["radio", "checkbox"], function () { 8720 jQuery.valHooks[this] = { 8721 set: function (elem, value) { 8722 if (Array.isArray(value)) { 8723 return (elem.checked = jQuery.inArray(jQuery(elem).val(), value) > -1); 8724 } 8725 } 8726 }; 8727 if (!support.checkOn) { 8728 jQuery.valHooks[this].get = function (elem) { 8729 return elem.getAttribute("value") === null ? "on" : elem.value; 8730 }; 8731 } 8732 }); 8733 8734 8735 8736 8737 // Return jQuery for attributes-only inclusion 8738 8739 8740 support.focusin = "onfocusin" in window; 8741 8742 8743 var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, 8744 stopPropagationCallback = function (e) { 8745 e.stopPropagation(); 8746 }; 8747 8748 jQuery.extend(jQuery.event, { 8749 8750 trigger: function (event, data, elem, onlyHandlers) { 8751 8752 var i, cur, tmp, bubbleType, ontype, handle, special, lastElement, 8753 eventPath = [elem || document], 8754 type = hasOwn.call(event, "type") ? event.type : event, 8755 namespaces = hasOwn.call(event, "namespace") ? event.namespace.split(".") : []; 8756 8757 cur = lastElement = tmp = elem = elem || document; 8758 8759 // Don't do events on text and comment nodes 8760 if (elem.nodeType === 3 || elem.nodeType === 8) { 8761 return; 8762 } 8763 8764 // focus/blur morphs to focusin/out; ensure we're not firing them right now 8765 if (rfocusMorph.test(type + jQuery.event.triggered)) { 8766 return; 8767 } 8768 8769 if (type.indexOf(".") > -1) { 8770 8771 // Namespaced trigger; create a regexp to match event type in handle() 8772 namespaces = type.split("."); 8773 type = namespaces.shift(); 8774 namespaces.sort(); 8775 }
vendor: 4,376 bytes, lines 8776-8929
8776 ontype = type.indexOf(":") < 0 && "on" + type; 8777 8778 // Caller can pass in a jQuery.Event object, Object, or just an event type string 8779 event = event[jQuery.expando] ? 8780 event : 8781 new jQuery.Event(type, typeof event === "object" && event); 8782 8783 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) 8784 event.isTrigger = onlyHandlers ? 2 : 3; 8785 event.namespace = namespaces.join("."); 8786 event.rnamespace = event.namespace ? 8787 new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : 8788 null; 8789 8790 // Clean up the event in case it is being reused 8791 event.result = undefined; 8792 if (!event.target) { 8793 event.target = elem; 8794 } 8795 8796 // Clone any incoming data and prepend the event, creating the handler arg list 8797 data = data == null ? 8798 [event] : 8799 jQuery.makeArray(data, [event]); 8800 8801 // Allow special events to draw outside the lines 8802 special = jQuery.event.special[type] || {}; 8803 if (!onlyHandlers && special.trigger && special.trigger.apply(elem, data) === false) { 8804 return; 8805 } 8806 8807 // Determine event propagation path in advance, per W3C events spec (trac-9951) 8808 // Bubble up to document, then to window; watch for a global ownerDocument var (trac-9724) 8809 if (!onlyHandlers && !special.noBubble && !isWindow(elem)) { 8810 8811 bubbleType = special.delegateType || type; 8812 if (!rfocusMorph.test(bubbleType + type)) { 8813 cur = cur.parentNode; 8814 } 8815 for (; cur; cur = cur.parentNode) { 8816 eventPath.push(cur); 8817 tmp = cur; 8818 } 8819 8820 // Only add window if we got to document (e.g., not plain obj or detached DOM) 8821 if (tmp === (elem.ownerDocument || document)) { 8822 eventPath.push(tmp.defaultView || tmp.parentWindow || window); 8823 } 8824 } 8825 8826 // Fire handlers on the event path 8827 i = 0; 8828 while ((cur = eventPath[i++]) && !event.isPropagationStopped()) { 8829 lastElement = cur; 8830 event.type = i > 1 ? 8831 bubbleType : 8832 special.bindType || type; 8833 8834 // jQuery handler 8835 handle = (dataPriv.get(cur, "events") || Object.create(null))[event.type] && 8836 dataPriv.get(cur, "handle"); 8837 if (handle) { 8838 handle.apply(cur, data); 8839 } 8840 8841 // Native handler 8842 handle = ontype && cur[ontype]; 8843 if (handle && handle.apply && acceptData(cur)) { 8844 event.result = handle.apply(cur, data); 8845 if (event.result === false) { 8846 event.preventDefault(); 8847 } 8848 } 8849 } 8850 event.type = type; 8851 8852 // If nobody prevented the default action, do it now 8853 if (!onlyHandlers && !event.isDefaultPrevented()) { 8854 8855 if ((!special._default || 8856 special._default.apply(eventPath.pop(), data) === false) && 8857 acceptData(elem)) { 8858 8859 // Call a native DOM method on the target with the same name as the event. 8860 // Don't do default actions on window, that's where global variables be (trac-6170) 8861 if (ontype && isFunction(elem[type]) && !isWindow(elem)) { 8862 8863 // Don't re-trigger an onFOO event when we call its FOO() method 8864 tmp = elem[ontype]; 8865 8866 if (tmp) { 8867 elem[ontype] = null; 8868 } 8869 8870 // Prevent re-triggering of the same event, since we already bubbled it above 8871 jQuery.event.triggered = type; 8872 8873 if (event.isPropagationStopped()) { 8874 lastElement.addEventListener(type, stopPropagationCallback); 8875 } 8876 8877 elem[type](); 8878 8879 if (event.isPropagationStopped()) { 8880 lastElement.removeEventListener(type, stopPropagationCallback); 8881 } 8882 8883 jQuery.event.triggered = undefined; 8884 8885 if (tmp) { 8886 elem[ontype] = tmp; 8887 } 8888 } 8889 } 8890 } 8891 8892 return event.result; 8893 }, 8894 8895 // Piggyback on a donor event to simulate a different one 8896 // Used only for `focus(in | out)` events 8897 simulate: function (type, elem, event) { 8898 var e = jQuery.extend( 8899 new jQuery.Event(), 8900 event, 8901 { 8902 type: type, 8903 isSimulated: true 8904 } 8905 ); 8906 8907 jQuery.event.trigger(e, null, elem); 8908 } 8909 8910 }); 8911 8912 jQuery.fn.extend({ 8913 8914 trigger: function (type, data) { 8915 return this.each(function () { 8916 jQuery.event.trigger(type, data, this); 8917 }); 8918 }, 8919 triggerHandler: function (type, data) { 8920 var elem = this[0]; 8921 if (elem) { 8922 return jQuery.event.trigger(type, data, elem, true); 8923 } 8924 } 8925 }); 8926 8927 8928 // Support: Firefox <=44 8929 // Firefox doesn't have focus(in | out) events
vendor: 5,864 bytes, lines 8930-9142
8930 // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 8931 // 8932 // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 8933 // focus(in | out) events fire after focus & blur events, 8934 // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order 8935 // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 8936 if (!support.focusin) { 8937 jQuery.each({ focus: "focusin", blur: "focusout" }, function (orig, fix) { 8938 8939 // Attach a single capturing handler on the document while someone wants focusin/focusout 8940 var handler = function (event) { 8941 jQuery.event.simulate(fix, event.target, jQuery.event.fix(event)); 8942 }; 8943 8944 jQuery.event.special[fix] = { 8945 setup: function () { 8946 8947 // Handle: regular nodes (via `this.ownerDocument`), window 8948 // (via `this.document`) & document (via `this`). 8949 var doc = this.ownerDocument || this.document || this, 8950 attaches = dataPriv.access(doc, fix); 8951 8952 if (!attaches) { 8953 doc.addEventListener(orig, handler, true); 8954 } 8955 dataPriv.access(doc, fix, (attaches || 0) + 1); 8956 }, 8957 teardown: function () { 8958 var doc = this.ownerDocument || this.document || this, 8959 attaches = dataPriv.access(doc, fix) - 1; 8960 8961 if (!attaches) { 8962 doc.removeEventListener(orig, handler, true); 8963 dataPriv.remove(doc, fix); 8964 8965 } else { 8966 dataPriv.access(doc, fix, attaches); 8967 } 8968 } 8969 }; 8970 }); 8971 } 8972 var location = window.location; 8973 8974 var nonce = { guid: Date.now() }; 8975 8976 var rquery = (/\?/); 8977 8978 8979 8980 // Cross-browser xml parsing 8981 jQuery.parseXML = function (data) { 8982 var xml, parserErrorElem; 8983 if (!data || typeof data !== "string") { 8984 return null; 8985 } 8986 8987 // Support: IE 9 - 11 only 8988 // IE throws on parseFromString with invalid input. 8989 try { 8990 xml = (new window.DOMParser()).parseFromString(data, "text/xml"); 8991 } catch (e) { } 8992 8993 parserErrorElem = xml && xml.getElementsByTagName("parsererror")[0]; 8994 if (!xml || parserErrorElem) { 8995 jQuery.error("Invalid XML: " + ( 8996 parserErrorElem ? 8997 jQuery.map(parserErrorElem.childNodes, function (el) { 8998 return el.textContent; 8999 }).join("\n") : 9000 data 9001 )); 9002 } 9003 return xml; 9004 }; 9005 9006 9007 var 9008 rbracket = /\[\]$/, 9009 rCRLF = /\r?\n/g, 9010 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, 9011 rsubmittable = /^(?:input|select|textarea|keygen)/i; 9012 9013 function buildParams(prefix, obj, traditional, add) { 9014 var name; 9015 9016 if (Array.isArray(obj)) { 9017 9018 // Serialize array item. 9019 jQuery.each(obj, function (i, v) { 9020 if (traditional || rbracket.test(prefix)) { 9021 9022 // Treat each array item as a scalar. 9023 add(prefix, v); 9024 9025 } else { 9026 9027 // Item is non-scalar (array or object), encode its numeric index. 9028 buildParams( 9029 prefix + "[" + (typeof v === "object" && v != null ? i : "") + "]", 9030 v, 9031 traditional, 9032 add 9033 ); 9034 } 9035 }); 9036 9037 } else if (!traditional && toType(obj) === "object") { 9038 9039 // Serialize object item. 9040 for (name in obj) { 9041 buildParams(prefix + "[" + name + "]", obj[name], traditional, add); 9042 } 9043 9044 } else { 9045 9046 // Serialize scalar item. 9047 add(prefix, obj); 9048 } 9049 } 9050 9051 // Serialize an array of form elements or a set of 9052 // key/values into a query string 9053 jQuery.param = function (a, traditional) { 9054 var prefix, 9055 s = [], 9056 add = function (key, valueOrFunction) { 9057 9058 // If value is a function, invoke it and use its return value 9059 var value = isFunction(valueOrFunction) ? 9060 valueOrFunction() : 9061 valueOrFunction; 9062 9063 s[s.length] = encodeURIComponent(key) + "=" + 9064 encodeURIComponent(value == null ? "" : value); 9065 }; 9066 9067 if (a == null) { 9068 return ""; 9069 } 9070 9071 // If an array was passed in, assume that it is an array of form elements. 9072 if (Array.isArray(a) || (a.jquery && !jQuery.isPlainObject(a))) { 9073 9074 // Serialize the form elements 9075 jQuery.each(a, function () { 9076 add(this.name, this.value); 9077 }); 9078 9079 } else { 9080 9081 // If traditional, encode the "old" way (the way 1.3.2 or older 9082 // did it), otherwise encode params recursively. 9083 for (prefix in a) { 9084 buildParams(prefix, a[prefix], traditional, add); 9085 } 9086 } 9087 9088 // Return the resulting serialization 9089 return s.join("&"); 9090 }; 9091 9092 jQuery.fn.extend({ 9093 serialize: function () { 9094 return jQuery.param(this.serializeArray()); 9095 }, 9096 serializeArray: function () { 9097 return this.map(function () { 9098 9099 // Can add propHook for "elements" to filter or add form elements 9100 var elements = jQuery.prop(this, "elements"); 9101 return elements ? jQuery.makeArray(elements) : this; 9102 }).filter(function () { 9103 var type = this.type; 9104 9105 // Use .is( ":disabled" ) so that fieldset[disabled] works 9106 return this.name && !jQuery(this).is(":disabled") && 9107 rsubmittable.test(this.nodeName) && !rsubmitterTypes.test(type) && 9108 (this.checked || !rcheckableType.test(type)); 9109 }).map(function (_i, elem) { 9110 var val = jQuery(this).val(); 9111 9112 if (val == null) { 9113 return null; 9114 } 9115 9116 if (Array.isArray(val)) { 9117 return jQuery.map(val, function (val) { 9118 return { name: elem.name, value: val.replace(rCRLF, "\r\n") }; 9119 }); 9120 } 9121 9122 return { name: elem.name, value: val.replace(rCRLF, "\r\n") }; 9123 }).get(); 9124 } 9125 }); 9126 9127 9128 var 9129 r20 = /%20/g, 9130 rhash = /#.*$/, 9131 rantiCache = /([?&])_=[^&]*/, 9132 rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, 9133 9134 // trac-7653, trac-8125, trac-8152: local protocol detection 9135 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, 9136 rnoContent = /^(?:GET|HEAD)$/, 9137 rprotocol = /^\/\//, 9138 9139 /* Prefilters 9140 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) 9141 * 2) These are called: 9142 * - BEFORE asking for a transport
vendor: 4,814 bytes, lines 9143-9308
9143 * - AFTER param serialization (s.data is a string if s.processData is true) 9144 * 3) key is the dataType 9145 * 4) the catchall symbol "*" can be used 9146 * 5) execution will start with transport dataType and THEN continue down to "*" if needed 9147 */ 9148 prefilters = {}, 9149 9150 /* Transports bindings 9151 * 1) key is the dataType 9152 * 2) the catchall symbol "*" can be used 9153 * 3) selection will start with transport dataType and THEN go to "*" if needed 9154 */ 9155 transports = {}, 9156 9157 // Avoid comment-prolog char sequence (trac-10098); must appease lint and evade compression 9158 allTypes = "*/".concat("*"), 9159 9160 // Anchor tag for parsing the document origin 9161 originAnchor = document.createElement("a"); 9162 9163 originAnchor.href = location.href; 9164 9165 // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport 9166 function addToPrefiltersOrTransports(structure) { 9167 9168 // dataTypeExpression is optional and defaults to "*" 9169 return function (dataTypeExpression, func) { 9170 9171 if (typeof dataTypeExpression !== "string") { 9172 func = dataTypeExpression; 9173 dataTypeExpression = "*"; 9174 } 9175 9176 var dataType, 9177 i = 0, 9178 dataTypes = dataTypeExpression.toLowerCase().match(rnothtmlwhite) || []; 9179 9180 if (isFunction(func)) { 9181 9182 // For each dataType in the dataTypeExpression 9183 while ((dataType = dataTypes[i++])) { 9184 9185 // Prepend if requested 9186 if (dataType[0] === "+") { 9187 dataType = dataType.slice(1) || "*"; 9188 (structure[dataType] = structure[dataType] || []).unshift(func); 9189 9190 // Otherwise append 9191 } else { 9192 (structure[dataType] = structure[dataType] || []).push(func); 9193 } 9194 } 9195 } 9196 }; 9197 } 9198 9199 // Base inspection function for prefilters and transports 9200 function inspectPrefiltersOrTransports(structure, options, originalOptions, jqXHR) { 9201 9202 var inspected = {}, 9203 seekingTransport = (structure === transports); 9204 9205 function inspect(dataType) { 9206 var selected; 9207 inspected[dataType] = true; 9208 jQuery.each(structure[dataType] || [], function (_, prefilterOrFactory) { 9209 var dataTypeOrTransport = prefilterOrFactory(options, originalOptions, jqXHR); 9210 if (typeof dataTypeOrTransport === "string" && 9211 !seekingTransport && !inspected[dataTypeOrTransport]) { 9212 9213 options.dataTypes.unshift(dataTypeOrTransport); 9214 inspect(dataTypeOrTransport); 9215 return false; 9216 } else if (seekingTransport) { 9217 return !(selected = dataTypeOrTransport); 9218 } 9219 }); 9220 return selected; 9221 } 9222 9223 return inspect(options.dataTypes[0]) || !inspected["*"] && inspect("*"); 9224 } 9225 9226 // A special extend for ajax options 9227 // that takes "flat" options (not to be deep extended) 9228 // Fixes trac-9887 9229 function ajaxExtend(target, src) { 9230 var key, deep, 9231 flatOptions = jQuery.ajaxSettings.flatOptions || {}; 9232 9233 for (key in src) { 9234 if (src[key] !== undefined) { 9235 (flatOptions[key] ? target : (deep || (deep = {})))[key] = src[key]; 9236 } 9237 } 9238 if (deep) { 9239 jQuery.extend(true, target, deep); 9240 } 9241 9242 return target; 9243 } 9244 9245 /* Handles responses to an ajax request: 9246 * - finds the right dataType (mediates between content-type and expected dataType) 9247 * - returns the corresponding response 9248 */ 9249 function ajaxHandleResponses(s, jqXHR, responses) { 9250 9251 var ct, type, finalDataType, firstDataType, 9252 contents = s.contents, 9253 dataTypes = s.dataTypes; 9254 9255 // Remove auto dataType and get content-type in the process 9256 while (dataTypes[0] === "*") { 9257 dataTypes.shift(); 9258 if (ct === undefined) { 9259 ct = s.mimeType || jqXHR.getResponseHeader("Content-Type"); 9260 } 9261 } 9262 9263 // Check if we're dealing with a known content-type 9264 if (ct) { 9265 for (type in contents) { 9266 if (contents[type] && contents[type].test(ct)) { 9267 dataTypes.unshift(type); 9268 break; 9269 } 9270 } 9271 } 9272 9273 // Check to see if we have a response for the expected dataType 9274 if (dataTypes[0] in responses) { 9275 finalDataType = dataTypes[0]; 9276 } else { 9277 9278 // Try convertible dataTypes 9279 for (type in responses) { 9280 if (!dataTypes[0] || s.converters[type + " " + dataTypes[0]]) { 9281 finalDataType = type; 9282 break; 9283 } 9284 if (!firstDataType) { 9285 firstDataType = type; 9286 } 9287 } 9288 9289 // Or just use first one 9290 finalDataType = finalDataType || firstDataType; 9291 } 9292 9293 // If we found a dataType 9294 // We add the dataType to the list if needed 9295 // and return the corresponding response 9296 if (finalDataType) { 9297 if (finalDataType !== dataTypes[0]) { 9298 dataTypes.unshift(finalDataType); 9299 } 9300 return responses[finalDataType]; 9301 } 9302 } 9303 9304 /* Chain conversions given the request and the original response 9305 * Also sets the responseXXX fields on the jqXHR instance 9306 */ 9307 function ajaxConvert(s, response, jqXHR, isSuccess) { 9308 var conv2, current, conv, tmp, prev,
vendor: 8,932 bytes, lines 9309-9656
9309 converters = {}, 9310 9311 // Work with a copy of dataTypes in case we need to modify it for conversion 9312 dataTypes = s.dataTypes.slice(); 9313 9314 // Create converters map with lowercased keys 9315 if (dataTypes[1]) { 9316 for (conv in s.converters) { 9317 converters[conv.toLowerCase()] = s.converters[conv]; 9318 } 9319 } 9320 9321 current = dataTypes.shift(); 9322 9323 // Convert to each sequential dataType 9324 while (current) { 9325 9326 if (s.responseFields[current]) { 9327 jqXHR[s.responseFields[current]] = response; 9328 } 9329 9330 // Apply the dataFilter if provided 9331 if (!prev && isSuccess && s.dataFilter) { 9332 response = s.dataFilter(response, s.dataType); 9333 } 9334 9335 prev = current; 9336 current = dataTypes.shift(); 9337 9338 if (current) { 9339 9340 // There's only work to do if current dataType is non-auto 9341 if (current === "*") { 9342 9343 current = prev; 9344 9345 // Convert response if prev dataType is non-auto and differs from current 9346 } else if (prev !== "*" && prev !== current) { 9347 9348 // Seek a direct converter 9349 conv = converters[prev + " " + current] || converters["* " + current]; 9350 9351 // If none found, seek a pair 9352 if (!conv) { 9353 for (conv2 in converters) { 9354 9355 // If conv2 outputs current 9356 tmp = conv2.split(" "); 9357 if (tmp[1] === current) { 9358 9359 // If prev can be converted to accepted input 9360 conv = converters[prev + " " + tmp[0]] || 9361 converters["* " + tmp[0]]; 9362 if (conv) { 9363 9364 // Condense equivalence converters 9365 if (conv === true) { 9366 conv = converters[conv2]; 9367 9368 // Otherwise, insert the intermediate dataType 9369 } else if (converters[conv2] !== true) { 9370 current = tmp[0]; 9371 dataTypes.unshift(tmp[1]); 9372 } 9373 break; 9374 } 9375 } 9376 } 9377 } 9378 9379 // Apply converter (if not an equivalence) 9380 if (conv !== true) { 9381 9382 // Unless errors are allowed to bubble, catch and return them 9383 if (conv && s.throws) { 9384 response = conv(response); 9385 } else { 9386 try { 9387 response = conv(response); 9388 } catch (e) { 9389 return { 9390 state: "parsererror", 9391 error: conv ? e : "No conversion from " + prev + " to " + current 9392 }; 9393 } 9394 } 9395 } 9396 } 9397 } 9398 } 9399 9400 return { state: "success", data: response }; 9401 } 9402 9403 jQuery.extend({ 9404 9405 // Counter for holding the number of active queries 9406 active: 0, 9407 9408 // Last-Modified header cache for next request 9409 lastModified: {}, 9410 etag: {}, 9411 9412 ajaxSettings: { 9413 url: location.href, 9414 type: "GET", 9415 isLocal: rlocalProtocol.test(location.protocol), 9416 global: true, 9417 processData: true, 9418 async: true, 9419 contentType: "application/x-www-form-urlencoded; charset=UTF-8", 9420 9421 /* 9422 timeout: 0, 9423 data: null, 9424 dataType: null, 9425 username: null, 9426 password: null, 9427 cache: null, 9428 throws: false, 9429 traditional: false, 9430 headers: {}, 9431 */ 9432 9433 accepts: { 9434 "*": allTypes, 9435 text: "text/plain", 9436 html: "text/html", 9437 xml: "application/xml, text/xml", 9438 json: "application/json, text/javascript" 9439 }, 9440 9441 contents: { 9442 xml: /\bxml\b/, 9443 html: /\bhtml/, 9444 json: /\bjson\b/ 9445 }, 9446 9447 responseFields: { 9448 xml: "responseXML", 9449 text: "responseText", 9450 json: "responseJSON" 9451 }, 9452 9453 // Data converters 9454 // Keys separate source (or catchall "*") and destination types with a single space 9455 converters: { 9456 9457 // Convert anything to text 9458 "* text": String, 9459 9460 // Text to html (true = no transformation) 9461 "text html": true, 9462 9463 // Evaluate text as a json expression 9464 "text json": JSON.parse, 9465 9466 // Parse text as xml 9467 "text xml": jQuery.parseXML 9468 }, 9469 9470 // For options that shouldn't be deep extended: 9471 // you can add your own custom options here if 9472 // and when you create one that shouldn't be 9473 // deep extended (see ajaxExtend) 9474 flatOptions: { 9475 url: true, 9476 context: true 9477 } 9478 }, 9479 9480 // Creates a full fledged settings object into target 9481 // with both ajaxSettings and settings fields. 9482 // If target is omitted, writes into ajaxSettings. 9483 ajaxSetup: function (target, settings) { 9484 return settings ? 9485 9486 // Building a settings object 9487 ajaxExtend(ajaxExtend(target, jQuery.ajaxSettings), settings) : 9488 9489 // Extending ajaxSettings 9490 ajaxExtend(jQuery.ajaxSettings, target); 9491 }, 9492 9493 ajaxPrefilter: addToPrefiltersOrTransports(prefilters), 9494 ajaxTransport: addToPrefiltersOrTransports(transports), 9495 9496 // Main method 9497 ajax: function (url, options) { 9498 9499 // If url is an object, simulate pre-1.5 signature 9500 if (typeof url === "object") { 9501 options = url; 9502 url = undefined; 9503 } 9504 9505 // Force options to be an object 9506 options = options || {}; 9507 9508 var transport, 9509 9510 // URL without anti-cache param 9511 cacheURL, 9512 9513 // Response headers 9514 responseHeadersString, 9515 responseHeaders, 9516 9517 // timeout handle 9518 timeoutTimer, 9519 9520 // Url cleanup var 9521 urlAnchor, 9522 9523 // Request state (becomes false upon send and true upon completion) 9524 completed, 9525 9526 // To know if global events are to be dispatched 9527 fireGlobals, 9528 9529 // Loop variable 9530 i, 9531 9532 // uncached part of the url 9533 uncached, 9534 9535 // Create the final options object 9536 s = jQuery.ajaxSetup({}, options), 9537 9538 // Callbacks context 9539 callbackContext = s.context || s, 9540 9541 // Context for global events is callbackContext if it is a DOM node or jQuery collection 9542 globalEventContext = s.context && 9543 (callbackContext.nodeType || callbackContext.jquery) ? 9544 jQuery(callbackContext) : 9545 jQuery.event, 9546 9547 // Deferreds 9548 deferred = jQuery.Deferred(), 9549 completeDeferred = jQuery.Callbacks("once memory"), 9550 9551 // Status-dependent callbacks 9552 statusCode = s.statusCode || {}, 9553 9554 // Headers (they are sent all at once) 9555 requestHeaders = {}, 9556 requestHeadersNames = {}, 9557 9558 // Default abort message 9559 strAbort = "canceled", 9560 9561 // Fake xhr 9562 jqXHR = { 9563 readyState: 0, 9564 9565 // Builds headers hashtable if needed 9566 getResponseHeader: function (key) { 9567 var match; 9568 if (completed) { 9569 if (!responseHeaders) { 9570 responseHeaders = {}; 9571 while ((match = rheaders.exec(responseHeadersString))) { 9572 responseHeaders[match[1].toLowerCase() + " "] = 9573 (responseHeaders[match[1].toLowerCase() + " "] || []) 9574 .concat(match[2]); 9575 } 9576 } 9577 match = responseHeaders[key.toLowerCase() + " "]; 9578 } 9579 return match == null ? null : match.join(", "); 9580 }, 9581 9582 // Raw string 9583 getAllResponseHeaders: function () { 9584 return completed ? responseHeadersString : null; 9585 }, 9586 9587 // Caches the header 9588 setRequestHeader: function (name, value) { 9589 if (completed == null) { 9590 name = requestHeadersNames[name.toLowerCase()] = 9591 requestHeadersNames[name.toLowerCase()] || name; 9592 requestHeaders[name] = value; 9593 } 9594 return this; 9595 }, 9596 9597 // Overrides response content-type header 9598 overrideMimeType: function (type) { 9599 if (completed == null) { 9600 s.mimeType = type; 9601 } 9602 return this; 9603 }, 9604 9605 // Status-dependent callbacks 9606 statusCode: function (map) { 9607 var code; 9608 if (map) { 9609 if (completed) { 9610 9611 // Execute the appropriate callbacks 9612 jqXHR.always(map[jqXHR.status]); 9613 } else { 9614 9615 // Lazy-add the new callbacks in a way that preserves old ones 9616 for (code in map) { 9617 statusCode[code] = [statusCode[code], map[code]]; 9618 } 9619 } 9620 } 9621 return this; 9622 }, 9623 9624 // Cancel the request 9625 abort: function (statusText) { 9626 var finalText = statusText || strAbort; 9627 if (transport) { 9628 transport.abort(finalText); 9629 } 9630 done(0, finalText); 9631 return this; 9632 } 9633 }; 9634 9635 // Attach deferreds 9636 deferred.promise(jqXHR); 9637 9638 // Add protocol if not provided (prefilters might expect it) 9639 // Handle falsy url in the settings object (trac-10093: consistency with old signature) 9640 // We also use the url parameter if available 9641 s.url = ((url || s.url || location.href) + "") 9642 .replace(rprotocol, location.protocol + "//"); 9643 9644 // Alias method option to type as per ticket trac-12004 9645 s.type = options.method || options.type || s.method || s.type; 9646 9647 // Extract dataTypes list 9648 s.dataTypes = (s.dataType || "*").toLowerCase().match(rnothtmlwhite) || [""]; 9649 9650 // A cross-domain request is in order when the origin doesn't match the current origin. 9651 if (s.crossDomain == null) { 9652 urlAnchor = document.createElement("a"); 9653 9654 // Support: IE <=8 - 11, Edge 12 - 15 9655 // IE throws exception on accessing the href property if url is malformed, 9656 // e.g. http://example.com:80x/
vendor: 30,953 bytes, lines 9657-10766
9657 try { 9658 urlAnchor.href = s.url; 9659 9660 // Support: IE <=8 - 11 only 9661 // Anchor's host property isn't correctly set when s.url is relative 9662 urlAnchor.href = urlAnchor.href; 9663 s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== 9664 urlAnchor.protocol + "//" + urlAnchor.host; 9665 } catch (e) { 9666 9667 // If there is an error parsing the URL, assume it is crossDomain, 9668 // it can be rejected by the transport if it is invalid 9669 s.crossDomain = true; 9670 } 9671 } 9672 9673 // Convert data if not already a string 9674 if (s.data && s.processData && typeof s.data !== "string") { 9675 s.data = jQuery.param(s.data, s.traditional); 9676 } 9677 9678 // Apply prefilters 9679 inspectPrefiltersOrTransports(prefilters, s, options, jqXHR); 9680 9681 // If request was aborted inside a prefilter, stop there 9682 if (completed) { 9683 return jqXHR; 9684 } 9685 9686 // We can fire global events as of now if asked to 9687 // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (trac-15118) 9688 fireGlobals = jQuery.event && s.global; 9689 9690 // Watch for a new set of requests 9691 if (fireGlobals && jQuery.active++ === 0) { 9692 jQuery.event.trigger("ajaxStart"); 9693 } 9694 9695 // Uppercase the type 9696 s.type = s.type.toUpperCase(); 9697 9698 // Determine if request has content 9699 s.hasContent = !rnoContent.test(s.type); 9700 9701 // Save the URL in case we're toying with the If-Modified-Since 9702 // and/or If-None-Match header later on 9703 // Remove hash to simplify url manipulation 9704 cacheURL = s.url.replace(rhash, ""); 9705 9706 // More options handling for requests with no content 9707 if (!s.hasContent) { 9708 9709 // Remember the hash so we can put it back 9710 uncached = s.url.slice(cacheURL.length); 9711 9712 // If data is available and should be processed, append data to url 9713 if (s.data && (s.processData || typeof s.data === "string")) { 9714 cacheURL += (rquery.test(cacheURL) ? "&" : "?") + s.data; 9715 9716 // trac-9682: remove data so that it's not used in an eventual retry 9717 delete s.data; 9718 } 9719 9720 // Add or update anti-cache param if needed 9721 if (s.cache === false) { 9722 cacheURL = cacheURL.replace(rantiCache, "$1"); 9723 uncached = (rquery.test(cacheURL) ? "&" : "?") + "_=" + (nonce.guid++) + 9724 uncached; 9725 } 9726 9727 // Put hash and anti-cache on the URL that will be requested (gh-1732) 9728 s.url = cacheURL + uncached; 9729 9730 // Change '%20' to '+' if this is encoded form body content (gh-2658) 9731 } else if (s.data && s.processData && 9732 (s.contentType || "").indexOf("application/x-www-form-urlencoded") === 0) { 9733 s.data = s.data.replace(r20, "+"); 9734 } 9735 9736 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 9737 if (s.ifModified) { 9738 if (jQuery.lastModified[cacheURL]) { 9739 jqXHR.setRequestHeader("If-Modified-Since", jQuery.lastModified[cacheURL]); 9740 } 9741 if (jQuery.etag[cacheURL]) { 9742 jqXHR.setRequestHeader("If-None-Match", jQuery.etag[cacheURL]); 9743 } 9744 } 9745 9746 // Set the correct header, if data is being sent 9747 if (s.data && s.hasContent && s.contentType !== false || options.contentType) { 9748 jqXHR.setRequestHeader("Content-Type", s.contentType); 9749 } 9750 9751 // Set the Accepts header for the server, depending on the dataType 9752 jqXHR.setRequestHeader( 9753 "Accept", 9754 s.dataTypes[0] && s.accepts[s.dataTypes[0]] ? 9755 s.accepts[s.dataTypes[0]] + 9756 (s.dataTypes[0] !== "*" ? ", " + allTypes + "; q=0.01" : "") : 9757 s.accepts["*"] 9758 ); 9759 9760 // Check for headers option 9761 for (i in s.headers) { 9762 jqXHR.setRequestHeader(i, s.headers[i]); 9763 } 9764 9765 // Allow custom headers/mimetypes and early abort 9766 if (s.beforeSend && 9767 (s.beforeSend.call(callbackContext, jqXHR, s) === false || completed)) { 9768 9769 // Abort if not done already and return 9770 return jqXHR.abort(); 9771 } 9772 9773 // Aborting is no longer a cancellation 9774 strAbort = "abort"; 9775 9776 // Install callbacks on deferreds 9777 completeDeferred.add(s.complete); 9778 jqXHR.done(s.success); 9779 jqXHR.fail(s.error); 9780 9781 // Get transport 9782 transport = inspectPrefiltersOrTransports(transports, s, options, jqXHR); 9783 9784 // If no transport, we auto-abort 9785 if (!transport) { 9786 done(-1, "No Transport"); 9787 } else { 9788 jqXHR.readyState = 1; 9789 9790 // Send global event 9791 if (fireGlobals) { 9792 globalEventContext.trigger("ajaxSend", [jqXHR, s]); 9793 } 9794 9795 // If request was aborted inside ajaxSend, stop there 9796 if (completed) { 9797 return jqXHR; 9798 } 9799 9800 // Timeout 9801 if (s.async && s.timeout > 0) { 9802 timeoutTimer = window.setTimeout(function () { 9803 jqXHR.abort("timeout"); 9804 }, s.timeout); 9805 } 9806 9807 try { 9808 completed = false; 9809 transport.send(requestHeaders, done); 9810 } catch (e) { 9811 9812 // Rethrow post-completion exceptions 9813 if (completed) { 9814 throw e; 9815 } 9816 9817 // Propagate others as results 9818 done(-1, e); 9819 } 9820 } 9821 9822 // Callback for when everything is done 9823 function done(status, nativeStatusText, responses, headers) { 9824 var isSuccess, success, error, response, modified, 9825 statusText = nativeStatusText; 9826 9827 // Ignore repeat invocations 9828 if (completed) { 9829 return; 9830 } 9831 9832 completed = true; 9833 9834 // Clear timeout if it exists 9835 if (timeoutTimer) { 9836 window.clearTimeout(timeoutTimer); 9837 } 9838 9839 // Dereference transport for early garbage collection 9840 // (no matter how long the jqXHR object will be used) 9841 transport = undefined; 9842 9843 // Cache response headers 9844 responseHeadersString = headers || ""; 9845 9846 // Set readyState 9847 jqXHR.readyState = status > 0 ? 4 : 0; 9848 9849 // Determine if successful 9850 isSuccess = status >= 200 && status < 300 || status === 304; 9851 9852 // Get response data 9853 if (responses) { 9854 response = ajaxHandleResponses(s, jqXHR, responses); 9855 } 9856 9857 // Use a noop converter for missing script but not if jsonp 9858 if (!isSuccess && 9859 jQuery.inArray("script", s.dataTypes) > -1 && 9860 jQuery.inArray("json", s.dataTypes) < 0) { 9861 s.converters["text script"] = function () { }; 9862 } 9863 9864 // Convert no matter what (that way responseXXX fields are always set) 9865 response = ajaxConvert(s, response, jqXHR, isSuccess); 9866 9867 // If successful, handle type chaining 9868 if (isSuccess) { 9869 9870 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 9871 if (s.ifModified) { 9872 modified = jqXHR.getResponseHeader("Last-Modified"); 9873 if (modified) { 9874 jQuery.lastModified[cacheURL] = modified; 9875 } 9876 modified = jqXHR.getResponseHeader("etag"); 9877 if (modified) { 9878 jQuery.etag[cacheURL] = modified; 9879 } 9880 } 9881 9882 // if no content 9883 if (status === 204 || s.type === "HEAD") { 9884 statusText = "nocontent"; 9885 9886 // if not modified 9887 } else if (status === 304) { 9888 statusText = "notmodified"; 9889 9890 // If we have data, let's convert it 9891 } else { 9892 statusText = response.state; 9893 success = response.data; 9894 error = response.error; 9895 isSuccess = !error; 9896 } 9897 } else { 9898 9899 // Extract error from statusText and normalize for non-aborts 9900 error = statusText; 9901 if (status || !statusText) { 9902 statusText = "error"; 9903 if (status < 0) { 9904 status = 0; 9905 } 9906 } 9907 } 9908 9909 // Set data for the fake xhr object 9910 jqXHR.status = status; 9911 jqXHR.statusText = (nativeStatusText || statusText) + ""; 9912 9913 // Success/Error 9914 if (isSuccess) { 9915 deferred.resolveWith(callbackContext, [success, statusText, jqXHR]); 9916 } else { 9917 deferred.rejectWith(callbackContext, [jqXHR, statusText, error]); 9918 } 9919 9920 // Status-dependent callbacks 9921 jqXHR.statusCode(statusCode); 9922 statusCode = undefined; 9923 9924 if (fireGlobals) { 9925 globalEventContext.trigger(isSuccess ? "ajaxSuccess" : "ajaxError", 9926 [jqXHR, s, isSuccess ? success : error]); 9927 } 9928 9929 // Complete 9930 completeDeferred.fireWith(callbackContext, [jqXHR, statusText]); 9931 9932 if (fireGlobals) { 9933 globalEventContext.trigger("ajaxComplete", [jqXHR, s]); 9934 9935 // Handle the global AJAX counter 9936 if (!(--jQuery.active)) { 9937 jQuery.event.trigger("ajaxStop"); 9938 } 9939 } 9940 } 9941 9942 return jqXHR; 9943 }, 9944 9945 getJSON: function (url, data, callback) { 9946 return jQuery.get(url, data, callback, "json"); 9947 }, 9948 9949 getScript: function (url, callback) { 9950 return jQuery.get(url, undefined, callback, "script"); 9951 } 9952 }); 9953 9954 jQuery.each(["get", "post"], function (_i, method) { 9955 jQuery[method] = function (url, data, callback, type) { 9956 9957 // Shift arguments if data argument was omitted 9958 if (isFunction(data)) { 9959 type = type || callback; 9960 callback = data; 9961 data = undefined; 9962 } 9963 9964 // The url can be an options object (which then must have .url) 9965 return jQuery.ajax(jQuery.extend({ 9966 url: url, 9967 type: method, 9968 dataType: type, 9969 data: data, 9970 success: callback 9971 }, jQuery.isPlainObject(url) && url)); 9972 }; 9973 }); 9974 9975 jQuery.ajaxPrefilter(function (s) { 9976 var i; 9977 for (i in s.headers) { 9978 if (i.toLowerCase() === "content-type") { 9979 s.contentType = s.headers[i] || ""; 9980 } 9981 } 9982 }); 9983 9984 9985 jQuery._evalUrl = function (url, options, doc) { 9986 return jQuery.ajax({ 9987 url: url, 9988 9989 // Make this explicit, since user can override this through ajaxSetup (trac-11264) 9990 type: "GET", 9991 dataType: "script", 9992 cache: true, 9993 async: false, 9994 global: false, 9995 9996 // Only evaluate the response if it is successful (gh-4126) 9997 // dataFilter is not invoked for failure responses, so using it instead 9998 // of the default converter is kludgy but it works. 9999 converters: { 10000 "text script": function () { } 10001 }, 10002 dataFilter: function (response) { 10003 jQuery.globalEval(response, options, doc); 10004 } 10005 }); 10006 }; 10007 10008 10009 jQuery.fn.extend({ 10010 wrapAll: function (html) { 10011 var wrap; 10012 10013 if (this[0]) { 10014 if (isFunction(html)) { 10015 html = html.call(this[0]); 10016 } 10017 10018 // The elements to wrap the target around 10019 wrap = jQuery(html, this[0].ownerDocument).eq(0).clone(true); 10020 10021 if (this[0].parentNode) { 10022 wrap.insertBefore(this[0]); 10023 } 10024 10025 wrap.map(function () { 10026 var elem = this; 10027 10028 while (elem.firstElementChild) { 10029 elem = elem.firstElementChild; 10030 } 10031 10032 return elem; 10033 }).append(this); 10034 } 10035 10036 return this; 10037 }, 10038 10039 wrapInner: function (html) { 10040 if (isFunction(html)) { 10041 return this.each(function (i) { 10042 jQuery(this).wrapInner(html.call(this, i)); 10043 }); 10044 } 10045 10046 return this.each(function () { 10047 var self = jQuery(this), 10048 contents = self.contents(); 10049 10050 if (contents.length) { 10051 contents.wrapAll(html); 10052 10053 } else { 10054 self.append(html); 10055 } 10056 }); 10057 }, 10058 10059 wrap: function (html) { 10060 var htmlIsFunction = isFunction(html); 10061 10062 return this.each(function (i) { 10063 jQuery(this).wrapAll(htmlIsFunction ? html.call(this, i) : html); 10064 }); 10065 }, 10066 10067 unwrap: function (selector) { 10068 this.parent(selector).not("body").each(function () { 10069 jQuery(this).replaceWith(this.childNodes); 10070 }); 10071 return this; 10072 } 10073 }); 10074 10075 10076 jQuery.expr.pseudos.hidden = function (elem) { 10077 return !jQuery.expr.pseudos.visible(elem); 10078 }; 10079 jQuery.expr.pseudos.visible = function (elem) { 10080 return !!(elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length); 10081 }; 10082 10083 10084 10085 10086 jQuery.ajaxSettings.xhr = function () { 10087 try { 10088 return new window.XMLHttpRequest(); 10089 } catch (e) { } 10090 }; 10091 10092 var xhrSuccessStatus = { 10093 10094 // File protocol always yields status code 0, assume 200 10095 0: 200, 10096 10097 // Support: IE <=9 only 10098 // trac-1450: sometimes IE returns 1223 when it should be 204 10099 1223: 204 10100 }, 10101 xhrSupported = jQuery.ajaxSettings.xhr(); 10102 10103 support.cors = !!xhrSupported && ("withCredentials" in xhrSupported); 10104 support.ajax = xhrSupported = !!xhrSupported; 10105 10106 jQuery.ajaxTransport(function (options) { 10107 var callback, errorCallback; 10108 10109 // Cross domain only allowed if supported through XMLHttpRequest 10110 if (support.cors || xhrSupported && !options.crossDomain) { 10111 return { 10112 send: function (headers, complete) { 10113 var i, 10114 xhr = options.xhr(); 10115 10116 xhr.open( 10117 options.type, 10118 options.url, 10119 options.async, 10120 options.username, 10121 options.password 10122 ); 10123 10124 // Apply custom fields if provided 10125 if (options.xhrFields) { 10126 for (i in options.xhrFields) { 10127 xhr[i] = options.xhrFields[i]; 10128 } 10129 } 10130 10131 // Override mime type if needed 10132 if (options.mimeType && xhr.overrideMimeType) { 10133 xhr.overrideMimeType(options.mimeType); 10134 } 10135 10136 // X-Requested-With header 10137 // For cross-domain requests, seeing as conditions for a preflight are 10138 // akin to a jigsaw puzzle, we simply never set it to be sure. 10139 // (it can always be set on a per-request basis or even using ajaxSetup) 10140 // For same-domain requests, won't change header if already provided. 10141 if (!options.crossDomain && !headers["X-Requested-With"]) { 10142 headers["X-Requested-With"] = "XMLHttpRequest"; 10143 } 10144 10145 // Set headers 10146 for (i in headers) { 10147 xhr.setRequestHeader(i, headers[i]); 10148 } 10149 10150 // Callback 10151 callback = function (type) { 10152 return function () { 10153 if (callback) { 10154 callback = errorCallback = xhr.onload = 10155 xhr.onerror = xhr.onabort = xhr.ontimeout = 10156 xhr.onreadystatechange = null; 10157 10158 if (type === "abort") { 10159 xhr.abort(); 10160 } else if (type === "error") { 10161 10162 // Support: IE <=9 only 10163 // On a manual native abort, IE9 throws 10164 // errors on any property access that is not readyState 10165 if (typeof xhr.status !== "number") { 10166 complete(0, "error"); 10167 } else { 10168 complete( 10169 10170 // File: protocol always yields status 0; see trac-8605, trac-14207 10171 xhr.status, 10172 xhr.statusText 10173 ); 10174 } 10175 } else { 10176 complete( 10177 xhrSuccessStatus[xhr.status] || xhr.status, 10178 xhr.statusText, 10179 10180 // Support: IE <=9 only 10181 // IE9 has no XHR2 but throws on binary (trac-11426) 10182 // For XHR2 non-text, let the caller handle it (gh-2498) 10183 (xhr.responseType || "text") !== "text" || 10184 typeof xhr.responseText !== "string" ? 10185 { binary: xhr.response } : 10186 { text: xhr.responseText }, 10187 xhr.getAllResponseHeaders() 10188 ); 10189 } 10190 } 10191 }; 10192 }; 10193 10194 // Listen to events 10195 xhr.onload = callback(); 10196 errorCallback = xhr.onerror = xhr.ontimeout = callback("error"); 10197 10198 // Support: IE 9 only 10199 // Use onreadystatechange to replace onabort 10200 // to handle uncaught aborts 10201 if (xhr.onabort !== undefined) { 10202 xhr.onabort = errorCallback; 10203 } else { 10204 xhr.onreadystatechange = function () { 10205 10206 // Check readyState before timeout as it changes 10207 if (xhr.readyState === 4) { 10208 10209 // Allow onerror to be called first, 10210 // but that will not handle a native abort 10211 // Also, save errorCallback to a variable 10212 // as xhr.onerror cannot be accessed 10213 window.setTimeout(function () { 10214 if (callback) { 10215 errorCallback(); 10216 } 10217 }); 10218 } 10219 }; 10220 } 10221 10222 // Create the abort callback 10223 callback = callback("abort"); 10224 10225 try { 10226 10227 // Do send the request (this may raise an exception) 10228 xhr.send(options.hasContent && options.data || null); 10229 } catch (e) { 10230 10231 // trac-14683: Only rethrow if this hasn't been notified as an error yet 10232 if (callback) { 10233 throw e; 10234 } 10235 } 10236 }, 10237 10238 abort: function () { 10239 if (callback) { 10240 callback(); 10241 } 10242 } 10243 }; 10244 } 10245 }); 10246 10247 10248 10249 10250 // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) 10251 jQuery.ajaxPrefilter(function (s) { 10252 if (s.crossDomain) { 10253 s.contents.script = false; 10254 } 10255 }); 10256 10257 // Install script dataType 10258 jQuery.ajaxSetup({ 10259 accepts: { 10260 script: "text/javascript, application/javascript, " + 10261 "application/ecmascript, application/x-ecmascript" 10262 }, 10263 contents: { 10264 script: /\b(?:java|ecma)script\b/ 10265 }, 10266 converters: { 10267 "text script": function (text) { 10268 jQuery.globalEval(text); 10269 return text; 10270 } 10271 } 10272 }); 10273 10274 // Handle cache's special case and crossDomain 10275 jQuery.ajaxPrefilter("script", function (s) { 10276 if (s.cache === undefined) { 10277 s.cache = false; 10278 } 10279 if (s.crossDomain) { 10280 s.type = "GET"; 10281 } 10282 }); 10283 10284 // Bind script tag hack transport 10285 jQuery.ajaxTransport("script", function (s) { 10286 10287 // This transport only deals with cross domain or forced-by-attrs requests 10288 if (s.crossDomain || s.scriptAttrs) { 10289 var script, callback; 10290 return { 10291 send: function (_, complete) { 10292 script = jQuery("<script>") 10293 .attr(s.scriptAttrs || {}) 10294 .prop({ charset: s.scriptCharset, src: s.url }) 10295 .on("load error", callback = function (evt) { 10296 script.remove(); 10297 callback = null; 10298 if (evt) { 10299 complete(evt.type === "error" ? 404 : 200, evt.type); 10300 } 10301 }); 10302 10303 // Use native DOM manipulation to avoid our domManip AJAX trickery 10304 document.head.appendChild(script[0]); 10305 }, 10306 abort: function () { 10307 if (callback) { 10308 callback(); 10309 } 10310 } 10311 }; 10312 } 10313 }); 10314 10315 10316 10317 10318 var oldCallbacks = [], 10319 rjsonp = /(=)\?(?=&|$)|\?\?/; 10320 10321 // Default jsonp settings 10322 jQuery.ajaxSetup({ 10323 jsonp: "callback", 10324 jsonpCallback: function () { 10325 var callback = oldCallbacks.pop() || (jQuery.expando + "_" + (nonce.guid++)); 10326 this[callback] = true; 10327 return callback; 10328 } 10329 }); 10330 10331 // Detect, normalize options and install callbacks for jsonp requests 10332 jQuery.ajaxPrefilter("json jsonp", function (s, originalSettings, jqXHR) { 10333 10334 var callbackName, overwritten, responseContainer, 10335 jsonProp = s.jsonp !== false && (rjsonp.test(s.url) ? 10336 "url" : 10337 typeof s.data === "string" && 10338 (s.contentType || "") 10339 .indexOf("application/x-www-form-urlencoded") === 0 && 10340 rjsonp.test(s.data) && "data" 10341 ); 10342 10343 // Handle iff the expected data type is "jsonp" or we have a parameter to set 10344 if (jsonProp || s.dataTypes[0] === "jsonp") { 10345 10346 // Get callback name, remembering preexisting value associated with it 10347 callbackName = s.jsonpCallback = isFunction(s.jsonpCallback) ? 10348 s.jsonpCallback() : 10349 s.jsonpCallback; 10350 10351 // Insert callback into url or form data 10352 if (jsonProp) { 10353 s[jsonProp] = s[jsonProp].replace(rjsonp, "$1" + callbackName); 10354 } else if (s.jsonp !== false) { 10355 s.url += (rquery.test(s.url) ? "&" : "?") + s.jsonp + "=" + callbackName; 10356 } 10357 10358 // Use data converter to retrieve json after script execution 10359 s.converters["script json"] = function () { 10360 if (!responseContainer) { 10361 jQuery.error(callbackName + " was not called"); 10362 } 10363 return responseContainer[0]; 10364 }; 10365 10366 // Force json dataType 10367 s.dataTypes[0] = "json"; 10368 10369 // Install callback 10370 overwritten = window[callbackName]; 10371 window[callbackName] = function () { 10372 responseContainer = arguments; 10373 }; 10374 10375 // Clean-up function (fires after converters) 10376 jqXHR.always(function () { 10377 10378 // If previous value didn't exist - remove it 10379 if (overwritten === undefined) { 10380 jQuery(window).removeProp(callbackName); 10381 10382 // Otherwise restore preexisting value 10383 } else { 10384 window[callbackName] = overwritten; 10385 } 10386 10387 // Save back as free 10388 if (s[callbackName]) { 10389 10390 // Make sure that re-using the options doesn't screw things around 10391 s.jsonpCallback = originalSettings.jsonpCallback; 10392 10393 // Save the callback name for future use 10394 oldCallbacks.push(callbackName); 10395 } 10396 10397 // Call if it was a function and we have a response 10398 if (responseContainer && isFunction(overwritten)) { 10399 overwritten(responseContainer[0]); 10400 } 10401 10402 responseContainer = overwritten = undefined; 10403 }); 10404 10405 // Delegate to script 10406 return "script"; 10407 } 10408 }); 10409 10410 10411 10412 10413 // Support: Safari 8 only 10414 // In Safari 8 documents created via document.implementation.createHTMLDocument 10415 // collapse sibling forms: the second one becomes a child of the first one. 10416 // Because of that, this security measure has to be disabled in Safari 8. 10417 // https://bugs.webkit.org/show_bug.cgi?id=137337 10418 support.createHTMLDocument = (function () { 10419 var body = document.implementation.createHTMLDocument("").body; 10420 body.innerHTML = "<form></form><form></form>"; 10421 return body.childNodes.length === 2; 10422 })(); 10423 10424 10425 // Argument "data" should be string of html 10426 // context (optional): If specified, the fragment will be created in this context, 10427 // defaults to document 10428 // keepScripts (optional): If true, will include scripts passed in the html string 10429 jQuery.parseHTML = function (data, context, keepScripts) { 10430 if (typeof data !== "string") { 10431 return []; 10432 } 10433 if (typeof context === "boolean") { 10434 keepScripts = context; 10435 context = false; 10436 } 10437 10438 var base, parsed, scripts; 10439 10440 if (!context) { 10441 10442 // Stop scripts or inline event handlers from being executed immediately 10443 // by using document.implementation 10444 if (support.createHTMLDocument) { 10445 context = document.implementation.createHTMLDocument(""); 10446 10447 // Set the base href for the created document 10448 // so any parsed elements with URLs 10449 // are based on the document's URL (gh-2965) 10450 base = context.createElement("base"); 10451 base.href = document.location.href; 10452 context.head.appendChild(base); 10453 } else { 10454 context = document; 10455 } 10456 } 10457 10458 parsed = rsingleTag.exec(data); 10459 scripts = !keepScripts && []; 10460 10461 // Single tag 10462 if (parsed) { 10463 return [context.createElement(parsed[1])]; 10464 } 10465 10466 parsed = buildFragment([data], context, scripts); 10467 10468 if (scripts && scripts.length) { 10469 jQuery(scripts).remove(); 10470 } 10471 10472 return jQuery.merge([], parsed.childNodes); 10473 }; 10474 10475 10476 /** 10477 * Load a url into a page 10478 */ 10479 jQuery.fn.load = function (url, params, callback) { 10480 var selector, type, response, 10481 self = this, 10482 off = url.indexOf(" "); 10483 10484 if (off > -1) { 10485 selector = stripAndCollapse(url.slice(off)); 10486 url = url.slice(0, off); 10487 } 10488 10489 // If it's a function 10490 if (isFunction(params)) { 10491 10492 // We assume that it's the callback 10493 callback = params; 10494 params = undefined; 10495 10496 // Otherwise, build a param string 10497 } else if (params && typeof params === "object") { 10498 type = "POST"; 10499 } 10500 10501 // If we have elements to modify, make the request 10502 if (self.length > 0) { 10503 jQuery.ajax({ 10504 url: url, 10505 10506 // If "type" variable is undefined, then "GET" method will be used. 10507 // Make value of this field explicit since 10508 // user can override it through ajaxSetup method 10509 type: type || "GET", 10510 dataType: "html", 10511 data: params 10512 }).done(function (responseText) { 10513 10514 // Save response for use in complete callback 10515 response = arguments; 10516 10517 self.html(selector ? 10518 10519 // If a selector was specified, locate the right elements in a dummy div 10520 // Exclude scripts to avoid IE 'Permission Denied' errors 10521 jQuery("<div>").append(jQuery.parseHTML(responseText)).find(selector) : 10522 10523 // Otherwise use the full result 10524 responseText); 10525 10526 // If the request succeeds, this function gets "data", "status", "jqXHR" 10527 // but they are ignored because response was set above. 10528 // If it fails, this function gets "jqXHR", "status", "error" 10529 }).always(callback && function (jqXHR, status) { 10530 self.each(function () { 10531 callback.apply(this, response || [jqXHR.responseText, status, jqXHR]); 10532 }); 10533 }); 10534 } 10535 10536 return this; 10537 }; 10538 10539 10540 10541 10542 jQuery.expr.pseudos.animated = function (elem) { 10543 return jQuery.grep(jQuery.timers, function (fn) { 10544 return elem === fn.elem; 10545 }).length; 10546 }; 10547 10548 10549 10550 10551 jQuery.offset = { 10552 setOffset: function (elem, options, i) { 10553 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, 10554 position = jQuery.css(elem, "position"), 10555 curElem = jQuery(elem), 10556 props = {}; 10557 10558 // Set position first, in-case top/left are set even on static elem 10559 if (position === "static") { 10560 elem.style.position = "relative"; 10561 } 10562 10563 curOffset = curElem.offset(); 10564 curCSSTop = jQuery.css(elem, "top"); 10565 curCSSLeft = jQuery.css(elem, "left"); 10566 calculatePosition = (position === "absolute" || position === "fixed") && 10567 (curCSSTop + curCSSLeft).indexOf("auto") > -1; 10568 10569 // Need to be able to calculate position if either 10570 // top or left is auto and position is either absolute or fixed 10571 if (calculatePosition) { 10572 curPosition = curElem.position(); 10573 curTop = curPosition.top; 10574 curLeft = curPosition.left; 10575 10576 } else { 10577 curTop = parseFloat(curCSSTop) || 0; 10578 curLeft = parseFloat(curCSSLeft) || 0; 10579 } 10580 10581 if (isFunction(options)) { 10582 10583 // Use jQuery.extend here to allow modification of coordinates argument (gh-1848) 10584 options = options.call(elem, i, jQuery.extend({}, curOffset)); 10585 } 10586 10587 if (options.top != null) { 10588 props.top = (options.top - curOffset.top) + curTop; 10589 } 10590 if (options.left != null) { 10591 props.left = (options.left - curOffset.left) + curLeft; 10592 } 10593 10594 if ("using" in options) { 10595 options.using.call(elem, props); 10596 10597 } else { 10598 curElem.css(props); 10599 } 10600 } 10601 }; 10602 10603 jQuery.fn.extend({ 10604 10605 // offset() relates an element's border box to the document origin 10606 offset: function (options) { 10607 10608 // Preserve chaining for setter 10609 if (arguments.length) { 10610 return options === undefined ? 10611 this : 10612 this.each(function (i) { 10613 jQuery.offset.setOffset(this, options, i); 10614 }); 10615 } 10616 10617 var rect, win, 10618 elem = this[0]; 10619 10620 if (!elem) { 10621 return; 10622 } 10623 10624 // Return zeros for disconnected and hidden (display: none) elements (gh-2310) 10625 // Support: IE <=11 only 10626 // Running getBoundingClientRect on a 10627 // disconnected node in IE throws an error 10628 if (!elem.getClientRects().length) { 10629 return { top: 0, left: 0 }; 10630 } 10631 10632 // Get document-relative position by adding viewport scroll to viewport-relative gBCR 10633 rect = elem.getBoundingClientRect(); 10634 win = elem.ownerDocument.defaultView; 10635 return { 10636 top: rect.top + win.pageYOffset, 10637 left: rect.left + win.pageXOffset 10638 }; 10639 }, 10640 10641 // position() relates an element's margin box to its offset parent's padding box 10642 // This corresponds to the behavior of CSS absolute positioning 10643 position: function () { 10644 if (!this[0]) { 10645 return; 10646 } 10647 10648 var offsetParent, offset, doc, 10649 elem = this[0], 10650 parentOffset = { top: 0, left: 0 }; 10651 10652 // position:fixed elements are offset from the viewport, which itself always has zero offset 10653 if (jQuery.css(elem, "position") === "fixed") { 10654 10655 // Assume position:fixed implies availability of getBoundingClientRect 10656 offset = elem.getBoundingClientRect(); 10657 10658 } else { 10659 offset = this.offset(); 10660 10661 // Account for the *real* offset parent, which can be the document or its root element 10662 // when a statically positioned element is identified 10663 doc = elem.ownerDocument; 10664 offsetParent = elem.offsetParent || doc.documentElement; 10665 while (offsetParent && 10666 (offsetParent === doc.body || offsetParent === doc.documentElement) && 10667 jQuery.css(offsetParent, "position") === "static") { 10668 10669 offsetParent = offsetParent.parentNode; 10670 } 10671 if (offsetParent && offsetParent !== elem && offsetParent.nodeType === 1) { 10672 10673 // Incorporate borders into its offset, since they are outside its content origin 10674 parentOffset = jQuery(offsetParent).offset(); 10675 parentOffset.top += jQuery.css(offsetParent, "borderTopWidth", true); 10676 parentOffset.left += jQuery.css(offsetParent, "borderLeftWidth", true); 10677 } 10678 } 10679 10680 // Subtract parent offsets and element margins 10681 return { 10682 top: offset.top - parentOffset.top - jQuery.css(elem, "marginTop", true), 10683 left: offset.left - parentOffset.left - jQuery.css(elem, "marginLeft", true) 10684 }; 10685 }, 10686 10687 // This method will return documentElement in the following cases: 10688 // 1) For the element inside the iframe without offsetParent, this method will return 10689 // documentElement of the parent window 10690 // 2) For the hidden or detached element 10691 // 3) For body or html element, i.e. in case of the html node - it will return itself 10692 // 10693 // but those exceptions were never presented as a real life use-cases 10694 // and might be considered as more preferable results. 10695 // 10696 // This logic, however, is not guaranteed and can change at any point in the future 10697 offsetParent: function () { 10698 return this.map(function () { 10699 var offsetParent = this.offsetParent; 10700 10701 while (offsetParent && jQuery.css(offsetParent, "position") === "static") { 10702 offsetParent = offsetParent.offsetParent; 10703 } 10704 10705 return offsetParent || documentElement; 10706 }); 10707 } 10708 }); 10709 10710 // Create scrollLeft and scrollTop methods 10711 jQuery.each({ scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function (method, prop) { 10712 var top = "pageYOffset" === prop; 10713 10714 jQuery.fn[method] = function (val) { 10715 return access(this, function (elem, method, val) { 10716 10717 // Coalesce documents and windows 10718 var win; 10719 if (isWindow(elem)) { 10720 win = elem; 10721 } else if (elem.nodeType === 9) { 10722 win = elem.defaultView; 10723 } 10724 10725 if (val === undefined) { 10726 return win ? win[prop] : elem[method]; 10727 } 10728 10729 if (win) { 10730 win.scrollTo( 10731 !top ? val : win.pageXOffset, 10732 top ? val : win.pageYOffset 10733 ); 10734 10735 } else { 10736 elem[method] = val; 10737 } 10738 }, method, val, arguments.length); 10739 }; 10740 }); 10741 10742 // Support: Safari <=7 - 9.1, Chrome <=37 - 49 10743 // Add the top/left cssHooks using jQuery.fn.position 10744 // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 10745 // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347 10746 // getComputedStyle returns percent when specified for top/left/bottom/right; 10747 // rather than make the css module depend on the offset module, just check for it here 10748 jQuery.each(["top", "left"], function (_i, prop) { 10749 jQuery.cssHooks[prop] = addGetHookIf(support.pixelPosition, 10750 function (elem, computed) { 10751 if (computed) { 10752 computed = curCSS(elem, prop); 10753 10754 // If curCSS returns percentage, fallback to offset 10755 return rnumnonpx.test(computed) ? 10756 jQuery(elem).position()[prop] + "px" : 10757 computed; 10758 } 10759 } 10760 ); 10761 }); 10762 10763 10764 // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods 10765 jQuery.each({ Height: "height", Width: "width" }, function (name, type) { 10766 jQuery.each({
vendor: 7,372 bytes, lines 10767-11029
10767 padding: "inner" + name, 10768 content: type, 10769 "": "outer" + name 10770 }, function (defaultExtra, funcName) { 10771 10772 // Margin is only for outerHeight, outerWidth 10773 jQuery.fn[funcName] = function (margin, value) { 10774 var chainable = arguments.length && (defaultExtra || typeof margin !== "boolean"), 10775 extra = defaultExtra || (margin === true || value === true ? "margin" : "border"); 10776 10777 return access(this, function (elem, type, value) { 10778 var doc; 10779 10780 if (isWindow(elem)) { 10781 10782 // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729) 10783 return funcName.indexOf("outer") === 0 ? 10784 elem["inner" + name] : 10785 elem.document.documentElement["client" + name]; 10786 } 10787 10788 // Get document width or height 10789 if (elem.nodeType === 9) { 10790 doc = elem.documentElement; 10791 10792 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], 10793 // whichever is greatest 10794 return Math.max( 10795 elem.body["scroll" + name], doc["scroll" + name], 10796 elem.body["offset" + name], doc["offset" + name], 10797 doc["client" + name] 10798 ); 10799 } 10800 10801 return value === undefined ? 10802 10803 // Get width or height on the element, requesting but not forcing parseFloat 10804 jQuery.css(elem, type, extra) : 10805 10806 // Set width or height on the element 10807 jQuery.style(elem, type, value, extra); 10808 }, type, chainable ? margin : undefined, chainable); 10809 }; 10810 }); 10811 }); 10812 10813 10814 jQuery.each([ 10815 "ajaxStart", 10816 "ajaxStop", 10817 "ajaxComplete", 10818 "ajaxError", 10819 "ajaxSuccess", 10820 "ajaxSend" 10821 ], function (_i, type) { 10822 jQuery.fn[type] = function (fn) { 10823 return this.on(type, fn); 10824 }; 10825 }); 10826 10827 10828 10829 10830 jQuery.fn.extend({ 10831 10832 bind: function (types, data, fn) { 10833 return this.on(types, null, data, fn); 10834 }, 10835 unbind: function (types, fn) { 10836 return this.off(types, null, fn); 10837 }, 10838 10839 delegate: function (selector, types, data, fn) { 10840 return this.on(types, selector, data, fn); 10841 }, 10842 undelegate: function (selector, types, fn) { 10843 10844 // ( namespace ) or ( selector, types [, fn] ) 10845 return arguments.length === 1 ? 10846 this.off(selector, "**") : 10847 this.off(types, selector || "**", fn); 10848 }, 10849 10850 hover: function (fnOver, fnOut) { 10851 return this.mouseenter(fnOver).mouseleave(fnOut || fnOver); 10852 } 10853 }); 10854 10855 jQuery.each( 10856 ("blur focus focusin focusout resize scroll click dblclick " + 10857 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + 10858 "change select submit keydown keypress keyup contextmenu").split(" "), 10859 function (_i, name) { 10860 10861 // Handle event binding 10862 jQuery.fn[name] = function (data, fn) { 10863 return arguments.length > 0 ? 10864 this.on(name, null, data, fn) : 10865 this.trigger(name); 10866 }; 10867 } 10868 ); 10869 10870 10871 10872 10873 // Support: Android <=4.0 only 10874 // Make sure we trim BOM and NBSP 10875 // Require that the "whitespace run" starts from a non-whitespace 10876 // to avoid O(N^2) behavior when the engine would try matching "\s+$" at each space position. 10877 var rtrim = /^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g; 10878 10879 // Bind a function to a context, optionally partially applying any 10880 // arguments. 10881 // jQuery.proxy is deprecated to promote standards (specifically Function#bind) 10882 // However, it is not slated for removal any time soon 10883 jQuery.proxy = function (fn, context) { 10884 var tmp, args, proxy; 10885 10886 if (typeof context === "string") { 10887 tmp = fn[context]; 10888 context = fn; 10889 fn = tmp; 10890 } 10891 10892 // Quick check to determine if target is callable, in the spec 10893 // this throws a TypeError, but we will just return undefined. 10894 if (!isFunction(fn)) { 10895 return undefined; 10896 } 10897 10898 // Simulated bind 10899 args = slice.call(arguments, 2); 10900 proxy = function () { 10901 return fn.apply(context || this, args.concat(slice.call(arguments))); 10902 }; 10903 10904 // Set the guid of unique handler to the same of original handler, so it can be removed 10905 proxy.guid = fn.guid = fn.guid || jQuery.guid++; 10906 10907 return proxy; 10908 }; 10909 10910 jQuery.holdReady = function (hold) { 10911 if (hold) { 10912 jQuery.readyWait++; 10913 } else { 10914 jQuery.ready(true); 10915 } 10916 }; 10917 jQuery.isArray = Array.isArray; 10918 jQuery.parseJSON = JSON.parse; 10919 jQuery.nodeName = nodeName; 10920 jQuery.isFunction = isFunction; 10921 jQuery.isWindow = isWindow; 10922 jQuery.camelCase = camelCase; 10923 jQuery.type = toType; 10924 10925 jQuery.now = Date.now; 10926 10927 jQuery.isNumeric = function (obj) { 10928 10929 // As of jQuery 3.0, isNumeric is limited to 10930 // strings and numbers (primitives or objects) 10931 // that can be coerced to finite numbers (gh-2662) 10932 var type = jQuery.type(obj); 10933 return (type === "number" || type === "string") && 10934 10935 // parseFloat NaNs numeric-cast false positives ("") 10936 // ...but misinterprets leading-number strings, particularly hex literals ("0x...") 10937 // subtraction forces infinities to NaN 10938 !isNaN(obj - parseFloat(obj)); 10939 }; 10940 10941 jQuery.trim = function (text) { 10942 return text == null ? 10943 "" : 10944 (text + "").replace(rtrim, "$1"); 10945 }; 10946 10947 10948 10949 // Register as a named AMD module, since jQuery can be concatenated with other 10950 // files that may use define, but not via a proper concatenation script that 10951 // understands anonymous AMD modules. A named AMD is safest and most robust 10952 // way to register. Lowercase jquery is used because AMD module names are 10953 // derived from file names, and jQuery is normally delivered in a lowercase 10954 // file name. Do this after creating the global so that if an AMD module wants 10955 // to call noConflict to hide this version of jQuery, it will work. 10956 10957 // Note that for maximum portability, libraries that are not jQuery should 10958 // declare themselves as anonymous modules, and avoid setting a global if an 10959 // AMD loader is present. jQuery is a special case. For more information, see 10960 // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon 10961 10962 if (typeof define === "function" && define.amd) { 10963 define("jquery", [], function () { 10964 return jQuery; 10965 }); 10966 } 10967 10968 10969 10970 10971 var 10972 10973 // Map over jQuery in case of overwrite 10974 _jQuery = window.jQuery, 10975 10976 // Map over the $ in case of overwrite 10977 _$ = window.$; 10978 10979 jQuery.noConflict = function (deep) { 10980 if (window.$ === jQuery) { 10981 window.$ = _$; 10982 } 10983 10984 if (deep && window.jQuery === jQuery) { 10985 window.jQuery = _jQuery; 10986 } 10987 10988 return jQuery; 10989 }; 10990 10991 // Expose jQuery and $ identifiers, even in AMD 10992 // (trac-7102#comment:10, https://github.com/jquery/jquery/pull/557) 10993 // and CommonJS for browser emulators (trac-13566) 10994 if (typeof noGlobal === "undefined") { 10995 window.jQuery = window.$ = jQuery; 10996 } 10997 10998 10999 11000 11001 return jQuery; 11002}); 11003; 11004/*! 11005 * jQuery Validation Plugin 1.11.1 11006 * 11007 * http://bassistance.de/jquery-plugins/jquery-plugin-validation/ 11008 * http://docs.jquery.com/Plugins/Validation 11009 * 11010 * Copyright 2013 Jörn Zaefferer 11011 * Released under the MIT license: 11012 * http://www.opensource.org/licenses/mit-license.php 11013 */ 11014 11015(function($) { 11016 11017$.extend($.fn, { 11018 // http://docs.jquery.com/Plugins/Validation/validate 11019 validate: function( options ) { 11020 11021 // if nothing is selected, return nothing; can't chain anyway 11022 if ( !this.length ) { 11023 if ( options && options.debug && window.console ) { 11024 console.warn( "Nothing selected, can't validate, returning nothing." ); 11025 } 11026 return; 11027 } 11028 11029 // check if a validator for this form was already created
11030 var validator = $.data( this[0], "validator" ); 11031 if ( validator ) { 11032 return validator; 11033 } 11034 11035 // Add novalidate tag if HTML5. 11036 this.attr( "novalidate", "novalidate" ); 11037 11038 validator = new $.validator( options, this[0] ); 11039 $.data( this[0], "validator", validator ); 11040 11041 if ( validator.settings.onsubmit ) { 11042 11043 this.validateDelegate( ":submit", "click", function( event ) { 11044 if ( validator.settings.submitHandler ) { 11045 validator.submitButton = event.target; 11046 } 11047 // allow suppressing validation by adding a cancel class to the submit button 11048 if ( $(event.target).hasClass("cancel") ) { 11049 validator.cancelSubmit = true; 11050 } 11051 11052 // allow suppressing validation by adding the html5 formnovalidate attribute to the submit button 11053 if ( $(event.target).attr("formnovalidate") !== undefined ) { 11054 validator.cancelSubmit = true; 11055 } 11056 }); 11057 11058 // validate the form on submit 11059 this.submit( function( event ) { 11060 if ( validator.settings.debug ) { 11061 // prevent form submit to be able to see console output 11062 event.preventDefault(); 11063 } 11064 function handle() { 11065 var hidden; 11066 if ( validator.settings.submitHandler ) { 11067 if ( validator.submitButton ) { 11068 // insert a hidden input as a replacement for the missing submit button 11069 hidden = $("<input type='hidden'/>").attr("name", validator.submitButton.name).val( $(validator.submitButton).val() ).appendTo(validator.currentForm); 11070 } 11071 validator.settings.submitHandler.call( validator, validator.currentForm, event ); 11072 if ( validator.submitButton ) { 11073 // and clean up afterwards; thanks to no-block-scope, hidden can be referenced 11074 hidden.remove(); 11075 } 11076 return false; 11077 } 11078 return true; 11079 } 11080 11081 // prevent submit for invalid forms or custom submit handlers 11082 if ( validator.cancelSubmit ) { 11083 validator.cancelSubmit = false; 11084 return handle(); 11085 } 11086 if ( validator.form() ) { 11087 if ( validator.pendingRequest ) { 11088 validator.formSubmitted = true; 11089 return false; 11090 } 11091 return handle(); 11092 } else { 11093 validator.focusInvalid(); 11094 return false; 11095 } 11096 }); 11097 } 11098 11099 return validator; 11100 }, 11101 // http://docs.jquery.com/Plugins/Validation/valid 11102 valid: function() { 11103 if ( $(this[0]).is("form")) { 11104 return this.validate().form(); 11105 } else { 11106 var valid = true; 11107 var validator = $(this[0].form).validate(); 11108 this.each(function() { 11109 valid = valid && validator.element(this); 11110 }); 11111 return valid; 11112 } 11113 }, 11114 // attributes: space seperated list of attributes to retrieve and remove 11115 removeAttrs: function( attributes ) { 11116 var result = {}, 11117 $element = this; 11118 $.each(attributes.split(/\s/), function( index, value ) { 11119 result[value] = $element.attr(value); 11120 $element.removeAttr(value); 11121 }); 11122 return result; 11123 }, 11124 // http://docs.jquery.com/Plugins/Validation/rules 11125 rules: function( command, argument ) { 11126 var element = this[0]; 11127 11128 if ( command ) { 11129 var settings = $.data(element.form, "validator").settings; 11130 var staticRules = settings.rules; 11131 var existingRules = $.validator.staticRules(element); 11132 switch(command) { 11133 case "add": 11134 $.extend(existingRules, $.validator.normalizeRule(argument)); 11135 // remove messages from rules, but allow them to be set separetely 11136 delete existingRules.messages; 11137 staticRules[element.name] = existingRules; 11138 if ( argument.messages ) { 11139 settings.messages[element.name] = $.extend( settings.messages[element.name], argument.messages ); 11140 } 11141 break; 11142 case "remove": 11143 if ( !argument ) { 11144 delete staticRules[element.name]; 11145 return existingRules; 11146 } 11147 var filtered = {}; 11148 $.each(argument.split(/\s/), function( index, method ) { 11149 filtered[method] = existingRules[method]; 11150 delete existingRules[method]; 11151 }); 11152 return filtered; 11153 } 11154 } 11155 11156 var data = $.validator.normalizeRules( 11157 $.extend( 11158 {}, 11159 $.validator.classRules(element), 11160 $.validator.attributeRules(element), 11161 $.validator.dataRules(element), 11162 $.validator.staticRules(element) 11163 ), element); 11164 11165 // make sure required is at front 11166 if ( data.required ) { 11167 var param = data.required; 11168 delete data.required; 11169 data = $.extend({required: param}, data); 11170 } 11171 11172 return data; 11173 } 11174}); 11175 11176// Custom selectors 11177$.extend($.expr[":"], { 11178 // http://docs.jquery.com/Plugins/Validation/blank 11179 blank: function( a ) { return !$.trim("" + $(a).val()); }, 11180 // http://docs.jquery.com/Plugins/Validation/filled 11181 filled: function( a ) { return !!$.trim("" + $(a).val()); }, 11182 // http://docs.jquery.com/Plugins/Validation/unchecked 11183 unchecked: function( a ) { return !$(a).prop("checked"); } 11184}); 11185 11186// constructor for validator 11187$.validator = function( options, form ) { 11188 this.settings = $.extend( true, {}, $.validator.defaults, options ); 11189 this.currentForm = form; 11190 this.init(); 11191}; 11192 11193$.validator.format = function( source, params ) { 11194 if ( arguments.length === 1 ) { 11195 return function() { 11196 var args = $.makeArray(arguments); 11197 args.unshift(source); 11198 return $.validator.format.apply( this, args ); 11199 }; 11200 } 11201 if ( arguments.length > 2 && params.constructor !== Array ) { 11202 params = $.makeArray(arguments).slice(1); 11203 } 11204 if ( params.constructor !== Array ) { 11205 params = [ params ]; 11206 } 11207 $.each(params, function( i, n ) { 11208 source = source.replace( new RegExp("\\{" + i + "\\}", "g"), function() { 11209 return n; 11210 }); 11211 }); 11212 return source; 11213}; 11214 11215$.extend($.validator, { 11216 11217 defaults: { 11218 messages: {}, 11219 groups: {}, 11220 rules: {}, 11221 errorClass: "error", 11222 validClass: "valid", 11223 errorElement: "label", 11224 focusInvalid: true, 11225 errorContainer: $([]), 11226 errorLabelContainer: $([]), 11227 onsubmit: true, 11228 ignore: ":hidden", 11229 ignoreTitle: false, 11230 onfocusin: function( element, event ) { 11231 this.lastActive = element; 11232 11233 // hide error label and remove error class on focus if enabled 11234 if ( this.settings.focusCleanup && !this.blockFocusCleanup ) { 11235 if ( this.settings.unhighlight ) { 11236 this.settings.unhighlight.call( this, element, this.settings.errorClass, this.settings.val
11236idClass ); 11237 } 11238 this.addWrapper(this.errorsFor(element)).hide(); 11239 } 11240 }, 11241 onfocusout: function( element, event ) { 11242 if ( !this.checkable(element) && (element.name in this.submitted || !this.optional(element)) ) { 11243 this.element(element); 11244 } 11245 }, 11246 onkeyup: function( element, event ) { 11247 if ( event.which === 9 && this.elementValue(element) === "" ) { 11248 return; 11249 } else if ( element.name in this.submitted || element === this.lastElement ) { 11250 this.element(element); 11251 } 11252 }, 11253 onclick: function( element, event ) { 11254 // click on selects, radiobuttons and checkboxes 11255 if ( element.name in this.submitted ) { 11256 this.element(element); 11257 } 11258 // or option elements, check parent select in that case 11259 else if ( element.parentNode.name in this.submitted ) { 11260 this.element(element.parentNode); 11261 } 11262 }, 11263 highlight: function( element, errorClass, validClass ) { 11264 if ( element.type === "radio" ) { 11265 this.findByName(element.name).addClass(errorClass).removeClass(validClass); 11266 } else { 11267 $(element).addClass(errorClass).removeClass(validClass); 11268 } 11269 }, 11270 unhighlight: function( element, errorClass, validClass ) { 11271 if ( element.type === "radio" ) { 11272 this.findByName(element.name).removeClass(errorClass).addClass(validClass); 11273 } else { 11274 $(element).removeClass(errorClass).addClass(validClass); 11275 } 11276 } 11277 }, 11278 11279 // http://docs.jquery.com/Plugins/Validation/Validator/setDefaults 11280 setDefaults: function( settings ) { 11281 $.extend( $.validator.defaults, settings ); 11282 }, 11283 11284 messages: { 11285 required: "This field is required.", 11286 remote: "Please fix this field.", 11287 email: "Please enter a valid email address.", 11288 url: "Please enter a valid URL.", 11289 date: "Please enter a valid date.", 11290 dateISO: "Please enter a valid date (ISO).", 11291 number: "Please enter a valid number.", 11292 digits: "Please enter only digits.", 11293 creditcard: "Please enter a valid credit card number.", 11294 equalTo: "Please enter the same value again.", 11295 maxlength: $.validator.format("Please enter no more than {0} characters."), 11296 minlength: $.validator.format("Please enter at least {0} characters."), 11297 rangelength: $.validator.format("Please enter a value between {0} and {1} characters long."), 11298 range: $.validator.format("Please enter a value between {0} and {1}."), 11299 max: $.validator.format("Please enter a value less than or equal to {0}."), 11300 min: $.validator.format("Please enter a value greater than or equal to {0}.") 11301 }, 11302 11303 autoCreateRanges: false, 11304 11305 prototype: { 11306 11307 init: function() { 11308 this.labelContainer = $(this.settings.errorLabelContainer); 11309 this.errorContext = this.labelContainer.length && this.labelContainer || $(this.currentForm); 11310 this.containers = $(this.settings.errorContainer).add( this.settings.errorLabelContainer ); 11311 this.submitted = {}; 11312 this.valueCache = {}; 11313 this.pendingRequest = 0; 11314 this.pending = {}; 11315 this.invalid = {}; 11316 this.reset(); 11317 11318 var groups = (this.groups = {}); 11319 $.each(this.settings.groups, function( key, value ) { 11320 if ( typeof value === "string" ) { 11321 value = value.split(/\s/); 11322 } 11323 $.each(value, function( index, name ) { 11324 groups[name] = key; 11325 }); 11326 }); 11327 var rules = this.settings.rules; 11328 $.each(rules, function( key, value ) { 11329 rules[key] = $.validator.normalizeRule(value); 11330 }); 11331 11332 function delegate(event) { 11333 var validator = $.data(this[0].form, "validator"), 11334 eventType = "on" + event.type.replace(/^validate/, ""); 11335 if ( validator.settings[eventType] ) { 11336 validator.settings[eventType].call(validator, this[0], event); 11337 } 11338 } 11339 $(this.currentForm) 11340 .validateDelegate(":text, [type='password'], [type='file'], select, textarea, " + 11341 "[type='number'], [type='search'] ,[type='tel'], [type='url'], " + 11342 "[type='email'], [type='datetime'], [type='date'], [type='month'], " + 11343 "[type='week'], [type='time'], [type='datetime-local'], " + 11344 "[type='range'], [type='color'] ", 11345 "focusin focusout keyup", delegate) 11346 .validateDelegate("[type='radio'], [type='checkbox'], select, option", "click", delegate); 11347 11348 if ( this.settings.invalidHandler ) { 11349 $(this.currentForm).bind("invalid-form.validate", this.settings.invalidHandler); 11350 } 11351 }, 11352 11353 // http://docs.jquery.com/Plugins/Validation/Validator/form 11354 form: function() { 11355 this.checkForm(); 11356 $.extend(this.submitted, this.errorMap); 11357 this.invalid = $.extend({}, this.errorMap); 11358 if ( !this.valid() ) { 11359 $(this.currentForm).triggerHandler("invalid-form", [this]); 11360 } 11361 this.showErrors(); 11362 return this.valid(); 11363 }, 11364 11365 checkForm: function() { 11366 this.prepareForm(); 11367 for ( var i = 0, elements = (this.currentElements = this.elements()); elements[i]; i++ ) { 11368 this.check( elements[i] ); 11369 } 11370 return this.valid(); 11371 }, 11372 11373 // http://docs.jquery.com/Plugins/Validation/Validator/element 11374 element: function( element ) { 11375 element = this.validationTargetFor( this.clean( element ) ); 11376 this.lastElement = element; 11377 this.prepareElement( element ); 11378 this.currentElements = $(element); 11379 var result = this.check( element ) !== false; 11380 if ( result ) { 11381 delete this.invalid[element.name]; 11382 } else { 11383 this.invalid[element.name] = true; 11384 } 11385 if ( !this.numberOfInvalids() ) { 11386 // Hide error containers on last error 11387 this.toHide = this.toHide.add( this.containers ); 11388 } 11389 this.showErrors(); 11390 return result; 11391 }, 11392 11393 // http://docs.jquery.com/Plugins/Validation/Validator/showErrors 11394 showErrors: function( errors ) { 11395 if ( errors ) { 11396 // add items to error list and map 11397 $.extend( this.errorMap, errors ); 11398 this.errorList = []; 11399 for ( var name in errors ) { 11400 this.errorList.push({ 11401 message: errors[name], 11402 element: this.findByName(name)[0] 11403 });
11404 } 11405 // remove items from success list 11406 this.successList = $.grep( this.successList, function( element ) { 11407 return !(element.name in errors); 11408 }); 11409 } 11410 if ( this.settings.showErrors ) { 11411 this.settings.showErrors.call( this, this.errorMap, this.errorList ); 11412 } else { 11413 this.defaultShowErrors(); 11414 } 11415 }, 11416 11417 // http://docs.jquery.com/Plugins/Validation/Validator/resetForm 11418 resetForm: function() { 11419 if ( $.fn.resetForm ) { 11420 $(this.currentForm).resetForm(); 11421 } 11422 this.submitted = {}; 11423 this.lastElement = null; 11424 this.prepareForm(); 11425 this.hideErrors(); 11426 this.elements().removeClass( this.settings.errorClass ).removeData( "previousValue" ); 11427 }, 11428 11429 numberOfInvalids: function() { 11430 return this.objectLength(this.invalid); 11431 }, 11432 11433 objectLength: function( obj ) { 11434 var count = 0; 11435 for ( var i in obj ) { 11436 count++; 11437 } 11438 return count; 11439 }, 11440 11441 hideErrors: function() { 11442 this.addWrapper( this.toHide ).hide(); 11443 }, 11444 11445 valid: function() { 11446 return this.size() === 0; 11447 }, 11448 11449 size: function() { 11450 return this.errorList.length; 11451 }, 11452 11453 focusInvalid: function() { 11454 if ( this.settings.focusInvalid ) { 11455 try { 11456 $(this.findLastActive() || this.errorList.length && this.errorList[0].element || []) 11457 .filter(":visible") 11458 .focus() 11459 // manually trigger focusin event; without it, focusin handler isn't called, findLastActive won't have anything to find 11460 .trigger("focusin"); 11461 } catch(e) { 11462 // ignore IE throwing errors when focusing hidden elements 11463 } 11464 } 11465 }, 11466 11467 findLastActive: function() { 11468 var lastActive = this.lastActive; 11469 return lastActive && $.grep(this.errorList, function( n ) { 11470 return n.element.name === lastActive.name; 11471 }).length === 1 && lastActive; 11472 }, 11473 11474 elements: function() { 11475 var validator = this, 11476 rulesCache = {}; 11477 11478 // select all valid inputs inside the form (no submit or reset buttons) 11479 return $(this.currentForm) 11480 .find("input, select, textarea") 11481 .not(":submit, :reset, :image, [disabled]") 11482 .not( this.settings.ignore ) 11483 .filter(function() { 11484 if ( !this.name && validator.settings.debug && window.console ) { 11485 console.error( "%o has no name assigned", this); 11486 } 11487 11488 // select only the first element for each name, and only those with rules specified 11489 if ( this.name in rulesCache || !validator.objectLength($(this).rules()) ) { 11490 return false; 11491 } 11492 11493 rulesCache[this.name] = true; 11494 return true; 11495 }); 11496 }, 11497 11498 clean: function( selector ) { 11499 return $(selector)[0]; 11500 }, 11501 11502 errors: function() { 11503 var errorClass = this.settings.errorClass.replace(" ", "."); 11504 return $(this.settings.errorElement + "." + errorClass, this.errorContext); 11505 }, 11506 11507 reset: function() { 11508 this.successList = []; 11509 this.errorList = []; 11510 this.errorMap = {}; 11511 this.toShow = $([]); 11512 this.toHide = $([]); 11513 this.currentElements = $([]); 11514 }, 11515 11516 prepareForm: function() { 11517 this.reset(); 11518 this.toHide = this.errors().add( this.containers ); 11519 }, 11520 11521 prepareElement: function( element ) { 11522 this.reset(); 11523 this.toHide = this.errorsFor(element); 11524 }, 11525 11526 elementValue: function( element ) { 11527 var type = $(element).attr("type"), 11528 val = $(element).val(); 11529 11530 if ( type === "radio" || type === "checkbox" ) { 11531 return $("input[name='" + $(element).attr("name") + "']:checked").val(); 11532 } 11533 11534 if ( typeof val === "string" ) { 11535 return val.replace(/\r/g, ""); 11536 } 11537 return val; 11538 }, 11539 11540 check: function( element ) { 11541 element = this.validationTargetFor( this.clean( element ) ); 11542 11543 var rules = $(element).rules(); 11544 var dependencyMismatch = false; 11545 var val = this.elementValue(element); 11546 var result; 11547 11548 for (var method in rules ) { 11549 var rule = { method: method, parameters: rules[method] }; 11550 try { 11551 11552 result = $.validator.methods[method].call( this, val, element, rule.parameters ); 11553 11554 // if a method indicates that the field is optional and therefore valid, 11555 // don't mark it as valid when there are no other rules 11556 if ( result === "dependency-mismatch" ) { 11557 dependencyMismatch = true; 11558 continue; 11559 } 11560 dependencyMismatch = false; 11561 11562 if ( result === "pending" ) { 11563 this.toHide = this.toHide.not( this.errorsFor(element) ); 11564 return; 11565 } 11566 11567 if ( !result ) { 11568 this.formatAndAdd( element, rule ); 11569 return false; 11570 } 11571 } catch(e) { 11572 if ( this.settings.debug && window.console ) { 11573 console.log( "Exception occurred when checking element " + element.i
11573d + ", check the '" + rule.method + "' method.", e ); 11574 } 11575 throw e; 11576 } 11577 } 11578 if ( dependencyMismatch ) { 11579 return; 11580 } 11581 if ( this.objectLength(rules) ) { 11582 this.successList.push(element); 11583 } 11584 return true; 11585 }, 11586 11587 // return the custom message for the given element and validation method 11588 // specified in the element's HTML5 data attribute 11589 customDataMessage: function( element, method ) { 11590 return $(element).data("msg-" + method.toLowerCase()) || (element.attributes && $(element).attr("data-msg-" + method.toLowerCase())); 11591 }, 11592 11593 // return the custom message for the given element name and validation method 11594 customMessage: function( name, method ) { 11595 var m = this.settings.messages[name]; 11596 return m && (m.constructor === String ? m : m[method]); 11597 }, 11598 11599 // return the first defined argument, allowing empty strings 11600 findDefined: function() { 11601 for(var i = 0; i < arguments.length; i++) { 11602 if ( arguments[i] !== undefined ) { 11603 return arguments[i]; 11604 } 11605 } 11606 return undefined; 11607 }, 11608 11609 defaultMessage: function( element, method ) { 11610 return this.findDefined( 11611 this.customMessage( element.name, method ), 11612 this.customDataMessage( element, method ), 11613 // title is never undefined, so handle empty string as undefined 11614 !this.settings.ignoreTitle && element.title || undefined, 11615 $.validator.messages[method], 11616 "<strong>Warning: No message defined for " + element.name + "</strong>" 11617 ); 11618 }, 11619 11620 formatAndAdd: function( element, rule ) { 11621 var message = this.defaultMessage( element, rule.method ), 11622 theregex = /\$?\{(\d+)\}/g; 11623 if ( typeof message === "function" ) { 11624 message = message.call(this, rule.parameters, element); 11625 } else if (theregex.test(message)) { 11626 message = $.validator.format(message.replace(theregex, "{$1}"), rule.parameters); 11627 } 11628 this.errorList.push({ 11629 message: message, 11630 element: element 11631 }); 11632 11633 this.errorMap[element.name] = message; 11634 this.submitted[element.name] = message; 11635 }, 11636 11637 addWrapper: function( toToggle ) { 11638 if ( this.settings.wrapper ) { 11639 toToggle = toToggle.add( toToggle.parent( this.settings.wrapper ) ); 11640 } 11641 return toToggle; 11642 }, 11643 11644 defaultShowErrors: function() { 11645 var i, elements; 11646 for ( i = 0; this.errorList[i]; i++ ) { 11647 var error = this.errorList[i]; 11648 if ( this.settings.highlight ) { 11649 this.settings.highlight.call( this, error.element, this.settings.errorClass, this.settings.validClass ); 11650 } 11651 this.showLabel( error.element, error.message ); 11652 } 11653 if ( this.errorList.length ) { 11654 this.toShow = this.toShow.add( this.containers ); 11655 } 11656 if ( this.settings.success ) { 11657 for ( i = 0; this.successList[i]; i++ ) { 11658 this.showLabel( this.successList[i] ); 11659 } 11660 } 11661 if ( this.settings.unhighlight ) { 11662 for ( i = 0, elements = this.validElements(); elements[i]; i++ ) { 11663 this.settings.unhighlight.call( this, elements[i], this.settings.errorClass, this.settings.validClass ); 11664 } 11665 } 11666 this.toHide = this.toHide.not( this.toShow ); 11667 this.hideErrors(); 11668 this.addWrapper( this.toShow ).show(); 11669 }, 11670 11671 validElements: function() { 11672 return this.currentElements.not(this.invalidElements()); 11673 }, 11674 11675 invalidElements: function() { 11676 return $(this.errorList).map(function() { 11677 return this.element; 11678 }); 11679 }, 11680 11681 showLabel: function( element, message ) { 11682 var label = this.errorsFor( element ); 11683 if ( label.length ) { 11684 // refresh error/success class 11685 label.removeClass( this.settings.validClass ).addClass( this.settings.errorClass ); 11686 // replace message on existing label 11687 label.html(message); 11688 } else { 11689 // create label 11690 label = $("<" + this.settings.errorElement + ">") 11691 .attr("for", this.idOrName(element)) 11692 .addClass(this.settings.errorClass) 11693 .html(message || ""); 11694 if ( this.settings.wrapper ) { 11695 // make sure the element is visible, even in IE 11696 // actually showing the wrapped element is handled elsewhere 11697 label = label.hide().show().wrap("<" + this.settings.wrapper + "/>").parent(); 11698 } 11699 if ( !this.labelContainer.append(label).length ) { 11700 if ( this.settings.errorPlacement ) { 11701 this.settings.errorPlacement(label, $(element) ); 11702 } else { 11703 label.insertAfter(element); 11704 } 11705 } 11706 } 11707 if ( !message && this.settings.success ) { 11708 label.text(""); 11709 if ( typeof this.settings.success === "string" ) { 11710 label.addClass( this.settings.success ); 11711 } else { 11712 this.settings.success( label, element ); 11713 } 11714 } 11715 this.toShow = this.toShow.add(label); 11716 }, 11717 11718 errorsFor: function( element ) { 11719 var name = this.idOrName(element); 11720 return this.errors().filter(function() { 11721 return $(this).attr("for") === name; 11722 }); 11723 }, 11724 11725 idOrName: function( element ) { 11726 return this.groups[element.name] || (this.checkable(element) ? element.name : element.i
11726d || element.name); 11727 }, 11728 11729 validationTargetFor: function( element ) { 11730 // if radio/checkbox, validate first element in group instead 11731 if ( this.checkable(element) ) { 11732 element = this.findByName( element.name ).not(this.settings.ignore)[0]; 11733 } 11734 return element; 11735 }, 11736 11737 checkable: function( element ) { 11738 return (/radio|checkbox/i).test(element.type); 11739 }, 11740 11741 findByName: function( name ) { 11742 return $(this.currentForm).find("[name='" + name + "']"); 11743 }, 11744 11745 getLength: function( value, element ) { 11746 switch( element.nodeName.toLowerCase() ) { 11747 case "select": 11748 return $("option:selected", element).length; 11749 case "input": 11750 if ( this.checkable( element) ) { 11751 return this.findByName(element.name).filter(":checked").length; 11752 } 11753 } 11754 return value.length; 11755 }, 11756 11757 depend: function( param, element ) { 11758 return this.dependTypes[typeof param] ? this.dependTypes[typeof param](param, element) : true; 11759 }, 11760 11761 dependTypes: { 11762 "boolean": function( param, element ) { 11763 return param; 11764 }, 11765 "string": function( param, element ) { 11766 return !!$(param, element.form).length; 11767 }, 11768 "function": function( param, element ) { 11769 return param(element); 11770 } 11771 }, 11772 11773 optional: function( element ) { 11774 var val = this.elementValue(element); 11775 return !$.validator.methods.required.call(this, val, element) && "dependency-mismatch"; 11776 }, 11777 11778 startRequest: function( element ) { 11779 if ( !this.pending[element.name] ) { 11780 this.pendingRequest++; 11781 this.pending[element.name] = true; 11782 } 11783 }, 11784 11785 stopRequest: function( element, valid ) { 11786 this.pendingRequest--; 11787 // sometimes synchronization fails, make sure pendingRequest is never < 0 11788 if ( this.pendingRequest < 0 ) { 11789 this.pendingRequest = 0; 11790 } 11791 delete this.pending[element.name]; 11792 if ( valid && this.pendingRequest === 0 && this.formSubmitted && this.form() ) { 11793 $(this.currentForm).submit(); 11794 this.formSubmitted = false; 11795 } else if (!valid && this.pendingRequest === 0 && this.formSubmitted) { 11796 $(this.currentForm).triggerHandler("invalid-form", [this]); 11797 this.formSubmitted = false; 11798 } 11799 }, 11800 11801 previousValue: function( element ) { 11802 return $.data(element, "previousValue") || $.data(element, "previousValue", { 11803 old: null, 11804 valid: true, 11805 message: this.defaultMessage( element, "remote" ) 11806 }); 11807 } 11808 11809 }, 11810 11811 classRuleSettings: { 11812 required: {required: true}, 11813 email: {email: true}, 11814 url: {url: true}, 11815 date: {date: true}, 11816 dateISO: {dateISO: true}, 11817 number: {number: true}, 11818 digits: {digits: true}, 11819 creditcard: {creditcard: true} 11820 }, 11821 11822 addClassRules: function( className, rules ) { 11823 if ( className.constructor === String ) { 11824 this.classRuleSettings[className] = rules; 11825 } else { 11826 $.extend(this.classRuleSettings, className); 11827 } 11828 }, 11829 11830 classRules: function( element ) { 11831 var rules = {}; 11832 var classes = $(element).attr("class"); 11833 if ( classes ) { 11834 $.each(classes.split(" "), function() { 11835 if ( this in $.validator.classRuleSettings ) { 11836 $.extend(rules, $.validator.classRuleSettings[this]); 11837 } 11838 }); 11839 } 11840 return rules; 11841 }, 11842 11843 attributeRules: function( element ) { 11844 var rules = {}; 11845 var $element = $(element); 11846 var type = $element[0].getAttribute("type"); 11847 11848 for (var method in $.validator.methods) { 11849 var value; 11850 11851 // support for <input required> in both html5 and older browsers 11852 if ( method === "required" ) { 11853 value = $element.get(0).getAttribute(method); 11854 // Some browsers return an empty string for the required attribute 11855 // and non-HTML5 browsers might have required="" markup 11856 if ( value === "" ) { 11857 value = true; 11858 } 11859 // force non-HTML5 browsers to return bool 11860 value = !!value; 11861 } else { 11862 value = $element.attr(method); 11863 } 11864 11865 // convert the value to a number for number inputs, and for text for backwards compability 11866 // allows type="date" and others to be compared as strings 11867 if ( /min|max/.test( method ) && ( type === null || /number|range|text/.test( type ) ) ) { 11868 value = Number(value); 11869 } 11870 11871 if ( value ) { 11872 rules[method] = value; 11873 } else if ( type === method && type !== 'range' ) { 11874 // exception: the jquery validate 'range' method 11875 // does not test for the html5 'range' type 11876 rules[method] = true; 11877 } 11878 } 11879 11880 // maxlength may be returned as -1, 2147483647 (IE) and 524288 (safari) for text inputs 11881 if ( rules.maxlength && /-1|2147483647|524288/.test(rules.maxlength) ) { 11882 delete rules.maxlength; 11883 } 11884 11885 return rules; 11886 }, 11887 11888 dataRules: function( element ) { 11889 var method, value, 11890 rules = {}, $element = $(element); 11891 for (method in $.validator.methods) { 11892 value = $element.data("rule-" + method.toLowerCase()); 11893 if ( value !== undefined ) { 11894 rules[method] = value; 11895 } 11896 } 11897 return rules; 11898 }, 11899 11900 staticRules: function( element ) { 11901 var rules = {};
vendor: 7,190 bytes, lines 11902-12065
11902 var validator = $.data(element.form, "validator"); 11903 if ( validator.settings.rules ) { 11904 rules = $.validator.normalizeRule(validator.settings.rules[element.name]) || {}; 11905 } 11906 return rules; 11907 }, 11908 11909 normalizeRules: function( rules, element ) { 11910 // handle dependency check 11911 $.each(rules, function( prop, val ) { 11912 // ignore rule when param is explicitly false, eg. required:false 11913 if ( val === false ) { 11914 delete rules[prop]; 11915 return; 11916 } 11917 if ( val.param || val.depends ) { 11918 var keepRule = true; 11919 switch (typeof val.depends) { 11920 case "string": 11921 keepRule = !!$(val.depends, element.form).length; 11922 break; 11923 case "function": 11924 keepRule = val.depends.call(element, element); 11925 break; 11926 } 11927 if ( keepRule ) { 11928 rules[prop] = val.param !== undefined ? val.param : true; 11929 } else { 11930 delete rules[prop]; 11931 } 11932 } 11933 }); 11934 11935 // evaluate parameters 11936 $.each(rules, function( rule, parameter ) { 11937 rules[rule] = $.isFunction(parameter) ? parameter(element) : parameter; 11938 }); 11939 11940 // clean number parameters 11941 $.each(['minlength', 'maxlength'], function() { 11942 if ( rules[this] ) { 11943 rules[this] = Number(rules[this]); 11944 } 11945 }); 11946 $.each(['rangelength', 'range'], function() { 11947 var parts; 11948 if ( rules[this] ) { 11949 if ( $.isArray(rules[this]) ) { 11950 rules[this] = [Number(rules[this][0]), Number(rules[this][1])]; 11951 } else if ( typeof rules[this] === "string" ) { 11952 parts = rules[this].split(/[\s,]+/); 11953 rules[this] = [Number(parts[0]), Number(parts[1])]; 11954 } 11955 } 11956 }); 11957 11958 if ( $.validator.autoCreateRanges ) { 11959 // auto-create ranges 11960 if ( rules.min && rules.max ) { 11961 rules.range = [rules.min, rules.max]; 11962 delete rules.min; 11963 delete rules.max; 11964 } 11965 if ( rules.minlength && rules.maxlength ) { 11966 rules.rangelength = [rules.minlength, rules.maxlength]; 11967 delete rules.minlength; 11968 delete rules.maxlength; 11969 } 11970 } 11971 11972 return rules; 11973 }, 11974 11975 // Converts a simple string to a {string: true} rule, e.g., "required" to {required:true} 11976 normalizeRule: function( data ) { 11977 if ( typeof data === "string" ) { 11978 var transformed = {}; 11979 $.each(data.split(/\s/), function() { 11980 transformed[this] = true; 11981 }); 11982 data = transformed; 11983 } 11984 return data; 11985 }, 11986 11987 // http://docs.jquery.com/Plugins/Validation/Validator/addMethod 11988 addMethod: function( name, method, message ) { 11989 $.validator.methods[name] = method; 11990 $.validator.messages[name] = message !== undefined ? message : $.validator.messages[name]; 11991 if ( method.length < 3 ) { 11992 $.validator.addClassRules(name, $.validator.normalizeRule(name)); 11993 } 11994 }, 11995 11996 methods: { 11997 11998 // http://docs.jquery.com/Plugins/Validation/Methods/required 11999 required: function( value, element, param ) { 12000 // check if dependency is met 12001 if ( !this.depend(param, element) ) { 12002 return "dependency-mismatch"; 12003 } 12004 if ( element.nodeName.toLowerCase() === "select" ) { 12005 // could be an array for select-multiple or a string, both are fine this way 12006 var val = $(element).val(); 12007 return val && val.length > 0; 12008 } 12009 if ( this.checkable(element) ) { 12010 return this.getLength(value, element) > 0; 12011 } 12012 return $.trim(value).length > 0; 12013 }, 12014 12015 // http://docs.jquery.com/Plugins/Validation/Methods/email 12016 email: function( value, element ) { 12017 // contributed by Scott Gonzalez: http://projects.scottsplayground.com/email_address_validation/ 12018 return this.optional(element) || /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i.test(value); 12019 }, 12020 12021 // http://docs.jquery.com/Plugins/Validation/Methods/url 12022 url: function( value, element ) { 12023 // contributed by Scott Gonzalez: http://projects.scottsplayground.com/iri/ 12024 return this.optional(element) || /^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value); 12025 }, 12026 12027 // http://docs.jquery.com/Plugins/Validation/Methods/date 12028 date: function( value, element ) { 12029 return this.optional(element) || !/Invalid|NaN/.test(new Date(value).toString()); 12030 }, 12031 12032 // http://docs.jquery.com/Plugins/Validation/Methods/dateISO 12033 dateISO: function( value, element ) { 12034 return this.optional(element) || /^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/.test(value); 12035 }, 12036 12037 // http://docs.jquery.com/Plugins/Validation/Methods/number 12038 number: function( value, element ) { 12039 return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(value); 12040 }, 12041 12042 // http://docs.jquery.com/Plugins/Validation/Methods/digits 12043 digits: function( value, element ) { 12044 return this.optional(element) || /^\d+$/.test(value); 12045 }, 12046 12047 // http://docs.jquery.com/Plugins/Validation/Methods/creditcard 12048 // based on http://en.wikipedia.org/wiki/Luhn 12049 creditcard: function( value, element ) { 12050 if ( this.optional(element) ) { 12051 return "dependency-mismatch"; 12052 } 12053 // accept only spaces, digits and dashes 12054 if ( /[^0-9 \-]+/.test(value) ) { 12055 return false; 12056 } 12057 var nCheck = 0, 12058 nDigit = 0, 12059 bEven = false; 12060 12061 value = value.replace(/\D/g, ""); 12062 12063 for (var n = value.length - 1; n >= 0; n--) { 12064 var cDigit = value.charAt(n); 12065 nDigit = parseInt(cDigit, 10);
12066 if ( bEven ) { 12067 if ( (nDigit *= 2) > 9 ) { 12068 nDigit -= 9; 12069 } 12070 } 12071 nCheck += nDigit; 12072 bEven = !bEven; 12073 } 12074 12075 return (nCheck % 10) === 0; 12076 }, 12077 12078 // http://docs.jquery.com/Plugins/Validation/Methods/minlength 12079 minlength: function( value, element, param ) { 12080 var length = $.isArray( value ) ? value.length : this.getLength($.trim(value), element); 12081 return this.optional(element) || length >= param; 12082 }, 12083 12084 // http://docs.jquery.com/Plugins/Validation/Methods/maxlength 12085 maxlength: function( value, element, param ) { 12086 var length = $.isArray( value ) ? value.length : this.getLength($.trim(value), element); 12087 return this.optional(element) || length <= param; 12088 }, 12089 12090 // http://docs.jquery.com/Plugins/Validation/Methods/rangelength 12091 rangelength: function( value, element, param ) { 12092 var length = $.isArray( value ) ? value.length : this.getLength($.trim(value), element); 12093 return this.optional(element) || ( length >= param[0] && length <= param[1] ); 12094 }, 12095 12096 // http://docs.jquery.com/Plugins/Validation/Methods/min 12097 min: function( value, element, param ) { 12098 return this.optional(element) || value >= param; 12099 }, 12100 12101 // http://docs.jquery.com/Plugins/Validation/Methods/max 12102 max: function( value, element, param ) { 12103 return this.optional(element) || value <= param; 12104 }, 12105 12106 // http://docs.jquery.com/Plugins/Validation/Methods/range 12107 range: function( value, element, param ) { 12108 return this.optional(element) || ( value >= param[0] && value <= param[1] ); 12109 }, 12110 12111 // http://docs.jquery.com/Plugins/Validation/Methods/equalTo 12112 equalTo: function( value, element, param ) {
12113 // bind to the blur event of the target in order to revalidate whenever the target field is updated 12114 // TODO find a way to bind the event just once, avoiding the unbind-rebind overhead 12115 var target = $(param); 12116 if ( this.settings.onfocusout ) { 12117 target.unbind(".validate-equalTo").bind("blur.validate-equalTo", function() { 12118 $(element).valid(); 12119 }); 12120 } 12121 return value === target.val(); 12122 }, 12123 12124 // http://docs.jquery.com/Plugins/Validation/Methods/remote 12125 remote: function( value, element, param ) { 12126 if ( this.optional(element) ) { 12127 return "dependency-mismatch"; 12128 } 12129 12130 var previous = this.previousValue(element); 12131 if (!this.settings.messages[element.name] ) { 12132 this.settings.messages[element.name] = {}; 12133 } 12134 previous.originalMessage = this.settings.messages[element.name].remote; 12135 this.settings.messages[element.name].remote = previous.message; 12136 12137 param = typeof param === "string" && {url:param} || param; 12138 12139 if ( previous.old === value ) { 12140 return previous.valid; 12141 } 12142 12143 previous.old = value; 12144 var validator = this; 12145 this.startRequest(element); 12146 var data = {}; 12147 data[element.name] = value; 12148 $.ajax($.extend(true, { 12149 url: param, 12150 mode: "abort", 12151 port: "validate" + element.name, 12152 dataType: "json", 12153 data: data, 12154 success: function( response ) { 12155 validator.settings.messages[element.name].remote = previous.originalMessage; 12156 var valid = response === true || response === "true"; 12157 if ( valid ) { 12158 var submitted = validator.formSubmitted; 12159 validator.prepareElement(element); 12160 validator.formSubmitted = submitted; 12161 validator.successList.push(element); 12162 delete validator.invalid[element.name]; 12163 validator.showErrors(); 12164 } else { 12165 var errors = {}; 12166 var message = response || validator.defaultMessage( element, "remote" ); 12167 errors[element.name] = previous.message = $.isFunction(message) ? message(value) : message; 12168 validator.invalid[element.name] = true; 12169 validator.showErrors(errors); 12170 } 12171 previous.valid = valid; 12172 validator.stopRequest(element, valid); 12173 } 12174 }, param)); 12175 return "pending"; 12176 } 12177 12178 } 12179 12180}); 12181 12182// deprecated, use $.validator.format instead 12183$.format = $.validator.format; 12184 12185}(jQuery)); 12186 12187// ajax mode: abort 12188// usage: $.ajax({ mode: "abort"[, port: "uniqueport"]}); 12189// if mode:"abort" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort() 12190(function($) { 12191 var pendingRequests = {}; 12192 // Use a prefilter if available (1.5+) 12193 if ( $.ajaxPrefilter ) { 12194 $.ajaxPrefilter(function( settings, _, xhr ) { 12195 var port = settings.port; 12196 if ( settings.mode === "abort" ) { 12197 if ( pendingRequests[port] ) { 12198 pendingRequests[port].abort(); 12199 } 12200 pendingRequests[port] = xhr; 12201 } 12202 }); 12203 } else { 12204 // Proxy ajax 12205 var ajax = $.ajax; 12206 $.ajax = function( settings ) { 12207 var mode = ( "mode" in settings ? settings : $.ajaxSettings ).mode, 12208 port = ( "port" in settings ? settings : $.ajaxSettings ).port; 12209 if ( mode === "abort" ) { 12210 if ( pendingRequests[port] ) { 12211 pendingRequests[port].abort(); 12212 } 12213 pendingRequests[port] = ajax.apply(this, arguments); 12214 return pendingRequests[port]; 12215 } 12216 return ajax.apply(this, arguments); 12217 }; 12218 } 12219}(jQuery)); 12220 12221// provides delegate(type: String, delegate: Selector, handler: Callback) plugin for easier event delegation 12222// handler is only called when $(event.target).is(delegate), in the scope of the jquery-object for event.target 12223(function($) { 12224 $.extend($.fn, { 12225 validateDelegate: function( delegate, type, handler ) { 12226 return this.bind(type, function( event ) { 12227 var target = $(event.target); 12228 if ( target.is(delegate) ) { 12229 return handler.apply(target, arguments); 12230 } 12231 }); 12232 } 12233 }); 12234}(jQuery)); 12235; 12236/*! jQuery Validation Plugin - v1.11.1 - 3/22/2013\n* https://github.com/jzaefferer/jquery-validation 12237* Copyright (c) 2013 Jörn Zaefferer; Licensed MIT */(function(t){t.extend(t.fn,{validate:function(e){if(!this.length)return e&&e.debug&&window.console&&console.warn("Nothing selected, can't validate, returning nothing."),void 0;var i=t.data(this[0],"validator");return i?i:(this.attr("novalidate","novalidate"),i=new t.validator(e,this[0]),t.data(this[0],"validator",i),i.settings.onsubmit&&(this.validateDelegate(":submit","click",function(e){i.settings.submitHandler&&(i.submitButton=e.target),t(e.target).hasClass("cancel")&&(i.cancelSubmit=!0),void 0!==t(e.target).attr("formnovalidate")&&(i.cancelSubmit=!0)}),this.submit(function(e){function s(){var s;return i.settings.submitHandler?(i.submitButton&&(s=t("<input type='hidden'/>").attr("name",i.submitButton.name).val(t(i.submitButton).val()).appendTo(i.currentForm)),i.settings.submitHandler.call(i,i.currentForm,e),i.submitButton&&s.remove(),!1):!0}return i.settings.debug&&e.preventDefault(),i.cancelSubmit?(i.cancelSubmit=!1,s()):i.form()?i.pendingRequest?(i.formSubmitted=!0,!1):s():(i.focusInvalid(),!1)})),i)},valid:function(){if(t(this[0]).is("form"))return this.validate().form();var e=!0,i=t(this[0].form).validate();
12237return this.each(function(){e=e&&i.element(this)}),e},removeAttrs:function(e){var i={},s=this;return t.each(e.split(/\s/),function(t,e){i[e]=s.attr(e),s.removeAttr(e)}),i},rules:function(e,i){var s=this[0];if(e){var r=t.data(s.form,"validator").settings,n=r.rules,a=t.validator.staticRules(s);switch(e){case"add":t.extend(a,t.validator.normalizeRule(i)),delete a.messages,n[s.name]=a,i.messages&&(r.messages[s.name]=t.extend(r.messages[s.name],i.messages));break;case"remove":if(!i)return delete n[s.name],a;var u={};return t.each(i.split(/\s/),function(t,e){u[e]=a[e],delete a[e]}),u}}var o=t.validator.normalizeRules(t.extend({},t.validator.classRules(s),t.validator.attributeRules(s),t.validator.dataRules(s),t.validator.staticRules(s)),s);if(o.required){var l=o.required;delete o.required,o=t.extend({required:l},o)}return o}}),t.extend(t.expr[":"],{blank:function(e){return!t.trim(""+t(e).val())},filled:function(e){return!!t.trim(""+t(e).val())},unchecked:function(e){return!t(e).prop("checked")}}),t.validator=function(e,i){this.settings=t.extend(!0,{},t.validator.defaults,e),this.currentForm=i,this.init()},t.validator.format=function(e,i){return 1===arguments.length?function(){var i=t.makeArray(arguments);return i.unshift(e),t.validator.format.apply(this,i)}:(arguments.length>2&&i.constructor!==Array&&(i=t.makeArray(arguments).slice(1)),i.constructor!==Array&&(i=[i]),t.each(i,function(t,i){e=e.replace(RegExp("\\{"+t+"\\}","g"),function(){return i})}),e)},t.extend(t.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusInvalid:!0,errorContainer:t([]),errorLabelContainer:t([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(t){this.lastActive=t,this.settings.focusCleanup&&!this.blockFocusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,t,this.settings.errorClass,this.settings.validClass),this.addWrapper(this.errorsFor(t)).hide())},onfocusout:function(t){this.checkable(t)||!(t.name in this.submitted)&&this.optional(t)||this.element(t)},onkeyup:function(t,e){(9!==e.which||""!==this.elementValue(t))&&(t.name in this.submitted||t===this.lastElement)&&this.element(t)},onclick:function(t){t.name in this.submitted?this.element(t):t.parentNode.name in this.submitted&&this.element(t.parentNode)},highlight:function(e,i,s){"radio"===e.type?this.findByName(e.name).addClass(i).removeClass(s):t(e).addClass(i).removeClass(s)},unhighlight:function(e,i,s){"radio"===e.type?this.findByName(e.name).removeClass(i).addClass(s):t(e).removeClass(i).addClass(s)}},setDefaults:function(e){t.extend(t.validator.defaults,e)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",maxlength:t.validator.format("Please enter no more than {0} characters."),minlength:t.validator.format("Please enter at least {0} characters."),rangelength:t.validator.format("Please enter a value between {0} and {1} characters long."),range:t.validator.format("Please enter a value between {0} and {1}."),max:t.validator.format("Please enter a value less than or equal to {0}."),min:t.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:!1,prototype:{init:function(){function e(e){var i=t.data(this[0].form,"validator"),s="on"+e.type.replace(/^validate/,"");i.settings[s]&&i.settings[s].call(i,this[0],e)}this.labelContainer=t(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||t(this.currentForm),this.containers=t(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var i=this.groups={};t.each(this.settings.groups,function(e,s){"string"==typeof s&&(s=s.split(/\s/)),t.each(s,function(t,s){i[s]=e})});var s=this.settings.rules;t.each(s,function(e,i){s[e]=t.validator.normalizeRule(i)}),t(this.currentForm).validateDelegate(":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'] ,[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'] ","focusin focusout keyup",e).validateDelegate("[type='radio'], [type='checkbox'], select, option","click",e),this.settings.invalidHandler&&t(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler)},form:function(){return this.checkForm(),t.extend(this.submitted,this.errorMap),this.invalid=t.extend({},this.errorMap),this.valid()||t(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var t=0,e=this.currentElements=this.elements();e[t];t++)this.check(e[t]);return this.valid()},element:function(e){e=this.validationTargetFor(this.clean(e)),this.lastElement=e,this.prepareElement(e),this.currentElements=t(e);var i=this.check(e)!==!1;return i?delete this.invalid[e.name]:this.invalid[e.name]=!0,this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers
12237)),this.showErrors(),i},showErrors:function(e){if(e){t.extend(this.errorMap,e),this.errorList=[];for(var i in e)this.errorList.push({message:e[i],element:this.findByName(i)[0]});this.successList=t.grep(this.successList,function(t){return!(t.name in e)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){t.fn.resetForm&&t(this.currentForm).resetForm(),this.submitted={},this.lastElement=null,this.prepareForm(),this.hideErrors(),this.elements().removeClass(this.settings.errorClass).removeData("previousValue")},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(t){var e=0;for(var i in t)e++;return e},hideErrors:function(){this.addWrapper(this.toHide).hide()},valid:function(){return 0===this.size()},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{t(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(e){}},findLastActive:function(){var e=this.lastActive;return e&&1===t.grep(this.errorList,function(t){return t.element.name===e.name}).length&&e},elements:function(){var e=this,i={};return t(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){return!this.name&&e.settings.debug&&window.console&&console.error("%o has no name assigned",this),this.name in i||!e.objectLength(t(this).rules())?!1:(i[this.name]=!0,!0)})},clean:function(e){return t(e)[0]},errors:function(){var e=this.settings.errorClass.replace(" ",".");return t(this.settings.errorElement+"."+e,this.errorContext)},reset:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=t([]),this.toHide=t([]),this.currentElements=t([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(t){this.reset(),this.toHide=this.errorsFor(t)},elementValue:function(e){var i=t(e).attr("type"),s=t(e).val();return"radio"===i||"checkbox"===i?t("input[name='"+t(e).attr("name")+"']:checked").val():"string"==typeof s?s.replace(/\r/g,""):s},check:function(e){e=this.validationTargetFor(this.clean(e));var i,s=t(e).rules(),r=!1,n=this.elementValue(e);for(var a in s){var u={method:a,parameters:s[a]};try{if(i=t.validator.methods[a].call(this,n,e,u.parameters),"dependency-mismatch"===i){r=!0;continue}if(r=!1,"pending"===i)return this.toHide=this.toHide.not(this.errorsFor(e)),void 0;if(!i)return this.formatAndAdd(e,u),!1}catch(o){throw this.settings.debug&&window.console&&console.log("Exception occurred when checking element "+e.id+", check the '"+u.method+"' method.",o),o}}return r?void 0:(this.objectLength(s)&&this.successList.push(e),!0)},customDataMessage:function(e,i){return t(e).data("msg-"+i.toLowerCase())||e.attributes&&t(e).attr("data-msg-"+i.toLowerCase())},customMessage:function(t,e){var i=this.settings.messages[t];return i&&(i.constructor===String?i:i[e])},findDefined:function(){for(var t=0;arguments.length>t;t++)if(void 0!==arguments[t])return arguments[t];return void 0},defaultMessage:function(e,i){return this.findDefined(this.customMessage(e.name,i),this.customDataMessage(e,i),!this.settings.ignoreTitle&&e.title||void 0,t.validator.messages[i],"<strong>Warning: No message defined for "+e.name+"</strong>")},formatAndAdd:function(e,i){var s=this.defaultMessage(e,i.method),r=/\$?\{(\d+)\}/g;"function"==typeof s?s=s.call(this,i.parameters,e):r.test(s)&&(s=t.validator.format(s.replace(r,"{$1}"),i.parameters)),this.errorList.push({message:s,element:e}),this.errorMap[e.name]=s,this.submitted[e.name]=s},addWrapper:function(t){return this.settings.wrapper&&(t=t.add(t.parent(this.settings.wrapper))),t},defaultShowErrors:function(){var t,e;for(t=0;this.errorList[t];t++){var i=this.errorList[t];this.settings.highlight&&this.settings.highlight.call(this,i.element,this.settings.errorClass,this.settings.validClass),this.showLabel(i.element,i.message)}if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers
12237)),this.settings.success)for(t=0;this.successList[t];t++)this.showLabel(this.successList[t]);if(this.settings.unhighlight)for(t=0,e=this.validElements();e[t];t++)this.settings.unhighlight.call(this,e[t],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return t(this.errorList).map(function(){return this.element})},showLabel:function(e,i){var s=this.errorsFor(e);s.length?(s.removeClass(this.settings.validClass).addClass(this.settings.errorClass),s.html(i)):(s=t("<"+this.settings.errorElement+">").attr("for",this.idOrName(e)).addClass(this.settings.errorClass).html(i||""),this.settings.wrapper&&(s=s.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.append(s).length||(this.settings.errorPlacement?this.settings.errorPlacement(s,t(e)):s.insertAfter(e))),!i&&this.settings.success&&(s.text(""),"string"==typeof this.settings.success?s.addClass(this.settings.success):this.settings.success(s,e)),this.toShow=this.toShow.add(s)},errorsFor:function(e){var i=this.idOrName(e);return this.errors().filter(function(){return t(this).attr("for")===i})},idOrName:function(t){return this.groups[t.name]||(this.checkable(t)?t.name:t.id||t.name)},validationTargetFor:function(t){return this.checkable(t)&&(t=this.findByName(t.name).not(this.settings.ignore)[0]),t},checkable:function(t){return/radio|checkbox/i.test(t.type)},findByName:function(e){return t(this.currentForm).find("[name='"+e+"']")},getLength:function(e,i){switch(i.nodeName.toLowerCase()){case"select":return t("option:selected",i).length;case"input":if(this.checkable(i))return this.findByName(i.name).filter(":checked").length}return e.length},depend:function(t,e){return this.dependTypes[typeof t]?this.dependTypes[typeof t](t,e):!0}
12237,dependTypes:{"boolean":function(t){return t},string:function(e,i){return!!t(e,i.form).length},"function":function(t,e){return t(e)}},optional:function(e){var i=this.elementValue(e);return!t.validator.methods.required.call(this,i,e)&&"dependency-mismatch"},startRequest:function(t){this.pending[t.name]||(this.pendingRequest++,this.pending[t.name]=!0)},stopRequest:function(e,i){this.pendingRequest--,0>this.pendingRequest&&(this.pendingRequest=0),delete this.pending[e.name],i&&0===this.pendingRequest&&this.formSubmitted&&this.form()?(t(this.currentForm).submit(),this.formSubmitted=!1):!i&&0===this.pendingRequest&&this.formSubmitted&&(t(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(e){return t.data(e,"previousValue")||t.data(e,"previousValue",{old:null,valid:!0,message:this.defaultMessage(e,"remote")})}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(e,i){e.constructor===String?this.classRuleSettings[e]=i:t.extend(this.classRuleSettings,e)},classRules:function(e){var i={},s=t(e).attr("class");return s&&t.each(s.split(" "),function(){this in t.validator.classRuleSettings&&t.extend(i,t.validator.classRuleSettings[this])}),i},attributeRules:function(e){var i={},s=t(e),r=s[0].getAttribute("type");for(var n in t.validator.methods){var a;"required"===n?(a=s.get(0).getAttribute(n),""===a&&(a=!0),a=!!a):a=s.attr(n),/min|max/.test(n)&&(null===r||/number|range|text/.test(r))&&(a=Number(a)),a?i[n]=a:r===n&&"range"!==r&&(i[n]=!0)}return i.maxlength&&/-1|2147483647|524288/.test(i.maxlength)&&delete i.maxlength,i},dataRules:function(e){var i,s,r={},n=t(e);for(i in t.validator.methods)s=n.data("rule-"+i.toLowerCase()),void 0!==s&&(r[i]=s);return r},staticRules:function(e){var i={},s=t.data(e.form,"validator");return s.settings.rules&&(i=t.validator.normalizeRule(s.settings.rules[e.name])||{}),i},normalizeRules:function(e,i){return t.each(e,function(s,r){if(r===!1)return delete e[s],void 0;if(r.param||r.depends){var n=!0;switch(typeof r.depends){case"string":n=!!t(r.depends,i.form).length;break;case"function":n=r.depends.call(i,i)}n?e[s]=void 0!==r.param?r.param:!0:delete e[s]}}),t.each(e,function(s,r){e[s]=t.isFunction(r)?r(i):r}),t.each(["minlength","maxlength"],function(){e[this]&&(e[this]=Number(e[this]))}),t.each(["rangelength","range"],function(){var i;e[this]&&(t.isArray(e[this])?e[this]=[Number(e[this][0]),Number(e[this][1])]:"string"==typeof e[this]&&(i=e[this].split(/[\s,]+/),e[this]=[Number(i[0]),Number(i[1])]))}),t.validator.autoCreateRanges&&(e.min&&e.max&&(e.range=[e.min,e.max],delete e.min,delete e.max),e.minlength&&e.maxlength&&(e.rangelength=[e.minlength,e.maxlength],delete e.minlength,delete e.maxlength)),e},normalizeRule:function(e){if("string"==typeof e){var i={};t.each(e.split(/\s/),function(){i[this]=!0}),e=i}return e},addMethod:function(e,i,s){t.validator.methods[e]=i,t.validator.messages[e]=void 0!==s?s:t.validator.messages[e],3>i.length&&t.validator.addClassRules(e,t.validator.normalizeRule(e))},methods:{required:function(e,i,s){if(!this.depend(s,i))return"dependency-mismatch";if("select"===i.nodeName.toLowerCase()){var r=t(i).val();return r&&r.length>0}return this.checkable(i)?this.getLength(e,i)>0:t.trim(e).length>0},email:function(t,e){return this.optional(e)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i.test(t)},url:function(t,e){return this.optional(e)||/^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(t)},date:function(t,e){return this.optional(e)||!/Invalid|NaN/.test(""+new Date(t))},dateISO:function(t,e){return this.optional(e)||/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/.test(t)},number:function(t,e){return this.optional(e)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(t)},digits:function(t,e){return this.optional(e)||/^\d+$/.test(t)},creditcard:function(t,e){if(this.optional(e))return"dependency-mismatch";if(/[^0-9 \-]+/.test(t))return!1;var i=0,s=0,r=!1;t=t.replace(/\D/g,"");for(var n=t.length-1;n>=0;n--){var a=t.charAt(n);s=parseInt(a,10),r&&(s*=2)>9&&(s-=9),i+=s,r=!r}return 0===i%10},minlength:function(e,i,s){var r=t.isArray(e)?e.length:this.getLength(t.trim(e),i);return this.optional(i)||r>=s},maxlength:function(e,i,s){var r=t.isArray(e)?e.length:this.getLength(t.trim(e),i);return this.optional(i)||s>=r},rangelength:function(e,i,s){var r=t.isArray(e)?e.length:this.getLength(t.trim(e),i);return this.optional(i)||r>=s[0]&&s[1]>=r}
12237,min:function(t,e,i){return this.optional(e)||t>=i},max:function(t,e,i){return this.optional(e)||i>=t},range:function(t,e,i){return this.optional(e)||t>=i[0]&&i[1]>=t},equalTo:function(e,i,s){var r=t(s);return this.settings.onfocusout&&r.unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){t(i).valid()}),e===r.val()},remote:function(e,i,s){if(this.optional(i))return"dependency-mismatch";var r=this.previousValue(i);if(this.settings.messages[i.name]||(this.settings.messages[i.name]={}),r.originalMessage=this.settings.messages[i.name].remote,this.settings.messages[i.name].remote=r.message,s="string"==typeof s&&{url:s}||s,r.old===e)return r.valid;r.old=e;var n=this;this.startRequest(i);var a={};return a[i.name]=e,t.ajax(t.extend(!0,{url:s,mode:"abort",port:"validate"+i.name,dataType:"json",data:a,success:function(s){n.settings.messages[i.name].remote=r.originalMessage;var a=s===!0||"true"===s;if(a){var u=n.formSubmitted;n.prepareElement(i),n.formSubmitted=u,n.successList.push(i),delete n.invalid[i.name],n.showErrors()}else{var o={},l=s||n.defaultMessage(i,"remote");o[i.name]=r.message=t.isFunction(l)?l(e):l,n.invalid[i.name]=!0,n.showErrors(o)}r.valid=a,n.stopRequest(i,a)}},s)),"pending"}}}),t.format=t.validator.format})(jQuery),function(t){var e={};if(t.ajaxPrefilter)t.ajaxPrefilter(function(t,i,s){var r=t.port;"abort"===t.mode&&(e[r]&&e[r].abort(),e[r]=s)});else{var i=t.ajax;t.ajax=function(s){var r=("mode"in s?s:t.ajaxSettings).mode,n=("port"in s?s:t.ajaxSettings).port;return"abort"===r?(e[n]&&e[n].abort(),e[n]=i.apply(this,arguments),e[n]):i.apply(this,arguments)}}}(jQuery),function(t){t.extend(t.fn,{validateDelegate:function(e,i,s){return this.bind(i,function(i){var r=t(i.target);return r.is(e)?s.apply(r,arguments):void 0})}})}(jQuery);; 12238/* NUGET: BEGIN LICENSE TEXT 12239 * 12240 * Microsoft grants you the right to use these script files for the sole 12241 * purpose of either: (i) interacting through your browser with the Microsoft 12242 * website or online service, subject to the applicable licensing or use 12243 * terms; or (ii) using the files as included with a Microsoft product subject 12244 * to that product's license terms. Microsoft reserves all other rights to the 12245 * files not expressly granted by Microsoft, whether by implication, estoppel 12246 * or otherwise. Insofar as a script file is dual licensed under GPL, 12247 * Microsoft neither took the code under GPL nor distributes it thereunder but 12248 * under the terms set out in this paragraph. All notices and licenses 12249 * below are for informational purposes only. 12250 * 12251 * NUGET: END LICENSE TEXT */ 12252/*! 12253** Unobtrusive validation support library for jQuery and jQuery Validate 12254** Copyright (C) Microsoft Corporation. All rights reserved. 12255*/ 12256 12257/*jslint white: true, browser: true, onevar: true, undef: true, nomen: true, eqeqeq: true, plusplus: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: false */ 12258/*global document: false, jQuery: false */ 12259 12260(function ($) { 12261 var $jQval = $.validator, 12262 adapters, 12263 data_validation = "unobtrusiveValidation"; 12264 12265 function setValidationValues(options, ruleName, value) { 12266 options.rules[ruleName] = value; 12267 if (options.message) { 12268 options.messages[ruleName] = options.message; 12269 } 12270 } 12271 12272 function splitAndTrim(value) { 12273 return value.replace(/^\s+|\s+$/g, "").split(/\s*,\s*/g); 12274 } 12275 12276 function escapeAttributeValue(value) { 12277 // As mentioned on http://api.jquery.com/category/selectors/ 12278 return value.replace(/([!"#$%&'()*+,./:;<=>?@\[\\\]^`{|}~])/g, "\\$1"); 12279 } 12280 12281 function getModelPrefix(fieldName) { 12282 return fieldName.substr(0, fieldName.lastIndexOf(".") + 1); 12283 } 12284 12285 function appendModelPrefix(value, prefix) { 12286 if (value.indexOf("*.") === 0) { 12287 value = value.replace("*.", prefix); 12288 } 12289 return value; 12290 } 12291 12292 function onError(error, inputElement) { // 'this' is the form element 12293 var container = $(this).find("[data-valmsg-for='" + escapeAttributeValue(inputElement[0].name) + "']"), 12294 replaceAttrValue = container.attr("data-valmsg-replace"), 12295 replace = replaceAttrValue ? $.parseJSON(replaceAttrValue) !== false : null; 12296 12297 container.removeClass("field-validation-valid").addClass("field-validation-error"); 12298 error.data("unobtrusiveContainer", container); 12299 12300 if (replace) { 12301 container.empty(); 12302 error.removeClass("input-validation-error").appendTo(container); 12303 } 12304 else { 12305 error.hide(); 12306 } 12307 } 12308 12309 function onErrors(event, validator) { // 'this' is the form element 12310 var container = $(this).find("[data-valmsg-summary=true]"), 12311 list = container.find("ul"); 12312 12313 if (list && list.length && validator.errorList.length) { 12314 list.empty();
vendor: 17,488 bytes, lines 12315-12675
12315 container.addClass("validation-summary-errors").removeClass("validation-summary-valid"); 12316 12317 $.each(validator.errorList, function () { 12318 $("<li />").html(this.message).appendTo(list); 12319 }); 12320 } 12321 } 12322 12323 function onSuccess(error) { // 'this' is the form element 12324 var container = error.data("unobtrusiveContainer"), 12325 replaceAttrValue = container.attr("data-valmsg-replace"), 12326 replace = replaceAttrValue ? $.parseJSON(replaceAttrValue) : null; 12327 12328 if (container) { 12329 container.addClass("field-validation-valid").removeClass("field-validation-error"); 12330 error.removeData("unobtrusiveContainer"); 12331 12332 if (replace) { 12333 container.empty(); 12334 } 12335 } 12336 } 12337 12338 function onReset(event) { // 'this' is the form element 12339 var $form = $(this); 12340 $form.data("validator").resetForm(); 12341 $form.find(".validation-summary-errors") 12342 .addClass("validation-summary-valid") 12343 .removeClass("validation-summary-errors"); 12344 $form.find(".field-validation-error") 12345 .addClass("field-validation-valid") 12346 .removeClass("field-validation-error") 12347 .removeData("unobtrusiveContainer") 12348 .find(">*") // If we were using valmsg-replace, get the underlying error 12349 .removeData("unobtrusiveContainer"); 12350 } 12351 12352 function validationInfo(form) { 12353 var $form = $(form), 12354 result = $form.data(data_validation), 12355 onResetProxy = $.proxy(onReset, form), 12356 defaultOptions = $jQval.unobtrusive.options || {}, 12357 execInContext = function (name, args) { 12358 var func = defaultOptions[name]; 12359 func && $.isFunction(func) && func.apply(form, args); 12360 } 12361 12362 if (!result) { 12363 result = { 12364 options: { // options structure passed to jQuery Validate's validate() method 12365 errorClass: defaultOptions.errorClass || "input-validation-error", 12366 errorElement: defaultOptions.errorElement || "span", 12367 errorPlacement: function () { 12368 onError.apply(form, arguments); 12369 execInContext("errorPlacement", arguments); 12370 }, 12371 invalidHandler: function () { 12372 onErrors.apply(form, arguments); 12373 execInContext("invalidHandler", arguments); 12374 }, 12375 messages: {}, 12376 rules: {}, 12377 success: function () { 12378 onSuccess.apply(form, arguments); 12379 execInContext("success", arguments); 12380 } 12381 }, 12382 attachValidation: function () { 12383 $form 12384 .off("reset." + data_validation, onResetProxy) 12385 .on("reset." + data_validation, onResetProxy) 12386 .validate(this.options); 12387 }, 12388 validate: function () { // a validation function that is called by unobtrusive Ajax 12389 $form.validate(); 12390 return $form.valid(); 12391 } 12392 }; 12393 $form.data(data_validation, result); 12394 } 12395 12396 return result; 12397 } 12398 12399 $jQval.unobtrusive = { 12400 adapters: [], 12401 12402 parseElement: function (element, skipAttach) { 12403 /// <summary> 12404 /// Parses a single HTML element for unobtrusive validation attributes. 12405 /// </summary> 12406 /// <param name="element" domElement="true">The HTML element to be parsed.</param> 12407 /// <param name="skipAttach" type="Boolean">[Optional] true to skip attaching the 12408 /// validation to the form. If parsing just this single element, you should specify true. 12409 /// If parsing several elements, you should specify false, and manually attach the validation 12410 /// to the form when you are finished. The default is false.</param> 12411 var $element = $(element), 12412 form = $element.parents("form")[0], 12413 valInfo, rules, messages; 12414 12415 if (!form) { // Cannot do client-side validation without a form 12416 return; 12417 } 12418 12419 valInfo = validationInfo(form); 12420 valInfo.options.rules[element.name] = rules = {}; 12421 valInfo.options.messages[element.name] = messages = {}; 12422 12423 $.each(this.adapters, function () { 12424 var prefix = "data-val-" + this.name, 12425 message = $element.attr(prefix), 12426 paramValues = {}; 12427 12428 if (message !== undefined) { // Compare against undefined, because an empty message is legal (and falsy) 12429 prefix += "-"; 12430 12431 $.each(this.params, function () { 12432 paramValues[this] = $element.attr(prefix + this); 12433 }); 12434 12435 this.adapt({ 12436 element: element, 12437 form: form, 12438 message: message, 12439 params: paramValues, 12440 rules: rules, 12441 messages: messages 12442 }); 12443 } 12444 }); 12445 12446 $.extend(rules, { "__dummy__": true }); 12447 12448 if (!skipAttach) { 12449 valInfo.attachValidation(); 12450 } 12451 }, 12452 12453 parse: function (selector) { 12454 /// <summary> 12455 /// Parses all the HTML elements in the specified selector. It looks for input elements decorated 12456 /// with the [data-val=true] attribute value and enables validation according to the data-val-* 12457 /// attribute values. 12458 /// </summary> 12459 /// <param name="selector" type="String">Any valid jQuery selector.</param> 12460 12461 // $forms includes all forms in selector's DOM hierarchy (parent, children and self) that have at least one 12462 // element with data-val=true 12463 var $selector = $(selector), 12464 $forms = $selector.parents() 12465 .addBack() 12466 .filter("form") 12467 .add($selector.find("form")) 12468 .has("[data-val=true]"); 12469 12470 $selector.find("[data-val=true]").each(function () { 12471 $jQval.unobtrusive.parseElement(this, true); 12472 }); 12473 12474 $forms.each(function () { 12475 var info = validationInfo(this); 12476 if (info) { 12477 info.attachValidation(); 12478 } 12479 }); 12480 } 12481 }; 12482 12483 adapters = $jQval.unobtrusive.adapters; 12484 12485 adapters.add = function (adapterName, params, fn) { 12486 /// <summary>Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation.</summary> 12487 /// <param name="adapterName" type="String">The name of the adapter to be added. This matches the name used 12488 /// in the data-val-nnnn HTML attribute (where nnnn is the adapter name).</param> 12489 /// <param name="params" type="Array" optional="true">[Optional] An array of parameter names (strings) that will 12490 /// be extracted from the data-val-nnnn-mmmm HTML attributes (where nnnn is the adapter name, and 12491 /// mmmm is the parameter name).</param> 12492 /// <param name="fn" type="Function">The function to call, which adapts the values from the HTML 12493 /// attributes into jQuery Validate rules and/or messages.</param> 12494 /// <returns type="jQuery.validator.unobtrusive.adapters" /> 12495 if (!fn) { // Called with no params, just a function 12496 fn = params; 12497 params = []; 12498 } 12499 this.push({ name: adapterName, params: params, adapt: fn }); 12500 return this; 12501 }; 12502 12503 adapters.addBool = function (adapterName, ruleName) { 12504 /// <summary>Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where 12505 /// the jQuery Validate validation rule has no parameter values.</summary> 12506 /// <param name="adapterName" type="String">The name of the adapter to be added. This matches the name used 12507 /// in the data-val-nnnn HTML attribute (where nnnn is the adapter name).</param> 12508 /// <param name="ruleName" type="String" optional="true">[Optional] The name of the jQuery Validate rule. If not provided, the value 12509 /// of adapterName will be used instead.</param> 12510 /// <returns type="jQuery.validator.unobtrusive.adapters" /> 12511 return this.add(adapterName, function (options) { 12512 setValidationValues(options, ruleName || adapterName, true); 12513 }); 12514 }; 12515 12516 adapters.addMinMax = function (adapterName, minRuleName, maxRuleName, minMaxRuleName, minAttribute, maxAttribute) { 12517 /// <summary>Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where 12518 /// the jQuery Validate validation has three potential rules (one for min-only, one for max-only, and 12519 /// one for min-and-max). The HTML parameters are expected to be named -min and -max.</summary> 12520 /// <param name="adapterName" type="String">The name of the adapter to be added. This matches the name used 12521 /// in the data-val-nnnn HTML attribute (where nnnn is the adapter name).</param> 12522 /// <param name="minRuleName" type="String">The name of the jQuery Validate rule to be used when you only 12523 /// have a minimum value.</param> 12524 /// <param name="maxRuleName" type="String">The name of the jQuery Validate rule to be used when you only 12525 /// have a maximum value.</param> 12526 /// <param name="minMaxRuleName" type="String">The name of the jQuery Validate rule to be used when you 12527 /// have both a minimum and maximum value.</param> 12528 /// <param name="minAttribute" type="String" optional="true">[Optional] The name of the HTML attribute that 12529 /// contains the minimum value. The default is "min".</param> 12530 /// <param name="maxAttribute" type="String" optional="true">[Optional] The name of the HTML attribute that 12531 /// contains the maximum value. The default is "max".</param> 12532 /// <returns type="jQuery.validator.unobtrusive.adapters" /> 12533 return this.add(adapterName, [minAttribute || "min", maxAttribute || "max"], function (options) { 12534 var min = options.params.min, 12535 max = options.params.max; 12536 12537 if (min && max) { 12538 setValidationValues(options, minMaxRuleName, [min, max]); 12539 } 12540 else if (min) { 12541 setValidationValues(options, minRuleName, min); 12542 } 12543 else if (max) { 12544 setValidationValues(options, maxRuleName, max); 12545 } 12546 }); 12547 }; 12548 12549 adapters.addSingleVal = function (adapterName, attribute, ruleName) { 12550 /// <summary>Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where 12551 /// the jQuery Validate validation rule has a single value.</summary> 12552 /// <param name="adapterName" type="String">The name of the adapter to be added. This matches the name used 12553 /// in the data-val-nnnn HTML attribute(where nnnn is the adapter name).</param> 12554 /// <param name="attribute" type="String">[Optional] The name of the HTML attribute that contains the value. 12555 /// The default is "val".</param> 12556 /// <param name="ruleName" type="String" optional="true">[Optional] The name of the jQuery Validate rule. If not provided, the value 12557 /// of adapterName will be used instead.</param> 12558 /// <returns type="jQuery.validator.unobtrusive.adapters" /> 12559 return this.add(adapterName, [attribute || "val"], function (options) { 12560 setValidationValues(options, ruleName || adapterName, options.params[attribute]); 12561 }); 12562 }; 12563 12564 $jQval.addMethod("__dummy__", function (value, element, params) { 12565 return true; 12566 }); 12567 12568 $jQval.addMethod("regex", function (value, element, params) { 12569 var match; 12570 if (this.optional(element)) { 12571 return true; 12572 } 12573 12574 match = new RegExp(params).exec(value); 12575 return (match && (match.index === 0) && (match[0].length === value.length)); 12576 }); 12577 12578 $jQval.addMethod("nonalphamin", function (value, element, nonalphamin) { 12579 var match; 12580 if (nonalphamin) { 12581 match = value.match(/\W/g); 12582 match = match && match.length >= nonalphamin; 12583 } 12584 return match; 12585 }); 12586 12587 if ($jQval.methods.extension) { 12588 adapters.addSingleVal("accept", "mimtype"); 12589 adapters.addSingleVal("extension", "extension"); 12590 } else { 12591 // for backward compatibility, when the 'extension' validation method does not exist, such as with versions 12592 // of JQuery Validation plugin prior to 1.10, we should use the 'accept' method for 12593 // validating the extension, and ignore mime-type validations as they are not supported. 12594 adapters.addSingleVal("extension", "extension", "accept"); 12595 } 12596 12597 adapters.addSingleVal("regex", "pattern"); 12598 adapters.addBool("creditcard").addBool("date").addBool("digits").addBool("email").addBool("number").addBool("url"); 12599 adapters.addMinMax("length", "minlength", "maxlength", "rangelength").addMinMax("range", "min", "max", "range"); 12600 adapters.addMinMax("minlength", "minlength").addMinMax("maxlength", "minlength", "maxlength"); 12601 adapters.add("equalto", ["other"], function (options) { 12602 var prefix = getModelPrefix(options.element.name), 12603 other = options.params.other, 12604 fullOtherName = appendModelPrefix(other, prefix), 12605 element = $(options.form).find(":input").filter("[name='" + escapeAttributeValue(fullOtherName) + "']")[0]; 12606 12607 setValidationValues(options, "equalTo", element); 12608 }); 12609 adapters.add("required", function (options) { 12610 // jQuery Validate equates "required" with "mandatory" for checkbox elements 12611 if (options.element.tagName.toUpperCase() !== "INPUT" || options.element.type.toUpperCase() !== "CHECKBOX") { 12612 setValidationValues(options, "required", true); 12613 } 12614 }); 12615 adapters.add("remote", ["url", "type", "additionalfields"], function (options) { 12616 var value = { 12617 url: options.params.url, 12618 type: options.params.type || "GET", 12619 data: {} 12620 }, 12621 prefix = getModelPrefix(options.element.name); 12622 12623 $.each(splitAndTrim(options.params.additionalfields || options.element.name), function (i, fieldName) { 12624 var paramName = appendModelPrefix(fieldName, prefix); 12625 value.data[paramName] = function () { 12626 return $(options.form).find(":input").filter("[name='" + escapeAttributeValue(paramName) + "']").val(); 12627 }; 12628 }); 12629 12630 setValidationValues(options, "remote", value); 12631 }); 12632 adapters.add("password", ["min", "nonalphamin", "regex"], function (options) { 12633 if (options.params.min) { 12634 setValidationValues(options, "minlength", options.params.min); 12635 } 12636 if (options.params.nonalphamin) { 12637 setValidationValues(options, "nonalphamin", options.params.nonalphamin); 12638 } 12639 if (options.params.regex) { 12640 setValidationValues(options, "regex", options.params.regex); 12641 } 12642 }); 12643 12644 $(function () { 12645 $jQval.unobtrusive.parse(document); 12646 }); 12647}(jQuery));; 12648/*! jQuery UI - v1.13.2 - 2022-07-14 12649* http://jqueryui.com 12650* Includes: widget.js, position.js, data.js, disable-selection.js, effect.js, effects/effect-blind.js, effects/effect-bounce.js, effects/effect-clip.js, effects/effect-drop.js, effects/effect-explode.js, effects/effect-fade.js, effects/effect-fold.js, effects/effect-highlight.js, effects/effect-puff.js, effects/effect-pulsate.js, effects/effect-scale.js, effects/effect-shake.js, effects/effect-size.js, effects/effect-slide.js, effects/effect-transfer.js, focusable.js, form-reset-mixin.js, jquery-patch.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/accordion.js, widgets/autocomplete.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/datepicker.js, widgets/dialog.js, widgets/draggable.js, widgets/droppable.js, widgets/menu.js, widgets/mouse.js, widgets/progressbar.js, widgets/resizable.js, widgets/selectable.js, widgets/selectmenu.js, widgets/slider.js, widgets/sortable.js, widgets/spinner.js, widgets/tabs.js, widgets/tooltip.js 12651* Copyright jQuery Foundation and other contributors; Licensed MIT */ 12652 12653(function (factory) { 12654 "use strict"; 12655 12656 if (typeof define === "function" && define.amd) { 12657 12658 // AMD. Register as an anonymous module. 12659 define(["jquery"], factory); 12660 } else { 12661 12662 // Browser globals 12663 factory(jQuery); 12664 } 12665})(function ($) { 12666 "use strict"; 12667 12668 $.ui = $.ui || {}; 12669 12670 var version = $.ui.version = "1.13.2"; 12671 12672 12673 /*! 12674 * jQuery UI Widget 1.13.2 12675 * http://jqueryui.com
vendor: 5,309 bytes, lines 12676-12846
12676 * 12677 * Copyright jQuery Foundation and other contributors 12678 * Released under the MIT license. 12679 * http://jquery.org/license 12680 */ 12681 12682 //>>label: Widget 12683 //>>group: Core 12684 //>>description: Provides a factory for creating stateful widgets with a common API. 12685 //>>docs: http://api.jqueryui.com/jQuery.widget/ 12686 //>>demos: http://jqueryui.com/widget/ 12687 12688 12689 var widgetUuid = 0; 12690 var widgetHasOwnProperty = Array.prototype.hasOwnProperty; 12691 var widgetSlice = Array.prototype.slice; 12692 12693 $.cleanData = (function (orig) { 12694 return function (elems) { 12695 var events, elem, i; 12696 for (i = 0; (elem = elems[i]) != null; i++) { 12697 12698 // Only trigger remove when necessary to save time 12699 events = $._data(elem, "events"); 12700 if (events && events.remove) { 12701 $(elem).triggerHandler("remove"); 12702 } 12703 } 12704 orig(elems); 12705 }; 12706 })($.cleanData); 12707 12708 $.widget = function (name, base, prototype) { 12709 var existingConstructor, constructor, basePrototype; 12710 12711 // ProxiedPrototype allows the provided prototype to remain unmodified 12712 // so that it can be used as a mixin for multiple widgets (#8876) 12713 var proxiedPrototype = {}; 12714 12715 var namespace = name.split(".")[0]; 12716 name = name.split(".")[1]; 12717 var fullName = namespace + "-" + name; 12718 12719 if (!prototype) { 12720 prototype = base; 12721 base = $.Widget; 12722 } 12723 12724 if (Array.isArray(prototype)) { 12725 prototype = $.extend.apply(null, [{}].concat(prototype)); 12726 } 12727 12728 // Create selector for plugin 12729 $.expr.pseudos[fullName.toLowerCase()] = function (elem) { 12730 return !!$.data(elem, fullName); 12731 }; 12732 12733 $[namespace] = $[namespace] || {}; 12734 existingConstructor = $[namespace][name]; 12735 constructor = $[namespace][name] = function (options, element) { 12736 12737 // Allow instantiation without "new" keyword 12738 if (!this || !this._createWidget) { 12739 return new constructor(options, element); 12740 } 12741 12742 // Allow instantiation without initializing for simple inheritance 12743 // must use "new" keyword (the code above always passes args) 12744 if (arguments.length) { 12745 this._createWidget(options, element); 12746 } 12747 }; 12748 12749 // Extend with the existing constructor to carry over any static properties 12750 $.extend(constructor, existingConstructor, { 12751 version: prototype.version, 12752 12753 // Copy the object used to create the prototype in case we need to 12754 // redefine the widget later 12755 _proto: $.extend({}, prototype), 12756 12757 // Track widgets that inherit from this widget in case this widget is 12758 // redefined after a widget inherits from it 12759 _childConstructors: [] 12760 }); 12761 12762 basePrototype = new base(); 12763 12764 // We need to make the options hash a property directly on the new instance 12765 // otherwise we'll modify the options hash on the prototype that we're 12766 // inheriting from 12767 basePrototype.options = $.widget.extend({}, basePrototype.options); 12768 $.each(prototype, function (prop, value) { 12769 if (typeof value !== "function") { 12770 proxiedPrototype[prop] = value; 12771 return; 12772 } 12773 proxiedPrototype[prop] = (function () { 12774 function _super() { 12775 return base.prototype[prop].apply(this, arguments); 12776 } 12777 12778 function _superApply(args) { 12779 return base.prototype[prop].apply(this, args); 12780 } 12781 12782 return function () { 12783 var __super = this._super; 12784 var __superApply = this._superApply; 12785 var returnValue; 12786 12787 this._super = _super; 12788 this._superApply = _superApply; 12789 12790 returnValue = value.apply(this, arguments); 12791 12792 this._super = __super; 12793 this._superApply = __superApply; 12794 12795 return returnValue; 12796 }; 12797 })(); 12798 }); 12799 constructor.prototype = $.widget.extend(basePrototype, { 12800 12801 // TODO: remove support for widgetEventPrefix 12802 // always use the name + a colon as the prefix, e.g., draggable:start 12803 // don't prefix for widgets that aren't DOM-based 12804 widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name 12805 }, proxiedPrototype, { 12806 constructor: constructor, 12807 namespace: namespace, 12808 widgetName: name, 12809 widgetFullName: fullName 12810 }); 12811 12812 // If this widget is being redefined then we need to find all widgets that 12813 // are inheriting from it and redefine all of them so that they inherit from 12814 // the new version of this widget. We're essentially trying to replace one 12815 // level in the prototype chain. 12816 if (existingConstructor) { 12817 $.each(existingConstructor._childConstructors, function (i, child) { 12818 var childPrototype = child.prototype; 12819 12820 // Redefine the child widget using the same prototype that was 12821 // originally used, but inherit from the new version of the base 12822 $.widget(childPrototype.namespace + "." + childPrototype.widgetName, constructor, 12823 child._proto); 12824 }); 12825 12826 // Remove the list of existing child constructors from the old constructor 12827 // so the old child constructors can be garbage collected 12828 delete existingConstructor._childConstructors; 12829 } else { 12830 base._childConstructors.push(constructor); 12831 } 12832 12833 $.widget.bridge(name, constructor); 12834 12835 return constructor; 12836 }; 12837 12838 $.widget.extend = function (target) { 12839 var input = widgetSlice.call(arguments, 1); 12840 var inputIndex = 0; 12841 var inputLength = input.length; 12842 var key; 12843 var value; 12844 12845 for (; inputIndex < inputLength; inputIndex++) { 12846 for (key in input[inputIndex]) {
vendor: 31,240 bytes, lines 12847-13914
12847 value = input[inputIndex][key]; 12848 if (widgetHasOwnProperty.call(input[inputIndex], key) && value !== undefined) { 12849 12850 // Clone objects 12851 if ($.isPlainObject(value)) { 12852 target[key] = $.isPlainObject(target[key]) ? 12853 $.widget.extend({}, target[key], value) : 12854 12855 // Don't extend strings, arrays, etc. with objects 12856 $.widget.extend({}, value); 12857 12858 // Copy everything else by reference 12859 } else { 12860 target[key] = value; 12861 } 12862 } 12863 } 12864 } 12865 return target; 12866 }; 12867 12868 $.widget.bridge = function (name, object) { 12869 var fullName = object.prototype.widgetFullName || name; 12870 $.fn[name] = function (options) { 12871 var isMethodCall = typeof options === "string"; 12872 var args = widgetSlice.call(arguments, 1); 12873 var returnValue = this; 12874 12875 if (isMethodCall) { 12876 12877 // If this is an empty collection, we need to have the instance method 12878 // return undefined instead of the jQuery instance 12879 if (!this.length && options === "instance") { 12880 returnValue = undefined; 12881 } else { 12882 this.each(function () { 12883 var methodValue; 12884 var instance = $.data(this, fullName); 12885 12886 if (options === "instance") { 12887 returnValue = instance; 12888 return false; 12889 } 12890 12891 if (!instance) { 12892 return $.error("cannot call methods on " + name + 12893 " prior to initialization; " + 12894 "attempted to call method '" + options + "'"); 12895 } 12896 12897 if (typeof instance[options] !== "function" || 12898 options.charAt(0) === "_") { 12899 return $.error("no such method '" + options + "' for " + name + 12900 " widget instance"); 12901 } 12902 12903 methodValue = instance[options].apply(instance, args); 12904 12905 if (methodValue !== instance && methodValue !== undefined) { 12906 returnValue = methodValue && methodValue.jquery ? 12907 returnValue.pushStack(methodValue.get()) : 12908 methodValue; 12909 return false; 12910 } 12911 }); 12912 } 12913 } else { 12914 12915 // Allow multiple hashes to be passed on init 12916 if (args.length) { 12917 options = $.widget.extend.apply(null, [options].concat(args)); 12918 } 12919 12920 this.each(function () { 12921 var instance = $.data(this, fullName); 12922 if (instance) { 12923 instance.option(options || {}); 12924 if (instance._init) { 12925 instance._init(); 12926 } 12927 } else { 12928 $.data(this, fullName, new object(options, this)); 12929 } 12930 }); 12931 } 12932 12933 return returnValue; 12934 }; 12935 }; 12936 12937 $.Widget = function ( /* options, element */) { }; 12938 $.Widget._childConstructors = []; 12939 12940 $.Widget.prototype = { 12941 widgetName: "widget", 12942 widgetEventPrefix: "", 12943 defaultElement: "<div>", 12944 12945 options: { 12946 classes: {}, 12947 disabled: false, 12948 12949 // Callbacks 12950 create: null 12951 }, 12952 12953 _createWidget: function (options, element) { 12954 element = $(element || this.defaultElement || this)[0]; 12955 this.element = $(element); 12956 this.uuid = widgetUuid++; 12957 this.eventNamespace = "." + this.widgetName + this.uuid; 12958 12959 this.bindings = $(); 12960 this.hoverable = $(); 12961 this.focusable = $(); 12962 this.classesElementLookup = {}; 12963 12964 if (element !== this) { 12965 $.data(element, this.widgetFullName, this); 12966 this._on(true, this.element, { 12967 remove: function (event) { 12968 if (event.target === element) { 12969 this.destroy(); 12970 } 12971 } 12972 }); 12973 this.document = $(element.style ? 12974 12975 // Element within the document 12976 element.ownerDocument : 12977 12978 // Element is window or document 12979 element.document || element); 12980 this.window = $(this.document[0].defaultView || this.document[0].parentWindow); 12981 } 12982 12983 this.options = $.widget.extend({}, 12984 this.options, 12985 this._getCreateOptions(), 12986 options); 12987 12988 this._create(); 12989 12990 if (this.options.disabled) { 12991 this._setOptionDisabled(this.options.disabled); 12992 } 12993 12994 this._trigger("create", null, this._getCreateEventData()); 12995 this._init(); 12996 }, 12997 12998 _getCreateOptions: function () { 12999 return {}; 13000 }, 13001 13002 _getCreateEventData: $.noop, 13003 13004 _create: $.noop, 13005 13006 _init: $.noop, 13007 13008 destroy: function () { 13009 var that = this; 13010 13011 this._destroy(); 13012 $.each(this.classesElementLookup, function (key, value) { 13013 that._removeClass(value, key); 13014 }); 13015 13016 // We can probably remove the unbind calls in 2.0 13017 // all event bindings should go through this._on() 13018 this.element 13019 .off(this.eventNamespace) 13020 .removeData(this.widgetFullName); 13021 this.widget() 13022 .off(this.eventNamespace) 13023 .removeAttr("aria-disabled"); 13024 13025 // Clean up events and states 13026 this.bindings.off(this.eventNamespace); 13027 }, 13028 13029 _destroy: $.noop, 13030 13031 widget: function () { 13032 return this.element; 13033 }, 13034 13035 option: function (key, value) { 13036 var options = key; 13037 var parts; 13038 var curOption; 13039 var i; 13040 13041 if (arguments.length === 0) { 13042 13043 // Don't return a reference to the internal hash 13044 return $.widget.extend({}, this.options); 13045 } 13046 13047 if (typeof key === "string") { 13048 13049 // Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } } 13050 options = {}; 13051 parts = key.split("."); 13052 key = parts.shift(); 13053 if (parts.length) { 13054 curOption = options[key] = $.widget.extend({}, this.options[key]); 13055 for (i = 0; i < parts.length - 1; i++) { 13056 curOption[parts[i]] = curOption[parts[i]] || {}; 13057 curOption = curOption[parts[i]]; 13058 } 13059 key = parts.pop(); 13060 if (arguments.length === 1) { 13061 return curOption[key] === undefined ? null : curOption[key]; 13062 } 13063 curOption[key] = value; 13064 } else { 13065 if (arguments.length === 1) { 13066 return this.options[key] === undefined ? null : this.options[key]; 13067 } 13068 options[key] = value; 13069 } 13070 } 13071 13072 this._setOptions(options); 13073 13074 return this; 13075 }, 13076 13077 _setOptions: function (options) { 13078 var key; 13079 13080 for (key in options) { 13081 this._setOption(key, options[key]); 13082 } 13083 13084 return this; 13085 }, 13086 13087 _setOption: function (key, value) { 13088 if (key === "classes") { 13089 this._setOptionClasses(value); 13090 } 13091 13092 this.options[key] = value; 13093 13094 if (key === "disabled") { 13095 this._setOptionDisabled(value); 13096 } 13097 13098 return this; 13099 }, 13100 13101 _setOptionClasses: function (value) { 13102 var classKey, elements, currentElements; 13103 13104 for (classKey in value) { 13105 currentElements = this.classesElementLookup[classKey]; 13106 if (value[classKey] === this.options.classes[classKey] || 13107 !currentElements || 13108 !currentElements.length) { 13109 continue; 13110 } 13111 13112 // We are doing this to create a new jQuery object because the _removeClass() call 13113 // on the next line is going to destroy the reference to the current elements being 13114 // tracked. We need to save a copy of this collection so that we can add the new classes 13115 // below. 13116 elements = $(currentElements.get()); 13117 this._removeClass(currentElements, classKey); 13118 13119 // We don't use _addClass() here, because that uses this.options.classes 13120 // for generating the string of classes. We want to use the value passed in from 13121 // _setOption(), this is the new value of the classes option which was passed to 13122 // _setOption(). We pass this value directly to _classes(). 13123 elements.addClass(this._classes({ 13124 element: elements, 13125 keys: classKey, 13126 classes: value, 13127 add: true 13128 })); 13129 } 13130 }, 13131 13132 _setOptionDisabled: function (value) { 13133 this._toggleClass(this.widget(), this.widgetFullName + "-disabled", null, !!value); 13134 13135 // If the widget is becoming disabled, then nothing is interactive 13136 if (value) { 13137 this._removeClass(this.hoverable, null, "ui-state-hover"); 13138 this._removeClass(this.focusable, null, "ui-state-focus"); 13139 } 13140 }, 13141 13142 enable: function () { 13143 return this._setOptions({ disabled: false }); 13144 }, 13145 13146 disable: function () { 13147 return this._setOptions({ disabled: true }); 13148 }, 13149 13150 _classes: function (options) { 13151 var full = []; 13152 var that = this; 13153 13154 options = $.extend({ 13155 element: this.element, 13156 classes: this.options.classes || {} 13157 }, options); 13158 13159 function bindRemoveEvent() { 13160 var nodesToBind = []; 13161 13162 options.element.each(function (_, element) { 13163 var isTracked = $.map(that.classesElementLookup, function (elements) { 13164 return elements; 13165 }) 13166 .some(function (elements) { 13167 return elements.is(element); 13168 }); 13169 13170 if (!isTracked) { 13171 nodesToBind.push(element); 13172 } 13173 }); 13174 13175 that._on($(nodesToBind), { 13176 remove: "_untrackClassesElement" 13177 }); 13178 } 13179 13180 function processClassString(classes, checkOption) { 13181 var current, i; 13182 for (i = 0; i < classes.length; i++) { 13183 current = that.classesElementLookup[classes[i]] || $(); 13184 if (options.add) { 13185 bindRemoveEvent(); 13186 current = $($.uniqueSort(current.get().concat(options.element.get()))); 13187 } else { 13188 current = $(current.not(options.element).get()); 13189 } 13190 that.classesElementLookup[classes[i]] = current; 13191 full.push(classes[i]); 13192 if (checkOption && options.classes[classes[i]]) { 13193 full.push(options.classes[classes[i]]); 13194 } 13195 } 13196 } 13197 13198 if (options.keys) { 13199 processClassString(options.keys.match(/\S+/g) || [], true); 13200 } 13201 if (options.extra) { 13202 processClassString(options.extra.match(/\S+/g) || []); 13203 } 13204 13205 return full.join(" "); 13206 }, 13207 13208 _untrackClassesElement: function (event) { 13209 var that = this; 13210 $.each(that.classesElementLookup, function (key, value) { 13211 if ($.inArray(event.target, value) !== -1) { 13212 that.classesElementLookup[key] = $(value.not(event.target).get()); 13213 } 13214 }); 13215 13216 this._off($(event.target)); 13217 }, 13218 13219 _removeClass: function (element, keys, extra) { 13220 return this._toggleClass(element, keys, extra, false); 13221 }, 13222 13223 _addClass: function (element, keys, extra) { 13224 return this._toggleClass(element, keys, extra, true); 13225 }, 13226 13227 _toggleClass: function (element, keys, extra, add) { 13228 add = (typeof add === "boolean") ? add : extra; 13229 var shift = (typeof element === "string" || element === null), 13230 options = { 13231 extra: shift ? keys : extra, 13232 keys: shift ? element : keys, 13233 element: shift ? this.element : element, 13234 add: add 13235 }; 13236 options.element.toggleClass(this._classes(options), add); 13237 return this; 13238 }, 13239 13240 _on: function (suppressDisabledCheck, element, handlers) { 13241 var delegateElement; 13242 var instance = this; 13243 13244 // No suppressDisabledCheck flag, shuffle arguments 13245 if (typeof suppressDisabledCheck !== "boolean") { 13246 handlers = element; 13247 element = suppressDisabledCheck; 13248 suppressDisabledCheck = false; 13249 } 13250 13251 // No element argument, shuffle and use this.element 13252 if (!handlers) { 13253 handlers = element; 13254 element = this.element; 13255 delegateElement = this.widget(); 13256 } else { 13257 element = delegateElement = $(element); 13258 this.bindings = this.bindings.add(element); 13259 } 13260 13261 $.each(handlers, function (event, handler) { 13262 function handlerProxy() { 13263 13264 // Allow widgets to customize the disabled handling 13265 // - disabled as an array instead of boolean 13266 // - disabled class as method for disabling individual parts 13267 if (!suppressDisabledCheck && 13268 (instance.options.disabled === true || 13269 $(this).hasClass("ui-state-disabled"))) { 13270 return; 13271 } 13272 return (typeof handler === "string" ? instance[handler] : handler) 13273 .apply(instance, arguments); 13274 } 13275 13276 // Copy the guid so direct unbinding works 13277 if (typeof handler !== "string") { 13278 handlerProxy.guid = handler.guid = 13279 handler.guid || handlerProxy.guid || $.guid++; 13280 } 13281 13282 var match = event.match(/^([\w:-]*)\s*(.*)$/); 13283 var eventName = match[1] + instance.eventNamespace; 13284 var selector = match[2]; 13285 13286 if (selector) { 13287 delegateElement.on(eventName, selector, handlerProxy); 13288 } else { 13289 element.on(eventName, handlerProxy); 13290 } 13291 }); 13292 }, 13293 13294 _off: function (element, eventName) { 13295 eventName = (eventName || "").split(" ").join(this.eventNamespace + " ") + 13296 this.eventNamespace; 13297 element.off(eventName); 13298 13299 // Clear the stack to avoid memory leaks (#10056) 13300 this.bindings = $(this.bindings.not(element).get()); 13301 this.focusable = $(this.focusable.not(element).get()); 13302 this.hoverable = $(this.hoverable.not(element).get()); 13303 }, 13304 13305 _delay: function (handler, delay) { 13306 function handlerProxy() { 13307 return (typeof handler === "string" ? instance[handler] : handler) 13308 .apply(instance, arguments); 13309 } 13310 var instance = this; 13311 return setTimeout(handlerProxy, delay || 0); 13312 }, 13313 13314 _hoverable: function (element) { 13315 this.hoverable = this.hoverable.add(element); 13316 this._on(element, { 13317 mouseenter: function (event) { 13318 this._addClass($(event.currentTarget), null, "ui-state-hover"); 13319 }, 13320 mouseleave: function (event) { 13321 this._removeClass($(event.currentTarget), null, "ui-state-hover"); 13322 } 13323 }); 13324 }, 13325 13326 _focusable: function (element) { 13327 this.focusable = this.focusable.add(element); 13328 this._on(element, { 13329 focusin: function (event) { 13330 this._addClass($(event.currentTarget), null, "ui-state-focus"); 13331 }, 13332 focusout: function (event) { 13333 this._removeClass($(event.currentTarget), null, "ui-state-focus"); 13334 } 13335 }); 13336 }, 13337 13338 _trigger: function (type, event, data) { 13339 var prop, orig; 13340 var callback = this.options[type]; 13341 13342 data = data || {}; 13343 event = $.Event(event); 13344 event.type = (type === this.widgetEventPrefix ? 13345 type : 13346 this.widgetEventPrefix + type).toLowerCase(); 13347 13348 // The original event may come from any element 13349 // so we need to reset the target on the new event 13350 event.target = this.element[0]; 13351 13352 // Copy original event properties over to the new event 13353 orig = event.originalEvent; 13354 if (orig) { 13355 for (prop in orig) { 13356 if (!(prop in event)) { 13357 event[prop] = orig[prop]; 13358 } 13359 } 13360 } 13361 13362 this.element.trigger(event, data); 13363 return !(typeof callback === "function" && 13364 callback.apply(this.element[0], [event].concat(data)) === false || 13365 event.isDefaultPrevented()); 13366 } 13367 }; 13368 13369 $.each({ show: "fadeIn", hide: "fadeOut" }, function (method, defaultEffect) { 13370 $.Widget.prototype["_" + method] = function (element, options, callback) { 13371 if (typeof options === "string") { 13372 options = { effect: options }; 13373 } 13374 13375 var hasOptions; 13376 var effectName = !options ? 13377 method : 13378 options === true || typeof options === "number" ? 13379 defaultEffect : 13380 options.effect || defaultEffect; 13381 13382 options = options || {}; 13383 if (typeof options === "number") { 13384 options = { duration: options }; 13385 } else if (options === true) { 13386 options = {}; 13387 } 13388 13389 hasOptions = !$.isEmptyObject(options); 13390 options.complete = callback; 13391 13392 if (options.delay) { 13393 element.delay(options.delay); 13394 } 13395 13396 if (hasOptions && $.effects && $.effects.effect[effectName]) { 13397 element[method](options); 13398 } else if (effectName !== method && element[effectName]) { 13399 element[effectName](options.duration, options.easing, callback); 13400 } else { 13401 element.queue(function (next) { 13402 $(this)[method](); 13403 if (callback) { 13404 callback.call(element[0]); 13405 } 13406 next(); 13407 }); 13408 } 13409 }; 13410 }); 13411 13412 var widget = $.widget; 13413 13414 13415 /*! 13416 * jQuery UI Position 1.13.2 13417 * http://jqueryui.com 13418 * 13419 * Copyright jQuery Foundation and other contributors 13420 * Released under the MIT license. 13421 * http://jquery.org/license 13422 * 13423 * http://api.jqueryui.com/position/ 13424 */ 13425 13426 //>>label: Position 13427 //>>group: Core 13428 //>>description: Positions elements relative to other elements. 13429 //>>docs: http://api.jqueryui.com/position/ 13430 //>>demos: http://jqueryui.com/position/ 13431 13432 13433 (function () { 13434 var cachedScrollbarWidth, 13435 max = Math.max, 13436 abs = Math.abs, 13437 rhorizontal = /left|center|right/, 13438 rvertical = /top|center|bottom/, 13439 roffset = /[\+\-]\d+(\.[\d]+)?%?/, 13440 rposition = /^\w+/, 13441 rpercent = /%$/, 13442 _position = $.fn.position; 13443 13444 function getOffsets(offsets, width, height) { 13445 return [ 13446 parseFloat(offsets[0]) * (rpercent.test(offsets[0]) ? width / 100 : 1), 13447 parseFloat(offsets[1]) * (rpercent.test(offsets[1]) ? height / 100 : 1) 13448 ]; 13449 } 13450 13451 function parseCss(element, property) { 13452 return parseInt($.css(element, property), 10) || 0; 13453 } 13454 13455 function isWindow(obj) { 13456 return obj != null && obj === obj.window; 13457 } 13458 13459 function getDimensions(elem) { 13460 var raw = elem[0]; 13461 if (raw.nodeType === 9) { 13462 return { 13463 width: elem.width(), 13464 height: elem.height(), 13465 offset: { top: 0, left: 0 } 13466 }; 13467 } 13468 if (isWindow(raw)) { 13469 return { 13470 width: elem.width(), 13471 height: elem.height(), 13472 offset: { top: elem.scrollTop(), left: elem.scrollLeft() } 13473 }; 13474 } 13475 if (raw.preventDefault) { 13476 return { 13477 width: 0, 13478 height: 0, 13479 offset: { top: raw.pageY, left: raw.pageX } 13480 }; 13481 } 13482 return { 13483 width: elem.outerWidth(), 13484 height: elem.outerHeight(), 13485 offset: elem.offset() 13486 }; 13487 } 13488 13489 $.position = { 13490 scrollbarWidth: function () { 13491 if (cachedScrollbarWidth !== undefined) { 13492 return cachedScrollbarWidth; 13493 } 13494 var w1, w2, 13495 div = $("<div style=" + 13496 "'display:block;position:absolute;width:200px;height:200px;overflow:hidden;'>" + 13497 "<div style='height:300px;width:auto;'></div></div>"), 13498 innerDiv = div.children()[0]; 13499 13500 $("body").append(div); 13501 w1 = innerDiv.offsetWidth; 13502 div.css("overflow", "scroll"); 13503 13504 w2 = innerDiv.offsetWidth; 13505 13506 if (w1 === w2) { 13507 w2 = div[0].clientWidth; 13508 } 13509 13510 div.remove(); 13511 13512 return (cachedScrollbarWidth = w1 - w2); 13513 }, 13514 getScrollInfo: function (within) { 13515 var overflowX = within.isWindow || within.isDocument ? "" : 13516 within.element.css("overflow-x"), 13517 overflowY = within.isWindow || within.isDocument ? "" : 13518 within.element.css("overflow-y"), 13519 hasOverflowX = overflowX === "scroll" || 13520 (overflowX === "auto" && within.width < within.element[0].scrollWidth), 13521 hasOverflowY = overflowY === "scroll" || 13522 (overflowY === "auto" && within.height < within.element[0].scrollHeight); 13523 return { 13524 width: hasOverflowY ? $.position.scrollbarWidth() : 0, 13525 height: hasOverflowX ? $.position.scrollbarWidth() : 0 13526 }; 13527 }, 13528 getWithinInfo: function (element) { 13529 var withinElement = $(element || window), 13530 isElemWindow = isWindow(withinElement[0]), 13531 isDocument = !!withinElement[0] && withinElement[0].nodeType === 9, 13532 hasOffset = !isElemWindow && !isDocument; 13533 return { 13534 element: withinElement, 13535 isWindow: isElemWindow, 13536 isDocument: isDocument, 13537 offset: hasOffset ? $(element).offset() : { left: 0, top: 0 }, 13538 scrollLeft: withinElement.scrollLeft(), 13539 scrollTop: withinElement.scrollTop(), 13540 width: withinElement.outerWidth(), 13541 height: withinElement.outerHeight() 13542 }; 13543 } 13544 }; 13545 13546 $.fn.position = function (options) { 13547 if (!options || !options.of) { 13548 return _position.apply(this, arguments); 13549 } 13550 13551 // Make a copy, we don't want to modify arguments 13552 options = $.extend({}, options); 13553 13554 var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions, 13555 13556 // Make sure string options are treated as CSS selectors 13557 target = typeof options.of === "string" ? 13558 $(document).find(options.of) : 13559 $(options.of), 13560 13561 within = $.position.getWithinInfo(options.within), 13562 scrollInfo = $.position.getScrollInfo(within), 13563 collision = (options.collision || "flip").split(" "), 13564 offsets = {}; 13565 13566 dimensions = getDimensions(target); 13567 if (target[0].preventDefault) { 13568 13569 // Force left top to allow flipping 13570 options.at = "left top"; 13571 } 13572 targetWidth = dimensions.width; 13573 targetHeight = dimensions.height; 13574 targetOffset = dimensions.offset; 13575 13576 // Clone to reuse original targetOffset later 13577 basePosition = $.extend({}, targetOffset); 13578 13579 // Force my and at to have valid horizontal and vertical positions 13580 // if a value is missing or invalid, it will be converted to center 13581 $.each(["my", "at"], function () { 13582 var pos = (options[this] || "").split(" "), 13583 horizontalOffset, 13584 verticalOffset; 13585 13586 if (pos.length === 1) { 13587 pos = rhorizontal.test(pos[0]) ? 13588 pos.concat(["center"]) : 13589 rvertical.test(pos[0]) ? 13590 ["center"].concat(pos) : 13591 ["center", "center"]; 13592 } 13593 pos[0] = rhorizontal.test(pos[0]) ? pos[0] : "center"; 13594 pos[1] = rvertical.test(pos[1]) ? pos[1] : "center"; 13595 13596 // Calculate offsets 13597 horizontalOffset = roffset.exec(pos[0]); 13598 verticalOffset = roffset.exec(pos[1]); 13599 offsets[this] = [ 13600 horizontalOffset ? horizontalOffset[0] : 0, 13601 verticalOffset ? verticalOffset[0] : 0 13602 ]; 13603 13604 // Reduce to just the positions without the offsets 13605 options[this] = [ 13606 rposition.exec(pos[0])[0], 13607 rposition.exec(pos[1])[0] 13608 ]; 13609 }); 13610 13611 // Normalize collision option 13612 if (collision.length === 1) { 13613 collision[1] = collision[0]; 13614 } 13615 13616 if (options.at[0] === "right") { 13617 basePosition.left += targetWidth; 13618 } else if (options.at[0] === "center") { 13619 basePosition.left += targetWidth / 2; 13620 } 13621 13622 if (options.at[1] === "bottom") { 13623 basePosition.top += targetHeight; 13624 } else if (options.at[1] === "center") { 13625 basePosition.top += targetHeight / 2; 13626 } 13627 13628 atOffset = getOffsets(offsets.at, targetWidth, targetHeight); 13629 basePosition.left += atOffset[0]; 13630 basePosition.top += atOffset[1]; 13631 13632 return this.each(function () { 13633 var collisionPosition, using, 13634 elem = $(this), 13635 elemWidth = elem.outerWidth(), 13636 elemHeight = elem.outerHeight(), 13637 marginLeft = parseCss(this, "marginLeft"), 13638 marginTop = parseCss(this, "marginTop"), 13639 collisionWidth = elemWidth + marginLeft + parseCss(this, "marginRight") + 13640 scrollInfo.width, 13641 collisionHeight = elemHeight + marginTop + parseCss(this, "marginBottom") + 13642 scrollInfo.height, 13643 position = $.extend({}, basePosition), 13644 myOffset = getOffsets(offsets.my, elem.outerWidth(), elem.outerHeight()); 13645 13646 if (options.my[0] === "right") { 13647 position.left -= elemWidth; 13648 } else if (options.my[0] === "center") { 13649 position.left -= elemWidth / 2; 13650 } 13651 13652 if (options.my[1] === "bottom") { 13653 position.top -= elemHeight; 13654 } else if (options.my[1] === "center") { 13655 position.top -= elemHeight / 2; 13656 } 13657 13658 position.left += myOffset[0]; 13659 position.top += myOffset[1]; 13660 13661 collisionPosition = { 13662 marginLeft: marginLeft, 13663 marginTop: marginTop 13664 }; 13665 13666 $.each(["left", "top"], function (i, dir) { 13667 if ($.ui.position[collision[i]]) { 13668 $.ui.position[collision[i]][dir](position, { 13669 targetWidth: targetWidth, 13670 targetHeight: targetHeight, 13671 elemWidth: elemWidth, 13672 elemHeight: elemHeight, 13673 collisionPosition: collisionPosition, 13674 collisionWidth: collisionWidth, 13675 collisionHeight: collisionHeight, 13676 offset: [atOffset[0] + myOffset[0], atOffset[1] + myOffset[1]], 13677 my: options.my, 13678 at: options.at, 13679 within: within, 13680 elem: elem 13681 }); 13682 } 13683 }); 13684 13685 if (options.using) { 13686 13687 // Adds feedback as second argument to using callback, if present 13688 using = function (props) { 13689 var left = targetOffset.left - position.left, 13690 right = left + targetWidth - elemWidth, 13691 top = targetOffset.top - position.top, 13692 bottom = top + targetHeight - elemHeight, 13693 feedback = { 13694 target: { 13695 element: target, 13696 left: targetOffset.left, 13697 top: targetOffset.top, 13698 width: targetWidth, 13699 height: targetHeight 13700 }, 13701 element: { 13702 element: elem, 13703 left: position.left, 13704 top: position.top, 13705 width: elemWidth, 13706 height: elemHeight 13707 }, 13708 horizontal: right < 0 ? "left" : left > 0 ? "right" : "center", 13709 vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle" 13710 }; 13711 if (targetWidth < elemWidth && abs(left + right) < targetWidth) { 13712 feedback.horizontal = "center"; 13713 } 13714 if (targetHeight < elemHeight && abs(top + bottom) < targetHeight) { 13715 feedback.vertical = "middle"; 13716 } 13717 if (max(abs(left), abs(right)) > max(abs(top), abs(bottom))) { 13718 feedback.important = "horizontal"; 13719 } else { 13720 feedback.important = "vertical"; 13721 } 13722 options.using.call(this, props, feedback); 13723 }; 13724 } 13725 13726 elem.offset($.extend(position, { using: using })); 13727 }); 13728 }; 13729 13730 $.ui.position = { 13731 fit: { 13732 left: function (position, data) { 13733 var within = data.within, 13734 withinOffset = within.isWindow ? within.scrollLeft : within.offset.left, 13735 outerWidth = within.width, 13736 collisionPosLeft = position.left - data.collisionPosition.marginLeft, 13737 overLeft = withinOffset - collisionPosLeft, 13738 overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset, 13739 newOverRight; 13740 13741 // Element is wider than within 13742 if (data.collisionWidth > outerWidth) { 13743 13744 // Element is initially over the left side of within 13745 if (overLeft > 0 && overRight <= 0) { 13746 newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - 13747 withinOffset; 13748 position.left += overLeft - newOverRight; 13749 13750 // Element is initially over right side of within 13751 } else if (overRight > 0 && overLeft <= 0) { 13752 position.left = withinOffset; 13753 13754 // Element is initially over both left and right sides of within 13755 } else { 13756 if (overLeft > overRight) { 13757 position.left = withinOffset + outerWidth - data.collisionWidth; 13758 } else { 13759 position.left = withinOffset; 13760 } 13761 } 13762 13763 // Too far left -> align with left edge 13764 } else if (overLeft > 0) { 13765 position.left += overLeft; 13766 13767 // Too far right -> align with right edge 13768 } else if (overRight > 0) { 13769 position.left -= overRight; 13770 13771 // Adjust based on position and margin 13772 } else { 13773 position.left = max(position.left - collisionPosLeft, position.left); 13774 } 13775 }, 13776 top: function (position, data) { 13777 var within = data.within, 13778 withinOffset = within.isWindow ? within.scrollTop : within.offset.top, 13779 outerHeight = data.within.height, 13780 collisionPosTop = position.top - data.collisionPosition.marginTop, 13781 overTop = withinOffset - collisionPosTop, 13782 overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset, 13783 newOverBottom; 13784 13785 // Element is taller than within 13786 if (data.collisionHeight > outerHeight) { 13787 13788 // Element is initially over the top of within 13789 if (overTop > 0 && overBottom <= 0) { 13790 newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - 13791 withinOffset; 13792 position.top += overTop - newOverBottom; 13793 13794 // Element is initially over bottom of within 13795 } else if (overBottom > 0 && overTop <= 0) { 13796 position.top = withinOffset; 13797 13798 // Element is initially over both top and bottom of within 13799 } else { 13800 if (overTop > overBottom) { 13801 position.top = withinOffset + outerHeight - data.collisionHeight; 13802 } else { 13803 position.top = withinOffset; 13804 } 13805 } 13806 13807 // Too far up -> align with top 13808 } else if (overTop > 0) { 13809 position.top += overTop; 13810 13811 // Too far down -> align with bottom edge 13812 } else if (overBottom > 0) { 13813 position.top -= overBottom; 13814 13815 // Adjust based on position and margin 13816 } else { 13817 position.top = max(position.top - collisionPosTop, position.top); 13818 } 13819 } 13820 }, 13821 flip: { 13822 left: function (position, data) { 13823 var within = data.within, 13824 withinOffset = within.offset.left + within.scrollLeft, 13825 outerWidth = within.width, 13826 offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left, 13827 collisionPosLeft = position.left - data.collisionPosition.marginLeft, 13828 overLeft = collisionPosLeft - offsetLeft, 13829 overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft, 13830 myOffset = data.my[0] === "left" ? 13831 -data.elemWidth : 13832 data.my[0] === "right" ? 13833 data.elemWidth : 13834 0, 13835 atOffset = data.at[0] === "left" ? 13836 data.targetWidth : 13837 data.at[0] === "right" ? 13838 -data.targetWidth : 13839 0, 13840 offset = -2 * data.offset[0], 13841 newOverRight, 13842 newOverLeft; 13843 13844 if (overLeft < 0) { 13845 newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - 13846 outerWidth - withinOffset; 13847 if (newOverRight < 0 || newOverRight < abs(overLeft)) { 13848 position.left += myOffset + atOffset + offset; 13849 } 13850 } else if (overRight > 0) { 13851 newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + 13852 atOffset + offset - offsetLeft; 13853 if (newOverLeft > 0 || abs(newOverLeft) < overRight) { 13854 position.left += myOffset + atOffset + offset; 13855 } 13856 } 13857 }, 13858 top: function (position, data) { 13859 var within = data.within, 13860 withinOffset = within.offset.top + within.scrollTop, 13861 outerHeight = within.height, 13862 offsetTop = within.isWindow ? within.scrollTop : within.offset.top, 13863 collisionPosTop = position.top - data.collisionPosition.marginTop, 13864 overTop = collisionPosTop - offsetTop, 13865 overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop, 13866 top = data.my[1] === "top", 13867 myOffset = top ? 13868 -data.elemHeight : 13869 data.my[1] === "bottom" ? 13870 data.elemHeight : 13871 0, 13872 atOffset = data.at[1] === "top" ? 13873 data.targetHeight : 13874 data.at[1] === "bottom" ? 13875 -data.targetHeight : 13876 0, 13877 offset = -2 * data.offset[1], 13878 newOverTop, 13879 newOverBottom; 13880 if (overTop < 0) { 13881 newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - 13882 outerHeight - withinOffset; 13883 if (newOverBottom < 0 || newOverBottom < abs(overTop)) { 13884 position.top += myOffset + atOffset + offset; 13885 } 13886 } else if (overBottom > 0) { 13887 newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + 13888 offset - offsetTop; 13889 if (newOverTop > 0 || abs(newOverTop) < overBottom) { 13890 position.top += myOffset + atOffset + offset; 13891 } 13892 } 13893 } 13894 }, 13895 flipfit: { 13896 left: function () { 13897 $.ui.position.flip.left.apply(this, arguments); 13898 $.ui.position.fit.left.apply(this, arguments); 13899 }, 13900 top: function () { 13901 $.ui.position.flip.top.apply(this, arguments); 13902 $.ui.position.fit.top.apply(this, arguments); 13903 } 13904 } 13905 }; 13906 13907 })(); 13908 13909 var position = $.ui.position; 13910 13911 13912 /*! 13913 * jQuery UI :data 1.13.2 13914 * http://jqueryui.com
vendor: 27,317 bytes, lines 13915-14982
13915 * 13916 * Copyright jQuery Foundation and other contributors 13917 * Released under the MIT license. 13918 * http://jquery.org/license 13919 */ 13920 13921 //>>label: :data Selector 13922 //>>group: Core 13923 //>>description: Selects elements which have data stored under the specified key. 13924 //>>docs: http://api.jqueryui.com/data-selector/ 13925 13926 13927 var data = $.extend($.expr.pseudos, { 13928 data: $.expr.createPseudo ? 13929 $.expr.createPseudo(function (dataName) { 13930 return function (elem) { 13931 return !!$.data(elem, dataName); 13932 }; 13933 }) : 13934 13935 // Support: jQuery <1.8 13936 function (elem, i, match) { 13937 return !!$.data(elem, match[3]); 13938 } 13939 }); 13940 13941 /*! 13942 * jQuery UI Disable Selection 1.13.2 13943 * http://jqueryui.com 13944 * 13945 * Copyright jQuery Foundation and other contributors 13946 * Released under the MIT license. 13947 * http://jquery.org/license 13948 */ 13949 13950 //>>label: disableSelection 13951 //>>group: Core 13952 //>>description: Disable selection of text content within the set of matched elements. 13953 //>>docs: http://api.jqueryui.com/disableSelection/ 13954 13955 // This file is deprecated 13956 13957 var disableSelection = $.fn.extend({ 13958 disableSelection: (function () { 13959 var eventType = "onselectstart" in document.createElement("div") ? 13960 "selectstart" : 13961 "mousedown"; 13962 13963 return function () { 13964 return this.on(eventType + ".ui-disableSelection", function (event) { 13965 event.preventDefault(); 13966 }); 13967 }; 13968 })(), 13969 13970 enableSelection: function () { 13971 return this.off(".ui-disableSelection"); 13972 } 13973 }); 13974 13975 13976 13977 // Create a local jQuery because jQuery Color relies on it and the 13978 // global may not exist with AMD and a custom build (#10199). 13979 // This module is a noop if used as a regular AMD module. 13980 // eslint-disable-next-line no-unused-vars 13981 var jQuery = $; 13982 13983 13984 /*! 13985 * jQuery Color Animations v2.2.0 13986 * https://github.com/jquery/jquery-color 13987 * 13988 * Copyright OpenJS Foundation and other contributors 13989 * Released under the MIT license. 13990 * http://jquery.org/license 13991 * 13992 * Date: Sun May 10 09:02:36 2020 +0200 13993 */ 13994 13995 13996 13997 var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor " + 13998 "borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor", 13999 14000 class2type = {}, 14001 toString = class2type.toString, 14002 14003 // plusequals test for += 100 -= 100 14004 rplusequals = /^([\-+])=\s*(\d+\.?\d*)/, 14005 14006 // a set of RE's that can match strings and generate color tuples. 14007 stringParsers = [{ 14008 re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, 14009 parse: function (execResult) { 14010 return [ 14011 execResult[1], 14012 execResult[2], 14013 execResult[3], 14014 execResult[4] 14015 ]; 14016 } 14017 }, { 14018 re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, 14019 parse: function (execResult) { 14020 return [ 14021 execResult[1] * 2.55, 14022 execResult[2] * 2.55, 14023 execResult[3] * 2.55, 14024 execResult[4] 14025 ]; 14026 } 14027 }, { 14028 14029 // this regex ignores A-F because it's compared against an already lowercased string 14030 re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})?/, 14031 parse: function (execResult) { 14032 return [ 14033 parseInt(execResult[1], 16), 14034 parseInt(execResult[2], 16), 14035 parseInt(execResult[3], 16), 14036 execResult[4] ? 14037 (parseInt(execResult[4], 16) / 255).toFixed(2) : 14038 1 14039 ]; 14040 } 14041 }, { 14042 14043 // this regex ignores A-F because it's compared against an already lowercased string 14044 re: /#([a-f0-9])([a-f0-9])([a-f0-9])([a-f0-9])?/, 14045 parse: function (execResult) { 14046 return [ 14047 parseInt(execResult[1] + execResult[1], 16), 14048 parseInt(execResult[2] + execResult[2], 16), 14049 parseInt(execResult[3] + execResult[3], 16), 14050 execResult[4] ? 14051 (parseInt(execResult[4] + execResult[4], 16) / 255) 14052 .toFixed(2) : 14053 1 14054 ]; 14055 } 14056 }, { 14057 re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, 14058 space: "hsla", 14059 parse: function (execResult) { 14060 return [ 14061 execResult[1], 14062 execResult[2] / 100, 14063 execResult[3] / 100, 14064 execResult[4] 14065 ]; 14066 } 14067 }], 14068 14069 // jQuery.Color( ) 14070 color = jQuery.Color = function (color, green, blue, alpha) { 14071 return new jQuery.Color.fn.parse(color, green, blue, alpha); 14072 }, 14073 spaces = { 14074 rgba: { 14075 props: { 14076 red: { 14077 idx: 0, 14078 type: "byte" 14079 }, 14080 green: { 14081 idx: 1, 14082 type: "byte" 14083 }, 14084 blue: { 14085 idx: 2, 14086 type: "byte" 14087 } 14088 } 14089 }, 14090 14091 hsla: { 14092 props: { 14093 hue: { 14094 idx: 0, 14095 type: "degrees" 14096 }, 14097 saturation: { 14098 idx: 1, 14099 type: "percent" 14100 }, 14101 lightness: { 14102 idx: 2, 14103 type: "percent" 14104 } 14105 } 14106 } 14107 }, 14108 propTypes = { 14109 "byte": { 14110 floor: true, 14111 max: 255 14112 }, 14113 "percent": { 14114 max: 1 14115 }, 14116 "degrees": { 14117 mod: 360, 14118 floor: true 14119 } 14120 }, 14121 support = color.support = {}, 14122 14123 // element for support tests 14124 supportElem = jQuery("<p>")[0], 14125 14126 // colors = jQuery.Color.names 14127 colors, 14128 14129 // local aliases of functions called often 14130 each = jQuery.each; 14131 14132 // determine rgba support immediately 14133 supportElem.style.cssText = "background-color:rgba(1,1,1,.5)"; 14134 support.rgba = supportElem.style.backgroundColor.indexOf("rgba") > -1; 14135 14136 // define cache name and alpha properties 14137 // for rgba and hsla spaces 14138 each(spaces, function (spaceName, space) { 14139 space.cache = "_" + spaceName; 14140 space.props.alpha = { 14141 idx: 3, 14142 type: "percent", 14143 def: 1 14144 }; 14145 }); 14146 14147 // Populate the class2type map 14148 jQuery.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "), 14149 function (_i, name) { 14150 class2type["[object " + name + "]"] = name.toLowerCase(); 14151 }); 14152 14153 function getType(obj) { 14154 if (obj == null) { 14155 return obj + ""; 14156 } 14157 14158 return typeof obj === "object" ? 14159 class2type[toString.call(obj)] || "object" : 14160 typeof obj; 14161 } 14162 14163 function clamp(value, prop, allowEmpty) { 14164 var type = propTypes[prop.type] || {}; 14165 14166 if (value == null) { 14167 return (allowEmpty || !prop.def) ? null : prop.def; 14168 } 14169 14170 // ~~ is an short way of doing floor for positive numbers 14171 value = type.floor ? ~~value : parseFloat(value); 14172 14173 // IE will pass in empty strings as value for alpha, 14174 // which will hit this case 14175 if (isNaN(value)) { 14176 return prop.def; 14177 } 14178 14179 if (type.mod) { 14180 14181 // we add mod before modding to make sure that negatives values 14182 // get converted properly: -10 -> 350 14183 return (value + type.mod) % type.mod; 14184 } 14185 14186 // for now all property types without mod have min and max 14187 return Math.min(type.max, Math.max(0, value)); 14188 } 14189 14190 function stringParse(string) { 14191 var inst = color(), 14192 rgba = inst._rgba = []; 14193 14194 string = string.toLowerCase(); 14195 14196 each(stringParsers, function (_i, parser) { 14197 var parsed, 14198 match = parser.re.exec(string), 14199 values = match && parser.parse(match), 14200 spaceName = parser.space || "rgba"; 14201 14202 if (values) { 14203 parsed = inst[spaceName](values); 14204 14205 // if this was an rgba parse the assignment might happen twice 14206 // oh well.... 14207 inst[spaces[spaceName].cache] = parsed[spaces[spaceName].cache]; 14208 rgba = inst._rgba = parsed._rgba; 14209 14210 // exit each( stringParsers ) here because we matched 14211 return false; 14212 } 14213 }); 14214 14215 // Found a stringParser that handled it 14216 if (rgba.length) { 14217 14218 // if this came from a parsed string, force "transparent" when alpha is 0 14219 // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0) 14220 if (rgba.join() === "0,0,0,0") { 14221 jQuery.extend(rgba, colors.transparent); 14222 } 14223 return inst; 14224 } 14225 14226 // named colors 14227 return colors[string]; 14228 } 14229 14230 color.fn = jQuery.extend(color.prototype, { 14231 parse: function (red, green, blue, alpha) { 14232 if (red === undefined) { 14233 this._rgba = [null, null, null, null]; 14234 return this; 14235 } 14236 if (red.jquery || red.nodeType) { 14237 red = jQuery(red).css(green); 14238 green = undefined; 14239 } 14240 14241 var inst = this, 14242 type = getType(red), 14243 rgba = this._rgba = []; 14244 14245 // more than 1 argument specified - assume ( red, green, blue, alpha ) 14246 if (green !== undefined) { 14247 red = [red, green, blue, alpha]; 14248 type = "array"; 14249 } 14250 14251 if (type === "string") { 14252 return this.parse(stringParse(red) || colors._default); 14253 } 14254 14255 if (type === "array") { 14256 each(spaces.rgba.props, function (_key, prop) { 14257 rgba[prop.idx] = clamp(red[prop.idx], prop); 14258 }); 14259 return this; 14260 } 14261 14262 if (type === "object") { 14263 if (red instanceof color) { 14264 each(spaces, function (_spaceName, space) { 14265 if (red[space.cache]) { 14266 inst[space.cache] = red[space.cache].slice(); 14267 } 14268 }); 14269 } else { 14270 each(spaces, function (_spaceName, space) { 14271 var cache = space.cache; 14272 each(space.props, function (key, prop) { 14273 14274 // if the cache doesn't exist, and we know how to convert 14275 if (!inst[cache] && space.to) { 14276 14277 // if the value was null, we don't need to copy it 14278 // if the key was alpha, we don't need to copy it either 14279 if (key === "alpha" || red[key] == null) { 14280 return; 14281 } 14282 inst[cache] = space.to(inst._rgba); 14283 } 14284 14285 // this is the only case where we allow nulls for ALL properties. 14286 // call clamp with alwaysAllowEmpty 14287 inst[cache][prop.idx] = clamp(red[key], prop, true); 14288 }); 14289 14290 // everything defined but alpha? 14291 if (inst[cache] && jQuery.inArray(null, inst[cache].slice(0, 3)) < 0) { 14292 14293 // use the default of 1 14294 if (inst[cache][3] == null) { 14295 inst[cache][3] = 1; 14296 } 14297 14298 if (space.from) { 14299 inst._rgba = space.from(inst[cache]); 14300 } 14301 } 14302 }); 14303 } 14304 return this; 14305 } 14306 }, 14307 is: function (compare) { 14308 var is = color(compare), 14309 same = true, 14310 inst = this; 14311 14312 each(spaces, function (_, space) { 14313 var localCache, 14314 isCache = is[space.cache]; 14315 if (isCache) { 14316 localCache = inst[space.cache] || space.to && space.to(inst._rgba) || []; 14317 each(space.props, function (_, prop) { 14318 if (isCache[prop.idx] != null) { 14319 same = (isCache[prop.idx] === localCache[prop.idx]); 14320 return same; 14321 } 14322 }); 14323 } 14324 return same; 14325 }); 14326 return same; 14327 }, 14328 _space: function () { 14329 var used = [], 14330 inst = this; 14331 each(spaces, function (spaceName, space) { 14332 if (inst[space.cache]) { 14333 used.push(spaceName); 14334 } 14335 }); 14336 return used.pop(); 14337 }, 14338 transition: function (other, distance) { 14339 var end = color(other), 14340 spaceName = end._space(), 14341 space = spaces[spaceName], 14342 startColor = this.alpha() === 0 ? color("transparent") : this, 14343 start = startColor[space.cache] || space.to(startColor._rgba), 14344 result = start.slice(); 14345 14346 end = end[space.cache]; 14347 each(space.props, function (_key, prop) { 14348 var index = prop.idx, 14349 startValue = start[index], 14350 endValue = end[index], 14351 type = propTypes[prop.type] || {}; 14352 14353 // if null, don't override start value 14354 if (endValue === null) { 14355 return; 14356 } 14357 14358 // if null - use end 14359 if (startValue === null) { 14360 result[index] = endValue; 14361 } else { 14362 if (type.mod) { 14363 if (endValue - startValue > type.mod / 2) { 14364 startValue += type.mod; 14365 } else if (startValue - endValue > type.mod / 2) { 14366 startValue -= type.mod; 14367 } 14368 } 14369 result[index] = clamp((endValue - startValue) * distance + startValue, prop); 14370 } 14371 }); 14372 return this[spaceName](result); 14373 }, 14374 blend: function (opaque) { 14375 14376 // if we are already opaque - return ourself 14377 if (this._rgba[3] === 1) { 14378 return this; 14379 } 14380 14381 var rgb = this._rgba.slice(), 14382 a = rgb.pop(), 14383 blend = color(opaque)._rgba; 14384 14385 return color(jQuery.map(rgb, function (v, i) { 14386 return (1 - a) * blend[i] + a * v; 14387 })); 14388 }, 14389 toRgbaString: function () { 14390 var prefix = "rgba(", 14391 rgba = jQuery.map(this._rgba, function (v, i) { 14392 if (v != null) { 14393 return v; 14394 } 14395 return i > 2 ? 1 : 0; 14396 }); 14397 14398 if (rgba[3] === 1) { 14399 rgba.pop(); 14400 prefix = "rgb("; 14401 } 14402 14403 return prefix + rgba.join() + ")"; 14404 }, 14405 toHslaString: function () { 14406 var prefix = "hsla(", 14407 hsla = jQuery.map(this.hsla(), function (v, i) { 14408 if (v == null) { 14409 v = i > 2 ? 1 : 0; 14410 } 14411 14412 // catch 1 and 2 14413 if (i && i < 3) { 14414 v = Math.round(v * 100) + "%"; 14415 } 14416 return v; 14417 }); 14418 14419 if (hsla[3] === 1) { 14420 hsla.pop(); 14421 prefix = "hsl("; 14422 } 14423 return prefix + hsla.join() + ")"; 14424 }, 14425 toHexString: function (includeAlpha) { 14426 var rgba = this._rgba.slice(), 14427 alpha = rgba.pop(); 14428 14429 if (includeAlpha) { 14430 rgba.push(~~(alpha * 255)); 14431 } 14432 14433 return "#" + jQuery.map(rgba, function (v) { 14434 14435 // default to 0 when nulls exist 14436 v = (v || 0).toString(16); 14437 return v.length === 1 ? "0" + v : v; 14438 }).join(""); 14439 }, 14440 toString: function () { 14441 return this._rgba[3] === 0 ? "transparent" : this.toRgbaString(); 14442 } 14443 }); 14444 color.fn.parse.prototype = color.fn; 14445 14446 // hsla conversions adapted from: 14447 // https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021 14448 14449 function hue2rgb(p, q, h) { 14450 h = (h + 1) % 1; 14451 if (h * 6 < 1) { 14452 return p + (q - p) * h * 6; 14453 } 14454 if (h * 2 < 1) { 14455 return q; 14456 } 14457 if (h * 3 < 2) { 14458 return p + (q - p) * ((2 / 3) - h) * 6; 14459 } 14460 return p; 14461 } 14462 14463 spaces.hsla.to = function (rgba) { 14464 if (rgba[0] == null || rgba[1] == null || rgba[2] == null) { 14465 return [null, null, null, rgba[3]]; 14466 } 14467 var r = rgba[0] / 255, 14468 g = rgba[1] / 255, 14469 b = rgba[2] / 255, 14470 a = rgba[3], 14471 max = Math.max(r, g, b), 14472 min = Math.min(r, g, b), 14473 diff = max - min, 14474 add = max + min, 14475 l = add * 0.5, 14476 h, s; 14477 14478 if (min === max) { 14479 h = 0; 14480 } else if (r === max) { 14481 h = (60 * (g - b) / diff) + 360; 14482 } else if (g === max) { 14483 h = (60 * (b - r) / diff) + 120; 14484 } else { 14485 h = (60 * (r - g) / diff) + 240; 14486 } 14487 14488 // chroma (diff) == 0 means greyscale which, by definition, saturation = 0% 14489 // otherwise, saturation is based on the ratio of chroma (diff) to lightness (add) 14490 if (diff === 0) { 14491 s = 0; 14492 } else if (l <= 0.5) { 14493 s = diff / add; 14494 } else { 14495 s = diff / (2 - add); 14496 } 14497 return [Math.round(h) % 360, s, l, a == null ? 1 : a]; 14498 }; 14499 14500 spaces.hsla.from = function (hsla) { 14501 if (hsla[0] == null || hsla[1] == null || hsla[2] == null) { 14502 return [null, null, null, hsla[3]]; 14503 } 14504 var h = hsla[0] / 360, 14505 s = hsla[1], 14506 l = hsla[2], 14507 a = hsla[3], 14508 q = l <= 0.5 ? l * (1 + s) : l + s - l * s, 14509 p = 2 * l - q; 14510 14511 return [ 14512 Math.round(hue2rgb(p, q, h + (1 / 3)) * 255), 14513 Math.round(hue2rgb(p, q, h) * 255), 14514 Math.round(hue2rgb(p, q, h - (1 / 3)) * 255), 14515 a 14516 ]; 14517 }; 14518 14519 14520 each(spaces, function (spaceName, space) { 14521 var props = space.props, 14522 cache = space.cache, 14523 to = space.to, 14524 from = space.from; 14525 14526 // makes rgba() and hsla() 14527 color.fn[spaceName] = function (value) { 14528 14529 // generate a cache for this space if it doesn't exist 14530 if (to && !this[cache]) { 14531 this[cache] = to(this._rgba); 14532 } 14533 if (value === undefined) { 14534 return this[cache].slice(); 14535 } 14536 14537 var ret, 14538 type = getType(value), 14539 arr = (type === "array" || type === "object") ? value : arguments, 14540 local = this[cache].slice(); 14541 14542 each(props, function (key, prop) { 14543 var val = arr[type === "object" ? key : prop.idx]; 14544 if (val == null) { 14545 val = local[prop.idx]; 14546 } 14547 local[prop.idx] = clamp(val, prop); 14548 }); 14549 14550 if (from) { 14551 ret = color(from(local)); 14552 ret[cache] = local; 14553 return ret; 14554 } else { 14555 return color(local); 14556 } 14557 }; 14558 14559 // makes red() green() blue() alpha() hue() saturation() lightness() 14560 each(props, function (key, prop) { 14561 14562 // alpha is included in more than one space 14563 if (color.fn[key]) { 14564 return; 14565 } 14566 color.fn[key] = function (value) { 14567 var local, cur, match, fn, 14568 vtype = getType(value); 14569 14570 if (key === "alpha") { 14571 fn = this._hsla ? "hsla" : "rgba"; 14572 } else { 14573 fn = spaceName; 14574 } 14575 local = this[fn](); 14576 cur = local[prop.idx]; 14577 14578 if (vtype === "undefined") { 14579 return cur; 14580 } 14581 14582 if (vtype === "function") { 14583 value = value.call(this, cur); 14584 vtype = getType(value); 14585 } 14586 if (value == null && prop.empty) { 14587 return this; 14588 } 14589 if (vtype === "string") { 14590 match = rplusequals.exec(value); 14591 if (match) { 14592 value = cur + parseFloat(match[2]) * (match[1] === "+" ? 1 : -1); 14593 } 14594 } 14595 local[prop.idx] = value; 14596 return this[fn](local); 14597 }; 14598 }); 14599 }); 14600 14601 // add cssHook and .fx.step function for each named hook. 14602 // accept a space separated string of properties 14603 color.hook = function (hook) { 14604 var hooks = hook.split(" "); 14605 each(hooks, function (_i, hook) { 14606 jQuery.cssHooks[hook] = { 14607 set: function (elem, value) { 14608 var parsed, curElem, 14609 backgroundColor = ""; 14610 14611 if (value !== "transparent" && (getType(value) !== "string" || (parsed = stringParse(value)))) { 14612 value = color(parsed || value); 14613 if (!support.rgba && value._rgba[3] !== 1) { 14614 curElem = hook === "backgroundColor" ? elem.parentNode : elem; 14615 while ( 14616 (backgroundColor === "" || backgroundColor === "transparent") && 14617 curElem && curElem.style 14618 ) { 14619 try { 14620 backgroundColor = jQuery.css(curElem, "backgroundColor"); 14621 curElem = curElem.parentNode; 14622 } catch (e) { 14623 } 14624 } 14625 14626 value = value.blend(backgroundColor && backgroundColor !== "transparent" ? 14627 backgroundColor : 14628 "_default"); 14629 } 14630 14631 value = value.toRgbaString(); 14632 } 14633 try { 14634 elem.style[hook] = value; 14635 } catch (e) { 14636 14637 // wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit' 14638 } 14639 } 14640 }; 14641 jQuery.fx.step[hook] = function (fx) { 14642 if (!fx.colorInit) { 14643 fx.start = color(fx.elem, hook); 14644 fx.end = color(fx.end); 14645 fx.colorInit = true; 14646 } 14647 jQuery.cssHooks[hook].set(fx.elem, fx.start.transition(fx.end, fx.pos)); 14648 }; 14649 }); 14650 14651 }; 14652 14653 color.hook(stepHooks); 14654 14655 jQuery.cssHooks.borderColor = { 14656 expand: function (value) { 14657 var expanded = {}; 14658 14659 each(["Top", "Right", "Bottom", "Left"], function (_i, part) { 14660 expanded["border" + part + "Color"] = value; 14661 }); 14662 return expanded; 14663 } 14664 }; 14665 14666 // Basic color names only. 14667 // Usage of any of the other color names requires adding yourself or including 14668 // jquery.color.svg-names.js. 14669 colors = jQuery.Color.names = { 14670 14671 // 4.1. Basic color keywords 14672 aqua: "#00ffff", 14673 black: "#000000", 14674 blue: "#0000ff", 14675 fuchsia: "#ff00ff", 14676 gray: "#808080", 14677 green: "#008000", 14678 lime: "#00ff00", 14679 maroon: "#800000", 14680 navy: "#000080", 14681 olive: "#808000", 14682 purple: "#800080", 14683 red: "#ff0000", 14684 silver: "#c0c0c0", 14685 teal: "#008080", 14686 white: "#ffffff", 14687 yellow: "#ffff00", 14688 14689 // 4.2.3. "transparent" color keyword 14690 transparent: [null, null, null, 0], 14691 14692 _default: "#ffffff" 14693 }; 14694 14695 14696 /*! 14697 * jQuery UI Effects 1.13.2 14698 * http://jqueryui.com 14699 * 14700 * Copyright jQuery Foundation and other contributors 14701 * Released under the MIT license. 14702 * http://jquery.org/license 14703 */ 14704 14705 //>>label: Effects Core 14706 //>>group: Effects 14707 /* eslint-disable max-len */ 14708 //>>description: Extends the internal jQuery effects. Includes morphing and easing. Required by all other effects. 14709 /* eslint-enable max-len */ 14710 //>>docs: http://api.jqueryui.com/category/effects-core/ 14711 //>>demos: http://jqueryui.com/effect/ 14712 14713 14714 var dataSpace = "ui-effects-", 14715 dataSpaceStyle = "ui-effects-style", 14716 dataSpaceAnimated = "ui-effects-animated"; 14717 14718 $.effects = { 14719 effect: {} 14720 }; 14721 14722 /******************************************************************************/ 14723 /****************************** CLASS ANIMATIONS ******************************/ 14724 /******************************************************************************/ 14725 (function () { 14726 14727 var classAnimationActions = ["add", "remove", "toggle"], 14728 shorthandStyles = { 14729 border: 1, 14730 borderBottom: 1, 14731 borderColor: 1, 14732 borderLeft: 1, 14733 borderRight: 1, 14734 borderTop: 1, 14735 borderWidth: 1, 14736 margin: 1, 14737 padding: 1 14738 }; 14739 14740 $.each( 14741 ["borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle"], 14742 function (_, prop) { 14743 $.fx.step[prop] = function (fx) { 14744 if (fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr) { 14745 jQuery.style(fx.elem, prop, fx.end); 14746 fx.setAttr = true; 14747 } 14748 }; 14749 } 14750 ); 14751 14752 function camelCase(string) { 14753 return string.replace(/-([\da-z])/gi, function (all, letter) { 14754 return letter.toUpperCase(); 14755 }); 14756 } 14757 14758 function getElementStyles(elem) { 14759 var key, len, 14760 style = elem.ownerDocument.defaultView ? 14761 elem.ownerDocument.defaultView.getComputedStyle(elem, null) : 14762 elem.currentStyle, 14763 styles = {}; 14764 14765 if (style && style.length && style[0] && style[style[0]]) { 14766 len = style.length; 14767 while (len--) { 14768 key = style[len]; 14769 if (typeof style[key] === "string") { 14770 styles[camelCase(key)] = style[key]; 14771 } 14772 } 14773 14774 // Support: Opera, IE <9 14775 } else { 14776 for (key in style) { 14777 if (typeof style[key] === "string") { 14778 styles[key] = style[key]; 14779 } 14780 } 14781 } 14782 14783 return styles; 14784 } 14785 14786 function styleDifference(oldStyle, newStyle) { 14787 var diff = {}, 14788 name, value; 14789 14790 for (name in newStyle) { 14791 value = newStyle[name]; 14792 if (oldStyle[name] !== value) { 14793 if (!shorthandStyles[name]) { 14794 if ($.fx.step[name] || !isNaN(parseFloat(value))) { 14795 diff[name] = value; 14796 } 14797 } 14798 } 14799 } 14800 14801 return diff; 14802 } 14803 14804 // Support: jQuery <1.8 14805 if (!$.fn.addBack) { 14806 $.fn.addBack = function (selector) { 14807 return this.add(selector == null ? 14808 this.prevObject : this.prevObject.filter(selector) 14809 ); 14810 }; 14811 } 14812 14813 $.effects.animateClass = function (value, duration, easing, callback) { 14814 var o = $.speed(duration, easing, callback); 14815 14816 return this.queue(function () { 14817 var animated = $(this), 14818 baseClass = animated.attr("class") || "", 14819 applyClassChange, 14820 allAnimations = o.children ? animated.find("*").addBack() : animated; 14821 14822 // Map the animated objects to store the original styles. 14823 allAnimations = allAnimations.map(function () { 14824 var el = $(this); 14825 return { 14826 el: el, 14827 start: getElementStyles(this) 14828 }; 14829 }); 14830 14831 // Apply class change 14832 applyClassChange = function () { 14833 $.each(classAnimationActions, function (i, action) { 14834 if (value[action]) { 14835 animated[action + "Class"](value[action]); 14836 } 14837 }); 14838 }; 14839 applyClassChange(); 14840 14841 // Map all animated objects again - calculate new styles and diff 14842 allAnimations = allAnimations.map(function () { 14843 this.end = getElementStyles(this.el[0]); 14844 this.diff = styleDifference(this.start, this.end); 14845 return this; 14846 }); 14847 14848 // Apply original class 14849 animated.attr("class", baseClass); 14850 14851 // Map all animated objects again - this time collecting a promise 14852 allAnimations = allAnimations.map(function () { 14853 var styleInfo = this, 14854 dfd = $.Deferred(), 14855 opts = $.extend({}, o, { 14856 queue: false, 14857 complete: function () { 14858 dfd.resolve(styleInfo); 14859 } 14860 }); 14861 14862 this.el.animate(this.diff, opts); 14863 return dfd.promise(); 14864 }); 14865 14866 // Once all animations have completed: 14867 $.when.apply($, allAnimations.get()).done(function () { 14868 14869 // Set the final class 14870 applyClassChange(); 14871 14872 // For each animated element, 14873 // clear all css properties that were animated 14874 $.each(arguments, function () { 14875 var el = this.el; 14876 $.each(this.diff, function (key) { 14877 el.css(key, ""); 14878 }); 14879 }); 14880 14881 // This is guarnteed to be there if you use jQuery.speed() 14882 // it also handles dequeuing the next anim... 14883 o.complete.call(animated[0]); 14884 }); 14885 }); 14886 }; 14887 14888 $.fn.extend({ 14889 addClass: (function (orig) { 14890 return function (classNames, speed, easing, callback) { 14891 return speed ? 14892 $.effects.animateClass.call(this, 14893 { add: classNames }, speed, easing, callback) : 14894 orig.apply(this, arguments); 14895 }; 14896 })($.fn.addClass), 14897 14898 removeClass: (function (orig) { 14899 return function (classNames, speed, easing, callback) { 14900 return arguments.length > 1 ? 14901 $.effects.animateClass.call(this, 14902 { remove: classNames }, speed, easing, callback) : 14903 orig.apply(this, arguments); 14904 }; 14905 })($.fn.removeClass), 14906 14907 toggleClass: (function (orig) { 14908 return function (classNames, force, speed, easing, callback) { 14909 if (typeof force === "boolean" || force === undefined) { 14910 if (!speed) { 14911 14912 // Without speed parameter 14913 return orig.apply(this, arguments); 14914 } else { 14915 return $.effects.animateClass.call(this, 14916 (force ? { add: classNames } : { remove: classNames }), 14917 speed, easing, callback); 14918 } 14919 } else { 14920 14921 // Without force parameter 14922 return $.effects.animateClass.call(this, 14923 { toggle: classNames }, force, speed, easing); 14924 } 14925 }; 14926 })($.fn.toggleClass), 14927 14928 switchClass: function (remove, add, speed, easing, callback) { 14929 return $.effects.animateClass.call(this, { 14930 add: add, 14931 remove: remove 14932 }, speed, easing, callback); 14933 } 14934 }); 14935 14936 })(); 14937 14938 /******************************************************************************/ 14939 /*********************************** EFFECTS **********************************/ 14940 /******************************************************************************/ 14941 14942 (function () { 14943 14944 if ($.expr && $.expr.pseudos && $.expr.pseudos.animated) { 14945 $.expr.pseudos.animated = (function (orig) { 14946 return function (elem) { 14947 return !!$(elem).data(dataSpaceAnimated) || orig(elem); 14948 }; 14949 })($.expr.pseudos.animated); 14950 } 14951 14952 if ($.uiBackCompat !== false) { 14953 $.extend($.effects, { 14954 14955 // Saves a set of properties in a data storage 14956 save: function (element, set) { 14957 var i = 0, length = set.length; 14958 for (; i < length; i++) { 14959 if (set[i] !== null) { 14960 element.data(dataSpace + set[i], element[0].style[set[i]]); 14961 } 14962 } 14963 }, 14964 14965 // Restores a set of previously saved properties from a data storage 14966 restore: function (element, set) { 14967 var val, i = 0, length = set.length; 14968 for (; i < length; i++) { 14969 if (set[i] !== null) { 14970 val = element.data(dataSpace + set[i]); 14971 element.css(set[i], val); 14972 } 14973 } 14974 }, 14975 14976 setMode: function (el, mode) { 14977 if (mode === "toggle") { 14978 mode = el.is(":hidden") ? "show" : "hide"; 14979 } 14980 return mode; 14981 }, 14982
vendor: 9,628 bytes, lines 14983-15349
14983 // Wraps the element around a wrapper that copies position properties 14984 createWrapper: function (element) { 14985 14986 // If the element is already wrapped, return it 14987 if (element.parent().is(".ui-effects-wrapper")) { 14988 return element.parent(); 14989 } 14990 14991 // Wrap the element 14992 var props = { 14993 width: element.outerWidth(true), 14994 height: element.outerHeight(true), 14995 "float": element.css("float") 14996 }, 14997 wrapper = $("<div></div>") 14998 .addClass("ui-effects-wrapper") 14999 .css({ 15000 fontSize: "100%", 15001 background: "transparent", 15002 border: "none", 15003 margin: 0, 15004 padding: 0 15005 }), 15006 15007 // Store the size in case width/height are defined in % - Fixes #5245 15008 size = { 15009 width: element.width(), 15010 height: element.height() 15011 }, 15012 active = document.activeElement; 15013 15014 // Support: Firefox 15015 // Firefox incorrectly exposes anonymous content 15016 // https://bugzilla.mozilla.org/show_bug.cgi?id=561664 15017 try { 15018 // eslint-disable-next-line no-unused-expressions 15019 active.id; 15020 } catch (e) { 15021 active = document.body; 15022 } 15023 15024 element.wrap(wrapper); 15025 15026 // Fixes #7595 - Elements lose focus when wrapped. 15027 if (element[0] === active || $.contains(element[0], active)) { 15028 $(active).trigger("focus"); 15029 } 15030 15031 // Hotfix for jQuery 1.4 since some change in wrap() seems to actually 15032 // lose the reference to the wrapped element 15033 wrapper = element.parent(); 15034 15035 // Transfer positioning properties to the wrapper 15036 if (element.css("position") === "static") { 15037 wrapper.css({ position: "relative" }); 15038 element.css({ position: "relative" }); 15039 } else { 15040 $.extend(props, { 15041 position: element.css("position"), 15042 zIndex: element.css("z-index") 15043 }); 15044 $.each(["top", "left", "bottom", "right"], function (i, pos) { 15045 props[pos] = element.css(pos); 15046 if (isNaN(parseInt(props[pos], 10))) { 15047 props[pos] = "auto"; 15048 } 15049 }); 15050 element.css({ 15051 position: "relative", 15052 top: 0, 15053 left: 0, 15054 right: "auto", 15055 bottom: "auto" 15056 }); 15057 } 15058 element.css(size); 15059 15060 return wrapper.css(props).show(); 15061 }, 15062 15063 removeWrapper: function (element) { 15064 var active = document.activeElement; 15065 15066 if (element.parent().is(".ui-effects-wrapper")) { 15067 element.parent().replaceWith(element); 15068 15069 // Fixes #7595 - Elements lose focus when wrapped. 15070 if (element[0] === active || $.contains(element[0], active)) { 15071 $(active).trigger("focus"); 15072 } 15073 } 15074 15075 return element; 15076 } 15077 }); 15078 } 15079 15080 $.extend($.effects, { 15081 version: "1.13.2", 15082 15083 define: function (name, mode, effect) { 15084 if (!effect) { 15085 effect = mode; 15086 mode = "effect"; 15087 } 15088 15089 $.effects.effect[name] = effect; 15090 $.effects.effect[name].mode = mode; 15091 15092 return effect; 15093 }, 15094 15095 scaledDimensions: function (element, percent, direction) { 15096 if (percent === 0) { 15097 return { 15098 height: 0, 15099 width: 0, 15100 outerHeight: 0, 15101 outerWidth: 0 15102 }; 15103 } 15104 15105 var x = direction !== "horizontal" ? ((percent || 100) / 100) : 1, 15106 y = direction !== "vertical" ? ((percent || 100) / 100) : 1; 15107 15108 return { 15109 height: element.height() * y, 15110 width: element.width() * x, 15111 outerHeight: element.outerHeight() * y, 15112 outerWidth: element.outerWidth() * x 15113 }; 15114 15115 }, 15116 15117 clipToBox: function (animation) { 15118 return { 15119 width: animation.clip.right - animation.clip.left, 15120 height: animation.clip.bottom - animation.clip.top, 15121 left: animation.clip.left, 15122 top: animation.clip.top 15123 }; 15124 }, 15125 15126 // Injects recently queued functions to be first in line (after "inprogress") 15127 unshift: function (element, queueLength, count) { 15128 var queue = element.queue(); 15129 15130 if (queueLength > 1) { 15131 queue.splice.apply(queue, 15132 [1, 0].concat(queue.splice(queueLength, count))); 15133 } 15134 element.dequeue(); 15135 }, 15136 15137 saveStyle: function (element) { 15138 element.data(dataSpaceStyle, element[0].style.cssText); 15139 }, 15140 15141 restoreStyle: function (element) { 15142 element[0].style.cssText = element.data(dataSpaceStyle) || ""; 15143 element.removeData(dataSpaceStyle); 15144 }, 15145 15146 mode: function (element, mode) { 15147 var hidden = element.is(":hidden"); 15148 15149 if (mode === "toggle") { 15150 mode = hidden ? "show" : "hide"; 15151 } 15152 if (hidden ? mode === "hide" : mode === "show") { 15153 mode = "none"; 15154 } 15155 return mode; 15156 }, 15157 15158 // Translates a [top,left] array into a baseline value 15159 getBaseline: function (origin, original) { 15160 var y, x; 15161 15162 switch (origin[0]) { 15163 case "top": 15164 y = 0; 15165 break; 15166 case "middle": 15167 y = 0.5; 15168 break; 15169 case "bottom": 15170 y = 1; 15171 break; 15172 default: 15173 y = origin[0] / original.height; 15174 } 15175 15176 switch (origin[1]) { 15177 case "left": 15178 x = 0; 15179 break; 15180 case "center": 15181 x = 0.5; 15182 break; 15183 case "right": 15184 x = 1; 15185 break; 15186 default: 15187 x = origin[1] / original.width; 15188 } 15189 15190 return { 15191 x: x, 15192 y: y 15193 }; 15194 }, 15195 15196 // Creates a placeholder element so that the original element can be made absolute 15197 createPlaceholder: function (element) { 15198 var placeholder, 15199 cssPosition = element.css("position"), 15200 position = element.position(); 15201 15202 // Lock in margins first to account for form elements, which 15203 // will change margin if you explicitly set height 15204 // see: http://jsfiddle.net/JZSMt/3/ https://bugs.webkit.org/show_bug.cgi?id=107380 15205 // Support: Safari 15206 element.css({ 15207 marginTop: element.css("marginTop"), 15208 marginBottom: element.css("marginBottom"), 15209 marginLeft: element.css("marginLeft"), 15210 marginRight: element.css("marginRight") 15211 }) 15212 .outerWidth(element.outerWidth()) 15213 .outerHeight(element.outerHeight()); 15214 15215 if (/^(static|relative)/.test(cssPosition)) { 15216 cssPosition = "absolute"; 15217 15218 placeholder = $("<" + element[0].nodeName + ">").insertAfter(element).css({ 15219 15220 // Convert inline to inline block to account for inline elements 15221 // that turn to inline block based on content (like img) 15222 display: /^(inline|ruby)/.test(element.css("display")) ? 15223 "inline-block" : 15224 "block", 15225 visibility: "hidden", 15226 15227 // Margins need to be set to account for margin collapse 15228 marginTop: element.css("marginTop"), 15229 marginBottom: element.css("marginBottom"), 15230 marginLeft: element.css("marginLeft"), 15231 marginRight: element.css("marginRight"), 15232 "float": element.css("float") 15233 }) 15234 .outerWidth(element.outerWidth()) 15235 .outerHeight(element.outerHeight()) 15236 .addClass("ui-effects-placeholder"); 15237 15238 element.data(dataSpace + "placeholder", placeholder); 15239 } 15240 15241 element.css({ 15242 position: cssPosition, 15243 left: position.left, 15244 top: position.top 15245 }); 15246 15247 return placeholder; 15248 }, 15249 15250 removePlaceholder: function (element) { 15251 var dataKey = dataSpace + "placeholder", 15252 placeholder = element.data(dataKey); 15253 15254 if (placeholder) { 15255 placeholder.remove(); 15256 element.removeData(dataKey); 15257 } 15258 }, 15259 15260 // Removes a placeholder if it exists and restores 15261 // properties that were modified during placeholder creation 15262 cleanUp: function (element) { 15263 $.effects.restoreStyle(element); 15264 $.effects.removePlaceholder(element); 15265 }, 15266 15267 setTransition: function (element, list, factor, value) { 15268 value = value || {}; 15269 $.each(list, function (i, x) { 15270 var unit = element.cssUnit(x); 15271 if (unit[0] > 0) { 15272 value[x] = unit[0] * factor + unit[1]; 15273 } 15274 }); 15275 return value; 15276 } 15277 }); 15278 15279 // Return an effect options object for the given parameters: 15280 function _normalizeArguments(effect, options, speed, callback) { 15281 15282 // Allow passing all options as the first parameter 15283 if ($.isPlainObject(effect)) { 15284 options = effect; 15285 effect = effect.effect; 15286 } 15287 15288 // Convert to an object 15289 effect = { effect: effect }; 15290 15291 // Catch (effect, null, ...) 15292 if (options == null) { 15293 options = {}; 15294 } 15295 15296 // Catch (effect, callback) 15297 if (typeof options === "function") { 15298 callback = options; 15299 speed = null; 15300 options = {}; 15301 } 15302 15303 // Catch (effect, speed, ?) 15304 if (typeof options === "number" || $.fx.speeds[options]) { 15305 callback = speed; 15306 speed = options; 15307 options = {}; 15308 } 15309 15310 // Catch (effect, options, callback) 15311 if (typeof speed === "function") { 15312 callback = speed; 15313 speed = null; 15314 } 15315 15316 // Add options to effect 15317 if (options) { 15318 $.extend(effect, options); 15319 } 15320 15321 speed = speed || options.duration; 15322 effect.duration = $.fx.off ? 0 : 15323 typeof speed === "number" ? speed : 15324 speed in $.fx.speeds ? $.fx.speeds[speed] : 15325 $.fx.speeds._default; 15326 15327 effect.complete = callback || options.complete; 15328 15329 return effect; 15330 } 15331 15332 function standardAnimationOption(option) { 15333 15334 // Valid standard speeds (nothing, number, named speed) 15335 if (!option || typeof option === "number" || $.fx.speeds[option]) { 15336 return true; 15337 } 15338 15339 // Invalid strings - treat as "normal" speed 15340 if (typeof option === "string" && !$.effects.effect[option]) { 15341 return true; 15342 } 15343 15344 // Complete callback 15345 if (typeof option === "function") { 15346 return true; 15347 } 15348 15349 // Options hash (but not naming an effect)
vendor: 5,140 bytes, lines 15350-15533
15350 if (typeof option === "object" && !option.effect) { 15351 return true; 15352 } 15353 15354 // Didn't match any standard API 15355 return false; 15356 } 15357 15358 $.fn.extend({ 15359 effect: function ( /* effect, options, speed, callback */) { 15360 var args = _normalizeArguments.apply(this, arguments), 15361 effectMethod = $.effects.effect[args.effect], 15362 defaultMode = effectMethod.mode, 15363 queue = args.queue, 15364 queueName = queue || "fx", 15365 complete = args.complete, 15366 mode = args.mode, 15367 modes = [], 15368 prefilter = function (next) { 15369 var el = $(this), 15370 normalizedMode = $.effects.mode(el, mode) || defaultMode; 15371 15372 // Sentinel for duck-punching the :animated pseudo-selector 15373 el.data(dataSpaceAnimated, true); 15374 15375 // Save effect mode for later use, 15376 // we can't just call $.effects.mode again later, 15377 // as the .show() below destroys the initial state 15378 modes.push(normalizedMode); 15379 15380 // See $.uiBackCompat inside of run() for removal of defaultMode in 1.14 15381 if (defaultMode && (normalizedMode === "show" || 15382 (normalizedMode === defaultMode && normalizedMode === "hide"))) { 15383 el.show(); 15384 } 15385 15386 if (!defaultMode || normalizedMode !== "none") { 15387 $.effects.saveStyle(el); 15388 } 15389 15390 if (typeof next === "function") { 15391 next(); 15392 } 15393 }; 15394 15395 if ($.fx.off || !effectMethod) { 15396 15397 // Delegate to the original method (e.g., .show()) if possible 15398 if (mode) { 15399 return this[mode](args.duration, complete); 15400 } else { 15401 return this.each(function () { 15402 if (complete) { 15403 complete.call(this); 15404 } 15405 }); 15406 } 15407 } 15408 15409 function run(next) { 15410 var elem = $(this); 15411 15412 function cleanup() { 15413 elem.removeData(dataSpaceAnimated); 15414 15415 $.effects.cleanUp(elem); 15416 15417 if (args.mode === "hide") { 15418 elem.hide(); 15419 } 15420 15421 done(); 15422 } 15423 15424 function done() { 15425 if (typeof complete === "function") { 15426 complete.call(elem[0]); 15427 } 15428 15429 if (typeof next === "function") { 15430 next(); 15431 } 15432 } 15433 15434 // Override mode option on a per element basis, 15435 // as toggle can be either show or hide depending on element state 15436 args.mode = modes.shift(); 15437 15438 if ($.uiBackCompat !== false && !defaultMode) { 15439 if (elem.is(":hidden") ? mode === "hide" : mode === "show") { 15440 15441 // Call the core method to track "olddisplay" properly 15442 elem[mode](); 15443 done(); 15444 } else { 15445 effectMethod.call(elem[0], args, done); 15446 } 15447 } else { 15448 if (args.mode === "none") { 15449 15450 // Call the core method to track "olddisplay" properly 15451 elem[mode](); 15452 done(); 15453 } else { 15454 effectMethod.call(elem[0], args, cleanup); 15455 } 15456 } 15457 } 15458 15459 // Run prefilter on all elements first to ensure that 15460 // any showing or hiding happens before placeholder creation, 15461 // which ensures that any layout changes are correctly captured. 15462 return queue === false ? 15463 this.each(prefilter).each(run) : 15464 this.queue(queueName, prefilter).queue(queueName, run); 15465 }, 15466 15467 show: (function (orig) { 15468 return function (option) { 15469 if (standardAnimationOption(option)) { 15470 return orig.apply(this, arguments); 15471 } else { 15472 var args = _normalizeArguments.apply(this, arguments); 15473 args.mode = "show"; 15474 return this.effect.call(this, args); 15475 } 15476 }; 15477 })($.fn.show), 15478 15479 hide: (function (orig) { 15480 return function (option) { 15481 if (standardAnimationOption(option)) { 15482 return orig.apply(this, arguments); 15483 } else { 15484 var args = _normalizeArguments.apply(this, arguments); 15485 args.mode = "hide"; 15486 return this.effect.call(this, args); 15487 } 15488 }; 15489 })($.fn.hide), 15490 15491 toggle: (function (orig) { 15492 return function (option) { 15493 if (standardAnimationOption(option) || typeof option === "boolean") { 15494 return orig.apply(this, arguments); 15495 } else { 15496 var args = _normalizeArguments.apply(this, arguments); 15497 args.mode = "toggle"; 15498 return this.effect.call(this, args); 15499 } 15500 }; 15501 })($.fn.toggle), 15502 15503 cssUnit: function (key) { 15504 var style = this.css(key), 15505 val = []; 15506 15507 $.each(["em", "px", "%", "pt"], function (i, unit) { 15508 if (style.indexOf(unit) > 0) { 15509 val = [parseFloat(style), unit]; 15510 } 15511 }); 15512 return val; 15513 }, 15514 15515 cssClip: function (clipObj) { 15516 if (clipObj) { 15517 return this.css("clip", "rect(" + clipObj.top + "px " + clipObj.right + "px " + 15518 clipObj.bottom + "px " + clipObj.left + "px)"); 15519 } 15520 return parseClip(this.css("clip"), this); 15521 }, 15522 15523 transfer: function (options, done) { 15524 var element = $(this), 15525 target = $(options.to), 15526 targetFixed = target.css("position") === "fixed", 15527 body = $("body"), 15528 fixTop = targetFixed ? body.scrollTop() : 0, 15529 fixLeft = targetFixed ? body.scrollLeft() : 0, 15530 endPosition = target.offset(), 15531 animation = { 15532 top: endPosition.top - fixTop, 15533 left: endPosition.left - fixLeft,
vendor: 26,620 bytes, lines 15534-16500
15534 height: target.innerHeight(), 15535 width: target.innerWidth() 15536 }, 15537 startPosition = element.offset(), 15538 transfer = $("<div class='ui-effects-transfer'></div>"); 15539 15540 transfer 15541 .appendTo("body") 15542 .addClass(options.className) 15543 .css({ 15544 top: startPosition.top - fixTop, 15545 left: startPosition.left - fixLeft, 15546 height: element.innerHeight(), 15547 width: element.innerWidth(), 15548 position: targetFixed ? "fixed" : "absolute" 15549 }) 15550 .animate(animation, options.duration, options.easing, function () { 15551 transfer.remove(); 15552 if (typeof done === "function") { 15553 done(); 15554 } 15555 }); 15556 } 15557 }); 15558 15559 function parseClip(str, element) { 15560 var outerWidth = element.outerWidth(), 15561 outerHeight = element.outerHeight(), 15562 clipRegex = /^rect\((-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto)\)$/, 15563 values = clipRegex.exec(str) || ["", 0, outerWidth, outerHeight, 0]; 15564 15565 return { 15566 top: parseFloat(values[1]) || 0, 15567 right: values[2] === "auto" ? outerWidth : parseFloat(values[2]), 15568 bottom: values[3] === "auto" ? outerHeight : parseFloat(values[3]), 15569 left: parseFloat(values[4]) || 0 15570 }; 15571 } 15572 15573 $.fx.step.clip = function (fx) { 15574 if (!fx.clipInit) { 15575 fx.start = $(fx.elem).cssClip(); 15576 if (typeof fx.end === "string") { 15577 fx.end = parseClip(fx.end, fx.elem); 15578 } 15579 fx.clipInit = true; 15580 } 15581 15582 $(fx.elem).cssClip({ 15583 top: fx.pos * (fx.end.top - fx.start.top) + fx.start.top, 15584 right: fx.pos * (fx.end.right - fx.start.right) + fx.start.right, 15585 bottom: fx.pos * (fx.end.bottom - fx.start.bottom) + fx.start.bottom, 15586 left: fx.pos * (fx.end.left - fx.start.left) + fx.start.left 15587 }); 15588 }; 15589 15590 })(); 15591 15592 /******************************************************************************/ 15593 /*********************************** EASING ***********************************/ 15594 /******************************************************************************/ 15595 15596 (function () { 15597 15598 // Based on easing equations from Robert Penner (http://www.robertpenner.com/easing) 15599 15600 var baseEasings = {}; 15601 15602 $.each(["Quad", "Cubic", "Quart", "Quint", "Expo"], function (i, name) { 15603 baseEasings[name] = function (p) { 15604 return Math.pow(p, i + 2); 15605 }; 15606 }); 15607 15608 $.extend(baseEasings, { 15609 Sine: function (p) { 15610 return 1 - Math.cos(p * Math.PI / 2); 15611 }, 15612 Circ: function (p) { 15613 return 1 - Math.sqrt(1 - p * p); 15614 }, 15615 Elastic: function (p) { 15616 return p === 0 || p === 1 ? p : 15617 -Math.pow(2, 8 * (p - 1)) * Math.sin(((p - 1) * 80 - 7.5) * Math.PI / 15); 15618 }, 15619 Back: function (p) { 15620 return p * p * (3 * p - 2); 15621 }, 15622 Bounce: function (p) { 15623 var pow2, 15624 bounce = 4; 15625 15626 while (p < ((pow2 = Math.pow(2, --bounce)) - 1) / 11) { } 15627 return 1 / Math.pow(4, 3 - bounce) - 7.5625 * Math.pow((pow2 * 3 - 2) / 22 - p, 2); 15628 } 15629 }); 15630 15631 $.each(baseEasings, function (name, easeIn) { 15632 $.easing["easeIn" + name] = easeIn; 15633 $.easing["easeOut" + name] = function (p) { 15634 return 1 - easeIn(1 - p); 15635 }; 15636 $.easing["easeInOut" + name] = function (p) { 15637 return p < 0.5 ? 15638 easeIn(p * 2) / 2 : 15639 1 - easeIn(p * -2 + 2) / 2; 15640 }; 15641 }); 15642 15643 })(); 15644 15645 var effect = $.effects; 15646 15647 15648 /*! 15649 * jQuery UI Effects Blind 1.13.2 15650 * http://jqueryui.com 15651 * 15652 * Copyright jQuery Foundation and other contributors 15653 * Released under the MIT license. 15654 * http://jquery.org/license 15655 */ 15656 15657 //>>label: Blind Effect 15658 //>>group: Effects 15659 //>>description: Blinds the element. 15660 //>>docs: http://api.jqueryui.com/blind-effect/ 15661 //>>demos: http://jqueryui.com/effect/ 15662 15663 15664 var effectsEffectBlind = $.effects.define("blind", "hide", function (options, done) { 15665 var map = { 15666 up: ["bottom", "top"], 15667 vertical: ["bottom", "top"], 15668 down: ["top", "bottom"], 15669 left: ["right", "left"], 15670 horizontal: ["right", "left"], 15671 right: ["left", "right"] 15672 }, 15673 element = $(this), 15674 direction = options.direction || "up", 15675 start = element.cssClip(), 15676 animate = { clip: $.extend({}, start) }, 15677 placeholder = $.effects.createPlaceholder(element); 15678 15679 animate.clip[map[direction][0]] = animate.clip[map[direction][1]]; 15680 15681 if (options.mode === "show") { 15682 element.cssClip(animate.clip); 15683 if (placeholder) { 15684 placeholder.css($.effects.clipToBox(animate)); 15685 } 15686 15687 animate.clip = start; 15688 } 15689 15690 if (placeholder) { 15691 placeholder.animate($.effects.clipToBox(animate), options.duration, options.easing); 15692 } 15693 15694 element.animate(animate, { 15695 queue: false, 15696 duration: options.duration, 15697 easing: options.easing, 15698 complete: done 15699 }); 15700 }); 15701 15702 15703 /*! 15704 * jQuery UI Effects Bounce 1.13.2 15705 * http://jqueryui.com 15706 * 15707 * Copyright jQuery Foundation and other contributors 15708 * Released under the MIT license. 15709 * http://jquery.org/license 15710 */ 15711 15712 //>>label: Bounce Effect 15713 //>>group: Effects 15714 //>>description: Bounces an element horizontally or vertically n times. 15715 //>>docs: http://api.jqueryui.com/bounce-effect/ 15716 //>>demos: http://jqueryui.com/effect/ 15717 15718 15719 var effectsEffectBounce = $.effects.define("bounce", function (options, done) { 15720 var upAnim, downAnim, refValue, 15721 element = $(this), 15722 15723 // Defaults: 15724 mode = options.mode, 15725 hide = mode === "hide", 15726 show = mode === "show", 15727 direction = options.direction || "up", 15728 distance = options.distance, 15729 times = options.times || 5, 15730 15731 // Number of internal animations 15732 anims = times * 2 + (show || hide ? 1 : 0), 15733 speed = options.duration / anims, 15734 easing = options.easing, 15735 15736 // Utility: 15737 ref = (direction === "up" || direction === "down") ? "top" : "left", 15738 motion = (direction === "up" || direction === "left"), 15739 i = 0, 15740 15741 queuelen = element.queue().length; 15742 15743 $.effects.createPlaceholder(element); 15744 15745 refValue = element.css(ref); 15746 15747 // Default distance for the BIGGEST bounce is the outer Distance / 3 15748 if (!distance) { 15749 distance = element[ref === "top" ? "outerHeight" : "outerWidth"]() / 3; 15750 } 15751 15752 if (show) { 15753 downAnim = { opacity: 1 }; 15754 downAnim[ref] = refValue; 15755 15756 // If we are showing, force opacity 0 and set the initial position 15757 // then do the "first" animation 15758 element 15759 .css("opacity", 0) 15760 .css(ref, motion ? -distance * 2 : distance * 2) 15761 .animate(downAnim, speed, easing); 15762 } 15763 15764 // Start at the smallest distance if we are hiding 15765 if (hide) { 15766 distance = distance / Math.pow(2, times - 1); 15767 } 15768 15769 downAnim = {}; 15770 downAnim[ref] = refValue; 15771 15772 // Bounces up/down/left/right then back to 0 -- times * 2 animations happen here 15773 for (; i < times; i++) { 15774 upAnim = {}; 15775 upAnim[ref] = (motion ? "-=" : "+=") + distance; 15776 15777 element 15778 .animate(upAnim, speed, easing) 15779 .animate(downAnim, speed, easing); 15780 15781 distance = hide ? distance * 2 : distance / 2; 15782 } 15783 15784 // Last Bounce when Hiding 15785 if (hide) { 15786 upAnim = { opacity: 0 }; 15787 upAnim[ref] = (motion ? "-=" : "+=") + distance; 15788 15789 element.animate(upAnim, speed, easing); 15790 } 15791 15792 element.queue(done); 15793 15794 $.effects.unshift(element, queuelen, anims + 1); 15795 }); 15796 15797 15798 /*! 15799 * jQuery UI Effects Clip 1.13.2 15800 * http://jqueryui.com 15801 * 15802 * Copyright jQuery Foundation and other contributors 15803 * Released under the MIT license. 15804 * http://jquery.org/license 15805 */ 15806 15807 //>>label: Clip Effect 15808 //>>group: Effects 15809 //>>description: Clips the element on and off like an old TV. 15810 //>>docs: http://api.jqueryui.com/clip-effect/ 15811 //>>demos: http://jqueryui.com/effect/ 15812 15813 15814 var effectsEffectClip = $.effects.define("clip", "hide", function (options, done) { 15815 var start, 15816 animate = {}, 15817 element = $(this), 15818 direction = options.direction || "vertical", 15819 both = direction === "both", 15820 horizontal = both || direction === "horizontal", 15821 vertical = both || direction === "vertical"; 15822 15823 start = element.cssClip(); 15824 animate.clip = { 15825 top: vertical ? (start.bottom - start.top) / 2 : start.top, 15826 right: horizontal ? (start.right - start.left) / 2 : start.right, 15827 bottom: vertical ? (start.bottom - start.top) / 2 : start.bottom, 15828 left: horizontal ? (start.right - start.left) / 2 : start.left 15829 }; 15830 15831 $.effects.createPlaceholder(element); 15832 15833 if (options.mode === "show") { 15834 element.cssClip(animate.clip); 15835 animate.clip = start; 15836 } 15837 15838 element.animate(animate, { 15839 queue: false, 15840 duration: options.duration, 15841 easing: options.easing, 15842 complete: done 15843 }); 15844 15845 }); 15846 15847 15848 /*! 15849 * jQuery UI Effects Drop 1.13.2 15850 * http://jqueryui.com 15851 * 15852 * Copyright jQuery Foundation and other contributors 15853 * Released under the MIT license. 15854 * http://jquery.org/license 15855 */ 15856 15857 //>>label: Drop Effect 15858 //>>group: Effects 15859 //>>description: Moves an element in one direction and hides it at the same time. 15860 //>>docs: http://api.jqueryui.com/drop-effect/ 15861 //>>demos: http://jqueryui.com/effect/ 15862 15863 15864 var effectsEffectDrop = $.effects.define("drop", "hide", function (options, done) { 15865 15866 var distance, 15867 element = $(this), 15868 mode = options.mode, 15869 show = mode === "show", 15870 direction = options.direction || "left", 15871 ref = (direction === "up" || direction === "down") ? "top" : "left", 15872 motion = (direction === "up" || direction === "left") ? "-=" : "+=", 15873 oppositeMotion = (motion === "+=") ? "-=" : "+=", 15874 animation = { 15875 opacity: 0 15876 }; 15877 15878 $.effects.createPlaceholder(element); 15879 15880 distance = options.distance || 15881 element[ref === "top" ? "outerHeight" : "outerWidth"](true) / 2; 15882 15883 animation[ref] = motion + distance; 15884 15885 if (show) { 15886 element.css(animation); 15887 15888 animation[ref] = oppositeMotion + distance; 15889 animation.opacity = 1; 15890 } 15891 15892 // Animate 15893 element.animate(animation, { 15894 queue: false, 15895 duration: options.duration, 15896 easing: options.easing, 15897 complete: done 15898 }); 15899 }); 15900 15901 15902 /*! 15903 * jQuery UI Effects Explode 1.13.2 15904 * http://jqueryui.com 15905 * 15906 * Copyright jQuery Foundation and other contributors 15907 * Released under the MIT license. 15908 * http://jquery.org/license 15909 */ 15910 15911 //>>label: Explode Effect 15912 //>>group: Effects 15913 /* eslint-disable max-len */ 15914 //>>description: Explodes an element in all directions into n pieces. Implodes an element to its original wholeness. 15915 /* eslint-enable max-len */ 15916 //>>docs: http://api.jqueryui.com/explode-effect/ 15917 //>>demos: http://jqueryui.com/effect/ 15918 15919 15920 var effectsEffectExplode = $.effects.define("explode", "hide", function (options, done) { 15921 15922 var i, j, left, top, mx, my, 15923 rows = options.pieces ? Math.round(Math.sqrt(options.pieces)) : 3, 15924 cells = rows, 15925 element = $(this), 15926 mode = options.mode, 15927 show = mode === "show", 15928 15929 // Show and then visibility:hidden the element before calculating offset 15930 offset = element.show().css("visibility", "hidden").offset(), 15931 15932 // Width and height of a piece 15933 width = Math.ceil(element.outerWidth() / cells), 15934 height = Math.ceil(element.outerHeight() / rows), 15935 pieces = []; 15936 15937 // Children animate complete: 15938 function childComplete() { 15939 pieces.push(this); 15940 if (pieces.length === rows * cells) { 15941 animComplete(); 15942 } 15943 } 15944 15945 // Clone the element for each row and cell. 15946 for (i = 0; i < rows; i++) { // ===> 15947 top = offset.top + i * height; 15948 my = i - (rows - 1) / 2; 15949 15950 for (j = 0; j < cells; j++) { // ||| 15951 left = offset.left + j * width; 15952 mx = j - (cells - 1) / 2; 15953 15954 // Create a clone of the now hidden main element that will be absolute positioned 15955 // within a wrapper div off the -left and -top equal to size of our pieces 15956 element 15957 .clone() 15958 .appendTo("body") 15959 .wrap("<div></div>") 15960 .css({ 15961 position: "absolute", 15962 visibility: "visible", 15963 left: -j * width, 15964 top: -i * height 15965 }) 15966 15967 // Select the wrapper - make it overflow: hidden and absolute positioned based on 15968 // where the original was located +left and +top equal to the size of pieces 15969 .parent() 15970 .addClass("ui-effects-explode") 15971 .css({ 15972 position: "absolute", 15973 overflow: "hidden", 15974 width: width, 15975 height: height, 15976 left: left + (show ? mx * width : 0), 15977 top: top + (show ? my * height : 0), 15978 opacity: show ? 0 : 1 15979 }) 15980 .animate({ 15981 left: left + (show ? 0 : mx * width), 15982 top: top + (show ? 0 : my * height), 15983 opacity: show ? 1 : 0 15984 }, options.duration || 500, options.easing, childComplete); 15985 } 15986 } 15987 15988 function animComplete() { 15989 element.css({ 15990 visibility: "visible" 15991 }); 15992 $(pieces).remove(); 15993 done(); 15994 } 15995 }); 15996 15997 15998 /*! 15999 * jQuery UI Effects Fade 1.13.2 16000 * http://jqueryui.com 16001 * 16002 * Copyright jQuery Foundation and other contributors 16003 * Released under the MIT license. 16004 * http://jquery.org/license 16005 */ 16006 16007 //>>label: Fade Effect 16008 //>>group: Effects 16009 //>>description: Fades the element. 16010 //>>docs: http://api.jqueryui.com/fade-effect/ 16011 //>>demos: http://jqueryui.com/effect/ 16012 16013 16014 var effectsEffectFade = $.effects.define("fade", "toggle", function (options, done) { 16015 var show = options.mode === "show"; 16016 16017 $(this) 16018 .css("opacity", show ? 0 : 1) 16019 .animate({ 16020 opacity: show ? 1 : 0 16021 }, { 16022 queue: false, 16023 duration: options.duration, 16024 easing: options.easing, 16025 complete: done 16026 }); 16027 }); 16028 16029 16030 /*! 16031 * jQuery UI Effects Fold 1.13.2 16032 * http://jqueryui.com 16033 * 16034 * Copyright jQuery Foundation and other contributors 16035 * Released under the MIT license. 16036 * http://jquery.org/license 16037 */ 16038 16039 //>>label: Fold Effect 16040 //>>group: Effects 16041 //>>description: Folds an element first horizontally and then vertically. 16042 //>>docs: http://api.jqueryui.com/fold-effect/ 16043 //>>demos: http://jqueryui.com/effect/ 16044 16045 16046 var effectsEffectFold = $.effects.define("fold", "hide", function (options, done) { 16047 16048 // Create element 16049 var element = $(this), 16050 mode = options.mode, 16051 show = mode === "show", 16052 hide = mode === "hide", 16053 size = options.size || 15, 16054 percent = /([0-9]+)%/.exec(size), 16055 horizFirst = !!options.horizFirst, 16056 ref = horizFirst ? ["right", "bottom"] : ["bottom", "right"], 16057 duration = options.duration / 2, 16058 16059 placeholder = $.effects.createPlaceholder(element), 16060 16061 start = element.cssClip(), 16062 animation1 = { clip: $.extend({}, start) }, 16063 animation2 = { clip: $.extend({}, start) }, 16064 16065 distance = [start[ref[0]], start[ref[1]]], 16066 16067 queuelen = element.queue().length; 16068 16069 if (percent) { 16070 size = parseInt(percent[1], 10) / 100 * distance[hide ? 0 : 1]; 16071 } 16072 animation1.clip[ref[0]] = size; 16073 animation2.clip[ref[0]] = size; 16074 animation2.clip[ref[1]] = 0; 16075 16076 if (show) { 16077 element.cssClip(animation2.clip); 16078 if (placeholder) { 16079 placeholder.css($.effects.clipToBox(animation2)); 16080 } 16081 16082 animation2.clip = start; 16083 } 16084 16085 // Animate 16086 element 16087 .queue(function (next) { 16088 if (placeholder) { 16089 placeholder 16090 .animate($.effects.clipToBox(animation1), duration, options.easing) 16091 .animate($.effects.clipToBox(animation2), duration, options.easing); 16092 } 16093 16094 next(); 16095 }) 16096 .animate(animation1, duration, options.easing) 16097 .animate(animation2, duration, options.easing) 16098 .queue(done); 16099 16100 $.effects.unshift(element, queuelen, 4); 16101 }); 16102 16103 16104 /*! 16105 * jQuery UI Effects Highlight 1.13.2 16106 * http://jqueryui.com 16107 * 16108 * Copyright jQuery Foundation and other contributors 16109 * Released under the MIT license. 16110 * http://jquery.org/license 16111 */ 16112 16113 //>>label: Highlight Effect 16114 //>>group: Effects 16115 //>>description: Highlights the background of an element in a defined color for a custom duration. 16116 //>>docs: http://api.jqueryui.com/highlight-effect/ 16117 //>>demos: http://jqueryui.com/effect/ 16118 16119 16120 var effectsEffectHighlight = $.effects.define("highlight", "show", function (options, done) { 16121 var element = $(this), 16122 animation = { 16123 backgroundColor: element.css("backgroundColor") 16124 }; 16125 16126 if (options.mode === "hide") { 16127 animation.opacity = 0; 16128 } 16129 16130 $.effects.saveStyle(element); 16131 16132 element 16133 .css({ 16134 backgroundImage: "none", 16135 backgroundColor: options.color || "#ffff99" 16136 }) 16137 .animate(animation, { 16138 queue: false, 16139 duration: options.duration, 16140 easing: options.easing, 16141 complete: done 16142 }); 16143 }); 16144 16145 16146 /*! 16147 * jQuery UI Effects Size 1.13.2 16148 * http://jqueryui.com 16149 * 16150 * Copyright jQuery Foundation and other contributors 16151 * Released under the MIT license. 16152 * http://jquery.org/license 16153 */ 16154 16155 //>>label: Size Effect 16156 //>>group: Effects 16157 //>>description: Resize an element to a specified width and height. 16158 //>>docs: http://api.jqueryui.com/size-effect/ 16159 //>>demos: http://jqueryui.com/effect/ 16160 16161 16162 var effectsEffectSize = $.effects.define("size", function (options, done) { 16163 16164 // Create element 16165 var baseline, factor, temp, 16166 element = $(this), 16167 16168 // Copy for children 16169 cProps = ["fontSize"], 16170 vProps = ["borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom"], 16171 hProps = ["borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight"], 16172 16173 // Set options 16174 mode = options.mode, 16175 restore = mode !== "effect", 16176 scale = options.scale || "both", 16177 origin = options.origin || ["middle", "center"], 16178 position = element.css("position"), 16179 pos = element.position(), 16180 original = $.effects.scaledDimensions(element), 16181 from = options.from || original, 16182 to = options.to || $.effects.scaledDimensions(element, 0); 16183 16184 $.effects.createPlaceholder(element); 16185 16186 if (mode === "show") { 16187 temp = from; 16188 from = to; 16189 to = temp; 16190 } 16191 16192 // Set scaling factor 16193 factor = { 16194 from: { 16195 y: from.height / original.height, 16196 x: from.width / original.width 16197 }, 16198 to: { 16199 y: to.height / original.height, 16200 x: to.width / original.width 16201 } 16202 }; 16203 16204 // Scale the css box 16205 if (scale === "box" || scale === "both") { 16206 16207 // Vertical props scaling 16208 if (factor.from.y !== factor.to.y) { 16209 from = $.effects.setTransition(element, vProps, factor.from.y, from); 16210 to = $.effects.setTransition(element, vProps, factor.to.y, to); 16211 } 16212 16213 // Horizontal props scaling 16214 if (factor.from.x !== factor.to.x) { 16215 from = $.effects.setTransition(element, hProps, factor.from.x, from); 16216 to = $.effects.setTransition(element, hProps, factor.to.x, to); 16217 } 16218 } 16219 16220 // Scale the content 16221 if (scale === "content" || scale === "both") { 16222 16223 // Vertical props scaling 16224 if (factor.from.y !== factor.to.y) { 16225 from = $.effects.setTransition(element, cProps, factor.from.y, from); 16226 to = $.effects.setTransition(element, cProps, factor.to.y, to); 16227 } 16228 } 16229 16230 // Adjust the position properties based on the provided origin points 16231 if (origin) { 16232 baseline = $.effects.getBaseline(origin, original); 16233 from.top = (original.outerHeight - from.outerHeight) * baseline.y + pos.top; 16234 from.left = (original.outerWidth - from.outerWidth) * baseline.x + pos.left; 16235 to.top = (original.outerHeight - to.outerHeight) * baseline.y + pos.top; 16236 to.left = (original.outerWidth - to.outerWidth) * baseline.x + pos.left; 16237 } 16238 delete from.outerHeight; 16239 delete from.outerWidth; 16240 element.css(from); 16241 16242 // Animate the children if desired 16243 if (scale === "content" || scale === "both") { 16244 16245 vProps = vProps.concat(["marginTop", "marginBottom"]).concat(cProps); 16246 hProps = hProps.concat(["marginLeft", "marginRight"]); 16247 16248 // Only animate children with width attributes specified 16249 // TODO: is this right? should we include anything with css width specified as well 16250 element.find("*[width]").each(function () { 16251 var child = $(this), 16252 childOriginal = $.effects.scaledDimensions(child), 16253 childFrom = { 16254 height: childOriginal.height * factor.from.y, 16255 width: childOriginal.width * factor.from.x, 16256 outerHeight: childOriginal.outerHeight * factor.from.y, 16257 outerWidth: childOriginal.outerWidth * factor.from.x 16258 }, 16259 childTo = { 16260 height: childOriginal.height * factor.to.y, 16261 width: childOriginal.width * factor.to.x, 16262 outerHeight: childOriginal.height * factor.to.y, 16263 outerWidth: childOriginal.width * factor.to.x 16264 }; 16265 16266 // Vertical props scaling 16267 if (factor.from.y !== factor.to.y) { 16268 childFrom = $.effects.setTransition(child, vProps, factor.from.y, childFrom); 16269 childTo = $.effects.setTransition(child, vProps, factor.to.y, childTo); 16270 } 16271 16272 // Horizontal props scaling 16273 if (factor.from.x !== factor.to.x) { 16274 childFrom = $.effects.setTransition(child, hProps, factor.from.x, childFrom); 16275 childTo = $.effects.setTransition(child, hProps, factor.to.x, childTo); 16276 } 16277 16278 if (restore) { 16279 $.effects.saveStyle(child); 16280 } 16281 16282 // Animate children 16283 child.css(childFrom); 16284 child.animate(childTo, options.duration, options.easing, function () { 16285 16286 // Restore children 16287 if (restore) { 16288 $.effects.restoreStyle(child); 16289 } 16290 }); 16291 }); 16292 } 16293 16294 // Animate 16295 element.animate(to, { 16296 queue: false, 16297 duration: options.duration, 16298 easing: options.easing, 16299 complete: function () { 16300 16301 var offset = element.offset(); 16302 16303 if (to.opacity === 0) { 16304 element.css("opacity", from.opacity); 16305 } 16306 16307 if (!restore) { 16308 element 16309 .css("position", position === "static" ? "relative" : position) 16310 .offset(offset); 16311 16312 // Need to save style here so that automatic style restoration 16313 // doesn't restore to the original styles from before the animation. 16314 $.effects.saveStyle(element); 16315 } 16316 16317 done(); 16318 } 16319 }); 16320 16321 }); 16322 16323 16324 /*! 16325 * jQuery UI Effects Scale 1.13.2 16326 * http://jqueryui.com 16327 * 16328 * Copyright jQuery Foundation and other contributors 16329 * Released under the MIT license. 16330 * http://jquery.org/license 16331 */ 16332 16333 //>>label: Scale Effect 16334 //>>group: Effects 16335 //>>description: Grows or shrinks an element and its content. 16336 //>>docs: http://api.jqueryui.com/scale-effect/ 16337 //>>demos: http://jqueryui.com/effect/ 16338 16339 16340 var effectsEffectScale = $.effects.define("scale", function (options, done) { 16341 16342 // Create element 16343 var el = $(this), 16344 mode = options.mode, 16345 percent = parseInt(options.percent, 10) || 16346 (parseInt(options.percent, 10) === 0 ? 0 : (mode !== "effect" ? 0 : 100)), 16347 16348 newOptions = $.extend(true, { 16349 from: $.effects.scaledDimensions(el), 16350 to: $.effects.scaledDimensions(el, percent, options.direction || "both"), 16351 origin: options.origin || ["middle", "center"] 16352 }, options); 16353 16354 // Fade option to support puff 16355 if (options.fade) { 16356 newOptions.from.opacity = 1; 16357 newOptions.to.opacity = 0; 16358 } 16359 16360 $.effects.effect.size.call(this, newOptions, done); 16361 }); 16362 16363 16364 /*! 16365 * jQuery UI Effects Puff 1.13.2 16366 * http://jqueryui.com 16367 * 16368 * Copyright jQuery Foundation and other contributors 16369 * Released under the MIT license. 16370 * http://jquery.org/license 16371 */ 16372 16373 //>>label: Puff Effect 16374 //>>group: Effects 16375 //>>description: Creates a puff effect by scaling the element up and hiding it at the same time. 16376 //>>docs: http://api.jqueryui.com/puff-effect/ 16377 //>>demos: http://jqueryui.com/effect/ 16378 16379 16380 var effectsEffectPuff = $.effects.define("puff", "hide", function (options, done) { 16381 var newOptions = $.extend(true, {}, options, { 16382 fade: true, 16383 percent: parseInt(options.percent, 10) || 150 16384 }); 16385 16386 $.effects.effect.scale.call(this, newOptions, done); 16387 }); 16388 16389 16390 /*! 16391 * jQuery UI Effects Pulsate 1.13.2 16392 * http://jqueryui.com 16393 * 16394 * Copyright jQuery Foundation and other contributors 16395 * Released under the MIT license. 16396 * http://jquery.org/license 16397 */ 16398 16399 //>>label: Pulsate Effect 16400 //>>group: Effects 16401 //>>description: Pulsates an element n times by changing the opacity to zero and back. 16402 //>>docs: http://api.jqueryui.com/pulsate-effect/ 16403 //>>demos: http://jqueryui.com/effect/ 16404 16405 16406 var effectsEffectPulsate = $.effects.define("pulsate", "show", function (options, done) { 16407 var element = $(this), 16408 mode = options.mode, 16409 show = mode === "show", 16410 hide = mode === "hide", 16411 showhide = show || hide, 16412 16413 // Showing or hiding leaves off the "last" animation 16414 anims = ((options.times || 5) * 2) + (showhide ? 1 : 0), 16415 duration = options.duration / anims, 16416 animateTo = 0, 16417 i = 1, 16418 queuelen = element.queue().length; 16419 16420 if (show || !element.is(":visible")) { 16421 element.css("opacity", 0).show(); 16422 animateTo = 1; 16423 } 16424 16425 // Anims - 1 opacity "toggles" 16426 for (; i < anims; i++) { 16427 element.animate({ opacity: animateTo }, duration, options.easing); 16428 animateTo = 1 - animateTo; 16429 } 16430 16431 element.animate({ opacity: animateTo }, duration, options.easing); 16432 16433 element.queue(done); 16434 16435 $.effects.unshift(element, queuelen, anims + 1); 16436 }); 16437 16438 16439 /*! 16440 * jQuery UI Effects Shake 1.13.2 16441 * http://jqueryui.com 16442 * 16443 * Copyright jQuery Foundation and other contributors 16444 * Released under the MIT license. 16445 * http://jquery.org/license 16446 */ 16447 16448 //>>label: Shake Effect 16449 //>>group: Effects 16450 //>>description: Shakes an element horizontally or vertically n times. 16451 //>>docs: http://api.jqueryui.com/shake-effect/ 16452 //>>demos: http://jqueryui.com/effect/ 16453 16454 16455 var effectsEffectShake = $.effects.define("shake", function (options, done) { 16456 16457 var i = 1, 16458 element = $(this), 16459 direction = options.direction || "left", 16460 distance = options.distance || 20, 16461 times = options.times || 3, 16462 anims = times * 2 + 1, 16463 speed = Math.round(options.duration / anims), 16464 ref = (direction === "up" || direction === "down") ? "top" : "left", 16465 positiveMotion = (direction === "up" || direction === "left"), 16466 animation = {}, 16467 animation1 = {}, 16468 animation2 = {}, 16469 16470 queuelen = element.queue().length; 16471 16472 $.effects.createPlaceholder(element); 16473 16474 // Animation 16475 animation[ref] = (positiveMotion ? "-=" : "+=") + distance; 16476 animation1[ref] = (positiveMotion ? "+=" : "-=") + distance * 2; 16477 animation2[ref] = (positiveMotion ? "-=" : "+=") + distance * 2; 16478 16479 // Animate 16480 element.animate(animation, speed, options.easing); 16481 16482 // Shakes 16483 for (; i < times; i++) { 16484 element 16485 .animate(animation1, speed, options.easing) 16486 .animate(animation2, speed, options.easing); 16487 } 16488 16489 element 16490 .animate(animation1, speed, options.easing) 16491 .animate(animation, speed / 2, options.easing) 16492 .queue(done); 16493 16494 $.effects.unshift(element, queuelen, anims + 1); 16495 }); 16496 16497 16498 /*! 16499 * jQuery UI Effects Slide 1.13.2 16500 * http://jqueryui.com
vendor: 19,239 bytes, lines 16501-17227
16501 * 16502 * Copyright jQuery Foundation and other contributors 16503 * Released under the MIT license. 16504 * http://jquery.org/license 16505 */ 16506 16507 //>>label: Slide Effect 16508 //>>group: Effects 16509 //>>description: Slides an element in and out of the viewport. 16510 //>>docs: http://api.jqueryui.com/slide-effect/ 16511 //>>demos: http://jqueryui.com/effect/ 16512 16513 16514 var effectsEffectSlide = $.effects.define("slide", "show", function (options, done) { 16515 var startClip, startRef, 16516 element = $(this), 16517 map = { 16518 up: ["bottom", "top"], 16519 down: ["top", "bottom"], 16520 left: ["right", "left"], 16521 right: ["left", "right"] 16522 }, 16523 mode = options.mode, 16524 direction = options.direction || "left", 16525 ref = (direction === "up" || direction === "down") ? "top" : "left", 16526 positiveMotion = (direction === "up" || direction === "left"), 16527 distance = options.distance || 16528 element[ref === "top" ? "outerHeight" : "outerWidth"](true), 16529 animation = {}; 16530 16531 $.effects.createPlaceholder(element); 16532 16533 startClip = element.cssClip(); 16534 startRef = element.position()[ref]; 16535 16536 // Define hide animation 16537 animation[ref] = (positiveMotion ? -1 : 1) * distance + startRef; 16538 animation.clip = element.cssClip(); 16539 animation.clip[map[direction][1]] = animation.clip[map[direction][0]]; 16540 16541 // Reverse the animation if we're showing 16542 if (mode === "show") { 16543 element.cssClip(animation.clip); 16544 element.css(ref, animation[ref]); 16545 animation.clip = startClip; 16546 animation[ref] = startRef; 16547 } 16548 16549 // Actually animate 16550 element.animate(animation, { 16551 queue: false, 16552 duration: options.duration, 16553 easing: options.easing, 16554 complete: done 16555 }); 16556 }); 16557 16558 16559 /*! 16560 * jQuery UI Effects Transfer 1.13.2 16561 * http://jqueryui.com 16562 * 16563 * Copyright jQuery Foundation and other contributors 16564 * Released under the MIT license. 16565 * http://jquery.org/license 16566 */ 16567 16568 //>>label: Transfer Effect 16569 //>>group: Effects 16570 //>>description: Displays a transfer effect from one element to another. 16571 //>>docs: http://api.jqueryui.com/transfer-effect/ 16572 //>>demos: http://jqueryui.com/effect/ 16573 16574 16575 var effect; 16576 if ($.uiBackCompat !== false) { 16577 effect = $.effects.define("transfer", function (options, done) { 16578 $(this).transfer(options, done); 16579 }); 16580 } 16581 var effectsEffectTransfer = effect; 16582 16583 16584 /*! 16585 * jQuery UI Focusable 1.13.2 16586 * http://jqueryui.com 16587 * 16588 * Copyright jQuery Foundation and other contributors 16589 * Released under the MIT license. 16590 * http://jquery.org/license 16591 */ 16592 16593 //>>label: :focusable Selector 16594 //>>group: Core 16595 //>>description: Selects elements which can be focused. 16596 //>>docs: http://api.jqueryui.com/focusable-selector/ 16597 16598 16599 // Selectors 16600 $.ui.focusable = function (element, hasTabindex) { 16601 var map, mapName, img, focusableIfVisible, fieldset, 16602 nodeName = element.nodeName.toLowerCase(); 16603 16604 if ("area" === nodeName) { 16605 map = element.parentNode; 16606 mapName = map.name; 16607 if (!element.href || !mapName || map.nodeName.toLowerCase() !== "map") { 16608 return false; 16609 } 16610 img = $("img[usemap='#" + mapName + "']"); 16611 return img.length > 0 && img.is(":visible"); 16612 } 16613 16614 if (/^(input|select|textarea|button|object)$/.test(nodeName)) { 16615 focusableIfVisible = !element.disabled; 16616 16617 if (focusableIfVisible) { 16618 16619 // Form controls within a disabled fieldset are disabled. 16620 // However, controls within the fieldset's legend do not get disabled. 16621 // Since controls generally aren't placed inside legends, we skip 16622 // this portion of the check. 16623 fieldset = $(element).closest("fieldset")[0]; 16624 if (fieldset) { 16625 focusableIfVisible = !fieldset.disabled; 16626 } 16627 } 16628 } else if ("a" === nodeName) { 16629 focusableIfVisible = element.href || hasTabindex; 16630 } else { 16631 focusableIfVisible = hasTabindex; 16632 } 16633 16634 return focusableIfVisible && $(element).is(":visible") && visible($(element)); 16635 }; 16636 16637 // Support: IE 8 only 16638 // IE 8 doesn't resolve inherit to visible/hidden for computed values 16639 function visible(element) { 16640 var visibility = element.css("visibility"); 16641 while (visibility === "inherit") { 16642 element = element.parent(); 16643 visibility = element.css("visibility"); 16644 } 16645 return visibility === "visible"; 16646 } 16647 16648 $.extend($.expr.pseudos, { 16649 focusable: function (element) { 16650 return $.ui.focusable(element, $.attr(element, "tabindex") != null); 16651 } 16652 }); 16653 16654 var focusable = $.ui.focusable; 16655 16656 16657 16658 // Support: IE8 Only 16659 // IE8 does not support the form attribute and when it is supplied. It overwrites the form prop 16660 // with a string, so we need to find the proper form. 16661 var form = $.fn._form = function () { 16662 return typeof this[0].form === "string" ? this.closest("form") : $(this[0].form); 16663 }; 16664 16665 16666 /*! 16667 * jQuery UI Form Reset Mixin 1.13.2 16668 * http://jqueryui.com 16669 * 16670 * Copyright jQuery Foundation and other contributors 16671 * Released under the MIT license. 16672 * http://jquery.org/license 16673 */ 16674 16675 //>>label: Form Reset Mixin 16676 //>>group: Core 16677 //>>description: Refresh input widgets when their form is reset 16678 //>>docs: http://api.jqueryui.com/form-reset-mixin/ 16679 16680 16681 var formResetMixin = $.ui.formResetMixin = { 16682 _formResetHandler: function () { 16683 var form = $(this); 16684 16685 // Wait for the form reset to actually happen before refreshing 16686 setTimeout(function () { 16687 var instances = form.data("ui-form-reset-instances"); 16688 $.each(instances, function () { 16689 this.refresh(); 16690 }); 16691 }); 16692 }, 16693 16694 _bindFormResetHandler: function () { 16695 this.form = this.element._form(); 16696 if (!this.form.length) { 16697 return; 16698 } 16699 16700 var instances = this.form.data("ui-form-reset-instances") || []; 16701 if (!instances.length) { 16702 16703 // We don't use _on() here because we use a single event handler per form 16704 this.form.on("reset.ui-form-reset", this._formResetHandler); 16705 } 16706 instances.push(this); 16707 this.form.data("ui-form-reset-instances", instances); 16708 }, 16709 16710 _unbindFormResetHandler: function () { 16711 if (!this.form.length) { 16712 return; 16713 } 16714 16715 var instances = this.form.data("ui-form-reset-instances"); 16716 instances.splice($.inArray(this, instances), 1); 16717 if (instances.length) { 16718 this.form.data("ui-form-reset-instances", instances); 16719 } else { 16720 this.form 16721 .removeData("ui-form-reset-instances") 16722 .off("reset.ui-form-reset"); 16723 } 16724 } 16725 }; 16726 16727 16728 /*! 16729 * jQuery UI Support for jQuery core 1.8.x and newer 1.13.2 16730 * http://jqueryui.com 16731 * 16732 * Copyright jQuery Foundation and other contributors 16733 * Released under the MIT license. 16734 * http://jquery.org/license 16735 * 16736 */ 16737 16738 //>>label: jQuery 1.8+ Support 16739 //>>group: Core 16740 //>>description: Support version 1.8.x and newer of jQuery core 16741 16742 16743 // Support: jQuery 1.9.x or older 16744 // $.expr[ ":" ] is deprecated. 16745 if (!$.expr.pseudos) { 16746 $.expr.pseudos = $.expr[":"]; 16747 } 16748 16749 // Support: jQuery 1.11.x or older 16750 // $.unique has been renamed to $.uniqueSort 16751 if (!$.uniqueSort) { 16752 $.uniqueSort = $.unique; 16753 } 16754 16755 // Support: jQuery 2.2.x or older. 16756 // This method has been defined in jQuery 3.0.0. 16757 // Code from https://github.com/jquery/jquery/blob/e539bac79e666bba95bba86d690b4e609dca2286/src/selector/escapeSelector.js 16758 if (!$.escapeSelector) { 16759 16760 // CSS string/identifier serialization 16761 // https://drafts.csswg.org/cssom/#common-serializing-idioms 16762 var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g; 16763 16764 var fcssescape = function (ch, asCodePoint) { 16765 if (asCodePoint) { 16766 16767 // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER 16768 if (ch === "\0") { 16769 return "\uFFFD"; 16770 } 16771 16772 // Control characters and (dependent upon position) numbers get escaped as code points 16773 return ch.slice(0, -1) + "\\" + ch.charCodeAt(ch.length - 1).toString(16) + " "; 16774 } 16775 16776 // Other potentially-special ASCII characters get backslash-escaped 16777 return "\\" + ch; 16778 }; 16779 16780 $.escapeSelector = function (sel) { 16781 return (sel + "").replace(rcssescape, fcssescape); 16782 }; 16783 } 16784 16785 // Support: jQuery 3.4.x or older 16786 // These methods have been defined in jQuery 3.5.0. 16787 if (!$.fn.even || !$.fn.odd) { 16788 $.fn.extend({ 16789 even: function () { 16790 return this.filter(function (i) { 16791 return i % 2 === 0; 16792 }); 16793 }, 16794 odd: function () { 16795 return this.filter(function (i) { 16796 return i % 2 === 1; 16797 }); 16798 } 16799 }); 16800 } 16801 16802 ; 16803 /*! 16804 * jQuery UI Keycode 1.13.2 16805 * http://jqueryui.com 16806 * 16807 * Copyright jQuery Foundation and other contributors 16808 * Released under the MIT license. 16809 * http://jquery.org/license 16810 */ 16811 16812 //>>label: Keycode 16813 //>>group: Core 16814 //>>description: Provide keycodes as keynames 16815 //>>docs: http://api.jqueryui.com/jQuery.ui.keyCode/ 16816 16817 16818 var keycode = $.ui.keyCode = { 16819 BACKSPACE: 8, 16820 COMMA: 188, 16821 DELETE: 46, 16822 DOWN: 40, 16823 END: 35, 16824 ENTER: 13, 16825 ESCAPE: 27, 16826 HOME: 36, 16827 LEFT: 37, 16828 PAGE_DOWN: 34, 16829 PAGE_UP: 33, 16830 PERIOD: 190, 16831 RIGHT: 39, 16832 SPACE: 32, 16833 TAB: 9, 16834 UP: 38 16835 }; 16836 16837 16838 /*! 16839 * jQuery UI Labels 1.13.2 16840 * http://jqueryui.com 16841 * 16842 * Copyright jQuery Foundation and other contributors 16843 * Released under the MIT license. 16844 * http://jquery.org/license 16845 */ 16846 16847 //>>label: labels 16848 //>>group: Core 16849 //>>description: Find all the labels associated with a given input 16850 //>>docs: http://api.jqueryui.com/labels/ 16851 16852 16853 var labels = $.fn.labels = function () { 16854 var ancestor, selector, id, labels, ancestors; 16855 16856 if (!this.length) { 16857 return this.pushStack([]); 16858 } 16859 16860 // Check control.labels first 16861 if (this[0].labels && this[0].labels.length) { 16862 return this.pushStack(this[0].labels); 16863 } 16864 16865 // Support: IE <= 11, FF <= 37, Android <= 2.3 only 16866 // Above browsers do not support control.labels. Everything below is to support them 16867 // as well as document fragments. control.labels does not work on document fragments 16868 labels = this.eq(0).parents("label"); 16869 16870 // Look for the label based on the id 16871 id = this.attr("id"); 16872 if (id) { 16873 16874 // We don't search against the document in case the element 16875 // is disconnected from the DOM 16876 ancestor = this.eq(0).parents().last(); 16877 16878 // Get a full set of top level ancestors 16879 ancestors = ancestor.add(ancestor.length ? ancestor.siblings() : this.siblings()); 16880 16881 // Create a selector for the label based on the id 16882 selector = "label[for='" + $.escapeSelector(id) + "']"; 16883 16884 labels = labels.add(ancestors.find(selector).addBack(selector)); 16885 16886 } 16887 16888 // Return whatever we have found for labels 16889 return this.pushStack(labels); 16890 }; 16891 16892 16893 /*! 16894 * jQuery UI Scroll Parent 1.13.2 16895 * http://jqueryui.com 16896 * 16897 * Copyright jQuery Foundation and other contributors 16898 * Released under the MIT license. 16899 * http://jquery.org/license 16900 */ 16901 16902 //>>label: scrollParent 16903 //>>group: Core 16904 //>>description: Get the closest ancestor element that is scrollable. 16905 //>>docs: http://api.jqueryui.com/scrollParent/ 16906 16907 16908 var scrollParent = $.fn.scrollParent = function (includeHidden) { 16909 var position = this.css("position"), 16910 excludeStaticParent = position === "absolute", 16911 overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/, 16912 scrollParent = this.parents().filter(function () { 16913 var parent = $(this); 16914 if (excludeStaticParent && parent.css("position") === "static") { 16915 return false; 16916 } 16917 return overflowRegex.test(parent.css("overflow") + parent.css("overflow-y") + 16918 parent.css("overflow-x")); 16919 }).eq(0); 16920 16921 return position === "fixed" || !scrollParent.length ? 16922 $(this[0].ownerDocument || document) : 16923 scrollParent; 16924 }; 16925 16926 16927 /*! 16928 * jQuery UI Tabbable 1.13.2 16929 * http://jqueryui.com 16930 * 16931 * Copyright jQuery Foundation and other contributors 16932 * Released under the MIT license. 16933 * http://jquery.org/license 16934 */ 16935 16936 //>>label: :tabbable Selector 16937 //>>group: Core 16938 //>>description: Selects elements which can be tabbed to. 16939 //>>docs: http://api.jqueryui.com/tabbable-selector/ 16940 16941 16942 var tabbable = $.extend($.expr.pseudos, { 16943 tabbable: function (element) { 16944 var tabIndex = $.attr(element, "tabindex"), 16945 hasTabindex = tabIndex != null; 16946 return (!hasTabindex || tabIndex >= 0) && $.ui.focusable(element, hasTabindex); 16947 } 16948 }); 16949 16950 16951 /*! 16952 * jQuery UI Unique ID 1.13.2 16953 * http://jqueryui.com 16954 * 16955 * Copyright jQuery Foundation and other contributors 16956 * Released under the MIT license. 16957 * http://jquery.org/license 16958 */ 16959 16960 //>>label: uniqueId 16961 //>>group: Core 16962 //>>description: Functions to generate and remove uniqueId's 16963 //>>docs: http://api.jqueryui.com/uniqueId/ 16964 16965 16966 var uniqueId = $.fn.extend({ 16967 uniqueId: (function () { 16968 var uuid = 0; 16969 16970 return function () { 16971 return this.each(function () { 16972 if (!this.id) { 16973 this.id = "ui-id-" + (++uuid); 16974 } 16975 }); 16976 }; 16977 })(), 16978 16979 removeUniqueId: function () { 16980 return this.each(function () { 16981 if (/^ui-id-\d+$/.test(this.id)) { 16982 $(this).removeAttr("id"); 16983 } 16984 }); 16985 } 16986 }); 16987 16988 16989 /*! 16990 * jQuery UI Accordion 1.13.2 16991 * http://jqueryui.com 16992 * 16993 * Copyright jQuery Foundation and other contributors 16994 * Released under the MIT license. 16995 * http://jquery.org/license 16996 */ 16997 16998 //>>label: Accordion 16999 //>>group: Widgets 17000 /* eslint-disable max-len */ 17001 //>>description: Displays collapsible content panels for presenting information in a limited amount of space. 17002 /* eslint-enable max-len */ 17003 //>>docs: http://api.jqueryui.com/accordion/ 17004 //>>demos: http://jqueryui.com/accordion/ 17005 //>>css.structure: ../../themes/base/core.css 17006 //>>css.structure: ../../themes/base/accordion.css 17007 //>>css.theme: ../../themes/base/theme.css 17008 17009 17010 var widgetsAccordion = $.widget("ui.accordion", { 17011 version: "1.13.2", 17012 options: { 17013 active: 0, 17014 animate: {}, 17015 classes: { 17016 "ui-accordion-header": "ui-corner-top", 17017 "ui-accordion-header-collapsed": "ui-corner-all", 17018 "ui-accordion-content": "ui-corner-bottom" 17019 }, 17020 collapsible: false, 17021 event: "click", 17022 header: function (elem) { 17023 return elem.find("> li > :first-child").add(elem.find("> :not(li)").even()); 17024 }, 17025 heightStyle: "auto", 17026 icons: { 17027 activeHeader: "ui-icon-triangle-1-s", 17028 header: "ui-icon-triangle-1-e" 17029 }, 17030 17031 // Callbacks 17032 activate: null, 17033 beforeActivate: null 17034 }, 17035 17036 hideProps: { 17037 borderTopWidth: "hide", 17038 borderBottomWidth: "hide", 17039 paddingTop: "hide", 17040 paddingBottom: "hide", 17041 height: "hide" 17042 }, 17043 17044 showProps: { 17045 borderTopWidth: "show", 17046 borderBottomWidth: "show", 17047 paddingTop: "show", 17048 paddingBottom: "show", 17049 height: "show" 17050 }, 17051 17052 _create: function () { 17053 var options = this.options; 17054 17055 this.prevShow = this.prevHide = $(); 17056 this._addClass("ui-accordion", "ui-widget ui-helper-reset"); 17057 this.element.attr("role", "tablist"); 17058 17059 // Don't allow collapsible: false and active: false / null 17060 if (!options.collapsible && (options.active === false || options.active == null)) { 17061 options.active = 0; 17062 } 17063 17064 this._processPanels(); 17065 17066 // handle negative values 17067 if (options.active < 0) { 17068 options.active += this.headers.length; 17069 } 17070 this._refresh(); 17071 }, 17072 17073 _getCreateEventData: function () { 17074 return { 17075 header: this.active, 17076 panel: !this.active.length ? $() : this.active.next() 17077 }; 17078 }, 17079 17080 _createIcons: function () { 17081 var icon, children, 17082 icons = this.options.icons; 17083 17084 if (icons) { 17085 icon = $("<span>"); 17086 this._addClass(icon, "ui-accordion-header-icon", "ui-icon " + icons.header); 17087 icon.prependTo(this.headers); 17088 children = this.active.children(".ui-accordion-header-icon"); 17089 this._removeClass(children, icons.header) 17090 ._addClass(children, null, icons.activeHeader) 17091 ._addClass(this.headers, "ui-accordion-icons"); 17092 } 17093 }, 17094 17095 _destroyIcons: function () { 17096 this._removeClass(this.headers, "ui-accordion-icons"); 17097 this.headers.children(".ui-accordion-header-icon").remove(); 17098 }, 17099 17100 _destroy: function () { 17101 var contents; 17102 17103 // Clean up main element 17104 this.element.removeAttr("role"); 17105 17106 // Clean up headers 17107 this.headers 17108 .removeAttr("role aria-expanded aria-selected aria-controls tabIndex") 17109 .removeUniqueId(); 17110 17111 this._destroyIcons(); 17112 17113 // Clean up content panels 17114 contents = this.headers.next() 17115 .css("display", "") 17116 .removeAttr("role aria-hidden aria-labelledby") 17117 .removeUniqueId(); 17118 17119 if (this.options.heightStyle !== "content") { 17120 contents.css("height", ""); 17121 } 17122 }, 17123 17124 _setOption: function (key, value) { 17125 if (key === "active") { 17126 17127 // _activate() will handle invalid values and update this.options 17128 this._activate(value); 17129 return; 17130 } 17131 17132 if (key === "event") { 17133 if (this.options.event) { 17134 this._off(this.headers, this.options.event); 17135 } 17136 this._setupEvents(value); 17137 } 17138 17139 this._super(key, value); 17140 17141 // Setting collapsible: false while collapsed; open first panel 17142 if (key === "collapsible" && !value && this.options.active === false) { 17143 this._activate(0); 17144 } 17145 17146 if (key === "icons") { 17147 this._destroyIcons(); 17148 if (value) { 17149 this._createIcons(); 17150 } 17151 } 17152 }, 17153 17154 _setOptionDisabled: function (value) { 17155 this._super(value); 17156 17157 this.element.attr("aria-disabled", value); 17158 17159 // Support: IE8 Only 17160 // #5332 / #6059 - opacity doesn't cascade to positioned elements in IE 17161 // so we need to add the disabled class to the headers and panels 17162 this._toggleClass(null, "ui-state-disabled", !!value); 17163 this._toggleClass(this.headers.add(this.headers.next()), null, "ui-state-disabled", 17164 !!value); 17165 }, 17166 17167 _keydown: function (event) { 17168 if (event.altKey || event.ctrlKey) { 17169 return; 17170 } 17171 17172 var keyCode = $.ui.keyCode, 17173 length = this.headers.length, 17174 currentIndex = this.headers.index(event.target), 17175 toFocus = false; 17176 17177 switch (event.keyCode) { 17178 case keyCode.RIGHT: 17179 case keyCode.DOWN: 17180 toFocus = this.headers[(currentIndex + 1) % length]; 17181 break; 17182 case keyCode.LEFT: 17183 case keyCode.UP: 17184 toFocus = this.headers[(currentIndex - 1 + length) % length]; 17185 break; 17186 case keyCode.SPACE: 17187 case keyCode.ENTER: 17188 this._eventHandler(event); 17189 break; 17190 case keyCode.HOME: 17191 toFocus = this.headers[0]; 17192 break; 17193 case keyCode.END: 17194 toFocus = this.headers[length - 1]; 17195 break; 17196 } 17197 17198 if (toFocus) { 17199 $(event.target).attr("tabIndex", -1); 17200 $(toFocus).attr("tabIndex", 0); 17201 $(toFocus).trigger("focus"); 17202 event.preventDefault(); 17203 } 17204 }, 17205 17206 _panelKeyDown: function (event) { 17207 if (event.keyCode === $.ui.keyCode.UP && event.ctrlKey) { 17208 $(event.currentTarget).prev().trigger("focus"); 17209 } 17210 }, 17211 17212 refresh: function () { 17213 var options = this.options; 17214 this._processPanels(); 17215 17216 // Was collapsed or no panel 17217 if ((options.active === false && options.collapsible === true) || 17218 !this.headers.length) { 17219 options.active = false; 17220 this.active = $(); 17221 17222 // active false only when collapsible is true 17223 } else if (options.active === false) { 17224 this._activate(0); 17225 17226 // was active, but active panel is gone 17227 } else if (this.active.length && !$.contains(this.element[0], this.active[0])
vendor: 7,413 bytes, lines 17227-17490
17227) { 17228 17229 // all remaining panel are disabled 17230 if (this.headers.length === this.headers.find(".ui-state-disabled").length) { 17231 options.active = false; 17232 this.active = $(); 17233 17234 // activate previous panel 17235 } else { 17236 this._activate(Math.max(0, options.active - 1)); 17237 } 17238 17239 // was active, active panel still exists 17240 } else { 17241 17242 // make sure active index is correct 17243 options.active = this.headers.index(this.active); 17244 } 17245 17246 this._destroyIcons(); 17247 17248 this._refresh(); 17249 }, 17250 17251 _processPanels: function () { 17252 var prevHeaders = this.headers, 17253 prevPanels = this.panels; 17254 17255 if (typeof this.options.header === "function") { 17256 this.headers = this.options.header(this.element); 17257 } else { 17258 this.headers = this.element.find(this.options.header); 17259 } 17260 this._addClass(this.headers, "ui-accordion-header ui-accordion-header-collapsed", 17261 "ui-state-default"); 17262 17263 this.panels = this.headers.next().filter(":not(.ui-accordion-content-active)").hide(); 17264 this._addClass(this.panels, "ui-accordion-content", "ui-helper-reset ui-widget-content"); 17265 17266 // Avoid memory leaks (#10056) 17267 if (prevPanels) { 17268 this._off(prevHeaders.not(this.headers)); 17269 this._off(prevPanels.not(this.panels)); 17270 } 17271 }, 17272 17273 _refresh: function () { 17274 var maxHeight, 17275 options = this.options, 17276 heightStyle = options.heightStyle, 17277 parent = this.element.parent(); 17278 17279 this.active = this._findActive(options.active); 17280 this._addClass(this.active, "ui-accordion-header-active", "ui-state-active") 17281 ._removeClass(this.active, "ui-accordion-header-collapsed"); 17282 this._addClass(this.active.next(), "ui-accordion-content-active"); 17283 this.active.next().show(); 17284 17285 this.headers 17286 .attr("role", "tab") 17287 .each(function () { 17288 var header = $(this), 17289 headerId = header.uniqueId().attr("id"), 17290 panel = header.next(), 17291 panelId = panel.uniqueId().attr("id"); 17292 header.attr("aria-controls", panelId); 17293 panel.attr("aria-labelledby", headerId); 17294 }) 17295 .next() 17296 .attr("role", "tabpanel"); 17297 17298 this.headers 17299 .not(this.active) 17300 .attr({ 17301 "aria-selected": "false", 17302 "aria-expanded": "false", 17303 tabIndex: -1 17304 }) 17305 .next() 17306 .attr({ 17307 "aria-hidden": "true" 17308 }) 17309 .hide(); 17310 17311 // Make sure at least one header is in the tab order 17312 if (!this.active.length) { 17313 this.headers.eq(0).attr("tabIndex", 0); 17314 } else { 17315 this.active.attr({ 17316 "aria-selected": "true", 17317 "aria-expanded": "true", 17318 tabIndex: 0 17319 }) 17320 .next() 17321 .attr({ 17322 "aria-hidden": "false" 17323 }); 17324 } 17325 17326 this._createIcons(); 17327 17328 this._setupEvents(options.event); 17329 17330 if (heightStyle === "fill") { 17331 maxHeight = parent.height(); 17332 this.element.siblings(":visible").each(function () { 17333 var elem = $(this), 17334 position = elem.css("position"); 17335 17336 if (position === "absolute" || position === "fixed") { 17337 return; 17338 } 17339 maxHeight -= elem.outerHeight(true); 17340 }); 17341 17342 this.headers.each(function () { 17343 maxHeight -= $(this).outerHeight(true); 17344 }); 17345 17346 this.headers.next() 17347 .each(function () { 17348 $(this).height(Math.max(0, maxHeight - 17349 $(this).innerHeight() + $(this).height())); 17350 }) 17351 .css("overflow", "auto"); 17352 } else if (heightStyle === "auto") { 17353 maxHeight = 0; 17354 this.headers.next() 17355 .each(function () { 17356 var isVisible = $(this).is(":visible"); 17357 if (!isVisible) { 17358 $(this).show(); 17359 } 17360 maxHeight = Math.max(maxHeight, $(this).css("height", "").height()); 17361 if (!isVisible) { 17362 $(this).hide(); 17363 } 17364 }) 17365 .height(maxHeight); 17366 } 17367 }, 17368 17369 _activate: function (index) { 17370 var active = this._findActive(index)[0]; 17371 17372 // Trying to activate the already active panel 17373 if (active === this.active[0]) { 17374 return; 17375 } 17376 17377 // Trying to collapse, simulate a click on the currently active header 17378 active = active || this.active[0]; 17379 17380 this._eventHandler({ 17381 target: active, 17382 currentTarget: active, 17383 preventDefault: $.noop 17384 }); 17385 }, 17386 17387 _findActive: function (selector) { 17388 return typeof selector === "number" ? this.headers.eq(selector) : $(); 17389 }, 17390 17391 _setupEvents: function (event) { 17392 var events = { 17393 keydown: "_keydown" 17394 }; 17395 if (event) { 17396 $.each(event.split(" "), function (index, eventName) { 17397 events[eventName] = "_eventHandler"; 17398 }); 17399 } 17400 17401 this._off(this.headers.add(this.headers.next())); 17402 this._on(this.headers, events); 17403 this._on(this.headers.next(), { keydown: "_panelKeyDown" }); 17404 this._hoverable(this.headers); 17405 this._focusable(this.headers); 17406 }, 17407 17408 _eventHandler: function (event) { 17409 var activeChildren, clickedChildren, 17410 options = this.options, 17411 active = this.active, 17412 clicked = $(event.currentTarget), 17413 clickedIsActive = clicked[0] === active[0], 17414 collapsing = clickedIsActive && options.collapsible, 17415 toShow = collapsing ? $() : clicked.next(), 17416 toHide = active.next(), 17417 eventData = { 17418 oldHeader: active, 17419 oldPanel: toHide, 17420 newHeader: collapsing ? $() : clicked, 17421 newPanel: toShow 17422 }; 17423 17424 event.preventDefault(); 17425 17426 if ( 17427 17428 // click on active header, but not collapsible 17429 (clickedIsActive && !options.collapsible) || 17430 17431 // allow canceling activation 17432 (this._trigger("beforeActivate", event, eventData) === false)) { 17433 return; 17434 } 17435 17436 options.active = collapsing ? false : this.headers.index(clicked); 17437 17438 // When the call to ._toggle() comes after the class changes 17439 // it causes a very odd bug in IE 8 (see #6720) 17440 this.active = clickedIsActive ? $() : clicked; 17441 this._toggle(eventData); 17442 17443 // Switch classes 17444 // corner classes on the previously active header stay after the animation 17445 this._removeClass(active, "ui-accordion-header-active", "ui-state-active"); 17446 if (options.icons) { 17447 activeChildren = active.children(".ui-accordion-header-icon"); 17448 this._removeClass(activeChildren, null, options.icons.activeHeader) 17449 ._addClass(activeChildren, null, options.icons.header); 17450 } 17451 17452 if (!clickedIsActive) { 17453 this._removeClass(clicked, "ui-accordion-header-collapsed") 17454 ._addClass(clicked, "ui-accordion-header-active", "ui-state-active"); 17455 if (options.icons) { 17456 clickedChildren = clicked.children(".ui-accordion-header-icon"); 17457 this._removeClass(clickedChildren, null, options.icons.header) 17458 ._addClass(clickedChildren, null, options.icons.activeHeader); 17459 } 17460 17461 this._addClass(clicked.next(), "ui-accordion-content-active"); 17462 } 17463 }, 17464 17465 _toggle: function (data) { 17466 var toShow = data.newPanel, 17467 toHide = this.prevShow.length ? this.prevShow : data.oldPanel; 17468 17469 // Handle activating a panel during the animation for another activation 17470 this.prevShow.add(this.prevHide).stop(true, true); 17471 this.prevShow = toShow; 17472 this.prevHide = toHide; 17473 17474 if (this.options.animate) { 17475 this._animate(toShow, toHide, data); 17476 } else { 17477 toHide.hide(); 17478 toShow.show(); 17479 this._toggleComplete(data); 17480 } 17481 17482 toHide.attr({ 17483 "aria-hidden": "true" 17484 }); 17485 toHide.prev().attr({ 17486 "aria-selected": "false", 17487 "aria-expanded": "false" 17488 }); 17489 17490 // if we're switching panels, remove the old header from the tab order
vendor: 6,874 bytes, lines 17491-17737
17491 // if we're opening from collapsed state, remove the previous header from the tab order 17492 // if we're collapsing, then keep the collapsing header in the tab order 17493 if (toShow.length && toHide.length) { 17494 toHide.prev().attr({ 17495 "tabIndex": -1, 17496 "aria-expanded": "false" 17497 }); 17498 } else if (toShow.length) { 17499 this.headers.filter(function () { 17500 return parseInt($(this).attr("tabIndex"), 10) === 0; 17501 }) 17502 .attr("tabIndex", -1); 17503 } 17504 17505 toShow 17506 .attr("aria-hidden", "false") 17507 .prev() 17508 .attr({ 17509 "aria-selected": "true", 17510 "aria-expanded": "true", 17511 tabIndex: 0 17512 }); 17513 }, 17514 17515 _animate: function (toShow, toHide, data) { 17516 var total, easing, duration, 17517 that = this, 17518 adjust = 0, 17519 boxSizing = toShow.css("box-sizing"), 17520 down = toShow.length && 17521 (!toHide.length || (toShow.index() < toHide.index())), 17522 animate = this.options.animate || {}, 17523 options = down && animate.down || animate, 17524 complete = function () { 17525 that._toggleComplete(data); 17526 }; 17527 17528 if (typeof options === "number") { 17529 duration = options; 17530 } 17531 if (typeof options === "string") { 17532 easing = options; 17533 } 17534 17535 // fall back from options to animation in case of partial down settings 17536 easing = easing || options.easing || animate.easing; 17537 duration = duration || options.duration || animate.duration; 17538 17539 if (!toHide.length) { 17540 return toShow.animate(this.showProps, duration, easing, complete); 17541 } 17542 if (!toShow.length) { 17543 return toHide.animate(this.hideProps, duration, easing, complete); 17544 } 17545 17546 total = toShow.show().outerHeight(); 17547 toHide.animate(this.hideProps, { 17548 duration: duration, 17549 easing: easing, 17550 step: function (now, fx) { 17551 fx.now = Math.round(now); 17552 } 17553 }); 17554 toShow 17555 .hide() 17556 .animate(this.showProps, { 17557 duration: duration, 17558 easing: easing, 17559 complete: complete, 17560 step: function (now, fx) { 17561 fx.now = Math.round(now); 17562 if (fx.prop !== "height") { 17563 if (boxSizing === "content-box") { 17564 adjust += fx.now; 17565 } 17566 } else if (that.options.heightStyle !== "content") { 17567 fx.now = Math.round(total - toHide.outerHeight() - adjust); 17568 adjust = 0; 17569 } 17570 } 17571 }); 17572 }, 17573 17574 _toggleComplete: function (data) { 17575 var toHide = data.oldPanel, 17576 prev = toHide.prev(); 17577 17578 this._removeClass(toHide, "ui-accordion-content-active"); 17579 this._removeClass(prev, "ui-accordion-header-active") 17580 ._addClass(prev, "ui-accordion-header-collapsed"); 17581 17582 // Work around for rendering bug in IE (#5421) 17583 if (toHide.length) { 17584 toHide.parent()[0].className = toHide.parent()[0].className; 17585 } 17586 this._trigger("activate", null, data); 17587 } 17588 }); 17589 17590 17591 17592 var safeActiveElement = $.ui.safeActiveElement = function (document) { 17593 var activeElement; 17594 17595 // Support: IE 9 only 17596 // IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe> 17597 try { 17598 activeElement = document.activeElement; 17599 } catch (error) { 17600 activeElement = document.body; 17601 } 17602 17603 // Support: IE 9 - 11 only 17604 // IE may return null instead of an element 17605 // Interestingly, this only seems to occur when NOT in an iframe 17606 if (!activeElement) { 17607 activeElement = document.body; 17608 } 17609 17610 // Support: IE 11 only 17611 // IE11 returns a seemingly empty object in some cases when accessing 17612 // document.activeElement from an <iframe> 17613 if (!activeElement.nodeName) { 17614 activeElement = document.body; 17615 } 17616 17617 return activeElement; 17618 }; 17619 17620 17621 /*! 17622 * jQuery UI Menu 1.13.2 17623 * http://jqueryui.com 17624 * 17625 * Copyright jQuery Foundation and other contributors 17626 * Released under the MIT license. 17627 * http://jquery.org/license 17628 */ 17629 17630 //>>label: Menu 17631 //>>group: Widgets 17632 //>>description: Creates nestable menus. 17633 //>>docs: http://api.jqueryui.com/menu/ 17634 //>>demos: http://jqueryui.com/menu/ 17635 //>>css.structure: ../../themes/base/core.css 17636 //>>css.structure: ../../themes/base/menu.css 17637 //>>css.theme: ../../themes/base/theme.css 17638 17639 17640 var widgetsMenu = $.widget("ui.menu", { 17641 version: "1.13.2", 17642 defaultElement: "<ul>", 17643 delay: 300, 17644 options: { 17645 icons: { 17646 submenu: "ui-icon-caret-1-e" 17647 }, 17648 items: "> *", 17649 menus: "ul", 17650 position: { 17651 my: "left top", 17652 at: "right top" 17653 }, 17654 role: "menu", 17655 17656 // Callbacks 17657 blur: null, 17658 focus: null, 17659 select: null 17660 }, 17661 17662 _create: function () { 17663 this.activeMenu = this.element; 17664 17665 // Flag used to prevent firing of the click handler 17666 // as the event bubbles up through nested menus 17667 this.mouseHandled = false; 17668 this.lastMousePosition = { x: null, y: null }; 17669 this.element 17670 .uniqueId() 17671 .attr({ 17672 role: this.options.role, 17673 tabIndex: 0 17674 }); 17675 17676 this._addClass("ui-menu", "ui-widget ui-widget-content"); 17677 this._on({ 17678 17679 // Prevent focus from sticking to links inside menu after clicking 17680 // them (focus should always stay on UL during navigation). 17681 "mousedown .ui-menu-item": function (event) { 17682 event.preventDefault(); 17683 17684 this._activateItem(event); 17685 }, 17686 "click .ui-menu-item": function (event) { 17687 var target = $(event.target); 17688 var active = $($.ui.safeActiveElement(this.document[0])); 17689 if (!this.mouseHandled && target.not(".ui-state-disabled").length) { 17690 this.select(event); 17691 17692 // Only set the mouseHandled flag if the event will bubble, see #9469. 17693 if (!event.isPropagationStopped()) { 17694 this.mouseHandled = true; 17695 } 17696 17697 // Open submenu on click 17698 if (target.has(".ui-menu").length) { 17699 this.expand(event); 17700 } else if (!this.element.is(":focus") && 17701 active.closest(".ui-menu").length) { 17702 17703 // Redirect focus to the menu 17704 this.element.trigger("focus", [true]); 17705 17706 // If the active item is on the top level, let it stay active. 17707 // Otherwise, blur the active item since it is no longer visible. 17708 if (this.active && this.active.parents(".ui-menu").length === 1) { 17709 clearTimeout(this.timer); 17710 } 17711 } 17712 } 17713 }, 17714 "mouseenter .ui-menu-item": "_activateItem", 17715 "mousemove .ui-menu-item": "_activateItem", 17716 mouseleave: "collapseAll", 17717 "mouseleave .ui-menu": "collapseAll", 17718 focus: function (event, keepActiveItem) { 17719 17720 // If there's already an active item, keep it active 17721 // If not, activate the first item 17722 var item = this.active || this._menuItems().first(); 17723 17724 if (!keepActiveItem) { 17725 this.focus(event, item); 17726 } 17727 }, 17728 blur: function (event) { 17729 this._delay(function () { 17730 var notContained = !$.contains( 17731 this.element[0], 17732 $.ui.safeActiveElement(this.document[0]) 17733 ); 17734 if (notContained) { 17735 this.collapseAll(event); 17736 } 17737 });
vendor: 13,718 bytes, lines 17738-18231
17738 }, 17739 keydown: "_keydown" 17740 }); 17741 17742 this.refresh(); 17743 17744 // Clicks outside of a menu collapse any open menus 17745 this._on(this.document, { 17746 click: function (event) { 17747 if (this._closeOnDocumentClick(event)) { 17748 this.collapseAll(event, true); 17749 } 17750 17751 // Reset the mouseHandled flag 17752 this.mouseHandled = false; 17753 } 17754 }); 17755 }, 17756 17757 _activateItem: function (event) { 17758 17759 // Ignore mouse events while typeahead is active, see #10458. 17760 // Prevents focusing the wrong item when typeahead causes a scroll while the mouse 17761 // is over an item in the menu 17762 if (this.previousFilter) { 17763 return; 17764 } 17765 17766 // If the mouse didn't actually move, but the page was scrolled, ignore the event (#9356) 17767 if (event.clientX === this.lastMousePosition.x && 17768 event.clientY === this.lastMousePosition.y) { 17769 return; 17770 } 17771 17772 this.lastMousePosition = { 17773 x: event.clientX, 17774 y: event.clientY 17775 }; 17776 17777 var actualTarget = $(event.target).closest(".ui-menu-item"), 17778 target = $(event.currentTarget); 17779 17780 // Ignore bubbled events on parent items, see #11641 17781 if (actualTarget[0] !== target[0]) { 17782 return; 17783 } 17784 17785 // If the item is already active, there's nothing to do 17786 if (target.is(".ui-state-active")) { 17787 return; 17788 } 17789 17790 // Remove ui-state-active class from siblings of the newly focused menu item 17791 // to avoid a jump caused by adjacent elements both having a class with a border 17792 this._removeClass(target.siblings().children(".ui-state-active"), 17793 null, "ui-state-active"); 17794 this.focus(event, target); 17795 }, 17796 17797 _destroy: function () { 17798 var items = this.element.find(".ui-menu-item") 17799 .removeAttr("role aria-disabled"), 17800 submenus = items.children(".ui-menu-item-wrapper") 17801 .removeUniqueId() 17802 .removeAttr("tabIndex role aria-haspopup"); 17803 17804 // Destroy (sub)menus 17805 this.element 17806 .removeAttr("aria-activedescendant") 17807 .find(".ui-menu").addBack() 17808 .removeAttr("role aria-labelledby aria-expanded aria-hidden aria-disabled " + 17809 "tabIndex") 17810 .removeUniqueId() 17811 .show(); 17812 17813 submenus.children().each(function () { 17814 var elem = $(this); 17815 if (elem.data("ui-menu-submenu-caret")) { 17816 elem.remove(); 17817 } 17818 }); 17819 }, 17820 17821 _keydown: function (event) { 17822 var match, prev, character, skip, 17823 preventDefault = true; 17824 17825 switch (event.keyCode) { 17826 case $.ui.keyCode.PAGE_UP: 17827 this.previousPage(event); 17828 break; 17829 case $.ui.keyCode.PAGE_DOWN: 17830 this.nextPage(event); 17831 break; 17832 case $.ui.keyCode.HOME: 17833 this._move("first", "first", event); 17834 break; 17835 case $.ui.keyCode.END: 17836 this._move("last", "last", event); 17837 break; 17838 case $.ui.keyCode.UP: 17839 this.previous(event); 17840 break; 17841 case $.ui.keyCode.DOWN: 17842 this.next(event); 17843 break; 17844 case $.ui.keyCode.LEFT: 17845 this.collapse(event); 17846 break; 17847 case $.ui.keyCode.RIGHT: 17848 if (this.active && !this.active.is(".ui-state-disabled")) { 17849 this.expand(event); 17850 } 17851 break; 17852 case $.ui.keyCode.ENTER: 17853 case $.ui.keyCode.SPACE: 17854 this._activate(event); 17855 break; 17856 case $.ui.keyCode.ESCAPE: 17857 this.collapse(event); 17858 break; 17859 default: 17860 preventDefault = false; 17861 prev = this.previousFilter || ""; 17862 skip = false; 17863 17864 // Support number pad values 17865 character = event.keyCode >= 96 && event.keyCode <= 105 ? 17866 (event.keyCode - 96).toString() : String.fromCharCode(event.keyCode); 17867 17868 clearTimeout(this.filterTimer); 17869 17870 if (character === prev) { 17871 skip = true; 17872 } else { 17873 character = prev + character; 17874 } 17875 17876 match = this._filterMenuItems(character); 17877 match = skip && match.index(this.active.next()) !== -1 ? 17878 this.active.nextAll(".ui-menu-item") : 17879 match; 17880 17881 // If no matches on the current filter, reset to the last character pressed 17882 // to move down the menu to the first item that starts with that character 17883 if (!match.length) { 17884 character = String.fromCharCode(event.keyCode); 17885 match = this._filterMenuItems(character); 17886 } 17887 17888 if (match.length) { 17889 this.focus(event, match); 17890 this.previousFilter = character; 17891 this.filterTimer = this._delay(function () { 17892 delete this.previousFilter; 17893 }, 1000); 17894 } else { 17895 delete this.previousFilter; 17896 } 17897 } 17898 17899 if (preventDefault) { 17900 event.preventDefault(); 17901 } 17902 }, 17903 17904 _activate: function (event) { 17905 if (this.active && !this.active.is(".ui-state-disabled")) { 17906 if (this.active.children("[aria-haspopup='true']").length) { 17907 this.expand(event); 17908 } else { 17909 this.select(event); 17910 } 17911 } 17912 }, 17913 17914 refresh: function () { 17915 var menus, items, newSubmenus, newItems, newWrappers, 17916 that = this, 17917 icon = this.options.icons.submenu, 17918 submenus = this.element.find(this.options.menus); 17919 17920 this._toggleClass("ui-menu-icons", null, !!this.element.find(".ui-icon").length); 17921 17922 // Initialize nested menus 17923 newSubmenus = submenus.filter(":not(.ui-menu)") 17924 .hide() 17925 .attr({ 17926 role: this.options.role, 17927 "aria-hidden": "true", 17928 "aria-expanded": "false" 17929 }) 17930 .each(function () { 17931 var menu = $(this), 17932 item = menu.prev(), 17933 submenuCaret = $("<span>").data("ui-menu-submenu-caret", true); 17934 17935 that._addClass(submenuCaret, "ui-menu-icon", "ui-icon " + icon); 17936 item 17937 .attr("aria-haspopup", "true") 17938 .prepend(submenuCaret); 17939 menu.attr("aria-labelledby", item.attr("id")); 17940 }); 17941 17942 this._addClass(newSubmenus, "ui-menu", "ui-widget ui-widget-content ui-front"); 17943 17944 menus = submenus.add(this.element); 17945 items = menus.find(this.options.items); 17946 17947 // Initialize menu-items containing spaces and/or dashes only as dividers 17948 items.not(".ui-menu-item").each(function () { 17949 var item = $(this); 17950 if (that._isDivider(item)) { 17951 that._addClass(item, "ui-menu-divider", "ui-widget-content"); 17952 } 17953 }); 17954 17955 // Don't refresh list items that are already adapted 17956 newItems = items.not(".ui-menu-item, .ui-menu-divider"); 17957 newWrappers = newItems.children() 17958 .not(".ui-menu") 17959 .uniqueId() 17960 .attr({ 17961 tabIndex: -1, 17962 role: this._itemRole() 17963 }); 17964 this._addClass(newItems, "ui-menu-item") 17965 ._addClass(newWrappers, "ui-menu-item-wrapper"); 17966 17967 // Add aria-disabled attribute to any disabled menu item 17968 items.filter(".ui-state-disabled").attr("aria-disabled", "true"); 17969 17970 // If the active item has been removed, blur the menu 17971 if (this.active && !$.contains(this.element[0], this.active[0])) { 17972 this.blur(); 17973 } 17974 }, 17975 17976 _itemRole: function () { 17977 return { 17978 menu: "menuitem", 17979 listbox: "option" 17980 }[this.options.role]; 17981 }, 17982 17983 _setOption: function (key, value) { 17984 if (key === "icons") { 17985 var icons = this.element.find(".ui-menu-icon"); 17986 this._removeClass(icons, null, this.options.icons.submenu) 17987 ._addClass(icons, null, value.submenu); 17988 } 17989 this._super(key, value); 17990 }, 17991 17992 _setOptionDisabled: function (value) { 17993 this._super(value); 17994 17995 this.element.attr("aria-disabled", String(value)); 17996 this._toggleClass(null, "ui-state-disabled", !!value); 17997 }, 17998 17999 focus: function (event, item) { 18000 var nested, focused, activeParent; 18001 this.blur(event, event && event.type === "focus"); 18002 18003 this._scrollIntoView(item); 18004 18005 this.active = item.first(); 18006 18007 focused = this.active.children(".ui-menu-item-wrapper"); 18008 this._addClass(focused, null, "ui-state-active"); 18009 18010 // Only update aria-activedescendant if there's a role 18011 // otherwise we assume focus is managed elsewhere 18012 if (this.options.role) { 18013 this.element.attr("aria-activedescendant", focused.attr("id")); 18014 } 18015 18016 // Highlight active parent menu item, if any 18017 activeParent = this.active 18018 .parent() 18019 .closest(".ui-menu-item") 18020 .children(".ui-menu-item-wrapper"); 18021 this._addClass(activeParent, null, "ui-state-active"); 18022 18023 if (event && event.type === "keydown") { 18024 this._close(); 18025 } else { 18026 this.timer = this._delay(function () { 18027 this._close(); 18028 }, this.delay); 18029 } 18030 18031 nested = item.children(".ui-menu"); 18032 if (nested.length && event && (/^mouse/.test(event.type))) { 18033 this._startOpening(nested); 18034 } 18035 this.activeMenu = item.parent(); 18036 18037 this._trigger("focus", event, { item: item }); 18038 }, 18039 18040 _scrollIntoView: function (item) { 18041 var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight; 18042 if (this._hasScroll()) { 18043 borderTop = parseFloat($.css(this.activeMenu[0], "borderTopWidth")) || 0; 18044 paddingTop = parseFloat($.css(this.activeMenu[0], "paddingTop")) || 0; 18045 offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop; 18046 scroll = this.activeMenu.scrollTop(); 18047 elementHeight = this.activeMenu.height(); 18048 itemHeight = item.outerHeight(); 18049 18050 if (offset < 0) { 18051 this.activeMenu.scrollTop(scroll + offset); 18052 } else if (offset + itemHeight > elementHeight) { 18053 this.activeMenu.scrollTop(scroll + offset - elementHeight + itemHeight); 18054 } 18055 } 18056 }, 18057 18058 blur: function (event, fromFocus) { 18059 if (!fromFocus) { 18060 clearTimeout(this.timer); 18061 } 18062 18063 if (!this.active) { 18064 return; 18065 } 18066 18067 this._removeClass(this.active.children(".ui-menu-item-wrapper"), 18068 null, "ui-state-active"); 18069 18070 this._trigger("blur", event, { item: this.active }); 18071 this.active = null; 18072 }, 18073 18074 _startOpening: function (submenu) { 18075 clearTimeout(this.timer); 18076 18077 // Don't open if already open fixes a Firefox bug that caused a .5 pixel 18078 // shift in the submenu position when mousing over the caret icon 18079 if (submenu.attr("aria-hidden") !== "true") { 18080 return; 18081 } 18082 18083 this.timer = this._delay(function () { 18084 this._close(); 18085 this._open(submenu); 18086 }, this.delay); 18087 }, 18088 18089 _open: function (submenu) { 18090 var position = $.extend({ 18091 of: this.active 18092 }, this.options.position); 18093 18094 clearTimeout(this.timer); 18095 this.element.find(".ui-menu").not(submenu.parents(".ui-menu")) 18096 .hide() 18097 .attr("aria-hidden", "true"); 18098 18099 submenu 18100 .show() 18101 .removeAttr("aria-hidden") 18102 .attr("aria-expanded", "true") 18103 .position(position); 18104 }, 18105 18106 collapseAll: function (event, all) { 18107 clearTimeout(this.timer); 18108 this.timer = this._delay(function () { 18109 18110 // If we were passed an event, look for the submenu that contains the event 18111 var currentMenu = all ? this.element : 18112 $(event && event.target).closest(this.element.find(".ui-menu")); 18113 18114 // If we found no valid submenu ancestor, use the main menu to close all 18115 // sub menus anyway 18116 if (!currentMenu.length) { 18117 currentMenu = this.element; 18118 } 18119 18120 this._close(currentMenu); 18121 18122 this.blur(event); 18123 18124 // Work around active item staying active after menu is blurred 18125 this._removeClass(currentMenu.find(".ui-state-active"), null, "ui-state-active"); 18126 18127 this.activeMenu = currentMenu; 18128 }, all ? 0 : this.delay); 18129 }, 18130 18131 // With no arguments, closes the currently active menu - if nothing is active 18132 // it closes all menus. If passed an argument, it will search for menus BELOW 18133 _close: function (startMenu) { 18134 if (!startMenu) { 18135 startMenu = this.active ? this.active.parent() : this.element; 18136 } 18137 18138 startMenu.find(".ui-menu") 18139 .hide() 18140 .attr("aria-hidden", "true") 18141 .attr("aria-expanded", "false"); 18142 }, 18143 18144 _closeOnDocumentClick: function (event) { 18145 return !$(event.target).closest(".ui-menu").length; 18146 }, 18147 18148 _isDivider: function (item) { 18149 18150 // Match hyphen, em dash, en dash 18151 return !/[^\-\u2014\u2013\s]/.test(item.text()); 18152 }, 18153 18154 collapse: function (event) { 18155 var newItem = this.active && 18156 this.active.parent().closest(".ui-menu-item", this.element); 18157 if (newItem && newItem.length) { 18158 this._close(); 18159 this.focus(event, newItem); 18160 } 18161 }, 18162 18163 expand: function (event) { 18164 var newItem = this.active && this._menuItems(this.active.children(".ui-menu")).first(); 18165 18166 if (newItem && newItem.length) { 18167 this._open(newItem.parent()); 18168 18169 // Delay so Firefox will not hide activedescendant change in expanding submenu from AT 18170 this._delay(function () { 18171 this.focus(event, newItem); 18172 }); 18173 } 18174 }, 18175 18176 next: function (event) { 18177 this._move("next", "first", event); 18178 }, 18179 18180 previous: function (event) { 18181 this._move("prev", "last", event); 18182 }, 18183 18184 isFirstItem: function () { 18185 return this.active && !this.active.prevAll(".ui-menu-item").length; 18186 }, 18187 18188 isLastItem: function () { 18189 return this.active && !this.active.nextAll(".ui-menu-item").length; 18190 }, 18191 18192 _menuItems: function (menu) { 18193 return (menu || this.element) 18194 .find(this.options.items) 18195 .filter(".ui-menu-item"); 18196 }, 18197 18198 _move: function (direction, filter, event) { 18199 var next; 18200 if (this.active) { 18201 if (direction === "first" || direction === "last") { 18202 next = this.active 18203 [direction === "first" ? "prevAll" : "nextAll"](".ui-menu-item") 18204 .last(); 18205 } else { 18206 next = this.active 18207 [direction + "All"](".ui-menu-item") 18208 .first(); 18209 } 18210 } 18211 if (!next || !next.length || !this.active) { 18212 next = this._menuItems(this.activeMenu)[filter](); 18213 } 18214 18215 this.focus(event, next); 18216 }, 18217 18218 nextPage: function (event) { 18219 var item, base, height; 18220 18221 if (!this.active) { 18222 this.next(event); 18223 return; 18224 } 18225 if (this.isLastItem()) { 18226 return; 18227 } 18228 if (this._hasScroll()) { 18229 base = this.active.offset().top; 18230 height = this.element.innerHeight(); 18231
vendor: 13,108 bytes, lines 18232-18684
18232 // jQuery 3.2 doesn't include scrollbars in innerHeight, add it back. 18233 if ($.fn.jquery.indexOf("3.2.") === 0) { 18234 height += this.element[0].offsetHeight - this.element.outerHeight(); 18235 } 18236 18237 this.active.nextAll(".ui-menu-item").each(function () { 18238 item = $(this); 18239 return item.offset().top - base - height < 0; 18240 }); 18241 18242 this.focus(event, item); 18243 } else { 18244 this.focus(event, this._menuItems(this.activeMenu) 18245 [!this.active ? "first" : "last"]()); 18246 } 18247 }, 18248 18249 previousPage: function (event) { 18250 var item, base, height; 18251 if (!this.active) { 18252 this.next(event); 18253 return; 18254 } 18255 if (this.isFirstItem()) { 18256 return; 18257 } 18258 if (this._hasScroll()) { 18259 base = this.active.offset().top; 18260 height = this.element.innerHeight(); 18261 18262 // jQuery 3.2 doesn't include scrollbars in innerHeight, add it back. 18263 if ($.fn.jquery.indexOf("3.2.") === 0) { 18264 height += this.element[0].offsetHeight - this.element.outerHeight(); 18265 } 18266 18267 this.active.prevAll(".ui-menu-item").each(function () { 18268 item = $(this); 18269 return item.offset().top - base + height > 0; 18270 }); 18271 18272 this.focus(event, item); 18273 } else { 18274 this.focus(event, this._menuItems(this.activeMenu).first()); 18275 } 18276 }, 18277 18278 _hasScroll: function () { 18279 return this.element.outerHeight() < this.element.prop("scrollHeight"); 18280 }, 18281 18282 select: function (event) { 18283 18284 // TODO: It should never be possible to not have an active item at this 18285 // point, but the tests don't trigger mouseenter before click. 18286 this.active = this.active || $(event.target).closest(".ui-menu-item"); 18287 var ui = { item: this.active }; 18288 if (!this.active.has(".ui-menu").length) { 18289 this.collapseAll(event, true); 18290 } 18291 this._trigger("select", event, ui); 18292 }, 18293 18294 _filterMenuItems: function (character) { 18295 var escapedCharacter = character.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&"), 18296 regex = new RegExp("^" + escapedCharacter, "i"); 18297 18298 return this.activeMenu 18299 .find(this.options.items) 18300 18301 // Only match on items, not dividers or other content (#10571) 18302 .filter(".ui-menu-item") 18303 .filter(function () { 18304 return regex.test( 18305 String.prototype.trim.call( 18306 $(this).children(".ui-menu-item-wrapper").text())); 18307 }); 18308 } 18309 }); 18310 18311 18312 /*! 18313 * jQuery UI Autocomplete 1.13.2 18314 * http://jqueryui.com 18315 * 18316 * Copyright jQuery Foundation and other contributors 18317 * Released under the MIT license. 18318 * http://jquery.org/license 18319 */ 18320 18321 //>>label: Autocomplete 18322 //>>group: Widgets 18323 //>>description: Lists suggested words as the user is typing. 18324 //>>docs: http://api.jqueryui.com/autocomplete/ 18325 //>>demos: http://jqueryui.com/autocomplete/ 18326 //>>css.structure: ../../themes/base/core.css 18327 //>>css.structure: ../../themes/base/autocomplete.css 18328 //>>css.theme: ../../themes/base/theme.css 18329 18330 18331 $.widget("ui.autocomplete", { 18332 version: "1.13.2", 18333 defaultElement: "<input>", 18334 options: { 18335 appendTo: null, 18336 autoFocus: false, 18337 delay: 300, 18338 minLength: 1, 18339 position: { 18340 my: "left top", 18341 at: "left bottom", 18342 collision: "none" 18343 }, 18344 source: null, 18345 18346 // Callbacks 18347 change: null, 18348 close: null, 18349 focus: null, 18350 open: null, 18351 response: null, 18352 search: null, 18353 select: null 18354 }, 18355 18356 requestIndex: 0, 18357 pending: 0, 18358 liveRegionTimer: null, 18359 18360 _create: function () { 18361 18362 // Some browsers only repeat keydown events, not keypress events, 18363 // so we use the suppressKeyPress flag to determine if we've already 18364 // handled the keydown event. #7269 18365 // Unfortunately the code for & in keypress is the same as the up arrow, 18366 // so we use the suppressKeyPressRepeat flag to avoid handling keypress 18367 // events when we know the keydown event was used to modify the 18368 // search term. #7799 18369 var suppressKeyPress, suppressKeyPressRepeat, suppressInput, 18370 nodeName = this.element[0].nodeName.toLowerCase(), 18371 isTextarea = nodeName === "textarea", 18372 isInput = nodeName === "input"; 18373 18374 // Textareas are always multi-line 18375 // Inputs are always single-line, even if inside a contentEditable element 18376 // IE also treats inputs as contentEditable 18377 // All other element types are determined by whether or not they're contentEditable 18378 this.isMultiLine = isTextarea || !isInput && this._isContentEditable(this.element); 18379 18380 this.valueMethod = this.element[isTextarea || isInput ? "val" : "text"]; 18381 this.isNewMenu = true; 18382 18383 this._addClass("ui-autocomplete-input"); 18384 this.element.attr("autocomplete", "off"); 18385 18386 this._on(this.element, { 18387 keydown: function (event) { 18388 if (this.element.prop("readOnly")) { 18389 suppressKeyPress = true; 18390 suppressInput = true; 18391 suppressKeyPressRepeat = true; 18392 return; 18393 } 18394 18395 suppressKeyPress = false; 18396 suppressInput = false; 18397 suppressKeyPressRepeat = false; 18398 var keyCode = $.ui.keyCode; 18399 switch (event.keyCode) { 18400 case keyCode.PAGE_UP: 18401 suppressKeyPress = true; 18402 this._move("previousPage", event); 18403 break; 18404 case keyCode.PAGE_DOWN: 18405 suppressKeyPress = true; 18406 this._move("nextPage", event); 18407 break; 18408 case keyCode.UP: 18409 suppressKeyPress = true; 18410 this._keyEvent("previous", event); 18411 break; 18412 case keyCode.DOWN: 18413 suppressKeyPress = true; 18414 this._keyEvent("next", event); 18415 break; 18416 case keyCode.ENTER: 18417 18418 // when menu is open and has focus 18419 if (this.menu.active) { 18420 18421 // #6055 - Opera still allows the keypress to occur 18422 // which causes forms to submit 18423 suppressKeyPress = true; 18424 event.preventDefault(); 18425 this.menu.select(event); 18426 } 18427 break; 18428 case keyCode.TAB: 18429 if (this.menu.active) { 18430 this.menu.select(event); 18431 } 18432 break; 18433 case keyCode.ESCAPE: 18434 if (this.menu.element.is(":visible")) { 18435 if (!this.isMultiLine) { 18436 this._value(this.term); 18437 } 18438 this.close(event); 18439 18440 // Different browsers have different default behavior for escape 18441 // Single press can mean undo or clear 18442 // Double press in IE means clear the whole form 18443 event.preventDefault(); 18444 } 18445 break; 18446 default: 18447 suppressKeyPressRepeat = true; 18448 18449 // search timeout should be triggered before the input value is changed 18450 this._searchTimeout(event); 18451 break; 18452 } 18453 }, 18454 keypress: function (event) { 18455 if (suppressKeyPress) { 18456 suppressKeyPress = false; 18457 if (!this.isMultiLine || this.menu.element.is(":visible")) { 18458 event.preventDefault(); 18459 } 18460 return; 18461 } 18462 if (suppressKeyPressRepeat) { 18463 return; 18464 } 18465 18466 // Replicate some key handlers to allow them to repeat in Firefox and Opera 18467 var keyCode = $.ui.keyCode; 18468 switch (event.keyCode) { 18469 case keyCode.PAGE_UP: 18470 this._move("previousPage", event); 18471 break; 18472 case keyCode.PAGE_DOWN: 18473 this._move("nextPage", event); 18474 break; 18475 case keyCode.UP: 18476 this._keyEvent("previous", event); 18477 break; 18478 case keyCode.DOWN: 18479 this._keyEvent("next", event); 18480 break; 18481 } 18482 }, 18483 input: function (event) { 18484 if (suppressInput) { 18485 suppressInput = false; 18486 event.preventDefault(); 18487 return; 18488 } 18489 this._searchTimeout(event); 18490 }, 18491 focus: function () { 18492 this.selectedItem = null; 18493 this.previous = this._value(); 18494 }, 18495 blur: function (event) { 18496 clearTimeout(this.searching); 18497 this.close(event); 18498 this._change(event); 18499 } 18500 }); 18501 18502 this._initSource(); 18503 this.menu = $("<ul>") 18504 .appendTo(this._appendTo()) 18505 .menu({ 18506 18507 // disable ARIA support, the live region takes care of that 18508 role: null 18509 }) 18510 .hide() 18511 18512 // Support: IE 11 only, Edge <= 14 18513 // For other browsers, we preventDefault() on the mousedown event 18514 // to keep the dropdown from taking focus from the input. This doesn't 18515 // work for IE/Edge, causing problems with selection and scrolling (#9638) 18516 // Happily, IE and Edge support an "unselectable" attribute that 18517 // prevents an element from receiving focus, exactly what we want here. 18518 .attr({ 18519 "unselectable": "on" 18520 }) 18521 .menu("instance"); 18522 18523 this._addClass(this.menu.element, "ui-autocomplete", "ui-front"); 18524 this._on(this.menu.element, { 18525 mousedown: function (event) { 18526 18527 // Prevent moving focus out of the text field 18528 event.preventDefault(); 18529 }, 18530 menufocus: function (event, ui) { 18531 var label, item; 18532 18533 // support: Firefox 18534 // Prevent accidental activation of menu items in Firefox (#7024 #9118) 18535 if (this.isNewMenu) { 18536 this.isNewMenu = false; 18537 if (event.originalEvent && /^mouse/.test(event.originalEvent.type)) { 18538 this.menu.blur(); 18539 18540 this.document.one("mousemove", function () { 18541 $(event.target).trigger(event.originalEvent); 18542 }); 18543 18544 return; 18545 } 18546 } 18547 18548 item = ui.item.data("ui-autocomplete-item"); 18549 if (false !== this._trigger("focus", event, { item: item })) { 18550 18551 // use value to match what will end up in the input, if it was a key event 18552 if (event.originalEvent && /^key/.test(event.originalEvent.type)) { 18553 this._value(item.value); 18554 } 18555 } 18556 18557 // Announce the value in the liveRegion 18558 label = ui.item.attr("aria-label") || item.value; 18559 if (label && String.prototype.trim.call(label).length) { 18560 clearTimeout(this.liveRegionTimer); 18561 this.liveRegionTimer = this._delay(function () { 18562 this.liveRegion.html($("<div>").text(label)); 18563 }, 100); 18564 } 18565 }, 18566 menuselect: function (event, ui) { 18567 var item = ui.item.data("ui-autocomplete-item"), 18568 previous = this.previous; 18569 18570 // Only trigger when focus was lost (click on menu) 18571 if (this.element[0] !== $.ui.safeActiveElement(this.document[0])) { 18572 this.element.trigger("focus"); 18573 this.previous = previous; 18574 18575 // #6109 - IE triggers two focus events and the second 18576 // is asynchronous, so we need to reset the previous 18577 // term synchronously and asynchronously :-( 18578 this._delay(function () { 18579 this.previous = previous; 18580 this.selectedItem = item; 18581 }); 18582 } 18583 18584 if (false !== this._trigger("select", event, { item: item })) { 18585 this._value(item.value); 18586 } 18587 18588 // reset the term after the select event 18589 // this allows custom select handling to work properly 18590 this.term = this._value(); 18591 18592 this.close(event); 18593 this.selectedItem = item; 18594 } 18595 }); 18596 18597 this.liveRegion = $("<div>", { 18598 role: "status", 18599 "aria-live": "assertive", 18600 "aria-relevant": "additions" 18601 }) 18602 .appendTo(this.document[0].body); 18603 18604 this._addClass(this.liveRegion, null, "ui-helper-hidden-accessible"); 18605 18606 // Turning off autocomplete prevents the browser from remembering the 18607 // value when navigating through history, so we re-enable autocomplete 18608 // if the page is unloaded before the widget is destroyed. #7790 18609 this._on(this.window, { 18610 beforeunload: function () { 18611 this.element.removeAttr("autocomplete"); 18612 } 18613 }); 18614 }, 18615 18616 _destroy: function () { 18617 clearTimeout(this.searching); 18618 this.element.removeAttr("autocomplete"); 18619 this.menu.element.remove(); 18620 this.liveRegion.remove(); 18621 }, 18622 18623 _setOption: function (key, value) { 18624 this._super(key, value); 18625 if (key === "source") { 18626 this._initSource(); 18627 } 18628 if (key === "appendTo") { 18629 this.menu.element.appendTo(this._appendTo()); 18630 } 18631 if (key === "disabled" && value && this.xhr) { 18632 this.xhr.abort(); 18633 } 18634 }, 18635 18636 _isEventTargetInWidget: function (event) { 18637 var menuElement = this.menu.element[0]; 18638 18639 return event.target === this.element[0] || 18640 event.target === menuElement || 18641 $.contains(menuElement, event.target); 18642 }, 18643 18644 _closeOnClickOutside: function (event) { 18645 if (!this._isEventTargetInWidget(event)) { 18646 this.close(); 18647 } 18648 }, 18649 18650 _appendTo: function () { 18651 var element = this.options.appendTo; 18652 18653 if (element) { 18654 element = element.jquery || element.nodeType ? 18655 $(element) : 18656 this.document.find(element).eq(0); 18657 } 18658 18659 if (!element || !element[0]) { 18660 element = this.element.closest(".ui-front, dialog"); 18661 } 18662 18663 if (!element.length) { 18664 element = this.document[0].body; 18665 } 18666 18667 return element; 18668 }, 18669 18670 _initSource: function () { 18671 var array, url, 18672 that = this; 18673 if (Array.isArray(this.options.source)) { 18674 array = this.options.source; 18675 this.source = function (request, response) { 18676 response($.ui.autocomplete.filter(array, request.term)); 18677 }; 18678 } else if (typeof this.options.source === "string") { 18679 url = this.options.source; 18680 this.source = function (request, response) { 18681 if (that.xhr) { 18682 that.xhr.abort(); 18683 } 18684 that.xhr = $.ajax({
vendor: 5,291 bytes, lines 18685-18901
18685 url: url, 18686 data: request, 18687 dataType: "json", 18688 success: function (data) { 18689 response(data); 18690 }, 18691 error: function () { 18692 response([]); 18693 } 18694 }); 18695 }; 18696 } else { 18697 this.source = this.options.source; 18698 } 18699 }, 18700 18701 _searchTimeout: function (event) { 18702 clearTimeout(this.searching); 18703 this.searching = this._delay(function () { 18704 18705 // Search if the value has changed, or if the user retypes the same value (see #7434) 18706 var equalValues = this.term === this._value(), 18707 menuVisible = this.menu.element.is(":visible"), 18708 modifierKey = event.altKey || event.ctrlKey || event.metaKey || event.shiftKey; 18709 18710 if (!equalValues || (equalValues && !menuVisible && !modifierKey)) { 18711 this.selectedItem = null; 18712 this.search(null, event); 18713 } 18714 }, this.options.delay); 18715 }, 18716 18717 search: function (value, event) { 18718 value = value != null ? value : this._value(); 18719 18720 // Always save the actual value, not the one passed as an argument 18721 this.term = this._value(); 18722 18723 if (value.length < this.options.minLength) { 18724 return this.close(event); 18725 } 18726 18727 if (this._trigger("search", event) === false) { 18728 return; 18729 } 18730 18731 return this._search(value); 18732 }, 18733 18734 _search: function (value) { 18735 this.pending++; 18736 this._addClass("ui-autocomplete-loading"); 18737 this.cancelSearch = false; 18738 18739 this.source({ term: value }, this._response()); 18740 }, 18741 18742 _response: function () { 18743 var index = ++this.requestIndex; 18744 18745 return function (content) { 18746 if (index === this.requestIndex) { 18747 this.__response(content); 18748 } 18749 18750 this.pending--; 18751 if (!this.pending) { 18752 this._removeClass("ui-autocomplete-loading"); 18753 } 18754 }.bind(this); 18755 }, 18756 18757 __response: function (content) { 18758 if (content) { 18759 content = this._normalize(content); 18760 } 18761 this._trigger("response", null, { content: content }); 18762 if (!this.options.disabled && content && content.length && !this.cancelSearch) { 18763 this._suggest(content); 18764 this._trigger("open"); 18765 } else { 18766 18767 // use ._close() instead of .close() so we don't cancel future searches 18768 this._close(); 18769 } 18770 }, 18771 18772 close: function (event) { 18773 this.cancelSearch = true; 18774 this._close(event); 18775 }, 18776 18777 _close: function (event) { 18778 18779 // Remove the handler that closes the menu on outside clicks 18780 this._off(this.document, "mousedown"); 18781 18782 if (this.menu.element.is(":visible")) { 18783 this.menu.element.hide(); 18784 this.menu.blur(); 18785 this.isNewMenu = true; 18786 this._trigger("close", event); 18787 } 18788 }, 18789 18790 _change: function (event) { 18791 if (this.previous !== this._value()) { 18792 this._trigger("change", event, { item: this.selectedItem }); 18793 } 18794 }, 18795 18796 _normalize: function (items) { 18797 18798 // assume all items have the right format when the first item is complete 18799 if (items.length && items[0].label && items[0].value) { 18800 return items; 18801 } 18802 return $.map(items, function (item) { 18803 if (typeof item === "string") { 18804 return { 18805 label: item, 18806 value: item 18807 }; 18808 } 18809 return $.extend({}, item, { 18810 label: item.label || item.value, 18811 value: item.value || item.label 18812 }); 18813 }); 18814 }, 18815 18816 _suggest: function (items) { 18817 var ul = this.menu.element.empty(); 18818 this._renderMenu(ul, items); 18819 this.isNewMenu = true; 18820 this.menu.refresh(); 18821 18822 // Size and position menu 18823 ul.show(); 18824 this._resizeMenu(); 18825 ul.position($.extend({ 18826 of: this.element 18827 }, this.options.position)); 18828 18829 if (this.options.autoFocus) { 18830 this.menu.next(); 18831 } 18832 18833 // Listen for interactions outside of the widget (#6642) 18834 this._on(this.document, { 18835 mousedown: "_closeOnClickOutside" 18836 }); 18837 }, 18838 18839 _resizeMenu: function () { 18840 var ul = this.menu.element; 18841 ul.outerWidth(Math.max( 18842 18843 // Firefox wraps long text (possibly a rounding bug) 18844 // so we add 1px to avoid the wrapping (#7513) 18845 ul.width("").outerWidth() + 1, 18846 this.element.outerWidth() 18847 )); 18848 }, 18849 18850 _renderMenu: function (ul, items) { 18851 var that = this; 18852 $.each(items, function (index, item) { 18853 that._renderItemData(ul, item); 18854 }); 18855 }, 18856 18857 _renderItemData: function (ul, item) { 18858 return this._renderItem(ul, item).data("ui-autocomplete-item", item); 18859 }, 18860 18861 _renderItem: function (ul, item) { 18862 return $("<li>") 18863 .append($("<div>").text(item.label)) 18864 .appendTo(ul); 18865 }, 18866 18867 _move: function (direction, event) { 18868 if (!this.menu.element.is(":visible")) { 18869 this.search(null, event); 18870 return; 18871 } 18872 if (this.menu.isFirstItem() && /^previous/.test(direction) || 18873 this.menu.isLastItem() && /^next/.test(direction)) { 18874 18875 if (!this.isMultiLine) { 18876 this._value(this.term); 18877 } 18878 18879 this.menu.blur(); 18880 return; 18881 } 18882 this.menu[direction](event); 18883 }, 18884 18885 widget: function () { 18886 return this.menu.element; 18887 }, 18888 18889 _value: function () { 18890 return this.valueMethod.apply(this.element, arguments); 18891 }, 18892 18893 _keyEvent: function (keyEvent, event) { 18894 if (!this.isMultiLine || this.menu.element.is(":visible")) { 18895 this._move(keyEvent, event); 18896 18897 // Prevents moving cursor to beginning/end of the text field in some browsers 18898 event.preventDefault(); 18899 } 18900 }, 18901
vendor: 4,339 bytes, lines 18902-19051
18902 // Support: Chrome <=50 18903 // We should be able to just use this.element.prop( "isContentEditable" ) 18904 // but hidden elements always report false in Chrome. 18905 // https://code.google.com/p/chromium/issues/detail?id=313082 18906 _isContentEditable: function (element) { 18907 if (!element.length) { 18908 return false; 18909 } 18910 18911 var editable = element.prop("contentEditable"); 18912 18913 if (editable === "inherit") { 18914 return this._isContentEditable(element.parent()); 18915 } 18916 18917 return editable === "true"; 18918 } 18919 }); 18920 18921 $.extend($.ui.autocomplete, { 18922 escapeRegex: function (value) { 18923 return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&"); 18924 }, 18925 filter: function (array, term) { 18926 var matcher = new RegExp($.ui.autocomplete.escapeRegex(term), "i"); 18927 return $.grep(array, function (value) { 18928 return matcher.test(value.label || value.value || value); 18929 }); 18930 } 18931 }); 18932 18933 // Live region extension, adding a `messages` option 18934 // NOTE: This is an experimental API. We are still investigating 18935 // a full solution for string manipulation and internationalization. 18936 $.widget("ui.autocomplete", $.ui.autocomplete, { 18937 options: { 18938 messages: { 18939 noResults: "No search results.", 18940 results: function (amount) { 18941 return amount + (amount > 1 ? " results are" : " result is") + 18942 " available, use up and down arrow keys to navigate."; 18943 } 18944 } 18945 }, 18946 18947 __response: function (content) { 18948 var message; 18949 this._superApply(arguments); 18950 if (this.options.disabled || this.cancelSearch) { 18951 return; 18952 } 18953 if (content && content.length) { 18954 message = this.options.messages.results(content.length); 18955 } else { 18956 message = this.options.messages.noResults; 18957 } 18958 clearTimeout(this.liveRegionTimer); 18959 this.liveRegionTimer = this._delay(function () { 18960 this.liveRegion.html($("<div>").text(message)); 18961 }, 100); 18962 } 18963 }); 18964 18965 var widgetsAutocomplete = $.ui.autocomplete; 18966 18967 18968 /*! 18969 * jQuery UI Controlgroup 1.13.2 18970 * http://jqueryui.com 18971 * 18972 * Copyright jQuery Foundation and other contributors 18973 * Released under the MIT license. 18974 * http://jquery.org/license 18975 */ 18976 18977 //>>label: Controlgroup 18978 //>>group: Widgets 18979 //>>description: Visually groups form control widgets 18980 //>>docs: http://api.jqueryui.com/controlgroup/ 18981 //>>demos: http://jqueryui.com/controlgroup/ 18982 //>>css.structure: ../../themes/base/core.css 18983 //>>css.structure: ../../themes/base/controlgroup.css 18984 //>>css.theme: ../../themes/base/theme.css 18985 18986 18987 var controlgroupCornerRegex = /ui-corner-([a-z]){2,6}/g; 18988 18989 var widgetsControlgroup = $.widget("ui.controlgroup", { 18990 version: "1.13.2", 18991 defaultElement: "<div>", 18992 options: { 18993 direction: "horizontal", 18994 disabled: null, 18995 onlyVisible: true, 18996 items: { 18997 "button": "input[type=button], input[type=submit], input[type=reset], button, a", 18998 "controlgroupLabel": ".ui-controlgroup-label", 18999 "checkboxradio": "input[type='checkbox'], input[type='radio']", 19000 "selectmenu": "select", 19001 "spinner": ".ui-spinner-input" 19002 } 19003 }, 19004 19005 _create: function () { 19006 this._enhance(); 19007 }, 19008 19009 // To support the enhanced option in jQuery Mobile, we isolate DOM manipulation 19010 _enhance: function () { 19011 this.element.attr("role", "toolbar"); 19012 this.refresh(); 19013 }, 19014 19015 _destroy: function () { 19016 this._callChildMethod("destroy"); 19017 this.childWidgets.removeData("ui-controlgroup-data"); 19018 this.element.removeAttr("role"); 19019 if (this.options.items.controlgroupLabel) { 19020 this.element 19021 .find(this.options.items.controlgroupLabel) 19022 .find(".ui-controlgroup-label-contents") 19023 .contents().unwrap(); 19024 } 19025 }, 19026 19027 _initWidgets: function () { 19028 var that = this, 19029 childWidgets = []; 19030 19031 // First we iterate over each of the items options 19032 $.each(this.options.items, function (widget, selector) { 19033 var labels; 19034 var options = {}; 19035 19036 // Make sure the widget has a selector set 19037 if (!selector) { 19038 return; 19039 } 19040 19041 if (widget === "controlgroupLabel") { 19042 labels = that.element.find(selector); 19043 labels.each(function () { 19044 var element = $(this); 19045 19046 if (element.children(".ui-controlgroup-label-contents").length) { 19047 return; 19048 } 19049 element.contents() 19050 .wrapAll("<span class='ui-controlgroup-label-contents'></span>"); 19051 });
vendor: 9,049 bytes, lines 19052-19343
19052 that._addClass(labels, null, "ui-widget ui-widget-content ui-state-default"); 19053 childWidgets = childWidgets.concat(labels.get()); 19054 return; 19055 } 19056 19057 // Make sure the widget actually exists 19058 if (!$.fn[widget]) { 19059 return; 19060 } 19061 19062 // We assume everything is in the middle to start because we can't determine 19063 // first / last elements until all enhancments are done. 19064 if (that["_" + widget + "Options"]) { 19065 options = that["_" + widget + "Options"]("middle"); 19066 } else { 19067 options = { classes: {} }; 19068 } 19069 19070 // Find instances of this widget inside controlgroup and init them 19071 that.element 19072 .find(selector) 19073 .each(function () { 19074 var element = $(this); 19075 var instance = element[widget]("instance"); 19076 19077 // We need to clone the default options for this type of widget to avoid 19078 // polluting the variable options which has a wider scope than a single widget. 19079 var instanceOptions = $.widget.extend({}, options); 19080 19081 // If the button is the child of a spinner ignore it 19082 // TODO: Find a more generic solution 19083 if (widget === "button" && element.parent(".ui-spinner").length) { 19084 return; 19085 } 19086 19087 // Create the widget if it doesn't exist 19088 if (!instance) { 19089 instance = element[widget]()[widget]("instance"); 19090 } 19091 if (instance) { 19092 instanceOptions.classes = 19093 that._resolveClassesValues(instanceOptions.classes, instance); 19094 } 19095 element[widget](instanceOptions); 19096 19097 // Store an instance of the controlgroup to be able to reference 19098 // from the outermost element for changing options and refresh 19099 var widgetElement = element[widget]("widget"); 19100 $.data(widgetElement[0], "ui-controlgroup-data", 19101 instance ? instance : element[widget]("instance")); 19102 19103 childWidgets.push(widgetElement[0]); 19104 }); 19105 }); 19106 19107 this.childWidgets = $($.uniqueSort(childWidgets)); 19108 this._addClass(this.childWidgets, "ui-controlgroup-item"); 19109 }, 19110 19111 _callChildMethod: function (method) { 19112 this.childWidgets.each(function () { 19113 var element = $(this), 19114 data = element.data("ui-controlgroup-data"); 19115 if (data && data[method]) { 19116 data[method](); 19117 } 19118 }); 19119 }, 19120 19121 _updateCornerClass: function (element, position) { 19122 var remove = "ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all"; 19123 var add = this._buildSimpleOptions(position, "label").classes.label; 19124 19125 this._removeClass(element, null, remove); 19126 this._addClass(element, null, add); 19127 }, 19128 19129 _buildSimpleOptions: function (position, key) { 19130 var direction = this.options.direction === "vertical"; 19131 var result = { 19132 classes: {} 19133 }; 19134 result.classes[key] = { 19135 "middle": "", 19136 "first": "ui-corner-" + (direction ? "top" : "left"), 19137 "last": "ui-corner-" + (direction ? "bottom" : "right"), 19138 "only": "ui-corner-all" 19139 }[position]; 19140 19141 return result; 19142 }, 19143 19144 _spinnerOptions: function (position) { 19145 var options = this._buildSimpleOptions(position, "ui-spinner"); 19146 19147 options.classes["ui-spinner-up"] = ""; 19148 options.classes["ui-spinner-down"] = ""; 19149 19150 return options; 19151 }, 19152 19153 _buttonOptions: function (position) { 19154 return this._buildSimpleOptions(position, "ui-button"); 19155 }, 19156 19157 _checkboxradioOptions: function (position) { 19158 return this._buildSimpleOptions(position, "ui-checkboxradio-label"); 19159 }, 19160 19161 _selectmenuOptions: function (position) { 19162 var direction = this.options.direction === "vertical"; 19163 return { 19164 width: direction ? "auto" : false, 19165 classes: { 19166 middle: { 19167 "ui-selectmenu-button-open": "", 19168 "ui-selectmenu-button-closed": "" 19169 }, 19170 first: { 19171 "ui-selectmenu-button-open": "ui-corner-" + (direction ? "top" : "tl"), 19172 "ui-selectmenu-button-closed": "ui-corner-" + (direction ? "top" : "left") 19173 }, 19174 last: { 19175 "ui-selectmenu-button-open": direction ? "" : "ui-corner-tr", 19176 "ui-selectmenu-button-closed": "ui-corner-" + (direction ? "bottom" : "right") 19177 }, 19178 only: { 19179 "ui-selectmenu-button-open": "ui-corner-top", 19180 "ui-selectmenu-button-closed": "ui-corner-all" 19181 } 19182 19183 }[position] 19184 }; 19185 }, 19186 19187 _resolveClassesValues: function (classes, instance) { 19188 var result = {}; 19189 $.each(classes, function (key) { 19190 var current = instance.options.classes[key] || ""; 19191 current = String.prototype.trim.call(current.replace(controlgroupCornerRegex, "")); 19192 result[key] = (current + " " + classes[key]).replace(/\s+/g, " "); 19193 }); 19194 return result; 19195 }, 19196 19197 _setOption: function (key, value) { 19198 if (key === "direction") { 19199 this._removeClass("ui-controlgroup-" + this.options.direction); 19200 } 19201 19202 this._super(key, value); 19203 if (key === "disabled") { 19204 this._callChildMethod(value ? "disable" : "enable"); 19205 return; 19206 } 19207 19208 this.refresh(); 19209 }, 19210 19211 refresh: function () { 19212 var children, 19213 that = this; 19214 19215 this._addClass("ui-controlgroup ui-controlgroup-" + this.options.direction); 19216 19217 if (this.options.direction === "horizontal") { 19218 this._addClass(null, "ui-helper-clearfix"); 19219 } 19220 this._initWidgets(); 19221 19222 children = this.childWidgets; 19223 19224 // We filter here because we need to track all childWidgets not just the visible ones 19225 if (this.options.onlyVisible) { 19226 children = children.filter(":visible"); 19227 } 19228 19229 if (children.length) { 19230 19231 // We do this last because we need to make sure all enhancment is done 19232 // before determining first and last 19233 $.each(["first", "last"], function (index, value) { 19234 var instance = children[value]().data("ui-controlgroup-data"); 19235 19236 if (instance && that["_" + instance.widgetName + "Options"]) { 19237 var options = that["_" + instance.widgetName + "Options"]( 19238 children.length === 1 ? "only" : value 19239 ); 19240 options.classes = that._resolveClassesValues(options.classes, instance); 19241 instance.element[instance.widgetName](options); 19242 } else { 19243 that._updateCornerClass(children[value](), value); 19244 } 19245 }); 19246 19247 // Finally call the refresh method on each of the child widgets. 19248 this._callChildMethod("refresh"); 19249 } 19250 } 19251 }); 19252 19253 /*! 19254 * jQuery UI Checkboxradio 1.13.2 19255 * http://jqueryui.com 19256 * 19257 * Copyright jQuery Foundation and other contributors 19258 * Released under the MIT license. 19259 * http://jquery.org/license 19260 */ 19261 19262 //>>label: Checkboxradio 19263 //>>group: Widgets 19264 //>>description: Enhances a form with multiple themeable checkboxes or radio buttons. 19265 //>>docs: http://api.jqueryui.com/checkboxradio/ 19266 //>>demos: http://jqueryui.com/checkboxradio/ 19267 //>>css.structure: ../../themes/base/core.css 19268 //>>css.structure: ../../themes/base/button.css 19269 //>>css.structure: ../../themes/base/checkboxradio.css 19270 //>>css.theme: ../../themes/base/theme.css 19271 19272 19273 $.widget("ui.checkboxradio", [$.ui.formResetMixin, { 19274 version: "1.13.2", 19275 options: { 19276 disabled: null, 19277 label: null, 19278 icon: true, 19279 classes: { 19280 "ui-checkboxradio-label": "ui-corner-all", 19281 "ui-checkboxradio-icon": "ui-corner-all" 19282 } 19283 }, 19284 19285 _getCreateOptions: function () { 19286 var disabled, labels, labelContents; 19287 var options = this._super() || {}; 19288 19289 // We read the type here, because it makes more sense to throw a element type error first, 19290 // rather then the error for lack of a label. Often if its the wrong type, it 19291 // won't have a label (e.g. calling on a div, btn, etc) 19292 this._readType(); 19293 19294 labels = this.element.labels(); 19295 19296 // If there are multiple labels, use the last one 19297 this.label = $(labels[labels.length - 1]); 19298 if (!this.label.length) { 19299 $.error("No label found for checkboxradio widget"); 19300 } 19301 19302 this.originalLabel = ""; 19303 19304 // We need to get the label text but this may also need to make sure it does not contain the 19305 // input itself. 19306 // The label contents could be text, html, or a mix. We wrap all elements 19307 // and read the wrapper's `innerHTML` to get a string representation of 19308 // the label, without the input as part of it. 19309 labelContents = this.label.contents().not(this.element[0]); 19310 19311 if (labelContents.length) { 19312 this.originalLabel += labelContents 19313 .clone() 19314 .wrapAll("<div></div>") 19315 .parent() 19316 .html(); 19317 } 19318 19319 // Set the label option if we found label text 19320 if (this.originalLabel) { 19321 options.label = this.originalLabel; 19322 } 19323 19324 disabled = this.element[0].disabled; 19325 if (disabled != null) { 19326 options.disabled = disabled; 19327 } 19328 return options; 19329 }, 19330 19331 _create: function () { 19332 var checked = this.element[0].checked; 19333 19334 this._bindFormResetHandler(); 19335 19336 if (this.options.disabled == null) { 19337 this.options.disabled = this.element[0].disabled; 19338 } 19339 19340 this._setOption("disabled", this.options.disabled); 19341 this._addClass("ui-checkboxradio", "ui-helper-hidden-accessible"); 19342 this._addClass(this.label, "ui-checkboxradio-label", "ui-button ui-widget"); 19343
vendor: 3,218 bytes, lines 19344-19467
19344 if (this.type === "radio") { 19345 this._addClass(this.label, "ui-checkboxradio-radio-label"); 19346 } 19347 19348 if (this.options.label && this.options.label !== this.originalLabel) { 19349 this._updateLabel(); 19350 } else if (this.originalLabel) { 19351 this.options.label = this.originalLabel; 19352 } 19353 19354 this._enhance(); 19355 19356 if (checked) { 19357 this._addClass(this.label, "ui-checkboxradio-checked", "ui-state-active"); 19358 } 19359 19360 this._on({ 19361 change: "_toggleClasses", 19362 focus: function () { 19363 this._addClass(this.label, null, "ui-state-focus ui-visual-focus"); 19364 }, 19365 blur: function () { 19366 this._removeClass(this.label, null, "ui-state-focus ui-visual-focus"); 19367 } 19368 }); 19369 }, 19370 19371 _readType: function () { 19372 var nodeName = this.element[0].nodeName.toLowerCase(); 19373 this.type = this.element[0].type; 19374 if (nodeName !== "input" || !/radio|checkbox/.test(this.type)) { 19375 $.error("Can't create checkboxradio on element.nodeName=" + nodeName + 19376 " and element.type=" + this.type); 19377 } 19378 }, 19379 19380 // Support jQuery Mobile enhanced option 19381 _enhance: function () { 19382 this._updateIcon(this.element[0].checked); 19383 }, 19384 19385 widget: function () { 19386 return this.label; 19387 }, 19388 19389 _getRadioGroup: function () { 19390 var group; 19391 var name = this.element[0].name; 19392 var nameSelector = "input[name='" + $.escapeSelector(name) + "']"; 19393 19394 if (!name) { 19395 return $([]); 19396 } 19397 19398 if (this.form.length) { 19399 group = $(this.form[0].elements).filter(nameSelector); 19400 } else { 19401 19402 // Not inside a form, check all inputs that also are not inside a form 19403 group = $(nameSelector).filter(function () { 19404 return $(this)._form().length === 0; 19405 }); 19406 } 19407 19408 return group.not(this.element); 19409 }, 19410 19411 _toggleClasses: function () { 19412 var checked = this.element[0].checked; 19413 this._toggleClass(this.label, "ui-checkboxradio-checked", "ui-state-active", checked); 19414 19415 if (this.options.icon && this.type === "checkbox") { 19416 this._toggleClass(this.icon, null, "ui-icon-check ui-state-checked", checked) 19417 ._toggleClass(this.icon, null, "ui-icon-blank", !checked); 19418 } 19419 19420 if (this.type === "radio") { 19421 this._getRadioGroup() 19422 .each(function () { 19423 var instance = $(this).checkboxradio("instance"); 19424 19425 if (instance) { 19426 instance._removeClass(instance.label, 19427 "ui-checkboxradio-checked", "ui-state-active"); 19428 } 19429 }); 19430 } 19431 }, 19432 19433 _destroy: function () { 19434 this._unbindFormResetHandler(); 19435 19436 if (this.icon) { 19437 this.icon.remove(); 19438 this.iconSpace.remove(); 19439 } 19440 }, 19441 19442 _setOption: function (key, value) { 19443 19444 // We don't allow the value to be set to nothing 19445 if (key === "label" && !value) { 19446 return; 19447 } 19448 19449 this._super(key, value); 19450 19451 if (key === "disabled") { 19452 this._toggleClass(this.label, null, "ui-state-disabled", value); 19453 this.element[0].disabled = value; 19454 19455 // Don't refresh when setting disabled 19456 return; 19457 } 19458 this.refresh(); 19459 }, 19460 19461 _updateIcon: function (checked) { 19462 var toAdd = "ui-icon ui-icon-background "; 19463 19464 if (this.options.icon) { 19465 if (!this.icon) { 19466 this.icon = $("<span>"); 19467 this.iconSpace = $("<span> </span>");
vendor: 5,778 bytes, lines 19468-19674
19468 this._addClass(this.iconSpace, "ui-checkboxradio-icon-space"); 19469 } 19470 19471 if (this.type === "checkbox") { 19472 toAdd += checked ? "ui-icon-check ui-state-checked" : "ui-icon-blank"; 19473 this._removeClass(this.icon, null, checked ? "ui-icon-blank" : "ui-icon-check"); 19474 } else { 19475 toAdd += "ui-icon-blank"; 19476 } 19477 this._addClass(this.icon, "ui-checkboxradio-icon", toAdd); 19478 if (!checked) { 19479 this._removeClass(this.icon, null, "ui-icon-check ui-state-checked"); 19480 } 19481 this.icon.prependTo(this.label).after(this.iconSpace); 19482 } else if (this.icon !== undefined) { 19483 this.icon.remove(); 19484 this.iconSpace.remove(); 19485 delete this.icon; 19486 } 19487 }, 19488 19489 _updateLabel: function () { 19490 19491 // Remove the contents of the label ( minus the icon, icon space, and input ) 19492 var contents = this.label.contents().not(this.element[0]); 19493 if (this.icon) { 19494 contents = contents.not(this.icon[0]); 19495 } 19496 if (this.iconSpace) { 19497 contents = contents.not(this.iconSpace[0]); 19498 } 19499 contents.remove(); 19500 19501 this.label.append(this.options.label); 19502 }, 19503 19504 refresh: function () { 19505 var checked = this.element[0].checked, 19506 isDisabled = this.element[0].disabled; 19507 19508 this._updateIcon(checked); 19509 this._toggleClass(this.label, "ui-checkboxradio-checked", "ui-state-active", checked); 19510 if (this.options.label !== null) { 19511 this._updateLabel(); 19512 } 19513 19514 if (isDisabled !== this.options.disabled) { 19515 this._setOptions({ "disabled": isDisabled }); 19516 } 19517 } 19518 19519 }]); 19520 19521 var widgetsCheckboxradio = $.ui.checkboxradio; 19522 19523 19524 /*! 19525 * jQuery UI Button 1.13.2 19526 * http://jqueryui.com 19527 * 19528 * Copyright jQuery Foundation and other contributors 19529 * Released under the MIT license. 19530 * http://jquery.org/license 19531 */ 19532 19533 //>>label: Button 19534 //>>group: Widgets 19535 //>>description: Enhances a form with themeable buttons. 19536 //>>docs: http://api.jqueryui.com/button/ 19537 //>>demos: http://jqueryui.com/button/ 19538 //>>css.structure: ../../themes/base/core.css 19539 //>>css.structure: ../../themes/base/button.css 19540 //>>css.theme: ../../themes/base/theme.css 19541 19542 19543 $.widget("ui.button", { 19544 version: "1.13.2", 19545 defaultElement: "<button>", 19546 options: { 19547 classes: { 19548 "ui-button": "ui-corner-all" 19549 }, 19550 disabled: null, 19551 icon: null, 19552 iconPosition: "beginning", 19553 label: null, 19554 showLabel: true 19555 }, 19556 19557 _getCreateOptions: function () { 19558 var disabled, 19559 19560 // This is to support cases like in jQuery Mobile where the base widget does have 19561 // an implementation of _getCreateOptions 19562 options = this._super() || {}; 19563 19564 this.isInput = this.element.is("input"); 19565 19566 disabled = this.element[0].disabled; 19567 if (disabled != null) { 19568 options.disabled = disabled; 19569 } 19570 19571 this.originalLabel = this.isInput ? this.element.val() : this.element.html(); 19572 if (this.originalLabel) { 19573 options.label = this.originalLabel; 19574 } 19575 19576 return options; 19577 }, 19578 19579 _create: function () { 19580 if (!this.option.showLabel & !this.options.icon) { 19581 this.options.showLabel = true; 19582 } 19583 19584 // We have to check the option again here even though we did in _getCreateOptions, 19585 // because null may have been passed on init which would override what was set in 19586 // _getCreateOptions 19587 if (this.options.disabled == null) { 19588 this.options.disabled = this.element[0].disabled || false; 19589 } 19590 19591 this.hasTitle = !!this.element.attr("title"); 19592 19593 // Check to see if the label needs to be set or if its already correct 19594 if (this.options.label && this.options.label !== this.originalLabel) { 19595 if (this.isInput) { 19596 this.element.val(this.options.label); 19597 } else { 19598 this.element.html(this.options.label); 19599 } 19600 } 19601 this._addClass("ui-button", "ui-widget"); 19602 this._setOption("disabled", this.options.disabled); 19603 this._enhance(); 19604 19605 if (this.element.is("a")) { 19606 this._on({ 19607 "keyup": function (event) { 19608 if (event.keyCode === $.ui.keyCode.SPACE) { 19609 event.preventDefault(); 19610 19611 // Support: PhantomJS <= 1.9, IE 8 Only 19612 // If a native click is available use it so we actually cause navigation 19613 // otherwise just trigger a click event 19614 if (this.element[0].click) { 19615 this.element[0].click(); 19616 } else { 19617 this.element.trigger("click"); 19618 } 19619 } 19620 } 19621 }); 19622 } 19623 }, 19624 19625 _enhance: function () { 19626 if (!this.element.is("button")) { 19627 this.element.attr("role", "button"); 19628 } 19629 19630 if (this.options.icon) { 19631 this._updateIcon("icon", this.options.icon); 19632 this._updateTooltip(); 19633 } 19634 }, 19635 19636 _updateTooltip: function () { 19637 this.title = this.element.attr("title"); 19638 19639 if (!this.options.showLabel && !this.title) { 19640 this.element.attr("title", this.options.label); 19641 } 19642 }, 19643 19644 _updateIcon: function (option, value) { 19645 var icon = option !== "iconPosition", 19646 position = icon ? this.options.iconPosition : value, 19647 displayBlock = position === "top" || position === "bottom"; 19648 19649 // Create icon 19650 if (!this.icon) { 19651 this.icon = $("<span>"); 19652 19653 this._addClass(this.icon, "ui-button-icon", "ui-icon"); 19654 19655 if (!this.options.showLabel) { 19656 this._addClass("ui-button-icon-only"); 19657 } 19658 } else if (icon) { 19659 19660 // If we are updating the icon remove the old icon class 19661 this._removeClass(this.icon, null, this.options.icon); 19662 } 19663 19664 // If we are updating the icon add the new icon class 19665 if (icon) { 19666 this._addClass(this.icon, null, value); 19667 } 19668 19669 this._attachIcon(position); 19670 19671 // If the icon is on top or bottom we need to add the ui-widget-icon-block class and remove 19672 // the iconSpace if there is one. 19673 if (displayBlock) { 19674 this._addClass(this.icon, null, "ui-widget-icon-block");
vendor: 6,075 bytes, lines 19675-19892
19675 if (this.iconSpace) { 19676 this.iconSpace.remove(); 19677 } 19678 } else { 19679 19680 // Position is beginning or end so remove the ui-widget-icon-block class and add the 19681 // space if it does not exist 19682 if (!this.iconSpace) { 19683 this.iconSpace = $("<span> </span>"); 19684 this._addClass(this.iconSpace, "ui-button-icon-space"); 19685 } 19686 this._removeClass(this.icon, null, "ui-wiget-icon-block"); 19687 this._attachIconSpace(position); 19688 } 19689 }, 19690 19691 _destroy: function () { 19692 this.element.removeAttr("role"); 19693 19694 if (this.icon) { 19695 this.icon.remove(); 19696 } 19697 if (this.iconSpace) { 19698 this.iconSpace.remove(); 19699 } 19700 if (!this.hasTitle) { 19701 this.element.removeAttr("title"); 19702 } 19703 }, 19704 19705 _attachIconSpace: function (iconPosition) { 19706 this.icon[/^(?:end|bottom)/.test(iconPosition) ? "before" : "after"](this.iconSpace); 19707 }, 19708 19709 _attachIcon: function (iconPosition) { 19710 this.element[/^(?:end|bottom)/.test(iconPosition) ? "append" : "prepend"](this.icon); 19711 }, 19712 19713 _setOptions: function (options) { 19714 var newShowLabel = options.showLabel === undefined ? 19715 this.options.showLabel : 19716 options.showLabel, 19717 newIcon = options.icon === undefined ? this.options.icon : options.icon; 19718 19719 if (!newShowLabel && !newIcon) { 19720 options.showLabel = true; 19721 } 19722 this._super(options); 19723 }, 19724 19725 _setOption: function (key, value) { 19726 if (key === "icon") { 19727 if (value) { 19728 this._updateIcon(key, value); 19729 } else if (this.icon) { 19730 this.icon.remove(); 19731 if (this.iconSpace) { 19732 this.iconSpace.remove(); 19733 } 19734 } 19735 } 19736 19737 if (key === "iconPosition") { 19738 this._updateIcon(key, value); 19739 } 19740 19741 // Make sure we can't end up with a button that has neither text nor icon 19742 if (key === "showLabel") { 19743 this._toggleClass("ui-button-icon-only", null, !value); 19744 this._updateTooltip(); 19745 } 19746 19747 if (key === "label") { 19748 if (this.isInput) { 19749 this.element.val(value); 19750 } else { 19751 19752 // If there is an icon, append it, else nothing then append the value 19753 // this avoids removal of the icon when setting label text 19754 this.element.html(value); 19755 if (this.icon) { 19756 this._attachIcon(this.options.iconPosition); 19757 this._attachIconSpace(this.options.iconPosition); 19758 } 19759 } 19760 } 19761 19762 this._super(key, value); 19763 19764 if (key === "disabled") { 19765 this._toggleClass(null, "ui-state-disabled", value); 19766 this.element[0].disabled = value; 19767 if (value) { 19768 this.element.trigger("blur"); 19769 } 19770 } 19771 }, 19772 19773 refresh: function () { 19774 19775 // Make sure to only check disabled if its an element that supports this otherwise 19776 // check for the disabled class to determine state 19777 var isDisabled = this.element.is("input, button") ? 19778 this.element[0].disabled : this.element.hasClass("ui-button-disabled"); 19779 19780 if (isDisabled !== this.options.disabled) { 19781 this._setOptions({ disabled: isDisabled }); 19782 } 19783 19784 this._updateTooltip(); 19785 } 19786 }); 19787 19788 // DEPRECATED 19789 if ($.uiBackCompat !== false) { 19790 19791 // Text and Icons options 19792 $.widget("ui.button", $.ui.button, { 19793 options: { 19794 text: true, 19795 icons: { 19796 primary: null, 19797 secondary: null 19798 } 19799 }, 19800 19801 _create: function () { 19802 if (this.options.showLabel && !this.options.text) { 19803 this.options.showLabel = this.options.text; 19804 } 19805 if (!this.options.showLabel && this.options.text) { 19806 this.options.text = this.options.showLabel; 19807 } 19808 if (!this.options.icon && (this.options.icons.primary || 19809 this.options.icons.secondary)) { 19810 if (this.options.icons.primary) { 19811 this.options.icon = this.options.icons.primary; 19812 } else { 19813 this.options.icon = this.options.icons.secondary; 19814 this.options.iconPosition = "end"; 19815 } 19816 } else if (this.options.icon) { 19817 this.options.icons.primary = this.options.icon; 19818 } 19819 this._super(); 19820 }, 19821 19822 _setOption: function (key, value) { 19823 if (key === "text") { 19824 this._super("showLabel", value); 19825 return; 19826 } 19827 if (key === "showLabel") { 19828 this.options.text = value; 19829 } 19830 if (key === "icon") { 19831 this.options.icons.primary = value; 19832 } 19833 if (key === "icons") { 19834 if (value.primary) { 19835 this._super("icon", value.primary); 19836 this._super("iconPosition", "beginning"); 19837 } else if (value.secondary) { 19838 this._super("icon", value.secondary); 19839 this._super("iconPosition", "end"); 19840 } 19841 } 19842 this._superApply(arguments); 19843 } 19844 }); 19845 19846 $.fn.button = (function (orig) { 19847 return function (options) { 19848 var isMethodCall = typeof options === "string"; 19849 var args = Array.prototype.slice.call(arguments, 1); 19850 var returnValue = this; 19851 19852 if (isMethodCall) { 19853 19854 // If this is an empty collection, we need to have the instance method 19855 // return undefined instead of the jQuery instance 19856 if (!this.length && options === "instance") { 19857 returnValue = undefined; 19858 } else { 19859 this.each(function () { 19860 var methodValue; 19861 var type = $(this).attr("type"); 19862 var name = type !== "checkbox" && type !== "radio" ? 19863 "button" : 19864 "checkboxradio"; 19865 var instance = $.data(this, "ui-" + name); 19866 19867 if (options === "instance") { 19868 returnValue = instance; 19869 return false; 19870 } 19871 19872 if (!instance) { 19873 return $.error("cannot call methods on button" + 19874 " prior to initialization; " + 19875 "attempted to call method '" + options + "'"); 19876 } 19877 19878 if (typeof instance[options] !== "function" || 19879 options.charAt(0) === "_") { 19880 return $.error("no such method '" + options + "' for button" + 19881 " widget instance"); 19882 } 19883 19884 methodValue = instance[options].apply(instance, args); 19885 19886 if (methodValue !== instance && methodValue !== undefined) { 19887 returnValue = methodValue && methodValue.jquery ? 19888 returnValue.pushStack(methodValue.get()) : 19889 methodValue; 19890 return false; 19891 } 19892 });
vendor: 5,001 bytes, lines 19893-20024
19893 } 19894 } else { 19895 19896 // Allow multiple hashes to be passed on init 19897 if (args.length) { 19898 options = $.widget.extend.apply(null, [options].concat(args)); 19899 } 19900 19901 this.each(function () { 19902 var type = $(this).attr("type"); 19903 var name = type !== "checkbox" && type !== "radio" ? "button" : "checkboxradio"; 19904 var instance = $.data(this, "ui-" + name); 19905 19906 if (instance) { 19907 instance.option(options || {}); 19908 if (instance._init) { 19909 instance._init(); 19910 } 19911 } else { 19912 if (name === "button") { 19913 orig.call($(this), options); 19914 return; 19915 } 19916 19917 $(this).checkboxradio($.extend({ icon: false }, options)); 19918 } 19919 }); 19920 } 19921 19922 return returnValue; 19923 }; 19924 })($.fn.button); 19925 19926 $.fn.buttonset = function () { 19927 if (!$.ui.controlgroup) { 19928 $.error("Controlgroup widget missing"); 19929 } 19930 if (arguments[0] === "option" && arguments[1] === "items" && arguments[2]) { 19931 return this.controlgroup.apply(this, 19932 [arguments[0], "items.button", arguments[2]]); 19933 } 19934 if (arguments[0] === "option" && arguments[1] === "items") { 19935 return this.controlgroup.apply(this, [arguments[0], "items.button"]); 19936 } 19937 if (typeof arguments[0] === "object" && arguments[0].items) { 19938 arguments[0].items = { 19939 button: arguments[0].items 19940 }; 19941 } 19942 return this.controlgroup.apply(this, arguments); 19943 }; 19944 } 19945 19946 var widgetsButton = $.ui.button; 19947 19948 19949 /* eslint-disable max-len, camelcase */ 19950 /*! 19951 * jQuery UI Datepicker 1.13.2 19952 * http://jqueryui.com 19953 * 19954 * Copyright jQuery Foundation and other contributors 19955 * Released under the MIT license. 19956 * http://jquery.org/license 19957 */ 19958 19959 //>>label: Datepicker 19960 //>>group: Widgets 19961 //>>description: Displays a calendar from an input or inline for selecting dates. 19962 //>>docs: http://api.jqueryui.com/datepicker/ 19963 //>>demos: http://jqueryui.com/datepicker/ 19964 //>>css.structure: ../../themes/base/core.css 19965 //>>css.structure: ../../themes/base/datepicker.css 19966 //>>css.theme: ../../themes/base/theme.css 19967 19968 19969 $.extend($.ui, { datepicker: { version: "1.13.2" } }); 19970 19971 var datepicker_instActive; 19972 19973 function datepicker_getZindex(elem) { 19974 var position, value; 19975 while (elem.length && elem[0] !== document) { 19976 19977 // Ignore z-index if position is set to a value where z-index is ignored by the browser 19978 // This makes behavior of this function consistent across browsers 19979 // WebKit always returns auto if the element is positioned 19980 position = elem.css("position"); 19981 if (position === "absolute" || position === "relative" || position === "fixed") { 19982 19983 // IE returns 0 when zIndex is not specified 19984 // other browsers return a string 19985 // we ignore the case of nested elements with an explicit value of 0 19986 // <div style="z-index: -10;"><div style="z-index: 0;"></div></div> 19987 value = parseInt(elem.css("zIndex"), 10); 19988 if (!isNaN(value) && value !== 0) { 19989 return value; 19990 } 19991 } 19992 elem = elem.parent(); 19993 } 19994 19995 return 0; 19996 } 19997 19998 /* Date picker manager. 19999 Use the singleton instance of this class, $.datepicker, to interact with the date picker. 20000 Settings for (groups of) date pickers are maintained in an instance object, 20001 allowing multiple different settings on the same page. */ 20002 20003 function Datepicker() { 20004 this._curInst = null; // The current instance in use 20005 this._keyEvent = false; // If the last event was a key event 20006 this._disabledInputs = []; // List of date picker inputs that have been disabled 20007 this._datepickerShowing = false; // True if the popup picker is showing , false if not 20008 this._inDialog = false; // True if showing within a "dialog", false if not 20009 this._mainDivId = "ui-datepicker-div"; // The ID of the main datepicker division 20010 this._inlineClass = "ui-datepicker-inline"; // The name of the inline marker class 20011 this._appendClass = "ui-datepicker-append"; // The name of the append marker class 20012 this._triggerClass = "ui-datepicker-trigger"; // The name of the trigger marker class 20013 this._dialogClass = "ui-datepicker-dialog"; // The name of the dialog marker class 20014 this._disableClass = "ui-datepicker-disabled"; // The name of the disabled covering marker class 20015 this._unselectableClass = "ui-datepicker-unselectable"; // The name of the unselectable cell marker class 20016 this._currentClass = "ui-datepicker-current-day"; // The name of the current day marker class 20017 this._dayOverClass = "ui-datepicker-days-cell-over"; // The name of the day hover marker class 20018 this.regional = []; // Available regional settings, indexed by language code 20019 this.regional[""] = { // Default regional settings 20020 closeText: "Done", // Display text for close link 20021 prevText: "Prev", // Display text for previous month link 20022 nextText: "Next", // Display text for next month link 20023 currentText: "Today", // Display text for current month link 20024 monthNames: ["January", "February", "March", "April", "May", "June",
20025 "July", "August", "September", "October", "November", "December"], // Names of months for drop-down and formatting 20026 monthNamesShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], // For formatting 20027 dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], // For formatting 20028 dayNamesShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], // For formatting 20029 dayNamesMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], // Column headings for days starting at Sunday 20030 weekHeader: "Wk", // Column header for week of the year 20031 dateFormat: "mm/dd/yy", // See format options on parseDate 20032 firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ... 20033 isRTL: false, // True if right-to-left language, false if left-to-right 20034 showMonthAfterYear: false, // True if the year select precedes month, false for month then year 20035 yearSuffix: "", // Additional text to append to the year in the month headers, 20036 selectMonthLabel: "Select month", // Invisible label for month selector 20037 selectYearLabel: "Select year" // Invisible label for year selector 20038 }; 20039 this._defaults = { // Global defaults for all the date picker instances 20040 showOn: "focus", // "focus" for popup on focus, 20041 // "button" for trigger button, or "both" for either 20042 showAnim: "fadeIn", // Name of jQuery animation for popup 20043 showOptions: {}, // Options for enhanced animations 20044 defaultDate: null, // Used when field is blank: actual date, 20045 // +/-number for offset from today, null for today 20046 appendText: "", // Display text following the input box, e.g. showing the format 20047 buttonText: "...", // Text for trigger button 20048 buttonImage: "", // URL for trigger button image 20049 buttonImageOnly: false, // True if the image appears alone, false if it appears on a button 20050 hideIfNoPrevNext: false, // True to hide next/previous month links 20051 // if not applicable, false to just disable them 20052 navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links 20053 gotoCurrent: false, // True if today link goes back to current selection instead 20054 changeMonth: false, // True if month can be selected directly, false if only prev/next 20055 changeYear: false, // True if year can be selected directly, false if only prev/next 20056 yearRange: "c-10:c+10", // Range of years to display in drop-down, 20057 // either relative to today's year (-nn:+nn), relative to currently displayed year 20058 // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n) 20059 showOtherMonths: false, // True to show dates in other months, false to leave blank 20060 selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable 20061 showWeek: false, // True to show week of the year, false to not show it 20062 calculateWeek: this.iso8601Week, // How to calculate the week of the year, 20063 // takes a Date and returns the number of the week for it 20064 shortYearCutoff: "+10", // Short year values < this are in the current century, 20065 // > this are in the previous century, 20066 // string value starting with "+" for current year + value 20067 minDate: null, // The earliest selectable date, or null for no limit 20068 maxDate: null, // The latest selectable date, or null for no limit 20069 duration: "fast", // Duration of display/closure 20070 beforeShowDay: null, // Function that takes a date and returns an array with 20071 // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "", 20072 // [2] = cell title (optional), e.g. $.datepicker.noWeekends 20073 beforeShow: null, // Function that takes an input field and 20074 // returns a set of custom settings for the date picker 20075 onSelect: null, // Define a callback function when a date is selected 20076 onChangeMonthYear: null, // Define a callback function when the month or year is changed 20077 onClose: null, // Define a callback function when the datepicker is closed
vendor: 10,578 bytes, lines 20078-20358
20078 onUpdateDatepicker: null, // Define a callback function when the datepicker is updated 20079 numberOfMonths: 1, // Number of months to show at a time 20080 showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0) 20081 stepMonths: 1, // Number of months to step back/forward 20082 stepBigMonths: 12, // Number of months to step back/forward for the big links 20083 altField: "", // Selector for an alternate field to store selected dates into 20084 altFormat: "", // The date format to use for the alternate field 20085 constrainInput: true, // The input is constrained by the current date format 20086 showButtonPanel: false, // True to show button panel, false to not show it 20087 autoSize: false, // True to size the input for the date format, false to leave as is 20088 disabled: false // The initial disabled state 20089 }; 20090 $.extend(this._defaults, this.regional[""]); 20091 this.regional.en = $.extend(true, {}, this.regional[""]); 20092 this.regional["en-US"] = $.extend(true, {}, this.regional.en); 20093 this.dpDiv = datepicker_bindHover($("<div id='" + this._mainDivId + "' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")); 20094 } 20095 20096 $.extend(Datepicker.prototype, { 20097 20098 /* Class name added to elements to indicate already configured with a date picker. */ 20099 markerClassName: "hasDatepicker", 20100 20101 //Keep track of the maximum number of rows displayed (see #7043) 20102 maxRows: 4, 20103 20104 // TODO rename to "widget" when switching to widget factory 20105 _widgetDatepicker: function () { 20106 return this.dpDiv; 20107 }, 20108 20109 /* Override the default settings for all instances of the date picker. 20110 * @param settings object - the new settings to use as defaults (anonymous object) 20111 * @return the manager object 20112 */ 20113 setDefaults: function (settings) { 20114 datepicker_extendRemove(this._defaults, settings || {}); 20115 return this; 20116 }, 20117 20118 /* Attach the date picker to a jQuery selection. 20119 * @param target element - the target input field or division or span 20120 * @param settings object - the new settings to use for this date picker instance (anonymous) 20121 */ 20122 _attachDatepicker: function (target, settings) { 20123 var nodeName, inline, inst; 20124 nodeName = target.nodeName.toLowerCase(); 20125 inline = (nodeName === "div" || nodeName === "span"); 20126 if (!target.id) { 20127 this.uuid += 1; 20128 target.id = "dp" + this.uuid; 20129 } 20130 inst = this._newInst($(target), inline); 20131 inst.settings = $.extend({}, settings || {}); 20132 if (nodeName === "input") { 20133 this._connectDatepicker(target, inst); 20134 } else if (inline) { 20135 this._inlineDatepicker(target, inst); 20136 } 20137 }, 20138 20139 /* Create a new instance object. */ 20140 _newInst: function (target, inline) { 20141 var id = target[0].id.replace(/([^A-Za-z0-9_\-])/g, "\\\\$1"); // escape jQuery meta chars 20142 return { 20143 id: id, input: target, // associated target 20144 selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection 20145 drawMonth: 0, drawYear: 0, // month being drawn 20146 inline: inline, // is datepicker inline or not 20147 dpDiv: (!inline ? this.dpDiv : // presentation div 20148 datepicker_bindHover($("<div class='" + this._inlineClass + " ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))) 20149 }; 20150 }, 20151 20152 /* Attach the date picker to an input field. */ 20153 _connectDatepicker: function (target, inst) { 20154 var input = $(target); 20155 inst.append = $([]); 20156 inst.trigger = $([]); 20157 if (input.hasClass(this.markerClassName)) { 20158 return; 20159 } 20160 this._attachments(input, inst); 20161 input.addClass(this.markerClassName).on("keydown", this._doKeyDown). 20162 on("keypress", this._doKeyPress).on("keyup", this._doKeyUp); 20163 this._autoSize(inst); 20164 $.data(target, "datepicker", inst); 20165 20166 //If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665) 20167 if (inst.settings.disabled) { 20168 this._disableDatepicker(target); 20169 } 20170 }, 20171 20172 /* Make attachments based on settings. */ 20173 _attachments: function (input, inst) { 20174 var showOn, buttonText, buttonImage, 20175 appendText = this._get(inst, "appendText"), 20176 isRTL = this._get(inst, "isRTL"); 20177 20178 if (inst.append) { 20179 inst.append.remove(); 20180 } 20181 if (appendText) { 20182 inst.append = $("<span>") 20183 .addClass(this._appendClass) 20184 .text(appendText); 20185 input[isRTL ? "before" : "after"](inst.append); 20186 } 20187 20188 input.off("focus", this._showDatepicker); 20189 20190 if (inst.trigger) { 20191 inst.trigger.remove(); 20192 } 20193 20194 showOn = this._get(inst, "showOn"); 20195 if (showOn === "focus" || showOn === "both") { // pop-up date picker when in the marked field 20196 input.on("focus", this._showDatepicker); 20197 } 20198 if (showOn === "button" || showOn === "both") { // pop-up date picker when button clicked 20199 buttonText = this._get(inst, "buttonText"); 20200 buttonImage = this._get(inst, "buttonImage"); 20201 20202 if (this._get(inst, "buttonImageOnly")) { 20203 inst.trigger = $("<img>") 20204 .addClass(this._triggerClass) 20205 .attr({ 20206 src: buttonImage, 20207 alt: buttonText, 20208 title: buttonText 20209 }); 20210 } else { 20211 inst.trigger = $("<button type='button'>") 20212 .addClass(this._triggerClass); 20213 if (buttonImage) { 20214 inst.trigger.html( 20215 $("<img>") 20216 .attr({ 20217 src: buttonImage, 20218 alt: buttonText, 20219 title: buttonText 20220 }) 20221 ); 20222 } else { 20223 inst.trigger.text(buttonText); 20224 } 20225 } 20226 20227 input[isRTL ? "before" : "after"](inst.trigger); 20228 inst.trigger.on("click", function () { 20229 if ($.datepicker._datepickerShowing && $.datepicker._lastInput === input[0]) { 20230 $.datepicker._hideDatepicker(); 20231 } else if ($.datepicker._datepickerShowing && $.datepicker._lastInput !== input[0]) { 20232 $.datepicker._hideDatepicker(); 20233 $.datepicker._showDatepicker(input[0]); 20234 } else { 20235 $.datepicker._showDatepicker(input[0]); 20236 } 20237 return false; 20238 }); 20239 } 20240 }, 20241 20242 /* Apply the maximum length for the date format. */ 20243 _autoSize: function (inst) { 20244 if (this._get(inst, "autoSize") && !inst.inline) { 20245 var findMax, max, maxI, i, 20246 date = new Date(2009, 12 - 1, 20), // Ensure double digits 20247 dateFormat = this._get(inst, "dateFormat"); 20248 20249 if (dateFormat.match(/[DM]/)) { 20250 findMax = function (names) { 20251 max = 0; 20252 maxI = 0; 20253 for (i = 0; i < names.length; i++) { 20254 if (names[i].length > max) { 20255 max = names[i].length; 20256 maxI = i; 20257 } 20258 } 20259 return maxI; 20260 }; 20261 date.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ? 20262 "monthNames" : "monthNamesShort")))); 20263 date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ? 20264 "dayNames" : "dayNamesShort"))) + 20 - date.getDay()); 20265 } 20266 inst.input.attr("size", this._formatDate(inst, date).length); 20267 } 20268 }, 20269 20270 /* Attach an inline date picker to a div. */ 20271 _inlineDatepicker: function (target, inst) { 20272 var divSpan = $(target); 20273 if (divSpan.hasClass(this.markerClassName)) { 20274 return; 20275 } 20276 divSpan.addClass(this.markerClassName).append(inst.dpDiv); 20277 $.data(target, "datepicker", inst); 20278 this._setDate(inst, this._getDefaultDate(inst), true); 20279 this._updateDatepicker(inst); 20280 this._updateAlternate(inst); 20281 20282 //If disabled option is true, disable the datepicker before showing it (see ticket #5665) 20283 if (inst.settings.disabled) { 20284 this._disableDatepicker(target); 20285 } 20286 20287 // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements 20288 // http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height 20289 inst.dpDiv.css("display", "block"); 20290 }, 20291 20292 /* Pop-up the date picker in a "dialog" box. 20293 * @param input element - ignored 20294 * @param date string or Date - the initial date to display 20295 * @param onSelect function - the function to call when a date is selected 20296 * @param settings object - update the dialog date picker instance's settings (anonymous object) 20297 * @param pos int[2] - coordinates for the dialog's position within the screen or 20298 * event - with x/y coordinates or 20299 * leave empty for default (screen centre) 20300 * @return the manager object 20301 */ 20302 _dialogDatepicker: function (input, date, onSelect, settings, pos) { 20303 var id, browserWidth, browserHeight, scrollX, scrollY, 20304 inst = this._dialogInst; // internal instance 20305 20306 if (!inst) { 20307 this.uuid += 1; 20308 id = "dp" + this.uuid; 20309 this._dialogInput = $("<input type='text' id='" + id + 20310 "' style='position: absolute; top: -100px; width: 0px;'/>"); 20311 this._dialogInput.on("keydown", this._doKeyDown); 20312 $("body").append(this._dialogInput); 20313 inst = this._dialogInst = this._newInst(this._dialogInput, false); 20314 inst.settings = {}; 20315 $.data(this._dialogInput[0], "datepicker", inst); 20316 } 20317 datepicker_extendRemove(inst.settings, settings || {}); 20318 date = (date && date.constructor === Date ? this._formatDate(inst, date) : date); 20319 this._dialogInput.val(date); 20320 20321 this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null); 20322 if (!this._pos) { 20323 browserWidth = document.documentElement.clientWidth; 20324 browserHeight = document.documentElement.clientHeight; 20325 scrollX = document.documentElement.scrollLeft || document.body.scrollLeft; 20326 scrollY = document.documentElement.scrollTop || document.body.scrollTop; 20327 this._pos = // should use actual width/height below 20328 [(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY]; 20329 } 20330 20331 // Move input on screen for focus, but hidden behind dialog 20332 this._dialogInput.css("left", (this._pos[0] + 20) + "px").css("top", this._pos[1] + "px"); 20333 inst.settings.onSelect = onSelect; 20334 this._inDialog = true; 20335 this.dpDiv.addClass(this._dialogClass); 20336 this._showDatepicker(this._dialogInput[0]); 20337 if ($.blockUI) { 20338 $.blockUI(this.dpDiv); 20339 } 20340 $.data(this._dialogInput[0], "datepicker", inst); 20341 return this; 20342 }, 20343 20344 /* Detach a datepicker from its control. 20345 * @param target element - the target input field or division or span 20346 */ 20347 _destroyDatepicker: function (target) { 20348 var nodeName, 20349 $target = $(target), 20350 inst = $.data(target, "datepicker"); 20351 20352 if (!$target.hasClass(this.markerClassName)) { 20353 return; 20354 } 20355 20356 nodeName = target.nodeName.toLowerCase(); 20357 $.removeData(target, "datepicker"); 20358 if (nodeName === "input") {
vendor: 12,085 bytes, lines 20359-20710
20359 inst.append.remove(); 20360 inst.trigger.remove(); 20361 $target.removeClass(this.markerClassName). 20362 off("focus", this._showDatepicker). 20363 off("keydown", this._doKeyDown). 20364 off("keypress", this._doKeyPress). 20365 off("keyup", this._doKeyUp); 20366 } else if (nodeName === "div" || nodeName === "span") { 20367 $target.removeClass(this.markerClassName).empty(); 20368 } 20369 20370 if (datepicker_instActive === inst) { 20371 datepicker_instActive = null; 20372 this._curInst = null; 20373 } 20374 }, 20375 20376 /* Enable the date picker to a jQuery selection. 20377 * @param target element - the target input field or division or span 20378 */ 20379 _enableDatepicker: function (target) { 20380 var nodeName, inline, 20381 $target = $(target), 20382 inst = $.data(target, "datepicker"); 20383 20384 if (!$target.hasClass(this.markerClassName)) { 20385 return; 20386 } 20387 20388 nodeName = target.nodeName.toLowerCase(); 20389 if (nodeName === "input") { 20390 target.disabled = false; 20391 inst.trigger.filter("button"). 20392 each(function () { 20393 this.disabled = false; 20394 }).end(). 20395 filter("img").css({ opacity: "1.0", cursor: "" }); 20396 } else if (nodeName === "div" || nodeName === "span") { 20397 inline = $target.children("." + this._inlineClass); 20398 inline.children().removeClass("ui-state-disabled"); 20399 inline.find("select.ui-datepicker-month, select.ui-datepicker-year"). 20400 prop("disabled", false); 20401 } 20402 this._disabledInputs = $.map(this._disabledInputs, 20403 20404 // Delete entry 20405 function (value) { 20406 return (value === target ? null : value); 20407 }); 20408 }, 20409 20410 /* Disable the date picker to a jQuery selection. 20411 * @param target element - the target input field or division or span 20412 */ 20413 _disableDatepicker: function (target) { 20414 var nodeName, inline, 20415 $target = $(target), 20416 inst = $.data(target, "datepicker"); 20417 20418 if (!$target.hasClass(this.markerClassName)) { 20419 return; 20420 } 20421 20422 nodeName = target.nodeName.toLowerCase(); 20423 if (nodeName === "input") { 20424 target.disabled = true; 20425 inst.trigger.filter("button"). 20426 each(function () { 20427 this.disabled = true; 20428 }).end(). 20429 filter("img").css({ opacity: "0.5", cursor: "default" }); 20430 } else if (nodeName === "div" || nodeName === "span") { 20431 inline = $target.children("." + this._inlineClass); 20432 inline.children().addClass("ui-state-disabled"); 20433 inline.find("select.ui-datepicker-month, select.ui-datepicker-year"). 20434 prop("disabled", true); 20435 } 20436 this._disabledInputs = $.map(this._disabledInputs, 20437 20438 // Delete entry 20439 function (value) { 20440 return (value === target ? null : value); 20441 }); 20442 this._disabledInputs[this._disabledInputs.length] = target; 20443 }, 20444 20445 /* Is the first field in a jQuery collection disabled as a datepicker? 20446 * @param target element - the target input field or division or span 20447 * @return boolean - true if disabled, false if enabled 20448 */ 20449 _isDisabledDatepicker: function (target) { 20450 if (!target) { 20451 return false; 20452 } 20453 for (var i = 0; i < this._disabledInputs.length; i++) { 20454 if (this._disabledInputs[i] === target) { 20455 return true; 20456 } 20457 } 20458 return false; 20459 }, 20460 20461 /* Retrieve the instance data for the target control. 20462 * @param target element - the target input field or division or span 20463 * @return object - the associated instance data 20464 * @throws error if a jQuery problem getting data 20465 */ 20466 _getInst: function (target) { 20467 try { 20468 return $.data(target, "datepicker"); 20469 } catch (err) { 20470 throw "Missing instance data for this datepicker"; 20471 } 20472 }, 20473 20474 /* Update or retrieve the settings for a date picker attached to an input field or division. 20475 * @param target element - the target input field or division or span 20476 * @param name object - the new settings to update or 20477 * string - the name of the setting to change or retrieve, 20478 * when retrieving also "all" for all instance settings or 20479 * "defaults" for all global defaults 20480 * @param value any - the new value for the setting 20481 * (omit if above is an object or to retrieve a value) 20482 */ 20483 _optionDatepicker: function (target, name, value) { 20484 var settings, date, minDate, maxDate, 20485 inst = this._getInst(target); 20486 20487 if (arguments.length === 2 && typeof name === "string") { 20488 return (name === "defaults" ? $.extend({}, $.datepicker._defaults) : 20489 (inst ? (name === "all" ? $.extend({}, inst.settings) : 20490 this._get(inst, name)) : null)); 20491 } 20492 20493 settings = name || {}; 20494 if (typeof name === "string") { 20495 settings = {}; 20496 settings[name] = value; 20497 } 20498 20499 if (inst) { 20500 if (this._curInst === inst) { 20501 this._hideDatepicker(); 20502 } 20503 20504 date = this._getDateDatepicker(target, true); 20505 minDate = this._getMinMaxDate(inst, "min"); 20506 maxDate = this._getMinMaxDate(inst, "max"); 20507 datepicker_extendRemove(inst.settings, settings); 20508 20509 // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided 20510 if (minDate !== null && settings.dateFormat !== undefined && settings.minDate === undefined) { 20511 inst.settings.minDate = this._formatDate(inst, minDate); 20512 } 20513 if (maxDate !== null && settings.dateFormat !== undefined && settings.maxDate === undefined) { 20514 inst.settings.maxDate = this._formatDate(inst, maxDate); 20515 } 20516 if ("disabled" in settings) { 20517 if (settings.disabled) { 20518 this._disableDatepicker(target); 20519 } else { 20520 this._enableDatepicker(target); 20521 } 20522 } 20523 this._attachments($(target), inst); 20524 this._autoSize(inst); 20525 this._setDate(inst, date); 20526 this._updateAlternate(inst); 20527 this._updateDatepicker(inst); 20528 } 20529 }, 20530 20531 // Change method deprecated 20532 _changeDatepicker: function (target, name, value) { 20533 this._optionDatepicker(target, name, value); 20534 }, 20535 20536 /* Redraw the date picker attached to an input field or division. 20537 * @param target element - the target input field or division or span 20538 */ 20539 _refreshDatepicker: function (target) { 20540 var inst = this._getInst(target); 20541 if (inst) { 20542 this._updateDatepicker(inst); 20543 } 20544 }, 20545 20546 /* Set the dates for a jQuery selection. 20547 * @param target element - the target input field or division or span 20548 * @param date Date - the new date 20549 */ 20550 _setDateDatepicker: function (target, date) { 20551 var inst = this._getInst(target); 20552 if (inst) { 20553 this._setDate(inst, date); 20554 this._updateDatepicker(inst); 20555 this._updateAlternate(inst); 20556 } 20557 }, 20558 20559 /* Get the date(s) for the first entry in a jQuery selection. 20560 * @param target element - the target input field or division or span 20561 * @param noDefault boolean - true if no default date is to be used 20562 * @return Date - the current date 20563 */ 20564 _getDateDatepicker: function (target, noDefault) { 20565 var inst = this._getInst(target); 20566 if (inst && !inst.inline) { 20567 this._setDateFromField(inst, noDefault); 20568 } 20569 return (inst ? this._getDate(inst) : null); 20570 }, 20571 20572 /* Handle keystrokes. */ 20573 _doKeyDown: function (event) { 20574 var onSelect, dateStr, sel, 20575 inst = $.datepicker._getInst(event.target), 20576 handled = true, 20577 isRTL = inst.dpDiv.is(".ui-datepicker-rtl"); 20578 20579 inst._keyEvent = true; 20580 if ($.datepicker._datepickerShowing) { 20581 switch (event.keyCode) { 20582 case 9: $.datepicker._hideDatepicker(); 20583 handled = false; 20584 break; // hide on tab out 20585 case 13: sel = $("td." + $.datepicker._dayOverClass + ":not(." + 20586 $.datepicker._currentClass + ")", inst.dpDiv); 20587 if (sel[0]) { 20588 $.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]); 20589 } 20590 20591 onSelect = $.datepicker._get(inst, "onSelect"); 20592 if (onSelect) { 20593 dateStr = $.datepicker._formatDate(inst); 20594 20595 // Trigger custom callback 20596 onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); 20597 } else { 20598 $.datepicker._hideDatepicker(); 20599 } 20600 20601 return false; // don't submit the form 20602 case 27: $.datepicker._hideDatepicker(); 20603 break; // hide on escape 20604 case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ? 20605 -$.datepicker._get(inst, "stepBigMonths") : 20606 -$.datepicker._get(inst, "stepMonths")), "M"); 20607 break; // previous month/year on page up/+ ctrl 20608 case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ? 20609 +$.datepicker._get(inst, "stepBigMonths") : 20610 +$.datepicker._get(inst, "stepMonths")), "M"); 20611 break; // next month/year on page down/+ ctrl 20612 case 35: if (event.ctrlKey || event.metaKey) { 20613 $.datepicker._clearDate(event.target); 20614 } 20615 handled = event.ctrlKey || event.metaKey; 20616 break; // clear on ctrl or command +end 20617 case 36: if (event.ctrlKey || event.metaKey) { 20618 $.datepicker._gotoToday(event.target); 20619 } 20620 handled = event.ctrlKey || event.metaKey; 20621 break; // current on ctrl or command +home 20622 case 37: if (event.ctrlKey || event.metaKey) { 20623 $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), "D"); 20624 } 20625 handled = event.ctrlKey || event.metaKey; 20626 20627 // -1 day on ctrl or command +left 20628 if (event.originalEvent.altKey) { 20629 $.datepicker._adjustDate(event.target, (event.ctrlKey ? 20630 -$.datepicker._get(inst, "stepBigMonths") : 20631 -$.datepicker._get(inst, "stepMonths")), "M"); 20632 } 20633 20634 // next month/year on alt +left on Mac 20635 break; 20636 case 38: if (event.ctrlKey || event.metaKey) { 20637 $.datepicker._adjustDate(event.target, -7, "D"); 20638 } 20639 handled = event.ctrlKey || event.metaKey; 20640 break; // -1 week on ctrl or command +up 20641 case 39: if (event.ctrlKey || event.metaKey) { 20642 $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), "D"); 20643 } 20644 handled = event.ctrlKey || event.metaKey; 20645 20646 // +1 day on ctrl or command +right 20647 if (event.originalEvent.altKey) { 20648 $.datepicker._adjustDate(event.target, (event.ctrlKey ? 20649 +$.datepicker._get(inst, "stepBigMonths") : 20650 +$.datepicker._get(inst, "stepMonths")), "M"); 20651 } 20652 20653 // next month/year on alt +right 20654 break; 20655 case 40: if (event.ctrlKey || event.metaKey) { 20656 $.datepicker._adjustDate(event.target, +7, "D"); 20657 } 20658 handled = event.ctrlKey || event.metaKey; 20659 break; // +1 week on ctrl or command +down 20660 default: handled = false; 20661 } 20662 } else if (event.keyCode === 36 && event.ctrlKey) { // display the date picker on ctrl+home 20663 $.datepicker._showDatepicker(this); 20664 } else { 20665 handled = false; 20666 } 20667 20668 if (handled) { 20669 event.preventDefault(); 20670 event.stopPropagation(); 20671 } 20672 }, 20673 20674 /* Filter entered characters - based on date format. */ 20675 _doKeyPress: function (event) { 20676 var chars, chr, 20677 inst = $.datepicker._getInst(event.target); 20678 20679 if ($.datepicker._get(inst, "constrainInput")) { 20680 chars = $.datepicker._possibleChars($.datepicker._get(inst, "dateFormat")); 20681 chr = String.fromCharCode(event.charCode == null ? event.keyCode : event.charCode); 20682 return event.ctrlKey || event.metaKey || (chr < " " || !chars || chars.indexOf(chr) > -1); 20683 } 20684 }, 20685 20686 /* Synchronise manual entry and field/alternate field. */ 20687 _doKeyUp: function (event) { 20688 var date, 20689 inst = $.datepicker._getInst(event.target); 20690 20691 if (inst.input.val() !== inst.lastVal) { 20692 try { 20693 date = $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"), 20694 (inst.input ? inst.input.val() : null), 20695 $.datepicker._getFormatConfig(inst)); 20696 20697 if (date) { // only if valid 20698 $.datepicker._setDateFromField(inst); 20699 $.datepicker._updateAlternate(inst); 20700 $.datepicker._updateDatepicker(inst); 20701 } 20702 } catch (err) { 20703 } 20704 } 20705 return true; 20706 }, 20707 20708 /* Pop-up the date picker for a given input field. 20709 * If false returned from beforeShow event handler do not show. 20710 * @param input element - the input field attached to the date picker or
vendor: 4,409 bytes, lines 20711-20835
20711 * event - if triggered by focus 20712 */ 20713 _showDatepicker: function (input) { 20714 input = input.target || input; 20715 if (input.nodeName.toLowerCase() !== "input") { // find from button/image trigger 20716 input = $("input", input.parentNode)[0]; 20717 } 20718 20719 if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput === input) { // already here 20720 return; 20721 } 20722 20723 var inst, beforeShow, beforeShowSettings, isFixed, 20724 offset, showAnim, duration; 20725 20726 inst = $.datepicker._getInst(input); 20727 if ($.datepicker._curInst && $.datepicker._curInst !== inst) { 20728 $.datepicker._curInst.dpDiv.stop(true, true); 20729 if (inst && $.datepicker._datepickerShowing) { 20730 $.datepicker._hideDatepicker($.datepicker._curInst.input[0]); 20731 } 20732 } 20733 20734 beforeShow = $.datepicker._get(inst, "beforeShow"); 20735 beforeShowSettings = beforeShow ? beforeShow.apply(input, [input, inst]) : {}; 20736 if (beforeShowSettings === false) { 20737 return; 20738 } 20739 datepicker_extendRemove(inst.settings, beforeShowSettings); 20740 20741 inst.lastVal = null; 20742 $.datepicker._lastInput = input; 20743 $.datepicker._setDateFromField(inst); 20744 20745 if ($.datepicker._inDialog) { // hide cursor 20746 input.value = ""; 20747 } 20748 if (!$.datepicker._pos) { // position below input 20749 $.datepicker._pos = $.datepicker._findPos(input); 20750 $.datepicker._pos[1] += input.offsetHeight; // add the height 20751 } 20752 20753 isFixed = false; 20754 $(input).parents().each(function () { 20755 isFixed |= $(this).css("position") === "fixed"; 20756 return !isFixed; 20757 }); 20758 20759 offset = { left: $.datepicker._pos[0], top: $.datepicker._pos[1] }; 20760 $.datepicker._pos = null; 20761 20762 //to avoid flashes on Firefox 20763 inst.dpDiv.empty(); 20764 20765 // determine sizing offscreen 20766 inst.dpDiv.css({ position: "absolute", display: "block", top: "-1000px" }); 20767 $.datepicker._updateDatepicker(inst); 20768 20769 // fix width for dynamic number of date pickers 20770 // and adjust position before showing 20771 offset = $.datepicker._checkOffset(inst, offset, isFixed); 20772 inst.dpDiv.css({ 20773 position: ($.datepicker._inDialog && $.blockUI ? 20774 "static" : (isFixed ? "fixed" : "absolute")), display: "none", 20775 left: offset.left + "px", top: offset.top + "px" 20776 }); 20777 20778 if (!inst.inline) { 20779 showAnim = $.datepicker._get(inst, "showAnim"); 20780 duration = $.datepicker._get(inst, "duration"); 20781 inst.dpDiv.css("z-index", datepicker_getZindex($(input)) + 1); 20782 $.datepicker._datepickerShowing = true; 20783 20784 if ($.effects && $.effects.effect[showAnim]) { 20785 inst.dpDiv.show(showAnim, $.datepicker._get(inst, "showOptions"), duration); 20786 } else { 20787 inst.dpDiv[showAnim || "show"](showAnim ? duration : null); 20788 } 20789 20790 if ($.datepicker._shouldFocusInput(inst)) { 20791 inst.input.trigger("focus"); 20792 } 20793 20794 $.datepicker._curInst = inst; 20795 } 20796 }, 20797 20798 /* Generate the date picker content. */ 20799 _updateDatepicker: function (inst) { 20800 this.maxRows = 4; //Reset the max number of rows being displayed (see #7043) 20801 datepicker_instActive = inst; // for delegate hover events 20802 inst.dpDiv.empty().append(this._generateHTML(inst)); 20803 this._attachHandlers(inst); 20804 20805 var origyearshtml, 20806 numMonths = this._getNumberOfMonths(inst), 20807 cols = numMonths[1], 20808 width = 17, 20809 activeCell = inst.dpDiv.find("." + this._dayOverClass + " a"), 20810 onUpdateDatepicker = $.datepicker._get(inst, "onUpdateDatepicker"); 20811 20812 if (activeCell.length > 0) { 20813 datepicker_handleMouseover.apply(activeCell.get(0)); 20814 } 20815 20816 inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""); 20817 if (cols > 1) { 20818 inst.dpDiv.addClass("ui-datepicker-multi-" + cols).css("width", (width * cols) + "em"); 20819 } 20820 inst.dpDiv[(numMonths[0] !== 1 || numMonths[1] !== 1 ? "add" : "remove") + 20821 "Class"]("ui-datepicker-multi"); 20822 inst.dpDiv[(this._get(inst, "isRTL") ? "add" : "remove") + 20823 "Class"]("ui-datepicker-rtl"); 20824 20825 if (inst === $.datepicker._curInst && $.datepicker._datepickerShowing && $.datepicker._shouldFocusInput(inst)) { 20826 inst.input.trigger("focus"); 20827 } 20828 20829 // Deffered render of the years select (to avoid flashes on Firefox) 20830 if (inst.yearshtml) { 20831 origyearshtml = inst.yearshtml; 20832 setTimeout(function () { 20833 20834 //assure that inst.yearshtml didn't change. 20835 if (origyearshtml === inst.yearshtml && inst.yearshtml) {
vendor: 5,592 bytes, lines 20836-20994
20836 inst.dpDiv.find("select.ui-datepicker-year").first().replaceWith(inst.yearshtml); 20837 } 20838 origyearshtml = inst.yearshtml = null; 20839 }, 0); 20840 } 20841 20842 if (onUpdateDatepicker) { 20843 onUpdateDatepicker.apply((inst.input ? inst.input[0] : null), [inst]); 20844 } 20845 }, 20846 20847 // #6694 - don't focus the input if it's already focused 20848 // this breaks the change event in IE 20849 // Support: IE and jQuery <1.9 20850 _shouldFocusInput: function (inst) { 20851 return inst.input && inst.input.is(":visible") && !inst.input.is(":disabled") && !inst.input.is(":focus"); 20852 }, 20853 20854 /* Check positioning to remain on screen. */ 20855 _checkOffset: function (inst, offset, isFixed) { 20856 var dpWidth = inst.dpDiv.outerWidth(), 20857 dpHeight = inst.dpDiv.outerHeight(), 20858 inputWidth = inst.input ? inst.input.outerWidth() : 0, 20859 inputHeight = inst.input ? inst.input.outerHeight() : 0, 20860 viewWidth = document.documentElement.clientWidth + (isFixed ? 0 : $(document).scrollLeft()), 20861 viewHeight = document.documentElement.clientHeight + (isFixed ? 0 : $(document).scrollTop()); 20862 20863 offset.left -= (this._get(inst, "isRTL") ? (dpWidth - inputWidth) : 0); 20864 offset.left -= (isFixed && offset.left === inst.input.offset().left) ? $(document).scrollLeft() : 0; 20865 offset.top -= (isFixed && offset.top === (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0; 20866 20867 // Now check if datepicker is showing outside window viewport - move to a better place if so. 20868 offset.left -= Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ? 20869 Math.abs(offset.left + dpWidth - viewWidth) : 0); 20870 offset.top -= Math.min(offset.top, (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ? 20871 Math.abs(dpHeight + inputHeight) : 0); 20872 20873 return offset; 20874 }, 20875 20876 /* Find an object's position on the screen. */ 20877 _findPos: function (obj) { 20878 var position, 20879 inst = this._getInst(obj), 20880 isRTL = this._get(inst, "isRTL"); 20881 20882 while (obj && (obj.type === "hidden" || obj.nodeType !== 1 || $.expr.pseudos.hidden(obj))) { 20883 obj = obj[isRTL ? "previousSibling" : "nextSibling"]; 20884 } 20885 20886 position = $(obj).offset(); 20887 return [position.left, position.top]; 20888 }, 20889 20890 /* Hide the date picker from view. 20891 * @param input element - the input field attached to the date picker 20892 */ 20893 _hideDatepicker: function (input) { 20894 var showAnim, duration, postProcess, onClose, 20895 inst = this._curInst; 20896 20897 if (!inst || (input && inst !== $.data(input, "datepicker"))) { 20898 return; 20899 } 20900 20901 if (this._datepickerShowing) { 20902 showAnim = this._get(inst, "showAnim"); 20903 duration = this._get(inst, "duration"); 20904 postProcess = function () { 20905 $.datepicker._tidyDialog(inst); 20906 }; 20907 20908 // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed 20909 if ($.effects && ($.effects.effect[showAnim] || $.effects[showAnim])) { 20910 inst.dpDiv.hide(showAnim, $.datepicker._get(inst, "showOptions"), duration, postProcess); 20911 } else { 20912 inst.dpDiv[(showAnim === "slideDown" ? "slideUp" : 20913 (showAnim === "fadeIn" ? "fadeOut" : "hide"))]((showAnim ? duration : null), postProcess); 20914 } 20915 20916 if (!showAnim) { 20917 postProcess(); 20918 } 20919 this._datepickerShowing = false; 20920 20921 onClose = this._get(inst, "onClose"); 20922 if (onClose) { 20923 onClose.apply((inst.input ? inst.input[0] : null), [(inst.input ? inst.input.val() : ""), inst]); 20924 } 20925 20926 this._lastInput = null; 20927 if (this._inDialog) { 20928 this._dialogInput.css({ position: "absolute", left: "0", top: "-100px" }); 20929 if ($.blockUI) { 20930 $.unblockUI(); 20931 $("body").append(this.dpDiv); 20932 } 20933 } 20934 this._inDialog = false; 20935 } 20936 }, 20937 20938 /* Tidy up after a dialog display. */ 20939 _tidyDialog: function (inst) { 20940 inst.dpDiv.removeClass(this._dialogClass).off(".ui-datepicker-calendar"); 20941 }, 20942 20943 /* Close date picker if clicked elsewhere. */ 20944 _checkExternalClick: function (event) { 20945 if (!$.datepicker._curInst) { 20946 return; 20947 } 20948 20949 var $target = $(event.target), 20950 inst = $.datepicker._getInst($target[0]); 20951 20952 if ((($target[0].id !== $.datepicker._mainDivId && 20953 $target.parents("#" + $.datepicker._mainDivId).length === 0 && 20954 !$target.hasClass($.datepicker.markerClassName) && 20955 !$target.closest("." + $.datepicker._triggerClass).length && 20956 $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI))) || 20957 ($target.hasClass($.datepicker.markerClassName) && $.datepicker._curInst !== inst)) { 20958 $.datepicker._hideDatepicker(); 20959 } 20960 }, 20961 20962 /* Adjust one of the date sub-fields. */ 20963 _adjustDate: function (id, offset, period) { 20964 var target = $(id), 20965 inst = this._getInst(target[0]); 20966 20967 if (this._isDisabledDatepicker(target[0])) { 20968 return; 20969 } 20970 this._adjustInstDate(inst, offset, period); 20971 this._updateDatepicker(inst); 20972 }, 20973 20974 /* Action for current link. */ 20975 _gotoToday: function (id) { 20976 var date, 20977 target = $(id), 20978 inst = this._getInst(target[0]); 20979 20980 if (this._get(inst, "gotoCurrent") && inst.currentDay) { 20981 inst.selectedDay = inst.currentDay; 20982 inst.drawMonth = inst.selectedMonth = inst.currentMonth; 20983 inst.drawYear = inst.selectedYear = inst.currentYear; 20984 } else { 20985 date = new Date(); 20986 inst.selectedDay = date.getDate(); 20987 inst.drawMonth = inst.selectedMonth = date.getMonth(); 20988 inst.drawYear = inst.selectedYear = date.getFullYear(); 20989 } 20990 this._notifyChange(inst); 20991 this._adjustDate(target); 20992 }, 20993 20994 /* Action for selecting a new month/year. */
vendor: 35,940 bytes, lines 20995-21969
20995 _selectMonthYear: function (id, select, period) { 20996 var target = $(id), 20997 inst = this._getInst(target[0]); 20998 20999 inst["selected" + (period === "M" ? "Month" : "Year")] = 21000 inst["draw" + (period === "M" ? "Month" : "Year")] = 21001 parseInt(select.options[select.selectedIndex].value, 10); 21002 21003 this._notifyChange(inst); 21004 this._adjustDate(target); 21005 }, 21006 21007 /* Action for selecting a day. */ 21008 _selectDay: function (id, month, year, td) { 21009 var inst, 21010 target = $(id); 21011 21012 if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) { 21013 return; 21014 } 21015 21016 inst = this._getInst(target[0]); 21017 inst.selectedDay = inst.currentDay = parseInt($("a", td).attr("data-date")); 21018 inst.selectedMonth = inst.currentMonth = month; 21019 inst.selectedYear = inst.currentYear = year; 21020 this._selectDate(id, this._formatDate(inst, 21021 inst.currentDay, inst.currentMonth, inst.currentYear)); 21022 }, 21023 21024 /* Erase the input field and hide the date picker. */ 21025 _clearDate: function (id) { 21026 var target = $(id); 21027 this._selectDate(target, ""); 21028 }, 21029 21030 /* Update the input field with the selected date. */ 21031 _selectDate: function (id, dateStr) { 21032 var onSelect, 21033 target = $(id), 21034 inst = this._getInst(target[0]); 21035 21036 dateStr = (dateStr != null ? dateStr : this._formatDate(inst)); 21037 if (inst.input) { 21038 inst.input.val(dateStr); 21039 } 21040 this._updateAlternate(inst); 21041 21042 onSelect = this._get(inst, "onSelect"); 21043 if (onSelect) { 21044 onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); // trigger custom callback 21045 } else if (inst.input) { 21046 inst.input.trigger("change"); // fire the change event 21047 } 21048 21049 if (inst.inline) { 21050 this._updateDatepicker(inst); 21051 } else { 21052 this._hideDatepicker(); 21053 this._lastInput = inst.input[0]; 21054 if (typeof (inst.input[0]) !== "object") { 21055 inst.input.trigger("focus"); // restore focus 21056 } 21057 this._lastInput = null; 21058 } 21059 }, 21060 21061 /* Update any alternate field to synchronise with the main field. */ 21062 _updateAlternate: function (inst) { 21063 var altFormat, date, dateStr, 21064 altField = this._get(inst, "altField"); 21065 21066 if (altField) { // update alternate field too 21067 altFormat = this._get(inst, "altFormat") || this._get(inst, "dateFormat"); 21068 date = this._getDate(inst); 21069 dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst)); 21070 $(document).find(altField).val(dateStr); 21071 } 21072 }, 21073 21074 /* Set as beforeShowDay function to prevent selection of weekends. 21075 * @param date Date - the date to customise 21076 * @return [boolean, string] - is this date selectable?, what is its CSS class? 21077 */ 21078 noWeekends: function (date) { 21079 var day = date.getDay(); 21080 return [(day > 0 && day < 6), ""]; 21081 }, 21082 21083 /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition. 21084 * @param date Date - the date to get the week for 21085 * @return number - the number of the week within the year that contains this date 21086 */ 21087 iso8601Week: function (date) { 21088 var time, 21089 checkDate = new Date(date.getTime()); 21090 21091 // Find Thursday of this week starting on Monday 21092 checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7)); 21093 21094 time = checkDate.getTime(); 21095 checkDate.setMonth(0); // Compare with Jan 1 21096 checkDate.setDate(1); 21097 return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1; 21098 }, 21099 21100 /* Parse a string value into a date object. 21101 * See formatDate below for the possible formats. 21102 * 21103 * @param format string - the expected format of the date 21104 * @param value string - the date in the above format 21105 * @param settings Object - attributes include: 21106 * shortYearCutoff number - the cutoff year for determining the century (optional) 21107 * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) 21108 * dayNames string[7] - names of the days from Sunday (optional) 21109 * monthNamesShort string[12] - abbreviated names of the months (optional) 21110 * monthNames string[12] - names of the months (optional) 21111 * @return Date - the extracted date value or null if value is blank 21112 */ 21113 parseDate: function (format, value, settings) { 21114 if (format == null || value == null) { 21115 throw "Invalid arguments"; 21116 } 21117 21118 value = (typeof value === "object" ? value.toString() : value + ""); 21119 if (value === "") { 21120 return null; 21121 } 21122 21123 var iFormat, dim, extra, 21124 iValue = 0, 21125 shortYearCutoffTemp = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff, 21126 shortYearCutoff = (typeof shortYearCutoffTemp !== "string" ? shortYearCutoffTemp : 21127 new Date().getFullYear() % 100 + parseInt(shortYearCutoffTemp, 10)), 21128 dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort, 21129 dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames, 21130 monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort, 21131 monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames, 21132 year = -1, 21133 month = -1, 21134 day = -1, 21135 doy = -1, 21136 literal = false, 21137 date, 21138 21139 // Check whether a format character is doubled 21140 lookAhead = function (match) { 21141 var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match); 21142 if (matches) { 21143 iFormat++; 21144 } 21145 return matches; 21146 }, 21147 21148 // Extract a number from the string value 21149 getNumber = function (match) { 21150 var isDoubled = lookAhead(match), 21151 size = (match === "@" ? 14 : (match === "!" ? 20 : 21152 (match === "y" && isDoubled ? 4 : (match === "o" ? 3 : 2)))), 21153 minSize = (match === "y" ? size : 1), 21154 digits = new RegExp("^\\d{" + minSize + "," + size + "}"), 21155 num = value.substring(iValue).match(digits); 21156 if (!num) { 21157 throw "Missing number at position " + iValue; 21158 } 21159 iValue += num[0].length; 21160 return parseInt(num[0], 10); 21161 }, 21162 21163 // Extract a name from the string value and convert to an index 21164 getName = function (match, shortNames, longNames) { 21165 var index = -1, 21166 names = $.map(lookAhead(match) ? longNames : shortNames, function (v, k) { 21167 return [[k, v]]; 21168 }).sort(function (a, b) { 21169 return -(a[1].length - b[1].length); 21170 }); 21171 21172 $.each(names, function (i, pair) { 21173 var name = pair[1]; 21174 if (value.substr(iValue, name.length).toLowerCase() === name.toLowerCase()) { 21175 index = pair[0]; 21176 iValue += name.length; 21177 return false; 21178 } 21179 }); 21180 if (index !== -1) { 21181 return index + 1; 21182 } else { 21183 throw "Unknown name at position " + iValue; 21184 } 21185 }, 21186 21187 // Confirm that a literal character matches the string value 21188 checkLiteral = function () { 21189 if (value.charAt(iValue) !== format.charAt(iFormat)) { 21190 throw "Unexpected literal at position " + iValue; 21191 } 21192 iValue++; 21193 }; 21194 21195 for (iFormat = 0; iFormat < format.length; iFormat++) { 21196 if (literal) { 21197 if (format.charAt(iFormat) === "'" && !lookAhead("'")) { 21198 literal = false; 21199 } else { 21200 checkLiteral(); 21201 } 21202 } else { 21203 switch (format.charAt(iFormat)) { 21204 case "d": 21205 day = getNumber("d"); 21206 break; 21207 case "D": 21208 getName("D", dayNamesShort, dayNames); 21209 break; 21210 case "o": 21211 doy = getNumber("o"); 21212 break; 21213 case "m": 21214 month = getNumber("m"); 21215 break; 21216 case "M": 21217 month = getName("M", monthNamesShort, monthNames); 21218 break; 21219 case "y": 21220 year = getNumber("y"); 21221 break; 21222 case "@": 21223 date = new Date(getNumber("@")); 21224 year = date.getFullYear(); 21225 month = date.getMonth() + 1; 21226 day = date.getDate(); 21227 break; 21228 case "!": 21229 date = new Date((getNumber("!") - this._ticksTo1970) / 10000); 21230 year = date.getFullYear(); 21231 month = date.getMonth() + 1; 21232 day = date.getDate(); 21233 break; 21234 case "'": 21235 if (lookAhead("'")) { 21236 checkLiteral(); 21237 } else { 21238 literal = true; 21239 } 21240 break; 21241 default: 21242 checkLiteral(); 21243 } 21244 } 21245 } 21246 21247 if (iValue < value.length) { 21248 extra = value.substr(iValue); 21249 if (!/^\s+/.test(extra)) { 21250 throw "Extra/unparsed characters found in date: " + extra; 21251 } 21252 } 21253 21254 if (year === -1) { 21255 year = new Date().getFullYear(); 21256 } else if (year < 100) { 21257 year += new Date().getFullYear() - new Date().getFullYear() % 100 + 21258 (year <= shortYearCutoff ? 0 : -100); 21259 } 21260 21261 if (doy > -1) { 21262 month = 1; 21263 day = doy; 21264 do { 21265 dim = this._getDaysInMonth(year, month - 1); 21266 if (day <= dim) { 21267 break; 21268 } 21269 month++; 21270 day -= dim; 21271 } while (true); 21272 } 21273 21274 date = this._daylightSavingAdjust(new Date(year, month - 1, day)); 21275 if (date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day) { 21276 throw "Invalid date"; // E.g. 31/02/00 21277 } 21278 return date; 21279 }, 21280 21281 /* Standard date formats. */ 21282 ATOM: "yy-mm-dd", // RFC 3339 (ISO 8601) 21283 COOKIE: "D, dd M yy", 21284 ISO_8601: "yy-mm-dd", 21285 RFC_822: "D, d M y", 21286 RFC_850: "DD, dd-M-y", 21287 RFC_1036: "D, d M y", 21288 RFC_1123: "D, d M yy", 21289 RFC_2822: "D, d M yy", 21290 RSS: "D, d M y", // RFC 822 21291 TICKS: "!", 21292 TIMESTAMP: "@", 21293 W3C: "yy-mm-dd", // ISO 8601 21294 21295 _ticksTo1970: (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) + 21296 Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000), 21297 21298 /* Format a date object into a string value. 21299 * The format can be combinations of the following: 21300 * d - day of month (no leading zero) 21301 * dd - day of month (two digit) 21302 * o - day of year (no leading zeros) 21303 * oo - day of year (three digit) 21304 * D - day name short 21305 * DD - day name long 21306 * m - month of year (no leading zero) 21307 * mm - month of year (two digit) 21308 * M - month name short 21309 * MM - month name long 21310 * y - year (two digit) 21311 * yy - year (four digit) 21312 * @ - Unix timestamp (ms since 01/01/1970) 21313 * ! - Windows ticks (100ns since 01/01/0001) 21314 * "..." - literal text 21315 * '' - single quote 21316 * 21317 * @param format string - the desired format of the date 21318 * @param date Date - the date value to format 21319 * @param settings Object - attributes include: 21320 * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) 21321 * dayNames string[7] - names of the days from Sunday (optional) 21322 * monthNamesShort string[12] - abbreviated names of the months (optional) 21323 * monthNames string[12] - names of the months (optional) 21324 * @return string - the date in the above format 21325 */ 21326 formatDate: function (format, date, settings) { 21327 if (!date) { 21328 return ""; 21329 } 21330 21331 var iFormat, 21332 dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort, 21333 dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames, 21334 monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort, 21335 monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames, 21336 21337 // Check whether a format character is doubled 21338 lookAhead = function (match) { 21339 var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match); 21340 if (matches) { 21341 iFormat++; 21342 } 21343 return matches; 21344 }, 21345 21346 // Format a number, with leading zero if necessary 21347 formatNumber = function (match, value, len) { 21348 var num = "" + value; 21349 if (lookAhead(match)) { 21350 while (num.length < len) { 21351 num = "0" + num; 21352 } 21353 } 21354 return num; 21355 }, 21356 21357 // Format a name, short or long as requested 21358 formatName = function (match, value, shortNames, longNames) { 21359 return (lookAhead(match) ? longNames[value] : shortNames[value]); 21360 }, 21361 output = "", 21362 literal = false; 21363 21364 if (date) { 21365 for (iFormat = 0; iFormat < format.length; iFormat++) { 21366 if (literal) { 21367 if (format.charAt(iFormat) === "'" && !lookAhead("'")) { 21368 literal = false; 21369 } else { 21370 output += format.charAt(iFormat); 21371 } 21372 } else { 21373 switch (format.charAt(iFormat)) { 21374 case "d": 21375 output += formatNumber("d", date.getDate(), 2); 21376 break; 21377 case "D": 21378 output += formatName("D", date.getDay(), dayNamesShort, dayNames); 21379 break; 21380 case "o": 21381 output += formatNumber("o", 21382 Math.round((new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000), 3); 21383 break; 21384 case "m": 21385 output += formatNumber("m", date.getMonth() + 1, 2); 21386 break; 21387 case "M": 21388 output += formatName("M", date.getMonth(), monthNamesShort, monthNames); 21389 break; 21390 case "y": 21391 output += (lookAhead("y") ? date.getFullYear() : 21392 (date.getFullYear() % 100 < 10 ? "0" : "") + date.getFullYear() % 100); 21393 break; 21394 case "@": 21395 output += date.getTime(); 21396 break; 21397 case "!": 21398 output += date.getTime() * 10000 + this._ticksTo1970; 21399 break; 21400 case "'": 21401 if (lookAhead("'")) { 21402 output += "'"; 21403 } else { 21404 literal = true; 21405 } 21406 break; 21407 default: 21408 output += format.charAt(iFormat); 21409 } 21410 } 21411 } 21412 } 21413 return output; 21414 }, 21415 21416 /* Extract all possible characters from the date format. */ 21417 _possibleChars: function (format) { 21418 var iFormat, 21419 chars = "", 21420 literal = false, 21421 21422 // Check whether a format character is doubled 21423 lookAhead = function (match) { 21424 var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match); 21425 if (matches) { 21426 iFormat++; 21427 } 21428 return matches; 21429 }; 21430 21431 for (iFormat = 0; iFormat < format.length; iFormat++) { 21432 if (literal) { 21433 if (format.charAt(iFormat) === "'" && !lookAhead("'")) { 21434 literal = false; 21435 } else { 21436 chars += format.charAt(iFormat); 21437 } 21438 } else { 21439 switch (format.charAt(iFormat)) { 21440 case "d": case "m": case "y": case "@": 21441 chars += "0123456789"; 21442 break; 21443 case "D": case "M": 21444 return null; // Accept anything 21445 case "'": 21446 if (lookAhead("'")) { 21447 chars += "'"; 21448 } else { 21449 literal = true; 21450 } 21451 break; 21452 default: 21453 chars += format.charAt(iFormat); 21454 } 21455 } 21456 } 21457 return chars; 21458 }, 21459 21460 /* Get a setting value, defaulting if necessary. */ 21461 _get: function (inst, name) { 21462 return inst.settings[name] !== undefined ? 21463 inst.settings[name] : this._defaults[name]; 21464 }, 21465 21466 /* Parse existing date and initialise date picker. */ 21467 _setDateFromField: function (inst, noDefault) { 21468 if (inst.input.val() === inst.lastVal) { 21469 return; 21470 } 21471 21472 var dateFormat = this._get(inst, "dateFormat"), 21473 dates = inst.lastVal = inst.input ? inst.input.val() : null, 21474 defaultDate = this._getDefaultDate(inst), 21475 date = defaultDate, 21476 settings = this._getFormatConfig(inst); 21477 21478 try { 21479 date = this.parseDate(dateFormat, dates, settings) || defaultDate; 21480 } catch (event) { 21481 dates = (noDefault ? "" : dates); 21482 } 21483 inst.selectedDay = date.getDate(); 21484 inst.drawMonth = inst.selectedMonth = date.getMonth(); 21485 inst.drawYear = inst.selectedYear = date.getFullYear(); 21486 inst.currentDay = (dates ? date.getDate() : 0); 21487 inst.currentMonth = (dates ? date.getMonth() : 0); 21488 inst.currentYear = (dates ? date.getFullYear() : 0); 21489 this._adjustInstDate(inst); 21490 }, 21491 21492 /* Retrieve the default date shown on opening. */ 21493 _getDefaultDate: function (inst) { 21494 return this._restrictMinMax(inst, 21495 this._determineDate(inst, this._get(inst, "defaultDate"), new Date())); 21496 }, 21497 21498 /* A date may be specified as an exact value or a relative one. */ 21499 _determineDate: function (inst, date, defaultDate) { 21500 var offsetNumeric = function (offset) { 21501 var date = new Date(); 21502 date.setDate(date.getDate() + offset); 21503 return date; 21504 }, 21505 offsetString = function (offset) { 21506 try { 21507 return $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"), 21508 offset, $.datepicker._getFormatConfig(inst)); 21509 } catch (e) { 21510 21511 // Ignore 21512 } 21513 21514 var date = (offset.toLowerCase().match(/^c/) ? 21515 $.datepicker._getDate(inst) : null) || new Date(), 21516 year = date.getFullYear(), 21517 month = date.getMonth(), 21518 day = date.getDate(), 21519 pattern = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g, 21520 matches = pattern.exec(offset); 21521 21522 while (matches) { 21523 switch (matches[2] || "d") { 21524 case "d": case "D": 21525 day += parseInt(matches[1], 10); break; 21526 case "w": case "W": 21527 day += parseInt(matches[1], 10) * 7; break; 21528 case "m": case "M": 21529 month += parseInt(matches[1], 10); 21530 day = Math.min(day, $.datepicker._getDaysInMonth(year, month)); 21531 break; 21532 case "y": case "Y": 21533 year += parseInt(matches[1], 10); 21534 day = Math.min(day, $.datepicker._getDaysInMonth(year, month)); 21535 break; 21536 } 21537 matches = pattern.exec(offset); 21538 } 21539 return new Date(year, month, day); 21540 }, 21541 newDate = (date == null || date === "" ? defaultDate : (typeof date === "string" ? offsetString(date) : 21542 (typeof date === "number" ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : new Date(date.getTime())))); 21543 21544 newDate = (newDate && newDate.toString() === "Invalid Date" ? defaultDate : newDate); 21545 if (newDate) { 21546 newDate.setHours(0); 21547 newDate.setMinutes(0); 21548 newDate.setSeconds(0); 21549 newDate.setMilliseconds(0); 21550 } 21551 return this._daylightSavingAdjust(newDate); 21552 }, 21553 21554 /* Handle switch to/from daylight saving. 21555 * Hours may be non-zero on daylight saving cut-over: 21556 * > 12 when midnight changeover, but then cannot generate 21557 * midnight datetime, so jump to 1AM, otherwise reset. 21558 * @param date (Date) the date to check 21559 * @return (Date) the corrected date 21560 */ 21561 _daylightSavingAdjust: function (date) { 21562 if (!date) { 21563 return null; 21564 } 21565 date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0); 21566 return date; 21567 }, 21568 21569 /* Set the date(s) directly. */ 21570 _setDate: function (inst, date, noChange) { 21571 var clear = !date, 21572 origMonth = inst.selectedMonth, 21573 origYear = inst.selectedYear, 21574 newDate = this._restrictMinMax(inst, this._determineDate(inst, date, new Date())); 21575 21576 inst.selectedDay = inst.currentDay = newDate.getDate(); 21577 inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth(); 21578 inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear(); 21579 if ((origMonth !== inst.selectedMonth || origYear !== inst.selectedYear) && !noChange) { 21580 this._notifyChange(inst); 21581 } 21582 this._adjustInstDate(inst); 21583 if (inst.input) { 21584 inst.input.val(clear ? "" : this._formatDate(inst)); 21585 } 21586 }, 21587 21588 /* Retrieve the date(s) directly. */ 21589 _getDate: function (inst) { 21590 var startDate = (!inst.currentYear || (inst.input && inst.input.val() === "") ? null : 21591 this._daylightSavingAdjust(new Date( 21592 inst.currentYear, inst.currentMonth, inst.currentDay))); 21593 return startDate; 21594 }, 21595 21596 /* Attach the onxxx handlers. These are declared statically so 21597 * they work with static code transformers like Caja. 21598 */ 21599 _attachHandlers: function (inst) { 21600 var stepMonths = this._get(inst, "stepMonths"), 21601 id = "#" + inst.id.replace(/\\\\/g, "\\"); 21602 inst.dpDiv.find("[data-handler]").map(function () { 21603 var handler = { 21604 prev: function () { 21605 $.datepicker._adjustDate(id, -stepMonths, "M"); 21606 }, 21607 next: function () { 21608 $.datepicker._adjustDate(id, +stepMonths, "M"); 21609 }, 21610 hide: function () { 21611 $.datepicker._hideDatepicker(); 21612 }, 21613 today: function () { 21614 $.datepicker._gotoToday(id); 21615 }, 21616 selectDay: function () { 21617 $.datepicker._selectDay(id, +this.getAttribute("data-month"), +this.getAttribute("data-year"), this); 21618 return false; 21619 }, 21620 selectMonth: function () { 21621 $.datepicker._selectMonthYear(id, this, "M"); 21622 return false; 21623 }, 21624 selectYear: function () { 21625 $.datepicker._selectMonthYear(id, this, "Y"); 21626 return false; 21627 } 21628 }; 21629 $(this).on(this.getAttribute("data-event"), handler[this.getAttribute("data-handler")]); 21630 }); 21631 }, 21632 21633 /* Generate the HTML for the current state of the date picker. */ 21634 _generateHTML: function (inst) { 21635 var maxDraw, prevText, prev, nextText, next, currentText, gotoDate, 21636 controls, buttonPanel, firstDay, showWeek, dayNames, dayNamesMin, 21637 monthNames, monthNamesShort, beforeShowDay, showOtherMonths, 21638 selectOtherMonths, defaultDate, html, dow, row, group, col, selectedDate, 21639 cornerClass, calender, thead, day, daysInMonth, leadDays, curRows, numRows, 21640 printDate, dRow, tbody, daySettings, otherMonth, unselectable, 21641 tempDate = new Date(), 21642 today = this._daylightSavingAdjust( 21643 new Date(tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate())), // clear time 21644 isRTL = this._get(inst, "isRTL"), 21645 showButtonPanel = this._get(inst, "showButtonPanel"), 21646 hideIfNoPrevNext = this._get(inst, "hideIfNoPrevNext"), 21647 navigationAsDateFormat = this._get(inst, "navigationAsDateFormat"), 21648 numMonths = this._getNumberOfMonths(inst), 21649 showCurrentAtPos = this._get(inst, "showCurrentAtPos"), 21650 stepMonths = this._get(inst, "stepMonths"), 21651 isMultiMonth = (numMonths[0] !== 1 || numMonths[1] !== 1), 21652 currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) : 21653 new Date(inst.currentYear, inst.currentMonth, inst.currentDay))), 21654 minDate = this._getMinMaxDate(inst, "min"), 21655 maxDate = this._getMinMaxDate(inst, "max"), 21656 drawMonth = inst.drawMonth - showCurrentAtPos, 21657 drawYear = inst.drawYear; 21658 21659 if (drawMonth < 0) { 21660 drawMonth += 12; 21661 drawYear--; 21662 } 21663 if (maxDate) { 21664 maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(), 21665 maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate())); 21666 maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw); 21667 while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) { 21668 drawMonth--; 21669 if (drawMonth < 0) { 21670 drawMonth = 11; 21671 drawYear--; 21672 } 21673 } 21674 } 21675 inst.drawMonth = drawMonth; 21676 inst.drawYear = drawYear; 21677 21678 prevText = this._get(inst, "prevText"); 21679 prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText, 21680 this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)), 21681 this._getFormatConfig(inst))); 21682 21683 if (this._canAdjustMonth(inst, -1, drawYear, drawMonth)) { 21684 prev = $("<a>") 21685 .attr({ 21686 "class": "ui-datepicker-prev ui-corner-all", 21687 "data-handler": "prev", 21688 "data-event": "click", 21689 title: prevText 21690 }) 21691 .append( 21692 $("<span>") 21693 .addClass("ui-icon ui-icon-circle-triangle-" + 21694 (isRTL ? "e" : "w")) 21695 .text(prevText) 21696 )[0].outerHTML; 21697 } else if (hideIfNoPrevNext) { 21698 prev = ""; 21699 } else { 21700 prev = $("<a>") 21701 .attr({ 21702 "class": "ui-datepicker-prev ui-corner-all ui-state-disabled", 21703 title: prevText 21704 }) 21705 .append( 21706 $("<span>") 21707 .addClass("ui-icon ui-icon-circle-triangle-" + 21708 (isRTL ? "e" : "w")) 21709 .text(prevText) 21710 )[0].outerHTML; 21711 } 21712 21713 nextText = this._get(inst, "nextText"); 21714 nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText, 21715 this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)), 21716 this._getFormatConfig(inst))); 21717 21718 if (this._canAdjustMonth(inst, +1, drawYear, drawMonth)) { 21719 next = $("<a>") 21720 .attr({ 21721 "class": "ui-datepicker-next ui-corner-all", 21722 "data-handler": "next", 21723 "data-event": "click", 21724 title: nextText 21725 }) 21726 .append( 21727 $("<span>") 21728 .addClass("ui-icon ui-icon-circle-triangle-" + 21729 (isRTL ? "w" : "e")) 21730 .text(nextText) 21731 )[0].outerHTML; 21732 } else if (hideIfNoPrevNext) { 21733 next = ""; 21734 } else { 21735 next = $("<a>") 21736 .attr({ 21737 "class": "ui-datepicker-next ui-corner-all ui-state-disabled", 21738 title: nextText 21739 }) 21740 .append( 21741 $("<span>") 21742 .attr("class", "ui-icon ui-icon-circle-triangle-" + 21743 (isRTL ? "w" : "e")) 21744 .text(nextText) 21745 )[0].outerHTML; 21746 } 21747 21748 currentText = this._get(inst, "currentText"); 21749 gotoDate = (this._get(inst, "gotoCurrent") && inst.currentDay ? currentDate : today); 21750 currentText = (!navigationAsDateFormat ? currentText : 21751 this.formatDate(currentText, gotoDate, this._getFormatConfig(inst))); 21752 21753 controls = ""; 21754 if (!inst.inline) { 21755 controls = $("<button>") 21756 .attr({ 21757 type: "button", 21758 "class": "ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all", 21759 "data-handler": "hide", 21760 "data-event": "click" 21761 }) 21762 .text(this._get(inst, "closeText"))[0].outerHTML; 21763 } 21764 21765 buttonPanel = ""; 21766 if (showButtonPanel) { 21767 buttonPanel = $("<div class='ui-datepicker-buttonpane ui-widget-content'>") 21768 .append(isRTL ? controls : "") 21769 .append(this._isInRange(inst, gotoDate) ? 21770 $("<button>") 21771 .attr({ 21772 type: "button", 21773 "class": "ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all", 21774 "data-handler": "today", 21775 "data-event": "click" 21776 }) 21777 .text(currentText) : 21778 "") 21779 .append(isRTL ? "" : controls)[0].outerHTML; 21780 } 21781 21782 firstDay = parseInt(this._get(inst, "firstDay"), 10); 21783 firstDay = (isNaN(firstDay) ? 0 : firstDay); 21784 21785 showWeek = this._get(inst, "showWeek"); 21786 dayNames = this._get(inst, "dayNames"); 21787 dayNamesMin = this._get(inst, "dayNamesMin"); 21788 monthNames = this._get(inst, "monthNames"); 21789 monthNamesShort = this._get(inst, "monthNamesShort"); 21790 beforeShowDay = this._get(inst, "beforeShowDay"); 21791 showOtherMonths = this._get(inst, "showOtherMonths"); 21792 selectOtherMonths = this._get(inst, "selectOtherMonths"); 21793 defaultDate = this._getDefaultDate(inst); 21794 html = ""; 21795 21796 for (row = 0; row < numMonths[0]; row++) { 21797 group = ""; 21798 this.maxRows = 4; 21799 for (col = 0; col < numMonths[1]; col++) { 21800 selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay)); 21801 cornerClass = " ui-corner-all"; 21802 calender = ""; 21803 if (isMultiMonth) { 21804 calender += "<div class='ui-datepicker-group"; 21805 if (numMonths[1] > 1) { 21806 switch (col) { 21807 case 0: calender += " ui-datepicker-group-first"; 21808 cornerClass = " ui-corner-" + (isRTL ? "right" : "left"); break; 21809 case numMonths[1] - 1: calender += " ui-datepicker-group-last"; 21810 cornerClass = " ui-corner-" + (isRTL ? "left" : "right"); break; 21811 default: calender += " ui-datepicker-group-middle"; cornerClass = ""; break; 21812 } 21813 } 21814 calender += "'>"; 21815 } 21816 calender += "<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix" + cornerClass + "'>" + 21817 (/all|left/.test(cornerClass) && row === 0 ? (isRTL ? next : prev) : "") + 21818 (/all|right/.test(cornerClass) && row === 0 ? (isRTL ? prev : next) : "") + 21819 this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate, 21820 row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers 21821 "</div><table class='ui-datepicker-calendar'><thead>" + 21822 "<tr>"; 21823 thead = (showWeek ? "<th class='ui-datepicker-week-col'>" + this._get(inst, "weekHeader") + "</th>" : ""); 21824 for (dow = 0; dow < 7; dow++) { // days of the week 21825 day = (dow + firstDay) % 7; 21826 thead += "<th scope='col'" + ((dow + firstDay + 6) % 7 >= 5 ? " class='ui-datepicker-week-end'" : "") + ">" + 21827 "<span title='" + dayNames[day] + "'>" + dayNamesMin[day] + "</span></th>"; 21828 } 21829 calender += thead + "</tr></thead><tbody>"; 21830 daysInMonth = this._getDaysInMonth(drawYear, drawMonth); 21831 if (drawYear === inst.selectedYear && drawMonth === inst.selectedMonth) { 21832 inst.selectedDay = Math.min(inst.selectedDay, daysInMonth); 21833 } 21834 leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7; 21835 curRows = Math.ceil((leadDays + daysInMonth) / 7); // calculate the number of rows to generate 21836 numRows = (isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows); //If multiple months, use the higher number of rows (see #7043) 21837 this.maxRows = numRows; 21838 printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays)); 21839 for (dRow = 0; dRow < numRows; dRow++) { // create date picker rows 21840 calender += "<tr>"; 21841 tbody = (!showWeek ? "" : "<td class='ui-datepicker-week-col'>" + 21842 this._get(inst, "calculateWeek")(printDate) + "</td>"); 21843 for (dow = 0; dow < 7; dow++) { // create date picker days 21844 daySettings = (beforeShowDay ? 21845 beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, ""]); 21846 otherMonth = (printDate.getMonth() !== drawMonth); 21847 unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] || 21848 (minDate && printDate < minDate) || (maxDate && printDate > maxDate); 21849 tbody += "<td class='" + 21850 ((dow + firstDay + 6) % 7 >= 5 ? " ui-datepicker-week-end" : "") + // highlight weekends 21851 (otherMonth ? " ui-datepicker-other-month" : "") + // highlight days from other months 21852 ((printDate.getTime() === selectedDate.getTime() && drawMonth === inst.selectedMonth && inst._keyEvent) || // user pressed key 21853 (defaultDate.getTime() === printDate.getTime() && defaultDate.getTime() === selectedDate.getTime()) ? 21854 21855 // or defaultDate is current printedDate and defaultDate is selectedDate 21856 " " + this._dayOverClass : "") + // highlight selected day 21857 (unselectable ? " " + this._unselectableClass + " ui-state-disabled" : "") + // highlight unselectable days 21858 (otherMonth && !showOtherMonths ? "" : " " + daySettings[1] + // highlight custom dates 21859 (printDate.getTime() === currentDate.getTime() ? " " + this._currentClass : "") + // highlight selected day 21860 (printDate.getTime() === today.getTime() ? " ui-datepicker-today" : "")) + "'" + // highlight today (if different) 21861 ((!otherMonth || showOtherMonths) && daySettings[2] ? " title='" + daySettings[2].replace(/'/g, "'") + "'" : "") + // cell title 21862 (unselectable ? "" : " data-handler='selectDay' data-event='click' data-month='" + printDate.getMonth() + "' data-year='" + printDate.getFullYear() + "'") + ">" + // actions 21863 (otherMonth && !showOtherMonths ? " " : // display for other months 21864 (unselectable ? "<span class='ui-state-default'>" + printDate.getDate() + "</span>" : "<a class='ui-state-default" + 21865 (printDate.getTime() === today.getTime() ? " ui-state-highlight" : "") + 21866 (printDate.getTime() === currentDate.getTime() ? " ui-state-active" : "") + // highlight selected day 21867 (otherMonth ? " ui-priority-secondary" : "") + // distinguish dates from other months 21868 "' href='#' aria-current='" + (printDate.getTime() === currentDate.getTime() ? "true" : "false") + // mark date as selected for screen reader 21869 "' data-date='" + printDate.getDate() + // store date as data 21870 "'>" + printDate.getDate() + "</a>")) + "</td>"; // display selectable date 21871 printDate.setDate(printDate.getDate() + 1); 21872 printDate = this._daylightSavingAdjust(printDate); 21873 } 21874 calender += tbody + "</tr>"; 21875 } 21876 drawMonth++; 21877 if (drawMonth > 11) { 21878 drawMonth = 0; 21879 drawYear++; 21880 } 21881 calender += "</tbody></table>" + (isMultiMonth ? "</div>" + 21882 ((numMonths[0] > 0 && col === numMonths[1] - 1) ? "<div class='ui-datepicker-row-break'></div>" : "") : ""); 21883 group += calender; 21884 } 21885 html += group; 21886 } 21887 html += buttonPanel; 21888 inst._keyEvent = false; 21889 return html; 21890 }, 21891 21892 /* Generate the month and year header. */ 21893 _generateMonthYearHeader: function (inst, drawMonth, drawYear, minDate, maxDate, 21894 secondary, monthNames, monthNamesShort) { 21895 21896 var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear, 21897 changeMonth = this._get(inst, "changeMonth"), 21898 changeYear = this._get(inst, "changeYear"), 21899 showMonthAfterYear = this._get(inst, "showMonthAfterYear"), 21900 selectMonthLabel = this._get(inst, "selectMonthLabel"), 21901 selectYearLabel = this._get(inst, "selectYearLabel"), 21902 html = "<div class='ui-datepicker-title'>", 21903 monthHtml = ""; 21904 21905 // Month selection 21906 if (secondary || !changeMonth) { 21907 monthHtml += "<span class='ui-datepicker-month'>" + monthNames[drawMonth] + "</span>"; 21908 } else { 21909 inMinYear = (minDate && minDate.getFullYear() === drawYear); 21910 inMaxYear = (maxDate && maxDate.getFullYear() === drawYear); 21911 monthHtml += "<select class='ui-datepicker-month' aria-label='" + selectMonthLabel + "' data-handler='selectMonth' data-event='change'>"; 21912 for (month = 0; month < 12; month++) { 21913 if ((!inMinYear || month >= minDate.getMonth()) && (!inMaxYear || month <= maxDate.getMonth())) { 21914 monthHtml += "<option value='" + month + "'" + 21915 (month === drawMonth ? " selected='selected'" : "") + 21916 ">" + monthNamesShort[month] + "</option>"; 21917 } 21918 } 21919 monthHtml += "</select>"; 21920 } 21921 21922 if (!showMonthAfterYear) { 21923 html += monthHtml + (secondary || !(changeMonth && changeYear) ? " " : ""); 21924 } 21925 21926 // Year selection 21927 if (!inst.yearshtml) { 21928 inst.yearshtml = ""; 21929 if (secondary || !changeYear) { 21930 html += "<span class='ui-datepicker-year'>" + drawYear + "</span>"; 21931 } else { 21932 21933 // determine range of years to display 21934 years = this._get(inst, "yearRange").split(":"); 21935 thisYear = new Date().getFullYear(); 21936 determineYear = function (value) { 21937 var year = (value.match(/c[+\-].*/) ? drawYear + parseInt(value.substring(1), 10) : 21938 (value.match(/[+\-].*/) ? thisYear + parseInt(value, 10) : 21939 parseInt(value, 10))); 21940 return (isNaN(year) ? thisYear : year); 21941 }; 21942 year = determineYear(years[0]); 21943 endYear = Math.max(year, determineYear(years[1] || "")); 21944 year = (minDate ? Math.max(year, minDate.getFullYear()) : year); 21945 endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear); 21946 inst.yearshtml += "<select class='ui-datepicker-year' aria-label='" + selectYearLabel + "' data-handler='selectYear' data-event='change'>"; 21947 for (; year <= endYear; year++) { 21948 inst.yearshtml += "<option value='" + year + "'" + 21949 (year === drawYear ? " selected='selected'" : "") + 21950 ">" + year + "</option>"; 21951 } 21952 inst.yearshtml += "</select>"; 21953 21954 html += inst.yearshtml; 21955 inst.yearshtml = null; 21956 } 21957 } 21958 21959 html += this._get(inst, "yearSuffix"); 21960 if (showMonthAfterYear) { 21961 html += (secondary || !(changeMonth && changeYear) ? " " : "") + monthHtml; 21962 } 21963 html += "</div>"; // Close datepicker_header 21964 return html; 21965 }, 21966 21967 /* Adjust one of the date sub-fields. */ 21968 _adjustInstDate: function (inst, offset, period) { 21969 var year = inst.selectedYear + (period === "Y" ? offset : 0),
vendor: 19,389 bytes, lines 21970-22613
21970 month = inst.selectedMonth + (period === "M" ? offset : 0), 21971 day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) + (period === "D" ? offset : 0), 21972 date = this._restrictMinMax(inst, this._daylightSavingAdjust(new Date(year, month, day))); 21973 21974 inst.selectedDay = date.getDate(); 21975 inst.drawMonth = inst.selectedMonth = date.getMonth(); 21976 inst.drawYear = inst.selectedYear = date.getFullYear(); 21977 if (period === "M" || period === "Y") { 21978 this._notifyChange(inst); 21979 } 21980 }, 21981 21982 /* Ensure a date is within any min/max bounds. */ 21983 _restrictMinMax: function (inst, date) { 21984 var minDate = this._getMinMaxDate(inst, "min"), 21985 maxDate = this._getMinMaxDate(inst, "max"), 21986 newDate = (minDate && date < minDate ? minDate : date); 21987 return (maxDate && newDate > maxDate ? maxDate : newDate); 21988 }, 21989 21990 /* Notify change of month/year. */ 21991 _notifyChange: function (inst) { 21992 var onChange = this._get(inst, "onChangeMonthYear"); 21993 if (onChange) { 21994 onChange.apply((inst.input ? inst.input[0] : null), 21995 [inst.selectedYear, inst.selectedMonth + 1, inst]); 21996 } 21997 }, 21998 21999 /* Determine the number of months to show. */ 22000 _getNumberOfMonths: function (inst) { 22001 var numMonths = this._get(inst, "numberOfMonths"); 22002 return (numMonths == null ? [1, 1] : (typeof numMonths === "number" ? [1, numMonths] : numMonths)); 22003 }, 22004 22005 /* Determine the current maximum date - ensure no time components are set. */ 22006 _getMinMaxDate: function (inst, minMax) { 22007 return this._determineDate(inst, this._get(inst, minMax + "Date"), null); 22008 }, 22009 22010 /* Find the number of days in a given month. */ 22011 _getDaysInMonth: function (year, month) { 22012 return 32 - this._daylightSavingAdjust(new Date(year, month, 32)).getDate(); 22013 }, 22014 22015 /* Find the day of the week of the first of a month. */ 22016 _getFirstDayOfMonth: function (year, month) { 22017 return new Date(year, month, 1).getDay(); 22018 }, 22019 22020 /* Determines if we should allow a "next/prev" month display change. */ 22021 _canAdjustMonth: function (inst, offset, curYear, curMonth) { 22022 var numMonths = this._getNumberOfMonths(inst), 22023 date = this._daylightSavingAdjust(new Date(curYear, 22024 curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1)); 22025 22026 if (offset < 0) { 22027 date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth())); 22028 } 22029 return this._isInRange(inst, date); 22030 }, 22031 22032 /* Is the given date in the accepted range? */ 22033 _isInRange: function (inst, date) { 22034 var yearSplit, currentYear, 22035 minDate = this._getMinMaxDate(inst, "min"), 22036 maxDate = this._getMinMaxDate(inst, "max"), 22037 minYear = null, 22038 maxYear = null, 22039 years = this._get(inst, "yearRange"); 22040 if (years) { 22041 yearSplit = years.split(":"); 22042 currentYear = new Date().getFullYear(); 22043 minYear = parseInt(yearSplit[0], 10); 22044 maxYear = parseInt(yearSplit[1], 10); 22045 if (yearSplit[0].match(/[+\-].*/)) { 22046 minYear += currentYear; 22047 } 22048 if (yearSplit[1].match(/[+\-].*/)) { 22049 maxYear += currentYear; 22050 } 22051 } 22052 22053 return ((!minDate || date.getTime() >= minDate.getTime()) && 22054 (!maxDate || date.getTime() <= maxDate.getTime()) && 22055 (!minYear || date.getFullYear() >= minYear) && 22056 (!maxYear || date.getFullYear() <= maxYear)); 22057 }, 22058 22059 /* Provide the configuration settings for formatting/parsing. */ 22060 _getFormatConfig: function (inst) { 22061 var shortYearCutoff = this._get(inst, "shortYearCutoff"); 22062 shortYearCutoff = (typeof shortYearCutoff !== "string" ? shortYearCutoff : 22063 new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10)); 22064 return { 22065 shortYearCutoff: shortYearCutoff, 22066 dayNamesShort: this._get(inst, "dayNamesShort"), dayNames: this._get(inst, "dayNames"), 22067 monthNamesShort: this._get(inst, "monthNamesShort"), monthNames: this._get(inst, "monthNames") 22068 }; 22069 }, 22070 22071 /* Format the given date for display. */ 22072 _formatDate: function (inst, day, month, year) { 22073 if (!day) { 22074 inst.currentDay = inst.selectedDay; 22075 inst.currentMonth = inst.selectedMonth; 22076 inst.currentYear = inst.selectedYear; 22077 } 22078 var date = (day ? (typeof day === "object" ? day : 22079 this._daylightSavingAdjust(new Date(year, month, day))) : 22080 this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay))); 22081 return this.formatDate(this._get(inst, "dateFormat"), date, this._getFormatConfig(inst)); 22082 } 22083 }); 22084 22085 /* 22086 * Bind hover events for datepicker elements. 22087 * Done via delegate so the binding only occurs once in the lifetime of the parent div. 22088 * Global datepicker_instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker. 22089 */ 22090 function datepicker_bindHover(dpDiv) { 22091 var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a"; 22092 return dpDiv.on("mouseout", selector, function () { 22093 $(this).removeClass("ui-state-hover"); 22094 if (this.className.indexOf("ui-datepicker-prev") !== -1) { 22095 $(this).removeClass("ui-datepicker-prev-hover"); 22096 } 22097 if (this.className.indexOf("ui-datepicker-next") !== -1) { 22098 $(this).removeClass("ui-datepicker-next-hover"); 22099 } 22100 }) 22101 .on("mouseover", selector, datepicker_handleMouseover); 22102 } 22103 22104 function datepicker_handleMouseover() { 22105 if (!$.datepicker._isDisabledDatepicker(datepicker_instActive.inline ? datepicker_instActive.dpDiv.parent()[0] : datepicker_instActive.input[0])) { 22106 $(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"); 22107 $(this).addClass("ui-state-hover"); 22108 if (this.className.indexOf("ui-datepicker-prev") !== -1) { 22109 $(this).addClass("ui-datepicker-prev-hover"); 22110 } 22111 if (this.className.indexOf("ui-datepicker-next") !== -1) { 22112 $(this).addClass("ui-datepicker-next-hover"); 22113 } 22114 } 22115 } 22116 22117 /* jQuery extend now ignores nulls! */ 22118 function datepicker_extendRemove(target, props) { 22119 $.extend(target, props); 22120 for (var name in props) { 22121 if (props[name] == null) { 22122 target[name] = props[name]; 22123 } 22124 } 22125 return target; 22126 } 22127 22128 /* Invoke the datepicker functionality. 22129 @param options string - a command, optionally followed by additional parameters or 22130 Object - settings for attaching new datepicker functionality 22131 @return jQuery object */ 22132 $.fn.datepicker = function (options) { 22133 22134 /* Verify an empty collection wasn't passed - Fixes #6976 */ 22135 if (!this.length) { 22136 return this; 22137 } 22138 22139 /* Initialise the date picker. */ 22140 if (!$.datepicker.initialized) { 22141 $(document).on("mousedown", $.datepicker._checkExternalClick); 22142 $.datepicker.initialized = true; 22143 } 22144 22145 /* Append datepicker main container to body if not exist. */ 22146 if ($("#" + $.datepicker._mainDivId).length === 0) { 22147 $("body").append($.datepicker.dpDiv); 22148 } 22149 22150 var otherArgs = Array.prototype.slice.call(arguments, 1); 22151 if (typeof options === "string" && (options === "isDisabled" || options === "getDate" || options === "widget")) { 22152 return $.datepicker["_" + options + "Datepicker"]. 22153 apply($.datepicker, [this[0]].concat(otherArgs)); 22154 } 22155 if (options === "option" && arguments.length === 2 && typeof arguments[1] === "string") { 22156 return $.datepicker["_" + options + "Datepicker"]. 22157 apply($.datepicker, [this[0]].concat(otherArgs)); 22158 } 22159 return this.each(function () { 22160 if (typeof options === "string") { 22161 $.datepicker["_" + options + "Datepicker"] 22162 .apply($.datepicker, [this].concat(otherArgs)); 22163 } else { 22164 $.datepicker._attachDatepicker(this, options); 22165 } 22166 }); 22167 }; 22168 22169 $.datepicker = new Datepicker(); // singleton instance 22170 $.datepicker.initialized = false; 22171 $.datepicker.uuid = new Date().getTime(); 22172 $.datepicker.version = "1.13.2"; 22173 22174 var widgetsDatepicker = $.datepicker; 22175 22176 22177 22178 // This file is deprecated 22179 var ie = $.ui.ie = !!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()); 22180 22181 /*! 22182 * jQuery UI Mouse 1.13.2 22183 * http://jqueryui.com 22184 * 22185 * Copyright jQuery Foundation and other contributors 22186 * Released under the MIT license. 22187 * http://jquery.org/license 22188 */ 22189 22190 //>>label: Mouse 22191 //>>group: Widgets 22192 //>>description: Abstracts mouse-based interactions to assist in creating certain widgets. 22193 //>>docs: http://api.jqueryui.com/mouse/ 22194 22195 22196 var mouseHandled = false; 22197 $(document).on("mouseup", function () { 22198 mouseHandled = false; 22199 }); 22200 22201 var widgetsMouse = $.widget("ui.mouse", { 22202 version: "1.13.2", 22203 options: { 22204 cancel: "input, textarea, button, select, option", 22205 distance: 1, 22206 delay: 0 22207 }, 22208 _mouseInit: function () { 22209 var that = this; 22210 22211 this.element 22212 .on("mousedown." + this.widgetName, function (event) { 22213 return that._mouseDown(event); 22214 }) 22215 .on("click." + this.widgetName, function (event) { 22216 if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) { 22217 $.removeData(event.target, that.widgetName + ".preventClickEvent"); 22218 event.stopImmediatePropagation(); 22219 return false; 22220 } 22221 }); 22222 22223 this.started = false; 22224 }, 22225 22226 // TODO: make sure destroying one instance of mouse doesn't mess with 22227 // other instances of mouse 22228 _mouseDestroy: function () { 22229 this.element.off("." + this.widgetName); 22230 if (this._mouseMoveDelegate) { 22231 this.document 22232 .off("mousemove." + this.widgetName, this._mouseMoveDelegate) 22233 .off("mouseup." + this.widgetName, this._mouseUpDelegate); 22234 } 22235 }, 22236 22237 _mouseDown: function (event) { 22238 22239 // don't let more than one widget handle mouseStart 22240 if (mouseHandled) { 22241 return; 22242 } 22243 22244 this._mouseMoved = false; 22245 22246 // We may have missed mouseup (out of window) 22247 if (this._mouseStarted) { 22248 this._mouseUp(event); 22249 } 22250 22251 this._mouseDownEvent = event; 22252 22253 var that = this, 22254 btnIsLeft = (event.which === 1), 22255 22256 // event.target.nodeName works around a bug in IE 8 with 22257 // disabled inputs (#7620) 22258 elIsCancel = (typeof this.options.cancel === "string" && event.target.nodeName ? 22259 $(event.target).closest(this.options.cancel).length : false); 22260 if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) { 22261 return true; 22262 } 22263 22264 this.mouseDelayMet = !this.options.delay; 22265 if (!this.mouseDelayMet) { 22266 this._mouseDelayTimer = setTimeout(function () { 22267 that.mouseDelayMet = true; 22268 }, this.options.delay); 22269 } 22270 22271 if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { 22272 this._mouseStarted = (this._mouseStart(event) !== false); 22273 if (!this._mouseStarted) { 22274 event.preventDefault(); 22275 return true; 22276 } 22277 } 22278 22279 // Click event may never have fired (Gecko & Opera) 22280 if (true === $.data(event.target, this.widgetName + ".preventClickEvent")) { 22281 $.removeData(event.target, this.widgetName + ".preventClickEvent"); 22282 } 22283 22284 // These delegates are required to keep context 22285 this._mouseMoveDelegate = function (event) { 22286 return that._mouseMove(event); 22287 }; 22288 this._mouseUpDelegate = function (event) { 22289 return that._mouseUp(event); 22290 }; 22291 22292 this.document 22293 .on("mousemove." + this.widgetName, this._mouseMoveDelegate) 22294 .on("mouseup." + this.widgetName, this._mouseUpDelegate); 22295 22296 event.preventDefault(); 22297 22298 mouseHandled = true; 22299 return true; 22300 }, 22301 22302 _mouseMove: function (event) { 22303 22304 // Only check for mouseups outside the document if you've moved inside the document 22305 // at least once. This prevents the firing of mouseup in the case of IE<9, which will 22306 // fire a mousemove event if content is placed under the cursor. See #7778 22307 // Support: IE <9 22308 if (this._mouseMoved) { 22309 22310 // IE mouseup check - mouseup happened when mouse was out of window 22311 if ($.ui.ie && (!document.documentMode || document.documentMode < 9) && 22312 !event.button) { 22313 return this._mouseUp(event); 22314 22315 // Iframe mouseup check - mouseup occurred in another document 22316 } else if (!event.which) { 22317 22318 // Support: Safari <=8 - 9 22319 // Safari sets which to 0 if you press any of the following keys 22320 // during a drag (#14461) 22321 if (event.originalEvent.altKey || event.originalEvent.ctrlKey || 22322 event.originalEvent.metaKey || event.originalEvent.shiftKey) { 22323 this.ignoreMissingWhich = true; 22324 } else if (!this.ignoreMissingWhich) { 22325 return this._mouseUp(event); 22326 } 22327 } 22328 } 22329 22330 if (event.which || event.button) { 22331 this._mouseMoved = true; 22332 } 22333 22334 if (this._mouseStarted) { 22335 this._mouseDrag(event); 22336 return event.preventDefault(); 22337 } 22338 22339 if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { 22340 this._mouseStarted = 22341 (this._mouseStart(this._mouseDownEvent, event) !== false); 22342 if (this._mouseStarted) { 22343 this._mouseDrag(event); 22344 } else { 22345 this._mouseUp(event); 22346 } 22347 } 22348 22349 return !this._mouseStarted; 22350 }, 22351 22352 _mouseUp: function (event) { 22353 this.document 22354 .off("mousemove." + this.widgetName, this._mouseMoveDelegate) 22355 .off("mouseup." + this.widgetName, this._mouseUpDelegate); 22356 22357 if (this._mouseStarted) { 22358 this._mouseStarted = false; 22359 22360 if (event.target === this._mouseDownEvent.target) { 22361 $.data(event.target, this.widgetName + ".preventClickEvent", true); 22362 } 22363 22364 this._mouseStop(event); 22365 } 22366 22367 if (this._mouseDelayTimer) { 22368 clearTimeout(this._mouseDelayTimer); 22369 delete this._mouseDelayTimer; 22370 } 22371 22372 this.ignoreMissingWhich = false; 22373 mouseHandled = false; 22374 event.preventDefault(); 22375 }, 22376 22377 _mouseDistanceMet: function (event) { 22378 return (Math.max( 22379 Math.abs(this._mouseDownEvent.pageX - event.pageX), 22380 Math.abs(this._mouseDownEvent.pageY - event.pageY) 22381 ) >= this.options.distance 22382 ); 22383 }, 22384 22385 _mouseDelayMet: function ( /* event */) { 22386 return this.mouseDelayMet; 22387 }, 22388 22389 // These are placeholder methods, to be overriden by extending plugin 22390 _mouseStart: function ( /* event */) { }, 22391 _mouseDrag: function ( /* event */) { }, 22392 _mouseStop: function ( /* event */) { }, 22393 _mouseCapture: function ( /* event */) { 22394 return true; 22395 } 22396 }); 22397 22398 22399 22400 // $.ui.plugin is deprecated. Use $.widget() extensions instead. 22401 var plugin = $.ui.plugin = { 22402 add: function (module, option, set) { 22403 var i, 22404 proto = $.ui[module].prototype; 22405 for (i in set) { 22406 proto.plugins[i] = proto.plugins[i] || []; 22407 proto.plugins[i].push([option, set[i]]); 22408 } 22409 }, 22410 call: function (instance, name, args, allowDisconnected) { 22411 var i, 22412 set = instance.plugins[name]; 22413 22414 if (!set) { 22415 return; 22416 } 22417 22418 if (!allowDisconnected && (!instance.element[0].parentNode || 22419 instance.element[0].parentNode.nodeType === 11)) { 22420 return; 22421 } 22422 22423 for (i = 0; i < set.length; i++) { 22424 if (instance.options[set[i][0]]) { 22425 set[i][1].apply(instance.element, args); 22426 } 22427 } 22428 } 22429 }; 22430 22431 22432 22433 var safeBlur = $.ui.safeBlur = function (element) { 22434 22435 // Support: IE9 - 10 only 22436 // If the <body> is blurred, IE will switch windows, see #9420 22437 if (element && element.nodeName.toLowerCase() !== "body") { 22438 $(element).trigger("blur"); 22439 } 22440 }; 22441 22442 22443 /*! 22444 * jQuery UI Draggable 1.13.2 22445 * http://jqueryui.com 22446 * 22447 * Copyright jQuery Foundation and other contributors 22448 * Released under the MIT license. 22449 * http://jquery.org/license 22450 */ 22451 22452 //>>label: Draggable 22453 //>>group: Interactions 22454 //>>description: Enables dragging functionality for any element. 22455 //>>docs: http://api.jqueryui.com/draggable/ 22456 //>>demos: http://jqueryui.com/draggable/ 22457 //>>css.structure: ../../themes/base/draggable.css 22458 22459 22460 $.widget("ui.draggable", $.ui.mouse, { 22461 version: "1.13.2", 22462 widgetEventPrefix: "drag", 22463 options: { 22464 addClasses: true, 22465 appendTo: "parent", 22466 axis: false, 22467 connectToSortable: false, 22468 containment: false, 22469 cursor: "auto", 22470 cursorAt: false, 22471 grid: false, 22472 handle: false, 22473 helper: "original", 22474 iframeFix: false, 22475 opacity: false, 22476 refreshPositions: false, 22477 revert: false, 22478 revertDuration: 500, 22479 scope: "default", 22480 scroll: true, 22481 scrollSensitivity: 20, 22482 scrollSpeed: 20, 22483 snap: false, 22484 snapMode: "both", 22485 snapTolerance: 20, 22486 stack: false, 22487 zIndex: false, 22488 22489 // Callbacks 22490 drag: null, 22491 start: null, 22492 stop: null 22493 }, 22494 _create: function () { 22495 22496 if (this.options.helper === "original") { 22497 this._setPositionRelative(); 22498 } 22499 if (this.options.addClasses) { 22500 this._addClass("ui-draggable"); 22501 } 22502 this._setHandleClassName(); 22503 22504 this._mouseInit(); 22505 }, 22506 22507 _setOption: function (key, value) { 22508 this._super(key, value); 22509 if (key === "handle") { 22510 this._removeHandleClassName(); 22511 this._setHandleClassName(); 22512 } 22513 }, 22514 22515 _destroy: function () { 22516 if ((this.helper || this.element).is(".ui-draggable-dragging")) { 22517 this.destroyOnClear = true; 22518 return; 22519 } 22520 this._removeHandleClassName(); 22521 this._mouseDestroy(); 22522 }, 22523 22524 _mouseCapture: function (event) { 22525 var o = this.options; 22526 22527 // Among others, prevent a drag on a resizable-handle 22528 if (this.helper || o.disabled || 22529 $(event.target).closest(".ui-resizable-handle").length > 0) { 22530 return false; 22531 } 22532 22533 //Quit if we're not on a valid handle 22534 this.handle = this._getHandle(event); 22535 if (!this.handle) { 22536 return false; 22537 } 22538 22539 this._blurActiveElement(event); 22540 22541 this._blockFrames(o.iframeFix === true ? "iframe" : o.iframeFix); 22542 22543 return true; 22544 22545 }, 22546 22547 _blockFrames: function (selector) { 22548 this.iframeBlocks = this.document.find(selector).map(function () { 22549 var iframe = $(this); 22550 22551 return $("<div>") 22552 .css("position", "absolute") 22553 .appendTo(iframe.parent()) 22554 .outerWidth(iframe.outerWidth()) 22555 .outerHeight(iframe.outerHeight()) 22556 .offset(iframe.offset())[0]; 22557 }); 22558 }, 22559 22560 _unblockFrames: function () { 22561 if (this.iframeBlocks) { 22562 this.iframeBlocks.remove(); 22563 delete this.iframeBlocks; 22564 } 22565 }, 22566 22567 _blurActiveElement: function (event) { 22568 var activeElement = $.ui.safeActiveElement(this.document[0]), 22569 target = $(event.target); 22570 22571 // Don't blur if the event occurred on an element that is within 22572 // the currently focused element 22573 // See #10527, #12472 22574 if (target.closest(activeElement).length) { 22575 return; 22576 } 22577 22578 // Blur any element that currently has focus, see #4261 22579 $.ui.safeBlur(activeElement); 22580 }, 22581 22582 _mouseStart: function (event) { 22583 22584 var o = this.options; 22585 22586 //Create and append the visible helper 22587 this.helper = this._createHelper(event); 22588 22589 this._addClass(this.helper, "ui-draggable-dragging"); 22590 22591 //Cache the helper size 22592 this._cacheHelperProportions(); 22593 22594 //If ddmanager is used for droppables, set the global draggable 22595 if ($.ui.ddmanager) { 22596 $.ui.ddmanager.current = this; 22597 } 22598 22599 /* 22600 * - Position generation - 22601 * This block generates everything position related - it's the core of draggables. 22602 */ 22603 22604 //Cache the margins of the original element 22605 this._cacheMargins(); 22606 22607 //Store the helper's css position 22608 this.cssPosition = this.helper.css("position"); 22609 this.scrollParent = this.helper.scrollParent(true); 22610 this.offsetParent = this.helper.offsetParent(); 22611 this.hasFixedAncestor = this.helper.parents().filter(function () { 22612 return $(this).css("position") === "fixed"; 22613 }).length > 0;
vendor: 32,151 bytes, lines 22614-23680
22614 22615 //The element's absolute position on the page minus margins 22616 this.positionAbs = this.element.offset(); 22617 this._refreshOffsets(event); 22618 22619 //Generate the original position 22620 this.originalPosition = this.position = this._generatePosition(event, false); 22621 this.originalPageX = event.pageX; 22622 this.originalPageY = event.pageY; 22623 22624 //Adjust the mouse offset relative to the helper if "cursorAt" is supplied 22625 if (o.cursorAt) { 22626 this._adjustOffsetFromHelper(o.cursorAt); 22627 } 22628 22629 //Set a containment if given in the options 22630 this._setContainment(); 22631 22632 //Trigger event + callbacks 22633 if (this._trigger("start", event) === false) { 22634 this._clear(); 22635 return false; 22636 } 22637 22638 //Recache the helper size 22639 this._cacheHelperProportions(); 22640 22641 //Prepare the droppable offsets 22642 if ($.ui.ddmanager && !o.dropBehaviour) { 22643 $.ui.ddmanager.prepareOffsets(this, event); 22644 } 22645 22646 // Execute the drag once - this causes the helper not to be visible before getting its 22647 // correct position 22648 this._mouseDrag(event, true); 22649 22650 // If the ddmanager is used for droppables, inform the manager that dragging has started 22651 // (see #5003) 22652 if ($.ui.ddmanager) { 22653 $.ui.ddmanager.dragStart(this, event); 22654 } 22655 22656 return true; 22657 }, 22658 22659 _refreshOffsets: function (event) { 22660 this.offset = { 22661 top: this.positionAbs.top - this.margins.top, 22662 left: this.positionAbs.left - this.margins.left, 22663 scroll: false, 22664 parent: this._getParentOffset(), 22665 relative: this._getRelativeOffset() 22666 }; 22667 22668 this.offset.click = { 22669 left: event.pageX - this.offset.left, 22670 top: event.pageY - this.offset.top 22671 }; 22672 }, 22673 22674 _mouseDrag: function (event, noPropagation) { 22675 22676 // reset any necessary cached properties (see #5009) 22677 if (this.hasFixedAncestor) { 22678 this.offset.parent = this._getParentOffset(); 22679 } 22680 22681 //Compute the helpers position 22682 this.position = this._generatePosition(event, true); 22683 this.positionAbs = this._convertPositionTo("absolute"); 22684 22685 //Call plugins and callbacks and use the resulting position if something is returned 22686 if (!noPropagation) { 22687 var ui = this._uiHash(); 22688 if (this._trigger("drag", event, ui) === false) { 22689 this._mouseUp(new $.Event("mouseup", event)); 22690 return false; 22691 } 22692 this.position = ui.position; 22693 } 22694 22695 this.helper[0].style.left = this.position.left + "px"; 22696 this.helper[0].style.top = this.position.top + "px"; 22697 22698 if ($.ui.ddmanager) { 22699 $.ui.ddmanager.drag(this, event); 22700 } 22701 22702 return false; 22703 }, 22704 22705 _mouseStop: function (event) { 22706 22707 //If we are using droppables, inform the manager about the drop 22708 var that = this, 22709 dropped = false; 22710 if ($.ui.ddmanager && !this.options.dropBehaviour) { 22711 dropped = $.ui.ddmanager.drop(this, event); 22712 } 22713 22714 //if a drop comes from outside (a sortable) 22715 if (this.dropped) { 22716 dropped = this.dropped; 22717 this.dropped = false; 22718 } 22719 22720 if ((this.options.revert === "invalid" && !dropped) || 22721 (this.options.revert === "valid" && dropped) || 22722 this.options.revert === true || (typeof this.options.revert === "function" && 22723 this.options.revert.call(this.element, dropped)) 22724 ) { 22725 $(this.helper).animate( 22726 this.originalPosition, 22727 parseInt(this.options.revertDuration, 10), 22728 function () { 22729 if (that._trigger("stop", event) !== false) { 22730 that._clear(); 22731 } 22732 } 22733 ); 22734 } else { 22735 if (this._trigger("stop", event) !== false) { 22736 this._clear(); 22737 } 22738 } 22739 22740 return false; 22741 }, 22742 22743 _mouseUp: function (event) { 22744 this._unblockFrames(); 22745 22746 // If the ddmanager is used for droppables, inform the manager that dragging has stopped 22747 // (see #5003) 22748 if ($.ui.ddmanager) { 22749 $.ui.ddmanager.dragStop(this, event); 22750 } 22751 22752 // Only need to focus if the event occurred on the draggable itself, see #10527 22753 if (this.handleElement.is(event.target)) { 22754 22755 // The interaction is over; whether or not the click resulted in a drag, 22756 // focus the element 22757 this.element.trigger("focus"); 22758 } 22759 22760 return $.ui.mouse.prototype._mouseUp.call(this, event); 22761 }, 22762 22763 cancel: function () { 22764 22765 if (this.helper.is(".ui-draggable-dragging")) { 22766 this._mouseUp(new $.Event("mouseup", { target: this.element[0] })); 22767 } else { 22768 this._clear(); 22769 } 22770 22771 return this; 22772 22773 }, 22774 22775 _getHandle: function (event) { 22776 return this.options.handle ? 22777 !!$(event.target).closest(this.element.find(this.options.handle)).length : 22778 true; 22779 }, 22780 22781 _setHandleClassName: function () { 22782 this.handleElement = this.options.handle ? 22783 this.element.find(this.options.handle) : this.element; 22784 this._addClass(this.handleElement, "ui-draggable-handle"); 22785 }, 22786 22787 _removeHandleClassName: function () { 22788 this._removeClass(this.handleElement, "ui-draggable-handle"); 22789 }, 22790 22791 _createHelper: function (event) { 22792 22793 var o = this.options, 22794 helperIsFunction = typeof o.helper === "function", 22795 helper = helperIsFunction ? 22796 $(o.helper.apply(this.element[0], [event])) : 22797 (o.helper === "clone" ? 22798 this.element.clone().removeAttr("id") : 22799 this.element); 22800 22801 if (!helper.parents("body").length) { 22802 helper.appendTo((o.appendTo === "parent" ? 22803 this.element[0].parentNode : 22804 o.appendTo)); 22805 } 22806 22807 // Http://bugs.jqueryui.com/ticket/9446 22808 // a helper function can return the original element 22809 // which wouldn't have been set to relative in _create 22810 if (helperIsFunction && helper[0] === this.element[0]) { 22811 this._setPositionRelative(); 22812 } 22813 22814 if (helper[0] !== this.element[0] && 22815 !(/(fixed|absolute)/).test(helper.css("position"))) { 22816 helper.css("position", "absolute"); 22817 } 22818 22819 return helper; 22820 22821 }, 22822 22823 _setPositionRelative: function () { 22824 if (!(/^(?:r|a|f)/).test(this.element.css("position"))) { 22825 this.element[0].style.position = "relative"; 22826 } 22827 }, 22828 22829 _adjustOffsetFromHelper: function (obj) { 22830 if (typeof obj === "string") { 22831 obj = obj.split(" "); 22832 } 22833 if (Array.isArray(obj)) { 22834 obj = { left: +obj[0], top: +obj[1] || 0 }; 22835 } 22836 if ("left" in obj) { 22837 this.offset.click.left = obj.left + this.margins.left; 22838 } 22839 if ("right" in obj) { 22840 this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; 22841 } 22842 if ("top" in obj) { 22843 this.offset.click.top = obj.top + this.margins.top; 22844 } 22845 if ("bottom" in obj) { 22846 this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; 22847 } 22848 }, 22849 22850 _isRootNode: function (element) { 22851 return (/(html|body)/i).test(element.tagName) || element === this.document[0]; 22852 }, 22853 22854 _getParentOffset: function () { 22855 22856 //Get the offsetParent and cache its position 22857 var po = this.offsetParent.offset(), 22858 document = this.document[0]; 22859 22860 // This is a special case where we need to modify a offset calculated on start, since the 22861 // following happened: 22862 // 1. The position of the helper is absolute, so it's position is calculated based on the 22863 // next positioned parent 22864 // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't 22865 // the document, which means that the scroll is included in the initial calculation of the 22866 // offset of the parent, and never recalculated upon drag 22867 if (this.cssPosition === "absolute" && this.scrollParent[0] !== document && 22868 $.contains(this.scrollParent[0], this.offsetParent[0])) { 22869 po.left += this.scrollParent.scrollLeft(); 22870 po.top += this.scrollParent.scrollTop(); 22871 } 22872 22873 if (this._isRootNode(this.offsetParent[0])) { 22874 po = { top: 0, left: 0 }; 22875 } 22876 22877 return { 22878 top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0), 22879 left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0) 22880 }; 22881 22882 }, 22883 22884 _getRelativeOffset: function () { 22885 if (this.cssPosition !== "relative") { 22886 return { top: 0, left: 0 }; 22887 } 22888 22889 var p = this.element.position(), 22890 scrollIsRootNode = this._isRootNode(this.scrollParent[0]); 22891 22892 return { 22893 top: p.top - (parseInt(this.helper.css("top"), 10) || 0) + 22894 (!scrollIsRootNode ? this.scrollParent.scrollTop() : 0), 22895 left: p.left - (parseInt(this.helper.css("left"), 10) || 0) + 22896 (!scrollIsRootNode ? this.scrollParent.scrollLeft() : 0) 22897 }; 22898 22899 }, 22900 22901 _cacheMargins: function () { 22902 this.margins = { 22903 left: (parseInt(this.element.css("marginLeft"), 10) || 0), 22904 top: (parseInt(this.element.css("marginTop"), 10) || 0), 22905 right: (parseInt(this.element.css("marginRight"), 10) || 0), 22906 bottom: (parseInt(this.element.css("marginBottom"), 10) || 0) 22907 }; 22908 }, 22909 22910 _cacheHelperProportions: function () { 22911 this.helperProportions = { 22912 width: this.helper.outerWidth(), 22913 height: this.helper.outerHeight() 22914 }; 22915 }, 22916 22917 _setContainment: function () { 22918 22919 var isUserScrollable, c, ce, 22920 o = this.options, 22921 document = this.document[0]; 22922 22923 this.relativeContainer = null; 22924 22925 if (!o.containment) { 22926 this.containment = null; 22927 return; 22928 } 22929 22930 if (o.containment === "window") { 22931 this.containment = [ 22932 $(window).scrollLeft() - this.offset.relative.left - this.offset.parent.left, 22933 $(window).scrollTop() - this.offset.relative.top - this.offset.parent.top, 22934 $(window).scrollLeft() + $(window).width() - 22935 this.helperProportions.width - this.margins.left, 22936 $(window).scrollTop() + 22937 ($(window).height() || document.body.parentNode.scrollHeight) - 22938 this.helperProportions.height - this.margins.top 22939 ]; 22940 return; 22941 } 22942 22943 if (o.containment === "document") { 22944 this.containment = [ 22945 0, 22946 0, 22947 $(document).width() - this.helperProportions.width - this.margins.left, 22948 ($(document).height() || document.body.parentNode.scrollHeight) - 22949 this.helperProportions.height - this.margins.top 22950 ]; 22951 return; 22952 } 22953 22954 if (o.containment.constructor === Array) { 22955 this.containment = o.containment; 22956 return; 22957 } 22958 22959 if (o.containment === "parent") { 22960 o.containment = this.helper[0].parentNode; 22961 } 22962 22963 c = $(o.containment); 22964 ce = c[0]; 22965 22966 if (!ce) { 22967 return; 22968 } 22969 22970 isUserScrollable = /(scroll|auto)/.test(c.css("overflow")); 22971 22972 this.containment = [ 22973 (parseInt(c.css("borderLeftWidth"), 10) || 0) + 22974 (parseInt(c.css("paddingLeft"), 10) || 0), 22975 (parseInt(c.css("borderTopWidth"), 10) || 0) + 22976 (parseInt(c.css("paddingTop"), 10) || 0), 22977 (isUserScrollable ? Math.max(ce.scrollWidth, ce.offsetWidth) : ce.offsetWidth) - 22978 (parseInt(c.css("borderRightWidth"), 10) || 0) - 22979 (parseInt(c.css("paddingRight"), 10) || 0) - 22980 this.helperProportions.width - 22981 this.margins.left - 22982 this.margins.right, 22983 (isUserScrollable ? Math.max(ce.scrollHeight, ce.offsetHeight) : ce.offsetHeight) - 22984 (parseInt(c.css("borderBottomWidth"), 10) || 0) - 22985 (parseInt(c.css("paddingBottom"), 10) || 0) - 22986 this.helperProportions.height - 22987 this.margins.top - 22988 this.margins.bottom 22989 ]; 22990 this.relativeContainer = c; 22991 }, 22992 22993 _convertPositionTo: function (d, pos) { 22994 22995 if (!pos) { 22996 pos = this.position; 22997 } 22998 22999 var mod = d === "absolute" ? 1 : -1, 23000 scrollIsRootNode = this._isRootNode(this.scrollParent[0]); 23001 23002 return { 23003 top: ( 23004 23005 // The absolute mouse position 23006 pos.top + 23007 23008 // Only for relative positioned nodes: Relative offset from element to offset parent 23009 this.offset.relative.top * mod + 23010 23011 // The offsetParent's offset without borders (offset + border) 23012 this.offset.parent.top * mod - 23013 ((this.cssPosition === "fixed" ? 23014 -this.offset.scroll.top : 23015 (scrollIsRootNode ? 0 : this.offset.scroll.top)) * mod) 23016 ), 23017 left: ( 23018 23019 // The absolute mouse position 23020 pos.left + 23021 23022 // Only for relative positioned nodes: Relative offset from element to offset parent 23023 this.offset.relative.left * mod + 23024 23025 // The offsetParent's offset without borders (offset + border) 23026 this.offset.parent.left * mod - 23027 ((this.cssPosition === "fixed" ? 23028 -this.offset.scroll.left : 23029 (scrollIsRootNode ? 0 : this.offset.scroll.left)) * mod) 23030 ) 23031 }; 23032 23033 }, 23034 23035 _generatePosition: function (event, constrainPosition) { 23036 23037 var containment, co, top, left, 23038 o = this.options, 23039 scrollIsRootNode = this._isRootNode(this.scrollParent[0]), 23040 pageX = event.pageX, 23041 pageY = event.pageY; 23042 23043 // Cache the scroll 23044 if (!scrollIsRootNode || !this.offset.scroll) { 23045 this.offset.scroll = { 23046 top: this.scrollParent.scrollTop(), 23047 left: this.scrollParent.scrollLeft() 23048 }; 23049 } 23050 23051 /* 23052 * - Position constraining - 23053 * Constrain the position to a mix of grid, containment. 23054 */ 23055 23056 // If we are not dragging yet, we won't check for options 23057 if (constrainPosition) { 23058 if (this.containment) { 23059 if (this.relativeContainer) { 23060 co = this.relativeContainer.offset(); 23061 containment = [ 23062 this.containment[0] + co.left, 23063 this.containment[1] + co.top, 23064 this.containment[2] + co.left, 23065 this.containment[3] + co.top 23066 ]; 23067 } else { 23068 containment = this.containment; 23069 } 23070 23071 if (event.pageX - this.offset.click.left < containment[0]) { 23072 pageX = containment[0] + this.offset.click.left; 23073 } 23074 if (event.pageY - this.offset.click.top < containment[1]) { 23075 pageY = containment[1] + this.offset.click.top; 23076 } 23077 if (event.pageX - this.offset.click.left > containment[2]) { 23078 pageX = containment[2] + this.offset.click.left; 23079 } 23080 if (event.pageY - this.offset.click.top > containment[3]) { 23081 pageY = containment[3] + this.offset.click.top; 23082 } 23083 } 23084 23085 if (o.grid) { 23086 23087 //Check for grid elements set to 0 to prevent divide by 0 error causing invalid 23088 // argument errors in IE (see ticket #6950) 23089 top = o.grid[1] ? this.originalPageY + Math.round((pageY - 23090 this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY; 23091 pageY = containment ? ((top - this.offset.click.top >= containment[1] || 23092 top - this.offset.click.top > containment[3]) ? 23093 top : 23094 ((top - this.offset.click.top >= containment[1]) ? 23095 top - o.grid[1] : top + o.grid[1])) : top; 23096 23097 left = o.grid[0] ? this.originalPageX + 23098 Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : 23099 this.originalPageX; 23100 pageX = containment ? ((left - this.offset.click.left >= containment[0] || 23101 left - this.offset.click.left > containment[2]) ? 23102 left : 23103 ((left - this.offset.click.left >= containment[0]) ? 23104 left - o.grid[0] : left + o.grid[0])) : left; 23105 } 23106 23107 if (o.axis === "y") { 23108 pageX = this.originalPageX; 23109 } 23110 23111 if (o.axis === "x") { 23112 pageY = this.originalPageY; 23113 } 23114 } 23115 23116 return { 23117 top: ( 23118 23119 // The absolute mouse position 23120 pageY - 23121 23122 // Click offset (relative to the element) 23123 this.offset.click.top - 23124 23125 // Only for relative positioned nodes: Relative offset from element to offset parent 23126 this.offset.relative.top - 23127 23128 // The offsetParent's offset without borders (offset + border) 23129 this.offset.parent.top + 23130 (this.cssPosition === "fixed" ? 23131 -this.offset.scroll.top : 23132 (scrollIsRootNode ? 0 : this.offset.scroll.top)) 23133 ), 23134 left: ( 23135 23136 // The absolute mouse position 23137 pageX - 23138 23139 // Click offset (relative to the element) 23140 this.offset.click.left - 23141 23142 // Only for relative positioned nodes: Relative offset from element to offset parent 23143 this.offset.relative.left - 23144 23145 // The offsetParent's offset without borders (offset + border) 23146 this.offset.parent.left + 23147 (this.cssPosition === "fixed" ? 23148 -this.offset.scroll.left : 23149 (scrollIsRootNode ? 0 : this.offset.scroll.left)) 23150 ) 23151 }; 23152 23153 }, 23154 23155 _clear: function () { 23156 this._removeClass(this.helper, "ui-draggable-dragging"); 23157 if (this.helper[0] !== this.element[0] && !this.cancelHelperRemoval) { 23158 this.helper.remove(); 23159 } 23160 this.helper = null; 23161 this.cancelHelperRemoval = false; 23162 if (this.destroyOnClear) { 23163 this.destroy(); 23164 } 23165 }, 23166 23167 // From now on bulk stuff - mainly helpers 23168 23169 _trigger: function (type, event, ui) { 23170 ui = ui || this._uiHash(); 23171 $.ui.plugin.call(this, type, [event, ui, this], true); 23172 23173 // Absolute position and offset (see #6884 ) have to be recalculated after plugins 23174 if (/^(drag|start|stop)/.test(type)) { 23175 this.positionAbs = this._convertPositionTo("absolute"); 23176 ui.offset = this.positionAbs; 23177 } 23178 return $.Widget.prototype._trigger.call(this, type, event, ui); 23179 }, 23180 23181 plugins: {}, 23182 23183 _uiHash: function () { 23184 return { 23185 helper: this.helper, 23186 position: this.position, 23187 originalPosition: this.originalPosition, 23188 offset: this.positionAbs 23189 }; 23190 } 23191 23192 }); 23193 23194 $.ui.plugin.add("draggable", "connectToSortable", { 23195 start: function (event, ui, draggable) { 23196 var uiSortable = $.extend({}, ui, { 23197 item: draggable.element 23198 }); 23199 23200 draggable.sortables = []; 23201 $(draggable.options.connectToSortable).each(function () { 23202 var sortable = $(this).sortable("instance"); 23203 23204 if (sortable && !sortable.options.disabled) { 23205 draggable.sortables.push(sortable); 23206 23207 // RefreshPositions is called at drag start to refresh the containerCache 23208 // which is used in drag. This ensures it's initialized and synchronized 23209 // with any changes that might have happened on the page since initialization. 23210 sortable.refreshPositions(); 23211 sortable._trigger("activate", event, uiSortable); 23212 } 23213 }); 23214 }, 23215 stop: function (event, ui, draggable) { 23216 var uiSortable = $.extend({}, ui, { 23217 item: draggable.element 23218 }); 23219 23220 draggable.cancelHelperRemoval = false; 23221 23222 $.each(draggable.sortables, function () { 23223 var sortable = this; 23224 23225 if (sortable.isOver) { 23226 sortable.isOver = 0; 23227 23228 // Allow this sortable to handle removing the helper 23229 draggable.cancelHelperRemoval = true; 23230 sortable.cancelHelperRemoval = false; 23231 23232 // Use _storedCSS To restore properties in the sortable, 23233 // as this also handles revert (#9675) since the draggable 23234 // may have modified them in unexpected ways (#8809) 23235 sortable._storedCSS = { 23236 position: sortable.placeholder.css("position"), 23237 top: sortable.placeholder.css("top"), 23238 left: sortable.placeholder.css("left") 23239 }; 23240 23241 sortable._mouseStop(event); 23242 23243 // Once drag has ended, the sortable should return to using 23244 // its original helper, not the shared helper from draggable 23245 sortable.options.helper = sortable.options._helper; 23246 } else { 23247 23248 // Prevent this Sortable from removing the helper. 23249 // However, don't set the draggable to remove the helper 23250 // either as another connected Sortable may yet handle the removal. 23251 sortable.cancelHelperRemoval = true; 23252 23253 sortable._trigger("deactivate", event, uiSortable); 23254 } 23255 }); 23256 }, 23257 drag: function (event, ui, draggable) { 23258 $.each(draggable.sortables, function () { 23259 var innermostIntersecting = false, 23260 sortable = this; 23261 23262 // Copy over variables that sortable's _intersectsWith uses 23263 sortable.positionAbs = draggable.positionAbs; 23264 sortable.helperProportions = draggable.helperProportions; 23265 sortable.offset.click = draggable.offset.click; 23266 23267 if (sortable._intersectsWith(sortable.containerCache)) { 23268 innermostIntersecting = true; 23269 23270 $.each(draggable.sortables, function () { 23271 23272 // Copy over variables that sortable's _intersectsWith uses 23273 this.positionAbs = draggable.positionAbs; 23274 this.helperProportions = draggable.helperProportions; 23275 this.offset.click = draggable.offset.click; 23276 23277 if (this !== sortable && 23278 this._intersectsWith(this.containerCache) && 23279 $.contains(sortable.element[0], this.element[0])) { 23280 innermostIntersecting = false; 23281 } 23282 23283 return innermostIntersecting; 23284 }); 23285 } 23286 23287 if (innermostIntersecting) { 23288 23289 // If it intersects, we use a little isOver variable and set it once, 23290 // so that the move-in stuff gets fired only once. 23291 if (!sortable.isOver) { 23292 sortable.isOver = 1; 23293 23294 // Store draggable's parent in case we need to reappend to it later. 23295 draggable._parent = ui.helper.parent(); 23296 23297 sortable.currentItem = ui.helper 23298 .appendTo(sortable.element) 23299 .data("ui-sortable-item", true); 23300 23301 // Store helper option to later restore it 23302 sortable.options._helper = sortable.options.helper; 23303 23304 sortable.options.helper = function () { 23305 return ui.helper[0]; 23306 }; 23307 23308 // Fire the start events of the sortable with our passed browser event, 23309 // and our own helper (so it doesn't create a new one) 23310 event.target = sortable.currentItem[0]; 23311 sortable._mouseCapture(event, true); 23312 sortable._mouseStart(event, true, true); 23313 23314 // Because the browser event is way off the new appended portlet, 23315 // modify necessary variables to reflect the changes 23316 sortable.offset.click.top = draggable.offset.click.top; 23317 sortable.offset.click.left = draggable.offset.click.left; 23318 sortable.offset.parent.left -= draggable.offset.parent.left - 23319 sortable.offset.parent.left; 23320 sortable.offset.parent.top -= draggable.offset.parent.top - 23321 sortable.offset.parent.top; 23322 23323 draggable._trigger("toSortable", event); 23324 23325 // Inform draggable that the helper is in a valid drop zone, 23326 // used solely in the revert option to handle "valid/invalid". 23327 draggable.dropped = sortable.element; 23328 23329 // Need to refreshPositions of all sortables in the case that 23330 // adding to one sortable changes the location of the other sortables (#9675) 23331 $.each(draggable.sortables, function () { 23332 this.refreshPositions(); 23333 }); 23334 23335 // Hack so receive/update callbacks work (mostly) 23336 draggable.currentItem = draggable.element; 23337 sortable.fromOutside = draggable; 23338 } 23339 23340 if (sortable.currentItem) { 23341 sortable._mouseDrag(event); 23342 23343 // Copy the sortable's position because the draggable's can potentially reflect 23344 // a relative position, while sortable is always absolute, which the dragged 23345 // element has now become. (#8809) 23346 ui.position = sortable.position; 23347 } 23348 } else { 23349 23350 // If it doesn't intersect with the sortable, and it intersected before, 23351 // we fake the drag stop of the sortable, but make sure it doesn't remove 23352 // the helper by using cancelHelperRemoval. 23353 if (sortable.isOver) { 23354 23355 sortable.isOver = 0; 23356 sortable.cancelHelperRemoval = true; 23357 23358 // Calling sortable's mouseStop would trigger a revert, 23359 // so revert must be temporarily false until after mouseStop is called. 23360 sortable.options._revert = sortable.options.revert; 23361 sortable.options.revert = false; 23362 23363 sortable._trigger("out", event, sortable._uiHash(sortable)); 23364 sortable._mouseStop(event, true); 23365 23366 // Restore sortable behaviors that were modfied 23367 // when the draggable entered the sortable area (#9481) 23368 sortable.options.revert = sortable.options._revert; 23369 sortable.options.helper = sortable.options._helper; 23370 23371 if (sortable.placeholder) { 23372 sortable.placeholder.remove(); 23373 } 23374 23375 // Restore and recalculate the draggable's offset considering the sortable 23376 // may have modified them in unexpected ways. (#8809, #10669) 23377 ui.helper.appendTo(draggable._parent); 23378 draggable._refreshOffsets(event); 23379 ui.position = draggable._generatePosition(event, true); 23380 23381 draggable._trigger("fromSortable", event); 23382 23383 // Inform draggable that the helper is no longer in a valid drop zone 23384 draggable.dropped = false; 23385 23386 // Need to refreshPositions of all sortables just in case removing 23387 // from one sortable changes the location of other sortables (#9675) 23388 $.each(draggable.sortables, function () { 23389 this.refreshPositions(); 23390 }); 23391 } 23392 } 23393 }); 23394 } 23395 }); 23396 23397 $.ui.plugin.add("draggable", "cursor", { 23398 start: function (event, ui, instance) { 23399 var t = $("body"), 23400 o = instance.options; 23401 23402 if (t.css("cursor")) { 23403 o._cursor = t.css("cursor"); 23404 } 23405 t.css("cursor", o.cursor); 23406 }, 23407 stop: function (event, ui, instance) { 23408 var o = instance.options; 23409 if (o._cursor) { 23410 $("body").css("cursor", o._cursor); 23411 } 23412 } 23413 }); 23414 23415 $.ui.plugin.add("draggable", "opacity", { 23416 start: function (event, ui, instance) { 23417 var t = $(ui.helper), 23418 o = instance.options; 23419 if (t.css("opacity")) { 23420 o._opacity = t.css("opacity"); 23421 } 23422 t.css("opacity", o.opacity); 23423 }, 23424 stop: function (event, ui, instance) { 23425 var o = instance.options; 23426 if (o._opacity) { 23427 $(ui.helper).css("opacity", o._opacity); 23428 } 23429 } 23430 }); 23431 23432 $.ui.plugin.add("draggable", "scroll", { 23433 start: function (event, ui, i) { 23434 if (!i.scrollParentNotHidden) { 23435 i.scrollParentNotHidden = i.helper.scrollParent(false); 23436 } 23437 23438 if (i.scrollParentNotHidden[0] !== i.document[0] && 23439 i.scrollParentNotHidden[0].tagName !== "HTML") { 23440 i.overflowOffset = i.scrollParentNotHidden.offset(); 23441 } 23442 }, 23443 drag: function (event, ui, i) { 23444 23445 var o = i.options, 23446 scrolled = false, 23447 scrollParent = i.scrollParentNotHidden[0], 23448 document = i.document[0]; 23449 23450 if (scrollParent !== document && scrollParent.tagName !== "HTML") { 23451 if (!o.axis || o.axis !== "x") { 23452 if ((i.overflowOffset.top + scrollParent.offsetHeight) - event.pageY < 23453 o.scrollSensitivity) { 23454 scrollParent.scrollTop = scrolled = scrollParent.scrollTop + o.scrollSpeed; 23455 } else if (event.pageY - i.overflowOffset.top < o.scrollSensitivity) { 23456 scrollParent.scrollTop = scrolled = scrollParent.scrollTop - o.scrollSpeed; 23457 } 23458 } 23459 23460 if (!o.axis || o.axis !== "y") { 23461 if ((i.overflowOffset.left + scrollParent.offsetWidth) - event.pageX < 23462 o.scrollSensitivity) { 23463 scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft + o.scrollSpeed; 23464 } else if (event.pageX - i.overflowOffset.left < o.scrollSensitivity) { 23465 scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft - o.scrollSpeed; 23466 } 23467 } 23468 23469 } else { 23470 23471 if (!o.axis || o.axis !== "x") { 23472 if (event.pageY - $(document).scrollTop() < o.scrollSensitivity) { 23473 scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed); 23474 } else if ($(window).height() - (event.pageY - $(document).scrollTop()) < 23475 o.scrollSensitivity) { 23476 scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed); 23477 } 23478 } 23479 23480 if (!o.axis || o.axis !== "y") { 23481 if (event.pageX - $(document).scrollLeft() < o.scrollSensitivity) { 23482 scrolled = $(document).scrollLeft( 23483 $(document).scrollLeft() - o.scrollSpeed 23484 ); 23485 } else if ($(window).width() - (event.pageX - $(document).scrollLeft()) < 23486 o.scrollSensitivity) { 23487 scrolled = $(document).scrollLeft( 23488 $(document).scrollLeft() + o.scrollSpeed 23489 ); 23490 } 23491 } 23492 23493 } 23494 23495 if (scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) { 23496 $.ui.ddmanager.prepareOffsets(i, event); 23497 } 23498 23499 } 23500 }); 23501 23502 $.ui.plugin.add("draggable", "snap", { 23503 start: function (event, ui, i) { 23504 23505 var o = i.options; 23506 23507 i.snapElements = []; 23508 23509 $(o.snap.constructor !== String ? (o.snap.items || ":data(ui-draggable)") : o.snap) 23510 .each(function () { 23511 var $t = $(this), 23512 $o = $t.offset(); 23513 if (this !== i.element[0]) { 23514 i.snapElements.push({ 23515 item: this, 23516 width: $t.outerWidth(), height: $t.outerHeight(), 23517 top: $o.top, left: $o.left 23518 }); 23519 } 23520 }); 23521 23522 }, 23523 drag: function (event, ui, inst) { 23524 23525 var ts, bs, ls, rs, l, r, t, b, i, first, 23526 o = inst.options, 23527 d = o.snapTolerance, 23528 x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width, 23529 y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height; 23530 23531 for (i = inst.snapElements.length - 1; i >= 0; i--) { 23532 23533 l = inst.snapElements[i].left - inst.margins.left; 23534 r = l + inst.snapElements[i].width; 23535 t = inst.snapElements[i].top - inst.margins.top; 23536 b = t + inst.snapElements[i].height; 23537 23538 if (x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d || 23539 !$.contains(inst.snapElements[i].item.ownerDocument, 23540 inst.snapElements[i].item)) { 23541 if (inst.snapElements[i].snapping) { 23542 if (inst.options.snap.release) { 23543 inst.options.snap.release.call( 23544 inst.element, 23545 event, 23546 $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item }) 23547 ); 23548 } 23549 } 23550 inst.snapElements[i].snapping = false; 23551 continue; 23552 } 23553 23554 if (o.snapMode !== "inner") { 23555 ts = Math.abs(t - y2) <= d; 23556 bs = Math.abs(b - y1) <= d; 23557 ls = Math.abs(l - x2) <= d; 23558 rs = Math.abs(r - x1) <= d; 23559 if (ts) { 23560 ui.position.top = inst._convertPositionTo("relative", { 23561 top: t - inst.helperProportions.height, 23562 left: 0 23563 }).top; 23564 } 23565 if (bs) { 23566 ui.position.top = inst._convertPositionTo("relative", { 23567 top: b, 23568 left: 0 23569 }).top; 23570 } 23571 if (ls) { 23572 ui.position.left = inst._convertPositionTo("relative", { 23573 top: 0, 23574 left: l - inst.helperProportions.width 23575 }).left; 23576 } 23577 if (rs) { 23578 ui.position.left = inst._convertPositionTo("relative", { 23579 top: 0, 23580 left: r 23581 }).left; 23582 } 23583 } 23584 23585 first = (ts || bs || ls || rs); 23586 23587 if (o.snapMode !== "outer") { 23588 ts = Math.abs(t - y1) <= d; 23589 bs = Math.abs(b - y2) <= d; 23590 ls = Math.abs(l - x1) <= d; 23591 rs = Math.abs(r - x2) <= d; 23592 if (ts) { 23593 ui.position.top = inst._convertPositionTo("relative", { 23594 top: t, 23595 left: 0 23596 }).top; 23597 } 23598 if (bs) { 23599 ui.position.top = inst._convertPositionTo("relative", { 23600 top: b - inst.helperProportions.height, 23601 left: 0 23602 }).top; 23603 } 23604 if (ls) { 23605 ui.position.left = inst._convertPositionTo("relative", { 23606 top: 0, 23607 left: l 23608 }).left; 23609 } 23610 if (rs) { 23611 ui.position.left = inst._convertPositionTo("relative", { 23612 top: 0, 23613 left: r - inst.helperProportions.width 23614 }).left; 23615 } 23616 } 23617 23618 if (!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) { 23619 if (inst.options.snap.snap) { 23620 inst.options.snap.snap.call( 23621 inst.element, 23622 event, 23623 $.extend(inst._uiHash(), { 23624 snapItem: inst.snapElements[i].item 23625 })); 23626 } 23627 } 23628 inst.snapElements[i].snapping = (ts || bs || ls || rs || first); 23629 23630 } 23631 23632 } 23633 }); 23634 23635 $.ui.plugin.add("draggable", "stack", { 23636 start: function (event, ui, instance) { 23637 var min, 23638 o = instance.options, 23639 group = $.makeArray($(o.stack)).sort(function (a, b) { 23640 return (parseInt($(a).css("zIndex"), 10) || 0) - 23641 (parseInt($(b).css("zIndex"), 10) || 0); 23642 }); 23643 23644 if (!group.length) { 23645 return; 23646 } 23647 23648 min = parseInt($(group[0]).css("zIndex"), 10) || 0; 23649 $(group).each(function (i) { 23650 $(this).css("zIndex", min + i); 23651 }); 23652 this.css("zIndex", (min + group.length)); 23653 } 23654 }); 23655 23656 $.ui.plugin.add("draggable", "zIndex", { 23657 start: function (event, ui, instance) { 23658 var t = $(ui.helper), 23659 o = instance.options; 23660 23661 if (t.css("zIndex")) { 23662 o._zIndex = t.css("zIndex"); 23663 } 23664 t.css("zIndex", o.zIndex); 23665 }, 23666 stop: function (event, ui, instance) { 23667 var o = instance.options; 23668 23669 if (o._zIndex) { 23670 $(ui.helper).css("zIndex", o._zIndex); 23671 } 23672 } 23673 }); 23674 23675 var widgetsDraggable = $.ui.draggable; 23676 23677 23678 /*! 23679 * jQuery UI Resizable 1.13.2 23680 * http://jqueryui.com
vendor: 18,185 bytes, lines 23681-24393
23681 * 23682 * Copyright jQuery Foundation and other contributors 23683 * Released under the MIT license. 23684 * http://jquery.org/license 23685 */ 23686 23687 //>>label: Resizable 23688 //>>group: Interactions 23689 //>>description: Enables resize functionality for any element. 23690 //>>docs: http://api.jqueryui.com/resizable/ 23691 //>>demos: http://jqueryui.com/resizable/ 23692 //>>css.structure: ../../themes/base/core.css 23693 //>>css.structure: ../../themes/base/resizable.css 23694 //>>css.theme: ../../themes/base/theme.css 23695 23696 23697 $.widget("ui.resizable", $.ui.mouse, { 23698 version: "1.13.2", 23699 widgetEventPrefix: "resize", 23700 options: { 23701 alsoResize: false, 23702 animate: false, 23703 animateDuration: "slow", 23704 animateEasing: "swing", 23705 aspectRatio: false, 23706 autoHide: false, 23707 classes: { 23708 "ui-resizable-se": "ui-icon ui-icon-gripsmall-diagonal-se" 23709 }, 23710 containment: false, 23711 ghost: false, 23712 grid: false, 23713 handles: "e,s,se", 23714 helper: false, 23715 maxHeight: null, 23716 maxWidth: null, 23717 minHeight: 10, 23718 minWidth: 10, 23719 23720 // See #7960 23721 zIndex: 90, 23722 23723 // Callbacks 23724 resize: null, 23725 start: null, 23726 stop: null 23727 }, 23728 23729 _num: function (value) { 23730 return parseFloat(value) || 0; 23731 }, 23732 23733 _isNumber: function (value) { 23734 return !isNaN(parseFloat(value)); 23735 }, 23736 23737 _hasScroll: function (el, a) { 23738 23739 if ($(el).css("overflow") === "hidden") { 23740 return false; 23741 } 23742 23743 var scroll = (a && a === "left") ? "scrollLeft" : "scrollTop", 23744 has = false; 23745 23746 if (el[scroll] > 0) { 23747 return true; 23748 } 23749 23750 // TODO: determine which cases actually cause this to happen 23751 // if the element doesn't have the scroll set, see if it's possible to 23752 // set the scroll 23753 try { 23754 el[scroll] = 1; 23755 has = (el[scroll] > 0); 23756 el[scroll] = 0; 23757 } catch (e) { 23758 23759 // `el` might be a string, then setting `scroll` will throw 23760 // an error in strict mode; ignore it. 23761 } 23762 return has; 23763 }, 23764 23765 _create: function () { 23766 23767 var margins, 23768 o = this.options, 23769 that = this; 23770 this._addClass("ui-resizable"); 23771 23772 $.extend(this, { 23773 _aspectRatio: !!(o.aspectRatio), 23774 aspectRatio: o.aspectRatio, 23775 originalElement: this.element, 23776 _proportionallyResizeElements: [], 23777 _helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null 23778 }); 23779 23780 // Wrap the element if it cannot hold child nodes 23781 if (this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)) { 23782 23783 this.element.wrap( 23784 $("<div class='ui-wrapper'></div>").css({ 23785 overflow: "hidden", 23786 position: this.element.css("position"), 23787 width: this.element.outerWidth(), 23788 height: this.element.outerHeight(), 23789 top: this.element.css("top"), 23790 left: this.element.css("left") 23791 }) 23792 ); 23793 23794 this.element = this.element.parent().data( 23795 "ui-resizable", this.element.resizable("instance") 23796 ); 23797 23798 this.elementIsWrapper = true; 23799 23800 margins = { 23801 marginTop: this.originalElement.css("marginTop"), 23802 marginRight: this.originalElement.css("marginRight"), 23803 marginBottom: this.originalElement.css("marginBottom"), 23804 marginLeft: this.originalElement.css("marginLeft") 23805 }; 23806 23807 this.element.css(margins); 23808 this.originalElement.css("margin", 0); 23809 23810 // support: Safari 23811 // Prevent Safari textarea resize 23812 this.originalResizeStyle = this.originalElement.css("resize"); 23813 this.originalElement.css("resize", "none"); 23814 23815 this._proportionallyResizeElements.push(this.originalElement.css({ 23816 position: "static", 23817 zoom: 1, 23818 display: "block" 23819 })); 23820 23821 // Support: IE9 23822 // avoid IE jump (hard set the margin) 23823 this.originalElement.css(margins); 23824 23825 this._proportionallyResize(); 23826 } 23827 23828 this._setupHandles(); 23829 23830 if (o.autoHide) { 23831 $(this.element) 23832 .on("mouseenter", function () { 23833 if (o.disabled) { 23834 return; 23835 } 23836 that._removeClass("ui-resizable-autohide"); 23837 that._handles.show(); 23838 }) 23839 .on("mouseleave", function () { 23840 if (o.disabled) { 23841 return; 23842 } 23843 if (!that.resizing) { 23844 that._addClass("ui-resizable-autohide"); 23845 that._handles.hide(); 23846 } 23847 }); 23848 } 23849 23850 this._mouseInit(); 23851 }, 23852 23853 _destroy: function () { 23854 23855 this._mouseDestroy(); 23856 this._addedHandles.remove(); 23857 23858 var wrapper, 23859 _destroy = function (exp) { 23860 $(exp) 23861 .removeData("resizable") 23862 .removeData("ui-resizable") 23863 .off(".resizable"); 23864 }; 23865 23866 // TODO: Unwrap at same DOM position 23867 if (this.elementIsWrapper) { 23868 _destroy(this.element); 23869 wrapper = this.element; 23870 this.originalElement.css({ 23871 position: wrapper.css("position"), 23872 width: wrapper.outerWidth(), 23873 height: wrapper.outerHeight(), 23874 top: wrapper.css("top"), 23875 left: wrapper.css("left") 23876 }).insertAfter(wrapper); 23877 wrapper.remove(); 23878 } 23879 23880 this.originalElement.css("resize", this.originalResizeStyle); 23881 _destroy(this.originalElement); 23882 23883 return this; 23884 }, 23885 23886 _setOption: function (key, value) { 23887 this._super(key, value); 23888 23889 switch (key) { 23890 case "handles": 23891 this._removeHandles(); 23892 this._setupHandles(); 23893 break; 23894 case "aspectRatio": 23895 this._aspectRatio = !!value; 23896 break; 23897 default: 23898 break; 23899 } 23900 }, 23901 23902 _setupHandles: function () { 23903 var o = this.options, handle, i, n, hname, axis, that = this; 23904 this.handles = o.handles || 23905 (!$(".ui-resizable-handle", this.element).length ? 23906 "e,s,se" : { 23907 n: ".ui-resizable-n", 23908 e: ".ui-resizable-e", 23909 s: ".ui-resizable-s", 23910 w: ".ui-resizable-w", 23911 se: ".ui-resizable-se", 23912 sw: ".ui-resizable-sw", 23913 ne: ".ui-resizable-ne", 23914 nw: ".ui-resizable-nw" 23915 }); 23916 23917 this._handles = $(); 23918 this._addedHandles = $(); 23919 if (this.handles.constructor === String) { 23920 23921 if (this.handles === "all") { 23922 this.handles = "n,e,s,w,se,sw,ne,nw"; 23923 } 23924 23925 n = this.handles.split(","); 23926 this.handles = {}; 23927 23928 for (i = 0; i < n.length; i++) { 23929 23930 handle = String.prototype.trim.call(n[i]); 23931 hname = "ui-resizable-" + handle; 23932 axis = $("<div>"); 23933 this._addClass(axis, "ui-resizable-handle " + hname); 23934 23935 axis.css({ zIndex: o.zIndex }); 23936 23937 this.handles[handle] = ".ui-resizable-" + handle; 23938 if (!this.element.children(this.handles[handle]).length) { 23939 this.element.append(axis); 23940 this._addedHandles = this._addedHandles.add(axis); 23941 } 23942 } 23943 23944 } 23945 23946 this._renderAxis = function (target) { 23947 23948 var i, axis, padPos, padWrapper; 23949 23950 target = target || this.element; 23951 23952 for (i in this.handles) { 23953 23954 if (this.handles[i].constructor === String) { 23955 this.handles[i] = this.element.children(this.handles[i]).first().show(); 23956 } else if (this.handles[i].jquery || this.handles[i].nodeType) { 23957 this.handles[i] = $(this.handles[i]); 23958 this._on(this.handles[i], { "mousedown": that._mouseDown }); 23959 } 23960 23961 if (this.elementIsWrapper && 23962 this.originalElement[0] 23963 .nodeName 23964 .match(/^(textarea|input|select|button)$/i)) { 23965 axis = $(this.handles[i], this.element); 23966 23967 padWrapper = /sw|ne|nw|se|n|s/.test(i) ? 23968 axis.outerHeight() : 23969 axis.outerWidth(); 23970 23971 padPos = ["padding", 23972 /ne|nw|n/.test(i) ? "Top" : 23973 /se|sw|s/.test(i) ? "Bottom" : 23974 /^e$/.test(i) ? "Right" : "Left"].join(""); 23975 23976 target.css(padPos, padWrapper); 23977 23978 this._proportionallyResize(); 23979 } 23980 23981 this._handles = this._handles.add(this.handles[i]); 23982 } 23983 }; 23984 23985 // TODO: make renderAxis a prototype function 23986 this._renderAxis(this.element); 23987 23988 this._handles = this._handles.add(this.element.find(".ui-resizable-handle")); 23989 this._handles.disableSelection(); 23990 23991 this._handles.on("mouseover", function () { 23992 if (!that.resizing) { 23993 if (this.className) { 23994 axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i); 23995 } 23996 that.axis = axis && axis[1] ? axis[1] : "se"; 23997 } 23998 }); 23999 24000 if (o.autoHide) { 24001 this._handles.hide(); 24002 this._addClass("ui-resizable-autohide"); 24003 } 24004 }, 24005 24006 _removeHandles: function () { 24007 this._addedHandles.remove(); 24008 }, 24009 24010 _mouseCapture: function (event) { 24011 var i, handle, 24012 capture = false; 24013 24014 for (i in this.handles) { 24015 handle = $(this.handles[i])[0]; 24016 if (handle === event.target || $.contains(handle, event.target)) { 24017 capture = true; 24018 } 24019 } 24020 24021 return !this.options.disabled && capture; 24022 }, 24023 24024 _mouseStart: function (event) { 24025 24026 var curleft, curtop, cursor, 24027 o = this.options, 24028 el = this.element; 24029 24030 this.resizing = true; 24031 24032 this._renderProxy(); 24033 24034 curleft = this._num(this.helper.css("left")); 24035 curtop = this._num(this.helper.css("top")); 24036 24037 if (o.containment) { 24038 curleft += $(o.containment).scrollLeft() || 0; 24039 curtop += $(o.containment).scrollTop() || 0; 24040 } 24041 24042 this.offset = this.helper.offset(); 24043 this.position = { left: curleft, top: curtop }; 24044 24045 this.size = this._helper ? { 24046 width: this.helper.width(), 24047 height: this.helper.height() 24048 } : { 24049 width: el.width(), 24050 height: el.height() 24051 }; 24052 24053 this.originalSize = this._helper ? { 24054 width: el.outerWidth(), 24055 height: el.outerHeight() 24056 } : { 24057 width: el.width(), 24058 height: el.height() 24059 }; 24060 24061 this.sizeDiff = { 24062 width: el.outerWidth() - el.width(), 24063 height: el.outerHeight() - el.height() 24064 }; 24065 24066 this.originalPosition = { left: curleft, top: curtop }; 24067 this.originalMousePosition = { left: event.pageX, top: event.pageY }; 24068 24069 this.aspectRatio = (typeof o.aspectRatio === "number") ? 24070 o.aspectRatio : 24071 ((this.originalSize.width / this.originalSize.height) || 1); 24072 24073 cursor = $(".ui-resizable-" + this.axis).css("cursor"); 24074 $("body").css("cursor", cursor === "auto" ? this.axis + "-resize" : cursor); 24075 24076 this._addClass("ui-resizable-resizing"); 24077 this._propagate("start", event); 24078 return true; 24079 }, 24080 24081 _mouseDrag: function (event) { 24082 24083 var data, props, 24084 smp = this.originalMousePosition, 24085 a = this.axis, 24086 dx = (event.pageX - smp.left) || 0, 24087 dy = (event.pageY - smp.top) || 0, 24088 trigger = this._change[a]; 24089 24090 this._updatePrevProperties(); 24091 24092 if (!trigger) { 24093 return false; 24094 } 24095 24096 data = trigger.apply(this, [event, dx, dy]); 24097 24098 this._updateVirtualBoundaries(event.shiftKey); 24099 if (this._aspectRatio || event.shiftKey) { 24100 data = this._updateRatio(data, event); 24101 } 24102 24103 data = this._respectSize(data, event); 24104 24105 this._updateCache(data); 24106 24107 this._propagate("resize", event); 24108 24109 props = this._applyChanges(); 24110 24111 if (!this._helper && this._proportionallyResizeElements.length) { 24112 this._proportionallyResize(); 24113 } 24114 24115 if (!$.isEmptyObject(props)) { 24116 this._updatePrevProperties(); 24117 this._trigger("resize", event, this.ui()); 24118 this._applyChanges(); 24119 } 24120 24121 return false; 24122 }, 24123 24124 _mouseStop: function (event) { 24125 24126 this.resizing = false; 24127 var pr, ista, soffseth, soffsetw, s, left, top, 24128 o = this.options, that = this; 24129 24130 if (this._helper) { 24131 24132 pr = this._proportionallyResizeElements; 24133 ista = pr.length && (/textarea/i).test(pr[0].nodeName); 24134 soffseth = ista && this._hasScroll(pr[0], "left") ? 0 : that.sizeDiff.height; 24135 soffsetw = ista ? 0 : that.sizeDiff.width; 24136 24137 s = { 24138 width: (that.helper.width() - soffsetw), 24139 height: (that.helper.height() - soffseth) 24140 }; 24141 left = (parseFloat(that.element.css("left")) + 24142 (that.position.left - that.originalPosition.left)) || null; 24143 top = (parseFloat(that.element.css("top")) + 24144 (that.position.top - that.originalPosition.top)) || null; 24145 24146 if (!o.animate) { 24147 this.element.css($.extend(s, { top: top, left: left })); 24148 } 24149 24150 that.helper.height(that.size.height); 24151 that.helper.width(that.size.width); 24152 24153 if (this._helper && !o.animate) { 24154 this._proportionallyResize(); 24155 } 24156 } 24157 24158 $("body").css("cursor", "auto"); 24159 24160 this._removeClass("ui-resizable-resizing"); 24161 24162 this._propagate("stop", event); 24163 24164 if (this._helper) { 24165 this.helper.remove(); 24166 } 24167 24168 return false; 24169 24170 }, 24171 24172 _updatePrevProperties: function () { 24173 this.prevPosition = { 24174 top: this.position.top, 24175 left: this.position.left 24176 }; 24177 this.prevSize = { 24178 width: this.size.width, 24179 height: this.size.height 24180 }; 24181 }, 24182 24183 _applyChanges: function () { 24184 var props = {}; 24185 24186 if (this.position.top !== this.prevPosition.top) { 24187 props.top = this.position.top + "px"; 24188 } 24189 if (this.position.left !== this.prevPosition.left) { 24190 props.left = this.position.left + "px"; 24191 } 24192 if (this.size.width !== this.prevSize.width) { 24193 props.width = this.size.width + "px"; 24194 } 24195 if (this.size.height !== this.prevSize.height) { 24196 props.height = this.size.height + "px"; 24197 } 24198 24199 this.helper.css(props); 24200 24201 return props; 24202 }, 24203 24204 _updateVirtualBoundaries: function (forceAspectRatio) { 24205 var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b, 24206 o = this.options; 24207 24208 b = { 24209 minWidth: this._isNumber(o.minWidth) ? o.minWidth : 0, 24210 maxWidth: this._isNumber(o.maxWidth) ? o.maxWidth : Infinity, 24211 minHeight: this._isNumber(o.minHeight) ? o.minHeight : 0, 24212 maxHeight: this._isNumber(o.maxHeight) ? o.maxHeight : Infinity 24213 }; 24214 24215 if (this._aspectRatio || forceAspectRatio) { 24216 pMinWidth = b.minHeight * this.aspectRatio; 24217 pMinHeight = b.minWidth / this.aspectRatio; 24218 pMaxWidth = b.maxHeight * this.aspectRatio; 24219 pMaxHeight = b.maxWidth / this.aspectRatio; 24220 24221 if (pMinWidth > b.minWidth) { 24222 b.minWidth = pMinWidth; 24223 } 24224 if (pMinHeight > b.minHeight) { 24225 b.minHeight = pMinHeight; 24226 } 24227 if (pMaxWidth < b.maxWidth) { 24228 b.maxWidth = pMaxWidth; 24229 } 24230 if (pMaxHeight < b.maxHeight) { 24231 b.maxHeight = pMaxHeight; 24232 } 24233 } 24234 this._vBoundaries = b; 24235 }, 24236 24237 _updateCache: function (data) { 24238 this.offset = this.helper.offset(); 24239 if (this._isNumber(data.left)) { 24240 this.position.left = data.left; 24241 } 24242 if (this._isNumber(data.top)) { 24243 this.position.top = data.top; 24244 } 24245 if (this._isNumber(data.height)) { 24246 this.size.height = data.height; 24247 } 24248 if (this._isNumber(data.width)) { 24249 this.size.width = data.width; 24250 } 24251 }, 24252 24253 _updateRatio: function (data) { 24254 24255 var cpos = this.position, 24256 csize = this.size, 24257 a = this.axis; 24258 24259 if (this._isNumber(data.height)) { 24260 data.width = (data.height * this.aspectRatio); 24261 } else if (this._isNumber(data.width)) { 24262 data.height = (data.width / this.aspectRatio); 24263 } 24264 24265 if (a === "sw") { 24266 data.left = cpos.left + (csize.width - data.width); 24267 data.top = null; 24268 } 24269 if (a === "nw") { 24270 data.top = cpos.top + (csize.height - data.height); 24271 data.left = cpos.left + (csize.width - data.width); 24272 } 24273 24274 return data; 24275 }, 24276 24277 _respectSize: function (data) { 24278 24279 var o = this._vBoundaries, 24280 a = this.axis, 24281 ismaxw = this._isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), 24282 ismaxh = this._isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height), 24283 isminw = this._isNumber(data.width) && o.minWidth && (o.minWidth > data.width), 24284 isminh = this._isNumber(data.height) && o.minHeight && (o.minHeight > data.height), 24285 dw = this.originalPosition.left + this.originalSize.width, 24286 dh = this.originalPosition.top + this.originalSize.height, 24287 cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a); 24288 if (isminw) { 24289 data.width = o.minWidth; 24290 } 24291 if (isminh) { 24292 data.height = o.minHeight; 24293 } 24294 if (ismaxw) { 24295 data.width = o.maxWidth; 24296 } 24297 if (ismaxh) { 24298 data.height = o.maxHeight; 24299 } 24300 24301 if (isminw && cw) { 24302 data.left = dw - o.minWidth; 24303 } 24304 if (ismaxw && cw) { 24305 data.left = dw - o.maxWidth; 24306 } 24307 if (isminh && ch) { 24308 data.top = dh - o.minHeight; 24309 } 24310 if (ismaxh && ch) { 24311 data.top = dh - o.maxHeight; 24312 } 24313 24314 // Fixing jump error on top/left - bug #2330 24315 if (!data.width && !data.height && !data.left && data.top) { 24316 data.top = null; 24317 } else if (!data.width && !data.height && !data.top && data.left) { 24318 data.left = null; 24319 } 24320 24321 return data; 24322 }, 24323 24324 _getPaddingPlusBorderDimensions: function (element) { 24325 var i = 0, 24326 widths = [], 24327 borders = [ 24328 element.css("borderTopWidth"), 24329 element.css("borderRightWidth"), 24330 element.css("borderBottomWidth"), 24331 element.css("borderLeftWidth") 24332 ], 24333 paddings = [ 24334 element.css("paddingTop"), 24335 element.css("paddingRight"), 24336 element.css("paddingBottom"), 24337 element.css("paddingLeft") 24338 ]; 24339 24340 for (; i < 4; i++) { 24341 widths[i] = (parseFloat(borders[i]) || 0); 24342 widths[i] += (parseFloat(paddings[i]) || 0); 24343 } 24344 24345 return { 24346 height: widths[0] + widths[2], 24347 width: widths[1] + widths[3] 24348 }; 24349 }, 24350 24351 _proportionallyResize: function () { 24352 24353 if (!this._proportionallyResizeElements.length) { 24354 return; 24355 } 24356 24357 var prel, 24358 i = 0, 24359 element = this.helper || this.element; 24360 24361 for (; i < this._proportionallyResizeElements.length; i++) { 24362 24363 prel = this._proportionallyResizeElements[i]; 24364 24365 // TODO: Seems like a bug to cache this.outerDimensions 24366 // considering that we are in a loop. 24367 if (!this.outerDimensions) { 24368 this.outerDimensions = this._getPaddingPlusBorderDimensions(prel); 24369 } 24370 24371 prel.css({ 24372 height: (element.height() - this.outerDimensions.height) || 0, 24373 width: (element.width() - this.outerDimensions.width) || 0 24374 }); 24375 24376 } 24377 24378 }, 24379 24380 _renderProxy: function () { 24381 24382 var el = this.element, o = this.options; 24383 this.elementOffset = el.offset(); 24384 24385 if (this._helper) { 24386 24387 this.helper = this.helper || $("<div></div>").css({ overflow: "hidden" }); 24388 24389 this._addClass(this.helper, this._helper); 24390 this.helper.css({ 24391 width: this.element.outerWidth(), 24392 height: this.element.outerHeight(), 24393 position: "absolute",
vendor: 4,474 bytes, lines 24394-24559
24394 left: this.elementOffset.left + "px", 24395 top: this.elementOffset.top + "px", 24396 zIndex: ++o.zIndex //TODO: Don't modify option 24397 }); 24398 24399 this.helper 24400 .appendTo("body") 24401 .disableSelection(); 24402 24403 } else { 24404 this.helper = this.element; 24405 } 24406 24407 }, 24408 24409 _change: { 24410 e: function (event, dx) { 24411 return { width: this.originalSize.width + dx }; 24412 }, 24413 w: function (event, dx) { 24414 var cs = this.originalSize, sp = this.originalPosition; 24415 return { left: sp.left + dx, width: cs.width - dx }; 24416 }, 24417 n: function (event, dx, dy) { 24418 var cs = this.originalSize, sp = this.originalPosition; 24419 return { top: sp.top + dy, height: cs.height - dy }; 24420 }, 24421 s: function (event, dx, dy) { 24422 return { height: this.originalSize.height + dy }; 24423 }, 24424 se: function (event, dx, dy) { 24425 return $.extend(this._change.s.apply(this, arguments), 24426 this._change.e.apply(this, [event, dx, dy])); 24427 }, 24428 sw: function (event, dx, dy) { 24429 return $.extend(this._change.s.apply(this, arguments), 24430 this._change.w.apply(this, [event, dx, dy])); 24431 }, 24432 ne: function (event, dx, dy) { 24433 return $.extend(this._change.n.apply(this, arguments), 24434 this._change.e.apply(this, [event, dx, dy])); 24435 }, 24436 nw: function (event, dx, dy) { 24437 return $.extend(this._change.n.apply(this, arguments), 24438 this._change.w.apply(this, [event, dx, dy])); 24439 } 24440 }, 24441 24442 _propagate: function (n, event) { 24443 $.ui.plugin.call(this, n, [event, this.ui()]); 24444 if (n !== "resize") { 24445 this._trigger(n, event, this.ui()); 24446 } 24447 }, 24448 24449 plugins: {}, 24450 24451 ui: function () { 24452 return { 24453 originalElement: this.originalElement, 24454 element: this.element, 24455 helper: this.helper, 24456 position: this.position, 24457 size: this.size, 24458 originalSize: this.originalSize, 24459 originalPosition: this.originalPosition 24460 }; 24461 } 24462 24463 }); 24464 24465 /* 24466 * Resizable Extensions 24467 */ 24468 24469 $.ui.plugin.add("resizable", "animate", { 24470 24471 stop: function (event) { 24472 var that = $(this).resizable("instance"), 24473 o = that.options, 24474 pr = that._proportionallyResizeElements, 24475 ista = pr.length && (/textarea/i).test(pr[0].nodeName), 24476 soffseth = ista && that._hasScroll(pr[0], "left") ? 0 : that.sizeDiff.height, 24477 soffsetw = ista ? 0 : that.sizeDiff.width, 24478 style = { 24479 width: (that.size.width - soffsetw), 24480 height: (that.size.height - soffseth) 24481 }, 24482 left = (parseFloat(that.element.css("left")) + 24483 (that.position.left - that.originalPosition.left)) || null, 24484 top = (parseFloat(that.element.css("top")) + 24485 (that.position.top - that.originalPosition.top)) || null; 24486 24487 that.element.animate( 24488 $.extend(style, top && left ? { top: top, left: left } : {}), { 24489 duration: o.animateDuration, 24490 easing: o.animateEasing, 24491 step: function () { 24492 24493 var data = { 24494 width: parseFloat(that.element.css("width")), 24495 height: parseFloat(that.element.css("height")), 24496 top: parseFloat(that.element.css("top")), 24497 left: parseFloat(that.element.css("left")) 24498 }; 24499 24500 if (pr && pr.length) { 24501 $(pr[0]).css({ width: data.width, height: data.height }); 24502 } 24503 24504 // Propagating resize, and updating values for each animation step 24505 that._updateCache(data); 24506 that._propagate("resize", event); 24507 24508 } 24509 } 24510 ); 24511 } 24512 24513 }); 24514 24515 $.ui.plugin.add("resizable", "containment", { 24516 24517 start: function () { 24518 var element, p, co, ch, cw, width, height, 24519 that = $(this).resizable("instance"), 24520 o = that.options, 24521 el = that.element, 24522 oc = o.containment, 24523 ce = (oc instanceof $) ? 24524 oc.get(0) : 24525 (/parent/.test(oc)) ? el.parent().get(0) : oc; 24526 24527 if (!ce) { 24528 return; 24529 } 24530 24531 that.containerElement = $(ce); 24532 24533 if (/document/.test(oc) || oc === document) { 24534 that.containerOffset = { 24535 left: 0, 24536 top: 0 24537 }; 24538 that.containerPosition = { 24539 left: 0, 24540 top: 0 24541 }; 24542 24543 that.parentData = { 24544 element: $(document), 24545 left: 0, 24546 top: 0, 24547 width: $(document).width(), 24548 height: $(document).height() || document.body.parentNode.scrollHeight 24549 }; 24550 } else { 24551 element = $(ce); 24552 p = []; 24553 $(["Top", "Right", "Left", "Bottom"]).each(function (i, name) { 24554 p[i] = that._num(element.css("padding" + name)); 24555 }); 24556 24557 that.containerOffset = element.offset(); 24558 that.containerPosition = element.position(); 24559 that.containerSize = {
vendor: 4,908 bytes, lines 24560-24730
24560 height: (element.innerHeight() - p[3]), 24561 width: (element.innerWidth() - p[1]) 24562 }; 24563 24564 co = that.containerOffset; 24565 ch = that.containerSize.height; 24566 cw = that.containerSize.width; 24567 width = (that._hasScroll(ce, "left") ? ce.scrollWidth : cw); 24568 height = (that._hasScroll(ce) ? ce.scrollHeight : ch); 24569 24570 that.parentData = { 24571 element: ce, 24572 left: co.left, 24573 top: co.top, 24574 width: width, 24575 height: height 24576 }; 24577 } 24578 }, 24579 24580 resize: function (event) { 24581 var woset, hoset, isParent, isOffsetRelative, 24582 that = $(this).resizable("instance"), 24583 o = that.options, 24584 co = that.containerOffset, 24585 cp = that.position, 24586 pRatio = that._aspectRatio || event.shiftKey, 24587 cop = { 24588 top: 0, 24589 left: 0 24590 }, 24591 ce = that.containerElement, 24592 continueResize = true; 24593 24594 if (ce[0] !== document && (/static/).test(ce.css("position"))) { 24595 cop = co; 24596 } 24597 24598 if (cp.left < (that._helper ? co.left : 0)) { 24599 that.size.width = that.size.width + 24600 (that._helper ? 24601 (that.position.left - co.left) : 24602 (that.position.left - cop.left)); 24603 24604 if (pRatio) { 24605 that.size.height = that.size.width / that.aspectRatio; 24606 continueResize = false; 24607 } 24608 that.position.left = o.helper ? co.left : 0; 24609 } 24610 24611 if (cp.top < (that._helper ? co.top : 0)) { 24612 that.size.height = that.size.height + 24613 (that._helper ? 24614 (that.position.top - co.top) : 24615 that.position.top); 24616 24617 if (pRatio) { 24618 that.size.width = that.size.height * that.aspectRatio; 24619 continueResize = false; 24620 } 24621 that.position.top = that._helper ? co.top : 0; 24622 } 24623 24624 isParent = that.containerElement.get(0) === that.element.parent().get(0); 24625 isOffsetRelative = /relative|absolute/.test(that.containerElement.css("position")); 24626 24627 if (isParent && isOffsetRelative) { 24628 that.offset.left = that.parentData.left + that.position.left; 24629 that.offset.top = that.parentData.top + that.position.top; 24630 } else { 24631 that.offset.left = that.element.offset().left; 24632 that.offset.top = that.element.offset().top; 24633 } 24634 24635 woset = Math.abs(that.sizeDiff.width + 24636 (that._helper ? 24637 that.offset.left - cop.left : 24638 (that.offset.left - co.left))); 24639 24640 hoset = Math.abs(that.sizeDiff.height + 24641 (that._helper ? 24642 that.offset.top - cop.top : 24643 (that.offset.top - co.top))); 24644 24645 if (woset + that.size.width >= that.parentData.width) { 24646 that.size.width = that.parentData.width - woset; 24647 if (pRatio) { 24648 that.size.height = that.size.width / that.aspectRatio; 24649 continueResize = false; 24650 } 24651 } 24652 24653 if (hoset + that.size.height >= that.parentData.height) { 24654 that.size.height = that.parentData.height - hoset; 24655 if (pRatio) { 24656 that.size.width = that.size.height * that.aspectRatio; 24657 continueResize = false; 24658 } 24659 } 24660 24661 if (!continueResize) { 24662 that.position.left = that.prevPosition.left; 24663 that.position.top = that.prevPosition.top; 24664 that.size.width = that.prevSize.width; 24665 that.size.height = that.prevSize.height; 24666 } 24667 }, 24668 24669 stop: function () { 24670 var that = $(this).resizable("instance"), 24671 o = that.options, 24672 co = that.containerOffset, 24673 cop = that.containerPosition, 24674 ce = that.containerElement, 24675 helper = $(that.helper), 24676 ho = helper.offset(), 24677 w = helper.outerWidth() - that.sizeDiff.width, 24678 h = helper.outerHeight() - that.sizeDiff.height; 24679 24680 if (that._helper && !o.animate && (/relative/).test(ce.css("position"))) { 24681 $(this).css({ 24682 left: ho.left - cop.left - co.left, 24683 width: w, 24684 height: h 24685 }); 24686 } 24687 24688 if (that._helper && !o.animate && (/static/).test(ce.css("position"))) { 24689 $(this).css({ 24690 left: ho.left - cop.left - co.left, 24691 width: w, 24692 height: h 24693 }); 24694 } 24695 } 24696 }); 24697 24698 $.ui.plugin.add("resizable", "alsoResize", { 24699 24700 start: function () { 24701 var that = $(this).resizable("instance"), 24702 o = that.options; 24703 24704 $(o.alsoResize).each(function () { 24705 var el = $(this); 24706 el.data("ui-resizable-alsoresize", { 24707 width: parseFloat(el.width()), height: parseFloat(el.height()), 24708 left: parseFloat(el.css("left")), top: parseFloat(el.css("top")) 24709 }); 24710 }); 24711 }, 24712 24713 resize: function (event, ui) { 24714 var that = $(this).resizable("instance"), 24715 o = that.options, 24716 os = that.originalSize, 24717 op = that.originalPosition, 24718 delta = { 24719 height: (that.size.height - os.height) || 0, 24720 width: (that.size.width - os.width) || 0, 24721 top: (that.position.top - op.top) || 0, 24722 left: (that.position.left - op.left) || 0 24723 }; 24724 24725 $(o.alsoResize).each(function () { 24726 var el = $(this), start = $(this).data("ui-resizable-alsoresize"), style = {}, 24727 css = el.parents(ui.originalElement[0]).length ? 24728 ["width", "height"] : 24729 ["width", "height", "top", "left"]; 24730
vendor: 32,190 bytes, lines 24731-25982
24731 $.each(css, function (i, prop) { 24732 var sum = (start[prop] || 0) + (delta[prop] || 0); 24733 if (sum && sum >= 0) { 24734 style[prop] = sum || null; 24735 } 24736 }); 24737 24738 el.css(style); 24739 }); 24740 }, 24741 24742 stop: function () { 24743 $(this).removeData("ui-resizable-alsoresize"); 24744 } 24745 }); 24746 24747 $.ui.plugin.add("resizable", "ghost", { 24748 24749 start: function () { 24750 24751 var that = $(this).resizable("instance"), cs = that.size; 24752 24753 that.ghost = that.originalElement.clone(); 24754 that.ghost.css({ 24755 opacity: 0.25, 24756 display: "block", 24757 position: "relative", 24758 height: cs.height, 24759 width: cs.width, 24760 margin: 0, 24761 left: 0, 24762 top: 0 24763 }); 24764 24765 that._addClass(that.ghost, "ui-resizable-ghost"); 24766 24767 // DEPRECATED 24768 // TODO: remove after 1.12 24769 if ($.uiBackCompat !== false && typeof that.options.ghost === "string") { 24770 24771 // Ghost option 24772 that.ghost.addClass(this.options.ghost); 24773 } 24774 24775 that.ghost.appendTo(that.helper); 24776 24777 }, 24778 24779 resize: function () { 24780 var that = $(this).resizable("instance"); 24781 if (that.ghost) { 24782 that.ghost.css({ 24783 position: "relative", 24784 height: that.size.height, 24785 width: that.size.width 24786 }); 24787 } 24788 }, 24789 24790 stop: function () { 24791 var that = $(this).resizable("instance"); 24792 if (that.ghost && that.helper) { 24793 that.helper.get(0).removeChild(that.ghost.get(0)); 24794 } 24795 } 24796 24797 }); 24798 24799 $.ui.plugin.add("resizable", "grid", { 24800 24801 resize: function () { 24802 var outerDimensions, 24803 that = $(this).resizable("instance"), 24804 o = that.options, 24805 cs = that.size, 24806 os = that.originalSize, 24807 op = that.originalPosition, 24808 a = that.axis, 24809 grid = typeof o.grid === "number" ? [o.grid, o.grid] : o.grid, 24810 gridX = (grid[0] || 1), 24811 gridY = (grid[1] || 1), 24812 ox = Math.round((cs.width - os.width) / gridX) * gridX, 24813 oy = Math.round((cs.height - os.height) / gridY) * gridY, 24814 newWidth = os.width + ox, 24815 newHeight = os.height + oy, 24816 isMaxWidth = o.maxWidth && (o.maxWidth < newWidth), 24817 isMaxHeight = o.maxHeight && (o.maxHeight < newHeight), 24818 isMinWidth = o.minWidth && (o.minWidth > newWidth), 24819 isMinHeight = o.minHeight && (o.minHeight > newHeight); 24820 24821 o.grid = grid; 24822 24823 if (isMinWidth) { 24824 newWidth += gridX; 24825 } 24826 if (isMinHeight) { 24827 newHeight += gridY; 24828 } 24829 if (isMaxWidth) { 24830 newWidth -= gridX; 24831 } 24832 if (isMaxHeight) { 24833 newHeight -= gridY; 24834 } 24835 24836 if (/^(se|s|e)$/.test(a)) { 24837 that.size.width = newWidth; 24838 that.size.height = newHeight; 24839 } else if (/^(ne)$/.test(a)) { 24840 that.size.width = newWidth; 24841 that.size.height = newHeight; 24842 that.position.top = op.top - oy; 24843 } else if (/^(sw)$/.test(a)) { 24844 that.size.width = newWidth; 24845 that.size.height = newHeight; 24846 that.position.left = op.left - ox; 24847 } else { 24848 if (newHeight - gridY <= 0 || newWidth - gridX <= 0) { 24849 outerDimensions = that._getPaddingPlusBorderDimensions(this); 24850 } 24851 24852 if (newHeight - gridY > 0) { 24853 that.size.height = newHeight; 24854 that.position.top = op.top - oy; 24855 } else { 24856 newHeight = gridY - outerDimensions.height; 24857 that.size.height = newHeight; 24858 that.position.top = op.top + os.height - newHeight; 24859 } 24860 if (newWidth - gridX > 0) { 24861 that.size.width = newWidth; 24862 that.position.left = op.left - ox; 24863 } else { 24864 newWidth = gridX - outerDimensions.width; 24865 that.size.width = newWidth; 24866 that.position.left = op.left + os.width - newWidth; 24867 } 24868 } 24869 } 24870 24871 }); 24872 24873 var widgetsResizable = $.ui.resizable; 24874 24875 24876 /*! 24877 * jQuery UI Dialog 1.13.2 24878 * http://jqueryui.com 24879 * 24880 * Copyright jQuery Foundation and other contributors 24881 * Released under the MIT license. 24882 * http://jquery.org/license 24883 */ 24884 24885 //>>label: Dialog 24886 //>>group: Widgets 24887 //>>description: Displays customizable dialog windows. 24888 //>>docs: http://api.jqueryui.com/dialog/ 24889 //>>demos: http://jqueryui.com/dialog/ 24890 //>>css.structure: ../../themes/base/core.css 24891 //>>css.structure: ../../themes/base/dialog.css 24892 //>>css.theme: ../../themes/base/theme.css 24893 24894 24895 $.widget("ui.dialog", { 24896 version: "1.13.2", 24897 options: { 24898 appendTo: "body", 24899 autoOpen: true, 24900 buttons: [], 24901 classes: { 24902 "ui-dialog": "ui-corner-all", 24903 "ui-dialog-titlebar": "ui-corner-all" 24904 }, 24905 closeOnEscape: true, 24906 closeText: "Close", 24907 draggable: true, 24908 hide: null, 24909 height: "auto", 24910 maxHeight: null, 24911 maxWidth: null, 24912 minHeight: 150, 24913 minWidth: 150, 24914 modal: false, 24915 position: { 24916 my: "center", 24917 at: "center", 24918 of: window, 24919 collision: "fit", 24920 24921 // Ensure the titlebar is always visible 24922 using: function (pos) { 24923 var topOffset = $(this).css(pos).offset().top; 24924 if (topOffset < 0) { 24925 $(this).css("top", pos.top - topOffset); 24926 } 24927 } 24928 }, 24929 resizable: true, 24930 show: null, 24931 title: null, 24932 width: 300, 24933 24934 // Callbacks 24935 beforeClose: null, 24936 close: null, 24937 drag: null, 24938 dragStart: null, 24939 dragStop: null, 24940 focus: null, 24941 open: null, 24942 resize: null, 24943 resizeStart: null, 24944 resizeStop: null 24945 }, 24946 24947 sizeRelatedOptions: { 24948 buttons: true, 24949 height: true, 24950 maxHeight: true, 24951 maxWidth: true, 24952 minHeight: true, 24953 minWidth: true, 24954 width: true 24955 }, 24956 24957 resizableRelatedOptions: { 24958 maxHeight: true, 24959 maxWidth: true, 24960 minHeight: true, 24961 minWidth: true 24962 }, 24963 24964 _create: function () { 24965 this.originalCss = { 24966 display: this.element[0].style.display, 24967 width: this.element[0].style.width, 24968 minHeight: this.element[0].style.minHeight, 24969 maxHeight: this.element[0].style.maxHeight, 24970 height: this.element[0].style.height 24971 }; 24972 this.originalPosition = { 24973 parent: this.element.parent(), 24974 index: this.element.parent().children().index(this.element) 24975 }; 24976 this.originalTitle = this.element.attr("title"); 24977 if (this.options.title == null && this.originalTitle != null) { 24978 this.options.title = this.originalTitle; 24979 } 24980 24981 // Dialogs can't be disabled 24982 if (this.options.disabled) { 24983 this.options.disabled = false; 24984 } 24985 24986 this._createWrapper(); 24987 24988 this.element 24989 .show() 24990 .removeAttr("title") 24991 .appendTo(this.uiDialog); 24992 24993 this._addClass("ui-dialog-content", "ui-widget-content"); 24994 24995 this._createTitlebar(); 24996 this._createButtonPane(); 24997 24998 if (this.options.draggable && $.fn.draggable) { 24999 this._makeDraggable(); 25000 } 25001 if (this.options.resizable && $.fn.resizable) { 25002 this._makeResizable(); 25003 } 25004 25005 this._isOpen = false; 25006 25007 this._trackFocus(); 25008 }, 25009 25010 _init: function () { 25011 if (this.options.autoOpen) { 25012 this.open(); 25013 } 25014 }, 25015 25016 _appendTo: function () { 25017 var element = this.options.appendTo; 25018 if (element && (element.jquery || element.nodeType)) { 25019 return $(element); 25020 } 25021 return this.document.find(element || "body").eq(0); 25022 }, 25023 25024 _destroy: function () { 25025 var next, 25026 originalPosition = this.originalPosition; 25027 25028 this._untrackInstance(); 25029 this._destroyOverlay(); 25030 25031 this.element 25032 .removeUniqueId() 25033 .css(this.originalCss) 25034 25035 // Without detaching first, the following becomes really slow 25036 .detach(); 25037 25038 this.uiDialog.remove(); 25039 25040 if (this.originalTitle) { 25041 this.element.attr("title", this.originalTitle); 25042 } 25043 25044 next = originalPosition.parent.children().eq(originalPosition.index); 25045 25046 // Don't try to place the dialog next to itself (#8613) 25047 if (next.length && next[0] !== this.element[0]) { 25048 next.before(this.element); 25049 } else { 25050 originalPosition.parent.append(this.element); 25051 } 25052 }, 25053 25054 widget: function () { 25055 return this.uiDialog; 25056 }, 25057 25058 disable: $.noop, 25059 enable: $.noop, 25060 25061 close: function (event) { 25062 var that = this; 25063 25064 if (!this._isOpen || this._trigger("beforeClose", event) === false) { 25065 return; 25066 } 25067 25068 this._isOpen = false; 25069 this._focusedElement = null; 25070 this._destroyOverlay(); 25071 this._untrackInstance(); 25072 25073 if (!this.opener.filter(":focusable").trigger("focus").length) { 25074 25075 // Hiding a focused element doesn't trigger blur in WebKit 25076 // so in case we have nothing to focus on, explicitly blur the active element 25077 // https://bugs.webkit.org/show_bug.cgi?id=47182 25078 $.ui.safeBlur($.ui.safeActiveElement(this.document[0])); 25079 } 25080 25081 this._hide(this.uiDialog, this.options.hide, function () { 25082 that._trigger("close", event); 25083 }); 25084 }, 25085 25086 isOpen: function () { 25087 return this._isOpen; 25088 }, 25089 25090 moveToTop: function () { 25091 this._moveToTop(); 25092 }, 25093 25094 _moveToTop: function (event, silent) { 25095 var moved = false, 25096 zIndices = this.uiDialog.siblings(".ui-front:visible").map(function () { 25097 return +$(this).css("z-index"); 25098 }).get(), 25099 zIndexMax = Math.max.apply(null, zIndices); 25100 25101 if (zIndexMax >= +this.uiDialog.css("z-index")) { 25102 this.uiDialog.css("z-index", zIndexMax + 1); 25103 moved = true; 25104 } 25105 25106 if (moved && !silent) { 25107 this._trigger("focus", event); 25108 } 25109 return moved; 25110 }, 25111 25112 open: function () { 25113 var that = this; 25114 if (this._isOpen) { 25115 if (this._moveToTop()) { 25116 this._focusTabbable(); 25117 } 25118 return; 25119 } 25120 25121 this._isOpen = true; 25122 this.opener = $($.ui.safeActiveElement(this.document[0])); 25123 25124 this._size(); 25125 this._position(); 25126 this._createOverlay(); 25127 this._moveToTop(null, true); 25128 25129 // Ensure the overlay is moved to the top with the dialog, but only when 25130 // opening. The overlay shouldn't move after the dialog is open so that 25131 // modeless dialogs opened after the modal dialog stack properly. 25132 if (this.overlay) { 25133 this.overlay.css("z-index", this.uiDialog.css("z-index") - 1); 25134 } 25135 25136 this._show(this.uiDialog, this.options.show, function () { 25137 that._focusTabbable(); 25138 that._trigger("focus"); 25139 }); 25140 25141 // Track the dialog immediately upon opening in case a focus event 25142 // somehow occurs outside of the dialog before an element inside the 25143 // dialog is focused (#10152) 25144 this._makeFocusTarget(); 25145 25146 this._trigger("open"); 25147 }, 25148 25149 _focusTabbable: function () { 25150 25151 // Set focus to the first match: 25152 // 1. An element that was focused previously 25153 // 2. First element inside the dialog matching [autofocus] 25154 // 3. Tabbable element inside the content element 25155 // 4. Tabbable element inside the buttonpane 25156 // 5. The close button 25157 // 6. The dialog itself 25158 var hasFocus = this._focusedElement; 25159 if (!hasFocus) { 25160 hasFocus = this.element.find("[autofocus]"); 25161 } 25162 if (!hasFocus.length) { 25163 hasFocus = this.element.find(":tabbable"); 25164 } 25165 if (!hasFocus.length) { 25166 hasFocus = this.uiDialogButtonPane.find(":tabbable"); 25167 } 25168 if (!hasFocus.length) { 25169 hasFocus = this.uiDialogTitlebarClose.filter(":tabbable"); 25170 } 25171 if (!hasFocus.length) { 25172 hasFocus = this.uiDialog; 25173 } 25174 hasFocus.eq(0).trigger("focus"); 25175 }, 25176 25177 _restoreTabbableFocus: function () { 25178 var activeElement = $.ui.safeActiveElement(this.document[0]), 25179 isActive = this.uiDialog[0] === activeElement || 25180 $.contains(this.uiDialog[0], activeElement); 25181 if (!isActive) { 25182 this._focusTabbable(); 25183 } 25184 }, 25185 25186 _keepFocus: function (event) { 25187 event.preventDefault(); 25188 this._restoreTabbableFocus(); 25189 25190 // support: IE 25191 // IE <= 8 doesn't prevent moving focus even with event.preventDefault() 25192 // so we check again later 25193 this._delay(this._restoreTabbableFocus); 25194 }, 25195 25196 _createWrapper: function () { 25197 this.uiDialog = $("<div>") 25198 .hide() 25199 .attr({ 25200 25201 // Setting tabIndex makes the div focusable 25202 tabIndex: -1, 25203 role: "dialog" 25204 }) 25205 .appendTo(this._appendTo()); 25206 25207 this._addClass(this.uiDialog, "ui-dialog", "ui-widget ui-widget-content ui-front"); 25208 this._on(this.uiDialog, { 25209 keydown: function (event) { 25210 if (this.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode && 25211 event.keyCode === $.ui.keyCode.ESCAPE) { 25212 event.preventDefault(); 25213 this.close(event); 25214 return; 25215 } 25216 25217 // Prevent tabbing out of dialogs 25218 if (event.keyCode !== $.ui.keyCode.TAB || event.isDefaultPrevented()) { 25219 return; 25220 } 25221 var tabbables = this.uiDialog.find(":tabbable"), 25222 first = tabbables.first(), 25223 last = tabbables.last(); 25224 25225 if ((event.target === last[0] || event.target === this.uiDialog[0]) && 25226 !event.shiftKey) { 25227 this._delay(function () { 25228 first.trigger("focus"); 25229 }); 25230 event.preventDefault(); 25231 } else if ((event.target === first[0] || 25232 event.target === this.uiDialog[0]) && event.shiftKey) { 25233 this._delay(function () { 25234 last.trigger("focus"); 25235 }); 25236 event.preventDefault(); 25237 } 25238 }, 25239 mousedown: function (event) { 25240 if (this._moveToTop(event)) { 25241 this._focusTabbable(); 25242 } 25243 } 25244 }); 25245 25246 // We assume that any existing aria-describedby attribute means 25247 // that the dialog content is marked up properly 25248 // otherwise we brute force the content as the description 25249 if (!this.element.find("[aria-describedby]").length) { 25250 this.uiDialog.attr({ 25251 "aria-describedby": this.element.uniqueId().attr("id") 25252 }); 25253 } 25254 }, 25255 25256 _createTitlebar: function () { 25257 var uiDialogTitle; 25258 25259 this.uiDialogTitlebar = $("<div>"); 25260 this._addClass(this.uiDialogTitlebar, 25261 "ui-dialog-titlebar", "ui-widget-header ui-helper-clearfix"); 25262 this._on(this.uiDialogTitlebar, { 25263 mousedown: function (event) { 25264 25265 // Don't prevent click on close button (#8838) 25266 // Focusing a dialog that is partially scrolled out of view 25267 // causes the browser to scroll it into view, preventing the click event 25268 if (!$(event.target).closest(".ui-dialog-titlebar-close")) { 25269 25270 // Dialog isn't getting focus when dragging (#8063) 25271 this.uiDialog.trigger("focus"); 25272 } 25273 } 25274 }); 25275 25276 // Support: IE 25277 // Use type="button" to prevent enter keypresses in textboxes from closing the 25278 // dialog in IE (#9312) 25279 this.uiDialogTitlebarClose = $("<button type='button'></button>") 25280 .button({ 25281 label: $("<a>").text(this.options.closeText).html(), 25282 icon: "ui-icon-closethick", 25283 showLabel: false 25284 }) 25285 .appendTo(this.uiDialogTitlebar); 25286 25287 this._addClass(this.uiDialogTitlebarClose, "ui-dialog-titlebar-close"); 25288 this._on(this.uiDialogTitlebarClose, { 25289 click: function (event) { 25290 event.preventDefault(); 25291 this.close(event); 25292 } 25293 }); 25294 25295 uiDialogTitle = $("<span>").uniqueId().prependTo(this.uiDialogTitlebar); 25296 this._addClass(uiDialogTitle, "ui-dialog-title"); 25297 this._title(uiDialogTitle); 25298 25299 this.uiDialogTitlebar.prependTo(this.uiDialog); 25300 25301 this.uiDialog.attr({ 25302 "aria-labelledby": uiDialogTitle.attr("id") 25303 }); 25304 }, 25305 25306 _title: function (title) { 25307 if (this.options.title) { 25308 title.text(this.options.title); 25309 } else { 25310 title.html(" "); 25311 } 25312 }, 25313 25314 _createButtonPane: function () { 25315 this.uiDialogButtonPane = $("<div>"); 25316 this._addClass(this.uiDialogButtonPane, "ui-dialog-buttonpane", 25317 "ui-widget-content ui-helper-clearfix"); 25318 25319 this.uiButtonSet = $("<div>") 25320 .appendTo(this.uiDialogButtonPane); 25321 this._addClass(this.uiButtonSet, "ui-dialog-buttonset"); 25322 25323 this._createButtons(); 25324 }, 25325 25326 _createButtons: function () { 25327 var that = this, 25328 buttons = this.options.buttons; 25329 25330 // If we already have a button pane, remove it 25331 this.uiDialogButtonPane.remove(); 25332 this.uiButtonSet.empty(); 25333 25334 if ($.isEmptyObject(buttons) || (Array.isArray(buttons) && !buttons.length)) { 25335 this._removeClass(this.uiDialog, "ui-dialog-buttons"); 25336 return; 25337 } 25338 25339 $.each(buttons, function (name, props) { 25340 var click, buttonOptions; 25341 props = typeof props === "function" ? 25342 { click: props, text: name } : 25343 props; 25344 25345 // Default to a non-submitting button 25346 props = $.extend({ type: "button" }, props); 25347 25348 // Change the context for the click callback to be the main element 25349 click = props.click; 25350 buttonOptions = { 25351 icon: props.icon, 25352 iconPosition: props.iconPosition, 25353 showLabel: props.showLabel, 25354 25355 // Deprecated options 25356 icons: props.icons, 25357 text: props.text 25358 }; 25359 25360 delete props.click; 25361 delete props.icon; 25362 delete props.iconPosition; 25363 delete props.showLabel; 25364 25365 // Deprecated options 25366 delete props.icons; 25367 if (typeof props.text === "boolean") { 25368 delete props.text; 25369 } 25370 25371 $("<button></button>", props) 25372 .button(buttonOptions) 25373 .appendTo(that.uiButtonSet) 25374 .on("click", function () { 25375 click.apply(that.element[0], arguments); 25376 }); 25377 }); 25378 this._addClass(this.uiDialog, "ui-dialog-buttons"); 25379 this.uiDialogButtonPane.appendTo(this.uiDialog); 25380 }, 25381 25382 _makeDraggable: function () { 25383 var that = this, 25384 options = this.options; 25385 25386 function filteredUi(ui) { 25387 return { 25388 position: ui.position, 25389 offset: ui.offset 25390 }; 25391 } 25392 25393 this.uiDialog.draggable({ 25394 cancel: ".ui-dialog-content, .ui-dialog-titlebar-close", 25395 handle: ".ui-dialog-titlebar", 25396 containment: "document", 25397 start: function (event, ui) { 25398 that._addClass($(this), "ui-dialog-dragging"); 25399 that._blockFrames(); 25400 that._trigger("dragStart", event, filteredUi(ui)); 25401 }, 25402 drag: function (event, ui) { 25403 that._trigger("drag", event, filteredUi(ui)); 25404 }, 25405 stop: function (event, ui) { 25406 var left = ui.offset.left - that.document.scrollLeft(), 25407 top = ui.offset.top - that.document.scrollTop(); 25408 25409 options.position = { 25410 my: "left top", 25411 at: "left" + (left >= 0 ? "+" : "") + left + " " + 25412 "top" + (top >= 0 ? "+" : "") + top, 25413 of: that.window 25414 }; 25415 that._removeClass($(this), "ui-dialog-dragging"); 25416 that._unblockFrames(); 25417 that._trigger("dragStop", event, filteredUi(ui)); 25418 } 25419 }); 25420 }, 25421 25422 _makeResizable: function () { 25423 var that = this, 25424 options = this.options, 25425 handles = options.resizable, 25426 25427 // .ui-resizable has position: relative defined in the stylesheet 25428 // but dialogs have to use absolute or fixed positioning 25429 position = this.uiDialog.css("position"), 25430 resizeHandles = typeof handles === "string" ? 25431 handles : 25432 "n,e,s,w,se,sw,ne,nw"; 25433 25434 function filteredUi(ui) { 25435 return { 25436 originalPosition: ui.originalPosition, 25437 originalSize: ui.originalSize, 25438 position: ui.position, 25439 size: ui.size 25440 }; 25441 } 25442 25443 this.uiDialog.resizable({ 25444 cancel: ".ui-dialog-content", 25445 containment: "document", 25446 alsoResize: this.element, 25447 maxWidth: options.maxWidth, 25448 maxHeight: options.maxHeight, 25449 minWidth: options.minWidth, 25450 minHeight: this._minHeight(), 25451 handles: resizeHandles, 25452 start: function (event, ui) { 25453 that._addClass($(this), "ui-dialog-resizing"); 25454 that._blockFrames(); 25455 that._trigger("resizeStart", event, filteredUi(ui)); 25456 }, 25457 resize: function (event, ui) { 25458 that._trigger("resize", event, filteredUi(ui)); 25459 }, 25460 stop: function (event, ui) { 25461 var offset = that.uiDialog.offset(), 25462 left = offset.left - that.document.scrollLeft(), 25463 top = offset.top - that.document.scrollTop(); 25464 25465 options.height = that.uiDialog.height(); 25466 options.width = that.uiDialog.width(); 25467 options.position = { 25468 my: "left top", 25469 at: "left" + (left >= 0 ? "+" : "") + left + " " + 25470 "top" + (top >= 0 ? "+" : "") + top, 25471 of: that.window 25472 }; 25473 that._removeClass($(this), "ui-dialog-resizing"); 25474 that._unblockFrames(); 25475 that._trigger("resizeStop", event, filteredUi(ui)); 25476 } 25477 }) 25478 .css("position", position); 25479 }, 25480 25481 _trackFocus: function () { 25482 this._on(this.widget(), { 25483 focusin: function (event) { 25484 this._makeFocusTarget(); 25485 this._focusedElement = $(event.target); 25486 } 25487 }); 25488 }, 25489 25490 _makeFocusTarget: function () { 25491 this._untrackInstance(); 25492 this._trackingInstances().unshift(this); 25493 }, 25494 25495 _untrackInstance: function () { 25496 var instances = this._trackingInstances(), 25497 exists = $.inArray(this, instances); 25498 if (exists !== -1) { 25499 instances.splice(exists, 1); 25500 } 25501 }, 25502 25503 _trackingInstances: function () { 25504 var instances = this.document.data("ui-dialog-instances"); 25505 if (!instances) { 25506 instances = []; 25507 this.document.data("ui-dialog-instances", instances); 25508 } 25509 return instances; 25510 }, 25511 25512 _minHeight: function () { 25513 var options = this.options; 25514 25515 return options.height === "auto" ? 25516 options.minHeight : 25517 Math.min(options.minHeight, options.height); 25518 }, 25519 25520 _position: function () { 25521 25522 // Need to show the dialog to get the actual offset in the position plugin 25523 var isVisible = this.uiDialog.is(":visible"); 25524 if (!isVisible) { 25525 this.uiDialog.show(); 25526 } 25527 this.uiDialog.position(this.options.position); 25528 if (!isVisible) { 25529 this.uiDialog.hide(); 25530 } 25531 }, 25532 25533 _setOptions: function (options) { 25534 var that = this, 25535 resize = false, 25536 resizableOptions = {}; 25537 25538 $.each(options, function (key, value) { 25539 that._setOption(key, value); 25540 25541 if (key in that.sizeRelatedOptions) { 25542 resize = true; 25543 } 25544 if (key in that.resizableRelatedOptions) { 25545 resizableOptions[key] = value; 25546 } 25547 }); 25548 25549 if (resize) { 25550 this._size(); 25551 this._position(); 25552 } 25553 if (this.uiDialog.is(":data(ui-resizable)")) { 25554 this.uiDialog.resizable("option", resizableOptions); 25555 } 25556 }, 25557 25558 _setOption: function (key, value) { 25559 var isDraggable, isResizable, 25560 uiDialog = this.uiDialog; 25561 25562 if (key === "disabled") { 25563 return; 25564 } 25565 25566 this._super(key, value); 25567 25568 if (key === "appendTo") { 25569 this.uiDialog.appendTo(this._appendTo()); 25570 } 25571 25572 if (key === "buttons") { 25573 this._createButtons(); 25574 } 25575 25576 if (key === "closeText") { 25577 this.uiDialogTitlebarClose.button({ 25578 25579 // Ensure that we always pass a string 25580 label: $("<a>").text("" + this.options.closeText).html() 25581 }); 25582 } 25583 25584 if (key === "draggable") { 25585 isDraggable = uiDialog.is(":data(ui-draggable)"); 25586 if (isDraggable && !value) { 25587 uiDialog.draggable("destroy"); 25588 } 25589 25590 if (!isDraggable && value) { 25591 this._makeDraggable(); 25592 } 25593 } 25594 25595 if (key === "position") { 25596 this._position(); 25597 } 25598 25599 if (key === "resizable") { 25600 25601 // currently resizable, becoming non-resizable 25602 isResizable = uiDialog.is(":data(ui-resizable)"); 25603 if (isResizable && !value) { 25604 uiDialog.resizable("destroy"); 25605 } 25606 25607 // Currently resizable, changing handles 25608 if (isResizable && typeof value === "string") { 25609 uiDialog.resizable("option", "handles", value); 25610 } 25611 25612 // Currently non-resizable, becoming resizable 25613 if (!isResizable && value !== false) { 25614 this._makeResizable(); 25615 } 25616 } 25617 25618 if (key === "title") { 25619 this._title(this.uiDialogTitlebar.find(".ui-dialog-title")); 25620 } 25621 }, 25622 25623 _size: function () { 25624 25625 // If the user has resized the dialog, the .ui-dialog and .ui-dialog-content 25626 // divs will both have width and height set, so we need to reset them 25627 var nonContentHeight, minContentHeight, maxContentHeight, 25628 options = this.options; 25629 25630 // Reset content sizing 25631 this.element.show().css({ 25632 width: "auto", 25633 minHeight: 0, 25634 maxHeight: "none", 25635 height: 0 25636 }); 25637 25638 if (options.minWidth > options.width) { 25639 options.width = options.minWidth; 25640 } 25641 25642 // Reset wrapper sizing 25643 // determine the height of all the non-content elements 25644 nonContentHeight = this.uiDialog.css({ 25645 height: "auto", 25646 width: options.width 25647 }) 25648 .outerHeight(); 25649 minContentHeight = Math.max(0, options.minHeight - nonContentHeight); 25650 maxContentHeight = typeof options.maxHeight === "number" ? 25651 Math.max(0, options.maxHeight - nonContentHeight) : 25652 "none"; 25653 25654 if (options.height === "auto") { 25655 this.element.css({ 25656 minHeight: minContentHeight, 25657 maxHeight: maxContentHeight, 25658 height: "auto" 25659 }); 25660 } else { 25661 this.element.height(Math.max(0, options.height - nonContentHeight)); 25662 } 25663 25664 if (this.uiDialog.is(":data(ui-resizable)")) { 25665 this.uiDialog.resizable("option", "minHeight", this._minHeight()); 25666 } 25667 }, 25668 25669 _blockFrames: function () { 25670 this.iframeBlocks = this.document.find("iframe").map(function () { 25671 var iframe = $(this); 25672 25673 return $("<div>") 25674 .css({ 25675 position: "absolute", 25676 width: iframe.outerWidth(), 25677 height: iframe.outerHeight() 25678 }) 25679 .appendTo(iframe.parent()) 25680 .offset(iframe.offset())[0]; 25681 }); 25682 }, 25683 25684 _unblockFrames: function () { 25685 if (this.iframeBlocks) { 25686 this.iframeBlocks.remove(); 25687 delete this.iframeBlocks; 25688 } 25689 }, 25690 25691 _allowInteraction: function (event) { 25692 if ($(event.target).closest(".ui-dialog").length) { 25693 return true; 25694 } 25695 25696 // TODO: Remove hack when datepicker implements 25697 // the .ui-front logic (#8989) 25698 return !!$(event.target).closest(".ui-datepicker").length; 25699 }, 25700 25701 _createOverlay: function () { 25702 if (!this.options.modal) { 25703 return; 25704 } 25705 25706 var jqMinor = $.fn.jquery.substring(0, 4); 25707 25708 // We use a delay in case the overlay is created from an 25709 // event that we're going to be cancelling (#2804) 25710 var isOpening = true; 25711 this._delay(function () { 25712 isOpening = false; 25713 }); 25714 25715 if (!this.document.data("ui-dialog-overlays")) { 25716 25717 // Prevent use of anchors and inputs 25718 // This doesn't use `_on()` because it is a shared event handler 25719 // across all open modal dialogs. 25720 this.document.on("focusin.ui-dialog", function (event) { 25721 if (isOpening) { 25722 return; 25723 } 25724 25725 var instance = this._trackingInstances()[0]; 25726 if (!instance._allowInteraction(event)) { 25727 event.preventDefault(); 25728 instance._focusTabbable(); 25729 25730 // Support: jQuery >=3.4 <3.6 only 25731 // Focus re-triggering in jQuery 3.4/3.5 makes the original element 25732 // have its focus event propagated last, breaking the re-targeting. 25733 // Trigger focus in a delay in addition if needed to avoid the issue 25734 // See https://github.com/jquery/jquery/issues/4382 25735 if (jqMinor === "3.4." || jqMinor === "3.5.") { 25736 instance._delay(instance._restoreTabbableFocus); 25737 } 25738 } 25739 }.bind(this)); 25740 } 25741 25742 this.overlay = $("<div>") 25743 .appendTo(this._appendTo()); 25744 25745 this._addClass(this.overlay, null, "ui-widget-overlay ui-front"); 25746 this._on(this.overlay, { 25747 mousedown: "_keepFocus" 25748 }); 25749 this.document.data("ui-dialog-overlays", 25750 (this.document.data("ui-dialog-overlays") || 0) + 1); 25751 }, 25752 25753 _destroyOverlay: function () { 25754 if (!this.options.modal) { 25755 return; 25756 } 25757 25758 if (this.overlay) { 25759 var overlays = this.document.data("ui-dialog-overlays") - 1; 25760 25761 if (!overlays) { 25762 this.document.off("focusin.ui-dialog"); 25763 this.document.removeData("ui-dialog-overlays"); 25764 } else { 25765 this.document.data("ui-dialog-overlays", overlays); 25766 } 25767 25768 this.overlay.remove(); 25769 this.overlay = null; 25770 } 25771 } 25772 }); 25773 25774 // DEPRECATED 25775 // TODO: switch return back to widget declaration at top of file when this is removed 25776 if ($.uiBackCompat !== false) { 25777 25778 // Backcompat for dialogClass option 25779 $.widget("ui.dialog", $.ui.dialog, { 25780 options: { 25781 dialogClass: "" 25782 }, 25783 _createWrapper: function () { 25784 this._super(); 25785 this.uiDialog.addClass(this.options.dialogClass); 25786 }, 25787 _setOption: function (key, value) { 25788 if (key === "dialogClass") { 25789 this.uiDialog 25790 .removeClass(this.options.dialogClass) 25791 .addClass(value); 25792 } 25793 this._superApply(arguments); 25794 } 25795 }); 25796 } 25797 25798 var widgetsDialog = $.ui.dialog; 25799 25800 25801 /*! 25802 * jQuery UI Droppable 1.13.2 25803 * http://jqueryui.com 25804 * 25805 * Copyright jQuery Foundation and other contributors 25806 * Released under the MIT license. 25807 * http://jquery.org/license 25808 */ 25809 25810 //>>label: Droppable 25811 //>>group: Interactions 25812 //>>description: Enables drop targets for draggable elements. 25813 //>>docs: http://api.jqueryui.com/droppable/ 25814 //>>demos: http://jqueryui.com/droppable/ 25815 25816 25817 $.widget("ui.droppable", { 25818 version: "1.13.2", 25819 widgetEventPrefix: "drop", 25820 options: { 25821 accept: "*", 25822 addClasses: true, 25823 greedy: false, 25824 scope: "default", 25825 tolerance: "intersect", 25826 25827 // Callbacks 25828 activate: null, 25829 deactivate: null, 25830 drop: null, 25831 out: null, 25832 over: null 25833 }, 25834 _create: function () { 25835 25836 var proportions, 25837 o = this.options, 25838 accept = o.accept; 25839 25840 this.isover = false; 25841 this.isout = true; 25842 25843 this.accept = typeof accept === "function" ? accept : function (d) { 25844 return d.is(accept); 25845 }; 25846 25847 this.proportions = function ( /* valueToWrite */) { 25848 if (arguments.length) { 25849 25850 // Store the droppable's proportions 25851 proportions = arguments[0]; 25852 } else { 25853 25854 // Retrieve or derive the droppable's proportions 25855 return proportions ? 25856 proportions : 25857 proportions = { 25858 width: this.element[0].offsetWidth, 25859 height: this.element[0].offsetHeight 25860 }; 25861 } 25862 }; 25863 25864 this._addToManager(o.scope); 25865 25866 if (o.addClasses) { 25867 this._addClass("ui-droppable"); 25868 } 25869 25870 }, 25871 25872 _addToManager: function (scope) { 25873 25874 // Add the reference and positions to the manager 25875 $.ui.ddmanager.droppables[scope] = $.ui.ddmanager.droppables[scope] || []; 25876 $.ui.ddmanager.droppables[scope].push(this); 25877 }, 25878 25879 _splice: function (drop) { 25880 var i = 0; 25881 for (; i < drop.length; i++) { 25882 if (drop[i] === this) { 25883 drop.splice(i, 1); 25884 } 25885 } 25886 }, 25887 25888 _destroy: function () { 25889 var drop = $.ui.ddmanager.droppables[this.options.scope]; 25890 25891 this._splice(drop); 25892 }, 25893 25894 _setOption: function (key, value) { 25895 25896 if (key === "accept") { 25897 this.accept = typeof value === "function" ? value : function (d) { 25898 return d.is(value); 25899 }; 25900 } else if (key === "scope") { 25901 var drop = $.ui.ddmanager.droppables[this.options.scope]; 25902 25903 this._splice(drop); 25904 this._addToManager(value); 25905 } 25906 25907 this._super(key, value); 25908 }, 25909 25910 _activate: function (event) { 25911 var draggable = $.ui.ddmanager.current; 25912 25913 this._addActiveClass(); 25914 if (draggable) { 25915 this._trigger("activate", event, this.ui(draggable)); 25916 } 25917 }, 25918 25919 _deactivate: function (event) { 25920 var draggable = $.ui.ddmanager.current; 25921 25922 this._removeActiveClass(); 25923 if (draggable) { 25924 this._trigger("deactivate", event, this.ui(draggable)); 25925 } 25926 }, 25927 25928 _over: function (event) { 25929 25930 var draggable = $.ui.ddmanager.current; 25931 25932 // Bail if draggable and droppable are same element 25933 if (!draggable || (draggable.currentItem || 25934 draggable.element)[0] === this.element[0]) { 25935 return; 25936 } 25937 25938 if (this.accept.call(this.element[0], (draggable.currentItem || 25939 draggable.element))) { 25940 this._addHoverClass(); 25941 this._trigger("over", event, this.ui(draggable)); 25942 } 25943 25944 }, 25945 25946 _out: function (event) { 25947 25948 var draggable = $.ui.ddmanager.current; 25949 25950 // Bail if draggable and droppable are same element 25951 if (!draggable || (draggable.currentItem || 25952 draggable.element)[0] === this.element[0]) { 25953 return; 25954 } 25955 25956 if (this.accept.call(this.element[0], (draggable.currentItem || 25957 draggable.element))) { 25958 this._removeHoverClass(); 25959 this._trigger("out", event, this.ui(draggable)); 25960 } 25961 25962 }, 25963 25964 _drop: function (event, custom) { 25965 25966 var draggable = custom || $.ui.ddmanager.current, 25967 childrenIntersection = false; 25968 25969 // Bail if draggable and droppable are same element 25970 if (!draggable || (draggable.currentItem || 25971 draggable.element)[0] === this.element[0]) { 25972 return false; 25973 } 25974 25975 this.element 25976 .find(":data(ui-droppable)") 25977 .not(".ui-draggable-dragging") 25978 .each(function () { 25979 var inst = $(this).droppable("instance"); 25980 if ( 25981 inst.options.greedy && 25982 !inst.options.disabled &&
vendor: 4,590 bytes, lines 25983-26143
25983 inst.options.scope === draggable.options.scope && 25984 inst.accept.call( 25985 inst.element[0], (draggable.currentItem || draggable.element) 25986 ) && 25987 $.ui.intersect( 25988 draggable, 25989 $.extend(inst, { offset: inst.element.offset() }), 25990 inst.options.tolerance, event 25991 ) 25992 ) { 25993 childrenIntersection = true; 25994 return false; 25995 } 25996 }); 25997 if (childrenIntersection) { 25998 return false; 25999 } 26000 26001 if (this.accept.call(this.element[0], 26002 (draggable.currentItem || draggable.element))) { 26003 this._removeActiveClass(); 26004 this._removeHoverClass(); 26005 26006 this._trigger("drop", event, this.ui(draggable)); 26007 return this.element; 26008 } 26009 26010 return false; 26011 26012 }, 26013 26014 ui: function (c) { 26015 return { 26016 draggable: (c.currentItem || c.element), 26017 helper: c.helper, 26018 position: c.position, 26019 offset: c.positionAbs 26020 }; 26021 }, 26022 26023 // Extension points just to make backcompat sane and avoid duplicating logic 26024 // TODO: Remove in 1.14 along with call to it below 26025 _addHoverClass: function () { 26026 this._addClass("ui-droppable-hover"); 26027 }, 26028 26029 _removeHoverClass: function () { 26030 this._removeClass("ui-droppable-hover"); 26031 }, 26032 26033 _addActiveClass: function () { 26034 this._addClass("ui-droppable-active"); 26035 }, 26036 26037 _removeActiveClass: function () { 26038 this._removeClass("ui-droppable-active"); 26039 } 26040 }); 26041 26042 $.ui.intersect = (function () { 26043 function isOverAxis(x, reference, size) { 26044 return (x >= reference) && (x < (reference + size)); 26045 } 26046 26047 return function (draggable, droppable, toleranceMode, event) { 26048 26049 if (!droppable.offset) { 26050 return false; 26051 } 26052 26053 var x1 = (draggable.positionAbs || 26054 draggable.position.absolute).left + draggable.margins.left, 26055 y1 = (draggable.positionAbs || 26056 draggable.position.absolute).top + draggable.margins.top, 26057 x2 = x1 + draggable.helperProportions.width, 26058 y2 = y1 + draggable.helperProportions.height, 26059 l = droppable.offset.left, 26060 t = droppable.offset.top, 26061 r = l + droppable.proportions().width, 26062 b = t + droppable.proportions().height; 26063 26064 switch (toleranceMode) { 26065 case "fit": 26066 return (l <= x1 && x2 <= r && t <= y1 && y2 <= b); 26067 case "intersect": 26068 return (l < x1 + (draggable.helperProportions.width / 2) && // Right Half 26069 x2 - (draggable.helperProportions.width / 2) < r && // Left Half 26070 t < y1 + (draggable.helperProportions.height / 2) && // Bottom Half 26071 y2 - (draggable.helperProportions.height / 2) < b); // Top Half 26072 case "pointer": 26073 return isOverAxis(event.pageY, t, droppable.proportions().height) && 26074 isOverAxis(event.pageX, l, droppable.proportions().width); 26075 case "touch": 26076 return ( 26077 (y1 >= t && y1 <= b) || // Top edge touching 26078 (y2 >= t && y2 <= b) || // Bottom edge touching 26079 (y1 < t && y2 > b) // Surrounded vertically 26080 ) && ( 26081 (x1 >= l && x1 <= r) || // Left edge touching 26082 (x2 >= l && x2 <= r) || // Right edge touching 26083 (x1 < l && x2 > r) // Surrounded horizontally 26084 ); 26085 default: 26086 return false; 26087 } 26088 }; 26089 })(); 26090 26091 /* 26092 This manager tracks offsets of draggables and droppables 26093 */ 26094 $.ui.ddmanager = { 26095 current: null, 26096 droppables: { "default": [] }, 26097 prepareOffsets: function (t, event) { 26098 26099 var i, j, 26100 m = $.ui.ddmanager.droppables[t.options.scope] || [], 26101 type = event ? event.type : null, // workaround for #2317 26102 list = (t.currentItem || t.element).find(":data(ui-droppable)").addBack(); 26103 26104 droppablesLoop: for (i = 0; i < m.length; i++) { 26105 26106 // No disabled and non-accepted 26107 if (m[i].options.disabled || (t && !m[i].accept.call(m[i].element[0], 26108 (t.currentItem || t.element)))) { 26109 continue; 26110 } 26111 26112 // Filter out elements in the current dragged item 26113 for (j = 0; j < list.length; j++) { 26114 if (list[j] === m[i].element[0]) { 26115 m[i].proportions().height = 0; 26116 continue droppablesLoop; 26117 } 26118 } 26119 26120 m[i].visible = m[i].element.css("display") !== "none"; 26121 if (!m[i].visible) { 26122 continue; 26123 } 26124 26125 // Activate the droppable if used directly from draggables 26126 if (type === "mousedown") { 26127 m[i]._activate.call(m[i], event); 26128 } 26129 26130 m[i].offset = m[i].element.offset(); 26131 m[i].proportions({ 26132 width: m[i].element[0].offsetWidth, 26133 height: m[i].element[0].offsetHeight 26134 }); 26135 26136 } 26137 26138 }, 26139 drop: function (draggable, event) { 26140 26141 var dropped = false; 26142 26143 // Create a copy of the droppables in case the list changes during the drop (#9116)
vendor: 4,316 bytes, lines 26144-26286
26144 $.each(($.ui.ddmanager.droppables[draggable.options.scope] || []).slice(), function () { 26145 26146 if (!this.options) { 26147 return; 26148 } 26149 if (!this.options.disabled && this.visible && 26150 $.ui.intersect(draggable, this, this.options.tolerance, event)) { 26151 dropped = this._drop.call(this, event) || dropped; 26152 } 26153 26154 if (!this.options.disabled && this.visible && this.accept.call(this.element[0], 26155 (draggable.currentItem || draggable.element))) { 26156 this.isout = true; 26157 this.isover = false; 26158 this._deactivate.call(this, event); 26159 } 26160 26161 }); 26162 return dropped; 26163 26164 }, 26165 dragStart: function (draggable, event) { 26166 26167 // Listen for scrolling so that if the dragging causes scrolling the position of the 26168 // droppables can be recalculated (see #5003) 26169 draggable.element.parentsUntil("body").on("scroll.droppable", function () { 26170 if (!draggable.options.refreshPositions) { 26171 $.ui.ddmanager.prepareOffsets(draggable, event); 26172 } 26173 }); 26174 }, 26175 drag: function (draggable, event) { 26176 26177 // If you have a highly dynamic page, you might try this option. It renders positions 26178 // every time you move the mouse. 26179 if (draggable.options.refreshPositions) { 26180 $.ui.ddmanager.prepareOffsets(draggable, event); 26181 } 26182 26183 // Run through all droppables and check their positions based on specific tolerance options 26184 $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function () { 26185 26186 if (this.options.disabled || this.greedyChild || !this.visible) { 26187 return; 26188 } 26189 26190 var parentInstance, scope, parent, 26191 intersects = $.ui.intersect(draggable, this, this.options.tolerance, event), 26192 c = !intersects && this.isover ? 26193 "isout" : 26194 (intersects && !this.isover ? "isover" : null); 26195 if (!c) { 26196 return; 26197 } 26198 26199 if (this.options.greedy) { 26200 26201 // find droppable parents with same scope 26202 scope = this.options.scope; 26203 parent = this.element.parents(":data(ui-droppable)").filter(function () { 26204 return $(this).droppable("instance").options.scope === scope; 26205 }); 26206 26207 if (parent.length) { 26208 parentInstance = $(parent[0]).droppable("instance"); 26209 parentInstance.greedyChild = (c === "isover"); 26210 } 26211 } 26212 26213 // We just moved into a greedy child 26214 if (parentInstance && c === "isover") { 26215 parentInstance.isover = false; 26216 parentInstance.isout = true; 26217 parentInstance._out.call(parentInstance, event); 26218 } 26219 26220 this[c] = true; 26221 this[c === "isout" ? "isover" : "isout"] = false; 26222 this[c === "isover" ? "_over" : "_out"].call(this, event); 26223 26224 // We just moved out of a greedy child 26225 if (parentInstance && c === "isout") { 26226 parentInstance.isout = false; 26227 parentInstance.isover = true; 26228 parentInstance._over.call(parentInstance, event); 26229 } 26230 }); 26231 26232 }, 26233 dragStop: function (draggable, event) { 26234 draggable.element.parentsUntil("body").off("scroll.droppable"); 26235 26236 // Call prepareOffsets one final time since IE does not fire return scroll events when 26237 // overflow was caused by drag (see #5003) 26238 if (!draggable.options.refreshPositions) { 26239 $.ui.ddmanager.prepareOffsets(draggable, event); 26240 } 26241 } 26242 }; 26243 26244 // DEPRECATED 26245 // TODO: switch return back to widget declaration at top of file when this is removed 26246 if ($.uiBackCompat !== false) { 26247 26248 // Backcompat for activeClass and hoverClass options 26249 $.widget("ui.droppable", $.ui.droppable, { 26250 options: { 26251 hoverClass: false, 26252 activeClass: false 26253 }, 26254 _addActiveClass: function () { 26255 this._super(); 26256 if (this.options.activeClass) { 26257 this.element.addClass(this.options.activeClass); 26258 } 26259 }, 26260 _removeActiveClass: function () { 26261 this._super(); 26262 if (this.options.activeClass) { 26263 this.element.removeClass(this.options.activeClass); 26264 } 26265 }, 26266 _addHoverClass: function () { 26267 this._super(); 26268 if (this.options.hoverClass) { 26269 this.element.addClass(this.options.hoverClass); 26270 } 26271 }, 26272 _removeHoverClass: function () { 26273 this._super(); 26274 if (this.options.hoverClass) { 26275 this.element.removeClass(this.options.hoverClass); 26276 } 26277 } 26278 }); 26279 } 26280 26281 var widgetsDroppable = $.ui.droppable; 26282 26283 26284 /*! 26285 * jQuery UI Progressbar 1.13.2 26286 * http://jqueryui.com
vendor: 16,165 bytes, lines 26287-26890
26287 * 26288 * Copyright jQuery Foundation and other contributors 26289 * Released under the MIT license. 26290 * http://jquery.org/license 26291 */ 26292 26293 //>>label: Progressbar 26294 //>>group: Widgets 26295 /* eslint-disable max-len */ 26296 //>>description: Displays a status indicator for loading state, standard percentage, and other progress indicators. 26297 /* eslint-enable max-len */ 26298 //>>docs: http://api.jqueryui.com/progressbar/ 26299 //>>demos: http://jqueryui.com/progressbar/ 26300 //>>css.structure: ../../themes/base/core.css 26301 //>>css.structure: ../../themes/base/progressbar.css 26302 //>>css.theme: ../../themes/base/theme.css 26303 26304 26305 var widgetsProgressbar = $.widget("ui.progressbar", { 26306 version: "1.13.2", 26307 options: { 26308 classes: { 26309 "ui-progressbar": "ui-corner-all", 26310 "ui-progressbar-value": "ui-corner-left", 26311 "ui-progressbar-complete": "ui-corner-right" 26312 }, 26313 max: 100, 26314 value: 0, 26315 26316 change: null, 26317 complete: null 26318 }, 26319 26320 min: 0, 26321 26322 _create: function () { 26323 26324 // Constrain initial value 26325 this.oldValue = this.options.value = this._constrainedValue(); 26326 26327 this.element.attr({ 26328 26329 // Only set static values; aria-valuenow and aria-valuemax are 26330 // set inside _refreshValue() 26331 role: "progressbar", 26332 "aria-valuemin": this.min 26333 }); 26334 this._addClass("ui-progressbar", "ui-widget ui-widget-content"); 26335 26336 this.valueDiv = $("<div>").appendTo(this.element); 26337 this._addClass(this.valueDiv, "ui-progressbar-value", "ui-widget-header"); 26338 this._refreshValue(); 26339 }, 26340 26341 _destroy: function () { 26342 this.element.removeAttr("role aria-valuemin aria-valuemax aria-valuenow"); 26343 26344 this.valueDiv.remove(); 26345 }, 26346 26347 value: function (newValue) { 26348 if (newValue === undefined) { 26349 return this.options.value; 26350 } 26351 26352 this.options.value = this._constrainedValue(newValue); 26353 this._refreshValue(); 26354 }, 26355 26356 _constrainedValue: function (newValue) { 26357 if (newValue === undefined) { 26358 newValue = this.options.value; 26359 } 26360 26361 this.indeterminate = newValue === false; 26362 26363 // Sanitize value 26364 if (typeof newValue !== "number") { 26365 newValue = 0; 26366 } 26367 26368 return this.indeterminate ? false : 26369 Math.min(this.options.max, Math.max(this.min, newValue)); 26370 }, 26371 26372 _setOptions: function (options) { 26373 26374 // Ensure "value" option is set after other values (like max) 26375 var value = options.value; 26376 delete options.value; 26377 26378 this._super(options); 26379 26380 this.options.value = this._constrainedValue(value); 26381 this._refreshValue(); 26382 }, 26383 26384 _setOption: function (key, value) { 26385 if (key === "max") { 26386 26387 // Don't allow a max less than min 26388 value = Math.max(this.min, value); 26389 } 26390 this._super(key, value); 26391 }, 26392 26393 _setOptionDisabled: function (value) { 26394 this._super(value); 26395 26396 this.element.attr("aria-disabled", value); 26397 this._toggleClass(null, "ui-state-disabled", !!value); 26398 }, 26399 26400 _percentage: function () { 26401 return this.indeterminate ? 26402 100 : 26403 100 * (this.options.value - this.min) / (this.options.max - this.min); 26404 }, 26405 26406 _refreshValue: function () { 26407 var value = this.options.value, 26408 percentage = this._percentage(); 26409 26410 this.valueDiv 26411 .toggle(this.indeterminate || value > this.min) 26412 .width(percentage.toFixed(0) + "%"); 26413 26414 this 26415 ._toggleClass(this.valueDiv, "ui-progressbar-complete", null, 26416 value === this.options.max) 26417 ._toggleClass("ui-progressbar-indeterminate", null, this.indeterminate); 26418 26419 if (this.indeterminate) { 26420 this.element.removeAttr("aria-valuenow"); 26421 if (!this.overlayDiv) { 26422 this.overlayDiv = $("<div>").appendTo(this.valueDiv); 26423 this._addClass(this.overlayDiv, "ui-progressbar-overlay"); 26424 } 26425 } else { 26426 this.element.attr({ 26427 "aria-valuemax": this.options.max, 26428 "aria-valuenow": value 26429 }); 26430 if (this.overlayDiv) { 26431 this.overlayDiv.remove(); 26432 this.overlayDiv = null; 26433 } 26434 } 26435 26436 if (this.oldValue !== value) { 26437 this.oldValue = value; 26438 this._trigger("change"); 26439 } 26440 if (value === this.options.max) { 26441 this._trigger("complete"); 26442 } 26443 } 26444 }); 26445 26446 26447 /*! 26448 * jQuery UI Selectable 1.13.2 26449 * http://jqueryui.com 26450 * 26451 * Copyright jQuery Foundation and other contributors 26452 * Released under the MIT license. 26453 * http://jquery.org/license 26454 */ 26455 26456 //>>label: Selectable 26457 //>>group: Interactions 26458 //>>description: Allows groups of elements to be selected with the mouse. 26459 //>>docs: http://api.jqueryui.com/selectable/ 26460 //>>demos: http://jqueryui.com/selectable/ 26461 //>>css.structure: ../../themes/base/selectable.css 26462 26463 26464 var widgetsSelectable = $.widget("ui.selectable", $.ui.mouse, { 26465 version: "1.13.2", 26466 options: { 26467 appendTo: "body", 26468 autoRefresh: true, 26469 distance: 0, 26470 filter: "*", 26471 tolerance: "touch", 26472 26473 // Callbacks 26474 selected: null, 26475 selecting: null, 26476 start: null, 26477 stop: null, 26478 unselected: null, 26479 unselecting: null 26480 }, 26481 _create: function () { 26482 var that = this; 26483 26484 this._addClass("ui-selectable"); 26485 26486 this.dragged = false; 26487 26488 // Cache selectee children based on filter 26489 this.refresh = function () { 26490 that.elementPos = $(that.element[0]).offset(); 26491 that.selectees = $(that.options.filter, that.element[0]); 26492 that._addClass(that.selectees, "ui-selectee"); 26493 that.selectees.each(function () { 26494 var $this = $(this), 26495 selecteeOffset = $this.offset(), 26496 pos = { 26497 left: selecteeOffset.left - that.elementPos.left, 26498 top: selecteeOffset.top - that.elementPos.top 26499 }; 26500 $.data(this, "selectable-item", { 26501 element: this, 26502 $element: $this, 26503 left: pos.left, 26504 top: pos.top, 26505 right: pos.left + $this.outerWidth(), 26506 bottom: pos.top + $this.outerHeight(), 26507 startselected: false, 26508 selected: $this.hasClass("ui-selected"), 26509 selecting: $this.hasClass("ui-selecting"), 26510 unselecting: $this.hasClass("ui-unselecting") 26511 }); 26512 }); 26513 }; 26514 this.refresh(); 26515 26516 this._mouseInit(); 26517 26518 this.helper = $("<div>"); 26519 this._addClass(this.helper, "ui-selectable-helper"); 26520 }, 26521 26522 _destroy: function () { 26523 this.selectees.removeData("selectable-item"); 26524 this._mouseDestroy(); 26525 }, 26526 26527 _mouseStart: function (event) { 26528 var that = this, 26529 options = this.options; 26530 26531 this.opos = [event.pageX, event.pageY]; 26532 this.elementPos = $(this.element[0]).offset(); 26533 26534 if (this.options.disabled) { 26535 return; 26536 } 26537 26538 this.selectees = $(options.filter, this.element[0]); 26539 26540 this._trigger("start", event); 26541 26542 $(options.appendTo).append(this.helper); 26543 26544 // position helper (lasso) 26545 this.helper.css({ 26546 "left": event.pageX, 26547 "top": event.pageY, 26548 "width": 0, 26549 "height": 0 26550 }); 26551 26552 if (options.autoRefresh) { 26553 this.refresh(); 26554 } 26555 26556 this.selectees.filter(".ui-selected").each(function () { 26557 var selectee = $.data(this, "selectable-item"); 26558 selectee.startselected = true; 26559 if (!event.metaKey && !event.ctrlKey) { 26560 that._removeClass(selectee.$element, "ui-selected"); 26561 selectee.selected = false; 26562 that._addClass(selectee.$element, "ui-unselecting"); 26563 selectee.unselecting = true; 26564 26565 // selectable UNSELECTING callback 26566 that._trigger("unselecting", event, { 26567 unselecting: selectee.element 26568 }); 26569 } 26570 }); 26571 26572 $(event.target).parents().addBack().each(function () { 26573 var doSelect, 26574 selectee = $.data(this, "selectable-item"); 26575 if (selectee) { 26576 doSelect = (!event.metaKey && !event.ctrlKey) || 26577 !selectee.$element.hasClass("ui-selected"); 26578 that._removeClass(selectee.$element, doSelect ? "ui-unselecting" : "ui-selected") 26579 ._addClass(selectee.$element, doSelect ? "ui-selecting" : "ui-unselecting"); 26580 selectee.unselecting = !doSelect; 26581 selectee.selecting = doSelect; 26582 selectee.selected = doSelect; 26583 26584 // selectable (UN)SELECTING callback 26585 if (doSelect) { 26586 that._trigger("selecting", event, { 26587 selecting: selectee.element 26588 }); 26589 } else { 26590 that._trigger("unselecting", event, { 26591 unselecting: selectee.element 26592 }); 26593 } 26594 return false; 26595 } 26596 }); 26597 26598 }, 26599 26600 _mouseDrag: function (event) { 26601 26602 this.dragged = true; 26603 26604 if (this.options.disabled) { 26605 return; 26606 } 26607 26608 var tmp, 26609 that = this, 26610 options = this.options, 26611 x1 = this.opos[0], 26612 y1 = this.opos[1], 26613 x2 = event.pageX, 26614 y2 = event.pageY; 26615 26616 if (x1 > x2) { 26617 tmp = x2; x2 = x1; x1 = tmp; 26618 } 26619 if (y1 > y2) { 26620 tmp = y2; y2 = y1; y1 = tmp; 26621 } 26622 this.helper.css({ left: x1, top: y1, width: x2 - x1, height: y2 - y1 }); 26623 26624 this.selectees.each(function () { 26625 var selectee = $.data(this, "selectable-item"), 26626 hit = false, 26627 offset = {}; 26628 26629 //prevent helper from being selected if appendTo: selectable 26630 if (!selectee || selectee.element === that.element[0]) { 26631 return; 26632 } 26633 26634 offset.left = selectee.left + that.elementPos.left; 26635 offset.right = selectee.right + that.elementPos.left; 26636 offset.top = selectee.top + that.elementPos.top; 26637 offset.bottom = selectee.bottom + that.elementPos.top; 26638 26639 if (options.tolerance === "touch") { 26640 hit = (!(offset.left > x2 || offset.right < x1 || offset.top > y2 || 26641 offset.bottom < y1)); 26642 } else if (options.tolerance === "fit") { 26643 hit = (offset.left > x1 && offset.right < x2 && offset.top > y1 && 26644 offset.bottom < y2); 26645 } 26646 26647 if (hit) { 26648 26649 // SELECT 26650 if (selectee.selected) { 26651 that._removeClass(selectee.$element, "ui-selected"); 26652 selectee.selected = false; 26653 } 26654 if (selectee.unselecting) { 26655 that._removeClass(selectee.$element, "ui-unselecting"); 26656 selectee.unselecting = false; 26657 } 26658 if (!selectee.selecting) { 26659 that._addClass(selectee.$element, "ui-selecting"); 26660 selectee.selecting = true; 26661 26662 // selectable SELECTING callback 26663 that._trigger("selecting", event, { 26664 selecting: selectee.element 26665 }); 26666 } 26667 } else { 26668 26669 // UNSELECT 26670 if (selectee.selecting) { 26671 if ((event.metaKey || event.ctrlKey) && selectee.startselected) { 26672 that._removeClass(selectee.$element, "ui-selecting"); 26673 selectee.selecting = false; 26674 that._addClass(selectee.$element, "ui-selected"); 26675 selectee.selected = true; 26676 } else { 26677 that._removeClass(selectee.$element, "ui-selecting"); 26678 selectee.selecting = false; 26679 if (selectee.startselected) { 26680 that._addClass(selectee.$element, "ui-unselecting"); 26681 selectee.unselecting = true; 26682 } 26683 26684 // selectable UNSELECTING callback 26685 that._trigger("unselecting", event, { 26686 unselecting: selectee.element 26687 }); 26688 } 26689 } 26690 if (selectee.selected) { 26691 if (!event.metaKey && !event.ctrlKey && !selectee.startselected) { 26692 that._removeClass(selectee.$element, "ui-selected"); 26693 selectee.selected = false; 26694 26695 that._addClass(selectee.$element, "ui-unselecting"); 26696 selectee.unselecting = true; 26697 26698 // selectable UNSELECTING callback 26699 that._trigger("unselecting", event, { 26700 unselecting: selectee.element 26701 }); 26702 } 26703 } 26704 } 26705 }); 26706 26707 return false; 26708 }, 26709 26710 _mouseStop: function (event) { 26711 var that = this; 26712 26713 this.dragged = false; 26714 26715 $(".ui-unselecting", this.element[0]).each(function () { 26716 var selectee = $.data(this, "selectable-item"); 26717 that._removeClass(selectee.$element, "ui-unselecting"); 26718 selectee.unselecting = false; 26719 selectee.startselected = false; 26720 that._trigger("unselected", event, { 26721 unselected: selectee.element 26722 }); 26723 }); 26724 $(".ui-selecting", this.element[0]).each(function () { 26725 var selectee = $.data(this, "selectable-item"); 26726 that._removeClass(selectee.$element, "ui-selecting") 26727 ._addClass(selectee.$element, "ui-selected"); 26728 selectee.selecting = false; 26729 selectee.selected = true; 26730 selectee.startselected = true; 26731 that._trigger("selected", event, { 26732 selected: selectee.element 26733 }); 26734 }); 26735 this._trigger("stop", event); 26736 26737 this.helper.remove(); 26738 26739 return false; 26740 } 26741 26742 }); 26743 26744 26745 /*! 26746 * jQuery UI Selectmenu 1.13.2 26747 * http://jqueryui.com 26748 * 26749 * Copyright jQuery Foundation and other contributors 26750 * Released under the MIT license. 26751 * http://jquery.org/license 26752 */ 26753 26754 //>>label: Selectmenu 26755 //>>group: Widgets 26756 /* eslint-disable max-len */ 26757 //>>description: Duplicates and extends the functionality of a native HTML select element, allowing it to be customizable in behavior and appearance far beyond the limitations of a native select. 26758 /* eslint-enable max-len */ 26759 //>>docs: http://api.jqueryui.com/selectmenu/ 26760 //>>demos: http://jqueryui.com/selectmenu/ 26761 //>>css.structure: ../../themes/base/core.css 26762 //>>css.structure: ../../themes/base/selectmenu.css, ../../themes/base/button.css 26763 //>>css.theme: ../../themes/base/theme.css 26764 26765 26766 var widgetsSelectmenu = $.widget("ui.selectmenu", [$.ui.formResetMixin, { 26767 version: "1.13.2", 26768 defaultElement: "<select>", 26769 options: { 26770 appendTo: null, 26771 classes: { 26772 "ui-selectmenu-button-open": "ui-corner-top", 26773 "ui-selectmenu-button-closed": "ui-corner-all" 26774 }, 26775 disabled: null, 26776 icons: { 26777 button: "ui-icon-triangle-1-s" 26778 }, 26779 position: { 26780 my: "left top", 26781 at: "left bottom", 26782 collision: "none" 26783 }, 26784 width: false, 26785 26786 // Callbacks 26787 change: null, 26788 close: null, 26789 focus: null, 26790 open: null, 26791 select: null 26792 }, 26793 26794 _create: function () { 26795 var selectmenuId = this.element.uniqueId().attr("id"); 26796 this.ids = { 26797 element: selectmenuId, 26798 button: selectmenuId + "-button", 26799 menu: selectmenuId + "-menu" 26800 }; 26801 26802 this._drawButton(); 26803 this._drawMenu(); 26804 this._bindFormResetHandler(); 26805 26806 this._rendered = false; 26807 this.menuItems = $(); 26808 }, 26809 26810 _drawButton: function () { 26811 var icon, 26812 that = this, 26813 item = this._parseOption( 26814 this.element.find("option:selected"), 26815 this.element[0].selectedIndex 26816 ); 26817 26818 // Associate existing label with the new button 26819 this.labels = this.element.labels().attr("for", this.ids.button); 26820 this._on(this.labels, { 26821 click: function (event) { 26822 this.button.trigger("focus"); 26823 event.preventDefault(); 26824 } 26825 }); 26826 26827 // Hide original select element 26828 this.element.hide(); 26829 26830 // Create button 26831 this.button = $("<span>", { 26832 tabindex: this.options.disabled ? -1 : 0, 26833 id: this.ids.button, 26834 role: "combobox", 26835 "aria-expanded": "false", 26836 "aria-autocomplete": "list", 26837 "aria-owns": this.ids.menu, 26838 "aria-haspopup": "true", 26839 title: this.element.attr("title") 26840 }) 26841 .insertAfter(this.element); 26842 26843 this._addClass(this.button, "ui-selectmenu-button ui-selectmenu-button-closed", 26844 "ui-button ui-widget"); 26845 26846 icon = $("<span>").appendTo(this.button); 26847 this._addClass(icon, "ui-selectmenu-icon", "ui-icon " + this.options.icons.button); 26848 this.buttonItem = this._renderButtonItem(item) 26849 .appendTo(this.button); 26850 26851 if (this.options.width !== false) { 26852 this._resizeButton(); 26853 } 26854 26855 this._on(this.button, this._buttonEvents); 26856 this.button.one("focusin", function () { 26857 26858 // Delay rendering the menu items until the button receives focus. 26859 // The menu may have already been rendered via a programmatic open. 26860 if (!that._rendered) { 26861 that._refreshMenu(); 26862 } 26863 }); 26864 }, 26865 26866 _drawMenu: function () { 26867 var that = this; 26868 26869 // Create menu 26870 this.menu = $("<ul>", { 26871 "aria-hidden": "true", 26872 "aria-labelledby": this.ids.button, 26873 id: this.ids.menu 26874 }); 26875 26876 // Wrap menu 26877 this.menuWrap = $("<div>").append(this.menu); 26878 this._addClass(this.menuWrap, "ui-selectmenu-menu", "ui-front"); 26879 this.menuWrap.appendTo(this._appendTo()); 26880 26881 // Initialize menu widget 26882 this.menuInstance = this.menu 26883 .menu({ 26884 classes: { 26885 "ui-menu": "ui-corner-bottom" 26886 }, 26887 role: "listbox", 26888 select: function (event, ui) { 26889 event.preventDefault(); 26890
vendor: 5,844 bytes, lines 26891-27131
26891 // Support: IE8 26892 // If the item was selected via a click, the text selection 26893 // will be destroyed in IE 26894 that._setSelection(); 26895 26896 that._select(ui.item.data("ui-selectmenu-item"), event); 26897 }, 26898 focus: function (event, ui) { 26899 var item = ui.item.data("ui-selectmenu-item"); 26900 26901 // Prevent inital focus from firing and check if its a newly focused item 26902 if (that.focusIndex != null && item.index !== that.focusIndex) { 26903 that._trigger("focus", event, { item: item }); 26904 if (!that.isOpen) { 26905 that._select(item, event); 26906 } 26907 } 26908 that.focusIndex = item.index; 26909 26910 that.button.attr("aria-activedescendant", 26911 that.menuItems.eq(item.index).attr("id")); 26912 } 26913 }) 26914 .menu("instance"); 26915 26916 // Don't close the menu on mouseleave 26917 this.menuInstance._off(this.menu, "mouseleave"); 26918 26919 // Cancel the menu's collapseAll on document click 26920 this.menuInstance._closeOnDocumentClick = function () { 26921 return false; 26922 }; 26923 26924 // Selects often contain empty items, but never contain dividers 26925 this.menuInstance._isDivider = function () { 26926 return false; 26927 }; 26928 }, 26929 26930 refresh: function () { 26931 this._refreshMenu(); 26932 this.buttonItem.replaceWith( 26933 this.buttonItem = this._renderButtonItem( 26934 26935 // Fall back to an empty object in case there are no options 26936 this._getSelectedItem().data("ui-selectmenu-item") || {} 26937 ) 26938 ); 26939 if (this.options.width === null) { 26940 this._resizeButton(); 26941 } 26942 }, 26943 26944 _refreshMenu: function () { 26945 var item, 26946 options = this.element.find("option"); 26947 26948 this.menu.empty(); 26949 26950 this._parseOptions(options); 26951 this._renderMenu(this.menu, this.items); 26952 26953 this.menuInstance.refresh(); 26954 this.menuItems = this.menu.find("li") 26955 .not(".ui-selectmenu-optgroup") 26956 .find(".ui-menu-item-wrapper"); 26957 26958 this._rendered = true; 26959 26960 if (!options.length) { 26961 return; 26962 } 26963 26964 item = this._getSelectedItem(); 26965 26966 // Update the menu to have the correct item focused 26967 this.menuInstance.focus(null, item); 26968 this._setAria(item.data("ui-selectmenu-item")); 26969 26970 // Set disabled state 26971 this._setOption("disabled", this.element.prop("disabled")); 26972 }, 26973 26974 open: function (event) { 26975 if (this.options.disabled) { 26976 return; 26977 } 26978 26979 // If this is the first time the menu is being opened, render the items 26980 if (!this._rendered) { 26981 this._refreshMenu(); 26982 } else { 26983 26984 // Menu clears focus on close, reset focus to selected item 26985 this._removeClass(this.menu.find(".ui-state-active"), null, "ui-state-active"); 26986 this.menuInstance.focus(null, this._getSelectedItem()); 26987 } 26988 26989 // If there are no options, don't open the menu 26990 if (!this.menuItems.length) { 26991 return; 26992 } 26993 26994 this.isOpen = true; 26995 this._toggleAttr(); 26996 this._resizeMenu(); 26997 this._position(); 26998 26999 this._on(this.document, this._documentClick); 27000 27001 this._trigger("open", event); 27002 }, 27003 27004 _position: function () { 27005 this.menuWrap.position($.extend({ of: this.button }, this.options.position)); 27006 }, 27007 27008 close: function (event) { 27009 if (!this.isOpen) { 27010 return; 27011 } 27012 27013 this.isOpen = false; 27014 this._toggleAttr(); 27015 27016 this.range = null; 27017 this._off(this.document); 27018 27019 this._trigger("close", event); 27020 }, 27021 27022 widget: function () { 27023 return this.button; 27024 }, 27025 27026 menuWidget: function () { 27027 return this.menu; 27028 }, 27029 27030 _renderButtonItem: function (item) { 27031 var buttonItem = $("<span>"); 27032 27033 this._setText(buttonItem, item.label); 27034 this._addClass(buttonItem, "ui-selectmenu-text"); 27035 27036 return buttonItem; 27037 }, 27038 27039 _renderMenu: function (ul, items) { 27040 var that = this, 27041 currentOptgroup = ""; 27042 27043 $.each(items, function (index, item) { 27044 var li; 27045 27046 if (item.optgroup !== currentOptgroup) { 27047 li = $("<li>", { 27048 text: item.optgroup 27049 }); 27050 that._addClass(li, "ui-selectmenu-optgroup", "ui-menu-divider" + 27051 (item.element.parent("optgroup").prop("disabled") ? 27052 " ui-state-disabled" : 27053 "")); 27054 27055 li.appendTo(ul); 27056 27057 currentOptgroup = item.optgroup; 27058 } 27059 27060 that._renderItemData(ul, item); 27061 }); 27062 }, 27063 27064 _renderItemData: function (ul, item) { 27065 return this._renderItem(ul, item).data("ui-selectmenu-item", item); 27066 }, 27067 27068 _renderItem: function (ul, item) { 27069 var li = $("<li>"), 27070 wrapper = $("<div>", { 27071 title: item.element.attr("title") 27072 }); 27073 27074 if (item.disabled) { 27075 this._addClass(li, null, "ui-state-disabled"); 27076 } 27077 this._setText(wrapper, item.label); 27078 27079 return li.append(wrapper).appendTo(ul); 27080 }, 27081 27082 _setText: function (element, value) { 27083 if (value) { 27084 element.text(value); 27085 } else { 27086 element.html(" "); 27087 } 27088 }, 27089 27090 _move: function (direction, event) { 27091 var item, next, 27092 filter = ".ui-menu-item"; 27093 27094 if (this.isOpen) { 27095 item = this.menuItems.eq(this.focusIndex).parent("li"); 27096 } else { 27097 item = this.menuItems.eq(this.element[0].selectedIndex).parent("li"); 27098 filter += ":not(.ui-state-disabled)"; 27099 } 27100 27101 if (direction === "first" || direction === "last") { 27102 next = item[direction === "first" ? "prevAll" : "nextAll"](filter).eq(-1); 27103 } else { 27104 next = item[direction + "All"](filter).eq(0); 27105 } 27106 27107 if (next.length) { 27108 this.menuInstance.focus(event, next); 27109 } 27110 }, 27111 27112 _getSelectedItem: function () { 27113 return this.menuItems.eq(this.element[0].selectedIndex).parent("li"); 27114 }, 27115 27116 _toggle: function (event) { 27117 this[this.isOpen ? "close" : "open"](event); 27118 }, 27119 27120 _setSelection: function () { 27121 var selection; 27122 27123 if (!this.range) { 27124 return; 27125 } 27126 27127 if (window.getSelection) { 27128 selection = window.getSelection(); 27129 selection.removeAllRanges(); 27130 selection.addRange(this.range); 27131
vendor: 9,925 bytes, lines 27132-27528
27132 // Support: IE8 27133 } else { 27134 this.range.select(); 27135 } 27136 27137 // Support: IE 27138 // Setting the text selection kills the button focus in IE, but 27139 // restoring the focus doesn't kill the selection. 27140 this.button.trigger("focus"); 27141 }, 27142 27143 _documentClick: { 27144 mousedown: function (event) { 27145 if (!this.isOpen) { 27146 return; 27147 } 27148 27149 if (!$(event.target).closest(".ui-selectmenu-menu, #" + 27150 $.escapeSelector(this.ids.button)).length) { 27151 this.close(event); 27152 } 27153 } 27154 }, 27155 27156 _buttonEvents: { 27157 27158 // Prevent text selection from being reset when interacting with the selectmenu (#10144) 27159 mousedown: function () { 27160 var selection; 27161 27162 if (window.getSelection) { 27163 selection = window.getSelection(); 27164 if (selection.rangeCount) { 27165 this.range = selection.getRangeAt(0); 27166 } 27167 27168 // Support: IE8 27169 } else { 27170 this.range = document.selection.createRange(); 27171 } 27172 }, 27173 27174 click: function (event) { 27175 this._setSelection(); 27176 this._toggle(event); 27177 }, 27178 27179 keydown: function (event) { 27180 var preventDefault = true; 27181 switch (event.keyCode) { 27182 case $.ui.keyCode.TAB: 27183 case $.ui.keyCode.ESCAPE: 27184 this.close(event); 27185 preventDefault = false; 27186 break; 27187 case $.ui.keyCode.ENTER: 27188 if (this.isOpen) { 27189 this._selectFocusedItem(event); 27190 } 27191 break; 27192 case $.ui.keyCode.UP: 27193 if (event.altKey) { 27194 this._toggle(event); 27195 } else { 27196 this._move("prev", event); 27197 } 27198 break; 27199 case $.ui.keyCode.DOWN: 27200 if (event.altKey) { 27201 this._toggle(event); 27202 } else { 27203 this._move("next", event); 27204 } 27205 break; 27206 case $.ui.keyCode.SPACE: 27207 if (this.isOpen) { 27208 this._selectFocusedItem(event); 27209 } else { 27210 this._toggle(event); 27211 } 27212 break; 27213 case $.ui.keyCode.LEFT: 27214 this._move("prev", event); 27215 break; 27216 case $.ui.keyCode.RIGHT: 27217 this._move("next", event); 27218 break; 27219 case $.ui.keyCode.HOME: 27220 case $.ui.keyCode.PAGE_UP: 27221 this._move("first", event); 27222 break; 27223 case $.ui.keyCode.END: 27224 case $.ui.keyCode.PAGE_DOWN: 27225 this._move("last", event); 27226 break; 27227 default: 27228 this.menu.trigger(event); 27229 preventDefault = false; 27230 } 27231 27232 if (preventDefault) { 27233 event.preventDefault(); 27234 } 27235 } 27236 }, 27237 27238 _selectFocusedItem: function (event) { 27239 var item = this.menuItems.eq(this.focusIndex).parent("li"); 27240 if (!item.hasClass("ui-state-disabled")) { 27241 this._select(item.data("ui-selectmenu-item"), event); 27242 } 27243 }, 27244 27245 _select: function (item, event) { 27246 var oldIndex = this.element[0].selectedIndex; 27247 27248 // Change native select element 27249 this.element[0].selectedIndex = item.index; 27250 this.buttonItem.replaceWith(this.buttonItem = this._renderButtonItem(item)); 27251 this._setAria(item); 27252 this._trigger("select", event, { item: item }); 27253 27254 if (item.index !== oldIndex) { 27255 this._trigger("change", event, { item: item }); 27256 } 27257 27258 this.close(event); 27259 }, 27260 27261 _setAria: function (item) { 27262 var id = this.menuItems.eq(item.index).attr("id"); 27263 27264 this.button.attr({ 27265 "aria-labelledby": id, 27266 "aria-activedescendant": id 27267 }); 27268 this.menu.attr("aria-activedescendant", id); 27269 }, 27270 27271 _setOption: function (key, value) { 27272 if (key === "icons") { 27273 var icon = this.button.find("span.ui-icon"); 27274 this._removeClass(icon, null, this.options.icons.button) 27275 ._addClass(icon, null, value.button); 27276 } 27277 27278 this._super(key, value); 27279 27280 if (key === "appendTo") { 27281 this.menuWrap.appendTo(this._appendTo()); 27282 } 27283 27284 if (key === "width") { 27285 this._resizeButton(); 27286 } 27287 }, 27288 27289 _setOptionDisabled: function (value) { 27290 this._super(value); 27291 27292 this.menuInstance.option("disabled", value); 27293 this.button.attr("aria-disabled", value); 27294 this._toggleClass(this.button, null, "ui-state-disabled", value); 27295 27296 this.element.prop("disabled", value); 27297 if (value) { 27298 this.button.attr("tabindex", -1); 27299 this.close(); 27300 } else { 27301 this.button.attr("tabindex", 0); 27302 } 27303 }, 27304 27305 _appendTo: function () { 27306 var element = this.options.appendTo; 27307 27308 if (element) { 27309 element = element.jquery || element.nodeType ? 27310 $(element) : 27311 this.document.find(element).eq(0); 27312 } 27313 27314 if (!element || !element[0]) { 27315 element = this.element.closest(".ui-front, dialog"); 27316 } 27317 27318 if (!element.length) { 27319 element = this.document[0].body; 27320 } 27321 27322 return element; 27323 }, 27324 27325 _toggleAttr: function () { 27326 this.button.attr("aria-expanded", this.isOpen); 27327 27328 // We can't use two _toggleClass() calls here, because we need to make sure 27329 // we always remove classes first and add them second, otherwise if both classes have the 27330 // same theme class, it will be removed after we add it. 27331 this._removeClass(this.button, "ui-selectmenu-button-" + 27332 (this.isOpen ? "closed" : "open")) 27333 ._addClass(this.button, "ui-selectmenu-button-" + 27334 (this.isOpen ? "open" : "closed")) 27335 ._toggleClass(this.menuWrap, "ui-selectmenu-open", null, this.isOpen); 27336 27337 this.menu.attr("aria-hidden", !this.isOpen); 27338 }, 27339 27340 _resizeButton: function () { 27341 var width = this.options.width; 27342 27343 // For `width: false`, just remove inline style and stop 27344 if (width === false) { 27345 this.button.css("width", ""); 27346 return; 27347 } 27348 27349 // For `width: null`, match the width of the original element 27350 if (width === null) { 27351 width = this.element.show().outerWidth(); 27352 this.element.hide(); 27353 } 27354 27355 this.button.outerWidth(width); 27356 }, 27357 27358 _resizeMenu: function () { 27359 this.menu.outerWidth(Math.max( 27360 this.button.outerWidth(), 27361 27362 // Support: IE10 27363 // IE10 wraps long text (possibly a rounding bug) 27364 // so we add 1px to avoid the wrapping 27365 this.menu.width("").outerWidth() + 1 27366 )); 27367 }, 27368 27369 _getCreateOptions: function () { 27370 var options = this._super(); 27371 27372 options.disabled = this.element.prop("disabled"); 27373 27374 return options; 27375 }, 27376 27377 _parseOptions: function (options) { 27378 var that = this, 27379 data = []; 27380 options.each(function (index, item) { 27381 if (item.hidden) { 27382 return; 27383 } 27384 27385 data.push(that._parseOption($(item), index)); 27386 }); 27387 this.items = data; 27388 }, 27389 27390 _parseOption: function (option, index) { 27391 var optgroup = option.parent("optgroup"); 27392 27393 return { 27394 element: option, 27395 index: index, 27396 value: option.val(), 27397 label: option.text(), 27398 optgroup: optgroup.attr("label") || "", 27399 disabled: optgroup.prop("disabled") || option.prop("disabled") 27400 }; 27401 }, 27402 27403 _destroy: function () { 27404 this._unbindFormResetHandler(); 27405 this.menuWrap.remove(); 27406 this.button.remove(); 27407 this.element.show(); 27408 this.element.removeUniqueId(); 27409 this.labels.attr("for", this.ids.element); 27410 } 27411 }]); 27412 27413 27414 /*! 27415 * jQuery UI Slider 1.13.2 27416 * http://jqueryui.com 27417 * 27418 * Copyright jQuery Foundation and other contributors 27419 * Released under the MIT license. 27420 * http://jquery.org/license 27421 */ 27422 27423 //>>label: Slider 27424 //>>group: Widgets 27425 //>>description: Displays a flexible slider with ranges and accessibility via keyboard. 27426 //>>docs: http://api.jqueryui.com/slider/ 27427 //>>demos: http://jqueryui.com/slider/ 27428 //>>css.structure: ../../themes/base/core.css 27429 //>>css.structure: ../../themes/base/slider.css 27430 //>>css.theme: ../../themes/base/theme.css 27431 27432 27433 var widgetsSlider = $.widget("ui.slider", $.ui.mouse, { 27434 version: "1.13.2", 27435 widgetEventPrefix: "slide", 27436 27437 options: { 27438 animate: false, 27439 classes: { 27440 "ui-slider": "ui-corner-all", 27441 "ui-slider-handle": "ui-corner-all", 27442 27443 // Note: ui-widget-header isn't the most fittingly semantic framework class for this 27444 // element, but worked best visually with a variety of themes 27445 "ui-slider-range": "ui-corner-all ui-widget-header" 27446 }, 27447 distance: 0, 27448 max: 100, 27449 min: 0, 27450 orientation: "horizontal", 27451 range: false, 27452 step: 1, 27453 value: 0, 27454 values: null, 27455 27456 // Callbacks 27457 change: null, 27458 slide: null, 27459 start: null, 27460 stop: null 27461 }, 27462 27463 // Number of pages in a slider 27464 // (how many times can you page up/down to go through the whole range) 27465 numPages: 5, 27466 27467 _create: function () { 27468 this._keySliding = false; 27469 this._mouseSliding = false; 27470 this._animateOff = true; 27471 this._handleIndex = null; 27472 this._detectOrientation(); 27473 this._mouseInit(); 27474 this._calculateNewMax(); 27475 27476 this._addClass("ui-slider ui-slider-" + this.orientation, 27477 "ui-widget ui-widget-content"); 27478 27479 this._refresh(); 27480 27481 this._animateOff = false; 27482 }, 27483 27484 _refresh: function () { 27485 this._createRange(); 27486 this._createHandles(); 27487 this._setupEvents(); 27488 this._refreshValue(); 27489 }, 27490 27491 _createHandles: function () { 27492 var i, handleCount, 27493 options = this.options, 27494 existingHandles = this.element.find(".ui-slider-handle"), 27495 handle = "<span tabindex='0'></span>", 27496 handles = []; 27497 27498 handleCount = (options.values && options.values.length) || 1; 27499 27500 if (existingHandles.length > handleCount) { 27501 existingHandles.slice(handleCount).remove(); 27502 existingHandles = existingHandles.slice(0, handleCount); 27503 } 27504 27505 for (i = existingHandles.length; i < handleCount; i++) { 27506 handles.push(handle); 27507 } 27508 27509 this.handles = existingHandles.add($(handles.join("")).appendTo(this.element)); 27510 27511 this._addClass(this.handles, "ui-slider-handle", "ui-state-default"); 27512 27513 this.handle = this.handles.eq(0); 27514 27515 this.handles.each(function (i) { 27516 $(this) 27517 .data("ui-slider-handle-index", i) 27518 .attr("tabIndex", 0); 27519 }); 27520 }, 27521 27522 _createRange: function () { 27523 var options = this.options; 27524 27525 if (options.range) { 27526 if (options.range === true) { 27527 if (!options.values) { 27528 options.values = [this._valueMin(), this._valueMin()];
vendor: 23,631 bytes, lines 27529-28404
27529 } else if (options.values.length && options.values.length !== 2) { 27530 options.values = [options.values[0], options.values[0]]; 27531 } else if (Array.isArray(options.values)) { 27532 options.values = options.values.slice(0); 27533 } 27534 } 27535 27536 if (!this.range || !this.range.length) { 27537 this.range = $("<div>") 27538 .appendTo(this.element); 27539 27540 this._addClass(this.range, "ui-slider-range"); 27541 } else { 27542 this._removeClass(this.range, "ui-slider-range-min ui-slider-range-max"); 27543 27544 // Handle range switching from true to min/max 27545 this.range.css({ 27546 "left": "", 27547 "bottom": "" 27548 }); 27549 } 27550 if (options.range === "min" || options.range === "max") { 27551 this._addClass(this.range, "ui-slider-range-" + options.range); 27552 } 27553 } else { 27554 if (this.range) { 27555 this.range.remove(); 27556 } 27557 this.range = null; 27558 } 27559 }, 27560 27561 _setupEvents: function () { 27562 this._off(this.handles); 27563 this._on(this.handles, this._handleEvents); 27564 this._hoverable(this.handles); 27565 this._focusable(this.handles); 27566 }, 27567 27568 _destroy: function () { 27569 this.handles.remove(); 27570 if (this.range) { 27571 this.range.remove(); 27572 } 27573 27574 this._mouseDestroy(); 27575 }, 27576 27577 _mouseCapture: function (event) { 27578 var position, normValue, distance, closestHandle, index, allowed, offset, mouseOverHandle, 27579 that = this, 27580 o = this.options; 27581 27582 if (o.disabled) { 27583 return false; 27584 } 27585 27586 this.elementSize = { 27587 width: this.element.outerWidth(), 27588 height: this.element.outerHeight() 27589 }; 27590 this.elementOffset = this.element.offset(); 27591 27592 position = { x: event.pageX, y: event.pageY }; 27593 normValue = this._normValueFromMouse(position); 27594 distance = this._valueMax() - this._valueMin() + 1; 27595 this.handles.each(function (i) { 27596 var thisDistance = Math.abs(normValue - that.values(i)); 27597 if ((distance > thisDistance) || 27598 (distance === thisDistance && 27599 (i === that._lastChangedValue || that.values(i) === o.min))) { 27600 distance = thisDistance; 27601 closestHandle = $(this); 27602 index = i; 27603 } 27604 }); 27605 27606 allowed = this._start(event, index); 27607 if (allowed === false) { 27608 return false; 27609 } 27610 this._mouseSliding = true; 27611 27612 this._handleIndex = index; 27613 27614 this._addClass(closestHandle, null, "ui-state-active"); 27615 closestHandle.trigger("focus"); 27616 27617 offset = closestHandle.offset(); 27618 mouseOverHandle = !$(event.target).parents().addBack().is(".ui-slider-handle"); 27619 this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : { 27620 left: event.pageX - offset.left - (closestHandle.width() / 2), 27621 top: event.pageY - offset.top - 27622 (closestHandle.height() / 2) - 27623 (parseInt(closestHandle.css("borderTopWidth"), 10) || 0) - 27624 (parseInt(closestHandle.css("borderBottomWidth"), 10) || 0) + 27625 (parseInt(closestHandle.css("marginTop"), 10) || 0) 27626 }; 27627 27628 if (!this.handles.hasClass("ui-state-hover")) { 27629 this._slide(event, index, normValue); 27630 } 27631 this._animateOff = true; 27632 return true; 27633 }, 27634 27635 _mouseStart: function () { 27636 return true; 27637 }, 27638 27639 _mouseDrag: function (event) { 27640 var position = { x: event.pageX, y: event.pageY }, 27641 normValue = this._normValueFromMouse(position); 27642 27643 this._slide(event, this._handleIndex, normValue); 27644 27645 return false; 27646 }, 27647 27648 _mouseStop: function (event) { 27649 this._removeClass(this.handles, null, "ui-state-active"); 27650 this._mouseSliding = false; 27651 27652 this._stop(event, this._handleIndex); 27653 this._change(event, this._handleIndex); 27654 27655 this._handleIndex = null; 27656 this._clickOffset = null; 27657 this._animateOff = false; 27658 27659 return false; 27660 }, 27661 27662 _detectOrientation: function () { 27663 this.orientation = (this.options.orientation === "vertical") ? "vertical" : "horizontal"; 27664 }, 27665 27666 _normValueFromMouse: function (position) { 27667 var pixelTotal, 27668 pixelMouse, 27669 percentMouse, 27670 valueTotal, 27671 valueMouse; 27672 27673 if (this.orientation === "horizontal") { 27674 pixelTotal = this.elementSize.width; 27675 pixelMouse = position.x - this.elementOffset.left - 27676 (this._clickOffset ? this._clickOffset.left : 0); 27677 } else { 27678 pixelTotal = this.elementSize.height; 27679 pixelMouse = position.y - this.elementOffset.top - 27680 (this._clickOffset ? this._clickOffset.top : 0); 27681 } 27682 27683 percentMouse = (pixelMouse / pixelTotal); 27684 if (percentMouse > 1) { 27685 percentMouse = 1; 27686 } 27687 if (percentMouse < 0) { 27688 percentMouse = 0; 27689 } 27690 if (this.orientation === "vertical") { 27691 percentMouse = 1 - percentMouse; 27692 } 27693 27694 valueTotal = this._valueMax() - this._valueMin(); 27695 valueMouse = this._valueMin() + percentMouse * valueTotal; 27696 27697 return this._trimAlignValue(valueMouse); 27698 }, 27699 27700 _uiHash: function (index, value, values) { 27701 var uiHash = { 27702 handle: this.handles[index], 27703 handleIndex: index, 27704 value: value !== undefined ? value : this.value() 27705 }; 27706 27707 if (this._hasMultipleValues()) { 27708 uiHash.value = value !== undefined ? value : this.values(index); 27709 uiHash.values = values || this.values(); 27710 } 27711 27712 return uiHash; 27713 }, 27714 27715 _hasMultipleValues: function () { 27716 return this.options.values && this.options.values.length; 27717 }, 27718 27719 _start: function (event, index) { 27720 return this._trigger("start", event, this._uiHash(index)); 27721 }, 27722 27723 _slide: function (event, index, newVal) { 27724 var allowed, otherVal, 27725 currentValue = this.value(), 27726 newValues = this.values(); 27727 27728 if (this._hasMultipleValues()) { 27729 otherVal = this.values(index ? 0 : 1); 27730 currentValue = this.values(index); 27731 27732 if (this.options.values.length === 2 && this.options.range === true) { 27733 newVal = index === 0 ? Math.min(otherVal, newVal) : Math.max(otherVal, newVal); 27734 } 27735 27736 newValues[index] = newVal; 27737 } 27738 27739 if (newVal === currentValue) { 27740 return; 27741 } 27742 27743 allowed = this._trigger("slide", event, this._uiHash(index, newVal, newValues)); 27744 27745 // A slide can be canceled by returning false from the slide callback 27746 if (allowed === false) { 27747 return; 27748 } 27749 27750 if (this._hasMultipleValues()) { 27751 this.values(index, newVal); 27752 } else { 27753 this.value(newVal); 27754 } 27755 }, 27756 27757 _stop: function (event, index) { 27758 this._trigger("stop", event, this._uiHash(index)); 27759 }, 27760 27761 _change: function (event, index) { 27762 if (!this._keySliding && !this._mouseSliding) { 27763 27764 //store the last changed value index for reference when handles overlap 27765 this._lastChangedValue = index; 27766 this._trigger("change", event, this._uiHash(index)); 27767 } 27768 }, 27769 27770 value: function (newValue) { 27771 if (arguments.length) { 27772 this.options.value = this._trimAlignValue(newValue); 27773 this._refreshValue(); 27774 this._change(null, 0); 27775 return; 27776 } 27777 27778 return this._value(); 27779 }, 27780 27781 values: function (index, newValue) { 27782 var vals, 27783 newValues, 27784 i; 27785 27786 if (arguments.length > 1) { 27787 this.options.values[index] = this._trimAlignValue(newValue); 27788 this._refreshValue(); 27789 this._change(null, index); 27790 return; 27791 } 27792 27793 if (arguments.length) { 27794 if (Array.isArray(arguments[0])) { 27795 vals = this.options.values; 27796 newValues = arguments[0]; 27797 for (i = 0; i < vals.length; i += 1) { 27798 vals[i] = this._trimAlignValue(newValues[i]); 27799 this._change(null, i); 27800 } 27801 this._refreshValue(); 27802 } else { 27803 if (this._hasMultipleValues()) { 27804 return this._values(index); 27805 } else { 27806 return this.value(); 27807 } 27808 } 27809 } else { 27810 return this._values(); 27811 } 27812 }, 27813 27814 _setOption: function (key, value) { 27815 var i, 27816 valsLength = 0; 27817 27818 if (key === "range" && this.options.range === true) { 27819 if (value === "min") { 27820 this.options.value = this._values(0); 27821 this.options.values = null; 27822 } else if (value === "max") { 27823 this.options.value = this._values(this.options.values.length - 1); 27824 this.options.values = null; 27825 } 27826 } 27827 27828 if (Array.isArray(this.options.values)) { 27829 valsLength = this.options.values.length; 27830 } 27831 27832 this._super(key, value); 27833 27834 switch (key) { 27835 case "orientation": 27836 this._detectOrientation(); 27837 this._removeClass("ui-slider-horizontal ui-slider-vertical") 27838 ._addClass("ui-slider-" + this.orientation); 27839 this._refreshValue(); 27840 if (this.options.range) { 27841 this._refreshRange(value); 27842 } 27843 27844 // Reset positioning from previous orientation 27845 this.handles.css(value === "horizontal" ? "bottom" : "left", ""); 27846 break; 27847 case "value": 27848 this._animateOff = true; 27849 this._refreshValue(); 27850 this._change(null, 0); 27851 this._animateOff = false; 27852 break; 27853 case "values": 27854 this._animateOff = true; 27855 this._refreshValue(); 27856 27857 // Start from the last handle to prevent unreachable handles (#9046) 27858 for (i = valsLength - 1; i >= 0; i--) { 27859 this._change(null, i); 27860 } 27861 this._animateOff = false; 27862 break; 27863 case "step": 27864 case "min": 27865 case "max": 27866 this._animateOff = true; 27867 this._calculateNewMax(); 27868 this._refreshValue(); 27869 this._animateOff = false; 27870 break; 27871 case "range": 27872 this._animateOff = true; 27873 this._refresh(); 27874 this._animateOff = false; 27875 break; 27876 } 27877 }, 27878 27879 _setOptionDisabled: function (value) { 27880 this._super(value); 27881 27882 this._toggleClass(null, "ui-state-disabled", !!value); 27883 }, 27884 27885 //internal value getter 27886 // _value() returns value trimmed by min and max, aligned by step 27887 _value: function () { 27888 var val = this.options.value; 27889 val = this._trimAlignValue(val); 27890 27891 return val; 27892 }, 27893 27894 //internal values getter 27895 // _values() returns array of values trimmed by min and max, aligned by step 27896 // _values( index ) returns single value trimmed by min and max, aligned by step 27897 _values: function (index) { 27898 var val, 27899 vals, 27900 i; 27901 27902 if (arguments.length) { 27903 val = this.options.values[index]; 27904 val = this._trimAlignValue(val); 27905 27906 return val; 27907 } else if (this._hasMultipleValues()) { 27908 27909 // .slice() creates a copy of the array 27910 // this copy gets trimmed by min and max and then returned 27911 vals = this.options.values.slice(); 27912 for (i = 0; i < vals.length; i += 1) { 27913 vals[i] = this._trimAlignValue(vals[i]); 27914 } 27915 27916 return vals; 27917 } else { 27918 return []; 27919 } 27920 }, 27921 27922 // Returns the step-aligned value that val is closest to, between (inclusive) min and max 27923 _trimAlignValue: function (val) { 27924 if (val <= this._valueMin()) { 27925 return this._valueMin(); 27926 } 27927 if (val >= this._valueMax()) { 27928 return this._valueMax(); 27929 } 27930 var step = (this.options.step > 0) ? this.options.step : 1, 27931 valModStep = (val - this._valueMin()) % step, 27932 alignValue = val - valModStep; 27933 27934 if (Math.abs(valModStep) * 2 >= step) { 27935 alignValue += (valModStep > 0) ? step : (-step); 27936 } 27937 27938 // Since JavaScript has problems with large floats, round 27939 // the final value to 5 digits after the decimal point (see #4124) 27940 return parseFloat(alignValue.toFixed(5)); 27941 }, 27942 27943 _calculateNewMax: function () { 27944 var max = this.options.max, 27945 min = this._valueMin(), 27946 step = this.options.step, 27947 aboveMin = Math.round((max - min) / step) * step; 27948 max = aboveMin + min; 27949 if (max > this.options.max) { 27950 27951 //If max is not divisible by step, rounding off may increase its value 27952 max -= step; 27953 } 27954 this.max = parseFloat(max.toFixed(this._precision())); 27955 }, 27956 27957 _precision: function () { 27958 var precision = this._precisionOf(this.options.step); 27959 if (this.options.min !== null) { 27960 precision = Math.max(precision, this._precisionOf(this.options.min)); 27961 } 27962 return precision; 27963 }, 27964 27965 _precisionOf: function (num) { 27966 var str = num.toString(), 27967 decimal = str.indexOf("."); 27968 return decimal === -1 ? 0 : str.length - decimal - 1; 27969 }, 27970 27971 _valueMin: function () { 27972 return this.options.min; 27973 }, 27974 27975 _valueMax: function () { 27976 return this.max; 27977 }, 27978 27979 _refreshRange: function (orientation) { 27980 if (orientation === "vertical") { 27981 this.range.css({ "width": "", "left": "" }); 27982 } 27983 if (orientation === "horizontal") { 27984 this.range.css({ "height": "", "bottom": "" }); 27985 } 27986 }, 27987 27988 _refreshValue: function () { 27989 var lastValPercent, valPercent, value, valueMin, valueMax, 27990 oRange = this.options.range, 27991 o = this.options, 27992 that = this, 27993 animate = (!this._animateOff) ? o.animate : false, 27994 _set = {}; 27995 27996 if (this._hasMultipleValues()) { 27997 this.handles.each(function (i) { 27998 valPercent = (that.values(i) - that._valueMin()) / (that._valueMax() - 27999 that._valueMin()) * 100; 28000 _set[that.orientation === "horizontal" ? "left" : "bottom"] = valPercent + "%"; 28001 $(this).stop(1, 1)[animate ? "animate" : "css"](_set, o.animate); 28002 if (that.options.range === true) { 28003 if (that.orientation === "horizontal") { 28004 if (i === 0) { 28005 that.range.stop(1, 1)[animate ? "animate" : "css"]({ 28006 left: valPercent + "%" 28007 }, o.animate); 28008 } 28009 if (i === 1) { 28010 that.range[animate ? "animate" : "css"]({ 28011 width: (valPercent - lastValPercent) + "%" 28012 }, { 28013 queue: false, 28014 duration: o.animate 28015 }); 28016 } 28017 } else { 28018 if (i === 0) { 28019 that.range.stop(1, 1)[animate ? "animate" : "css"]({ 28020 bottom: (valPercent) + "%" 28021 }, o.animate); 28022 } 28023 if (i === 1) { 28024 that.range[animate ? "animate" : "css"]({ 28025 height: (valPercent - lastValPercent) + "%" 28026 }, { 28027 queue: false, 28028 duration: o.animate 28029 }); 28030 } 28031 } 28032 } 28033 lastValPercent = valPercent; 28034 }); 28035 } else { 28036 value = this.value(); 28037 valueMin = this._valueMin(); 28038 valueMax = this._valueMax(); 28039 valPercent = (valueMax !== valueMin) ? 28040 (value - valueMin) / (valueMax - valueMin) * 100 : 28041 0; 28042 _set[this.orientation === "horizontal" ? "left" : "bottom"] = valPercent + "%"; 28043 this.handle.stop(1, 1)[animate ? "animate" : "css"](_set, o.animate); 28044 28045 if (oRange === "min" && this.orientation === "horizontal") { 28046 this.range.stop(1, 1)[animate ? "animate" : "css"]({ 28047 width: valPercent + "%" 28048 }, o.animate); 28049 } 28050 if (oRange === "max" && this.orientation === "horizontal") { 28051 this.range.stop(1, 1)[animate ? "animate" : "css"]({ 28052 width: (100 - valPercent) + "%" 28053 }, o.animate); 28054 } 28055 if (oRange === "min" && this.orientation === "vertical") { 28056 this.range.stop(1, 1)[animate ? "animate" : "css"]({ 28057 height: valPercent + "%" 28058 }, o.animate); 28059 } 28060 if (oRange === "max" && this.orientation === "vertical") { 28061 this.range.stop(1, 1)[animate ? "animate" : "css"]({ 28062 height: (100 - valPercent) + "%" 28063 }, o.animate); 28064 } 28065 } 28066 }, 28067 28068 _handleEvents: { 28069 keydown: function (event) { 28070 var allowed, curVal, newVal, step, 28071 index = $(event.target).data("ui-slider-handle-index"); 28072 28073 switch (event.keyCode) { 28074 case $.ui.keyCode.HOME: 28075 case $.ui.keyCode.END: 28076 case $.ui.keyCode.PAGE_UP: 28077 case $.ui.keyCode.PAGE_DOWN: 28078 case $.ui.keyCode.UP: 28079 case $.ui.keyCode.RIGHT: 28080 case $.ui.keyCode.DOWN: 28081 case $.ui.keyCode.LEFT: 28082 event.preventDefault(); 28083 if (!this._keySliding) { 28084 this._keySliding = true; 28085 this._addClass($(event.target), null, "ui-state-active"); 28086 allowed = this._start(event, index); 28087 if (allowed === false) { 28088 return; 28089 } 28090 } 28091 break; 28092 } 28093 28094 step = this.options.step; 28095 if (this._hasMultipleValues()) { 28096 curVal = newVal = this.values(index); 28097 } else { 28098 curVal = newVal = this.value(); 28099 } 28100 28101 switch (event.keyCode) { 28102 case $.ui.keyCode.HOME: 28103 newVal = this._valueMin(); 28104 break; 28105 case $.ui.keyCode.END: 28106 newVal = this._valueMax(); 28107 break; 28108 case $.ui.keyCode.PAGE_UP: 28109 newVal = this._trimAlignValue( 28110 curVal + ((this._valueMax() - this._valueMin()) / this.numPages) 28111 ); 28112 break; 28113 case $.ui.keyCode.PAGE_DOWN: 28114 newVal = this._trimAlignValue( 28115 curVal - ((this._valueMax() - this._valueMin()) / this.numPages)); 28116 break; 28117 case $.ui.keyCode.UP: 28118 case $.ui.keyCode.RIGHT: 28119 if (curVal === this._valueMax()) { 28120 return; 28121 } 28122 newVal = this._trimAlignValue(curVal + step); 28123 break; 28124 case $.ui.keyCode.DOWN: 28125 case $.ui.keyCode.LEFT: 28126 if (curVal === this._valueMin()) { 28127 return; 28128 } 28129 newVal = this._trimAlignValue(curVal - step); 28130 break; 28131 } 28132 28133 this._slide(event, index, newVal); 28134 }, 28135 keyup: function (event) { 28136 var index = $(event.target).data("ui-slider-handle-index"); 28137 28138 if (this._keySliding) { 28139 this._keySliding = false; 28140 this._stop(event, index); 28141 this._change(event, index); 28142 this._removeClass($(event.target), null, "ui-state-active"); 28143 } 28144 } 28145 } 28146 }); 28147 28148 28149 /*! 28150 * jQuery UI Sortable 1.13.2 28151 * http://jqueryui.com 28152 * 28153 * Copyright jQuery Foundation and other contributors 28154 * Released under the MIT license. 28155 * http://jquery.org/license 28156 */ 28157 28158 //>>label: Sortable 28159 //>>group: Interactions 28160 //>>description: Enables items in a list to be sorted using the mouse. 28161 //>>docs: http://api.jqueryui.com/sortable/ 28162 //>>demos: http://jqueryui.com/sortable/ 28163 //>>css.structure: ../../themes/base/sortable.css 28164 28165 28166 var widgetsSortable = $.widget("ui.sortable", $.ui.mouse, { 28167 version: "1.13.2", 28168 widgetEventPrefix: "sort", 28169 ready: false, 28170 options: { 28171 appendTo: "parent", 28172 axis: false, 28173 connectWith: false, 28174 containment: false, 28175 cursor: "auto", 28176 cursorAt: false, 28177 dropOnEmpty: true, 28178 forcePlaceholderSize: false, 28179 forceHelperSize: false, 28180 grid: false, 28181 handle: false, 28182 helper: "original", 28183 items: "> *", 28184 opacity: false, 28185 placeholder: false, 28186 revert: false, 28187 scroll: true, 28188 scrollSensitivity: 20, 28189 scrollSpeed: 20, 28190 scope: "default", 28191 tolerance: "intersect", 28192 zIndex: 1000, 28193 28194 // Callbacks 28195 activate: null, 28196 beforeStop: null, 28197 change: null, 28198 deactivate: null, 28199 out: null, 28200 over: null, 28201 receive: null, 28202 remove: null, 28203 sort: null, 28204 start: null, 28205 stop: null, 28206 update: null 28207 }, 28208 28209 _isOverAxis: function (x, reference, size) { 28210 return (x >= reference) && (x < (reference + size)); 28211 }, 28212 28213 _isFloating: function (item) { 28214 return (/left|right/).test(item.css("float")) || 28215 (/inline|table-cell/).test(item.css("display")); 28216 }, 28217 28218 _create: function () { 28219 this.containerCache = {}; 28220 this._addClass("ui-sortable"); 28221 28222 //Get the items 28223 this.refresh(); 28224 28225 //Let's determine the parent's offset 28226 this.offset = this.element.offset(); 28227 28228 //Initialize mouse events for interaction 28229 this._mouseInit(); 28230 28231 this._setHandleClassName(); 28232 28233 //We're ready to go 28234 this.ready = true; 28235 28236 }, 28237 28238 _setOption: function (key, value) { 28239 this._super(key, value); 28240 28241 if (key === "handle") { 28242 this._setHandleClassName(); 28243 } 28244 }, 28245 28246 _setHandleClassName: function () { 28247 var that = this; 28248 this._removeClass(this.element.find(".ui-sortable-handle"), "ui-sortable-handle"); 28249 $.each(this.items, function () { 28250 that._addClass( 28251 this.instance.options.handle ? 28252 this.item.find(this.instance.options.handle) : 28253 this.item, 28254 "ui-sortable-handle" 28255 ); 28256 }); 28257 }, 28258 28259 _destroy: function () { 28260 this._mouseDestroy(); 28261 28262 for (var i = this.items.length - 1; i >= 0; i--) { 28263 this.items[i].item.removeData(this.widgetName + "-item"); 28264 } 28265 28266 return this; 28267 }, 28268 28269 _mouseCapture: function (event, overrideHandle) { 28270 var currentItem = null, 28271 validHandle = false, 28272 that = this; 28273 28274 if (this.reverting) { 28275 return false; 28276 } 28277 28278 if (this.options.disabled || this.options.type === "static") { 28279 return false; 28280 } 28281 28282 //We have to refresh the items data once first 28283 this._refreshItems(event); 28284 28285 //Find out if the clicked node (or one of its parents) is a actual item in this.items 28286 $(event.target).parents().each(function () { 28287 if ($.data(this, that.widgetName + "-item") === that) { 28288 currentItem = $(this); 28289 return false; 28290 } 28291 }); 28292 if ($.data(event.target, that.widgetName + "-item") === that) { 28293 currentItem = $(event.target); 28294 } 28295 28296 if (!currentItem) { 28297 return false; 28298 } 28299 if (this.options.handle && !overrideHandle) { 28300 $(this.options.handle, currentItem).find("*").addBack().each(function () { 28301 if (this === event.target) { 28302 validHandle = true; 28303 } 28304 }); 28305 if (!validHandle) { 28306 return false; 28307 } 28308 } 28309 28310 this.currentItem = currentItem; 28311 this._removeCurrentsFromItems(); 28312 return true; 28313 28314 }, 28315 28316 _mouseStart: function (event, overrideHandle, noActivation) { 28317 28318 var i, body, 28319 o = this.options; 28320 28321 this.currentContainer = this; 28322 28323 //We only need to call refreshPositions, because the refreshItems call has been moved to 28324 // mouseCapture 28325 this.refreshPositions(); 28326 28327 //Prepare the dragged items parent 28328 this.appendTo = $(o.appendTo !== "parent" ? 28329 o.appendTo : 28330 this.currentItem.parent()); 28331 28332 //Create and append the visible helper 28333 this.helper = this._createHelper(event); 28334 28335 //Cache the helper size 28336 this._cacheHelperProportions(); 28337 28338 /* 28339 * - Position generation - 28340 * This block generates everything position related - it's the core of draggables. 28341 */ 28342 28343 //Cache the margins of the original element 28344 this._cacheMargins(); 28345 28346 //The element's absolute position on the page minus margins 28347 this.offset = this.currentItem.offset(); 28348 this.offset = { 28349 top: this.offset.top - this.margins.top, 28350 left: this.offset.left - this.margins.left 28351 }; 28352 28353 $.extend(this.offset, { 28354 click: { //Where the click happened, relative to the element 28355 left: event.pageX - this.offset.left, 28356 top: event.pageY - this.offset.top 28357 }, 28358 28359 // This is a relative to absolute position minus the actual position calculation - 28360 // only used for relative positioned helper 28361 relative: this._getRelativeOffset() 28362 }); 28363 28364 // After we get the helper offset, but before we get the parent offset we can 28365 // change the helper's position to absolute 28366 // TODO: Still need to figure out a way to make relative sorting possible 28367 this.helper.css("position", "absolute"); 28368 this.cssPosition = this.helper.css("position"); 28369 28370 //Adjust the mouse offset relative to the helper if "cursorAt" is supplied 28371 if (o.cursorAt) { 28372 this._adjustOffsetFromHelper(o.cursorAt); 28373 } 28374 28375 //Cache the former DOM position 28376 this.domPosition = { 28377 prev: this.currentItem.prev()[0], 28378 parent: this.currentItem.parent()[0] 28379 }; 28380 28381 // If the helper is not the original, hide the original so it's not playing any role during 28382 // the drag, won't cause anything bad this way 28383 if (this.helper[0] !== this.currentItem[0]) { 28384 this.currentItem.hide(); 28385 } 28386 28387 //Create the placeholder 28388 this._createPlaceholder(); 28389 28390 //Get the next scrolling parent 28391 this.scrollParent = this.placeholder.scrollParent(); 28392 28393 $.extend(this.offset, { 28394 parent: this._getParentOffset() 28395 }); 28396 28397 //Set a containment if given in the options 28398 if (o.containment) { 28399 this._setContainment(); 28400 } 28401 28402 if (o.cursor && o.cursor !== "auto") { // cursor option 28403 body = this.document.find("body"); 28404
vendor: 5,611 bytes, lines 28405-28583
28405 // Support: IE 28406 this.storedCursor = body.css("cursor"); 28407 body.css("cursor", o.cursor); 28408 28409 this.storedStylesheet = 28410 $("<style>*{ cursor: " + o.cursor + " !important; }</style>").appendTo(body); 28411 } 28412 28413 // We need to make sure to grab the zIndex before setting the 28414 // opacity, because setting the opacity to anything lower than 1 28415 // causes the zIndex to change from "auto" to 0. 28416 if (o.zIndex) { // zIndex option 28417 if (this.helper.css("zIndex")) { 28418 this._storedZIndex = this.helper.css("zIndex"); 28419 } 28420 this.helper.css("zIndex", o.zIndex); 28421 } 28422 28423 if (o.opacity) { // opacity option 28424 if (this.helper.css("opacity")) { 28425 this._storedOpacity = this.helper.css("opacity"); 28426 } 28427 this.helper.css("opacity", o.opacity); 28428 } 28429 28430 //Prepare scrolling 28431 if (this.scrollParent[0] !== this.document[0] && 28432 this.scrollParent[0].tagName !== "HTML") { 28433 this.overflowOffset = this.scrollParent.offset(); 28434 } 28435 28436 //Call callbacks 28437 this._trigger("start", event, this._uiHash()); 28438 28439 //Recache the helper size 28440 if (!this._preserveHelperProportions) { 28441 this._cacheHelperProportions(); 28442 } 28443 28444 //Post "activate" events to possible containers 28445 if (!noActivation) { 28446 for (i = this.containers.length - 1; i >= 0; i--) { 28447 this.containers[i]._trigger("activate", event, this._uiHash(this)); 28448 } 28449 } 28450 28451 //Prepare possible droppables 28452 if ($.ui.ddmanager) { 28453 $.ui.ddmanager.current = this; 28454 } 28455 28456 if ($.ui.ddmanager && !o.dropBehaviour) { 28457 $.ui.ddmanager.prepareOffsets(this, event); 28458 } 28459 28460 this.dragging = true; 28461 28462 this._addClass(this.helper, "ui-sortable-helper"); 28463 28464 //Move the helper, if needed 28465 if (!this.helper.parent().is(this.appendTo)) { 28466 this.helper.detach().appendTo(this.appendTo); 28467 28468 //Update position 28469 this.offset.parent = this._getParentOffset(); 28470 } 28471 28472 //Generate the original position 28473 this.position = this.originalPosition = this._generatePosition(event); 28474 this.originalPageX = event.pageX; 28475 this.originalPageY = event.pageY; 28476 this.lastPositionAbs = this.positionAbs = this._convertPositionTo("absolute"); 28477 28478 this._mouseDrag(event); 28479 28480 return true; 28481 28482 }, 28483 28484 _scroll: function (event) { 28485 var o = this.options, 28486 scrolled = false; 28487 28488 if (this.scrollParent[0] !== this.document[0] && 28489 this.scrollParent[0].tagName !== "HTML") { 28490 28491 if ((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - 28492 event.pageY < o.scrollSensitivity) { 28493 this.scrollParent[0].scrollTop = 28494 scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed; 28495 } else if (event.pageY - this.overflowOffset.top < o.scrollSensitivity) { 28496 this.scrollParent[0].scrollTop = 28497 scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed; 28498 } 28499 28500 if ((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - 28501 event.pageX < o.scrollSensitivity) { 28502 this.scrollParent[0].scrollLeft = scrolled = 28503 this.scrollParent[0].scrollLeft + o.scrollSpeed; 28504 } else if (event.pageX - this.overflowOffset.left < o.scrollSensitivity) { 28505 this.scrollParent[0].scrollLeft = scrolled = 28506 this.scrollParent[0].scrollLeft - o.scrollSpeed; 28507 } 28508 28509 } else { 28510 28511 if (event.pageY - this.document.scrollTop() < o.scrollSensitivity) { 28512 scrolled = this.document.scrollTop(this.document.scrollTop() - o.scrollSpeed); 28513 } else if (this.window.height() - (event.pageY - this.document.scrollTop()) < 28514 o.scrollSensitivity) { 28515 scrolled = this.document.scrollTop(this.document.scrollTop() + o.scrollSpeed); 28516 } 28517 28518 if (event.pageX - this.document.scrollLeft() < o.scrollSensitivity) { 28519 scrolled = this.document.scrollLeft( 28520 this.document.scrollLeft() - o.scrollSpeed 28521 ); 28522 } else if (this.window.width() - (event.pageX - this.document.scrollLeft()) < 28523 o.scrollSensitivity) { 28524 scrolled = this.document.scrollLeft( 28525 this.document.scrollLeft() + o.scrollSpeed 28526 ); 28527 } 28528 28529 } 28530 28531 return scrolled; 28532 }, 28533 28534 _mouseDrag: function (event) { 28535 var i, item, itemElement, intersection, 28536 o = this.options; 28537 28538 //Compute the helpers position 28539 this.position = this._generatePosition(event); 28540 this.positionAbs = this._convertPositionTo("absolute"); 28541 28542 //Set the helper position 28543 if (!this.options.axis || this.options.axis !== "y") { 28544 this.helper[0].style.left = this.position.left + "px"; 28545 } 28546 if (!this.options.axis || this.options.axis !== "x") { 28547 this.helper[0].style.top = this.position.top + "px"; 28548 } 28549 28550 //Do scrolling 28551 if (o.scroll) { 28552 if (this._scroll(event) !== false) { 28553 28554 //Update item positions used in position checks 28555 this._refreshItemPositions(true); 28556 28557 if ($.ui.ddmanager && !o.dropBehaviour) { 28558 $.ui.ddmanager.prepareOffsets(this, event); 28559 } 28560 } 28561 } 28562 28563 this.dragDirection = { 28564 vertical: this._getDragVerticalDirection(), 28565 horizontal: this._getDragHorizontalDirection() 28566 }; 28567 28568 //Rearrange 28569 for (i = this.items.length - 1; i >= 0; i--) { 28570 28571 //Cache variables and intersection, continue if no intersection 28572 item = this.items[i]; 28573 itemElement = item.item[0]; 28574 intersection = this._intersectsWithPointer(item); 28575 if (!intersection) { 28576 continue; 28577 } 28578 28579 // Only put the placeholder inside the current Container, skip all 28580 // items from other containers. This works because when moving 28581 // an item from one container to another the 28582 // currentContainer is switched before the placeholder is moved. 28583 //
vendor: 15,297 bytes, lines 28584-29094
28584 // Without this, moving items in "sub-sortables" can cause 28585 // the placeholder to jitter between the outer and inner container. 28586 if (item.instance !== this.currentContainer) { 28587 continue; 28588 } 28589 28590 // Cannot intersect with itself 28591 // no useless actions that have been done before 28592 // no action if the item moved is the parent of the item checked 28593 if (itemElement !== this.currentItem[0] && 28594 this.placeholder[intersection === 1 ? 28595 "next" : "prev"]()[0] !== itemElement && 28596 !$.contains(this.placeholder[0], itemElement) && 28597 (this.options.type === "semi-dynamic" ? 28598 !$.contains(this.element[0], itemElement) : 28599 true 28600 ) 28601 ) { 28602 28603 this.direction = intersection === 1 ? "down" : "up"; 28604 28605 if (this.options.tolerance === "pointer" || 28606 this._intersectsWithSides(item)) { 28607 this._rearrange(event, item); 28608 } else { 28609 break; 28610 } 28611 28612 this._trigger("change", event, this._uiHash()); 28613 break; 28614 } 28615 } 28616 28617 //Post events to containers 28618 this._contactContainers(event); 28619 28620 //Interconnect with droppables 28621 if ($.ui.ddmanager) { 28622 $.ui.ddmanager.drag(this, event); 28623 } 28624 28625 //Call callbacks 28626 this._trigger("sort", event, this._uiHash()); 28627 28628 this.lastPositionAbs = this.positionAbs; 28629 return false; 28630 28631 }, 28632 28633 _mouseStop: function (event, noPropagation) { 28634 28635 if (!event) { 28636 return; 28637 } 28638 28639 //If we are using droppables, inform the manager about the drop 28640 if ($.ui.ddmanager && !this.options.dropBehaviour) { 28641 $.ui.ddmanager.drop(this, event); 28642 } 28643 28644 if (this.options.revert) { 28645 var that = this, 28646 cur = this.placeholder.offset(), 28647 axis = this.options.axis, 28648 animation = {}; 28649 28650 if (!axis || axis === "x") { 28651 animation.left = cur.left - this.offset.parent.left - this.margins.left + 28652 (this.offsetParent[0] === this.document[0].body ? 28653 0 : 28654 this.offsetParent[0].scrollLeft 28655 ); 28656 } 28657 if (!axis || axis === "y") { 28658 animation.top = cur.top - this.offset.parent.top - this.margins.top + 28659 (this.offsetParent[0] === this.document[0].body ? 28660 0 : 28661 this.offsetParent[0].scrollTop 28662 ); 28663 } 28664 this.reverting = true; 28665 $(this.helper).animate( 28666 animation, 28667 parseInt(this.options.revert, 10) || 500, 28668 function () { 28669 that._clear(event); 28670 } 28671 ); 28672 } else { 28673 this._clear(event, noPropagation); 28674 } 28675 28676 return false; 28677 28678 }, 28679 28680 cancel: function () { 28681 28682 if (this.dragging) { 28683 28684 this._mouseUp(new $.Event("mouseup", { target: null })); 28685 28686 if (this.options.helper === "original") { 28687 this.currentItem.css(this._storedCSS); 28688 this._removeClass(this.currentItem, "ui-sortable-helper"); 28689 } else { 28690 this.currentItem.show(); 28691 } 28692 28693 //Post deactivating events to containers 28694 for (var i = this.containers.length - 1; i >= 0; i--) { 28695 this.containers[i]._trigger("deactivate", null, this._uiHash(this)); 28696 if (this.containers[i].containerCache.over) { 28697 this.containers[i]._trigger("out", null, this._uiHash(this)); 28698 this.containers[i].containerCache.over = 0; 28699 } 28700 } 28701 28702 } 28703 28704 if (this.placeholder) { 28705 28706 //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, 28707 // it unbinds ALL events from the original node! 28708 if (this.placeholder[0].parentNode) { 28709 this.placeholder[0].parentNode.removeChild(this.placeholder[0]); 28710 } 28711 if (this.options.helper !== "original" && this.helper && 28712 this.helper[0].parentNode) { 28713 this.helper.remove(); 28714 } 28715 28716 $.extend(this, { 28717 helper: null, 28718 dragging: false, 28719 reverting: false, 28720 _noFinalSort: null 28721 }); 28722 28723 if (this.domPosition.prev) { 28724 $(this.domPosition.prev).after(this.currentItem); 28725 } else { 28726 $(this.domPosition.parent).prepend(this.currentItem); 28727 } 28728 } 28729 28730 return this; 28731 28732 }, 28733 28734 serialize: function (o) { 28735 28736 var items = this._getItemsAsjQuery(o && o.connected), 28737 str = []; 28738 o = o || {}; 28739 28740 $(items).each(function () { 28741 var res = ($(o.item || this).attr(o.attribute || "id") || "") 28742 .match(o.expression || (/(.+)[\-=_](.+)/)); 28743 if (res) { 28744 str.push( 28745 (o.key || res[1] + "[]") + 28746 "=" + (o.key && o.expression ? res[1] : res[2])); 28747 } 28748 }); 28749 28750 if (!str.length && o.key) { 28751 str.push(o.key + "="); 28752 } 28753 28754 return str.join("&"); 28755 28756 }, 28757 28758 toArray: function (o) { 28759 28760 var items = this._getItemsAsjQuery(o && o.connected), 28761 ret = []; 28762 28763 o = o || {}; 28764 28765 items.each(function () { 28766 ret.push($(o.item || this).attr(o.attribute || "id") || ""); 28767 }); 28768 return ret; 28769 28770 }, 28771 28772 /* Be careful with the following core functions */ 28773 _intersectsWith: function (item) { 28774 28775 var x1 = this.positionAbs.left, 28776 x2 = x1 + this.helperProportions.width, 28777 y1 = this.positionAbs.top, 28778 y2 = y1 + this.helperProportions.height, 28779 l = item.left, 28780 r = l + item.width, 28781 t = item.top, 28782 b = t + item.height, 28783 dyClick = this.offset.click.top, 28784 dxClick = this.offset.click.left, 28785 isOverElementHeight = (this.options.axis === "x") || ((y1 + dyClick) > t && 28786 (y1 + dyClick) < b), 28787 isOverElementWidth = (this.options.axis === "y") || ((x1 + dxClick) > l && 28788 (x1 + dxClick) < r), 28789 isOverElement = isOverElementHeight && isOverElementWidth; 28790 28791 if (this.options.tolerance === "pointer" || 28792 this.options.forcePointerForContainers || 28793 (this.options.tolerance !== "pointer" && 28794 this.helperProportions[this.floating ? "width" : "height"] > 28795 item[this.floating ? "width" : "height"]) 28796 ) { 28797 return isOverElement; 28798 } else { 28799 28800 return (l < x1 + (this.helperProportions.width / 2) && // Right Half 28801 x2 - (this.helperProportions.width / 2) < r && // Left Half 28802 t < y1 + (this.helperProportions.height / 2) && // Bottom Half 28803 y2 - (this.helperProportions.height / 2) < b); // Top Half 28804 28805 } 28806 }, 28807 28808 _intersectsWithPointer: function (item) { 28809 var verticalDirection, horizontalDirection, 28810 isOverElementHeight = (this.options.axis === "x") || 28811 this._isOverAxis( 28812 this.positionAbs.top + this.offset.click.top, item.top, item.height), 28813 isOverElementWidth = (this.options.axis === "y") || 28814 this._isOverAxis( 28815 this.positionAbs.left + this.offset.click.left, item.left, item.width), 28816 isOverElement = isOverElementHeight && isOverElementWidth; 28817 28818 if (!isOverElement) { 28819 return false; 28820 } 28821 28822 verticalDirection = this.dragDirection.vertical; 28823 horizontalDirection = this.dragDirection.horizontal; 28824 28825 return this.floating ? 28826 ((horizontalDirection === "right" || verticalDirection === "down") ? 2 : 1) : 28827 (verticalDirection && (verticalDirection === "down" ? 2 : 1)); 28828 28829 }, 28830 28831 _intersectsWithSides: function (item) { 28832 28833 var isOverBottomHalf = this._isOverAxis(this.positionAbs.top + 28834 this.offset.click.top, item.top + (item.height / 2), item.height), 28835 isOverRightHalf = this._isOverAxis(this.positionAbs.left + 28836 this.offset.click.left, item.left + (item.width / 2), item.width), 28837 verticalDirection = this.dragDirection.vertical, 28838 horizontalDirection = this.dragDirection.horizontal; 28839 28840 if (this.floating && horizontalDirection) { 28841 return ((horizontalDirection === "right" && isOverRightHalf) || 28842 (horizontalDirection === "left" && !isOverRightHalf)); 28843 } else { 28844 return verticalDirection && ((verticalDirection === "down" && isOverBottomHalf) || 28845 (verticalDirection === "up" && !isOverBottomHalf)); 28846 } 28847 28848 }, 28849 28850 _getDragVerticalDirection: function () { 28851 var delta = this.positionAbs.top - this.lastPositionAbs.top; 28852 return delta !== 0 && (delta > 0 ? "down" : "up"); 28853 }, 28854 28855 _getDragHorizontalDirection: function () { 28856 var delta = this.positionAbs.left - this.lastPositionAbs.left; 28857 return delta !== 0 && (delta > 0 ? "right" : "left"); 28858 }, 28859 28860 refresh: function (event) { 28861 this._refreshItems(event); 28862 this._setHandleClassName(); 28863 this.refreshPositions(); 28864 return this; 28865 }, 28866 28867 _connectWith: function () { 28868 var options = this.options; 28869 return options.connectWith.constructor === String ? 28870 [options.connectWith] : 28871 options.connectWith; 28872 }, 28873 28874 _getItemsAsjQuery: function (connected) { 28875 28876 var i, j, cur, inst, 28877 items = [], 28878 queries = [], 28879 connectWith = this._connectWith(); 28880 28881 if (connectWith && connected) { 28882 for (i = connectWith.length - 1; i >= 0; i--) { 28883 cur = $(connectWith[i], this.document[0]); 28884 for (j = cur.length - 1; j >= 0; j--) { 28885 inst = $.data(cur[j], this.widgetFullName); 28886 if (inst && inst !== this && !inst.options.disabled) { 28887 queries.push([typeof inst.options.items === "function" ? 28888 inst.options.items.call(inst.element) : 28889 $(inst.options.items, inst.element) 28890 .not(".ui-sortable-helper") 28891 .not(".ui-sortable-placeholder"), inst]); 28892 } 28893 } 28894 } 28895 } 28896 28897 queries.push([typeof this.options.items === "function" ? 28898 this.options.items 28899 .call(this.element, null, { options: this.options, item: this.currentItem }) : 28900 $(this.options.items, this.element) 28901 .not(".ui-sortable-helper") 28902 .not(".ui-sortable-placeholder"), this]); 28903 28904 function addItems() { 28905 items.push(this); 28906 } 28907 for (i = queries.length - 1; i >= 0; i--) { 28908 queries[i][0].each(addItems); 28909 } 28910 28911 return $(items); 28912 28913 }, 28914 28915 _removeCurrentsFromItems: function () { 28916 28917 var list = this.currentItem.find(":data(" + this.widgetName + "-item)"); 28918 28919 this.items = $.grep(this.items, function (item) { 28920 for (var j = 0; j < list.length; j++) { 28921 if (list[j] === item.item[0]) { 28922 return false; 28923 } 28924 } 28925 return true; 28926 }); 28927 28928 }, 28929 28930 _refreshItems: function (event) { 28931 28932 this.items = []; 28933 this.containers = [this]; 28934 28935 var i, j, cur, inst, targetData, _queries, item, queriesLength, 28936 items = this.items, 28937 queries = [[typeof this.options.items === "function" ? 28938 this.options.items.call(this.element[0], event, { item: this.currentItem }) : 28939 $(this.options.items, this.element), this]], 28940 connectWith = this._connectWith(); 28941 28942 //Shouldn't be run the first time through due to massive slow-down 28943 if (connectWith && this.ready) { 28944 for (i = connectWith.length - 1; i >= 0; i--) { 28945 cur = $(connectWith[i], this.document[0]); 28946 for (j = cur.length - 1; j >= 0; j--) { 28947 inst = $.data(cur[j], this.widgetFullName); 28948 if (inst && inst !== this && !inst.options.disabled) { 28949 queries.push([typeof inst.options.items === "function" ? 28950 inst.options.items 28951 .call(inst.element[0], event, { item: this.currentItem }) : 28952 $(inst.options.items, inst.element), inst]); 28953 this.containers.push(inst); 28954 } 28955 } 28956 } 28957 } 28958 28959 for (i = queries.length - 1; i >= 0; i--) { 28960 targetData = queries[i][1]; 28961 _queries = queries[i][0]; 28962 28963 for (j = 0, queriesLength = _queries.length; j < queriesLength; j++) { 28964 item = $(_queries[j]); 28965 28966 // Data for target checking (mouse manager) 28967 item.data(this.widgetName + "-item", targetData); 28968 28969 items.push({ 28970 item: item, 28971 instance: targetData, 28972 width: 0, height: 0, 28973 left: 0, top: 0 28974 }); 28975 } 28976 } 28977 28978 }, 28979 28980 _refreshItemPositions: function (fast) { 28981 var i, item, t, p; 28982 28983 for (i = this.items.length - 1; i >= 0; i--) { 28984 item = this.items[i]; 28985 28986 //We ignore calculating positions of all connected containers when we're not over them 28987 if (this.currentContainer && item.instance !== this.currentContainer && 28988 item.item[0] !== this.currentItem[0]) { 28989 continue; 28990 } 28991 28992 t = this.options.toleranceElement ? 28993 $(this.options.toleranceElement, item.item) : 28994 item.item; 28995 28996 if (!fast) { 28997 item.width = t.outerWidth(); 28998 item.height = t.outerHeight(); 28999 } 29000 29001 p = t.offset(); 29002 item.left = p.left; 29003 item.top = p.top; 29004 } 29005 }, 29006 29007 refreshPositions: function (fast) { 29008 29009 // Determine whether items are being displayed horizontally 29010 this.floating = this.items.length ? 29011 this.options.axis === "x" || this._isFloating(this.items[0].item) : 29012 false; 29013 29014 // This has to be redone because due to the item being moved out/into the offsetParent, 29015 // the offsetParent's position will change 29016 if (this.offsetParent && this.helper) { 29017 this.offset.parent = this._getParentOffset(); 29018 } 29019 29020 this._refreshItemPositions(fast); 29021 29022 var i, p; 29023 29024 if (this.options.custom && this.options.custom.refreshContainers) { 29025 this.options.custom.refreshContainers.call(this); 29026 } else { 29027 for (i = this.containers.length - 1; i >= 0; i--) { 29028 p = this.containers[i].element.offset(); 29029 this.containers[i].containerCache.left = p.left; 29030 this.containers[i].containerCache.top = p.top; 29031 this.containers[i].containerCache.width = 29032 this.containers[i].element.outerWidth(); 29033 this.containers[i].containerCache.height = 29034 this.containers[i].element.outerHeight(); 29035 } 29036 } 29037 29038 return this; 29039 }, 29040 29041 _createPlaceholder: function (that) { 29042 that = that || this; 29043 var className, nodeName, 29044 o = that.options; 29045 29046 if (!o.placeholder || o.placeholder.constructor === String) { 29047 className = o.placeholder; 29048 nodeName = that.currentItem[0].nodeName.toLowerCase(); 29049 o.placeholder = { 29050 element: function () { 29051 29052 var element = $("<" + nodeName + ">", that.document[0]); 29053 29054 that._addClass(element, "ui-sortable-placeholder", 29055 className || that.currentItem[0].className) 29056 ._removeClass(element, "ui-sortable-helper"); 29057 29058 if (nodeName === "tbody") { 29059 that._createTrPlaceholder( 29060 that.currentItem.find("tr").eq(0), 29061 $("<tr>", that.document[0]).appendTo(element) 29062 ); 29063 } else if (nodeName === "tr") { 29064 that._createTrPlaceholder(that.currentItem, element); 29065 } else if (nodeName === "img") { 29066 element.attr("src", that.currentItem.attr("src")); 29067 } 29068 29069 if (!className) { 29070 element.css("visibility", "hidden"); 29071 } 29072 29073 return element; 29074 }, 29075 update: function (container, p) { 29076 29077 // 1. If a className is set as 'placeholder option, we don't force sizes - 29078 // the class is responsible for that 29079 // 2. The option 'forcePlaceholderSize can be enabled to force it even if a 29080 // class name is specified 29081 if (className && !o.forcePlaceholderSize) { 29082 return; 29083 } 29084 29085 // If the element doesn't have a actual height or width by itself (without 29086 // styles coming from a stylesheet), it receives the inline height and width 29087 // from the dragged item. Or, if it's a tbody or tr, it's going to have a height 29088 // anyway since we're populating them with <td>s above, but they're unlikely to 29089 // be the correct height on their own if the row heights are dynamic, so we'll 29090 // always assign the height of the dragged item given forcePlaceholderSize 29091 // is true. 29092 if (!p.height() || (o.forcePlaceholderSize && 29093 (nodeName === "tbody" || nodeName === "tr"))) { 29094 p.height(
vendor: 12,083 bytes, lines 29095-29454
29095 that.currentItem.innerHeight() - 29096 parseInt(that.currentItem.css("paddingTop") || 0, 10) - 29097 parseInt(that.currentItem.css("paddingBottom") || 0, 10)); 29098 } 29099 if (!p.width()) { 29100 p.width( 29101 that.currentItem.innerWidth() - 29102 parseInt(that.currentItem.css("paddingLeft") || 0, 10) - 29103 parseInt(that.currentItem.css("paddingRight") || 0, 10)); 29104 } 29105 } 29106 }; 29107 } 29108 29109 //Create the placeholder 29110 that.placeholder = $(o.placeholder.element.call(that.element, that.currentItem)); 29111 29112 //Append it after the actual current item 29113 that.currentItem.after(that.placeholder); 29114 29115 //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317) 29116 o.placeholder.update(that, that.placeholder); 29117 29118 }, 29119 29120 _createTrPlaceholder: function (sourceTr, targetTr) { 29121 var that = this; 29122 29123 sourceTr.children().each(function () { 29124 $("<td> </td>", that.document[0]) 29125 .attr("colspan", $(this).attr("colspan") || 1) 29126 .appendTo(targetTr); 29127 }); 29128 }, 29129 29130 _contactContainers: function (event) { 29131 var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom, 29132 floating, axis, 29133 innermostContainer = null, 29134 innermostIndex = null; 29135 29136 // Get innermost container that intersects with item 29137 for (i = this.containers.length - 1; i >= 0; i--) { 29138 29139 // Never consider a container that's located within the item itself 29140 if ($.contains(this.currentItem[0], this.containers[i].element[0])) { 29141 continue; 29142 } 29143 29144 if (this._intersectsWith(this.containers[i].containerCache)) { 29145 29146 // If we've already found a container and it's more "inner" than this, then continue 29147 if (innermostContainer && 29148 $.contains( 29149 this.containers[i].element[0], 29150 innermostContainer.element[0])) { 29151 continue; 29152 } 29153 29154 innermostContainer = this.containers[i]; 29155 innermostIndex = i; 29156 29157 } else { 29158 29159 // container doesn't intersect. trigger "out" event if necessary 29160 if (this.containers[i].containerCache.over) { 29161 this.containers[i]._trigger("out", event, this._uiHash(this)); 29162 this.containers[i].containerCache.over = 0; 29163 } 29164 } 29165 29166 } 29167 29168 // If no intersecting containers found, return 29169 if (!innermostContainer) { 29170 return; 29171 } 29172 29173 // Move the item into the container if it's not there already 29174 if (this.containers.length === 1) { 29175 if (!this.containers[innermostIndex].containerCache.over) { 29176 this.containers[innermostIndex]._trigger("over", event, this._uiHash(this)); 29177 this.containers[innermostIndex].containerCache.over = 1; 29178 } 29179 } else { 29180 29181 // When entering a new container, we will find the item with the least distance and 29182 // append our item near it 29183 dist = 10000; 29184 itemWithLeastDistance = null; 29185 floating = innermostContainer.floating || this._isFloating(this.currentItem); 29186 posProperty = floating ? "left" : "top"; 29187 sizeProperty = floating ? "width" : "height"; 29188 axis = floating ? "pageX" : "pageY"; 29189 29190 for (j = this.items.length - 1; j >= 0; j--) { 29191 if (!$.contains( 29192 this.containers[innermostIndex].element[0], this.items[j].item[0]) 29193 ) { 29194 continue; 29195 } 29196 if (this.items[j].item[0] === this.currentItem[0]) { 29197 continue; 29198 } 29199 29200 cur = this.items[j].item.offset()[posProperty]; 29201 nearBottom = false; 29202 if (event[axis] - cur > this.items[j][sizeProperty] / 2) { 29203 nearBottom = true; 29204 } 29205 29206 if (Math.abs(event[axis] - cur) < dist) { 29207 dist = Math.abs(event[axis] - cur); 29208 itemWithLeastDistance = this.items[j]; 29209 this.direction = nearBottom ? "up" : "down"; 29210 } 29211 } 29212 29213 //Check if dropOnEmpty is enabled 29214 if (!itemWithLeastDistance && !this.options.dropOnEmpty) { 29215 return; 29216 } 29217 29218 if (this.currentContainer === this.containers[innermostIndex]) { 29219 if (!this.currentContainer.containerCache.over) { 29220 this.containers[innermostIndex]._trigger("over", event, this._uiHash()); 29221 this.currentContainer.containerCache.over = 1; 29222 } 29223 return; 29224 } 29225 29226 if (itemWithLeastDistance) { 29227 this._rearrange(event, itemWithLeastDistance, null, true); 29228 } else { 29229 this._rearrange(event, null, this.containers[innermostIndex].element, true); 29230 } 29231 this._trigger("change", event, this._uiHash()); 29232 this.containers[innermostIndex]._trigger("change", event, this._uiHash(this)); 29233 this.currentContainer = this.containers[innermostIndex]; 29234 29235 //Update the placeholder 29236 this.options.placeholder.update(this.currentContainer, this.placeholder); 29237 29238 //Update scrollParent 29239 this.scrollParent = this.placeholder.scrollParent(); 29240 29241 //Update overflowOffset 29242 if (this.scrollParent[0] !== this.document[0] && 29243 this.scrollParent[0].tagName !== "HTML") { 29244 this.overflowOffset = this.scrollParent.offset(); 29245 } 29246 29247 this.containers[innermostIndex]._trigger("over", event, this._uiHash(this)); 29248 this.containers[innermostIndex].containerCache.over = 1; 29249 } 29250 29251 }, 29252 29253 _createHelper: function (event) { 29254 29255 var o = this.options, 29256 helper = typeof o.helper === "function" ? 29257 $(o.helper.apply(this.element[0], [event, this.currentItem])) : 29258 (o.helper === "clone" ? this.currentItem.clone() : this.currentItem); 29259 29260 //Add the helper to the DOM if that didn't happen already 29261 if (!helper.parents("body").length) { 29262 this.appendTo[0].appendChild(helper[0]); 29263 } 29264 29265 if (helper[0] === this.currentItem[0]) { 29266 this._storedCSS = { 29267 width: this.currentItem[0].style.width, 29268 height: this.currentItem[0].style.height, 29269 position: this.currentItem.css("position"), 29270 top: this.currentItem.css("top"), 29271 left: this.currentItem.css("left") 29272 }; 29273 } 29274 29275 if (!helper[0].style.width || o.forceHelperSize) { 29276 helper.width(this.currentItem.width()); 29277 } 29278 if (!helper[0].style.height || o.forceHelperSize) { 29279 helper.height(this.currentItem.height()); 29280 } 29281 29282 return helper; 29283 29284 }, 29285 29286 _adjustOffsetFromHelper: function (obj) { 29287 if (typeof obj === "string") { 29288 obj = obj.split(" "); 29289 } 29290 if (Array.isArray(obj)) { 29291 obj = { left: +obj[0], top: +obj[1] || 0 }; 29292 } 29293 if ("left" in obj) { 29294 this.offset.click.left = obj.left + this.margins.left; 29295 } 29296 if ("right" in obj) { 29297 this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; 29298 } 29299 if ("top" in obj) { 29300 this.offset.click.top = obj.top + this.margins.top; 29301 } 29302 if ("bottom" in obj) { 29303 this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; 29304 } 29305 }, 29306 29307 _getParentOffset: function () { 29308 29309 //Get the offsetParent and cache its position 29310 this.offsetParent = this.helper.offsetParent(); 29311 var po = this.offsetParent.offset(); 29312 29313 // This is a special case where we need to modify a offset calculated on start, since the 29314 // following happened: 29315 // 1. The position of the helper is absolute, so it's position is calculated based on the 29316 // next positioned parent 29317 // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't 29318 // the document, which means that the scroll is included in the initial calculation of the 29319 // offset of the parent, and never recalculated upon drag 29320 if (this.cssPosition === "absolute" && this.scrollParent[0] !== this.document[0] && 29321 $.contains(this.scrollParent[0], this.offsetParent[0])) { 29322 po.left += this.scrollParent.scrollLeft(); 29323 po.top += this.scrollParent.scrollTop(); 29324 } 29325 29326 // This needs to be actually done for all browsers, since pageX/pageY includes this 29327 // information with an ugly IE fix 29328 if (this.offsetParent[0] === this.document[0].body || 29329 (this.offsetParent[0].tagName && 29330 this.offsetParent[0].tagName.toLowerCase() === "html" && $.ui.ie)) { 29331 po = { top: 0, left: 0 }; 29332 } 29333 29334 return { 29335 top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0), 29336 left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0) 29337 }; 29338 29339 }, 29340 29341 _getRelativeOffset: function () { 29342 29343 if (this.cssPosition === "relative") { 29344 var p = this.currentItem.position(); 29345 return { 29346 top: p.top - (parseInt(this.helper.css("top"), 10) || 0) + 29347 this.scrollParent.scrollTop(), 29348 left: p.left - (parseInt(this.helper.css("left"), 10) || 0) + 29349 this.scrollParent.scrollLeft() 29350 }; 29351 } else { 29352 return { top: 0, left: 0 }; 29353 } 29354 29355 }, 29356 29357 _cacheMargins: function () { 29358 this.margins = { 29359 left: (parseInt(this.currentItem.css("marginLeft"), 10) || 0), 29360 top: (parseInt(this.currentItem.css("marginTop"), 10) || 0) 29361 }; 29362 }, 29363 29364 _cacheHelperProportions: function () { 29365 this.helperProportions = { 29366 width: this.helper.outerWidth(), 29367 height: this.helper.outerHeight() 29368 }; 29369 }, 29370 29371 _setContainment: function () { 29372 29373 var ce, co, over, 29374 o = this.options; 29375 if (o.containment === "parent") { 29376 o.containment = this.helper[0].parentNode; 29377 } 29378 if (o.containment === "document" || o.containment === "window") { 29379 this.containment = [ 29380 0 - this.offset.relative.left - this.offset.parent.left, 29381 0 - this.offset.relative.top - this.offset.parent.top, 29382 o.containment === "document" ? 29383 this.document.width() : 29384 this.window.width() - this.helperProportions.width - this.margins.left, 29385 (o.containment === "document" ? 29386 (this.document.height() || document.body.parentNode.scrollHeight) : 29387 this.window.height() || this.document[0].body.parentNode.scrollHeight 29388 ) - this.helperProportions.height - this.margins.top 29389 ]; 29390 } 29391 29392 if (!(/^(document|window|parent)$/).test(o.containment)) { 29393 ce = $(o.containment)[0]; 29394 co = $(o.containment).offset(); 29395 over = ($(ce).css("overflow") !== "hidden"); 29396 29397 this.containment = [ 29398 co.left + (parseInt($(ce).css("borderLeftWidth"), 10) || 0) + 29399 (parseInt($(ce).css("paddingLeft"), 10) || 0) - this.margins.left, 29400 co.top + (parseInt($(ce).css("borderTopWidth"), 10) || 0) + 29401 (parseInt($(ce).css("paddingTop"), 10) || 0) - this.margins.top, 29402 co.left + (over ? Math.max(ce.scrollWidth, ce.offsetWidth) : ce.offsetWidth) - 29403 (parseInt($(ce).css("borderLeftWidth"), 10) || 0) - 29404 (parseInt($(ce).css("paddingRight"), 10) || 0) - 29405 this.helperProportions.width - this.margins.left, 29406 co.top + (over ? Math.max(ce.scrollHeight, ce.offsetHeight) : ce.offsetHeight) - 29407 (parseInt($(ce).css("borderTopWidth"), 10) || 0) - 29408 (parseInt($(ce).css("paddingBottom"), 10) || 0) - 29409 this.helperProportions.height - this.margins.top 29410 ]; 29411 } 29412 29413 }, 29414 29415 _convertPositionTo: function (d, pos) { 29416 29417 if (!pos) { 29418 pos = this.position; 29419 } 29420 var mod = d === "absolute" ? 1 : -1, 29421 scroll = this.cssPosition === "absolute" && 29422 !(this.scrollParent[0] !== this.document[0] && 29423 $.contains(this.scrollParent[0], this.offsetParent[0])) ? 29424 this.offsetParent : 29425 this.scrollParent, 29426 scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); 29427 29428 return { 29429 top: ( 29430 29431 // The absolute mouse position 29432 pos.top + 29433 29434 // Only for relative positioned nodes: Relative offset from element to offset parent 29435 this.offset.relative.top * mod + 29436 29437 // The offsetParent's offset without borders (offset + border) 29438 this.offset.parent.top * mod - 29439 ((this.cssPosition === "fixed" ? 29440 -this.scrollParent.scrollTop() : 29441 (scrollIsRootNode ? 0 : scroll.scrollTop())) * mod) 29442 ), 29443 left: ( 29444 29445 // The absolute mouse position 29446 pos.left + 29447 29448 // Only for relative positioned nodes: Relative offset from element to offset parent 29449 this.offset.relative.left * mod + 29450 29451 // The offsetParent's offset without borders (offset + border) 29452 this.offset.parent.left * mod - 29453 ((this.cssPosition === "fixed" ? 29454 -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 :
vendor: 4,583 bytes, lines 29455-29589
29455 scroll.scrollLeft()) * mod) 29456 ) 29457 }; 29458 29459 }, 29460 29461 _generatePosition: function (event) { 29462 29463 var top, left, 29464 o = this.options, 29465 pageX = event.pageX, 29466 pageY = event.pageY, 29467 scroll = this.cssPosition === "absolute" && 29468 !(this.scrollParent[0] !== this.document[0] && 29469 $.contains(this.scrollParent[0], this.offsetParent[0])) ? 29470 this.offsetParent : 29471 this.scrollParent, 29472 scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); 29473 29474 // This is another very weird special case that only happens for relative elements: 29475 // 1. If the css position is relative 29476 // 2. and the scroll parent is the document or similar to the offset parent 29477 // we have to refresh the relative offset during the scroll so there are no jumps 29478 if (this.cssPosition === "relative" && !(this.scrollParent[0] !== this.document[0] && 29479 this.scrollParent[0] !== this.offsetParent[0])) { 29480 this.offset.relative = this._getRelativeOffset(); 29481 } 29482 29483 /* 29484 * - Position constraining - 29485 * Constrain the position to a mix of grid, containment. 29486 */ 29487 29488 if (this.originalPosition) { //If we are not dragging yet, we won't check for options 29489 29490 if (this.containment) { 29491 if (event.pageX - this.offset.click.left < this.containment[0]) { 29492 pageX = this.containment[0] + this.offset.click.left; 29493 } 29494 if (event.pageY - this.offset.click.top < this.containment[1]) { 29495 pageY = this.containment[1] + this.offset.click.top; 29496 } 29497 if (event.pageX - this.offset.click.left > this.containment[2]) { 29498 pageX = this.containment[2] + this.offset.click.left; 29499 } 29500 if (event.pageY - this.offset.click.top > this.containment[3]) { 29501 pageY = this.containment[3] + this.offset.click.top; 29502 } 29503 } 29504 29505 if (o.grid) { 29506 top = this.originalPageY + Math.round((pageY - this.originalPageY) / 29507 o.grid[1]) * o.grid[1]; 29508 pageY = this.containment ? 29509 ((top - this.offset.click.top >= this.containment[1] && 29510 top - this.offset.click.top <= this.containment[3]) ? 29511 top : 29512 ((top - this.offset.click.top >= this.containment[1]) ? 29513 top - o.grid[1] : top + o.grid[1])) : 29514 top; 29515 29516 left = this.originalPageX + Math.round((pageX - this.originalPageX) / 29517 o.grid[0]) * o.grid[0]; 29518 pageX = this.containment ? 29519 ((left - this.offset.click.left >= this.containment[0] && 29520 left - this.offset.click.left <= this.containment[2]) ? 29521 left : 29522 ((left - this.offset.click.left >= this.containment[0]) ? 29523 left - o.grid[0] : left + o.grid[0])) : 29524 left; 29525 } 29526 29527 } 29528 29529 return { 29530 top: ( 29531 29532 // The absolute mouse position 29533 pageY - 29534 29535 // Click offset (relative to the element) 29536 this.offset.click.top - 29537 29538 // Only for relative positioned nodes: Relative offset from element to offset parent 29539 this.offset.relative.top - 29540 29541 // The offsetParent's offset without borders (offset + border) 29542 this.offset.parent.top + 29543 ((this.cssPosition === "fixed" ? 29544 -this.scrollParent.scrollTop() : 29545 (scrollIsRootNode ? 0 : scroll.scrollTop()))) 29546 ), 29547 left: ( 29548 29549 // The absolute mouse position 29550 pageX - 29551 29552 // Click offset (relative to the element) 29553 this.offset.click.left - 29554 29555 // Only for relative positioned nodes: Relative offset from element to offset parent 29556 this.offset.relative.left - 29557 29558 // The offsetParent's offset without borders (offset + border) 29559 this.offset.parent.left + 29560 ((this.cssPosition === "fixed" ? 29561 -this.scrollParent.scrollLeft() : 29562 scrollIsRootNode ? 0 : scroll.scrollLeft())) 29563 ) 29564 }; 29565 29566 }, 29567 29568 _rearrange: function (event, i, a, hardRefresh) { 29569 29570 if (a) { 29571 a[0].appendChild(this.placeholder[0]); 29572 } else { 29573 i.item[0].parentNode.insertBefore(this.placeholder[0], 29574 (this.direction === "down" ? i.item[0] : i.item[0].nextSibling)); 29575 } 29576 29577 //Various things done here to improve the performance: 29578 // 1. we create a setTimeout, that calls refreshPositions 29579 // 2. on the instance, we have a counter variable, that get's higher after every append 29580 // 3. on the local scope, we copy the counter variable, and check in the timeout, 29581 // if it's still the same 29582 // 4. this lets only the last addition to the timeout stack through 29583 this.counter = this.counter ? ++this.counter : 1; 29584 var counter = this.counter; 29585 29586 this._delay(function () { 29587 if (counter === this.counter) { 29588 29589 //Precompute after each DOM insertion, NOT on mousemove
vendor: 31,598 bytes, lines 29590-30752
29590 this.refreshPositions(!hardRefresh); 29591 } 29592 }); 29593 29594 }, 29595 29596 _clear: function (event, noPropagation) { 29597 29598 this.reverting = false; 29599 29600 // We delay all events that have to be triggered to after the point where the placeholder 29601 // has been removed and everything else normalized again 29602 var i, 29603 delayedTriggers = []; 29604 29605 // We first have to update the dom position of the actual currentItem 29606 // Note: don't do it if the current item is already removed (by a user), or it gets 29607 // reappended (see #4088) 29608 if (!this._noFinalSort && this.currentItem.parent().length) { 29609 this.placeholder.before(this.currentItem); 29610 } 29611 this._noFinalSort = null; 29612 29613 if (this.helper[0] === this.currentItem[0]) { 29614 for (i in this._storedCSS) { 29615 if (this._storedCSS[i] === "auto" || this._storedCSS[i] === "static") { 29616 this._storedCSS[i] = ""; 29617 } 29618 } 29619 this.currentItem.css(this._storedCSS); 29620 this._removeClass(this.currentItem, "ui-sortable-helper"); 29621 } else { 29622 this.currentItem.show(); 29623 } 29624 29625 if (this.fromOutside && !noPropagation) { 29626 delayedTriggers.push(function (event) { 29627 this._trigger("receive", event, this._uiHash(this.fromOutside)); 29628 }); 29629 } 29630 if ((this.fromOutside || 29631 this.domPosition.prev !== 29632 this.currentItem.prev().not(".ui-sortable-helper")[0] || 29633 this.domPosition.parent !== this.currentItem.parent()[0]) && !noPropagation) { 29634 29635 // Trigger update callback if the DOM position has changed 29636 delayedTriggers.push(function (event) { 29637 this._trigger("update", event, this._uiHash()); 29638 }); 29639 } 29640 29641 // Check if the items Container has Changed and trigger appropriate 29642 // events. 29643 if (this !== this.currentContainer) { 29644 if (!noPropagation) { 29645 delayedTriggers.push(function (event) { 29646 this._trigger("remove", event, this._uiHash()); 29647 }); 29648 delayedTriggers.push((function (c) { 29649 return function (event) { 29650 c._trigger("receive", event, this._uiHash(this)); 29651 }; 29652 }).call(this, this.currentContainer)); 29653 delayedTriggers.push((function (c) { 29654 return function (event) { 29655 c._trigger("update", event, this._uiHash(this)); 29656 }; 29657 }).call(this, this.currentContainer)); 29658 } 29659 } 29660 29661 //Post events to containers 29662 function delayEvent(type, instance, container) { 29663 return function (event) { 29664 container._trigger(type, event, instance._uiHash(instance)); 29665 }; 29666 } 29667 for (i = this.containers.length - 1; i >= 0; i--) { 29668 if (!noPropagation) { 29669 delayedTriggers.push(delayEvent("deactivate", this, this.containers[i])); 29670 } 29671 if (this.containers[i].containerCache.over) { 29672 delayedTriggers.push(delayEvent("out", this, this.containers[i])); 29673 this.containers[i].containerCache.over = 0; 29674 } 29675 } 29676 29677 //Do what was originally in plugins 29678 if (this.storedCursor) { 29679 this.document.find("body").css("cursor", this.storedCursor); 29680 this.storedStylesheet.remove(); 29681 } 29682 if (this._storedOpacity) { 29683 this.helper.css("opacity", this._storedOpacity); 29684 } 29685 if (this._storedZIndex) { 29686 this.helper.css("zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex); 29687 } 29688 29689 this.dragging = false; 29690 29691 if (!noPropagation) { 29692 this._trigger("beforeStop", event, this._uiHash()); 29693 } 29694 29695 //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, 29696 // it unbinds ALL events from the original node! 29697 this.placeholder[0].parentNode.removeChild(this.placeholder[0]); 29698 29699 if (!this.cancelHelperRemoval) { 29700 if (this.helper[0] !== this.currentItem[0]) { 29701 this.helper.remove(); 29702 } 29703 this.helper = null; 29704 } 29705 29706 if (!noPropagation) { 29707 for (i = 0; i < delayedTriggers.length; i++) { 29708 29709 // Trigger all delayed events 29710 delayedTriggers[i].call(this, event); 29711 } 29712 this._trigger("stop", event, this._uiHash()); 29713 } 29714 29715 this.fromOutside = false; 29716 return !this.cancelHelperRemoval; 29717 29718 }, 29719 29720 _trigger: function () { 29721 if ($.Widget.prototype._trigger.apply(this, arguments) === false) { 29722 this.cancel(); 29723 } 29724 }, 29725 29726 _uiHash: function (_inst) { 29727 var inst = _inst || this; 29728 return { 29729 helper: inst.helper, 29730 placeholder: inst.placeholder || $([]), 29731 position: inst.position, 29732 originalPosition: inst.originalPosition, 29733 offset: inst.positionAbs, 29734 item: inst.currentItem, 29735 sender: _inst ? _inst.element : null 29736 }; 29737 } 29738 29739 }); 29740 29741 29742 /*! 29743 * jQuery UI Spinner 1.13.2 29744 * http://jqueryui.com 29745 * 29746 * Copyright jQuery Foundation and other contributors 29747 * Released under the MIT license. 29748 * http://jquery.org/license 29749 */ 29750 29751 //>>label: Spinner 29752 //>>group: Widgets 29753 //>>description: Displays buttons to easily input numbers via the keyboard or mouse. 29754 //>>docs: http://api.jqueryui.com/spinner/ 29755 //>>demos: http://jqueryui.com/spinner/ 29756 //>>css.structure: ../../themes/base/core.css 29757 //>>css.structure: ../../themes/base/spinner.css 29758 //>>css.theme: ../../themes/base/theme.css 29759 29760 29761 function spinnerModifier(fn) { 29762 return function () { 29763 var previous = this.element.val(); 29764 fn.apply(this, arguments); 29765 this._refresh(); 29766 if (previous !== this.element.val()) { 29767 this._trigger("change"); 29768 } 29769 }; 29770 } 29771 29772 $.widget("ui.spinner", { 29773 version: "1.13.2", 29774 defaultElement: "<input>", 29775 widgetEventPrefix: "spin", 29776 options: { 29777 classes: { 29778 "ui-spinner": "ui-corner-all", 29779 "ui-spinner-down": "ui-corner-br", 29780 "ui-spinner-up": "ui-corner-tr" 29781 }, 29782 culture: null, 29783 icons: { 29784 down: "ui-icon-triangle-1-s", 29785 up: "ui-icon-triangle-1-n" 29786 }, 29787 incremental: true, 29788 max: null, 29789 min: null, 29790 numberFormat: null, 29791 page: 10, 29792 step: 1, 29793 29794 change: null, 29795 spin: null, 29796 start: null, 29797 stop: null 29798 }, 29799 29800 _create: function () { 29801 29802 // handle string values that need to be parsed 29803 this._setOption("max", this.options.max); 29804 this._setOption("min", this.options.min); 29805 this._setOption("step", this.options.step); 29806 29807 // Only format if there is a value, prevents the field from being marked 29808 // as invalid in Firefox, see #9573. 29809 if (this.value() !== "") { 29810 29811 // Format the value, but don't constrain. 29812 this._value(this.element.val(), true); 29813 } 29814 29815 this._draw(); 29816 this._on(this._events); 29817 this._refresh(); 29818 29819 // Turning off autocomplete prevents the browser from remembering the 29820 // value when navigating through history, so we re-enable autocomplete 29821 // if the page is unloaded before the widget is destroyed. #7790 29822 this._on(this.window, { 29823 beforeunload: function () { 29824 this.element.removeAttr("autocomplete"); 29825 } 29826 }); 29827 }, 29828 29829 _getCreateOptions: function () { 29830 var options = this._super(); 29831 var element = this.element; 29832 29833 $.each(["min", "max", "step"], function (i, option) { 29834 var value = element.attr(option); 29835 if (value != null && value.length) { 29836 options[option] = value; 29837 } 29838 }); 29839 29840 return options; 29841 }, 29842 29843 _events: { 29844 keydown: function (event) { 29845 if (this._start(event) && this._keydown(event)) { 29846 event.preventDefault(); 29847 } 29848 }, 29849 keyup: "_stop", 29850 focus: function () { 29851 this.previous = this.element.val(); 29852 }, 29853 blur: function (event) { 29854 if (this.cancelBlur) { 29855 delete this.cancelBlur; 29856 return; 29857 } 29858 29859 this._stop(); 29860 this._refresh(); 29861 if (this.previous !== this.element.val()) { 29862 this._trigger("change", event); 29863 } 29864 }, 29865 mousewheel: function (event, delta) { 29866 var activeElement = $.ui.safeActiveElement(this.document[0]); 29867 var isActive = this.element[0] === activeElement; 29868 29869 if (!isActive || !delta) { 29870 return; 29871 } 29872 29873 if (!this.spinning && !this._start(event)) { 29874 return false; 29875 } 29876 29877 this._spin((delta > 0 ? 1 : -1) * this.options.step, event); 29878 clearTimeout(this.mousewheelTimer); 29879 this.mousewheelTimer = this._delay(function () { 29880 if (this.spinning) { 29881 this._stop(event); 29882 } 29883 }, 100); 29884 event.preventDefault(); 29885 }, 29886 "mousedown .ui-spinner-button": function (event) { 29887 var previous; 29888 29889 // We never want the buttons to have focus; whenever the user is 29890 // interacting with the spinner, the focus should be on the input. 29891 // If the input is focused then this.previous is properly set from 29892 // when the input first received focus. If the input is not focused 29893 // then we need to set this.previous based on the value before spinning. 29894 previous = this.element[0] === $.ui.safeActiveElement(this.document[0]) ? 29895 this.previous : this.element.val(); 29896 function checkFocus() { 29897 var isActive = this.element[0] === $.ui.safeActiveElement(this.document[0]); 29898 if (!isActive) { 29899 this.element.trigger("focus"); 29900 this.previous = previous; 29901 29902 // support: IE 29903 // IE sets focus asynchronously, so we need to check if focus 29904 // moved off of the input because the user clicked on the button. 29905 this._delay(function () { 29906 this.previous = previous; 29907 }); 29908 } 29909 } 29910 29911 // Ensure focus is on (or stays on) the text field 29912 event.preventDefault(); 29913 checkFocus.call(this); 29914 29915 // Support: IE 29916 // IE doesn't prevent moving focus even with event.preventDefault() 29917 // so we set a flag to know when we should ignore the blur event 29918 // and check (again) if focus moved off of the input. 29919 this.cancelBlur = true; 29920 this._delay(function () { 29921 delete this.cancelBlur; 29922 checkFocus.call(this); 29923 }); 29924 29925 if (this._start(event) === false) { 29926 return; 29927 } 29928 29929 this._repeat(null, $(event.currentTarget) 29930 .hasClass("ui-spinner-up") ? 1 : -1, event); 29931 }, 29932 "mouseup .ui-spinner-button": "_stop", 29933 "mouseenter .ui-spinner-button": function (event) { 29934 29935 // button will add ui-state-active if mouse was down while mouseleave and kept down 29936 if (!$(event.currentTarget).hasClass("ui-state-active")) { 29937 return; 29938 } 29939 29940 if (this._start(event) === false) { 29941 return false; 29942 } 29943 this._repeat(null, $(event.currentTarget) 29944 .hasClass("ui-spinner-up") ? 1 : -1, event); 29945 }, 29946 29947 // TODO: do we really want to consider this a stop? 29948 // shouldn't we just stop the repeater and wait until mouseup before 29949 // we trigger the stop event? 29950 "mouseleave .ui-spinner-button": "_stop" 29951 }, 29952 29953 // Support mobile enhanced option and make backcompat more sane 29954 _enhance: function () { 29955 this.uiSpinner = this.element 29956 .attr("autocomplete", "off") 29957 .wrap("<span>") 29958 .parent() 29959 29960 // Add buttons 29961 .append( 29962 "<a></a><a></a>" 29963 ); 29964 }, 29965 29966 _draw: function () { 29967 this._enhance(); 29968 29969 this._addClass(this.uiSpinner, "ui-spinner", "ui-widget ui-widget-content"); 29970 this._addClass("ui-spinner-input"); 29971 29972 this.element.attr("role", "spinbutton"); 29973 29974 // Button bindings 29975 this.buttons = this.uiSpinner.children("a") 29976 .attr("tabIndex", -1) 29977 .attr("aria-hidden", true) 29978 .button({ 29979 classes: { 29980 "ui-button": "" 29981 } 29982 }); 29983 29984 // TODO: Right now button does not support classes this is already updated in button PR 29985 this._removeClass(this.buttons, "ui-corner-all"); 29986 29987 this._addClass(this.buttons.first(), "ui-spinner-button ui-spinner-up"); 29988 this._addClass(this.buttons.last(), "ui-spinner-button ui-spinner-down"); 29989 this.buttons.first().button({ 29990 "icon": this.options.icons.up, 29991 "showLabel": false 29992 }); 29993 this.buttons.last().button({ 29994 "icon": this.options.icons.down, 29995 "showLabel": false 29996 }); 29997 29998 // IE 6 doesn't understand height: 50% for the buttons 29999 // unless the wrapper has an explicit height 30000 if (this.buttons.height() > Math.ceil(this.uiSpinner.height() * 0.5) && 30001 this.uiSpinner.height() > 0) { 30002 this.uiSpinner.height(this.uiSpinner.height()); 30003 } 30004 }, 30005 30006 _keydown: function (event) { 30007 var options = this.options, 30008 keyCode = $.ui.keyCode; 30009 30010 switch (event.keyCode) { 30011 case keyCode.UP: 30012 this._repeat(null, 1, event); 30013 return true; 30014 case keyCode.DOWN: 30015 this._repeat(null, -1, event); 30016 return true; 30017 case keyCode.PAGE_UP: 30018 this._repeat(null, options.page, event); 30019 return true; 30020 case keyCode.PAGE_DOWN: 30021 this._repeat(null, -options.page, event); 30022 return true; 30023 } 30024 30025 return false; 30026 }, 30027 30028 _start: function (event) { 30029 if (!this.spinning && this._trigger("start", event) === false) { 30030 return false; 30031 } 30032 30033 if (!this.counter) { 30034 this.counter = 1; 30035 } 30036 this.spinning = true; 30037 return true; 30038 }, 30039 30040 _repeat: function (i, steps, event) { 30041 i = i || 500; 30042 30043 clearTimeout(this.timer); 30044 this.timer = this._delay(function () { 30045 this._repeat(40, steps, event); 30046 }, i); 30047 30048 this._spin(steps * this.options.step, event); 30049 }, 30050 30051 _spin: function (step, event) { 30052 var value = this.value() || 0; 30053 30054 if (!this.counter) { 30055 this.counter = 1; 30056 } 30057 30058 value = this._adjustValue(value + step * this._increment(this.counter)); 30059 30060 if (!this.spinning || this._trigger("spin", event, { value: value }) !== false) { 30061 this._value(value); 30062 this.counter++; 30063 } 30064 }, 30065 30066 _increment: function (i) { 30067 var incremental = this.options.incremental; 30068 30069 if (incremental) { 30070 return typeof incremental === "function" ? 30071 incremental(i) : 30072 Math.floor(i * i * i / 50000 - i * i / 500 + 17 * i / 200 + 1); 30073 } 30074 30075 return 1; 30076 }, 30077 30078 _precision: function () { 30079 var precision = this._precisionOf(this.options.step); 30080 if (this.options.min !== null) { 30081 precision = Math.max(precision, this._precisionOf(this.options.min)); 30082 } 30083 return precision; 30084 }, 30085 30086 _precisionOf: function (num) { 30087 var str = num.toString(), 30088 decimal = str.indexOf("."); 30089 return decimal === -1 ? 0 : str.length - decimal - 1; 30090 }, 30091 30092 _adjustValue: function (value) { 30093 var base, aboveMin, 30094 options = this.options; 30095 30096 // Make sure we're at a valid step 30097 // - find out where we are relative to the base (min or 0) 30098 base = options.min !== null ? options.min : 0; 30099 aboveMin = value - base; 30100 30101 // - round to the nearest step 30102 aboveMin = Math.round(aboveMin / options.step) * options.step; 30103 30104 // - rounding is based on 0, so adjust back to our base 30105 value = base + aboveMin; 30106 30107 // Fix precision from bad JS floating point math 30108 value = parseFloat(value.toFixed(this._precision())); 30109 30110 // Clamp the value 30111 if (options.max !== null && value > options.max) { 30112 return options.max; 30113 } 30114 if (options.min !== null && value < options.min) { 30115 return options.min; 30116 } 30117 30118 return value; 30119 }, 30120 30121 _stop: function (event) { 30122 if (!this.spinning) { 30123 return; 30124 } 30125 30126 clearTimeout(this.timer); 30127 clearTimeout(this.mousewheelTimer); 30128 this.counter = 0; 30129 this.spinning = false; 30130 this._trigger("stop", event); 30131 }, 30132 30133 _setOption: function (key, value) { 30134 var prevValue, first, last; 30135 30136 if (key === "culture" || key === "numberFormat") { 30137 prevValue = this._parse(this.element.val()); 30138 this.options[key] = value; 30139 this.element.val(this._format(prevValue)); 30140 return; 30141 } 30142 30143 if (key === "max" || key === "min" || key === "step") { 30144 if (typeof value === "string") { 30145 value = this._parse(value); 30146 } 30147 } 30148 if (key === "icons") { 30149 first = this.buttons.first().find(".ui-icon"); 30150 this._removeClass(first, null, this.options.icons.up); 30151 this._addClass(first, null, value.up); 30152 last = this.buttons.last().find(".ui-icon"); 30153 this._removeClass(last, null, this.options.icons.down); 30154 this._addClass(last, null, value.down); 30155 } 30156 30157 this._super(key, value); 30158 }, 30159 30160 _setOptionDisabled: function (value) { 30161 this._super(value); 30162 30163 this._toggleClass(this.uiSpinner, null, "ui-state-disabled", !!value); 30164 this.element.prop("disabled", !!value); 30165 this.buttons.button(value ? "disable" : "enable"); 30166 }, 30167 30168 _setOptions: spinnerModifier(function (options) { 30169 this._super(options); 30170 }), 30171 30172 _parse: function (val) { 30173 if (typeof val === "string" && val !== "") { 30174 val = window.Globalize && this.options.numberFormat ? 30175 Globalize.parseFloat(val, 10, this.options.culture) : +val; 30176 } 30177 return val === "" || isNaN(val) ? null : val; 30178 }, 30179 30180 _format: function (value) { 30181 if (value === "") { 30182 return ""; 30183 } 30184 return window.Globalize && this.options.numberFormat ? 30185 Globalize.format(value, this.options.numberFormat, this.options.culture) : 30186 value; 30187 }, 30188 30189 _refresh: function () { 30190 this.element.attr({ 30191 "aria-valuemin": this.options.min, 30192 "aria-valuemax": this.options.max, 30193 30194 // TODO: what should we do with values that can't be parsed? 30195 "aria-valuenow": this._parse(this.element.val()) 30196 }); 30197 }, 30198 30199 isValid: function () { 30200 var value = this.value(); 30201 30202 // Null is invalid 30203 if (value === null) { 30204 return false; 30205 } 30206 30207 // If value gets adjusted, it's invalid 30208 return value === this._adjustValue(value); 30209 }, 30210 30211 // Update the value without triggering change 30212 _value: function (value, allowAny) { 30213 var parsed; 30214 if (value !== "") { 30215 parsed = this._parse(value); 30216 if (parsed !== null) { 30217 if (!allowAny) { 30218 parsed = this._adjustValue(parsed); 30219 } 30220 value = this._format(parsed); 30221 } 30222 } 30223 this.element.val(value); 30224 this._refresh(); 30225 }, 30226 30227 _destroy: function () { 30228 this.element 30229 .prop("disabled", false) 30230 .removeAttr("autocomplete role aria-valuemin aria-valuemax aria-valuenow"); 30231 30232 this.uiSpinner.replaceWith(this.element); 30233 }, 30234 30235 stepUp: spinnerModifier(function (steps) { 30236 this._stepUp(steps); 30237 }), 30238 _stepUp: function (steps) { 30239 if (this._start()) { 30240 this._spin((steps || 1) * this.options.step); 30241 this._stop(); 30242 } 30243 }, 30244 30245 stepDown: spinnerModifier(function (steps) { 30246 this._stepDown(steps); 30247 }), 30248 _stepDown: function (steps) { 30249 if (this._start()) { 30250 this._spin((steps || 1) * -this.options.step); 30251 this._stop(); 30252 } 30253 }, 30254 30255 pageUp: spinnerModifier(function (pages) { 30256 this._stepUp((pages || 1) * this.options.page); 30257 }), 30258 30259 pageDown: spinnerModifier(function (pages) { 30260 this._stepDown((pages || 1) * this.options.page); 30261 }), 30262 30263 value: function (newVal) { 30264 if (!arguments.length) { 30265 return this._parse(this.element.val()); 30266 } 30267 spinnerModifier(this._value).call(this, newVal); 30268 }, 30269 30270 widget: function () { 30271 return this.uiSpinner; 30272 } 30273 }); 30274 30275 // DEPRECATED 30276 // TODO: switch return back to widget declaration at top of file when this is removed 30277 if ($.uiBackCompat !== false) { 30278 30279 // Backcompat for spinner html extension points 30280 $.widget("ui.spinner", $.ui.spinner, { 30281 _enhance: function () { 30282 this.uiSpinner = this.element 30283 .attr("autocomplete", "off") 30284 .wrap(this._uiSpinnerHtml()) 30285 .parent() 30286 30287 // Add buttons 30288 .append(this._buttonHtml()); 30289 }, 30290 _uiSpinnerHtml: function () { 30291 return "<span>"; 30292 }, 30293 30294 _buttonHtml: function () { 30295 return "<a></a><a></a>"; 30296 } 30297 }); 30298 } 30299 30300 var widgetsSpinner = $.ui.spinner; 30301 30302 30303 /*! 30304 * jQuery UI Tabs 1.13.2 30305 * http://jqueryui.com 30306 * 30307 * Copyright jQuery Foundation and other contributors 30308 * Released under the MIT license. 30309 * http://jquery.org/license 30310 */ 30311 30312 //>>label: Tabs 30313 //>>group: Widgets 30314 //>>description: Transforms a set of container elements into a tab structure. 30315 //>>docs: http://api.jqueryui.com/tabs/ 30316 //>>demos: http://jqueryui.com/tabs/ 30317 //>>css.structure: ../../themes/base/core.css 30318 //>>css.structure: ../../themes/base/tabs.css 30319 //>>css.theme: ../../themes/base/theme.css 30320 30321 30322 $.widget("ui.tabs", { 30323 version: "1.13.2", 30324 delay: 300, 30325 options: { 30326 active: null, 30327 classes: { 30328 "ui-tabs": "ui-corner-all", 30329 "ui-tabs-nav": "ui-corner-all", 30330 "ui-tabs-panel": "ui-corner-bottom", 30331 "ui-tabs-tab": "ui-corner-top" 30332 }, 30333 collapsible: false, 30334 event: "click", 30335 heightStyle: "content", 30336 hide: null, 30337 show: null, 30338 30339 // Callbacks 30340 activate: null, 30341 beforeActivate: null, 30342 beforeLoad: null, 30343 load: null 30344 }, 30345 30346 _isLocal: (function () { 30347 var rhash = /#.*$/; 30348 30349 return function (anchor) { 30350 var anchorUrl, locationUrl; 30351 30352 anchorUrl = anchor.href.replace(rhash, ""); 30353 locationUrl = location.href.replace(rhash, ""); 30354 30355 // Decoding may throw an error if the URL isn't UTF-8 (#9518) 30356 try { 30357 anchorUrl = decodeURIComponent(anchorUrl); 30358 } catch (error) { } 30359 try { 30360 locationUrl = decodeURIComponent(locationUrl); 30361 } catch (error) { } 30362 30363 return anchor.hash.length > 1 && anchorUrl === locationUrl; 30364 }; 30365 })(), 30366 30367 _create: function () { 30368 var that = this, 30369 options = this.options; 30370 30371 this.running = false; 30372 30373 this._addClass("ui-tabs", "ui-widget ui-widget-content"); 30374 this._toggleClass("ui-tabs-collapsible", null, options.collapsible); 30375 30376 this._processTabs(); 30377 options.active = this._initialActive(); 30378 30379 // Take disabling tabs via class attribute from HTML 30380 // into account and update option properly. 30381 if (Array.isArray(options.disabled)) { 30382 options.disabled = $.uniqueSort(options.disabled.concat( 30383 $.map(this.tabs.filter(".ui-state-disabled"), function (li) { 30384 return that.tabs.index(li); 30385 }) 30386 )).sort(); 30387 } 30388 30389 // Check for length avoids error when initializing empty list 30390 if (this.options.active !== false && this.anchors.length) { 30391 this.active = this._findActive(options.active); 30392 } else { 30393 this.active = $(); 30394 } 30395 30396 this._refresh(); 30397 30398 if (this.active.length) { 30399 this.load(options.active); 30400 } 30401 }, 30402 30403 _initialActive: function () { 30404 var active = this.options.active, 30405 collapsible = this.options.collapsible, 30406 locationHash = location.hash.substring(1); 30407 30408 if (active === null) { 30409 30410 // check the fragment identifier in the URL 30411 if (locationHash) { 30412 this.tabs.each(function (i, tab) { 30413 if ($(tab).attr("aria-controls") === locationHash) { 30414 active = i; 30415 return false; 30416 } 30417 }); 30418 } 30419 30420 // Check for a tab marked active via a class 30421 if (active === null) { 30422 active = this.tabs.index(this.tabs.filter(".ui-tabs-active")); 30423 } 30424 30425 // No active tab, set to false 30426 if (active === null || active === -1) { 30427 active = this.tabs.length ? 0 : false; 30428 } 30429 } 30430 30431 // Handle numbers: negative, out of range 30432 if (active !== false) { 30433 active = this.tabs.index(this.tabs.eq(active)); 30434 if (active === -1) { 30435 active = collapsible ? false : 0; 30436 } 30437 } 30438 30439 // Don't allow collapsible: false and active: false 30440 if (!collapsible && active === false && this.anchors.length) { 30441 active = 0; 30442 } 30443 30444 return active; 30445 }, 30446 30447 _getCreateEventData: function () { 30448 return { 30449 tab: this.active, 30450 panel: !this.active.length ? $() : this._getPanelForTab(this.active) 30451 }; 30452 }, 30453 30454 _tabKeydown: function (event) { 30455 var focusedTab = $($.ui.safeActiveElement(this.document[0])).closest("li"), 30456 selectedIndex = this.tabs.index(focusedTab), 30457 goingForward = true; 30458 30459 if (this._handlePageNav(event)) { 30460 return; 30461 } 30462 30463 switch (event.keyCode) { 30464 case $.ui.keyCode.RIGHT: 30465 case $.ui.keyCode.DOWN: 30466 selectedIndex++; 30467 break; 30468 case $.ui.keyCode.UP: 30469 case $.ui.keyCode.LEFT: 30470 goingForward = false; 30471 selectedIndex--; 30472 break; 30473 case $.ui.keyCode.END: 30474 selectedIndex = this.anchors.length - 1; 30475 break; 30476 case $.ui.keyCode.HOME: 30477 selectedIndex = 0; 30478 break; 30479 case $.ui.keyCode.SPACE: 30480 30481 // Activate only, no collapsing 30482 event.preventDefault(); 30483 clearTimeout(this.activating); 30484 this._activate(selectedIndex); 30485 return; 30486 case $.ui.keyCode.ENTER: 30487 30488 // Toggle (cancel delayed activation, allow collapsing) 30489 event.preventDefault(); 30490 clearTimeout(this.activating); 30491 30492 // Determine if we should collapse or activate 30493 this._activate(selectedIndex === this.options.active ? false : selectedIndex); 30494 return; 30495 default: 30496 return; 30497 } 30498 30499 // Focus the appropriate tab, based on which key was pressed 30500 event.preventDefault(); 30501 clearTimeout(this.activating); 30502 selectedIndex = this._focusNextTab(selectedIndex, goingForward); 30503 30504 // Navigating with control/command key will prevent automatic activation 30505 if (!event.ctrlKey && !event.metaKey) { 30506 30507 // Update aria-selected immediately so that AT think the tab is already selected. 30508 // Otherwise AT may confuse the user by stating that they need to activate the tab, 30509 // but the tab will already be activated by the time the announcement finishes. 30510 focusedTab.attr("aria-selected", "false"); 30511 this.tabs.eq(selectedIndex).attr("aria-selected", "true"); 30512 30513 this.activating = this._delay(function () { 30514 this.option("active", selectedIndex); 30515 }, this.delay); 30516 } 30517 }, 30518 30519 _panelKeydown: function (event) { 30520 if (this._handlePageNav(event)) { 30521 return; 30522 } 30523 30524 // Ctrl+up moves focus to the current tab 30525 if (event.ctrlKey && event.keyCode === $.ui.keyCode.UP) { 30526 event.preventDefault(); 30527 this.active.trigger("focus"); 30528 } 30529 }, 30530 30531 // Alt+page up/down moves focus to the previous/next tab (and activates) 30532 _handlePageNav: function (event) { 30533 if (event.altKey && event.keyCode === $.ui.keyCode.PAGE_UP) { 30534 this._activate(this._focusNextTab(this.options.active - 1, false)); 30535 return true; 30536 } 30537 if (event.altKey && event.keyCode === $.ui.keyCode.PAGE_DOWN) { 30538 this._activate(this._focusNextTab(this.options.active + 1, true)); 30539 return true; 30540 } 30541 }, 30542 30543 _findNextTab: function (index, goingForward) { 30544 var lastTabIndex = this.tabs.length - 1; 30545 30546 function constrain() { 30547 if (index > lastTabIndex) { 30548 index = 0; 30549 } 30550 if (index < 0) { 30551 index = lastTabIndex; 30552 } 30553 return index; 30554 } 30555 30556 while ($.inArray(constrain(), this.options.disabled) !== -1) { 30557 index = goingForward ? index + 1 : index - 1; 30558 } 30559 30560 return index; 30561 }, 30562 30563 _focusNextTab: function (index, goingForward) { 30564 index = this._findNextTab(index, goingForward); 30565 this.tabs.eq(index).trigger("focus"); 30566 return index; 30567 }, 30568 30569 _setOption: function (key, value) { 30570 if (key === "active") { 30571 30572 // _activate() will handle invalid values and update this.options 30573 this._activate(value); 30574 return; 30575 } 30576 30577 this._super(key, value); 30578 30579 if (key === "collapsible") { 30580 this._toggleClass("ui-tabs-collapsible", null, value); 30581 30582 // Setting collapsible: false while collapsed; open first panel 30583 if (!value && this.options.active === false) { 30584 this._activate(0); 30585 } 30586 } 30587 30588 if (key === "event") { 30589 this._setupEvents(value); 30590 } 30591 30592 if (key === "heightStyle") { 30593 this._setupHeightStyle(value); 30594 } 30595 }, 30596 30597 _sanitizeSelector: function (hash) { 30598 return hash ? hash.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g, "\\$&") : ""; 30599 }, 30600 30601 refresh: function () { 30602 var options = this.options, 30603 lis = this.tablist.children(":has(a[href])"); 30604 30605 // Get disabled tabs from class attribute from HTML 30606 // this will get converted to a boolean if needed in _refresh() 30607 options.disabled = $.map(lis.filter(".ui-state-disabled"), function (tab) { 30608 return lis.index(tab); 30609 }); 30610 30611 this._processTabs(); 30612 30613 // Was collapsed or no tabs 30614 if (options.active === false || !this.anchors.length) { 30615 options.active = false; 30616 this.active = $(); 30617 30618 // was active, but active tab is gone 30619 } else if (this.active.length && !$.contains(this.tablist[0], this.active[0])) { 30620 30621 // all remaining tabs are disabled 30622 if (this.tabs.length === options.disabled.length) { 30623 options.active = false; 30624 this.active = $(); 30625 30626 // activate previous tab 30627 } else { 30628 this._activate(this._findNextTab(Math.max(0, options.active - 1), false)); 30629 } 30630 30631 // was active, active tab still exists 30632 } else { 30633 30634 // make sure active index is correct 30635 options.active = this.tabs.index(this.active); 30636 } 30637 30638 this._refresh(); 30639 }, 30640 30641 _refresh: function () { 30642 this._setOptionDisabled(this.options.disabled); 30643 this._setupEvents(this.options.event); 30644 this._setupHeightStyle(this.options.heightStyle); 30645 30646 this.tabs.not(this.active).attr({ 30647 "aria-selected": "false", 30648 "aria-expanded": "false", 30649 tabIndex: -1 30650 }); 30651 this.panels.not(this._getPanelForTab(this.active)) 30652 .hide() 30653 .attr({ 30654 "aria-hidden": "true" 30655 }); 30656 30657 // Make sure one tab is in the tab order 30658 if (!this.active.length) { 30659 this.tabs.eq(0).attr("tabIndex", 0); 30660 } else { 30661 this.active 30662 .attr({ 30663 "aria-selected": "true", 30664 "aria-expanded": "true", 30665 tabIndex: 0 30666 }); 30667 this._addClass(this.active, "ui-tabs-active", "ui-state-active"); 30668 this._getPanelForTab(this.active) 30669 .show() 30670 .attr({ 30671 "aria-hidden": "false" 30672 }); 30673 } 30674 }, 30675 30676 _processTabs: function () { 30677 var that = this, 30678 prevTabs = this.tabs, 30679 prevAnchors = this.anchors, 30680 prevPanels = this.panels; 30681 30682 this.tablist = this._getList().attr("role", "tablist"); 30683 this._addClass(this.tablist, "ui-tabs-nav", 30684 "ui-helper-reset ui-helper-clearfix ui-widget-header"); 30685 30686 // Prevent users from focusing disabled tabs via click 30687 this.tablist 30688 .on("mousedown" + this.eventNamespace, "> li", function (event) { 30689 if ($(this).is(".ui-state-disabled")) { 30690 event.preventDefault(); 30691 } 30692 }) 30693 30694 // Support: IE <9 30695 // Preventing the default action in mousedown doesn't prevent IE 30696 // from focusing the element, so if the anchor gets focused, blur. 30697 // We don't have to worry about focusing the previously focused 30698 // element since clicking on a non-focusable element should focus 30699 // the body anyway. 30700 .on("focus" + this.eventNamespace, ".ui-tabs-anchor", function () { 30701 if ($(this).closest("li").is(".ui-state-disabled")) { 30702 this.blur(); 30703 } 30704 }); 30705 30706 this.tabs = this.tablist.find("> li:has(a[href])") 30707 .attr({ 30708 role: "tab", 30709 tabIndex: -1 30710 }); 30711 this._addClass(this.tabs, "ui-tabs-tab", "ui-state-default"); 30712 30713 this.anchors = this.tabs.map(function () { 30714 return $("a", this)[0]; 30715 }) 30716 .attr({ 30717 tabIndex: -1 30718 }); 30719 this._addClass(this.anchors, "ui-tabs-anchor"); 30720 30721 this.panels = $(); 30722 30723 this.anchors.each(function (i, anchor) { 30724 var selector, panel, panelId, 30725 anchorId = $(anchor).uniqueId().attr("id"), 30726 tab = $(anchor).closest("li"), 30727 originalAriaControls = tab.attr("aria-controls"); 30728 30729 // Inline tab 30730 if (that._isLocal(anchor)) { 30731 selector = anchor.hash; 30732 panelId = selector.substring(1); 30733 panel = that.element.find(that._sanitizeSelector(selector)); 30734 30735 // remote tab 30736 } else { 30737 30738 // If the tab doesn't already have aria-controls, 30739 // generate an id by using a throw-away element 30740 panelId = tab.attr("aria-controls") || $({}).uniqueId()[0].id; 30741 selector = "#" + panelId; 30742 panel = that.element.find(selector); 30743 if (!panel.length) { 30744 panel = that._createPanel(panelId); 30745 panel.insertAfter(that.panels[i - 1] || that.tablist); 30746 } 30747 panel.attr("aria-live", "polite"); 30748 } 30749 30750 if (panel.length) { 30751 that.panels = that.panels.add(panel); 30752 }
vendor: 10,082 bytes, lines 30753-31140
30753 if (originalAriaControls) { 30754 tab.data("ui-tabs-aria-controls", originalAriaControls); 30755 } 30756 tab.attr({ 30757 "aria-controls": panelId, 30758 "aria-labelledby": anchorId 30759 }); 30760 panel.attr("aria-labelledby", anchorId); 30761 }); 30762 30763 this.panels.attr("role", "tabpanel"); 30764 this._addClass(this.panels, "ui-tabs-panel", "ui-widget-content"); 30765 30766 // Avoid memory leaks (#10056) 30767 if (prevTabs) { 30768 this._off(prevTabs.not(this.tabs)); 30769 this._off(prevAnchors.not(this.anchors)); 30770 this._off(prevPanels.not(this.panels)); 30771 } 30772 }, 30773 30774 // Allow overriding how to find the list for rare usage scenarios (#7715) 30775 _getList: function () { 30776 return this.tablist || this.element.find("ol, ul").eq(0); 30777 }, 30778 30779 _createPanel: function (id) { 30780 return $("<div>") 30781 .attr("id", id) 30782 .data("ui-tabs-destroy", true); 30783 }, 30784 30785 _setOptionDisabled: function (disabled) { 30786 var currentItem, li, i; 30787 30788 if (Array.isArray(disabled)) { 30789 if (!disabled.length) { 30790 disabled = false; 30791 } else if (disabled.length === this.anchors.length) { 30792 disabled = true; 30793 } 30794 } 30795 30796 // Disable tabs 30797 for (i = 0; (li = this.tabs[i]); i++) { 30798 currentItem = $(li); 30799 if (disabled === true || $.inArray(i, disabled) !== -1) { 30800 currentItem.attr("aria-disabled", "true"); 30801 this._addClass(currentItem, null, "ui-state-disabled"); 30802 } else { 30803 currentItem.removeAttr("aria-disabled"); 30804 this._removeClass(currentItem, null, "ui-state-disabled"); 30805 } 30806 } 30807 30808 this.options.disabled = disabled; 30809 30810 this._toggleClass(this.widget(), this.widgetFullName + "-disabled", null, 30811 disabled === true); 30812 }, 30813 30814 _setupEvents: function (event) { 30815 var events = {}; 30816 if (event) { 30817 $.each(event.split(" "), function (index, eventName) { 30818 events[eventName] = "_eventHandler"; 30819 }); 30820 } 30821 30822 this._off(this.anchors.add(this.tabs).add(this.panels)); 30823 30824 // Always prevent the default action, even when disabled 30825 this._on(true, this.anchors, { 30826 click: function (event) { 30827 event.preventDefault(); 30828 } 30829 }); 30830 this._on(this.anchors, events); 30831 this._on(this.tabs, { keydown: "_tabKeydown" }); 30832 this._on(this.panels, { keydown: "_panelKeydown" }); 30833 30834 this._focusable(this.tabs); 30835 this._hoverable(this.tabs); 30836 }, 30837 30838 _setupHeightStyle: function (heightStyle) { 30839 var maxHeight, 30840 parent = this.element.parent(); 30841 30842 if (heightStyle === "fill") { 30843 maxHeight = parent.height(); 30844 maxHeight -= this.element.outerHeight() - this.element.height(); 30845 30846 this.element.siblings(":visible").each(function () { 30847 var elem = $(this), 30848 position = elem.css("position"); 30849 30850 if (position === "absolute" || position === "fixed") { 30851 return; 30852 } 30853 maxHeight -= elem.outerHeight(true); 30854 }); 30855 30856 this.element.children().not(this.panels).each(function () { 30857 maxHeight -= $(this).outerHeight(true); 30858 }); 30859 30860 this.panels.each(function () { 30861 $(this).height(Math.max(0, maxHeight - 30862 $(this).innerHeight() + $(this).height())); 30863 }) 30864 .css("overflow", "auto"); 30865 } else if (heightStyle === "auto") { 30866 maxHeight = 0; 30867 this.panels.each(function () { 30868 maxHeight = Math.max(maxHeight, $(this).height("").height()); 30869 }).height(maxHeight); 30870 } 30871 }, 30872 30873 _eventHandler: function (event) { 30874 var options = this.options, 30875 active = this.active, 30876 anchor = $(event.currentTarget), 30877 tab = anchor.closest("li"), 30878 clickedIsActive = tab[0] === active[0], 30879 collapsing = clickedIsActive && options.collapsible, 30880 toShow = collapsing ? $() : this._getPanelForTab(tab), 30881 toHide = !active.length ? $() : this._getPanelForTab(active), 30882 eventData = { 30883 oldTab: active, 30884 oldPanel: toHide, 30885 newTab: collapsing ? $() : tab, 30886 newPanel: toShow 30887 }; 30888 30889 event.preventDefault(); 30890 30891 if (tab.hasClass("ui-state-disabled") || 30892 30893 // tab is already loading 30894 tab.hasClass("ui-tabs-loading") || 30895 30896 // can't switch durning an animation 30897 this.running || 30898 30899 // click on active header, but not collapsible 30900 (clickedIsActive && !options.collapsible) || 30901 30902 // allow canceling activation 30903 (this._trigger("beforeActivate", event, eventData) === false)) { 30904 return; 30905 } 30906 30907 options.active = collapsing ? false : this.tabs.index(tab); 30908 30909 this.active = clickedIsActive ? $() : tab; 30910 if (this.xhr) { 30911 this.xhr.abort(); 30912 } 30913 30914 if (!toHide.length && !toShow.length) { 30915 $.error("jQuery UI Tabs: Mismatching fragment identifier."); 30916 } 30917 30918 if (toShow.length) { 30919 this.load(this.tabs.index(tab), event); 30920 } 30921 this._toggle(event, eventData); 30922 }, 30923 30924 // Handles show/hide for selecting tabs 30925 _toggle: function (event, eventData) { 30926 var that = this, 30927 toShow = eventData.newPanel, 30928 toHide = eventData.oldPanel; 30929 30930 this.running = true; 30931 30932 function complete() { 30933 that.running = false; 30934 that._trigger("activate", event, eventData); 30935 } 30936 30937 function show() { 30938 that._addClass(eventData.newTab.closest("li"), "ui-tabs-active", "ui-state-active"); 30939 30940 if (toShow.length && that.options.show) { 30941 that._show(toShow, that.options.show, complete); 30942 } else { 30943 toShow.show(); 30944 complete(); 30945 } 30946 } 30947 30948 // Start out by hiding, then showing, then completing 30949 if (toHide.length && this.options.hide) { 30950 this._hide(toHide, this.options.hide, function () { 30951 that._removeClass(eventData.oldTab.closest("li"), 30952 "ui-tabs-active", "ui-state-active"); 30953 show(); 30954 }); 30955 } else { 30956 this._removeClass(eventData.oldTab.closest("li"), 30957 "ui-tabs-active", "ui-state-active"); 30958 toHide.hide(); 30959 show(); 30960 } 30961 30962 toHide.attr("aria-hidden", "true"); 30963 eventData.oldTab.attr({ 30964 "aria-selected": "false", 30965 "aria-expanded": "false" 30966 }); 30967 30968 // If we're switching tabs, remove the old tab from the tab order. 30969 // If we're opening from collapsed state, remove the previous tab from the tab order. 30970 // If we're collapsing, then keep the collapsing tab in the tab order. 30971 if (toShow.length && toHide.length) { 30972 eventData.oldTab.attr("tabIndex", -1); 30973 } else if (toShow.length) { 30974 this.tabs.filter(function () { 30975 return $(this).attr("tabIndex") === 0; 30976 }) 30977 .attr("tabIndex", -1); 30978 } 30979 30980 toShow.attr("aria-hidden", "false"); 30981 eventData.newTab.attr({ 30982 "aria-selected": "true", 30983 "aria-expanded": "true", 30984 tabIndex: 0 30985 }); 30986 }, 30987 30988 _activate: function (index) { 30989 var anchor, 30990 active = this._findActive(index); 30991 30992 // Trying to activate the already active panel 30993 if (active[0] === this.active[0]) { 30994 return; 30995 } 30996 30997 // Trying to collapse, simulate a click on the current active header 30998 if (!active.length) { 30999 active = this.active; 31000 } 31001 31002 anchor = active.find(".ui-tabs-anchor")[0]; 31003 this._eventHandler({ 31004 target: anchor, 31005 currentTarget: anchor, 31006 preventDefault: $.noop 31007 }); 31008 }, 31009 31010 _findActive: function (index) { 31011 return index === false ? $() : this.tabs.eq(index); 31012 }, 31013 31014 _getIndex: function (index) { 31015 31016 // meta-function to give users option to provide a href string instead of a numerical index. 31017 if (typeof index === "string") { 31018 index = this.anchors.index(this.anchors.filter("[href$='" + 31019 $.escapeSelector(index) + "']")); 31020 } 31021 31022 return index; 31023 }, 31024 31025 _destroy: function () { 31026 if (this.xhr) { 31027 this.xhr.abort(); 31028 } 31029 31030 this.tablist 31031 .removeAttr("role") 31032 .off(this.eventNamespace); 31033 31034 this.anchors 31035 .removeAttr("role tabIndex") 31036 .removeUniqueId(); 31037 31038 this.tabs.add(this.panels).each(function () { 31039 if ($.data(this, "ui-tabs-destroy")) { 31040 $(this).remove(); 31041 } else { 31042 $(this).removeAttr("role tabIndex " + 31043 "aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded"); 31044 } 31045 }); 31046 31047 this.tabs.each(function () { 31048 var li = $(this), 31049 prev = li.data("ui-tabs-aria-controls"); 31050 if (prev) { 31051 li 31052 .attr("aria-controls", prev) 31053 .removeData("ui-tabs-aria-controls"); 31054 } else { 31055 li.removeAttr("aria-controls"); 31056 } 31057 }); 31058 31059 this.panels.show(); 31060 31061 if (this.options.heightStyle !== "content") { 31062 this.panels.css("height", ""); 31063 } 31064 }, 31065 31066 enable: function (index) { 31067 var disabled = this.options.disabled; 31068 if (disabled === false) { 31069 return; 31070 } 31071 31072 if (index === undefined) { 31073 disabled = false; 31074 } else { 31075 index = this._getIndex(index); 31076 if (Array.isArray(disabled)) { 31077 disabled = $.map(disabled, function (num) { 31078 return num !== index ? num : null; 31079 }); 31080 } else { 31081 disabled = $.map(this.tabs, function (li, num) { 31082 return num !== index ? num : null; 31083 }); 31084 } 31085 } 31086 this._setOptionDisabled(disabled); 31087 }, 31088 31089 disable: function (index) { 31090 var disabled = this.options.disabled; 31091 if (disabled === true) { 31092 return; 31093 } 31094 31095 if (index === undefined) { 31096 disabled = true; 31097 } else { 31098 index = this._getIndex(index); 31099 if ($.inArray(index, disabled) !== -1) { 31100 return; 31101 } 31102 if (Array.isArray(disabled)) { 31103 disabled = $.merge([index], disabled).sort(); 31104 } else { 31105 disabled = [index]; 31106 } 31107 } 31108 this._setOptionDisabled(disabled); 31109 }, 31110 31111 load: function (index, event) { 31112 index = this._getIndex(index); 31113 var that = this, 31114 tab = this.tabs.eq(index), 31115 anchor = tab.find(".ui-tabs-anchor"), 31116 panel = this._getPanelForTab(tab), 31117 eventData = { 31118 tab: tab, 31119 panel: panel 31120 }, 31121 complete = function (jqXHR, status) { 31122 if (status === "abort") { 31123 that.panels.stop(false, true); 31124 } 31125 31126 that._removeClass(tab, "ui-tabs-loading"); 31127 panel.removeAttr("aria-busy"); 31128 31129 if (jqXHR === that.xhr) { 31130 delete that.xhr; 31131 } 31132 }; 31133 31134 // Not remote 31135 if (this._isLocal(anchor[0])) { 31136 return; 31137 } 31138 31139 this.xhr = $.ajax(this._ajaxSettings(anchor, event, eventData)); 31140
vendor: 9,512 bytes, lines 31141-31475
31141 // Support: jQuery <1.8 31142 // jQuery <1.8 returns false if the request is canceled in beforeSend, 31143 // but as of 1.8, $.ajax() always returns a jqXHR object. 31144 if (this.xhr && this.xhr.statusText !== "canceled") { 31145 this._addClass(tab, "ui-tabs-loading"); 31146 panel.attr("aria-busy", "true"); 31147 31148 this.xhr 31149 .done(function (response, status, jqXHR) { 31150 31151 // support: jQuery <1.8 31152 // http://bugs.jquery.com/ticket/11778 31153 setTimeout(function () { 31154 panel.html(response); 31155 that._trigger("load", event, eventData); 31156 31157 complete(jqXHR, status); 31158 }, 1); 31159 }) 31160 .fail(function (jqXHR, status) { 31161 31162 // support: jQuery <1.8 31163 // http://bugs.jquery.com/ticket/11778 31164 setTimeout(function () { 31165 complete(jqXHR, status); 31166 }, 1); 31167 }); 31168 } 31169 }, 31170 31171 _ajaxSettings: function (anchor, event, eventData) { 31172 var that = this; 31173 return { 31174 31175 // Support: IE <11 only 31176 // Strip any hash that exists to prevent errors with the Ajax request 31177 url: anchor.attr("href").replace(/#.*$/, ""), 31178 beforeSend: function (jqXHR, settings) { 31179 return that._trigger("beforeLoad", event, 31180 $.extend({ jqXHR: jqXHR, ajaxSettings: settings }, eventData)); 31181 } 31182 }; 31183 }, 31184 31185 _getPanelForTab: function (tab) { 31186 var id = $(tab).attr("aria-controls"); 31187 return this.element.find(this._sanitizeSelector("#" + id)); 31188 } 31189 }); 31190 31191 // DEPRECATED 31192 // TODO: Switch return back to widget declaration at top of file when this is removed 31193 if ($.uiBackCompat !== false) { 31194 31195 // Backcompat for ui-tab class (now ui-tabs-tab) 31196 $.widget("ui.tabs", $.ui.tabs, { 31197 _processTabs: function () { 31198 this._superApply(arguments); 31199 this._addClass(this.tabs, "ui-tab"); 31200 } 31201 }); 31202 } 31203 31204 var widgetsTabs = $.ui.tabs; 31205 31206 31207 /*! 31208 * jQuery UI Tooltip 1.13.2 31209 * http://jqueryui.com 31210 * 31211 * Copyright jQuery Foundation and other contributors 31212 * Released under the MIT license. 31213 * http://jquery.org/license 31214 */ 31215 31216 //>>label: Tooltip 31217 //>>group: Widgets 31218 //>>description: Shows additional information for any element on hover or focus. 31219 //>>docs: http://api.jqueryui.com/tooltip/ 31220 //>>demos: http://jqueryui.com/tooltip/ 31221 //>>css.structure: ../../themes/base/core.css 31222 //>>css.structure: ../../themes/base/tooltip.css 31223 //>>css.theme: ../../themes/base/theme.css 31224 31225 31226 $.widget("ui.tooltip", { 31227 version: "1.13.2", 31228 options: { 31229 classes: { 31230 "ui-tooltip": "ui-corner-all ui-widget-shadow" 31231 }, 31232 content: function () { 31233 var title = $(this).attr("title"); 31234 31235 // Escape title, since we're going from an attribute to raw HTML 31236 return $("<a>").text(title).html(); 31237 }, 31238 hide: true, 31239 31240 // Disabled elements have inconsistent behavior across browsers (#8661) 31241 items: "[title]:not([disabled])", 31242 position: { 31243 my: "left top+15", 31244 at: "left bottom", 31245 collision: "flipfit flip" 31246 }, 31247 show: true, 31248 track: false, 31249 31250 // Callbacks 31251 close: null, 31252 open: null 31253 }, 31254 31255 _addDescribedBy: function (elem, id) { 31256 var describedby = (elem.attr("aria-describedby") || "").split(/\s+/); 31257 describedby.push(id); 31258 elem 31259 .data("ui-tooltip-id", id) 31260 .attr("aria-describedby", String.prototype.trim.call(describedby.join(" "))); 31261 }, 31262 31263 _removeDescribedBy: function (elem) { 31264 var id = elem.data("ui-tooltip-id"), 31265 describedby = (elem.attr("aria-describedby") || "").split(/\s+/), 31266 index = $.inArray(id, describedby); 31267 31268 if (index !== -1) { 31269 describedby.splice(index, 1); 31270 } 31271 31272 elem.removeData("ui-tooltip-id"); 31273 describedby = String.prototype.trim.call(describedby.join(" ")); 31274 if (describedby) { 31275 elem.attr("aria-describedby", describedby); 31276 } else { 31277 elem.removeAttr("aria-describedby"); 31278 } 31279 }, 31280 31281 _create: function () { 31282 this._on({ 31283 mouseover: "open", 31284 focusin: "open" 31285 }); 31286 31287 // IDs of generated tooltips, needed for destroy 31288 this.tooltips = {}; 31289 31290 // IDs of parent tooltips where we removed the title attribute 31291 this.parents = {}; 31292 31293 // Append the aria-live region so tooltips announce correctly 31294 this.liveRegion = $("<div>") 31295 .attr({ 31296 role: "log", 31297 "aria-live": "assertive", 31298 "aria-relevant": "additions" 31299 }) 31300 .appendTo(this.document[0].body); 31301 this._addClass(this.liveRegion, null, "ui-helper-hidden-accessible"); 31302 31303 this.disabledTitles = $([]); 31304 }, 31305 31306 _setOption: function (key, value) { 31307 var that = this; 31308 31309 this._super(key, value); 31310 31311 if (key === "content") { 31312 $.each(this.tooltips, function (id, tooltipData) { 31313 that._updateContent(tooltipData.element); 31314 }); 31315 } 31316 }, 31317 31318 _setOptionDisabled: function (value) { 31319 this[value ? "_disable" : "_enable"](); 31320 }, 31321 31322 _disable: function () { 31323 var that = this; 31324 31325 // Close open tooltips 31326 $.each(this.tooltips, function (id, tooltipData) { 31327 var event = $.Event("blur"); 31328 event.target = event.currentTarget = tooltipData.element[0]; 31329 that.close(event, true); 31330 }); 31331 31332 // Remove title attributes to prevent native tooltips 31333 this.disabledTitles = this.disabledTitles.add( 31334 this.element.find(this.options.items).addBack() 31335 .filter(function () { 31336 var element = $(this); 31337 if (element.is("[title]")) { 31338 return element 31339 .data("ui-tooltip-title", element.attr("title")) 31340 .removeAttr("title"); 31341 } 31342 }) 31343 ); 31344 }, 31345 31346 _enable: function () { 31347 31348 // restore title attributes 31349 this.disabledTitles.each(function () { 31350 var element = $(this); 31351 if (element.data("ui-tooltip-title")) { 31352 element.attr("title", element.data("ui-tooltip-title")); 31353 } 31354 }); 31355 this.disabledTitles = $([]); 31356 }, 31357 31358 open: function (event) { 31359 var that = this, 31360 target = $(event ? event.target : this.element) 31361 31362 // we need closest here due to mouseover bubbling, 31363 // but always pointing at the same event target 31364 .closest(this.options.items); 31365 31366 // No element to show a tooltip for or the tooltip is already open 31367 if (!target.length || target.data("ui-tooltip-id")) { 31368 return; 31369 } 31370 31371 if (target.attr("title")) { 31372 target.data("ui-tooltip-title", target.attr("title")); 31373 } 31374 31375 target.data("ui-tooltip-open", true); 31376 31377 // Kill parent tooltips, custom or native, for hover 31378 if (event && event.type === "mouseover") { 31379 target.parents().each(function () { 31380 var parent = $(this), 31381 blurEvent; 31382 if (parent.data("ui-tooltip-open")) { 31383 blurEvent = $.Event("blur"); 31384 blurEvent.target = blurEvent.currentTarget = this; 31385 that.close(blurEvent, true); 31386 } 31387 if (parent.attr("title")) { 31388 parent.uniqueId(); 31389 that.parents[this.id] = { 31390 element: this, 31391 title: parent.attr("title") 31392 }; 31393 parent.attr("title", ""); 31394 } 31395 }); 31396 } 31397 31398 this._registerCloseHandlers(event, target); 31399 this._updateContent(target, event); 31400 }, 31401 31402 _updateContent: function (target, event) { 31403 var content, 31404 contentOption = this.options.content, 31405 that = this, 31406 eventType = event ? event.type : null; 31407 31408 if (typeof contentOption === "string" || contentOption.nodeType || 31409 contentOption.jquery) { 31410 return this._open(event, target, contentOption); 31411 } 31412 31413 content = contentOption.call(target[0], function (response) { 31414 31415 // IE may instantly serve a cached response for ajax requests 31416 // delay this call to _open so the other call to _open runs first 31417 that._delay(function () { 31418 31419 // Ignore async response if tooltip was closed already 31420 if (!target.data("ui-tooltip-open")) { 31421 return; 31422 } 31423 31424 // JQuery creates a special event for focusin when it doesn't 31425 // exist natively. To improve performance, the native event 31426 // object is reused and the type is changed. Therefore, we can't 31427 // rely on the type being correct after the event finished 31428 // bubbling, so we set it back to the previous value. (#8740) 31429 if (event) { 31430 event.type = eventType; 31431 } 31432 this._open(event, target, response); 31433 }); 31434 }); 31435 if (content) { 31436 this._open(event, target, content); 31437 } 31438 }, 31439 31440 _open: function (event, target, content) { 31441 var tooltipData, tooltip, delayedShow, a11yContent, 31442 positionOption = $.extend({}, this.options.position); 31443 31444 if (!content) { 31445 return; 31446 } 31447 31448 // Content can be updated multiple times. If the tooltip already 31449 // exists, then just update the content and bail. 31450 tooltipData = this._find(target); 31451 if (tooltipData) { 31452 tooltipData.tooltip.find(".ui-tooltip-content").html(content); 31453 return; 31454 } 31455 31456 // If we have a title, clear it to prevent the native tooltip 31457 // we have to check first to avoid defining a title if none exists 31458 // (we don't want to cause an element to start matching [title]) 31459 // 31460 // We use removeAttr only for key events, to allow IE to export the correct 31461 // accessible attributes. For mouse events, set to empty string to avoid 31462 // native tooltip showing up (happens only when removing inside mouseover). 31463 if (target.is("[title]")) { 31464 if (event && event.type === "mouseover") { 31465 target.attr("title", ""); 31466 } else { 31467 target.removeAttr("title"); 31468 } 31469 } 31470 31471 tooltipData = this._tooltip(target); 31472 tooltip = tooltipData.tooltip; 31473 this._addDescribedBy(target, tooltip.attr("id")); 31474 tooltip.find(".ui-tooltip-content").html(content); 31475
31476 // Support: Voiceover on OS X, JAWS on IE <= 9 31477 // JAWS announces deletions even when aria-relevant="additions" 31478 // Voiceover will sometimes re-read the entire log region's contents from the beginning 31479 this.liveRegion.children().hide(); 31480 a11yContent = $("<div>").html(tooltip.find(".ui-tooltip-content").html()); 31481 a11yContent.removeAttr("name").find("[name]").removeAttr("name"); 31482 a11yContent.removeAttr("id").find("[id]").removeAttr("id"); 31483 a11yContent.appendTo(this.liveRegion); 31484 31485 function position(event) { 31486 positionOption.of = event; 31487 if (tooltip.is(":hidden")) { 31488 return; 31489 } 31490 tooltip.position(positionOption); 31491 } 31492 if (this.options.track && event && /^mouse/.test(event.type)) { 31493 this._on(this.document, { 31494 mousemove: position 31495 }); 31496 31497 // trigger once to override element-relative positioning 31498 position(event); 31499 } else { 31500 tooltip.position($.extend({ 31501 of: target 31502 }, this.options.position)); 31503 } 31504 31505 tooltip.hide(); 31506 31507 this._show(tooltip, this.options.show); 31508 31509 // Handle tracking tooltips that are shown with a delay (#8644). As soon 31510 // as the tooltip is visible, position the tooltip using the most recent 31511 // event. 31512 // Adds the check to add the timers only when both delay and track options are set (#14682) 31513 if (this.options.track && this.options.show && this.options.show.delay) { 31514 delayedShow = this.delayedShow = setInterval(function () { 31515 if (tooltip.is(":visible")) { 31516 position(positionOption.of); 31517 clearInterval(delayedShow); 31518 } 31519 }, 13); 31520 } 31521 31522 this._trigger("open", event, { tooltip: tooltip }); 31523 }, 31524 31525 _registerCloseHandlers: function (event, target) { 31526 var events = { 31527 keyup: function (event) { 31528 if (event.keyCode === $.ui.keyCode.ESCAPE) { 31529 var fakeEvent = $.Event(event); 31530 fakeEvent.currentTarget = target[0]; 31531 this.close(fakeEvent, true); 31532 } 31533 } 31534 }; 31535 31536 // Only bind remove handler for delegated targets. Non-delegated 31537 // tooltips will handle this in destroy. 31538 if (target[0] !== this.element[0]) { 31539 events.remove = function () { 31540 var targetElement = this._find(target); 31541 if (targetElement) { 31542 this._removeTooltip(targetElement.tooltip); 31543 } 31544 }; 31545 } 31546 31547 if (!event || event.type === "mouseover") { 31548 events.mouseleave = "close"; 31549 } 31550 if (!event || event.type === "focusin") { 31551 events.focusout = "close"; 31552 } 31553 this._on(true, target, events); 31554 }, 31555 31556 close: function (event) { 31557 var tooltip, 31558 that = this, 31559 target = $(event ? event.currentTarget : this.element), 31560 tooltipData = this._find(target); 31561 31562 // The tooltip may already be closed 31563 if (!tooltipData) { 31564 31565 // We set ui-tooltip-open immediately upon open (in open()), but only set the 31566 // additional data once there's actually content to show (in _open()). So even if the 31567 // tooltip doesn't have full data, we always remove ui-tooltip-open in case we're in 31568 // the period between open() and _open(). 31569 target.removeData("ui-tooltip-open"); 31570 return; 31571 } 31572 31573 tooltip = tooltipData.tooltip; 31574 31575 // Disabling closes the tooltip, so we need to track when we're closing 31576 // to avoid an infinite loop in case the tooltip becomes disabled on close 31577 if (tooltipData.closing) { 31578 return; 31579 } 31580 31581 // Clear the interval for delayed tracking tooltips 31582 clearInterval(this.delayedShow); 31583 31584 // Only set title if we had one before (see comment in _open()) 31585 // If the title attribute has changed since open(), don't restore 31586 if (target.data("ui-tooltip-title") && !target.attr("title")) { 31587 target.attr("title", target.data("ui-tooltip-title")); 31588 } 31589 31590 this._removeDescribedBy(target); 31591 31592 tooltipData.hiding = true; 31593 tooltip.stop(true); 31594 this._hide(tooltip, this.options.hide, function () { 31595 that._removeTooltip($(this)); 31596 }); 31597 31598 target.removeData("ui-tooltip-open"); 31599 this._off(target, "mouseleave focusout keyup"); 31600 31601 // Remove 'remove' binding only on delegated targets 31602 if (target[0] !== this.element[0]) { 31603 this._off(target, "remove"); 31604 } 31605 this._off(this.document, "mousemove"); 31606 31607 if (event && event.type === "mouseleave") { 31608 $.each(this.parents, function (id, parent) { 31609 $(parent.element).attr("title", parent.title); 31610 delete that.parents[id]; 31611 }); 31612 } 31613 31614 tooltipData.closing = true; 31615 this._trigger("close", event, { tooltip: tooltip }); 31616 if (!tooltipData.hiding) { 31617 tooltipData.closing = false; 31618 } 31619 }, 31620 31621 _tooltip: function (element) { 31622 var tooltip = $("<div>").attr("role", "tooltip"), 31623 content = $("<div>").appendTo(tooltip), 31624 id = tooltip.uniqueId().attr("id"); 31625 31626 this._addClass(content, "ui-tooltip-content"); 31627 this._addClass(tooltip, "ui-tooltip", "ui-widget ui-widget-content"); 31628 31629 tooltip.appendTo(this._appendTo(element)); 31630 31631 return this.tooltips[id] = { 31632 element: element, 31633 tooltip: tooltip 31634 }; 31635 }, 31636 31637 _find: function (target) { 31638 var id = target.data("ui-tooltip-id"); 31639 return id ? this.tooltips[id] : null; 31640 }, 31641 31642 _removeTooltip: function (tooltip) { 31643 31644 // Clear the interval for delayed tracking tooltips 31645 clearInterval(this.delayedShow); 31646 31647 tooltip.remove(); 31648 delete this.tooltips[tooltip.attr("id")]; 31649 }, 31650 31651 _appendTo: function (target) { 31652 var element = target.closest(".ui-front, dialog"); 31653 31654 if (!element.length) { 31655 element = this.document[0].body; 31656 } 31657 31658 return element; 31659 }, 31660 31661 _destroy: function () { 31662 var that = this; 31663 31664 // Close open tooltips 31665 $.each(this.tooltips, function (id, tooltipData) { 31666 31667 // Delegate to close method to handle common cleanup 31668 var event = $.Event("blur"), 31669 element = tooltipData.element; 31670 event.target = event.currentTarget = element[0]; 31671 that.close(event, true); 31672 31673 // Remove immediately; destroying an open tooltip doesn't use the 31674 // hide animation 31675 $("#" + id).remove(); 31676 31677 // Restore the title 31678 if (element.data("ui-tooltip-title")) { 31679 31680 // If the title attribute has changed since open(), don't restore 31681 if (!element.attr("title")) { 31682 element.attr("title", element.data("ui-tooltip-title")); 31683 } 31684 element.removeData("ui-tooltip-title"); 31685 } 31686 }); 31687 this.liveRegion.remove(); 31688 } 31689 }); 31690 31691 // DEPRECATED 31692 // TODO: Switch return back to widget declaration at top of file when this is removed 31693 if ($.uiBackCompat !== false) { 31694 31695 // Backcompat for tooltipClass option 31696 $.widget("ui.tooltip", $.ui.tooltip, { 31697 options: { 31698 tooltipClass: null 31699 }, 31700 _tooltip: function () { 31701 var tooltipData = this._superApply(arguments); 31702 if (this.options.tooltipClass) { 31703 tooltipData.tooltip.addClass(this.options.tooltipClass); 31704 } 31705 return tooltipData; 31706 } 31707 }); 31708 } 31709 31710 var widgetsTooltip = $.ui.tooltip; 31711 31712 31713 31714 31715});; 31716!function(a){var b=function(){window.asyncWebshims||(window.asyncWebshims={cfg:[],ready:[]})},c=function(){window.jQuery&&(a(jQuery),a=function(){return window.webshims})};window.webshims={setOptions:function(){b(),window.asyncWebshims.cfg.push(arguments)},ready:function(){b(),window.asyncWebshims.ready.push(arguments)},activeLang:function(a){b(),window.asyncWebshims.lang=a},polyfill:function(a){b(),window.asyncWebshims.polyfill=a},_curScript:function(){var a,b,c,d,e,f=document.currentScript;if(!f){try{throw new Error("")}catch(g){for(c=(g.sourceURL||g.stack||"").split("\n"),e=/(?:fil|htt|wid|abo|app|res)(.)+/i,b=0;b<c.length;b++)if(d=c[b].match(e)){c=d[0].replace(/[\:\s\(]+[\d\:\)\(\s]+$/,"");break}}for(a=document.scripts||document.getElementsByTagName("script"),b=0;b<a.length&&(!a[b].getAttribute("src")||(f=a[b],"interactive"!=a[b].readyState&&c!=a[b].src));b++);}return f}()},window.webshim=window.webshims,window.webshims.timer=setInterval(c,0),c(),"function"==typeof define&&define.amd&&define("polyfiller",["jquery"],a)}(function(a){"use strict";function b(a){return document.createElement(a)}var c,d,e=window.navigator,f=window.webshims,g="dom-support",h=a.event.special,i=a([]),j=window.asyncWebshims,k={},l=window.Object,m=function(a){return a+"\n//# sourceURL="+this.url},n=function(a){return q.enhanceAuto||"auto"!=a?a:!1},o={matchmedia:"matchMedia",xhr2:"filereader",promise:"es6",URL:"url"},p="capture"in b("input");clearInterval(f.timer),k.advancedObjectProperties=k.objectAccessor=k.ES5=!!("create"in l&&"seal"in l),!k.ES5||"toJSON"in Date.prototype||(k.ES5=!1),d=a.support.hrefNormalized===!1?f._curScript.getAttribute("src",4):f._curScript.src,d=d.split("?")[0].slice(0,d.lastIndexOf("/")+1)+"shims/",a.extend(f,{version:"1.16.0",cfg:{enhanceAuto:window.Audio&&(!window.matchMedia||matchMedia("(min-device-width: 721px)").matches),waitReady:!0,loadStyles:!0,wsdoc:document,wspopover:{appendTo:"auto",hideOnBlur:!0},ajax:{crossDomain:!0},loadScript:function(b,c){a.ajax(a.extend({},q.ajax,{url:b,success:c,dataType:"script",cache:!0,global:!1,dataFilter:m}))},basePath:d},support:k,bugs:{},modules:{},features:{},featureList:[],setOptions:function(b,c){"string"==typeof b&&arguments.length>1?q[b]=a.isPlainObject(c)?a.extend(!0,q[b]||{},c):c:"object"==typeof b&&a.extend(!0,q,b)},_getAutoEnhance:n,addPolyfill:function(b,c){c=c||{};var d=c.f||b;r[d]||(r[d]=[],f.featureList.push(d),q[d]={}),r[d].push(b),c.options=a.extend(q[d],c.options),y(b,c),c.methodNames&&a.each(c.methodNames,function(a,b){f.addMethodName(b)})},polyfill:function(){return function(a){a||(a=f.featureList),"string"==typeof a&&(a=a.split(" "));return f._polyfill(a)}}(),_polyfill:function(b){var d,e,f=[];c.run||(d=-1!==a.inArray("forms-ext",b),c(),e=d&&!v["form-number-date-ui"].test()||!p&&-1!==a.inArray("mediacapture",b),d&&-1==a.inArray("forms",b)&&b.push("forms"),q.loadStyles&&w.loadCSS("styles/shim"+(e?"-ext":"")+".css")),q.waitReady&&(a.readyWait++,t(b,function(){a.ready(!0)})),a.each(b,function(a,b){return b=o[b]||b,r[b]?(b!==r[b][0]&&t(r[b],function(){s(b,!0)}),void(f=f.concat(r[b]))):void s(b,!0)}),x(f),a.each(b,function(a,b){var c=q[b];c&&("mediaelement"==b&&(c.replaceUI=n(c.replaceUI))&&c.plugins.unshift("mediacontrol
31716s"),c.plugins&&c.plugins.length&&x(q[b].plugins))})},reTest:function(){var b,c=function(c,d){var e=v[d],f=d+"Ready";!e||e.loaded||(e.test&&a.isFunction(e.test)?e.test([]):e.test)||(h[f]&&delete h[f],r[e.f],b.push(d))};return function(d){"string"==typeof d&&(d=d.split(" ")),b=[],a.each(d,c),x(b)}}(),isReady:function(b,c){if(b+="Ready",c){if(h[b]&&h[b].add)return!0;h[b]=a.extend(h[b]||{},{add:function(a){a.handler.call(this,b)}}),a(document).triggerHandler(b)}return!(!h[b]||!h[b].add)||!1},ready:function(b,c){var d=arguments[2];if("string"==typeof b&&(b=b.split(" ")),d||(b=a.map(a.grep(b,function(a){return!s(a)}),function(a){return a+"Ready"})),!b.length)return void c(a,f,window,document);var e=b.shift(),g=function(){t(b,c,!0)};a(document).one(e,g)},capturingEvents:function(b,c){document.addEventListener&&("string"==typeof b&&(b=[b]),a.each(b,function(b,d){var e=function(b){return b=a.event.fix(b),c&&f.capturingEventPrevented&&f.capturingEventPrevented(b),a.event.dispatch.call(this,b)};h[d]=h[d]||{},h[d].setup||h[d].teardown||a.extend(h[d],{setup:function(){this.addEventListener(d,e,!0)},teardown:function(){this.removeEventListener(d,e,!0)}})}))},register:function(b,c){var d=v[b];if(!d)return void f.error("can't find module: "+b);d.loaded=!0;var e=function(){c(a,f,window,document,void 0,d.options),s(b,!0)};d.d&&d.d.length?t(d.d,e):e()},c:{},loader:{addModule:function(b,c){v[b]=c,c.name=c.name||b,c.c||(c.c=[]),a.each(c.c,function(a,c){f.c[c]||(f.c[c]=[]),f.c[c].push(b)})},loadList:function(){var b=[],c=function(c,d){"string"==typeof d&&(d=[d]),a.merge(b,d),w.loadScript(c,!1,d)},d=function(c,d){if(s(c)||-1!=a.inArray(c,b))return!0;var e,f=v[c];return f?(e=f.test&&a.isFunction(f.test)?f.test(d):f.test,e?(s(c,!0),!0):!1):!0},e=function(b,c){if(b.d&&b.d.length){var e=function(b,e){d(e,c)||-1!=a.inArray(e,c)||c.push(e)};a.each(b.d,function(b,c){v[c]?v[c].loaded||e(b,c):r[c]&&(a.each(r[c],e),t(r[c],function(){s(c,!0)}))}),b.noAutoCallback||(b.noAutoCallback=!0)}};return function(g){var h,i,j,k,l=[],m=function(d,e){return k=e,a.each(f.c[e],function(c,d){return-1==a.inArray(d,l)||-1!=a.inArray(d,b)?(k=!1,!1):void 0}),k?(c("combos/"+k,f.c[k]),!1):void 0};for(i=0;i<g.length;i++)h=v[g[i]],h&&!d(h.name,g)&&(h.css&&q.loadStyles&&w.loadCSS(h.css),h.loadInit&&h.loadInit(),e(h,g),h.loaded||l.push(h.name),h.loaded=!0);for(i=0,j=l.length;j>i;i++)k=!1,h=l[i],-1==a.inArray(h,b)&&("noCombo"!=q.debug&&a.each(v[h].c,m),k||c(v[h].src||h,h))}}(),makePath:function(a){return-1!=a.indexOf("//")||0===a.indexOf("/")?a:(-1==a.indexOf(".")&&(a+=".js"),q.addCacheBuster&&(a+=q.addCacheBuster),q.basePath+a)},loadCSS:function(){var b,c={};return function(d){d=this.makePath(d),c[d]||(b=b||a("link, style")[0]||a("script")[0],c[d]=1,a('<link rel="stylesheet" />').insertBefore(b).attr({href:d}))}}(),loadScript:function(){var b={};return function(c,d,e,f){if(f||(c=w.makePath(c)),!b[c]){var g=function(){d&&d(),e&&("string"==typeof e&&(e=e.split(" ")),a.each(e,function(a,b){v[b]&&(v[b].afterLoad&&v[b].afterLoad(),s(v[b].noAutoCallback?b+"FileLoaded":b,!0))}))};b[c]=1,q.loadScript(c,g,a.noop)}}}()}});var q=f.cfg,r=f.features,s=f.isReady,t=f.ready,u=f.addPolyfill,v=f.modules,w=f.loader,x=w.loadList,y=w.addModule,z=f.bugs,A=[],B={warn:1,error:1},C=a.fn,D=b("video");f.addMethodName=function(a){a=a.split(":");var b=a[1];1==a.length?(b=a[0],a=a[0]):a=a[0],C[a]=function(){return this.callProp(b,arguments)}},C.callProp=function(b,c){var d;return c||(c=[]),this.each(function(){var e=a.prop(this,b);if(e&&e.apply){if(d=e.apply(this,c),void 0!==d)return!1}else f.warn(b+" is not a method of "+this)}),void 0!==d?d:this},f.activeLang=function(){"language"in e||(e.language=e.browserLanguage||"");var b=a.attr(document.documentElement,"lang")||e.language;return t("webshimLocalization",function(){f.activeLang(b)}),function(a){if(a)if("string"==typeof a)b=a;else if("object"==typeof a){var c=arguments,d=this;t("webshimLocalization",function(){f.activeLang.apply(d,c)})}return b}}(),f.errorLog=[],a.each(["log","error","warn","info"],function(a,b){f[b]=function(a){(B[b]&&q.debug!==!1||q.debug)&&(f.errorLog.push(a),window.console&&console.log&&console[console[b]?b:"log"](a))}}),function(){a.isDOMReady=a.isReady;var b=function(){a.isDOMReady=!0,s("DOM",!0),setTimeout(function(){s("WINDOWLOAD",!0)},9999)};
31716c=function(){if(!c.run){if(!a.isDOMReady&&q.waitReady){var d=a.ready;a.ready=function(a){return a!==!0&&document.body&&b(),d.apply(this,arguments)},a.ready.promise=d.promise}q.readyEvt?a(document).one(q.readyEvt,b):a(b)}c.run=!0},a(window).on("load",function(){b(),setTimeout(function(){s("WINDOWLOAD",!0)},9)});var d=[],e=function(){1==this.nodeType&&f.triggerDomUpdate(this)};a.extend(f,{addReady:function(a){var b=function(b,c){f.ready("DOM",function(){a(b,c)})};d.push(b),q.wsdoc&&b(q.wsdoc,i)},triggerDomUpdate:function(b){if(!b||!b.nodeType)return void(b&&b.jquery&&b.each(function(){f.triggerDomUpdate(this)}));var c=b.nodeType;if(1==c||9==c){var e=b!==document?a(b):i;a.each(d,function(a,c){c(b,e)})}}}),C.clonePolyfill=C.clone,C.htmlPolyfill=function(b){if(!arguments.length)return a(this.clonePolyfill()).html();var c=C.html.call(this,b);return c===this&&a.isDOMReady&&this.each(e),c},C.jProp=function(){return this.pushStack(a(C.prop.apply(this,arguments)||[]))},a.each(["after","before","append","prepend","replaceWith"],function(b,c){C[c+"Polyfill"]=function(b){return b=a(b),C[c].call(this,b),a.isDOMReady&&b.each(e),this}}),a.each(["insertAfter","insertBefore","appendTo","prependTo","replaceAll"],function(b,c){C[c.replace(/[A-Z]/,function(a){return"Polyfill"+a})]=function(){return C[c].apply(this,arguments),a.isDOMReady&&f.triggerDomUpdate(this),this}}),C.updatePolyfill=function(){return a.isDOMReady&&f.triggerDomUpdate(this),this},a.each(["getNativeElement","getShadowElement","getShadowFocusElement"],function(a,b){C[b]=function(){return this.pushStack(this)}})}(),l.create&&(f.objectCreate=function(b,c,d){var e=l.create(b);return d&&(e.options=a.extend(!0,{},e.options||{},d),d=e.options),e._create&&a.isFunction(e._create)&&e._create(d),e}),y("swfmini",{test:function(){return window.swfobject&&!window.swfmini&&(window.swfmini=window.swfobject),"swfmini"in window},c:[16,7,2,8,1,12,23]}),v.swfmini.test(),y("sizzle",{test:a.expr.filters}),u("es5",{test:!(!k.ES5||!Function.prototype.bind),d:["sizzle"]}),u("dom-extend",{f:g,noAutoCallback:!0,d:["es5"],c:[16,7,2,15,30,3,8,4,9,10,25,31,34]}),b("picture"),u("picture",{test:"picturefill"in window||!!window.HTMLPictureElement||"respimage"in window,d:["matchMedia"],c:[18],loadInit:function(){s("picture",!0)}}),u("matchMedia",{test:!(!window.matchMedia||!matchMedia("all").addListener),c:[18]}),u("sticky",{test:-1!=(a(b("b")).attr("style","position: -webkit-sticky; position: sticky").css("position")||"").indexOf("sticky"),d:["es5","matchMedia"]}),u("es6",{test:!!(Math.imul&&Number.MIN_SAFE_INTEGER&&l.is&&window.Promise&&Promise.all),d:["es5"]}),u("geolocation",{test:"geolocation"in e,options:{destroyWrite:!0},c:[21]}),function(){u("canvas",{src:"excanvas",test:"getContext"in b("canvas"),options:{type:"flash"},noAutoCallback:!0,loadInit:function(){var a=this.options.type;!a||-1===a.indexOf("flash")||v.swfmini.test()&&!swfmini.hasFlashPlayerVersion("9.0.0")||(this.src="flash"==a?"FlashCanvas/flashcanvas":"FlashCanvasPro/flashcanvas")},methodNames:["getContext"],d:[g]})}();var E="getUserMedia"in e;u("usermedia-core",{f:"usermedia",test:E&&!!window.URL,d:["url",g]}),u("usermedia-shim",{f:"usermedia",test:!!(E||e.webkitGetUserMedia||e.mozGetUserMedia||e.msGetUserMedia),d:["url","mediaelement",g]}),u("mediacapture",{test:p,d:["swfmini","usermedia",g,"filereader","forms","canvas"]}),function(){var c,d,h="form-shim-extend",i="formvalidation",j="form-number-date-api",l=!1,m=!1,o=!1,p={},r=b("progress"),s=b("output"),t=function(){var d,f,g="1(",j=b("input");if(f=a('<fieldset><textarea required="" /></fieldset>')[0],k.inputtypes=p,a.each(["range","date","datetime-local","month","color","number"],function(a,b){j.setAttribute("type",b),p[b]=j.type==b&&(j.value=g)&&j.value!=g}),k.datalist=!!("options"in b("datalist")&&window.HTMLDataListElement),k[i]="checkValidity"in j,k.fieldsetelements="elements"in f,k.fieldsetdisabled="disabled"in f){try{f.querySelector(":invalid")&&(f.disabled=!0,d=!f.querySelector(":invalid")&&f.querySelector(":disabled"))}catch(n){}k.fieldsetdisabled=!!d}if(k[i]&&(m=!(k.fieldsetdisabled&&k.fieldsetelements&&"value"in r&&"value"in s),o=m&&/Android/i.test(e.userAgent),l=window.opera||z.bustedValidity||m||!k.datalist,!l&&p.number)){l=!0;try{j.type="number",j.value="",j.stepUp(),l="1"!=j.value}catch(q){}}return z.bustedValidity=l,c=k[i]&&!l?"form-native-extend":h,t=a.noop,!1},w=function(b){var c=!0;
31716return b._types||(b._types=b.types.split(" ")),a.each(b._types,function(a,b){return b in p&&!p[b]?(c=!1,!1):void 0}),c};f.validationMessages=f.validityMessages={langSrc:"i18n/formcfg-",availableLangs:"ar bg ca cs el es fa fi fr he hi hu it ja lt nl no pl pt pt-BR pt-PT ru sv zh-CN zh-TW".split(" ")},f.formcfg=a.extend({},f.validationMessages),f.inputTypes={},u("form-core",{f:"forms",test:t,d:["es5"],options:{placeholderType:"value",messagePopover:{},list:{popover:{constrainWidth:!0}},iVal:{sel:".ws-validate",handleBubble:"hide",recheckDelay:400}},methodNames:["setCustomValidity","checkValidity","setSelectionRange"],c:[16,7,2,8,1,15,30,3,31]}),d=q.forms,u("form-native-extend",{f:"forms",test:function(b){return t(),!k[i]||l||-1==a.inArray(j,b||[])||v[j].test()},d:["form-core",g,"form-message"],c:[6,5,14,29]}),u(h,{f:"forms",test:function(){return t(),k[i]&&!l},d:["form-core",g,"sizzle"],c:[16,15,28]}),u(h+"2",{f:"forms",test:function(){return t(),k[i]&&!m},d:[h],c:[27]}),u("form-message",{f:"forms",test:function(a){return t(),!(d.customMessages||!k[i]||l||!v[c].test(a))},d:[g],c:[16,7,15,30,3,8,4,14,28]}),u(j,{f:"forms-ext",options:{types:"date time range number"},test:function(){t();var a=!l;return a&&(a=w(this.options)),a},methodNames:["stepUp","stepDown"],d:["forms",g],c:[6,5,17,14,28,29,33]}),y("range-ui",{options:{},noAutoCallback:!0,test:function(){return!!C.rangeUI},d:["es5"],c:[6,5,9,10,17,11]}),u("form-number-date-ui",{f:"forms-ext",test:function(){var a=this.options;return a.replaceUI=n(a.replaceUI),t(),!a.replaceUI&&o&&(a.replaceUI=!0),!a.replaceUI&&w(a)},d:["forms",g,j,"range-ui"],options:{widgets:{calculateWidth:!0,animate:!0}},c:[6,5,9,10,17,11]}),u("form-datalist",{f:"forms",test:function(){return t(),o&&(d.customDatalist=!0),k.datalist&&!d.fD},d:["form-core",g],c:[16,7,6,2,9,15,30,31,28,33]})}();var F="FileReader"in window&&"FormData"in window;return u("filereader-xhr",{f:"filereader",test:F,d:[g,"swfmini"],c:[25,27]}),u("canvas-blob",{f:"filereader",methodNames:["toBlob"],test:!(F&&!b("canvas").toBlob)}),u("details",{test:"open"in b("details"),d:[g],options:{text:"Details"},c:[21,22]}),u("url",{test:function(){var a=!1;try{a=new URL("b","http://a"),a=!(!a.searchParams||"http://a/b"!=a.href)}catch(b){}return a},d:["es5"]}),function(){f.mediaelement={};var c=b("track");if(k.mediaelement="canPlayType"in D,k.texttrackapi="addTextTrack"in D,k.track="kind"in c,b("audio"),!(z.track=!k.texttrackapi))try{z.track=!("oncuechange"in D.addTextTrack("metadata"))}catch(d){}u("mediaelement-core",{f:"mediaelement",noAutoCallback:!0,options:{jme:{},plugins:[],vars:{},params:{},attrs:{},changeSWF:a.noop},methodNames:["play","pause","canPlayType","mediaLoad:load"],d:["swfmini"],c:[16,7,2,8,1,12,13,23]}),u("mediaelement-jaris",{f:"mediaelement",d:["mediaelement-core",g],test:function(){var a=this.options;return!k.mediaelement||f.mediaelement.loadSwf?!1:(a.preferFlash&&!v.swfmini.test()&&(a.preferFlash=!1),!(a.preferFlash&&swfmini.hasFlashPlayerVersion("11.3")))},c:[21,25]}),u("track",{options:{positionDisplay:!0,override:z.track},test:function(){var a=this.options;return a.override=n(a.override),!a.override&&!z.track},d:["mediaelement",g],methodNames:["addTextTrack"],c:[21,12,13,22,34]}),y("jmebase",{src:"jme/base",c:[98,99,97]}),a.each([["mediacontrols",{c:[98,99],css:"jme/controls.css"}],["playlist",{c:[98,97]}],["alternate-media"]],function(b,c){y(c[0],a.extend({src:"jme/"+c[0],d:["jmebase"]},c[1]))}),y("track-ui",{d:["track",g]})}(),u("feature-dummy",{test:!0,loaded:!0,c:A}),f.$=a,a.webshims=f,a.webshim=webshim,f.callAsync=function(){f.callAsync=a.noop,j&&(j.cfg&&(j.cfg.length||(j.cfg=[[j.cfg]]),a.each(j.cfg,function(a,b){f.setOptions.apply(f,b)})),j.ready&&a.each(j.ready,function(a,b){f.ready.apply(f,b)}),j.lang&&f.activeLang(j.lang),"polyfill"in j&&f.polyfill(j.polyfill)),f.isReady("jquery",!0)},f.callAsync(),f});; 31717/*! 31718 * Bootstrap v3.3.7 (http://getbootstrap.com) 31719 * Copyright 2011-2016 Twitter, Inc. 31720 * Licensed under the MIT license 31721 */ 31722 31723if (typeof jQuery === 'undefined') { 31724 throw new Error('Bootstrap\'s JavaScript requires jQuery') 31725} 31726 31727+function ($) { 31728 'use strict'; 31729 var version = $.fn.jquery.split(' ')[0].split('.') 31730 if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1) || (version[0] > 3)) { 31731 throw new Error('Bootstrap\'s JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4') 31732 } 31733}(jQuery); 31734 31735/* ======================================================================== 31736 * Bootstrap: transition.js v3.3.7 31737 * http://getbootstrap.com/javascript/#transitions 31738 * ======================================================================== 31739 * Copyright 2011-2016 Twitter, Inc. 31740 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 31741 * ======================================================================== */ 31742 31743 31744+function ($) { 31745 'use strict'; 31746
vendor: 6,193 bytes, lines 31747-31963
31747 // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/) 31748 // ============================================================ 31749 31750 function transitionEnd() { 31751 var el = document.createElement('bootstrap') 31752 31753 var transEndEventNames = { 31754 WebkitTransition : 'webkitTransitionEnd', 31755 MozTransition : 'transitionend', 31756 OTransition : 'oTransitionEnd otransitionend', 31757 transition : 'transitionend' 31758 } 31759 31760 for (var name in transEndEventNames) { 31761 if (el.style[name] !== undefined) { 31762 return { end: transEndEventNames[name] } 31763 } 31764 } 31765 31766 return false // explicit for ie8 ( ._.) 31767 } 31768 31769 // http://blog.alexmaccaw.com/css-transitions 31770 $.fn.emulateTransitionEnd = function (duration) { 31771 var called = false 31772 var $el = this 31773 $(this).one('bsTransitionEnd', function () { called = true }) 31774 var callback = function () { if (!called) $($el).trigger($.support.transition.end) } 31775 setTimeout(callback, duration) 31776 return this 31777 } 31778 31779 $(function () { 31780 $.support.transition = transitionEnd() 31781 31782 if (!$.support.transition) return 31783 31784 $.event.special.bsTransitionEnd = { 31785 bindType: $.support.transition.end, 31786 delegateType: $.support.transition.end, 31787 handle: function (e) { 31788 if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments) 31789 } 31790 } 31791 }) 31792 31793}(jQuery); 31794 31795/* ======================================================================== 31796 * Bootstrap: alert.js v3.3.7 31797 * http://getbootstrap.com/javascript/#alerts 31798 * ======================================================================== 31799 * Copyright 2011-2016 Twitter, Inc. 31800 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 31801 * ======================================================================== */ 31802 31803 31804+function ($) { 31805 'use strict'; 31806 31807 // ALERT CLASS DEFINITION 31808 // ====================== 31809 31810 var dismiss = '[data-dismiss="alert"]' 31811 var Alert = function (el) { 31812 $(el).on('click', dismiss, this.close) 31813 } 31814 31815 Alert.VERSION = '3.3.7' 31816 31817 Alert.TRANSITION_DURATION = 150 31818 31819 Alert.prototype.close = function (e) { 31820 var $this = $(this) 31821 var selector = $this.attr('data-target') 31822 31823 if (!selector) { 31824 selector = $this.attr('href') 31825 selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 31826 } 31827 31828 var $parent = $(selector === '#' ? [] : selector) 31829 31830 if (e) e.preventDefault() 31831 31832 if (!$parent.length) { 31833 $parent = $this.closest('.alert') 31834 } 31835 31836 $parent.trigger(e = $.Event('close.bs.alert')) 31837 31838 if (e.isDefaultPrevented()) return 31839 31840 $parent.removeClass('in') 31841 31842 function removeElement() { 31843 // detach from parent, fire event then clean up data 31844 $parent.detach().trigger('closed.bs.alert').remove() 31845 } 31846 31847 $.support.transition && $parent.hasClass('fade') ? 31848 $parent 31849 .one('bsTransitionEnd', removeElement) 31850 .emulateTransitionEnd(Alert.TRANSITION_DURATION) : 31851 removeElement() 31852 } 31853 31854 31855 // ALERT PLUGIN DEFINITION 31856 // ======================= 31857 31858 function Plugin(option) { 31859 return this.each(function () { 31860 var $this = $(this) 31861 var data = $this.data('bs.alert') 31862 31863 if (!data) $this.data('bs.alert', (data = new Alert(this))) 31864 if (typeof option == 'string') data[option].call($this) 31865 }) 31866 } 31867 31868 var old = $.fn.alert 31869 31870 $.fn.alert = Plugin 31871 $.fn.alert.Constructor = Alert 31872 31873 31874 // ALERT NO CONFLICT 31875 // ================= 31876 31877 $.fn.alert.noConflict = function () { 31878 $.fn.alert = old 31879 return this 31880 } 31881 31882 31883 // ALERT DATA-API 31884 // ============== 31885 31886 $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close) 31887 31888}(jQuery); 31889 31890/* ======================================================================== 31891 * Bootstrap: button.js v3.3.7 31892 * http://getbootstrap.com/javascript/#buttons 31893 * ======================================================================== 31894 * Copyright 2011-2016 Twitter, Inc. 31895 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 31896 * ======================================================================== */ 31897 31898 31899+function ($) { 31900 'use strict'; 31901 31902 // BUTTON PUBLIC CLASS DEFINITION 31903 // ============================== 31904 31905 var Button = function (element, options) { 31906 this.$element = $(element) 31907 this.options = $.extend({}, Button.DEFAULTS, options) 31908 this.isLoading = false 31909 } 31910 31911 Button.VERSION = '3.3.7' 31912 31913 Button.DEFAULTS = { 31914 loadingText: 'loading...' 31915 } 31916 31917 Button.prototype.setState = function (state) { 31918 var d = 'disabled' 31919 var $el = this.$element 31920 var val = $el.is('input') ? 'val' : 'html' 31921 var data = $el.data() 31922 31923 state += 'Text' 31924 31925 if (data.resetText == null) $el.data('resetText', $el[val]()) 31926 31927 // push to event loop to allow forms to submit 31928 setTimeout($.proxy(function () { 31929 $el[val](data[state] == null ? this.options[state] : data[state]) 31930 31931 if (state == 'loadingText') { 31932 this.isLoading = true 31933 $el.addClass(d).attr(d, d).prop(d, true) 31934 } else if (this.isLoading) { 31935 this.isLoading = false 31936 $el.removeClass(d).removeAttr(d).prop(d, false) 31937 } 31938 }, this), 0) 31939 } 31940 31941 Button.prototype.toggle = function () { 31942 var changed = true 31943 var $parent = this.$element.closest('[data-toggle="buttons"]') 31944 31945 if ($parent.length) { 31946 var $input = this.$element.find('input') 31947 if ($input.prop('type') == 'radio') { 31948 if ($input.prop('checked')) changed = false 31949 $parent.find('.active').removeClass('active') 31950 this.$element.addClass('active') 31951 } else if ($input.prop('type') == 'checkbox') { 31952 if (($input.prop('checked')) !== this.$element.hasClass('active')) changed = false 31953 this.$element.toggleClass('active') 31954 } 31955 $input.prop('checked', this.$element.hasClass('active')) 31956 if (changed) $input.trigger('change') 31957 } else { 31958 this.$element.attr('aria-pressed', !this.$element.hasClass('active')) 31959 this.$element.toggleClass('active') 31960 } 31961 } 31962 31963
vendor: 6,227 bytes, lines 31964-32159
31964 // BUTTON PLUGIN DEFINITION 31965 // ======================== 31966 31967 function Plugin(option) { 31968 return this.each(function () { 31969 var $this = $(this) 31970 var data = $this.data('bs.button') 31971 var options = typeof option == 'object' && option 31972 31973 if (!data) $this.data('bs.button', (data = new Button(this, options))) 31974 31975 if (option == 'toggle') data.toggle() 31976 else if (option) data.setState(option) 31977 }) 31978 } 31979 31980 var old = $.fn.button 31981 31982 $.fn.button = Plugin 31983 $.fn.button.Constructor = Button 31984 31985 31986 // BUTTON NO CONFLICT 31987 // ================== 31988 31989 $.fn.button.noConflict = function () { 31990 $.fn.button = old 31991 return this 31992 } 31993 31994 31995 // BUTTON DATA-API 31996 // =============== 31997 31998 $(document) 31999 .on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) { 32000 var $btn = $(e.target).closest('.btn') 32001 Plugin.call($btn, 'toggle') 32002 if (!($(e.target).is('input[type="radio"], input[type="checkbox"]'))) { 32003 // Prevent double click on radios, and the double selections (so cancellation) on checkboxes 32004 e.preventDefault() 32005 // The target component still receive the focus 32006 if ($btn.is('input,button')) $btn.trigger('focus') 32007 else $btn.find('input:visible,button:visible').first().trigger('focus') 32008 } 32009 }) 32010 .on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) { 32011 $(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type)) 32012 }) 32013 32014}(jQuery); 32015 32016/* ======================================================================== 32017 * Bootstrap: carousel.js v3.3.7 32018 * http://getbootstrap.com/javascript/#carousel 32019 * ======================================================================== 32020 * Copyright 2011-2016 Twitter, Inc. 32021 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 32022 * ======================================================================== */ 32023 32024 32025+function ($) { 32026 'use strict'; 32027 32028 // CAROUSEL CLASS DEFINITION 32029 // ========================= 32030 32031 var Carousel = function (element, options) { 32032 this.$element = $(element) 32033 this.$indicators = this.$element.find('.carousel-indicators') 32034 this.options = options 32035 this.paused = null 32036 this.sliding = null 32037 this.interval = null 32038 this.$active = null 32039 this.$items = null 32040 32041 this.options.keyboard && this.$element.on('keydown.bs.carousel', $.proxy(this.keydown, this)) 32042 32043 this.options.pause == 'hover' && !('ontouchstart' in document.documentElement) && this.$element 32044 .on('mouseenter.bs.carousel', $.proxy(this.pause, this)) 32045 .on('mouseleave.bs.carousel', $.proxy(this.cycle, this)) 32046 } 32047 32048 Carousel.VERSION = '3.3.7' 32049 32050 Carousel.TRANSITION_DURATION = 600 32051 32052 Carousel.DEFAULTS = { 32053 interval: 5000, 32054 pause: 'hover', 32055 wrap: true, 32056 keyboard: true 32057 } 32058 32059 Carousel.prototype.keydown = function (e) { 32060 if (/input|textarea/i.test(e.target.tagName)) return 32061 switch (e.which) { 32062 case 37: this.prev(); break 32063 case 39: this.next(); break 32064 default: return 32065 } 32066 32067 e.preventDefault() 32068 } 32069 32070 Carousel.prototype.cycle = function (e) { 32071 e || (this.paused = false) 32072 32073 this.interval && clearInterval(this.interval) 32074 32075 this.options.interval 32076 && !this.paused 32077 && (this.interval = setInterval($.proxy(this.next, this), this.options.interval)) 32078 32079 return this 32080 } 32081 32082 Carousel.prototype.getItemIndex = function (item) { 32083 this.$items = item.parent().children('.item') 32084 return this.$items.index(item || this.$active) 32085 } 32086 32087 Carousel.prototype.getItemForDirection = function (direction, active) { 32088 var activeIndex = this.getItemIndex(active) 32089 var willWrap = (direction == 'prev' && activeIndex === 0) 32090 || (direction == 'next' && activeIndex == (this.$items.length - 1)) 32091 if (willWrap && !this.options.wrap) return active 32092 var delta = direction == 'prev' ? -1 : 1 32093 var itemIndex = (activeIndex + delta) % this.$items.length 32094 return this.$items.eq(itemIndex) 32095 } 32096 32097 Carousel.prototype.to = function (pos) { 32098 var that = this 32099 var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active')) 32100 32101 if (pos > (this.$items.length - 1) || pos < 0) return 32102 32103 if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid" 32104 if (activeIndex == pos) return this.pause().cycle() 32105 32106 return this.slide(pos > activeIndex ? 'next' : 'prev', this.$items.eq(pos)) 32107 } 32108 32109 Carousel.prototype.pause = function (e) { 32110 e || (this.paused = true) 32111 32112 if (this.$element.find('.next, .prev').length && $.support.transition) { 32113 this.$element.trigger($.support.transition.end) 32114 this.cycle(true) 32115 } 32116 32117 this.interval = clearInterval(this.interval) 32118 32119 return this 32120 } 32121 32122 Carousel.prototype.next = function () { 32123 if (this.sliding) return 32124 return this.slide('next') 32125 } 32126 32127 Carousel.prototype.prev = function () { 32128 if (this.sliding) return 32129 return this.slide('prev') 32130 } 32131 32132 Carousel.prototype.slide = function (type, next) { 32133 var $active = this.$element.find('.item.active') 32134 var $next = next || this.getItemForDirection(type, $active) 32135 var isCycling = this.interval 32136 var direction = type == 'next' ? 'left' : 'right' 32137 var that = this 32138 32139 if ($next.hasClass('active')) return (this.sliding = false) 32140 32141 var relatedTarget = $next[0] 32142 var slideEvent = $.Event('slide.bs.carousel', { 32143 relatedTarget: relatedTarget, 32144 direction: direction 32145 }) 32146 this.$element.trigger(slideEvent) 32147 if (slideEvent.isDefaultPrevented()) return 32148 32149 this.sliding = true 32150 32151 isCycling && this.pause() 32152 32153 if (this.$indicators.length) { 32154 this.$indicators.find('.active').removeClass('active') 32155 var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)]) 32156 $nextIndicator && $nextIndicator.addClass('active') 32157 } 32158 32159 var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, "slid"
vendor: 18,259 bytes, lines 32160-32785
32160 if ($.support.transition && this.$element.hasClass('slide')) { 32161 $next.addClass(type) 32162 $next[0].offsetWidth // force reflow 32163 $active.addClass(direction) 32164 $next.addClass(direction) 32165 $active 32166 .one('bsTransitionEnd', function () { 32167 $next.removeClass([type, direction].join(' ')).addClass('active') 32168 $active.removeClass(['active', direction].join(' ')) 32169 that.sliding = false 32170 setTimeout(function () { 32171 that.$element.trigger(slidEvent) 32172 }, 0) 32173 }) 32174 .emulateTransitionEnd(Carousel.TRANSITION_DURATION) 32175 } else { 32176 $active.removeClass('active') 32177 $next.addClass('active') 32178 this.sliding = false 32179 this.$element.trigger(slidEvent) 32180 } 32181 32182 isCycling && this.cycle() 32183 32184 return this 32185 } 32186 32187 32188 // CAROUSEL PLUGIN DEFINITION 32189 // ========================== 32190 32191 function Plugin(option) { 32192 return this.each(function () { 32193 var $this = $(this) 32194 var data = $this.data('bs.carousel') 32195 var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option) 32196 var action = typeof option == 'string' ? option : options.slide 32197 32198 if (!data) $this.data('bs.carousel', (data = new Carousel(this, options))) 32199 if (typeof option == 'number') data.to(option) 32200 else if (action) data[action]() 32201 else if (options.interval) data.pause().cycle() 32202 }) 32203 } 32204 32205 var old = $.fn.carousel 32206 32207 $.fn.carousel = Plugin 32208 $.fn.carousel.Constructor = Carousel 32209 32210 32211 // CAROUSEL NO CONFLICT 32212 // ==================== 32213 32214 $.fn.carousel.noConflict = function () { 32215 $.fn.carousel = old 32216 return this 32217 } 32218 32219 32220 // CAROUSEL DATA-API 32221 // ================= 32222 32223 var clickHandler = function (e) { 32224 var href 32225 var $this = $(this) 32226 var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7 32227 if (!$target.hasClass('carousel')) return 32228 var options = $.extend({}, $target.data(), $this.data()) 32229 var slideIndex = $this.attr('data-slide-to') 32230 if (slideIndex) options.interval = false 32231 32232 Plugin.call($target, options) 32233 32234 if (slideIndex) { 32235 $target.data('bs.carousel').to(slideIndex) 32236 } 32237 32238 e.preventDefault() 32239 } 32240 32241 $(document) 32242 .on('click.bs.carousel.data-api', '[data-slide]', clickHandler) 32243 .on('click.bs.carousel.data-api', '[data-slide-to]', clickHandler) 32244 32245 $(window).on('load', function () { 32246 $('[data-ride="carousel"]').each(function () { 32247 var $carousel = $(this) 32248 Plugin.call($carousel, $carousel.data()) 32249 }) 32250 }) 32251 32252}(jQuery); 32253 32254/* ======================================================================== 32255 * Bootstrap: collapse.js v3.3.7 32256 * http://getbootstrap.com/javascript/#collapse 32257 * ======================================================================== 32258 * Copyright 2011-2016 Twitter, Inc. 32259 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 32260 * ======================================================================== */ 32261 32262/* jshint latedef: false */ 32263 32264+function ($) { 32265 'use strict'; 32266 32267 // COLLAPSE PUBLIC CLASS DEFINITION 32268 // ================================ 32269 32270 var Collapse = function (element, options) { 32271 this.$element = $(element) 32272 this.options = $.extend({}, Collapse.DEFAULTS, options) 32273 this.$trigger = $('[data-toggle="collapse"][href="#' + element.id + '"],' + 32274 '[data-toggle="collapse"][data-target="#' + element.id + '"]') 32275 this.transitioning = null 32276 32277 if (this.options.parent) { 32278 this.$parent = this.getParent() 32279 } else { 32280 this.addAriaAndCollapsedClass(this.$element, this.$trigger) 32281 } 32282 32283 if (this.options.toggle) this.toggle() 32284 } 32285 32286 Collapse.VERSION = '3.3.7' 32287 32288 Collapse.TRANSITION_DURATION = 350 32289 32290 Collapse.DEFAULTS = { 32291 toggle: true 32292 } 32293 32294 Collapse.prototype.dimension = function () { 32295 var hasWidth = this.$element.hasClass('width') 32296 return hasWidth ? 'width' : 'height' 32297 } 32298 32299 Collapse.prototype.show = function () { 32300 if (this.transitioning || this.$element.hasClass('in')) return 32301 32302 var activesData 32303 var actives = this.$parent && this.$parent.children('.panel').children('.in, .collapsing') 32304 32305 if (actives && actives.length) { 32306 activesData = actives.data('bs.collapse') 32307 if (activesData && activesData.transitioning) return 32308 } 32309 32310 var startEvent = $.Event('show.bs.collapse') 32311 this.$element.trigger(startEvent) 32312 if (startEvent.isDefaultPrevented()) return 32313 32314 if (actives && actives.length) { 32315 Plugin.call(actives, 'hide') 32316 activesData || actives.data('bs.collapse', null) 32317 } 32318 32319 var dimension = this.dimension() 32320 32321 this.$element 32322 .removeClass('collapse') 32323 .addClass('collapsing')[dimension](0) 32324 .attr('aria-expanded', true) 32325 32326 this.$trigger 32327 .removeClass('collapsed') 32328 .attr('aria-expanded', true) 32329 32330 this.transitioning = 1 32331 32332 var complete = function () { 32333 this.$element 32334 .removeClass('collapsing') 32335 .addClass('collapse in')[dimension]('') 32336 this.transitioning = 0 32337 this.$element 32338 .trigger('shown.bs.collapse') 32339 } 32340 32341 if (!$.support.transition) return complete.call(this) 32342 32343 var scrollSize = $.camelCase(['scroll', dimension].join('-')) 32344 32345 this.$element 32346 .one('bsTransitionEnd', $.proxy(complete, this)) 32347 .emulateTransitionEnd(Collapse.TRANSITION_DURATION)[dimension](this.$element[0][scrollSize]) 32348 } 32349 32350 Collapse.prototype.hide = function () { 32351 if (this.transitioning || !this.$element.hasClass('in')) return 32352 32353 var startEvent = $.Event('hide.bs.collapse') 32354 this.$element.trigger(startEvent) 32355 if (startEvent.isDefaultPrevented()) return 32356 32357 var dimension = this.dimension() 32358 32359 this.$element[dimension](this.$element[dimension]())[0].offsetHeight 32360 32361 this.$element 32362 .addClass('collapsing') 32363 .removeClass('collapse in') 32364 .attr('aria-expanded', false) 32365 32366 this.$trigger 32367 .addClass('collapsed') 32368 .attr('aria-expanded', false) 32369 32370 this.transitioning = 1 32371 32372 var complete = function () { 32373 this.transitioning = 0 32374 this.$element 32375 .removeClass('collapsing') 32376 .addClass('collapse') 32377 .trigger('hidden.bs.collapse') 32378 } 32379 32380 if (!$.support.transition) return complete.call(this) 32381 32382 this.$element 32383 [dimension](0) 32384 .one('bsTransitionEnd', $.proxy(complete, this)) 32385 .emulateTransitionEnd(Collapse.TRANSITION_DURATION) 32386 } 32387 32388 Collapse.prototype.toggle = function () { 32389 this[this.$element.hasClass('in') ? 'hide' : 'show']() 32390 } 32391 32392 Collapse.prototype.getParent = function () { 32393 return $(this.options.parent) 32394 .find('[data-toggle="collapse"][data-parent="' + this.options.parent + '"]') 32395 .each($.proxy(function (i, element) { 32396 var $element = $(element) 32397 this.addAriaAndCollapsedClass(getTargetFromTrigger($element), $element) 32398 }, this)) 32399 .end() 32400 } 32401 32402 Collapse.prototype.addAriaAndCollapsedClass = function ($element, $trigger) { 32403 var isOpen = $element.hasClass('in') 32404 32405 $element.attr('aria-expanded', isOpen) 32406 $trigger 32407 .toggleClass('collapsed', !isOpen) 32408 .attr('aria-expanded', isOpen) 32409 } 32410 32411 function getTargetFromTrigger($trigger) { 32412 var href 32413 var target = $trigger.attr('data-target') 32414 || (href = $trigger.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7 32415 32416 return $(target) 32417 } 32418 32419 32420 // COLLAPSE PLUGIN DEFINITION 32421 // ========================== 32422 32423 function Plugin(option) { 32424 return this.each(function () { 32425 var $this = $(this) 32426 var data = $this.data('bs.collapse') 32427 var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option) 32428 32429 if (!data && options.toggle && /show|hide/.test(option)) options.toggle = false 32430 if (!data) $this.data('bs.collapse', (data = new Collapse(this, options))) 32431 if (typeof option == 'string') data[option]() 32432 }) 32433 } 32434 32435 var old = $.fn.collapse 32436 32437 $.fn.collapse = Plugin 32438 $.fn.collapse.Constructor = Collapse 32439 32440 32441 // COLLAPSE NO CONFLICT 32442 // ==================== 32443 32444 $.fn.collapse.noConflict = function () { 32445 $.fn.collapse = old 32446 return this 32447 } 32448 32449 32450 // COLLAPSE DATA-API 32451 // ================= 32452 32453 $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) { 32454 var $this = $(this) 32455 32456 if (!$this.attr('data-target')) e.preventDefault() 32457 32458 var $target = getTargetFromTrigger($this) 32459 var data = $target.data('bs.collapse') 32460 var option = data ? 'toggle' : $this.data() 32461 32462 Plugin.call($target, option) 32463 }) 32464 32465}(jQuery); 32466 32467/* ======================================================================== 32468 * Bootstrap: dropdown.js v3.3.7 32469 * http://getbootstrap.com/javascript/#dropdowns 32470 * ======================================================================== 32471 * Copyright 2011-2016 Twitter, Inc. 32472 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 32473 * ======================================================================== */ 32474 32475 32476+function ($) { 32477 'use strict'; 32478 32479 // DROPDOWN CLASS DEFINITION 32480 // ========================= 32481 32482 var backdrop = '.dropdown-backdrop' 32483 var toggle = '[data-toggle="dropdown"]' 32484 var Dropdown = function (element) { 32485 $(element).on('click.bs.dropdown', this.toggle) 32486 } 32487 32488 Dropdown.VERSION = '3.3.7' 32489 32490 function getParent($this) { 32491 var selector = $this.attr('data-target') 32492 32493 if (!selector) { 32494 selector = $this.attr('href') 32495 selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 32496 } 32497 32498 var $parent = selector && $(selector) 32499 32500 return $parent && $parent.length ? $parent : $this.parent() 32501 } 32502 32503 function clearMenus(e) { 32504 if (e && e.which === 3) return 32505 $(backdrop).remove() 32506 $(toggle).each(function () { 32507 var $this = $(this) 32508 var $parent = getParent($this) 32509 var relatedTarget = { relatedTarget: this } 32510 32511 if (!$parent.hasClass('open')) return 32512 32513 if (e && e.type == 'click' && /input|textarea/i.test(e.target.tagName) && $.contains($parent[0], e.target)) return 32514 32515 $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget)) 32516 32517 if (e.isDefaultPrevented()) return 32518 32519 $this.attr('aria-expanded', 'false') 32520 $parent.removeClass('open').trigger($.Event('hidden.bs.dropdown', relatedTarget)) 32521 }) 32522 } 32523 32524 Dropdown.prototype.toggle = function (e) { 32525 var $this = $(this) 32526 32527 if ($this.is('.disabled, :disabled')) return 32528 32529 var $parent = getParent($this) 32530 var isActive = $parent.hasClass('open') 32531 32532 clearMenus() 32533 32534 if (!isActive) { 32535 if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) { 32536 // if mobile we use a backdrop because click events don't delegate 32537 $(document.createElement('div')) 32538 .addClass('dropdown-backdrop') 32539 .insertAfter($(this)) 32540 .on('click', clearMenus) 32541 } 32542 32543 var relatedTarget = { relatedTarget: this } 32544 $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget)) 32545 32546 if (e.isDefaultPrevented()) return 32547 32548 $this 32549 .trigger('focus') 32550 .attr('aria-expanded', 'true') 32551 32552 $parent 32553 .toggleClass('open') 32554 .trigger($.Event('shown.bs.dropdown', relatedTarget)) 32555 } 32556 32557 return false 32558 } 32559 32560 Dropdown.prototype.keydown = function (e) { 32561 if (!/(38|40|27|32)/.test(e.which) || /input|textarea/i.test(e.target.tagName)) return 32562 32563 var $this = $(this) 32564 32565 e.preventDefault() 32566 e.stopPropagation() 32567 32568 if ($this.is('.disabled, :disabled')) return 32569 32570 var $parent = getParent($this) 32571 var isActive = $parent.hasClass('open') 32572 32573 if (!isActive && e.which != 27 || isActive && e.which == 27) { 32574 if (e.which == 27) $parent.find(toggle).trigger('focus') 32575 return $this.trigger('click') 32576 } 32577 32578 var desc = ' li:not(.disabled):visible a' 32579 var $items = $parent.find('.dropdown-menu' + desc) 32580 32581 if (!$items.length) return 32582 32583 var index = $items.index(e.target) 32584 32585 if (e.which == 38 && index > 0) index-- // up 32586 if (e.which == 40 && index < $items.length - 1) index++ // down 32587 if (!~index) index = 0 32588 32589 $items.eq(index).trigger('focus') 32590 } 32591 32592 32593 // DROPDOWN PLUGIN DEFINITION 32594 // ========================== 32595 32596 function Plugin(option) { 32597 return this.each(function () { 32598 var $this = $(this) 32599 var data = $this.data('bs.dropdown') 32600 32601 if (!data) $this.data('bs.dropdown', (data = new Dropdown(this))) 32602 if (typeof option == 'string') data[option].call($this) 32603 }) 32604 } 32605 32606 var old = $.fn.dropdown 32607 32608 $.fn.dropdown = Plugin 32609 $.fn.dropdown.Constructor = Dropdown 32610 32611 32612 // DROPDOWN NO CONFLICT 32613 // ==================== 32614 32615 $.fn.dropdown.noConflict = function () { 32616 $.fn.dropdown = old 32617 return this 32618 } 32619 32620 32621 // APPLY TO STANDARD DROPDOWN ELEMENTS 32622 // =================================== 32623 32624 $(document) 32625 .on('click.bs.dropdown.data-api', clearMenus) 32626 .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() }) 32627 .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle) 32628 .on('keydown.bs.dropdown.data-api', toggle, Dropdown.prototype.keydown) 32629 .on('keydown.bs.dropdown.data-api', '.dropdown-menu', Dropdown.prototype.keydown) 32630 32631}(jQuery); 32632 32633/* ======================================================================== 32634 * Bootstrap: modal.js v3.3.7 32635 * http://getbootstrap.com/javascript/#modals 32636 * ======================================================================== 32637 * Copyright 2011-2016 Twitter, Inc. 32638 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 32639 * ======================================================================== */ 32640 32641 32642+function ($) { 32643 'use strict'; 32644 32645 // MODAL CLASS DEFINITION 32646 // ====================== 32647 32648 var Modal = function (element, options) { 32649 this.options = options 32650 this.$body = $(document.body) 32651 this.$element = $(element) 32652 this.$dialog = this.$element.find('.modal-dialog') 32653 this.$backdrop = null 32654 this.isShown = null 32655 this.originalBodyPad = null 32656 this.scrollbarWidth = 0 32657 this.ignoreBackdropClick = false 32658 32659 if (this.options.remote) { 32660 this.$element 32661 .find('.modal-content') 32662 .load(this.options.remote, $.proxy(function () { 32663 this.$element.trigger('loaded.bs.modal') 32664 }, this)) 32665 } 32666 } 32667 32668 Modal.VERSION = '3.3.7' 32669 32670 Modal.TRANSITION_DURATION = 300 32671 Modal.BACKDROP_TRANSITION_DURATION = 150 32672 32673 Modal.DEFAULTS = { 32674 backdrop: true, 32675 keyboard: true, 32676 show: true 32677 } 32678 32679 Modal.prototype.toggle = function (_relatedTarget) { 32680 return this.isShown ? this.hide() : this.show(_relatedTarget) 32681 } 32682 32683 Modal.prototype.show = function (_relatedTarget) { 32684 var that = this 32685 var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget }) 32686 32687 this.$element.trigger(e) 32688 32689 if (this.isShown || e.isDefaultPrevented()) return 32690 32691 this.isShown = true 32692 32693 this.checkScrollbar() 32694 this.setScrollbar() 32695 this.$body.addClass('modal-open') 32696 32697 this.escape() 32698 this.resize() 32699 32700 this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this)) 32701 32702 this.$dialog.on('mousedown.dismiss.bs.modal', function () { 32703 that.$element.one('mouseup.dismiss.bs.modal', function (e) { 32704 if ($(e.target).is(that.$element)) that.ignoreBackdropClick = true 32705 }) 32706 }) 32707 32708 this.backdrop(function () { 32709 var transition = $.support.transition && that.$element.hasClass('fade') 32710 32711 if (!that.$element.parent().length) { 32712 that.$element.appendTo(that.$body) // don't move modals dom position 32713 } 32714 32715 that.$element 32716 .show() 32717 .scrollTop(0) 32718 32719 that.adjustDialog() 32720 32721 if (transition) { 32722 that.$element[0].offsetWidth // force reflow 32723 } 32724 32725 that.$element.addClass('in') 32726 32727 that.enforceFocus() 32728 32729 var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget }) 32730 32731 transition ? 32732 that.$dialog // wait for modal to slide in 32733 .one('bsTransitionEnd', function () { 32734 that.$element.trigger('focus').trigger(e) 32735 }) 32736 .emulateTransitionEnd(Modal.TRANSITION_DURATION) : 32737 that.$element.trigger('focus').trigger(e) 32738 }) 32739 } 32740 32741 Modal.prototype.hide = function (e) { 32742 if (e) e.preventDefault() 32743 32744 e = $.Event('hide.bs.modal') 32745 32746 this.$element.trigger(e) 32747 32748 if (!this.isShown || e.isDefaultPrevented()) return 32749 32750 this.isShown = false 32751 32752 this.escape() 32753 this.resize() 32754 32755 $(document).off('focusin.bs.modal') 32756 32757 this.$element 32758 .removeClass('in') 32759 .off('click.dismiss.bs.modal') 32760 .off('mouseup.dismiss.bs.modal') 32761 32762 this.$dialog.off('mousedown.dismiss.bs.modal') 32763 32764 $.support.transition && this.$element.hasClass('fade') ? 32765 this.$element 32766 .one('bsTransitionEnd', $.proxy(this.hideModal, this)) 32767 .emulateTransitionEnd(Modal.TRANSITION_DURATION) : 32768 this.hideModal() 32769 } 32770 32771 Modal.prototype.enforceFocus = function () { 32772 $(document) 32773 .off('focusin.bs.modal') // guard against infinite focus loop 32774 .on('focusin.bs.modal', $.proxy(function (e) { 32775 if (document !== e.target && 32776 this.$element[0] !== e.target && 32777 !this.$element.has(e.target).length) { 32778 this.$element.trigger('focus') 32779 } 32780 }, this)) 32781 } 32782 32783 Modal.prototype.escape = function () { 32784 if (this.isShown && this.options.keyboard) { 32785 this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e) {
vendor: 9,817 bytes, lines 32786-33091
32786 e.which == 27 && this.hide() 32787 }, this)) 32788 } else if (!this.isShown) { 32789 this.$element.off('keydown.dismiss.bs.modal') 32790 } 32791 } 32792 32793 Modal.prototype.resize = function () { 32794 if (this.isShown) { 32795 $(window).on('resize.bs.modal', $.proxy(this.handleUpdate, this)) 32796 } else { 32797 $(window).off('resize.bs.modal') 32798 } 32799 } 32800 32801 Modal.prototype.hideModal = function () { 32802 var that = this 32803 this.$element.hide() 32804 this.backdrop(function () { 32805 that.$body.removeClass('modal-open') 32806 that.resetAdjustments() 32807 that.resetScrollbar() 32808 that.$element.trigger('hidden.bs.modal') 32809 }) 32810 } 32811 32812 Modal.prototype.removeBackdrop = function () { 32813 this.$backdrop && this.$backdrop.remove() 32814 this.$backdrop = null 32815 } 32816 32817 Modal.prototype.backdrop = function (callback) { 32818 var that = this 32819 var animate = this.$element.hasClass('fade') ? 'fade' : '' 32820 32821 if (this.isShown && this.options.backdrop) { 32822 var doAnimate = $.support.transition && animate 32823 32824 this.$backdrop = $(document.createElement('div')) 32825 .addClass('modal-backdrop ' + animate) 32826 .appendTo(this.$body) 32827 32828 this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) { 32829 if (this.ignoreBackdropClick) { 32830 this.ignoreBackdropClick = false 32831 return 32832 } 32833 if (e.target !== e.currentTarget) return 32834 this.options.backdrop == 'static' 32835 ? this.$element[0].focus() 32836 : this.hide() 32837 }, this)) 32838 32839 if (doAnimate) this.$backdrop[0].offsetWidth // force reflow 32840 32841 this.$backdrop.addClass('in') 32842 32843 if (!callback) return 32844 32845 doAnimate ? 32846 this.$backdrop 32847 .one('bsTransitionEnd', callback) 32848 .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) : 32849 callback() 32850 32851 } else if (!this.isShown && this.$backdrop) { 32852 this.$backdrop.removeClass('in') 32853 32854 var callbackRemove = function () { 32855 that.removeBackdrop() 32856 callback && callback() 32857 } 32858 $.support.transition && this.$element.hasClass('fade') ? 32859 this.$backdrop 32860 .one('bsTransitionEnd', callbackRemove) 32861 .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) : 32862 callbackRemove() 32863 32864 } else if (callback) { 32865 callback() 32866 } 32867 } 32868 32869 // these following methods are used to handle overflowing modals 32870 32871 Modal.prototype.handleUpdate = function () { 32872 this.adjustDialog() 32873 } 32874 32875 Modal.prototype.adjustDialog = function () { 32876 var modalIsOverflowing = this.$element[0].scrollHeight > document.documentElement.clientHeight 32877 32878 this.$element.css({ 32879 paddingLeft: !this.bodyIsOverflowing && modalIsOverflowing ? this.scrollbarWidth : '', 32880 paddingRight: this.bodyIsOverflowing && !modalIsOverflowing ? this.scrollbarWidth : '' 32881 }) 32882 } 32883 32884 Modal.prototype.resetAdjustments = function () { 32885 this.$element.css({ 32886 paddingLeft: '', 32887 paddingRight: '' 32888 }) 32889 } 32890 32891 Modal.prototype.checkScrollbar = function () { 32892 var fullWindowWidth = window.innerWidth 32893 if (!fullWindowWidth) { // workaround for missing window.innerWidth in IE8 32894 var documentElementRect = document.documentElement.getBoundingClientRect() 32895 fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left) 32896 } 32897 this.bodyIsOverflowing = document.body.clientWidth < fullWindowWidth 32898 this.scrollbarWidth = this.measureScrollbar() 32899 } 32900 32901 Modal.prototype.setScrollbar = function () { 32902 var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10) 32903 this.originalBodyPad = document.body.style.paddingRight || '' 32904 if (this.bodyIsOverflowing) this.$body.css('padding-right', bodyPad + this.scrollbarWidth) 32905 } 32906 32907 Modal.prototype.resetScrollbar = function () { 32908 this.$body.css('padding-right', this.originalBodyPad) 32909 } 32910 32911 Modal.prototype.measureScrollbar = function () { // thx walsh 32912 var scrollDiv = document.createElement('div') 32913 scrollDiv.className = 'modal-scrollbar-measure' 32914 this.$body.append(scrollDiv) 32915 var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth 32916 this.$body[0].removeChild(scrollDiv) 32917 return scrollbarWidth 32918 } 32919 32920 32921 // MODAL PLUGIN DEFINITION 32922 // ======================= 32923 32924 function Plugin(option, _relatedTarget) { 32925 return this.each(function () { 32926 var $this = $(this) 32927 var data = $this.data('bs.modal') 32928 var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option) 32929 32930 if (!data) $this.data('bs.modal', (data = new Modal(this, options))) 32931 if (typeof option == 'string') data[option](_relatedTarget) 32932 else if (options.show) data.show(_relatedTarget) 32933 }) 32934 } 32935 32936 var old = $.fn.modal 32937 32938 $.fn.modal = Plugin 32939 $.fn.modal.Constructor = Modal 32940 32941 32942 // MODAL NO CONFLICT 32943 // ================= 32944 32945 $.fn.modal.noConflict = function () { 32946 $.fn.modal = old 32947 return this 32948 } 32949 32950 32951 // MODAL DATA-API 32952 // ============== 32953 32954 $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) { 32955 var $this = $(this) 32956 var href = $this.attr('href') 32957 var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) // strip for ie7 32958 var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data()) 32959 32960 if ($this.is('a')) e.preventDefault() 32961 32962 $target.one('show.bs.modal', function (showEvent) { 32963 if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown 32964 $target.one('hidden.bs.modal', function () { 32965 $this.is(':visible') && $this.trigger('focus') 32966 }) 32967 }) 32968 Plugin.call($target, option, this) 32969 }) 32970 32971}(jQuery); 32972 32973/* ======================================================================== 32974 * Bootstrap: tooltip.js v3.3.7 32975 * http://getbootstrap.com/javascript/#tooltip 32976 * Inspired by the original jQuery.tipsy by Jason Frame 32977 * ======================================================================== 32978 * Copyright 2011-2016 Twitter, Inc. 32979 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 32980 * ======================================================================== */ 32981 32982 32983+function ($) { 32984 'use strict'; 32985 32986 // TOOLTIP PUBLIC CLASS DEFINITION 32987 // =============================== 32988 32989 var Tooltip = function (element, options) { 32990 this.type = null 32991 this.options = null 32992 this.enabled = null 32993 this.timeout = null 32994 this.hoverState = null 32995 this.$element = null 32996 this.inState = null 32997 32998 this.init('tooltip', element, options) 32999 } 33000 33001 Tooltip.VERSION = '3.3.7' 33002 33003 Tooltip.TRANSITION_DURATION = 150 33004 33005 Tooltip.DEFAULTS = { 33006 animation: true, 33007 placement: 'top', 33008 selector: false, 33009 template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>', 33010 trigger: 'hover focus', 33011 title: '', 33012 delay: 0, 33013 html: false, 33014 container: false, 33015 viewport: { 33016 selector: 'body', 33017 padding: 0 33018 } 33019 } 33020 33021 Tooltip.prototype.init = function (type, element, options) { 33022 this.enabled = true 33023 this.type = type 33024 this.$element = $(element) 33025 this.options = this.getOptions(options) 33026 this.$viewport = this.options.viewport && $($.isFunction(this.options.viewport) ? this.options.viewport.call(this, this.$element) : (this.options.viewport.selector || this.options.viewport)) 33027 this.inState = { click: false, hover: false, focus: false } 33028 33029 if (this.$element[0] instanceof document.constructor && !this.options.selector) { 33030 throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!') 33031 } 33032 33033 var triggers = this.options.trigger.split(' ') 33034 33035 for (var i = triggers.length; i--;) { 33036 var trigger = triggers[i] 33037 33038 if (trigger == 'click') { 33039 this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this)) 33040 } else if (trigger != 'manual') { 33041 var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin' 33042 var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout' 33043 33044 this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this)) 33045 this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this)) 33046 } 33047 } 33048 33049 this.options.selector ? 33050 (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) : 33051 this.fixTitle() 33052 } 33053 33054 Tooltip.prototype.getDefaults = function () { 33055 return Tooltip.DEFAULTS 33056 } 33057 33058 Tooltip.prototype.getOptions = function (options) { 33059 options = $.extend({}, this.getDefaults(), this.$element.data(), options) 33060 33061 if (options.delay && typeof options.delay == 'number') { 33062 options.delay = { 33063 show: options.delay, 33064 hide: options.delay 33065 } 33066 } 33067 33068 return options 33069 } 33070 33071 Tooltip.prototype.getDelegateOptions = function () { 33072 var options = {} 33073 var defaults = this.getDefaults() 33074 33075 this._options && $.each(this._options, function (key, value) { 33076 if (defaults[key] != value) options[key] = value 33077 }) 33078 33079 return options 33080 } 33081 33082 Tooltip.prototype.enter = function (obj) { 33083 var self = obj instanceof this.constructor ? 33084 obj : $(obj.currentTarget).data('bs.' + this.type) 33085 33086 if (!self) { 33087 self = new this.constructor(obj.currentTarget, this.getDelegateOptions()) 33088 $(obj.currentTarget).data('bs.' + this.type, self) 33089 } 33090 33091 if (obj instanceof $.Event) {
vendor: 10,031 bytes, lines 33092-33370
33092 self.inState[obj.type == 'focusin' ? 'focus' : 'hover'] = true 33093 } 33094 33095 if (self.tip().hasClass('in') || self.hoverState == 'in') { 33096 self.hoverState = 'in' 33097 return 33098 } 33099 33100 clearTimeout(self.timeout) 33101 33102 self.hoverState = 'in' 33103 33104 if (!self.options.delay || !self.options.delay.show) return self.show() 33105 33106 self.timeout = setTimeout(function () { 33107 if (self.hoverState == 'in') self.show() 33108 }, self.options.delay.show) 33109 } 33110 33111 Tooltip.prototype.isInStateTrue = function () { 33112 for (var key in this.inState) { 33113 if (this.inState[key]) return true 33114 } 33115 33116 return false 33117 } 33118 33119 Tooltip.prototype.leave = function (obj) { 33120 var self = obj instanceof this.constructor ? 33121 obj : $(obj.currentTarget).data('bs.' + this.type) 33122 33123 if (!self) { 33124 self = new this.constructor(obj.currentTarget, this.getDelegateOptions()) 33125 $(obj.currentTarget).data('bs.' + this.type, self) 33126 } 33127 33128 if (obj instanceof $.Event) { 33129 self.inState[obj.type == 'focusout' ? 'focus' : 'hover'] = false 33130 } 33131 33132 if (self.isInStateTrue()) return 33133 33134 clearTimeout(self.timeout) 33135 33136 self.hoverState = 'out' 33137 33138 if (!self.options.delay || !self.options.delay.hide) return self.hide() 33139 33140 self.timeout = setTimeout(function () { 33141 if (self.hoverState == 'out') self.hide() 33142 }, self.options.delay.hide) 33143 } 33144 33145 Tooltip.prototype.show = function () { 33146 var e = $.Event('show.bs.' + this.type) 33147 33148 if (this.hasContent() && this.enabled) { 33149 this.$element.trigger(e) 33150 33151 var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0]) 33152 if (e.isDefaultPrevented() || !inDom) return 33153 var that = this 33154 33155 var $tip = this.tip() 33156 33157 var tipId = this.getUID(this.type) 33158 33159 this.setContent() 33160 $tip.attr('id', tipId) 33161 this.$element.attr('aria-describedby', tipId) 33162 33163 if (this.options.animation) $tip.addClass('fade') 33164 33165 var placement = typeof this.options.placement == 'function' ? 33166 this.options.placement.call(this, $tip[0], this.$element[0]) : 33167 this.options.placement 33168 33169 var autoToken = /\s?auto?\s?/i 33170 var autoPlace = autoToken.test(placement) 33171 if (autoPlace) placement = placement.replace(autoToken, '') || 'top' 33172 33173 $tip 33174 .detach() 33175 .css({ top: 0, left: 0, display: 'block' }) 33176 .addClass(placement) 33177 .data('bs.' + this.type, this) 33178 33179 this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element) 33180 this.$element.trigger('inserted.bs.' + this.type) 33181 33182 var pos = this.getPosition() 33183 var actualWidth = $tip[0].offsetWidth 33184 var actualHeight = $tip[0].offsetHeight 33185 33186 if (autoPlace) { 33187 var orgPlacement = placement 33188 var viewportDim = this.getPosition(this.$viewport) 33189 33190 placement = placement == 'bottom' && pos.bottom + actualHeight > viewportDim.bottom ? 'top' : 33191 placement == 'top' && pos.top - actualHeight < viewportDim.top ? 'bottom' : 33192 placement == 'right' && pos.right + actualWidth > viewportDim.width ? 'left' : 33193 placement == 'left' && pos.left - actualWidth < viewportDim.left ? 'right' : 33194 placement 33195 33196 $tip 33197 .removeClass(orgPlacement) 33198 .addClass(placement) 33199 } 33200 33201 var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight) 33202 33203 this.applyPlacement(calculatedOffset, placement) 33204 33205 var complete = function () { 33206 var prevHoverState = that.hoverState 33207 that.$element.trigger('shown.bs.' + that.type) 33208 that.hoverState = null 33209 33210 if (prevHoverState == 'out') that.leave(that) 33211 } 33212 33213 $.support.transition && this.$tip.hasClass('fade') ? 33214 $tip 33215 .one('bsTransitionEnd', complete) 33216 .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) : 33217 complete() 33218 } 33219 } 33220 33221 Tooltip.prototype.applyPlacement = function (offset, placement) { 33222 var $tip = this.tip() 33223 var width = $tip[0].offsetWidth 33224 var height = $tip[0].offsetHeight 33225 33226 // manually read margins because getBoundingClientRect includes difference 33227 var marginTop = parseInt($tip.css('margin-top'), 10) 33228 var marginLeft = parseInt($tip.css('margin-left'), 10) 33229 33230 // we must check for NaN for ie 8/9 33231 if (isNaN(marginTop)) marginTop = 0 33232 if (isNaN(marginLeft)) marginLeft = 0 33233 33234 offset.top += marginTop 33235 offset.left += marginLeft 33236 33237 // $.fn.offset doesn't round pixel values 33238 // so we use setOffset directly with our own function B-0 33239 $.offset.setOffset($tip[0], $.extend({ 33240 using: function (props) { 33241 $tip.css({ 33242 top: Math.round(props.top), 33243 left: Math.round(props.left) 33244 }) 33245 } 33246 }, offset), 0) 33247 33248 $tip.addClass('in') 33249 33250 // check to see if placing tip in new offset caused the tip to resize itself 33251 var actualWidth = $tip[0].offsetWidth 33252 var actualHeight = $tip[0].offsetHeight 33253 33254 if (placement == 'top' && actualHeight != height) { 33255 offset.top = offset.top + height - actualHeight 33256 } 33257 33258 var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight) 33259 33260 if (delta.left) offset.left += delta.left 33261 else offset.top += delta.top 33262 33263 var isVertical = /top|bottom/.test(placement) 33264 var arrowDelta = isVertical ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight 33265 var arrowOffsetPosition = isVertical ? 'offsetWidth' : 'offsetHeight' 33266 33267 $tip.offset(offset) 33268 this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical) 33269 } 33270 33271 Tooltip.prototype.replaceArrow = function (delta, dimension, isVertical) { 33272 this.arrow() 33273 .css(isVertical ? 'left' : 'top', 50 * (1 - delta / dimension) + '%') 33274 .css(isVertical ? 'top' : 'left', '') 33275 } 33276 33277 Tooltip.prototype.setContent = function () { 33278 var $tip = this.tip() 33279 var title = this.getTitle() 33280 33281 $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title) 33282 $tip.removeClass('fade in top bottom left right') 33283 } 33284 33285 Tooltip.prototype.hide = function (callback) { 33286 var that = this 33287 var $tip = $(this.$tip) 33288 var e = $.Event('hide.bs.' + this.type) 33289 33290 function complete() { 33291 if (that.hoverState != 'in') $tip.detach() 33292 if (that.$element) { // TODO: Check whether guarding this code with this `if` is really necessary. 33293 that.$element 33294 .removeAttr('aria-describedby') 33295 .trigger('hidden.bs.' + that.type) 33296 } 33297 callback && callback() 33298 } 33299 33300 this.$element.trigger(e) 33301 33302 if (e.isDefaultPrevented()) return 33303 33304 $tip.removeClass('in') 33305 33306 $.support.transition && $tip.hasClass('fade') ? 33307 $tip 33308 .one('bsTransitionEnd', complete) 33309 .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) : 33310 complete() 33311 33312 this.hoverState = null 33313 33314 return this 33315 } 33316 33317 Tooltip.prototype.fixTitle = function () { 33318 var $e = this.$element 33319 if ($e.attr('title') || typeof $e.attr('data-original-title') != 'string') { 33320 $e.attr('data-original-title', $e.attr('title') || '').attr('title', '') 33321 } 33322 } 33323 33324 Tooltip.prototype.hasContent = function () { 33325 return this.getTitle() 33326 } 33327 33328 Tooltip.prototype.getPosition = function ($element) { 33329 $element = $element || this.$element 33330 33331 var el = $element[0] 33332 var isBody = el.tagName == 'BODY' 33333 33334 var elRect = el.getBoundingClientRect() 33335 if (elRect.width == null) { 33336 // width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093 33337 elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top }) 33338 } 33339 var isSvg = window.SVGElement && el instanceof window.SVGElement 33340 // Avoid using $.offset() on SVGs since it gives incorrect results in jQuery 3. 33341 // See https://github.com/twbs/bootstrap/issues/20280 33342 var elOffset = isBody ? { top: 0, left: 0 } : (isSvg ? null : $element.offset()) 33343 var scroll = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() } 33344 var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null 33345 33346 return $.extend({}, elRect, scroll, outerDims, elOffset) 33347 } 33348 33349 Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) { 33350 return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } : 33351 placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } : 33352 placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } : 33353 /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width } 33354 33355 } 33356 33357 Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) { 33358 var delta = { top: 0, left: 0 } 33359 if (!this.$viewport) return delta 33360 33361 var viewportPadding = this.options.viewport && this.options.viewport.padding || 0 33362 var viewportDimensions = this.getPosition(this.$viewport) 33363 33364 if (/right|left/.test(placement)) { 33365 var topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll 33366 var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight 33367 if (topEdgeOffset < viewportDimensions.top) { // top overflow 33368 delta.top = viewportDimensions.top - topEdgeOffset 33369 } else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) { // bottom overflow 33370 delta.top = viewportDimensions.top + viewportDimensions.height - bottom
vendor: 8,124 bytes, lines 33370-33649
33370EdgeOffset 33371 } 33372 } else { 33373 var leftEdgeOffset = pos.left - viewportPadding 33374 var rightEdgeOffset = pos.left + viewportPadding + actualWidth 33375 if (leftEdgeOffset < viewportDimensions.left) { // left overflow 33376 delta.left = viewportDimensions.left - leftEdgeOffset 33377 } else if (rightEdgeOffset > viewportDimensions.right) { // right overflow 33378 delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset 33379 } 33380 } 33381 33382 return delta 33383 } 33384 33385 Tooltip.prototype.getTitle = function () { 33386 var title 33387 var $e = this.$element 33388 var o = this.options 33389 33390 title = $e.attr('data-original-title') 33391 || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title) 33392 33393 return title 33394 } 33395 33396 Tooltip.prototype.getUID = function (prefix) { 33397 do prefix += ~~(Math.random() * 1000000) 33398 while (document.getElementById(prefix)) 33399 return prefix 33400 } 33401 33402 Tooltip.prototype.tip = function () { 33403 if (!this.$tip) { 33404 this.$tip = $(this.options.template) 33405 if (this.$tip.length != 1) { 33406 throw new Error(this.type + ' `template` option must consist of exactly 1 top-level element!') 33407 } 33408 } 33409 return this.$tip 33410 } 33411 33412 Tooltip.prototype.arrow = function () { 33413 return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow')) 33414 } 33415 33416 Tooltip.prototype.enable = function () { 33417 this.enabled = true 33418 } 33419 33420 Tooltip.prototype.disable = function () { 33421 this.enabled = false 33422 } 33423 33424 Tooltip.prototype.toggleEnabled = function () { 33425 this.enabled = !this.enabled 33426 } 33427 33428 Tooltip.prototype.toggle = function (e) { 33429 var self = this 33430 if (e) { 33431 self = $(e.currentTarget).data('bs.' + this.type) 33432 if (!self) { 33433 self = new this.constructor(e.currentTarget, this.getDelegateOptions()) 33434 $(e.currentTarget).data('bs.' + this.type, self) 33435 } 33436 } 33437 33438 if (e) { 33439 self.inState.click = !self.inState.click 33440 if (self.isInStateTrue()) self.enter(self) 33441 else self.leave(self) 33442 } else { 33443 self.tip().hasClass('in') ? self.leave(self) : self.enter(self) 33444 } 33445 } 33446 33447 Tooltip.prototype.destroy = function () { 33448 var that = this 33449 clearTimeout(this.timeout) 33450 this.hide(function () { 33451 that.$element.off('.' + that.type).removeData('bs.' + that.type) 33452 if (that.$tip) { 33453 that.$tip.detach() 33454 } 33455 that.$tip = null 33456 that.$arrow = null 33457 that.$viewport = null 33458 that.$element = null 33459 }) 33460 } 33461 33462 33463 // TOOLTIP PLUGIN DEFINITION 33464 // ========================= 33465 33466 function Plugin(option) { 33467 return this.each(function () { 33468 var $this = $(this) 33469 var data = $this.data('bs.tooltip') 33470 var options = typeof option == 'object' && option 33471 33472 if (!data && /destroy|hide/.test(option)) return 33473 if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options))) 33474 if (typeof option == 'string') data[option]() 33475 }) 33476 } 33477 33478 var old = $.fn.tooltip 33479 33480 $.fn.tooltip = Plugin 33481 $.fn.tooltip.Constructor = Tooltip 33482 33483 33484 // TOOLTIP NO CONFLICT 33485 // =================== 33486 33487 $.fn.tooltip.noConflict = function () { 33488 $.fn.tooltip = old 33489 return this 33490 } 33491 33492}(jQuery); 33493 33494/* ======================================================================== 33495 * Bootstrap: popover.js v3.3.7 33496 * http://getbootstrap.com/javascript/#popovers 33497 * ======================================================================== 33498 * Copyright 2011-2016 Twitter, Inc. 33499 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 33500 * ======================================================================== */ 33501 33502 33503+function ($) { 33504 'use strict'; 33505 33506 // POPOVER PUBLIC CLASS DEFINITION 33507 // =============================== 33508 33509 var Popover = function (element, options) { 33510 this.init('popover', element, options) 33511 } 33512 33513 if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js') 33514 33515 Popover.VERSION = '3.3.7' 33516 33517 Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, { 33518 placement: 'right', 33519 trigger: 'click', 33520 content: '', 33521 template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>' 33522 }) 33523 33524 33525 // NOTE: POPOVER EXTENDS tooltip.js 33526 // ================================ 33527 33528 Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype) 33529 33530 Popover.prototype.constructor = Popover 33531 33532 Popover.prototype.getDefaults = function () { 33533 return Popover.DEFAULTS 33534 } 33535 33536 Popover.prototype.setContent = function () { 33537 var $tip = this.tip() 33538 var title = this.getTitle() 33539 var content = this.getContent() 33540 33541 $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title) 33542 $tip.find('.popover-content').children().detach().end()[ // we use append for html objects to maintain js events 33543 this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text' 33544 ](content) 33545 33546 $tip.removeClass('fade top bottom left right in') 33547 33548 // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do 33549 // this manually by checking the contents. 33550 if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide() 33551 } 33552 33553 Popover.prototype.hasContent = function () { 33554 return this.getTitle() || this.getContent() 33555 } 33556 33557 Popover.prototype.getContent = function () { 33558 var $e = this.$element 33559 var o = this.options 33560 33561 return $e.attr('data-content') 33562 || (typeof o.content == 'function' ? 33563 o.content.call($e[0]) : 33564 o.content) 33565 } 33566 33567 Popover.prototype.arrow = function () { 33568 return (this.$arrow = this.$arrow || this.tip().find('.arrow')) 33569 } 33570 33571 33572 // POPOVER PLUGIN DEFINITION 33573 // ========================= 33574 33575 function Plugin(option) { 33576 return this.each(function () { 33577 var $this = $(this) 33578 var data = $this.data('bs.popover') 33579 var options = typeof option == 'object' && option 33580 33581 if (!data && /destroy|hide/.test(option)) return 33582 if (!data) $this.data('bs.popover', (data = new Popover(this, options))) 33583 if (typeof option == 'string') data[option]() 33584 }) 33585 } 33586 33587 var old = $.fn.popover 33588 33589 $.fn.popover = Plugin 33590 $.fn.popover.Constructor = Popover 33591 33592 33593 // POPOVER NO CONFLICT 33594 // =================== 33595 33596 $.fn.popover.noConflict = function () { 33597 $.fn.popover = old 33598 return this 33599 } 33600 33601}(jQuery); 33602 33603/* ======================================================================== 33604 * Bootstrap: scrollspy.js v3.3.7 33605 * http://getbootstrap.com/javascript/#scrollspy 33606 * ======================================================================== 33607 * Copyright 2011-2016 Twitter, Inc. 33608 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 33609 * ======================================================================== */ 33610 33611 33612+function ($) { 33613 'use strict'; 33614 33615 // SCROLLSPY CLASS DEFINITION 33616 // ========================== 33617 33618 function ScrollSpy(element, options) { 33619 this.$body = $(document.body) 33620 this.$scrollElement = $(element).is(document.body) ? $(window) : $(element) 33621 this.options = $.extend({}, ScrollSpy.DEFAULTS, options) 33622 this.selector = (this.options.target || '') + ' .nav li > a' 33623 this.offsets = [] 33624 this.targets = [] 33625 this.activeTarget = null 33626 this.scrollHeight = 0 33627 33628 this.$scrollElement.on('scroll.bs.scrollspy', $.proxy(this.process, this)) 33629 this.refresh() 33630 this.process() 33631 } 33632 33633 ScrollSpy.VERSION = '3.3.7' 33634 33635 ScrollSpy.DEFAULTS = { 33636 offset: 10 33637 } 33638 33639 ScrollSpy.prototype.getScrollHeight = function () { 33640 return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight) 33641 } 33642 33643 ScrollSpy.prototype.refresh = function () { 33644 var that = this 33645 var offsetMethod = 'offset' 33646 var offsetBase = 0 33647 33648 this.offsets = [] 33649 this.targets = []
vendor: 12,381 bytes, lines 33650-34095
33650 this.scrollHeight = this.getScrollHeight() 33651 33652 if (!$.isWindow(this.$scrollElement[0])) { 33653 offsetMethod = 'position' 33654 offsetBase = this.$scrollElement.scrollTop() 33655 } 33656 33657 this.$body 33658 .find(this.selector) 33659 .map(function () { 33660 var $el = $(this) 33661 var href = $el.data('target') || $el.attr('href') 33662 var $href = /^#./.test(href) && $(href) 33663 33664 return ($href 33665 && $href.length 33666 && $href.is(':visible') 33667 && [[$href[offsetMethod]().top + offsetBase, href]]) || null 33668 }) 33669 .sort(function (a, b) { return a[0] - b[0] }) 33670 .each(function () { 33671 that.offsets.push(this[0]) 33672 that.targets.push(this[1]) 33673 }) 33674 } 33675 33676 ScrollSpy.prototype.process = function () { 33677 var scrollTop = this.$scrollElement.scrollTop() + this.options.offset 33678 var scrollHeight = this.getScrollHeight() 33679 var maxScroll = this.options.offset + scrollHeight - this.$scrollElement.height() 33680 var offsets = this.offsets 33681 var targets = this.targets 33682 var activeTarget = this.activeTarget 33683 var i 33684 33685 if (this.scrollHeight != scrollHeight) { 33686 this.refresh() 33687 } 33688 33689 if (scrollTop >= maxScroll) { 33690 return activeTarget != (i = targets[targets.length - 1]) && this.activate(i) 33691 } 33692 33693 if (activeTarget && scrollTop < offsets[0]) { 33694 this.activeTarget = null 33695 return this.clear() 33696 } 33697 33698 for (i = offsets.length; i--;) { 33699 activeTarget != targets[i] 33700 && scrollTop >= offsets[i] 33701 && (offsets[i + 1] === undefined || scrollTop < offsets[i + 1]) 33702 && this.activate(targets[i]) 33703 } 33704 } 33705 33706 ScrollSpy.prototype.activate = function (target) { 33707 this.activeTarget = target 33708 33709 this.clear() 33710 33711 var selector = this.selector + 33712 '[data-target="' + target + '"],' + 33713 this.selector + '[href="' + target + '"]' 33714 33715 var active = $(selector) 33716 .parents('li') 33717 .addClass('active') 33718 33719 if (active.parent('.dropdown-menu').length) { 33720 active = active 33721 .closest('li.dropdown') 33722 .addClass('active') 33723 } 33724 33725 active.trigger('activate.bs.scrollspy') 33726 } 33727 33728 ScrollSpy.prototype.clear = function () { 33729 $(this.selector) 33730 .parentsUntil(this.options.target, '.active') 33731 .removeClass('active') 33732 } 33733 33734 33735 // SCROLLSPY PLUGIN DEFINITION 33736 // =========================== 33737 33738 function Plugin(option) { 33739 return this.each(function () { 33740 var $this = $(this) 33741 var data = $this.data('bs.scrollspy') 33742 var options = typeof option == 'object' && option 33743 33744 if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options))) 33745 if (typeof option == 'string') data[option]() 33746 }) 33747 } 33748 33749 var old = $.fn.scrollspy 33750 33751 $.fn.scrollspy = Plugin 33752 $.fn.scrollspy.Constructor = ScrollSpy 33753 33754 33755 // SCROLLSPY NO CONFLICT 33756 // ===================== 33757 33758 $.fn.scrollspy.noConflict = function () { 33759 $.fn.scrollspy = old 33760 return this 33761 } 33762 33763 33764 // SCROLLSPY DATA-API 33765 // ================== 33766 33767 $(window).on('load.bs.scrollspy.data-api', function () { 33768 $('[data-spy="scroll"]').each(function () { 33769 var $spy = $(this) 33770 Plugin.call($spy, $spy.data()) 33771 }) 33772 }) 33773 33774}(jQuery); 33775 33776/* ======================================================================== 33777 * Bootstrap: tab.js v3.3.7 33778 * http://getbootstrap.com/javascript/#tabs 33779 * ======================================================================== 33780 * Copyright 2011-2016 Twitter, Inc. 33781 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 33782 * ======================================================================== */ 33783 33784 33785+function ($) { 33786 'use strict'; 33787 33788 // TAB CLASS DEFINITION 33789 // ==================== 33790 33791 var Tab = function (element) { 33792 // jscs:disable requireDollarBeforejQueryAssignment 33793 this.element = $(element) 33794 // jscs:enable requireDollarBeforejQueryAssignment 33795 } 33796 33797 Tab.VERSION = '3.3.7' 33798 33799 Tab.TRANSITION_DURATION = 150 33800 33801 Tab.prototype.show = function () { 33802 var $this = this.element 33803 var $ul = $this.closest('ul:not(.dropdown-menu)') 33804 var selector = $this.data('target') 33805 33806 if (!selector) { 33807 selector = $this.attr('href') 33808 selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 33809 } 33810 33811 if ($this.parent('li').hasClass('active')) return 33812 33813 var $previous = $ul.find('.active:last a') 33814 var hideEvent = $.Event('hide.bs.tab', { 33815 relatedTarget: $this[0] 33816 }) 33817 var showEvent = $.Event('show.bs.tab', { 33818 relatedTarget: $previous[0] 33819 }) 33820 33821 $previous.trigger(hideEvent) 33822 $this.trigger(showEvent) 33823 33824 if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return 33825 33826 var $target = $(selector) 33827 33828 this.activate($this.closest('li'), $ul) 33829 this.activate($target, $target.parent(), function () { 33830 $previous.trigger({ 33831 type: 'hidden.bs.tab', 33832 relatedTarget: $this[0] 33833 }) 33834 $this.trigger({ 33835 type: 'shown.bs.tab', 33836 relatedTarget: $previous[0] 33837 }) 33838 }) 33839 } 33840 33841 Tab.prototype.activate = function (element, container, callback) { 33842 var $active = container.find('> .active') 33843 var transition = callback 33844 && $.support.transition 33845 && ($active.length && $active.hasClass('fade') || !!container.find('> .fade').length) 33846 33847 function next() { 33848 $active 33849 .removeClass('active') 33850 .find('> .dropdown-menu > .active') 33851 .removeClass('active') 33852 .end() 33853 .find('[data-toggle="tab"]') 33854 .attr('aria-expanded', false) 33855 33856 element 33857 .addClass('active') 33858 .find('[data-toggle="tab"]') 33859 .attr('aria-expanded', true) 33860 33861 if (transition) { 33862 element[0].offsetWidth // reflow for transition 33863 element.addClass('in') 33864 } else { 33865 element.removeClass('fade') 33866 } 33867 33868 if (element.parent('.dropdown-menu').length) { 33869 element 33870 .closest('li.dropdown') 33871 .addClass('active') 33872 .end() 33873 .find('[data-toggle="tab"]') 33874 .attr('aria-expanded', true) 33875 } 33876 33877 callback && callback() 33878 } 33879 33880 $active.length && transition ? 33881 $active 33882 .one('bsTransitionEnd', next) 33883 .emulateTransitionEnd(Tab.TRANSITION_DURATION) : 33884 next() 33885 33886 $active.removeClass('in') 33887 } 33888 33889 33890 // TAB PLUGIN DEFINITION 33891 // ===================== 33892 33893 function Plugin(option) { 33894 return this.each(function () { 33895 var $this = $(this) 33896 var data = $this.data('bs.tab') 33897 33898 if (!data) $this.data('bs.tab', (data = new Tab(this))) 33899 if (typeof option == 'string') data[option]() 33900 }) 33901 } 33902 33903 var old = $.fn.tab 33904 33905 $.fn.tab = Plugin 33906 $.fn.tab.Constructor = Tab 33907 33908 33909 // TAB NO CONFLICT 33910 // =============== 33911 33912 $.fn.tab.noConflict = function () { 33913 $.fn.tab = old 33914 return this 33915 } 33916 33917 33918 // TAB DATA-API 33919 // ============ 33920 33921 var clickHandler = function (e) { 33922 e.preventDefault() 33923 Plugin.call($(this), 'show') 33924 } 33925 33926 $(document) 33927 .on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler) 33928 .on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler) 33929 33930}(jQuery); 33931 33932/* ======================================================================== 33933 * Bootstrap: affix.js v3.3.7 33934 * http://getbootstrap.com/javascript/#affix 33935 * ======================================================================== 33936 * Copyright 2011-2016 Twitter, Inc. 33937 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 33938 * ======================================================================== */ 33939 33940 33941+function ($) { 33942 'use strict'; 33943 33944 // AFFIX CLASS DEFINITION 33945 // ====================== 33946 33947 var Affix = function (element, options) { 33948 this.options = $.extend({}, Affix.DEFAULTS, options) 33949 33950 this.$target = $(this.options.target) 33951 .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this)) 33952 .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this)) 33953 33954 this.$element = $(element) 33955 this.affixed = null 33956 this.unpin = null 33957 this.pinnedOffset = null 33958 33959 this.checkPosition() 33960 } 33961 33962 Affix.VERSION = '3.3.7' 33963 33964 Affix.RESET = 'affix affix-top affix-bottom' 33965 33966 Affix.DEFAULTS = { 33967 offset: 0, 33968 target: window 33969 } 33970 33971 Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) { 33972 var scrollTop = this.$target.scrollTop() 33973 var position = this.$element.offset() 33974 var targetHeight = this.$target.height() 33975 33976 if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false 33977 33978 if (this.affixed == 'bottom') { 33979 if (offsetTop != null) return (scrollTop + this.unpin <= position.top) ? false : 'bottom' 33980 return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom' 33981 } 33982 33983 var initializing = this.affixed == null 33984 var colliderTop = initializing ? scrollTop : position.top 33985 var colliderHeight = initializing ? targetHeight : height 33986 33987 if (offsetTop != null && scrollTop <= offsetTop) return 'top' 33988 if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom' 33989 33990 return false 33991 } 33992 33993 Affix.prototype.getPinnedOffset = function () { 33994 if (this.pinnedOffset) return this.pinnedOffset 33995 this.$element.removeClass(Affix.RESET).addClass('affix') 33996 var scrollTop = this.$target.scrollTop() 33997 var position = this.$element.offset() 33998 return (this.pinnedOffset = position.top - scrollTop) 33999 } 34000 34001 Affix.prototype.checkPositionWithEventLoop = function () { 34002 setTimeout($.proxy(this.checkPosition, this), 1) 34003 } 34004 34005 Affix.prototype.checkPosition = function () { 34006 if (!this.$element.is(':visible')) return 34007 34008 var height = this.$element.height() 34009 var offset = this.options.offset 34010 var offsetTop = offset.top 34011 var offsetBottom = offset.bottom 34012 var scrollHeight = Math.max($(document).height(), $(document.body).height()) 34013 34014 if (typeof offset != 'object') offsetBottom = offsetTop = offset 34015 if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element) 34016 if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element) 34017 34018 var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom) 34019 34020 if (this.affixed != affix) { 34021 if (this.unpin != null) this.$element.css('top', '') 34022 34023 var affixType = 'affix' + (affix ? '-' + affix : '') 34024 var e = $.Event(affixType + '.bs.affix') 34025 34026 this.$element.trigger(e) 34027 34028 if (e.isDefaultPrevented()) return 34029 34030 this.affixed = affix 34031 this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null 34032 34033 this.$element 34034 .removeClass(Affix.RESET) 34035 .addClass(affixType) 34036 .trigger(affixType.replace('affix', 'affixed') + '.bs.affix') 34037 } 34038 34039 if (affix == 'bottom') { 34040 this.$element.offset({ 34041 top: scrollHeight - height - offsetBottom 34042 }) 34043 } 34044 } 34045 34046 34047 // AFFIX PLUGIN DEFINITION 34048 // ======================= 34049 34050 function Plugin(option) { 34051 return this.each(function () { 34052 var $this = $(this) 34053 var data = $this.data('bs.affix') 34054 var options = typeof option == 'object' && option 34055 34056 if (!data) $this.data('bs.affix', (data = new Affix(this, options))) 34057 if (typeof option == 'string') data[option]() 34058 }) 34059 } 34060 34061 var old = $.fn.affix 34062 34063 $.fn.affix = Plugin 34064 $.fn.affix.Constructor = Affix 34065 34066 34067 // AFFIX NO CONFLICT 34068 // ================= 34069 34070 $.fn.affix.noConflict = function () { 34071 $.fn.affix = old 34072 return this 34073 } 34074 34075 34076 // AFFIX DATA-API 34077 // ============== 34078 34079 $(window).on('load', function () { 34080 $('[data-spy="affix"]').each(function () { 34081 var $spy = $(this) 34082 var data = $spy.data() 34083 34084 data.offset = data.offset || {} 34085 34086 if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom 34087 if (data.offsetTop != null) data.offset.top = data.offsetTop 34088 34089 Plugin.call($spy, data) 34090 }) 34091 }) 34092 34093}(jQuery); 34094; 34095/*!
34096 * SmartMenus jQuery Plugin - v1.0.1 - November 1, 2016 34097 * http://www.smartmenus.org/ 34098 * 34099 * Copyright Vasil Dinkov, Vadikom Web Ltd. 34100 * http://vadikom.com 34101 * 34102 * Licensed MIT 34103 */ 34104 34105(function(factory) { 34106 if (typeof define === 'function' && define.amd) { 34107 // AMD 34108 define(['jquery'], factory); 34109 } else if (typeof module === 'object' && typeof module.exports === 'object') { 34110 // CommonJS 34111 module.exports = factory(require('jquery')); 34112 } else { 34113 // Global jQuery 34114 factory(jQuery); 34115 } 34116} (function($) { 34117 34118 var menuTrees = [], 34119 IE = !!window.createPopup, // detect it for the iframe shim 34120 mouse = false, // optimize for touch by default - we will detect for mouse input 34121 touchEvents = 'ontouchstart' in window, // we use this just to choose between toucn and pointer events, not for touch screen detection 34122 mouseDetectionEnabled = false, 34123 requestAnimationFrame = window.requestAnimationFrame || function(callback) { return setTimeout(callback, 1000 / 60); }, 34124 cancelAnimationFrame = window.cancelAnimationFrame || function(id) { clearTimeout(id); }; 34125 34126 // Handle detection for mouse input (i.e. desktop browsers, tablets with a mouse, etc.) 34127 function initMouseDetection(disable) { 34128 var eNS = '.smartmenus_mouse'; 34129 if (!mouseDetectionEnabled && !disable) { 34130 // if we get two consecutive mousemoves within 2 pixels from each other and within 300ms, we assume a real mouse/cursor is present 34131 // in practice, this seems like impossible to trick unintentianally with a real mouse and a pretty safe detection on touch devices (even with older browsers that do not support touch events) 34132 var firstTime = true, 34133 lastMove = null; 34134 $(document).bind(getEventsNS([ 34135 ['mousemove', function(e) { 34136 var thisMove = { x: e.pageX, y: e.pageY, timeStamp: new Date().getTime() }; 34137 if (lastMove) { 34138 var deltaX = Math.abs(lastMove.x - thisMove.x), 34139 deltaY = Math.abs(lastMove.y - thisMove.y); 34140 if ((deltaX > 0 || deltaY > 0) && deltaX <= 2 && deltaY <= 2 && thisMove.timeStamp - lastMove.timeStamp <= 300) { 34141 mouse = true; 34142 // if this is the first check after page load, check if we are not over some item by chance and call the mouseenter handler if yes 34143 if (firstTime) { 34144 var $a = $(e.target).closest('a'); 34145 if ($a.is('a')) { 34146 $.each(menuTrees, function() { 34147 if ($.contains(this.$root[0], $a[0])) { 34148 this.itemEnter({ currentTarget: $a[0] }); 34149 return false; 34150 } 34151 }); 34152 } 34153 firstTime = false; 34154 } 34155 } 34156 } 34157 lastMove = thisMove; 34158 }], 34159 [touchEvents ? 'touchstart' : 'pointerover pointermove pointerout MSPointerOver MSPointerMove MSPointerOut', function(e) { 34160 if (isTouchEvent(e.originalEvent)) { 34161 mouse = false; 34162 } 34163 }] 34164 ], eNS)); 34165 mouseDetectionEnabled = true; 34166 } else if (mouseDetectionEnabled && disable) { 34167 $(document).unbind(eNS); 34168 mouseDetectionEnabled = false; 34169 } 34170 } 34171 34172 function isTouchEvent(e) { 34173 return !/^(4|mouse)$/.test(e.pointerType); 34174 } 34175 34176 // returns a jQuery bind() ready object 34177 function getEventsNS(defArr, eNS) { 34178 if (!eNS) { 34179 eNS = ''; 34180 } 34181 var obj = {}; 34182 $.each(defArr, function(index, value) { 34183 obj[value[0].split(' ').join(eNS + ' ') + eNS] = value[1]; 34184 }); 34185 return obj; 34186 } 34187 34188 $.SmartMenus = function(elm, options) { 34189 this.$root = $(elm); 34190 this.opts = options; 34191 this.rootId = ''; // internal 34192 this.accessIdPrefix = ''; 34193 this.$subArrow = null; 34194 this.activatedItems = []; // stores last activated A's for each level 34195 this.visibleSubMenus = []; // stores visible sub menus UL's (might be in no particular order) 34196 this.showTimeout = 0; 34197 this.hideTimeout = 0; 34198 this.scrollTimeout = 0; 34199 this.clickActivated = false; 34200 this.focusActivated = false; 34201 this.zIndexInc = 0; 34202 this.idInc = 0; 34203 this.$firstLink = null; // we'll use these for some tests 34204 this.$firstSub = null; // at runtime so we'll cache them 34205 this.disabled = false; 34206 this.$disableOverlay = null; 34207 this.$touchScrollingSub = null; 34208 this.cssTransforms3d = 'perspective' in elm.style || 'webkitPerspective' in elm.style; 34209 this.wasCollapsible = false; 34210 this.init(); 34211 }; 34212 34213 $.extend($.SmartMenus, { 34214 hideAll: function() { 34215 $.each(menuTrees, function() { 34216 this.menuHideAll(); 34217 }); 34218 }, 34219 destroy: function() { 34220 while (menuTrees.length) { 34221 menuTrees[0].destroy(); 34222 } 34223 initMouseDetection(true); 34224 }, 34225 prototype: { 34226 init: function(refresh) { 34227 var self = this; 34228 34229 if (!refresh) { 34230 menuTrees.push(this); 34231 34232 this.rootId = (new Date().getTime() + Math.random() + '').replace(/\D/g, ''); 34233 this.accessIdPrefix = 'sm-' + this.rootId + '-'; 34234 34235 if (this.$root.hasClass('sm-rtl')) { 34236 this.opts.rightToLeftSubMenus = true; 34237 } 34238 34239 // init root (main menu) 34240 var eNS = '.smartmenus'; 34241 this.$root 34242 .data('smartmenus', this) 34243 .attr('data-smartmenus-id', this.rootId) 34244 .dataSM('level', 1) 34245 .bind(getEventsNS([ 34246 ['mouseover focusin', $.proxy(this.rootOver, this)], 34247 ['mouseout focusout', $.proxy(this.rootOut, this)], 34248 ['keydown', $.proxy(this.rootKeyDown, this)] 34249 ], eNS)) 34250 .delegate('a', getEventsNS([ 34251 ['mouseenter', $.proxy(this.itemEnter, this)], 34252 ['mouseleave', $.proxy(this.itemLeave, this)], 34253 ['mousedown', $.proxy(this.itemDown, this)], 34254 ['focus', $.proxy(this.itemFocus, this)], 34255 ['blur', $.proxy(this.itemBlur, this)], 34256 ['click', $.proxy(this.itemClick, this)] 34257 ], eNS)); 34258 34259 // hide menus on tap or click outside the root UL 34260 eNS += this.rootId; 34261 if (this.opts.hideOnClick) { 34262 $(document).bind(getEventsNS([ 34263 ['touchstart', $.proxy(this.docTouchStart, this)], 34264 ['touchmove', $.proxy(this.docTouchMove, this)], 34265 ['touchend', $.proxy(this.docTouchEnd, this)], 34266 // for Opera Mobile < 11.5, webOS browser, etc. we'll check click too 34267 ['click', $.proxy(this.docClick, this)] 34268 ], eNS)); 34269 } 34270 // hide sub menus on resize 34271 $(window).bind(getEventsNS([['resize orientationchange', $.proxy(this.winResize, this)]], eNS)); 34272 34273 if (this.opts.subIndicators) { 34274 this.$subArrow = $('<span/>').addClass('sub-arrow'); 34275 if (this.opts.subIndicatorsText) { 34276 this.$subArrow.html(this.opts.subIndicatorsText); 34277 } 34278 } 34279 34280 // make sure mouse detection is enabled 34281 initMouseDetection(); 34282 } 34283 34284 // init sub menus 34285 this.$firstSub = this.$root.find('ul').each(function() { self.menuInit($(this)); }).eq(0); 34286 34287 this.$firstLink = this.$root.find('a').eq(0); 34288 34289 // find current item 34290 if (this.opts.markCurrentItem) { 34291 var reDefaultDoc = /(index|default)\.[^#\?\/]*/i, 34292 reHash = /#.*/, 34293 locHref = window.location.href.replace(reDefaultDoc, ''), 34294 locHrefNoHash = locHref.replace(reHash, ''); 34295 this.$root.find('a').each(function() { 34296 var href = this.href.replace(reDefaultDoc, ''), 34297 $this = $(this); 34298 if (href == locHref || href == locHrefNoHash) { 34299 $this.addClass('current'); 34300 if (self.opts.markCurrentTree) { 34301 $this.parentsUntil('[data-smartmenus-id]', 'ul').each(function() { 34302 $(this).dataSM('parent-a').addClass('current'); 34303 });
34304 } 34305 } 34306 }); 34307 } 34308 34309 // save initial state 34310 this.wasCollapsible = this.isCollapsible(); 34311 }, 34312 destroy: function(refresh) { 34313 if (!refresh) { 34314 var eNS = '.smartmenus'; 34315 this.$root 34316 .removeData('smartmenus') 34317 .removeAttr('data-smartmenus-id') 34318 .removeDataSM('level') 34319 .unbind(eNS) 34320 .undelegate(eNS); 34321 eNS += this.rootId; 34322 $(document).unbind(eNS); 34323 $(window).unbind(eNS); 34324 if (this.opts.subIndicators) { 34325 this.$subArrow = null; 34326 } 34327 } 34328 this.menuHideAll(); 34329 var self = this; 34330 this.$root.find('ul').each(function() { 34331 var $this = $(this); 34332 if ($this.dataSM('scroll-arrows')) { 34333 $this.dataSM('scroll-arrows').remove(); 34334 } 34335 if ($this.dataSM('shown-before')) { 34336 if (self.opts.subMenusMinWidth || self.opts.subMenusMaxWidth) { 34337 $this.css({ width: '', minWidth: '', maxWidth: '' }).removeClass('sm-nowrap'); 34338 } 34339 if ($this.dataSM('scroll-arrows')) { 34340 $this.dataSM('scroll-arrows').remove(); 34341 } 34342 $this.css({ zIndex: '', top: '', left: '', marginLeft: '', marginTop: '', display: '' }); 34343 } 34344 if (($this.attr('id') || '').indexOf(self.accessIdPrefix) == 0) { 34345 $this.removeAttr('id'); 34346 } 34347 }) 34348 .removeDataSM('in-mega') 34349 .removeDataSM('shown-before') 34350 .removeDataSM('ie-shim') 34351 .removeDataSM('scroll-arrows') 34352 .removeDataSM('parent-a') 34353 .removeDataSM('level') 34354 .removeDataSM('beforefirstshowfired') 34355 .removeAttr('role') 34356 .removeAttr('aria-hidden') 34357 .removeAttr('aria-labelledby') 34358 .removeAttr('aria-expanded'); 34359 this.$root.find('a.has-submenu').each(function() { 34360 var $this = $(this); 34361 if ($this.attr('id').indexOf(self.accessIdPrefix) == 0) { 34362 $this.removeAttr('id'); 34363 } 34364 }) 34365 .removeClass('has-submenu') 34366 .removeDataSM('sub') 34367 .removeAttr('aria-haspopup') 34368 .removeAttr('aria-controls') 34369 .removeAttr('aria-expanded') 34370 .closest('li').removeDataSM('sub'); 34371 if (this.opts.subIndicators) { 34372 this.$root.find('span.sub-arrow').remove(); 34373 } 34374 if (this.opts.markCurrentItem) { 34375 this.$root.find('a.current').removeClass('current'); 34376 } 34377 if (!refresh) { 34378 this.$root = null; 34379 this.$firstLink = null; 34380 this.$firstSub = null; 34381 if (this.$disableOverlay) { 34382 this.$disableOverlay.remove(); 34383 this.$disableOverlay = null; 34384 } 34385 menuTrees.splice($.inArray(this, menuTrees), 1); 34386 } 34387 }, 34388 disable: function(noOverlay) { 34389 if (!this.disabled) { 34390 this.menuHideAll(); 34391 // display overlay over the menu to prevent interaction 34392 if (!noOverlay && !this.opts.isPopup && this.$root.is(':visible')) { 34393 var pos = this.$root.offset(); 34394 this.$disableOverlay = $('<div class="sm-jquery-disable-overlay"/>').css({ 34395 position: 'absolute', 34396 top: pos.top, 34397 left: pos.left, 34398 width: this.$root.outerWidth(), 34399 height: this.$root.outerHeight(), 34400 zIndex: this.getStartZIndex(true), 34401 opacity: 0 34402 }).appendTo(document.body); 34403 } 34404 this.disabled = true; 34405 } 34406 }, 34407 docClick: function(e) { 34408 if (this.$touchScrollingSub) { 34409 this.$touchScrollingSub = null; 34410 return; 34411 } 34412 // hide on any click outside the menu or on a menu link 34413 if (this.visibleSubMenus.length && !$.contains(this.$root[0], e.target) || $(e.target).is('a')) { 34414 this.menuHideAll(); 34415 } 34416 }, 34417 docTouchEnd: function(e) { 34418 if (!this.lastTouch) { 34419 return; 34420 } 34421 if (this.visibleSubMenus.length && (this.lastTouch.x2 === undefined || this.lastTouch.x1 == this.lastTouch.x2) && (this.lastTouch.y2 === undefined || this.lastTouch.y1 == this.lastTouch.y2) && (!this.lastTouch.target || !$.contains(this.$root[0], this.lastTouch.target))) { 34422 if (this.hideTimeout) { 34423 clearTimeout(this.hideTimeout); 34424 this.hideTimeout = 0; 34425 } 34426 // hide with a delay to prevent triggering accidental unwanted click on some page element 34427 var self = this; 34428 this.hideTimeout = setTimeout(function() { self.menuHideAll(); }, 350); 34429 } 34430 this.lastTouch = null; 34431 }, 34432 docTouchMove: function(e) { 34433 if (!this.lastTouch) { 34434 return; 34435 } 34436 var touchPoint = e.originalEvent.touches[0]; 34437 this.lastTouch.x2 = touchPoint.pageX; 34438 this.lastTouch.y2 = touchPoint.pageY; 34439 }, 34440 docTouchStart: function(e) { 34441 var touchPoint = e.originalEvent.touches[0]; 34442 this.lastTouch = { x1: touchPoint.pageX, y1: touchPoint.pageY, target: touchPoint.target }; 34443 }, 34444 enable: function() { 34445 if (this.disabled) { 34446 if (this.$disableOverlay) { 34447 this.$disableOverlay.remove(); 34448 this.$disableOverlay = null; 34449 } 34450 this.disabled = false; 34451 } 34452 }, 34453 getClosestMenu: function(elm) { 34454 var $closestMenu = $(elm).closest('ul'); 34455 while ($closestMenu.dataSM('in-mega')) { 34456 $closestMenu = $closestMenu.parent().closest('ul'); 34457 } 34458 return $closestMenu[0] || null; 34459 }, 34460 getHeight: function($elm) { 34461 return this.getOffset($elm, true); 34462 }, 34463 // returns precise width/height float values 34464 getOffset: function($elm, height) { 34465 var old; 34466 if ($elm.css('display') == 'none') { 34467 old = { position: $elm[0].style.position, visibility: $elm[0].style.visibility }; 34468 $elm.css({ position: 'absolute', visibility: 'hidden' }).show(); 34469 } 34470 var box = $elm[0].getBoundingClientRect && $elm[0].getBoundingClientRect(), 34471 val = box && (height ? box.height || box.bottom - box.top : box.width || box.right - box.left); 34472 if (!val && val !== 0) { 34473 val = height ? $elm[0].offsetHeight : $elm[0].offsetWidth; 34474 } 34475 if (old) { 34476 $elm.hide().css(old); 34477 } 34478 return val; 34479 }, 34480 getStartZIndex: function(root) { 34481 var zIndex = parseInt(this[root ? '$root' : '$firstSub'].css('z-index')); 34482 if (!root && isNaN(zIndex)) { 34483 zIndex = parseInt(this.$root.css('z-index')); 34484 } 34485 return !isNaN(zIndex) ? zIndex : 1; 34486 }, 34487 getTouchPoint: function(e) { 34488 return e.touches && e.touches[0] || e.changedTouches && e.changedTouches[0] || e; 34489 }, 34490 getViewport: function(height) { 34491 var name = height ? 'Height' : 'Width', 34492 val = document.documentElement['client' + name], 34493 val2 = window['inner' + name]; 34494 if (val2) { 34495 val = Math.min(val, val2); 34496 } 34497 return val; 34498 },
34499 getViewportHeight: function() { 34500 return this.getViewport(true); 34501 }, 34502 getViewportWidth: function() { 34503 return this.getViewport(); 34504 }, 34505 getWidth: function($elm) { 34506 return this.getOffset($elm); 34507 }, 34508 handleEvents: function() { 34509 return !this.disabled && this.isCSSOn(); 34510 }, 34511 handleItemEvents: function($a) { 34512 return this.handleEvents() && !this.isLinkInMegaMenu($a); 34513 }, 34514 isCollapsible: function() { 34515 return this.$firstSub.css('position') == 'static'; 34516 }, 34517 isCSSOn: function() { 34518 return this.$firstLink.css('display') == 'block'; 34519 }, 34520 isFixed: function() { 34521 var isFixed = this.$root.css('position') == 'fixed'; 34522 if (!isFixed) { 34523 this.$root.parentsUntil('body').each(function() { 34524 if ($(this).css('position') == 'fixed') { 34525 isFixed = true; 34526 return false; 34527 } 34528 }); 34529 } 34530 return isFixed; 34531 }, 34532 isLinkInMegaMenu: function($a) { 34533 return $(this.getClosestMenu($a[0])).hasClass('mega-menu'); 34534 }, 34535 isTouchMode: function() { 34536 return !mouse || this.opts.noMouseOver || this.isCollapsible(); 34537 }, 34538 itemActivate: function($a, focus) { 34539 var $ul = $a.closest('ul'), 34540 level = $ul.dataSM('level'); 34541 // if for some reason the parent item is not activated (e.g. this is an API call to activate the item), activate all parent items first 34542 if (level > 1 && (!this.activatedItems[level - 2] || this.activatedItems[level - 2][0] != $ul.dataSM('parent-a')[0])) { 34543 var self = this; 34544 $($ul.parentsUntil('[data-smartmenus-id]', 'ul').get().reverse()).add($ul).each(function() { 34545 self.itemActivate($(this).dataSM('parent-a')); 34546 }); 34547 } 34548 // hide any visible deeper level sub menus 34549 if (!this.isCollapsible() || focus) { 34550 this.menuHideSubMenus(!this.activatedItems[level - 1] || this.activatedItems[level - 1][0] != $a[0] ? level - 1 : level); 34551 } 34552 // save new active item for this level 34553 this.activatedItems[level - 1] = $a; 34554 if (this.$root.triggerHandler('activate.smapi', $a[0]) === false) { 34555 return; 34556 } 34557 // show the sub menu if this item has one 34558 var $sub = $a.dataSM('sub'); 34559 if ($sub && (this.isTouchMode() || (!this.opts.showOnClick || this.clickActivated))) { 34560 this.menuShow($sub); 34561 } 34562 }, 34563 itemBlur: function(e) { 34564 var $a = $(e.currentTarget); 34565 if (!this.handleItemEvents($a)) { 34566 return; 34567 } 34568 this.$root.triggerHandler('blur.smapi', $a[0]); 34569 }, 34570 itemClick: function(e) { 34571 var $a = $(e.currentTarget); 34572 if (!this.handleItemEvents($a)) { 34573 return; 34574 } 34575 if (this.$touchScrollingSub && this.$touchScrollingSub[0] == $a.closest('ul')[0]) { 34576 this.$touchScrollingSub = null; 34577 e.stopPropagation(); 34578 return false; 34579 } 34580 if (this.$root.triggerHandler('click.smapi', $a[0]) === false) { 34581 return false; 34582 } 34583 var subArrowClicked = $(e.target).is('span.sub-arrow'), 34584 $sub = $a.dataSM('sub'), 34585 firstLevelSub = $sub ? $sub.dataSM('level') == 2 : false; 34586 // if the sub is not visible 34587 if ($sub && !$sub.is(':visible')) { 34588 if (this.opts.showOnClick && firstLevelSub) { 34589 this.clickActivated = true; 34590 } 34591 // try to activate the item and show the sub 34592 this.itemActivate($a); 34593 // if "itemActivate" showed the sub, prevent the click so that the link is not loaded 34594 // if it couldn't show it, then the sub menus are disabled with an !important declaration (e.g. via mobile styles) so let the link get loaded 34595 if ($sub.is(':visible')) { 34596 this.focusActivated = true; 34597 return false; 34598 } 34599 } else if (this.isCollapsible() && subArrowClicked) { 34600 this.itemActivate($a); 34601 this.menuHide($sub); 34602 return false; 34603 } 34604 if (this.opts.showOnClick && firstLevelSub || $a.hasClass('disabled') || this.$root.triggerHandler('select.smapi', $a[0]) === false) { 34605 return false; 34606 } 34607 }, 34608 itemDown: function(e) { 34609 var $a = $(e.currentTarget); 34610 if (!this.handleItemEvents($a)) { 34611 return; 34612 } 34613 $a.dataSM('mousedown', true); 34614 }, 34615 itemEnter: function(e) { 34616 var $a = $(e.currentTarget); 34617 if (!this.handleItemEvents($a)) { 34618 return; 34619 } 34620 if (!this.isTouchMode()) { 34621 if (this.showTimeout) { 34622 clearTimeout(this.showTimeout); 34623 this.showTimeout = 0; 34624 } 34625 var self = this; 34626 this.showTimeout = setTimeout(function() { self.itemActivate($a); }, this.opts.showOnClick && $a.closest('ul').dataSM('level') == 1 ? 1 : this.opts.showTimeout); 34627 } 34628 this.$root.triggerHandler('mouseenter.smapi', $a[0]); 34629 }, 34630 itemFocus: function(e) { 34631 var $a = $(e.currentTarget); 34632 if (!this.handleItemEvents($a)) { 34633 return; 34634 } 34635 // fix (the mousedown check): in some browsers a tap/click produces consecutive focus + click events so we don't need to activate the item on focus 34636 if (this.focusActivated && (!this.isTouchMode() || !$a.dataSM('mousedown')) && (!this.activatedItems.length || this.activatedItems[this.activatedItems.length - 1][0] != $a[0])) { 34637 this.itemActivate($a, true); 34638 } 34639 this.$root.triggerHandler('focus.smapi', $a[0]); 34640 }, 34641 itemLeave: function(e) { 34642 var $a = $(e.currentTarget); 34643 if (!this.handleItemEvents($a)) { 34644 return; 34645 } 34646 if (!this.isTouchMode()) { 34647 $a[0].blur(); 34648 if (this.showTimeout) { 34649 clearTimeout(this.showTimeout); 34650 this.showTimeout = 0; 34651 } 34652 } 34653 $a.removeDataSM('mousedown');
34654 this.$root.triggerHandler('mouseleave.smapi', $a[0]); 34655 }, 34656 menuHide: function($sub) { 34657 if (this.$root.triggerHandler('beforehide.smapi', $sub[0]) === false) { 34658 return; 34659 } 34660 $sub.stop(true, true); 34661 if ($sub.css('display') != 'none') { 34662 var complete = function() { 34663 // unset z-index 34664 $sub.css('z-index', ''); 34665 }; 34666 // if sub is collapsible (mobile view) 34667 if (this.isCollapsible()) { 34668 if (this.opts.collapsibleHideFunction) { 34669 this.opts.collapsibleHideFunction.call(this, $sub, complete); 34670 } else { 34671 $sub.hide(this.opts.collapsibleHideDuration, complete); 34672 } 34673 } else { 34674 if (this.opts.hideFunction) { 34675 this.opts.hideFunction.call(this, $sub, complete); 34676 } else { 34677 $sub.hide(this.opts.hideDuration, complete); 34678 } 34679 } 34680 // remove IE iframe shim 34681 if ($sub.dataSM('ie-shim')) { 34682 $sub.dataSM('ie-shim').remove().css({ '-webkit-transform': '', transform: '' }); 34683 } 34684 // deactivate scrolling if it is activated for this sub 34685 if ($sub.dataSM('scroll')) { 34686 this.menuScrollStop($sub); 34687 $sub.css({ 'touch-action': '', '-ms-touch-action': '', '-webkit-transform': '', transform: '' }) 34688 .unbind('.smartmenus_scroll').removeDataSM('scroll').dataSM('scroll-arrows').hide(); 34689 } 34690 // unhighlight parent item + accessibility 34691 $sub.dataSM('parent-a').removeClass('highlighted').attr('aria-expanded', 'false'); 34692 $sub.attr({ 34693 'aria-expanded': 'false', 34694 'aria-hidden': 'true' 34695 }); 34696 var level = $sub.dataSM('level'); 34697 this.activatedItems.splice(level - 1, 1); 34698 this.visibleSubMenus.splice($.inArray($sub, this.visibleSubMenus), 1); 34699 this.$root.triggerHandler('hide.smapi', $sub[0]); 34700 } 34701 }, 34702 menuHideAll: function() { 34703 if (this.showTimeout) { 34704 clearTimeout(this.showTimeout); 34705 this.showTimeout = 0; 34706 } 34707 // hide all subs 34708 // if it's a popup, this.visibleSubMenus[0] is the root UL 34709 var level = this.opts.isPopup ? 1 : 0; 34710 for (var i = this.visibleSubMenus.length - 1; i >= level; i--) { 34711 this.menuHide(this.visibleSubMenus[i]); 34712 } 34713 // hide root if it's popup 34714 if (this.opts.isPopup) { 34715 this.$root.stop(true, true); 34716 if (this.$root.is(':visible')) { 34717 if (this.opts.hideFunction) { 34718 this.opts.hideFunction.call(this, this.$root); 34719 } else { 34720 this.$root.hide(this.opts.hideDuration); 34721 } 34722 // remove IE iframe shim 34723 if (this.$root.dataSM('ie-shim')) { 34724 this.$root.dataSM('ie-shim').remove(); 34725 } 34726 } 34727 } 34728 this.activatedItems = []; 34729 this.visibleSubMenus = []; 34730 this.clickActivated = false; 34731 this.focusActivated = false; 34732 // reset z-index increment 34733 this.zIndexInc = 0; 34734 this.$root.triggerHandler('hideAll.smapi'); 34735 }, 34736 menuHideSubMenus: function(level) { 34737 for (var i = this.activatedItems.length - 1; i >= level; i--) { 34738 var $sub = this.activatedItems[i].dataSM('sub'); 34739 if ($sub) { 34740 this.menuHide($sub); 34741 } 34742 } 34743 }, 34744 menuIframeShim: function($ul) { 34745 // create iframe shim for the menu 34746 if (IE && this.opts.overlapControlsInIE && !$ul.dataSM('ie-shim')) { 34747 $ul.dataSM('ie-shim', $('<iframe/>').attr({ src: 'javascript:0', tabindex: -9 }) 34748 .css({ position: 'absolute', top: 'auto', left: '0', opacity: 0, border: '0' }) 34749 ); 34750 } 34751 }, 34752 menuInit: function($ul) { 34753 if (!$ul.dataSM('in-mega')) { 34754 // mark UL's in mega drop downs (if any) so we can neglect them 34755 if ($ul.hasClass('mega-menu')) { 34756 $ul.find('ul').dataSM('in-mega', true); 34757 } 34758 // get level (much faster than, for example, using parentsUntil) 34759 var level = 2, 34760 par = $ul[0]; 34761 while ((par = par.parentNode.parentNode) != this.$root[0]) { 34762 level++; 34763 } 34764 // cache stuff for quick access 34765 var $a = $ul.prevAll('a').eq(-1); 34766 // if the link is nested (e.g. in a heading) 34767 if (!$a.length) { 34768 $a = $ul.prevAll().find('a').eq(-1); 34769 } 34770 $a.addClass('has-submenu').dataSM('sub', $ul); 34771 $ul.dataSM('parent-a', $a) 34772 .dataSM('level', level) 34773 .parent().dataSM('sub', $ul); 34774 // accessibility 34775 var aId = $a.attr('id') || this.accessIdPrefix + (++this.idInc), 34776 ulId = $ul.attr('id') || this.accessIdPrefix + (++this.idInc); 34777 $a.attr({ 34778 id: aId, 34779 'aria-haspopup': 'true', 34780 'aria-controls': ulId, 34781 'aria-expanded': 'false' 34782 });
34783 $ul.attr({ 34784 id: ulId, 34785 'role': 'group', 34786 'aria-hidden': 'true', 34787 'aria-labelledby': aId, 34788 'aria-expanded': 'false' 34789 }); 34790 // add sub indicator to parent item 34791 if (this.opts.subIndicators) { 34792 $a[this.opts.subIndicatorsPos](this.$subArrow.clone()); 34793 } 34794 } 34795 }, 34796 menuPosition: function($sub) { 34797 var $a = $sub.dataSM('parent-a'), 34798 $li = $a.closest('li'), 34799 $ul = $li.parent(), 34800 level = $sub.dataSM('level'), 34801 subW = this.getWidth($sub), 34802 subH = this.getHeight($sub), 34803 itemOffset = $a.offset(), 34804 itemX = itemOffset.left, 34805 itemY = itemOffset.top, 34806 itemW = this.getWidth($a), 34807 itemH = this.getHeight($a), 34808 $win = $(window), 34809 winX = $win.scrollLeft(), 34810 winY = $win.scrollTop(), 34811 winW = this.getViewportWidth(), 34812 winH = this.getViewportHeight(), 34813 horizontalParent = $ul.parent().is('[data-sm-horizontal-sub]') || level == 2 && !$ul.hasClass('sm-vertical'), 34814 rightToLeft = this.opts.rightToLeftSubMenus && !$li.is('[data-sm-reverse]') || !this.opts.rightToLeftSubMenus && $li.is('[data-sm-reverse]'), 34815 subOffsetX = level == 2 ? this.opts.mainMenuSubOffsetX : this.opts.subMenusSubOffsetX, 34816 subOffsetY = level == 2 ? this.opts.mainMenuSubOffsetY : this.opts.subMenusSubOffsetY, 34817 x, y; 34818 if (horizontalParent) { 34819 x = rightToLeft ? itemW - subW - subOffsetX : subOffsetX; 34820 y = this.opts.bottomToTopSubMenus ? -subH - subOffsetY : itemH + subOffsetY; 34821 } else { 34822 x = rightToLeft ? subOffsetX - subW : itemW - subOffsetX; 34823 y = this.opts.bottomToTopSubMenus ? itemH - subOffsetY - subH : subOffsetY; 34824 } 34825 if (this.opts.keepInViewport) { 34826 var absX = itemX + x, 34827 absY = itemY + y; 34828 if (rightToLeft && absX < winX) { 34829 x = horizontalParent ? winX - absX + x : itemW - subOffsetX; 34830 } else if (!rightToLeft && absX + subW > winX + winW) { 34831 x = horizontalParent ? winX + winW - subW - absX + x : subOffsetX - subW; 34832 } 34833 if (!horizontalParent) { 34834 if (subH < winH && absY + subH > winY + winH) { 34835 y += winY + winH - subH - absY; 34836 } else if (subH >= winH || absY < winY) { 34837 y += winY - absY; 34838 } 34839 } 34840 // do we need scrolling? 34841 // 0.49 used for better precision when dealing with float values 34842 if (horizontalParent && (absY + subH > winY + winH + 0.49 || absY < winY) || !horizontalParent && subH > winH + 0.49) { 34843 var self = this; 34844 if (!$sub.dataSM('scroll-arrows')) { 34845 $sub.dataSM('scroll-arrows', $([$('<span class="scroll-up"><span class="scroll-up-arrow"></span></span>')[0], $('<span class="scroll-down"><span class="scroll-down-arrow"></span></span>')[0]]) 34846 .bind({ 34847 mouseenter: function() { 34848 $sub.dataSM('scroll').up = $(this).hasClass('scroll-up'); 34849 self.menuScroll($sub); 34850 }, 34851 mouseleave: function(e) { 34852 self.menuScrollStop($sub); 34853 self.menuScrollOut($sub, e); 34854 }, 34855 'mousewheel DOMMouseScroll': function(e) { e.preventDefault(); } 34856 }) 34857 .insertAfter($sub) 34858 ); 34859 } 34860 // bind scroll events and save scroll data for this sub 34861 var eNS = '.smartmenus_scroll'; 34862 $sub.dataSM('scroll', { 34863 y: this.cssTransforms3d ? 0 : y - itemH, 34864 step: 1, 34865 // cache stuff for faster recalcs later 34866 itemH: itemH, 34867 subH: subH, 34868 arrowDownH: this.getHeight($sub.dataSM('scroll-arrows').eq(1)) 34869 }) 34870 .bind(getEventsNS([ 34871 ['mouseover', function(e) { self.menuScrollOver($sub, e); }], 34872 ['mouseout', function(e) { self.menuScrollOut($sub, e); }], 34873 ['mousewheel DOMMouseScroll', function(e) { self.menuScrollMousewheel($sub, e); }] 34874 ], eNS)) 34875 .dataSM('scroll-arrows').css({ top: 'auto', left: '0', marginLeft: x + (parseInt($sub.css('border-left-width')) || 0), width: subW - (parseInt($sub.css('border-left-width')) || 0) - (parseInt($sub.css('border-right-width')) || 0), zIndex: $sub.css('z-index') }) 34876 .eq(horizontalParent && this.opts.bottomToTopSubMenus ? 0 : 1).show(); 34877 // when a menu tree is fixed positioned we allow scrolling via touch too 34878 // since there is no other way to access such long sub menus if no mouse is present 34879 if (this.isFixed()) { 34880 $sub.css({ 'touch-action': 'none', '-ms-touch-action': 'none' }) 34881 .bind(getEventsNS([ 34882 [touchEvents ? 'touchstart touchmove touchend' : 'pointerdown pointermove pointerup MSPointerDown MSPointerMove MSPointerUp', function(e) { 34883 self.menuScrollTouch($sub, e); 34884 }] 34885 ], eNS)); 34886 } 34887 } 34888 } 34889 $sub.css({ top: 'auto', left: '0', marginLeft: x, marginTop: y - itemH }); 34890 // IE iframe shim 34891 this.menuIframeShim($sub); 34892 if ($sub.dataSM('ie-shim')) { 34893 $sub.dataSM('ie-shim').css({ zIndex: $sub.css('z-index'), width: subW, height: subH, marginLeft: x, marginTop: y - itemH }); 34894 } 34895 }, 34896 menuScroll: function($sub, once, step) { 34897 var data = $sub.dataSM('scroll'), 34898 $arrows = $sub.dataSM('scroll-arrows'), 34899 end = data.up ? data.upEnd : data.downEnd, 34900 diff; 34901 if (!once && data.momentum) { 34902 data.momentum *= 0.92; 34903 diff = data.momentum; 34904 if (diff < 0.5) { 34905 this.menuScrollStop($sub); 34906 return; 34907 } 34908 } else { 34909 diff = step || (once || !this.opts.scrollAccelerate ? this.opts.scrollStep : Math.floor(data.step)); 34910 } 34911 // hide any visible deeper level sub menus 34912 var level = $sub.dataSM('level'); 34913 if (this.activatedItems[level - 1] && this.activatedItems[level - 1].dataSM('sub') && this.activatedItems[level - 1].dataSM('sub').is(':visible')) {
34914 this.menuHideSubMenus(level - 1); 34915 } 34916 data.y = data.up && end <= data.y || !data.up && end >= data.y ? data.y : (Math.abs(end - data.y) > diff ? data.y + (data.up ? diff : -diff) : end); 34917 $sub.add($sub.dataSM('ie-shim')).css(this.cssTransforms3d ? { '-webkit-transform': 'translate3d(0, ' + data.y + 'px, 0)', transform: 'translate3d(0, ' + data.y + 'px, 0)' } : { marginTop: data.y }); 34918 // show opposite arrow if appropriate 34919 if (mouse && (data.up && data.y > data.downEnd || !data.up && data.y < data.upEnd)) { 34920 $arrows.eq(data.up ? 1 : 0).show(); 34921 } 34922 // if we've reached the end 34923 if (data.y == end) { 34924 if (mouse) { 34925 $arrows.eq(data.up ? 0 : 1).hide(); 34926 } 34927 this.menuScrollStop($sub); 34928 } else if (!once) { 34929 if (this.opts.scrollAccelerate && data.step < this.opts.scrollStep) { 34930 data.step += 0.2; 34931 } 34932 var self = this; 34933 this.scrollTimeout = requestAnimationFrame(function() { self.menuScroll($sub); }); 34934 } 34935 }, 34936 menuScrollMousewheel: function($sub, e) { 34937 if (this.getClosestMenu(e.target) == $sub[0]) { 34938 e = e.originalEvent; 34939 var up = (e.wheelDelta || -e.detail) > 0; 34940 if ($sub.dataSM('scroll-arrows').eq(up ? 0 : 1).is(':visible')) { 34941 $sub.dataSM('scroll').up = up; 34942 this.menuScroll($sub, true); 34943 } 34944 } 34945 e.preventDefault(); 34946 }, 34947 menuScrollOut: function($sub, e) { 34948 if (mouse) { 34949 if (!/^scroll-(up|down)/.test((e.relatedTarget || '').className) && ($sub[0] != e.relatedTarget && !$.contains($sub[0], e.relatedTarget) || this.getClosestMenu(e.relatedTarget) != $sub[0])) { 34950 $sub.dataSM('scroll-arrows').css('visibility', 'hidden'); 34951 } 34952 } 34953 }, 34954 menuScrollOver: function($sub, e) { 34955 if (mouse) { 34956 if (!/^scroll-(up|down)/.test(e.target.className) && this.getClosestMenu(e.target) == $sub[0]) { 34957 this.menuScrollRefreshData($sub); 34958 var data = $sub.dataSM('scroll'), 34959 upEnd = $(window).scrollTop() - $sub.dataSM('parent-a').offset().top - data.itemH; 34960 $sub.dataSM('scroll-arrows').eq(0).css('margin-top', upEnd).end() 34961 .eq(1).css('margin-top', upEnd + this.getViewportHeight() - data.arrowDownH).end() 34962 .css('visibility', 'visible'); 34963 } 34964 } 34965 }, 34966 menuScrollRefreshData: function($sub) { 34967 var data = $sub.dataSM('scroll'), 34968 upEnd = $(window).scrollTop() - $sub.dataSM('parent-a').offset().top - data.itemH; 34969 if (this.cssTransforms3d) { 34970 upEnd = -(parseFloat($sub.css('margin-top')) - upEnd); 34971 } 34972 $.extend(data, { 34973 upEnd: upEnd, 34974 downEnd: upEnd + this.getViewportHeight() - data.subH 34975 }); 34976 }, 34977 menuScrollStop: function($sub) { 34978 if (this.scrollTimeout) { 34979 cancelAnimationFrame(this.scrollTimeout); 34980 this.scrollTimeout = 0; 34981 $sub.dataSM('scroll').step = 1; 34982 return true; 34983 } 34984 }, 34985 menuScrollTouch: function($sub, e) { 34986 e = e.originalEvent; 34987 if (isTouchEvent(e)) { 34988 var touchPoint = this.getTouchPoint(e); 34989 // neglect event if we touched a visible deeper level sub menu 34990 if (this.getClosestMenu(touchPoint.target) == $sub[0]) { 34991 var data = $sub.dataSM('scroll'); 34992 if (/(start|down)$/i.test(e.type)) { 34993 if (this.menuScrollStop($sub)) { 34994 // if we were scrolling, just stop and don't activate any link on the first touch 34995 e.preventDefault(); 34996 this.$touchScrollingSub = $sub; 34997 } else { 34998 this.$touchScrollingSub = null; 34999 } 35000 // update scroll data since the user might have zoomed, etc. 35001 this.menuScrollRefreshData($sub); 35002 // extend it with the touch properties 35003 $.extend(data, { 35004 touchStartY: touchPoint.pageY, 35005 touchStartTime: e.timeStamp 35006 }); 35007 } else if (/move$/i.test(e.type)) { 35008 var prevY = data.touchY !== undefined ? data.touchY : data.touchStartY; 35009 if (prevY !== undefined && prevY != touchPoint.pageY) { 35010 this.$touchScrollingSub = $sub; 35011 var up = prevY < touchPoint.pageY; 35012 // changed direction? reset... 35013 if (data.up !== undefined && data.up != up) { 35014 $.extend(data, { 35015 touchStartY: touchPoint.pageY, 35016 touchStartTime: e.timeStamp 35017 });
35018 } 35019 $.extend(data, { 35020 up: up, 35021 touchY: touchPoint.pageY 35022 }); 35023 this.menuScroll($sub, true, Math.abs(touchPoint.pageY - prevY)); 35024 } 35025 e.preventDefault(); 35026 } else { // touchend/pointerup 35027 if (data.touchY !== undefined) { 35028 if (data.momentum = Math.pow(Math.abs(touchPoint.pageY - data.touchStartY) / (e.timeStamp - data.touchStartTime), 2) * 15) { 35029 this.menuScrollStop($sub); 35030 this.menuScroll($sub); 35031 e.preventDefault(); 35032 } 35033 delete data.touchY; 35034 } 35035 } 35036 } 35037 } 35038 }, 35039 menuShow: function($sub) { 35040 if (!$sub.dataSM('beforefirstshowfired')) { 35041 $sub.dataSM('beforefirstshowfired', true); 35042 if (this.$root.triggerHandler('beforefirstshow.smapi', $sub[0]) === false) { 35043 return; 35044 } 35045 } 35046 if (this.$root.triggerHandler('beforeshow.smapi', $sub[0]) === false) { 35047 return; 35048 } 35049 $sub.dataSM('shown-before', true) 35050 .stop(true, true); 35051 if (!$sub.is(':visible')) { 35052 // highlight parent item 35053 var $a = $sub.dataSM('parent-a'); 35054 if (this.opts.keepHighlighted || this.isCollapsible()) { 35055 $a.addClass('highlighted'); 35056 } 35057 if (this.isCollapsible()) { 35058 $sub.removeClass('sm-nowrap').css({ zIndex: '', width: 'auto', minWidth: '', maxWidth: '', top: '', left: '', marginLeft: '', marginTop: '' }); 35059 } else { 35060 // set z-index 35061 $sub.css('z-index', this.zIndexInc = (this.zIndexInc || this.get
35061StartZIndex()) + 1); 35062 // min/max-width fix - no way to rely purely on CSS as all UL's are nested 35063 if (this.opts.subMenusMinWidth || this.opts.subMenusMaxWidth) { 35064 $sub.css({ width: 'auto', minWidth: '', maxWidth: '' }).addClass('sm-nowrap'); 35065 if (this.opts.subMenusMinWidth) { 35066 $sub.css('min-width', this.opts.subMenusMinWidth); 35067 } 35068 if (this.opts.subMenusMaxWidth) { 35069 var noMaxWidth = this.getWidth($sub); 35070 $sub.css('max-width', this.opts.subMenusMaxWidth); 35071 if (noMaxWidth > this.getWidth($sub)) { 35072 $sub.removeClass('sm-nowrap').css('width', this.opts.subMenusMaxWidth); 35073 } 35074 } 35075 } 35076 this.menuPosition($sub); 35077 // insert IE iframe shim 35078 if ($sub.dataSM('ie-shim')) { 35079 $sub.dataSM('ie-shim').insertBefore($sub); 35080 } 35081 } 35082 var complete = function() { 35083 // fix: "overflow: hidden;" is not reset on animation complete in jQuery < 1.9.0 in Chrome when global "box-sizing: border-box;" is used 35084 $sub.css('overflow', ''); 35085 }; 35086 // if sub is collapsible (mobile view) 35087 if (this.isCollapsible()) { 35088 if (this.opts.collapsibleShowFunction) { 35089 this.opts.collapsibleShowFunction.call(this, $sub, complete); 35090 } else { 35091 $sub.show(this.opts.collapsibleShowDuration, complete); 35092 } 35093 } else { 35094 if (this.opts.showFunction) { 35095 this.opts.showFunction.call(this, $sub, complete); 35096 } else { 35097 $sub.show(this.opts.showDuration, complete); 35098 } 35099 } 35100 // accessibility 35101 $a.attr('aria-expanded', 'true'); 35102 $sub.attr({ 35103 'aria-expanded': 'true', 35104 'aria-hidden': 'false' 35105 }); 35106 // store sub menu in visible array 35107 this.visibleSubMenus.push($sub); 35108 this.$root.triggerHandler('show.smapi', $sub[0]); 35109 } 35110 }, 35111 popupHide: function(noHideTimeout) { 35112 if (this.hideTimeout) { 35113 clearTimeout(this.hideTimeout); 35114 this.hideTimeout = 0; 35115 } 35116 var self = this; 35117 this.hideTimeout = setTimeout(function() { 35118 self.menuHideAll(); 35119 }, noHideTimeout ? 1 : this.opts.hideTimeout); 35120 }, 35121 popupShow: function(left, top) { 35122 if (!this.opts.isPopup) { 35123 alert('SmartMenus jQuery Error:\n\nIf you want to show this menu via the "popupShow" method, set the isPopup:true option.'); 35124 return; 35125 } 35126 if (this.hideTimeout) { 35127 clearTimeout(this.hideTimeout); 35128 this.hideTimeout = 0; 35129 } 35130 this.$root.dataSM('shown-before', true) 35131 .stop(true, true); 35132 if (!this.$root.is(':visible')) { 35133 this.$root.css({ left: left, top: top }); 35134 // IE iframe shim 35135 this.menuIframeShim(this.$root); 35136 if (this.$root.dataSM('ie-shim')) { 35137 this.$root.dataSM('ie-shim').css({ zIndex: this.$root.css('z-index'), width: this.getWidth(this.$root), height: this.getHeight(this.$root), left: left, top: top }).insertBefore(this.$root); 35138 } 35139 // show menu 35140 var self = this, 35141 complete = function() { 35142 self.$root.css('overflow', ''); 35143 }; 35144 if (this.opts.showFunction) { 35145 this.opts.showFunction.call(this, this.$root, complete); 35146 } else { 35147 this.$root.show(this.opts.showDuration, complete); 35148 } 35149 this.visibleSubMenus[0] = this.$root; 35150 } 35151 }, 35152 refresh: function() { 35153 this.destroy(true); 35154 this.init(true); 35155 }, 35156 rootKeyDown: function(e) { 35157 if (!this.handleEvents()) { 35158 return; 35159 } 35160 switch (e.keyCode) { 35161 case 27: // reset on Esc 35162 var $activeTopItem = this.activatedItems[0]; 35163 if ($activeTopItem) { 35164 this.menuHideAll(); 35165 $activeTopItem[0].focus(); 35166 var $sub = $activeTopItem.dataSM('sub'); 35167 if ($sub) { 35168 this.menuHide($sub); 35169 } 35170 } 35171 break; 35172 case 32: // activate item's sub on Space 35173 var $target = $(e.target); 35174 if ($target.is('a') && this.handleItemEvents($target)) { 35175 var $sub = $target.dataSM('sub'); 35176 if ($sub && !$sub.is(':visible')) { 35177 this.itemClick({ currentTarget: e.target }); 35178 e.preventDefault(); 35179 } 35180 } 35181 break; 35182 } 35183 }, 35184 rootOut: function(e) { 35185 if (!this.handleEvents() || this.isTouchMode() || e.target == this.$root[0]) { 35186 return; 35187 } 35188 if (this.hideTimeout) { 35189 clearTimeout(this.hideTimeout); 35190 this.hideTimeout = 0; 35191 } 35192 if (!this.opts.showOnClick || !this.opts.hideOnClick) { 35193 var self = this; 35194 this.hideTimeout = setTimeout(function() { self.menuHideAll(); }, this.opts.hideTimeout); 35195 } 35196 }, 35197 rootOver: function(e) { 35198 if (!this.handleEvents() || this.isTouchMode() || e.target == this.$root[0]) { 35199 return; 35200 } 35201 if (this.hideTimeout) { 35202 clearTimeout(this.hideTimeout); 35203 this.hideTimeout = 0; 35204 } 35205 }, 35206 winResize: function(e) { 35207 if (!this.handleEvents()) { 35208 // we still need to resize the disable overlay if it's visible 35209 if (this.$disableOverlay) { 35210 var pos = this.$root.offset(); 35211 this.$disableOverlay.css({ 35212 top: pos.top, 35213 left: pos.left, 35214 width: this.$root.outerWidth(), 35215 height: this.$root.outerHeight() 35216 });
35217 } 35218 return; 35219 } 35220 // hide sub menus on resize - on mobile do it only on orientation change 35221 if (!('onorientationchange' in window) || e.type == 'orientationchange') { 35222 var isCollapsible = this.isCollapsible(); 35223 // if it was collapsible before resize and still is, don't do it 35224 if (!(this.wasCollapsible && isCollapsible)) { 35225 if (this.activatedItems.length) { 35226 this.activatedItems[this.activatedItems.length - 1][0].blur(); 35227 } 35228 this.menuHideAll(); 35229 } 35230 this.wasCollapsible = isCollapsible; 35231 } 35232 } 35233 } 35234 }); 35235 35236 $.fn.dataSM = function(key, val) { 35237 if (val) { 35238 return this.data(key + '_smartmenus', val); 35239 } 35240 return this.data(key + '_smartmenus'); 35241 }; 35242 35243 $.fn.removeDataSM = function(key) { 35244 return this.removeData(key + '_smartmenus'); 35245 }; 35246 35247 $.fn.smartmenus = function(options) { 35248 if (typeof options == 'string') { 35249 var args = arguments, 35250 method = options; 35251 Array.prototype.shift.call(args); 35252 return this.each(function() { 35253 var smartmenus = $(this).data('smartmenus'); 35254 if (smartmenus && smartmenus[method]) { 35255 smartmenus[method].apply(smartmenus, args); 35256 } 35257 }); 35258 } 35259 // [data-sm-options] attribute on the root UL 35260 var dataOpts = this.data('sm-options') || null; 35261 if (dataOpts) { 35262 try { 35263 dataOpts = eval('(' + dataOpts + ')'); 35264 } catch(e) { 35265 dataOpts = null; 35266 alert('ERROR\n\nSmartMenus jQuery init:\nInvalid "data-sm-options" attribute value syntax.'); 35267 }; 35268 } 35269 return this.each(function() { 35270 new $.SmartMenus(this, $.extend({}, $.fn.smartmenus.defaults, options, dataOpts)); 35271 }); 35272 }; 35273 35274 // default settings 35275 $.fn.smartmenus.defaults = { 35276 isPopup: false, // is this a popup menu (can be shown via the popupShow/popupHide methods) or a permanent menu bar 35277 mainMenuSubOffsetX: 0, // pixels offset from default position 35278 mainMenuSubOffsetY: 0, // pixels offset from default position 35279 subMenusSubOffsetX: 0, // pixels offset from default position 35280 subMenusSubOffsetY: 0, // pixels offset from default position 35281 subMenusMinWidth: '10em', // min-width for the sub menus (any CSS unit) - if set, the fixed width set in CSS will be ignored 35282 subMenusMaxWidth: '20em', // max-width for the sub menus (any CSS unit) - if set, the fixed width set in CSS will be ignored 35283 subIndicators: true, // create sub menu indicators - creates a SPAN and inserts it in the A 35284 subIndicatorsPos: 'prepend', // position of the SPAN relative to the menu item content ('prepend', 'append') 35285 subIndicatorsText: '+', // [optionally] add text in the SPAN (e.g. '+') (you may want to check the CSS for the sub indicators too) 35286 scrollStep: 30, // pixels step when scrolling long sub menus that do not fit in the viewport height 35287 scrollAccelerate: true, // accelerate scrolling or use a fixed step 35288 showTimeout: 250, // timeout before showing the sub menus 35289 hideTimeout: 500, // timeout before hiding the sub menus 35290 showDuration: 0, // duration for show animation - set to 0 for no animation - matters only if showFunction:null 35291 showFunction: null, // custom function to use when showing a sub menu (the default is the jQuery 'show') 35292 // don't forget to call complete() at the end of whatever you do 35293 // e.g.: function($ul, complete) { $ul.fadeIn(250, complete); } 35294 hideDuration: 0, // duration for hide animation - set to 0 for no animation - matters only if hideFunction:null 35295 hideFunction: function($ul, complete) { $ul.fadeOut(200, complete); }, // custom function to use when hiding a sub menu (the default is the jQuery 'hide') 35296 // don't forget to call complete() at the end of whatever you do 35297 // e.g.: function($ul, complete) { $ul.fadeOut(250, complete); } 35298 collapsibleShowDuration:0, // duration for show animation for collapsible sub menus - matters only if collapsibleShowFunction:null 35299 collapsibleShowFunction:function($ul, complete) { $ul.slideDown(200, complete); }, // custom function to use when showing a collapsible sub menu 35300 // (i.e. when mobile styles are used to make the sub menus collapsible) 35301 collapsibleHideDuration:0, // duration for hide animation for collapsible sub menus - matters only if c
35301ollapsibleHideFunction:null 35302 collapsibleHideFunction:function($ul, complete) { $ul.slideUp(200, complete); }, // custom function to use when hiding a collapsible sub menu 35303 // (i.e. when mobile styles are used to make the sub menus collapsible) 35304 showOnClick: false, // show the first-level sub menus onclick instead of onmouseover (i.e. mimic desktop app menus) (matters only for mouse input) 35305 hideOnClick: true, // hide the sub menus on click/tap anywhere on the page 35306 noMouseOver: false, // disable sub menus activation onmouseover (i.e. behave like in touch mode - use just mouse clicks) (matters only for mouse input) 35307 keepInViewport: true, // reposition the sub menus if needed to make sure they always appear inside the viewport 35308 keepHighlighted: true, // keep all ancestor items of the current sub menu highlighted (adds the 'highlighted' class to the A's) 35309 markCurrentItem: false, // automatically add the 'current' class to the A element of the item linking to the current URL 35310 markCurrentTree: true, // add the 'current' class also to the A elements of all ancestor items of the current item 35311 rightToLeftSubMenus: false, // right to left display of the sub menus (check the CSS for the sub indicators' position) 35312 bottomToTopSubMenus: false, // bottom to top display of the sub menus 35313 overlapControlsInIE: true // make sure sub menus appear on top of special OS controls in IE (i.e. SELECT, OBJECT, EMBED, etc.) 35314 }; 35315 35316 return $; 35317}));; 35318/*! 35319 * SmartMenus jQuery Plugin Bootstrap Addon - v0.3.1 - November 1, 2016 35320 * http://www.smartmenus.org/ 35321 * 35322 * Copyright Vasil Dinkov, Vadikom Web Ltd. 35323 * http://vadikom.com 35324 * 35325 * Licensed MIT 35326 */ 35327 35328(function(factory) { 35329 if (typeof define === 'function' && define.amd) { 35330 // AMD 35331 define(['jquery', 'jquery.smartmenus'], factory); 35332 } else if (typeof module === 'object' && typeof module.exports === 'object') { 35333 // CommonJS 35334 module.exports = factory(require('jquery')); 35335 } else { 35336 // Global jQuery 35337 factory(jQuery); 35338 } 35339} (function($) { 35340 35341 $.extend($.SmartMenus.Bootstrap = {}, { 35342 keydownFix: false, 35343 init: function() { 35344 // init all navbars that don't have the "data-sm-skip" attribute set 35345 var $navbars = $('ul.navbar-nav:not([data-sm-skip])'); 35346 $navbars.each(function() { 35347 var $this = $(this), 35348 obj = $this.data('smartmenus'); 35349 // if this navbar is not initialized 35350 if (!obj) { 35351 $this.smartmenus({ 35352 35353 // these are some good default options that should work for all 35354 // you can, of course, tweak these as you like 35355 subMenusSubOffsetX: 2, 35356 subMenusSubOffsetY: -6, 35357 subIndicators: false, 35358 collapsibleShowFunction: null, 35359 collapsibleHideFunction: null, 35360 rightToLeftSubMenus: $this.hasClass('navbar-right'), 35361 bottomToTopSubMenus: $this.closest('.navbar').hasClass('navbar-fixed-bottom') 35362 }) 35363 .bind({ 35364 // set/unset proper Bootstrap classes for some menu elements 35365 'show.smapi': function(e, menu) { 35366 var $menu = $(menu), 35367 $scrollArrows = $menu.dataSM('scroll-arrows'); 35368 if ($scrollArrows) { 35369 // they inherit border-color from body, so we can use its background-color too 35370 $scrollArrows.css('background-color', $(document.body).css('background-color')); 35371 } 35372 $menu.parent().addClass('open'); 35373 }, 35374 'hide.smapi': function(e, menu) { 35375 $(menu).parent().removeClass('open'); 35376 } 35377 }); 35378 35379 function onInit() { 35380 // set Bootstrap's "active" class to SmartMenus "current" items (should someone decide to enable markCurrentItem: true) 35381 $this.find('a.current').parent().addClass('active'); 35382 // remove any Bootstrap required attributes that might cause conflicting issues with the SmartMenus script 35383 $this.find('a.has-submenu').each(function() { 35384 var $this = $(this); 35385 if ($this.is('[data-toggle="dropdown"]')) { 35386 $this.dataSM('bs-data-toggle-dropdown', true).removeAttr('data-toggle'); 35387 } 35388 if ($this.is('[role="button"]')) { 35389 $this.dataSM('bs-role-button', true).removeAttr('role'); 35390 } 35391 });
35392 } 35393 35394 onInit(); 35395 35396 function onBeforeDestroy() { 35397 $this.find('a.current').parent().removeClass('active'); 35398 $this.find('a.has-submenu').each(function() { 35399 var $this = $(this); 35400 if ($this.dataSM('bs-data-toggle-dropdown')) { 35401 $this.attr('data-toggle', 'dropdown').removeDataSM('bs-data-toggle-dropdown'); 35402 } 35403 if ($this.dataSM('bs-role-button')) { 35404 $this.attr('role', 'button').removeDataSM('bs-role-button'); 35405 } 35406 }); 35407 } 35408 35409 obj = $this.data('smartmenus'); 35410 35411 // custom "isCollapsible" method for Bootstrap 35412 obj.isCollapsible = function() { 35413 return !/^(left|right)$/.test(this.$firstLink.parent().css('float')); 35414 }; 35415 35416 // custom "refresh" method for Bootstrap 35417 obj.refresh = function() { 35418 $.SmartMenus.prototype.refresh.call(this); 35419 onInit(); 35420 // update collapsible detection 35421 detectCollapsible(true); 35422 }; 35423 35424 // custom "destroy" method for Bootstrap 35425 obj.destroy = function(refresh) { 35426 onBeforeDestroy(); 35427 $.SmartMenus.prototype.destroy.call(this, refresh); 35428 }; 35429 35430 // keep Bootstrap's default behavior for parent items when the "data-sm-skip-collapsible-behavior" attribute is set to the ul.navbar-nav 35431 // i.e. use the whole item area just as a sub menu toggle and don't customize the carets 35432 if ($this.is('[data-sm-skip-collapsible-behavior]')) { 35433 $this.bind({ 35434 // click the parent item to toggle the sub menus (and reset deeper levels and other branches on click) 35435 'click.smapi': function(e, item) { 35436 if (obj.isCollapsible()) { 35437 var $item = $(item), 35438 $sub = $item.parent().dataSM('sub'); 35439 if ($sub && $sub.dataSM('shown-before') && $sub.is(':visible')) { 35440 obj.itemActivate($item); 35441 obj.menuHide($sub); 35442 return false; 35443 } 35444 } 35445 } 35446 }); 35447 } 35448 35449 // onresize detect when the navbar becomes collapsible and add it the "sm-collapsible" class 35450 var winW; 35451 function detectCollapsible(force) { 35452 var newW = obj.getViewportWidth(); 35453 if (newW != winW || force) { 35454 var $carets = $this.find('.caret'); 35455 if (obj.isCollapsible()) { 35456 $this.addClass('sm-collapsible'); 35457 // set "navbar-toggle" class to carets (so they look like a button) if the "data-sm-skip-collapsible-behavior" attribute is not set to the ul.navbar-nav 35458 if (!$this.is('[data-sm-skip-collapsible-behavior]')) { 35459 $carets.addClass('navbar-toggle sub-arrow'); 35460 } 35461 } else { 35462 $this.removeClass('sm-collapsible'); 35463 if (!$this.is('[data-sm-skip-collapsible-behavior]')) { 35464 $carets.removeClass('navbar-toggle sub-arrow'); 35465 } 35466 } 35467 winW = newW; 35468 } 35469 } 35470 detectCollapsible(); 35471 $(window).bind('resize.smartmenus' + obj.rootId, detectCollapsible); 35472 } 35473 }); 35474 // keydown fix for Bootstrap 3.3.5+ conflict 35475 if ($navbars.length && !$.SmartMenus.Bootstrap.keydownFix) { 35476 // unhook BS keydown handler for all dropdowns 35477 $(document).off('keydown.bs.dropdown.data-api', '.dropdown-menu'); 35478 // restore BS keydown handler for dropdowns that are not inside SmartMenus navbars 35479 if ($.fn.dropdown && $.fn.dropdown.Constructor) { 35480 $(document).on('keydown.bs.dropdown.data-api', '.dropdown-menu:not([id^="sm-"])', $.fn.dropdown.Constructor.prototype.keydown); 35481 } 35482 $.SmartMenus.Bootstrap.keydownFix = true; 35483 } 35484 } 35485 }); 35486 35487 // init ondomready 35488 $($.SmartMenus.Bootstrap.init); 35489 35490 return $; 35491}));; 35492/*! 35493 * Modernizr v2.6.2 35494 * www.modernizr.com 35495 * 35496 * Copyright (c) Faruk Ates, Paul Irish, Alex Sexton 35497 * Available under the BSD and MIT licenses: www.modernizr.com/license/ 35498 */ 35499 35500/* 35501 * Modernizr tests which native CSS3 and HTML5 features are available in 35502 * the current UA and makes the results available to you in two ways: 35503 * as properties on a global Modernizr object, and as classes on the 35504 * <html> element. This information allows you to progressively enhance 35505 * your pages with a granular level of control over the experience. 35506 * 35507 * Modernizr has an optional (not included) conditional resource loader 35508 * called Modernizr.load(), based on Yepnope.js (yepnopejs.com). 35509 * To get a build that includes Modernizr.load(), as well as choosing 35510 * which tests to include, go to www.modernizr.com/download/ 35511 * 35512 * Authors Faruk Ates, Paul Irish, Alex Sexton 35513 * Contributors Ryan Seddon, Ben Alman 35514 */ 35515 35516window.Modernizr = (function( window, document, undefined ) { 35517 35518 var version = '2.6.2', 35519 35520 Modernizr = {}, 35521 35522 /*>>cssclasses*/ 35523 // option for enabling the HTML classes to be added 35524 enableClasses = true, 35525 /*>>cssclasses*/ 35526 35527 docElement = document.documentElement, 35528 35529 /** 35530 * Create our "modernizr" element that we do most feature tests on. 35531 */ 35532 mod = 'modernizr', 35533 modElem = document.createElement(mod), 35534 mStyle = modElem.style, 35535 35536 /** 35537 * Create the input element for various Web Forms feature tests. 35538 */ 35539 inputElem /*>>inputelem*/ = document.createElement('input') /*>>inputelem*/ , 35540 35541 /*>>smile*/ 35542 smile = ':)', 35543 /*>>smile*/ 35544 35545 toString = {}.toString, 35546 35547 // TODO :: make the prefixes more granular 35548 /*>>prefixes*/ 35549 // List of property values to set for css tests. See ticket #21 35550 prefixes = ' -webkit- -moz- -o- -ms- '.split(' '), 35551 /*>>prefixes*/ 35552 35553 /*>>domprefixes*/ 35554 // Following spec is to expose vendor-specific style properties as: 35555 // elem.style.WebkitBorderRadius 35556 // and the following would be incorrect: 35557 // elem.style.webkitBorderRadius 35558 35559 // Webkit ghosts their properties in lowercase but Opera & Moz do not. 35560 // Microsoft uses a lowercase `ms` instead of the correct `Ms` in IE8+ 35561 // erik.eae.net/archives/2008/03/10/21.48.10/ 35562 35563 // More here: github.com/Modernizr/Modernizr/issues/issue/21 35564 omPrefixes = 'Webkit Moz O ms', 35565 35566 cssomPrefixes = omPrefixes.split(' '), 35567 35568 domPrefixes = omPrefixes.toLowerCase().split(' '), 35569 /*>>domprefixes*/ 35570 35571 /*>>ns*/ 35572 ns = {'svg': 'http://www.w3.org/2000/svg'}, 35573 /*>>ns*/ 35574 35575 tests = {}, 35576 inputs = {}, 35577 attrs = {}, 35578 35579 classes = [], 35580 35581 slice = classes.slice, 35582 35583 featureName, // used in testing loop 35584 35585 35586 /*>>
vendor: 21,772 bytes, lines 35586-36195
35586teststyles*/ 35587 // Inject element with style element and some CSS rules 35588 injectElementWithStyles = function( rule, callback, nodes, testnames ) { 35589 35590 var style, ret, node, docOverflow, 35591 div = document.createElement('div'), 35592 // After page load injecting a fake body doesn't work so check if body exists 35593 body = document.body, 35594 // IE6 and 7 won't return offsetWidth or offsetHeight unless it's in the body element, so we fake it. 35595 fakeBody = body || document.createElement('body'); 35596 35597 if ( parseInt(nodes, 10) ) { 35598 // In order not to give false positives we create a node for each test 35599 // This also allows the method to scale for unspecified uses 35600 while ( nodes-- ) { 35601 node = document.createElement('div'); 35602 node.id = testnames ? testnames[nodes] : mod + (nodes + 1); 35603 div.appendChild(node); 35604 } 35605 } 35606 35607 // <style> elements in IE6-9 are considered 'NoScope' elements and therefore will be removed 35608 // when injected with innerHTML. To get around this you need to prepend the 'NoScope' element 35609 // with a 'scoped' element, in our case the soft-hyphen entity as it won't mess with our measurements. 35610 // msdn.microsoft.com/en-us/library/ms533897%28VS.85%29.aspx 35611 // Documents served as xml will throw if using ­ so use xml friendly encoded version. See issue #277 35612 style = ['­','<style id="s', mod, '">', rule, '</style>'].join(''); 35613 div.id = mod; 35614 // IE6 will false positive on some tests due to the style element inside the test div somehow interfering offsetHeight, so insert it into body or fakebody. 35615 // Opera will act all quirky when injecting elements in documentElement when page is served as xml, needs fakebody too. #270 35616 (body ? div : fakeBody).innerHTML += style; 35617 fakeBody.appendChild(div); 35618 if ( !body ) { 35619 //avoid crashing IE8, if background image is used 35620 fakeBody.style.background = ''; 35621 //Safari 5.13/5.1.4 OSX stops loading if ::-webkit-scrollbar is used and scrollbars are visible 35622 fakeBody.style.overflow = 'hidden'; 35623 docOverflow = docElement.style.overflow; 35624 docElement.style.overflow = 'hidden'; 35625 docElement.appendChild(fakeBody); 35626 } 35627 35628 ret = callback(div, rule); 35629 // If this is done after page load we don't want to remove the body so check if body exists 35630 if ( !body ) { 35631 fakeBody.parentNode.removeChild(fakeBody); 35632 docElement.style.overflow = docOverflow; 35633 } else { 35634 div.parentNode.removeChild(div); 35635 } 35636 35637 return !!ret; 35638 35639 }, 35640 /*>>teststyles*/ 35641 35642 /*>>mq*/ 35643 // adapted from matchMedia polyfill 35644 // by Scott Jehl and Paul Irish 35645 // gist.github.com/786768 35646 testMediaQuery = function( mq ) { 35647 35648 var matchMedia = window.matchMedia || window.msMatchMedia; 35649 if ( matchMedia ) { 35650 return matchMedia(mq).matches; 35651 } 35652 35653 var bool; 35654 35655 injectElementWithStyles('@media ' + mq + ' { #' + mod + ' { position: absolute; } }', function( node ) { 35656 bool = (window.getComputedStyle ? 35657 getComputedStyle(node, null) : 35658 node.currentStyle)['position'] == 'absolute'; 35659 }); 35660 35661 return bool; 35662 35663 }, 35664 /*>>mq*/ 35665 35666 35667 /*>>hasevent*/ 35668 // 35669 // isEventSupported determines if a given element supports the given event 35670 // kangax.github.com/iseventsupported/ 35671 // 35672 // The following results are known incorrects: 35673 // Modernizr.hasEvent("webkitTransitionEnd", elem) // false negative 35674 // Modernizr.hasEvent("textInput") // in Webkit. github.com/Modernizr/Modernizr/issues/333 35675 // ... 35676 isEventSupported = (function() { 35677 35678 var TAGNAMES = { 35679 'select': 'input', 'change': 'input', 35680 'submit': 'form', 'reset': 'form', 35681 'error': 'img', 'load': 'img', 'abort': 'img' 35682 }; 35683 35684 function isEventSupported( eventName, element ) { 35685 35686 element = element || document.createElement(TAGNAMES[eventName] || 'div'); 35687 eventName = 'on' + eventName; 35688 35689 // When using `setAttribute`, IE skips "unload", WebKit skips "unload" and "resize", whereas `in` "catches" those 35690 var isSupported = eventName in element; 35691 35692 if ( !isSupported ) { 35693 // If it has no `setAttribute` (i.e. doesn't implement Node interface), try generic element 35694 if ( !element.setAttribute ) { 35695 element = document.createElement('div'); 35696 } 35697 if ( element.setAttribute && element.removeAttribute ) { 35698 element.setAttribute(eventName, ''); 35699 isSupported = is(element[eventName], 'function'); 35700 35701 // If property was created, "remove it" (by setting value to `undefined`) 35702 if ( !is(element[eventName], 'undefined') ) { 35703 element[eventName] = undefined; 35704 } 35705 element.removeAttribute(eventName); 35706 } 35707 } 35708 35709 element = null; 35710 return isSupported; 35711 } 35712 return isEventSupported; 35713 })(), 35714 /*>>hasevent*/ 35715 35716 // TODO :: Add flag for hasownprop ? didn't last time 35717 35718 // hasOwnProperty shim by kangax needed for Safari 2.0 support 35719 _hasOwnProperty = ({}).hasOwnProperty, hasOwnProp; 35720 35721 if ( !is(_hasOwnProperty, 'undefined') && !is(_hasOwnProperty.call, 'undefined') ) { 35722 hasOwnProp = function (object, property) { 35723 return _hasOwnProperty.call(object, property); 35724 }; 35725 } 35726 else { 35727 hasOwnProp = function (object, property) { /* yes, this can give false positives/negatives, but most of the time we don't care about those */ 35728 return ((property in object) && is(object.constructor.prototype[property], 'undefined')); 35729 }; 35730 } 35731 35732 // Adapted from ES5-shim https://github.com/kriskowal/es5-shim/blob/master/es5-shim.js 35733 // es5.github.com/#x15.3.4.5 35734 35735 if (!Function.prototype.bind) { 35736 Function.prototype.bind = function bind(that) { 35737 35738 var target = this; 35739 35740 if (typeof target != "function") { 35741 throw new TypeError(); 35742 } 35743 35744 var args = slice.call(arguments, 1), 35745 bound = function () { 35746 35747 if (this instanceof bound) { 35748 35749 var F = function(){}; 35750 F.prototype = target.prototype; 35751 var self = new F(); 35752 35753 var result = target.apply( 35754 self, 35755 args.concat(slice.call(arguments)) 35756 ); 35757 if (Object(result) === result) { 35758 return result; 35759 } 35760 return self; 35761 35762 } else { 35763 35764 return target.apply( 35765 that, 35766 args.concat(slice.call(arguments)) 35767 ); 35768 35769 } 35770 35771 }; 35772 35773 return bound; 35774 }; 35775 } 35776 35777 /** 35778 * setCss applies given styles to the Modernizr DOM node. 35779 */ 35780 function setCss( str ) { 35781 mStyle.cssText = str; 35782 } 35783 35784 /** 35785 * setCssAll extrapolates all vendor-specific css strings. 35786 */ 35787 function setCssAll( str1, str2 ) { 35788 return setCss(prefixes.join(str1 + ';') + ( str2 || '' )); 35789 } 35790 35791 /** 35792 * is returns a boolean for if typeof obj is exactly type. 35793 */ 35794 function is( obj, type ) { 35795 return typeof obj === type; 35796 } 35797 35798 /** 35799 * contains returns a boolean for if substr is found within str. 35800 */ 35801 function contains( str, substr ) { 35802 return !!~('' + str).indexOf(substr); 35803 } 35804 35805 /*>>testprop*/ 35806 35807 // testProps is a generic CSS / DOM property test. 35808 35809 // In testing support for a given CSS property, it's legit to test: 35810 // `elem.style[styleName] !== undefined` 35811 // If the property is supported it will return an empty string, 35812 // if unsupported it will return undefined. 35813 35814 // We'll take advantage of this quick test and skip setting a style 35815 // on our modernizr element, but instead just testing undefined vs 35816 // empty string. 35817 35818 // Because the testing of the CSS property names (with "-", as 35819 // opposed to the camelCase DOM properties) is non-portable and 35820 // non-standard but works in WebKit and IE (but not Gecko or Opera), 35821 // we explicitly reject properties with dashes so that authors 35822 // developing in WebKit or IE first don't end up with 35823 // browser-specific content by accident. 35824 35825 function testProps( props, prefixed ) { 35826 for ( var i in props ) { 35827 var prop = props[i]; 35828 if ( !contains(prop, "-") && mStyle[prop] !== undefined ) { 35829 return prefixed == 'pfx' ? prop : true; 35830 } 35831 } 35832 return false; 35833 } 35834 /*>>testprop*/ 35835 35836 // TODO :: add testDOMProps 35837 /** 35838 * testDOMProps is a generic DOM property test; if a browser supports 35839 * a certain property, it won't return undefined for it. 35840 */ 35841 function testDOMProps( props, obj, elem ) { 35842 for ( var i in props ) { 35843 var item = obj[props[i]]; 35844 if ( item !== undefined) { 35845 35846 // return the property name as a string 35847 if (elem === false) return props[i]; 35848 35849 // let's bind a function 35850 if (is(item, 'function')){ 35851 // default to autobind unless override 35852 return item.bind(elem || obj); 35853 } 35854 35855 // return the unbound function or obj or value 35856 return item; 35857 } 35858 } 35859 return false; 35860 } 35861 35862 /*>>testallprops*/ 35863 /** 35864 * testPropsAll tests a list of DOM properties we want to check against. 35865 * We specify literally ALL possible (known and/or likely) properties on 35866 * the element including the non-vendor prefixed one, for forward- 35867 * compatibility. 35868 */ 35869 function testPropsAll( prop, prefixed, elem ) { 35870 35871 var ucProp = prop.charAt(0).toUpperCase() + prop.slice(1), 35872 props = (prop + ' ' + cssomPrefixes.join(ucProp + ' ') + ucProp).split(' '); 35873 35874 // did they call .prefixed('boxSizing') or are we just testing a prop? 35875 if(is(prefixed, "string") || is(prefixed, "undefined")) { 35876 return testProps(props, prefixed); 35877 35878 // otherwise, they called .prefixed('requestAnimationFrame', window[, elem]) 35879 } else { 35880 props = (prop + ' ' + (domPrefixes).join(ucProp + ' ') + ucProp).split(' '); 35881 return testDOMProps(props, prefixed, elem); 35882 } 35883 } 35884 /*>>testallprops*/ 35885 35886 35887 /** 35888 * Tests 35889 * ----- 35890 */ 35891 35892 // The *new* flexbox 35893 // dev.w3.org/csswg/css3-flexbox 35894 35895 tests['flexbox'] = function() { 35896 return testPropsAll('flexWrap'); 35897 }; 35898 35899 // The *old* flexbox 35900 // www.w3.org/TR/2009/WD-css3-flexbox-20090723/ 35901 35902 tests['flexboxlegacy'] = function() { 35903 return testPropsAll('boxDirection'); 35904 }; 35905 35906 // On the S60 and BB Storm, getContext exists, but always returns undefined 35907 // so we actually have to call getContext() to verify 35908 // github.com/Modernizr/Modernizr/issues/issue/97/ 35909 35910 tests['canvas'] = function() { 35911 var elem = document.createElement('canvas'); 35912 return !!(elem.getContext && elem.getContext('2d')); 35913 }; 35914 35915 tests['canvastext'] = function() { 35916 return !!(Modernizr['canvas'] && is(document.createElement('canvas').getContext('2d').fillText, 'function')); 35917 }; 35918 35919 // webk.it/70117 is tracking a legit WebGL feature detect proposal 35920 35921 // We do a soft detect which may false positive in order to avoid 35922 // an expensive context creation: bugzil.la/732441 35923 35924 tests['webgl'] = function() { 35925 return !!window.WebGLRenderingContext; 35926 }; 35927 35928 /* 35929 * The Modernizr.touch test only indicates if the browser supports 35930 * touch events, which does not necessarily reflect a touchscreen 35931 * device, as evidenced by tablets running Windows 7 or, alas, 35932 * the Palm Pre / WebOS (touch) phones. 35933 * 35934 * Additionally, Chrome (desktop) used to lie about its support on this, 35935 * but that has since been rectified: crbug.com/36415 35936 * 35937 * We also test for Firefox 4 Multitouch Support. 35938 * 35939 * For more info, see: modernizr.github.com/Modernizr/touch.html 35940 */ 35941 35942 tests['touch'] = function() { 35943 var bool; 35944 35945 if(('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch) { 35946 bool = true; 35947 } else { 35948 injectElementWithStyles(['@media (',prefixes.join('touch-enabled),('),mod,')','{#modernizr{top:9px;position:absolute}}'].join(''), function( node ) { 35949 bool = node.offsetTop === 9; 35950 }); 35951 } 35952 35953 return bool; 35954 }; 35955 35956 35957 // geolocation is often considered a trivial feature detect... 35958 // Turns out, it's quite tricky to get right: 35959 // 35960 // Using !!navigator.geolocation does two things we don't want. It: 35961 // 1. Leaks memory in IE9: github.com/Modernizr/Modernizr/issues/513 35962 // 2. Disables page caching in WebKit: webk.it/43956 35963 // 35964 // Meanwhile, in Firefox < 8, an about:config setting could expose 35965 // a false positive that would throw an exception: bugzil.la/688158 35966 35967 tests['geolocation'] = function() { 35968 return 'geolocation' in navigator; 35969 }; 35970 35971 35972 tests['postmessage'] = function() { 35973 return !!window.postMessage; 35974 }; 35975 35976 35977 // Chrome incognito mode used to throw an exception when using openDatabase 35978 // It doesn't anymore. 35979 tests['websqldatabase'] = function() { 35980 return !!window.openDatabase; 35981 }; 35982 35983 // Vendors had inconsistent prefixing with the experimental Indexed DB: 35984 // - Webkit's implementation is accessible through webkitIndexedDB 35985 // - Firefox shipped moz_indexedDB before FF4b9, but since then has been mozIndexedDB 35986 // For speed, we don't test the legacy (and beta-only) indexedDB 35987 tests['indexedDB'] = function() { 35988 return !!testPropsAll("indexedDB", window); 35989 }; 35990 35991 // documentMode logic from YUI to filter out IE8 Compat Mode 35992 // which false positives. 35993 tests['hashchange'] = function() { 35994 return isEventSupported('hashchange', window) && (document.documentMode === undefined || document.documentMode > 7); 35995 }; 35996 35997 // Per 1.6: 35998 // This used to be Modernizr.historymanagement but the longer 35999 // name has been deprecated in favor of a shorter and property-matching one. 36000 // The old API is still available in 1.6, but as of 2.0 will throw a warning, 36001 // and in the first release thereafter disappear entirely. 36002 tests['history'] = function() { 36003 return !!(window.history && history.pushState); 36004 }; 36005 36006 tests['draganddrop'] = function() { 36007 var div = document.createElement('div'); 36008 return ('draggable' in div) || ('ondragstart' in div && 'ondrop' in div); 36009 }; 36010 36011 // FF3.6 was EOL'ed on 4/24/12, but the ESR version of FF10 36012 // will be supported until FF19 (2/12/13), at which time, ESR becomes FF17. 36013 // FF10 still uses prefixes, so check for it until then. 36014 // for more ESR info, see: mozilla.org/en-US/firefox/organizations/faq/ 36015 tests['websockets'] = function() { 36016 return 'WebSocket' in window || 'MozWebSocket' in window; 36017 }; 36018 36019 36020 // css-tricks.com/rgba-browser-support/ 36021 tests['rgba'] = function() { 36022 // Set an rgba() color and check the returned value 36023 36024 setCss('background-color:rgba(150,255,150,.5)'); 36025 36026 return contains(mStyle.backgroundColor, 'rgba'); 36027 }; 36028 36029 tests['hsla'] = function() { 36030 // Same as rgba(), in fact, browsers re-map hsla() to rgba() internally, 36031 // except IE9 who retains it as hsla 36032 36033 setCss('background-color:hsla(120,40%,100%,.5)'); 36034 36035 return contains(mStyle.backgroundColor, 'rgba') || contains(mStyle.backgroundColor, 'hsla'); 36036 }; 36037 36038 tests['multiplebgs'] = function() { 36039 // Setting multiple images AND a color on the background shorthand property 36040 // and then querying the style.background property value for the number of 36041 // occurrences of "url(" is a reliable method for detecting ACTUAL support for this! 36042 36043 setCss('background:url(https://),url(https://),red url(https://)'); 36044 36045 // If the UA supports multiple backgrounds, there should be three occurrences 36046 // of the string "url(" in the return value for elemStyle.background 36047 36048 return (/(url\s*\(.*?){3}/).test(mStyle.background); 36049 }; 36050 36051 36052 36053 // this will false positive in Opera Mini 36054 // github.com/Modernizr/Modernizr/issues/396 36055 36056 tests['backgroundsize'] = function() { 36057 return testPropsAll('backgroundSize'); 36058 }; 36059 36060 tests['borderimage'] = function() { 36061 return testPropsAll('borderImage'); 36062 }; 36063 36064 36065 // Super comprehensive table about all the unique implementations of 36066 // border-radius: muddledramblings.com/table-of-css3-border-radius-compliance 36067 36068 tests['borderradius'] = function() { 36069 return testPropsAll('borderRadius'); 36070 }; 36071 36072 // WebOS unfortunately false positives on this test. 36073 tests['boxshadow'] = function() { 36074 return testPropsAll('boxShadow'); 36075 }; 36076 36077 // FF3.0 will false positive on this test 36078 tests['textshadow'] = function() { 36079 return document.createElement('div').style.textShadow === ''; 36080 }; 36081 36082 36083 tests['opacity'] = function() { 36084 // Browsers that actually have CSS Opacity implemented have done so 36085 // according to spec, which means their return values are within the 36086 // range of [0.0,1.0] - including the leading zero. 36087 36088 setCssAll('opacity:.55'); 36089 36090 // The non-literal . in this regex is intentional: 36091 // German Chrome returns this value as 0,55 36092 // github.com/Modernizr/Modernizr/issues/#issue/59/comment/516632 36093 return (/^0.55$/).test(mStyle.opacity); 36094 }; 36095 36096 36097 // Note, Android < 4 will pass this test, but can only animate 36098 // a single property at a time 36099 // daneden.me/2011/12/putting-up-with-androids-bullshit/ 36100 tests['cssanimations'] = function() { 36101 return testPropsAll('animationName'); 36102 }; 36103 36104 36105 tests['csscolumns'] = function() { 36106 return testPropsAll('columnCount'); 36107 }; 36108 36109 36110 tests['cssgradients'] = function() { 36111 /** 36112 * For CSS Gradients syntax, please see: 36113 * webkit.org/blog/175/introducing-css-gradients/ 36114 * developer.mozilla.org/en/CSS/-moz-linear-gradient 36115 * developer.mozilla.org/en/CSS/-moz-radial-gradient 36116 * dev.w3.org/csswg/css3-images/#gradients- 36117 */ 36118 36119 var str1 = 'background-image:', 36120 str2 = 'gradient(linear,left top,right bottom,from(#9f9),to(white));', 36121 str3 = 'linear-gradient(left top,#9f9, white);'; 36122 36123 setCss( 36124 // legacy webkit syntax (FIXME: remove when syntax not in use anymore) 36125 (str1 + '-webkit- '.split(' ').join(str2 + str1) + 36126 // standard syntax // trailing 'background-image:' 36127 prefixes.join(str3 + str1)).slice(0, -str1.length) 36128 ); 36129 36130 return contains(mStyle.backgroundImage, 'gradient'); 36131 }; 36132 36133 36134 tests['cssreflections'] = function() { 36135 return testPropsAll('boxReflect'); 36136 }; 36137 36138 36139 tests['csstransforms'] = function() { 36140 return !!testPropsAll('transform'); 36141 }; 36142 36143 36144 tests['csstransforms3d'] = function() { 36145 36146 var ret = !!testPropsAll('perspective'); 36147 36148 // Webkit's 3D transforms are passed off to the browser's own graphics renderer. 36149 // It works fine in Safari on Leopard and Snow Leopard, but not in Chrome in 36150 // some conditions. As a result, Webkit typically recognizes the syntax but 36151 // will sometimes throw a false positive, thus we must do a more thorough check: 36152 if ( ret && 'webkitPerspective' in docElement.style ) { 36153 36154 // Webkit allows this media query to succeed only if the feature is enabled. 36155 // `@media (transform-3d),(-webkit-transform-3d){ ... }` 36156 injectElementWithStyles('@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}', function( node, rule ) { 36157 ret = node.offsetLeft === 9 && node.offsetHeight === 3; 36158 }); 36159 } 36160 return ret; 36161 }; 36162 36163 36164 tests['csstransitions'] = function() { 36165 return testPropsAll('transition'); 36166 }; 36167 36168 36169 /*>>fontface*/ 36170 // @font-face detection routine by Diego Perini 36171 // javascript.nwbox.com/CSSSupport/ 36172 36173 // false positives: 36174 // WebOS github.com/Modernizr/Modernizr/issues/342 36175 // WP7 github.com/Modernizr/Modernizr/issues/538 36176 tests['fontface'] = function() { 36177 var bool; 36178 36179 injectElementWithStyles('@font-face {font-family:"font";src:url("https://")}', function( node, rule ) { 36180 var style = document.getElementById('smodernizr'), 36181 sheet = style.sheet || style.styleSheet, 36182 cssText = sheet ? (sheet.cssRules && sheet.cssRules[0] ? sheet.cssRules[0].cssText : sheet.cssText || '') : ''; 36183 36184 bool = /src/i.test(cssText) && cssText.indexOf(rule.split(' ')[0]) === 0; 36185 }); 36186 36187 return bool; 36188 }; 36189 /*>>fontface*/ 36190 36191 // CSS generated content detection 36192 tests['generatedcontent'] = function() { 36193 var bool; 36194 36195 injectElementWithStyles(['#',mod,'{font:0/0 a}
36195#',mod,':after{content:"',smile,'";visibility:hidden;font:3px/1 a}'].join(''), function( node ) { 36196 bool = node.offsetHeight >= 3; 36197 }); 36198 36199 return bool; 36200 }; 36201 36202 36203 36204 // These tests evaluate support of the video/audio elements, as well as 36205 // testing what types of content they support. 36206 // 36207 // We're using the Boolean constructor here, so that we can extend the value 36208 // e.g. Modernizr.video // true 36209 // Modernizr.video.ogg // 'probably' 36210 // 36211 // Codec values from : github.com/NielsLeenheer/html5test/blob/9106a8/index.html#L845 36212 // thx to NielsLeenheer and zcorpan 36213 36214 // Note: in some older browsers, "no" was a return value instead of empty string. 36215 // It was live in FF3.5.0 and 3.5.1, but fixed in 3.5.2 36216 // It was also live in Safari 4.0.0 - 4.0.4, but fixed in 4.0.5 36217 36218 tests['video'] = function() { 36219 var elem = document.createElement('video'), 36220 bool = false; 36221 36222 // IE9 Running on Windows Server SKU can cause an exception to be thrown, bug #224 36223 try { 36224 if ( bool = !!elem.canPlayType ) { 36225 bool = new Boolean(bool); 36226 bool.ogg = elem.canPlayType('video/ogg; codecs="theora"') .replace(/^no$/,''); 36227
vendor: 14,694 bytes, lines 36228-36596
36228 // Without QuickTime, this value will be `undefined`. github.com/Modernizr/Modernizr/issues/546 36229 bool.h264 = elem.canPlayType('video/mp4; codecs="avc1.42E01E"') .replace(/^no$/,''); 36230 36231 bool.webm = elem.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,''); 36232 } 36233 36234 } catch(e) { } 36235 36236 return bool; 36237 }; 36238 36239 tests['audio'] = function() { 36240 var elem = document.createElement('audio'), 36241 bool = false; 36242 36243 try { 36244 if ( bool = !!elem.canPlayType ) { 36245 bool = new Boolean(bool); 36246 bool.ogg = elem.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,''); 36247 bool.mp3 = elem.canPlayType('audio/mpeg;') .replace(/^no$/,''); 36248 36249 // Mimetypes accepted: 36250 // developer.mozilla.org/En/Media_formats_supported_by_the_audio_and_video_elements 36251 // bit.ly/iphoneoscodecs 36252 bool.wav = elem.canPlayType('audio/wav; codecs="1"') .replace(/^no$/,''); 36253 bool.m4a = ( elem.canPlayType('audio/x-m4a;') || 36254 elem.canPlayType('audio/aac;')) .replace(/^no$/,''); 36255 } 36256 } catch(e) { } 36257 36258 return bool; 36259 }; 36260 36261 36262 // In FF4, if disabled, window.localStorage should === null. 36263 36264 // Normally, we could not test that directly and need to do a 36265 // `('localStorage' in window) && ` test first because otherwise Firefox will 36266 // throw bugzil.la/365772 if cookies are disabled 36267 36268 // Also in iOS5 Private Browsing mode, attempting to use localStorage.setItem 36269 // will throw the exception: 36270 // QUOTA_EXCEEDED_ERRROR DOM Exception 22. 36271 // Peculiarly, getItem and removeItem calls do not throw. 36272 36273 // Because we are forced to try/catch this, we'll go aggressive. 36274 36275 // Just FWIW: IE8 Compat mode supports these features completely: 36276 // www.quirksmode.org/dom/html5.html 36277 // But IE8 doesn't support either with local files 36278 36279 tests['localstorage'] = function() { 36280 try { 36281 localStorage.setItem(mod, mod); 36282 localStorage.removeItem(mod); 36283 return true; 36284 } catch(e) { 36285 return false; 36286 } 36287 }; 36288 36289 tests['sessionstorage'] = function() { 36290 try { 36291 sessionStorage.setItem(mod, mod); 36292 sessionStorage.removeItem(mod); 36293 return true; 36294 } catch(e) { 36295 return false; 36296 } 36297 }; 36298 36299 36300 tests['webworkers'] = function() { 36301 return !!window.Worker; 36302 }; 36303 36304 36305 tests['applicationcache'] = function() { 36306 return !!window.applicationCache; 36307 }; 36308 36309 36310 // Thanks to Erik Dahlstrom 36311 tests['svg'] = function() { 36312 return !!document.createElementNS && !!document.createElementNS(ns.svg, 'svg').createSVGRect; 36313 }; 36314 36315 // specifically for SVG inline in HTML, not within XHTML 36316 // test page: paulirish.com/demo/inline-svg 36317 tests['inlinesvg'] = function() { 36318 var div = document.createElement('div'); 36319 div.innerHTML = '<svg/>'; 36320 return (div.firstChild && div.firstChild.namespaceURI) == ns.svg; 36321 }; 36322 36323 // SVG SMIL animation 36324 tests['smil'] = function() { 36325 return !!document.createElementNS && /SVGAnimate/.test(toString.call(document.createElementNS(ns.svg, 'animate'))); 36326 }; 36327 36328 // This test is only for clip paths in SVG proper, not clip paths on HTML content 36329 // demo: srufaculty.sru.edu/david.dailey/svg/newstuff/clipPath4.svg 36330 36331 // However read the comments to dig into applying SVG clippaths to HTML content here: 36332 // github.com/Modernizr/Modernizr/issues/213#issuecomment-1149491 36333 tests['svgclippaths'] = function() { 36334 return !!document.createElementNS && /SVGClipPath/.test(toString.call(document.createElementNS(ns.svg, 'clipPath'))); 36335 }; 36336 36337 /*>>webforms*/ 36338 // input features and input types go directly onto the ret object, bypassing the tests loop. 36339 // Hold this guy to execute in a moment. 36340 function webforms() { 36341 /*>>input*/ 36342 // Run through HTML5's new input attributes to see if the UA understands any. 36343 // We're using f which is the <input> element created early on 36344 // Mike Taylr has created a comprehensive resource for testing these attributes 36345 // when applied to all input types: 36346 // miketaylr.com/code/input-type-attr.html 36347 // spec: www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary 36348 36349 // Only input placeholder is tested while textarea's placeholder is not. 36350 // Currently Safari 4 and Opera 11 have support only for the input placeholder 36351 // Both tests are available in feature-detects/forms-placeholder.js 36352 Modernizr['input'] = (function( props ) { 36353 for ( var i = 0, len = props.length; i < len; i++ ) { 36354 attrs[ props[i] ] = !!(props[i] in inputElem); 36355 } 36356 if (attrs.list){ 36357 // safari false positive's on datalist: webk.it/74252 36358 // see also github.com/Modernizr/Modernizr/issues/146 36359 attrs.list = !!(document.createElement('datalist') && window.HTMLDataListElement); 36360 } 36361 return attrs; 36362 })('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' ')); 36363 /*>>input*/ 36364 36365 /*>>inputtypes*/ 36366 // Run through HTML5's new input types to see if the UA understands any. 36367 // This is put behind the tests runloop because it doesn't return a 36368 // true/false like all the other tests; instead, it returns an object 36369 // containing each input type with its corresponding true/false value 36370 36371 // Big thanks to @miketaylr for the html5 forms expertise. miketaylr.com/ 36372 Modernizr['inputtypes'] = (function(props) { 36373 36374 for ( var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++ ) { 36375 36376 inputElem.setAttribute('type', inputElemType = props[i]); 36377 bool = inputElem.type !== 'text'; 36378 36379 // We first check to see if the type we give it sticks.. 36380 // If the type does, we feed it a textual value, which shouldn't be valid. 36381 // If the value doesn't stick, we know there's input sanitization which infers a custom UI 36382 if ( bool ) { 36383 36384 inputElem.value = smile; 36385 inputElem.style.cssText = 'position:absolute;visibility:hidden;'; 36386 36387 if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) { 36388 36389 docElement.appendChild(inputElem); 36390 defaultView = document.defaultView; 36391 36392 // Safari 2-4 allows the smiley as a value, despite making a slider 36393 bool = defaultView.getComputedStyle && 36394 defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' && 36395 // Mobile android web browser has false positive, so must 36396 // check the height to see if the widget is actually there. 36397 (inputElem.offsetHeight !== 0); 36398 36399 docElement.removeChild(inputElem); 36400 36401 } else if ( /^(search|tel)$/.test(inputElemType) ){ 36402 // Spec doesn't define any special parsing or detectable UI 36403 // behaviors so we pass these through as true 36404 36405 // Interestingly, opera fails the earlier test, so it doesn't 36406 // even make it here. 36407 36408 } else if ( /^(url|email)$/.test(inputElemType) ) { 36409 // Real url and email support comes with prebaked validation. 36410 bool = inputElem.checkValidity && inputElem.checkValidity() === false; 36411 36412 } else { 36413 // If the upgraded input compontent rejects the :) text, we got a winner 36414 bool = inputElem.value != smile; 36415 } 36416 } 36417 36418 inputs[ props[i] ] = !!bool; 36419 } 36420 return inputs; 36421 })('search tel url email datetime date month week time datetime-local number range color'.split(' ')); 36422 /*>>inputtypes*/ 36423 } 36424 /*>>webforms*/ 36425 36426 36427 // End of test definitions 36428 // ----------------------- 36429 36430 36431 36432 // Run through all tests and detect their support in the current UA. 36433 // todo: hypothetically we could be doing an array of tests and use a basic loop here. 36434 for ( var feature in tests ) { 36435 if ( hasOwnProp(tests, feature) ) { 36436 // run the test, throw the return value into the Modernizr, 36437 // then based on that boolean, define an appropriate className 36438 // and push it into an array of classes we'll join later. 36439 featureName = feature.toLowerCase(); 36440 Modernizr[featureName] = tests[feature](); 36441 36442 classes.push((Modernizr[featureName] ? '' : 'no-') + featureName); 36443 } 36444 } 36445 36446 /*>>webforms*/ 36447 // input tests need to run. 36448 Modernizr.input || webforms(); 36449 /*>>webforms*/ 36450 36451 36452 /** 36453 * addTest allows the user to define their own feature tests 36454 * the result will be added onto the Modernizr object, 36455 * as well as an appropriate className set on the html element 36456 * 36457 * @param feature - String naming the feature 36458 * @param test - Function returning true if feature is supported, false if not 36459 */ 36460 Modernizr.addTest = function ( feature, test ) { 36461 if ( typeof feature == 'object' ) { 36462 for ( var key in feature ) { 36463 if ( hasOwnProp( feature, key ) ) { 36464 Modernizr.addTest( key, feature[ key ] ); 36465 } 36466 } 36467 } else { 36468 36469 feature = feature.toLowerCase(); 36470 36471 if ( Modernizr[feature] !== undefined ) { 36472 // we're going to quit if you're trying to overwrite an existing test 36473 // if we were to allow it, we'd do this: 36474 // var re = new RegExp("\\b(no-)?" + feature + "\\b"); 36475 // docElement.className = docElement.className.replace( re, '' ); 36476 // but, no rly, stuff 'em. 36477 return Modernizr; 36478 } 36479 36480 test = typeof test == 'function' ? test() : test; 36481 36482 if (typeof enableClasses !== "undefined" && enableClasses) { 36483 docElement.className += ' ' + (test ? '' : 'no-') + feature; 36484 } 36485 Modernizr[feature] = test; 36486 36487 } 36488 36489 return Modernizr; // allow chaining. 36490 }; 36491 36492 36493 // Reset modElem.cssText to nothing to reduce memory footprint. 36494 setCss(''); 36495 modElem = inputElem = null; 36496 36497 /*>>shiv*/ 36498 /*! HTML5 Shiv v3.6.1 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed */ 36499 ;(function(window, document) { 36500 /*jshint evil:true */ 36501 /** Preset options */ 36502 var options = window.html5 || {}; 36503 36504 /** Used to skip problem elements */ 36505 var reSkip = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i; 36506 36507 /** Not all elements can be cloned in IE **/ 36508 var saveClones = /^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i; 36509 36510 /** Detect whether the browser supports default html5 styles */ 36511 var supportsHtml5Styles; 36512 36513 /** Name of the expando, to work with multiple documents or to re-shiv one document */ 36514 var expando = '_html5shiv'; 36515 36516 /** The id for the the documents expando */ 36517 var expanID = 0; 36518 36519 /** Cached data for each document */ 36520 var expandoData = {}; 36521 36522 /** Detect whether the browser supports unknown elements */ 36523 var supportsUnknownElements; 36524 36525 (function() { 36526 try { 36527 var a = document.createElement('a'); 36528 a.innerHTML = '<xyz></xyz>'; 36529 //if the hidden property is implemented we can assume, that the browser supports basic HTML5 Styles 36530 supportsHtml5Styles = ('hidden' in a); 36531 36532 supportsUnknownElements = a.childNodes.length == 1 || (function() { 36533 // assign a false positive if unable to shiv 36534 (document.createElement)('a'); 36535 var frag = document.createDocumentFragment(); 36536 return ( 36537 typeof frag.cloneNode == 'undefined' || 36538 typeof frag.createDocumentFragment == 'undefined' || 36539 typeof frag.createElement == 'undefined' 36540 ); 36541 }()); 36542 } catch(e) { 36543 supportsHtml5Styles = true; 36544 supportsUnknownElements = true; 36545 } 36546 36547 }()); 36548 36549 /*--------------------------------------------------------------------------*/ 36550 36551 /** 36552 * Creates a style sheet with the given CSS text and adds it to the document. 36553 * @private 36554 * @param {Document} ownerDocument The document. 36555 * @param {String} cssText The CSS text. 36556 * @returns {StyleSheet} The style element. 36557 */ 36558 function addStyleSheet(ownerDocument, cssText) { 36559 var p = ownerDocument.createElement('p'), 36560 parent = ownerDocument.getElementsByTagName('head')[0] || ownerDocument.documentElement; 36561 36562 p.innerHTML = 'x<style>' + cssText + '</style>'; 36563 return parent.insertBefore(p.lastChild, parent.firstChild); 36564 } 36565 36566 /** 36567 * Returns the value of `html5.elements` as an array. 36568 * @private 36569 * @returns {Array} An array of shived element node names. 36570 */ 36571 function getElements() { 36572 var elements = html5.elements; 36573 return typeof elements == 'string' ? elements.split(' ') : elements; 36574 } 36575 36576 /** 36577 * Returns the data associated to the given document 36578 * @private 36579 * @param {Document} ownerDocument The document. 36580 * @returns {Object} An object of data. 36581 */ 36582 function getExpandoData(ownerDocument) { 36583 var data = expandoData[ownerDocument[expando]]; 36584 if (!data) { 36585 data = {}; 36586 expanID++; 36587 ownerDocument[expando] = expanID; 36588 expandoData[expanID] = data; 36589 } 36590 return data; 36591 } 36592 36593 /** 36594 * returns a shived element for the given nodeName and document 36595 * @memberOf html5 36596 * @param {String}
vendor: 4,248 bytes, lines 36596-36707
36596 nodeName name of the element 36597 * @param {Document} ownerDocument The context document. 36598 * @returns {Object} The shived element. 36599 */ 36600 function createElement(nodeName, ownerDocument, data){ 36601 if (!ownerDocument) { 36602 ownerDocument = document; 36603 } 36604 if(supportsUnknownElements){ 36605 return ownerDocument.createElement(nodeName); 36606 } 36607 if (!data) { 36608 data = getExpandoData(ownerDocument); 36609 } 36610 var node; 36611 36612 if (data.cache[nodeName]) { 36613 node = data.cache[nodeName].cloneNode(); 36614 } else if (saveClones.test(nodeName)) { 36615 node = (data.cache[nodeName] = data.createElem(nodeName)).cloneNode(); 36616 } else { 36617 node = data.createElem(nodeName); 36618 } 36619 36620 // Avoid adding some elements to fragments in IE < 9 because 36621 // * Attributes like `name` or `type` cannot be set/changed once an element 36622 // is inserted into a document/fragment 36623 // * Link elements with `src` attributes that are inaccessible, as with 36624 // a 403 response, will cause the tab/window to crash 36625 // * Script elements appended to fragments will execute when their `src` 36626 // or `text` property is set 36627 return node.canHaveChildren && !reSkip.test(nodeName) ? data.frag.appendChild(node) : node; 36628 } 36629 36630 /** 36631 * returns a shived DocumentFragment for the given document 36632 * @memberOf html5 36633 * @param {Document} ownerDocument The context document. 36634 * @returns {Object} The shived DocumentFragment. 36635 */ 36636 function createDocumentFragment(ownerDocument, data){ 36637 if (!ownerDocument) { 36638 ownerDocument = document; 36639 } 36640 if(supportsUnknownElements){ 36641 return ownerDocument.createDocumentFragment(); 36642 } 36643 data = data || getExpandoData(ownerDocument); 36644 var clone = data.frag.cloneNode(), 36645 i = 0, 36646 elems = getElements(), 36647 l = elems.length; 36648 for(;i<l;i++){ 36649 clone.createElement(elems[i]); 36650 } 36651 return clone; 36652 } 36653 36654 /** 36655 * Shivs the `createElement` and `createDocumentFragment` methods of the document. 36656 * @private 36657 * @param {Document|DocumentFragment} ownerDocument The document. 36658 * @param {Object} data of the document. 36659 */ 36660 function shivMethods(ownerDocument, data) { 36661 if (!data.cache) { 36662 data.cache = {}; 36663 data.createElem = ownerDocument.createElement; 36664 data.createFrag = ownerDocument.createDocumentFragment; 36665 data.frag = data.createFrag(); 36666 } 36667 36668 36669 ownerDocument.createElement = function(nodeName) { 36670 //abort shiv 36671 if (!html5.shivMethods) { 36672 return data.createElem(nodeName); 36673 } 36674 return createElement(nodeName, ownerDocument, data); 36675 }; 36676 36677 ownerDocument.createDocumentFragment = Function('h,f', 'return function(){' + 36678 'var n=f.cloneNode(),c=n.createElement;' + 36679 'h.shivMethods&&(' + 36680 // unroll the `createElement` calls 36681 getElements().join().replace(/\w+/g, function(nodeName) { 36682 data.createElem(nodeName); 36683 data.frag.createElement(nodeName); 36684 return 'c("' + nodeName + '")'; 36685 }) + 36686 ');return n}' 36687 )(html5, data.frag); 36688 } 36689 36690 /*--------------------------------------------------------------------------*/ 36691 36692 /** 36693 * Shivs the given document. 36694 * @memberOf html5 36695 * @param {Document} ownerDocument The document to shiv. 36696 * @returns {Document} The shived document. 36697 */ 36698 function shivDocument(ownerDocument) { 36699 if (!ownerDocument) { 36700 ownerDocument = document; 36701 } 36702 var data = getExpandoData(ownerDocument); 36703 36704 if (html5.shivCSS && !supportsHtml5Styles && !data.hasCSS) { 36705 data.hasCSS = !!addStyleSheet(ownerDocument, 36706 // corrects block display not defined in IE6/7/8/9 36707 'article,aside,figcaption,figure,footer,header,hgroup,nav,section{dis
36707play:block}' + 36708 // adds styling not present in IE6/7/8/9 36709 'mark{background:#FF0;color:#000}' 36710 ); 36711 } 36712 if (!supportsUnknownElements) { 36713 shivMethods(ownerDocument, data); 36714 } 36715 return ownerDocument; 36716 } 36717 36718 /*--------------------------------------------------------------------------*/ 36719 36720 /** 36721 * The `html5` object is exposed so that more elements can be shived and 36722 * existing shiving can be detected on iframes. 36723 * @type Object 36724 * @example 36725 * 36726 * // options can be changed before the script is included 36727 * html5 = { 'elements': 'mark section', 'shivCSS': false, 'shivMethods': false }; 36728 */ 36729 var html5 = { 36730 36731 /** 36732 * An array or space separated string of node names of the elements to shiv. 36733 * @memberOf html5 36734 * @type Array|String 36735 */ 36736 'elements': options.elements || 'abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video', 36737 36738 /** 36739 * A flag to indicate that the HTML5 style sheet should be inserted. 36740 * @memberOf html5 36741 * @type Boolean 36742 */ 36743 'shivCSS': (options.shivCSS !== false), 36744 36745 /** 36746 * Is equal to true if a browser supports creating unknown/HTML5 elements 36747 * @memberOf html5 36748 * @type boolean 36749 */ 36750 'supportsUnknownElements': supportsUnknownElements, 36751 36752 /** 36753 * A flag to indicate that the document's `createElement` and `createDocumentFragment` 36754 * methods should be overwritten. 36755 * @memberOf html5 36756 * @type Boolean 36757 */ 36758 'shivMethods': (options.shivMethods !== false), 36759 36760 /** 36761 * A string to describe the type of `html5` object ("default" or "default print"). 36762 * @memberOf html5
36763 * @type String 36764 */ 36765 'type': 'default', 36766 36767 // shivs the document according to the specified `html5` object options 36768 'shivDocument': shivDocument, 36769 36770 //creates a shived element 36771 createElement: createElement, 36772 36773 //creates a shived documentFragment 36774 createDocumentFragment: createDocumentFragment 36775 }; 36776 36777 /*--------------------------------------------------------------------------*/ 36778 36779 // expose html5 36780 window.html5 = html5; 36781 36782 // shiv the document 36783 shivDocument(document); 36784 36785 }(this, document)); 36786 /*>>shiv*/ 36787 36788 // Assign private properties to the return object with prefix 36789 Modernizr._version = version; 36790 36791 // expose these for the plugin API. Look in the source for how to join() them against your input 36792 /*>>prefixes*/ 36793 Modernizr._prefixes = prefixes; 36794 /*>>prefixes*/ 36795 /*>>domprefixes*/ 36796 Modernizr._domPrefixes = domPrefixes; 36797 Modernizr._cssomPrefixes = cssomPrefixes; 36798 /*>>domprefixes*/ 36799 36800 /*>>mq*/ 36801 // Modernizr.mq tests a given media query, live against the current state of the window 36802 // A few important notes: 36803 // * If a browser does not support media queries at all (eg. oldIE) the mq() will always return false 36804 // * A max-width or orientation query will be evaluated against the current state, which may change later. 36805 // * You must specify values. Eg. If you are testing support for the min-width media query use: 36806 // Modernizr.mq('(min-width:0)') 36807 // usage: 36808 // Modernizr.mq('only screen and (max-width:768)') 36809 Modernizr.mq = testMediaQuery; 36810 /*>>mq*/ 36811 36812 /*>>hasevent*/ 36813 // Modernizr.hasEvent() detects support for a given event, with an optional element to test on 36814 // Modernizr.hasEvent('gesturestart', elem) 36815 Modernizr.hasEvent = isEventSupported; 36816 /*>>hasevent*/ 36817 36818 /*>>testprop*/ 36819 // Modernizr.testProp() investigates whether a given style property is recognized 36820 // Note that the property names must be provided in the camelCase variant. 36821 // Modernizr.testProp('pointerEvents') 36822 Modernizr.testProp = function(prop){ 36823 return testProps([prop]); 36824 }; 36825 /*>>testprop*/ 36826 36827 /*>>testallprops*/ 36828 // Modernizr.testAllProps() investigates whether a given style property, 36829 // or any of its vendor-prefixed variants, is recognized 36830 // Note that the property names must be provided in the camelCase variant. 36831 // Modernizr.testAllProps('boxSizing') 36832 Modernizr.testAllProps = testPropsAll; 36833 /*>>testallprops*/ 36834 36835 36836 /*>>teststyles*/ 36837 // Modernizr.testStyles() allows you to add custom styles to the document and test an element afterwards 36838 // Modernizr.testStyles('#modernizr { position:absolute }', function(elem, rule){ ... }) 36839 Modernizr.testStyles = injectElementWithStyles; 36840 /*>>teststyles*/ 36841 36842 36843 /*>>prefixed*/ 36844 // Modernizr.prefixed() returns the prefixed or nonprefixed property name variant of your input 36845 // Modernizr.prefixed('boxSizing') // 'MozBoxSizing' 36846 36847 // Properties must be passed as dom-style camelcase, rather than `box-sizing` hypentated style. 36848 // Return values will also be the camelCase variant, if you need to translate that to hypenated style use: 36849 // 36850 // str.replace(/([A-Z])/g, function(str,m1){ return '-' + m1.toLowerCase(); }).replace(/^ms-/,'-ms-'); 36851 36852 // If you're trying to ascertain which transition end event to bind to, you might do something like... 36853 // 36854 // var transEndEventNames = { 36855 // 'WebkitTransition' : 'webkitTransitionEnd', 36856 // 'MozTransition' : 'transitionend', 36857 // 'OTransition' : 'oTransitionEnd', 36858 // 'msTransition' : 'MSTransitionEnd', 36859 // 'transition' : 'transitionend' 36860 // }, 36861 // transEndEventName = transEndEventNames[ Modernizr.prefixed('transition') ]; 36862 36863 Modernizr.prefixed = function(prop, obj, elem){ 36864 if(!obj) { 36865 return testPropsAll(prop, 'pfx'); 36866 } else { 36867 // Testing DOM property e.g. Modernizr.prefixed('requestAnimationFrame', window) // 'mozRequestAnimationFrame' 36868 return testPropsAll(prop, obj, elem); 36869 } 36870 }; 36871 /*>>prefixed*/ 36872 36873 36874 /*>>cssclasses*/ 36875 // Remove "no-js" class from <html> element, if it exists: 36876 docElement.className = docElement.className.replace(/(^|\s)no-js(\s|$)/, '$1$2') + 36877 36878 // Add the new classes to the <html> element. 36879 (enableClasses ? ' js ' + classes.join(' ') : ''); 36880 /*>>cssclasses*/ 36881 36882 return Modernizr; 36883 36884})(this, this.document); 36885; 36886/*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */ 36887/*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */ 36888window.matchMedia = window.matchMedia || (function(doc, undefined){ 36889 36890 var bool, 36891 docElem = doc.documentElement, 36892 refNode = docElem.firstElementChild || docElem.firstChild, 36893 // fakeBody required for <FF4 when executed in <head> 36894 fakeBody = doc.createElement('body'), 36895 div = doc.createElement('div'); 36896 36897 div.id = 'mq-test-1'; 36898 div.style.cssText = "position:absolute;top:-100em"; 36899 fakeBody.style.background = "none"; 36900 fakeBody.appendChild(div); 36901 36902 return function(q){ 36903 36904 div.innerHTML = '­<style media="'+q+'"> #mq-test-1 { width: 42px; }</style>'; 36905
vendor: 4,406 bytes, lines 36906-37047
36906 docElem.insertBefore(fakeBody, refNode); 36907 bool = div.offsetWidth == 42; 36908 docElem.removeChild(fakeBody); 36909 36910 return { matches: bool, media: q }; 36911 }; 36912 36913})(document); 36914 36915 36916 36917 36918/*! Respond.js v1.2.0: min/max-width media query polyfill. (c) Scott Jehl. MIT/GPLv2 Lic. j.mp/respondjs */ 36919(function( win ){ 36920 //exposed namespace 36921 win.respond = {}; 36922 36923 //define update even in native-mq-supporting browsers, to avoid errors 36924 respond.update = function(){}; 36925 36926 //expose media query support flag for external use 36927 respond.mediaQueriesSupported = win.matchMedia && win.matchMedia( "only all" ).matches; 36928 36929 //if media queries are supported, exit here 36930 if( respond.mediaQueriesSupported ){ return; } 36931 36932 //define vars 36933 var doc = win.document, 36934 docElem = doc.documentElement, 36935 mediastyles = [], 36936 rules = [], 36937 appendedEls = [], 36938 parsedSheets = {}, 36939 resizeThrottle = 30, 36940 head = doc.getElementsByTagName( "head" )[0] || docElem, 36941 base = doc.getElementsByTagName( "base" )[0], 36942 links = head.getElementsByTagName( "link" ), 36943 requestQueue = [], 36944 36945 //loop stylesheets, send text content to translate 36946 ripCSS = function(){ 36947 var sheets = links, 36948 sl = sheets.length, 36949 i = 0, 36950 //vars for loop: 36951 sheet, href, media, isCSS; 36952 36953 for( ; i < sl; i++ ){ 36954 sheet = sheets[ i ], 36955 href = sheet.href, 36956 media = sheet.media, 36957 isCSS = sheet.rel && sheet.rel.toLowerCase() === "stylesheet"; 36958 36959 //only links plz and prevent re-parsing 36960 if( !!href && isCSS && !parsedSheets[ href ] ){ 36961 // selectivizr exposes css through the rawCssText expando 36962 if (sheet.styleSheet && sheet.styleSheet.rawCssText) { 36963 translate( sheet.styleSheet.rawCssText, href, media ); 36964 parsedSheets[ href ] = true; 36965 } else { 36966 if( (!/^([a-zA-Z:]*\/\/)/.test( href ) && !base) 36967 || href.replace( RegExp.$1, "" ).split( "/" )[0] === win.location.host ){ 36968 requestQueue.push( { 36969 href: href, 36970 media: media 36971 } ); 36972 } 36973 } 36974 } 36975 } 36976 makeRequests(); 36977 }, 36978 36979 //recurse through request queue, get css text 36980 makeRequests = function(){ 36981 if( requestQueue.length ){ 36982 var thisRequest = requestQueue.shift(); 36983 36984 ajax( thisRequest.href, function( styles ){ 36985 translate( styles, thisRequest.href, thisRequest.media ); 36986 parsedSheets[ thisRequest.href ] = true; 36987 makeRequests(); 36988 } ); 36989 } 36990 }, 36991 36992 //find media blocks in css text, convert to style blocks 36993 translate = function( styles, href, media ){ 36994 var qs = styles.match( /@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi ), 36995 ql = qs && qs.length || 0, 36996 //try to get CSS path 36997 href = href.substring( 0, href.lastIndexOf( "/" )), 36998 repUrls = function( css ){ 36999 return css.replace( /(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g, "$1" + href + "$2$3" ); 37000 }, 37001 useMedia = !ql && media, 37002 //vars used in loop 37003 i = 0, 37004 j, fullq, thisq, eachq, eql; 37005 37006 //if path exists, tack on trailing slash 37007 if( href.length ){ href += "/"; } 37008 37009 //if no internal queries exist, but media attr does, use that 37010 //note: this currently lacks support for situations where a media attr is specified on a link AND 37011 //its associated stylesheet has internal CSS media queries. 37012 //In those cases, the media attribute will currently be ignored. 37013 if( useMedia ){ 37014 ql = 1; 37015 } 37016 37017 37018 for( ; i < ql; i++ ){ 37019 j = 0; 37020 37021 //media attr 37022 if( useMedia ){ 37023 fullq = media; 37024 rules.push( repUrls( styles ) ); 37025 } 37026 //parse for styles 37027 else{ 37028 fullq = qs[ i ].match( /@media *([^\{]+)\{([\S\s]+?)$/ ) && RegExp.$1; 37029 rules.push( RegExp.$2 && repUrls( RegExp.$2 ) ); 37030 } 37031 37032 eachq = fullq.split( "," ); 37033 eql = eachq.length; 37034 37035 for( ; j < eql; j++ ){ 37036 thisq = eachq[ j ]; 37037 mediastyles.push( { 37038 media : thisq.split( "(" )[ 0 ].match( /(only\s+)?([a-zA-Z]+)\s?/ ) && RegExp.$2 || "all", 37039 rules : rules.length - 1, 37040 hasquery: thisq.indexOf("(") > -1, 37041 minw : thisq.match( /\(min\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/ ) && parseFloat( RegExp.$1 ) + ( RegExp.$2 || "" ), 37042 maxw : thisq.match( /\(max\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/ ) && parseFloat( RegExp.$1 ) + ( RegExp.$2 || "" ) 37043 } ); 37044 } 37045 } 37046 37047 applyMedia();
37048 }, 37049 37050 lastCall, 37051 37052 resizeDefer, 37053 37054 // returns the value of 1em in pixels 37055 getEmValue = function() { 37056 var ret, 37057 div = doc.createElement('div'), 37058 body = doc.body, 37059 fakeUsed = false; 37060 37061 div.style.cssText = "position:absolute;font-size:1em;width:1em"; 37062 37063 if( !body ){ 37064 body = fakeUsed = doc.createElement( "body" ); 37065 body.style.background = "none"; 37066 } 37067 37068 body.appendChild( div ); 37069 37070 docElem.insertBefore( body, docElem.firstChild ); 37071 37072 ret = div.offsetWidth; 37073 37074 if( fakeUsed ){ 37075 docElem.removeChild( body ); 37076 } 37077 else { 37078 body.removeChild( div ); 37079 } 37080 37081 //also update eminpx before returning 37082 ret = eminpx = parseFloat(ret); 37083 37084 return ret; 37085 }, 37086 37087 //cached container for 1em value, populated the first time it's needed 37088 eminpx, 37089 37090 //enable/disable styles 37091 applyMedia = function( fromResize ){ 37092 var name = "clientWidth", 37093 docElemProp = docElem[ name ], 37094 currWidth = doc.compatMode === "CSS1Compat" && docElemProp || doc.body[ name ] || docElemProp, 37095 styleBlocks = {}, 37096 lastLink = links[ links.length-1 ], 37097 now = (new Date()).getTime(); 37098 37099 //throttle resize calls 37100 if( fromResize && lastCall && now - lastCall < resizeThrottle ){ 37101 clearTimeout( resizeDefer ); 37102 resizeDefer = setTimeout( applyMedia, resizeThrottle ); 37103 return; 37104 } 37105 else { 37106 lastCall = now; 37107 } 37108 37109 for( var i in mediastyles ){ 37110 var thisstyle = mediastyles[ i ], 37111 min = thisstyle.minw, 37112 max = thisstyle.maxw, 37113 minnull = min === null, 37114 maxnull = max === null, 37115 em = "em"; 37116 37117 if( !!min ){ 37118 min = parseFloat( min ) * ( min.indexOf( em ) > -1 ? ( eminpx || getEmValue() ) : 1 ); 37119 } 37120 if( !!max ){ 37121 max = parseFloat( max ) * ( max.indexOf( em ) > -1 ? ( eminpx || getEmValue() ) : 1 ); 37122 } 37123 37124 // if there's no media query at all (the () part), or min or max is not null, and if either is present, they're true 37125 if( !thisstyle.hasquery || ( !minnull || !maxnull ) && ( minnull || currWidth >= min ) && ( maxnull || currWidth <= max ) ){ 37126 if( !styleBlocks[ thisstyle.media ] ){ 37127 styleBlocks[ thisstyle.media ] = []; 37128 } 37129 styleBlocks[ thisstyle.media ].push( rules[ thisstyle.rules ] ); 37130 } 37131 } 37132 37133 //remove any existing respond style element(s) 37134 for( var i in appendedEls ){ 37135 if( appendedEls[ i ] && appendedEls[ i ].parentNode === head ){ 37136 head.removeChild( appendedEls[ i ] ); 37137 } 37138 } 37139 37140 //inject active styles, grouped by media type 37141 for( var i in styleBlocks ){ 37142 var ss = doc.createElement( "style" ), 37143 css = styleBlocks[ i ].join( "\n" ); 37144 37145 ss.type = "text/css"; 37146 ss.media = i; 37147 37148 //originally, ss was appended to a documentFragment and sheets were appended in bulk. 37149 //this caused crashes in IE in a number of circumstances, such as when the HTML element had a bg image set, so appending beforehand seems best. Thanks to @dvelyk for the initial research on this one! 37150 head.insertBefore( ss, lastLink.nextSibling ); 37151 37152 if ( ss.styleSheet ){ 37153 ss.styleSheet.cssText = css; 37154 } 37155 else { 37156 ss.appendChild( doc.createTextNode( css ) ); 37157 } 37158 37159 //push to appendedEls to track for later removal 37160 appendedEls.push( ss ); 37161 } 37162 }, 37163 //tweaked Ajax functions from Quirksmode 37164 ajax = function( url, callback ) { 37165 var req = xmlHttp(); 37166 if (!req){ 37167 return; 37168 } 37169 req.open( "GET", url, true ); 37170 req.onreadystatechange = function () { 37171 if ( req.readyState != 4 || req.status != 200 && req.status != 304 ){ 37172 return; 37173 } 37174 callback( req.responseText ); 37175 } 37176 if ( req.readyState == 4 ){ 37177 return; 37178 } 37179 req.send( null ); 37180 }, 37181 //define ajax obj 37182 xmlHttp = (function() { 37183 var xmlhttpmethod = false; 37184 try { 37185 xmlhttpmethod = new XMLHttpRequest(); 37186 } 37187 catch( e ){ 37188 xmlhttpmethod = new ActiveXObject( "Microsoft.XMLHTTP" ); 37189 } 37190 return function(){ 37191 return xmlhttpmethod; 37192 }; 37193 })();
vendor: 5,410 bytes, lines 37194-37365
37194 37195 //translate CSS 37196 ripCSS(); 37197 37198 //expose update for re-running respond later on 37199 respond.update = ripCSS; 37200 37201 //adjust on resize 37202 function callMedia(){ 37203 applyMedia( true ); 37204 } 37205 if( win.addEventListener ){ 37206 win.addEventListener( "resize", callMedia, false ); 37207 } 37208 else if( win.attachEvent ){ 37209 win.attachEvent( "onresize", callMedia ); 37210 } 37211})(this); 37212; 37213/**! 37214 37215 @license 37216 handlebars v4.7.7 37217 37218Copyright (C) 2011-2019 by Yehuda Katz 37219 37220Permission is hereby granted, free of charge, to any person obtaining a copy 37221of this software and associated documentation files (the "Software"), to deal 37222in the Software without restriction, including without limitation the rights 37223to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 37224copies of the Software, and to permit persons to whom the Software is 37225furnished to do so, subject to the following conditions: 37226 37227The above copyright notice and this permission notice shall be included in 37228all copies or substantial portions of the Software. 37229 37230THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 37231IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 37232FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 37233AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 37234LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 37235OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 37236THE SOFTWARE. 37237 37238*/ 37239(function webpackUniversalModuleDefinition(root, factory) { 37240 if (typeof exports === 'object' && typeof module === 'object') 37241 module.exports = factory(); 37242 else if (typeof define === 'function' && define.amd) 37243 define([], factory); 37244 else if (typeof exports === 'object') 37245 exports["Handlebars"] = factory(); 37246 else 37247 root["Handlebars"] = factory(); 37248})(this, function () { 37249 return /******/ (function (modules) { // webpackBootstrap 37250/******/ // The module cache 37251/******/ var installedModules = {}; 37252 37253/******/ // The require function 37254/******/ function __webpack_require__(moduleId) { 37255 37256/******/ // Check if module is in cache 37257/******/ if (installedModules[moduleId]) 37258/******/ return installedModules[moduleId].exports; 37259 37260/******/ // Create a new module (and put it into the cache) 37261/******/ var module = installedModules[moduleId] = { 37262/******/ exports: {}, 37263/******/ id: moduleId, 37264/******/ loaded: false 37265 /******/ 37266}; 37267 37268/******/ // Execute the module function 37269/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 37270 37271/******/ // Flag the module as loaded 37272/******/ module.loaded = true; 37273 37274/******/ // Return the exports of the module 37275/******/ return module.exports; 37276 /******/ 37277} 37278 37279 37280/******/ // expose the modules object (__webpack_modules__) 37281/******/ __webpack_require__.m = modules; 37282 37283/******/ // expose the module cache 37284/******/ __webpack_require__.c = installedModules; 37285 37286/******/ // __webpack_public_path__ 37287/******/ __webpack_require__.p = ""; 37288 37289/******/ // Load entry module and return exports 37290/******/ return __webpack_require__(0); 37291 /******/ 37292}) 37293/************************************************************************/ 37294/******/([ 37295/* 0 */ 37296/***/ (function (module, exports, __webpack_require__) { 37297 37298 'use strict'; 37299 37300 var _interopRequireDefault = __webpack_require__(1)['default']; 37301 37302 exports.__esModule = true; 37303 37304 var _handlebarsRuntime = __webpack_require__(2); 37305 37306 var _handlebarsRuntime2 = _interopRequireDefault(_handlebarsRuntime); 37307 37308 // Compiler imports 37309 37310 var _handlebarsCompilerAst = __webpack_require__(45); 37311 37312 var _handlebarsCompilerAst2 = _interopRequireDefault(_handlebarsCompilerAst); 37313 37314 var _handlebarsCompilerBase = __webpack_require__(46); 37315 37316 var _handlebarsCompilerCompiler = __webpack_require__(51); 37317 37318 var _handlebarsCompilerJavascriptCompiler = __webpack_require__(52); 37319 37320 var _handlebarsCompilerJavascriptCompiler2 = _interopRequireDefault(_handlebarsCompilerJavascriptCompiler); 37321 37322 var _handlebarsCompilerVisitor = __webpack_require__(49); 37323 37324 var _handlebarsCompilerVisitor2 = _interopRequireDefault(_handlebarsCompilerVisitor); 37325 37326 var _handlebarsNoConflict = __webpack_require__(44); 37327 37328 var _handlebarsNoConflict2 = _interopRequireDefault(_handlebarsNoConflict); 37329 37330 var _create = _handlebarsRuntime2['default'].create; 37331 function create() { 37332 var hb = _create(); 37333 37334 hb.compile = function (input, options) { 37335 return _handlebarsCompilerCompiler.compile(input, options, hb); 37336 }; 37337 hb.precompile = function (input, options) { 37338 return _handlebarsCompilerCompiler.precompile(input, options, hb); 37339 }; 37340 37341 hb.AST = _handlebarsCompilerAst2['default']; 37342 hb.Compiler = _handlebarsCompilerCompiler.Compiler; 37343 hb.JavaScriptCompiler = _handlebarsCompilerJavascriptCompiler2['default']; 37344 hb.Parser = _handlebarsCompilerBase.parser; 37345 hb.parse = _handlebarsCompilerBase.parse; 37346 hb.parseWithoutProcessing = _handlebarsCompilerBase.parseWithoutProcessing; 37347 37348 return hb; 37349 } 37350 37351 var inst = create(); 37352 inst.create = create; 37353 37354 _handlebarsNoConflict2['default'](inst); 37355 37356 inst.Visitor = _handlebarsCompilerVisitor2['default']; 37357 37358 inst['default'] = inst; 37359 37360 exports['default'] = inst; 37361 module.exports = exports['default']; 37362 37363 /***/ 37364}), 37365/* 1 */
vendor: 10,733 bytes, lines 37366-37760
37366/***/ (function (module, exports) { 37367 37368 "use strict"; 37369 37370 exports["default"] = function (obj) { 37371 return obj && obj.__esModule ? obj : { 37372 "default": obj 37373 }; 37374 }; 37375 37376 exports.__esModule = true; 37377 37378 /***/ 37379}), 37380/* 2 */ 37381/***/ (function (module, exports, __webpack_require__) { 37382 37383 'use strict'; 37384 37385 var _interopRequireWildcard = __webpack_require__(3)['default']; 37386 37387 var _interopRequireDefault = __webpack_require__(1)['default']; 37388 37389 exports.__esModule = true; 37390 37391 var _handlebarsBase = __webpack_require__(4); 37392 37393 var base = _interopRequireWildcard(_handlebarsBase); 37394 37395 // Each of these augment the Handlebars object. No need to setup here. 37396 // (This is done to easily share code between commonjs and browse envs) 37397 37398 var _handlebarsSafeString = __webpack_require__(37); 37399 37400 var _handlebarsSafeString2 = _interopRequireDefault(_handlebarsSafeString); 37401 37402 var _handlebarsException = __webpack_require__(6); 37403 37404 var _handlebarsException2 = _interopRequireDefault(_handlebarsException); 37405 37406 var _handlebarsUtils = __webpack_require__(5); 37407 37408 var Utils = _interopRequireWildcard(_handlebarsUtils); 37409 37410 var _handlebarsRuntime = __webpack_require__(38); 37411 37412 var runtime = _interopRequireWildcard(_handlebarsRuntime); 37413 37414 var _handlebarsNoConflict = __webpack_require__(44); 37415 37416 var _handlebarsNoConflict2 = _interopRequireDefault(_handlebarsNoConflict); 37417 37418 // For compatibility and usage outside of module systems, make the Handlebars object a namespace 37419 function create() { 37420 var hb = new base.HandlebarsEnvironment(); 37421 37422 Utils.extend(hb, base); 37423 hb.SafeString = _handlebarsSafeString2['default']; 37424 hb.Exception = _handlebarsException2['default']; 37425 hb.Utils = Utils; 37426 hb.escapeExpression = Utils.escapeExpression; 37427 37428 hb.VM = runtime; 37429 hb.template = function (spec) { 37430 return runtime.template(spec, hb); 37431 }; 37432 37433 return hb; 37434 } 37435 37436 var inst = create(); 37437 inst.create = create; 37438 37439 _handlebarsNoConflict2['default'](inst); 37440 37441 inst['default'] = inst; 37442 37443 exports['default'] = inst; 37444 module.exports = exports['default']; 37445 37446 /***/ 37447}), 37448/* 3 */ 37449/***/ (function (module, exports) { 37450 37451 "use strict"; 37452 37453 exports["default"] = function (obj) { 37454 if (obj && obj.__esModule) { 37455 return obj; 37456 } else { 37457 var newObj = {}; 37458 37459 if (obj != null) { 37460 for (var key in obj) { 37461 if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; 37462 } 37463 } 37464 37465 newObj["default"] = obj; 37466 return newObj; 37467 } 37468 }; 37469 37470 exports.__esModule = true; 37471 37472 /***/ 37473}), 37474/* 4 */ 37475/***/ (function (module, exports, __webpack_require__) { 37476 37477 'use strict'; 37478 37479 var _interopRequireDefault = __webpack_require__(1)['default']; 37480 37481 exports.__esModule = true; 37482 exports.HandlebarsEnvironment = HandlebarsEnvironment; 37483 37484 var _utils = __webpack_require__(5); 37485 37486 var _exception = __webpack_require__(6); 37487 37488 var _exception2 = _interopRequireDefault(_exception); 37489 37490 var _helpers = __webpack_require__(10); 37491 37492 var _decorators = __webpack_require__(30); 37493 37494 var _logger = __webpack_require__(32); 37495 37496 var _logger2 = _interopRequireDefault(_logger); 37497 37498 var _internalProtoAccess = __webpack_require__(33); 37499 37500 var VERSION = '4.7.7'; 37501 exports.VERSION = VERSION; 37502 var COMPILER_REVISION = 8; 37503 exports.COMPILER_REVISION = COMPILER_REVISION; 37504 var LAST_COMPATIBLE_COMPILER_REVISION = 7; 37505 37506 exports.LAST_COMPATIBLE_COMPILER_REVISION = LAST_COMPATIBLE_COMPILER_REVISION; 37507 var REVISION_CHANGES = { 37508 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it 37509 2: '== 1.0.0-rc.3', 37510 3: '== 1.0.0-rc.4', 37511 4: '== 1.x.x', 37512 5: '== 2.0.0-alpha.x', 37513 6: '>= 2.0.0-beta.1', 37514 7: '>= 4.0.0 <4.3.0', 37515 8: '>= 4.3.0' 37516 }; 37517 37518 exports.REVISION_CHANGES = REVISION_CHANGES; 37519 var objectType = '[object Object]'; 37520 37521 function HandlebarsEnvironment(helpers, partials, decorators) { 37522 this.helpers = helpers || {}; 37523 this.partials = partials || {}; 37524 this.decorators = decorators || {}; 37525 37526 _helpers.registerDefaultHelpers(this); 37527 _decorators.registerDefaultDecorators(this); 37528 } 37529 37530 HandlebarsEnvironment.prototype = { 37531 constructor: HandlebarsEnvironment, 37532 37533 logger: _logger2['default'], 37534 log: _logger2['default'].log, 37535 37536 registerHelper: function registerHelper(name, fn) { 37537 if (_utils.toString.call(name) === objectType) { 37538 if (fn) { 37539 throw new _exception2['default']('Arg not supported with multiple helpers'); 37540 } 37541 _utils.extend(this.helpers, name); 37542 } else { 37543 this.helpers[name] = fn; 37544 } 37545 }, 37546 unregisterHelper: function unregisterHelper(name) { 37547 delete this.helpers[name]; 37548 }, 37549 37550 registerPartial: function registerPartial(name, partial) { 37551 if (_utils.toString.call(name) === objectType) { 37552 _utils.extend(this.partials, name); 37553 } else { 37554 if (typeof partial === 'undefined') { 37555 throw new _exception2['default']('Attempting to register a partial called "' + name + '" as undefined'); 37556 } 37557 this.partials[name] = partial; 37558 } 37559 }, 37560 unregisterPartial: function unregisterPartial(name) { 37561 delete this.partials[name]; 37562 }, 37563 37564 registerDecorator: function registerDecorator(name, fn) { 37565 if (_utils.toString.call(name) === objectType) { 37566 if (fn) { 37567 throw new _exception2['default']('Arg not supported with multiple decorators'); 37568 } 37569 _utils.extend(this.decorators, name); 37570 } else { 37571 this.decorators[name] = fn; 37572 } 37573 }, 37574 unregisterDecorator: function unregisterDecorator(name) { 37575 delete this.decorators[name]; 37576 }, 37577 /** 37578 * Reset the memory of illegal property accesses that have already been logged. 37579 * @deprecated should only be used in handlebars test-cases 37580 */ 37581 resetLoggedPropertyAccesses: function resetLoggedPropertyAccesses() { 37582 _internalProtoAccess.resetLoggedProperties(); 37583 } 37584 }; 37585 37586 var log = _logger2['default'].log; 37587 37588 exports.log = log; 37589 exports.createFrame = _utils.createFrame; 37590 exports.logger = _logger2['default']; 37591 37592 /***/ 37593}), 37594/* 5 */ 37595/***/ (function (module, exports) { 37596 37597 'use strict'; 37598 37599 exports.__esModule = true; 37600 exports.extend = extend; 37601 exports.indexOf = indexOf; 37602 exports.escapeExpression = escapeExpression; 37603 exports.isEmpty = isEmpty; 37604 exports.createFrame = createFrame; 37605 exports.blockParams = blockParams; 37606 exports.appendContextPath = appendContextPath; 37607 var escape = { 37608 '&': '&', 37609 '<': '<', 37610 '>': '>', 37611 '"': '"', 37612 "'": ''', 37613 '`': '`', 37614 '=': '=' 37615 }; 37616 37617 var badChars = /[&<>"'`=]/g, 37618 possible = /[&<>"'`=]/; 37619 37620 function escapeChar(chr) { 37621 return escape[chr]; 37622 } 37623 37624 function extend(obj /* , ...source */) { 37625 for (var i = 1; i < arguments.length; i++) { 37626 for (var key in arguments[i]) { 37627 if (Object.prototype.hasOwnProperty.call(arguments[i], key)) { 37628 obj[key] = arguments[i][key]; 37629 } 37630 } 37631 } 37632 37633 return obj; 37634 } 37635 37636 var toString = Object.prototype.toString; 37637 37638 exports.toString = toString; 37639 // Sourced from lodash 37640 // https://github.com/bestiejs/lodash/blob/master/LICENSE.txt 37641 /* eslint-disable func-style */ 37642 var isFunction = function isFunction(value) { 37643 return typeof value === 'function'; 37644 }; 37645 // fallback for older versions of Chrome and Safari 37646 /* istanbul ignore next */ 37647 if (isFunction(/x/)) { 37648 exports.isFunction = isFunction = function (value) { 37649 return typeof value === 'function' && toString.call(value) === '[object Function]'; 37650 }; 37651 } 37652 exports.isFunction = isFunction; 37653 37654 /* eslint-enable func-style */ 37655 37656 /* istanbul ignore next */ 37657 var isArray = Array.isArray || function (value) { 37658 return value && typeof value === 'object' ? toString.call(value) === '[object Array]' : false; 37659 }; 37660 37661 exports.isArray = isArray; 37662 // Older IE versions do not directly support indexOf so we must implement our own, sadly. 37663 37664 function indexOf(array, value) { 37665 for (var i = 0, len = array.length; i < len; i++) { 37666 if (array[i] === value) { 37667 return i; 37668 } 37669 } 37670 return -1; 37671 } 37672 37673 function escapeExpression(string) { 37674 if (typeof string !== 'string') { 37675 // don't escape SafeStrings, since they're already safe 37676 if (string && string.toHTML) { 37677 return string.toHTML(); 37678 } else if (string == null) { 37679 return ''; 37680 } else if (!string) { 37681 return string + ''; 37682 } 37683 37684 // Force a string conversion as this will be done by the append regardless and 37685 // the regex test will do this transparently behind the scenes, causing issues if 37686 // an object's to string has escaped characters in it. 37687 string = '' + string; 37688 } 37689 37690 if (!possible.test(string)) { 37691 return string; 37692 } 37693 return string.replace(badChars, escapeChar); 37694 } 37695 37696 function isEmpty(value) { 37697 if (!value && value !== 0) { 37698 return true; 37699 } else if (isArray(value) && value.length === 0) { 37700 return true; 37701 } else { 37702 return false; 37703 } 37704 } 37705 37706 function createFrame(object) { 37707 var frame = extend({}, object); 37708 frame._parent = object; 37709 return frame; 37710 } 37711 37712 function blockParams(params, ids) { 37713 params.path = ids; 37714 return params; 37715 } 37716 37717 function appendContextPath(contextPath, id) { 37718 return (contextPath ? contextPath + '.' : '') + id; 37719 } 37720 37721 /***/ 37722}), 37723/* 6 */ 37724/***/ (function (module, exports, __webpack_require__) { 37725 37726 'use strict'; 37727 37728 var _Object$defineProperty = __webpack_require__(7)['default']; 37729 37730 exports.__esModule = true; 37731 var errorProps = ['description', 'fileName', 'lineNumber', 'endLineNumber', 'message', 'name', 'number', 'stack']; 37732 37733 function Exception(message, node) { 37734 var loc = node && node.loc, 37735 line = undefined, 37736 endLineNumber = undefined, 37737 column = undefined, 37738 endColumn = undefined; 37739 37740 if (loc) { 37741 line = loc.start.line; 37742 endLineNumber = loc.end.line; 37743 column = loc.start.column; 37744 endColumn = loc.end.column; 37745 37746 message += ' - ' + line + ':' + column; 37747 } 37748 37749 var tmp = Error.prototype.constructor.call(this, message); 37750 37751 // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work. 37752 for (var idx = 0; idx < errorProps.length; idx++) { 37753 this[errorProps[idx]] = tmp[errorProps[idx]]; 37754 } 37755 37756 /* istanbul ignore else */ 37757 if (Error.captureStackTrace) { 37758 Error.captureStackTrace(this, Exception); 37759 } 37760
vendor: 10,816 bytes, lines 37761-38145
37761 try { 37762 if (loc) { 37763 this.lineNumber = line; 37764 this.endLineNumber = endLineNumber; 37765 37766 // Work around issue under safari where we can't directly set the column value 37767 /* istanbul ignore next */ 37768 if (_Object$defineProperty) { 37769 Object.defineProperty(this, 'column', { 37770 value: column, 37771 enumerable: true 37772 }); 37773 Object.defineProperty(this, 'endColumn', { 37774 value: endColumn, 37775 enumerable: true 37776 }); 37777 } else { 37778 this.column = column; 37779 this.endColumn = endColumn; 37780 } 37781 } 37782 } catch (nop) { 37783 /* Ignore if the browser is very particular */ 37784 } 37785 } 37786 37787 Exception.prototype = new Error(); 37788 37789 exports['default'] = Exception; 37790 module.exports = exports['default']; 37791 37792 /***/ 37793}), 37794/* 7 */ 37795/***/ (function (module, exports, __webpack_require__) { 37796 37797 module.exports = { "default": __webpack_require__(8), __esModule: true }; 37798 37799 /***/ 37800}), 37801/* 8 */ 37802/***/ (function (module, exports, __webpack_require__) { 37803 37804 var $ = __webpack_require__(9); 37805 module.exports = function defineProperty(it, key, desc) { 37806 return $.setDesc(it, key, desc); 37807 }; 37808 37809 /***/ 37810}), 37811/* 9 */ 37812/***/ (function (module, exports) { 37813 37814 var $Object = Object; 37815 module.exports = { 37816 create: $Object.create, 37817 getProto: $Object.getPrototypeOf, 37818 isEnum: {}.propertyIsEnumerable, 37819 getDesc: $Object.getOwnPropertyDescriptor, 37820 setDesc: $Object.defineProperty, 37821 setDescs: $Object.defineProperties, 37822 getKeys: $Object.keys, 37823 getNames: $Object.getOwnPropertyNames, 37824 getSymbols: $Object.getOwnPropertySymbols, 37825 each: [].forEach 37826 }; 37827 37828 /***/ 37829}), 37830/* 10 */ 37831/***/ (function (module, exports, __webpack_require__) { 37832 37833 'use strict'; 37834 37835 var _interopRequireDefault = __webpack_require__(1)['default']; 37836 37837 exports.__esModule = true; 37838 exports.registerDefaultHelpers = registerDefaultHelpers; 37839 exports.moveHelperToHooks = moveHelperToHooks; 37840 37841 var _helpersBlockHelperMissing = __webpack_require__(11); 37842 37843 var _helpersBlockHelperMissing2 = _interopRequireDefault(_helpersBlockHelperMissing); 37844 37845 var _helpersEach = __webpack_require__(12); 37846 37847 var _helpersEach2 = _interopRequireDefault(_helpersEach); 37848 37849 var _helpersHelperMissing = __webpack_require__(25); 37850 37851 var _helpersHelperMissing2 = _interopRequireDefault(_helpersHelperMissing); 37852 37853 var _helpersIf = __webpack_require__(26); 37854 37855 var _helpersIf2 = _interopRequireDefault(_helpersIf); 37856 37857 var _helpersLog = __webpack_require__(27); 37858 37859 var _helpersLog2 = _interopRequireDefault(_helpersLog); 37860 37861 var _helpersLookup = __webpack_require__(28); 37862 37863 var _helpersLookup2 = _interopRequireDefault(_helpersLookup); 37864 37865 var _helpersWith = __webpack_require__(29); 37866 37867 var _helpersWith2 = _interopRequireDefault(_helpersWith); 37868 37869 function registerDefaultHelpers(instance) { 37870 _helpersBlockHelperMissing2['default'](instance); 37871 _helpersEach2['default'](instance); 37872 _helpersHelperMissing2['default'](instance); 37873 _helpersIf2['default'](instance); 37874 _helpersLog2['default'](instance); 37875 _helpersLookup2['default'](instance); 37876 _helpersWith2['default'](instance); 37877 } 37878 37879 function moveHelperToHooks(instance, helperName, keepHelper) { 37880 if (instance.helpers[helperName]) { 37881 instance.hooks[helperName] = instance.helpers[helperName]; 37882 if (!keepHelper) { 37883 delete instance.helpers[helperName]; 37884 } 37885 } 37886 } 37887 37888 /***/ 37889}), 37890/* 11 */ 37891/***/ (function (module, exports, __webpack_require__) { 37892 37893 'use strict'; 37894 37895 exports.__esModule = true; 37896 37897 var _utils = __webpack_require__(5); 37898 37899 exports['default'] = function (instance) { 37900 instance.registerHelper('blockHelperMissing', function (context, options) { 37901 var inverse = options.inverse, 37902 fn = options.fn; 37903 37904 if (context === true) { 37905 return fn(this); 37906 } else if (context === false || context == null) { 37907 return inverse(this); 37908 } else if (_utils.isArray(context)) { 37909 if (context.length > 0) { 37910 if (options.ids) { 37911 options.ids = [options.name]; 37912 } 37913 37914 return instance.helpers.each(context, options); 37915 } else { 37916 return inverse(this); 37917 } 37918 } else { 37919 if (options.data && options.ids) { 37920 var data = _utils.createFrame(options.data); 37921 data.contextPath = _utils.appendContextPath(options.data.contextPath, options.name); 37922 options = { data: data }; 37923 } 37924 37925 return fn(context, options); 37926 } 37927 }); 37928 }; 37929 37930 module.exports = exports['default']; 37931 37932 /***/ 37933}), 37934/* 12 */ 37935/***/ (function (module, exports, __webpack_require__) { 37936 37937 /* WEBPACK VAR INJECTION */(function (global) { 37938 'use strict'; 37939 37940 var _Object$keys = __webpack_require__(13)['default']; 37941 37942 var _interopRequireDefault = __webpack_require__(1)['default']; 37943 37944 exports.__esModule = true; 37945 37946 var _utils = __webpack_require__(5); 37947 37948 var _exception = __webpack_require__(6); 37949 37950 var _exception2 = _interopRequireDefault(_exception); 37951 37952 exports['default'] = function (instance) { 37953 instance.registerHelper('each', function (context, options) { 37954 if (!options) { 37955 throw new _exception2['default']('Must pass iterator to #each'); 37956 } 37957 37958 var fn = options.fn, 37959 inverse = options.inverse, 37960 i = 0, 37961 ret = '', 37962 data = undefined, 37963 contextPath = undefined; 37964 37965 if (options.data && options.ids) { 37966 contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.'; 37967 } 37968 37969 if (_utils.isFunction(context)) { 37970 context = context.call(this); 37971 } 37972 37973 if (options.data) { 37974 data = _utils.createFrame(options.data); 37975 } 37976 37977 function execIteration(field, index, last) { 37978 if (data) { 37979 data.key = field; 37980 data.index = index; 37981 data.first = index === 0; 37982 data.last = !!last; 37983 37984 if (contextPath) { 37985 data.contextPath = contextPath + field; 37986 } 37987 } 37988 37989 ret = ret + fn(context[field], { 37990 data: data, 37991 blockParams: _utils.blockParams([context[field], field], [contextPath + field, null]) 37992 }); 37993 } 37994 37995 if (context && typeof context === 'object') { 37996 if (_utils.isArray(context)) { 37997 for (var j = context.length; i < j; i++) { 37998 if (i in context) { 37999 execIteration(i, i, i === context.length - 1); 38000 } 38001 } 38002 } else if (global.Symbol && context[global.Symbol.iterator]) { 38003 var newContext = []; 38004 var iterator = context[global.Symbol.iterator](); 38005 for (var it = iterator.next(); !it.done; it = iterator.next()) { 38006 newContext.push(it.value); 38007 } 38008 context = newContext; 38009 for (var j = context.length; i < j; i++) { 38010 execIteration(i, i, i === context.length - 1); 38011 } 38012 } else { 38013 (function () { 38014 var priorKey = undefined; 38015 38016 _Object$keys(context).forEach(function (key) { 38017 // We're running the iterations one step out of sync so we can detect 38018 // the last iteration without have to scan the object twice and create 38019 // an itermediate keys array. 38020 if (priorKey !== undefined) { 38021 execIteration(priorKey, i - 1); 38022 } 38023 priorKey = key; 38024 i++; 38025 }); 38026 if (priorKey !== undefined) { 38027 execIteration(priorKey, i - 1, true); 38028 } 38029 })(); 38030 } 38031 } 38032 38033 if (i === 0) { 38034 ret = inverse(this); 38035 } 38036 38037 return ret; 38038 }); 38039 }; 38040 38041 module.exports = exports['default']; 38042 /* WEBPACK VAR INJECTION */ 38043}.call(exports, (function () { return this; }()))) 38044 38045 /***/ 38046}), 38047/* 13 */ 38048/***/ (function (module, exports, __webpack_require__) { 38049 38050 module.exports = { "default": __webpack_require__(14), __esModule: true }; 38051 38052 /***/ 38053}), 38054/* 14 */ 38055/***/ (function (module, exports, __webpack_require__) { 38056 38057 __webpack_require__(15); 38058 module.exports = __webpack_require__(21).Object.keys; 38059 38060 /***/ 38061}), 38062/* 15 */ 38063/***/ (function (module, exports, __webpack_require__) { 38064 38065 // 19.1.2.14 Object.keys(O) 38066 var toObject = __webpack_require__(16); 38067 38068 __webpack_require__(18)('keys', function ($keys) { 38069 return function keys(it) { 38070 return $keys(toObject(it)); 38071 }; 38072 }); 38073 38074 /***/ 38075}), 38076/* 16 */ 38077/***/ (function (module, exports, __webpack_require__) { 38078 38079 // 7.1.13 ToObject(argument) 38080 var defined = __webpack_require__(17); 38081 module.exports = function (it) { 38082 return Object(defined(it)); 38083 }; 38084 38085 /***/ 38086}), 38087/* 17 */ 38088/***/ (function (module, exports) { 38089 38090 // 7.2.1 RequireObjectCoercible(argument) 38091 module.exports = function (it) { 38092 if (it == undefined) throw TypeError("Can't call method on " + it); 38093 return it; 38094 }; 38095 38096 /***/ 38097}), 38098/* 18 */ 38099/***/ (function (module, exports, __webpack_require__) { 38100 38101 // most Object methods by ES6 should accept primitives 38102 var $export = __webpack_require__(19) 38103 , core = __webpack_require__(21) 38104 , fails = __webpack_require__(24); 38105 module.exports = function (KEY, exec) { 38106 var fn = (core.Object || {})[KEY] || Object[KEY] 38107 , exp = {}; 38108 exp[KEY] = exec(fn); 38109 $export($export.S + $export.F * fails(function () { fn(1); }), 'Object', exp); 38110 }; 38111 38112 /***/ 38113}), 38114/* 19 */ 38115/***/ (function (module, exports, __webpack_require__) { 38116 38117 var global = __webpack_require__(20) 38118 , core = __webpack_require__(21) 38119 , ctx = __webpack_require__(22) 38120 , PROTOTYPE = 'prototype'; 38121 38122 var $export = function (type, name, source) { 38123 var IS_FORCED = type & $export.F 38124 , IS_GLOBAL = type & $export.G 38125 , IS_STATIC = type & $export.S 38126 , IS_PROTO = type & $export.P 38127 , IS_BIND = type & $export.B 38128 , IS_WRAP = type & $export.W 38129 , exports = IS_GLOBAL ? core : core[name] || (core[name] = {}) 38130 , target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE] 38131 , key, own, out; 38132 if (IS_GLOBAL) source = name; 38133 for (key in source) { 38134 // contains in native 38135 own = !IS_FORCED && target && key in target; 38136 if (own && key in exports) continue; 38137 // export native or passed 38138 out = own ? target[key] : source[key]; 38139 // prevent global pollution for namespaces 38140 exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key] 38141 // bind timers to global for call from export context 38142 : IS_BIND && own ? ctx(out, global) 38143 // wrap global constructors for prevent change them in library 38144 : IS_WRAP && target[key] == out ? (function (C) { 38145 var F = function (param) {
vendor: 22,947 bytes, lines 38146-38897
38146 return this instanceof C ? new C(param) : C(param); 38147 }; 38148 F[PROTOTYPE] = C[PROTOTYPE]; 38149 return F; 38150 // make static versions for prototype methods 38151 })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; 38152 if (IS_PROTO) (exports[PROTOTYPE] || (exports[PROTOTYPE] = {}))[key] = out; 38153 } 38154 }; 38155 // type bitmap 38156 $export.F = 1; // forced 38157 $export.G = 2; // global 38158 $export.S = 4; // static 38159 $export.P = 8; // proto 38160 $export.B = 16; // bind 38161 $export.W = 32; // wrap 38162 module.exports = $export; 38163 38164 /***/ 38165}), 38166/* 20 */ 38167/***/ (function (module, exports) { 38168 38169 // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 38170 var global = module.exports = typeof window != 'undefined' && window.Math == Math 38171 ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')(); 38172 if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef 38173 38174 /***/ 38175}), 38176/* 21 */ 38177/***/ (function (module, exports) { 38178 38179 var core = module.exports = { version: '1.2.6' }; 38180 if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef 38181 38182 /***/ 38183}), 38184/* 22 */ 38185/***/ (function (module, exports, __webpack_require__) { 38186 38187 // optional / simple context binding 38188 var aFunction = __webpack_require__(23); 38189 module.exports = function (fn, that, length) { 38190 aFunction(fn); 38191 if (that === undefined) return fn; 38192 switch (length) { 38193 case 1: return function (a) { 38194 return fn.call(that, a); 38195 }; 38196 case 2: return function (a, b) { 38197 return fn.call(that, a, b); 38198 }; 38199 case 3: return function (a, b, c) { 38200 return fn.call(that, a, b, c); 38201 }; 38202 } 38203 return function (/* ...args */) { 38204 return fn.apply(that, arguments); 38205 }; 38206 }; 38207 38208 /***/ 38209}), 38210/* 23 */ 38211/***/ (function (module, exports) { 38212 38213 module.exports = function (it) { 38214 if (typeof it != 'function') throw TypeError(it + ' is not a function!'); 38215 return it; 38216 }; 38217 38218 /***/ 38219}), 38220/* 24 */ 38221/***/ (function (module, exports) { 38222 38223 module.exports = function (exec) { 38224 try { 38225 return !!exec(); 38226 } catch (e) { 38227 return true; 38228 } 38229 }; 38230 38231 /***/ 38232}), 38233/* 25 */ 38234/***/ (function (module, exports, __webpack_require__) { 38235 38236 'use strict'; 38237 38238 var _interopRequireDefault = __webpack_require__(1)['default']; 38239 38240 exports.__esModule = true; 38241 38242 var _exception = __webpack_require__(6); 38243 38244 var _exception2 = _interopRequireDefault(_exception); 38245 38246 exports['default'] = function (instance) { 38247 instance.registerHelper('helperMissing', function () /* [args, ]options */ { 38248 if (arguments.length === 1) { 38249 // A missing field in a {{foo}} construct. 38250 return undefined; 38251 } else { 38252 // Someone is actually trying to call something, blow up. 38253 throw new _exception2['default']('Missing helper: "' + arguments[arguments.length - 1].name + '"'); 38254 } 38255 }); 38256 }; 38257 38258 module.exports = exports['default']; 38259 38260 /***/ 38261}), 38262/* 26 */ 38263/***/ (function (module, exports, __webpack_require__) { 38264 38265 'use strict'; 38266 38267 var _interopRequireDefault = __webpack_require__(1)['default']; 38268 38269 exports.__esModule = true; 38270 38271 var _utils = __webpack_require__(5); 38272 38273 var _exception = __webpack_require__(6); 38274 38275 var _exception2 = _interopRequireDefault(_exception); 38276 38277 exports['default'] = function (instance) { 38278 instance.registerHelper('if', function (conditional, options) { 38279 if (arguments.length != 2) { 38280 throw new _exception2['default']('#if requires exactly one argument'); 38281 } 38282 if (_utils.isFunction(conditional)) { 38283 conditional = conditional.call(this); 38284 } 38285 38286 // Default behavior is to render the positive path if the value is truthy and not empty. 38287 // The `includeZero` option may be set to treat the condtional as purely not empty based on the 38288 // behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative. 38289 if (!options.hash.includeZero && !conditional || _utils.isEmpty(conditional)) { 38290 return options.inverse(this); 38291 } else { 38292 return options.fn(this); 38293 } 38294 }); 38295 38296 instance.registerHelper('unless', function (conditional, options) { 38297 if (arguments.length != 2) { 38298 throw new _exception2['default']('#unless requires exactly one argument'); 38299 } 38300 return instance.helpers['if'].call(this, conditional, { 38301 fn: options.inverse, 38302 inverse: options.fn, 38303 hash: options.hash 38304 }); 38305 }); 38306 }; 38307 38308 module.exports = exports['default']; 38309 38310 /***/ 38311}), 38312/* 27 */ 38313/***/ (function (module, exports) { 38314 38315 'use strict'; 38316 38317 exports.__esModule = true; 38318 38319 exports['default'] = function (instance) { 38320 instance.registerHelper('log', function () /* message, options */ { 38321 var args = [undefined], 38322 options = arguments[arguments.length - 1]; 38323 for (var i = 0; i < arguments.length - 1; i++) { 38324 args.push(arguments[i]); 38325 } 38326 38327 var level = 1; 38328 if (options.hash.level != null) { 38329 level = options.hash.level; 38330 } else if (options.data && options.data.level != null) { 38331 level = options.data.level; 38332 } 38333 args[0] = level; 38334 38335 instance.log.apply(instance, args); 38336 }); 38337 }; 38338 38339 module.exports = exports['default']; 38340 38341 /***/ 38342}), 38343/* 28 */ 38344/***/ (function (module, exports) { 38345 38346 'use strict'; 38347 38348 exports.__esModule = true; 38349 38350 exports['default'] = function (instance) { 38351 instance.registerHelper('lookup', function (obj, field, options) { 38352 if (!obj) { 38353 // Note for 5.0: Change to "obj == null" in 5.0 38354 return obj; 38355 } 38356 return options.lookupProperty(obj, field); 38357 }); 38358 }; 38359 38360 module.exports = exports['default']; 38361 38362 /***/ 38363}), 38364/* 29 */ 38365/***/ (function (module, exports, __webpack_require__) { 38366 38367 'use strict'; 38368 38369 var _interopRequireDefault = __webpack_require__(1)['default']; 38370 38371 exports.__esModule = true; 38372 38373 var _utils = __webpack_require__(5); 38374 38375 var _exception = __webpack_require__(6); 38376 38377 var _exception2 = _interopRequireDefault(_exception); 38378 38379 exports['default'] = function (instance) { 38380 instance.registerHelper('with', function (context, options) { 38381 if (arguments.length != 2) { 38382 throw new _exception2['default']('#with requires exactly one argument'); 38383 } 38384 if (_utils.isFunction(context)) { 38385 context = context.call(this); 38386 } 38387 38388 var fn = options.fn; 38389 38390 if (!_utils.isEmpty(context)) { 38391 var data = options.data; 38392 if (options.data && options.ids) { 38393 data = _utils.createFrame(options.data); 38394 data.contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]); 38395 } 38396 38397 return fn(context, { 38398 data: data, 38399 blockParams: _utils.blockParams([context], [data && data.contextPath]) 38400 }); 38401 } else { 38402 return options.inverse(this); 38403 } 38404 }); 38405 }; 38406 38407 module.exports = exports['default']; 38408 38409 /***/ 38410}), 38411/* 30 */ 38412/***/ (function (module, exports, __webpack_require__) { 38413 38414 'use strict'; 38415 38416 var _interopRequireDefault = __webpack_require__(1)['default']; 38417 38418 exports.__esModule = true; 38419 exports.registerDefaultDecorators = registerDefaultDecorators; 38420 38421 var _decoratorsInline = __webpack_require__(31); 38422 38423 var _decoratorsInline2 = _interopRequireDefault(_decoratorsInline); 38424 38425 function registerDefaultDecorators(instance) { 38426 _decoratorsInline2['default'](instance); 38427 } 38428 38429 /***/ 38430}), 38431/* 31 */ 38432/***/ (function (module, exports, __webpack_require__) { 38433 38434 'use strict'; 38435 38436 exports.__esModule = true; 38437 38438 var _utils = __webpack_require__(5); 38439 38440 exports['default'] = function (instance) { 38441 instance.registerDecorator('inline', function (fn, props, container, options) { 38442 var ret = fn; 38443 if (!props.partials) { 38444 props.partials = {}; 38445 ret = function (context, options) { 38446 // Create a new partials stack frame prior to exec. 38447 var original = container.partials; 38448 container.partials = _utils.extend({}, original, props.partials); 38449 var ret = fn(context, options); 38450 container.partials = original; 38451 return ret; 38452 }; 38453 } 38454 38455 props.partials[options.args[0]] = options.fn; 38456 38457 return ret; 38458 }); 38459 }; 38460 38461 module.exports = exports['default']; 38462 38463 /***/ 38464}), 38465/* 32 */ 38466/***/ (function (module, exports, __webpack_require__) { 38467 38468 'use strict'; 38469 38470 exports.__esModule = true; 38471 38472 var _utils = __webpack_require__(5); 38473 38474 var logger = { 38475 methodMap: ['debug', 'info', 'warn', 'error'], 38476 level: 'info', 38477 38478 // Maps a given level value to the `methodMap` indexes above. 38479 lookupLevel: function lookupLevel(level) { 38480 if (typeof level === 'string') { 38481 var levelMap = _utils.indexOf(logger.methodMap, level.toLowerCase()); 38482 if (levelMap >= 0) { 38483 level = levelMap; 38484 } else { 38485 level = parseInt(level, 10); 38486 } 38487 } 38488 38489 return level; 38490 }, 38491 38492 // Can be overridden in the host environment 38493 log: function log(level) { 38494 level = logger.lookupLevel(level); 38495 38496 if (typeof console !== 'undefined' && logger.lookupLevel(logger.level) <= level) { 38497 var method = logger.methodMap[level]; 38498 // eslint-disable-next-line no-console 38499 if (!console[method]) { 38500 method = 'log'; 38501 } 38502 38503 for (var _len = arguments.length, message = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { 38504 message[_key - 1] = arguments[_key]; 38505 } 38506 38507 console[method].apply(console, message); // eslint-disable-line no-console 38508 } 38509 } 38510 }; 38511 38512 exports['default'] = logger; 38513 module.exports = exports['default']; 38514 38515 /***/ 38516}), 38517/* 33 */ 38518/***/ (function (module, exports, __webpack_require__) { 38519 38520 'use strict'; 38521 38522 var _Object$create = __webpack_require__(34)['default']; 38523 38524 var _Object$keys = __webpack_require__(13)['default']; 38525 38526 var _interopRequireWildcard = __webpack_require__(3)['default']; 38527 38528 exports.__esModule = true; 38529 exports.createProtoAccessControl = createProtoAccessControl; 38530 exports.resultIsAllowed = resultIsAllowed; 38531 exports.resetLoggedProperties = resetLoggedProperties; 38532 38533 var _createNewLookupObject = __webpack_require__(36); 38534 38535 var _logger = __webpack_require__(32); 38536 38537 var logger = _interopRequireWildcard(_logger); 38538 38539 var loggedProperties = _Object$create(null); 38540 38541 function createProtoAccessControl(runtimeOptions) { 38542 var defaultMethodWhiteList = _Object$create(null); 38543 defaultMethodWhiteList['constructor'] = false; 38544 defaultMethodWhiteList['__defineGetter__'] = false; 38545 defaultMethodWhiteList['__defineSetter__'] = false; 38546 defaultMethodWhiteList['__lookupGetter__'] = false; 38547 38548 var defaultPropertyWhiteList = _Object$create(null); 38549 // eslint-disable-next-line no-proto 38550 defaultPropertyWhiteList['__proto__'] = false; 38551 38552 return { 38553 properties: { 38554 whitelist: _createNewLookupObject.createNewLookupObject(defaultPropertyWhiteList, runtimeOptions.allowedProtoProperties), 38555 defaultValue: runtimeOptions.allowProtoPropertiesByDefault 38556 }, 38557 methods: { 38558 whitelist: _createNewLookupObject.createNewLookupObject(defaultMethodWhiteList, runtimeOptions.allowedProtoMethods), 38559 defaultValue: runtimeOptions.allowProtoMethodsByDefault 38560 } 38561 }; 38562 } 38563 38564 function resultIsAllowed(result, protoAccessControl, propertyName) { 38565 if (typeof result === 'function') { 38566 return checkWhiteList(protoAccessControl.methods, propertyName); 38567 } else { 38568 return checkWhiteList(protoAccessControl.properties, propertyName); 38569 } 38570 } 38571 38572 function checkWhiteList(protoAccessControlForType, propertyName) { 38573 if (protoAccessControlForType.whitelist[propertyName] !== undefined) { 38574 return protoAccessControlForType.whitelist[propertyName] === true; 38575 } 38576 if (protoAccessControlForType.defaultValue !== undefined) { 38577 return protoAccessControlForType.defaultValue; 38578 } 38579 logUnexpecedPropertyAccessOnce(propertyName); 38580 return false; 38581 } 38582 38583 function logUnexpecedPropertyAccessOnce(propertyName) { 38584 if (loggedProperties[propertyName] !== true) { 38585 loggedProperties[propertyName] = true; 38586 logger.log('error', 'Handlebars: Access has been denied to resolve the property "' + propertyName + '" because it is not an "own property" of its parent.\n' + 'You can add a runtime option to disable the check or this warning:\n' + 'See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details'); 38587 } 38588 } 38589 38590 function resetLoggedProperties() { 38591 _Object$keys(loggedProperties).forEach(function (propertyName) { 38592 delete loggedProperties[propertyName]; 38593 }); 38594 } 38595 38596 /***/ 38597}), 38598/* 34 */ 38599/***/ (function (module, exports, __webpack_require__) { 38600 38601 module.exports = { "default": __webpack_require__(35), __esModule: true }; 38602 38603 /***/ 38604}), 38605/* 35 */ 38606/***/ (function (module, exports, __webpack_require__) { 38607 38608 var $ = __webpack_require__(9); 38609 module.exports = function create(P, D) { 38610 return $.create(P, D); 38611 }; 38612 38613 /***/ 38614}), 38615/* 36 */ 38616/***/ (function (module, exports, __webpack_require__) { 38617 38618 'use strict'; 38619 38620 var _Object$create = __webpack_require__(34)['default']; 38621 38622 exports.__esModule = true; 38623 exports.createNewLookupObject = createNewLookupObject; 38624 38625 var _utils = __webpack_require__(5); 38626 38627 /** 38628 * Create a new object with "null"-prototype to avoid truthy results on prototype properties. 38629 * The resulting object can be used with "object[property]" to check if a property exists 38630 * @param {...object} sources a varargs parameter of source objects that will be merged 38631 * @returns {object} 38632 */ 38633 38634 function createNewLookupObject() { 38635 for (var _len = arguments.length, sources = Array(_len), _key = 0; _key < _len; _key++) { 38636 sources[_key] = arguments[_key]; 38637 } 38638 38639 return _utils.extend.apply(undefined, [_Object$create(null)].concat(sources)); 38640 } 38641 38642 /***/ 38643}), 38644/* 37 */ 38645/***/ (function (module, exports) { 38646 38647 // Build out our basic SafeString type 38648 'use strict'; 38649 38650 exports.__esModule = true; 38651 function SafeString(string) { 38652 this.string = string; 38653 } 38654 38655 SafeString.prototype.toString = SafeString.prototype.toHTML = function () { 38656 return '' + this.string; 38657 }; 38658 38659 exports['default'] = SafeString; 38660 module.exports = exports['default']; 38661 38662 /***/ 38663}), 38664/* 38 */ 38665/***/ (function (module, exports, __webpack_require__) { 38666 38667 'use strict'; 38668 38669 var _Object$seal = __webpack_require__(39)['default']; 38670 38671 var _Object$keys = __webpack_require__(13)['default']; 38672 38673 var _interopRequireWildcard = __webpack_require__(3)['default']; 38674 38675 var _interopRequireDefault = __webpack_require__(1)['default']; 38676 38677 exports.__esModule = true; 38678 exports.checkRevision = checkRevision; 38679 exports.template = template; 38680 exports.wrapProgram = wrapProgram; 38681 exports.resolvePartial = resolvePartial; 38682 exports.invokePartial = invokePartial; 38683 exports.noop = noop; 38684 38685 var _utils = __webpack_require__(5); 38686 38687 var Utils = _interopRequireWildcard(_utils); 38688 38689 var _exception = __webpack_require__(6); 38690 38691 var _exception2 = _interopRequireDefault(_exception); 38692 38693 var _base = __webpack_require__(4); 38694 38695 var _helpers = __webpack_require__(10); 38696 38697 var _internalWrapHelper = __webpack_require__(43); 38698 38699 var _internalProtoAccess = __webpack_require__(33); 38700 38701 function checkRevision(compilerInfo) { 38702 var compilerRevision = compilerInfo && compilerInfo[0] || 1, 38703 currentRevision = _base.COMPILER_REVISION; 38704 38705 if (compilerRevision >= _base.LAST_COMPATIBLE_COMPILER_REVISION && compilerRevision <= _base.COMPILER_REVISION) { 38706 return; 38707 } 38708 38709 if (compilerRevision < _base.LAST_COMPATIBLE_COMPILER_REVISION) { 38710 var runtimeVersions = _base.REVISION_CHANGES[currentRevision], 38711 compilerVersions = _base.REVISION_CHANGES[compilerRevision]; 38712 throw new _exception2['default']('Template was precompiled with an older version of Handlebars than the current runtime. ' + 'Please update your precompiler to a newer version (' + runtimeVersions + ') or downgrade your runtime to an older version (' + compilerVersions + ').'); 38713 } else { 38714 // Use the embedded version info since the runtime doesn't know about this revision yet 38715 throw new _exception2['default']('Template was precompiled with a newer version of Handlebars than the current runtime. ' + 'Please update your runtime to a newer version (' + compilerInfo[1] + ').'); 38716 } 38717 } 38718 38719 function template(templateSpec, env) { 38720 /* istanbul ignore next */ 38721 if (!env) { 38722 throw new _exception2['default']('No environment passed to template'); 38723 } 38724 if (!templateSpec || !templateSpec.main) { 38725 throw new _exception2['default']('Unknown template object: ' + typeof templateSpec); 38726 } 38727 38728 templateSpec.main.decorator = templateSpec.main_d; 38729 38730 // Note: Using env.VM references rather than local var references throughout this section to allow 38731 // for external users to override these as pseudo-supported APIs. 38732 env.VM.checkRevision(templateSpec.compiler); 38733 38734 // backwards compatibility for precompiled templates with compiler-version 7 (<4.3.0) 38735 var templateWasPrecompiledWithCompilerV7 = templateSpec.compiler && templateSpec.compiler[0] === 7; 38736 38737 function invokePartialWrapper(partial, context, options) { 38738 if (options.hash) { 38739 context = Utils.extend({}, context, options.hash); 38740 if (options.ids) { 38741 options.ids[0] = true; 38742 } 38743 } 38744 partial = env.VM.resolvePartial.call(this, partial, context, options); 38745 38746 var extendedOptions = Utils.extend({}, options, { 38747 hooks: this.hooks, 38748 protoAccessControl: this.protoAccessControl 38749 }); 38750 38751 var result = env.VM.invokePartial.call(this, partial, context, extendedOptions); 38752 38753 if (result == null && env.compile) { 38754 options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env); 38755 result = options.partials[options.name](context, extendedOptions); 38756 } 38757 if (result != null) { 38758 if (options.indent) { 38759 var lines = result.split('\n'); 38760 for (var i = 0, l = lines.length; i < l; i++) { 38761 if (!lines[i] && i + 1 === l) { 38762 break; 38763 } 38764 38765 lines[i] = options.indent + lines[i]; 38766 } 38767 result = lines.join('\n'); 38768 } 38769 return result; 38770 } else { 38771 throw new _exception2['default']('The partial ' + options.name + ' could not be compiled when running in runtime-only mode'); 38772 } 38773 } 38774 38775 // Just add water 38776 var container = { 38777 strict: function strict(obj, name, loc) { 38778 if (!obj || !(name in obj)) { 38779 throw new _exception2['default']('"' + name + '" not defined in ' + obj, { 38780 loc: loc 38781 }); 38782 } 38783 return container.lookupProperty(obj, name); 38784 }, 38785 lookupProperty: function lookupProperty(parent, propertyName) { 38786 var result = parent[propertyName]; 38787 if (result == null) { 38788 return result; 38789 } 38790 if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { 38791 return result; 38792 } 38793 38794 if (_internalProtoAccess.resultIsAllowed(result, container.protoAccessControl, propertyName)) { 38795 return result; 38796 } 38797 return undefined; 38798 }, 38799 lookup: function lookup(depths, name) { 38800 var len = depths.length; 38801 for (var i = 0; i < len; i++) { 38802 var result = depths[i] && container.lookupProperty(depths[i], name); 38803 if (result != null) { 38804 return depths[i][name]; 38805 } 38806 } 38807 }, 38808 lambda: function lambda(current, context) { 38809 return typeof current === 'function' ? current.call(context) : current; 38810 }, 38811 38812 escapeExpression: Utils.escapeExpression, 38813 invokePartial: invokePartialWrapper, 38814 38815 fn: function fn(i) { 38816 var ret = templateSpec[i]; 38817 ret.decorator = templateSpec[i + '_d']; 38818 return ret; 38819 }, 38820 38821 programs: [], 38822 program: function program(i, data, declaredBlockParams, blockParams, depths) { 38823 var programWrapper = this.programs[i], 38824 fn = this.fn(i); 38825 if (data || depths || blockParams || declaredBlockParams) { 38826 programWrapper = wrapProgram(this, i, fn, data, declaredBlockParams, blockParams, depths); 38827 } else if (!programWrapper) { 38828 programWrapper = this.programs[i] = wrapProgram(this, i, fn); 38829 } 38830 return programWrapper; 38831 }, 38832 38833 data: function data(value, depth) { 38834 while (value && depth--) { 38835 value = value._parent; 38836 } 38837 return value; 38838 }, 38839 mergeIfNeeded: function mergeIfNeeded(param, common) { 38840 var obj = param || common; 38841 38842 if (param && common && param !== common) { 38843 obj = Utils.extend({}, common, param); 38844 } 38845 38846 return obj; 38847 }, 38848 // An empty object to use as replacement for null-contexts 38849 nullContext: _Object$seal({}), 38850 38851 noop: env.VM.noop, 38852 compilerInfo: templateSpec.compiler 38853 }; 38854 38855 function ret(context) { 38856 var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; 38857 38858 var data = options.data; 38859 38860 ret._setup(options); 38861 if (!options.partial && templateSpec.useData) { 38862 data = initData(context, data); 38863 } 38864 var depths = undefined, 38865 blockParams = templateSpec.useBlockParams ? [] : undefined; 38866 if (templateSpec.useDepths) { 38867 if (options.depths) { 38868 depths = context != options.depths[0] ? [context].concat(options.depths) : options.depths; 38869 } else { 38870 depths = [context]; 38871 } 38872 } 38873 38874 function main(context /*, options*/) { 38875 return '' + templateSpec.main(container, context, container.helpers, container.partials, data, blockParams, depths); 38876 } 38877 38878 main = executeDecorators(templateSpec.main, main, container, options.depths || [], data, blockParams); 38879 return main(context, options); 38880 } 38881 38882 ret.isTop = true; 38883 38884 ret._setup = function (options) { 38885 if (!options.partial) { 38886 var mergedHelpers = Utils.extend({}, env.helpers, options.helpers); 38887 wrapHelpersToPassLookupProperty(mergedHelpers, container); 38888 container.helpers = mergedHelpers; 38889 38890 if (templateSpec.usePartial) { 38891 // Use mergeIfNeeded here to prevent compiling global partials multiple times 38892 container.partials = container.mergeIfNeeded(options.partials, env.partials); 38893 } 38894 if (templateSpec.usePartial || templateSpec.useDecorators) { 38895 container.decorators = Utils.extend({}, env.decorators, options.decorators); 38896 } 38897
vendor: 4,727 bytes, lines 38898-39026
38898 container.hooks = {}; 38899 container.protoAccessControl = _internalProtoAccess.createProtoAccessControl(options); 38900 38901 var keepHelperInHelpers = options.allowCallsToHelperMissing || templateWasPrecompiledWithCompilerV7; 38902 _helpers.moveHelperToHooks(container, 'helperMissing', keepHelperInHelpers); 38903 _helpers.moveHelperToHooks(container, 'blockHelperMissing', keepHelperInHelpers); 38904 } else { 38905 container.protoAccessControl = options.protoAccessControl; // internal option 38906 container.helpers = options.helpers; 38907 container.partials = options.partials; 38908 container.decorators = options.decorators; 38909 container.hooks = options.hooks; 38910 } 38911 }; 38912 38913 ret._child = function (i, data, blockParams, depths) { 38914 if (templateSpec.useBlockParams && !blockParams) { 38915 throw new _exception2['default']('must pass block params'); 38916 } 38917 if (templateSpec.useDepths && !depths) { 38918 throw new _exception2['default']('must pass parent depths'); 38919 } 38920 38921 return wrapProgram(container, i, templateSpec[i], data, 0, blockParams, depths); 38922 }; 38923 return ret; 38924 } 38925 38926 function wrapProgram(container, i, fn, data, declaredBlockParams, blockParams, depths) { 38927 function prog(context) { 38928 var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; 38929 38930 var currentDepths = depths; 38931 if (depths && context != depths[0] && !(context === container.nullContext && depths[0] === null)) { 38932 currentDepths = [context].concat(depths); 38933 } 38934 38935 return fn(container, context, container.helpers, container.partials, options.data || data, blockParams && [options.blockParams].concat(blockParams), currentDepths); 38936 } 38937 38938 prog = executeDecorators(fn, prog, container, depths, data, blockParams); 38939 38940 prog.program = i; 38941 prog.depth = depths ? depths.length : 0; 38942 prog.blockParams = declaredBlockParams || 0; 38943 return prog; 38944 } 38945 38946 /** 38947 * This is currently part of the official API, therefore implementation details should not be changed. 38948 */ 38949 38950 function resolvePartial(partial, context, options) { 38951 if (!partial) { 38952 if (options.name === '@partial-block') { 38953 partial = options.data['partial-block']; 38954 } else { 38955 partial = options.partials[options.name]; 38956 } 38957 } else if (!partial.call && !options.name) { 38958 // This is a dynamic partial that returned a string 38959 options.name = partial; 38960 partial = options.partials[partial]; 38961 } 38962 return partial; 38963 } 38964 38965 function invokePartial(partial, context, options) { 38966 // Use the current closure context to save the partial-block if this partial 38967 var currentPartialBlock = options.data && options.data['partial-block']; 38968 options.partial = true; 38969 if (options.ids) { 38970 options.data.contextPath = options.ids[0] || options.data.contextPath; 38971 } 38972 38973 var partialBlock = undefined; 38974 if (options.fn && options.fn !== noop) { 38975 (function () { 38976 options.data = _base.createFrame(options.data); 38977 // Wrapper function to get access to currentPartialBlock from the closure 38978 var fn = options.fn; 38979 partialBlock = options.data['partial-block'] = function partialBlockWrapper(context) { 38980 var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; 38981 38982 // Restore the partial-block from the closure for the execution of the block 38983 // i.e. the part inside the block of the partial call. 38984 options.data = _base.createFrame(options.data); 38985 options.data['partial-block'] = currentPartialBlock; 38986 return fn(context, options); 38987 }; 38988 if (fn.partials) { 38989 options.partials = Utils.extend({}, options.partials, fn.partials); 38990 } 38991 })(); 38992 } 38993 38994 if (partial === undefined && partialBlock) { 38995 partial = partialBlock; 38996 } 38997 38998 if (partial === undefined) { 38999 throw new _exception2['default']('The partial ' + options.name + ' could not be found'); 39000 } else if (partial instanceof Function) { 39001 return partial(context, options); 39002 } 39003 } 39004 39005 function noop() { 39006 return ''; 39007 } 39008 39009 function initData(context, data) { 39010 if (!data || !('root' in data)) { 39011 data = data ? _base.createFrame(data) : {}; 39012 data.root = context; 39013 } 39014 return data; 39015 } 39016 39017 function executeDecorators(fn, prog, container, depths, data, blockParams) { 39018 if (fn.decorator) { 39019 var props = {}; 39020 prog = fn.decorator(prog, props, container, depths && depths[0], data, blockParams, depths); 39021 Utils.extend(prog, props); 39022 } 39023 return prog; 39024 } 39025 39026 function wrapHelpersToPassLookupProperty(mergedHelpers, container) {
vendor: 12,456 bytes, lines 39027-39343
39027 _Object$keys(mergedHelpers).forEach(function (helperName) { 39028 var helper = mergedHelpers[helperName]; 39029 mergedHelpers[helperName] = passLookupPropertyOption(helper, container); 39030 }); 39031 } 39032 39033 function passLookupPropertyOption(helper, container) { 39034 var lookupProperty = container.lookupProperty; 39035 return _internalWrapHelper.wrapHelper(helper, function (options) { 39036 return Utils.extend({ lookupProperty: lookupProperty }, options); 39037 }); 39038 } 39039 39040 /***/ 39041}), 39042/* 39 */ 39043/***/ (function (module, exports, __webpack_require__) { 39044 39045 module.exports = { "default": __webpack_require__(40), __esModule: true }; 39046 39047 /***/ 39048}), 39049/* 40 */ 39050/***/ (function (module, exports, __webpack_require__) { 39051 39052 __webpack_require__(41); 39053 module.exports = __webpack_require__(21).Object.seal; 39054 39055 /***/ 39056}), 39057/* 41 */ 39058/***/ (function (module, exports, __webpack_require__) { 39059 39060 // 19.1.2.17 Object.seal(O) 39061 var isObject = __webpack_require__(42); 39062 39063 __webpack_require__(18)('seal', function ($seal) { 39064 return function seal(it) { 39065 return $seal && isObject(it) ? $seal(it) : it; 39066 }; 39067 }); 39068 39069 /***/ 39070}), 39071/* 42 */ 39072/***/ (function (module, exports) { 39073 39074 module.exports = function (it) { 39075 return typeof it === 'object' ? it !== null : typeof it === 'function'; 39076 }; 39077 39078 /***/ 39079}), 39080/* 43 */ 39081/***/ (function (module, exports) { 39082 39083 'use strict'; 39084 39085 exports.__esModule = true; 39086 exports.wrapHelper = wrapHelper; 39087 39088 function wrapHelper(helper, transformOptionsFn) { 39089 if (typeof helper !== 'function') { 39090 // This should not happen, but apparently it does in https://github.com/wycats/handlebars.js/issues/1639 39091 // We try to make the wrapper least-invasive by not wrapping it, if the helper is not a function. 39092 return helper; 39093 } 39094 var wrapper = function wrapper() /* dynamic arguments */ { 39095 var options = arguments[arguments.length - 1]; 39096 arguments[arguments.length - 1] = transformOptionsFn(options); 39097 return helper.apply(this, arguments); 39098 }; 39099 return wrapper; 39100 } 39101 39102 /***/ 39103}), 39104/* 44 */ 39105/***/ (function (module, exports) { 39106 39107 /* WEBPACK VAR INJECTION */(function (global) { 39108 'use strict'; 39109 39110 exports.__esModule = true; 39111 39112 exports['default'] = function (Handlebars) { 39113 /* istanbul ignore next */ 39114 var root = typeof global !== 'undefined' ? global : window, 39115 $Handlebars = root.Handlebars; 39116 /* istanbul ignore next */ 39117 Handlebars.noConflict = function () { 39118 if (root.Handlebars === Handlebars) { 39119 root.Handlebars = $Handlebars; 39120 } 39121 return Handlebars; 39122 }; 39123 }; 39124 39125 module.exports = exports['default']; 39126 /* WEBPACK VAR INJECTION */ 39127}.call(exports, (function () { return this; }()))) 39128 39129 /***/ 39130}), 39131/* 45 */ 39132/***/ (function (module, exports) { 39133 39134 'use strict'; 39135 39136 exports.__esModule = true; 39137 var AST = { 39138 // Public API used to evaluate derived attributes regarding AST nodes 39139 helpers: { 39140 // a mustache is definitely a helper if: 39141 // * it is an eligible helper, and 39142 // * it has at least one parameter or hash segment 39143 helperExpression: function helperExpression(node) { 39144 return node.type === 'SubExpression' || (node.type === 'MustacheStatement' || node.type === 'BlockStatement') && !!(node.params && node.params.length || node.hash); 39145 }, 39146 39147 scopedId: function scopedId(path) { 39148 return (/^\.|this\b/.test(path.original) 39149 ); 39150 }, 39151 39152 // an ID is simple if it only has one part, and that part is not 39153 // `..` or `this`. 39154 simpleId: function simpleId(path) { 39155 return path.parts.length === 1 && !AST.helpers.scopedId(path) && !path.depth; 39156 } 39157 } 39158 }; 39159 39160 // Must be exported as an object rather than the root of the module as the jison lexer 39161 // must modify the object to operate properly. 39162 exports['default'] = AST; 39163 module.exports = exports['default']; 39164 39165 /***/ 39166}), 39167/* 46 */ 39168/***/ (function (module, exports, __webpack_require__) { 39169 39170 'use strict'; 39171 39172 var _interopRequireDefault = __webpack_require__(1)['default']; 39173 39174 var _interopRequireWildcard = __webpack_require__(3)['default']; 39175 39176 exports.__esModule = true; 39177 exports.parseWithoutProcessing = parseWithoutProcessing; 39178 exports.parse = parse; 39179 39180 var _parser = __webpack_require__(47); 39181 39182 var _parser2 = _interopRequireDefault(_parser); 39183 39184 var _whitespaceControl = __webpack_require__(48); 39185 39186 var _whitespaceControl2 = _interopRequireDefault(_whitespaceControl); 39187 39188 var _helpers = __webpack_require__(50); 39189 39190 var Helpers = _interopRequireWildcard(_helpers); 39191 39192 var _utils = __webpack_require__(5); 39193 39194 exports.parser = _parser2['default']; 39195 39196 var yy = {}; 39197 _utils.extend(yy, Helpers); 39198 39199 function parseWithoutProcessing(input, options) { 39200 // Just return if an already-compiled AST was passed in. 39201 if (input.type === 'Program') { 39202 return input; 39203 } 39204 39205 _parser2['default'].yy = yy; 39206 39207 // Altering the shared object here, but this is ok as parser is a sync operation 39208 yy.locInfo = function (locInfo) { 39209 return new yy.SourceLocation(options && options.srcName, locInfo); 39210 }; 39211 39212 var ast = _parser2['default'].parse(input); 39213 39214 return ast; 39215 } 39216 39217 function parse(input, options) { 39218 var ast = parseWithoutProcessing(input, options); 39219 var strip = new _whitespaceControl2['default'](options); 39220 39221 return strip.accept(ast); 39222 } 39223 39224 /***/ 39225}), 39226/* 47 */ 39227/***/ (function (module, exports) { 39228 39229 // File ignored in coverage tests via setting in .istanbul.yml 39230 /* Jison generated parser */ 39231 "use strict"; 39232 39233 exports.__esModule = true; 39234 var handlebars = (function () { 39235 var parser = { 39236 trace: function trace() { }, 39237 yy: {}, 39238 symbols_: { "error": 2, "root": 3, "program": 4, "EOF": 5, "program_repetition0": 6, "statement": 7, "mustache": 8, "block": 9, "rawBlock": 10, "partial": 11, "partialBlock": 12, "content": 13, "COMMENT": 14, "CONTENT": 15, "openRawBlock": 16, "rawBlock_repetition0": 17, "END_RAW_BLOCK": 18, "OPEN_RAW_BLOCK": 19, "helperName": 20, "openRawBlock_repetition0": 21, "openRawBlock_option0": 22, "CLOSE_RAW_BLOCK": 23, "openBlock": 24, "block_option0": 25, "closeBlock": 26, "openInverse": 27, "block_option1": 28, "OPEN_BLOCK": 29, "openBlock_repetition0": 30, "openBlock_option0": 31, "openBlock_option1": 32, "CLOSE": 33, "OPEN_INVERSE": 34, "openInverse_repetition0": 35, "openInverse_option0": 36, "openInverse_option1": 37, "openInverseChain": 38, "OPEN_INVERSE_CHAIN": 39, "openInverseChain_repetition0": 40, "openInverseChain_option0": 41, "openInverseChain_option1": 42, "inverseAndProgram": 43, "INVERSE": 44, "inverseChain": 45, "inverseChain_option0": 46, "OPEN_ENDBLOCK": 47, "OPEN": 48, "mustache_repetition0": 49, "mustache_option0": 50, "OPEN_UNESCAPED": 51, "mustache_repetition1": 52, "mustache_option1": 53, "CLOSE_UNESCAPED": 54, "OPEN_PARTIAL": 55, "partialName": 56, "partial_repetition0": 57, "partial_option0": 58, "openPartialBlock": 59, "OPEN_PARTIAL_BLOCK": 60, "openPartialBlock_repetition0": 61, "openPartialBlock_option0": 62, "param": 63, "sexpr": 64, "OPEN_SEXPR": 65, "sexpr_repetition0": 66, "sexpr_option0": 67, "CLOSE_SEXPR": 68, "hash": 69, "hash_repetition_plus0": 70, "hashSegment": 71, "ID": 72, "EQUALS": 73, "blockParams": 74, "OPEN_BLOCK_PARAMS": 75, "blockParams_repetition_plus0": 76, "CLOSE_BLOCK_PARAMS": 77, "path": 78, "dataName": 79, "STRING": 80, "NUMBER": 81, "BOOLEAN": 82, "UNDEFINED": 83, "NULL": 84, "DATA": 85, "pathSegments": 86, "SEP": 87, "$accept": 0, "$end": 1 }, 39239 terminals_: { 2: "error", 5: "EOF", 14: "COMMENT", 15: "CONTENT", 18: "END_RAW_BLOCK", 19: "OPEN_RAW_BLOCK", 23: "CLOSE_RAW_BLOCK", 29: "OPEN_BLOCK", 33: "CLOSE", 34: "OPEN_INVERSE", 39: "OPEN_INVERSE_CHAIN", 44: "INVERSE", 47: "OPEN_ENDBLOCK", 48: "OPEN", 51: "OPEN_UNESCAPED", 54: "CLOSE_UNESCAPED", 55: "OPEN_PARTIAL", 60: "OPEN_PARTIAL_BLOCK", 65: "OPEN_SEXPR", 68: "CLOSE_SEXPR", 72: "ID", 73: "EQUALS", 75: "OPEN_BLOCK_PARAMS", 77: "CLOSE_BLOCK_PARAMS", 80: "STRING", 81: "NUMBER", 82: "BOOLEAN", 83: "UNDEFINED", 84: "NULL", 85: "DATA", 87: "SEP" }, 39240 productions_: [0, [3, 2], [4, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [13, 1], [10, 3], [16, 5], [9, 4], [9, 4], [24, 6], [27, 6], [38, 6], [43, 2], [45, 3], [45, 1], [26, 3], [8, 5], [8, 5], [11, 5], [12, 3], [59, 5], [63, 1], [63, 1], [64, 5], [69, 1], [71, 3], [74, 3], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [56, 1], [56, 1], [79, 2], [78, 1], [86, 3], [86, 1], [6, 0], [6, 2], [17, 0], [17, 2], [21, 0], [21, 2], [22, 0], [22, 1], [25, 0], [25, 1], [28, 0], [28, 1], [30, 0], [30, 2], [31, 0], [31, 1], [32, 0], [32, 1], [35, 0], [35, 2], [36, 0], [36, 1], [37, 0], [37, 1], [40, 0], [40, 2], [41, 0], [41, 1], [42, 0], [42, 1], [46, 0], [46, 1], [49, 0], [49, 2], [50, 0], [50, 1], [52, 0], [52, 2], [53, 0], [53, 1], [57, 0], [57, 2], [58, 0], [58, 1], [61, 0], [61, 2], [62, 0], [62, 1], [66, 0], [66, 2], [67, 0], [67, 1], [70, 1], [70, 2], [76, 1], [76, 2]], 39241 performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) { 39242 39243 var $0 = $$.length - 1; 39244 switch (yystate) { 39245 case 1: 39246 return $$[$0 - 1]; 39247 break; 39248 case 2: 39249 this.$ = yy.prepareProgram($$[$0]); 39250 break; 39251 case 3: 39252 this.$ = $$[$0]; 39253 break; 39254 case 4: 39255 this.$ = $$[$0]; 39256 break; 39257 case 5: 39258 this.$ = $$[$0]; 39259 break; 39260 case 6: 39261 this.$ = $$[$0]; 39262 break; 39263 case 7: 39264 this.$ = $$[$0]; 39265 break; 39266 case 8: 39267 this.$ = $$[$0]; 39268 break; 39269 case 9: 39270 this.$ = { 39271 type: 'CommentStatement', 39272 value: yy.stripComment($$[$0]), 39273 strip: yy.stripFlags($$[$0], $$[$0]), 39274 loc: yy.locInfo(this._$) 39275 }; 39276 39277 break; 39278 case 10: 39279 this.$ = { 39280 type: 'ContentStatement', 39281 original: $$[$0], 39282 value: $$[$0], 39283 loc: yy.locInfo(this._$) 39284 }; 39285 39286 break; 39287 case 11: 39288 this.$ = yy.prepareRawBlock($$[$0 - 2], $$[$0 - 1], $$[$0], this._$); 39289 break; 39290 case 12: 39291 this.$ = { path: $$[$0 - 3], params: $$[$0 - 2], hash: $$[$0 - 1] }; 39292 break; 39293 case 13: 39294 this.$ = yy.prepareBlock($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0], false, this._$); 39295 break; 39296 case 14: 39297 this.$ = yy.prepareBlock($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0], true, this._$); 39298 break; 39299 case 15: 39300 this.$ = { open: $$[$0 - 5], path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) }; 39301 break; 39302 case 16: 39303 this.$ = { path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) }; 39304 break; 39305 case 17: 39306 this.$ = { path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) }; 39307 break; 39308 case 18: 39309 this.$ = { strip: yy.stripFlags($$[$0 - 1], $$[$0 - 1]), program: $$[$0] }; 39310 break; 39311 case 19: 39312 var inverse = yy.prepareBlock($$[$0 - 2], $$[$0 - 1], $$[$0], $$[$0], false, this._$), 39313 program = yy.prepareProgram([inverse], $$[$0 - 1].loc); 39314 program.chained = true; 39315 39316 this.$ = { strip: $$[$0 - 2].strip, program: program, chain: true }; 39317 39318 break; 39319 case 20: 39320 this.$ = $$[$0]; 39321 break; 39322 case 21: 39323 this.$ = { path: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 2], $$[$0]) }; 39324 break; 39325 case 22: 39326 this.$ = yy.prepareMustache($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0 - 4], yy.stripFlags($$[$0 - 4], $$[$0]), this._$); 39327 break; 39328 case 23: 39329 this.$ = yy.prepareMustache($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0 - 4], yy.stripFlags($$[$0 - 4], $$[$0]), this._$); 39330 break; 39331 case 24: 39332 this.$ = { 39333 type: 'PartialStatement', 39334 name: $$[$0 - 3], 39335 params: $$[$0 - 2], 39336 hash: $$[$0 - 1], 39337 indent: '', 39338 strip: yy.stripFlags($$[$0 - 4], $$[$0]), 39339 loc: yy.locInfo(this._$) 39340 }; 39341 39342 break; 39343 case 25:
vendor: 3,918 bytes, lines 39344-39493
39344 this.$ = yy.preparePartialBlock($$[$0 - 2], $$[$0 - 1], $$[$0], this._$); 39345 break; 39346 case 26: 39347 this.$ = { path: $$[$0 - 3], params: $$[$0 - 2], hash: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 4], $$[$0]) }; 39348 break; 39349 case 27: 39350 this.$ = $$[$0]; 39351 break; 39352 case 28: 39353 this.$ = $$[$0]; 39354 break; 39355 case 29: 39356 this.$ = { 39357 type: 'SubExpression', 39358 path: $$[$0 - 3], 39359 params: $$[$0 - 2], 39360 hash: $$[$0 - 1], 39361 loc: yy.locInfo(this._$) 39362 }; 39363 39364 break; 39365 case 30: 39366 this.$ = { type: 'Hash', pairs: $$[$0], loc: yy.locInfo(this._$) }; 39367 break; 39368 case 31: 39369 this.$ = { type: 'HashPair', key: yy.id($$[$0 - 2]), value: $$[$0], loc: yy.locInfo(this._$) }; 39370 break; 39371 case 32: 39372 this.$ = yy.id($$[$0 - 1]); 39373 break; 39374 case 33: 39375 this.$ = $$[$0]; 39376 break; 39377 case 34: 39378 this.$ = $$[$0]; 39379 break; 39380 case 35: 39381 this.$ = { type: 'StringLiteral', value: $$[$0], original: $$[$0], loc: yy.locInfo(this._$) }; 39382 break; 39383 case 36: 39384 this.$ = { type: 'NumberLiteral', value: Number($$[$0]), original: Number($$[$0]), loc: yy.locInfo(this._$) }; 39385 break; 39386 case 37: 39387 this.$ = { type: 'BooleanLiteral', value: $$[$0] === 'true', original: $$[$0] === 'true', loc: yy.locInfo(this._$) }; 39388 break; 39389 case 38: 39390 this.$ = { type: 'UndefinedLiteral', original: undefined, value: undefined, loc: yy.locInfo(this._$) }; 39391 break; 39392 case 39: 39393 this.$ = { type: 'NullLiteral', original: null, value: null, loc: yy.locInfo(this._$) }; 39394 break; 39395 case 40: 39396 this.$ = $$[$0]; 39397 break; 39398 case 41: 39399 this.$ = $$[$0]; 39400 break; 39401 case 42: 39402 this.$ = yy.preparePath(true, $$[$0], this._$); 39403 break; 39404 case 43: 39405 this.$ = yy.preparePath(false, $$[$0], this._$); 39406 break; 39407 case 44: 39408 $$[$0 - 2].push({ part: yy.id($$[$0]), original: $$[$0], separator: $$[$0 - 1] }); this.$ = $$[$0 - 2]; 39409 break; 39410 case 45: 39411 this.$ = [{ part: yy.id($$[$0]), original: $$[$0] }]; 39412 break; 39413 case 46: 39414 this.$ = []; 39415 break; 39416 case 47: 39417 $$[$0 - 1].push($$[$0]); 39418 break; 39419 case 48: 39420 this.$ = []; 39421 break; 39422 case 49: 39423 $$[$0 - 1].push($$[$0]); 39424 break; 39425 case 50: 39426 this.$ = []; 39427 break; 39428 case 51: 39429 $$[$0 - 1].push($$[$0]); 39430 break; 39431 case 58: 39432 this.$ = []; 39433 break; 39434 case 59: 39435 $$[$0 - 1].push($$[$0]); 39436 break; 39437 case 64: 39438 this.$ = []; 39439 break; 39440 case 65: 39441 $$[$0 - 1].push($$[$0]); 39442 break; 39443 case 70: 39444 this.$ = []; 39445 break; 39446 case 71: 39447 $$[$0 - 1].push($$[$0]); 39448 break; 39449 case 78: 39450 this.$ = []; 39451 break; 39452 case 79: 39453 $$[$0 - 1].push($$[$0]); 39454 break; 39455 case 82: 39456 this.$ = []; 39457 break; 39458 case 83: 39459 $$[$0 - 1].push($$[$0]); 39460 break; 39461 case 86: 39462 this.$ = []; 39463 break; 39464 case 87: 39465 $$[$0 - 1].push($$[$0]); 39466 break; 39467 case 90: 39468 this.$ = []; 39469 break; 39470 case 91: 39471 $$[$0 - 1].push($$[$0]); 39472 break; 39473 case 94: 39474 this.$ = []; 39475 break; 39476 case 95: 39477 $$[$0 - 1].push($$[$0]); 39478 break; 39479 case 98: 39480 this.$ = [$$[$0]]; 39481 break; 39482 case 99: 39483 $$[$0 - 1].push($$[$0]); 39484 break; 39485 case 100: 39486 this.$ = [$$[$0]]; 39487 break; 39488 case 101: 39489 $$[$0 - 1].push($$[$0]); 39490 break; 39491 } 39492 }, 39493
vendor: 14,904 bytes, line 39493
39493table: [{ 3: 1, 4: 2, 5: [2, 46], 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 1: [3] }, { 5: [1, 4] }, { 5: [2, 2], 7: 5, 8: 6, 9: 7, 10: 8, 11: 9, 12: 10, 13: 11, 14: [1, 12], 15: [1, 20], 16: 17, 19: [1, 23], 24: 15, 27: 16, 29: [1, 21], 34: [1, 22], 39: [2, 2], 44: [2, 2], 47: [2, 2], 48: [1, 13], 51: [1, 14], 55: [1, 18], 59: 19, 60: [1, 24] }, { 1: [2, 1] }, { 5: [2, 47], 14: [2, 47], 15: [2, 47], 19: [2, 47], 29: [2, 47], 34: [2, 47], 39: [2, 47], 44: [2, 47], 47: [2, 47], 48: [2, 47], 51: [2, 47], 55: [2, 47], 60: [2, 47] }, { 5: [2, 3], 14: [2, 3], 15: [2, 3], 19: [2, 3], 29: [2, 3], 34: [2, 3], 39: [2, 3], 44: [2, 3], 47: [2, 3], 48: [2, 3], 51: [2, 3], 55: [2, 3], 60: [2, 3] }, { 5: [2, 4], 14: [2, 4], 15: [2, 4], 19: [2, 4], 29: [2, 4], 34: [2, 4], 39: [2, 4], 44: [2, 4], 47: [2, 4], 48: [2, 4], 51: [2, 4], 55: [2, 4], 60: [2, 4] }, { 5: [2, 5], 14: [2, 5], 15: [2, 5], 19: [2, 5], 29: [2, 5], 34: [2, 5], 39: [2, 5], 44: [2, 5], 47: [2, 5], 48: [2, 5], 51: [2, 5], 55: [2, 5], 60: [2, 5] }, { 5: [2, 6], 14: [2, 6], 15: [2, 6], 19: [2, 6], 29: [2, 6], 34: [2, 6], 39: [2, 6], 44: [2, 6], 47: [2, 6], 48: [2, 6], 51: [2, 6], 55: [2, 6], 60: [2, 6] }, { 5: [2, 7], 14: [2, 7], 15: [2, 7], 19: [2, 7], 29: [2, 7], 34: [2, 7], 39: [2, 7], 44: [2, 7], 47: [2, 7], 48: [2, 7], 51: [2, 7], 55: [2, 7], 60: [2, 7] }, { 5: [2, 8], 14: [2, 8], 15: [2, 8], 19: [2, 8], 29: [2, 8], 34: [2, 8], 39: [2, 8], 44: [2, 8], 47: [2, 8], 48: [2, 8], 51: [2, 8], 55: [2, 8], 60: [2, 8] }, { 5: [2, 9], 14: [2, 9], 15: [2, 9], 19: [2, 9], 29: [2, 9], 34: [2, 9], 39: [2, 9], 44: [2, 9], 47: [2, 9], 48: [2, 9], 51: [2, 9], 55: [2, 9], 60: [2, 9] }, { 20: 25, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 36, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 4: 37, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 39: [2, 46], 44: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 4: 38, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 44: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 15: [2, 48], 17: 39, 18: [2, 48] }, { 20: 41, 56: 40, 64: 42, 65: [1, 43], 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 4: 44, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 5: [2, 10], 14: [2, 10], 15: [2, 10], 18: [2, 10], 19: [2, 10], 29: [2, 10], 34: [2, 10], 39: [2, 10], 44: [2, 10], 47: [2, 10], 48: [2, 10], 51: [2, 10], 55: [2, 10], 60: [2, 10] }, { 20: 45, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 46, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 47, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 41, 56: 48, 64: 42, 65: [1, 43], 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 33: [2, 78], 49: 49, 65: [2, 78], 72: [2, 78], 80: [2, 78], 81: [2, 78], 82: [2, 78], 83: [2, 78], 84: [2, 78], 85: [2, 78] }, { 23: [2, 33], 33: [2, 33], 54: [2, 33], 65: [2, 33], 68: [2, 33], 72: [2, 33], 75: [2, 33], 80: [2, 33], 81: [2, 33], 82: [2, 33], 83: [2, 33], 84: [2, 33], 85: [2, 33] }, { 23: [2, 34], 33: [2, 34], 54: [2, 34], 65: [2, 34], 68: [2, 34], 72: [2, 34], 75: [2, 34], 80: [2, 34], 81: [2, 34], 82: [2, 34], 83: [2, 34], 84: [2, 34], 85: [2, 34] }, { 23: [2, 35], 33: [2, 35], 54: [2, 35], 65: [2, 35], 68: [2, 35], 72: [2, 35], 75: [2, 35], 80: [2, 35], 81: [2, 35], 82: [2, 35], 83: [2, 35], 84: [2, 35], 85: [2, 35] }, { 23: [2, 36], 33: [2, 36], 54: [2, 36], 65: [2, 36], 68: [2, 36], 72: [2, 36], 75: [2, 36], 80: [2, 36], 81: [2, 36], 82: [2, 36], 83: [2, 36], 84: [2, 36], 85: [2, 36] }, { 23: [2, 37], 33: [2, 37], 54: [2, 37], 65: [2, 37], 68: [2, 37], 72: [2, 37], 75: [2, 37], 80: [2, 37], 81: [2, 37], 82: [2, 37], 83: [2, 37], 84: [2, 37], 85: [2, 37] }, { 23: [2, 38], 33: [2, 38], 54: [2, 38], 65: [2, 38], 68: [2, 38], 72: [2, 38], 75: [2, 38], 80: [2, 38], 81: [2, 38], 82: [2, 38], 83: [2, 38], 84: [2, 38], 85: [2, 38] }, { 23: [2, 39], 33: [2, 39], 54: [2, 39], 65: [2, 39], 68: [2, 39], 72: [2, 39], 75: [2, 39], 80: [2, 39], 81: [2, 39], 82: [2, 39], 83: [2, 39], 84: [2, 39], 85: [2, 39] }, { 23: [2, 43], 33: [2, 43], 54: [2, 43], 65: [2, 43], 68: [2, 43], 72: [2, 43], 75: [2, 43], 80: [2, 43], 81: [2, 43], 82: [2, 43], 83: [2, 43], 84: [2, 43], 85: [2, 43], 87: [1, 50] }, { 72: [1, 35], 86: 51 }, { 23: [2, 45], 33: [2, 45], 54: [2, 45], 65: [2, 45], 68: [2, 45], 72: [2, 45], 75: [2, 45], 80: [2, 45], 81: [2, 45], 82: [2, 45], 83: [2, 45], 84: [2, 45], 85: [2, 45], 87: [2, 45] }, { 52: 52, 54: [2, 82], 65: [2, 82], 72: [2, 82], 80: [2, 82], 81: [2, 82], 82: [2, 82], 83: [2, 82], 84: [2, 82], 85: [2, 82] }, { 25: 53, 38: 55, 39: [1, 57], 43: 56, 44: [1, 58], 45: 54, 47: [2, 54] }, { 28: 59, 43: 60, 44: [1, 58], 47: [2, 56] }, { 13: 62, 15: [1, 20], 18: [1, 61] }, { 33: [2, 86], 57: 63, 65: [2, 86], 72: [2, 86], 80: [2, 86], 81: [2, 86], 82: [2, 86], 83: [2, 86], 84: [2, 86], 85: [2, 86] }, { 33: [2, 40], 65: [2, 40], 72: [2, 40], 80: [2, 40], 81: [2, 40], 82: [2, 40], 83: [2, 40], 84: [2, 40], 85: [2, 40] }, { 33: [2, 41], 65: [2, 41], 72: [2, 41], 80: [2, 41], 81: [2, 41], 82: [2, 41], 83: [2, 41], 84: [2, 41], 85: [2, 41] }, { 20: 64, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 26: 65, 47: [1, 66] }, { 30: 67, 33: [2, 58], 65: [2, 58], 72: [2, 58], 75: [2, 58], 80: [2, 58], 81: [2, 58], 82: [2, 58], 83: [2, 58], 84: [2, 58], 85: [2, 58] }, { 33: [2, 64], 35: 68, 65: [2, 64], 72: [2, 64], 75: [2, 64], 80: [2, 64], 81: [2, 64], 82: [2, 64], 83: [2, 64], 84: [2, 64], 85: [2, 64] }, { 21: 69, 23: [2, 50], 65: [2, 50], 72: [2, 50], 80: [2, 50], 81: [2, 50], 82: [2, 50], 83: [2, 50], 84: [2, 50], 85: [2, 50] }, { 33: [2, 90], 61: 70, 65: [2, 90], 72: [2, 90], 80: [2, 90], 81: [2, 90], 82: [2, 90], 83: [2, 90], 84: [2, 90], 85: [2, 90] }, { 20: 74, 33: [2, 80], 50: 71, 63: 72, 64: 75, 65: [1, 43], 69: 73, 70: 76, 71: 77, 72: [1, 78], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 72: [1, 79] }, { 23: [2, 42], 33: [2, 42], 54: [2, 42], 65: [2, 42], 68: [2, 42], 72: [2, 42], 75: [2, 42], 80: [2, 42], 81: [2, 42], 82: [2, 42], 83: [2, 42], 84: [2, 42], 85: [2, 42], 87: [1, 50] }, { 20: 74, 53: 80, 54: [2, 84], 63: 81, 64: 75, 65: [1, 43], 69: 82, 70: 76, 71: 77, 72: [1, 78], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 26: 83, 47: [1, 66] }, { 47: [2, 55] }, { 4: 84, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 39: [2, 46], 44: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 47: [2, 20] }, { 20: 85, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 4: 86, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 26: 87, 47: [1, 66] }, { 47: [2, 57] }, { 5: [2, 11], 14: [2, 11], 15: [2, 11], 19: [2, 11], 29: [2, 11], 34: [2, 11], 39: [2, 11], 44: [2, 11], 47: [2, 11], 48: [2, 11], 51: [2, 11], 55: [2, 11], 60: [2, 11] }, { 15: [2, 49], 18: [2, 49] }, { 20: 74, 33: [2, 88], 58: 88, 63: 89, 64: 75, 65: [1, 43], 69: 90, 70: 76, 71: 77, 72: [1, 78], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 65: [2, 94], 66: 91, 68: [2, 94], 72: [2, 94], 80: [2, 94], 81: [2, 94], 82: [2, 94], 83: [2, 94], 84: [2, 94], 85: [2, 94] }, { 5: [2, 25], 14: [2, 25], 15: [2, 25], 19: [2, 25], 29: [2, 25], 34: [2, 25], 39: [2, 25], 44: [2, 25], 47: [2, 25], 48: [2, 25], 51: [2, 25], 55: [2, 25], 60: [2, 25] }, { 20: 92, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 74, 31: 93, 33: [2, 60], 63: 94, 64: 75, 65: [1, 43], 69: 95, 70: 76, 71: 77, 72: [1, 78], 75: [2, 60], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 74, 33: [2, 66], 36: 96, 63: 97, 64: 75, 65: [1, 43], 69: 98, 70: 76, 71: 77, 72: [1, 78], 75: [2, 66], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 74, 22: 99, 23: [2, 52], 63: 100, 64: 75, 65: [1, 43], 69: 101, 70: 76, 71: 77, 72: [1, 78], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 74, 33: [2, 92], 62: 102, 63: 103, 64: 75, 65: [1, 43], 69: 104, 70: 76, 71: 77, 72: [1, 78], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 33: [1, 105] }, { 33: [2, 79], 65: [2, 79], 72: [2, 79], 80: [2, 79], 81: [2, 79], 82: [2, 79], 83: [2, 79], 84: [2, 79], 85: [2, 79] }, { 33: [2, 81] }, { 23: [2, 27], 33: [2, 27], 54: [2, 27], 65: [2, 27], 68: [2, 27], 72: [2, 27], 75: [2, 27], 80: [2, 27], 81: [2, 27], 82: [2, 27], 83: [2, 27], 84: [2, 27], 85: [2, 27] }, { 23: [2, 28], 33: [2, 28], 54: [2, 28], 65: [2, 28], 68: [2, 28], 72: [2, 28], 75: [2, 28], 80: [2, 28], 81: [2, 28], 82: [2, 28], 83: [2, 28], 84: [2, 28], 85: [2, 28] }, { 23: [2, 30], 33: [2, 30], 54: [2, 30], 68: [2, 30], 71: 106, 72: [1, 107], 75: [2, 30] }, { 23: [2, 98], 33: [2, 98], 54: [2, 98], 68: [2, 98], 72: [2, 98], 75: [2, 98] }, { 23: [2, 45], 33: [2, 45], 54: [2, 45], 65: [2, 45], 68: [2, 45], 72: [2, 45], 73: [1, 108], 75: [2, 45], 80: [2, 45], 81: [2, 45], 82: [2, 45], 83: [2, 45], 84: [2, 45], 85: [2, 45], 87: [2, 45] }, { 23: [2, 44], 33: [2, 44], 54: [2, 44], 65: [2, 44], 68: [2, 44], 72: [2, 44], 75: [2, 44], 80: [2, 44], 81: [2, 44], 82: [2, 44], 83: [2, 44], 84: [2, 44], 85: [2, 44], 87: [2, 44] }, { 54: [1, 109] }, { 54: [2, 83], 65: [2, 83], 72: [2, 83], 80: [2, 83], 81: [2, 83], 82: [2, 83], 83: [2, 83], 84: [2, 83], 85: [2, 83] }, { 54: [2, 85] }, { 5: [2, 13], 14: [2, 13], 15: [2, 13], 19: [2, 13], 29: [2, 13], 34: [2, 13], 39: [2, 13], 44: [2, 13], 47: [2, 13], 48: [2, 13], 51: [2, 13], 55: [2, 13], 60: [2, 13] }, { 38: 55, 39: [1, 57], 43: 56, 44: [1, 58], 45: 111, 46: 110, 47: [2, 76] }, { 33: [2, 70], 40: 112, 65: [2, 70], 72: [2, 70], 75: [2, 70], 80: [2, 70], 81: [2, 70], 82: [2, 70], 83: [2, 70], 84: [2, 70], 85: [2, 70] }, { 47: [2, 18] }, { 5: [2, 14], 14: [2, 14], 15: [2, 14], 19: [2, 14], 29: [2, 14], 34: [2, 14], 39: [2, 14], 44: [2, 14], 47: [2, 14], 48: [2, 14], 51: [2, 14], 55: [2, 14], 60: [2, 14] }, { 33: [1, 113] }, { 33: [2, 87], 65: [2, 87], 72: [2, 87], 80: [2, 87], 81: [2, 87], 82: [2, 87], 83: [2, 87], 84: [2, 87], 85: [2, 87] }, { 33: [2, 89] }, { 20: 74, 63: 115, 64: 75, 65: [1, 43], 67: 114, 68: [2, 96], 69: 116, 70: 76, 71: 77, 72: [1, 78], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 33: [1, 117] }, { 32: 118, 33: [2, 62], 74: 119, 75: [1, 120] }, { 33: [2, 59], 65: [2, 59], 72: [2, 59], 75: [2, 59], 80: [2, 59], 81: [2, 59], 82: [2, 59], 83: [2, 59], 84: [2, 59], 85: [2, 59] }, { 33: [2, 61], 75: [2, 61] }, { 33: [2, 68], 37: 121, 74: 122, 75: [1, 120] }, { 33: [2, 65], 65: [2, 65], 72: [2, 65], 75: [2, 65], 80: [2, 65], 81: [2, 65], 82: [2, 65], 83: [2, 65], 84: [2, 65], 85: [2, 65] }, { 33: [2, 67], 75: [2, 67] }, { 23: [1, 123] }, { 23: [2, 51], 65: [2, 51], 72: [2, 51], 80: [2, 51], 81: [2, 51], 82: [2, 51], 83: [2, 51], 84: [2, 51], 85: [2, 51] }, { 23: [2, 53] }, { 33: [1, 124] }, { 33: [2, 91], 65: [2, 91], 72: [2, 91], 80: [2, 91], 81: [2, 91], 82: [2, 91], 83: [2, 91], 84: [2, 91], 85: [2, 91] }, { 33: [2, 93] }, { 5: [2, 22], 14: [2, 22], 15: [2, 22], 19: [2, 22], 29: [2, 22], 34: [2, 22], 39: [2, 22], 44: [2, 22], 47: [2, 22], 48: [2, 22], 51: [2, 22], 55: [2, 22], 60: [2, 22] }, { 23: [2, 99], 33: [2, 99], 54: [2, 99], 68: [2, 99], 72: [2, 99], 75: [2, 99] }, { 73: [1, 108] }, { 20: 74, 63: 125, 64: 75, 65: [1, 43], 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 5: [2, 23], 14: [2, 23], 15: [2, 23], 19: [2, 23], 29: [2, 23], 34: [2, 23], 39: [2, 23], 44: [2, 23], 47: [2, 23], 48: [2, 23], 51: [2, 23], 55: [2, 23], 60: [2, 23] }, { 47: [2, 19] }, { 47: [2, 77] }, { 20: 74, 33: [2, 72], 41: 126, 63: 127, 64: 75, 65: [1, 43], 69: 128, 70: 76, 71: 77, 72: [1, 78], 75: [2, 72], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 5: [2, 24], 14: [2, 24], 15: [2, 24], 19: [2, 24], 29: [2, 24], 34: [2, 24], 39: [2, 24], 44: [2, 24], 47: [2, 24], 48: [2, 24], 51: [2, 24], 55: [2, 24], 60: [2, 24] }, { 68: [1, 129] }, { 65: [2, 95], 68: [2, 95], 72: [2, 95], 80: [2, 95], 81: [2, 95], 82: [2, 95], 83: [2, 95], 84: [2, 95], 85: [2, 95] }, { 68: [2, 97] }, { 5: [2, 21], 14: [2, 21], 15: [2, 21], 19: [2, 21], 29: [2, 21], 34: [2, 21], 39: [2, 21], 44: [2, 21], 47: [2, 21], 48: [2, 21], 51: [2, 21], 55: [2, 21], 60: [2, 21] }, { 33: [1, 130] }, { 33: [2, 63] }, { 72: [1, 132], 76: 131 }, { 33: [1, 133] }, { 33: [2, 69] }, { 15: [2, 12], 18: [2, 12] }, { 14: [2, 26], 15: [2, 26], 19: [2, 26], 29: [2, 26], 34: [2, 26], 47: [2, 26], 48: [2, 26], 51: [2, 26], 55: [2, 26], 60: [2, 26] }, { 23: [2, 31], 33: [2, 31], 54: [2, 31], 68: [2, 31], 72: [2, 31], 75: [2, 31] }, { 33: [2, 74], 42: 134, 74: 135, 75: [1, 120] }, { 33: [2, 71], 65: [2, 71], 72: [2, 71], 75: [2, 71], 80: [2, 71], 81: [2, 71], 82: [2, 71], 83: [2, 71], 84: [2, 71], 85: [2, 71] }, { 33: [2, 73], 75: [2, 73] }, { 23: [2, 29], 33: [2, 29], 54: [2, 29], 65: [2, 29], 68: [2, 29], 72: [2, 29], 75: [2, 29], 80: [2, 29], 81: [2, 29], 82: [2, 29], 83: [2, 29], 84: [2, 29], 85: [2, 29] }, { 14: [2, 15], 15: [2, 15], 19: [2, 15], 29: [2, 15], 34: [2, 15], 39: [2, 15], 44: [2, 15], 47: [2, 15], 48: [2, 15], 51: [2, 15], 55: [2, 15], 60: [2, 15] }, { 72: [1, 137], 77: [1, 136] }, { 72: [2, 100], 77: [2, 100] }, { 14: [2, 16], 15: [2, 16], 19: [2, 16], 29: [2, 16], 34: [2, 16], 44: [2, 16], 47: [2, 16], 48: [2, 16], 51: [2, 16], 55: [2, 16], 60: [2, 16] }, { 33: [1, 138] }, { 33: [2, 75] }, { 33: [2, 32] }, { 72: [2, 101], 77: [2, 101] }, { 14: [2, 17], 15: [2, 17], 19: [2, 17], 29: [2, 17], 34: [2, 17], 39: [2, 17], 44: [2, 17], 47: [2, 17], 48: [2, 17], 51: [2, 17], 55: [2, 17], 60: [2, 17] }],
vendor: 10,583 bytes, lines 39493-39774
39493 39494 defaultActions: { 4: [2, 1], 54: [2, 55], 56: [2, 20], 60: [2, 57], 73: [2, 81], 82: [2, 85], 86: [2, 18], 90: [2, 89], 101: [2, 53], 104: [2, 93], 110: [2, 19], 111: [2, 77], 116: [2, 97], 119: [2, 63], 122: [2, 69], 135: [2, 75], 136: [2, 32] }, 39495 parseError: function parseError(str, hash) { 39496 throw new Error(str); 39497 }, 39498 parse: function parse(input) { 39499 var self = this, 39500 stack = [0], 39501 vstack = [null], 39502 lstack = [], 39503 table = this.table, 39504 yytext = "", 39505 yylineno = 0, 39506 yyleng = 0, 39507 recovering = 0, 39508 TERROR = 2, 39509 EOF = 1; 39510 this.lexer.setInput(input); 39511 this.lexer.yy = this.yy; 39512 this.yy.lexer = this.lexer; 39513 this.yy.parser = this; 39514 if (typeof this.lexer.yylloc == "undefined") this.lexer.yylloc = {}; 39515 var yyloc = this.lexer.yylloc; 39516 lstack.push(yyloc); 39517 var ranges = this.lexer.options && this.lexer.options.ranges; 39518 if (typeof this.yy.parseError === "function") this.parseError = this.yy.parseError; 39519 function popStack(n) { 39520 stack.length = stack.length - 2 * n; 39521 vstack.length = vstack.length - n; 39522 lstack.length = lstack.length - n; 39523 } 39524 function lex() { 39525 var token; 39526 token = self.lexer.lex() || 1; 39527 if (typeof token !== "number") { 39528 token = self.symbols_[token] || token; 39529 } 39530 return token; 39531 } 39532 var symbol, 39533 preErrorSymbol, 39534 state, 39535 action, 39536 a, 39537 r, 39538 yyval = {}, 39539 p, 39540 len, 39541 newState, 39542 expected; 39543 while (true) { 39544 state = stack[stack.length - 1]; 39545 if (this.defaultActions[state]) { 39546 action = this.defaultActions[state]; 39547 } else { 39548 if (symbol === null || typeof symbol == "undefined") { 39549 symbol = lex(); 39550 } 39551 action = table[state] && table[state][symbol]; 39552 } 39553 if (typeof action === "undefined" || !action.length || !action[0]) { 39554 var errStr = ""; 39555 if (!recovering) { 39556 expected = []; 39557 for (p in table[state]) if (this.terminals_[p] && p > 2) { 39558 expected.push("'" + this.terminals_[p] + "'"); 39559 } 39560 if (this.lexer.showPosition) { 39561 errStr = "Parse error on line " + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; 39562 } else { 39563 errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == 1 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'"); 39564 } 39565 this.parseError(errStr, { text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected }); 39566 } 39567 } 39568 if (action[0] instanceof Array && action.length > 1) { 39569 throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol); 39570 } 39571 switch (action[0]) { 39572 case 1: 39573 stack.push(symbol); 39574 vstack.push(this.lexer.yytext); 39575 lstack.push(this.lexer.yylloc); 39576 stack.push(action[1]); 39577 symbol = null; 39578 if (!preErrorSymbol) { 39579 yyleng = this.lexer.yyleng; 39580 yytext = this.lexer.yytext; 39581 yylineno = this.lexer.yylineno; 39582 yyloc = this.lexer.yylloc; 39583 if (recovering > 0) recovering--; 39584 } else { 39585 symbol = preErrorSymbol; 39586 preErrorSymbol = null; 39587 } 39588 break; 39589 case 2: 39590 len = this.productions_[action[1]][1]; 39591 yyval.$ = vstack[vstack.length - len]; 39592 yyval._$ = { first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column }; 39593 if (ranges) { 39594 yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]]; 39595 } 39596 r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack); 39597 if (typeof r !== "undefined") { 39598 return r; 39599 } 39600 if (len) { 39601 stack = stack.slice(0, -1 * len * 2); 39602 vstack = vstack.slice(0, -1 * len); 39603 lstack = lstack.slice(0, -1 * len); 39604 } 39605 stack.push(this.productions_[action[1]][0]); 39606 vstack.push(yyval.$); 39607 lstack.push(yyval._$); 39608 newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; 39609 stack.push(newState); 39610 break; 39611 case 3: 39612 return true; 39613 } 39614 } 39615 return true; 39616 } 39617 }; 39618 /* Jison generated lexer */ 39619 var lexer = (function () { 39620 var lexer = { 39621 EOF: 1, 39622 parseError: function parseError(str, hash) { 39623 if (this.yy.parser) { 39624 this.yy.parser.parseError(str, hash); 39625 } else { 39626 throw new Error(str); 39627 } 39628 }, 39629 setInput: function setInput(input) { 39630 this._input = input; 39631 this._more = this._less = this.done = false; 39632 this.yylineno = this.yyleng = 0; 39633 this.yytext = this.matched = this.match = ''; 39634 this.conditionStack = ['INITIAL']; 39635 this.yylloc = { first_line: 1, first_column: 0, last_line: 1, last_column: 0 }; 39636 if (this.options.ranges) this.yylloc.range = [0, 0]; 39637 this.offset = 0; 39638 return this; 39639 }, 39640 input: function input() { 39641 var ch = this._input[0]; 39642 this.yytext += ch; 39643 this.yyleng++; 39644 this.offset++; 39645 this.match += ch; 39646 this.matched += ch; 39647 var lines = ch.match(/(?:\r\n?|\n).*/g); 39648 if (lines) { 39649 this.yylineno++; 39650 this.yylloc.last_line++; 39651 } else { 39652 this.yylloc.last_column++; 39653 } 39654 if (this.options.ranges) this.yylloc.range[1]++; 39655 39656 this._input = this._input.slice(1); 39657 return ch; 39658 }, 39659 unput: function unput(ch) { 39660 var len = ch.length; 39661 var lines = ch.split(/(?:\r\n?|\n)/g); 39662 39663 this._input = ch + this._input; 39664 this.yytext = this.yytext.substr(0, this.yytext.length - len - 1); 39665 //this.yyleng -= len; 39666 this.offset -= len; 39667 var oldLines = this.match.split(/(?:\r\n?|\n)/g); 39668 this.match = this.match.substr(0, this.match.length - 1); 39669 this.matched = this.matched.substr(0, this.matched.length - 1); 39670 39671 if (lines.length - 1) this.yylineno -= lines.length - 1; 39672 var r = this.yylloc.range; 39673 39674 this.yylloc = { 39675 first_line: this.yylloc.first_line, 39676 last_line: this.yylineno + 1, 39677 first_column: this.yylloc.first_column, 39678 last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len 39679 }; 39680 39681 if (this.options.ranges) { 39682 this.yylloc.range = [r[0], r[0] + this.yyleng - len]; 39683 } 39684 return this; 39685 }, 39686 more: function more() { 39687 this._more = true; 39688 return this; 39689 }, 39690 less: function less(n) { 39691 this.unput(this.match.slice(n)); 39692 }, 39693 pastInput: function pastInput() { 39694 var past = this.matched.substr(0, this.matched.length - this.match.length); 39695 return (past.length > 20 ? '...' : '') + past.substr(-20).replace(/\n/g, ""); 39696 }, 39697 upcomingInput: function upcomingInput() { 39698 var next = this.match; 39699 if (next.length < 20) { 39700 next += this._input.substr(0, 20 - next.length); 39701 } 39702 return (next.substr(0, 20) + (next.length > 20 ? '...' : '')).replace(/\n/g, ""); 39703 }, 39704 showPosition: function showPosition() { 39705 var pre = this.pastInput(); 39706 var c = new Array(pre.length + 1).join("-"); 39707 return pre + this.upcomingInput() + "\n" + c + "^"; 39708 }, 39709 next: function next() { 39710 if (this.done) { 39711 return this.EOF; 39712 } 39713 if (!this._input) this.done = true; 39714 39715 var token, match, tempMatch, index, col, lines; 39716 if (!this._more) { 39717 this.yytext = ''; 39718 this.match = ''; 39719 } 39720 var rules = this._currentRules(); 39721 for (var i = 0; i < rules.length; i++) { 39722 tempMatch = this._input.match(this.rules[rules[i]]); 39723 if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { 39724 match = tempMatch; 39725 index = i; 39726 if (!this.options.flex) break; 39727 } 39728 } 39729 if (match) { 39730 lines = match[0].match(/(?:\r\n?|\n).*/g); 39731 if (lines) this.yylineno += lines.length; 39732 this.yylloc = { 39733 first_line: this.yylloc.last_line, 39734 last_line: this.yylineno + 1, 39735 first_column: this.yylloc.last_column, 39736 last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length 39737 }; 39738 this.yytext += match[0]; 39739 this.match += match[0]; 39740 this.matches = match; 39741 this.yyleng = this.yytext.length; 39742 if (this.options.ranges) { 39743 this.yylloc.range = [this.offset, this.offset += this.yyleng]; 39744 } 39745 this._more = false; 39746 this._input = this._input.slice(match[0].length); 39747 this.matched += match[0]; 39748 token = this.performAction.call(this, this.yy, this, rules[index], this.conditionStack[this.conditionStack.length - 1]); 39749 if (this.done && this._input) this.done = false; 39750 if (token) return token; else return; 39751 } 39752 if (this._input === "") { 39753 return this.EOF; 39754 } else { 39755 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { text: "", token: null, line: this.yylineno }); 39756 } 39757 }, 39758 lex: function lex() { 39759 var r = this.next(); 39760 if (typeof r !== 'undefined') { 39761 return r; 39762 } else { 39763 return this.lex(); 39764 } 39765 }, 39766 begin: function begin(condition) { 39767 this.conditionStack.push(condition); 39768 }, 39769 popState: function popState() { 39770 return this.conditionStack.pop(); 39771 }, 39772 _currentRules: function _currentRules() { 39773 return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; 39774 },
vendor: 6,503 bytes, lines 39775-39996
39775 topState: function topState() { 39776 return this.conditionStack[this.conditionStack.length - 2]; 39777 }, 39778 pushState: function begin(condition) { 39779 this.begin(condition); 39780 } 39781 }; 39782 lexer.options = {}; 39783 lexer.performAction = function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { 39784 39785 function strip(start, end) { 39786 return yy_.yytext = yy_.yytext.substring(start, yy_.yyleng - end + start); 39787 } 39788 39789 var YYSTATE = YY_START; 39790 switch ($avoiding_name_collisions) { 39791 case 0: 39792 if (yy_.yytext.slice(-2) === "\\\\") { 39793 strip(0, 1); 39794 this.begin("mu"); 39795 } else if (yy_.yytext.slice(-1) === "\\") { 39796 strip(0, 1); 39797 this.begin("emu"); 39798 } else { 39799 this.begin("mu"); 39800 } 39801 if (yy_.yytext) return 15; 39802 39803 break; 39804 case 1: 39805 return 15; 39806 break; 39807 case 2: 39808 this.popState(); 39809 return 15; 39810 39811 break; 39812 case 3: 39813 this.begin('raw'); return 15; 39814 break; 39815 case 4: 39816 this.popState(); 39817 // Should be using `this.topState()` below, but it currently 39818 // returns the second top instead of the first top. Opened an 39819 // issue about it at https://github.com/zaach/jison/issues/291 39820 if (this.conditionStack[this.conditionStack.length - 1] === 'raw') { 39821 return 15; 39822 } else { 39823 strip(5, 9); 39824 return 'END_RAW_BLOCK'; 39825 } 39826 39827 break; 39828 case 5: 39829 return 15; 39830 break; 39831 case 6: 39832 this.popState(); 39833 return 14; 39834 39835 break; 39836 case 7: 39837 return 65; 39838 break; 39839 case 8: 39840 return 68; 39841 break; 39842 case 9: 39843 return 19; 39844 break; 39845 case 10: 39846 this.popState(); 39847 this.begin('raw'); 39848 return 23; 39849 39850 break; 39851 case 11: 39852 return 55; 39853 break; 39854 case 12: 39855 return 60; 39856 break; 39857 case 13: 39858 return 29; 39859 break; 39860 case 14: 39861 return 47; 39862 break; 39863 case 15: 39864 this.popState(); return 44; 39865 break; 39866 case 16: 39867 this.popState(); return 44; 39868 break; 39869 case 17: 39870 return 34; 39871 break; 39872 case 18: 39873 return 39; 39874 break; 39875 case 19: 39876 return 51; 39877 break; 39878 case 20: 39879 return 48; 39880 break; 39881 case 21: 39882 this.unput(yy_.yytext); 39883 this.popState(); 39884 this.begin('com'); 39885 39886 break; 39887 case 22: 39888 this.popState(); 39889 return 14; 39890 39891 break; 39892 case 23: 39893 return 48; 39894 break; 39895 case 24: 39896 return 73; 39897 break; 39898 case 25: 39899 return 72; 39900 break; 39901 case 26: 39902 return 72; 39903 break; 39904 case 27: 39905 return 87; 39906 break; 39907 case 28: 39908 // ignore whitespace 39909 break; 39910 case 29: 39911 this.popState(); return 54; 39912 break; 39913 case 30: 39914 this.popState(); return 33; 39915 break; 39916 case 31: 39917 yy_.yytext = strip(1, 2).replace(/\\"/g, '"'); return 80; 39918 break; 39919 case 32: 39920 yy_.yytext = strip(1, 2).replace(/\\'/g, "'"); return 80; 39921 break; 39922 case 33: 39923 return 85; 39924 break; 39925 case 34: 39926 return 82; 39927 break; 39928 case 35: 39929 return 82; 39930 break; 39931 case 36: 39932 return 83; 39933 break; 39934 case 37: 39935 return 84; 39936 break; 39937 case 38: 39938 return 81; 39939 break; 39940 case 39: 39941 return 75; 39942 break; 39943 case 40: 39944 return 77; 39945 break; 39946 case 41: 39947 return 72; 39948 break; 39949 case 42: 39950 yy_.yytext = yy_.yytext.replace(/\\([\\\]])/g, '$1'); return 72; 39951 break; 39952 case 43: 39953 return 'INVALID'; 39954 break; 39955 case 44: 39956 return 5; 39957 break; 39958 } 39959 }; 39960 lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/, /^(?:[^\x00]+)/, /^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/, /^(?:\{\{\{\{(?=[^\/]))/, /^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/, /^(?:[^\x00]+?(?=(\{\{\{\{)))/, /^(?:[\s\S]*?--(~)?\}\})/, /^(?:\()/, /^(?:\))/, /^(?:\{\{\{\{)/, /^(?:\}\}\}\})/, /^(?:\{\{(~)?>)/, /^(?:\{\{(~)?#>)/, /^(?:\{\{(~)?#\*?)/, /^(?:\{\{(~)?\/)/, /^(?:\{\{(~)?\^\s*(~)?\}\})/, /^(?:\{\{(~)?\s*else\s*(~)?\}\})/, /^(?:\{\{(~)?\^)/, /^(?:\{\{(~)?\s*else\b)/, /^(?:\{\{(~)?\{)/, /^(?:\{\{(~)?&)/, /^(?:\{\{(~)?!--)/, /^(?:\{\{(~)?![\s\S]*?\}\})/, /^(?:\{\{(~)?\*?)/, /^(?:=)/, /^(?:\.\.)/, /^(?:\.(?=([=~}\s\/.)|])))/, /^(?:[\/.])/, /^(?:\s+)/, /^(?:\}(~)?\}\})/, /^(?:(~)?\}\})/, /^(?:"(\\["]|[^"])*")/, /^(?:'(\\[']|[^'])*')/, /^(?:@)/, /^(?:true(?=([~}\s)])))/, /^(?:false(?=([~}\s)])))/, /^(?:undefined(?=([~}\s)])))/, /^(?:null(?=([~}\s)])))/, /^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/, /^(?:as\s+\|)/, /^(?:\|)/, /^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/, /^(?:\[(\\\]|[^\]])*\])/, /^(?:.)/, /^(?:$)/]; 39961 lexer.conditions = { "mu": { "rules": [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44], "inclusive": false }, "emu": { "rules": [2], "inclusive": false }, "com": { "rules": [6], "inclusive": false }, "raw": { "rules": [3, 4, 5], "inclusive": false }, "INITIAL": { "rules": [0, 1, 44], "inclusive": true } }; 39962 return lexer; 39963 })(); 39964 parser.lexer = lexer; 39965 function Parser() { 39966 this.yy = {}; 39967 } Parser.prototype = parser; parser.Parser = Parser; 39968 return new Parser(); 39969 })(); exports["default"] = handlebars; 39970 module.exports = exports["default"]; 39971 39972 /***/ 39973}), 39974/* 48 */ 39975/***/ (function (module, exports, __webpack_require__) { 39976 39977 'use strict'; 39978 39979 var _interopRequireDefault = __webpack_require__(1)['default']; 39980 39981 exports.__esModule = true; 39982 39983 var _visitor = __webpack_require__(49); 39984 39985 var _visitor2 = _interopRequireDefault(_visitor); 39986 39987 function WhitespaceControl() { 39988 var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; 39989 39990 this.options = options; 39991 } 39992 WhitespaceControl.prototype = new _visitor2['default'](); 39993 39994 WhitespaceControl.prototype.Program = function (program) { 39995 var doStandalone = !this.options.ignoreStandalone; 39996
vendor: 5,197 bytes, lines 39997-40164
39997 var isRoot = !this.isRootSeen; 39998 this.isRootSeen = true; 39999 40000 var body = program.body; 40001 for (var i = 0, l = body.length; i < l; i++) { 40002 var current = body[i], 40003 strip = this.accept(current); 40004 40005 if (!strip) { 40006 continue; 40007 } 40008 40009 var _isPrevWhitespace = isPrevWhitespace(body, i, isRoot), 40010 _isNextWhitespace = isNextWhitespace(body, i, isRoot), 40011 openStandalone = strip.openStandalone && _isPrevWhitespace, 40012 closeStandalone = strip.closeStandalone && _isNextWhitespace, 40013 inlineStandalone = strip.inlineStandalone && _isPrevWhitespace && _isNextWhitespace; 40014 40015 if (strip.close) { 40016 omitRight(body, i, true); 40017 } 40018 if (strip.open) { 40019 omitLeft(body, i, true); 40020 } 40021 40022 if (doStandalone && inlineStandalone) { 40023 omitRight(body, i); 40024 40025 if (omitLeft(body, i)) { 40026 // If we are on a standalone node, save the indent info for partials 40027 if (current.type === 'PartialStatement') { 40028 // Pull out the whitespace from the final line 40029 current.indent = /([ \t]+$)/.exec(body[i - 1].original)[1]; 40030 } 40031 } 40032 } 40033 if (doStandalone && openStandalone) { 40034 omitRight((current.program || current.inverse).body); 40035 40036 // Strip out the previous content node if it's whitespace only 40037 omitLeft(body, i); 40038 } 40039 if (doStandalone && closeStandalone) { 40040 // Always strip the next node 40041 omitRight(body, i); 40042 40043 omitLeft((current.inverse || current.program).body); 40044 } 40045 } 40046 40047 return program; 40048 }; 40049 40050 WhitespaceControl.prototype.BlockStatement = WhitespaceControl.prototype.DecoratorBlock = WhitespaceControl.prototype.PartialBlockStatement = function (block) { 40051 this.accept(block.program); 40052 this.accept(block.inverse); 40053 40054 // Find the inverse program that is involed with whitespace stripping. 40055 var program = block.program || block.inverse, 40056 inverse = block.program && block.inverse, 40057 firstInverse = inverse, 40058 lastInverse = inverse; 40059 40060 if (inverse && inverse.chained) { 40061 firstInverse = inverse.body[0].program; 40062 40063 // Walk the inverse chain to find the last inverse that is actually in the chain. 40064 while (lastInverse.chained) { 40065 lastInverse = lastInverse.body[lastInverse.body.length - 1].program; 40066 } 40067 } 40068 40069 var strip = { 40070 open: block.openStrip.open, 40071 close: block.closeStrip.close, 40072 40073 // Determine the standalone candiacy. Basically flag our content as being possibly standalone 40074 // so our parent can determine if we actually are standalone 40075 openStandalone: isNextWhitespace(program.body), 40076 closeStandalone: isPrevWhitespace((firstInverse || program).body) 40077 }; 40078 40079 if (block.openStrip.close) { 40080 omitRight(program.body, null, true); 40081 } 40082 40083 if (inverse) { 40084 var inverseStrip = block.inverseStrip; 40085 40086 if (inverseStrip.open) { 40087 omitLeft(program.body, null, true); 40088 } 40089 40090 if (inverseStrip.close) { 40091 omitRight(firstInverse.body, null, true); 40092 } 40093 if (block.closeStrip.open) { 40094 omitLeft(lastInverse.body, null, true); 40095 } 40096 40097 // Find standalone else statments 40098 if (!this.options.ignoreStandalone && isPrevWhitespace(program.body) && isNextWhitespace(firstInverse.body)) { 40099 omitLeft(program.body); 40100 omitRight(firstInverse.body); 40101 } 40102 } else if (block.closeStrip.open) { 40103 omitLeft(program.body, null, true); 40104 } 40105 40106 return strip; 40107 }; 40108 40109 WhitespaceControl.prototype.Decorator = WhitespaceControl.prototype.MustacheStatement = function (mustache) { 40110 return mustache.strip; 40111 }; 40112 40113 WhitespaceControl.prototype.PartialStatement = WhitespaceControl.prototype.CommentStatement = function (node) { 40114 /* istanbul ignore next */ 40115 var strip = node.strip || {}; 40116 return { 40117 inlineStandalone: true, 40118 open: strip.open, 40119 close: strip.close 40120 }; 40121 }; 40122 40123 function isPrevWhitespace(body, i, isRoot) { 40124 if (i === undefined) { 40125 i = body.length; 40126 } 40127 40128 // Nodes that end with newlines are considered whitespace (but are special 40129 // cased for strip operations) 40130 var prev = body[i - 1], 40131 sibling = body[i - 2]; 40132 if (!prev) { 40133 return isRoot; 40134 } 40135 40136 if (prev.type === 'ContentStatement') { 40137 return (sibling || !isRoot ? /\r?\n\s*?$/ : /(^|\r?\n)\s*?$/).test(prev.original); 40138 } 40139 } 40140 function isNextWhitespace(body, i, isRoot) { 40141 if (i === undefined) { 40142 i = -1; 40143 } 40144 40145 var next = body[i + 1], 40146 sibling = body[i + 2]; 40147 if (!next) { 40148 return isRoot; 40149 } 40150 40151 if (next.type === 'ContentStatement') { 40152 return (sibling || !isRoot ? /^\s*?\r?\n/ : /^\s*?(\r?\n|$)/).test(next.original); 40153 } 40154 } 40155 40156 // Marks the node to the right of the position as omitted. 40157 // I.e. {{foo}}' ' will mark the ' ' node as omitted. 40158 // 40159 // If i is undefined, then the first child will be marked as such. 40160 // 40161 // If mulitple is truthy then all whitespace will be stripped out until non-whitespace 40162 // content is met. 40163 function omitRight(body, i, multiple) { 40164 var current = body[i == null ? 0 : i + 1];
vendor: 14,910 bytes, lines 40165-40707
40165 if (!current || current.type !== 'ContentStatement' || !multiple && current.rightStripped) { 40166 return; 40167 } 40168 40169 var original = current.value; 40170 current.value = current.value.replace(multiple ? /^\s+/ : /^[ \t]*\r?\n?/, ''); 40171 current.rightStripped = current.value !== original; 40172 } 40173 40174 // Marks the node to the left of the position as omitted. 40175 // I.e. ' '{{foo}} will mark the ' ' node as omitted. 40176 // 40177 // If i is undefined then the last child will be marked as such. 40178 // 40179 // If mulitple is truthy then all whitespace will be stripped out until non-whitespace 40180 // content is met. 40181 function omitLeft(body, i, multiple) { 40182 var current = body[i == null ? body.length - 1 : i - 1]; 40183 if (!current || current.type !== 'ContentStatement' || !multiple && current.leftStripped) { 40184 return; 40185 } 40186 40187 // We omit the last node if it's whitespace only and not preceded by a non-content node. 40188 var original = current.value; 40189 current.value = current.value.replace(multiple ? /\s+$/ : /[ \t]+$/, ''); 40190 current.leftStripped = current.value !== original; 40191 return current.leftStripped; 40192 } 40193 40194 exports['default'] = WhitespaceControl; 40195 module.exports = exports['default']; 40196 40197 /***/ 40198}), 40199/* 49 */ 40200/***/ (function (module, exports, __webpack_require__) { 40201 40202 'use strict'; 40203 40204 var _interopRequireDefault = __webpack_require__(1)['default']; 40205 40206 exports.__esModule = true; 40207 40208 var _exception = __webpack_require__(6); 40209 40210 var _exception2 = _interopRequireDefault(_exception); 40211 40212 function Visitor() { 40213 this.parents = []; 40214 } 40215 40216 Visitor.prototype = { 40217 constructor: Visitor, 40218 mutating: false, 40219 40220 // Visits a given value. If mutating, will replace the value if necessary. 40221 acceptKey: function acceptKey(node, name) { 40222 var value = this.accept(node[name]); 40223 if (this.mutating) { 40224 // Hacky sanity check: This may have a few false positives for type for the helper 40225 // methods but will generally do the right thing without a lot of overhead. 40226 if (value && !Visitor.prototype[value.type]) { 40227 throw new _exception2['default']('Unexpected node type "' + value.type + '" found when accepting ' + name + ' on ' + node.type); 40228 } 40229 node[name] = value; 40230 } 40231 }, 40232 40233 // Performs an accept operation with added sanity check to ensure 40234 // required keys are not removed. 40235 acceptRequired: function acceptRequired(node, name) { 40236 this.acceptKey(node, name); 40237 40238 if (!node[name]) { 40239 throw new _exception2['default'](node.type + ' requires ' + name); 40240 } 40241 }, 40242 40243 // Traverses a given array. If mutating, empty respnses will be removed 40244 // for child elements. 40245 acceptArray: function acceptArray(array) { 40246 for (var i = 0, l = array.length; i < l; i++) { 40247 this.acceptKey(array, i); 40248 40249 if (!array[i]) { 40250 array.splice(i, 1); 40251 i--; 40252 l--; 40253 } 40254 } 40255 }, 40256 40257 accept: function accept(object) { 40258 if (!object) { 40259 return; 40260 } 40261 40262 /* istanbul ignore next: Sanity code */ 40263 if (!this[object.type]) { 40264 throw new _exception2['default']('Unknown type: ' + object.type, object); 40265 } 40266 40267 if (this.current) { 40268 this.parents.unshift(this.current); 40269 } 40270 this.current = object; 40271 40272 var ret = this[object.type](object); 40273 40274 this.current = this.parents.shift(); 40275 40276 if (!this.mutating || ret) { 40277 return ret; 40278 } else if (ret !== false) { 40279 return object; 40280 } 40281 }, 40282 40283 Program: function Program(program) { 40284 this.acceptArray(program.body); 40285 }, 40286 40287 MustacheStatement: visitSubExpression, 40288 Decorator: visitSubExpression, 40289 40290 BlockStatement: visitBlock, 40291 DecoratorBlock: visitBlock, 40292 40293 PartialStatement: visitPartial, 40294 PartialBlockStatement: function PartialBlockStatement(partial) { 40295 visitPartial.call(this, partial); 40296 40297 this.acceptKey(partial, 'program'); 40298 }, 40299 40300 ContentStatement: function ContentStatement() /* content */ { }, 40301 CommentStatement: function CommentStatement() /* comment */ { }, 40302 40303 SubExpression: visitSubExpression, 40304 40305 PathExpression: function PathExpression() /* path */ { }, 40306 40307 StringLiteral: function StringLiteral() /* string */ { }, 40308 NumberLiteral: function NumberLiteral() /* number */ { }, 40309 BooleanLiteral: function BooleanLiteral() /* bool */ { }, 40310 UndefinedLiteral: function UndefinedLiteral() /* literal */ { }, 40311 NullLiteral: function NullLiteral() /* literal */ { }, 40312 40313 Hash: function Hash(hash) { 40314 this.acceptArray(hash.pairs); 40315 }, 40316 HashPair: function HashPair(pair) { 40317 this.acceptRequired(pair, 'value'); 40318 } 40319 }; 40320 40321 function visitSubExpression(mustache) { 40322 this.acceptRequired(mustache, 'path'); 40323 this.acceptArray(mustache.params); 40324 this.acceptKey(mustache, 'hash'); 40325 } 40326 function visitBlock(block) { 40327 visitSubExpression.call(this, block); 40328 40329 this.acceptKey(block, 'program'); 40330 this.acceptKey(block, 'inverse'); 40331 } 40332 function visitPartial(partial) { 40333 this.acceptRequired(partial, 'name'); 40334 this.acceptArray(partial.params); 40335 this.acceptKey(partial, 'hash'); 40336 } 40337 40338 exports['default'] = Visitor; 40339 module.exports = exports['default']; 40340 40341 /***/ 40342}), 40343/* 50 */ 40344/***/ (function (module, exports, __webpack_require__) { 40345 40346 'use strict'; 40347 40348 var _interopRequireDefault = __webpack_require__(1)['default']; 40349 40350 exports.__esModule = true; 40351 exports.SourceLocation = SourceLocation; 40352 exports.id = id; 40353 exports.stripFlags = stripFlags; 40354 exports.stripComment = stripComment; 40355 exports.preparePath = preparePath; 40356 exports.prepareMustache = prepareMustache; 40357 exports.prepareRawBlock = prepareRawBlock; 40358 exports.prepareBlock = prepareBlock; 40359 exports.prepareProgram = prepareProgram; 40360 exports.preparePartialBlock = preparePartialBlock; 40361 40362 var _exception = __webpack_require__(6); 40363 40364 var _exception2 = _interopRequireDefault(_exception); 40365 40366 function validateClose(open, close) { 40367 close = close.path ? close.path.original : close; 40368 40369 if (open.path.original !== close) { 40370 var errorNode = { loc: open.path.loc }; 40371 40372 throw new _exception2['default'](open.path.original + " doesn't match " + close, errorNode); 40373 } 40374 } 40375 40376 function SourceLocation(source, locInfo) { 40377 this.source = source; 40378 this.start = { 40379 line: locInfo.first_line, 40380 column: locInfo.first_column 40381 }; 40382 this.end = { 40383 line: locInfo.last_line, 40384 column: locInfo.last_column 40385 }; 40386 } 40387 40388 function id(token) { 40389 if (/^\[.*\]$/.test(token)) { 40390 return token.substring(1, token.length - 1); 40391 } else { 40392 return token; 40393 } 40394 } 40395 40396 function stripFlags(open, close) { 40397 return { 40398 open: open.charAt(2) === '~', 40399 close: close.charAt(close.length - 3) === '~' 40400 }; 40401 } 40402 40403 function stripComment(comment) { 40404 return comment.replace(/^\{\{~?!-?-?/, '').replace(/-?-?~?\}\}$/, ''); 40405 } 40406 40407 function preparePath(data, parts, loc) { 40408 loc = this.locInfo(loc); 40409 40410 var original = data ? '@' : '', 40411 dig = [], 40412 depth = 0; 40413 40414 for (var i = 0, l = parts.length; i < l; i++) { 40415 var part = parts[i].part, 40416 40417 // If we have [] syntax then we do not treat path references as operators, 40418 // i.e. foo.[this] resolves to approximately context.foo['this'] 40419 isLiteral = parts[i].original !== part; 40420 original += (parts[i].separator || '') + part; 40421 40422 if (!isLiteral && (part === '..' || part === '.' || part === 'this')) { 40423 if (dig.length > 0) { 40424 throw new _exception2['default']('Invalid path: ' + original, { loc: loc }); 40425 } else if (part === '..') { 40426 depth++; 40427 } 40428 } else { 40429 dig.push(part); 40430 } 40431 } 40432 40433 return { 40434 type: 'PathExpression', 40435 data: data, 40436 depth: depth, 40437 parts: dig, 40438 original: original, 40439 loc: loc 40440 }; 40441 } 40442 40443 function prepareMustache(path, params, hash, open, strip, locInfo) { 40444 // Must use charAt to support IE pre-10 40445 var escapeFlag = open.charAt(3) || open.charAt(2), 40446 escaped = escapeFlag !== '{' && escapeFlag !== '&'; 40447 40448 var decorator = /\*/.test(open); 40449 return { 40450 type: decorator ? 'Decorator' : 'MustacheStatement', 40451 path: path, 40452 params: params, 40453 hash: hash, 40454 escaped: escaped, 40455 strip: strip, 40456 loc: this.locInfo(locInfo) 40457 }; 40458 } 40459 40460 function prepareRawBlock(openRawBlock, contents, close, locInfo) { 40461 validateClose(openRawBlock, close); 40462 40463 locInfo = this.locInfo(locInfo); 40464 var program = { 40465 type: 'Program', 40466 body: contents, 40467 strip: {}, 40468 loc: locInfo 40469 }; 40470 40471 return { 40472 type: 'BlockStatement', 40473 path: openRawBlock.path, 40474 params: openRawBlock.params, 40475 hash: openRawBlock.hash, 40476 program: program, 40477 openStrip: {}, 40478 inverseStrip: {}, 40479 closeStrip: {}, 40480 loc: locInfo 40481 }; 40482 } 40483 40484 function prepareBlock(openBlock, program, inverseAndProgram, close, inverted, locInfo) { 40485 if (close && close.path) { 40486 validateClose(openBlock, close); 40487 } 40488 40489 var decorator = /\*/.test(openBlock.open); 40490 40491 program.blockParams = openBlock.blockParams; 40492 40493 var inverse = undefined, 40494 inverseStrip = undefined; 40495 40496 if (inverseAndProgram) { 40497 if (decorator) { 40498 throw new _exception2['default']('Unexpected inverse block on decorator', inverseAndProgram); 40499 } 40500 40501 if (inverseAndProgram.chain) { 40502 inverseAndProgram.program.body[0].closeStrip = close.strip; 40503 } 40504 40505 inverseStrip = inverseAndProgram.strip; 40506 inverse = inverseAndProgram.program; 40507 } 40508 40509 if (inverted) { 40510 inverted = inverse; 40511 inverse = program; 40512 program = inverted; 40513 } 40514 40515 return { 40516 type: decorator ? 'DecoratorBlock' : 'BlockStatement', 40517 path: openBlock.path, 40518 params: openBlock.params, 40519 hash: openBlock.hash, 40520 program: program, 40521 inverse: inverse, 40522 openStrip: openBlock.strip, 40523 inverseStrip: inverseStrip, 40524 closeStrip: close && close.strip, 40525 loc: this.locInfo(locInfo) 40526 }; 40527 } 40528 40529 function prepareProgram(statements, loc) { 40530 if (!loc && statements.length) { 40531 var firstLoc = statements[0].loc, 40532 lastLoc = statements[statements.length - 1].loc; 40533 40534 /* istanbul ignore else */ 40535 if (firstLoc && lastLoc) { 40536 loc = { 40537 source: firstLoc.source, 40538 start: { 40539 line: firstLoc.start.line, 40540 column: firstLoc.start.column 40541 }, 40542 end: { 40543 line: lastLoc.end.line, 40544 column: lastLoc.end.column 40545 } 40546 }; 40547 } 40548 } 40549 40550 return { 40551 type: 'Program', 40552 body: statements, 40553 strip: {}, 40554 loc: loc 40555 }; 40556 } 40557 40558 function preparePartialBlock(open, program, close, locInfo) { 40559 validateClose(open, close); 40560 40561 return { 40562 type: 'PartialBlockStatement', 40563 name: open.path, 40564 params: open.params, 40565 hash: open.hash, 40566 program: program, 40567 openStrip: open.strip, 40568 closeStrip: close && close.strip, 40569 loc: this.locInfo(locInfo) 40570 }; 40571 } 40572 40573 /***/ 40574}), 40575/* 51 */ 40576/***/ (function (module, exports, __webpack_require__) { 40577 40578 /* eslint-disable new-cap */ 40579 40580 'use strict'; 40581 40582 var _Object$create = __webpack_require__(34)['default']; 40583 40584 var _interopRequireDefault = __webpack_require__(1)['default']; 40585 40586 exports.__esModule = true; 40587 exports.Compiler = Compiler; 40588 exports.precompile = precompile; 40589 exports.compile = compile; 40590 40591 var _exception = __webpack_require__(6); 40592 40593 var _exception2 = _interopRequireDefault(_exception); 40594 40595 var _utils = __webpack_require__(5); 40596 40597 var _ast = __webpack_require__(45); 40598 40599 var _ast2 = _interopRequireDefault(_ast); 40600 40601 var slice = [].slice; 40602 40603 function Compiler() { } 40604 40605 // the foundHelper register will disambiguate helper lookup from finding a 40606 // function in a context. This is necessary for mustache compatibility, which 40607 // requires that context functions in blocks are evaluated by blockHelperMissing, 40608 // and then proceed as if the resulting value was provided to blockHelperMissing. 40609 40610 Compiler.prototype = { 40611 compiler: Compiler, 40612 40613 equals: function equals(other) { 40614 var len = this.opcodes.length; 40615 if (other.opcodes.length !== len) { 40616 return false; 40617 } 40618 40619 for (var i = 0; i < len; i++) { 40620 var opcode = this.opcodes[i], 40621 otherOpcode = other.opcodes[i]; 40622 if (opcode.opcode !== otherOpcode.opcode || !argEquals(opcode.args, otherOpcode.args)) { 40623 return false; 40624 } 40625 } 40626 40627 // We know that length is the same between the two arrays because they are directly tied 40628 // to the opcode behavior above. 40629 len = this.children.length; 40630 for (var i = 0; i < len; i++) { 40631 if (!this.children[i].equals(other.children[i])) { 40632 return false; 40633 } 40634 } 40635 40636 return true; 40637 }, 40638 40639 guid: 0, 40640 40641 compile: function compile(program, options) { 40642 this.sourceNode = []; 40643 this.opcodes = []; 40644 this.children = []; 40645 this.options = options; 40646 this.stringParams = options.stringParams; 40647 this.trackIds = options.trackIds; 40648 40649 options.blockParams = options.blockParams || []; 40650 40651 options.knownHelpers = _utils.extend(_Object$create(null), { 40652 helperMissing: true, 40653 blockHelperMissing: true, 40654 each: true, 40655 'if': true, 40656 unless: true, 40657 'with': true, 40658 log: true, 40659 lookup: true 40660 }, options.knownHelpers); 40661 40662 return this.accept(program); 40663 }, 40664 40665 compileProgram: function compileProgram(program) { 40666 var childCompiler = new this.compiler(), 40667 // eslint-disable-line new-cap 40668 result = childCompiler.compile(program, this.options), 40669 guid = this.guid++; 40670 40671 this.usePartial = this.usePartial || result.usePartial; 40672 40673 this.children[guid] = result; 40674 this.useDepths = this.useDepths || result.useDepths; 40675 40676 return guid; 40677 }, 40678 40679 accept: function accept(node) { 40680 /* istanbul ignore next: Sanity code */ 40681 if (!this[node.type]) { 40682 throw new _exception2['default']('Unknown type: ' + node.type, node); 40683 } 40684 40685 this.sourceNode.unshift(node); 40686 var ret = this[node.type](node); 40687 this.sourceNode.shift(); 40688 return ret; 40689 }, 40690 40691 Program: function Program(program) { 40692 this.options.blockParams.unshift(program.blockParams); 40693 40694 var body = program.body, 40695 bodyLength = body.length; 40696 for (var i = 0; i < bodyLength; i++) { 40697 this.accept(body[i]); 40698 } 40699 40700 this.options.blockParams.shift(); 40701 40702 this.isSimple = bodyLength === 1; 40703 this.blockParams = program.blockParams ? program.blockParams.length : 0; 40704 40705 return this; 40706 }, 40707
vendor: 4,149 bytes, lines 40708-40841
40708 BlockStatement: function BlockStatement(block) { 40709 transformLiteralToPath(block); 40710 40711 var program = block.program, 40712 inverse = block.inverse; 40713 40714 program = program && this.compileProgram(program); 40715 inverse = inverse && this.compileProgram(inverse); 40716 40717 var type = this.classifySexpr(block); 40718 40719 if (type === 'helper') { 40720 this.helperSexpr(block, program, inverse); 40721 } else if (type === 'simple') { 40722 this.simpleSexpr(block); 40723 40724 // now that the simple mustache is resolved, we need to 40725 // evaluate it by executing `blockHelperMissing` 40726 this.opcode('pushProgram', program); 40727 this.opcode('pushProgram', inverse); 40728 this.opcode('emptyHash'); 40729 this.opcode('blockValue', block.path.original); 40730 } else { 40731 this.ambiguousSexpr(block, program, inverse); 40732 40733 // now that the simple mustache is resolved, we need to 40734 // evaluate it by executing `blockHelperMissing` 40735 this.opcode('pushProgram', program); 40736 this.opcode('pushProgram', inverse); 40737 this.opcode('emptyHash'); 40738 this.opcode('ambiguousBlockValue'); 40739 } 40740 40741 this.opcode('append'); 40742 }, 40743 40744 DecoratorBlock: function DecoratorBlock(decorator) { 40745 var program = decorator.program && this.compileProgram(decorator.program); 40746 var params = this.setupFullMustacheParams(decorator, program, undefined), 40747 path = decorator.path; 40748 40749 this.useDecorators = true; 40750 this.opcode('registerDecorator', params.length, path.original); 40751 }, 40752 40753 PartialStatement: function PartialStatement(partial) { 40754 this.usePartial = true; 40755 40756 var program = partial.program; 40757 if (program) { 40758 program = this.compileProgram(partial.program); 40759 } 40760 40761 var params = partial.params; 40762 if (params.length > 1) { 40763 throw new _exception2['default']('Unsupported number of partial arguments: ' + params.length, partial); 40764 } else if (!params.length) { 40765 if (this.options.explicitPartialContext) { 40766 this.opcode('pushLiteral', 'undefined'); 40767 } else { 40768 params.push({ type: 'PathExpression', parts: [], depth: 0 }); 40769 } 40770 } 40771 40772 var partialName = partial.name.original, 40773 isDynamic = partial.name.type === 'SubExpression'; 40774 if (isDynamic) { 40775 this.accept(partial.name); 40776 } 40777 40778 this.setupFullMustacheParams(partial, program, undefined, true); 40779 40780 var indent = partial.indent || ''; 40781 if (this.options.preventIndent && indent) { 40782 this.opcode('appendContent', indent); 40783 indent = ''; 40784 } 40785 40786 this.opcode('invokePartial', isDynamic, partialName, indent); 40787 this.opcode('append'); 40788 }, 40789 PartialBlockStatement: function PartialBlockStatement(partialBlock) { 40790 this.PartialStatement(partialBlock); 40791 }, 40792 40793 MustacheStatement: function MustacheStatement(mustache) { 40794 this.SubExpression(mustache); 40795 40796 if (mustache.escaped && !this.options.noEscape) { 40797 this.opcode('appendEscaped'); 40798 } else { 40799 this.opcode('append'); 40800 } 40801 }, 40802 Decorator: function Decorator(decorator) { 40803 this.DecoratorBlock(decorator); 40804 }, 40805 40806 ContentStatement: function ContentStatement(content) { 40807 if (content.value) { 40808 this.opcode('appendContent', content.value); 40809 } 40810 }, 40811 40812 CommentStatement: function CommentStatement() { }, 40813 40814 SubExpression: function SubExpression(sexpr) { 40815 transformLiteralToPath(sexpr); 40816 var type = this.classifySexpr(sexpr); 40817 40818 if (type === 'simple') { 40819 this.simpleSexpr(sexpr); 40820 } else if (type === 'helper') { 40821 this.helperSexpr(sexpr); 40822 } else { 40823 this.ambiguousSexpr(sexpr); 40824 } 40825 }, 40826 ambiguousSexpr: function ambiguousSexpr(sexpr, program, inverse) { 40827 var path = sexpr.path, 40828 name = path.parts[0], 40829 isBlock = program != null || inverse != null; 40830 40831 this.opcode('getContext', path.depth); 40832 40833 this.opcode('pushProgram', program); 40834 this.opcode('pushProgram', inverse); 40835 40836 path.strict = true; 40837 this.accept(path); 40838 40839 this.opcode('invokeAmbiguous', name, isBlock); 40840 }, 40841
vendor: 11,490 bytes, lines 40842-41220
40842 simpleSexpr: function simpleSexpr(sexpr) { 40843 var path = sexpr.path; 40844 path.strict = true; 40845 this.accept(path); 40846 this.opcode('resolvePossibleLambda'); 40847 }, 40848 40849 helperSexpr: function helperSexpr(sexpr, program, inverse) { 40850 var params = this.setupFullMustacheParams(sexpr, program, inverse), 40851 path = sexpr.path, 40852 name = path.parts[0]; 40853 40854 if (this.options.knownHelpers[name]) { 40855 this.opcode('invokeKnownHelper', params.length, name); 40856 } else if (this.options.knownHelpersOnly) { 40857 throw new _exception2['default']('You specified knownHelpersOnly, but used the unknown helper ' + name, sexpr); 40858 } else { 40859 path.strict = true; 40860 path.falsy = true; 40861 40862 this.accept(path); 40863 this.opcode('invokeHelper', params.length, path.original, _ast2['default'].helpers.simpleId(path)); 40864 } 40865 }, 40866 40867 PathExpression: function PathExpression(path) { 40868 this.addDepth(path.depth); 40869 this.opcode('getContext', path.depth); 40870 40871 var name = path.parts[0], 40872 scoped = _ast2['default'].helpers.scopedId(path), 40873 blockParamId = !path.depth && !scoped && this.blockParamIndex(name); 40874 40875 if (blockParamId) { 40876 this.opcode('lookupBlockParam', blockParamId, path.parts); 40877 } else if (!name) { 40878 // Context reference, i.e. `{{foo .}}` or `{{foo ..}}` 40879 this.opcode('pushContext'); 40880 } else if (path.data) { 40881 this.options.data = true; 40882 this.opcode('lookupData', path.depth, path.parts, path.strict); 40883 } else { 40884 this.opcode('lookupOnContext', path.parts, path.falsy, path.strict, scoped); 40885 } 40886 }, 40887 40888 StringLiteral: function StringLiteral(string) { 40889 this.opcode('pushString', string.value); 40890 }, 40891 40892 NumberLiteral: function NumberLiteral(number) { 40893 this.opcode('pushLiteral', number.value); 40894 }, 40895 40896 BooleanLiteral: function BooleanLiteral(bool) { 40897 this.opcode('pushLiteral', bool.value); 40898 }, 40899 40900 UndefinedLiteral: function UndefinedLiteral() { 40901 this.opcode('pushLiteral', 'undefined'); 40902 }, 40903 40904 NullLiteral: function NullLiteral() { 40905 this.opcode('pushLiteral', 'null'); 40906 }, 40907 40908 Hash: function Hash(hash) { 40909 var pairs = hash.pairs, 40910 i = 0, 40911 l = pairs.length; 40912 40913 this.opcode('pushHash'); 40914 40915 for (; i < l; i++) { 40916 this.pushParam(pairs[i].value); 40917 } 40918 while (i--) { 40919 this.opcode('assignToHash', pairs[i].key); 40920 } 40921 this.opcode('popHash'); 40922 }, 40923 40924 // HELPERS 40925 opcode: function opcode(name) { 40926 this.opcodes.push({ 40927 opcode: name, 40928 args: slice.call(arguments, 1), 40929 loc: this.sourceNode[0].loc 40930 }); 40931 }, 40932 40933 addDepth: function addDepth(depth) { 40934 if (!depth) { 40935 return; 40936 } 40937 40938 this.useDepths = true; 40939 }, 40940 40941 classifySexpr: function classifySexpr(sexpr) { 40942 var isSimple = _ast2['default'].helpers.simpleId(sexpr.path); 40943 40944 var isBlockParam = isSimple && !!this.blockParamIndex(sexpr.path.parts[0]); 40945 40946 // a mustache is an eligible helper if: 40947 // * its id is simple (a single part, not `this` or `..`) 40948 var isHelper = !isBlockParam && _ast2['default'].helpers.helperExpression(sexpr); 40949 40950 // if a mustache is an eligible helper but not a definite 40951 // helper, it is ambiguous, and will be resolved in a later 40952 // pass or at runtime. 40953 var isEligible = !isBlockParam && (isHelper || isSimple); 40954 40955 // if ambiguous, we can possibly resolve the ambiguity now 40956 // An eligible helper is one that does not have a complex path, i.e. `this.foo`, `../foo` etc. 40957 if (isEligible && !isHelper) { 40958 var _name = sexpr.path.parts[0], 40959 options = this.options; 40960 if (options.knownHelpers[_name]) { 40961 isHelper = true; 40962 } else if (options.knownHelpersOnly) { 40963 isEligible = false; 40964 } 40965 } 40966 40967 if (isHelper) { 40968 return 'helper'; 40969 } else if (isEligible) { 40970 return 'ambiguous'; 40971 } else { 40972 return 'simple'; 40973 } 40974 }, 40975 40976 pushParams: function pushParams(params) { 40977 for (var i = 0, l = params.length; i < l; i++) { 40978 this.pushParam(params[i]); 40979 } 40980 }, 40981 40982 pushParam: function pushParam(val) { 40983 var value = val.value != null ? val.value : val.original || ''; 40984 40985 if (this.stringParams) { 40986 if (value.replace) { 40987 value = value.replace(/^(\.?\.\/)*/g, '').replace(/\//g, '.'); 40988 } 40989 40990 if (val.depth) { 40991 this.addDepth(val.depth); 40992 } 40993 this.opcode('getContext', val.depth || 0); 40994 this.opcode('pushStringParam', value, val.type); 40995 40996 if (val.type === 'SubExpression') { 40997 // SubExpressions get evaluated and passed in 40998 // in string params mode. 40999 this.accept(val); 41000 } 41001 } else { 41002 if (this.trackIds) { 41003 var blockParamIndex = undefined; 41004 if (val.parts && !_ast2['default'].helpers.scopedId(val) && !val.depth) { 41005 blockParamIndex = this.blockParamIndex(val.parts[0]); 41006 } 41007 if (blockParamIndex) { 41008 var blockParamChild = val.parts.slice(1).join('.'); 41009 this.opcode('pushId', 'BlockParam', blockParamIndex, blockParamChild); 41010 } else { 41011 value = val.original || value; 41012 if (value.replace) { 41013 value = value.replace(/^this(?:\.|$)/, '').replace(/^\.\//, '').replace(/^\.$/, ''); 41014 } 41015 41016 this.opcode('pushId', val.type, value); 41017 } 41018 } 41019 this.accept(val); 41020 } 41021 }, 41022 41023 setupFullMustacheParams: function setupFullMustacheParams(sexpr, program, inverse, omitEmpty) { 41024 var params = sexpr.params; 41025 this.pushParams(params); 41026 41027 this.opcode('pushProgram', program); 41028 this.opcode('pushProgram', inverse); 41029 41030 if (sexpr.hash) { 41031 this.accept(sexpr.hash); 41032 } else { 41033 this.opcode('emptyHash', omitEmpty); 41034 } 41035 41036 return params; 41037 }, 41038 41039 blockParamIndex: function blockParamIndex(name) { 41040 for (var depth = 0, len = this.options.blockParams.length; depth < len; depth++) { 41041 var blockParams = this.options.blockParams[depth], 41042 param = blockParams && _utils.indexOf(blockParams, name); 41043 if (blockParams && param >= 0) { 41044 return [depth, param]; 41045 } 41046 } 41047 } 41048 }; 41049 41050 function precompile(input, options, env) { 41051 if (input == null || typeof input !== 'string' && input.type !== 'Program') { 41052 throw new _exception2['default']('You must pass a string or Handlebars AST to Handlebars.precompile. You passed ' + input); 41053 } 41054 41055 options = options || {}; 41056 if (!('data' in options)) { 41057 options.data = true; 41058 } 41059 if (options.compat) { 41060 options.useDepths = true; 41061 } 41062 41063 var ast = env.parse(input, options), 41064 environment = new env.Compiler().compile(ast, options); 41065 return new env.JavaScriptCompiler().compile(environment, options); 41066 } 41067 41068 function compile(input, options, env) { 41069 if (options === undefined) options = {}; 41070 41071 if (input == null || typeof input !== 'string' && input.type !== 'Program') { 41072 throw new _exception2['default']('You must pass a string or Handlebars AST to Handlebars.compile. You passed ' + input); 41073 } 41074 41075 options = _utils.extend({}, options); 41076 if (!('data' in options)) { 41077 options.data = true; 41078 } 41079 if (options.compat) { 41080 options.useDepths = true; 41081 } 41082 41083 var compiled = undefined; 41084 41085 function compileInput() { 41086 var ast = env.parse(input, options), 41087 environment = new env.Compiler().compile(ast, options), 41088 templateSpec = new env.JavaScriptCompiler().compile(environment, options, undefined, true); 41089 return env.template(templateSpec); 41090 } 41091 41092 // Template is only compiled on first use and cached after that point. 41093 function ret(context, execOptions) { 41094 if (!compiled) { 41095 compiled = compileInput(); 41096 } 41097 return compiled.call(this, context, execOptions); 41098 } 41099 ret._setup = function (setupOptions) { 41100 if (!compiled) { 41101 compiled = compileInput(); 41102 } 41103 return compiled._setup(setupOptions); 41104 }; 41105 ret._child = function (i, data, blockParams, depths) { 41106 if (!compiled) { 41107 compiled = compileInput(); 41108 } 41109 return compiled._child(i, data, blockParams, depths); 41110 }; 41111 return ret; 41112 } 41113 41114 function argEquals(a, b) { 41115 if (a === b) { 41116 return true; 41117 } 41118 41119 if (_utils.isArray(a) && _utils.isArray(b) && a.length === b.length) { 41120 for (var i = 0; i < a.length; i++) { 41121 if (!argEquals(a[i], b[i])) { 41122 return false; 41123 } 41124 } 41125 return true; 41126 } 41127 } 41128 41129 function transformLiteralToPath(sexpr) { 41130 if (!sexpr.path.parts) { 41131 var literal = sexpr.path; 41132 // Casting to string here to make false and 0 literal values play nicely with the rest 41133 // of the system. 41134 sexpr.path = { 41135 type: 'PathExpression', 41136 data: false, 41137 depth: 0, 41138 parts: [literal.original + ''], 41139 original: literal.original + '', 41140 loc: literal.loc 41141 }; 41142 } 41143 } 41144 41145 /***/ 41146}), 41147/* 52 */ 41148/***/ (function (module, exports, __webpack_require__) { 41149 41150 'use strict'; 41151 41152 var _Object$keys = __webpack_require__(13)['default']; 41153 41154 var _interopRequireDefault = __webpack_require__(1)['default']; 41155 41156 exports.__esModule = true; 41157 41158 var _base = __webpack_require__(4); 41159 41160 var _exception = __webpack_require__(6); 41161 41162 var _exception2 = _interopRequireDefault(_exception); 41163 41164 var _utils = __webpack_require__(5); 41165 41166 var _codeGen = __webpack_require__(53); 41167 41168 var _codeGen2 = _interopRequireDefault(_codeGen); 41169 41170 function Literal(value) { 41171 this.value = value; 41172 } 41173 41174 function JavaScriptCompiler() { } 41175 41176 JavaScriptCompiler.prototype = { 41177 // PUBLIC API: You can override these methods in a subclass to provide 41178 // alternative compiled forms for name lookup and buffering semantics 41179 nameLookup: function nameLookup(parent, name /*, type */) { 41180 return this.internalNameLookup(parent, name); 41181 }, 41182 depthedLookup: function depthedLookup(name) { 41183 return [this.aliasable('container.lookup'), '(depths, ', JSON.stringify(name), ')']; 41184 }, 41185 41186 compilerInfo: function compilerInfo() { 41187 var revision = _base.COMPILER_REVISION, 41188 versions = _base.REVISION_CHANGES[revision]; 41189 return [revision, versions]; 41190 }, 41191 41192 appendToBuffer: function appendToBuffer(source, location, explicit) { 41193 // Force a source as this simplifies the merge logic. 41194 if (!_utils.isArray(source)) { 41195 source = [source]; 41196 } 41197 source = this.source.wrap(source, location); 41198 41199 if (this.environment.isSimple) { 41200 return ['return ', source, ';']; 41201 } else if (explicit) { 41202 // This is a case where the buffer operation occurs as a child of another 41203 // construct, generally braces. We have to explicitly output these buffer 41204 // operations to ensure that the emitted code goes in the correct location. 41205 return ['buffer += ', source, ';']; 41206 } else { 41207 source.appendToBuffer = true; 41208 return source; 41209 } 41210 }, 41211 41212 initializeBuffer: function initializeBuffer() { 41213 return this.quotedString(''); 41214 }, 41215 // END PUBLIC API 41216 internalNameLookup: function internalNameLookup(parent, name) { 41217 this.lookupPropertyFunctionIsUsed = true; 41218 return ['lookupProperty(', parent, ',', JSON.stringify(name), ')']; 41219 }, 41220
vendor: 10,496 bytes, lines 41221-41546
41221 lookupPropertyFunctionIsUsed: false, 41222 41223 compile: function compile(environment, options, context, asObject) { 41224 this.environment = environment; 41225 this.options = options; 41226 this.stringParams = this.options.stringParams; 41227 this.trackIds = this.options.trackIds; 41228 this.precompile = !asObject; 41229 41230 this.name = this.environment.name; 41231 this.isChild = !!context; 41232 this.context = context || { 41233 decorators: [], 41234 programs: [], 41235 environments: [] 41236 }; 41237 41238 this.preamble(); 41239 41240 this.stackSlot = 0; 41241 this.stackVars = []; 41242 this.aliases = {}; 41243 this.registers = { list: [] }; 41244 this.hashes = []; 41245 this.compileStack = []; 41246 this.inlineStack = []; 41247 this.blockParams = []; 41248 41249 this.compileChildren(environment, options); 41250 41251 this.useDepths = this.useDepths || environment.useDepths || environment.useDecorators || this.options.compat; 41252 this.useBlockParams = this.useBlockParams || environment.useBlockParams; 41253 41254 var opcodes = environment.opcodes, 41255 opcode = undefined, 41256 firstLoc = undefined, 41257 i = undefined, 41258 l = undefined; 41259 41260 for (i = 0, l = opcodes.length; i < l; i++) { 41261 opcode = opcodes[i]; 41262 41263 this.source.currentLocation = opcode.loc; 41264 firstLoc = firstLoc || opcode.loc; 41265 this[opcode.opcode].apply(this, opcode.args); 41266 } 41267 41268 // Flush any trailing content that might be pending. 41269 this.source.currentLocation = firstLoc; 41270 this.pushSource(''); 41271 41272 /* istanbul ignore next */ 41273 if (this.stackSlot || this.inlineStack.length || this.compileStack.length) { 41274 throw new _exception2['default']('Compile completed with content left on stack'); 41275 } 41276 41277 if (!this.decorators.isEmpty()) { 41278 this.useDecorators = true; 41279 41280 this.decorators.prepend(['var decorators = container.decorators, ', this.lookupPropertyFunctionVarDeclaration(), ';\n']); 41281 this.decorators.push('return fn;'); 41282 41283 if (asObject) { 41284 this.decorators = Function.apply(this, ['fn', 'props', 'container', 'depth0', 'data', 'blockParams', 'depths', this.decorators.merge()]); 41285 } else { 41286 this.decorators.prepend('function(fn, props, container, depth0, data, blockParams, depths) {\n'); 41287 this.decorators.push('}\n'); 41288 this.decorators = this.decorators.merge(); 41289 } 41290 } else { 41291 this.decorators = undefined; 41292 } 41293 41294 var fn = this.createFunctionContext(asObject); 41295 if (!this.isChild) { 41296 var ret = { 41297 compiler: this.compilerInfo(), 41298 main: fn 41299 }; 41300 41301 if (this.decorators) { 41302 ret.main_d = this.decorators; // eslint-disable-line camelcase 41303 ret.useDecorators = true; 41304 } 41305 41306 var _context = this.context; 41307 var programs = _context.programs; 41308 var decorators = _context.decorators; 41309 41310 for (i = 0, l = programs.length; i < l; i++) { 41311 if (programs[i]) { 41312 ret[i] = programs[i]; 41313 if (decorators[i]) { 41314 ret[i + '_d'] = decorators[i]; 41315 ret.useDecorators = true; 41316 } 41317 } 41318 } 41319 41320 if (this.environment.usePartial) { 41321 ret.usePartial = true; 41322 } 41323 if (this.options.data) { 41324 ret.useData = true; 41325 } 41326 if (this.useDepths) { 41327 ret.useDepths = true; 41328 } 41329 if (this.useBlockParams) { 41330 ret.useBlockParams = true; 41331 } 41332 if (this.options.compat) { 41333 ret.compat = true; 41334 } 41335 41336 if (!asObject) { 41337 ret.compiler = JSON.stringify(ret.compiler); 41338 41339 this.source.currentLocation = { start: { line: 1, column: 0 } }; 41340 ret = this.objectLiteral(ret); 41341 41342 if (options.srcName) { 41343 ret = ret.toStringWithSourceMap({ file: options.destName }); 41344 ret.map = ret.map && ret.map.toString(); 41345 } else { 41346 ret = ret.toString(); 41347 } 41348 } else { 41349 ret.compilerOptions = this.options; 41350 } 41351 41352 return ret; 41353 } else { 41354 return fn; 41355 } 41356 }, 41357 41358 preamble: function preamble() { 41359 // track the last context pushed into place to allow skipping the 41360 // getContext opcode when it would be a noop 41361 this.lastContext = 0; 41362 this.source = new _codeGen2['default'](this.options.srcName); 41363 this.decorators = new _codeGen2['default'](this.options.srcName); 41364 }, 41365 41366 createFunctionContext: function createFunctionContext(asObject) { 41367 // istanbul ignore next 41368 41369 var _this = this; 41370 41371 var varDeclarations = ''; 41372 41373 var locals = this.stackVars.concat(this.registers.list); 41374 if (locals.length > 0) { 41375 varDeclarations += ', ' + locals.join(', '); 41376 } 41377 41378 // Generate minimizer alias mappings 41379 // 41380 // When using true SourceNodes, this will update all references to the given alias 41381 // as the source nodes are reused in situ. For the non-source node compilation mode, 41382 // aliases will not be used, but this case is already being run on the client and 41383 // we aren't concern about minimizing the template size. 41384 var aliasCount = 0; 41385 _Object$keys(this.aliases).forEach(function (alias) { 41386 var node = _this.aliases[alias]; 41387 if (node.children && node.referenceCount > 1) { 41388 varDeclarations += ', alias' + ++aliasCount + '=' + alias; 41389 node.children[0] = 'alias' + aliasCount; 41390 } 41391 }); 41392 41393 if (this.lookupPropertyFunctionIsUsed) { 41394 varDeclarations += ', ' + this.lookupPropertyFunctionVarDeclaration(); 41395 } 41396 41397 var params = ['container', 'depth0', 'helpers', 'partials', 'data']; 41398 41399 if (this.useBlockParams || this.useDepths) { 41400 params.push('blockParams'); 41401 } 41402 if (this.useDepths) { 41403 params.push('depths'); 41404 } 41405 41406 // Perform a second pass over the output to merge content when possible 41407 var source = this.mergeSource(varDeclarations); 41408 41409 if (asObject) { 41410 params.push(source); 41411 41412 return Function.apply(this, params); 41413 } else { 41414 return this.source.wrap(['function(', params.join(','), ') {\n ', source, '}']); 41415 } 41416 }, 41417 mergeSource: function mergeSource(varDeclarations) { 41418 var isSimple = this.environment.isSimple, 41419 appendOnly = !this.forceBuffer, 41420 appendFirst = undefined, 41421 sourceSeen = undefined, 41422 bufferStart = undefined, 41423 bufferEnd = undefined; 41424 this.source.each(function (line) { 41425 if (line.appendToBuffer) { 41426 if (bufferStart) { 41427 line.prepend(' + '); 41428 } else { 41429 bufferStart = line; 41430 } 41431 bufferEnd = line; 41432 } else { 41433 if (bufferStart) { 41434 if (!sourceSeen) { 41435 appendFirst = true; 41436 } else { 41437 bufferStart.prepend('buffer += '); 41438 } 41439 bufferEnd.add(';'); 41440 bufferStart = bufferEnd = undefined; 41441 } 41442 41443 sourceSeen = true; 41444 if (!isSimple) { 41445 appendOnly = false; 41446 } 41447 } 41448 }); 41449 41450 if (appendOnly) { 41451 if (bufferStart) { 41452 bufferStart.prepend('return '); 41453 bufferEnd.add(';'); 41454 } else if (!sourceSeen) { 41455 this.source.push('return "";'); 41456 } 41457 } else { 41458 varDeclarations += ', buffer = ' + (appendFirst ? '' : this.initializeBuffer()); 41459 41460 if (bufferStart) { 41461 bufferStart.prepend('return buffer + '); 41462 bufferEnd.add(';'); 41463 } else { 41464 this.source.push('return buffer;'); 41465 } 41466 } 41467 41468 if (varDeclarations) { 41469 this.source.prepend('var ' + varDeclarations.substring(2) + (appendFirst ? '' : ';\n')); 41470 } 41471 41472 return this.source.merge(); 41473 }, 41474 41475 lookupPropertyFunctionVarDeclaration: function lookupPropertyFunctionVarDeclaration() { 41476 return '\n lookupProperty = container.lookupProperty || function(parent, propertyName) {\n if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {\n return parent[propertyName];\n }\n return undefined\n }\n '.trim(); 41477 }, 41478 41479 // [blockValue] 41480 // 41481 // On stack, before: hash, inverse, program, value 41482 // On stack, after: return value of blockHelperMissing 41483 // 41484 // The purpose of this opcode is to take a block of the form 41485 // `{{#this.foo}}...{{/this.foo}}`, resolve the value of `foo`, and 41486 // replace it on the stack with the result of properly 41487 // invoking blockHelperMissing. 41488 blockValue: function blockValue(name) { 41489 var blockHelperMissing = this.aliasable('container.hooks.blockHelperMissing'), 41490 params = [this.contextName(0)]; 41491 this.setupHelperArgs(name, 0, params); 41492 41493 var blockName = this.popStack(); 41494 params.splice(1, 0, blockName); 41495 41496 this.push(this.source.functionCall(blockHelperMissing, 'call', params)); 41497 }, 41498 41499 // [ambiguousBlockValue] 41500 // 41501 // On stack, before: hash, inverse, program, value 41502 // Compiler value, before: lastHelper=value of last found helper, if any 41503 // On stack, after, if no lastHelper: same as [blockValue] 41504 // On stack, after, if lastHelper: value 41505 ambiguousBlockValue: function ambiguousBlockValue() { 41506 // We're being a bit cheeky and reusing the options value from the prior exec 41507 var blockHelperMissing = this.aliasable('container.hooks.blockHelperMissing'), 41508 params = [this.contextName(0)]; 41509 this.setupHelperArgs('', 0, params, true); 41510 41511 this.flushInline(); 41512 41513 var current = this.topStack(); 41514 params.splice(1, 0, current); 41515 41516 this.pushSource(['if (!', this.lastHelper, ') { ', current, ' = ', this.source.functionCall(blockHelperMissing, 'call', params), '}']); 41517 }, 41518 41519 // [appendContent] 41520 // 41521 // On stack, before: ... 41522 // On stack, after: ... 41523 // 41524 // Appends the string value of `content` to the current buffer 41525 appendContent: function appendContent(content) { 41526 if (this.pendingContent) { 41527 content = this.pendingContent + content; 41528 } else { 41529 this.pendingLocation = this.source.currentLocation; 41530 } 41531 41532 this.pendingContent = content; 41533 }, 41534 41535 // [append] 41536 // 41537 // On stack, before: value, ... 41538 // On stack, after: ... 41539 // 41540 // Coerces `value` to a String and appends it to the current buffer. 41541 // 41542 // If `value` is truthy, or 0, it is coerced into a string and appended 41543 // Otherwise, the empty string is appended 41544 append: function append() { 41545 if (this.isInline()) { 41546 this.replaceStack(function (current) {
vendor: 6,035 bytes, lines 41547-41739
41547 return [' != null ? ', current, ' : ""']; 41548 }); 41549 41550 this.pushSource(this.appendToBuffer(this.popStack())); 41551 } else { 41552 var local = this.popStack(); 41553 this.pushSource(['if (', local, ' != null) { ', this.appendToBuffer(local, undefined, true), ' }']); 41554 if (this.environment.isSimple) { 41555 this.pushSource(['else { ', this.appendToBuffer("''", undefined, true), ' }']); 41556 } 41557 } 41558 }, 41559 41560 // [appendEscaped] 41561 // 41562 // On stack, before: value, ... 41563 // On stack, after: ... 41564 // 41565 // Escape `value` and append it to the buffer 41566 appendEscaped: function appendEscaped() { 41567 this.pushSource(this.appendToBuffer([this.aliasable('container.escapeExpression'), '(', this.popStack(), ')'])); 41568 }, 41569 41570 // [getContext] 41571 // 41572 // On stack, before: ... 41573 // On stack, after: ... 41574 // Compiler value, after: lastContext=depth 41575 // 41576 // Set the value of the `lastContext` compiler value to the depth 41577 getContext: function getContext(depth) { 41578 this.lastContext = depth; 41579 }, 41580 41581 // [pushContext] 41582 // 41583 // On stack, before: ... 41584 // On stack, after: currentContext, ... 41585 // 41586 // Pushes the value of the current context onto the stack. 41587 pushContext: function pushContext() { 41588 this.pushStackLiteral(this.contextName(this.lastContext)); 41589 }, 41590 41591 // [lookupOnContext] 41592 // 41593 // On stack, before: ... 41594 // On stack, after: currentContext[name], ... 41595 // 41596 // Looks up the value of `name` on the current context and pushes 41597 // it onto the stack. 41598 lookupOnContext: function lookupOnContext(parts, falsy, strict, scoped) { 41599 var i = 0; 41600 41601 if (!scoped && this.options.compat && !this.lastContext) { 41602 // The depthed query is expected to handle the undefined logic for the root level that 41603 // is implemented below, so we evaluate that directly in compat mode 41604 this.push(this.depthedLookup(parts[i++])); 41605 } else { 41606 this.pushContext(); 41607 } 41608 41609 this.resolvePath('context', parts, i, falsy, strict); 41610 }, 41611 41612 // [lookupBlockParam] 41613 // 41614 // On stack, before: ... 41615 // On stack, after: blockParam[name], ... 41616 // 41617 // Looks up the value of `parts` on the given block param and pushes 41618 // it onto the stack. 41619 lookupBlockParam: function lookupBlockParam(blockParamId, parts) { 41620 this.useBlockParams = true; 41621 41622 this.push(['blockParams[', blockParamId[0], '][', blockParamId[1], ']']); 41623 this.resolvePath('context', parts, 1); 41624 }, 41625 41626 // [lookupData] 41627 // 41628 // On stack, before: ... 41629 // On stack, after: data, ... 41630 // 41631 // Push the data lookup operator 41632 lookupData: function lookupData(depth, parts, strict) { 41633 if (!depth) { 41634 this.pushStackLiteral('data'); 41635 } else { 41636 this.pushStackLiteral('container.data(data, ' + depth + ')'); 41637 } 41638 41639 this.resolvePath('data', parts, 0, true, strict); 41640 }, 41641 41642 resolvePath: function resolvePath(type, parts, i, falsy, strict) { 41643 // istanbul ignore next 41644 41645 var _this2 = this; 41646 41647 if (this.options.strict || this.options.assumeObjects) { 41648 this.push(strictLookup(this.options.strict && strict, this, parts, type)); 41649 return; 41650 } 41651 41652 var len = parts.length; 41653 for (; i < len; i++) { 41654 /* eslint-disable no-loop-func */ 41655 this.replaceStack(function (current) { 41656 var lookup = _this2.nameLookup(current, parts[i], type); 41657 // We want to ensure that zero and false are handled properly if the context (falsy flag) 41658 // needs to have the special handling for these values. 41659 if (!falsy) { 41660 return [' != null ? ', lookup, ' : ', current]; 41661 } else { 41662 // Otherwise we can use generic falsy handling 41663 return [' && ', lookup]; 41664 } 41665 }); 41666 /* eslint-enable no-loop-func */ 41667 } 41668 }, 41669 41670 // [resolvePossibleLambda] 41671 // 41672 // On stack, before: value, ... 41673 // On stack, after: resolved value, ... 41674 // 41675 // If the `value` is a lambda, replace it on the stack by 41676 // the return value of the lambda 41677 resolvePossibleLambda: function resolvePossibleLambda() { 41678 this.push([this.aliasable('container.lambda'), '(', this.popStack(), ', ', this.contextName(0), ')']); 41679 }, 41680 41681 // [pushStringParam] 41682 // 41683 // On stack, before: ... 41684 // On stack, after: string, currentContext, ... 41685 // 41686 // This opcode is designed for use in string mode, which 41687 // provides the string value of a parameter along with its 41688 // depth rather than resolving it immediately. 41689 pushStringParam: function pushStringParam(string, type) { 41690 this.pushContext(); 41691 this.pushString(type); 41692 41693 // If it's a subexpression, the string result 41694 // will be pushed after this opcode. 41695 if (type !== 'SubExpression') { 41696 if (typeof string === 'string') { 41697 this.pushString(string); 41698 } else { 41699 this.pushStackLiteral(string); 41700 } 41701 } 41702 }, 41703 41704 emptyHash: function emptyHash(omitEmpty) { 41705 if (this.trackIds) { 41706 this.push('{}'); // hashIds 41707 } 41708 if (this.stringParams) { 41709 this.push('{}'); // hashContexts 41710 this.push('{}'); // hashTypes 41711 } 41712 this.pushStackLiteral(omitEmpty ? 'undefined' : '{}'); 41713 }, 41714 pushHash: function pushHash() { 41715 if (this.hash) { 41716 this.hashes.push(this.hash); 41717 } 41718 this.hash = { values: {}, types: [], contexts: [], ids: [] }; 41719 }, 41720 popHash: function popHash() { 41721 var hash = this.hash; 41722 this.hash = this.hashes.pop(); 41723 41724 if (this.trackIds) { 41725 this.push(this.objectLiteral(hash.ids)); 41726 } 41727 if (this.stringParams) { 41728 this.push(this.objectLiteral(hash.contexts)); 41729 this.push(this.objectLiteral(hash.types)); 41730 } 41731 41732 this.push(this.objectLiteral(hash.values)); 41733 }, 41734 41735 // [pushString] 41736 // 41737 // On stack, before: ... 41738 // On stack, after: quotedString(string), ... 41739 //
vendor: 4,498 bytes, lines 41740-41862
41740 // Push a quoted version of `string` onto the stack 41741 pushString: function pushString(string) { 41742 this.pushStackLiteral(this.quotedString(string)); 41743 }, 41744 41745 // [pushLiteral] 41746 // 41747 // On stack, before: ... 41748 // On stack, after: value, ... 41749 // 41750 // Pushes a value onto the stack. This operation prevents 41751 // the compiler from creating a temporary variable to hold 41752 // it. 41753 pushLiteral: function pushLiteral(value) { 41754 this.pushStackLiteral(value); 41755 }, 41756 41757 // [pushProgram] 41758 // 41759 // On stack, before: ... 41760 // On stack, after: program(guid), ... 41761 // 41762 // Push a program expression onto the stack. This takes 41763 // a compile-time guid and converts it into a runtime-accessible 41764 // expression. 41765 pushProgram: function pushProgram(guid) { 41766 if (guid != null) { 41767 this.pushStackLiteral(this.programExpression(guid)); 41768 } else { 41769 this.pushStackLiteral(null); 41770 } 41771 }, 41772 41773 // [registerDecorator] 41774 // 41775 // On stack, before: hash, program, params..., ... 41776 // On stack, after: ... 41777 // 41778 // Pops off the decorator's parameters, invokes the decorator, 41779 // and inserts the decorator into the decorators list. 41780 registerDecorator: function registerDecorator(paramSize, name) { 41781 var foundDecorator = this.nameLookup('decorators', name, 'decorator'), 41782 options = this.setupHelperArgs(name, paramSize); 41783 41784 this.decorators.push(['fn = ', this.decorators.functionCall(foundDecorator, '', ['fn', 'props', 'container', options]), ' || fn;']); 41785 }, 41786 41787 // [invokeHelper] 41788 // 41789 // On stack, before: hash, inverse, program, params..., ... 41790 // On stack, after: result of helper invocation 41791 // 41792 // Pops off the helper's parameters, invokes the helper, 41793 // and pushes the helper's return value onto the stack. 41794 // 41795 // If the helper is not found, `helperMissing` is called. 41796 invokeHelper: function invokeHelper(paramSize, name, isSimple) { 41797 var nonHelper = this.popStack(), 41798 helper = this.setupHelper(paramSize, name); 41799 41800 var possibleFunctionCalls = []; 41801 41802 if (isSimple) { 41803 // direct call to helper 41804 possibleFunctionCalls.push(helper.name); 41805 } 41806 // call a function from the input object 41807 possibleFunctionCalls.push(nonHelper); 41808 if (!this.options.strict) { 41809 possibleFunctionCalls.push(this.aliasable('container.hooks.helperMissing')); 41810 } 41811 41812 var functionLookupCode = ['(', this.itemsSeparatedBy(possibleFunctionCalls, '||'), ')']; 41813 var functionCall = this.source.functionCall(functionLookupCode, 'call', helper.callParams); 41814 this.push(functionCall); 41815 }, 41816 41817 itemsSeparatedBy: function itemsSeparatedBy(items, separator) { 41818 var result = []; 41819 result.push(items[0]); 41820 for (var i = 1; i < items.length; i++) { 41821 result.push(separator, items[i]); 41822 } 41823 return result; 41824 }, 41825 // [invokeKnownHelper] 41826 // 41827 // On stack, before: hash, inverse, program, params..., ... 41828 // On stack, after: result of helper invocation 41829 // 41830 // This operation is used when the helper is known to exist, 41831 // so a `helperMissing` fallback is not required. 41832 invokeKnownHelper: function invokeKnownHelper(paramSize, name) { 41833 var helper = this.setupHelper(paramSize, name); 41834 this.push(this.source.functionCall(helper.name, 'call', helper.callParams)); 41835 }, 41836 41837 // [invokeAmbiguous] 41838 // 41839 // On stack, before: hash, inverse, program, params..., ... 41840 // On stack, after: result of disambiguation 41841 // 41842 // This operation is used when an expression like `{{foo}}` 41843 // is provided, but we don't know at compile-time whether it 41844 // is a helper or a path. 41845 // 41846 // This operation emits more code than the other options, 41847 // and can be avoided by passing the `knownHelpers` and 41848 // `knownHelpersOnly` flags at compile-time. 41849 invokeAmbiguous: function invokeAmbiguous(name, helperCall) { 41850 this.useRegister('helper'); 41851 41852 var nonHelper = this.popStack(); 41853 41854 this.emptyHash(); 41855 var helper = this.setupHelper(0, name, helperCall); 41856 41857 var helperName = this.lastHelper = this.nameLookup('helpers', name, 'helper'); 41858 41859 var lookup = ['(', '(helper = ', helperName, ' || ', nonHelper, ')']; 41860 if (!this.options.strict) { 41861 lookup[0] = '(helper = '; 41862 lookup.push(' != null ? helper : ', this.aliasable('container.hooks.helperMissing'));
vendor: 5,268 bytes, lines 41863-42032
41863 } 41864 41865 this.push(['(', lookup, helper.paramsInit ? ['),(', helper.paramsInit] : [], '),', '(typeof helper === ', this.aliasable('"function"'), ' ? ', this.source.functionCall('helper', 'call', helper.callParams), ' : helper))']); 41866 }, 41867 41868 // [invokePartial] 41869 // 41870 // On stack, before: context, ... 41871 // On stack after: result of partial invocation 41872 // 41873 // This operation pops off a context, invokes a partial with that context, 41874 // and pushes the result of the invocation back. 41875 invokePartial: function invokePartial(isDynamic, name, indent) { 41876 var params = [], 41877 options = this.setupParams(name, 1, params); 41878 41879 if (isDynamic) { 41880 name = this.popStack(); 41881 delete options.name; 41882 } 41883 41884 if (indent) { 41885 options.indent = JSON.stringify(indent); 41886 } 41887 options.helpers = 'helpers'; 41888 options.partials = 'partials'; 41889 options.decorators = 'container.decorators'; 41890 41891 if (!isDynamic) { 41892 params.unshift(this.nameLookup('partials', name, 'partial')); 41893 } else { 41894 params.unshift(name); 41895 } 41896 41897 if (this.options.compat) { 41898 options.depths = 'depths'; 41899 } 41900 options = this.objectLiteral(options); 41901 params.push(options); 41902 41903 this.push(this.source.functionCall('container.invokePartial', '', params)); 41904 }, 41905 41906 // [assignToHash] 41907 // 41908 // On stack, before: value, ..., hash, ... 41909 // On stack, after: ..., hash, ... 41910 // 41911 // Pops a value off the stack and assigns it to the current hash 41912 assignToHash: function assignToHash(key) { 41913 var value = this.popStack(), 41914 context = undefined, 41915 type = undefined, 41916 id = undefined; 41917 41918 if (this.trackIds) { 41919 id = this.popStack(); 41920 } 41921 if (this.stringParams) { 41922 type = this.popStack(); 41923 context = this.popStack(); 41924 } 41925 41926 var hash = this.hash; 41927 if (context) { 41928 hash.contexts[key] = context; 41929 } 41930 if (type) { 41931 hash.types[key] = type; 41932 } 41933 if (id) { 41934 hash.ids[key] = id; 41935 } 41936 hash.values[key] = value; 41937 }, 41938 41939 pushId: function pushId(type, name, child) { 41940 if (type === 'BlockParam') { 41941 this.pushStackLiteral('blockParams[' + name[0] + '].path[' + name[1] + ']' + (child ? ' + ' + JSON.stringify('.' + child) : '')); 41942 } else if (type === 'PathExpression') { 41943 this.pushString(name); 41944 } else if (type === 'SubExpression') { 41945 this.pushStackLiteral('true'); 41946 } else { 41947 this.pushStackLiteral('null'); 41948 } 41949 }, 41950 41951 // HELPERS 41952 41953 compiler: JavaScriptCompiler, 41954 41955 compileChildren: function compileChildren(environment, options) { 41956 var children = environment.children, 41957 child = undefined, 41958 compiler = undefined; 41959 41960 for (var i = 0, l = children.length; i < l; i++) { 41961 child = children[i]; 41962 compiler = new this.compiler(); // eslint-disable-line new-cap 41963 41964 var existing = this.matchExistingProgram(child); 41965 41966 if (existing == null) { 41967 this.context.programs.push(''); // Placeholder to prevent name conflicts for nested children 41968 var index = this.context.programs.length; 41969 child.index = index; 41970 child.name = 'program' + index; 41971 this.context.programs[index] = compiler.compile(child, options, this.context, !this.precompile); 41972 this.context.decorators[index] = compiler.decorators; 41973 this.context.environments[index] = child; 41974 41975 this.useDepths = this.useDepths || compiler.useDepths; 41976 this.useBlockParams = this.useBlockParams || compiler.useBlockParams; 41977 child.useDepths = this.useDepths; 41978 child.useBlockParams = this.useBlockParams; 41979 } else { 41980 child.index = existing.index; 41981 child.name = 'program' + existing.index; 41982 41983 this.useDepths = this.useDepths || existing.useDepths; 41984 this.useBlockParams = this.useBlockParams || existing.useBlockParams; 41985 } 41986 } 41987 }, 41988 matchExistingProgram: function matchExistingProgram(child) { 41989 for (var i = 0, len = this.context.environments.length; i < len; i++) { 41990 var environment = this.context.environments[i]; 41991 if (environment && environment.equals(child)) { 41992 return environment; 41993 } 41994 } 41995 }, 41996 41997 programExpression: function programExpression(guid) { 41998 var child = this.environment.children[guid], 41999 programParams = [child.index, 'data', child.blockParams]; 42000 42001 if (this.useBlockParams || this.useDepths) { 42002 programParams.push('blockParams'); 42003 } 42004 if (this.useDepths) { 42005 programParams.push('depths'); 42006 } 42007 42008 return 'container.program(' + programParams.join(', ') + ')'; 42009 }, 42010 42011 useRegister: function useRegister(name) { 42012 if (!this.registers[name]) { 42013 this.registers[name] = true; 42014 this.registers.list.push(name); 42015 } 42016 }, 42017 42018 push: function push(expr) { 42019 if (!(expr instanceof Literal)) { 42020 expr = this.source.wrap(expr); 42021 } 42022 42023 this.inlineStack.push(expr); 42024 return expr; 42025 }, 42026 42027 pushStackLiteral: function pushStackLiteral(item) { 42028 this.push(new Literal(item)); 42029 }, 42030 42031 pushSource: function pushSource(source) { 42032 if (this.pendingContent) {
vendor: 7,448 bytes, lines 42033-42283
42033 this.source.push(this.appendToBuffer(this.source.quotedString(this.pendingContent), this.pendingLocation)); 42034 this.pendingContent = undefined; 42035 } 42036 42037 if (source) { 42038 this.source.push(source); 42039 } 42040 }, 42041 42042 replaceStack: function replaceStack(callback) { 42043 var prefix = ['('], 42044 stack = undefined, 42045 createdStack = undefined, 42046 usedLiteral = undefined; 42047 42048 /* istanbul ignore next */ 42049 if (!this.isInline()) { 42050 throw new _exception2['default']('replaceStack on non-inline'); 42051 } 42052 42053 // We want to merge the inline statement into the replacement statement via ',' 42054 var top = this.popStack(true); 42055 42056 if (top instanceof Literal) { 42057 // Literals do not need to be inlined 42058 stack = [top.value]; 42059 prefix = ['(', stack]; 42060 usedLiteral = true; 42061 } else { 42062 // Get or create the current stack name for use by the inline 42063 createdStack = true; 42064 var _name = this.incrStack(); 42065 42066 prefix = ['((', this.push(_name), ' = ', top, ')']; 42067 stack = this.topStack(); 42068 } 42069 42070 var item = callback.call(this, stack); 42071 42072 if (!usedLiteral) { 42073 this.popStack(); 42074 } 42075 if (createdStack) { 42076 this.stackSlot--; 42077 } 42078 this.push(prefix.concat(item, ')')); 42079 }, 42080 42081 incrStack: function incrStack() { 42082 this.stackSlot++; 42083 if (this.stackSlot > this.stackVars.length) { 42084 this.stackVars.push('stack' + this.stackSlot); 42085 } 42086 return this.topStackName(); 42087 }, 42088 topStackName: function topStackName() { 42089 return 'stack' + this.stackSlot; 42090 }, 42091 flushInline: function flushInline() { 42092 var inlineStack = this.inlineStack; 42093 this.inlineStack = []; 42094 for (var i = 0, len = inlineStack.length; i < len; i++) { 42095 var entry = inlineStack[i]; 42096 /* istanbul ignore if */ 42097 if (entry instanceof Literal) { 42098 this.compileStack.push(entry); 42099 } else { 42100 var stack = this.incrStack(); 42101 this.pushSource([stack, ' = ', entry, ';']); 42102 this.compileStack.push(stack); 42103 } 42104 } 42105 }, 42106 isInline: function isInline() { 42107 return this.inlineStack.length; 42108 }, 42109 42110 popStack: function popStack(wrapped) { 42111 var inline = this.isInline(), 42112 item = (inline ? this.inlineStack : this.compileStack).pop(); 42113 42114 if (!wrapped && item instanceof Literal) { 42115 return item.value; 42116 } else { 42117 if (!inline) { 42118 /* istanbul ignore next */ 42119 if (!this.stackSlot) { 42120 throw new _exception2['default']('Invalid stack pop'); 42121 } 42122 this.stackSlot--; 42123 } 42124 return item; 42125 } 42126 }, 42127 42128 topStack: function topStack() { 42129 var stack = this.isInline() ? this.inlineStack : this.compileStack, 42130 item = stack[stack.length - 1]; 42131 42132 /* istanbul ignore if */ 42133 if (item instanceof Literal) { 42134 return item.value; 42135 } else { 42136 return item; 42137 } 42138 }, 42139 42140 contextName: function contextName(context) { 42141 if (this.useDepths && context) { 42142 return 'depths[' + context + ']'; 42143 } else { 42144 return 'depth' + context; 42145 } 42146 }, 42147 42148 quotedString: function quotedString(str) { 42149 return this.source.quotedString(str); 42150 }, 42151 42152 objectLiteral: function objectLiteral(obj) { 42153 return this.source.objectLiteral(obj); 42154 }, 42155 42156 aliasable: function aliasable(name) { 42157 var ret = this.aliases[name]; 42158 if (ret) { 42159 ret.referenceCount++; 42160 return ret; 42161 } 42162 42163 ret = this.aliases[name] = this.source.wrap(name); 42164 ret.aliasable = true; 42165 ret.referenceCount = 1; 42166 42167 return ret; 42168 }, 42169 42170 setupHelper: function setupHelper(paramSize, name, blockHelper) { 42171 var params = [], 42172 paramsInit = this.setupHelperArgs(name, paramSize, params, blockHelper); 42173 var foundHelper = this.nameLookup('helpers', name, 'helper'), 42174 callContext = this.aliasable(this.contextName(0) + ' != null ? ' + this.contextName(0) + ' : (container.nullContext || {})'); 42175 42176 return { 42177 params: params, 42178 paramsInit: paramsInit, 42179 name: foundHelper, 42180 callParams: [callContext].concat(params) 42181 }; 42182 }, 42183 42184 setupParams: function setupParams(helper, paramSize, params) { 42185 var options = {}, 42186 contexts = [], 42187 types = [], 42188 ids = [], 42189 objectArgs = !params, 42190 param = undefined; 42191 42192 if (objectArgs) { 42193 params = []; 42194 } 42195 42196 options.name = this.quotedString(helper); 42197 options.hash = this.popStack(); 42198 42199 if (this.trackIds) { 42200 options.hashIds = this.popStack(); 42201 } 42202 if (this.stringParams) { 42203 options.hashTypes = this.popStack(); 42204 options.hashContexts = this.popStack(); 42205 } 42206 42207 var inverse = this.popStack(), 42208 program = this.popStack(); 42209 42210 // Avoid setting fn and inverse if neither are set. This allows 42211 // helpers to do a check for `if (options.fn)` 42212 if (program || inverse) { 42213 options.fn = program || 'container.noop'; 42214 options.inverse = inverse || 'container.noop'; 42215 } 42216 42217 // The parameters go on to the stack in order (making sure that they are evaluated in order) 42218 // so we need to pop them off the stack in reverse order 42219 var i = paramSize; 42220 while (i--) { 42221 param = this.popStack(); 42222 params[i] = param; 42223 42224 if (this.trackIds) { 42225 ids[i] = this.popStack(); 42226 } 42227 if (this.stringParams) { 42228 types[i] = this.popStack(); 42229 contexts[i] = this.popStack(); 42230 } 42231 } 42232 42233 if (objectArgs) { 42234 options.args = this.source.generateArray(params); 42235 } 42236 42237 if (this.trackIds) { 42238 options.ids = this.source.generateArray(ids); 42239 } 42240 if (this.stringParams) { 42241 options.types = this.source.generateArray(types); 42242 options.contexts = this.source.generateArray(contexts); 42243 } 42244 42245 if (this.options.data) { 42246 options.data = 'data'; 42247 } 42248 if (this.useBlockParams) { 42249 options.blockParams = 'blockParams'; 42250 } 42251 return options; 42252 }, 42253 42254 setupHelperArgs: function setupHelperArgs(helper, paramSize, params, useRegister) { 42255 var options = this.setupParams(helper, paramSize, params); 42256 options.loc = JSON.stringify(this.source.currentLocation); 42257 options = this.objectLiteral(options); 42258 if (useRegister) { 42259 this.useRegister('options'); 42260 params.push('options'); 42261 return ['options=', options]; 42262 } else if (params) { 42263 params.push(options); 42264 return ''; 42265 } else { 42266 return options; 42267 } 42268 } 42269 }; 42270 42271 (function () { 42272 var reservedWords = ('break else new var' + ' case finally return void' + ' catch for switch while' + ' continue function this with' + ' default if throw' + ' delete in try' + ' do instanceof typeof' + ' abstract enum int short' + ' boolean export interface static' + ' byte extends long super' + ' char final native synchronized' + ' class float package throws' + ' const goto private transient' + ' debugger implements protected volatile' + ' double import public let yield await' + ' null true false').split(' '); 42273 42274 var compilerWords = JavaScriptCompiler.RESERVED_WORDS = {}; 42275 42276 for (var i = 0, l = reservedWords.length; i < l; i++) { 42277 compilerWords[reservedWords[i]] = true; 42278 } 42279 })(); 42280 42281 /** 42282 * @deprecated May be removed in the next major version 42283 */
vendor: 4,462 bytes, lines 42284-42438
42284 JavaScriptCompiler.isValidJavaScriptVariableName = function (name) { 42285 return !JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(name); 42286 }; 42287 42288 function strictLookup(requireTerminal, compiler, parts, type) { 42289 var stack = compiler.popStack(), 42290 i = 0, 42291 len = parts.length; 42292 if (requireTerminal) { 42293 len--; 42294 } 42295 42296 for (; i < len; i++) { 42297 stack = compiler.nameLookup(stack, parts[i], type); 42298 } 42299 42300 if (requireTerminal) { 42301 return [compiler.aliasable('container.strict'), '(', stack, ', ', compiler.quotedString(parts[i]), ', ', JSON.stringify(compiler.source.currentLocation), ' )']; 42302 } else { 42303 return stack; 42304 } 42305 } 42306 42307 exports['default'] = JavaScriptCompiler; 42308 module.exports = exports['default']; 42309 42310 /***/ 42311}), 42312/* 53 */ 42313/***/ (function (module, exports, __webpack_require__) { 42314 42315 /* global define */ 42316 'use strict'; 42317 42318 var _Object$keys = __webpack_require__(13)['default']; 42319 42320 exports.__esModule = true; 42321 42322 var _utils = __webpack_require__(5); 42323 42324 var SourceNode = undefined; 42325 42326 try { 42327 /* istanbul ignore next */ 42328 if (false) { 42329 // We don't support this in AMD environments. For these environments, we asusme that 42330 // they are running on the browser and thus have no need for the source-map library. 42331 var SourceMap = require('source-map'); 42332 SourceNode = SourceMap.SourceNode; 42333 } 42334 } catch (err) { } 42335 /* NOP */ 42336 42337 /* istanbul ignore if: tested but not covered in istanbul due to dist build */ 42338 if (!SourceNode) { 42339 SourceNode = function (line, column, srcFile, chunks) { 42340 this.src = ''; 42341 if (chunks) { 42342 this.add(chunks); 42343 } 42344 }; 42345 /* istanbul ignore next */ 42346 SourceNode.prototype = { 42347 add: function add(chunks) { 42348 if (_utils.isArray(chunks)) { 42349 chunks = chunks.join(''); 42350 } 42351 this.src += chunks; 42352 }, 42353 prepend: function prepend(chunks) { 42354 if (_utils.isArray(chunks)) { 42355 chunks = chunks.join(''); 42356 } 42357 this.src = chunks + this.src; 42358 }, 42359 toStringWithSourceMap: function toStringWithSourceMap() { 42360 return { code: this.toString() }; 42361 }, 42362 toString: function toString() { 42363 return this.src; 42364 } 42365 }; 42366 } 42367 42368 function castChunk(chunk, codeGen, loc) { 42369 if (_utils.isArray(chunk)) { 42370 var ret = []; 42371 42372 for (var i = 0, len = chunk.length; i < len; i++) { 42373 ret.push(codeGen.wrap(chunk[i], loc)); 42374 } 42375 return ret; 42376 } else if (typeof chunk === 'boolean' || typeof chunk === 'number') { 42377 // Handle primitives that the SourceNode will throw up on 42378 return chunk + ''; 42379 } 42380 return chunk; 42381 } 42382 42383 function CodeGen(srcFile) { 42384 this.srcFile = srcFile; 42385 this.source = []; 42386 } 42387 42388 CodeGen.prototype = { 42389 isEmpty: function isEmpty() { 42390 return !this.source.length; 42391 }, 42392 prepend: function prepend(source, loc) { 42393 this.source.unshift(this.wrap(source, loc)); 42394 }, 42395 push: function push(source, loc) { 42396 this.source.push(this.wrap(source, loc)); 42397 }, 42398 42399 merge: function merge() { 42400 var source = this.empty(); 42401 this.each(function (line) { 42402 source.add([' ', line, '\n']); 42403 }); 42404 return source; 42405 }, 42406 42407 each: function each(iter) { 42408 for (var i = 0, len = this.source.length; i < len; i++) { 42409 iter(this.source[i]); 42410 } 42411 }, 42412 42413 empty: function empty() { 42414 var loc = this.currentLocation || { start: {} }; 42415 return new SourceNode(loc.start.line, loc.start.column, this.srcFile); 42416 }, 42417 wrap: function wrap(chunk) { 42418 var loc = arguments.length <= 1 || arguments[1] === undefined ? this.currentLocation || { start: {} } : arguments[1]; 42419 42420 if (chunk instanceof SourceNode) { 42421 return chunk; 42422 } 42423 42424 chunk = castChunk(chunk, this, loc); 42425 42426 return new SourceNode(loc.start.line, loc.start.column, this.srcFile, chunk); 42427 }, 42428 42429 functionCall: function functionCall(fn, type, params) { 42430 params = this.generateList(params); 42431 return this.wrap([fn, type ? '.' + type + '(' : '(', params, ')']); 42432 }, 42433 42434 quotedString: function quotedString(str) { 42435 return '"' + (str + '').replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\n/g, '\\n').replace(/\r/g, '\\r').replace(/\u2028/g, '\\u2028') // Per Ecma-262 7.3 + 7.8.4 42436 .replace(/\u2029/g, '\\u2029') + '"'; 42437 }, 42438
42439 objectLiteral: function objectLiteral(obj) { 42440 // istanbul ignore next 42441 42442 var _this = this; 42443 42444 var pairs = []; 42445 42446 _Object$keys(obj).forEach(function (key) { 42447 var value = castChunk(obj[key], _this); 42448 if (value !== 'undefined') { 42449 pairs.push([_this.quotedString(key), ':', value]); 42450 } 42451 }); 42452 42453 var ret = this.generateList(pairs); 42454 ret.prepend('{'); 42455 ret.add('}'); 42456 return ret; 42457 }, 42458 42459 generateList: function generateList(entries) { 42460 var ret = this.empty(); 42461 42462 for (var i = 0, len = entries.length; i < len; i++) { 42463 if (i) { 42464 ret.add(','); 42465 } 42466 42467 ret.add(castChunk(entries[i], this)); 42468 } 42469 42470 return ret; 42471 }, 42472 42473 generateArray: function generateArray(entries) { 42474 var ret = this.generateList(entries); 42475 ret.prepend('['); 42476 ret.add(']'); 42477 42478 return ret; 42479 } 42480 }; 42481 42482 exports['default'] = CodeGen; 42483 module.exports = exports['default']; 42484 42485 /***/ 42486}) 42487/******/]) 42488}); 42489;; 42490 42491//register helper functions for handlebar templates 42492 42493//if each row has 3 items 42494Handlebars.registerHelper('ifNewRow_3', function (index, options) { 42495 if ((index + 1) % 3 == 0) { 42496 return options.fn(this); 42497 } else { 42498 return options.inverse(this); 42499 } 42500}); 42501 42502//if each row has 4 items 42503Handlebars.registerHelper('ifNewRow_4', function (index, options) { 42504 if ((index + 1) % 4 == 0) { 42505 return options.fn(this); 42506 } else { 42507 return options.inverse(this); 42508 } 42509}); 42510 42511Handlebars.registerHelper('ifThirdRow', function (index, options) { 42512 //if (paginationParams.rowCount == 3) { 42513 // return options.fn(this); 42514 //} 42515}); 42516 42517Handlebars.registerHelper('ifCond', function (v1, operator, v2, options) { 42518 42519 switch (operator) { 42520 case '==': 42521 return (v1 == v2) ? options.fn(this) : options.inverse(this); 42522 case '===': 42523 return (v1 === v2) ? options.fn(this) : options.inverse(this); 42524 case '!=': 42525 return (v1 != v2) ? options.fn(this) : options.inverse(this); 42526 case '!==': 42527 return (v1 !== v2) ? options.fn(this) : options.inverse(this); 42528 case '<': 42529 return (v1 < v2) ? options.fn(this) : options.inverse(this); 42530 case '<=': 42531 return (v1 <= v2) ? options.fn(this) : options.inverse(this); 42532 case '>': 42533 return (v1 > v2) ? options.fn(this) : options.inverse(this); 42534 case '>=': 42535 return (v1 >= v2) ? options.fn(this) : options.inverse(this); 42536 case '&&': 42537 return (v1 && v2) ? options.fn(this) : options.inverse(this); 42538 case '||': 42539 return (v1 || v2) ? options.fn(this) : options.inverse(this); 42540 default: 42541 return options.inverse(this); 42542 } 42543});; 42544/*! 42545 * imagesLoaded PACKAGED v3.1.8 42546 * JavaScript is all like "You images are done yet or what?" 42547 * MIT License 42548 */ 42549 42550 42551/*! 42552 * EventEmitter v4.2.6 - git.io/ee 42553 * Oliver Caldwell 42554 * MIT license 42555 * @preserve 42556 */ 42557 42558(function () { 42559 42560 42561 /** 42562 * Class for managing events. 42563 * Can be extended to provide event functionality in other classes. 42564 * 42565 * @class EventEmitter Manages event registering and emitting. 42566 */ 42567 function EventEmitter() {} 42568 42569 // Shortcuts to improve speed and size 42570 var proto = EventEmitter.prototype; 42571 var exports = this; 42572 var originalGlobalValue = exports.EventEmitter; 42573 42574 /** 42575 * Finds the index of the listener for the event in it's storage array. 42576 * 42577 * @param {Function[]} listeners Array of listeners to search through. 42578 * @param {Function} listener Method to look for. 42579 * @return {Number} Index of the specified listener, -1 if not found 42580 * @api private 42581 */ 42582 function indexOfListener(listeners, listener) { 42583 var i = listeners.length; 42584 while (i--) { 42585 if (listeners[i].listener === listener) { 42586 return i; 42587 } 42588 } 42589 42590 return -1; 42591 } 42592 42593 /** 42594 * Alias a method while keeping the context correct, to allow for overwriting of target method. 42595 * 42596 * @param {String} name The name of the target method. 42597 * @return {Function} The aliased method 42598 * @api private 42599 */ 42600 function alias(name) { 42601 return function aliasClosure() { 42602 return this[name].apply(this, arguments); 42603 }; 42604 } 42605 42606 /** 42607 * Returns the listener array for the specified event. 42608 * Will initialise the event object and listener arrays if required. 42609 * Will return an object if you use a regex search. The object c
vendor: 11,181 bytes, lines 42609-42902
42609ontains keys for each matched event. So /ba[rz]/ might return an object containing bar and baz. But only if you have either defined them with defineEvent or added some listeners to them. 42610 * Each property in the object response is an array of listener functions. 42611 * 42612 * @param {String|RegExp} evt Name of the event to return the listeners from. 42613 * @return {Function[]|Object} All listener functions for the event. 42614 */ 42615 proto.getListeners = function getListeners(evt) { 42616 var events = this._getEvents(); 42617 var response; 42618 var key; 42619 42620 // Return a concatenated array of all matching events if 42621 // the selector is a regular expression. 42622 if (typeof evt === 'object') { 42623 response = {}; 42624 for (key in events) { 42625 if (events.hasOwnProperty(key) && evt.test(key)) { 42626 response[key] = events[key]; 42627 } 42628 } 42629 } 42630 else { 42631 response = events[evt] || (events[evt] = []); 42632 } 42633 42634 return response; 42635 }; 42636 42637 /** 42638 * Takes a list of listener objects and flattens it into a list of listener functions. 42639 * 42640 * @param {Object[]} listeners Raw listener objects. 42641 * @return {Function[]} Just the listener functions. 42642 */ 42643 proto.flattenListeners = function flattenListeners(listeners) { 42644 var flatListeners = []; 42645 var i; 42646 42647 for (i = 0; i < listeners.length; i += 1) { 42648 flatListeners.push(listeners[i].listener); 42649 } 42650 42651 return flatListeners; 42652 }; 42653 42654 /** 42655 * Fetches the requested listeners via getListeners but will always return the results inside an object. This is mainly for internal use but others may find it useful. 42656 * 42657 * @param {String|RegExp} evt Name of the event to return the listeners from. 42658 * @return {Object} All listener functions for an event in an object. 42659 */ 42660 proto.getListenersAsObject = function getListenersAsObject(evt) { 42661 var listeners = this.getListeners(evt); 42662 var response; 42663 42664 if (listeners instanceof Array) { 42665 response = {}; 42666 response[evt] = listeners; 42667 } 42668 42669 return response || listeners; 42670 }; 42671 42672 /** 42673 * Adds a listener function to the specified event. 42674 * The listener will not be added if it is a duplicate. 42675 * If the listener returns true then it will be removed after it is called. 42676 * If you pass a regular expression as the event name then the listener will be added to all events that match it. 42677 * 42678 * @param {String|RegExp} evt Name of the event to attach the listener to. 42679 * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling. 42680 * @return {Object} Current instance of EventEmitter for chaining. 42681 */ 42682 proto.addListener = function addListener(evt, listener) { 42683 var listeners = this.getListenersAsObject(evt); 42684 var listenerIsWrapped = typeof listener === 'object'; 42685 var key; 42686 42687 for (key in listeners) { 42688 if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) { 42689 listeners[key].push(listenerIsWrapped ? listener : { 42690 listener: listener, 42691 once: false 42692 }); 42693 } 42694 } 42695 42696 return this; 42697 }; 42698 42699 /** 42700 * Alias of addListener 42701 */ 42702 proto.on = alias('addListener'); 42703 42704 /** 42705 * Semi-alias of addListener. It will add a listener that will be 42706 * automatically removed after it's first execution. 42707 * 42708 * @param {String|RegExp} evt Name of the event to attach the listener to. 42709 * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling. 42710 * @return {Object} Current instance of EventEmitter for chaining. 42711 */ 42712 proto.addOnceListener = function addOnceListener(evt, listener) { 42713 return this.addListener(evt, { 42714 listener: listener, 42715 once: true 42716 }); 42717 }; 42718 42719 /** 42720 * Alias of addOnceListener. 42721 */ 42722 proto.once = alias('addOnceListener'); 42723 42724 /** 42725 * Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don't do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad. 42726 * You need to tell it what event names should be matched by a regex. 42727 * 42728 * @param {String} evt Name of the event to create. 42729 * @return {Object} Current instance of EventEmitter for chaining. 42730 */ 42731 proto.defineEvent = function defineEvent(evt) { 42732 this.getListeners(evt); 42733 return this; 42734 }; 42735 42736 /** 42737 * Uses defineEvent to define multiple events. 42738 * 42739 * @param {String[]} evts An array of event names to define. 42740 * @return {Object} Current instance of EventEmitter for chaining. 42741 */ 42742 proto.defineEvents = function defineEvents(evts) { 42743 for (var i = 0; i < evts.length; i += 1) { 42744 this.defineEvent(evts[i]); 42745 } 42746 return this; 42747 }; 42748 42749 /** 42750 * Removes a listener function from the specified event. 42751 * When passed a regular expression as the event name, it will remove the listener from all events that match it. 42752 * 42753 * @param {String|RegExp} evt Name of the event to remove the listener from. 42754 * @param {Function} listener Method to remove from the event. 42755 * @return {Object} Current instance of EventEmitter for chaining. 42756 */ 42757 proto.removeListener = function removeListener(evt, listener) { 42758 var listeners = this.getListenersAsObject(evt); 42759 var index; 42760 var key; 42761 42762 for (key in listeners) { 42763 if (listeners.hasOwnProperty(key)) { 42764 index = indexOfListener(listeners[key], listener); 42765 42766 if (index !== -1) { 42767 listeners[key].splice(index, 1); 42768 } 42769 } 42770 } 42771 42772 return this; 42773 }; 42774 42775 /** 42776 * Alias of removeListener 42777 */ 42778 proto.off = alias('removeListener'); 42779 42780 /** 42781 * Adds listeners in bulk using the manipulateListeners method. 42782 * If you pass an object as the second argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added. 42783 * You can also pass it a regular expression to add the array of listeners to all events that match it. 42784 * Yeah, this function does quite a bit. That's probably a bad thing. 42785 * 42786 * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once. 42787 * @param {Function[]} [listeners] An optional array of listener functions to add. 42788 * @return {Object} Current instance of EventEmitter for chaining. 42789 */ 42790 proto.addListeners = function addListeners(evt, listeners) { 42791 // Pass through to manipulateListeners 42792 return this.manipulateListeners(false, evt, listeners); 42793 }; 42794 42795 /** 42796 * Removes listeners in bulk using the manipulateListeners method. 42797 * If you pass an object as the second argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. 42798 * You can also pass it an event name and an array of listeners to be removed. 42799 * You can also pass it a regular expression to remove the listeners from all events that match it. 42800 * 42801 * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once. 42802 * @param {Function[]} [listeners] An optional array of listener functions to remove. 42803 * @return {Object} Current instance of EventEmitter for chaining. 42804 */ 42805 proto.removeListeners = function removeListeners(evt, listeners) { 42806 // Pass through to manipulateListeners 42807 return this.manipulateListeners(true, evt, listeners); 42808 }; 42809 42810 /** 42811 * Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. You should really use those instead, this is a little lower level. 42812 * The first argument will determine if the listeners are removed (true) or added (false). 42813 * If you pass an object as the second argument you can add/remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. 42814 * You can also pass it an event name and an array of listeners to be added/removed. 42815 * You can also pass it a regular expression to manipulate the listeners of all events that match it. 42816 * 42817 * @param {Boolean} remove True if you want to remove listeners, false if you want to add. 42818 * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once. 42819 * @param {Function[]} [listeners] An optional array of listener functions to add/remove. 42820 * @return {Object} Current instance of EventEmitter for chaining. 42821 */ 42822 proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) { 42823 var i; 42824 var value; 42825 var single = remove ? this.removeListener : this.addListener; 42826 var multiple = remove ? this.removeListeners : this.addListeners; 42827 42828 // If evt is an object then pass each of it's properties to this method 42829 if (typeof evt === 'object' && !(evt instanceof RegExp)) { 42830 for (i in evt) { 42831 if (evt.hasOwnProperty(i) && (value = evt[i])) { 42832 // Pass the single listener straight through to the singular method 42833 if (typeof value === 'function') { 42834 single.call(this, i, value); 42835 } 42836 else { 42837 // Otherwise pass back to the multiple function 42838 multiple.call(this, i, value); 42839 } 42840 } 42841 } 42842 } 42843 else { 42844 // So evt must be a string 42845 // And listeners must be an array of listeners 42846 // Loop over it and pass each one to the multiple method 42847 i = listeners.length; 42848 while (i--) { 42849 single.call(this, evt, listeners[i]); 42850 } 42851 } 42852 42853 return this; 42854 }; 42855 42856 /** 42857 * Removes all listeners from a specified event. 42858 * If you do not specify an event then all listeners will be removed. 42859 * That means every event will be emptied. 42860 * You can also pass a regex to remove all events that match it. 42861 * 42862 * @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed. 42863 * @return {Object} Current instance of EventEmitter for chaining. 42864 */ 42865 proto.removeEvent = function removeEvent(evt) { 42866 var type = typeof evt; 42867 var events = this._getEvents(); 42868 var key; 42869 42870 // Remove different things depending on the state of evt 42871 if (type === 'string') { 42872 // Remove all listeners for the specified event 42873 delete events[evt]; 42874 } 42875 else if (type === 'object') { 42876 // Remove all events matching the regex. 42877 for (key in events) { 42878 if (events.hasOwnProperty(key) && evt.test(key)) { 42879 delete events[key]; 42880 } 42881 } 42882 } 42883 else { 42884 // Remove all listeners in all events 42885 delete this._events; 42886 } 42887 42888 return this; 42889 }; 42890 42891 /** 42892 * Alias of removeEvent. 42893 * 42894 * Added to mirror the node API. 42895 */ 42896 proto.removeAllListeners = alias('removeEvent'); 42897 42898 /** 42899 * Emits an event of your choice. 42900 * When emitted, every listener attached to that event will be executed. 42901 * If you pass the optional argument array then those arguments will be passed to every listener upon execution. 42902 * Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately.
42903 * So they will not arrive within the array on the other side, they will be separate. 42904 * You can also pass a regular expression to emit to all events that match it. 42905 * 42906 * @param {String|RegExp} evt Name of the event to emit and execute listeners for. 42907 * @param {Array} [args] Optional array of arguments to be passed to each listener. 42908 * @return {Object} Current instance of EventEmitter for chaining. 42909 */ 42910 proto.emitEvent = function emitEvent(evt, args) { 42911 var listeners = this.getListenersAsObject(evt); 42912 var listener; 42913 var i; 42914 var key; 42915 var response; 42916 42917 for (key in listeners) { 42918 if (listeners.hasOwnProperty(key)) { 42919 i = listeners[key].length; 42920 42921 while (i--) { 42922 // If the listener returns true then it shall be removed from the event 42923 // The function is executed either with a basic call or an apply if there is an args array 42924 listener = listeners[key][i]; 42925 42926 if (listener.once === true) { 42927 this.removeListener(evt, listener.listener); 42928 } 42929 42930 response = listener.listener.apply(this, args || []); 42931 42932 if (response === this._getOnceReturnValue()) { 42933 this.removeListener(evt, listener.listener); 42934 } 42935 } 42936 } 42937 } 42938 42939 return this; 42940 }; 42941 42942 /** 42943 * Alias of emitEvent 42944 */ 42945 proto.trigger = alias('emitEvent'); 42946 42947 /** 42948 * Subtly different from emitEvent in that it will pass its arguments on to the listeners, as opposed to taking a single array of arguments to pass on. 42949 * As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it. 42950 * 42951 * @param {String|RegExp} evt Name of the event to emit and execute listeners for. 42952 * @param {...*} Optional additional arguments to be passed to each listener. 42953 * @return {Object} Current instance of EventEmitter for chaining. 42954 */ 42955 proto.emit = function emit(evt) { 42956 var args = Array.prototype.slice.call(arguments, 1); 42957 return this.emitEvent(evt, args); 42958 }; 42959 42960 /** 42961 * Sets the current value to check against when executing listeners. If a 42962 * listeners return value matches the one set here then it will be removed 42963 * after execution. This value defaults to true. 42964 * 42965 * @param {*} value The new value to check for when executing listeners. 42966 * @return {Object} Current instance of EventEmitter for chaining. 42967 */ 42968 proto.setOnceReturnValue = function setOnceReturnValue(value) { 42969 this._onceReturnValue = value; 42970 return this; 42971 }; 42972 42973 /** 42974 * Fetches the current value to check against when executing listeners. If 42975 * the listeners return value matches this one then it should be removed 42976 * automatically. It will return true by default. 42977 * 42978 * @return {*|Boolean} The current value to check for or the default, true. 42979 * @api private 42980 */ 42981 proto._getOnceReturnValue = function _getOnceReturnValue() { 42982 if (this.hasOwnProperty('_onceReturnValue')) { 42983 return this._onceReturnValue; 42984 } 42985 else { 42986 return true; 42987 } 42988 }; 42989 42990 /** 42991 * Fetches the events object and creates one if required. 42992 * 42993 * @return {Object} The events storage object. 42994 * @api private 42995 */ 42996 proto._getEvents = function _getEvents() { 42997 return this._events || (this._events = {}); 42998 }; 42999 43000 /** 43001 * Reverts the global {@link EventEmitter} to its previous value and returns a reference to this version. 43002 * 43003 * @return {Function} Non conflicting EventEmitter class. 43004 */ 43005 EventEmitter.noConflict = function noConflict() { 43006 exports.EventEmitter = originalGlobalValue; 43007 return EventEmitter; 43008 }; 43009 43010 // Expose the class either via AMD, CommonJS or the global object 43011 if (typeof define === 'function' && define.amd) { 43012 define('eventEmitter/EventEmitter',[],function () { 43013 return EventEmitter; 43014 }); 43015 } 43016 else if (typeof module === 'object' && module.exports){ 43017 module.exports = EventEmitter; 43018 } 43019 else { 43020 this.EventEmitter = EventEmitter; 43021 } 43022}.call(this)); 43023 43024/*! 43025 * eventie v1.0.4 43026 * event binding helper 43027 * eventie.bind( elem, 'click', myFn ) 43028 * eventie.unbind( elem, 'click', myFn ) 43029 */ 43030 43031/*jshint browser: true, undef: true, unused: true */ 43032/*global define: false */ 43033 43034( function( window ) { 43035 43036 43037 43038var docElem = document.documentElement; 43039 43040var bind = function() {}; 43041 43042function getIEEvent( obj ) { 43043 var event = window.event; 43044 // add event.target 43045 event.target = event.target || event.srcElement || obj; 43046 return event; 43047} 43048 43049if ( docElem.addEventListener ) { 43050 bind = function( obj, type, fn ) { 43051 obj.addEventListener( type, fn, false ); 43052 }; 43053} else if ( docElem.attachEvent ) { 43054 bind = function( obj, type, fn ) { 43055 obj[ type + fn ] = fn.handleEvent ? 43056 function() { 43057 var event = getIEEvent( obj ); 43058 fn.handleEvent.call( fn, event ); 43059 } : 43060 function() { 43061 var event = getIEEvent( obj ); 43062 fn.call( obj, event ); 43063 }; 43064 obj.attachEvent( "on" + type, obj[ type + fn ] ); 43065 }; 43066} 43067 43068var unbind = function() {}; 43069 43070if ( docElem.removeEventListener ) { 43071 unbind = function( obj, type, fn ) { 43072 obj.removeEventListener( type, fn, false ); 43073 }; 43074} else if ( docElem.detachEvent ) { 43075 unbind = function( obj, type, fn ) { 43076 obj.detachEvent( "on" + type, obj[ type + fn ] ); 43077 try { 43078 delete obj[ type + fn ]; 43079 } catch ( err ) { 43080 // can't delete window object properties 43081 obj[ type + fn ] = undefined; 43082 } 43083 }; 43084} 43085 43086var eventie = { 43087 bind: bind, 43088 unbind: unbind 43089}; 43090 43091// transport 43092if ( typeof define === 'function' && define.amd ) { 43093 // AMD 43094 define( 'eventie/eventie',eventie ); 43095} else { 43096 // browser global 43097 window.eventie = eventie; 43098} 43099 43100})( this ); 43101 43102/*! 43103 * imagesLoaded v3.1.8 43104 * JavaScript is all like "You images are done yet or what?" 43105 * MIT License 43106 */ 43107 43108( function( window, factory ) { 43109 // universal module definition 43110 43111 /*global define: false, module: false, require: false */ 43112 43113 if ( typeof define === 'function' && define.amd ) { 43114 // AMD 43115 define( [ 43116 'eventEmitter/EventEmitter', 43117 'eventie/eventie' 43118 ], function( EventEmitter, eventie ) { 43119 return factory( window, EventEmitter, eventie ); 43120 });
43121 } else if ( typeof exports === 'object' ) { 43122 // CommonJS 43123 module.exports = factory( 43124 window, 43125 require('wolfy87-eventemitter'), 43126 require('eventie') 43127 ); 43128 } else { 43129 // browser global 43130 window.imagesLoaded = factory( 43131 window, 43132 window.EventEmitter, 43133 window.eventie 43134 ); 43135 } 43136 43137})( window, 43138 43139// -------------------------- factory -------------------------- // 43140 43141function factory( window, EventEmitter, eventie ) { 43142 43143 43144 43145var $ = window.jQuery; 43146var console = window.console; 43147var hasConsole = typeof console !== 'undefined'; 43148 43149// -------------------------- helpers -------------------------- // 43150 43151// extend objects 43152function extend( a, b ) { 43153 for ( var prop in b ) { 43154 a[ prop ] = b[ prop ]; 43155 } 43156 return a; 43157} 43158 43159var objToString = Object.prototype.toString; 43160function isArray( obj ) { 43161 return objToString.call( obj ) === '[object Array]'; 43162} 43163 43164// turn element or nodeList into an array 43165function makeArray( obj ) { 43166 var ary = []; 43167 if ( isArray( obj ) ) { 43168 // use object if already an array 43169 ary = obj; 43170 } else if ( typeof obj.length === 'number' ) { 43171 // convert nodeList to array 43172 for ( var i=0, len = obj.length; i < len; i++ ) { 43173 ary.push( obj[i] ); 43174 } 43175 } else { 43176 // array of single index 43177 ary.push( obj ); 43178 } 43179 return ary; 43180} 43181 43182 // -------------------------- imagesLoaded -------------------------- // 43183 43184 /** 43185 * @param {Array, Element, NodeList, String} elem 43186 * @param {Object or Function} options - if function, use as callback 43187 * @param {Function} onAlways - callback function 43188 */ 43189 function ImagesLoaded( elem, options, onAlways ) { 43190 // coerce ImagesLoaded() without new, to be new ImagesLoaded() 43191 if ( !( this instanceof ImagesLoaded ) ) { 43192 return new ImagesLoaded( elem, options ); 43193 } 43194 // use elem as selector string 43195 if ( typeof elem === 'string' ) { 43196 elem = document.querySelectorAll( elem ); 43197 } 43198 43199 this.elements = makeArray( elem ); 43200 this.options = extend( {}, this.options ); 43201 43202 if ( typeof options === 'function' ) { 43203 onAlways = options; 43204 } else { 43205 extend( this.options, options ); 43206 } 43207 43208 if ( onAlways ) { 43209 this.on( 'always', onAlways ); 43210 } 43211 43212 this.getImages(); 43213 43214 if ( $ ) { 43215 // add jQuery Deferred object 43216 this.jqDeferred = new $.Deferred(); 43217 } 43218 43219 // HACK check async to allow time to bind listeners 43220 var _this = this; 43221 setTimeout( function() { 43222 _this.check(); 43223 }); 43224 } 43225 43226 ImagesLoaded.prototype = new EventEmitter(); 43227 43228 ImagesLoaded.prototype.options = {}; 43229 43230 ImagesLoaded.prototype.getImages = function() { 43231 this.images = []; 43232 43233 // filter & find items if we have an item selector 43234 for ( var i=0, len = this.elements.length; i < len; i++ ) { 43235 var elem = this.elements[i]; 43236 // filter siblings 43237 if ( elem.nodeName === 'IMG' ) { 43238 this.addImage( elem ); 43239 } 43240 // find children 43241 // no non-element nodes, #143 43242 var nodeType = elem.nodeType; 43243 if ( !nodeType || !( nodeType === 1 || nodeType === 9 || nodeType === 11 ) ) { 43244 continue; 43245 } 43246 var childElems = elem.querySelectorAll('img'); 43247 // concat childElems to filterFound array 43248 for ( var j=0, jLen = childElems.length; j < jLen; j++ ) { 43249 var img = childElems[j]; 43250 this.addImage( img ); 43251 } 43252 } 43253 }; 43254 43255 /** 43256 * @param {Image} img 43257 */ 43258 ImagesLoaded.prototype.addImage = function( img ) { 43259 var loadingImage = new LoadingImage( img ); 43260 this.images.push( loadingImage ); 43261 }; 43262 43263 ImagesLoaded.prototype.check = function() { 43264 var _this = this; 43265 var checkedCount = 0; 43266 var length = this.images.length; 43267 this.hasAnyBroken = false; 43268 // complete if no images 43269 if ( !length ) { 43270 this.complete(); 43271 return; 43272 } 43273 43274 function onConfirm( image, message ) { 43275 if ( _this.options.debug && hasConsole ) { 43276 console.log( 'confirm', image, message ); 43277 } 43278 43279 _this.progress( image ); 43280 checkedCount++; 43281 if ( checkedCount === length ) { 43282 _this.complete(); 43283 } 43284 return true; // bind once 43285 } 43286 43287 for ( var i=0; i < length; i++ ) { 43288 var loadingImage = this.images[i]; 43289 loadingImage.on( 'confirm', onConfirm ); 43290 loadingImage.check(); 43291 } 43292 }; 43293 43294 ImagesLoaded.prototype.progress = function( image ) { 43295 this.hasAnyBroken = this.hasAnyBroken || !image.isLoaded; 43296 // HACK - Chrome triggers event before object properties have changed. #83 43297 var _this = this; 43298 setTimeout( function() {
43299 _this.emit( 'progress', _this, image ); 43300 if ( _this.jqDeferred && _this.jqDeferred.notify ) { 43301 _this.jqDeferred.notify( _this, image ); 43302 } 43303 }); 43304 }; 43305 43306 ImagesLoaded.prototype.complete = function() { 43307 var eventName = this.hasAnyBroken ? 'fail' : 'done'; 43308 this.isComplete = true; 43309 var _this = this; 43310 // HACK - another setTimeout so that confirm happens after progress 43311 setTimeout( function() { 43312 _this.emit( eventName, _this ); 43313 _this.emit( 'always', _this ); 43314 if ( _this.jqDeferred ) { 43315 var jqMethod = _this.hasAnyBroken ? 'reject' : 'resolve'; 43316 _this.jqDeferred[ jqMethod ]( _this ); 43317 } 43318 }); 43319 }; 43320 43321 // -------------------------- jquery -------------------------- // 43322 43323 if ( $ ) { 43324 $.fn.imagesLoaded = function( options, callback ) { 43325 var instance = new ImagesLoaded( this, options, callback ); 43326 return instance.jqDeferred.promise( $(this) ); 43327 }; 43328 } 43329 43330 43331 // -------------------------- -------------------------- // 43332 43333 function LoadingImage( img ) { 43334 this.img = img; 43335 } 43336 43337 LoadingImage.prototype = new EventEmitter(); 43338 43339 LoadingImage.prototype.check = function() { 43340 // first check cached any previous images that have same src 43341 var resource = cache[ this.img.src ] || new Resource( this.img.src ); 43342 if ( resource.isConfirmed ) { 43343 this.confirm( resource.isLoaded, 'cached was confirmed' ); 43344 return; 43345 } 43346 43347 // If complete is true and browser supports natural sizes, 43348 // try to check for image status manually. 43349 if ( this.img.complete && this.img.naturalWidth !== undefined ) { 43350 // report based on naturalWidth 43351 this.confirm( this.img.naturalWidth !== 0, 'naturalWidth' ); 43352 return; 43353 } 43354 43355 // If none of the checks above matched, simulate loading on detached element. 43356 var _this = this; 43357 resource.on( 'confirm', function( resrc, message ) { 43358 _this.confirm( resrc.isLoaded, message ); 43359 return true; 43360 }); 43361 43362 resource.check(); 43363 }; 43364 43365 LoadingImage.prototype.confirm = function( isLoaded, message ) { 43366 this.isLoaded = isLoaded; 43367 this.emit( 'confirm', this, message ); 43368 }; 43369 43370 // -------------------------- Resource -------------------------- // 43371 43372 // Resource checks each src, only once 43373 // separate class from LoadingImage to prevent memory leaks. See #115 43374 43375 var cache = {}; 43376 43377 function Resource( src ) { 43378 this.src = src; 43379 // add to cache 43380 cache[ src ] = this; 43381 } 43382 43383 Resource.prototype = new EventEmitter(); 43384 43385 Resource.prototype.check = function() { 43386 // only trigger checking once 43387 if ( this.isChecked ) { 43388 return; 43389 } 43390 // simulate loading on detached element 43391 var proxyImage = new Image(); 43392 eventie.bind( proxyImage, 'load', this ); 43393 eventie.bind( proxyImage, 'error', this ); 43394 proxyImage.src = this.src; 43395 // set flag 43396 this.isChecked = true; 43397 }; 43398 43399 // ----- events ----- // 43400 43401 // trigger specified handler for event type 43402 Resource.prototype.handleEvent = function( event ) { 43403 var method = 'on' + event.type; 43404 if ( this[ method ] ) { 43405 this[ method ]( event ); 43406 } 43407 }; 43408 43409 Resource.prototype.onload = function( event ) { 43410 this.confirm( true, 'onload' ); 43411 this.unbindProxyEvents( event ); 43412 }; 43413 43414 Resource.prototype.onerror = function( event ) { 43415 this.confirm( false, 'onerror' ); 43416 this.unbindProxyEvents( event ); 43417 }; 43418 43419 // ----- confirm ----- // 43420 43421 Resource.prototype.confirm = function( isLoaded, message ) { 43422 this.isConfirmed = true; 43423 this.isLoaded = isLoaded; 43424 this.emit( 'confirm', this, message ); 43425 }; 43426 43427 Resource.prototype.unbindProxyEvents = function( event ) { 43428 eventie.unbind( event.target, 'load', this ); 43429 eventie.unbind( event.target, 'error', this ); 43430 }; 43431 43432 // ----- ----- // 43433 43434 return ImagesLoaded; 43435 43436}); 43437; 43438/*! 43439 * Select2 4.0.3 43440 * https://select2.github.io 43441 * 43442 * Released under the MIT license 43443 * https://github.com/select2/select2/blob/master/LICENSE.md 43444 */ 43445(function (factory) { 43446 if (typeof define === 'function' && define.amd) { 43447 // AMD. Register as an anonymous module. 43448 define(['jquery'], factory); 43449 } else if (typeof exports === 'object') { 43450 // Node/CommonJS 43451 factory(require('jquery')); 43452 } else { 43453 // Browser globals 43454 factory(jQuery); 43455 } 43456}(function (jQuery) { 43457 // This is needed so we can catch the AMD loader configuration and use it 43458 // The inner file should be wrapped (by `banner.start.js`) in a function that 43459 // returns the AMD loader references. 43460 var S2 = 43461(function () { 43462 // Restore the Select2 AMD loader so it can be used 43463 // Needed mostly in the language files, where the loader is not inserted 43464 if (jQuery && jQuery.fn && jQuery.fn.select2 && jQuery.fn.select2.amd) { 43465 var S2 = jQuery.fn.select2.amd; 43466 } 43467var S2;(function () { if (!S2 || !S2.requirejs) { 43468if (!S2) { S2 = {}; } else { require = S2; } 43469/** 43470 * @license almond 0.3.1 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved. 43471 * Available via the MIT or new BSD license. 43472 * see: http://github.com/jrburke/almond for details 43473 */ 43474//Going sloppy to avoid 'use strict' string cost, but strict practices should 43475//be followed. 43476/*jslint sloppy: true */ 43477/*global setTimeout: false */ 43478 43479var requirejs, require, define; 43480(function (undef) { 43481 var main, req, makeMap, handlers, 43482 defined = {}, 43483 waiting = {}, 43484 config = {}, 43485 defining = {}, 43486 hasOwn = Object.prototype.hasOwnProperty, 43487 aps = [].slice, 43488 jsSuffixRegExp = /\.js$/; 43489 43490 function hasProp(obj, prop) { 43491 return hasOwn.call(obj, prop); 43492 } 43493 43494 /** 43495 * Given a relative module name, like ./something, normalize it to 43496 * a real name that can be mapped to a path. 43497 * @param {String} name the relative name 43498 * @param {String} baseName a real name that the name arg is relative 43499 * to. 43500 * @returns {String} normalized name 43501 */ 43502 function normalize(name, baseName) { 43503 var nameParts, nameSegment, mapValue, foundMap, lastIndex, 43504 foundI, foundStarMap, starI, i, j, part, 43505 baseParts = baseName && baseName.split("/"), 43506 map = config.map, 43507 starMap = (map && map['*']) || {}; 43508 43509 //Adjust any relative paths. 43510 if (name && name.charAt(0) === ".") { 43511 //If have a base name, try to normalize against it, 43512 //otherwise, assume it is a top-level require that will 43513 //be relative to baseUrl in the end. 43514 if (baseName) { 43515 name = name.split('/'); 43516 lastIndex = name.length - 1; 43517 43518 // Node .js allowance: 43519 if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) { 43520 name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, ''); 43521 } 43522 43523 //Lop off the last part of baseParts, so that . matches the 43524 //"directory" and not name of the baseName's module. For instance, 43525 //baseName of "one/two/three", maps to "one/two/three.js", but we 43526 //want the directory, "one/two" for this normalization. 43527 name = baseParts.slice(0, baseParts.length - 1).concat(name); 43528 43529 //start trimDots 43530 for (i = 0; i < name.length; i += 1) { 43531 part = name[i]; 43532 if (part === ".") { 43533 name.splice(i, 1); 43534 i -= 1; 43535 } else if (part === "..") { 43536 if (i === 1 && (name[2] === '..' || name[0] === '..')) { 43537 //End of the line. Keep at least one non-dot 43538 //path segment at the front so it can be mapped 43539 //correctly to disk. Otherwise, there is likely 43540 //no path mapping for a path starting with '..'. 43541 //This can still fail, but catches the most reasonable 43542 //uses of .. 43543 break; 43544 } else if (i > 0) { 43545 name.splice(i - 1, 2); 43546 i -= 2; 43547 } 43548 } 43549 } 43550 //end trimDots 43551 43552 name = name.join("/"); 43553 } else if (name.indexOf('./') === 0) { 43554 // No baseName, so this is ID is resolved relative 43555 // to baseUrl, pull off the leading dot. 43556 name = name.substring(2); 43557 } 43558 } 43559 43560 //Apply map config if available. 43561 if ((baseParts || starMap) && map) {
vendor: 67,537 bytes, lines 43562-46185
43562 nameParts = name.split('/'); 43563 43564 for (i = nameParts.length; i > 0; i -= 1) { 43565 nameSegment = nameParts.slice(0, i).join("/"); 43566 43567 if (baseParts) { 43568 //Find the longest baseName segment match in the config. 43569 //So, do joins on the biggest to smallest lengths of baseParts. 43570 for (j = baseParts.length; j > 0; j -= 1) { 43571 mapValue = map[baseParts.slice(0, j).join('/')]; 43572 43573 //baseName segment has config, find if it has one for 43574 //this name. 43575 if (mapValue) { 43576 mapValue = mapValue[nameSegment]; 43577 if (mapValue) { 43578 //Match, update name to the new value. 43579 foundMap = mapValue; 43580 foundI = i; 43581 break; 43582 } 43583 } 43584 } 43585 } 43586 43587 if (foundMap) { 43588 break; 43589 } 43590 43591 //Check for a star map match, but just hold on to it, 43592 //if there is a shorter segment match later in a matching 43593 //config, then favor over this star map. 43594 if (!foundStarMap && starMap && starMap[nameSegment]) { 43595 foundStarMap = starMap[nameSegment]; 43596 starI = i; 43597 } 43598 } 43599 43600 if (!foundMap && foundStarMap) { 43601 foundMap = foundStarMap; 43602 foundI = starI; 43603 } 43604 43605 if (foundMap) { 43606 nameParts.splice(0, foundI, foundMap); 43607 name = nameParts.join('/'); 43608 } 43609 } 43610 43611 return name; 43612 } 43613 43614 function makeRequire(relName, forceSync) { 43615 return function () { 43616 //A version of a require function that passes a moduleName 43617 //value for items that may need to 43618 //look up paths relative to the moduleName 43619 var args = aps.call(arguments, 0); 43620 43621 //If first arg is not require('string'), and there is only 43622 //one arg, it is the array form without a callback. Insert 43623 //a null so that the following concat is correct. 43624 if (typeof args[0] !== 'string' && args.length === 1) { 43625 args.push(null); 43626 } 43627 return req.apply(undef, args.concat([relName, forceSync])); 43628 }; 43629 } 43630 43631 function makeNormalize(relName) { 43632 return function (name) { 43633 return normalize(name, relName); 43634 }; 43635 } 43636 43637 function makeLoad(depName) { 43638 return function (value) { 43639 defined[depName] = value; 43640 }; 43641 } 43642 43643 function callDep(name) { 43644 if (hasProp(waiting, name)) { 43645 var args = waiting[name]; 43646 delete waiting[name]; 43647 defining[name] = true; 43648 main.apply(undef, args); 43649 } 43650 43651 if (!hasProp(defined, name) && !hasProp(defining, name)) { 43652 throw new Error('No ' + name); 43653 } 43654 return defined[name]; 43655 } 43656 43657 //Turns a plugin!resource to [plugin, resource] 43658 //with the plugin being undefined if the name 43659 //did not have a plugin prefix. 43660 function splitPrefix(name) { 43661 var prefix, 43662 index = name ? name.indexOf('!') : -1; 43663 if (index > -1) { 43664 prefix = name.substring(0, index); 43665 name = name.substring(index + 1, name.length); 43666 } 43667 return [prefix, name]; 43668 } 43669 43670 /** 43671 * Makes a name map, normalizing the name, and using a plugin 43672 * for normalization if necessary. Grabs a ref to plugin 43673 * too, as an optimization. 43674 */ 43675 makeMap = function (name, relName) { 43676 var plugin, 43677 parts = splitPrefix(name), 43678 prefix = parts[0]; 43679 43680 name = parts[1]; 43681 43682 if (prefix) { 43683 prefix = normalize(prefix, relName); 43684 plugin = callDep(prefix); 43685 } 43686 43687 //Normalize according 43688 if (prefix) { 43689 if (plugin && plugin.normalize) { 43690 name = plugin.normalize(name, makeNormalize(relName)); 43691 } else { 43692 name = normalize(name, relName); 43693 } 43694 } else { 43695 name = normalize(name, relName); 43696 parts = splitPrefix(name); 43697 prefix = parts[0]; 43698 name = parts[1]; 43699 if (prefix) { 43700 plugin = callDep(prefix); 43701 } 43702 } 43703 43704 //Using ridiculous property names for space reasons 43705 return { 43706 f: prefix ? prefix + '!' + name : name, //fullName 43707 n: name, 43708 pr: prefix, 43709 p: plugin 43710 }; 43711 }; 43712 43713 function makeConfig(name) { 43714 return function () { 43715 return (config && config.config && config.config[name]) || {}; 43716 }; 43717 } 43718 43719 handlers = { 43720 require: function (name) { 43721 return makeRequire(name); 43722 }, 43723 exports: function (name) { 43724 var e = defined[name]; 43725 if (typeof e !== 'undefined') { 43726 return e; 43727 } else { 43728 return (defined[name] = {}); 43729 } 43730 }, 43731 module: function (name) { 43732 return { 43733 id: name, 43734 uri: '', 43735 exports: defined[name], 43736 config: makeConfig(name) 43737 }; 43738 } 43739 }; 43740 43741 main = function (name, deps, callback, relName) { 43742 var cjsModule, depName, ret, map, i, 43743 args = [], 43744 callbackType = typeof callback, 43745 usingExports; 43746 43747 //Use name if no relName 43748 relName = relName || name; 43749 43750 //Call the callback to define the module, if necessary. 43751 if (callbackType === 'undefined' || callbackType === 'function') { 43752 //Pull out the defined dependencies and pass the ordered 43753 //values to the callback. 43754 //Default to [require, exports, module] if no deps 43755 deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps; 43756 for (i = 0; i < deps.length; i += 1) { 43757 map = makeMap(deps[i], relName); 43758 depName = map.f; 43759 43760 //Fast path CommonJS standard dependencies. 43761 if (depName === "require") { 43762 args[i] = handlers.require(name); 43763 } else if (depName === "exports") { 43764 //CommonJS module spec 1.1 43765 args[i] = handlers.exports(name); 43766 usingExports = true; 43767 } else if (depName === "module") { 43768 //CommonJS module spec 1.1 43769 cjsModule = args[i] = handlers.module(name); 43770 } else if (hasProp(defined, depName) || 43771 hasProp(waiting, depName) || 43772 hasProp(defining, depName)) { 43773 args[i] = callDep(depName); 43774 } else if (map.p) { 43775 map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {}); 43776 args[i] = defined[depName]; 43777 } else { 43778 throw new Error(name + ' missing ' + depName); 43779 } 43780 } 43781 43782 ret = callback ? callback.apply(defined[name], args) : undefined; 43783 43784 if (name) { 43785 //If setting exports via "module" is in play, 43786 //favor that over return value and exports. After that, 43787 //favor a non-undefined return value over exports use. 43788 if (cjsModule && cjsModule.exports !== undef && 43789 cjsModule.exports !== defined[name]) { 43790 defined[name] = cjsModule.exports; 43791 } else if (ret !== undef || !usingExports) { 43792 //Use the return value from the function. 43793 defined[name] = ret; 43794 } 43795 } 43796 } else if (name) { 43797 //May just be an object definition for the module. Only 43798 //worry about defining if have a module name. 43799 defined[name] = callback; 43800 } 43801 }; 43802 43803 requirejs = require = req = function (deps, callback, relName, forceSync, alt) { 43804 if (typeof deps === "string") { 43805 if (handlers[deps]) { 43806 //callback in this case is really relName 43807 return handlers[deps](callback); 43808 } 43809 //Just return the module wanted. In this scenario, the 43810 //deps arg is the module name, and second arg (if passed) 43811 //is just the relName. 43812 //Normalize module name, if it contains . or .. 43813 return callDep(makeMap(deps, callback).f); 43814 } else if (!deps.splice) { 43815 //deps is a config object, not an array. 43816 config = deps; 43817 if (config.deps) { 43818 req(config.deps, config.callback); 43819 } 43820 if (!callback) { 43821 return; 43822 } 43823 43824 if (callback.splice) { 43825 //callback is an array, which means it is a dependency list. 43826 //Adjust args if there are dependencies 43827 deps = callback; 43828 callback = relName; 43829 relName = null; 43830 } else { 43831 deps = undef; 43832 } 43833 } 43834 43835 //Support require(['a']) 43836 callback = callback || function () {}; 43837 43838 //If relName is a function, it is an errback handler, 43839 //so remove it. 43840 if (typeof relName === 'function') { 43841 relName = forceSync; 43842 forceSync = alt; 43843 } 43844 43845 //Simulate async callback; 43846 if (forceSync) { 43847 main(undef, deps, callback, relName); 43848 } else { 43849 //Using a non-zero value because of concern for what old browsers 43850 //do, and latest browsers "upgrade" to 4 if lower value is used: 43851 //http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout: 43852 //If want a value immediately, use require('id') instead -- something 43853 //that works in almond on the global level, but not guaranteed and 43854 //unlikely to work in other AMD implementations. 43855 setTimeout(function () { 43856 main(undef, deps, callback, relName); 43857 }, 4); 43858 } 43859 43860 return req; 43861 }; 43862 43863 /** 43864 * Just drops the config on the floor, but returns req in case 43865 * the config return value is used. 43866 */ 43867 req.config = function (cfg) { 43868 return req(cfg); 43869 }; 43870 43871 /** 43872 * Expose module registry for debugging and tooling 43873 */ 43874 requirejs._defined = defined; 43875 43876 define = function (name, deps, callback) { 43877 if (typeof name !== 'string') { 43878 throw new Error('See almond README: incorrect module build, no module name'); 43879 } 43880 43881 //This module may not have dependencies 43882 if (!deps.splice) { 43883 //deps is not an array, so probably means 43884 //an object literal or factory function for 43885 //the value. Adjust args. 43886 callback = deps; 43887 deps = []; 43888 } 43889 43890 if (!hasProp(defined, name) && !hasProp(waiting, name)) { 43891 waiting[name] = [name, deps, callback]; 43892 } 43893 }; 43894 43895 define.amd = { 43896 jQuery: true 43897 }; 43898}()); 43899 43900S2.requirejs = requirejs;S2.require = require;S2.define = define; 43901} 43902}()); 43903S2.define("almond", function(){}); 43904 43905/* global jQuery:false, $:false */ 43906S2.define('jquery',[],function () { 43907 var _$ = jQuery || $; 43908 43909 if (_$ == null && console && console.error) { 43910 console.error( 43911 'Select2: An instance of jQuery or a jQuery-compatible library was not ' + 43912 'found. Make sure that you are including jQuery before Select2 on your ' + 43913 'web page.' 43914 ); 43915 } 43916 43917 return _$; 43918}); 43919 43920S2.define('select2/utils',[ 43921 'jquery' 43922], function ($) { 43923 var Utils = {}; 43924 43925 Utils.Extend = function (ChildClass, SuperClass) { 43926 var __hasProp = {}.hasOwnProperty; 43927 43928 function BaseConstructor () { 43929 this.constructor = ChildClass; 43930 } 43931 43932 for (var key in SuperClass) { 43933 if (__hasProp.call(SuperClass, key)) { 43934 ChildClass[key] = SuperClass[key]; 43935 } 43936 } 43937 43938 BaseConstructor.prototype = SuperClass.prototype; 43939 ChildClass.prototype = new BaseConstructor(); 43940 ChildClass.__super__ = SuperClass.prototype; 43941 43942 return ChildClass; 43943 }; 43944 43945 function getMethods (theClass) { 43946 var proto = theClass.prototype; 43947 43948 var methods = []; 43949 43950 for (var methodName in proto) { 43951 var m = proto[methodName]; 43952 43953 if (typeof m !== 'function') { 43954 continue; 43955 } 43956 43957 if (methodName === 'constructor') { 43958 continue; 43959 } 43960 43961 methods.push(methodName); 43962 } 43963 43964 return methods; 43965 } 43966 43967 Utils.Decorate = function (SuperClass, DecoratorClass) { 43968 var decoratedMethods = getMethods(DecoratorClass); 43969 var superMethods = getMethods(SuperClass); 43970 43971 function DecoratedClass () { 43972 var unshift = Array.prototype.unshift; 43973 43974 var argCount = DecoratorClass.prototype.constructor.length; 43975 43976 var calledConstructor = SuperClass.prototype.constructor; 43977 43978 if (argCount > 0) { 43979 unshift.call(arguments, SuperClass.prototype.constructor); 43980 43981 calledConstructor = DecoratorClass.prototype.constructor; 43982 } 43983 43984 calledConstructor.apply(this, arguments); 43985 } 43986 43987 DecoratorClass.displayName = SuperClass.displayName; 43988 43989 function ctr () { 43990 this.constructor = DecoratedClass; 43991 } 43992 43993 DecoratedClass.prototype = new ctr(); 43994 43995 for (var m = 0; m < superMethods.length; m++) { 43996 var superMethod = superMethods[m]; 43997 43998 DecoratedClass.prototype[superMethod] = 43999 SuperClass.prototype[superMethod]; 44000 } 44001 44002 var calledMethod = function (methodName) { 44003 // Stub out the original method if it's not decorating an actual method 44004 var originalMethod = function () {}; 44005 44006 if (methodName in DecoratedClass.prototype) { 44007 originalMethod = DecoratedClass.prototype[methodName]; 44008 } 44009 44010 var decoratedMethod = DecoratorClass.prototype[methodName]; 44011 44012 return function () { 44013 var unshift = Array.prototype.unshift; 44014 44015 unshift.call(arguments, originalMethod); 44016 44017 return decoratedMethod.apply(this, arguments); 44018 }; 44019 }; 44020 44021 for (var d = 0; d < decoratedMethods.length; d++) { 44022 var decoratedMethod = decoratedMethods[d]; 44023 44024 DecoratedClass.prototype[decoratedMethod] = calledMethod(decoratedMethod); 44025 } 44026 44027 return DecoratedClass; 44028 }; 44029 44030 var Observable = function () { 44031 this.listeners = {}; 44032 }; 44033 44034 Observable.prototype.on = function (event, callback) { 44035 this.listeners = this.listeners || {}; 44036 44037 if (event in this.listeners) { 44038 this.listeners[event].push(callback); 44039 } else { 44040 this.listeners[event] = [callback]; 44041 } 44042 }; 44043 44044 Observable.prototype.trigger = function (event) { 44045 var slice = Array.prototype.slice; 44046 var params = slice.call(arguments, 1); 44047 44048 this.listeners = this.listeners || {}; 44049 44050 // Params should always come in as an array 44051 if (params == null) { 44052 params = []; 44053 } 44054 44055 // If there are no arguments to the event, use a temporary object 44056 if (params.length === 0) { 44057 params.push({}); 44058 } 44059 44060 // Set the `_type` of the first object to the event 44061 params[0]._type = event; 44062 44063 if (event in this.listeners) { 44064 this.invoke(this.listeners[event], slice.call(arguments, 1)); 44065 } 44066 44067 if ('*' in this.listeners) { 44068 this.invoke(this.listeners['*'], arguments); 44069 } 44070 }; 44071 44072 Observable.prototype.invoke = function (listeners, params) { 44073 for (var i = 0, len = listeners.length; i < len; i++) { 44074 listeners[i].apply(this, params); 44075 } 44076 }; 44077 44078 Utils.Observable = Observable; 44079 44080 Utils.generateChars = function (length) { 44081 var chars = ''; 44082 44083 for (var i = 0; i < length; i++) { 44084 var randomChar = Math.floor(Math.random() * 36); 44085 chars += randomChar.toString(36); 44086 } 44087 44088 return chars; 44089 }; 44090 44091 Utils.bind = function (func, context) { 44092 return function () { 44093 func.apply(context, arguments); 44094 }; 44095 }; 44096 44097 Utils._convertData = function (data) { 44098 for (var originalKey in data) { 44099 var keys = originalKey.split('-'); 44100 44101 var dataLevel = data; 44102 44103 if (keys.length === 1) { 44104 continue; 44105 } 44106 44107 for (var k = 0; k < keys.length; k++) { 44108 var key = keys[k]; 44109 44110 // Lowercase the first letter 44111 // By default, dash-separated becomes camelCase 44112 key = key.substring(0, 1).toLowerCase() + key.substring(1); 44113 44114 if (!(key in dataLevel)) { 44115 dataLevel[key] = {}; 44116 } 44117 44118 if (k == keys.length - 1) { 44119 dataLevel[key] = data[originalKey]; 44120 } 44121 44122 dataLevel = dataLevel[key]; 44123 } 44124 44125 delete data[originalKey]; 44126 } 44127 44128 return data; 44129 }; 44130 44131 Utils.hasScroll = function (index, el) { 44132 // Adapted from the function created by @ShadowScripter 44133 // and adapted by @BillBarry on the Stack Exchange Code Review website. 44134 // The original code can be found at 44135 // http://codereview.stackexchange.com/q/13338 44136 // and was designed to be used with the Sizzle selector engine. 44137 44138 var $el = $(el); 44139 var overflowX = el.style.overflowX; 44140 var overflowY = el.style.overflowY; 44141 44142 //Check both x and y declarations 44143 if (overflowX === overflowY && 44144 (overflowY === 'hidden' || overflowY === 'visible')) { 44145 return false; 44146 } 44147 44148 if (overflowX === 'scroll' || overflowY === 'scroll') { 44149 return true; 44150 } 44151 44152 return ($el.innerHeight() < el.scrollHeight || 44153 $el.innerWidth() < el.scrollWidth); 44154 }; 44155 44156 Utils.escapeMarkup = function (markup) { 44157 var replaceMap = { 44158 '\\': '\', 44159 '&': '&', 44160 '<': '<', 44161 '>': '>', 44162 '"': '"', 44163 '\'': ''', 44164 '/': '/' 44165 }; 44166 44167 // Do not try to escape the markup if it's not a string 44168 if (typeof markup !== 'string') { 44169 return markup; 44170 } 44171 44172 return String(markup).replace(/[&<>"'\/\\]/g, function (match) { 44173 return replaceMap[match]; 44174 }); 44175 }; 44176 44177 // Append an array of jQuery nodes to a given element. 44178 Utils.appendMany = function ($element, $nodes) { 44179 // jQuery 1.7.x does not support $.fn.append() with an array 44180 // Fall back to a jQuery object collection using $.fn.add() 44181 if ($.fn.jquery.substr(0, 3) === '1.7') { 44182 var $jqNodes = $(); 44183 44184 $.map($nodes, function (node) { 44185 $jqNodes = $jqNodes.add(node); 44186 }); 44187 44188 $nodes = $jqNodes; 44189 } 44190 44191 $element.append($nodes); 44192 }; 44193 44194 return Utils; 44195}); 44196 44197S2.define('select2/results',[ 44198 'jquery', 44199 './utils' 44200], function ($, Utils) { 44201 function Results ($element, options, dataAdapter) { 44202 this.$element = $element; 44203 this.data = dataAdapter; 44204 this.options = options; 44205 44206 Results.__super__.constructor.call(this); 44207 } 44208 44209 Utils.Extend(Results, Utils.Observable); 44210 44211 Results.prototype.render = function () { 44212 var $results = $( 44213 '<ul class="select2-results__options" role="tree"></ul>' 44214 ); 44215 44216 if (this.options.get('multiple')) { 44217 $results.attr('aria-multiselectable', 'true'); 44218 } 44219 44220 this.$results = $results; 44221 44222 return $results; 44223 }; 44224 44225 Results.prototype.clear = function () { 44226 this.$results.empty(); 44227 }; 44228 44229 Results.prototype.displayMessage = function (params) { 44230 var escapeMarkup = this.options.get('escapeMarkup'); 44231 44232 this.clear(); 44233 this.hideLoading(); 44234 44235 var $message = $( 44236 '<li role="treeitem" aria-live="assertive"' + 44237 ' class="select2-results__option"></li>' 44238 ); 44239 44240 var message = this.options.get('translations').get(params.message); 44241 44242 $message.append( 44243 escapeMarkup( 44244 message(params.args) 44245 ) 44246 ); 44247 44248 $message[0].className += ' select2-results__message'; 44249 44250 this.$results.append($message); 44251 }; 44252 44253 Results.prototype.hideMessages = function () { 44254 this.$results.find('.select2-results__message').remove(); 44255 }; 44256 44257 Results.prototype.append = function (data) { 44258 this.hideLoading(); 44259 44260 var $options = []; 44261 44262 if (data.results == null || data.results.length === 0) { 44263 if (this.$results.children().length === 0) { 44264 this.trigger('results:message', { 44265 message: 'noResults' 44266 }); 44267 } 44268 44269 return; 44270 } 44271 44272 data.results = this.sort(data.results); 44273 44274 for (var d = 0; d < data.results.length; d++) { 44275 var item = data.results[d]; 44276 44277 var $option = this.option(item); 44278 44279 $options.push($option); 44280 } 44281 44282 this.$results.append($options); 44283 }; 44284 44285 Results.prototype.position = function ($results, $dropdown) { 44286 var $resultsContainer = $dropdown.find('.select2-results'); 44287 $resultsContainer.append($results); 44288 }; 44289 44290 Results.prototype.sort = function (data) { 44291 var sorter = this.options.get('sorter'); 44292 44293 return sorter(data); 44294 }; 44295 44296 Results.prototype.highlightFirstItem = function () { 44297 var $options = this.$results 44298 .find('.select2-results__option[aria-selected]'); 44299 44300 var $selected = $options.filter('[aria-selected=true]'); 44301 44302 // Check if there are any selected options 44303 if ($selected.length > 0) { 44304 // If there are selected options, highlight the first 44305 $selected.first().trigger('mouseenter'); 44306 } else { 44307 // If there are no selected options, highlight the first option 44308 // in the dropdown 44309 $options.first().trigger('mouseenter'); 44310 } 44311 44312 this.ensureHighlightVisible(); 44313 }; 44314 44315 Results.prototype.setClasses = function () { 44316 var self = this; 44317 44318 this.data.current(function (selected) { 44319 var selectedIds = $.map(selected, function (s) { 44320 return s.id.toString(); 44321 }); 44322 44323 var $options = self.$results 44324 .find('.select2-results__option[aria-selected]'); 44325 44326 $options.each(function () { 44327 var $option = $(this); 44328 44329 var item = $.data(this, 'data'); 44330 44331 // id needs to be converted to a string when comparing 44332 var id = '' + item.id; 44333 44334 if ((item.element != null && item.element.selected) || 44335 (item.element == null && $.inArray(id, selectedIds) > -1)) { 44336 $option.attr('aria-selected', 'true'); 44337 } else { 44338 $option.attr('aria-selected', 'false'); 44339 } 44340 }); 44341 44342 }); 44343 }; 44344 44345 Results.prototype.showLoading = function (params) { 44346 this.hideLoading(); 44347 44348 var loadingMore = this.options.get('translations').get('searching'); 44349 44350 var loading = { 44351 disabled: true, 44352 loading: true, 44353 text: loadingMore(params) 44354 }; 44355 var $loading = this.option(loading); 44356 $loading.className += ' loading-results'; 44357 44358 this.$results.prepend($loading); 44359 }; 44360 44361 Results.prototype.hideLoading = function () { 44362 this.$results.find('.loading-results').remove(); 44363 }; 44364 44365 Results.prototype.option = function (data) { 44366 var option = document.createElement('li'); 44367 option.className = 'select2-results__option'; 44368 44369 var attrs = { 44370 'role': 'treeitem', 44371 'aria-selected': 'false' 44372 }; 44373 44374 if (data.disabled) { 44375 delete attrs['aria-selected']; 44376 attrs['aria-disabled'] = 'true'; 44377 } 44378 44379 if (data.id == null) { 44380 delete attrs['aria-selected']; 44381 } 44382 44383 if (data._resultId != null) { 44384 option.id = data._resultId; 44385 } 44386 44387 if (data.title) { 44388 option.title = data.title; 44389 } 44390 44391 if (data.children) { 44392 attrs.role = 'group'; 44393 attrs['aria-label'] = data.text; 44394 delete attrs['aria-selected']; 44395 } 44396 44397 for (var attr in attrs) { 44398 var val = attrs[attr]; 44399 44400 option.setAttribute(attr, val); 44401 } 44402 44403 if (data.children) { 44404 var $option = $(option); 44405 44406 var label = document.createElement('strong'); 44407 label.className = 'select2-results__group'; 44408 44409 var $label = $(label); 44410 this.template(data, label); 44411 44412 var $children = []; 44413 44414 for (var c = 0; c < data.children.length; c++) { 44415 var child = data.children[c]; 44416 44417 var $child = this.option(child); 44418 44419 $children.push($child); 44420 } 44421 44422 var $childrenContainer = $('<ul></ul>', { 44423 'class': 'select2-results__options select2-results__options--nested' 44424 }); 44425 44426 $childrenContainer.append($children); 44427 44428 $option.append(label); 44429 $option.append($childrenContainer); 44430 } else { 44431 this.template(data, option); 44432 } 44433 44434 $.data(option, 'data', data); 44435 44436 return option; 44437 }; 44438 44439 Results.prototype.bind = function (container, $container) { 44440 var self = this; 44441 44442 var id = container.id + '-results'; 44443 44444 this.$results.attr('id', id); 44445 44446 container.on('results:all', function (params) { 44447 self.clear(); 44448 self.append(params.data); 44449 44450 if (container.isOpen()) { 44451 self.setClasses(); 44452 self.highlightFirstItem(); 44453 } 44454 }); 44455 44456 container.on('results:append', function (params) { 44457 self.append(params.data); 44458 44459 if (container.isOpen()) { 44460 self.setClasses(); 44461 } 44462 }); 44463 44464 container.on('query', function (params) { 44465 self.hideMessages(); 44466 self.showLoading(params); 44467 }); 44468 44469 container.on('select', function () { 44470 if (!container.isOpen()) { 44471 return; 44472 } 44473 44474 self.setClasses(); 44475 self.highlightFirstItem(); 44476 }); 44477 44478 container.on('unselect', function () { 44479 if (!container.isOpen()) { 44480 return; 44481 } 44482 44483 self.setClasses(); 44484 self.highlightFirstItem(); 44485 }); 44486 44487 container.on('open', function () { 44488 // When the dropdown is open, aria-expended="true" 44489 self.$results.attr('aria-expanded', 'true'); 44490 self.$results.attr('aria-hidden', 'false'); 44491 44492 self.setClasses(); 44493 self.ensureHighlightVisible(); 44494 }); 44495 44496 container.on('close', function () { 44497 // When the dropdown is closed, aria-expended="false" 44498 self.$results.attr('aria-expanded', 'false'); 44499 self.$results.attr('aria-hidden', 'true'); 44500 self.$results.removeAttr('aria-activedescendant'); 44501 }); 44502 44503 container.on('results:toggle', function () { 44504 var $highlighted = self.getHighlightedResults(); 44505 44506 if ($highlighted.length === 0) { 44507 return; 44508 } 44509 44510 $highlighted.trigger('mouseup'); 44511 }); 44512 44513 container.on('results:select', function () { 44514 var $highlighted = self.getHighlightedResults(); 44515 44516 if ($highlighted.length === 0) { 44517 return; 44518 } 44519 44520 var data = $highlighted.data('data'); 44521 44522 if ($highlighted.attr('aria-selected') == 'true') { 44523 self.trigger('close', {}); 44524 } else { 44525 self.trigger('select', { 44526 data: data 44527 }); 44528 } 44529 }); 44530 44531 container.on('results:previous', function () { 44532 var $highlighted = self.getHighlightedResults(); 44533 44534 var $options = self.$results.find('[aria-selected]'); 44535 44536 var currentIndex = $options.index($highlighted); 44537 44538 // If we are already at te top, don't move further 44539 if (currentIndex === 0) { 44540 return; 44541 } 44542 44543 var nextIndex = currentIndex - 1; 44544 44545 // If none are highlighted, highlight the first 44546 if ($highlighted.length === 0) { 44547 nextIndex = 0; 44548 } 44549 44550 var $next = $options.eq(nextIndex); 44551 44552 $next.trigger('mouseenter'); 44553 44554 var currentOffset = self.$results.offset().top; 44555 var nextTop = $next.offset().top; 44556 var nextOffset = self.$results.scrollTop() + (nextTop - currentOffset); 44557 44558 if (nextIndex === 0) { 44559 self.$results.scrollTop(0); 44560 } else if (nextTop - currentOffset < 0) { 44561 self.$results.scrollTop(nextOffset); 44562 } 44563 }); 44564 44565 container.on('results:next', function () { 44566 var $highlighted = self.getHighlightedResults(); 44567 44568 var $options = self.$results.find('[aria-selected]'); 44569 44570 var currentIndex = $options.index($highlighted); 44571 44572 var nextIndex = currentIndex + 1; 44573 44574 // If we are at the last option, stay there 44575 if (nextIndex >= $options.length) { 44576 return; 44577 } 44578 44579 var $next = $options.eq(nextIndex); 44580 44581 $next.trigger('mouseenter'); 44582 44583 var currentOffset = self.$results.offset().top + 44584 self.$results.outerHeight(false); 44585 var nextBottom = $next.offset().top + $next.outerHeight(false); 44586 var nextOffset = self.$results.scrollTop() + nextBottom - currentOffset; 44587 44588 if (nextIndex === 0) { 44589 self.$results.scrollTop(0); 44590 } else if (nextBottom > currentOffset) { 44591 self.$results.scrollTop(nextOffset); 44592 } 44593 }); 44594 44595 container.on('results:focus', function (params) { 44596 params.element.addClass('select2-results__option--highlighted'); 44597 }); 44598 44599 container.on('results:message', function (params) { 44600 self.displayMessage(params); 44601 }); 44602 44603 if ($.fn.mousewheel) { 44604 this.$results.on('mousewheel', function (e) { 44605 var top = self.$results.scrollTop(); 44606 44607 var bottom = self.$results.get(0).scrollHeight - top + e.deltaY; 44608 44609 var isAtTop = e.deltaY > 0 && top - e.deltaY <= 0; 44610 var isAtBottom = e.deltaY < 0 && bottom <= self.$results.height(); 44611 44612 if (isAtTop) { 44613 self.$results.scrollTop(0); 44614 44615 e.preventDefault(); 44616 e.stopPropagation(); 44617 } else if (isAtBottom) { 44618 self.$results.scrollTop( 44619 self.$results.get(0).scrollHeight - self.$results.height() 44620 ); 44621 44622 e.preventDefault(); 44623 e.stopPropagation(); 44624 } 44625 }); 44626 } 44627 44628 this.$results.on('mouseup', '.select2-results__option[aria-selected]', 44629 function (evt) { 44630 var $this = $(this); 44631 44632 var data = $this.data('data'); 44633 44634 if ($this.attr('aria-selected') === 'true') { 44635 if (self.options.get('multiple')) { 44636 self.trigger('unselect', { 44637 originalEvent: evt, 44638 data: data 44639 }); 44640 } else { 44641 self.trigger('close', {}); 44642 } 44643 44644 return; 44645 } 44646 44647 self.trigger('select', { 44648 originalEvent: evt, 44649 data: data 44650 }); 44651 }); 44652 44653 this.$results.on('mouseenter', '.select2-results__option[aria-selected]', 44654 function (evt) { 44655 var data = $(this).data('data'); 44656 44657 self.getHighlightedResults() 44658 .removeClass('select2-results__option--highlighted'); 44659 44660 self.trigger('results:focus', { 44661 data: data, 44662 element: $(this) 44663 }); 44664 }); 44665 }; 44666 44667 Results.prototype.getHighlightedResults = function () { 44668 var $highlighted = this.$results 44669 .find('.select2-results__option--highlighted'); 44670 44671 return $highlighted; 44672 }; 44673 44674 Results.prototype.destroy = function () { 44675 this.$results.remove(); 44676 }; 44677 44678 Results.prototype.ensureHighlightVisible = function () { 44679 var $highlighted = this.getHighlightedResults(); 44680 44681 if ($highlighted.length === 0) { 44682 return; 44683 } 44684 44685 var $options = this.$results.find('[aria-selected]'); 44686 44687 var currentIndex = $options.index($highlighted); 44688 44689 var currentOffset = this.$results.offset().top; 44690 var nextTop = $highlighted.offset().top; 44691 var nextOffset = this.$results.scrollTop() + (nextTop - currentOffset); 44692 44693 var offsetDelta = nextTop - currentOffset; 44694 nextOffset -= $highlighted.outerHeight(false) * 2; 44695 44696 if (currentIndex <= 2) { 44697 this.$results.scrollTop(0); 44698 } else if (offsetDelta > this.$results.outerHeight() || offsetDelta < 0) { 44699 this.$results.scrollTop(nextOffset); 44700 } 44701 }; 44702 44703 Results.prototype.template = function (result, container) { 44704 var template = this.options.get('templateResult'); 44705 var escapeMarkup = this.options.get('escapeMarkup'); 44706 44707 var content = template(result, container); 44708 44709 if (content == null) { 44710 container.style.display = 'none'; 44711 } else if (typeof content === 'string') { 44712 container.innerHTML = escapeMarkup(content); 44713 } else { 44714 $(container).append(content); 44715 } 44716 }; 44717 44718 return Results; 44719}); 44720 44721S2.define('select2/keys',[ 44722 44723], function () { 44724 var KEYS = { 44725 BACKSPACE: 8, 44726 TAB: 9, 44727 ENTER: 13, 44728 SHIFT: 16, 44729 CTRL: 17, 44730 ALT: 18, 44731 ESC: 27, 44732 SPACE: 32, 44733 PAGE_UP: 33, 44734 PAGE_DOWN: 34, 44735 END: 35, 44736 HOME: 36, 44737 LEFT: 37, 44738 UP: 38, 44739 RIGHT: 39, 44740 DOWN: 40, 44741 DELETE: 46 44742 }; 44743 44744 return KEYS; 44745}); 44746 44747S2.define('select2/selection/base',[ 44748 'jquery', 44749 '../utils', 44750 '../keys' 44751], function ($, Utils, KEYS) { 44752 function BaseSelection ($element, options) { 44753 this.$element = $element; 44754 this.options = options; 44755 44756 BaseSelection.__super__.constructor.call(this); 44757 } 44758 44759 Utils.Extend(BaseSelection, Utils.Observable); 44760 44761 BaseSelection.prototype.render = function () { 44762 var $selection = $( 44763 '<span class="select2-selection" role="combobox" ' + 44764 ' aria-haspopup="true" aria-expanded="false">' + 44765 '</span>' 44766 ); 44767 44768 this._tabindex = 0; 44769 44770 if (this.$element.data('old-tabindex') != null) { 44771 this._tabindex = this.$element.data('old-tabindex'); 44772 } else if (this.$element.attr('tabindex') != null) { 44773 this._tabindex = this.$element.attr('tabindex'); 44774 } 44775 44776 $selection.attr('title', this.$element.attr('title')); 44777 $selection.attr('tabindex', this._tabindex); 44778 44779 this.$selection = $selection; 44780 44781 return $selection; 44782 }; 44783 44784 BaseSelection.prototype.bind = function (container, $container) { 44785 var self = this; 44786 44787 var id = container.id + '-container'; 44788 var resultsId = container.id + '-results'; 44789 44790 this.container = container; 44791 44792 this.$selection.on('focus', function (evt) { 44793 self.trigger('focus', evt); 44794 }); 44795 44796 this.$selection.on('blur', function (evt) { 44797 self._handleBlur(evt); 44798 }); 44799 44800 this.$selection.on('keydown', function (evt) { 44801 self.trigger('keypress', evt); 44802 44803 if (evt.which === KEYS.SPACE) { 44804 evt.preventDefault(); 44805 } 44806 }); 44807 44808 container.on('results:focus', function (params) { 44809 self.$selection.attr('aria-activedescendant', params.data._resultId); 44810 }); 44811 44812 container.on('selection:update', function (params) { 44813 self.update(params.data); 44814 }); 44815 44816 container.on('open', function () { 44817 // When the dropdown is open, aria-expanded="true" 44818 self.$selection.attr('aria-expanded', 'true'); 44819 self.$selection.attr('aria-owns', resultsId); 44820 44821 self._attachCloseHandler(container); 44822 }); 44823 44824 container.on('close', function () { 44825 // When the dropdown is closed, aria-expanded="false" 44826 self.$selection.attr('aria-expanded', 'false'); 44827 self.$selection.removeAttr('aria-activedescendant'); 44828 self.$selection.removeAttr('aria-owns'); 44829 44830 self.$selection.focus(); 44831 44832 self._detachCloseHandler(container); 44833 }); 44834 44835 container.on('enable', function () { 44836 self.$selection.attr('tabindex', self._tabindex); 44837 }); 44838 44839 container.on('disable', function () { 44840 self.$selection.attr('tabindex', '-1'); 44841 }); 44842 }; 44843 44844 BaseSelection.prototype._handleBlur = function (evt) { 44845 var self = this; 44846 44847 // This needs to be delayed as the active element is the body when the tab 44848 // key is pressed, possibly along with others. 44849 window.setTimeout(function () { 44850 // Don't trigger `blur` if the focus is still in the selection 44851 if ( 44852 (document.activeElement == self.$selection[0]) || 44853 ($.contains(self.$selection[0], document.activeElement)) 44854 ) { 44855 return; 44856 } 44857 44858 self.trigger('blur', evt); 44859 }, 1); 44860 }; 44861 44862 BaseSelection.prototype._attachCloseHandler = function (container) { 44863 var self = this; 44864 44865 $(document.body).on('mousedown.select2.' + container.id, function (e) { 44866 var $target = $(e.target); 44867 44868 var $select = $target.closest('.select2'); 44869 44870 var $all = $('.select2.select2-container--open'); 44871 44872 $all.each(function () { 44873 var $this = $(this); 44874 44875 if (this == $select[0]) { 44876 return; 44877 } 44878 44879 var $element = $this.data('element'); 44880 44881 $element.select2('close'); 44882 }); 44883 }); 44884 }; 44885 44886 BaseSelection.prototype._detachCloseHandler = function (container) { 44887 $(document.body).off('mousedown.select2.' + container.id); 44888 }; 44889 44890 BaseSelection.prototype.position = function ($selection, $container) { 44891 var $selectionContainer = $container.find('.selection'); 44892 $selectionContainer.append($selection); 44893 }; 44894 44895 BaseSelection.prototype.destroy = function () { 44896 this._detachCloseHandler(this.container); 44897 }; 44898 44899 BaseSelection.prototype.update = function (data) { 44900 throw new Error('The `update` method must be defined in child classes.'); 44901 }; 44902 44903 return BaseSelection; 44904}); 44905 44906S2.define('select2/selection/single',[ 44907 'jquery', 44908 './base', 44909 '../utils', 44910 '../keys' 44911], function ($, BaseSelection, Utils, KEYS) { 44912 function SingleSelection () { 44913 SingleSelection.__super__.constructor.apply(this, arguments); 44914 } 44915 44916 Utils.Extend(SingleSelection, BaseSelection); 44917 44918 SingleSelection.prototype.render = function () { 44919 var $selection = SingleSelection.__super__.render.call(this); 44920 44921 $selection.addClass('select2-selection--single'); 44922 44923 $selection.html( 44924 '<span class="select2-selection__rendered"></span>' + 44925 '<span class="select2-selection__arrow" role="presentation">' + 44926 '<b role="presentation"></b>' + 44927 '</span>' 44928 ); 44929 44930 return $selection; 44931 }; 44932 44933 SingleSelection.prototype.bind = function (container, $container) { 44934 var self = this; 44935 44936 SingleSelection.__super__.bind.apply(this, arguments); 44937 44938 var id = container.id + '-container'; 44939 44940 this.$selection.find('.select2-selection__rendered').attr('id', id); 44941 this.$selection.attr('aria-labelledby', id); 44942 44943 this.$selection.on('mousedown', function (evt) { 44944 // Only respond to left clicks 44945 if (evt.which !== 1) { 44946 return; 44947 } 44948 44949 self.trigger('toggle', { 44950 originalEvent: evt 44951 }); 44952 }); 44953 44954 this.$selection.on('focus', function (evt) { 44955 // User focuses on the container 44956 }); 44957 44958 this.$selection.on('blur', function (evt) { 44959 // User exits the container 44960 }); 44961 44962 container.on('focus', function (evt) { 44963 if (!container.isOpen()) { 44964 self.$selection.focus(); 44965 } 44966 }); 44967 44968 container.on('selection:update', function (params) { 44969 self.update(params.data); 44970 }); 44971 }; 44972 44973 SingleSelection.prototype.clear = function () { 44974 this.$selection.find('.select2-selection__rendered').empty(); 44975 }; 44976 44977 SingleSelection.prototype.display = function (data, container) { 44978 var template = this.options.get('templateSelection'); 44979 var escapeMarkup = this.options.get('escapeMarkup'); 44980 44981 return escapeMarkup(template(data, container)); 44982 }; 44983 44984 SingleSelection.prototype.selectionContainer = function () { 44985 return $('<span></span>'); 44986 }; 44987 44988 SingleSelection.prototype.update = function (data) { 44989 if (data.length === 0) { 44990 this.clear(); 44991 return; 44992 } 44993 44994 var selection = data[0]; 44995 44996 var $rendered = this.$selection.find('.select2-selection__rendered'); 44997 var formatted = this.display(selection, $rendered); 44998 44999 $rendered.empty().append(formatted); 45000 $rendered.prop('title', selection.title || selection.text); 45001 }; 45002 45003 return SingleSelection; 45004}); 45005 45006S2.define('select2/selection/multiple',[ 45007 'jquery', 45008 './base', 45009 '../utils' 45010], function ($, BaseSelection, Utils) { 45011 function MultipleSelection ($element, options) { 45012 MultipleSelection.__super__.constructor.apply(this, arguments); 45013 } 45014 45015 Utils.Extend(MultipleSelection, BaseSelection); 45016 45017 MultipleSelection.prototype.render = function () { 45018 var $selection = MultipleSelection.__super__.render.call(this); 45019 45020 $selection.addClass('select2-selection--multiple'); 45021 45022 $selection.html( 45023 '<ul class="select2-selection__rendered"></ul>' 45024 ); 45025 45026 return $selection; 45027 }; 45028 45029 MultipleSelection.prototype.bind = function (container, $container) { 45030 var self = this; 45031 45032 MultipleSelection.__super__.bind.apply(this, arguments); 45033 45034 this.$selection.on('click', function (evt) { 45035 self.trigger('toggle', { 45036 originalEvent: evt 45037 }); 45038 }); 45039 45040 this.$selection.on( 45041 'click', 45042 '.select2-selection__choice__remove', 45043 function (evt) { 45044 // Ignore the event if it is disabled 45045 if (self.options.get('disabled')) { 45046 return; 45047 } 45048 45049 var $remove = $(this); 45050 var $selection = $remove.parent(); 45051 45052 var data = $selection.data('data'); 45053 45054 self.trigger('unselect', { 45055 originalEvent: evt, 45056 data: data 45057 }); 45058 } 45059 ); 45060 }; 45061 45062 MultipleSelection.prototype.clear = function () { 45063 this.$selection.find('.select2-selection__rendered').empty(); 45064 }; 45065 45066 MultipleSelection.prototype.display = function (data, container) { 45067 var template = this.options.get('templateSelection'); 45068 var escapeMarkup = this.options.get('escapeMarkup'); 45069 45070 return escapeMarkup(template(data, container)); 45071 }; 45072 45073 MultipleSelection.prototype.selectionContainer = function () { 45074 var $container = $( 45075 '<li class="select2-selection__choice">' + 45076 '<span class="select2-selection__choice__remove" role="presentation">' + 45077 '×' + 45078 '</span>' + 45079 '</li>' 45080 ); 45081 45082 return $container; 45083 }; 45084 45085 MultipleSelection.prototype.update = function (data) { 45086 this.clear(); 45087 45088 if (data.length === 0) { 45089 return; 45090 } 45091 45092 var $selections = []; 45093 45094 for (var d = 0; d < data.length; d++) { 45095 var selection = data[d]; 45096 45097 var $selection = this.selectionContainer(); 45098 var formatted = this.display(selection, $selection); 45099 45100 $selection.append(formatted); 45101 $selection.prop('title', selection.title || selection.text); 45102 45103 $selection.data('data', selection); 45104 45105 $selections.push($selection); 45106 } 45107 45108 var $rendered = this.$selection.find('.select2-selection__rendered'); 45109 45110 Utils.appendMany($rendered, $selections); 45111 }; 45112 45113 return MultipleSelection; 45114}); 45115 45116S2.define('select2/selection/placeholder',[ 45117 '../utils' 45118], function (Utils) { 45119 function Placeholder (decorated, $element, options) { 45120 this.placeholder = this.normalizePlaceholder(options.get('placeholder')); 45121 45122 decorated.call(this, $element, options); 45123 } 45124 45125 Placeholder.prototype.normalizePlaceholder = function (_, placeholder) { 45126 if (typeof placeholder === 'string') { 45127 placeholder = { 45128 id: '', 45129 text: placeholder 45130 }; 45131 } 45132 45133 return placeholder; 45134 }; 45135 45136 Placeholder.prototype.createPlaceholder = function (decorated, placeholder) { 45137 var $placeholder = this.selectionContainer(); 45138 45139 $placeholder.html(this.display(placeholder)); 45140 $placeholder.addClass('select2-selection__placeholder') 45141 .removeClass('select2-selection__choice'); 45142 45143 return $placeholder; 45144 }; 45145 45146 Placeholder.prototype.update = function (decorated, data) { 45147 var singlePlaceholder = ( 45148 data.length == 1 && data[0].id != this.placeholder.id 45149 ); 45150 var multipleSelections = data.length > 1; 45151 45152 if (multipleSelections || singlePlaceholder) { 45153 return decorated.call(this, data); 45154 } 45155 45156 this.clear(); 45157 45158 var $placeholder = this.createPlaceholder(this.placeholder); 45159 45160 this.$selection.find('.select2-selection__rendered').append($placeholder); 45161 }; 45162 45163 return Placeholder; 45164}); 45165 45166S2.define('select2/selection/allowClear',[ 45167 'jquery', 45168 '../keys' 45169], function ($, KEYS) { 45170 function AllowClear () { } 45171 45172 AllowClear.prototype.bind = function (decorated, container, $container) { 45173 var self = this; 45174 45175 decorated.call(this, container, $container); 45176 45177 if (this.placeholder == null) { 45178 if (this.options.get('debug') && window.console && console.error) { 45179 console.error( 45180 'Select2: The `allowClear` option should be used in combination ' + 45181 'with the `placeholder` option.' 45182 ); 45183 } 45184 } 45185 45186 this.$selection.on('mousedown', '.select2-selection__clear', 45187 function (evt) { 45188 self._handleClear(evt); 45189 }); 45190 45191 container.on('keypress', function (evt) { 45192 self._handleKeyboardClear(evt, container); 45193 }); 45194 }; 45195 45196 AllowClear.prototype._handleClear = function (_, evt) { 45197 // Ignore the event if it is disabled 45198 if (this.options.get('disabled')) { 45199 return; 45200 } 45201 45202 var $clear = this.$selection.find('.select2-selection__clear'); 45203 45204 // Ignore the event if nothing has been selected 45205 if ($clear.length === 0) { 45206 return; 45207 } 45208 45209 evt.stopPropagation(); 45210 45211 var data = $clear.data('data'); 45212 45213 for (var d = 0; d < data.length; d++) { 45214 var unselectData = { 45215 data: data[d] 45216 }; 45217 45218 // Trigger the `unselect` event, so people can prevent it from being 45219 // cleared. 45220 this.trigger('unselect', unselectData); 45221 45222 // If the event was prevented, don't clear it out. 45223 if (unselectData.prevented) { 45224 return; 45225 } 45226 } 45227 45228 this.$element.val(this.placeholder.id).trigger('change'); 45229 45230 this.trigger('toggle', {}); 45231 }; 45232 45233 AllowClear.prototype._handleKeyboardClear = function (_, evt, container) { 45234 if (container.isOpen()) { 45235 return; 45236 } 45237 45238 if (evt.which == KEYS.DELETE || evt.which == KEYS.BACKSPACE) { 45239 this._handleClear(evt); 45240 } 45241 }; 45242 45243 AllowClear.prototype.update = function (decorated, data) { 45244 decorated.call(this, data); 45245 45246 if (this.$selection.find('.select2-selection__placeholder').length > 0 || 45247 data.length === 0) { 45248 return; 45249 } 45250 45251 var $remove = $( 45252 '<span class="select2-selection__clear">' + 45253 '×' + 45254 '</span>' 45255 ); 45256 $remove.data('data', data); 45257 45258 this.$selection.find('.select2-selection__rendered').prepend($remove); 45259 }; 45260 45261 return AllowClear; 45262}); 45263 45264S2.define('select2/selection/search',[ 45265 'jquery', 45266 '../utils', 45267 '../keys' 45268], function ($, Utils, KEYS) { 45269 function Search (decorated, $element, options) { 45270 decorated.call(this, $element, options); 45271 } 45272 45273 Search.prototype.render = function (decorated) { 45274 var $search = $( 45275 '<li class="select2-search select2-search--inline">' + 45276 '<input class="select2-search__field" type="search" tabindex="-1"' + 45277 ' autocomplete="off" autocorrect="off" autocapitalize="off"' + 45278 ' spellcheck="false" role="textbox" aria-autocomplete="list" />' + 45279 '</li>' 45280 ); 45281 45282 this.$searchContainer = $search; 45283 this.$search = $search.find('input'); 45284 45285 var $rendered = decorated.call(this); 45286 45287 this._transferTabIndex(); 45288 45289 return $rendered; 45290 }; 45291 45292 Search.prototype.bind = function (decorated, container, $container) { 45293 var self = this; 45294 45295 decorated.call(this, container, $container); 45296 45297 container.on('open', function () { 45298 self.$search.trigger('focus'); 45299 }); 45300 45301 container.on('close', function () { 45302 self.$search.val(''); 45303 self.$search.removeAttr('aria-activedescendant'); 45304 self.$search.trigger('focus'); 45305 }); 45306 45307 container.on('enable', function () { 45308 self.$search.prop('disabled', false); 45309 45310 self._transferTabIndex(); 45311 }); 45312 45313 container.on('disable', function () { 45314 self.$search.prop('disabled', true); 45315 }); 45316 45317 container.on('focus', function (evt) { 45318 self.$search.trigger('focus'); 45319 }); 45320 45321 container.on('results:focus', function (params) { 45322 self.$search.attr('aria-activedescendant', params.id); 45323 }); 45324 45325 this.$selection.on('focusin', '.select2-search--inline', function (evt) { 45326 self.trigger('focus', evt); 45327 }); 45328 45329 this.$selection.on('focusout', '.select2-search--inline', function (evt) { 45330 self._handleBlur(evt); 45331 }); 45332 45333 this.$selection.on('keydown', '.select2-search--inline', function (evt) { 45334 evt.stopPropagation(); 45335 45336 self.trigger('keypress', evt); 45337 45338 self._keyUpPrevented = evt.isDefaultPrevented(); 45339 45340 var key = evt.which; 45341 45342 if (key === KEYS.BACKSPACE && self.$search.val() === '') { 45343 var $previousChoice = self.$searchContainer 45344 .prev('.select2-selection__choice'); 45345 45346 if ($previousChoice.length > 0) { 45347 var item = $previousChoice.data('data'); 45348 45349 self.searchRemoveChoice(item); 45350 45351 evt.preventDefault(); 45352 } 45353 } 45354 }); 45355 45356 // Try to detect the IE version should the `documentMode` property that 45357 // is stored on the document. This is only implemented in IE and is 45358 // slightly cleaner than doing a user agent check. 45359 // This property is not available in Edge, but Edge also doesn't have 45360 // this bug. 45361 var msie = document.documentMode; 45362 var disableInputEvents = msie && msie <= 11; 45363 45364 // Workaround for browsers which do not support the `input` event 45365 // This will prevent double-triggering of events for browsers which support 45366 // both the `keyup` and `input` events. 45367 this.$selection.on( 45368 'input.searchcheck', 45369 '.select2-search--inline', 45370 function (evt) { 45371 // IE will trigger the `input` event when a placeholder is used on a 45372 // search box. To get around this issue, we are forced to ignore all 45373 // `input` events in IE and keep using `keyup`. 45374 if (disableInputEvents) { 45375 self.$selection.off('input.search input.searchcheck'); 45376 return; 45377 } 45378 45379 // Unbind the duplicated `keyup` event 45380 self.$selection.off('keyup.search'); 45381 } 45382 ); 45383 45384 this.$selection.on( 45385 'keyup.search input.search', 45386 '.select2-search--inline', 45387 function (evt) { 45388 // IE will trigger the `input` event when a placeholder is used on a 45389 // search box. To get around this issue, we are forced to ignore all 45390 // `input` events in IE and keep using `keyup`. 45391 if (disableInputEvents && evt.type === 'input') { 45392 self.$selection.off('input.search input.searchcheck'); 45393 return; 45394 } 45395 45396 var key = evt.which; 45397 45398 // We can freely ignore events from modifier keys 45399 if (key == KEYS.SHIFT || key == KEYS.CTRL || key == KEYS.ALT) { 45400 return; 45401 } 45402 45403 // Tabbing will be handled during the `keydown` phase 45404 if (key == KEYS.TAB) { 45405 return; 45406 } 45407 45408 self.handleSearch(evt); 45409 } 45410 ); 45411 }; 45412 45413 /** 45414 * This method will transfer the tabindex attribute from the rendered 45415 * selection to the search box. This allows for the search box to be used as 45416 * the primary focus instead of the selection container. 45417 * 45418 * @private 45419 */ 45420 Search.prototype._transferTabIndex = function (decorated) { 45421 this.$search.attr('tabindex', this.$selection.attr('tabindex')); 45422 this.$selection.attr('tabindex', '-1'); 45423 }; 45424 45425 Search.prototype.createPlaceholder = function (decorated, placeholder) { 45426 this.$search.attr('placeholder', placeholder.text); 45427 }; 45428 45429 Search.prototype.update = function (decorated, data) { 45430 var searchHadFocus = this.$search[0] == document.activeElement; 45431 45432 this.$search.attr('placeholder', ''); 45433 45434 decorated.call(this, data); 45435 45436 this.$selection.find('.select2-selection__rendered') 45437 .append(this.$searchContainer); 45438 45439 this.resizeSearch(); 45440 if (searchHadFocus) { 45441 this.$search.focus(); 45442 } 45443 }; 45444 45445 Search.prototype.handleSearch = function () { 45446 this.resizeSearch(); 45447 45448 if (!this._keyUpPrevented) { 45449 var input = this.$search.val(); 45450 45451 this.trigger('query', { 45452 term: input 45453 }); 45454 } 45455 45456 this._keyUpPrevented = false; 45457 }; 45458 45459 Search.prototype.searchRemoveChoice = function (decorated, item) { 45460 this.trigger('unselect', { 45461 data: item 45462 }); 45463 45464 this.$search.val(item.text); 45465 this.handleSearch(); 45466 }; 45467 45468 Search.prototype.resizeSearch = function () { 45469 this.$search.css('width', '25px'); 45470 45471 var width = ''; 45472 45473 if (this.$search.attr('placeholder') !== '') { 45474 width = this.$selection.find('.select2-selection__rendered').innerWidth(); 45475 } else { 45476 var minimumWidth = this.$search.val().length + 1; 45477 45478 width = (minimumWidth * 0.75) + 'em'; 45479 } 45480 45481 this.$search.css('width', width); 45482 }; 45483 45484 return Search; 45485}); 45486 45487S2.define('select2/selection/eventRelay',[ 45488 'jquery' 45489], function ($) { 45490 function EventRelay () { } 45491 45492 EventRelay.prototype.bind = function (decorated, container, $container) { 45493 var self = this; 45494 var relayEvents = [ 45495 'open', 'opening', 45496 'close', 'closing', 45497 'select', 'selecting', 45498 'unselect', 'unselecting' 45499 ]; 45500 45501 var preventableEvents = ['opening', 'closing', 'selecting', 'unselecting']; 45502 45503 decorated.call(this, container, $container); 45504 45505 container.on('*', function (name, params) { 45506 // Ignore events that should not be relayed 45507 if ($.inArray(name, relayEvents) === -1) { 45508 return; 45509 } 45510 45511 // The parameters should always be an object 45512 params = params || {}; 45513 45514 // Generate the jQuery event for the Select2 event 45515 var evt = $.Event('select2:' + name, { 45516 params: params 45517 }); 45518 45519 self.$element.trigger(evt); 45520 45521 // Only handle preventable events if it was one 45522 if ($.inArray(name, preventableEvents) === -1) { 45523 return; 45524 } 45525 45526 params.prevented = evt.isDefaultPrevented(); 45527 }); 45528 }; 45529 45530 return EventRelay; 45531}); 45532 45533S2.define('select2/translation',[ 45534 'jquery', 45535 'require' 45536], function ($, require) { 45537 function Translation (dict) { 45538 this.dict = dict || {}; 45539 } 45540 45541 Translation.prototype.all = function () { 45542 return this.dict; 45543 }; 45544 45545 Translation.prototype.get = function (key) { 45546 return this.dict[key]; 45547 }; 45548 45549 Translation.prototype.extend = function (translation) { 45550 this.dict = $.extend({}, translation.all(), this.dict); 45551 }; 45552 45553 // Static functions 45554 45555 Translation._cache = {}; 45556 45557 Translation.loadPath = function (path) { 45558 if (!(path in Translation._cache)) { 45559 var translations = require(path); 45560 45561 Translation._cache[path] = translations; 45562 } 45563 45564 return new Translation(Translation._cache[path]); 45565 }; 45566 45567 return Translation; 45568}); 45569 45570S2.define('select2/diacritics',[ 45571 45572], function () { 45573 var diacritics = { 45574 '\u24B6': 'A', 45575 '\uFF21': 'A', 45576 '\u00C0': 'A', 45577 '\u00C1': 'A', 45578 '\u00C2': 'A', 45579 '\u1EA6': 'A', 45580 '\u1EA4': 'A', 45581 '\u1EAA': 'A', 45582 '\u1EA8': 'A', 45583 '\u00C3': 'A', 45584 '\u0100': 'A', 45585 '\u0102': 'A', 45586 '\u1EB0': 'A', 45587 '\u1EAE': 'A', 45588 '\u1EB4': 'A', 45589 '\u1EB2': 'A', 45590 '\u0226': 'A', 45591 '\u01E0': 'A', 45592 '\u00C4': 'A', 45593 '\u01DE': 'A', 45594 '\u1EA2': 'A', 45595 '\u00C5': 'A', 45596 '\u01FA': 'A', 45597 '\u01CD': 'A', 45598 '\u0200': 'A', 45599 '\u0202': 'A', 45600 '\u1EA0': 'A', 45601 '\u1EAC': 'A', 45602 '\u1EB6': 'A', 45603 '\u1E00': 'A', 45604 '\u0104': 'A', 45605 '\u023A': 'A', 45606 '\u2C6F': 'A', 45607 '\uA732': 'AA', 45608 '\u00C6': 'AE', 45609 '\u01FC': 'AE', 45610 '\u01E2': 'AE', 45611 '\uA734': 'AO', 45612 '\uA736': 'AU', 45613 '\uA738': 'AV', 45614 '\uA73A': 'AV', 45615 '\uA73C': 'AY', 45616 '\u24B7': 'B', 45617 '\uFF22': 'B', 45618 '\u1E02': 'B', 45619 '\u1E04': 'B', 45620 '\u1E06': 'B', 45621 '\u0243': 'B', 45622 '\u0182': 'B', 45623 '\u0181': 'B', 45624 '\u24B8': 'C', 45625 '\uFF23': 'C', 45626 '\u0106': 'C', 45627 '\u0108': 'C', 45628 '\u010A': 'C', 45629 '\u010C': 'C', 45630 '\u00C7': 'C', 45631 '\u1E08': 'C', 45632 '\u0187': 'C', 45633 '\u023B': 'C', 45634 '\uA73E': 'C', 45635 '\u24B9': 'D', 45636 '\uFF24': 'D', 45637 '\u1E0A': 'D', 45638 '\u010E': 'D', 45639 '\u1E0C': 'D', 45640 '\u1E10': 'D', 45641 '\u1E12': 'D', 45642 '\u1E0E': 'D', 45643 '\u0110': 'D', 45644 '\u018B': 'D', 45645 '\u018A': 'D', 45646 '\u0189': 'D', 45647 '\uA779': 'D', 45648 '\u01F1': 'DZ', 45649 '\u01C4': 'DZ', 45650 '\u01F2': 'Dz', 45651 '\u01C5': 'Dz', 45652 '\u24BA': 'E', 45653 '\uFF25': 'E', 45654 '\u00C8': 'E', 45655 '\u00C9': 'E', 45656 '\u00CA': 'E', 45657 '\u1EC0': 'E', 45658 '\u1EBE': 'E', 45659 '\u1EC4': 'E', 45660 '\u1EC2': 'E', 45661 '\u1EBC': 'E', 45662 '\u0112': 'E', 45663 '\u1E14': 'E', 45664 '\u1E16': 'E', 45665 '\u0114': 'E', 45666 '\u0116': 'E', 45667 '\u00CB': 'E', 45668 '\u1EBA': 'E', 45669 '\u011A': 'E', 45670 '\u0204': 'E', 45671 '\u0206': 'E', 45672 '\u1EB8': 'E', 45673 '\u1EC6': 'E', 45674 '\u0228': 'E', 45675 '\u1E1C': 'E', 45676 '\u0118': 'E', 45677 '\u1E18': 'E', 45678 '\u1E1A': 'E', 45679 '\u0190': 'E', 45680 '\u018E': 'E', 45681 '\u24BB': 'F', 45682 '\uFF26': 'F', 45683 '\u1E1E': 'F', 45684 '\u0191': 'F', 45685 '\uA77B': 'F', 45686 '\u24BC': 'G', 45687 '\uFF27': 'G', 45688 '\u01F4': 'G', 45689 '\u011C': 'G', 45690 '\u1E20': 'G', 45691 '\u011E': 'G', 45692 '\u0120': 'G', 45693 '\u01E6': 'G', 45694 '\u0122': 'G', 45695 '\u01E4': 'G', 45696 '\u0193': 'G', 45697 '\uA7A0': 'G', 45698 '\uA77D': 'G', 45699 '\uA77E': 'G', 45700 '\u24BD': 'H', 45701 '\uFF28': 'H', 45702 '\u0124': 'H', 45703 '\u1E22': 'H', 45704 '\u1E26': 'H', 45705 '\u021E': 'H', 45706 '\u1E24': 'H', 45707 '\u1E28': 'H', 45708 '\u1E2A': 'H', 45709 '\u0126': 'H', 45710 '\u2C67': 'H', 45711 '\u2C75': 'H', 45712 '\uA78D': 'H', 45713 '\u24BE': 'I', 45714 '\uFF29': 'I', 45715 '\u00CC': 'I', 45716 '\u00CD': 'I', 45717 '\u00CE': 'I', 45718 '\u0128': 'I', 45719 '\u012A': 'I', 45720 '\u012C': 'I', 45721 '\u0130': 'I', 45722 '\u00CF': 'I', 45723 '\u1E2E': 'I', 45724 '\u1EC8': 'I', 45725 '\u01CF': 'I', 45726 '\u0208': 'I', 45727 '\u020A': 'I', 45728 '\u1ECA': 'I', 45729 '\u012E': 'I', 45730 '\u1E2C': 'I', 45731 '\u0197': 'I', 45732 '\u24BF': 'J', 45733 '\uFF2A': 'J', 45734 '\u0134': 'J', 45735 '\u0248': 'J', 45736 '\u24C0': 'K', 45737 '\uFF2B': 'K', 45738 '\u1E30': 'K', 45739 '\u01E8': 'K', 45740 '\u1E32': 'K', 45741 '\u0136': 'K', 45742 '\u1E34': 'K', 45743 '\u0198': 'K', 45744 '\u2C69': 'K', 45745 '\uA740': 'K', 45746 '\uA742': 'K', 45747 '\uA744': 'K', 45748 '\uA7A2': 'K', 45749 '\u24C1': 'L', 45750 '\uFF2C': 'L', 45751 '\u013F': 'L', 45752 '\u0139': 'L', 45753 '\u013D': 'L', 45754 '\u1E36': 'L', 45755 '\u1E38': 'L', 45756 '\u013B': 'L', 45757 '\u1E3C': 'L', 45758 '\u1E3A': 'L', 45759 '\u0141': 'L', 45760 '\u023D': 'L', 45761 '\u2C62': 'L', 45762 '\u2C60': 'L', 45763 '\uA748': 'L', 45764 '\uA746': 'L', 45765 '\uA780': 'L', 45766 '\u01C7': 'LJ', 45767 '\u01C8': 'Lj', 45768 '\u24C2': 'M', 45769 '\uFF2D': 'M', 45770 '\u1E3E': 'M', 45771 '\u1E40': 'M', 45772 '\u1E42': 'M', 45773 '\u2C6E': 'M', 45774 '\u019C': 'M', 45775 '\u24C3': 'N', 45776 '\uFF2E': 'N', 45777 '\u01F8': 'N', 45778 '\u0143': 'N', 45779 '\u00D1': 'N', 45780 '\u1E44': 'N', 45781 '\u0147': 'N', 45782 '\u1E46': 'N', 45783 '\u0145': 'N', 45784 '\u1E4A': 'N', 45785 '\u1E48': 'N', 45786 '\u0220': 'N', 45787 '\u019D': 'N', 45788 '\uA790': 'N', 45789 '\uA7A4': 'N', 45790 '\u01CA': 'NJ', 45791 '\u01CB': 'Nj', 45792 '\u24C4': 'O', 45793 '\uFF2F': 'O', 45794 '\u00D2': 'O', 45795 '\u00D3': 'O', 45796 '\u00D4': 'O', 45797 '\u1ED2': 'O', 45798 '\u1ED0': 'O', 45799 '\u1ED6': 'O', 45800 '\u1ED4': 'O', 45801 '\u00D5': 'O', 45802 '\u1E4C': 'O', 45803 '\u022C': 'O', 45804 '\u1E4E': 'O', 45805 '\u014C': 'O', 45806 '\u1E50': 'O', 45807 '\u1E52': 'O', 45808 '\u014E': 'O', 45809 '\u022E': 'O', 45810 '\u0230': 'O', 45811 '\u00D6': 'O', 45812 '\u022A': 'O', 45813 '\u1ECE': 'O', 45814 '\u0150': 'O', 45815 '\u01D1': 'O', 45816 '\u020C': 'O', 45817 '\u020E': 'O', 45818 '\u01A0': 'O', 45819 '\u1EDC': 'O', 45820 '\u1EDA': 'O', 45821 '\u1EE0': 'O', 45822 '\u1EDE': 'O', 45823 '\u1EE2': 'O', 45824 '\u1ECC': 'O', 45825 '\u1ED8': 'O', 45826 '\u01EA': 'O', 45827 '\u01EC': 'O', 45828 '\u00D8': 'O', 45829 '\u01FE': 'O', 45830 '\u0186': 'O', 45831 '\u019F': 'O', 45832 '\uA74A': 'O', 45833 '\uA74C': 'O', 45834 '\u01A2': 'OI', 45835 '\uA74E': 'OO', 45836 '\u0222': 'OU', 45837 '\u24C5': 'P', 45838 '\uFF30': 'P', 45839 '\u1E54': 'P', 45840 '\u1E56': 'P', 45841 '\u01A4': 'P', 45842 '\u2C63': 'P', 45843 '\uA750': 'P', 45844 '\uA752': 'P', 45845 '\uA754': 'P', 45846 '\u24C6': 'Q', 45847 '\uFF31': 'Q', 45848 '\uA756': 'Q', 45849 '\uA758': 'Q', 45850 '\u024A': 'Q', 45851 '\u24C7': 'R', 45852 '\uFF32': 'R', 45853 '\u0154': 'R', 45854 '\u1E58': 'R', 45855 '\u0158': 'R', 45856 '\u0210': 'R', 45857 '\u0212': 'R', 45858 '\u1E5A': 'R', 45859 '\u1E5C': 'R', 45860 '\u0156': 'R', 45861 '\u1E5E': 'R', 45862 '\u024C': 'R', 45863 '\u2C64': 'R', 45864 '\uA75A': 'R', 45865 '\uA7A6': 'R', 45866 '\uA782': 'R', 45867 '\u24C8': 'S', 45868 '\uFF33': 'S', 45869 '\u1E9E': 'S', 45870 '\u015A': 'S', 45871 '\u1E64': 'S', 45872 '\u015C': 'S', 45873 '\u1E60': 'S', 45874 '\u0160': 'S', 45875 '\u1E66': 'S', 45876 '\u1E62': 'S', 45877 '\u1E68': 'S', 45878 '\u0218': 'S', 45879 '\u015E': 'S', 45880 '\u2C7E': 'S', 45881 '\uA7A8': 'S', 45882 '\uA784': 'S', 45883 '\u24C9': 'T', 45884 '\uFF34': 'T', 45885 '\u1E6A': 'T', 45886 '\u0164': 'T', 45887 '\u1E6C': 'T', 45888 '\u021A': 'T', 45889 '\u0162': 'T', 45890 '\u1E70': 'T', 45891 '\u1E6E': 'T', 45892 '\u0166': 'T', 45893 '\u01AC': 'T', 45894 '\u01AE': 'T', 45895 '\u023E': 'T', 45896 '\uA786': 'T', 45897 '\uA728': 'TZ', 45898 '\u24CA': 'U', 45899 '\uFF35': 'U', 45900 '\u00D9': 'U', 45901 '\u00DA': 'U', 45902 '\u00DB': 'U', 45903 '\u0168': 'U', 45904 '\u1E78': 'U', 45905 '\u016A': 'U', 45906 '\u1E7A': 'U', 45907 '\u016C': 'U', 45908 '\u00DC': 'U', 45909 '\u01DB': 'U', 45910 '\u01D7': 'U', 45911 '\u01D5': 'U', 45912 '\u01D9': 'U', 45913 '\u1EE6': 'U', 45914 '\u016E': 'U', 45915 '\u0170': 'U', 45916 '\u01D3': 'U', 45917 '\u0214': 'U', 45918 '\u0216': 'U', 45919 '\u01AF': 'U', 45920 '\u1EEA': 'U', 45921 '\u1EE8': 'U', 45922 '\u1EEE': 'U', 45923 '\u1EEC': 'U', 45924 '\u1EF0': 'U', 45925 '\u1EE4': 'U', 45926 '\u1E72': 'U', 45927 '\u0172': 'U', 45928 '\u1E76': 'U', 45929 '\u1E74': 'U', 45930 '\u0244': 'U', 45931 '\u24CB': 'V', 45932 '\uFF36': 'V', 45933 '\u1E7C': 'V', 45934 '\u1E7E': 'V', 45935 '\u01B2': 'V', 45936 '\uA75E': 'V', 45937 '\u0245': 'V', 45938 '\uA760': 'VY', 45939 '\u24CC': 'W', 45940 '\uFF37': 'W', 45941 '\u1E80': 'W', 45942 '\u1E82': 'W', 45943 '\u0174': 'W', 45944 '\u1E86': 'W', 45945 '\u1E84': 'W', 45946 '\u1E88': 'W', 45947 '\u2C72': 'W', 45948 '\u24CD': 'X', 45949 '\uFF38': 'X', 45950 '\u1E8A': 'X', 45951 '\u1E8C': 'X', 45952 '\u24CE': 'Y', 45953 '\uFF39': 'Y', 45954 '\u1EF2': 'Y', 45955 '\u00DD': 'Y', 45956 '\u0176': 'Y', 45957 '\u1EF8': 'Y', 45958 '\u0232': 'Y', 45959 '\u1E8E': 'Y', 45960 '\u0178': 'Y', 45961 '\u1EF6': 'Y', 45962 '\u1EF4': 'Y', 45963 '\u01B3': 'Y', 45964 '\u024E': 'Y', 45965 '\u1EFE': 'Y', 45966 '\u24CF': 'Z', 45967 '\uFF3A': 'Z', 45968 '\u0179': 'Z', 45969 '\u1E90': 'Z', 45970 '\u017B': 'Z', 45971 '\u017D': 'Z', 45972 '\u1E92': 'Z', 45973 '\u1E94': 'Z', 45974 '\u01B5': 'Z', 45975 '\u0224': 'Z', 45976 '\u2C7F': 'Z', 45977 '\u2C6B': 'Z', 45978 '\uA762': 'Z', 45979 '\u24D0': 'a', 45980 '\uFF41': 'a', 45981 '\u1E9A': 'a', 45982 '\u00E0': 'a', 45983 '\u00E1': 'a', 45984 '\u00E2': 'a', 45985 '\u1EA7': 'a', 45986 '\u1EA5': 'a', 45987 '\u1EAB': 'a', 45988 '\u1EA9': 'a', 45989 '\u00E3': 'a', 45990 '\u0101': 'a', 45991 '\u0103': 'a', 45992 '\u1EB1': 'a', 45993 '\u1EAF': 'a', 45994 '\u1EB5': 'a', 45995 '\u1EB3': 'a', 45996 '\u0227': 'a', 45997 '\u01E1': 'a', 45998 '\u00E4': 'a', 45999 '\u01DF': 'a', 46000 '\u1EA3': 'a', 46001 '\u00E5': 'a', 46002 '\u01FB': 'a', 46003 '\u01CE': 'a', 46004 '\u0201': 'a', 46005 '\u0203': 'a', 46006 '\u1EA1': 'a', 46007 '\u1EAD': 'a', 46008 '\u1EB7': 'a', 46009 '\u1E01': 'a', 46010 '\u0105': 'a', 46011 '\u2C65': 'a', 46012 '\u0250': 'a', 46013 '\uA733': 'aa', 46014 '\u00E6': 'ae', 46015 '\u01FD': 'ae', 46016 '\u01E3': 'ae', 46017 '\uA735': 'ao', 46018 '\uA737': 'au', 46019 '\uA739': 'av', 46020 '\uA73B': 'av', 46021 '\uA73D': 'ay', 46022 '\u24D1': 'b', 46023 '\uFF42': 'b', 46024 '\u1E03': 'b', 46025 '\u1E05': 'b', 46026 '\u1E07': 'b', 46027 '\u0180': 'b', 46028 '\u0183': 'b', 46029 '\u0253': 'b', 46030 '\u24D2': 'c', 46031 '\uFF43': 'c', 46032 '\u0107': 'c', 46033 '\u0109': 'c', 46034 '\u010B': 'c', 46035 '\u010D': 'c', 46036 '\u00E7': 'c', 46037 '\u1E09': 'c', 46038 '\u0188': 'c', 46039 '\u023C': 'c', 46040 '\uA73F': 'c', 46041 '\u2184': 'c', 46042 '\u24D3': 'd', 46043 '\uFF44': 'd', 46044 '\u1E0B': 'd', 46045 '\u010F': 'd', 46046 '\u1E0D': 'd', 46047 '\u1E11': 'd', 46048 '\u1E13': 'd', 46049 '\u1E0F': 'd', 46050 '\u0111': 'd', 46051 '\u018C': 'd', 46052 '\u0256': 'd', 46053 '\u0257': 'd', 46054 '\uA77A': 'd', 46055 '\u01F3': 'dz', 46056 '\u01C6': 'dz', 46057 '\u24D4': 'e', 46058 '\uFF45': 'e', 46059 '\u00E8': 'e', 46060 '\u00E9': 'e', 46061 '\u00EA': 'e', 46062 '\u1EC1': 'e', 46063 '\u1EBF': 'e', 46064 '\u1EC5': 'e', 46065 '\u1EC3': 'e', 46066 '\u1EBD': 'e', 46067 '\u0113': 'e', 46068 '\u1E15': 'e', 46069 '\u1E17': 'e', 46070 '\u0115': 'e', 46071 '\u0117': 'e', 46072 '\u00EB': 'e', 46073 '\u1EBB': 'e', 46074 '\u011B': 'e', 46075 '\u0205': 'e', 46076 '\u0207': 'e', 46077 '\u1EB9': 'e', 46078 '\u1EC7': 'e', 46079 '\u0229': 'e', 46080 '\u1E1D': 'e', 46081 '\u0119': 'e', 46082 '\u1E19': 'e', 46083 '\u1E1B': 'e', 46084 '\u0247': 'e', 46085 '\u025B': 'e', 46086 '\u01DD': 'e', 46087 '\u24D5': 'f', 46088 '\uFF46': 'f', 46089 '\u1E1F': 'f', 46090 '\u0192': 'f', 46091 '\uA77C': 'f', 46092 '\u24D6': 'g', 46093 '\uFF47': 'g', 46094 '\u01F5': 'g', 46095 '\u011D': 'g', 46096 '\u1E21': 'g', 46097 '\u011F': 'g', 46098 '\u0121': 'g', 46099 '\u01E7': 'g', 46100 '\u0123': 'g', 46101 '\u01E5': 'g', 46102 '\u0260': 'g', 46103 '\uA7A1': 'g', 46104 '\u1D79': 'g', 46105 '\uA77F': 'g', 46106 '\u24D7': 'h', 46107 '\uFF48': 'h', 46108 '\u0125': 'h', 46109 '\u1E23': 'h', 46110 '\u1E27': 'h', 46111 '\u021F': 'h', 46112 '\u1E25': 'h', 46113 '\u1E29': 'h', 46114 '\u1E2B': 'h', 46115 '\u1E96': 'h', 46116 '\u0127': 'h', 46117 '\u2C68': 'h', 46118 '\u2C76': 'h', 46119 '\u0265': 'h', 46120 '\u0195': 'hv', 46121 '\u24D8': 'i', 46122 '\uFF49': 'i', 46123 '\u00EC': 'i', 46124 '\u00ED': 'i', 46125 '\u00EE': 'i', 46126 '\u0129': 'i', 46127 '\u012B': 'i', 46128 '\u012D': 'i', 46129 '\u00EF': 'i', 46130 '\u1E2F': 'i', 46131 '\u1EC9': 'i', 46132 '\u01D0': 'i', 46133 '\u0209': 'i', 46134 '\u020B': 'i', 46135 '\u1ECB': 'i', 46136 '\u012F': 'i', 46137 '\u1E2D': 'i', 46138 '\u0268': 'i', 46139 '\u0131': 'i', 46140 '\u24D9': 'j', 46141 '\uFF4A': 'j', 46142 '\u0135': 'j', 46143 '\u01F0': 'j', 46144 '\u0249': 'j', 46145 '\u24DA': 'k', 46146 '\uFF4B': 'k', 46147 '\u1E31': 'k', 46148 '\u01E9': 'k', 46149 '\u1E33': 'k', 46150 '\u0137': 'k', 46151 '\u1E35': 'k', 46152 '\u0199': 'k', 46153 '\u2C6A': 'k', 46154 '\uA741': 'k', 46155 '\uA743': 'k', 46156 '\uA745': 'k', 46157 '\uA7A3': 'k', 46158 '\u24DB': 'l', 46159 '\uFF4C': 'l', 46160 '\u0140': 'l', 46161 '\u013A': 'l', 46162 '\u013E': 'l', 46163 '\u1E37': 'l', 46164 '\u1E39': 'l', 46165 '\u013C': 'l', 46166 '\u1E3D': 'l', 46167 '\u1E3B': 'l', 46168 '\u017F': 'l', 46169 '\u0142': 'l', 46170 '\u019A': 'l', 46171 '\u026B': 'l', 46172 '\u2C61': 'l', 46173 '\uA749': 'l', 46174 '\uA781': 'l', 46175 '\uA747': 'l', 46176 '\u01C9': 'lj', 46177 '\u24DC': 'm', 46178 '\uFF4D': 'm', 46179 '\u1E3F': 'm', 46180 '\u1E41': 'm', 46181 '\u1E43': 'm', 46182 '\u0271': 'm', 46183 '\u026F': 'm', 46184 '\u24DD': 'n', 46185 '\uFF4E': 'n',
vendor: 6,356 bytes, lines 46186-46483
46186 '\u01F9': 'n', 46187 '\u0144': 'n', 46188 '\u00F1': 'n', 46189 '\u1E45': 'n', 46190 '\u0148': 'n', 46191 '\u1E47': 'n', 46192 '\u0146': 'n', 46193 '\u1E4B': 'n', 46194 '\u1E49': 'n', 46195 '\u019E': 'n', 46196 '\u0272': 'n', 46197 '\u0149': 'n', 46198 '\uA791': 'n', 46199 '\uA7A5': 'n', 46200 '\u01CC': 'nj', 46201 '\u24DE': 'o', 46202 '\uFF4F': 'o', 46203 '\u00F2': 'o', 46204 '\u00F3': 'o', 46205 '\u00F4': 'o', 46206 '\u1ED3': 'o', 46207 '\u1ED1': 'o', 46208 '\u1ED7': 'o', 46209 '\u1ED5': 'o', 46210 '\u00F5': 'o', 46211 '\u1E4D': 'o', 46212 '\u022D': 'o', 46213 '\u1E4F': 'o', 46214 '\u014D': 'o', 46215 '\u1E51': 'o', 46216 '\u1E53': 'o', 46217 '\u014F': 'o', 46218 '\u022F': 'o', 46219 '\u0231': 'o', 46220 '\u00F6': 'o', 46221 '\u022B': 'o', 46222 '\u1ECF': 'o', 46223 '\u0151': 'o', 46224 '\u01D2': 'o', 46225 '\u020D': 'o', 46226 '\u020F': 'o', 46227 '\u01A1': 'o', 46228 '\u1EDD': 'o', 46229 '\u1EDB': 'o', 46230 '\u1EE1': 'o', 46231 '\u1EDF': 'o', 46232 '\u1EE3': 'o', 46233 '\u1ECD': 'o', 46234 '\u1ED9': 'o', 46235 '\u01EB': 'o', 46236 '\u01ED': 'o', 46237 '\u00F8': 'o', 46238 '\u01FF': 'o', 46239 '\u0254': 'o', 46240 '\uA74B': 'o', 46241 '\uA74D': 'o', 46242 '\u0275': 'o', 46243 '\u01A3': 'oi', 46244 '\u0223': 'ou', 46245 '\uA74F': 'oo', 46246 '\u24DF': 'p', 46247 '\uFF50': 'p', 46248 '\u1E55': 'p', 46249 '\u1E57': 'p', 46250 '\u01A5': 'p', 46251 '\u1D7D': 'p', 46252 '\uA751': 'p', 46253 '\uA753': 'p', 46254 '\uA755': 'p', 46255 '\u24E0': 'q', 46256 '\uFF51': 'q', 46257 '\u024B': 'q', 46258 '\uA757': 'q', 46259 '\uA759': 'q', 46260 '\u24E1': 'r', 46261 '\uFF52': 'r', 46262 '\u0155': 'r', 46263 '\u1E59': 'r', 46264 '\u0159': 'r', 46265 '\u0211': 'r', 46266 '\u0213': 'r', 46267 '\u1E5B': 'r', 46268 '\u1E5D': 'r', 46269 '\u0157': 'r', 46270 '\u1E5F': 'r', 46271 '\u024D': 'r', 46272 '\u027D': 'r', 46273 '\uA75B': 'r', 46274 '\uA7A7': 'r', 46275 '\uA783': 'r', 46276 '\u24E2': 's', 46277 '\uFF53': 's', 46278 '\u00DF': 's', 46279 '\u015B': 's', 46280 '\u1E65': 's', 46281 '\u015D': 's', 46282 '\u1E61': 's', 46283 '\u0161': 's', 46284 '\u1E67': 's', 46285 '\u1E63': 's', 46286 '\u1E69': 's', 46287 '\u0219': 's', 46288 '\u015F': 's', 46289 '\u023F': 's', 46290 '\uA7A9': 's', 46291 '\uA785': 's', 46292 '\u1E9B': 's', 46293 '\u24E3': 't', 46294 '\uFF54': 't', 46295 '\u1E6B': 't', 46296 '\u1E97': 't', 46297 '\u0165': 't', 46298 '\u1E6D': 't', 46299 '\u021B': 't', 46300 '\u0163': 't', 46301 '\u1E71': 't', 46302 '\u1E6F': 't', 46303 '\u0167': 't', 46304 '\u01AD': 't', 46305 '\u0288': 't', 46306 '\u2C66': 't', 46307 '\uA787': 't', 46308 '\uA729': 'tz', 46309 '\u24E4': 'u', 46310 '\uFF55': 'u', 46311 '\u00F9': 'u', 46312 '\u00FA': 'u', 46313 '\u00FB': 'u', 46314 '\u0169': 'u', 46315 '\u1E79': 'u', 46316 '\u016B': 'u', 46317 '\u1E7B': 'u', 46318 '\u016D': 'u', 46319 '\u00FC': 'u', 46320 '\u01DC': 'u', 46321 '\u01D8': 'u', 46322 '\u01D6': 'u', 46323 '\u01DA': 'u', 46324 '\u1EE7': 'u', 46325 '\u016F': 'u', 46326 '\u0171': 'u', 46327 '\u01D4': 'u', 46328 '\u0215': 'u', 46329 '\u0217': 'u', 46330 '\u01B0': 'u', 46331 '\u1EEB': 'u', 46332 '\u1EE9': 'u', 46333 '\u1EEF': 'u', 46334 '\u1EED': 'u', 46335 '\u1EF1': 'u', 46336 '\u1EE5': 'u', 46337 '\u1E73': 'u', 46338 '\u0173': 'u', 46339 '\u1E77': 'u', 46340 '\u1E75': 'u', 46341 '\u0289': 'u', 46342 '\u24E5': 'v', 46343 '\uFF56': 'v', 46344 '\u1E7D': 'v', 46345 '\u1E7F': 'v', 46346 '\u028B': 'v', 46347 '\uA75F': 'v', 46348 '\u028C': 'v', 46349 '\uA761': 'vy', 46350 '\u24E6': 'w', 46351 '\uFF57': 'w', 46352 '\u1E81': 'w', 46353 '\u1E83': 'w', 46354 '\u0175': 'w', 46355 '\u1E87': 'w', 46356 '\u1E85': 'w', 46357 '\u1E98': 'w', 46358 '\u1E89': 'w', 46359 '\u2C73': 'w', 46360 '\u24E7': 'x', 46361 '\uFF58': 'x', 46362 '\u1E8B': 'x', 46363 '\u1E8D': 'x', 46364 '\u24E8': 'y', 46365 '\uFF59': 'y', 46366 '\u1EF3': 'y', 46367 '\u00FD': 'y', 46368 '\u0177': 'y', 46369 '\u1EF9': 'y', 46370 '\u0233': 'y', 46371 '\u1E8F': 'y', 46372 '\u00FF': 'y', 46373 '\u1EF7': 'y', 46374 '\u1E99': 'y', 46375 '\u1EF5': 'y', 46376 '\u01B4': 'y', 46377 '\u024F': 'y', 46378 '\u1EFF': 'y', 46379 '\u24E9': 'z', 46380 '\uFF5A': 'z', 46381 '\u017A': 'z', 46382 '\u1E91': 'z', 46383 '\u017C': 'z', 46384 '\u017E': 'z', 46385 '\u1E93': 'z', 46386 '\u1E95': 'z', 46387 '\u01B6': 'z', 46388 '\u0225': 'z', 46389 '\u0240': 'z', 46390 '\u2C6C': 'z', 46391 '\uA763': 'z', 46392 '\u0386': '\u0391', 46393 '\u0388': '\u0395', 46394 '\u0389': '\u0397', 46395 '\u038A': '\u0399', 46396 '\u03AA': '\u0399', 46397 '\u038C': '\u039F', 46398 '\u038E': '\u03A5', 46399 '\u03AB': '\u03A5', 46400 '\u038F': '\u03A9', 46401 '\u03AC': '\u03B1', 46402 '\u03AD': '\u03B5', 46403 '\u03AE': '\u03B7', 46404 '\u03AF': '\u03B9', 46405 '\u03CA': '\u03B9', 46406 '\u0390': '\u03B9', 46407 '\u03CC': '\u03BF', 46408 '\u03CD': '\u03C5', 46409 '\u03CB': '\u03C5', 46410 '\u03B0': '\u03C5', 46411 '\u03C9': '\u03C9', 46412 '\u03C2': '\u03C3' 46413 }; 46414 46415 return diacritics; 46416}); 46417 46418S2.define('select2/data/base',[ 46419 '../utils' 46420], function (Utils) { 46421 function BaseAdapter ($element, options) { 46422 BaseAdapter.__super__.constructor.call(this); 46423 } 46424 46425 Utils.Extend(BaseAdapter, Utils.Observable); 46426 46427 BaseAdapter.prototype.current = function (callback) { 46428 throw new Error('The `current` method must be defined in child classes.'); 46429 }; 46430 46431 BaseAdapter.prototype.query = function (params, callback) { 46432 throw new Error('The `query` method must be defined in child classes.'); 46433 }; 46434 46435 BaseAdapter.prototype.bind = function (container, $container) { 46436 // Can be implemented in subclasses 46437 }; 46438 46439 BaseAdapter.prototype.destroy = function () { 46440 // Can be implemented in subclasses 46441 }; 46442 46443 BaseAdapter.prototype.generateResultId = function (container, data) { 46444 var id = container.id + '-result-'; 46445 46446 id += Utils.generateChars(4); 46447 46448 if (data.id != null) { 46449 id += '-' + data.id.toString(); 46450 } else { 46451 id += '-' + Utils.generateChars(4); 46452 } 46453 return id; 46454 }; 46455 46456 return BaseAdapter; 46457}); 46458 46459S2.define('select2/data/select',[ 46460 './base', 46461 '../utils', 46462 'jquery' 46463], function (BaseAdapter, Utils, $) { 46464 function SelectAdapter ($element, options) { 46465 this.$element = $element; 46466 this.options = options; 46467 46468 SelectAdapter.__super__.constructor.call(this); 46469 } 46470 46471 Utils.Extend(SelectAdapter, BaseAdapter); 46472 46473 SelectAdapter.prototype.current = function (callback) { 46474 var data = []; 46475 var self = this; 46476 46477 this.$element.find(':selected').each(function () { 46478 var $option = $(this); 46479 46480 var option = self.item($option); 46481 46482 data.push(option); 46483 });
vendor: 81,933 bytes, lines 46484-49664
46484 46485 callback(data); 46486 }; 46487 46488 SelectAdapter.prototype.select = function (data) { 46489 var self = this; 46490 46491 data.selected = true; 46492 46493 // If data.element is a DOM node, use it instead 46494 if ($(data.element).is('option')) { 46495 data.element.selected = true; 46496 46497 this.$element.trigger('change'); 46498 46499 return; 46500 } 46501 46502 if (this.$element.prop('multiple')) { 46503 this.current(function (currentData) { 46504 var val = []; 46505 46506 data = [data]; 46507 data.push.apply(data, currentData); 46508 46509 for (var d = 0; d < data.length; d++) { 46510 var id = data[d].id; 46511 46512 if ($.inArray(id, val) === -1) { 46513 val.push(id); 46514 } 46515 } 46516 46517 self.$element.val(val); 46518 self.$element.trigger('change'); 46519 }); 46520 } else { 46521 var val = data.id; 46522 46523 this.$element.val(val); 46524 this.$element.trigger('change'); 46525 } 46526 }; 46527 46528 SelectAdapter.prototype.unselect = function (data) { 46529 var self = this; 46530 46531 if (!this.$element.prop('multiple')) { 46532 return; 46533 } 46534 46535 data.selected = false; 46536 46537 if ($(data.element).is('option')) { 46538 data.element.selected = false; 46539 46540 this.$element.trigger('change'); 46541 46542 return; 46543 } 46544 46545 this.current(function (currentData) { 46546 var val = []; 46547 46548 for (var d = 0; d < currentData.length; d++) { 46549 var id = currentData[d].id; 46550 46551 if (id !== data.id && $.inArray(id, val) === -1) { 46552 val.push(id); 46553 } 46554 } 46555 46556 self.$element.val(val); 46557 46558 self.$element.trigger('change'); 46559 }); 46560 }; 46561 46562 SelectAdapter.prototype.bind = function (container, $container) { 46563 var self = this; 46564 46565 this.container = container; 46566 46567 container.on('select', function (params) { 46568 self.select(params.data); 46569 }); 46570 46571 container.on('unselect', function (params) { 46572 self.unselect(params.data); 46573 }); 46574 }; 46575 46576 SelectAdapter.prototype.destroy = function () { 46577 // Remove anything added to child elements 46578 this.$element.find('*').each(function () { 46579 // Remove any custom data set by Select2 46580 $.removeData(this, 'data'); 46581 }); 46582 }; 46583 46584 SelectAdapter.prototype.query = function (params, callback) { 46585 var data = []; 46586 var self = this; 46587 46588 var $options = this.$element.children(); 46589 46590 $options.each(function () { 46591 var $option = $(this); 46592 46593 if (!$option.is('option') && !$option.is('optgroup')) { 46594 return; 46595 } 46596 46597 var option = self.item($option); 46598 46599 var matches = self.matches(params, option); 46600 46601 if (matches !== null) { 46602 data.push(matches); 46603 } 46604 }); 46605 46606 callback({ 46607 results: data 46608 }); 46609 }; 46610 46611 SelectAdapter.prototype.addOptions = function ($options) { 46612 Utils.appendMany(this.$element, $options); 46613 }; 46614 46615 SelectAdapter.prototype.option = function (data) { 46616 var option; 46617 46618 if (data.children) { 46619 option = document.createElement('optgroup'); 46620 option.label = data.text; 46621 } else { 46622 option = document.createElement('option'); 46623 46624 if (option.textContent !== undefined) { 46625 option.textContent = data.text; 46626 } else { 46627 option.innerText = data.text; 46628 } 46629 } 46630 46631 if (data.id) { 46632 option.value = data.id; 46633 } 46634 46635 if (data.disabled) { 46636 option.disabled = true; 46637 } 46638 46639 if (data.selected) { 46640 option.selected = true; 46641 } 46642 46643 if (data.title) { 46644 option.title = data.title; 46645 } 46646 46647 var $option = $(option); 46648 46649 var normalizedData = this._normalizeItem(data); 46650 normalizedData.element = option; 46651 46652 // Override the option's data with the combined data 46653 $.data(option, 'data', normalizedData); 46654 46655 return $option; 46656 }; 46657 46658 SelectAdapter.prototype.item = function ($option) { 46659 var data = {}; 46660 46661 data = $.data($option[0], 'data'); 46662 46663 if (data != null) { 46664 return data; 46665 } 46666 46667 if ($option.is('option')) { 46668 data = { 46669 id: $option.val(), 46670 text: $option.text(), 46671 disabled: $option.prop('disabled'), 46672 selected: $option.prop('selected'), 46673 title: $option.prop('title') 46674 }; 46675 } else if ($option.is('optgroup')) { 46676 data = { 46677 text: $option.prop('label'), 46678 children: [], 46679 title: $option.prop('title') 46680 }; 46681 46682 var $children = $option.children('option'); 46683 var children = []; 46684 46685 for (var c = 0; c < $children.length; c++) { 46686 var $child = $($children[c]); 46687 46688 var child = this.item($child); 46689 46690 children.push(child); 46691 } 46692 46693 data.children = children; 46694 } 46695 46696 data = this._normalizeItem(data); 46697 data.element = $option[0]; 46698 46699 $.data($option[0], 'data', data); 46700 46701 return data; 46702 }; 46703 46704 SelectAdapter.prototype._normalizeItem = function (item) { 46705 if (!$.isPlainObject(item)) { 46706 item = { 46707 id: item, 46708 text: item 46709 }; 46710 } 46711 46712 item = $.extend({}, { 46713 text: '' 46714 }, item); 46715 46716 var defaults = { 46717 selected: false, 46718 disabled: false 46719 }; 46720 46721 if (item.id != null) { 46722 item.id = item.id.toString(); 46723 } 46724 46725 if (item.text != null) { 46726 item.text = item.text.toString(); 46727 } 46728 46729 if (item._resultId == null && item.id && this.container != null) { 46730 item._resultId = this.generateResultId(this.container, item); 46731 } 46732 46733 return $.extend({}, defaults, item); 46734 }; 46735 46736 SelectAdapter.prototype.matches = function (params, data) { 46737 var matcher = this.options.get('matcher'); 46738 46739 return matcher(params, data); 46740 }; 46741 46742 return SelectAdapter; 46743}); 46744 46745S2.define('select2/data/array',[ 46746 './select', 46747 '../utils', 46748 'jquery' 46749], function (SelectAdapter, Utils, $) { 46750 function ArrayAdapter ($element, options) { 46751 var data = options.get('data') || []; 46752 46753 ArrayAdapter.__super__.constructor.call(this, $element, options); 46754 46755 this.addOptions(this.convertToOptions(data)); 46756 } 46757 46758 Utils.Extend(ArrayAdapter, SelectAdapter); 46759 46760 ArrayAdapter.prototype.select = function (data) { 46761 var $option = this.$element.find('option').filter(function (i, elm) { 46762 return elm.value == data.id.toString(); 46763 }); 46764 46765 if ($option.length === 0) { 46766 $option = this.option(data); 46767 46768 this.addOptions($option); 46769 } 46770 46771 ArrayAdapter.__super__.select.call(this, data); 46772 }; 46773 46774 ArrayAdapter.prototype.convertToOptions = function (data) { 46775 var self = this; 46776 46777 var $existing = this.$element.find('option'); 46778 var existingIds = $existing.map(function () { 46779 return self.item($(this)).id; 46780 }).get(); 46781 46782 var $options = []; 46783 46784 // Filter out all items except for the one passed in the argument 46785 function onlyItem (item) { 46786 return function () { 46787 return $(this).val() == item.id; 46788 }; 46789 } 46790 46791 for (var d = 0; d < data.length; d++) { 46792 var item = this._normalizeItem(data[d]); 46793 46794 // Skip items which were pre-loaded, only merge the data 46795 if ($.inArray(item.id, existingIds) >= 0) { 46796 var $existingOption = $existing.filter(onlyItem(item)); 46797 46798 var existingData = this.item($existingOption); 46799 var newData = $.extend(true, {}, item, existingData); 46800 46801 var $newOption = this.option(newData); 46802 46803 $existingOption.replaceWith($newOption); 46804 46805 continue; 46806 } 46807 46808 var $option = this.option(item); 46809 46810 if (item.children) { 46811 var $children = this.convertToOptions(item.children); 46812 46813 Utils.appendMany($option, $children); 46814 } 46815 46816 $options.push($option); 46817 } 46818 46819 return $options; 46820 }; 46821 46822 return ArrayAdapter; 46823}); 46824 46825S2.define('select2/data/ajax',[ 46826 './array', 46827 '../utils', 46828 'jquery' 46829], function (ArrayAdapter, Utils, $) { 46830 function AjaxAdapter ($element, options) { 46831 this.ajaxOptions = this._applyDefaults(options.get('ajax')); 46832 46833 if (this.ajaxOptions.processResults != null) { 46834 this.processResults = this.ajaxOptions.processResults; 46835 } 46836 46837 AjaxAdapter.__super__.constructor.call(this, $element, options); 46838 } 46839 46840 Utils.Extend(AjaxAdapter, ArrayAdapter); 46841 46842 AjaxAdapter.prototype._applyDefaults = function (options) { 46843 var defaults = { 46844 data: function (params) { 46845 return $.extend({}, params, { 46846 q: params.term 46847 }); 46848 }, 46849 transport: function (params, success, failure) { 46850 var $request = $.ajax(params); 46851 46852 $request.then(success); 46853 $request.fail(failure); 46854 46855 return $request; 46856 } 46857 }; 46858 46859 return $.extend({}, defaults, options, true); 46860 }; 46861 46862 AjaxAdapter.prototype.processResults = function (results) { 46863 return results; 46864 }; 46865 46866 AjaxAdapter.prototype.query = function (params, callback) { 46867 var matches = []; 46868 var self = this; 46869 46870 if (this._request != null) { 46871 // JSONP requests cannot always be aborted 46872 if ($.isFunction(this._request.abort)) { 46873 this._request.abort(); 46874 } 46875 46876 this._request = null; 46877 } 46878 46879 var options = $.extend({ 46880 type: 'GET' 46881 }, this.ajaxOptions); 46882 46883 if (typeof options.url === 'function') { 46884 options.url = options.url.call(this.$element, params); 46885 } 46886 46887 if (typeof options.data === 'function') { 46888 options.data = options.data.call(this.$element, params); 46889 } 46890 46891 function request () { 46892 var $request = options.transport(options, function (data) { 46893 var results = self.processResults(data, params); 46894 46895 if (self.options.get('debug') && window.console && console.error) { 46896 // Check to make sure that the response included a `results` key. 46897 if (!results || !results.results || !$.isArray(results.results)) { 46898 console.error( 46899 'Select2: The AJAX results did not return an array in the ' + 46900 '`results` key of the response.' 46901 ); 46902 } 46903 } 46904 46905 callback(results); 46906 }, function () { 46907 // Attempt to detect if a request was aborted 46908 // Only works if the transport exposes a status property 46909 if ($request.status && $request.status === '0') { 46910 return; 46911 } 46912 46913 self.trigger('results:message', { 46914 message: 'errorLoading' 46915 }); 46916 }); 46917 46918 self._request = $request; 46919 } 46920 46921 if (this.ajaxOptions.delay && params.term != null) { 46922 if (this._queryTimeout) { 46923 window.clearTimeout(this._queryTimeout); 46924 } 46925 46926 this._queryTimeout = window.setTimeout(request, this.ajaxOptions.delay); 46927 } else { 46928 request(); 46929 } 46930 }; 46931 46932 return AjaxAdapter; 46933}); 46934 46935S2.define('select2/data/tags',[ 46936 'jquery' 46937], function ($) { 46938 function Tags (decorated, $element, options) { 46939 var tags = options.get('tags'); 46940 46941 var createTag = options.get('createTag'); 46942 46943 if (createTag !== undefined) { 46944 this.createTag = createTag; 46945 } 46946 46947 var insertTag = options.get('insertTag'); 46948 46949 if (insertTag !== undefined) { 46950 this.insertTag = insertTag; 46951 } 46952 46953 decorated.call(this, $element, options); 46954 46955 if ($.isArray(tags)) { 46956 for (var t = 0; t < tags.length; t++) { 46957 var tag = tags[t]; 46958 var item = this._normalizeItem(tag); 46959 46960 var $option = this.option(item); 46961 46962 this.$element.append($option); 46963 } 46964 } 46965 } 46966 46967 Tags.prototype.query = function (decorated, params, callback) { 46968 var self = this; 46969 46970 this._removeOldTags(); 46971 46972 if (params.term == null || params.page != null) { 46973 decorated.call(this, params, callback); 46974 return; 46975 } 46976 46977 function wrapper (obj, child) { 46978 var data = obj.results; 46979 46980 for (var i = 0; i < data.length; i++) { 46981 var option = data[i]; 46982 46983 var checkChildren = ( 46984 option.children != null && 46985 !wrapper({ 46986 results: option.children 46987 }, true) 46988 ); 46989 46990 var checkText = option.text === params.term; 46991 46992 if (checkText || checkChildren) { 46993 if (child) { 46994 return false; 46995 } 46996 46997 obj.data = data; 46998 callback(obj); 46999 47000 return; 47001 } 47002 } 47003 47004 if (child) { 47005 return true; 47006 } 47007 47008 var tag = self.createTag(params); 47009 47010 if (tag != null) { 47011 var $option = self.option(tag); 47012 $option.attr('data-select2-tag', true); 47013 47014 self.addOptions([$option]); 47015 47016 self.insertTag(data, tag); 47017 } 47018 47019 obj.results = data; 47020 47021 callback(obj); 47022 } 47023 47024 decorated.call(this, params, wrapper); 47025 }; 47026 47027 Tags.prototype.createTag = function (decorated, params) { 47028 var term = $.trim(params.term); 47029 47030 if (term === '') { 47031 return null; 47032 } 47033 47034 return { 47035 id: term, 47036 text: term 47037 }; 47038 }; 47039 47040 Tags.prototype.insertTag = function (_, data, tag) { 47041 data.unshift(tag); 47042 }; 47043 47044 Tags.prototype._removeOldTags = function (_) { 47045 var tag = this._lastTag; 47046 47047 var $options = this.$element.find('option[data-select2-tag]'); 47048 47049 $options.each(function () { 47050 if (this.selected) { 47051 return; 47052 } 47053 47054 $(this).remove(); 47055 }); 47056 }; 47057 47058 return Tags; 47059}); 47060 47061S2.define('select2/data/tokenizer',[ 47062 'jquery' 47063], function ($) { 47064 function Tokenizer (decorated, $element, options) { 47065 var tokenizer = options.get('tokenizer'); 47066 47067 if (tokenizer !== undefined) { 47068 this.tokenizer = tokenizer; 47069 } 47070 47071 decorated.call(this, $element, options); 47072 } 47073 47074 Tokenizer.prototype.bind = function (decorated, container, $container) { 47075 decorated.call(this, container, $container); 47076 47077 this.$search = container.dropdown.$search || container.selection.$search || 47078 $container.find('.select2-search__field'); 47079 }; 47080 47081 Tokenizer.prototype.query = function (decorated, params, callback) { 47082 var self = this; 47083 47084 function createAndSelect (data) { 47085 // Normalize the data object so we can use it for checks 47086 var item = self._normalizeItem(data); 47087 47088 // Check if the data object already exists as a tag 47089 // Select it if it doesn't 47090 var $existingOptions = self.$element.find('option').filter(function () { 47091 return $(this).val() === item.id; 47092 }); 47093 47094 // If an existing option wasn't found for it, create the option 47095 if (!$existingOptions.length) { 47096 var $option = self.option(item); 47097 $option.attr('data-select2-tag', true); 47098 47099 self._removeOldTags(); 47100 self.addOptions([$option]); 47101 } 47102 47103 // Select the item, now that we know there is an option for it 47104 select(item); 47105 } 47106 47107 function select (data) { 47108 self.trigger('select', { 47109 data: data 47110 }); 47111 } 47112 47113 params.term = params.term || ''; 47114 47115 var tokenData = this.tokenizer(params, this.options, createAndSelect); 47116 47117 if (tokenData.term !== params.term) { 47118 // Replace the search term if we have the search box 47119 if (this.$search.length) { 47120 this.$search.val(tokenData.term); 47121 this.$search.focus(); 47122 } 47123 47124 params.term = tokenData.term; 47125 } 47126 47127 decorated.call(this, params, callback); 47128 }; 47129 47130 Tokenizer.prototype.tokenizer = function (_, params, options, callback) { 47131 var separators = options.get('tokenSeparators') || []; 47132 var term = params.term; 47133 var i = 0; 47134 47135 var createTag = this.createTag || function (params) { 47136 return { 47137 id: params.term, 47138 text: params.term 47139 }; 47140 }; 47141 47142 while (i < term.length) { 47143 var termChar = term[i]; 47144 47145 if ($.inArray(termChar, separators) === -1) { 47146 i++; 47147 47148 continue; 47149 } 47150 47151 var part = term.substr(0, i); 47152 var partParams = $.extend({}, params, { 47153 term: part 47154 }); 47155 47156 var data = createTag(partParams); 47157 47158 if (data == null) { 47159 i++; 47160 continue; 47161 } 47162 47163 callback(data); 47164 47165 // Reset the term to not include the tokenized portion 47166 term = term.substr(i + 1) || ''; 47167 i = 0; 47168 } 47169 47170 return { 47171 term: term 47172 }; 47173 }; 47174 47175 return Tokenizer; 47176}); 47177 47178S2.define('select2/data/minimumInputLength',[ 47179 47180], function () { 47181 function MinimumInputLength (decorated, $e, options) { 47182 this.minimumInputLength = options.get('minimumInputLength'); 47183 47184 decorated.call(this, $e, options); 47185 } 47186 47187 MinimumInputLength.prototype.query = function (decorated, params, callback) { 47188 params.term = params.term || ''; 47189 47190 if (params.term.length < this.minimumInputLength) { 47191 this.trigger('results:message', { 47192 message: 'inputTooShort', 47193 args: { 47194 minimum: this.minimumInputLength, 47195 input: params.term, 47196 params: params 47197 } 47198 }); 47199 47200 return; 47201 } 47202 47203 decorated.call(this, params, callback); 47204 }; 47205 47206 return MinimumInputLength; 47207}); 47208 47209S2.define('select2/data/maximumInputLength',[ 47210 47211], function () { 47212 function MaximumInputLength (decorated, $e, options) { 47213 this.maximumInputLength = options.get('maximumInputLength'); 47214 47215 decorated.call(this, $e, options); 47216 } 47217 47218 MaximumInputLength.prototype.query = function (decorated, params, callback) { 47219 params.term = params.term || ''; 47220 47221 if (this.maximumInputLength > 0 && 47222 params.term.length > this.maximumInputLength) { 47223 this.trigger('results:message', { 47224 message: 'inputTooLong', 47225 args: { 47226 maximum: this.maximumInputLength, 47227 input: params.term, 47228 params: params 47229 } 47230 }); 47231 47232 return; 47233 } 47234 47235 decorated.call(this, params, callback); 47236 }; 47237 47238 return MaximumInputLength; 47239}); 47240 47241S2.define('select2/data/maximumSelectionLength',[ 47242 47243], function (){ 47244 function MaximumSelectionLength (decorated, $e, options) { 47245 this.maximumSelectionLength = options.get('maximumSelectionLength'); 47246 47247 decorated.call(this, $e, options); 47248 } 47249 47250 MaximumSelectionLength.prototype.query = 47251 function (decorated, params, callback) { 47252 var self = this; 47253 47254 this.current(function (currentData) { 47255 var count = currentData != null ? currentData.length : 0; 47256 if (self.maximumSelectionLength > 0 && 47257 count >= self.maximumSelectionLength) { 47258 self.trigger('results:message', { 47259 message: 'maximumSelected', 47260 args: { 47261 maximum: self.maximumSelectionLength 47262 } 47263 }); 47264 return; 47265 } 47266 decorated.call(self, params, callback); 47267 }); 47268 }; 47269 47270 return MaximumSelectionLength; 47271}); 47272 47273S2.define('select2/dropdown',[ 47274 'jquery', 47275 './utils' 47276], function ($, Utils) { 47277 function Dropdown ($element, options) { 47278 this.$element = $element; 47279 this.options = options; 47280 47281 Dropdown.__super__.constructor.call(this); 47282 } 47283 47284 Utils.Extend(Dropdown, Utils.Observable); 47285 47286 Dropdown.prototype.render = function () { 47287 var $dropdown = $( 47288 '<span class="select2-dropdown">' + 47289 '<span class="select2-results"></span>' + 47290 '</span>' 47291 ); 47292 47293 $dropdown.attr('dir', this.options.get('dir')); 47294 47295 this.$dropdown = $dropdown; 47296 47297 return $dropdown; 47298 }; 47299 47300 Dropdown.prototype.bind = function () { 47301 // Should be implemented in subclasses 47302 }; 47303 47304 Dropdown.prototype.position = function ($dropdown, $container) { 47305 // Should be implmented in subclasses 47306 }; 47307 47308 Dropdown.prototype.destroy = function () { 47309 // Remove the dropdown from the DOM 47310 this.$dropdown.remove(); 47311 }; 47312 47313 return Dropdown; 47314}); 47315 47316S2.define('select2/dropdown/search',[ 47317 'jquery', 47318 '../utils' 47319], function ($, Utils) { 47320 function Search () { } 47321 47322 Search.prototype.render = function (decorated) { 47323 var $rendered = decorated.call(this); 47324 47325 var $search = $( 47326 '<span class="select2-search select2-search--dropdown">' + 47327 '<input class="select2-search__field" type="search" tabindex="-1"' + 47328 ' autocomplete="off" autocorrect="off" autocapitalize="off"' + 47329 ' spellcheck="false" role="textbox" />' + 47330 '</span>' 47331 ); 47332 47333 this.$searchContainer = $search; 47334 this.$search = $search.find('input'); 47335 47336 $rendered.prepend($search); 47337 47338 return $rendered; 47339 }; 47340 47341 Search.prototype.bind = function (decorated, container, $container) { 47342 var self = this; 47343 47344 decorated.call(this, container, $container); 47345 47346 this.$search.on('keydown', function (evt) { 47347 self.trigger('keypress', evt); 47348 47349 self._keyUpPrevented = evt.isDefaultPrevented(); 47350 }); 47351 47352 // Workaround for browsers which do not support the `input` event 47353 // This will prevent double-triggering of events for browsers which support 47354 // both the `keyup` and `input` events. 47355 this.$search.on('input', function (evt) { 47356 // Unbind the duplicated `keyup` event 47357 $(this).off('keyup'); 47358 }); 47359 47360 this.$search.on('keyup input', function (evt) { 47361 self.handleSearch(evt); 47362 }); 47363 47364 container.on('open', function () { 47365 self.$search.attr('tabindex', 0); 47366 47367 self.$search.focus(); 47368 47369 window.setTimeout(function () { 47370 self.$search.focus(); 47371 }, 0); 47372 }); 47373 47374 container.on('close', function () { 47375 self.$search.attr('tabindex', -1); 47376 47377 self.$search.val(''); 47378 }); 47379 47380 container.on('focus', function () { 47381 if (container.isOpen()) { 47382 self.$search.focus(); 47383 } 47384 }); 47385 47386 container.on('results:all', function (params) { 47387 if (params.query.term == null || params.query.term === '') { 47388 var showSearch = self.showSearch(params); 47389 47390 if (showSearch) { 47391 self.$searchContainer.removeClass('select2-search--hide'); 47392 } else { 47393 self.$searchContainer.addClass('select2-search--hide'); 47394 } 47395 } 47396 }); 47397 }; 47398 47399 Search.prototype.handleSearch = function (evt) { 47400 if (!this._keyUpPrevented) { 47401 var input = this.$search.val(); 47402 47403 this.trigger('query', { 47404 term: input 47405 }); 47406 } 47407 47408 this._keyUpPrevented = false; 47409 }; 47410 47411 Search.prototype.showSearch = function (_, params) { 47412 return true; 47413 }; 47414 47415 return Search; 47416}); 47417 47418S2.define('select2/dropdown/hidePlaceholder',[ 47419 47420], function () { 47421 function HidePlaceholder (decorated, $element, options, dataAdapter) { 47422 this.placeholder = this.normalizePlaceholder(options.get('placeholder')); 47423 47424 decorated.call(this, $element, options, dataAdapter); 47425 } 47426 47427 HidePlaceholder.prototype.append = function (decorated, data) { 47428 data.results = this.removePlaceholder(data.results); 47429 47430 decorated.call(this, data); 47431 }; 47432 47433 HidePlaceholder.prototype.normalizePlaceholder = function (_, placeholder) { 47434 if (typeof placeholder === 'string') { 47435 placeholder = { 47436 id: '', 47437 text: placeholder 47438 }; 47439 } 47440 47441 return placeholder; 47442 }; 47443 47444 HidePlaceholder.prototype.removePlaceholder = function (_, data) { 47445 var modifiedData = data.slice(0); 47446 47447 for (var d = data.length - 1; d >= 0; d--) { 47448 var item = data[d]; 47449 47450 if (this.placeholder.id === item.id) { 47451 modifiedData.splice(d, 1); 47452 } 47453 } 47454 47455 return modifiedData; 47456 }; 47457 47458 return HidePlaceholder; 47459}); 47460 47461S2.define('select2/dropdown/infiniteScroll',[ 47462 'jquery' 47463], function ($) { 47464 function InfiniteScroll (decorated, $element, options, dataAdapter) { 47465 this.lastParams = {}; 47466 47467 decorated.call(this, $element, options, dataAdapter); 47468 47469 this.$loadingMore = this.createLoadingMore(); 47470 this.loading = false; 47471 } 47472 47473 InfiniteScroll.prototype.append = function (decorated, data) { 47474 this.$loadingMore.remove(); 47475 this.loading = false; 47476 47477 decorated.call(this, data); 47478 47479 if (this.showLoadingMore(data)) { 47480 this.$results.append(this.$loadingMore); 47481 } 47482 }; 47483 47484 InfiniteScroll.prototype.bind = function (decorated, container, $container) { 47485 var self = this; 47486 47487 decorated.call(this, container, $container); 47488 47489 container.on('query', function (params) { 47490 self.lastParams = params; 47491 self.loading = true; 47492 }); 47493 47494 container.on('query:append', function (params) { 47495 self.lastParams = params; 47496 self.loading = true; 47497 }); 47498 47499 this.$results.on('scroll', function () { 47500 var isLoadMoreVisible = $.contains( 47501 document.documentElement, 47502 self.$loadingMore[0] 47503 ); 47504 47505 if (self.loading || !isLoadMoreVisible) { 47506 return; 47507 } 47508 47509 var currentOffset = self.$results.offset().top + 47510 self.$results.outerHeight(false); 47511 var loadingMoreOffset = self.$loadingMore.offset().top + 47512 self.$loadingMore.outerHeight(false); 47513 47514 if (currentOffset + 50 >= loadingMoreOffset) { 47515 self.loadMore(); 47516 } 47517 }); 47518 }; 47519 47520 InfiniteScroll.prototype.loadMore = function () { 47521 this.loading = true; 47522 47523 var params = $.extend({}, {page: 1}, this.lastParams); 47524 47525 params.page++; 47526 47527 this.trigger('query:append', params); 47528 }; 47529 47530 InfiniteScroll.prototype.showLoadingMore = function (_, data) { 47531 return data.pagination && data.pagination.more; 47532 }; 47533 47534 InfiniteScroll.prototype.createLoadingMore = function () { 47535 var $option = $( 47536 '<li ' + 47537 'class="select2-results__option select2-results__option--load-more"' + 47538 'role="treeitem" aria-disabled="true"></li>' 47539 ); 47540 47541 var message = this.options.get('translations').get('loadingMore'); 47542 47543 $option.html(message(this.lastParams)); 47544 47545 return $option; 47546 }; 47547 47548 return InfiniteScroll; 47549}); 47550 47551S2.define('select2/dropdown/attachBody',[ 47552 'jquery', 47553 '../utils' 47554], function ($, Utils) { 47555 function AttachBody (decorated, $element, options) { 47556 this.$dropdownParent = options.get('dropdownParent') || $(document.body); 47557 47558 decorated.call(this, $element, options); 47559 } 47560 47561 AttachBody.prototype.bind = function (decorated, container, $container) { 47562 var self = this; 47563 47564 var setupResultsEvents = false; 47565 47566 decorated.call(this, container, $container); 47567 47568 container.on('open', function () { 47569 self._showDropdown(); 47570 self._attachPositioningHandler(container); 47571 47572 if (!setupResultsEvents) { 47573 setupResultsEvents = true; 47574 47575 container.on('results:all', function () { 47576 self._positionDropdown(); 47577 self._resizeDropdown(); 47578 }); 47579 47580 container.on('results:append', function () { 47581 self._positionDropdown(); 47582 self._resizeDropdown(); 47583 }); 47584 } 47585 }); 47586 47587 container.on('close', function () { 47588 self._hideDropdown(); 47589 self._detachPositioningHandler(container); 47590 }); 47591 47592 this.$dropdownContainer.on('mousedown', function (evt) { 47593 evt.stopPropagation(); 47594 }); 47595 }; 47596 47597 AttachBody.prototype.destroy = function (decorated) { 47598 decorated.call(this); 47599 47600 this.$dropdownContainer.remove(); 47601 }; 47602 47603 AttachBody.prototype.position = function (decorated, $dropdown, $container) { 47604 // Clone all of the container classes 47605 $dropdown.attr('class', $container.attr('class')); 47606 47607 $dropdown.removeClass('select2'); 47608 $dropdown.addClass('select2-container--open'); 47609 47610 $dropdown.css({ 47611 position: 'absolute', 47612 top: -999999 47613 }); 47614 47615 this.$container = $container; 47616 }; 47617 47618 AttachBody.prototype.render = function (decorated) { 47619 var $container = $('<span></span>'); 47620 47621 var $dropdown = decorated.call(this); 47622 $container.append($dropdown); 47623 47624 this.$dropdownContainer = $container; 47625 47626 return $container; 47627 }; 47628 47629 AttachBody.prototype._hideDropdown = function (decorated) { 47630 this.$dropdownContainer.detach(); 47631 }; 47632 47633 AttachBody.prototype._attachPositioningHandler = 47634 function (decorated, container) { 47635 var self = this; 47636 47637 var scrollEvent = 'scroll.select2.' + container.id; 47638 var resizeEvent = 'resize.select2.' + container.id; 47639 var orientationEvent = 'orientationchange.select2.' + container.id; 47640 47641 var $watchers = this.$container.parents().filter(Utils.hasScroll); 47642 $watchers.each(function () { 47643 $(this).data('select2-scroll-position', { 47644 x: $(this).scrollLeft(), 47645 y: $(this).scrollTop() 47646 }); 47647 }); 47648 47649 $watchers.on(scrollEvent, function (ev) { 47650 var position = $(this).data('select2-scroll-position'); 47651 $(this).scrollTop(position.y); 47652 }); 47653 47654 $(window).on(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent, 47655 function (e) { 47656 self._positionDropdown(); 47657 self._resizeDropdown(); 47658 }); 47659 }; 47660 47661 AttachBody.prototype._detachPositioningHandler = 47662 function (decorated, container) { 47663 var scrollEvent = 'scroll.select2.' + container.id; 47664 var resizeEvent = 'resize.select2.' + container.id; 47665 var orientationEvent = 'orientationchange.select2.' + container.id; 47666 47667 var $watchers = this.$container.parents().filter(Utils.hasScroll); 47668 $watchers.off(scrollEvent); 47669 47670 $(window).off(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent); 47671 }; 47672 47673 AttachBody.prototype._positionDropdown = function () { 47674 var $window = $(window); 47675 47676 var isCurrentlyAbove = this.$dropdown.hasClass('select2-dropdown--above'); 47677 var isCurrentlyBelow = this.$dropdown.hasClass('select2-dropdown--below'); 47678 47679 var newDirection = null; 47680 47681 var offset = this.$container.offset(); 47682 47683 offset.bottom = offset.top + this.$container.outerHeight(false); 47684 47685 var container = { 47686 height: this.$container.outerHeight(false) 47687 }; 47688 47689 container.top = offset.top; 47690 container.bottom = offset.top + container.height; 47691 47692 var dropdown = { 47693 height: this.$dropdown.outerHeight(false) 47694 }; 47695 47696 var viewport = { 47697 top: $window.scrollTop(), 47698 bottom: $window.scrollTop() + $window.height() 47699 }; 47700 47701 var enoughRoomAbove = viewport.top < (offset.top - dropdown.height); 47702 var enoughRoomBelow = viewport.bottom > (offset.bottom + dropdown.height); 47703 47704 var css = { 47705 left: offset.left, 47706 top: container.bottom 47707 }; 47708 47709 // Determine what the parent element is to use for calciulating the offset 47710 var $offsetParent = this.$dropdownParent; 47711 47712 // For statically positoned elements, we need to get the element 47713 // that is determining the offset 47714 if ($offsetParent.css('position') === 'static') { 47715 $offsetParent = $offsetParent.offsetParent(); 47716 } 47717 47718 var parentOffset = $offsetParent.offset(); 47719 47720 css.top -= parentOffset.top; 47721 css.left -= parentOffset.left; 47722 47723 if (!isCurrentlyAbove && !isCurrentlyBelow) { 47724 newDirection = 'below'; 47725 } 47726 47727 if (!enoughRoomBelow && enoughRoomAbove && !isCurrentlyAbove) { 47728 newDirection = 'above'; 47729 } else if (!enoughRoomAbove && enoughRoomBelow && isCurrentlyAbove) { 47730 newDirection = 'below'; 47731 } 47732 47733 if (newDirection == 'above' || 47734 (isCurrentlyAbove && newDirection !== 'below')) { 47735 css.top = container.top - parentOffset.top - dropdown.height; 47736 } 47737 47738 if (newDirection != null) { 47739 this.$dropdown 47740 .removeClass('select2-dropdown--below select2-dropdown--above') 47741 .addClass('select2-dropdown--' + newDirection); 47742 this.$container 47743 .removeClass('select2-container--below select2-container--above') 47744 .addClass('select2-container--' + newDirection); 47745 } 47746 47747 this.$dropdownContainer.css(css); 47748 }; 47749 47750 AttachBody.prototype._resizeDropdown = function () { 47751 var css = { 47752 width: this.$container.outerWidth(false) + 'px' 47753 }; 47754 47755 if (this.options.get('dropdownAutoWidth')) { 47756 css.minWidth = css.width; 47757 css.position = 'relative'; 47758 css.width = 'auto'; 47759 } 47760 47761 this.$dropdown.css(css); 47762 }; 47763 47764 AttachBody.prototype._showDropdown = function (decorated) { 47765 this.$dropdownContainer.appendTo(this.$dropdownParent); 47766 47767 this._positionDropdown(); 47768 this._resizeDropdown(); 47769 }; 47770 47771 return AttachBody; 47772}); 47773 47774S2.define('select2/dropdown/minimumResultsForSearch',[ 47775 47776], function () { 47777 function countResults (data) { 47778 var count = 0; 47779 47780 for (var d = 0; d < data.length; d++) { 47781 var item = data[d]; 47782 47783 if (item.children) { 47784 count += countResults(item.children); 47785 } else { 47786 count++; 47787 } 47788 } 47789 47790 return count; 47791 } 47792 47793 function MinimumResultsForSearch (decorated, $element, options, dataAdapter) { 47794 this.minimumResultsForSearch = options.get('minimumResultsForSearch'); 47795 47796 if (this.minimumResultsForSearch < 0) { 47797 this.minimumResultsForSearch = Infinity; 47798 } 47799 47800 decorated.call(this, $element, options, dataAdapter); 47801 } 47802 47803 MinimumResultsForSearch.prototype.showSearch = function (decorated, params) { 47804 if (countResults(params.data.results) < this.minimumResultsForSearch) { 47805 return false; 47806 } 47807 47808 return decorated.call(this, params); 47809 }; 47810 47811 return MinimumResultsForSearch; 47812}); 47813 47814S2.define('select2/dropdown/selectOnClose',[ 47815 47816], function () { 47817 function SelectOnClose () { } 47818 47819 SelectOnClose.prototype.bind = function (decorated, container, $container) { 47820 var self = this; 47821 47822 decorated.call(this, container, $container); 47823 47824 container.on('close', function (params) { 47825 self._handleSelectOnClose(params); 47826 }); 47827 }; 47828 47829 SelectOnClose.prototype._handleSelectOnClose = function (_, params) { 47830 if (params && params.originalSelect2Event != null) { 47831 var event = params.originalSelect2Event; 47832 47833 // Don't select an item if the close event was triggered from a select or 47834 // unselect event 47835 if (event._type === 'select' || event._type === 'unselect') { 47836 return; 47837 } 47838 } 47839 47840 var $highlightedResults = this.getHighlightedResults(); 47841 47842 // Only select highlighted results 47843 if ($highlightedResults.length < 1) { 47844 return; 47845 } 47846 47847 var data = $highlightedResults.data('data'); 47848 47849 // Don't re-select already selected resulte 47850 if ( 47851 (data.element != null && data.element.selected) || 47852 (data.element == null && data.selected) 47853 ) { 47854 return; 47855 } 47856 47857 this.trigger('select', { 47858 data: data 47859 }); 47860 }; 47861 47862 return SelectOnClose; 47863}); 47864 47865S2.define('select2/dropdown/closeOnSelect',[ 47866 47867], function () { 47868 function CloseOnSelect () { } 47869 47870 CloseOnSelect.prototype.bind = function (decorated, container, $container) { 47871 var self = this; 47872 47873 decorated.call(this, container, $container); 47874 47875 container.on('select', function (evt) { 47876 self._selectTriggered(evt); 47877 }); 47878 47879 container.on('unselect', function (evt) { 47880 self._selectTriggered(evt); 47881 }); 47882 }; 47883 47884 CloseOnSelect.prototype._selectTriggered = function (_, evt) { 47885 var originalEvent = evt.originalEvent; 47886 47887 // Don't close if the control key is being held 47888 if (originalEvent && originalEvent.ctrlKey) { 47889 return; 47890 } 47891 47892 this.trigger('close', { 47893 originalEvent: originalEvent, 47894 originalSelect2Event: evt 47895 }); 47896 }; 47897 47898 return CloseOnSelect; 47899}); 47900 47901S2.define('select2/i18n/en',[],function () { 47902 // English 47903 return { 47904 errorLoading: function () { 47905 return 'The results could not be loaded.'; 47906 }, 47907 inputTooLong: function (args) { 47908 var overChars = args.input.length - args.maximum; 47909 47910 var message = 'Please delete ' + overChars + ' character'; 47911 47912 if (overChars != 1) { 47913 message += 's'; 47914 } 47915 47916 return message; 47917 }, 47918 inputTooShort: function (args) { 47919 var remainingChars = args.minimum - args.input.length; 47920 47921 var message = 'Please enter ' + remainingChars + ' or more characters'; 47922 47923 return message; 47924 }, 47925 loadingMore: function () { 47926 return 'Loading more results…'; 47927 }, 47928 maximumSelected: function (args) { 47929 var message = 'You can only select ' + args.maximum + ' item'; 47930 47931 if (args.maximum != 1) { 47932 message += 's'; 47933 } 47934 47935 return message; 47936 }, 47937 noResults: function () { 47938 return 'No results found'; 47939 }, 47940 searching: function () { 47941 return 'Searching…'; 47942 } 47943 }; 47944}); 47945 47946S2.define('select2/defaults',[ 47947 'jquery', 47948 'require', 47949 47950 './results', 47951 47952 './selection/single', 47953 './selection/multiple', 47954 './selection/placeholder', 47955 './selection/allowClear', 47956 './selection/search', 47957 './selection/eventRelay', 47958 47959 './utils', 47960 './translation', 47961 './diacritics', 47962 47963 './data/select', 47964 './data/array', 47965 './data/ajax', 47966 './data/tags', 47967 './data/tokenizer', 47968 './data/minimumInputLength', 47969 './data/maximumInputLength', 47970 './data/maximumSelectionLength', 47971 47972 './dropdown', 47973 './dropdown/search', 47974 './dropdown/hidePlaceholder', 47975 './dropdown/infiniteScroll', 47976 './dropdown/attachBody', 47977 './dropdown/minimumResultsForSearch', 47978 './dropdown/selectOnClose', 47979 './dropdown/closeOnSelect', 47980 47981 './i18n/en' 47982], function ($, require, 47983 47984 ResultsList, 47985 47986 SingleSelection, MultipleSelection, Placeholder, AllowClear, 47987 SelectionSearch, EventRelay, 47988 47989 Utils, Translation, DIACRITICS, 47990 47991 SelectData, ArrayData, AjaxData, Tags, Tokenizer, 47992 MinimumInputLength, MaximumInputLength, MaximumSelectionLength, 47993 47994 Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll, 47995 AttachBody, MinimumResultsForSearch, SelectOnClose, CloseOnSelect, 47996 47997 EnglishTranslation) { 47998 function Defaults () { 47999 this.reset(); 48000 } 48001 48002 Defaults.prototype.apply = function (options) { 48003 options = $.extend(true, {}, this.defaults, options); 48004 48005 if (options.dataAdapter == null) { 48006 if (options.ajax != null) { 48007 options.dataAdapter = AjaxData; 48008 } else if (options.data != null) { 48009 options.dataAdapter = ArrayData; 48010 } else { 48011 options.dataAdapter = SelectData; 48012 } 48013 48014 if (options.minimumInputLength > 0) { 48015 options.dataAdapter = Utils.Decorate( 48016 options.dataAdapter, 48017 MinimumInputLength 48018 ); 48019 } 48020 48021 if (options.maximumInputLength > 0) { 48022 options.dataAdapter = Utils.Decorate( 48023 options.dataAdapter, 48024 MaximumInputLength 48025 ); 48026 } 48027 48028 if (options.maximumSelectionLength > 0) { 48029 options.dataAdapter = Utils.Decorate( 48030 options.dataAdapter, 48031 MaximumSelectionLength 48032 ); 48033 } 48034 48035 if (options.tags) { 48036 options.dataAdapter = Utils.Decorate(options.dataAdapter, Tags); 48037 } 48038 48039 if (options.tokenSeparators != null || options.tokenizer != null) { 48040 options.dataAdapter = Utils.Decorate( 48041 options.dataAdapter, 48042 Tokenizer 48043 ); 48044 } 48045 48046 if (options.query != null) { 48047 var Query = require(options.amdBase + 'compat/query'); 48048 48049 options.dataAdapter = Utils.Decorate( 48050 options.dataAdapter, 48051 Query 48052 ); 48053 } 48054 48055 if (options.initSelection != null) { 48056 var InitSelection = require(options.amdBase + 'compat/initSelection'); 48057 48058 options.dataAdapter = Utils.Decorate( 48059 options.dataAdapter, 48060 InitSelection 48061 ); 48062 } 48063 } 48064 48065 if (options.resultsAdapter == null) { 48066 options.resultsAdapter = ResultsList; 48067 48068 if (options.ajax != null) { 48069 options.resultsAdapter = Utils.Decorate( 48070 options.resultsAdapter, 48071 InfiniteScroll 48072 ); 48073 } 48074 48075 if (options.placeholder != null) { 48076 options.resultsAdapter = Utils.Decorate( 48077 options.resultsAdapter, 48078 HidePlaceholder 48079 ); 48080 } 48081 48082 if (options.selectOnClose) { 48083 options.resultsAdapter = Utils.Decorate( 48084 options.resultsAdapter, 48085 SelectOnClose 48086 ); 48087 } 48088 } 48089 48090 if (options.dropdownAdapter == null) { 48091 if (options.multiple) { 48092 options.dropdownAdapter = Dropdown; 48093 } else { 48094 var SearchableDropdown = Utils.Decorate(Dropdown, DropdownSearch); 48095 48096 options.dropdownAdapter = SearchableDropdown; 48097 } 48098 48099 if (options.minimumResultsForSearch !== 0) { 48100 options.dropdownAdapter = Utils.Decorate( 48101 options.dropdownAdapter, 48102 MinimumResultsForSearch 48103 ); 48104 } 48105 48106 if (options.closeOnSelect) { 48107 options.dropdownAdapter = Utils.Decorate( 48108 options.dropdownAdapter, 48109 CloseOnSelect 48110 ); 48111 } 48112 48113 if ( 48114 options.dropdownCssClass != null || 48115 options.dropdownCss != null || 48116 options.adaptDropdownCssClass != null 48117 ) { 48118 var DropdownCSS = require(options.amdBase + 'compat/dropdownCss'); 48119 48120 options.dropdownAdapter = Utils.Decorate( 48121 options.dropdownAdapter, 48122 DropdownCSS 48123 ); 48124 } 48125 48126 options.dropdownAdapter = Utils.Decorate( 48127 options.dropdownAdapter, 48128 AttachBody 48129 ); 48130 } 48131 48132 if (options.selectionAdapter == null) { 48133 if (options.multiple) { 48134 options.selectionAdapter = MultipleSelection; 48135 } else { 48136 options.selectionAdapter = SingleSelection; 48137 } 48138 48139 // Add the placeholder mixin if a placeholder was specified 48140 if (options.placeholder != null) { 48141 options.selectionAdapter = Utils.Decorate( 48142 options.selectionAdapter, 48143 Placeholder 48144 ); 48145 } 48146 48147 if (options.allowClear) { 48148 options.selectionAdapter = Utils.Decorate( 48149 options.selectionAdapter, 48150 AllowClear 48151 ); 48152 } 48153 48154 if (options.multiple) { 48155 options.selectionAdapter = Utils.Decorate( 48156 options.selectionAdapter, 48157 SelectionSearch 48158 ); 48159 } 48160 48161 if ( 48162 options.containerCssClass != null || 48163 options.containerCss != null || 48164 options.adaptContainerCssClass != null 48165 ) { 48166 var ContainerCSS = require(options.amdBase + 'compat/containerCss'); 48167 48168 options.selectionAdapter = Utils.Decorate( 48169 options.selectionAdapter, 48170 ContainerCSS 48171 ); 48172 } 48173 48174 options.selectionAdapter = Utils.Decorate( 48175 options.selectionAdapter, 48176 EventRelay 48177 ); 48178 } 48179 48180 if (typeof options.language === 'string') { 48181 // Check if the language is specified with a region 48182 if (options.language.indexOf('-') > 0) { 48183 // Extract the region information if it is included 48184 var languageParts = options.language.split('-'); 48185 var baseLanguage = languageParts[0]; 48186 48187 options.language = [options.language, baseLanguage]; 48188 } else { 48189 options.language = [options.language]; 48190 } 48191 } 48192 48193 if ($.isArray(options.language)) { 48194 var languages = new Translation(); 48195 options.language.push('en'); 48196 48197 var languageNames = options.language; 48198 48199 for (var l = 0; l < languageNames.length; l++) { 48200 var name = languageNames[l]; 48201 var language = {}; 48202 48203 try { 48204 // Try to load it with the original name 48205 language = Translation.loadPath(name); 48206 } catch (e) { 48207 try { 48208 // If we couldn't load it, check if it wasn't the full path 48209 name = this.defaults.amdLanguageBase + name; 48210 language = Translation.loadPath(name); 48211 } catch (ex) { 48212 // The translation could not be loaded at all. Sometimes this is 48213 // because of a configuration problem, other times this can be 48214 // because of how Select2 helps load all possible translation files. 48215 if (options.debug && window.console && console.warn) { 48216 console.warn( 48217 'Select2: The language file for "' + name + '" could not be ' + 48218 'automatically loaded. A fallback will be used instead.' 48219 ); 48220 } 48221 48222 continue; 48223 } 48224 } 48225 48226 languages.extend(language); 48227 } 48228 48229 options.translations = languages; 48230 } else { 48231 var baseTranslation = Translation.loadPath( 48232 this.defaults.amdLanguageBase + 'en' 48233 ); 48234 var customTranslation = new Translation(options.language); 48235 48236 customTranslation.extend(baseTranslation); 48237 48238 options.translations = customTranslation; 48239 } 48240 48241 return options; 48242 }; 48243 48244 Defaults.prototype.reset = function () { 48245 function stripDiacritics (text) { 48246 // Used 'uni range + named function' from http://jsperf.com/diacritics/18 48247 function match(a) { 48248 return DIACRITICS[a] || a; 48249 } 48250 48251 return text.replace(/[^\u0000-\u007E]/g, match); 48252 } 48253 48254 function matcher (params, data) { 48255 // Always return the object if there is nothing to compare 48256 if ($.trim(params.term) === '') { 48257 return data; 48258 } 48259 48260 // Do a recursive check for options with children 48261 if (data.children && data.children.length > 0) { 48262 // Clone the data object if there are children 48263 // This is required as we modify the object to remove any non-matches 48264 var match = $.extend(true, {}, data); 48265 48266 // Check each child of the option 48267 for (var c = data.children.length - 1; c >= 0; c--) { 48268 var child = data.children[c]; 48269 48270 var matches = matcher(params, child); 48271 48272 // If there wasn't a match, remove the object in the array 48273 if (matches == null) { 48274 match.children.splice(c, 1); 48275 } 48276 } 48277 48278 // If any children matched, return the new object 48279 if (match.children.length > 0) { 48280 return match; 48281 } 48282 48283 // If there were no matching children, check just the plain object 48284 return matcher(params, match); 48285 } 48286 48287 var original = stripDiacritics(data.text).toUpperCase(); 48288 var term = stripDiacritics(params.term).toUpperCase(); 48289 48290 // Check if the text contains the term 48291 if (original.indexOf(term) > -1) { 48292 return data; 48293 } 48294 48295 // If it doesn't contain the term, don't return anything 48296 return null; 48297 } 48298 48299 this.defaults = { 48300 amdBase: './', 48301 amdLanguageBase: './i18n/', 48302 closeOnSelect: true, 48303 debug: false, 48304 dropdownAutoWidth: false, 48305 escapeMarkup: Utils.escapeMarkup, 48306 language: EnglishTranslation, 48307 matcher: matcher, 48308 minimumInputLength: 0, 48309 maximumInputLength: 0, 48310 maximumSelectionLength: 0, 48311 minimumResultsForSearch: 0, 48312 selectOnClose: false, 48313 sorter: function (data) { 48314 return data; 48315 }, 48316 templateResult: function (result) { 48317 return result.text; 48318 }, 48319 templateSelection: function (selection) { 48320 return selection.text; 48321 }, 48322 theme: 'default', 48323 width: 'resolve' 48324 }; 48325 }; 48326 48327 Defaults.prototype.set = function (key, value) { 48328 var camelKey = $.camelCase(key); 48329 48330 var data = {}; 48331 data[camelKey] = value; 48332 48333 var convertedData = Utils._convertData(data); 48334 48335 $.extend(this.defaults, convertedData); 48336 }; 48337 48338 var defaults = new Defaults(); 48339 48340 return defaults; 48341}); 48342 48343S2.define('select2/options',[ 48344 'require', 48345 'jquery', 48346 './defaults', 48347 './utils' 48348], function (require, $, Defaults, Utils) { 48349 function Options (options, $element) { 48350 this.options = options; 48351 48352 if ($element != null) { 48353 this.fromElement($element); 48354 } 48355 48356 this.options = Defaults.apply(this.options); 48357 48358 if ($element && $element.is('input')) { 48359 var InputCompat = require(this.get('amdBase') + 'compat/inputData'); 48360 48361 this.options.dataAdapter = Utils.Decorate( 48362 this.options.dataAdapter, 48363 InputCompat 48364 ); 48365 } 48366 } 48367 48368 Options.prototype.fromElement = function ($e) { 48369 var excludedData = ['select2']; 48370 48371 if (this.options.multiple == null) { 48372 this.options.multiple = $e.prop('multiple'); 48373 } 48374 48375 if (this.options.disabled == null) { 48376 this.options.disabled = $e.prop('disabled'); 48377 } 48378 48379 if (this.options.language == null) { 48380 if ($e.prop('lang')) { 48381 this.options.language = $e.prop('lang').toLowerCase(); 48382 } else if ($e.closest('[lang]').prop('lang')) { 48383 this.options.language = $e.closest('[lang]').prop('lang'); 48384 } 48385 } 48386 48387 if (this.options.dir == null) { 48388 if ($e.prop('dir')) { 48389 this.options.dir = $e.prop('dir'); 48390 } else if ($e.closest('[dir]').prop('dir')) { 48391 this.options.dir = $e.closest('[dir]').prop('dir'); 48392 } else { 48393 this.options.dir = 'ltr'; 48394 } 48395 } 48396 48397 $e.prop('disabled', this.options.disabled); 48398 $e.prop('multiple', this.options.multiple); 48399 48400 if ($e.data('select2Tags')) { 48401 if (this.options.debug && window.console && console.warn) { 48402 console.warn( 48403 'Select2: The `data-select2-tags` attribute has been changed to ' + 48404 'use the `data-data` and `data-tags="true"` attributes and will be ' + 48405 'removed in future versions of Select2.' 48406 ); 48407 } 48408 48409 $e.data('data', $e.data('select2Tags')); 48410 $e.data('tags', true); 48411 } 48412 48413 if ($e.data('ajaxUrl')) { 48414 if (this.options.debug && window.console && console.warn) { 48415 console.warn( 48416 'Select2: The `data-ajax-url` attribute has been changed to ' + 48417 '`data-ajax--url` and support for the old attribute will be removed' + 48418 ' in future versions of Select2.' 48419 ); 48420 } 48421 48422 $e.attr('ajax--url', $e.data('ajaxUrl')); 48423 $e.data('ajax--url', $e.data('ajaxUrl')); 48424 } 48425 48426 var dataset = {}; 48427 48428 // Prefer the element's `dataset` attribute if it exists 48429 // jQuery 1.x does not correctly handle data attributes with multiple dashes 48430 if ($.fn.jquery && $.fn.jquery.substr(0, 2) == '1.' && $e[0].dataset) { 48431 dataset = $.extend(true, {}, $e[0].dataset, $e.data()); 48432 } else { 48433 dataset = $e.data(); 48434 } 48435 48436 var data = $.extend(true, {}, dataset); 48437 48438 data = Utils._convertData(data); 48439 48440 for (var key in data) { 48441 if ($.inArray(key, excludedData) > -1) { 48442 continue; 48443 } 48444 48445 if ($.isPlainObject(this.options[key])) { 48446 $.extend(this.options[key], data[key]); 48447 } else { 48448 this.options[key] = data[key]; 48449 } 48450 } 48451 48452 return this; 48453 }; 48454 48455 Options.prototype.get = function (key) { 48456 return this.options[key]; 48457 }; 48458 48459 Options.prototype.set = function (key, val) { 48460 this.options[key] = val; 48461 }; 48462 48463 return Options; 48464}); 48465 48466S2.define('select2/core',[ 48467 'jquery', 48468 './options', 48469 './utils', 48470 './keys' 48471], function ($, Options, Utils, KEYS) { 48472 var Select2 = function ($element, options) { 48473 if ($element.data('select2') != null) { 48474 $element.data('select2').destroy(); 48475 } 48476 48477 this.$element = $element; 48478 48479 this.id = this._generateId($element); 48480 48481 options = options || {}; 48482 48483 this.options = new Options(options, $element); 48484 48485 Select2.__super__.constructor.call(this); 48486 48487 // Set up the tabindex 48488 48489 var tabindex = $element.attr('tabindex') || 0; 48490 $element.data('old-tabindex', tabindex); 48491 $element.attr('tabindex', '-1'); 48492 48493 // Set up containers and adapters 48494 48495 var DataAdapter = this.options.get('dataAdapter'); 48496 this.dataAdapter = new DataAdapter($element, this.options); 48497 48498 var $container = this.render(); 48499 48500 this._placeContainer($container); 48501 48502 var SelectionAdapter = this.options.get('selectionAdapter'); 48503 this.selection = new SelectionAdapter($element, this.options); 48504 this.$selection = this.selection.render(); 48505 48506 this.selection.position(this.$selection, $container); 48507 48508 var DropdownAdapter = this.options.get('dropdownAdapter'); 48509 this.dropdown = new DropdownAdapter($element, this.options); 48510 this.$dropdown = this.dropdown.render(); 48511 48512 this.dropdown.position(this.$dropdown, $container); 48513 48514 var ResultsAdapter = this.options.get('resultsAdapter'); 48515 this.results = new ResultsAdapter($element, this.options, this.dataAdapter); 48516 this.$results = this.results.render(); 48517 48518 this.results.position(this.$results, this.$dropdown); 48519 48520 // Bind events 48521 48522 var self = this; 48523 48524 // Bind the container to all of the adapters 48525 this._bindAdapters(); 48526 48527 // Register any DOM event handlers 48528 this._registerDomEvents(); 48529 48530 // Register any internal event handlers 48531 this._registerDataEvents(); 48532 this._registerSelectionEvents(); 48533 this._registerDropdownEvents(); 48534 this._registerResultsEvents(); 48535 this._registerEvents(); 48536 48537 // Set the initial state 48538 this.dataAdapter.current(function (initialData) { 48539 self.trigger('selection:update', { 48540 data: initialData 48541 }); 48542 }); 48543 48544 // Hide the original select 48545 $element.addClass('select2-hidden-accessible'); 48546 $element.attr('aria-hidden', 'true'); 48547 48548 // Synchronize any monitored attributes 48549 this._syncAttributes(); 48550 48551 $element.data('select2', this); 48552 }; 48553 48554 Utils.Extend(Select2, Utils.Observable); 48555 48556 Select2.prototype._generateId = function ($element) { 48557 var id = ''; 48558 48559 if ($element.attr('id') != null) { 48560 id = $element.attr('id'); 48561 } else if ($element.attr('name') != null) { 48562 id = $element.attr('name') + '-' + Utils.generateChars(2); 48563 } else { 48564 id = Utils.generateChars(4); 48565 } 48566 48567 id = id.replace(/(:|\.|\[|\]|,)/g, ''); 48568 id = 'select2-' + id; 48569 48570 return id; 48571 }; 48572 48573 Select2.prototype._placeContainer = function ($container) { 48574 $container.insertAfter(this.$element); 48575 48576 var width = this._resolveWidth(this.$element, this.options.get('width')); 48577 48578 if (width != null) { 48579 $container.css('width', width); 48580 } 48581 }; 48582 48583 Select2.prototype._resolveWidth = function ($element, method) { 48584 var WIDTH = /^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i; 48585 48586 if (method == 'resolve') { 48587 var styleWidth = this._resolveWidth($element, 'style'); 48588 48589 if (styleWidth != null) { 48590 return styleWidth; 48591 } 48592 48593 return this._resolveWidth($element, 'element'); 48594 } 48595 48596 if (method == 'element') { 48597 var elementWidth = $element.outerWidth(false); 48598 48599 if (elementWidth <= 0) { 48600 return 'auto'; 48601 } 48602 48603 return elementWidth + 'px'; 48604 } 48605 48606 if (method == 'style') { 48607 var style = $element.attr('style'); 48608 48609 if (typeof(style) !== 'string') { 48610 return null; 48611 } 48612 48613 var attrs = style.split(';'); 48614 48615 for (var i = 0, l = attrs.length; i < l; i = i + 1) { 48616 var attr = attrs[i].replace(/\s/g, ''); 48617 var matches = attr.match(WIDTH); 48618 48619 if (matches !== null && matches.length >= 1) { 48620 return matches[1]; 48621 } 48622 } 48623 48624 return null; 48625 } 48626 48627 return method; 48628 }; 48629 48630 Select2.prototype._bindAdapters = function () { 48631 this.dataAdapter.bind(this, this.$container); 48632 this.selection.bind(this, this.$container); 48633 48634 this.dropdown.bind(this, this.$container); 48635 this.results.bind(this, this.$container); 48636 }; 48637 48638 Select2.prototype._registerDomEvents = function () { 48639 var self = this; 48640 48641 this.$element.on('change.select2', function () { 48642 self.dataAdapter.current(function (data) { 48643 self.trigger('selection:update', { 48644 data: data 48645 }); 48646 }); 48647 }); 48648 48649 this.$element.on('focus.select2', function (evt) { 48650 self.trigger('focus', evt); 48651 }); 48652 48653 this._syncA = Utils.bind(this._syncAttributes, this); 48654 this._syncS = Utils.bind(this._syncSubtree, this); 48655 48656 if (this.$element[0].attachEvent) { 48657 this.$element[0].attachEvent('onpropertychange', this._syncA); 48658 } 48659 48660 var observer = window.MutationObserver || 48661 window.WebKitMutationObserver || 48662 window.MozMutationObserver 48663 ; 48664 48665 if (observer != null) { 48666 this._observer = new observer(function (mutations) { 48667 $.each(mutations, self._syncA); 48668 $.each(mutations, self._syncS); 48669 }); 48670 this._observer.observe(this.$element[0], { 48671 attributes: true, 48672 childList: true, 48673 subtree: false 48674 }); 48675 } else if (this.$element[0].addEventListener) { 48676 this.$element[0].addEventListener( 48677 'DOMAttrModified', 48678 self._syncA, 48679 false 48680 ); 48681 this.$element[0].addEventListener( 48682 'DOMNodeInserted', 48683 self._syncS, 48684 false 48685 ); 48686 this.$element[0].addEventListener( 48687 'DOMNodeRemoved', 48688 self._syncS, 48689 false 48690 ); 48691 } 48692 }; 48693 48694 Select2.prototype._registerDataEvents = function () { 48695 var self = this; 48696 48697 this.dataAdapter.on('*', function (name, params) { 48698 self.trigger(name, params); 48699 }); 48700 }; 48701 48702 Select2.prototype._registerSelectionEvents = function () { 48703 var self = this; 48704 var nonRelayEvents = ['toggle', 'focus']; 48705 48706 this.selection.on('toggle', function () { 48707 self.toggleDropdown(); 48708 }); 48709 48710 this.selection.on('focus', function (params) { 48711 self.focus(params); 48712 }); 48713 48714 this.selection.on('*', function (name, params) { 48715 if ($.inArray(name, nonRelayEvents) !== -1) { 48716 return; 48717 } 48718 48719 self.trigger(name, params); 48720 }); 48721 }; 48722 48723 Select2.prototype._registerDropdownEvents = function () { 48724 var self = this; 48725 48726 this.dropdown.on('*', function (name, params) { 48727 self.trigger(name, params); 48728 }); 48729 }; 48730 48731 Select2.prototype._registerResultsEvents = function () { 48732 var self = this; 48733 48734 this.results.on('*', function (name, params) { 48735 self.trigger(name, params); 48736 }); 48737 }; 48738 48739 Select2.prototype._registerEvents = function () { 48740 var self = this; 48741 48742 this.on('open', function () { 48743 self.$container.addClass('select2-container--open'); 48744 }); 48745 48746 this.on('close', function () { 48747 self.$container.removeClass('select2-container--open'); 48748 }); 48749 48750 this.on('enable', function () { 48751 self.$container.removeClass('select2-container--disabled'); 48752 }); 48753 48754 this.on('disable', function () { 48755 self.$container.addClass('select2-container--disabled'); 48756 }); 48757 48758 this.on('blur', function () { 48759 self.$container.removeClass('select2-container--focus'); 48760 }); 48761 48762 this.on('query', function (params) { 48763 if (!self.isOpen()) { 48764 self.trigger('open', {}); 48765 } 48766 48767 this.dataAdapter.query(params, function (data) { 48768 self.trigger('results:all', { 48769 data: data, 48770 query: params 48771 }); 48772 }); 48773 }); 48774 48775 this.on('query:append', function (params) { 48776 this.dataAdapter.query(params, function (data) { 48777 self.trigger('results:append', { 48778 data: data, 48779 query: params 48780 }); 48781 }); 48782 }); 48783 48784 this.on('keypress', function (evt) { 48785 var key = evt.which; 48786 48787 if (self.isOpen()) { 48788 if (key === KEYS.ESC || key === KEYS.TAB || 48789 (key === KEYS.UP && evt.altKey)) { 48790 self.close(); 48791 48792 evt.preventDefault(); 48793 } else if (key === KEYS.ENTER) { 48794 self.trigger('results:select', {}); 48795 48796 evt.preventDefault(); 48797 } else if ((key === KEYS.SPACE && evt.ctrlKey)) { 48798 self.trigger('results:toggle', {}); 48799 48800 evt.preventDefault(); 48801 } else if (key === KEYS.UP) { 48802 self.trigger('results:previous', {}); 48803 48804 evt.preventDefault(); 48805 } else if (key === KEYS.DOWN) { 48806 self.trigger('results:next', {}); 48807 48808 evt.preventDefault(); 48809 } 48810 } else { 48811 if (key === KEYS.ENTER || key === KEYS.SPACE || 48812 (key === KEYS.DOWN && evt.altKey)) { 48813 self.open(); 48814 48815 evt.preventDefault(); 48816 } 48817 } 48818 }); 48819 }; 48820 48821 Select2.prototype._syncAttributes = function () { 48822 this.options.set('disabled', this.$element.prop('disabled')); 48823 48824 if (this.options.get('disabled')) { 48825 if (this.isOpen()) { 48826 this.close(); 48827 } 48828 48829 this.trigger('disable', {}); 48830 } else { 48831 this.trigger('enable', {}); 48832 } 48833 }; 48834 48835 Select2.prototype._syncSubtree = function (evt, mutations) { 48836 var changed = false; 48837 var self = this; 48838 48839 // Ignore any mutation events raised for elements that aren't options or 48840 // optgroups. This handles the case when the select element is destroyed 48841 if ( 48842 evt && evt.target && ( 48843 evt.target.nodeName !== 'OPTION' && evt.target.nodeName !== 'OPTGROUP' 48844 ) 48845 ) { 48846 return; 48847 } 48848 48849 if (!mutations) { 48850 // If mutation events aren't supported, then we can only assume that the 48851 // change affected the selections 48852 changed = true; 48853 } else if (mutations.addedNodes && mutations.addedNodes.length > 0) { 48854 for (var n = 0; n < mutations.addedNodes.length; n++) { 48855 var node = mutations.addedNodes[n]; 48856 48857 if (node.selected) { 48858 changed = true; 48859 } 48860 } 48861 } else if (mutations.removedNodes && mutations.removedNodes.length > 0) { 48862 changed = true; 48863 } 48864 48865 // Only re-pull the data if we think there is a change 48866 if (changed) { 48867 this.dataAdapter.current(function (currentData) { 48868 self.trigger('selection:update', { 48869 data: currentData 48870 }); 48871 }); 48872 } 48873 }; 48874 48875 /** 48876 * Override the trigger method to automatically trigger pre-events when 48877 * there are events that can be prevented. 48878 */ 48879 Select2.prototype.trigger = function (name, args) { 48880 var actualTrigger = Select2.__super__.trigger; 48881 var preTriggerMap = { 48882 'open': 'opening', 48883 'close': 'closing', 48884 'select': 'selecting', 48885 'unselect': 'unselecting' 48886 }; 48887 48888 if (args === undefined) { 48889 args = {}; 48890 } 48891 48892 if (name in preTriggerMap) { 48893 var preTriggerName = preTriggerMap[name]; 48894 var preTriggerArgs = { 48895 prevented: false, 48896 name: name, 48897 args: args 48898 }; 48899 48900 actualTrigger.call(this, preTriggerName, preTriggerArgs); 48901 48902 if (preTriggerArgs.prevented) { 48903 args.prevented = true; 48904 48905 return; 48906 } 48907 } 48908 48909 actualTrigger.call(this, name, args); 48910 }; 48911 48912 Select2.prototype.toggleDropdown = function () { 48913 if (this.options.get('disabled')) { 48914 return; 48915 } 48916 48917 if (this.isOpen()) { 48918 this.close(); 48919 } else { 48920 this.open(); 48921 } 48922 }; 48923 48924 Select2.prototype.open = function () { 48925 if (this.isOpen()) { 48926 return; 48927 } 48928 48929 this.trigger('query', {}); 48930 }; 48931 48932 Select2.prototype.close = function () { 48933 if (!this.isOpen()) { 48934 return; 48935 } 48936 48937 this.trigger('close', {}); 48938 }; 48939 48940 Select2.prototype.isOpen = function () { 48941 return this.$container.hasClass('select2-container--open'); 48942 }; 48943 48944 Select2.prototype.hasFocus = function () { 48945 return this.$container.hasClass('select2-container--focus'); 48946 }; 48947 48948 Select2.prototype.focus = function (data) { 48949 // No need to re-trigger focus events if we are already focused 48950 if (this.hasFocus()) { 48951 return; 48952 } 48953 48954 this.$container.addClass('select2-container--focus'); 48955 this.trigger('focus', {}); 48956 }; 48957 48958 Select2.prototype.enable = function (args) { 48959 if (this.options.get('debug') && window.console && console.warn) { 48960 console.warn( 48961 'Select2: The `select2("enable")` method has been deprecated and will' + 48962 ' be removed in later Select2 versions. Use $element.prop("disabled")' + 48963 ' instead.' 48964 ); 48965 } 48966 48967 if (args == null || args.length === 0) { 48968 args = [true]; 48969 } 48970 48971 var disabled = !args[0]; 48972 48973 this.$element.prop('disabled', disabled); 48974 }; 48975 48976 Select2.prototype.data = function () { 48977 if (this.options.get('debug') && 48978 arguments.length > 0 && window.console && console.warn) { 48979 console.warn( 48980 'Select2: Data can no longer be set using `select2("data")`. You ' + 48981 'should consider setting the value instead using `$element.val()`.' 48982 ); 48983 } 48984 48985 var data = []; 48986 48987 this.dataAdapter.current(function (currentData) { 48988 data = currentData; 48989 }); 48990 48991 return data; 48992 }; 48993 48994 Select2.prototype.val = function (args) { 48995 if (this.options.get('debug') && window.console && console.warn) { 48996 console.warn( 48997 'Select2: The `select2("val")` method has been deprecated and will be' + 48998 ' removed in later Select2 versions. Use $element.val() instead.' 48999 ); 49000 } 49001 49002 if (args == null || args.length === 0) { 49003 return this.$element.val(); 49004 } 49005 49006 var newVal = args[0]; 49007 49008 if ($.isArray(newVal)) { 49009 newVal = $.map(newVal, function (obj) { 49010 return obj.toString(); 49011 }); 49012 } 49013 49014 this.$element.val(newVal).trigger('change'); 49015 }; 49016 49017 Select2.prototype.destroy = function () { 49018 this.$container.remove(); 49019 49020 if (this.$element[0].detachEvent) { 49021 this.$element[0].detachEvent('onpropertychange', this._syncA); 49022 } 49023 49024 if (this._observer != null) { 49025 this._observer.disconnect(); 49026 this._observer = null; 49027 } else if (this.$element[0].removeEventListener) { 49028 this.$element[0] 49029 .removeEventListener('DOMAttrModified', this._syncA, false); 49030 this.$element[0] 49031 .removeEventListener('DOMNodeInserted', this._syncS, false); 49032 this.$element[0] 49033 .removeEventListener('DOMNodeRemoved', this._syncS, false); 49034 } 49035 49036 this._syncA = null; 49037 this._syncS = null; 49038 49039 this.$element.off('.select2'); 49040 this.$element.attr('tabindex', this.$element.data('old-tabindex')); 49041 49042 this.$element.removeClass('select2-hidden-accessible'); 49043 this.$element.attr('aria-hidden', 'false'); 49044 this.$element.removeData('select2'); 49045 49046 this.dataAdapter.destroy(); 49047 this.selection.destroy(); 49048 this.dropdown.destroy(); 49049 this.results.destroy(); 49050 49051 this.dataAdapter = null; 49052 this.selection = null; 49053 this.dropdown = null; 49054 this.results = null; 49055 }; 49056 49057 Select2.prototype.render = function () { 49058 var $container = $( 49059 '<span class="select2 select2-container">' + 49060 '<span class="selection"></span>' + 49061 '<span class="dropdown-wrapper" aria-hidden="true"></span>' + 49062 '</span>' 49063 ); 49064 49065 $container.attr('dir', this.options.get('dir')); 49066 49067 this.$container = $container; 49068 49069 this.$container.addClass('select2-container--' + this.options.get('theme')); 49070 49071 $container.data('element', this.$element); 49072 49073 return $container; 49074 }; 49075 49076 return Select2; 49077}); 49078 49079S2.define('select2/compat/utils',[ 49080 'jquery' 49081], function ($) { 49082 function syncCssClasses ($dest, $src, adapter) { 49083 var classes, replacements = [], adapted; 49084 49085 classes = $.trim($dest.attr('class')); 49086 49087 if (classes) { 49088 classes = '' + classes; // for IE which returns object 49089 49090 $(classes.split(/\s+/)).each(function () { 49091 // Save all Select2 classes 49092 if (this.indexOf('select2-') === 0) { 49093 replacements.push(this); 49094 } 49095 }); 49096 } 49097 49098 classes = $.trim($src.attr('class')); 49099 49100 if (classes) { 49101 classes = '' + classes; // for IE which returns object 49102 49103 $(classes.split(/\s+/)).each(function () { 49104 // Only adapt non-Select2 classes 49105 if (this.indexOf('select2-') !== 0) { 49106 adapted = adapter(this); 49107 49108 if (adapted != null) { 49109 replacements.push(adapted); 49110 } 49111 } 49112 }); 49113 } 49114 49115 $dest.attr('class', replacements.join(' ')); 49116 } 49117 49118 return { 49119 syncCssClasses: syncCssClasses 49120 }; 49121}); 49122 49123S2.define('select2/compat/containerCss',[ 49124 'jquery', 49125 './utils' 49126], function ($, CompatUtils) { 49127 // No-op CSS adapter that discards all classes by default 49128 function _containerAdapter (clazz) { 49129 return null; 49130 } 49131 49132 function ContainerCSS () { } 49133 49134 ContainerCSS.prototype.render = function (decorated) { 49135 var $container = decorated.call(this); 49136 49137 var containerCssClass = this.options.get('containerCssClass') || ''; 49138 49139 if ($.isFunction(containerCssClass)) { 49140 containerCssClass = containerCssClass(this.$element); 49141 } 49142 49143 var containerCssAdapter = this.options.get('adaptContainerCssClass'); 49144 containerCssAdapter = containerCssAdapter || _containerAdapter; 49145 49146 if (containerCssClass.indexOf(':all:') !== -1) { 49147 containerCssClass = containerCssClass.replace(':all:', ''); 49148 49149 var _cssAdapter = containerCssAdapter; 49150 49151 containerCssAdapter = function (clazz) { 49152 var adapted = _cssAdapter(clazz); 49153 49154 if (adapted != null) { 49155 // Append the old one along with the adapted one 49156 return adapted + ' ' + clazz; 49157 } 49158 49159 return clazz; 49160 }; 49161 } 49162 49163 var containerCss = this.options.get('containerCss') || {}; 49164 49165 if ($.isFunction(containerCss)) { 49166 containerCss = containerCss(this.$element); 49167 } 49168 49169 CompatUtils.syncCssClasses($container, this.$element, containerCssAdapter); 49170 49171 $container.css(containerCss); 49172 $container.addClass(containerCssClass); 49173 49174 return $container; 49175 }; 49176 49177 return ContainerCSS; 49178}); 49179 49180S2.define('select2/compat/dropdownCss',[ 49181 'jquery', 49182 './utils' 49183], function ($, CompatUtils) { 49184 // No-op CSS adapter that discards all classes by default 49185 function _dropdownAdapter (clazz) { 49186 return null; 49187 } 49188 49189 function DropdownCSS () { } 49190 49191 DropdownCSS.prototype.render = function (decorated) { 49192 var $dropdown = decorated.call(this); 49193 49194 var dropdownCssClass = this.options.get('dropdownCssClass') || ''; 49195 49196 if ($.isFunction(dropdownCssClass)) { 49197 dropdownCssClass = dropdownCssClass(this.$element); 49198 } 49199 49200 var dropdownCssAdapter = this.options.get('adaptDropdownCssClass'); 49201 dropdownCssAdapter = dropdownCssAdapter || _dropdownAdapter; 49202 49203 if (dropdownCssClass.indexOf(':all:') !== -1) { 49204 dropdownCssClass = dropdownCssClass.replace(':all:', ''); 49205 49206 var _cssAdapter = dropdownCssAdapter; 49207 49208 dropdownCssAdapter = function (clazz) { 49209 var adapted = _cssAdapter(clazz); 49210 49211 if (adapted != null) { 49212 // Append the old one along with the adapted one 49213 return adapted + ' ' + clazz; 49214 } 49215 49216 return clazz; 49217 }; 49218 } 49219 49220 var dropdownCss = this.options.get('dropdownCss') || {}; 49221 49222 if ($.isFunction(dropdownCss)) { 49223 dropdownCss = dropdownCss(this.$element); 49224 } 49225 49226 CompatUtils.syncCssClasses($dropdown, this.$element, dropdownCssAdapter); 49227 49228 $dropdown.css(dropdownCss); 49229 $dropdown.addClass(dropdownCssClass); 49230 49231 return $dropdown; 49232 }; 49233 49234 return DropdownCSS; 49235}); 49236 49237S2.define('select2/compat/initSelection',[ 49238 'jquery' 49239], function ($) { 49240 function InitSelection (decorated, $element, options) { 49241 if (options.get('debug') && window.console && console.warn) { 49242 console.warn( 49243 'Select2: The `initSelection` option has been deprecated in favor' + 49244 ' of a custom data adapter that overrides the `current` method. ' + 49245 'This method is now called multiple times instead of a single ' + 49246 'time when the instance is initialized. Support will be removed ' + 49247 'for the `initSelection` option in future versions of Select2' 49248 ); 49249 } 49250 49251 this.initSelection = options.get('initSelection'); 49252 this._isInitialized = false; 49253 49254 decorated.call(this, $element, options); 49255 } 49256 49257 InitSelection.prototype.current = function (decorated, callback) { 49258 var self = this; 49259 49260 if (this._isInitialized) { 49261 decorated.call(this, callback); 49262 49263 return; 49264 } 49265 49266 this.initSelection.call(null, this.$element, function (data) { 49267 self._isInitialized = true; 49268 49269 if (!$.isArray(data)) { 49270 data = [data]; 49271 } 49272 49273 callback(data); 49274 }); 49275 }; 49276 49277 return InitSelection; 49278}); 49279 49280S2.define('select2/compat/inputData',[ 49281 'jquery' 49282], function ($) { 49283 function InputData (decorated, $element, options) { 49284 this._currentData = []; 49285 this._valueSeparator = options.get('valueSeparator') || ','; 49286 49287 if ($element.prop('type') === 'hidden') { 49288 if (options.get('debug') && console && console.warn) { 49289 console.warn( 49290 'Select2: Using a hidden input with Select2 is no longer ' + 49291 'supported and may stop working in the future. It is recommended ' + 49292 'to use a `<select>` element instead.' 49293 ); 49294 } 49295 } 49296 49297 decorated.call(this, $element, options); 49298 } 49299 49300 InputData.prototype.current = function (_, callback) { 49301 function getSelected (data, selectedIds) { 49302 var selected = []; 49303 49304 if (data.selected || $.inArray(data.id, selectedIds) !== -1) { 49305 data.selected = true; 49306 selected.push(data); 49307 } else { 49308 data.selected = false; 49309 } 49310 49311 if (data.children) { 49312 selected.push.apply(selected, getSelected(data.children, selectedIds)); 49313 } 49314 49315 return selected; 49316 } 49317 49318 var selected = []; 49319 49320 for (var d = 0; d < this._currentData.length; d++) { 49321 var data = this._currentData[d]; 49322 49323 selected.push.apply( 49324 selected, 49325 getSelected( 49326 data, 49327 this.$element.val().split( 49328 this._valueSeparator 49329 ) 49330 ) 49331 ); 49332 } 49333 49334 callback(selected); 49335 }; 49336 49337 InputData.prototype.select = function (_, data) { 49338 if (!this.options.get('multiple')) { 49339 this.current(function (allData) { 49340 $.map(allData, function (data) { 49341 data.selected = false; 49342 }); 49343 }); 49344 49345 this.$element.val(data.id); 49346 this.$element.trigger('change'); 49347 } else { 49348 var value = this.$element.val(); 49349 value += this._valueSeparator + data.id; 49350 49351 this.$element.val(value); 49352 this.$element.trigger('change'); 49353 } 49354 }; 49355 49356 InputData.prototype.unselect = function (_, data) { 49357 var self = this; 49358 49359 data.selected = false; 49360 49361 this.current(function (allData) { 49362 var values = []; 49363 49364 for (var d = 0; d < allData.length; d++) { 49365 var item = allData[d]; 49366 49367 if (data.id == item.id) { 49368 continue; 49369 } 49370 49371 values.push(item.id); 49372 } 49373 49374 self.$element.val(values.join(self._valueSeparator)); 49375 self.$element.trigger('change'); 49376 }); 49377 }; 49378 49379 InputData.prototype.query = function (_, params, callback) { 49380 var results = []; 49381 49382 for (var d = 0; d < this._currentData.length; d++) { 49383 var data = this._currentData[d]; 49384 49385 var matches = this.matches(params, data); 49386 49387 if (matches !== null) { 49388 results.push(matches); 49389 } 49390 } 49391 49392 callback({ 49393 results: results 49394 }); 49395 }; 49396 49397 InputData.prototype.addOptions = function (_, $options) { 49398 var options = $.map($options, function ($option) { 49399 return $.data($option[0], 'data'); 49400 }); 49401 49402 this._currentData.push.apply(this._currentData, options); 49403 }; 49404 49405 return InputData; 49406}); 49407 49408S2.define('select2/compat/matcher',[ 49409 'jquery' 49410], function ($) { 49411 function oldMatcher (matcher) { 49412 function wrappedMatcher (params, data) { 49413 var match = $.extend(true, {}, data); 49414 49415 if (params.term == null || $.trim(params.term) === '') { 49416 return match; 49417 } 49418 49419 if (data.children) { 49420 for (var c = data.children.length - 1; c >= 0; c--) { 49421 var child = data.children[c]; 49422 49423 // Check if the child object matches 49424 // The old matcher returned a boolean true or false 49425 var doesMatch = matcher(params.term, child.text, child); 49426 49427 // If the child didn't match, pop it off 49428 if (!doesMatch) { 49429 match.children.splice(c, 1); 49430 } 49431 } 49432 49433 if (match.children.length > 0) { 49434 return match; 49435 } 49436 } 49437 49438 if (matcher(params.term, data.text, data)) { 49439 return match; 49440 } 49441 49442 return null; 49443 } 49444 49445 return wrappedMatcher; 49446 } 49447 49448 return oldMatcher; 49449}); 49450 49451S2.define('select2/compat/query',[ 49452 49453], function () { 49454 function Query (decorated, $element, options) { 49455 if (options.get('debug') && window.console && console.warn) { 49456 console.warn( 49457 'Select2: The `query` option has been deprecated in favor of a ' + 49458 'custom data adapter that overrides the `query` method. Support ' + 49459 'will be removed for the `query` option in future versions of ' + 49460 'Select2.' 49461 ); 49462 } 49463 49464 decorated.call(this, $element, options); 49465 } 49466 49467 Query.prototype.query = function (_, params, callback) { 49468 params.callback = callback; 49469 49470 var query = this.options.get('query'); 49471 49472 query.call(null, params); 49473 }; 49474 49475 return Query; 49476}); 49477 49478S2.define('select2/dropdown/attachContainer',[ 49479 49480], function () { 49481 function AttachContainer (decorated, $element, options) { 49482 decorated.call(this, $element, options); 49483 } 49484 49485 AttachContainer.prototype.position = 49486 function (decorated, $dropdown, $container) { 49487 var $dropdownContainer = $container.find('.dropdown-wrapper'); 49488 $dropdownContainer.append($dropdown); 49489 49490 $dropdown.addClass('select2-dropdown--below'); 49491 $container.addClass('select2-container--below'); 49492 }; 49493 49494 return AttachContainer; 49495}); 49496 49497S2.define('select2/dropdown/stopPropagation',[ 49498 49499], function () { 49500 function StopPropagation () { } 49501 49502 StopPropagation.prototype.bind = function (decorated, container, $container) { 49503 decorated.call(this, container, $container); 49504 49505 var stoppedEvents = [ 49506 'blur', 49507 'change', 49508 'click', 49509 'dblclick', 49510 'focus', 49511 'focusin', 49512 'focusout', 49513 'input', 49514 'keydown', 49515 'keyup', 49516 'keypress', 49517 'mousedown', 49518 'mouseenter', 49519 'mouseleave', 49520 'mousemove', 49521 'mouseover', 49522 'mouseup', 49523 'search', 49524 'touchend', 49525 'touchstart' 49526 ]; 49527 49528 this.$dropdown.on(stoppedEvents.join(' '), function (evt) { 49529 evt.stopPropagation(); 49530 }); 49531 }; 49532 49533 return StopPropagation; 49534}); 49535 49536S2.define('select2/selection/stopPropagation',[ 49537 49538], function () { 49539 function StopPropagation () { } 49540 49541 StopPropagation.prototype.bind = function (decorated, container, $container) { 49542 decorated.call(this, container, $container); 49543 49544 var stoppedEvents = [ 49545 'blur', 49546 'change', 49547 'click', 49548 'dblclick', 49549 'focus', 49550 'focusin', 49551 'focusout', 49552 'input', 49553 'keydown', 49554 'keyup', 49555 'keypress', 49556 'mousedown', 49557 'mouseenter', 49558 'mouseleave', 49559 'mousemove', 49560 'mouseover', 49561 'mouseup', 49562 'search', 49563 'touchend', 49564 'touchstart' 49565 ]; 49566 49567 this.$selection.on(stoppedEvents.join(' '), function (evt) { 49568 evt.stopPropagation(); 49569 }); 49570 }; 49571 49572 return StopPropagation; 49573}); 49574 49575/*! 49576 * jQuery Mousewheel 3.1.13 49577 * 49578 * Copyright jQuery Foundation and other contributors 49579 * Released under the MIT license 49580 * http://jquery.org/license 49581 */ 49582 49583(function (factory) { 49584 if ( typeof S2.define === 'function' && S2.define.amd ) { 49585 // AMD. Register as an anonymous module. 49586 S2.define('jquery-mousewheel',['jquery'], factory); 49587 } else if (typeof exports === 'object') { 49588 // Node/CommonJS style for Browserify 49589 module.exports = factory; 49590 } else { 49591 // Browser globals 49592 factory(jQuery); 49593 } 49594}(function ($) { 49595 49596 var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'], 49597 toBind = ( 'onwheel' in document || document.documentMode >= 9 ) ? 49598 ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'], 49599 slice = Array.prototype.slice, 49600 nullLowestDeltaTimeout, lowestDelta; 49601 49602 if ( $.event.fixHooks ) { 49603 for ( var i = toFix.length; i; ) { 49604 $.event.fixHooks[ toFix[--i] ] = $.event.mouseHooks; 49605 } 49606 } 49607 49608 var special = $.event.special.mousewheel = { 49609 version: '3.1.12', 49610 49611 setup: function() { 49612 if ( this.addEventListener ) { 49613 for ( var i = toBind.length; i; ) { 49614 this.addEventListener( toBind[--i], handler, false ); 49615 } 49616 } else { 49617 this.onmousewheel = handler; 49618 } 49619 // Store the line height and page height for this particular element 49620 $.data(this, 'mousewheel-line-height', special.getLineHeight(this)); 49621 $.data(this, 'mousewheel-page-height', special.getPageHeight(this)); 49622 }, 49623 49624 teardown: function() { 49625 if ( this.removeEventListener ) { 49626 for ( var i = toBind.length; i; ) { 49627 this.removeEventListener( toBind[--i], handler, false ); 49628 } 49629 } else { 49630 this.onmousewheel = null; 49631 } 49632 // Clean up the data we added to the element 49633 $.removeData(this, 'mousewheel-line-height'); 49634 $.removeData(this, 'mousewheel-page-height'); 49635 }, 49636 49637 getLineHeight: function(elem) { 49638 var $elem = $(elem), 49639 $parent = $elem['offsetParent' in $.fn ? 'offsetParent' : 'parent'](); 49640 if (!$parent.length) { 49641 $parent = $('body'); 49642 } 49643 return parseInt($parent.css('fontSize'), 10) || parseInt($elem.css('fontSize'), 10) || 16; 49644 }, 49645 49646 getPageHeight: function(elem) { 49647 return $(elem).height(); 49648 }, 49649 49650 settings: { 49651 adjustOldDeltas: true, // see shouldAdjustOldDeltas() below 49652 normalizeOffset: true // calls getBoundingClientRect for each event 49653 } 49654 }; 49655 49656 $.fn.extend({ 49657 mousewheel: function(fn) { 49658 return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel'); 49659 }, 49660 49661 unmousewheel: function(fn) { 49662 return this.unbind('mousewheel', fn); 49663 } 49664 });
vendor: 4,353 bytes, lines 49665-49773
49665 49666 49667 function handler(event) { 49668 var orgEvent = event || window.event, 49669 args = slice.call(arguments, 1), 49670 delta = 0, 49671 deltaX = 0, 49672 deltaY = 0, 49673 absDelta = 0, 49674 offsetX = 0, 49675 offsetY = 0; 49676 event = $.event.fix(orgEvent); 49677 event.type = 'mousewheel'; 49678 49679 // Old school scrollwheel delta 49680 if ( 'detail' in orgEvent ) { deltaY = orgEvent.detail * -1; } 49681 if ( 'wheelDelta' in orgEvent ) { deltaY = orgEvent.wheelDelta; } 49682 if ( 'wheelDeltaY' in orgEvent ) { deltaY = orgEvent.wheelDeltaY; } 49683 if ( 'wheelDeltaX' in orgEvent ) { deltaX = orgEvent.wheelDeltaX * -1; } 49684 49685 // Firefox < 17 horizontal scrolling related to DOMMouseScroll event 49686 if ( 'axis' in orgEvent && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) { 49687 deltaX = deltaY * -1; 49688 deltaY = 0; 49689 } 49690 49691 // Set delta to be deltaY or deltaX if deltaY is 0 for backwards compatabilitiy 49692 delta = deltaY === 0 ? deltaX : deltaY; 49693 49694 // New school wheel delta (wheel event) 49695 if ( 'deltaY' in orgEvent ) { 49696 deltaY = orgEvent.deltaY * -1; 49697 delta = deltaY; 49698 } 49699 if ( 'deltaX' in orgEvent ) { 49700 deltaX = orgEvent.deltaX; 49701 if ( deltaY === 0 ) { delta = deltaX * -1; } 49702 } 49703 49704 // No change actually happened, no reason to go any further 49705 if ( deltaY === 0 && deltaX === 0 ) { return; } 49706 49707 // Need to convert lines and pages to pixels if we aren't already in pixels 49708 // There are three delta modes: 49709 // * deltaMode 0 is by pixels, nothing to do 49710 // * deltaMode 1 is by lines 49711 // * deltaMode 2 is by pages 49712 if ( orgEvent.deltaMode === 1 ) { 49713 var lineHeight = $.data(this, 'mousewheel-line-height'); 49714 delta *= lineHeight; 49715 deltaY *= lineHeight; 49716 deltaX *= lineHeight; 49717 } else if ( orgEvent.deltaMode === 2 ) { 49718 var pageHeight = $.data(this, 'mousewheel-page-height'); 49719 delta *= pageHeight; 49720 deltaY *= pageHeight; 49721 deltaX *= pageHeight; 49722 } 49723 49724 // Store lowest absolute delta to normalize the delta values 49725 absDelta = Math.max( Math.abs(deltaY), Math.abs(deltaX) ); 49726 49727 if ( !lowestDelta || absDelta < lowestDelta ) { 49728 lowestDelta = absDelta; 49729 49730 // Adjust older deltas if necessary 49731 if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) { 49732 lowestDelta /= 40; 49733 } 49734 } 49735 49736 // Adjust older deltas if necessary 49737 if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) { 49738 // Divide all the things by 40! 49739 delta /= 40; 49740 deltaX /= 40; 49741 deltaY /= 40; 49742 } 49743 49744 // Get a whole, normalized value for the deltas 49745 delta = Math[ delta >= 1 ? 'floor' : 'ceil' ](delta / lowestDelta); 49746 deltaX = Math[ deltaX >= 1 ? 'floor' : 'ceil' ](deltaX / lowestDelta); 49747 deltaY = Math[ deltaY >= 1 ? 'floor' : 'ceil' ](deltaY / lowestDelta); 49748 49749 // Normalise offsetX and offsetY properties 49750 if ( special.settings.normalizeOffset && this.getBoundingClientRect ) { 49751 var boundingRect = this.getBoundingClientRect(); 49752 offsetX = event.clientX - boundingRect.left; 49753 offsetY = event.clientY - boundingRect.top; 49754 } 49755 49756 // Add information to the event object 49757 event.deltaX = deltaX; 49758 event.deltaY = deltaY; 49759 event.deltaFactor = lowestDelta; 49760 event.offsetX = offsetX; 49761 event.offsetY = offsetY; 49762 // Go ahead and set deltaMode to 0 since we converted to pixels 49763 // Although this is a little odd since we overwrite the deltaX/Y 49764 // properties with normalized deltas. 49765 event.deltaMode = 0; 49766 49767 // Add event and delta to the front of the arguments 49768 args.unshift(event, delta, deltaX, deltaY); 49769 49770 // Clearout lowestDelta after sometime to better 49771 // handle multiple device types that give different 49772 // a different lowestDelta 49773 // Ex: trackpad = 3 and mouse wheel = 120
49774 if (nullLowestDeltaTimeout) { clearTimeout(nullLowestDeltaTimeout); } 49775 nullLowestDeltaTimeout = setTimeout(nullLowestDelta, 200); 49776 49777 return ($.event.dispatch || $.event.handle).apply(this, args); 49778 } 49779 49780 function nullLowestDelta() { 49781 lowestDelta = null; 49782 } 49783 49784 function shouldAdjustOldDeltas(orgEvent, absDelta) { 49785 // If this is an older event and the delta is divisable by 120, 49786 // then we are assuming that the browser is treating this as an 49787 // older mouse wheel event and that we should divide the deltas 49788 // by 40 to try and get a more usable deltaFactor. 49789 // Side note, this actually impacts the reported scroll distance 49790 // in older browsers and can cause scrolling to be slower than native. 49791 // Turn this off by setting $.event.special.mousewheel.settings.adjustOldDeltas to false. 49792 return special.settings.adjustOldDeltas && orgEvent.type === 'mousewheel' && absDelta % 120 === 0; 49793 } 49794 49795})); 49796 49797S2.define('jquery.select2',[ 49798 'jquery', 49799 'jquery-mousewheel', 49800 49801 './select2/core', 49802 './select2/defaults' 49803], function ($, _, Select2, Defaults) { 49804 if ($.fn.select2 == null) { 49805 // All methods that should return the element 49806 var thisMethods = ['open', 'close', 'destroy']; 49807 49808 $.fn.select2 = function (options) { 49809 options = options || {}; 49810 49811 if (typeof options === 'object') { 49812 this.each(function () { 49813 var instanceOptions = $.extend(true, {}, options); 49814 49815 var instance = new Select2($(this), instanceOptions); 49816 }); 49817 49818 return this; 49819 } else if (typeof options === 'string') { 49820 var ret; 49821 var args = Array.prototype.slice.call(arguments, 1); 49822 49823 this.each(function () { 49824 var instance = $(this).data('select2'); 49825 49826 if (instance == null && window.console && console.error) { 49827 console.error( 49828 'The select2(\'' + options + '\') method was called on an ' + 49829 'element that is not using Select2.' 49830 ); 49831 } 49832 49833 ret = instance[options].apply(instance, args); 49834 }); 49835 49836 // Check if we should be returning `this` 49837 if ($.inArray(options, thisMethods) > -1) { 49838 return this; 49839 } 49840 49841 return ret; 49842 } else { 49843 throw new Error('Invalid arguments for Select2: ' + options); 49844 } 49845 }; 49846 } 49847 49848 if ($.fn.select2.defaults == null) { 49849 $.fn.select2.defaults = Defaults; 49850 } 49851 49852 return Select2; 49853}); 49854 49855 // Return the AMD loader configuration so it can be used outside of this file 49856 return { 49857 define: S2.define, 49858 require: S2.require 49859 }; 49860}()); 49861 49862 // Autoload the jQuery bindings 49863 // We know that all of the modules exist above this, so we're safe 49864 var select2 = S2.require('jquery.select2'); 49865 49866 // Hold the AMD module references on the jQuery function that was just loaded 49867 // This allows Select2 to use the internal loader outside of this file, such 49868 // as in the language files. 49869 jQuery.fn.select2.amd = S2; 49870 49871 // Return the Select2 instance for anyone who is importing it. 49872 return select2; 49873})); 49874; 49875/*! 49876 * iCheck v1.0.2, http://git.io/arlzeA 49877 * =================================== 49878 * Powerful jQuery and Zepto plugin for checkboxes and radio buttons customization 49879 * 49880 * (c) 2013 Damir Sultanov, http://fronteed.com 49881 * MIT Licensed 49882 */ 49883 49884(function($) { 49885 49886 // Cached vars 49887 var _iCheck = 'iCheck', 49888 _iCheckHelper = _iCheck + '-helper', 49889 _checkbox = 'checkbox', 49890 _radio = 'radio', 49891 _checked = 'checked', 49892 _unchecked = 'un' + _checked, 49893 _disabled = 'disabled', 49894 _determinate = 'determinate', 49895 _indeterminate = 'in' + _determinate, 49896 _update = 'update', 49897 _type = 'type', 49898 _click = 'click', 49899 _touch = 'touchbegin.i touchend.i', 49900 _add = 'addClass', 49901 _remove = 'removeClass', 49902 _callback = 'trigger', 49903 _label = 'label', 49904 _cursor = 'cursor', 49905 _mobile = /ipad|iphone|ipod|android|blackberry|windows phone|opera mini|silk/i.test(navigator.userAgent); 49906 49907 // Plugin init 49908 $.fn[_iCheck] = function(options, fire) { 49909 49910 // Walker 49911 var handle = 'input[type="' + _checkbox + '"], input[type="' + _radio + '"]', 49912 stack = $(), 49913 walker = function(object) { 49914 object.each(function() { 49915 var self = $(this); 49916 49917 if (self.is(handle)) { 49918 stack = stack.add(self); 49919 } else { 49920 stack = stack.add(self.find(handle)); 49921 } 49922 }); 49923 }; 49924 49925 // Check if we should operate with some method 49926 if (/^(check|uncheck|toggle|indeterminate|determinate|disable|enable|update|destroy)$/i.test(options)) { 49927 49928 // Normalize method's name 49929 options = options.toLowerCase(); 49930 49931 // Find checkboxes and radio buttons 49932 walker(this); 49933 49934 return stack.each(function() { 49935 var self = $(this); 49936 49937 if (options == 'destroy') { 49938 tidy(self, 'ifDestroyed'); 49939 } else { 49940 operate(self, true, options); 49941 } 49942 49943 // Fire method's callback 49944 if ($.isFunction(fire)) { 49945 fire(); 49946 } 49947 }); 49948 49949 // Customization 49950 } else if (typeof options == 'object' || !options) { 49951 49952 // Check if any options were passed 49953 var settings = $.extend({ 49954 checkedClass: _checked, 49955 disabledClass: _disabled, 49956 indeterminateClass: _indeterminate, 49957 labelHover: true 49958 }, options), 49959 49960 selector = settings.handle, 49961 hoverClass = settings.hoverClass || 'hover',
vendor: 9,312 bytes, lines 49962-50283
49962 focusClass = settings.focusClass || 'focus', 49963 activeClass = settings.activeClass || 'active', 49964 labelHover = !!settings.labelHover, 49965 labelHoverClass = settings.labelHoverClass || 'hover', 49966 49967 // Setup clickable area 49968 area = ('' + settings.increaseArea).replace('%', '') | 0; 49969 49970 // Selector limit 49971 if (selector == _checkbox || selector == _radio) { 49972 handle = 'input[type="' + selector + '"]'; 49973 } 49974 49975 // Clickable area limit 49976 if (area < -50) { 49977 area = -50; 49978 } 49979 49980 // Walk around the selector 49981 walker(this); 49982 49983 return stack.each(function() { 49984 var self = $(this); 49985 49986 // If already customized 49987 tidy(self); 49988 49989 var node = this, 49990 id = node.id, 49991 49992 // Layer styles 49993 offset = -area + '%', 49994 size = 100 + (area * 2) + '%', 49995 layer = { 49996 position: 'absolute', 49997 top: offset, 49998 left: offset, 49999 display: 'block', 50000 width: size, 50001 height: size, 50002 margin: 0, 50003 padding: 0, 50004 background: '#fff', 50005 border: 0, 50006 opacity: 0 50007 }, 50008 50009 // Choose how to hide input 50010 hide = _mobile ? { 50011 position: 'absolute', 50012 visibility: 'hidden' 50013 } : area ? layer : { 50014 position: 'absolute', 50015 opacity: 0 50016 }, 50017 50018 // Get proper class 50019 className = node[_type] == _checkbox ? settings.checkboxClass || 'i' + _checkbox : settings.radioClass || 'i' + _radio, 50020 50021 // Find assigned labels 50022 label = $(_label + '[for="' + id + '"]').add(self.closest(_label)), 50023 50024 // Check ARIA option 50025 aria = !!settings.aria, 50026 50027 // Set ARIA placeholder 50028 ariaID = _iCheck + '-' + Math.random().toString(36).substr(2,6), 50029 50030 // Parent & helper 50031 parent = '<div class="' + className + '" ' + (aria ? 'role="' + node[_type] + '" ' : ''), 50032 helper; 50033 50034 // Set ARIA "labelledby" 50035 if (aria) { 50036 label.each(function() { 50037 parent += 'aria-labelledby="'; 50038 50039 if (this.id) { 50040 parent += this.id; 50041 } else { 50042 this.id = ariaID; 50043 parent += ariaID; 50044 } 50045 50046 parent += '"'; 50047 }); 50048 } 50049 50050 // Wrap input 50051 parent = self.wrap(parent + '/>')[_callback]('ifCreated').parent().append(settings.insert); 50052 50053 // Layer addition 50054 helper = $('<ins class="' + _iCheckHelper + '"/>').css(layer).appendTo(parent); 50055 50056 // Finalize customization 50057 self.data(_iCheck, {o: settings, s: self.attr('style')}).css(hide); 50058 !!settings.inheritClass && parent[_add](node.className || ''); 50059 !!settings.inheritID && id && parent.attr('id', _iCheck + '-' + id); 50060 parent.css('position') == 'static' && parent.css('position', 'relative'); 50061 operate(self, true, _update); 50062 50063 // Label events 50064 if (label.length) { 50065 label.on(_click + '.i mouseover.i mouseout.i ' + _touch, function(event) { 50066 var type = event[_type], 50067 item = $(this); 50068 50069 // Do nothing if input is disabled 50070 if (!node[_disabled]) { 50071 50072 // Click 50073 if (type == _click) { 50074 if ($(event.target).is('a')) { 50075 return; 50076 } 50077 operate(self, false, true); 50078 50079 // Hover state 50080 } else if (labelHover) { 50081 50082 // mouseout|touchend 50083 if (/ut|nd/.test(type)) { 50084 parent[_remove](hoverClass); 50085 item[_remove](labelHoverClass); 50086 } else { 50087 parent[_add](hoverClass); 50088 item[_add](labelHoverClass); 50089 } 50090 } 50091 50092 if (_mobile) { 50093 event.stopPropagation(); 50094 } else { 50095 return false; 50096 } 50097 } 50098 }); 50099 } 50100 50101 // Input events 50102 self.on(_click + '.i focus.i blur.i keyup.i keydown.i keypress.i', function(event) { 50103 var type = event[_type], 50104 key = event.keyCode; 50105 50106 // Click 50107 if (type == _click) { 50108 return false; 50109 50110 // Keydown 50111 } else if (type == 'keydown' && key == 32) { 50112 if (!(node[_type] == _radio && node[_checked])) { 50113 if (node[_checked]) { 50114 off(self, _checked); 50115 } else { 50116 on(self, _checked); 50117 } 50118 } 50119 50120 return false; 50121 50122 // Keyup 50123 } else if (type == 'keyup' && node[_type] == _radio) { 50124 !node[_checked] && on(self, _checked); 50125 50126 // Focus/blur 50127 } else if (/us|ur/.test(type)) { 50128 parent[type == 'blur' ? _remove : _add](focusClass); 50129 } 50130 }); 50131 50132 // Helper events 50133 helper.on(_click + ' mousedown mouseup mouseover mouseout ' + _touch, function(event) { 50134 var type = event[_type], 50135 50136 // mousedown|mouseup 50137 toggle = /wn|up/.test(type) ? activeClass : hoverClass; 50138 50139 // Do nothing if input is disabled 50140 if (!node[_disabled]) { 50141 50142 // Click 50143 if (type == _click) { 50144 operate(self, false, true); 50145 50146 // Active and hover states 50147 } else { 50148 50149 // State is on 50150 if (/wn|er|in/.test(type)) { 50151 50152 // mousedown|mouseover|touchbegin 50153 parent[_add](toggle); 50154 50155 // State is off 50156 } else { 50157 parent[_remove](toggle + ' ' + activeClass); 50158 } 50159 50160 // Label hover 50161 if (label.length && labelHover && toggle == hoverClass) { 50162 50163 // mouseout|touchend 50164 label[/ut|nd/.test(type) ? _remove : _add](labelHoverClass); 50165 } 50166 } 50167 50168 if (_mobile) { 50169 event.stopPropagation(); 50170 } else { 50171 return false; 50172 } 50173 } 50174 }); 50175 }); 50176 } else { 50177 return this; 50178 } 50179 }; 50180 50181 // Do something with inputs 50182 function operate(input, direct, method) { 50183 var node = input[0], 50184 state = /er/.test(method) ? _indeterminate : /bl/.test(method) ? _disabled : _checked, 50185 active = method == _update ? { 50186 checked: node[_checked], 50187 disabled: node[_disabled], 50188 indeterminate: input.attr(_indeterminate) == 'true' || input.attr(_determinate) == 'false' 50189 } : node[state]; 50190 50191 // Check, disable or indeterminate 50192 if (/^(ch|di|in)/.test(method) && !active) { 50193 on(input, state); 50194 50195 // Uncheck, enable or determinate 50196 } else if (/^(un|en|de)/.test(method) && active) { 50197 off(input, state); 50198 50199 // Update 50200 } else if (method == _update) { 50201 50202 // Handle states 50203 for (var each in active) { 50204 if (active[each]) { 50205 on(input, each, true); 50206 } else { 50207 off(input, each, true); 50208 } 50209 } 50210 50211 } else if (!direct || method == 'toggle') { 50212 50213 // Helper or label was clicked 50214 if (!direct) { 50215 input[_callback]('ifClicked'); 50216 } 50217 50218 // Toggle checked state 50219 if (active) { 50220 if (node[_type] !== _radio) { 50221 off(input, state); 50222 } 50223 } else { 50224 on(input, state); 50225 } 50226 } 50227 } 50228 50229 // Add checked, disabled or indeterminate state 50230 function on(input, state, keep) { 50231 var node = input[0], 50232 parent = input.parent(), 50233 checked = state == _checked, 50234 indeterminate = state == _indeterminate, 50235 disabled = state == _disabled, 50236 callback = indeterminate ? _determinate : checked ? _unchecked : 'enabled', 50237 regular = option(input, callback + capitalize(node[_type])), 50238 specific = option(input, state + capitalize(node[_type])); 50239 50240 // Prevent unnecessary actions 50241 if (node[state] !== true) { 50242 50243 // Toggle assigned radio buttons 50244 if (!keep && state == _checked && node[_type] == _radio && node.name) { 50245 var form = input.closest('form'), 50246 inputs = 'input[name="' + node.name + '"]'; 50247 50248 inputs = form.length ? form.find(inputs) : $(inputs); 50249 50250 inputs.each(function() { 50251 if (this !== node && $(this).data(_iCheck)) { 50252 off($(this), state); 50253 } 50254 }); 50255 } 50256 50257 // Indeterminate state 50258 if (indeterminate) { 50259 50260 // Add indeterminate state 50261 node[state] = true; 50262 50263 // Remove checked state 50264 if (node[_checked]) { 50265 off(input, _checked, 'force'); 50266 } 50267 50268 // Checked or disabled state 50269 } else { 50270 50271 // Add checked or disabled state 50272 if (!keep) { 50273 node[state] = true; 50274 } 50275 50276 // Remove indeterminate state 50277 if (checked && node[_indeterminate]) { 50278 off(input, _indeterminate, false); 50279 } 50280 } 50281 50282 // Trigger callbacks 50283 callbacks(input, checked, state, keep);
50284 } 50285 50286 // Add proper cursor 50287 if (node[_disabled] && !!option(input, _cursor, true)) { 50288 parent.find('.' + _iCheckHelper).css(_cursor, 'default'); 50289 } 50290 50291 // Add state class 50292 parent[_add](specific || option(input, state) || ''); 50293 50294 // Set ARIA attribute 50295 if (!!parent.attr('role') && !indeterminate) { 50296 parent.attr('aria-' + (disabled ? _disabled : _checked), 'true'); 50297 } 50298 50299 // Remove regular state class 50300 parent[_remove](regular || option(input, callback) || ''); 50301 } 50302 50303 // Remove checked, disabled or indeterminate state 50304 function off(input, state, keep) { 50305 var node = input[0], 50306 parent = input.parent(), 50307 checked = state == _checked, 50308 indeterminate = state == _indeterminate, 50309 disabled = state == _disabled, 50310 callback = indeterminate ? _determinate : checked ? _unchecked : 'enabled', 50311 regular = option(input, callback + capitalize(node[_type])), 50312 specific = option(input, state + capitalize(node[_type])); 50313 50314 // Prevent unnecessary actions 50315 if (node[state] !== false) { 50316 50317 // Toggle state 50318 if (indeterminate || !keep || keep == 'force') { 50319 node[state] = false; 50320 } 50321 50322 // Trigger callbacks 50323 callbacks(input, checked, callback, keep); 50324 } 50325 50326 // Add proper cursor 50327 if (!node[_disabled] && !!option(input, _cursor, true)) { 50328 parent.find('.' + _iCheckHelper).css(_cursor, 'pointer'); 50329 } 50330 50331 // Remove state class 50332 parent[_remove](specific || option(input, state) || ''); 50333 50334 // Set ARIA attribute 50335 if (!!parent.attr('role') && !indeterminate) { 50336 parent.attr('aria-' + (disabled ? _disabled : _checked), 'false'); 50337 } 50338 50339 // Add regular state class 50340 parent[_add](regular || option(input, callback) || ''); 50341 } 50342 50343 // Remove all traces 50344 function tidy(input, callback) { 50345 if (input.data(_iCheck)) { 50346 50347 // Remove everything except input 50348 input.parent().html(input.attr('style', input.data(_iCheck).s || '')); 50349 50350 // Callback 50351 if (callback) { 50352 input[_callback](callback); 50353 } 50354 50355 // Unbind events 50356 input.off('.i').unwrap(); 50357 $(_label + '[for="' + input[0].id + '"]').add(input.closest(_label)).off('.i'); 50358 } 50359 } 50360 50361 // Get some option 50362 function option(input, state, regular) { 50363 if (input.data(_iCheck)) { 50364 return input.data(_iCheck).o[state + (regular ? '' : 'Class')]; 50365 } 50366 } 50367 50368 // Capitalize some string 50369 function capitalize(string) { 50370 return string.charAt(0).toUpperCase() + string.slice(1); 50371 } 50372 50373 // Executable handlers 50374 function callbacks(input, checked, callback, keep) { 50375 if (!keep) { 50376 if (checked) { 50377 input[_callback]('ifToggled'); 50378 } 50379 50380 input[_callback]('ifChanged')[_callback]('if' + capitalize(callback)); 50381 } 50382 } 50383})(window.jQuery || window.Zepto); 50384; 50385/*! 50386 * numeral.js 50387 * version : 1.5.3 50388 * author : Adam Draper 50389 * license : MIT 50390 * http://adamwdraper.github.com/Numeral-js/ 50391 */ 50392(function(){function a(a){this._value=a}function b(a,b,c,d){var e,f,g=Math.pow(10,b);return f=(c(a*g)/g).toFixed(b),d&&(e=new RegExp("0{1,"+d+"}$"),f=f.replace(e,"")),f}function c(a,b,c){var d;return d=b.indexOf("$")>-1?e(a,b,c):b.indexOf("%")>-1?f(a,b,c):b.indexOf(":")>-1?g(a,b):i(a._value,b,c)}function d(a,b){var c,d,e,f,g,i=b,j=["KB","MB","GB","TB","PB","EB","ZB","YB"],k=!1;if(b.indexOf(":")>-1)a._value=h(b);else if(b===q)a._value=0;else{for("."!==o[p].delimiters.decimal&&(b=b.replace(/\./g,"").replace(o[p].delimiters.decimal,".")),c=new RegExp("[^a-zA-Z]"+o[p].abbreviations.thousand+"(?:\\)|(\\"+o[p].currency.symbol+")?(?:\\))?)?$"),d=new RegExp("[^a-zA-Z]"+o[p].abbreviations.million+"(?:\\)|(\\"+o[p].currency.symbol+")?(?:\\))?)?$"),e=new RegExp("[^a-zA-Z]"+o[p].abbreviations.billion+"(?:\\)|(\\"+o[p].currency.symbol+")?(?:\\))?)?$"),f=new RegExp("[^a-zA-Z]"+o[p].abbreviations.trillion+"(?:\\)|(\\"+o[p].currency.symbol+")?(?:\\))?)?$"),g=0;g<=j.length&&!(k=b.indexOf(j[g])>-1?Math.pow(1024,g+1):!1);g++);a._value=(k?k:1)*(i.match(c)?Math.pow(10,3):1)*(i.match(d)?Math.pow(10,6):1)*(i.match(e)?Math.pow(10,9):1)*(i.match(f)?Math.pow(10,12):1)*(b.indexOf("%")>-1?.01:1)*((b.split("-").length+Math.min(b.split("(").length-1,b.split(")").length-1))%2?1:-1)*Number(b.replace(/[^0-9\.]+/g,"")),a._value=k?Math.ceil(a._value):a._value}return a._value}function e(a,b,c){var d,e,f=b.indexOf("$"),g=b.indexOf("("),h=b.indexOf("-"),j="";return b.indexOf(" $")>-1?(j=" ",b=b.replace(" $","")):b.indexOf("$ ")>-1?(j=" ",b=b.replace("$ ","")):b=b.replace("$",""),e=i(a._value,b,c),1>=f?e.indexOf("(")>-1||e.indexOf("-")>-1?(e=e.split(""),d=1,(g>f||h>f)&&(d=0),e.splice(d,0,o[p].currency.symbol+j),e=e.join("")):e=o[p
vendor: 5,142 bytes, line 50392
50392].currency.symbol+j+e:e.indexOf(")")>-1?(e=e.split(""),e.splice(-1,0,j+o[p].currency.symbol),e=e.join("")):e=e+j+o[p].currency.symbol,e}function f(a,b,c){var d,e="",f=100*a._value;return b.indexOf(" %")>-1?(e=" ",b=b.replace(" %","")):b=b.replace("%",""),d=i(f,b,c),d.indexOf(")")>-1?(d=d.split(""),d.splice(-1,0,e+"%"),d=d.join("")):d=d+e+"%",d}function g(a){var b=Math.floor(a._value/60/60),c=Math.floor((a._value-60*b*60)/60),d=Math.round(a._value-60*b*60-60*c);return b+":"+(10>c?"0"+c:c)+":"+(10>d?"0"+d:d)}function h(a){var b=a.split(":"),c=0;return 3===b.length?(c+=60*Number(b[0])*60,c+=60*Number(b[1]),c+=Number(b[2])):2===b.length&&(c+=60*Number(b[0]),c+=Number(b[1])),Number(c)}function i(a,c,d){var e,f,g,h,i,j,k=!1,l=!1,m=!1,n="",r=!1,s=!1,t=!1,u=!1,v=!1,w="",x="",y=Math.abs(a),z=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],A="",B=!1;if(0===a&&null!==q)return q;if(c.indexOf("(")>-1?(k=!0,c=c.slice(1,-1)):c.indexOf("+")>-1&&(l=!0,c=c.replace(/\+/g,"")),c.indexOf("a")>-1&&(r=c.indexOf("aK")>=0,s=c.indexOf("aM")>=0,t=c.indexOf("aB")>=0,u=c.indexOf("aT")>=0,v=r||s||t||u,c.indexOf(" a")>-1?(n=" ",c=c.replace(" a","")):c=c.replace("a",""),y>=Math.pow(10,12)&&!v||u?(n+=o[p].abbreviations.trillion,a/=Math.pow(10,12)):y<Math.pow(10,12)&&y>=Math.pow(10,9)&&!v||t?(n+=o[p].abbreviations.billion,a/=Math.pow(10,9)):y<Math.pow(10,9)&&y>=Math.pow(10,6)&&!v||s?(n+=o[p].abbreviations.million,a/=Math.pow(10,6)):(y<Math.pow(10,6)&&y>=Math.pow(10,3)&&!v||r)&&(n+=o[p].abbreviations.thousand,a/=Math.pow(10,3))),c.indexOf("b")>-1)for(c.indexOf(" b")>-1?(w=" ",c=c.replace(" b","")):c=c.replace("b",""),g=0;g<=z.length;g++)if(e=Math.pow(1024,g),f=Math.pow(1024,g+1),a>=e&&f>a){w+=z[g],e>0&&(a/=e);break}return c.indexOf("o")>-1&&(c.indexOf(" o")>-1?(x=" ",c=c.replace(" o","")):c=c.replace("o",""),x+=o[p].ordinal(a)),c.indexOf("[.]")>-1&&(m=!0,c=c.replace("[.]",".")),h=a.toString().split(".")[0],i=c.split(".")[1],j=c.indexOf(","),i?(i.indexOf("[")>-1?(i=i.replace("]",""),i=i.split("["),A=b(a,i[0].length+i[1].length,d,i[1].length)):A=b(a,i.length,d),h=A.split(".")[0],A=A.split(".")[1].length?o[p].delimiters.decimal+A.split(".")[1]:"",m&&0===Number(A.slice(1))&&(A="")):h=b(a,null,d),h.indexOf("-")>-1&&(h=h.slice(1),B=!0),j>-1&&(h=h.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+o[p].delimiters.thousands)),0===c.indexOf(".")&&(h=""),(k&&B?"(":"")+(!k&&B?"-":"")+(!B&&l?"+":"")+h+A+(x?x:"")+(n?n:"")+(w?w:"")+(k&&B?")":"")}function j(a,b){o[a]=b}function k(a){var b=a.toString().split(".");return b.length<2?1:Math.pow(10,b[1].length)}function l(){var a=Array.prototype.slice.call(arguments);return a.reduce(function(a,b){var c=k(a),d=k(b);return c>d?c:d},-1/0)}var m,n="1.5.3",o={},p="en",q=null,r="0,0",s="undefined"!=typeof module&&module.exports;m=function(b){return m.isNumeral(b)?b=b.value():0===b||"undefined"==typeof b?b=0:Number(b)||(b=m.fn.unformat(b)),new a(Number(b))},m.version=n,m.isNumeral=function(b){return b instanceof a},m.language=function(a,b){if(!a)return p;if(a&&!b){if(!o[a])throw new Error("Unknown language : "+a);p=a}return(b||!o[a])&&j(a,b),m},m.languageData=function(a){if(!a)return o[p];if(!o[a])throw new Error("Unknown language : "+a);return o[a]},m.language("en",{delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(a){var b=a%10;return 1===~~(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th"},currency:{symbol:"$"}}),m.zeroFormat=function(a){q="string"==typeof a?a:null},m.defaultFormat=function(a){r="string"==typeof a?a:"0.0"},"function"!=typeof Array.prototype.reduce&&(Array.prototype.reduce=function(a,b){"use strict";if(null===this||"undefined"==typeof this)throw new TypeError("Array.prototype.reduce called on null or undefined");if("function"!=typeof a)throw new TypeError(a+" is not a function");var c,d,e=this.length>>>0,f=!1;for(1<arguments.length&&(d=b,f=!0),c=0;e>c;++c)this.hasOwnProperty(c)&&(f?d=a(d,this[c],c,this):(d=this[c],f=!0));if(!f)throw new TypeError("Reduce of empty array with no initial value");return d}),m.fn=a.prototype={clone:function(){return m(this)},format:function(a,b){return c(this,a?a:r,void 0!==b?b:Math.round)},unformat:function(a){return"[object Number]"===Object.prototype.toString.call(a)?a:d(this,a?a:r)},value:function(){return this._value},valueOf:function(){return this._value},set:function(a){return this._value=Number(a),this},add:function(a){function b(a,b){return a+c*b}var c=l.call(null,this._value,a);return this._value=[this._value,a].reduce(b,0)/c,this},subtract:function(a){function b(a,b){return a-c*b}var c=l.call(null,this._value,a);return this._value=[a].reduce(b,this._value*c)/c,this},multiply:function(a){function b(a,b){var c=l(a,b);return a*c*b*c/(c*c)}return this._value=[this._value,a].reduce(b,1),this},divide:function(a){function b(a,b){var c=l(a,b);return a*c/(b*c)}return this._value=[this._value,a].reduce(b),this},difference:function(a){return Math.abs(m(this._value).subtract(a).value())}},s&&(module.exports=m),"undefined"==typeof ender&&(this.numeral=m),"function"==typeof define&&define.amd&&define([],function(){return m})}).call(this);;
vendor: 10,224 bytes, lines 50393-50691
50393/*! 50394 * jQuery blockUI plugin 50395 * Version 2.70.0-2014.11.23 50396 * Requires jQuery v1.7 or later 50397 * 50398 * Examples at: http://malsup.com/jquery/block/ 50399 * Copyright (c) 2007-2013 M. Alsup 50400 * Dual licensed under the MIT and GPL licenses: 50401 * http://www.opensource.org/licenses/mit-license.php 50402 * http://www.gnu.org/licenses/gpl.html 50403 * 50404 * Thanks to Amir-Hossein Sobhi for some excellent contributions! 50405 */ 50406 50407;(function() { 50408/*jshint eqeqeq:false curly:false latedef:false */ 50409"use strict"; 50410 50411 function setup($) { 50412 $.fn._fadeIn = $.fn.fadeIn; 50413 50414 var noOp = $.noop || function() {}; 50415 50416 // this bit is to ensure we don't call setExpression when we shouldn't (with extra muscle to handle 50417 // confusing userAgent strings on Vista) 50418 var msie = /MSIE/.test(navigator.userAgent); 50419 var ie6 = /MSIE 6.0/.test(navigator.userAgent) && ! /MSIE 8.0/.test(navigator.userAgent); 50420 var mode = document.documentMode || 0; 50421 var setExpr = $.isFunction( document.createElement('div').style.setExpression ); 50422 50423 // global $ methods for blocking/unblocking the entire page 50424 $.blockUI = function(opts) { install(window, opts); }; 50425 $.unblockUI = function(opts) { remove(window, opts); }; 50426 50427 // convenience method for quick growl-like notifications (http://www.google.com/search?q=growl) 50428 $.growlUI = function(title, message, timeout, onClose) { 50429 var $m = $('<div class="growlUI"></div>'); 50430 if (title) $m.append('<h1>'+title+'</h1>'); 50431 if (message) $m.append('<h2>'+message+'</h2>'); 50432 if (timeout === undefined) timeout = 3000; 50433 50434 // Added by konapun: Set timeout to 30 seconds if this growl is moused over, like normal toast notifications 50435 var callBlock = function(opts) { 50436 opts = opts || {}; 50437 50438 $.blockUI({ 50439 message: $m, 50440 fadeIn : typeof opts.fadeIn !== 'undefined' ? opts.fadeIn : 700, 50441 fadeOut: typeof opts.fadeOut !== 'undefined' ? opts.fadeOut : 1000, 50442 timeout: typeof opts.timeout !== 'undefined' ? opts.timeout : timeout, 50443 centerY: false, 50444 showOverlay: false, 50445 onUnblock: onClose, 50446 css: $.blockUI.defaults.growlCSS 50447 }); 50448 }; 50449 50450 callBlock(); 50451 var nonmousedOpacity = $m.css('opacity'); 50452 $m.mouseover(function() { 50453 callBlock({ 50454 fadeIn: 0, 50455 timeout: 30000 50456 }); 50457 50458 var displayBlock = $('.blockMsg'); 50459 displayBlock.stop(); // cancel fadeout if it has started 50460 displayBlock.fadeTo(300, 1); // make it easier to read the message by removing transparency 50461 }).mouseout(function() { 50462 $('.blockMsg').fadeOut(1000); 50463 }); 50464 // End konapun additions 50465 }; 50466 50467 // plugin method for blocking element content 50468 $.fn.block = function(opts) { 50469 if ( this[0] === window ) { 50470 $.blockUI( opts ); 50471 return this; 50472 } 50473 var fullOpts = $.extend({}, $.blockUI.defaults, opts || {}); 50474 this.each(function() { 50475 var $el = $(this); 50476 if (fullOpts.ignoreIfBlocked && $el.data('blockUI.isBlocked')) 50477 return; 50478 $el.unblock({ fadeOut: 0 }); 50479 }); 50480 50481 return this.each(function() { 50482 if ($.css(this,'position') == 'static') { 50483 this.style.position = 'relative'; 50484 $(this).data('blockUI.static', true); 50485 } 50486 this.style.zoom = 1; // force 'hasLayout' in ie 50487 install(this, opts); 50488 }); 50489 }; 50490 50491 // plugin method for unblocking element content 50492 $.fn.unblock = function(opts) { 50493 if ( this[0] === window ) { 50494 $.unblockUI( opts ); 50495 return this; 50496 } 50497 return this.each(function() { 50498 remove(this, opts); 50499 }); 50500 }; 50501 50502 $.blockUI.version = 2.70; // 2nd generation blocking at no extra cost! 50503 50504 // override these in your code to change the default behavior and style 50505 $.blockUI.defaults = { 50506 // message displayed when blocking (use null for no message) 50507 message: '<h1>Please wait...</h1>', 50508 50509 title: null, // title string; only used when theme == true 50510 draggable: true, // only used when theme == true (requires jquery-ui.js to be loaded) 50511 50512 theme: false, // set to true to use with jQuery UI themes 50513 50514 // styles for the message when blocking; if you wish to disable 50515 // these and use an external stylesheet then do this in your code: 50516 // $.blockUI.defaults.css = {}; 50517 css: { 50518 padding: 0, 50519 margin: 0, 50520 width: '30%', 50521 top: '40%', 50522 left: '35%', 50523 textAlign: 'center', 50524 color: '#000', 50525 border: '3px solid #aaa', 50526 backgroundColor:'#fff', 50527 cursor: 'wait' 50528 }, 50529 50530 // minimal style set used when themes are used 50531 themedCSS: { 50532 width: '30%', 50533 top: '40%', 50534 left: '35%' 50535 }, 50536 50537 // styles for the overlay 50538 overlayCSS: { 50539 backgroundColor: '#000', 50540 opacity: 0.6, 50541 cursor: 'wait' 50542 }, 50543 50544 // style to replace wait cursor before unblocking to correct issue 50545 // of lingering wait cursor 50546 cursorReset: 'default', 50547 50548 // styles applied when using $.growlUI 50549 growlCSS: { 50550 width: '350px', 50551 top: '10px', 50552 left: '', 50553 right: '10px', 50554 border: 'none', 50555 padding: '5px', 50556 opacity: 0.6, 50557 cursor: 'default', 50558 color: '#fff', 50559 backgroundColor: '#000', 50560 '-webkit-border-radius':'10px', 50561 '-moz-border-radius': '10px', 50562 'border-radius': '10px' 50563 }, 50564 50565 // IE issues: 'about:blank' fails on HTTPS and javascript:false is s-l-o-w 50566 // (hat tip to Jorge H. N. de Vasconcelos) 50567 /*jshint scripturl:true */ 50568 iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank', 50569 50570 // force usage of iframe in non-IE browsers (handy for blocking applets) 50571 forceIframe: false, 50572 50573 // z-index for the blocking overlay 50574 baseZ: 1000, 50575 50576 // set these to true to have the message automatically centered 50577 centerX: true, // <-- only effects element blocking (page block controlled via css above) 50578 centerY: true, 50579 50580 // allow body element to be stetched in ie6; this makes blocking look better 50581 // on "short" pages. disable if you wish to prevent changes to the body height 50582 allowBodyStretch: true, 50583 50584 // enable if you want key and mouse events to be disabled for content that is blocked 50585 bindEvents: true, 50586 50587 // be default blockUI will supress tab navigation from leaving blocking content 50588 // (if bindEvents is true) 50589 constrainTabKey: true, 50590 50591 // fadeIn time in millis; set to 0 to disable fadeIn on block 50592 fadeIn: 200, 50593 50594 // fadeOut time in millis; set to 0 to disable fadeOut on unblock 50595 fadeOut: 400, 50596 50597 // time in millis to wait before auto-unblocking; set to 0 to disable auto-unblock 50598 timeout: 0, 50599 50600 // disable if you don't want to show the overlay 50601 showOverlay: true, 50602 50603 // if true, focus will be placed in the first available input field when 50604 // page blocking 50605 focusInput: true, 50606 50607 // elements that can receive focus 50608 focusableElements: ':input:enabled:visible', 50609 50610 // suppresses the use of overlay styles on FF/Linux (due to performance issues with opacity) 50611 // no longer needed in 2012 50612 // applyPlatformOpacityRules: true, 50613 50614 // callback method invoked when fadeIn has completed and blocking message is visible 50615 onBlock: null, 50616 50617 // callback method invoked when unblocking has completed; the callback is 50618 // passed the element that has been unblocked (which is the window object for page 50619 // blocks) and the options that were passed to the unblock call: 50620 // onUnblock(element, options) 50621 onUnblock: null, 50622 50623 // callback method invoked when the overlay area is clicked. 50624 // setting this will turn the cursor to a pointer, otherwise cursor defined in overlayCss will be used. 50625 onOverlayClick: null, 50626 50627 // don't ask; if you really must know: http://groups.google.com/group/jquery-en/browse_thread/thread/36640a8730503595/2f6a79a77a78e493#2f6a79a77a78e493 50628 quirksmodeOffsetHack: 4, 50629 50630 // class name of the message block 50631 blockMsgClass: 'blockMsg', 50632 50633 // if it is already blocked, then ignore it (don't unblock and reblock) 50634 ignoreIfBlocked: false 50635 }; 50636 50637 // private data and functions follow... 50638 50639 var pageBlock = null; 50640 var pageBlockEls = []; 50641 50642 function install(el, opts) { 50643 var css, themedCSS; 50644 var full = (el == window); 50645 var msg = (opts && opts.message !== undefined ? opts.message : undefined); 50646 opts = $.extend({}, $.blockUI.defaults, opts || {}); 50647 50648 if (opts.ignoreIfBlocked && $(el).data('blockUI.isBlocked')) 50649 return; 50650 50651 opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {}); 50652 css = $.extend({}, $.blockUI.defaults.css, opts.css || {}); 50653 if (opts.onOverlayClick) 50654 opts.overlayCSS.cursor = 'pointer'; 50655 50656 themedCSS = $.extend({}, $.blockUI.defaults.themedCSS, opts.themedCSS || {}); 50657 msg = msg === undefined ? opts.message : msg; 50658 50659 // remove the current block (if there is one) 50660 if (full && pageBlock) 50661 remove(window, {fadeOut:0}); 50662 50663 // if an existing element is being used as the blocking content then we capture 50664 // its current place in the DOM (and current display style) so we can restore 50665 // it when we unblock 50666 if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) { 50667 var node = msg.jquery ? msg[0] : msg; 50668 var data = {}; 50669 $(el).data('blockUI.history', data); 50670 data.el = node; 50671 data.parent = node.parentNode; 50672 data.display = node.style.display; 50673 data.position = node.style.position; 50674 if (data.parent) 50675 data.parent.removeChild(node); 50676 } 50677 50678 $(el).data('blockUI.onUnblock', opts.onUnblock); 50679 var z = opts.baseZ; 50680 50681 // blockUI uses 3 layers for blocking, for simplicity they are all used on every platform; 50682 // layer1 is the iframe layer which is used to supress bleed through of underlying content 50683 // layer2 is the overlay layer which has opacity and a wait cursor (by default) 50684 // layer3 is the message content that is displayed while blocking 50685 var lyr1, lyr2, lyr3, s; 50686 if (msie || opts.forceIframe) 50687 lyr1 = $('<iframe class="blockUI" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+opts.iframeSrc+'"></iframe>'); 50688 else 50689 lyr1 = $('<div class="blockUI" style="display:none"></div>'); 50690 50691 if (opts.theme)
vendor: 5,126 bytes, lines 50692-50823
50692 lyr2 = $('<div class="blockUI blockOverlay ui-widget-overlay" style="z-index:'+ (z++) +';display:none"></div>'); 50693 else 50694 lyr2 = $('<div class="blockUI blockOverlay" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>'); 50695 50696 if (opts.theme && full) { 50697 s = '<div class="blockUI ' + opts.blockMsgClass + ' blockPage ui-dialog ui-widget ui-corner-all" style="z-index:'+(z+10)+';display:none;position:fixed">'; 50698 if ( opts.title ) { 50699 s += '<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(opts.title || ' ')+'</div>'; 50700 } 50701 s += '<div class="ui-widget-content ui-dialog-content"></div>'; 50702 s += '</div>'; 50703 } 50704 else if (opts.theme) { 50705 s = '<div class="blockUI ' + opts.blockMsgClass + ' blockElement ui-dialog ui-widget ui-corner-all" style="z-index:'+(z+10)+';display:none;position:absolute">'; 50706 if ( opts.title ) { 50707 s += '<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(opts.title || ' ')+'</div>'; 50708 } 50709 s += '<div class="ui-widget-content ui-dialog-content"></div>'; 50710 s += '</div>'; 50711 } 50712 else if (full) { 50713 s = '<div class="blockUI ' + opts.blockMsgClass + ' blockPage" style="z-index:'+(z+10)+';display:none;position:fixed"></div>'; 50714 } 50715 else { 50716 s = '<div class="blockUI ' + opts.blockMsgClass + ' blockElement" style="z-index:'+(z+10)+';display:none;position:absolute"></div>'; 50717 } 50718 lyr3 = $(s); 50719 50720 // if we have a message, style it 50721 if (msg) { 50722 if (opts.theme) { 50723 lyr3.css(themedCSS); 50724 lyr3.addClass('ui-widget-content'); 50725 } 50726 else 50727 lyr3.css(css); 50728 } 50729 50730 // style the overlay 50731 if (!opts.theme /*&& (!opts.applyPlatformOpacityRules)*/) 50732 lyr2.css(opts.overlayCSS); 50733 lyr2.css('position', full ? 'fixed' : 'absolute'); 50734 50735 // make iframe layer transparent in IE 50736 if (msie || opts.forceIframe) 50737 lyr1.css('opacity',0.0); 50738 50739 //$([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full ? 'body' : el); 50740 var layers = [lyr1,lyr2,lyr3], $par = full ? $('body') : $(el); 50741 $.each(layers, function() { 50742 this.appendTo($par); 50743 }); 50744 50745 if (opts.theme && opts.draggable && $.fn.draggable) { 50746 lyr3.draggable({ 50747 handle: '.ui-dialog-titlebar', 50748 cancel: 'li' 50749 }); 50750 } 50751 50752 // ie7 must use absolute positioning in quirks mode and to account for activex issues (when scrolling) 50753 var expr = setExpr && (!$.support.boxModel || $('object,embed', full ? null : el).length > 0); 50754 if (ie6 || expr) { 50755 // give body 100% height 50756 if (full && opts.allowBodyStretch && $.support.boxModel) 50757 $('html,body').css('height','100%'); 50758 50759 // fix ie6 issue when blocked element has a border width 50760 if ((ie6 || !$.support.boxModel) && !full) { 50761 var t = sz(el,'borderTopWidth'), l = sz(el,'borderLeftWidth'); 50762 var fixT = t ? '(0 - '+t+')' : 0; 50763 var fixL = l ? '(0 - '+l+')' : 0; 50764 } 50765 50766 // simulate fixed position 50767 $.each(layers, function(i,o) { 50768 var s = o[0].style; 50769 s.position = 'absolute'; 50770 if (i < 2) { 50771 if (full) 50772 s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.support.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"'); 50773 else 50774 s.setExpression('height','this.parentNode.offsetHeight + "px"'); 50775 if (full) 50776 s.setExpression('width','jQuery.support.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"'); 50777 else 50778 s.setExpression('width','this.parentNode.offsetWidth + "px"'); 50779 if (fixL) s.setExpression('left', fixL); 50780 if (fixT) s.setExpression('top', fixT); 50781 } 50782 else if (opts.centerY) { 50783 if (full) s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"'); 50784 s.marginTop = 0; 50785 } 50786 else if (!opts.centerY && full) { 50787 var top = (opts.css && opts.css.top) ? parseInt(opts.css.top, 10) : 0; 50788 var expression = '((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"'; 50789 s.setExpression('top',expression); 50790 } 50791 }); 50792 } 50793 50794 // show the message 50795 if (msg) { 50796 if (opts.theme) 50797 lyr3.find('.ui-widget-content').append(msg); 50798 else 50799 lyr3.append(msg); 50800 if (msg.jquery || msg.nodeType) 50801 $(msg).show(); 50802 } 50803 50804 if ((msie || opts.forceIframe) && opts.showOverlay) 50805 lyr1.show(); // opacity is zero 50806 if (opts.fadeIn) { 50807 var cb = opts.onBlock ? opts.onBlock : noOp; 50808 var cb1 = (opts.showOverlay && !msg) ? cb : noOp; 50809 var cb2 = msg ? cb : noOp; 50810 if (opts.showOverlay) 50811 lyr2._fadeIn(opts.fadeIn, cb1); 50812 if (msg) 50813 lyr3._fadeIn(opts.fadeIn, cb2); 50814 } 50815 else { 50816 if (opts.showOverlay) 50817 lyr2.show(); 50818 if (msg) 50819 lyr3.show(); 50820 if (opts.onBlock) 50821 opts.onBlock.bind(lyr3)(); 50822 } 50823
vendor: 5,236 bytes, lines 50824-51012
50824 // bind key and mouse events 50825 bind(1, el, opts); 50826 50827 if (full) { 50828 pageBlock = lyr3[0]; 50829 pageBlockEls = $(opts.focusableElements,pageBlock); 50830 if (opts.focusInput) 50831 setTimeout(focus, 20); 50832 } 50833 else 50834 center(lyr3[0], opts.centerX, opts.centerY); 50835 50836 if (opts.timeout) { 50837 // auto-unblock 50838 var to = setTimeout(function() { 50839 if (full) 50840 $.unblockUI(opts); 50841 else 50842 $(el).unblock(opts); 50843 }, opts.timeout); 50844 $(el).data('blockUI.timeout', to); 50845 } 50846 } 50847 50848 // remove the block 50849 function remove(el, opts) { 50850 var count; 50851 var full = (el == window); 50852 var $el = $(el); 50853 var data = $el.data('blockUI.history'); 50854 var to = $el.data('blockUI.timeout'); 50855 if (to) { 50856 clearTimeout(to); 50857 $el.removeData('blockUI.timeout'); 50858 } 50859 opts = $.extend({}, $.blockUI.defaults, opts || {}); 50860 bind(0, el, opts); // unbind events 50861 50862 if (opts.onUnblock === null) { 50863 opts.onUnblock = $el.data('blockUI.onUnblock'); 50864 $el.removeData('blockUI.onUnblock'); 50865 } 50866 50867 var els; 50868 if (full) // crazy selector to handle odd field errors in ie6/7 50869 els = $('body').children().filter('.blockUI').add('body > .blockUI'); 50870 else 50871 els = $el.find('>.blockUI'); 50872 50873 // fix cursor issue 50874 if ( opts.cursorReset ) { 50875 if ( els.length > 1 ) 50876 els[1].style.cursor = opts.cursorReset; 50877 if ( els.length > 2 ) 50878 els[2].style.cursor = opts.cursorReset; 50879 } 50880 50881 if (full) 50882 pageBlock = pageBlockEls = null; 50883 50884 if (opts.fadeOut) { 50885 count = els.length; 50886 els.stop().fadeOut(opts.fadeOut, function() { 50887 if ( --count === 0) 50888 reset(els,data,opts,el); 50889 }); 50890 } 50891 else 50892 reset(els, data, opts, el); 50893 } 50894 50895 // move blocking element back into the DOM where it started 50896 function reset(els,data,opts,el) { 50897 var $el = $(el); 50898 if ( $el.data('blockUI.isBlocked') ) 50899 return; 50900 50901 els.each(function(i,o) { 50902 // remove via DOM calls so we don't lose event handlers 50903 if (this.parentNode) 50904 this.parentNode.removeChild(this); 50905 }); 50906 50907 if (data && data.el) { 50908 data.el.style.display = data.display; 50909 data.el.style.position = data.position; 50910 data.el.style.cursor = 'default'; // #59 50911 if (data.parent) 50912 data.parent.appendChild(data.el); 50913 $el.removeData('blockUI.history'); 50914 } 50915 50916 if ($el.data('blockUI.static')) { 50917 $el.css('position', 'static'); // #22 50918 } 50919 50920 if (typeof opts.onUnblock == 'function') 50921 opts.onUnblock(el,opts); 50922 50923 // fix issue in Safari 6 where block artifacts remain until reflow 50924 var body = $(document.body), w = body.width(), cssW = body[0].style.width; 50925 body.width(w-1).width(w); 50926 body[0].style.width = cssW; 50927 } 50928 50929 // bind/unbind the handler 50930 function bind(b, el, opts) { 50931 var full = el == window, $el = $(el); 50932 50933 // don't bother unbinding if there is nothing to unbind 50934 if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked'))) 50935 return; 50936 50937 $el.data('blockUI.isBlocked', b); 50938 50939 // don't bind events when overlay is not in use or if bindEvents is false 50940 if (!full || !opts.bindEvents || (b && !opts.showOverlay)) 50941 return; 50942 50943 // bind anchors and inputs for mouse and key events 50944 var events = 'mousedown mouseup keydown keypress keyup touchstart touchend touchmove'; 50945 if (b) 50946 $(document).bind(events, opts, handler); 50947 else 50948 $(document).unbind(events, handler); 50949 50950 // former impl... 50951 // var $e = $('a,:input'); 50952 // b ? $e.bind(events, opts, handler) : $e.unbind(events, handler); 50953 } 50954 50955 // event handler to suppress keyboard/mouse events when blocking 50956 function handler(e) { 50957 // allow tab navigation (conditionally) 50958 if (e.type === 'keydown' && e.keyCode && e.keyCode == 9) { 50959 if (pageBlock && e.data.constrainTabKey) { 50960 var els = pageBlockEls; 50961 var fwd = !e.shiftKey && e.target === els[els.length-1]; 50962 var back = e.shiftKey && e.target === els[0]; 50963 if (fwd || back) { 50964 setTimeout(function(){focus(back);},10); 50965 return false; 50966 } 50967 } 50968 } 50969 var opts = e.data; 50970 var target = $(e.target); 50971 if (target.hasClass('blockOverlay') && opts.onOverlayClick) 50972 opts.onOverlayClick(e); 50973 50974 // allow events within the message content 50975 if (target.parents('div.' + opts.blockMsgClass).length > 0) 50976 return true; 50977 50978 // allow events for content that is not being blocked 50979 return target.parents().children().filter('div.blockUI').length === 0; 50980 } 50981 50982 function focus(back) { 50983 if (!pageBlockEls) 50984 return; 50985 var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0]; 50986 if (e) 50987 e.focus(); 50988 } 50989 50990 function center(el, x, y) { 50991 var p = el.parentNode, s = el.style; 50992 var l = ((p.offsetWidth - el.offsetWidth)/2) - sz(p,'borderLeftWidth'); 50993 var t = ((p.offsetHeight - el.offsetHeight)/2) - sz(p,'borderTopWidth'); 50994 if (x) s.left = l > 0 ? (l+'px') : '0'; 50995 if (y) s.top = t > 0 ? (t+'px') : '0'; 50996 } 50997 50998 function sz(el, p) { 50999 return parseInt($.css(el,p),10)||0; 51000 } 51001 51002 } 51003 51004 51005 /*global define:true */ 51006 if (typeof define === 'function' && define.amd && define.amd.jQuery) { 51007 define(['jquery'], setup); 51008 } else { 51009 setup(jQuery); 51010 } 51011 51012})();
51013; 51014// Author: Joshua De Leon - File: numericInput.js - Description: Allows only numeric input in an element. - If you happen upon this code, enjoy it, learn from it, and if possible please credit me: www.transtatic.com 51015(function (e) { function n(e) { if (e.selectionStart) return e.selectionStart; else if (document.selection) { e.focus(); var t = document.selection.createRange(); if (t == null) return 0; var n = e.createTextRange(), r = n.duplicate(); n.moveToBookmark(t.getBookmark()); r.setEndPoint("EndToStart", n); return r.text.length } return 0 } var t = { allowFloat: false, allowNegative: false, min: undefined, max: undefined }; e.fn.numericInput = function (r) { var i = e.extend({}, t, r); var s = i.allowFloat; var o = i.allowNegative; var u = i.min; var a = i.max; if (u == a) { throw "The minimum value cannot be the same as the max value" } else if (u > a) { var f = u; u = a; a = f } this.keypress(function (t) { var r = t.which; var i = e(this).val(); if (r > 0 && (r < 48 || r > 57)) { if (s == true && r == 46) { if (o == true && n(this) == 0 && i.charAt(0) == "-") return false; if (i.match(/[.]/)) return false } else if (o == true && r == 45) { if (i.charAt(0) == "-") return false; if (n(this) != 0) return false } else if (r == 8) return true; else return false } else if (r > 0 && r >= 48 && r <= 57) { if (o == true && i.charAt(0) == "-" && n(this) == 0) return false } }); this.blur(function (t) { var n = e(this).val(); if (n.length > 0) { var r = parseFloat(n); if (u !== undefined && r < u) { e(this).val(u) } if (a !== undefined && r > a) { e(this).val(a) } } }); return this }; })(jQuery); 51016String.prototype.capitalize = function () { 51017 return this.charAt(0).toUpperCase() + this.slice(1); 51018} 51019 51020Number.isInteger = Number.isInteger || function (value) { 51021 return typeof value === "number" && 51022 isFinite(value) && 51023 Math.floor(value) === value; 51024}; 51025 51026function isFloat(n) { 51027 return n === +n && n !== (n | 0); 51028} 51029 51030function isInt(n) { 51031 return n === +n && n === (n | 0); 51032} 51033 51034function getUrlParameter(sParam) { 51035 var sPageURL = decodeURIComponent(window.location.search.substring(1)), 51036 sURLVariables = sPageURL.split('&'), 51037 sParameterName, 51038 i; 51039 51040 for (i = 0; i < sURLVariables.length; i++) { 51041 sParameterName = sURLVariables[i].split('='); 51042 51043 if (sParameterName[0] === sParam) { 51044 return sParameterName[1] === undefined ? true : sParameterName[1]; 51045 } 51046 } 51047}; 51048 51049function getOrdinal(n) { 51050 var s = ["th", "st", "nd", "rd"], 51051 v = n % 100; 51052 return n + (s[(v - 20) % 10] || s[v] || s[0]); 51053} 51054 51055function getFormattedColors(colors) { 51056 var formattedColors = []; 51057 51058 if (colors.length) { 51059 colors.forEach(function (value) { 51060 var formattedColor = {}; 51061 51062 formattedColor.HexCode = value.HexCode; 51063 formattedColor.Pms = value.Pms; 51064 51065 var hex = value.HexCode.substring(1); 51066 51067 /* Get the RGB values to calculate the hue. */ 51068 var r = parseInt(hex.substring(0, 2), 16) / 255; 51069 var g = parseInt(hex.substring(2, 4), 16) / 255;
51070 var b = parseInt(hex.substring(4, 6), 16) / 255; 51071 51072 /* Getting the max and min values for chroma. */ 51073 var max = Math.max.apply(Math, [r, g, b]); 51074 var min = Math.min.apply(Math, [r, g, b]); 51075 51076 /* Variables for HSV value of hex color. */ 51077 var chr = max - min; 51078 var hue = 0; 51079 var val = max; 51080 var sat = 0; 51081 51082 if (val > 0) { 51083 /* Calculate saturation only if value is not 0. */ 51084 sat = chr / val; 51085 if (sat > 0) { 51086 if (r == max) { 51087 hue = 60 * (((g - min) - (b - min)) / chr); 51088 if (hue < 0) { 51089 hue += 360; 51090 } 51091 } else if (g == max) { 51092 hue = 120 + 60 * (((b - min) - (r - min)) / chr); 51093 } else if (b == max) { 51094 hue = 240 + 60 * (((r - min) - (g - min)) / chr); 51095 } 51096 } 51097 } 51098 formattedColor.Hue = hue; 51099 51100 formattedColors.push(formattedColor); 51101 }); 51102 } 51103 51104 return formattedColors; 51105} 51106 51107function sortColorsByHue(colors) { 51108 if (colors.length) { 51109 return colors.sort(function (a, b) { 51110 return a.Hue - b.Hue; 51111 }); 51112 } 51113}; 51114 51115/** 51116 * Loops through the entries of the provided object to construct a matching 51117 * set of URLSearchParams that is returned as a string value. The value does 51118 * not include the initial question mark, but only ampersands. 51119 * @param {object} dataObj - The data object used to convert to a query string. 51120 * @returns {string} - The URLSearchParams as a string value. 51121 */ 51122function convertObjectToQueryString(dataObj) { 51123 const params = new URLSearchParams(); 51124 51125 Object.entries(dataObj).forEach(([key, value]) => { 51126 if (Array.isArray(value)) { 51127 value.forEach(value => params.append(key, value.toString())); 51128 } else { 51129 params.append(key, value.toString()); 51130 } 51131 }); 51132 51133 return params.toString(); 51134}; 51135/*! 51136 * jQuery Color Animations v@VERSION 51137 * https://github.com/jquery/jquery-color 51138 * 51139 * Copyright jQuery Foundation and other contributors 51140 * Released under the MIT license. 51141 * http://jquery.org/license 51142 * 51143 * Date: @DATE 51144 */ 51145(function( jQuery, undefined ) { 51146 51147 var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor", 51148 51149 // plusequals test for += 100 -= 100 51150 rplusequals = /^([\-+])=\s*(\d+\.?\d*)/, 51151 // a set of RE's that can match strings and generate color tuples. 51152 stringParsers = [{ 51153 re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, 51154 parse: function( execResult ) { 51155 return [ 51156 execResult[ 1 ], 51157 execResult[ 2 ], 51158 execResult[ 3 ], 51159 execResult[ 4 ] 51160 ]; 51161 } 51162 }, { 51163 re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, 51164 parse: function( execResult ) { 51165 return [ 51166 execResult[ 1 ] * 2.55, 51167 execResult[ 2 ] * 2.55, 51168 execResult[ 3 ] * 2.55, 51169 execResult[ 4 ] 51170 ]; 51171 } 51172 }, { 51173 // this regex ignores A-F because it's compared against an already lowercased string 51174 re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/, 51175 parse: function( execResult ) { 51176 return [ 51177 parseInt( execResult[ 1 ], 16 ), 51178 parseInt( execResult[ 2 ], 16 ), 51179 parseInt( execResult[ 3 ], 16 ) 51180 ]; 51181 } 51182 }, { 51183 // this regex ignores A-F because it's compared against an already lowercased string 51184 re: /#([a-f0-9])([a-f0-9])([a-f0-9])/, 51185 parse: function( execResult ) { 51186 return [ 51187 parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ), 51188 parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ), 51189 parseInt( execResult[ 3 ] + execResult[ 3 ], 16 ) 51190 ]; 51191 } 51192 }, { 51193 re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, 51194 space: "hsla", 51195 parse: function( execResult ) { 51196 return [ 51197 execResult[ 1 ], 51198 execResult[ 2 ] / 100, 51199 execResult[ 3 ] / 100, 51200 execResult[ 4 ] 51201 ]; 51202 } 51203 }], 51204 51205 // jQuery.Color( ) 51206 color = jQuery.Color = function( color, green, blue, alpha ) { 51207 return new jQuery.Color.fn.parse( color, green, blue, alpha ); 51208 }, 51209 spaces = { 51210 rgba: { 51211 props: { 51212 red: { 51213 idx: 0, 51214 type: "byte" 51215 }, 51216 green: { 51217 idx: 1, 51218 type: "byte" 51219 }, 51220 blue: { 51221 idx: 2, 51222 type: "byte" 51223 } 51224 } 51225 }, 51226 51227 hsla: { 51228 props: { 51229 hue: { 51230 idx: 0, 51231 type: "degrees" 51232 }, 51233 saturation: { 51234 idx: 1, 51235 type: "percent" 51236 }, 51237 lightness: { 51238 idx: 2, 51239 type: "percent" 51240 } 51241 } 51242 } 51243 },
vendor: 10,400 bytes, lines 51244-51652
51244 propTypes = { 51245 "byte": { 51246 floor: true, 51247 max: 255 51248 }, 51249 "percent": { 51250 max: 1 51251 }, 51252 "degrees": { 51253 mod: 360, 51254 floor: true 51255 } 51256 }, 51257 support = color.support = {}, 51258 51259 // element for support tests 51260 supportElem = jQuery( "<p>" )[ 0 ], 51261 51262 // colors = jQuery.Color.names 51263 colors, 51264 51265 // local aliases of functions called often 51266 each = jQuery.each; 51267 51268// determine rgba support immediately 51269supportElem.style.cssText = "background-color:rgba(1,1,1,.5)"; 51270support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1; 51271 51272// define cache name and alpha properties 51273// for rgba and hsla spaces 51274each( spaces, function( spaceName, space ) { 51275 space.cache = "_" + spaceName; 51276 space.props.alpha = { 51277 idx: 3, 51278 type: "percent", 51279 def: 1 51280 }; 51281}); 51282 51283function clamp( value, prop, allowEmpty ) { 51284 var type = propTypes[ prop.type ] || {}; 51285 51286 if ( value == null ) { 51287 return (allowEmpty || !prop.def) ? null : prop.def; 51288 } 51289 51290 // ~~ is an short way of doing floor for positive numbers 51291 value = type.floor ? ~~value : parseFloat( value ); 51292 51293 // IE will pass in empty strings as value for alpha, 51294 // which will hit this case 51295 if ( isNaN( value ) ) { 51296 return prop.def; 51297 } 51298 51299 if ( type.mod ) { 51300 // we add mod before modding to make sure that negatives values 51301 // get converted properly: -10 -> 350 51302 return (value + type.mod) % type.mod; 51303 } 51304 51305 // for now all property types without mod have min and max 51306 return 0 > value ? 0 : type.max < value ? type.max : value; 51307} 51308 51309function stringParse( string ) { 51310 var inst = color(), 51311 rgba = inst._rgba = []; 51312 51313 string = string.toLowerCase(); 51314 51315 each( stringParsers, function( i, parser ) { 51316 var parsed, 51317 match = parser.re.exec( string ), 51318 values = match && parser.parse( match ), 51319 spaceName = parser.space || "rgba"; 51320 51321 if ( values ) { 51322 parsed = inst[ spaceName ]( values ); 51323 51324 // if this was an rgba parse the assignment might happen twice 51325 // oh well.... 51326 inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ]; 51327 rgba = inst._rgba = parsed._rgba; 51328 51329 // exit each( stringParsers ) here because we matched 51330 return false; 51331 } 51332 }); 51333 51334 // Found a stringParser that handled it 51335 if ( rgba.length ) { 51336 51337 // if this came from a parsed string, force "transparent" when alpha is 0 51338 // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0) 51339 if ( rgba.join() === "0,0,0,0" ) { 51340 jQuery.extend( rgba, colors.transparent ); 51341 } 51342 return inst; 51343 } 51344 51345 // named colors 51346 return colors[ string ]; 51347} 51348 51349color.fn = jQuery.extend( color.prototype, { 51350 parse: function( red, green, blue, alpha ) { 51351 if ( red === undefined ) { 51352 this._rgba = [ null, null, null, null ]; 51353 return this; 51354 } 51355 if ( red.jquery || red.nodeType ) { 51356 red = jQuery( red ).css( green ); 51357 green = undefined; 51358 } 51359 51360 var inst = this, 51361 type = jQuery.type( red ), 51362 rgba = this._rgba = []; 51363 51364 // more than 1 argument specified - assume ( red, green, blue, alpha ) 51365 if ( green !== undefined ) { 51366 red = [ red, green, blue, alpha ]; 51367 type = "array"; 51368 } 51369 51370 if ( type === "string" ) { 51371 return this.parse( stringParse( red ) || colors._default ); 51372 } 51373 51374 if ( type === "array" ) { 51375 each( spaces.rgba.props, function( key, prop ) { 51376 rgba[ prop.idx ] = clamp( red[ prop.idx ], prop ); 51377 }); 51378 return this; 51379 } 51380 51381 if ( type === "object" ) { 51382 if ( red instanceof color ) { 51383 each( spaces, function( spaceName, space ) { 51384 if ( red[ space.cache ] ) { 51385 inst[ space.cache ] = red[ space.cache ].slice(); 51386 } 51387 }); 51388 } else { 51389 each( spaces, function( spaceName, space ) { 51390 var cache = space.cache; 51391 each( space.props, function( key, prop ) { 51392 51393 // if the cache doesn't exist, and we know how to convert 51394 if ( !inst[ cache ] && space.to ) { 51395 51396 // if the value was null, we don't need to copy it 51397 // if the key was alpha, we don't need to copy it either 51398 if ( key === "alpha" || red[ key ] == null ) { 51399 return; 51400 } 51401 inst[ cache ] = space.to( inst._rgba ); 51402 } 51403 51404 // this is the only case where we allow nulls for ALL properties. 51405 // call clamp with alwaysAllowEmpty 51406 inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true ); 51407 }); 51408 51409 // everything defined but alpha? 51410 if ( inst[ cache ] && jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) { 51411 // use the default of 1 51412 inst[ cache ][ 3 ] = 1; 51413 if ( space.from ) { 51414 inst._rgba = space.from( inst[ cache ] ); 51415 } 51416 } 51417 }); 51418 } 51419 return this; 51420 } 51421 }, 51422 is: function( compare ) { 51423 var is = color( compare ), 51424 same = true, 51425 inst = this; 51426 51427 each( spaces, function( _, space ) { 51428 var localCache, 51429 isCache = is[ space.cache ]; 51430 if (isCache) { 51431 localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || []; 51432 each( space.props, function( _, prop ) { 51433 if ( isCache[ prop.idx ] != null ) { 51434 same = ( isCache[ prop.idx ] === localCache[ prop.idx ] ); 51435 return same; 51436 } 51437 }); 51438 } 51439 return same; 51440 }); 51441 return same; 51442 }, 51443 _space: function() { 51444 var used = [], 51445 inst = this; 51446 each( spaces, function( spaceName, space ) { 51447 if ( inst[ space.cache ] ) { 51448 used.push( spaceName ); 51449 } 51450 }); 51451 return used.pop(); 51452 }, 51453 transition: function( other, distance ) { 51454 var end = color( other ), 51455 spaceName = end._space(), 51456 space = spaces[ spaceName ], 51457 startColor = this.alpha() === 0 ? color( "transparent" ) : this, 51458 start = startColor[ space.cache ] || space.to( startColor._rgba ), 51459 result = start.slice(); 51460 51461 end = end[ space.cache ]; 51462 each( space.props, function( key, prop ) { 51463 var index = prop.idx, 51464 startValue = start[ index ], 51465 endValue = end[ index ], 51466 type = propTypes[ prop.type ] || {}; 51467 51468 // if null, don't override start value 51469 if ( endValue === null ) { 51470 return; 51471 } 51472 // if null - use end 51473 if ( startValue === null ) { 51474 result[ index ] = endValue; 51475 } else { 51476 if ( type.mod ) { 51477 if ( endValue - startValue > type.mod / 2 ) { 51478 startValue += type.mod; 51479 } else if ( startValue - endValue > type.mod / 2 ) { 51480 startValue -= type.mod; 51481 } 51482 } 51483 result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop ); 51484 } 51485 }); 51486 return this[ spaceName ]( result ); 51487 }, 51488 blend: function( opaque ) { 51489 // if we are already opaque - return ourself 51490 if ( this._rgba[ 3 ] === 1 ) { 51491 return this; 51492 } 51493 51494 var rgb = this._rgba.slice(), 51495 a = rgb.pop(), 51496 blend = color( opaque )._rgba; 51497 51498 return color( jQuery.map( rgb, function( v, i ) { 51499 return ( 1 - a ) * blend[ i ] + a * v; 51500 })); 51501 }, 51502 toRgbaString: function() { 51503 var prefix = "rgba(", 51504 rgba = jQuery.map( this._rgba, function( v, i ) { 51505 return v == null ? ( i > 2 ? 1 : 0 ) : v; 51506 }); 51507 51508 if ( rgba[ 3 ] === 1 ) { 51509 rgba.pop(); 51510 prefix = "rgb("; 51511 } 51512 51513 return prefix + rgba.join() + ")"; 51514 }, 51515 toHslaString: function() { 51516 var prefix = "hsla(", 51517 hsla = jQuery.map( this.hsla(), function( v, i ) { 51518 if ( v == null ) { 51519 v = i > 2 ? 1 : 0; 51520 } 51521 51522 // catch 1 and 2 51523 if ( i && i < 3 ) { 51524 v = Math.round( v * 100 ) + "%"; 51525 } 51526 return v; 51527 }); 51528 51529 if ( hsla[ 3 ] === 1 ) { 51530 hsla.pop(); 51531 prefix = "hsl("; 51532 } 51533 return prefix + hsla.join() + ")"; 51534 }, 51535 toHexString: function( includeAlpha ) { 51536 var rgba = this._rgba.slice(), 51537 alpha = rgba.pop(); 51538 51539 if ( includeAlpha ) { 51540 rgba.push( ~~( alpha * 255 ) ); 51541 } 51542 51543 return "#" + jQuery.map( rgba, function( v ) { 51544 51545 // default to 0 when nulls exist 51546 v = ( v || 0 ).toString( 16 ); 51547 return v.length === 1 ? "0" + v : v; 51548 }).join(""); 51549 }, 51550 toString: function() { 51551 return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString(); 51552 } 51553}); 51554color.fn.parse.prototype = color.fn; 51555 51556// hsla conversions adapted from: 51557// https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021 51558 51559function hue2rgb( p, q, h ) { 51560 h = ( h + 1 ) % 1; 51561 if ( h * 6 < 1 ) { 51562 return p + (q - p) * h * 6; 51563 } 51564 if ( h * 2 < 1) { 51565 return q; 51566 } 51567 if ( h * 3 < 2 ) { 51568 return p + (q - p) * ((2/3) - h) * 6; 51569 } 51570 return p; 51571} 51572 51573spaces.hsla.to = function ( rgba ) { 51574 if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) { 51575 return [ null, null, null, rgba[ 3 ] ]; 51576 } 51577 var r = rgba[ 0 ] / 255, 51578 g = rgba[ 1 ] / 255, 51579 b = rgba[ 2 ] / 255, 51580 a = rgba[ 3 ], 51581 max = Math.max( r, g, b ), 51582 min = Math.min( r, g, b ), 51583 diff = max - min, 51584 add = max + min, 51585 l = add * 0.5, 51586 h, s; 51587 51588 if ( min === max ) { 51589 h = 0; 51590 } else if ( r === max ) { 51591 h = ( 60 * ( g - b ) / diff ) + 360; 51592 } else if ( g === max ) { 51593 h = ( 60 * ( b - r ) / diff ) + 120; 51594 } else { 51595 h = ( 60 * ( r - g ) / diff ) + 240; 51596 } 51597 51598 // chroma (diff) == 0 means greyscale which, by definition, saturation = 0% 51599 // otherwise, saturation is based on the ratio of chroma (diff) to lightness (add) 51600 if ( diff === 0 ) { 51601 s = 0; 51602 } else if ( l <= 0.5 ) { 51603 s = diff / add; 51604 } else { 51605 s = diff / ( 2 - add ); 51606 } 51607 return [ Math.round(h) % 360, s, l, a == null ? 1 : a ]; 51608}; 51609 51610spaces.hsla.from = function ( hsla ) { 51611 if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) { 51612 return [ null, null, null, hsla[ 3 ] ]; 51613 } 51614 var h = hsla[ 0 ] / 360, 51615 s = hsla[ 1 ], 51616 l = hsla[ 2 ], 51617 a = hsla[ 3 ], 51618 q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s, 51619 p = 2 * l - q; 51620 51621 return [ 51622 Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ), 51623 Math.round( hue2rgb( p, q, h ) * 255 ), 51624 Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ), 51625 a 51626 ]; 51627}; 51628 51629 51630each( spaces, function( spaceName, space ) { 51631 var props = space.props, 51632 cache = space.cache, 51633 to = space.to, 51634 from = space.from; 51635 51636 // makes rgba() and hsla() 51637 color.fn[ spaceName ] = function( value ) { 51638 51639 // generate a cache for this space if it doesn't exist 51640 if ( to && !this[ cache ] ) { 51641 this[ cache ] = to( this._rgba ); 51642 } 51643 if ( value === undefined ) { 51644 return this[ cache ].slice(); 51645 } 51646 51647 var ret, 51648 type = jQuery.type( value ), 51649 arr = ( type === "array" || type === "object" ) ? value : arguments, 51650 local = this[ cache ].slice(); 51651 51652 each( props, function( key, prop ) {
vendor: 5,859 bytes, lines 51653-51858
51653 var val = arr[ type === "object" ? key : prop.idx ]; 51654 if ( val == null ) { 51655 val = local[ prop.idx ]; 51656 } 51657 local[ prop.idx ] = clamp( val, prop ); 51658 }); 51659 51660 if ( from ) { 51661 ret = color( from( local ) ); 51662 ret[ cache ] = local; 51663 return ret; 51664 } else { 51665 return color( local ); 51666 } 51667 }; 51668 51669 // makes red() green() blue() alpha() hue() saturation() lightness() 51670 each( props, function( key, prop ) { 51671 // alpha is included in more than one space 51672 if ( color.fn[ key ] ) { 51673 return; 51674 } 51675 color.fn[ key ] = function( value ) { 51676 var vtype = jQuery.type( value ), 51677 fn = ( key === "alpha" ? ( this._hsla ? "hsla" : "rgba" ) : spaceName ), 51678 local = this[ fn ](), 51679 cur = local[ prop.idx ], 51680 match; 51681 51682 if ( vtype === "undefined" ) { 51683 return cur; 51684 } 51685 51686 if ( vtype === "function" ) { 51687 value = value.call( this, cur ); 51688 vtype = jQuery.type( value ); 51689 } 51690 if ( value == null && prop.empty ) { 51691 return this; 51692 } 51693 if ( vtype === "string" ) { 51694 match = rplusequals.exec( value ); 51695 if ( match ) { 51696 value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 ); 51697 } 51698 } 51699 local[ prop.idx ] = value; 51700 return this[ fn ]( local ); 51701 }; 51702 }); 51703}); 51704 51705// add cssHook and .fx.step function for each named hook. 51706// accept a space separated string of properties 51707color.hook = function( hook ) { 51708 var hooks = hook.split( " " ); 51709 each( hooks, function( i, hook ) { 51710 jQuery.cssHooks[ hook ] = { 51711 set: function( elem, value ) { 51712 var parsed, curElem, 51713 backgroundColor = ""; 51714 51715 if ( value !== "transparent" && ( jQuery.type( value ) !== "string" || ( parsed = stringParse( value ) ) ) ) { 51716 value = color( parsed || value ); 51717 if ( !support.rgba && value._rgba[ 3 ] !== 1 ) { 51718 curElem = hook === "backgroundColor" ? elem.parentNode : elem; 51719 while ( 51720 (backgroundColor === "" || backgroundColor === "transparent") && 51721 curElem && curElem.style 51722 ) { 51723 try { 51724 backgroundColor = jQuery.css( curElem, "backgroundColor" ); 51725 curElem = curElem.parentNode; 51726 } catch ( e ) { 51727 } 51728 } 51729 51730 value = value.blend( backgroundColor && backgroundColor !== "transparent" ? 51731 backgroundColor : 51732 "_default" ); 51733 } 51734 51735 value = value.toRgbaString(); 51736 } 51737 try { 51738 elem.style[ hook ] = value; 51739 } catch( e ) { 51740 // wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit' 51741 } 51742 } 51743 }; 51744 jQuery.fx.step[ hook ] = function( fx ) { 51745 if ( !fx.colorInit ) { 51746 fx.start = color( fx.elem, hook ); 51747 fx.end = color( fx.end ); 51748 fx.colorInit = true; 51749 } 51750 jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) ); 51751 }; 51752 }); 51753 51754}; 51755 51756color.hook( stepHooks ); 51757 51758jQuery.cssHooks.borderColor = { 51759 expand: function( value ) { 51760 var expanded = {}; 51761 51762 each( [ "Top", "Right", "Bottom", "Left" ], function( i, part ) { 51763 expanded[ "border" + part + "Color" ] = value; 51764 }); 51765 return expanded; 51766 } 51767}; 51768 51769// Basic color names only. 51770// Usage of any of the other color names requires adding yourself or including 51771// jquery.color.svg-names.js. 51772colors = jQuery.Color.names = { 51773 // 4.1. Basic color keywords 51774 aqua: "#00ffff", 51775 black: "#000000", 51776 blue: "#0000ff", 51777 fuchsia: "#ff00ff", 51778 gray: "#808080", 51779 green: "#008000", 51780 lime: "#00ff00", 51781 maroon: "#800000", 51782 navy: "#000080", 51783 olive: "#808000", 51784 purple: "#800080", 51785 red: "#ff0000", 51786 silver: "#c0c0c0", 51787 teal: "#008080", 51788 white: "#ffffff", 51789 yellow: "#ffff00", 51790 51791 // 4.2.3. "transparent" color keyword 51792 transparent: [ null, null, null, 0 ], 51793 51794 _default: "#ffffff" 51795}; 51796 51797}( jQuery )); 51798; 51799(function ($) { 51800 // Extend the autocomplete widget with a new "suggest" option. 51801 $.widget("app.autocomplete", $.ui.autocomplete, { 51802 options: { 51803 suggest: false 51804 }, 51805 51806 _create: function () { 51807 this._super(); 51808 51809 this._off(this.element, "blur"); 51810 this._on(this.element, { 51811 blur: function (event) { 51812 51813 if (this.cancelBlur) { 51814 delete this.cancelBlur; 51815 return; 51816 } 51817 clearTimeout(this.searching); 51818 51819 if (!$("#autocomplete-results").is(":hover")) 51820 this.close(event); 51821 this._change(event); 51822 } 51823 }); 51824 }, 51825 // Called when the autocomplete menu is about to be displayed. 51826 _suggest: function (items) { 51827 51828 // If there's a "suggest" function, use it to render the 51829 // items. Otherwise, use the default _suggest() implementation. 51830 if ($.isFunction(this.options.suggest)) { 51831 return this.options.suggest(items); 51832 } 51833 51834 this._super(items); 51835 }, 51836 // Called when the autocomplete menu is about to be hidden. 51837 _close: function (e) { 51838 // If there's a "suggest" function, call it with an 51839 // empty array so it can clean up. Otherwise, use the 51840 // default _close() implementation. 51841 if ($.isFunction(this.options.suggest)) { 51842 this.options.suggest([]); 51843 return this._trigger("close", e); 51844 } 51845 51846 this._super(e) 51847 }, 51848 __response: function (content) { 51849 if (content) { 51850 content = this._normalize(content); 51851 } 51852 this._trigger("response", null, { content: content }); 51853 if (!this.options.disabled && content && content.length && !this.cancelSearch) { 51854 this._suggest(content); 51855 this._trigger("open"); 51856 } 51857 }, 51858 });
51859})(jQuery);; 51860(function ($) { 51861 $.extend({ 51862 form: function (url, data, method) { 51863 if (method == null) method = 'POST'; 51864 if (data == null) data = {}; 51865 51866 var form = $('<form>').attr({ 51867 method: method, 51868 action: url 51869 }).css({ 51870 display: 'none' 51871 }); 51872 51873 var addData = function (name, data) { 51874 if ($.isArray(data)) { 51875 for (var i = 0; i < data.length; i++) { 51876 var value = data[i]; 51877 addData(name + '['+ i + ']', value); 51878 } 51879 } else if (typeof data === 'object') { 51880 for (var key in data) { 51881 if (data.hasOwnProperty(key)) { 51882 addData(name + '[' + key + ']', data[key]); 51883 } 51884 } 51885 } else if (data != null) { 51886 form.append($('<input>').attr({ 51887 type: 'hidden', 51888 name: String(name), 51889 value: String(data) 51890 })); 51891 } 51892 }; 51893 51894 for (var key in data) { 51895 if (data.hasOwnProperty(key)) { 51896 addData(key, data[key]); 51897 } 51898 } 51899 51900 return form.appendTo('body'); 51901 } 51902 }); 51903})(jQuery);; 51904/*! 51905 * @preserve 51906 * 51907 * Readmore.js jQuery plugin 51908 * Author: @jed_foster 51909 * Project home: http://jedfoster.github.io/Readmore.js 51910 * Licensed under the MIT license 51911 * 51912 * Debounce function from http://davidwalsh.name/javascript-debounce-function 51913 */ 51914 51915/* global jQuery */ 51916 51917(function(factory) { 51918 if (typeof define === 'function' && define.amd) { 51919 // AMD 51920 define(['jquery'], factory); 51921 } else if (typeof exports === 'object') { 51922 // CommonJS 51923 module.exports = factory(require('jquery')); 51924 } else { 51925 // Browser globals 51926 factory(jQuery); 51927 } 51928}(function($) { 51929 'use strict'; 51930 51931 var readmore = 'readmore', 51932 defaults = { 51933 speed: 100, 51934 collapsedHeight: 200, 51935 heightMargin: 16, 51936 moreLink: '<a href="#">Read More</a>', 51937 lessLink: '<a href="#">Close</a>', 51938 embedCSS: true, 51939 blockCSS: 'display: block; width: 100%;', 51940 startOpen: false, 51941 51942 // callbacks 51943 blockProcessed: function() {}, 51944 beforeToggle: function() {}, 51945 afterToggle: function() {} 51946 }, 51947 cssEmbedded = {}, 51948 uniqueIdCounter = 0; 51949 51950 function debounce(func, wait, immediate) { 51951 var timeout; 51952 51953 return function() { 51954 var context = this, args = arguments; 51955 var later = function() { 51956 timeout = null; 51957 if (! immediate) { 51958 func.apply(context, args); 51959 } 51960 }; 51961 var callNow = immediate && !timeout; 51962 51963 clearTimeout(timeout); 51964 timeout = setTimeout(later, wait); 51965 51966 if (callNow) { 51967 func.apply(context, args); 51968 } 51969 }; 51970 } 51971 51972 function uniqueId(prefix) { 51973 var id = ++uniqueIdCounter; 51974 51975 return String(prefix == null ? 'rmjs-' : prefix) + id; 51976 } 51977 51978 function setBoxHeights(element) { 51979 var el = element.clone().css({ 51980 height: 'auto', 51981 width: element.width(), 51982 maxHeight: 'none', 51983 overflow: 'hidden' 51984 }).insertAfter(element), 51985 expandedHeight = el.outerHeight(), 51986 cssMaxHeight = parseInt(el.css({maxHeight: ''}).css('max-height').replace(/[^-\d\.]/g, ''), 10), 51987 defaultHeight = element.data('defaultHeight'); 51988 51989 el.remove(); 51990 51991 var collapsedHeight = cssMaxHeight || element.data('collapsedHeight') || defaultHeight; 51992 51993 // Store our measurements. 51994 element.data({ 51995 expandedHeight: expandedHeight, 51996 maxHeight: cssMaxHeight, 51997 collapsedHeight: collapsedHeight 51998 }) 51999 // and disable any `max-height` property set in CSS 52000 .css({ 52001 maxHeight: 'none' 52002 }); 52003 } 52004 52005 var resizeBoxes = debounce(function() { 52006 $('[data-readmore]').each(function() { 52007 var current = $(this), 52008 isExpanded = (current.attr('aria-expanded') === 'true'); 52009 52010 setBoxHeights(current); 52011 52012 current.css({ 52013 height: current.data( (isExpanded ? 'expandedHeight' : 'collapsedHeight') ) 52014 }); 52015 });
vendor: 10,550 bytes, lines 52016-52362
52016 }, 100); 52017 52018 function embedCSS(options) { 52019 if (! cssEmbedded[options.selector]) { 52020 var styles = ' '; 52021 52022 if (options.embedCSS && options.blockCSS !== '') { 52023 styles += options.selector + ' + [data-readmore-toggle], ' + 52024 options.selector + '[data-readmore]{' + 52025 options.blockCSS + 52026 '}'; 52027 } 52028 52029 // Include the transition CSS even if embedCSS is false 52030 styles += options.selector + '[data-readmore]{' + 52031 'transition: height ' + options.speed + 'ms;' + 52032 'overflow: hidden;' + 52033 '}'; 52034 52035 (function(d, u) { 52036 var css = d.createElement('style'); 52037 css.type = 'text/css'; 52038 52039 if (css.styleSheet) { 52040 css.styleSheet.cssText = u; 52041 } 52042 else { 52043 css.appendChild(d.createTextNode(u)); 52044 } 52045 52046 d.getElementsByTagName('head')[0].appendChild(css); 52047 }(document, styles)); 52048 52049 cssEmbedded[options.selector] = true; 52050 } 52051 } 52052 52053 function Readmore(element, options) { 52054 this.element = element; 52055 52056 this.options = $.extend({}, defaults, options); 52057 52058 embedCSS(this.options); 52059 52060 this._defaults = defaults; 52061 this._name = readmore; 52062 52063 this.init(); 52064 52065 // IE8 chokes on `window.addEventListener`, so need to test for support. 52066 if (window.addEventListener) { 52067 // Need to resize boxes when the page has fully loaded. 52068 window.addEventListener('load', resizeBoxes); 52069 window.addEventListener('resize', resizeBoxes); 52070 } 52071 else { 52072 window.attachEvent('load', resizeBoxes); 52073 window.attachEvent('resize', resizeBoxes); 52074 } 52075 } 52076 52077 52078 Readmore.prototype = { 52079 init: function() { 52080 var current = $(this.element); 52081 52082 current.data({ 52083 defaultHeight: this.options.collapsedHeight, 52084 heightMargin: this.options.heightMargin 52085 }); 52086 52087 setBoxHeights(current); 52088 52089 var collapsedHeight = current.data('collapsedHeight'), 52090 heightMargin = current.data('heightMargin'); 52091 52092 if (current.outerHeight(true) <= collapsedHeight + heightMargin) { 52093 // The block is shorter than the limit, so there's no need to truncate it. 52094 if (this.options.blockProcessed && typeof this.options.blockProcessed === 'function') { 52095 this.options.blockProcessed(current, false); 52096 } 52097 return true; 52098 } 52099 else { 52100 var id = current.attr('id') || uniqueId(), 52101 useLink = this.options.startOpen ? this.options.lessLink : this.options.moreLink; 52102 52103 current.attr({ 52104 'data-readmore': '', 52105 'aria-expanded': this.options.startOpen, 52106 'id': id 52107 }); 52108 52109 current.after($(useLink) 52110 .on('click', (function(_this) { 52111 return function(event) { 52112 _this.toggle(this, current[0], event); 52113 }; 52114 })(this)) 52115 .attr({ 52116 'data-readmore-toggle': id, 52117 'aria-controls': id 52118 })); 52119 52120 if (! this.options.startOpen) { 52121 current.css({ 52122 height: collapsedHeight 52123 }); 52124 } 52125 52126 if (this.options.blockProcessed && typeof this.options.blockProcessed === 'function') { 52127 this.options.blockProcessed(current, true); 52128 } 52129 } 52130 }, 52131 52132 toggle: function(trigger, element, event) { 52133 if (event) { 52134 event.preventDefault(); 52135 } 52136 52137 if (! trigger) { 52138 trigger = $('[aria-controls="' + this.element.id + '"]')[0]; 52139 } 52140 52141 if (! element) { 52142 element = this.element; 52143 } 52144 52145 var $element = $(element), 52146 newHeight = '', 52147 newLink = '', 52148 expanded = false, 52149 collapsedHeight = $element.data('collapsedHeight'); 52150 52151 if ($element.height() <= collapsedHeight) { 52152 newHeight = $element.data('expandedHeight') + 'px'; 52153 newLink = 'lessLink'; 52154 expanded = true; 52155 } 52156 else { 52157 newHeight = collapsedHeight; 52158 newLink = 'moreLink'; 52159 } 52160 52161 // Fire beforeToggle callback 52162 // Since we determined the new "expanded" state above we're now out of sync 52163 // with our true current state, so we need to flip the value of `expanded` 52164 if (this.options.beforeToggle && typeof this.options.beforeToggle === 'function') { 52165 this.options.beforeToggle(trigger, $element, ! expanded); 52166 } 52167 52168 $element.css({'height': newHeight}); 52169 52170 // Fire afterToggle callback 52171 $element.on('transitionend', (function(_this) { 52172 return function() { 52173 if (_this.options.afterToggle && typeof _this.options.afterToggle === 'function') { 52174 _this.options.afterToggle(trigger, $element, expanded); 52175 } 52176 52177 $(this).attr({ 52178 'aria-expanded': expanded 52179 }).off('transitionend'); 52180 } 52181 })(this)); 52182 52183 $(trigger).replaceWith($(this.options[newLink]) 52184 .on('click', (function(_this) { 52185 return function(event) { 52186 _this.toggle(this, element, event); 52187 }; 52188 })(this)) 52189 .attr({ 52190 'data-readmore-toggle': $element.attr('id'), 52191 'aria-controls': $element.attr('id') 52192 })); 52193 }, 52194 52195 destroy: function() { 52196 $(this.element).each(function() { 52197 var current = $(this); 52198 52199 current.attr({ 52200 'data-readmore': null, 52201 'aria-expanded': null 52202 }) 52203 .css({ 52204 maxHeight: '', 52205 height: '' 52206 }) 52207 .next('[data-readmore-toggle]') 52208 .remove(); 52209 52210 current.removeData(); 52211 }); 52212 } 52213 }; 52214 52215 52216 $.fn.readmore = function(options) { 52217 var args = arguments, 52218 selector = this.selector; 52219 52220 options = options || {}; 52221 52222 if (typeof options === 'object') { 52223 return this.each(function() { 52224 if ($.data(this, 'plugin_' + readmore)) { 52225 var instance = $.data(this, 'plugin_' + readmore); 52226 instance.destroy.apply(instance); 52227 } 52228 52229 options.selector = selector; 52230 52231 $.data(this, 'plugin_' + readmore, new Readmore(this, options)); 52232 }); 52233 } 52234 else if (typeof options === 'string' && options[0] !== '_' && options !== 'init') { 52235 return this.each(function () { 52236 var instance = $.data(this, 'plugin_' + readmore); 52237 if (instance instanceof Readmore && typeof instance[options] === 'function') { 52238 instance[options].apply(instance, Array.prototype.slice.call(args, 1)); 52239 } 52240 }); 52241 } 52242 }; 52243 52244})); 52245 52246; 52247/* 52248 _ _ _ _ 52249 ___| (_) ___| | __ (_)___ 52250/ __| | |/ __| |/ / | / __| 52251\__ \ | | (__| < _ | \__ \ 52252|___/_|_|\___|_|\_(_)/ |___/ 52253 |__/ 52254 52255 Version: 1.5.9 52256 Author: Ken Wheeler 52257 Website: http://kenwheeler.github.io 52258 Docs: http://kenwheeler.github.io/slick 52259 Repo: http://github.com/kenwheeler/slick 52260 Issues: http://github.com/kenwheeler/slick/issues 52261 52262 */ 52263/* global window, document, define, jQuery, setInterval, clearInterval */ 52264(function(factory) { 52265 'use strict'; 52266 if (typeof define === 'function' && define.amd) { 52267 define(['jquery'], factory); 52268 } else if (typeof exports !== 'undefined') { 52269 module.exports = factory(require('jquery')); 52270 } else { 52271 factory(jQuery); 52272 } 52273 52274}(function($) { 52275 'use strict'; 52276 var Slick = window.Slick || {}; 52277 52278 Slick = (function() { 52279 52280 var instanceUid = 0; 52281 52282 function Slick(element, settings) { 52283 52284 var _ = this, dataSettings; 52285 52286 _.defaults = { 52287 accessibility: true, 52288 adaptiveHeight: false, 52289 appendArrows: $(element), 52290 appendDots: $(element), 52291 arrows: true, 52292 asNavFor: null, 52293 prevArrow: '<button type="button" data-role="none" class="slick-prev" aria-label="Previous" tabindex="0" role="button">Previous</button>', 52294 nextArrow: '<button type="button" data-role="none" class="slick-next" aria-label="Next" tabindex="0" role="button">Next</button>', 52295 autoplay: false, 52296 autoplaySpeed: 3000, 52297 centerMode: false, 52298 centerPadding: '50px', 52299 cssEase: 'ease', 52300 customPaging: function(slider, i) { 52301 return $('<button type="button" data-role="none" role="button" tabindex="0" />').text(i + 1); 52302 }, 52303 dots: false, 52304 dotsClass: 'slick-dots', 52305 draggable: true, 52306 easing: 'linear', 52307 edgeFriction: 0.35, 52308 fade: false, 52309 focusOnSelect: false, 52310 infinite: true, 52311 initialSlide: 0, 52312 lazyLoad: 'ondemand', 52313 mobileFirst: false, 52314 pauseOnHover: true, 52315 pauseOnFocus: true, 52316 pauseOnDotsHover: false, 52317 respondTo: 'window', 52318 responsive: null, 52319 rows: 1, 52320 rtl: false, 52321 slide: '', 52322 slidesPerRow: 1, 52323 slidesToShow: 1, 52324 slidesToScroll: 1, 52325 speed: 500, 52326 swipe: true, 52327 swipeToSlide: false, 52328 touchMove: true, 52329 touchThreshold: 5, 52330 useCSS: true, 52331 useTransform: true, 52332 variableWidth: false, 52333 vertical: false, 52334 verticalSwiping: false, 52335 waitForAnimate: true, 52336 zIndex: 1000 52337 }; 52338 52339 _.initials = { 52340 animating: false, 52341 dragging: false, 52342 autoPlayTimer: null, 52343 currentDirection: 0, 52344 currentLeft: null, 52345 currentSlide: 0, 52346 direction: 1, 52347 $dots: null, 52348 listWidth: null, 52349 listHeight: null, 52350 loadIndex: 0, 52351 $nextArrow: null, 52352 $prevArrow: null, 52353 slideCount: null, 52354 slideWidth: null, 52355 $slideTrack: null, 52356 $slides: null, 52357 sliding: false, 52358 slideOffset: 0, 52359 swipeLeft: null, 52360 $list: null, 52361 touchObject: {}, 52362 transformsEnabled: false,
vendor: 84,818 bytes, lines 52363-55190
52363 unslicked: false 52364 }; 52365 52366 $.extend(_, _.initials); 52367 52368 _.activeBreakpoint = null; 52369 _.animType = null; 52370 _.animProp = null; 52371 _.breakpoints = []; 52372 _.breakpointSettings = []; 52373 _.cssTransitions = false; 52374 _.focussed = false; 52375 _.interrupted = false; 52376 _.hidden = 'hidden'; 52377 _.paused = true; 52378 _.positionProp = null; 52379 _.respondTo = null; 52380 _.rowCount = 1; 52381 _.shouldClick = true; 52382 _.$slider = $(element); 52383 _.$slidesCache = null; 52384 _.transformType = null; 52385 _.transitionType = null; 52386 _.visibilityChange = 'visibilitychange'; 52387 _.windowWidth = 0; 52388 _.windowTimer = null; 52389 52390 dataSettings = $(element).data('slick') || {}; 52391 52392 _.options = $.extend({}, _.defaults, settings, dataSettings); 52393 52394 _.currentSlide = _.options.initialSlide; 52395 52396 _.originalSettings = _.options; 52397 52398 if (typeof document.mozHidden !== 'undefined') { 52399 _.hidden = 'mozHidden'; 52400 _.visibilityChange = 'mozvisibilitychange'; 52401 } else if (typeof document.webkitHidden !== 'undefined') { 52402 _.hidden = 'webkitHidden'; 52403 _.visibilityChange = 'webkitvisibilitychange'; 52404 } 52405 52406 _.autoPlay = $.proxy(_.autoPlay, _); 52407 _.autoPlayClear = $.proxy(_.autoPlayClear, _); 52408 _.autoPlayIterator = $.proxy(_.autoPlayIterator, _); 52409 _.changeSlide = $.proxy(_.changeSlide, _); 52410 _.clickHandler = $.proxy(_.clickHandler, _); 52411 _.selectHandler = $.proxy(_.selectHandler, _); 52412 _.setPosition = $.proxy(_.setPosition, _); 52413 _.swipeHandler = $.proxy(_.swipeHandler, _); 52414 _.dragHandler = $.proxy(_.dragHandler, _); 52415 _.keyHandler = $.proxy(_.keyHandler, _); 52416 52417 _.instanceUid = instanceUid++; 52418 52419 // A simple way to check for HTML strings 52420 // Strict HTML recognition (must start with <) 52421 // Extracted from jQuery v1.11 source 52422 _.htmlExpr = /^(?:\s*(<[\w\W]+>)[^>]*)$/; 52423 52424 52425 _.registerBreakpoints(); 52426 _.init(true); 52427 52428 } 52429 52430 return Slick; 52431 52432 }()); 52433 52434 Slick.prototype.activateADA = function() { 52435 var _ = this; 52436 52437 _.$slideTrack.find('.slick-active').attr({ 52438 'aria-hidden': 'false' 52439 }).find('a, input, button, select').attr({ 52440 'tabindex': '0' 52441 }); 52442 52443 }; 52444 52445 Slick.prototype.addSlide = Slick.prototype.slickAdd = function(markup, index, addBefore) { 52446 52447 var _ = this; 52448 52449 if (typeof(index) === 'boolean') { 52450 addBefore = index; 52451 index = null; 52452 } else if (index < 0 || (index >= _.slideCount)) { 52453 return false; 52454 } 52455 52456 _.unload(); 52457 52458 if (typeof(index) === 'number') { 52459 if (index === 0 && _.$slides.length === 0) { 52460 $(markup).appendTo(_.$slideTrack); 52461 } else if (addBefore) { 52462 $(markup).insertBefore(_.$slides.eq(index)); 52463 } else { 52464 $(markup).insertAfter(_.$slides.eq(index)); 52465 } 52466 } else { 52467 if (addBefore === true) { 52468 $(markup).prependTo(_.$slideTrack); 52469 } else { 52470 $(markup).appendTo(_.$slideTrack); 52471 } 52472 } 52473 52474 _.$slides = _.$slideTrack.children(this.options.slide); 52475 52476 _.$slideTrack.children(this.options.slide).detach(); 52477 52478 _.$slideTrack.append(_.$slides); 52479 52480 _.$slides.each(function(index, element) { 52481 $(element).attr('data-slick-index', index); 52482 }); 52483 52484 _.$slidesCache = _.$slides; 52485 52486 _.reinit(); 52487 52488 }; 52489 52490 Slick.prototype.animateHeight = function() { 52491 var _ = this; 52492 if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) { 52493 var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true); 52494 _.$list.animate({ 52495 height: targetHeight 52496 }, _.options.speed); 52497 } 52498 }; 52499 52500 Slick.prototype.animateSlide = function(targetLeft, callback) { 52501 52502 var animProps = {}, 52503 _ = this; 52504 52505 _.animateHeight(); 52506 52507 if (_.options.rtl === true && _.options.vertical === false) { 52508 targetLeft = -targetLeft; 52509 } 52510 if (_.transformsEnabled === false) { 52511 if (_.options.vertical === false) { 52512 _.$slideTrack.animate({ 52513 left: targetLeft 52514 }, _.options.speed, _.options.easing, callback); 52515 } else { 52516 _.$slideTrack.animate({ 52517 top: targetLeft 52518 }, _.options.speed, _.options.easing, callback); 52519 } 52520 52521 } else { 52522 52523 if (_.cssTransitions === false) { 52524 if (_.options.rtl === true) { 52525 _.currentLeft = -(_.currentLeft); 52526 } 52527 $({ 52528 animStart: _.currentLeft 52529 }).animate({ 52530 animStart: targetLeft 52531 }, { 52532 duration: _.options.speed, 52533 easing: _.options.easing, 52534 step: function(now) { 52535 now = Math.ceil(now); 52536 if (_.options.vertical === false) { 52537 animProps[_.animType] = 'translate(' + 52538 now + 'px, 0px)'; 52539 _.$slideTrack.css(animProps); 52540 } else { 52541 animProps[_.animType] = 'translate(0px,' + 52542 now + 'px)'; 52543 _.$slideTrack.css(animProps); 52544 } 52545 }, 52546 complete: function() { 52547 if (callback) { 52548 callback.call(); 52549 } 52550 } 52551 }); 52552 52553 } else { 52554 52555 _.applyTransition(); 52556 targetLeft = Math.ceil(targetLeft); 52557 52558 if (_.options.vertical === false) { 52559 animProps[_.animType] = 'translate3d(' + targetLeft + 'px, 0px, 0px)'; 52560 } else { 52561 animProps[_.animType] = 'translate3d(0px,' + targetLeft + 'px, 0px)'; 52562 } 52563 _.$slideTrack.css(animProps); 52564 52565 if (callback) { 52566 setTimeout(function() { 52567 52568 _.disableTransition(); 52569 52570 callback.call(); 52571 }, _.options.speed); 52572 } 52573 52574 } 52575 52576 } 52577 52578 }; 52579 52580 Slick.prototype.getNavTarget = function() { 52581 52582 var _ = this, 52583 asNavFor = _.options.asNavFor; 52584 52585 if ( asNavFor && asNavFor !== null ) { 52586 asNavFor = $(asNavFor).not(_.$slider); 52587 } 52588 52589 return asNavFor; 52590 52591 }; 52592 52593 Slick.prototype.asNavFor = function(index) { 52594 52595 var _ = this, 52596 asNavFor = _.getNavTarget(); 52597 52598 if ( asNavFor !== null && typeof asNavFor === 'object' ) { 52599 asNavFor.each(function() { 52600 var target = $(this).slick('getSlick'); 52601 if(!target.unslicked) { 52602 target.slideHandler(index, true); 52603 } 52604 }); 52605 } 52606 52607 }; 52608 52609 Slick.prototype.applyTransition = function(slide) { 52610 52611 var _ = this, 52612 transition = {}; 52613 52614 if (_.options.fade === false) { 52615 transition[_.transitionType] = _.transformType + ' ' + _.options.speed + 'ms ' + _.options.cssEase; 52616 } else { 52617 transition[_.transitionType] = 'opacity ' + _.options.speed + 'ms ' + _.options.cssEase; 52618 } 52619 52620 if (_.options.fade === false) { 52621 _.$slideTrack.css(transition); 52622 } else { 52623 _.$slides.eq(slide).css(transition); 52624 } 52625 52626 }; 52627 52628 Slick.prototype.autoPlay = function() { 52629 52630 var _ = this; 52631 52632 _.autoPlayClear(); 52633 52634 if ( _.slideCount > _.options.slidesToShow ) { 52635 _.autoPlayTimer = setInterval( _.autoPlayIterator, _.options.autoplaySpeed ); 52636 } 52637 52638 }; 52639 52640 Slick.prototype.autoPlayClear = function() { 52641 52642 var _ = this; 52643 52644 if (_.autoPlayTimer) { 52645 clearInterval(_.autoPlayTimer); 52646 } 52647 52648 }; 52649 52650 Slick.prototype.autoPlayIterator = function() { 52651 52652 var _ = this, 52653 slideTo = _.currentSlide + _.options.slidesToScroll; 52654 52655 if ( !_.paused && !_.interrupted && !_.focussed ) { 52656 52657 if ( _.options.infinite === false ) { 52658 52659 if ( _.direction === 1 && ( _.currentSlide + 1 ) === ( _.slideCount - 1 )) { 52660 _.direction = 0; 52661 } 52662 52663 else if ( _.direction === 0 ) { 52664 52665 slideTo = _.currentSlide - _.options.slidesToScroll; 52666 52667 if ( _.currentSlide - 1 === 0 ) { 52668 _.direction = 1; 52669 } 52670 52671 } 52672 52673 } 52674 52675 _.slideHandler( slideTo ); 52676 52677 } 52678 52679 }; 52680 52681 Slick.prototype.buildArrows = function() { 52682 52683 var _ = this; 52684 52685 if (_.options.arrows === true ) { 52686 52687 _.$prevArrow = $(_.options.prevArrow).addClass('slick-arrow'); 52688 _.$nextArrow = $(_.options.nextArrow).addClass('slick-arrow'); 52689 52690 if( _.slideCount > _.options.slidesToShow ) { 52691 52692 _.$prevArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex'); 52693 _.$nextArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex'); 52694 52695 if (_.htmlExpr.test(_.options.prevArrow)) { 52696 _.$prevArrow.prependTo(_.options.appendArrows); 52697 } 52698 52699 if (_.htmlExpr.test(_.options.nextArrow)) { 52700 _.$nextArrow.appendTo(_.options.appendArrows); 52701 } 52702 52703 if (_.options.infinite !== true) { 52704 _.$prevArrow 52705 .addClass('slick-disabled') 52706 .attr('aria-disabled', 'true'); 52707 } 52708 52709 } else { 52710 52711 _.$prevArrow.add( _.$nextArrow ) 52712 52713 .addClass('slick-hidden') 52714 .attr({ 52715 'aria-disabled': 'true', 52716 'tabindex': '-1' 52717 }); 52718 52719 } 52720 52721 } 52722 52723 }; 52724 52725 Slick.prototype.buildDots = function() { 52726 52727 var _ = this, 52728 i, dot; 52729 52730 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 52731 52732 _.$slider.addClass('slick-dotted'); 52733 52734 dot = $('<ul />').addClass(_.options.dotsClass); 52735 52736 for (i = 0; i <= _.getDotCount(); i += 1) { 52737 dot.append($('<li />').append(_.options.customPaging.call(this, _, i))); 52738 } 52739 52740 _.$dots = dot.appendTo(_.options.appendDots); 52741 52742 _.$dots.find('li').first().addClass('slick-active').attr('aria-hidden', 'false'); 52743 52744 } 52745 52746 }; 52747 52748 Slick.prototype.buildOut = function() { 52749 52750 var _ = this; 52751 52752 _.$slides = 52753 _.$slider 52754 .children( _.options.slide + ':not(.slick-cloned)') 52755 .addClass('slick-slide'); 52756 52757 _.slideCount = _.$slides.length; 52758 52759 _.$slides.each(function(index, element) { 52760 $(element) 52761 .attr('data-slick-index', index) 52762 .data('originalStyling', $(element).attr('style') || ''); 52763 }); 52764 52765 _.$slider.addClass('slick-slider'); 52766 52767 _.$slideTrack = (_.slideCount === 0) ? 52768 $('<div class="slick-track"/>').appendTo(_.$slider) : 52769 _.$slides.wrapAll('<div class="slick-track"/>').parent(); 52770 52771 _.$list = _.$slideTrack.wrap( 52772 '<div aria-live="polite" class="slick-list"/>').parent(); 52773 _.$slideTrack.css('opacity', 0); 52774 52775 if (_.options.centerMode === true || _.options.swipeToSlide === true) { 52776 _.options.slidesToScroll = 1; 52777 } 52778 52779 $('img[data-lazy]', _.$slider).not('[src]').addClass('slick-loading'); 52780 52781 _.setupInfinite(); 52782 52783 _.buildArrows(); 52784 52785 _.buildDots(); 52786 52787 _.updateDots(); 52788 52789 52790 _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0); 52791 52792 if (_.options.draggable === true) { 52793 _.$list.addClass('draggable'); 52794 } 52795 52796 }; 52797 52798 Slick.prototype.buildRows = function() { 52799 52800 var _ = this, a, b, c, newSlides, numOfSlides, originalSlides,slidesPerSection; 52801 52802 newSlides = document.createDocumentFragment(); 52803 originalSlides = _.$slider.children(); 52804 52805 if(_.options.rows > 1) { 52806 52807 slidesPerSection = _.options.slidesPerRow * _.options.rows; 52808 numOfSlides = Math.ceil( 52809 originalSlides.length / slidesPerSection 52810 ); 52811 52812 for(a = 0; a < numOfSlides; a++){ 52813 var slide = document.createElement('div'); 52814 for(b = 0; b < _.options.rows; b++) { 52815 var row = document.createElement('div'); 52816 for(c = 0; c < _.options.slidesPerRow; c++) { 52817 var target = (a * slidesPerSection + ((b * _.options.slidesPerRow) + c)); 52818 if (originalSlides.get(target)) { 52819 row.appendChild(originalSlides.get(target)); 52820 } 52821 } 52822 slide.appendChild(row); 52823 } 52824 newSlides.appendChild(slide); 52825 } 52826 52827 _.$slider.empty().append(newSlides); 52828 _.$slider.children().children().children() 52829 .css({ 52830 'width':(100 / _.options.slidesPerRow) + '%', 52831 'display': 'inline-block' 52832 }); 52833 52834 } 52835 52836 }; 52837 52838 Slick.prototype.checkResponsive = function(initial, forceUpdate) { 52839 52840 var _ = this, 52841 breakpoint, targetBreakpoint, respondToWidth, triggerBreakpoint = false; 52842 var sliderWidth = _.$slider.width(); 52843 var windowWidth = window.innerWidth || $(window).width(); 52844 52845 if (_.respondTo === 'window') { 52846 respondToWidth = windowWidth; 52847 } else if (_.respondTo === 'slider') { 52848 respondToWidth = sliderWidth; 52849 } else if (_.respondTo === 'min') { 52850 respondToWidth = Math.min(windowWidth, sliderWidth); 52851 } 52852 52853 if ( _.options.responsive && 52854 _.options.responsive.length && 52855 _.options.responsive !== null) { 52856 52857 targetBreakpoint = null; 52858 52859 for (breakpoint in _.breakpoints) { 52860 if (_.breakpoints.hasOwnProperty(breakpoint)) { 52861 if (_.originalSettings.mobileFirst === false) { 52862 if (respondToWidth < _.breakpoints[breakpoint]) { 52863 targetBreakpoint = _.breakpoints[breakpoint]; 52864 } 52865 } else { 52866 if (respondToWidth > _.breakpoints[breakpoint]) { 52867 targetBreakpoint = _.breakpoints[breakpoint]; 52868 } 52869 } 52870 } 52871 } 52872 52873 if (targetBreakpoint !== null) { 52874 if (_.activeBreakpoint !== null) { 52875 if (targetBreakpoint !== _.activeBreakpoint || forceUpdate) { 52876 _.activeBreakpoint = 52877 targetBreakpoint; 52878 if (_.breakpointSettings[targetBreakpoint] === 'unslick') { 52879 _.unslick(targetBreakpoint); 52880 } else { 52881 _.options = $.extend({}, _.originalSettings, 52882 _.breakpointSettings[ 52883 targetBreakpoint]); 52884 if (initial === true) { 52885 _.currentSlide = _.options.initialSlide; 52886 } 52887 _.refresh(initial); 52888 } 52889 triggerBreakpoint = targetBreakpoint; 52890 } 52891 } else { 52892 _.activeBreakpoint = targetBreakpoint; 52893 if (_.breakpointSettings[targetBreakpoint] === 'unslick') { 52894 _.unslick(targetBreakpoint); 52895 } else { 52896 _.options = $.extend({}, _.originalSettings, 52897 _.breakpointSettings[ 52898 targetBreakpoint]); 52899 if (initial === true) { 52900 _.currentSlide = _.options.initialSlide; 52901 } 52902 _.refresh(initial); 52903 } 52904 triggerBreakpoint = targetBreakpoint; 52905 } 52906 } else { 52907 if (_.activeBreakpoint !== null) { 52908 _.activeBreakpoint = null; 52909 _.options = _.originalSettings; 52910 if (initial === true) { 52911 _.currentSlide = _.options.initialSlide; 52912 } 52913 _.refresh(initial); 52914 triggerBreakpoint = targetBreakpoint; 52915 } 52916 } 52917 52918 // only trigger breakpoints during an actual break. not on initialize. 52919 if( !initial && triggerBreakpoint !== false ) { 52920 _.$slider.trigger('breakpoint', [_, triggerBreakpoint]); 52921 } 52922 } 52923 52924 }; 52925 52926 Slick.prototype.changeSlide = function(event, dontAnimate) { 52927 52928 var _ = this, 52929 $target = $(event.currentTarget), 52930 indexOffset, slideOffset, unevenOffset; 52931 52932 // If target is a link, prevent default action. 52933 if($target.is('a')) { 52934 event.preventDefault(); 52935 } 52936 52937 // If target is not the <li> element (ie: a child), find the <li>. 52938 if(!$target.is('li')) { 52939 $target = $target.closest('li'); 52940 } 52941 52942 unevenOffset = (_.slideCount % _.options.slidesToScroll !== 0); 52943 indexOffset = unevenOffset ? 0 : (_.slideCount - _.currentSlide) % _.options.slidesToScroll; 52944 52945 switch (event.data.message) { 52946 52947 case 'previous': 52948 slideOffset = indexOffset === 0 ? _.options.slidesToScroll : _.options.slidesToShow - indexOffset; 52949 if (_.slideCount > _.options.slidesToShow) { 52950 _.slideHandler(_.currentSlide - slideOffset, false, dontAnimate); 52951 } 52952 break; 52953 52954 case 'next': 52955 slideOffset = indexOffset === 0 ? _.options.slidesToScroll : indexOffset; 52956 if (_.slideCount > _.options.slidesToShow) { 52957 _.slideHandler(_.currentSlide + slideOffset, false, dontAnimate); 52958 } 52959 break; 52960 52961 case 'index': 52962 var index = event.data.index === 0 ? 0 : 52963 event.data.index || $target.index() * _.options.slidesToScroll; 52964 52965 _.slideHandler(_.checkNavigable(index), false, dontAnimate); 52966 $target.children().trigger('focus'); 52967 break; 52968 52969 default: 52970 return; 52971 } 52972 52973 }; 52974 52975 Slick.prototype.checkNavigable = function(index) { 52976 52977 var _ = this, 52978 navigables, prevNavigable; 52979 52980 navigables = _.getNavigableIndexes(); 52981 prevNavigable = 0; 52982 if (index > navigables[navigables.length - 1]) { 52983 index = navigables[navigables.length - 1]; 52984 } else { 52985 for (var n in navigables) { 52986 if (index < navigables[n]) { 52987 index = prevNavigable; 52988 break; 52989 } 52990 prevNavigable = navigables[n]; 52991 } 52992 } 52993 52994 return index; 52995 }; 52996 52997 Slick.prototype.cleanUpEvents = function() { 52998 52999 var _ = this; 53000 53001 if (_.options.dots && _.$dots !== null) { 53002 53003 $('li', _.$dots) 53004 .off('click.slick', _.changeSlide) 53005 .off('mouseenter.slick', $.proxy(_.interrupt, _, true)) 53006 .off('mouseleave.slick', $.proxy(_.interrupt, _, false)); 53007 53008 } 53009 53010 _.$slider.off('focus.slick blur.slick'); 53011 53012 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 53013 _.$prevArrow && _.$prevArrow.off('click.slick', _.changeSlide); 53014 _.$nextArrow && _.$nextArrow.off('click.slick', _.changeSlide); 53015 } 53016 53017 _.$list.off('touchstart.slick mousedown.slick', _.swipeHandler); 53018 _.$list.off('touchmove.slick mousemove.slick', _.swipeHandler); 53019 _.$list.off('touchend.slick mouseup.slick', _.swipeHandler); 53020 _.$list.off('touchcancel.slick mouseleave.slick', _.swipeHandler); 53021 53022 _.$list.off('click.slick', _.clickHandler); 53023 53024 $(document).off(_.visibilityChange, _.visibility); 53025 53026 _.cleanUpSlideEvents(); 53027 53028 if (_.options.accessibility === true) { 53029 _.$list.off('keydown.slick', _.keyHandler); 53030 } 53031 53032 if (_.options.focusOnSelect === true) { 53033 $(_.$slideTrack).children().off('click.slick', _.selectHandler); 53034 } 53035 53036 $(window).off('orientationchange.slick.slick-' + _.instanceUid, _.orientationChange); 53037 53038 $(window).off('resize.slick.slick-' + _.instanceUid, _.resize); 53039 53040 $('[draggable!=true]', _.$slideTrack).off('dragstart', _.preventDefault); 53041 53042 $(window).off('load.slick.slick-' + _.instanceUid, _.setPosition); 53043 $(document).off('ready.slick.slick-' + _.instanceUid, _.setPosition); 53044 53045 }; 53046 53047 Slick.prototype.cleanUpSlideEvents = function() { 53048 53049 var _ = this; 53050 53051 _.$list.off('mouseenter.slick', $.proxy(_.interrupt, _, true)); 53052 _.$list.off('mouseleave.slick', $.proxy(_.interrupt, _, false)); 53053 53054 }; 53055 53056 Slick.prototype.cleanUpRows = function() { 53057 53058 var _ = this, originalSlides; 53059 53060 if(_.options.rows > 1) { 53061 originalSlides = _.$slides.children().children(); 53062 originalSlides.removeAttr('style'); 53063 _.$slider.empty().append(originalSlides); 53064 } 53065 53066 }; 53067 53068 Slick.prototype.clickHandler = function(event) { 53069 53070 var _ = this; 53071 53072 if (_.shouldClick === false) { 53073 event.stopImmediatePropagation(); 53074 event.stopPropagation(); 53075 event.preventDefault(); 53076 } 53077 53078 }; 53079 53080 Slick.prototype.destroy = function(refresh) { 53081 53082 var _ = this; 53083 53084 _.autoPlayClear(); 53085 53086 _.touchObject = {}; 53087 53088 _.cleanUpEvents(); 53089 53090 $('.slick-cloned', _.$slider).detach(); 53091 53092 if (_.$dots) { 53093 _.$dots.remove(); 53094 } 53095 53096 53097 if ( _.$prevArrow && _.$prevArrow.length ) { 53098 53099 _.$prevArrow 53100 .removeClass('slick-disabled slick-arrow slick-hidden') 53101 .removeAttr('aria-hidden aria-disabled tabindex') 53102 .css('display',''); 53103 53104 if ( _.htmlExpr.test( _.options.prevArrow )) { 53105 _.$prevArrow.remove(); 53106 } 53107 } 53108 53109 if ( _.$nextArrow && _.$nextArrow.length ) { 53110 53111 _.$nextArrow 53112 .removeClass('slick-disabled slick-arrow slick-hidden') 53113 .removeAttr('aria-hidden aria-disabled tabindex') 53114 .css('display',''); 53115 53116 if ( _.htmlExpr.test( _.options.nextArrow )) { 53117 _.$nextArrow.remove(); 53118 } 53119 53120 } 53121 53122 53123 if (_.$slides) { 53124 53125 _.$slides 53126 .removeClass('slick-slide slick-active slick-center slick-visible slick-current') 53127 .removeAttr('aria-hidden') 53128 .removeAttr('data-slick-index') 53129 .each(function(){ 53130 $(this).attr('style', $(this).data('originalStyling')); 53131 }); 53132 53133 _.$slideTrack.children(this.options.slide).detach(); 53134 53135 _.$slideTrack.detach(); 53136 53137 _.$list.detach(); 53138 53139 _.$slider.append(_.$slides); 53140 } 53141 53142 _.cleanUpRows(); 53143 53144 _.$slider.removeClass('slick-slider'); 53145 _.$slider.removeClass('slick-initialized'); 53146 _.$slider.removeClass('slick-dotted'); 53147 53148 _.unslicked = true; 53149 53150 if(!refresh) { 53151 _.$slider.trigger('destroy', [_]); 53152 } 53153 53154 }; 53155 53156 Slick.prototype.disableTransition = function(slide) { 53157 53158 var _ = this, 53159 transition = {}; 53160 53161 transition[_.transitionType] = ''; 53162 53163 if (_.options.fade === false) { 53164 _.$slideTrack.css(transition); 53165 } else { 53166 _.$slides.eq(slide).css(transition); 53167 } 53168 53169 }; 53170 53171 Slick.prototype.fadeSlide = function(slideIndex, callback) { 53172 53173 var _ = this; 53174 53175 if (_.cssTransitions === false) { 53176 53177 _.$slides.eq(slideIndex).css({ 53178 zIndex: _.options.zIndex 53179 }); 53180 53181 _.$slides.eq(slideIndex).animate({ 53182 opacity: 1 53183 }, _.options.speed, _.options.easing, callback); 53184 53185 } else { 53186 53187 _.applyTransition(slideIndex); 53188 53189 _.$slides.eq(slideIndex).css({ 53190 opacity: 1, 53191 zIndex: _.options.zIndex 53192 }); 53193 53194 if (callback) { 53195 setTimeout(function() { 53196 53197 _.disableTransition(slideIndex); 53198 53199 callback.call(); 53200 }, _.options.speed); 53201 } 53202 53203 } 53204 53205 }; 53206 53207 Slick.prototype.fadeSlideOut = function(slideIndex) { 53208 53209 var _ = this; 53210 53211 if (_.cssTransitions === false) { 53212 53213 _.$slides.eq(slideIndex).animate({ 53214 opacity: 0, 53215 zIndex: _.options.zIndex - 2 53216 }, _.options.speed, _.options.easing); 53217 53218 } else { 53219 53220 _.applyTransition(slideIndex); 53221 53222 _.$slides.eq(slideIndex).css({ 53223 opacity: 0, 53224 zIndex: _.options.zIndex - 2 53225 }); 53226 53227 } 53228 53229 }; 53230 53231 Slick.prototype.filterSlides = Slick.prototype.slickFilter = function(filter) { 53232 53233 var _ = this; 53234 53235 if (filter !== null) { 53236 53237 _.$slidesCache = _.$slides; 53238 53239 _.unload(); 53240 53241 _.$slideTrack.children(this.options.slide).detach(); 53242 53243 _.$slidesCache.filter(filter).appendTo(_.$slideTrack); 53244 53245 _.reinit(); 53246 53247 } 53248 53249 }; 53250 53251 Slick.prototype.focusHandler = function() { 53252 53253 var _ = this; 53254 53255 _.$slider 53256 .off('focus.slick blur.slick') 53257 .on('focus.slick blur.slick', 53258 '*:not(.slick-arrow)', function(event) { 53259 53260 event.stopImmediatePropagation(); 53261 var $sf = $(this); 53262 53263 setTimeout(function() { 53264 53265 if( _.options.pauseOnFocus ) { 53266 _.focussed = $sf.is(':focus'); 53267 _.autoPlay(); 53268 } 53269 53270 }, 0); 53271 53272 }); 53273 }; 53274 53275 Slick.prototype.getCurrent = Slick.prototype.slickCurrentSlide = function() { 53276 53277 var _ = this; 53278 return _.currentSlide; 53279 53280 }; 53281 53282 Slick.prototype.getDotCount = function() { 53283 53284 var _ = this; 53285 53286 var breakPoint = 0; 53287 var counter = 0; 53288 var pagerQty = 0; 53289 53290 if (_.options.infinite === true) { 53291 while (breakPoint < _.slideCount) { 53292 ++pagerQty; 53293 breakPoint = counter + _.options.slidesToScroll; 53294 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 53295 } 53296 } else if (_.options.centerMode === true) { 53297 pagerQty = _.slideCount; 53298 } else { 53299 while (breakPoint < _.slideCount) { 53300 ++pagerQty; 53301 breakPoint = counter + _.options.slidesToScroll; 53302 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 53303 } 53304 } 53305 53306 return pagerQty - 1; 53307 53308 }; 53309 53310 Slick.prototype.getLeft = function(slideIndex) { 53311 53312 var _ = this, 53313 targetLeft, 53314 verticalHeight, 53315 verticalOffset = 0, 53316 targetSlide; 53317 53318 _.slideOffset = 0; 53319 verticalHeight = _.$slides.first().outerHeight(true); 53320 53321 if (_.options.infinite === true) { 53322 if (_.slideCount > _.options.slidesToShow) { 53323 _.slideOffset = (_.slideWidth * _.options.slidesToShow) * -1; 53324 verticalOffset = (verticalHeight * _.options.slidesToShow) * -1; 53325 } 53326 if (_.slideCount % _.options.slidesToScroll !== 0) { 53327 if (slideIndex + _.options.slidesToScroll > _.slideCount && _.slideCount > _.options.slidesToShow) { 53328 if (slideIndex > _.slideCount) { 53329 _.slideOffset = ((_.options.slidesToShow - (slideIndex - _.slideCount)) * _.slideWidth) * -1; 53330 verticalOffset = ((_.options.slidesToShow - (slideIndex - _.slideCount)) * verticalHeight) * -1; 53331 } else { 53332 _.slideOffset = ((_.slideCount % _.options.slidesToScroll) * _.slideWidth) * -1; 53333 verticalOffset = ((_.slideCount % _.options.slidesToScroll) * verticalHeight) * -1; 53334 } 53335 } 53336 } 53337 } else { 53338 if (slideIndex + _.options.slidesToShow > _.slideCount) { 53339 _.slideOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * _.slideWidth; 53340 verticalOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * verticalHeight; 53341 } 53342 } 53343 53344 if (_.slideCount <= _.options.slidesToShow) { 53345 _.slideOffset = 0; 53346 verticalOffset = 0; 53347 } 53348 53349 if (_.options.centerMode === true && _.options.infinite === true) { 53350 _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2) - _.slideWidth; 53351 } else if (_.options.centerMode === true) { 53352 _.slideOffset = 0; 53353 _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2); 53354 } 53355 53356 if (_.options.vertical === false) { 53357 targetLeft = ((slideIndex * _.slideWidth) * -1) + _.slideOffset; 53358 } else { 53359 targetLeft = ((slideIndex * verticalHeight) * -1) + verticalOffset; 53360 } 53361 53362 if (_.options.variableWidth === true) { 53363 53364 if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) { 53365 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex); 53366 } else { 53367 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow); 53368 } 53369 53370 if (_.options.rtl === true) { 53371 if (targetSlide[0]) { 53372 targetLeft = (_.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1; 53373 } else { 53374 targetLeft = 0; 53375 } 53376 } else { 53377 targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0; 53378 } 53379 53380 if (_.options.centerMode === true) { 53381 if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) { 53382 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex); 53383 } else { 53384 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow + 1); 53385 } 53386 53387 if (_.options.rtl === true) { 53388 if (targetSlide[0]) { 53389 targetLeft = (_.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1; 53390 } else { 53391 targetLeft = 0; 53392 } 53393 } else { 53394 targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0; 53395 } 53396 53397 targetLeft += (_.$list.width() - targetSlide.outerWidth()) / 2; 53398 } 53399 } 53400 53401 return targetLeft; 53402 53403 }; 53404 53405 Slick.prototype.getOption = Slick.prototype.slickGetOption = function(option) { 53406 53407 var _ = this; 53408 53409 return _.options[option]; 53410 53411 }; 53412 53413 Slick.prototype.getNavigableIndexes = function() { 53414 53415 var _ = this, 53416 breakPoint = 0, 53417 counter = 0, 53418 indexes = [], 53419 max; 53420 53421 if (_.options.infinite === false) { 53422 max = _.slideCount; 53423 } else { 53424 breakPoint = _.options.slidesToScroll * -1; 53425 counter = _.options.slidesToScroll * -1; 53426 max = _.slideCount * 2; 53427 } 53428 53429 while (breakPoint < max) { 53430 indexes.push(breakPoint); 53431 breakPoint = counter + _.options.slidesToScroll; 53432 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 53433 } 53434 53435 return indexes; 53436 53437 }; 53438 53439 Slick.prototype.getSlick = function() { 53440 53441 return this; 53442 53443 }; 53444 53445 Slick.prototype.getSlideCount = function() { 53446 53447 var _ = this, 53448 slidesTraversed, swipedSlide, centerOffset; 53449 53450 centerOffset = _.options.centerMode === true ? _.slideWidth * Math.floor(_.options.slidesToShow / 2) : 0; 53451 53452 if (_.options.swipeToSlide === true) { 53453 _.$slideTrack.find('.slick-slide').each(function(index, slide) { 53454 if (slide.offsetLeft - centerOffset + ($(slide).outerWidth() / 2) > (_.swipeLeft * -1)) { 53455 swipedSlide = slide; 53456 return false; 53457 } 53458 }); 53459 53460 slidesTraversed = Math.abs($(swipedSlide).attr('data-slick-index') - _.currentSlide) || 1; 53461 53462 return slidesTraversed; 53463 53464 } else { 53465 return _.options.slidesToScroll; 53466 } 53467 53468 }; 53469 53470 Slick.prototype.goTo = Slick.prototype.slickGoTo = function(slide, dontAnimate) { 53471 53472 var _ = this; 53473 53474 _.changeSlide({ 53475 data: { 53476 message: 'index', 53477 index: parseInt(slide) 53478 } 53479 }, dontAnimate); 53480 53481 }; 53482 53483 Slick.prototype.init = function(creation) { 53484 53485 var _ = this; 53486 53487 if (!$(_.$slider).hasClass('slick-initialized')) { 53488 53489 $(_.$slider).addClass('slick-initialized'); 53490 53491 _.buildRows(); 53492 _.buildOut(); 53493 _.setProps(); 53494 _.startLoad(); 53495 _.loadSlider(); 53496 _.initializeEvents(); 53497 _.updateArrows(); 53498 _.updateDots(); 53499 _.checkResponsive(true); 53500 _.focusHandler(); 53501 53502 } 53503 53504 if (creation) { 53505 _.$slider.trigger('init', [_]); 53506 } 53507 53508 if (_.options.accessibility === true) { 53509 _.initADA(); 53510 } 53511 53512 if ( _.options.autoplay ) { 53513 53514 _.paused = false; 53515 _.autoPlay(); 53516 53517 } 53518 53519 }; 53520 53521 Slick.prototype.initADA = function() { 53522 var _ = this; 53523 _.$slides.add(_.$slideTrack.find('.slick-cloned')).attr({ 53524 'aria-hidden': 'true', 53525 'tabindex': '-1' 53526 }).find('a, input, button, select').attr({ 53527 'tabindex': '-1' 53528 }); 53529 53530 _.$slideTrack.attr('role', 'listbox'); 53531 53532 _.$slides.not(_.$slideTrack.find('.slick-cloned')).each(function(i) { 53533 $(this).attr({ 53534 'role': 'option', 53535 'aria-describedby': 'slick-slide' + _.instanceUid + i + '' 53536 }); 53537 }); 53538 53539 if (_.$dots !== null) { 53540 _.$dots.attr('role', 'tablist').find('li').each(function(i) { 53541 $(this).attr({ 53542 'role': 'presentation', 53543 'aria-selected': 'false', 53544 'aria-controls': 'navigation' + _.instanceUid + i + '', 53545 'id': 'slick-slide' + _.instanceUid + i + '' 53546 }); 53547 }) 53548 .first().attr('aria-selected', 'true').end() 53549 .find('button').attr('role', 'button').end() 53550 .closest('div').attr('role', 'toolbar'); 53551 } 53552 _.activateADA(); 53553 53554 }; 53555 53556 Slick.prototype.initArrowEvents = function() { 53557 53558 var _ = this; 53559 53560 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 53561 _.$prevArrow 53562 .off('click.slick') 53563 .on('click.slick', { 53564 message: 'previous' 53565 }, _.changeSlide); 53566 _.$nextArrow 53567 .off('click.slick') 53568 .on('click.slick', { 53569 message: 'next' 53570 }, _.changeSlide); 53571 } 53572 53573 }; 53574 53575 Slick.prototype.initDotEvents = function() { 53576 53577 var _ = this; 53578 53579 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 53580 $('li', _.$dots).on('click.slick', { 53581 message: 'index' 53582 }, _.changeSlide); 53583 } 53584 53585 if ( _.options.dots === true && _.options.pauseOnDotsHover === true ) { 53586 53587 $('li', _.$dots) 53588 .on('mouseenter.slick', $.proxy(_.interrupt, _, true)) 53589 .on('mouseleave.slick', $.proxy(_.interrupt, _, false)); 53590 53591 } 53592 53593 }; 53594 53595 Slick.prototype.initSlideEvents = function() { 53596 53597 var _ = this; 53598 53599 if ( _.options.pauseOnHover ) { 53600 53601 _.$list.on('mouseenter.slick', $.proxy(_.interrupt, _, true)); 53602 _.$list.on('mouseleave.slick', $.proxy(_.interrupt, _, false)); 53603 53604 } 53605 53606 }; 53607 53608 Slick.prototype.initializeEvents = function() { 53609 53610 var _ = this; 53611 53612 _.initArrowEvents(); 53613 53614 _.initDotEvents(); 53615 _.initSlideEvents(); 53616 53617 _.$list.on('touchstart.slick mousedown.slick', { 53618 action: 'start' 53619 }, _.swipeHandler); 53620 _.$list.on('touchmove.slick mousemove.slick', { 53621 action: 'move' 53622 }, _.swipeHandler); 53623 _.$list.on('touchend.slick mouseup.slick', { 53624 action: 'end' 53625 }, _.swipeHandler); 53626 _.$list.on('touchcancel.slick mouseleave.slick', { 53627 action: 'end' 53628 }, _.swipeHandler); 53629 53630 _.$list.on('click.slick', _.clickHandler); 53631 53632 $(document).on(_.visibilityChange, $.proxy(_.visibility, _)); 53633 53634 if (_.options.accessibility === true) { 53635 _.$list.on('keydown.slick', _.keyHandler); 53636 } 53637 53638 if (_.options.focusOnSelect === true) { 53639 $(_.$slideTrack).children().on('click.slick', _.selectHandler); 53640 } 53641 53642 $(window).on('orientationchange.slick.slick-' + _.instanceUid, $.proxy(_.orientationChange, _)); 53643 53644 $(window).on('resize.slick.slick-' + _.instanceUid, $.proxy(_.resize, _)); 53645 53646 $('[draggable!=true]', _.$slideTrack).on('dragstart', _.preventDefault); 53647 53648 $(window).on('load.slick.slick-' + _.instanceUid, _.setPosition); 53649 $(document).on('ready.slick.slick-' + _.instanceUid, _.setPosition); 53650 53651 }; 53652 53653 Slick.prototype.initUI = function() { 53654 53655 var _ = this; 53656 53657 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 53658 53659 _.$prevArrow.show(); 53660 _.$nextArrow.show(); 53661 53662 } 53663 53664 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 53665 53666 _.$dots.show(); 53667 53668 } 53669 53670 }; 53671 53672 Slick.prototype.keyHandler = function(event) { 53673 53674 var _ = this; 53675 //Dont slide if the cursor is inside the form fields and arrow keys are pressed 53676 if(!event.target.tagName.match('TEXTAREA|INPUT|SELECT')) { 53677 if (event.keyCode === 37 && _.options.accessibility === true) { 53678 _.changeSlide({ 53679 data: { 53680 message: _.options.rtl === true ? 'next' : 'previous' 53681 } 53682 }); 53683 } else if (event.keyCode === 39 && _.options.accessibility === true) { 53684 _.changeSlide({ 53685 data: { 53686 message: _.options.rtl === true ? 'previous' : 'next' 53687 } 53688 }); 53689 } 53690 } 53691 53692 }; 53693 53694 Slick.prototype.lazyLoad = function() { 53695 53696 var _ = this, 53697 loadRange, cloneRange, rangeStart, rangeEnd; 53698 53699 function loadImages(imagesScope) { 53700 53701 $('img[data-lazy]', imagesScope).each(function() { 53702 53703 var image = $(this), 53704 imageSource = $(this).attr('data-lazy'), 53705 imageToLoad = document.createElement('img'); 53706 53707 imageToLoad.onload = function() { 53708 53709 image 53710 .animate({ opacity: 0 }, 100, function() { 53711 image 53712 .attr('src', imageSource) 53713 .animate({ opacity: 1 }, 200, function() { 53714 image 53715 .removeAttr('data-lazy') 53716 .removeClass('slick-loading'); 53717 }); 53718 _.$slider.trigger('lazyLoaded', [_, image, imageSource]); 53719 }); 53720 53721 }; 53722 53723 imageToLoad.onerror = function() { 53724 53725 image 53726 .removeAttr( 'data-lazy' ) 53727 .removeClass( 'slick-loading' ) 53728 .addClass( 'slick-lazyload-error' ); 53729 53730 _.$slider.trigger('lazyLoadError', [ _, image, imageSource ]); 53731 53732 }; 53733 53734 imageToLoad.src = imageSource; 53735 53736 }); 53737 53738 } 53739 53740 if (_.options.centerMode === true) { 53741 if (_.options.infinite === true) { 53742 rangeStart = _.currentSlide + (_.options.slidesToShow / 2 + 1); 53743 rangeEnd = rangeStart + _.options.slidesToShow + 2; 53744 } else { 53745 rangeStart = Math.max(0, _.currentSlide - (_.options.slidesToShow / 2 + 1)); 53746 rangeEnd = 2 + (_.options.slidesToShow / 2 + 1) + _.currentSlide; 53747 } 53748 } else { 53749 rangeStart = _.options.infinite ? _.options.slidesToShow + _.currentSlide : _.currentSlide; 53750 rangeEnd = Math.ceil(rangeStart + _.options.slidesToShow); 53751 if (_.options.fade === true) { 53752 if (rangeStart > 0) rangeStart--; 53753 if (rangeEnd <= _.slideCount) rangeEnd++; 53754 } 53755 } 53756 53757 loadRange = _.$slider.find('.slick-slide').slice(rangeStart, rangeEnd); 53758 loadImages(loadRange); 53759 53760 if (_.slideCount <= _.options.slidesToShow) { 53761 cloneRange = _.$slider.find('.slick-slide'); 53762 loadImages(cloneRange); 53763 } else 53764 if (_.currentSlide >= _.slideCount - _.options.slidesToShow) { 53765 cloneRange = _.$slider.find('.slick-cloned').slice(0, _.options.slidesToShow); 53766 loadImages(cloneRange); 53767 } else if (_.currentSlide === 0) { 53768 cloneRange = _.$slider.find('.slick-cloned').slice(_.options.slidesToShow * -1); 53769 loadImages(cloneRange); 53770 } 53771 53772 }; 53773 53774 Slick.prototype.loadSlider = function() { 53775 53776 var _ = this; 53777 53778 _.setPosition(); 53779 53780 _.$slideTrack.css({ 53781 opacity: 1 53782 }); 53783 53784 _.$slider.removeClass('slick-loading'); 53785 53786 _.initUI(); 53787 53788 if (_.options.lazyLoad === 'progressive') { 53789 _.progressiveLazyLoad(); 53790 } 53791 53792 }; 53793 53794 Slick.prototype.next = Slick.prototype.slickNext = function() { 53795 53796 var _ = this; 53797 53798 _.changeSlide({ 53799 data: { 53800 message: 'next' 53801 } 53802 }); 53803 53804 }; 53805 53806 Slick.prototype.orientationChange = function() { 53807 53808 var _ = this; 53809 53810 _.checkResponsive(); 53811 _.setPosition(); 53812 53813 }; 53814 53815 Slick.prototype.pause = Slick.prototype.slickPause = function() { 53816 53817 var _ = this; 53818 53819 _.autoPlayClear(); 53820 _.paused = true; 53821 53822 }; 53823 53824 Slick.prototype.play = Slick.prototype.slickPlay = function() { 53825 53826 var _ = this; 53827 53828 _.autoPlay(); 53829 _.options.autoplay = true; 53830 _.paused = false; 53831 _.focussed = false; 53832 _.interrupted = false; 53833 53834 }; 53835 53836 Slick.prototype.postSlide = function(index) { 53837 53838 var _ = this; 53839 53840 if( !_.unslicked ) { 53841 53842 _.$slider.trigger('afterChange', [_, index]); 53843 53844 _.animating = false; 53845 53846 _.setPosition(); 53847 53848 _.swipeLeft = null; 53849 53850 if ( _.options.autoplay ) { 53851 _.autoPlay(); 53852 } 53853 53854 if (_.options.accessibility === true) { 53855 _.initADA(); 53856 } 53857 53858 } 53859 53860 }; 53861 53862 Slick.prototype.prev = Slick.prototype.slickPrev = function() { 53863 53864 var _ = this; 53865 53866 _.changeSlide({ 53867 data: { 53868 message: 'previous' 53869 } 53870 }); 53871 53872 }; 53873 53874 Slick.prototype.preventDefault = function(event) { 53875 53876 event.preventDefault(); 53877 53878 }; 53879 53880 Slick.prototype.progressiveLazyLoad = function( tryCount ) { 53881 53882 tryCount = tryCount || 1; 53883 53884 var _ = this, 53885 $imgsToLoad = $( 'img[data-lazy]', _.$slider ), 53886 image, 53887 imageSource, 53888 imageToLoad; 53889 53890 if ( $imgsToLoad.length ) { 53891 53892 image = $imgsToLoad.first(); 53893 imageSource = image.attr('data-lazy'); 53894 imageToLoad = document.createElement('img'); 53895 53896 imageToLoad.onload = function() { 53897 53898 image 53899 .attr( 'src', imageSource ) 53900 .removeAttr('data-lazy') 53901 .removeClass('slick-loading'); 53902 53903 if ( _.options.adaptiveHeight === true ) { 53904 _.setPosition(); 53905 } 53906 53907 _.$slider.trigger('lazyLoaded', [ _, image, imageSource ]); 53908 _.progressiveLazyLoad(); 53909 53910 }; 53911 53912 imageToLoad.onerror = function() { 53913 53914 if ( tryCount < 3 ) { 53915 53916 /** 53917 * try to load the image 3 times, 53918 * leave a slight delay so we don't get 53919 * servers blocking the request. 53920 */ 53921 setTimeout( function() { 53922 _.progressiveLazyLoad( tryCount + 1 ); 53923 }, 500 ); 53924 53925 } else { 53926 53927 image 53928 .removeAttr( 'data-lazy' ) 53929 .removeClass( 'slick-loading' ) 53930 .addClass( 'slick-lazyload-error' ); 53931 53932 _.$slider.trigger('lazyLoadError', [ _, image, imageSource ]); 53933 53934 _.progressiveLazyLoad(); 53935 53936 } 53937 53938 }; 53939 53940 imageToLoad.src = imageSource; 53941 53942 } else { 53943 53944 _.$slider.trigger('allImagesLoaded', [ _ ]); 53945 53946 } 53947 53948 }; 53949 53950 Slick.prototype.refresh = function( initializing ) { 53951 53952 var _ = this, currentSlide, lastVisibleIndex; 53953 53954 lastVisibleIndex = _.slideCount - _.options.slidesToShow; 53955 53956 // in non-infinite sliders, we don't want to go past the 53957 // last visible index. 53958 if( !_.options.infinite && ( _.currentSlide > lastVisibleIndex )) { 53959 _.currentSlide = lastVisibleIndex; 53960 } 53961 53962 // if less slides than to show, go to start. 53963 if ( _.slideCount <= _.options.slidesToShow ) { 53964 _.currentSlide = 0; 53965 53966 } 53967 53968 currentSlide = _.currentSlide; 53969 53970 _.destroy(true); 53971 53972 $.extend(_, _.initials, { currentSlide: currentSlide }); 53973 53974 _.init(); 53975 53976 if( !initializing ) { 53977 53978 _.changeSlide({ 53979 data: { 53980 message: 'index', 53981 index: currentSlide 53982 } 53983 }, false); 53984 53985 } 53986 53987 }; 53988 53989 Slick.prototype.registerBreakpoints = function() { 53990 53991 var _ = this, breakpoint, currentBreakpoint, l, 53992 responsiveSettings = _.options.responsive || null; 53993 53994 if ( $.type(responsiveSettings) === 'array' && responsiveSettings.length ) { 53995 53996 _.respondTo = _.options.respondTo || 'window'; 53997 53998 for ( breakpoint in responsiveSettings ) { 53999 54000 l = _.breakpoints.length-1; 54001 currentBreakpoint = responsiveSettings[breakpoint].breakpoint; 54002 54003 if (responsiveSettings.hasOwnProperty(breakpoint)) { 54004 54005 // loop through the breakpoints and cut out any existing 54006 // ones with the same breakpoint number, we don't want dupes. 54007 while( l >= 0 ) { 54008 if( _.breakpoints[l] && _.breakpoints[l] === currentBreakpoint ) { 54009 _.breakpoints.splice(l,1); 54010 } 54011 l--; 54012 } 54013 54014 _.breakpoints.push(currentBreakpoint); 54015 _.breakpointSettings[currentBreakpoint] = responsiveSettings[breakpoint].settings; 54016 54017 } 54018 54019 } 54020 54021 _.breakpoints.sort(function(a, b) { 54022 return ( _.options.mobileFirst ) ? a-b : b-a; 54023 }); 54024 54025 } 54026 54027 }; 54028 54029 Slick.prototype.reinit = function() { 54030 54031 var _ = this; 54032 54033 _.$slides = 54034 _.$slideTrack 54035 .children(_.options.slide) 54036 .addClass('slick-slide'); 54037 54038 _.slideCount = _.$slides.length; 54039 54040 if (_.currentSlide >= _.slideCount && _.currentSlide !== 0) { 54041 _.currentSlide = _.currentSlide - _.options.slidesToScroll; 54042 } 54043 54044 if (_.slideCount <= _.options.slidesToShow) { 54045 _.currentSlide = 0; 54046 } 54047 54048 _.registerBreakpoints(); 54049 54050 _.setProps(); 54051 _.setupInfinite(); 54052 _.buildArrows(); 54053 _.updateArrows(); 54054 _.initArrowEvents(); 54055 _.buildDots(); 54056 _.updateDots(); 54057 _.initDotEvents(); 54058 _.cleanUpSlideEvents(); 54059 _.initSlideEvents(); 54060 54061 _.checkResponsive(false, true); 54062 54063 if (_.options.focusOnSelect === true) { 54064 $(_.$slideTrack).children().on('click.slick', _.selectHandler); 54065 } 54066 54067 _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0); 54068 54069 _.setPosition(); 54070 _.focusHandler(); 54071 54072 _.paused = !_.options.autoplay; 54073 _.autoPlay(); 54074 54075 _.$slider.trigger('reInit', [_]); 54076 54077 }; 54078 54079 Slick.prototype.resize = function() { 54080 54081 var _ = this; 54082 54083 if ($(window).width() !== _.windowWidth) { 54084 clearTimeout(_.windowDelay); 54085 _.windowDelay = window.setTimeout(function() { 54086 _.windowWidth = $(window).width(); 54087 _.checkResponsive(); 54088 if( !_.unslicked ) { _.setPosition(); } 54089 }, 50); 54090 } 54091 }; 54092 54093 Slick.prototype.removeSlide = Slick.prototype.slickRemove = function(index, removeBefore, removeAll) { 54094 54095 var _ = this; 54096 54097 if (typeof(index) === 'boolean') { 54098 removeBefore = index; 54099 index = removeBefore === true ? 0 : _.slideCount - 1; 54100 } else { 54101 index = removeBefore === true ? --index : index; 54102 } 54103 54104 if (_.slideCount < 1 || index < 0 || index > _.slideCount - 1) { 54105 return false; 54106 } 54107 54108 _.unload(); 54109 54110 if (removeAll === true) { 54111 _.$slideTrack.children().remove(); 54112 } else { 54113 _.$slideTrack.children(this.options.slide).eq(index).remove(); 54114 } 54115 54116 _.$slides = _.$slideTrack.children(this.options.slide); 54117 54118 _.$slideTrack.children(this.options.slide).detach(); 54119 54120 _.$slideTrack.append(_.$slides); 54121 54122 _.$slidesCache = _.$slides; 54123 54124 _.reinit(); 54125 54126 }; 54127 54128 Slick.prototype.setCSS = function(position) { 54129 54130 var _ = this, 54131 positionProps = {}, 54132 x, y; 54133 54134 if (_.options.rtl === true) { 54135 position = -position; 54136 } 54137 x = _.positionProp == 'left' ? Math.ceil(position) + 'px' : '0px'; 54138 y = _.positionProp == 'top' ? Math.ceil(position) + 'px' : '0px'; 54139 54140 positionProps[_.positionProp] = position; 54141 54142 if (_.transformsEnabled === false) { 54143 _.$slideTrack.css(positionProps); 54144 } else { 54145 positionProps = {}; 54146 if (_.cssTransitions === false) { 54147 positionProps[_.animType] = 'translate(' + x + ', ' + y + ')'; 54148 _.$slideTrack.css(positionProps); 54149 } else { 54150 positionProps[_.animType] = 'translate3d(' + x + ', ' + y + ', 0px)'; 54151 _.$slideTrack.css(positionProps); 54152 } 54153 } 54154 54155 }; 54156 54157 Slick.prototype.setDimensions = function() { 54158 54159 var _ = this; 54160 54161 if (_.options.vertical === false) { 54162 if (_.options.centerMode === true) { 54163 _.$list.css({ 54164 padding: ('0px ' + _.options.centerPadding) 54165 }); 54166 } 54167 } else { 54168 _.$list.height(_.$slides.first().outerHeight(true) * _.options.slidesToShow); 54169 if (_.options.centerMode === true) { 54170 _.$list.css({ 54171 padding: (_.options.centerPadding + ' 0px') 54172 }); 54173 } 54174 } 54175 54176 _.listWidth = _.$list.width(); 54177 _.listHeight = _.$list.height(); 54178 54179 54180 if (_.options.vertical === false && _.options.variableWidth === false) { 54181 _.slideWidth = Math.ceil(_.listWidth / _.options.slidesToShow); 54182 _.$slideTrack.width(Math.ceil((_.slideWidth * _.$slideTrack.children('.slick-slide').length))); 54183 54184 } else if (_.options.variableWidth === true) { 54185 _.$slideTrack.width(5000 * _.slideCount); 54186 } else { 54187 _.slideWidth = Math.ceil(_.listWidth); 54188 _.$slideTrack.height(Math.ceil((_.$slides.first().outerHeight(true) * _.$slideTrack.children('.slick-slide').length))); 54189 } 54190 54191 var offset = _.$slides.first().outerWidth(true) - _.$slides.first().width(); 54192 if (_.options.variableWidth === false) _.$slideTrack.children('.slick-slide').width(_.slideWidth - offset); 54193 54194 }; 54195 54196 Slick.prototype.setFade = function() { 54197 54198 var _ = this, 54199 targetLeft; 54200 54201 _.$slides.each(function(index, element) { 54202 targetLeft = (_.slideWidth * index) * -1; 54203 if (_.options.rtl === true) { 54204 $(element).css({ 54205 position: 'relative', 54206 right: targetLeft, 54207 top: 0, 54208 zIndex: _.options.zIndex - 2, 54209 opacity: 0 54210 }); 54211 } else { 54212 $(element).css({ 54213 position: 'relative', 54214 left: targetLeft, 54215 top: 0, 54216 zIndex: _.options.zIndex - 2, 54217 opacity: 0 54218 }); 54219 } 54220 }); 54221 54222 _.$slides.eq(_.currentSlide).css({ 54223 zIndex: _.options.zIndex - 1, 54224 opacity: 1 54225 }); 54226 54227 }; 54228 54229 Slick.prototype.setHeight = function() { 54230 54231 var _ = this; 54232 54233 if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) { 54234 var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true); 54235 _.$list.css('height', targetHeight); 54236 } 54237 54238 }; 54239 54240 Slick.prototype.setOption = 54241 Slick.prototype.slickSetOption = function() { 54242 54243 /** 54244 * accepts arguments in format of: 54245 * 54246 * - for changing a single option's value: 54247 * .slick("setOption", option, value, refresh ) 54248 * 54249 * - for changing a set of responsive options: 54250 * .slick("setOption", 'responsive', [{}, ...], refresh ) 54251 * 54252 * - for updating multiple values at once (not responsive) 54253 * .slick("setOption", { 'option': value, ... }, refresh ) 54254 */ 54255 54256 var _ = this, l, item, option, value, refresh = false, type; 54257 54258 if( $.type( arguments[0] ) === 'object' ) { 54259 54260 option = arguments[0]; 54261 refresh = arguments[1]; 54262 type = 'multiple'; 54263 54264 } else if ( $.type( arguments[0] ) === 'string' ) { 54265 54266 option = arguments[0]; 54267 value = arguments[1]; 54268 refresh = arguments[2]; 54269 54270 if ( arguments[0] === 'responsive' && $.type( arguments[1] ) === 'array' ) { 54271 54272 type = 'responsive'; 54273 54274 } else if ( typeof arguments[1] !== 'undefined' ) { 54275 54276 type = 'single'; 54277 54278 } 54279 54280 } 54281 54282 if ( type === 'single' ) { 54283 54284 _.options[option] = value; 54285 54286 54287 } else if ( type === 'multiple' ) { 54288 54289 $.each( option , function( opt, val ) { 54290 54291 _.options[opt] = val; 54292 54293 }); 54294 54295 54296 } else if ( type === 'responsive' ) { 54297 54298 for ( item in value ) { 54299 54300 if( $.type( _.options.responsive ) !== 'array' ) { 54301 54302 _.options.responsive = [ value[item] ]; 54303 54304 } else { 54305 54306 l = _.options.responsive.length-1; 54307 54308 // loop through the responsive object and splice out duplicates. 54309 while( l >= 0 ) { 54310 54311 if( _.options.responsive[l].breakpoint === value[item].breakpoint ) { 54312 54313 _.options.responsive.splice(l,1); 54314 54315 } 54316 54317 l--; 54318 54319 } 54320 54321 _.options.responsive.push( value[item] ); 54322 54323 } 54324 54325 } 54326 54327 } 54328 54329 if ( refresh ) { 54330 54331 _.unload(); 54332 _.reinit(); 54333 54334 } 54335 54336 }; 54337 54338 Slick.prototype.setPosition = function() { 54339 54340 var _ = this; 54341 54342 _.setDimensions(); 54343 54344 _.setHeight(); 54345 54346 if (_.options.fade === false) { 54347 _.setCSS(_.getLeft(_.currentSlide)); 54348 } else { 54349 _.setFade(); 54350 } 54351 54352 _.$slider.trigger('setPosition', [_]); 54353 54354 }; 54355 54356 Slick.prototype.setProps = function() { 54357 54358 var _ = this, 54359 bodyStyle = document.body.style; 54360 54361 _.positionProp = _.options.vertical === true ? 'top' : 'left'; 54362 54363 if (_.positionProp === 'top') { 54364 _.$slider.addClass('slick-vertical'); 54365 } else { 54366 _.$slider.removeClass('slick-vertical'); 54367 } 54368 54369 if (bodyStyle.WebkitTransition !== undefined || 54370 bodyStyle.MozTransition !== undefined || 54371 bodyStyle.msTransition !== undefined) { 54372 if (_.options.useCSS === true) { 54373 _.cssTransitions = true; 54374 } 54375 } 54376 54377 if ( _.options.fade ) { 54378 if ( typeof _.options.zIndex === 'number' ) { 54379 if( _.options.zIndex < 3 ) { 54380 _.options.zIndex = 3; 54381 } 54382 } else { 54383 _.options.zIndex = _.defaults.zIndex; 54384 } 54385 } 54386 54387 if (bodyStyle.OTransform !== undefined) { 54388 _.animType = 'OTransform'; 54389 _.transformType = '-o-transform'; 54390 _.transitionType = 'OTransition'; 54391 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false; 54392 } 54393 if (bodyStyle.MozTransform !== undefined) { 54394 _.animType = 'MozTransform'; 54395 _.transformType = '-moz-transform'; 54396 _.transitionType = 'MozTransition'; 54397 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.MozPerspective === undefined) _.animType = false; 54398 } 54399 if (bodyStyle.webkitTransform !== undefined) { 54400 _.animType = 'webkitTransform'; 54401 _.transformType = '-webkit-transform'; 54402 _.transitionType = 'webkitTransition'; 54403 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false; 54404 } 54405 if (bodyStyle.msTransform !== undefined) { 54406 _.animType = 'msTransform'; 54407 _.transformType = '-ms-transform'; 54408 _.transitionType = 'msTransition'; 54409 if (bodyStyle.msTransform === undefined) _.animType = false; 54410 } 54411 if (bodyStyle.transform !== undefined && _.animType !== false) { 54412 _.animType = 'transform'; 54413 _.transformType = 'transform'; 54414 _.transitionType = 'transition'; 54415 } 54416 _.transformsEnabled = _.options.useTransform && (_.animType !== null && _.animType !== false); 54417 }; 54418 54419 54420 Slick.prototype.setSlideClasses = function(index) { 54421 54422 var _ = this, 54423 centerOffset, allSlides, indexOffset, remainder; 54424 54425 allSlides = _.$slider 54426 .find('.slick-slide') 54427 .removeClass('slick-active slick-center slick-current') 54428 .attr('aria-hidden', 'true'); 54429 54430 _.$slides 54431 .eq(index) 54432 .addClass('slick-current'); 54433 54434 if (_.options.centerMode === true) { 54435 54436 centerOffset = Math.floor(_.options.slidesToShow / 2); 54437 54438 if (_.options.infinite === true) { 54439 54440 if (index >= centerOffset && index <= (_.slideCount - 1) - centerOffset) { 54441 54442 _.$slides 54443 .slice(index - centerOffset, index + centerOffset + 1) 54444 .addClass('slick-active') 54445 .attr('aria-hidden', 'false'); 54446 54447 } else { 54448 54449 indexOffset = _.options.slidesToShow + index; 54450 allSlides 54451 .slice(indexOffset - centerOffset + 1, indexOffset + centerOffset + 2) 54452 .addClass('slick-active') 54453 .attr('aria-hidden', 'false'); 54454 54455 } 54456 54457 if (index === 0) { 54458 54459 allSlides 54460 .eq(allSlides.length - 1 - _.options.slidesToShow) 54461 .addClass('slick-center'); 54462 54463 } else if (index === _.slideCount - 1) { 54464 54465 allSlides 54466 .eq(_.options.slidesToShow) 54467 .addClass('slick-center'); 54468 54469 } 54470 54471 } 54472 54473 _.$slides 54474 .eq(index) 54475 .addClass('slick-center'); 54476 54477 } else { 54478 54479 if (index >= 0 && index <= (_.slideCount - _.options.slidesToShow)) { 54480 54481 _.$slides 54482 .slice(index, index + _.options.slidesToShow) 54483 .addClass('slick-active') 54484 .attr('aria-hidden', 'false'); 54485 54486 } else if (allSlides.length <= _.options.slidesToShow) { 54487 54488 allSlides 54489 .addClass('slick-active') 54490 .attr('aria-hidden', 'false'); 54491 54492 } else { 54493 54494 remainder = _.slideCount % _.options.slidesToShow; 54495 indexOffset = _.options.infinite === true ? _.options.slidesToShow + index : index; 54496 54497 if (_.options.slidesToShow == _.options.slidesToScroll && (_.slideCount - index) < _.options.slidesToShow) { 54498 54499 allSlides 54500 .slice(indexOffset - (_.options.slidesToShow - remainder), indexOffset + remainder) 54501 .addClass('slick-active') 54502 .attr('aria-hidden', 'false'); 54503 54504 } else { 54505 54506 allSlides 54507 .slice(indexOffset, indexOffset + _.options.slidesToShow) 54508 .addClass('slick-active') 54509 .attr('aria-hidden', 'false'); 54510 54511 } 54512 54513 } 54514 54515 } 54516 54517 if (_.options.lazyLoad === 'ondemand') { 54518 _.lazyLoad(); 54519 } 54520 54521 }; 54522 54523 Slick.prototype.setupInfinite = function() { 54524 54525 var _ = this, 54526 i, slideIndex, infiniteCount; 54527 54528 if (_.options.fade === true) { 54529 _.options.centerMode = false; 54530 } 54531 54532 if (_.options.infinite === true && _.options.fade === false) { 54533 54534 slideIndex = null; 54535 54536 if (_.slideCount > _.options.slidesToShow) { 54537 54538 if (_.options.centerMode === true) { 54539 infiniteCount = _.options.slidesToShow + 1; 54540 } else { 54541 infiniteCount = _.options.slidesToShow; 54542 } 54543 54544 for (i = _.slideCount; i > (_.slideCount - 54545 infiniteCount); i -= 1) { 54546 slideIndex = i - 1; 54547 $(_.$slides[slideIndex]).clone(true).attr('id', '') 54548 .attr('data-slick-index', slideIndex - _.slideCount) 54549 .prependTo(_.$slideTrack).addClass('slick-cloned'); 54550 } 54551 for (i = 0; i < infiniteCount; i += 1) { 54552 slideIndex = i; 54553 $(_.$slides[slideIndex]).clone(true).attr('id', '') 54554 .attr('data-slick-index', slideIndex + _.slideCount) 54555 .appendTo(_.$slideTrack).addClass('slick-cloned'); 54556 } 54557 _.$slideTrack.find('.slick-cloned').find('[id]').each(function() { 54558 $(this).attr('id', ''); 54559 }); 54560 54561 } 54562 54563 } 54564 54565 }; 54566 54567 Slick.prototype.interrupt = function( toggle ) { 54568 54569 var _ = this; 54570 54571 if( !toggle ) { 54572 _.autoPlay(); 54573 } 54574 _.interrupted = toggle; 54575 54576 }; 54577 54578 Slick.prototype.selectHandler = function(event) { 54579 54580 var _ = this; 54581 54582 var targetElement = 54583 $(event.target).is('.slick-slide') ? 54584 $(event.target) : 54585 $(event.target).parents('.slick-slide'); 54586 54587 var index = parseInt(targetElement.attr('data-slick-index')); 54588 54589 if (!index) index = 0; 54590 54591 if (_.slideCount <= _.options.slidesToShow) { 54592 54593 _.setSlideClasses(index); 54594 _.asNavFor(index); 54595 return; 54596 54597 } 54598 54599 _.slideHandler(index); 54600 54601 }; 54602 54603 Slick.prototype.slideHandler = function(index, sync, dontAnimate) { 54604 54605 var targetSlide, animSlide, oldSlide, slideLeft, targetLeft = null, 54606 _ = this, navTarget; 54607 54608 sync = sync || false; 54609 54610 if (_.animating === true && _.options.waitForAnimate === true) { 54611 return; 54612 } 54613 54614 if (_.options.fade === true && _.currentSlide === index) { 54615 return; 54616 } 54617 54618 if (_.slideCount <= _.options.slidesToShow) { 54619 return; 54620 } 54621 54622 if (sync === false) { 54623 _.asNavFor(index); 54624 } 54625 54626 targetSlide = index; 54627 targetLeft = _.getLeft(targetSlide); 54628 slideLeft = _.getLeft(_.currentSlide); 54629 54630 _.currentLeft = _.swipeLeft === null ? slideLeft : _.swipeLeft; 54631 54632 if (_.options.infinite === false && _.options.centerMode === false && (index < 0 || index > _.getDotCount() * _.options.slidesToScroll)) { 54633 if (_.options.fade === false) { 54634 targetSlide = _.currentSlide; 54635 if (dontAnimate !== true) { 54636 _.animateSlide(slideLeft, function() { 54637 _.postSlide(targetSlide); 54638 }); 54639 } else { 54640 _.postSlide(targetSlide); 54641 } 54642 } 54643 return; 54644 } else if (_.options.infinite === false && _.options.centerMode === true && (index < 0 || index > (_.slideCount - _.options.slidesToScroll))) { 54645 if (_.options.fade === false) { 54646 targetSlide = _.currentSlide; 54647 if (dontAnimate !== true) { 54648 _.animateSlide(slideLeft, function() { 54649 _.postSlide(targetSlide); 54650 }); 54651 } else { 54652 _.postSlide(targetSlide); 54653 } 54654 } 54655 return; 54656 } 54657 54658 if ( _.options.autoplay ) { 54659 clearInterval(_.autoPlayTimer); 54660 } 54661 54662 if (targetSlide < 0) { 54663 if (_.slideCount % _.options.slidesToScroll !== 0) { 54664 animSlide = _.slideCount - (_.slideCount % _.options.slidesToScroll); 54665 } else { 54666 animSlide = _.slideCount + targetSlide; 54667 } 54668 } else if (targetSlide >= _.slideCount) { 54669 if (_.slideCount % _.options.slidesToScroll !== 0) { 54670 animSlide = 0; 54671 } else { 54672 animSlide = targetSlide - _.slideCount; 54673 } 54674 } else { 54675 animSlide = targetSlide; 54676 } 54677 54678 _.animating = true; 54679 54680 _.$slider.trigger('beforeChange', [_, _.currentSlide, animSlide]); 54681 54682 oldSlide = _.currentSlide; 54683 _.currentSlide = animSlide; 54684 54685 _.setSlideClasses(_.currentSlide); 54686 54687 if ( _.options.asNavFor ) { 54688 54689 navTarget = _.getNavTarget(); 54690 navTarget = navTarget.slick('getSlick'); 54691 54692 if ( navTarget.slideCount <= navTarget.options.slidesToShow ) { 54693 navTarget.setSlideClasses(_.currentSlide); 54694 } 54695 54696 } 54697 54698 _.updateDots(); 54699 _.updateArrows(); 54700 54701 if (_.options.fade === true) { 54702 if (dontAnimate !== true) { 54703 54704 _.fadeSlideOut(oldSlide); 54705 54706 _.fadeSlide(animSlide, function() { 54707 _.postSlide(animSlide); 54708 }); 54709 54710 } else { 54711 _.postSlide(animSlide); 54712 } 54713 _.animateHeight(); 54714 return; 54715 } 54716 54717 if (dontAnimate !== true) { 54718 _.animateSlide(targetLeft, function() { 54719 _.postSlide(animSlide); 54720 }); 54721 } else { 54722 _.postSlide(animSlide); 54723 } 54724 54725 }; 54726 54727 Slick.prototype.startLoad = function() { 54728 54729 var _ = this; 54730 54731 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 54732 54733 _.$prevArrow.hide(); 54734 _.$nextArrow.hide(); 54735 54736 } 54737 54738 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 54739 54740 _.$dots.hide(); 54741 54742 } 54743 54744 _.$slider.addClass('slick-loading'); 54745 54746 }; 54747 54748 Slick.prototype.swipeDirection = function() { 54749 54750 var xDist, yDist, r, swipeAngle, _ = this; 54751 54752 xDist = _.touchObject.startX - _.touchObject.curX; 54753 yDist = _.touchObject.startY - _.touchObject.curY; 54754 r = Math.atan2(yDist, xDist); 54755 54756 swipeAngle = Math.round(r * 180 / Math.PI); 54757 if (swipeAngle < 0) { 54758 swipeAngle = 360 - Math.abs(swipeAngle); 54759 } 54760 54761 if ((swipeAngle <= 45) && (swipeAngle >= 0)) { 54762 return (_.options.rtl === false ? 'left' : 'right'); 54763 } 54764 if ((swipeAngle <= 360) && (swipeAngle >= 315)) { 54765 return (_.options.rtl === false ? 'left' : 'right'); 54766 } 54767 if ((swipeAngle >= 135) && (swipeAngle <= 225)) { 54768 return (_.options.rtl === false ? 'right' : 'left'); 54769 } 54770 if (_.options.verticalSwiping === true) { 54771 if ((swipeAngle >= 35) && (swipeAngle <= 135)) { 54772 return 'down'; 54773 } else { 54774 return 'up'; 54775 } 54776 } 54777 54778 return 'vertical'; 54779 54780 }; 54781 54782 Slick.prototype.swipeEnd = function(event) { 54783 54784 var _ = this, 54785 slideCount, 54786 direction; 54787 54788 _.dragging = false; 54789 _.interrupted = false; 54790 _.shouldClick = ( _.touchObject.swipeLength > 10 ) ? false : true; 54791 54792 if ( _.touchObject.curX === undefined ) { 54793 return false; 54794 } 54795 54796 if ( _.touchObject.edgeHit === true ) { 54797 _.$slider.trigger('edge', [_, _.swipeDirection() ]); 54798 } 54799 54800 if ( _.touchObject.swipeLength >= _.touchObject.minSwipe ) { 54801 54802 direction = _.swipeDirection(); 54803 54804 switch ( direction ) { 54805 54806 case 'left': 54807 case 'down': 54808 54809 slideCount = 54810 _.options.swipeToSlide ? 54811 _.checkNavigable( _.currentSlide + _.getSlideCount() ) : 54812 _.currentSlide + _.getSlideCount(); 54813 54814 _.currentDirection = 0; 54815 54816 break; 54817 54818 case 'right': 54819 case 'up': 54820 54821 slideCount = 54822 _.options.swipeToSlide ? 54823 _.checkNavigable( _.currentSlide - _.getSlideCount() ) : 54824 _.currentSlide - _.getSlideCount(); 54825 54826 _.currentDirection = 1; 54827 54828 break; 54829 54830 default: 54831 54832 54833 } 54834 54835 if( direction != 'vertical' ) { 54836 54837 _.slideHandler( slideCount ); 54838 _.touchObject = {}; 54839 _.$slider.trigger('swipe', [_, direction ]); 54840 54841 } 54842 54843 } else { 54844 54845 if ( _.touchObject.startX !== _.touchObject.curX ) { 54846 54847 _.slideHandler( _.currentSlide ); 54848 _.touchObject = {}; 54849 54850 } 54851 54852 } 54853 54854 }; 54855 54856 Slick.prototype.swipeHandler = function(event) { 54857 54858 var _ = this; 54859 54860 if ((_.options.swipe === false) || ('ontouchend' in document && _.options.swipe === false)) { 54861 return; 54862 } else if (_.options.draggable === false && event.type.indexOf('mouse') !== -1) { 54863 return; 54864 } 54865 54866 _.touchObject.fingerCount = event.originalEvent && event.originalEvent.touches !== undefined ? 54867 event.originalEvent.touches.length : 1; 54868 54869 _.touchObject.minSwipe = _.listWidth / _.options 54870 .touchThreshold; 54871 54872 if (_.options.verticalSwiping === true) { 54873 _.touchObject.minSwipe = _.listHeight / _.options 54874 .touchThreshold; 54875 } 54876 54877 switch (event.data.action) { 54878 54879 case 'start': 54880 _.swipeStart(event); 54881 break; 54882 54883 case 'move': 54884 _.swipeMove(event); 54885 break; 54886 54887 case 'end': 54888 _.swipeEnd(event); 54889 break; 54890 54891 } 54892 54893 }; 54894 54895 Slick.prototype.swipeMove = function(event) { 54896 54897 var _ = this, 54898 edgeWasHit = false, 54899 curLeft, swipeDirection, swipeLength, positionOffset, touches; 54900 54901 touches = event.originalEvent !== undefined ? event.originalEvent.touches : null; 54902 54903 if (!_.dragging || touches && touches.length !== 1) { 54904 return false; 54905 } 54906 54907 curLeft = _.getLeft(_.currentSlide); 54908 54909 _.touchObject.curX = touches !== undefined ? touches[0].pageX : event.clientX; 54910 _.touchObject.curY = touches !== undefined ? touches[0].pageY : event.clientY; 54911 54912 _.touchObject.swipeLength = Math.round(Math.sqrt( 54913 Math.pow(_.touchObject.curX - _.touchObject.startX, 2))); 54914 54915 if (_.options.verticalSwiping === true) { 54916 _.touchObject.swipeLength = Math.round(Math.sqrt( 54917 Math.pow(_.touchObject.curY - _.touchObject.startY, 2))); 54918 } 54919 54920 swipeDirection = _.swipeDirection(); 54921 54922 if (swipeDirection === 'vertical') { 54923 return; 54924 } 54925 54926 if (event.originalEvent !== undefined && _.touchObject.swipeLength > 4) { 54927 event.preventDefault(); 54928 } 54929 54930 positionOffset = (_.options.rtl === false ? 1 : -1) * (_.touchObject.curX > _.touchObject.startX ? 1 : -1); 54931 if (_.options.verticalSwiping === true) { 54932 positionOffset = _.touchObject.curY > _.touchObject.startY ? 1 : -1; 54933 } 54934 54935 54936 swipeLength = _.touchObject.swipeLength; 54937 54938 _.touchObject.edgeHit = false; 54939 54940 if (_.options.infinite === false) { 54941 if ((_.currentSlide === 0 && swipeDirection === 'right') || (_.currentSlide >= _.getDotCount() && swipeDirection === 'left')) { 54942 swipeLength = _.touchObject.swipeLength * _.options.edgeFriction; 54943 _.touchObject.edgeHit = true; 54944 } 54945 } 54946 54947 if (_.options.vertical === false) { 54948 _.swipeLeft = curLeft + swipeLength * positionOffset; 54949 } else { 54950 _.swipeLeft = curLeft + (swipeLength * (_.$list.height() / _.listWidth)) * positionOffset; 54951 } 54952 if (_.options.verticalSwiping === true) { 54953 _.swipeLeft = curLeft + swipeLength * positionOffset; 54954 } 54955 54956 if (_.options.fade === true || _.options.touchMove === false) { 54957 return false; 54958 } 54959 54960 if (_.animating === true) { 54961 _.swipeLeft = null; 54962 return false; 54963 } 54964 54965 _.setCSS(_.swipeLeft); 54966 54967 }; 54968 54969 Slick.prototype.swipeStart = function(event) { 54970 54971 var _ = this, 54972 touches; 54973 54974 _.interrupted = true; 54975 54976 if (_.touchObject.fingerCount !== 1 || _.slideCount <= _.options.slidesToShow) { 54977 _.touchObject = {}; 54978 return false; 54979 } 54980 54981 if (event.originalEvent !== undefined && event.originalEvent.touches !== undefined) { 54982 touches = event.originalEvent.touches[0]; 54983 } 54984 54985 _.touchObject.startX = _.touchObject.curX = touches !== undefined ? touches.pageX : event.clientX; 54986 _.touchObject.startY = _.touchObject.curY = touches !== undefined ? touches.pageY : event.clientY; 54987 54988 _.dragging = true; 54989 54990 }; 54991 54992 Slick.prototype.unfilterSlides = Slick.prototype.slickUnfilter = function() { 54993 54994 var _ = this; 54995 54996 if (_.$slidesCache !== null) { 54997 54998 _.unload(); 54999 55000 _.$slideTrack.children(this.options.slide).detach(); 55001 55002 _.$slidesCache.appendTo(_.$slideTrack); 55003 55004 _.reinit(); 55005 55006 } 55007 55008 }; 55009 55010 Slick.prototype.unload = function() { 55011 55012 var _ = this; 55013 55014 $('.slick-cloned', _.$slider).remove(); 55015 55016 if (_.$dots) { 55017 _.$dots.remove(); 55018 } 55019 55020 if (_.$prevArrow && _.htmlExpr.test(_.options.prevArrow)) { 55021 _.$prevArrow.remove(); 55022 } 55023 55024 if (_.$nextArrow && _.htmlExpr.test(_.options.nextArrow)) { 55025 _.$nextArrow.remove(); 55026 } 55027 55028 _.$slides 55029 .removeClass('slick-slide slick-active slick-visible slick-current') 55030 .attr('aria-hidden', 'true') 55031 .css('width', ''); 55032 55033 }; 55034 55035 Slick.prototype.unslick = function(fromBreakpoint) { 55036 55037 var _ = this; 55038 _.$slider.trigger('unslick', [_, fromBreakpoint]); 55039 _.destroy(); 55040 55041 }; 55042 55043 Slick.prototype.updateArrows = function() { 55044 55045 var _ = this, 55046 centerOffset; 55047 55048 centerOffset = Math.floor(_.options.slidesToShow / 2); 55049 55050 if ( _.options.arrows === true && 55051 _.slideCount > _.options.slidesToShow && 55052 !_.options.infinite ) { 55053 55054 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 55055 _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 55056 55057 if (_.currentSlide === 0) { 55058 55059 _.$prevArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 55060 _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 55061 55062 } else if (_.currentSlide >= _.slideCount - _.options.slidesToShow && _.options.centerMode === false) { 55063 55064 _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 55065 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 55066 55067 } else if (_.currentSlide >= _.slideCount - 1 && _.options.centerMode === true) { 55068 55069 _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 55070 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 55071 55072 } 55073 55074 } 55075 55076 }; 55077 55078 Slick.prototype.updateDots = function() { 55079 55080 var _ = this; 55081 55082 if (_.$dots !== null) { 55083 55084 _.$dots 55085 .find('li') 55086 .removeClass('slick-active') 55087 .attr('aria-hidden', 'true'); 55088 55089 _.$dots 55090 .find('li') 55091 .eq(Math.floor(_.currentSlide / _.options.slidesToScroll)) 55092 .addClass('slick-active') 55093 .attr('aria-hidden', 'false'); 55094 55095 } 55096 55097 }; 55098 55099 Slick.prototype.visibility = function() { 55100 55101 var _ = this; 55102 55103 if ( _.options.autoplay ) { 55104 55105 if ( document[_.hidden] ) { 55106 55107 _.interrupted = true; 55108 55109 } else { 55110 55111 _.interrupted = false; 55112 55113 } 55114 55115 } 55116 55117 }; 55118 55119 $.fn.slick = function() { 55120 var _ = this, 55121 opt = arguments[0], 55122 args = Array.prototype.slice.call(arguments, 1), 55123 l = _.length, 55124 i, 55125 ret; 55126 for (i = 0; i < l; i++) { 55127 if (typeof opt == 'object' || typeof opt == 'undefined') 55128 _[i].slick = new Slick(_[i], opt); 55129 else 55130 ret = _[i].slick[opt].apply(_[i].slick, args); 55131 if (typeof ret != 'undefined') return ret; 55132 } 55133 return _; 55134 }; 55135 55136})); 55137; 55138/** 55139 * Current accepted format for options: 55140 * var options = { 55141 * callback: { 55142 * done: function(data) { }, 55143 * fail: funciton(xhr) { }, 55144 * always: function(data) { } 55145 * }, 55146 * params: { 55147 * Someparam: somedata, 55148 * Someparam2: somedata2 55149 * } 55150 * 55151 * DataManager.process('Controller','Action', options); 55152 */ 55153 55154/** 55155 * @author Liam Conlan 55156 * @copyright Facilisgroup 2016 - All rights reserved. 55157 * @description Generic data manager class for CRUD operations on @ease record types. 55158 */ 55159var DataManager = function () { 55160 55161 var DEBUG = false; 55162 var methods = ['GET', 'POST']; 55163 var currentMethod = methods[1]; 55164 55165 /** 55166 * @description List of areas and actions that can be performed, and their associated URL. 55167 */ 55168 var urls = { 55169 Auth: { 55170 CheckStatus: '/auth/asynccheckstatus/', 55171 Register: '/auth/asyncregister/', 55172 SendValidationEmail: '/auth/asyncsendvalidationemail/', 55173 AcknowledgeVirtualSamplingModal: '/auth/asyncacknowledgevirtualsamplingmodal/' 55174 }, 55175 Product: { 55176 SendProductEnquiry: '/product/asyncsendproductenquiry/', 55177 CheckColour: '/product/asynccheckcolour/', 55178 ShareProduct: '/product/asyncshareproduct/', 55179 GetProductModal: '/product/asyncproduct/' 55180 }, 55181 Search: { 55182 ProductSearch: '/search/asyncproductsearch/' 55183 }, 55184 Cart: { 55185 RemoveArtwork: '/cart/asyncremoveartwork/', 55186 RemoveItem: '/cart/asyncremoveitem/', 55187 UpdateAddress: '/cart/asyncupdateaddress/' 55188 }, 55189 Sample: { 55190 RemoveItem: '/sample/asyncremoveitem/',
55191 GetSampleCount: '/sample/asyncgetsamplecount/' 55192 }, 55193 Wishlist: { 55194 SendWishlist: '/wishlist/asyncsendwishlist/', 55195 SendWishlistEnquiry: '/wishlist/asyncsendwishlistenquiry/', 55196 AddItem: '/wishlist/asyncadditem/', 55197 RemoveItem: '/wishlist/asyncremoveitem/' 55198 }, 55199 Account: { 55200 DeleteAccountVault: '/account/asyncdeleteaccountvault', 55201 GetOrder: '/account/asyncgetorder/', 55202 GetOrderList: '/account/asyncgetorderlist/', 55203 GetInvoiceList: '/account/asyncgetinvoicelist/' 55204 }, 55205 Page: { 55206 GetContentPage: '/page/asyncgetcontentpage/' 55207 } 55208 } 55209 55210 55211 /** 55212 * Checks for an error in the Ajax response 55213 * @param {object} data Ajax response from the server 55214 * @returns {bool} Indicating whether or not an error was detected. 55215 */ 55216 var throwError = function (data) { 55217 if (data.ErrorType || data.ErrorType === 0) { 55218 AsyncException(data); 55219 return true; 55220 } else { 55221 return false; 55222 } 55223 }; 55224 55225 var done, 55226 fail, 55227 always, 55228 params = {}, 55229 url = '', 55230 doneDefault = function(data, status, xhr){}, 55231 failDefault = function(xhr, status, error){}, 55232 alwaysDefault = function(data, status, xhr){}; 55233 55234 55235 /** 55236 * Processes the requested Ajax request 55237 */ 55238 function process() { 55239 55240 var d = done; 55241 var f = fail; 55242 var a = always; 55243 55244 if (DEBUG) { 55245 console.log('processing...'); 55246 } 55247 55248 $.ajax({
55249 method: currentMethod, 55250 url: url, 55251 data: params 55252 }).done(function(data,status,xhr) { 55253 if (DEBUG) { 55254 console.log('ajax result(done):'); 55255 console.log(data); 55256 } 55257 if (!throwError(data)) { 55258 d(data, status, xhr); 55259 } else { 55260 f(data); 55261 } 55262 }).fail(function(xhr,status,error) { 55263 if (DEBUG) { 55264 console.log('ajax error(fail):'); 55265 console.log(error); 55266 } 55267 f(xhr,status,error); 55268 }).always(function(data, status, xhr) { 55269 if (DEBUG) { 55270 console.log('ajax result(always):'); 55271 console.log(data); 55272 } 55273 a(data, status, xhr); 55274 }); 55275 } 55276 55277 /** 55278 * Sets up the requested Ajax request; setting callback functions, parameters and the URL to be called 55279 * @param {string} area The area of the site the request is to be carried out on (usually a Controller) 55280 * @param {string} action The action result or method to be called in the Controller 55281 * @param {object} options The javascript object containing options and parameters as passed by the calling user 55282 */ 55283 function setup(area, action, options) { 55284 // Set method 55285 if (options.method && options.method.length) { 55286 currentMethod = options.method.toLowerCase() === 'get' ? methods[0] : methods[1]; 55287 } 55288 55289 // Set Parameters 55290 if (options.params) { 55291 params = options.params; 55292 } else { 55293 params = {}; 55294 } 55295 55296 // Check if a __RequestVerificationToken element has been added to the page content. 55297 if ($('.page-content > [name="__RequestVerificationToken"]').length) { 55298 // Set the parameter for the value of the __RequestVerificationToken. 55299 params['__RequestVerificationToken'] = $('.page-content > [name="__RequestVerificationToken"]').val(); 55300 } 55301 55302 if (DEBUG) { 55303 console.log('params:'); 55304 console.log(params); 55305 } 55306 55307 // Set Service URL 55308 if (area && action && urls[area][action]) { 55309 url = urls[area][action]; 55310 } else { 55311 url = 'javascript:void(0);'; 55312 } 55313 if (DEBUG) { 55314 console.log('url:'); 55315 console.log(url); 55316 } 55317 55318 55319 // Set Callbacks 55320 if (options.callback) { 55321 always = options.callback.always || alwaysDefault; 55322 done = options.callback.done || doneDefault; 55323 fail = options.callback.fail || failDefault; 55324 } else if (DEBUG) { 55325 always = alwaysDefault; 55326 done = doneDefault; 55327 fail = failDefault; 55328 console.log('options.callback is not defined'); 55329 } 55330 55331 55332 if (DEBUG) { 55333 console.log('always:'); 55334 console.log(always); 55335 55336 console.log('done:'); 55337 console.log(done); 55338 55339 console.log('fail:'); 55340 console.log(fail); 55341 } 55342 } 55343 55344 return { 55345 /** 55346 * Process: Called to request an Ajax request 55347 * @param {string} area The area of the site to make the request under (usually a Controller). 55348 * @param {string} action The method or Action Result to call 55349 * @param {object} options Contains parameters, callback functions and other user-defined options 55350 */ 55351 process: function(area, action, options) { 55352 if (DEBUG) { 55353 console.log('Options:'); 55354 console.log(options); 55355 } 55356 setup(area, action, options); 55357 process(); 55358 } 55359 }; 55360 55361}();; 55362function AsyncException(error) { 55363 55364 if (error.ErrorType === 5) { 55365 swal({ 55366 title: getTitle(error.ErrorType), 55367 text: error.Message, 55368 type: 'error', 55369 confirmButtonColor: '#0083BF', 55370 closeOnConfirm: false, 55371 confirmButtonText: 'Login', 55372 showLoaderOnConfirm: true, 55373 allowOutsideClick: false, 55374 allowEscapeKey: false, 55375 preConfirm: function () { 55376 return new Promise(function (resolve) { 55377 window.location.href = '/Account/Login'; 55378 }); 55379 } 55380 }); 55381 } else { 55382 if (Boolean(error.ForceReload)) { 55383 swal({ 55384 title: getTitle(error.ErrorType), 55385 text: error.Message, 55386 type: 'error', 55387 confirmButtonColor: '#0083BF', 55388 closeOnConfirm: false, 55389 confirmButtonText: 'Reload Page', 55390 showLoaderOnConfirm: true, 55391 allowOutsideClick: false, 55392 allowEscapeKey: false, 55393 preConfirm: function () { 55394 return new Promise(function (resolve) { 55395 location.reload(); 55396 }); 55397 } 55398 }); 55399 } else { 55400 swal({ 55401 title: getTitle(error.ErrorType), 55402 text: error.Message, 55403 type: 'error', 55404 confirmButtonColor: '#0083BF', 55405 allowOutsideClick: false, 55406 allowEscapeKey: false 55407 }); 55408 } 55409 } 55410 55411 function getTitle(errorType) { 55412 switch(errorType) { 55413 case -1: 55414 return 'Operation Failed'; 55415 case 1: 55416 return 'Permission Denied'; 55417 case 2: 55418 return 'Unexpected Error'; 55419 case 3: 55420 return 'Load Failed'; 55421 case 4: 55422 return 'Save Failed'; 55423 case 5: 55424 return 'Not Logged In'; 55425 case 6: 55426 return 'Unknown Operation'; 55427 case 7: 55428 return 'Delete Failed'; 55429 default: 55430 return 'Error'; 55431 } 55432 } 55433}; 55434const TpcUtility = { 55435 /** 55436 * Gets the tawk.to widget chat ID. 55437 * @param chatId {string} - The value of the tawk.to property ID (and optionally a widget ID). 55438 * @returns {string} - A string value that contains a tawk.to property ID and widget ID. 55439 */
55440 getTawkToChatId: function(chatId) { 55441 if (!chatId || chatId === "") { 55442 return ""; 55443 } 55444 55445 if (chatId.includes("/")) { 55446 return chatId; 55447 } 55448 55449 return `${chatId}/default`; 55450 }, 55451 stripHtmlTags: function(value) { 55452 let isObject = typeof value === "object"; 55453 55454 if (typeof value !== "string" && !isObject) { 55455 return value; 55456 } 55457 55458 if (isObject) { 55459 value = JSON.stringify(value); 55460 } 55461 55462 let result = value.replace(/(<[^>]*>)/g, ""); 55463 55464 if (isObject) { 55465 result = JSON.parse(result); 55466 } 55467 55468 return result; 55469 } 55470};; 55471/* global $, Cookies */ 55472 55473/** 55474 * @file - Handles displaying of notices that require using acceptance 55475 * and storing that value in specified cookies. 55476 * @copyright - 2021 Facilisgroup. 55477 */ 55478 55479const Notices = (() => { 55480 55481 const modes = { 55482 "default": 0, 55483 "intrusive": 1 55484 }; 55485 const $notices = $('#notices'); 55486 const $repWindow = $('#rep-window:not(.bottom-bound)'); 55487 const cookiesArray = [ 55488 { 55489 "name": 'AcceptedCookieUsage', 55490 "expiryInDays": 3650 55491 }, 55492 { 55493 "name": 'AcceptedAdaCompliance', 55494 "expiryInDays": 3650 55495 } 55496 ]; 55497 let mode = 0; 55498
55499 const setCookie = (cookie, value) => { 55500 Cookies.set(cookie.name, value, { expires: cookie.expiryInDays }); 55501 } 55502 55503 const setRepWindowHeight = () => { 55504 if (mode !== modes.default) { 55505 return; 55506 } 55507 55508 const noticeHeight = $notices.height(); 55509 $repWindow.css({ 'bottom': `${noticeHeight}px` }); 55510 } 55511 55512 const displayNextOverlayNotice = () => { 55513 if (mode !== modes.intrusive) { 55514 return; 55515 } 55516 55517 if ($('.app-notice').length) { 55518 $('.app-notice').first('.hidden').removeClass('hidden'); 55519 } else { 55520 $('#notices-overlay').fadeOut().remove(); 55521 $('body').removeClass('notices-overlay-open'); 55522 } 55523 } 55524 55525 const renderNoticeOverlay = () => { 55526 if (!$('.app-notice').length || mode !== modes.intrusive) { 55527 return; 55528 } 55529 55530 const $noticesOverlay = $('<div/>', { 'id': 'notices-overlay', 'class': 'app-notice-overlay' }); 55531 55532 $.each($('.app-notice'), (i, notice) => { 55533 const $copyNotice = $(notice).clone(); 55534 $copyNotice.addClass(i > 0 ? 'hidden' : ''); 55535 $noticesOverlay.append($copyNotice); 55536 $(notice).remove(); 55537 }); 55538 55539 $notices.remove(); 55540 55541 $('body') 55542 .addClass('notices-overlay-open') 55543 .append($noticesOverlay); 55544 } 55545 55546 const init = (selectedMode = modes.default) => { 55547 mode = selectedMode; 55548 55549 cookiesArray.forEach((c) => { 55550 const cookie = Cookies.get(c.name); 55551 if (cookie === undefined || cookie === 'false') { 55552 setCookie(c, false); 55553 } 55554 }); 55555 55556 switch (mode) { 55557 case modes.default: 55558 setRepWindowHeight(); 55559 break; 55560 case modes.intrusive: 55561 renderNoticeOverlay(); 55562 break; 55563 } 55564 } 55565 55566 $('body').on('click', '.btn-accept-notice', function () { 55567 const type = $(this).data('type'); 55568 const cookieName = `Accepted${type}`; 55569 const cookie = cookiesArray.find((c) => c.name === cookieName); 55570 55571 setCookie(cookie, true); 55572 55573 $(`.app-notice[data-type="${type}"]`).remove(); 55574 55575 setRepWindowHeight(); 55576 displayNextOverlayNotice(); 55577 }); 55578 55579 window.addEventListener('resize', () => { 55580 if (!$('.app-notice').length) { 55581 return; 55582 } 55583 55584 setRepWindowHeight(); 55585 }); 55586 55587 return { 55588 init: init, 55589 modes: modes 55590 } 55591 55592})();; 55593/* 55594 * l10n.js 55595 * 2014-05-02 55596 * 55597 * By Eli Grey, http://eligrey.com 55598 * Licensed under the MIT License 55599 * See https://github.com/eligrey/l10n.js/blob/master/LICENSE.md 55600 */ 55601 55602/*global XMLHttpRequest, setTimeout, document, navigator, ActiveXObject*/ 55603 55604/*! @source http://purl.eligrey.com/github/l10n.js/blob/master/l10n.js*/ 55605 55606(function () { 55607"use strict"; 55608 55609var 55610 undef_type = "undefined" 55611, string_type = "string" 55612, nav = self.navigator 55613, String_ctr = String 55614, has_own_prop = Object.prototype.hasOwnProperty 55615, load_queues = {} 55616, localizations = {} 55617, FALSE = !1 55618, TRUE = !0 55619// the official format is application/vnd.oftn.l10n+json, though l10n.js will also 55620// accept application/x-l10n+json and application/l10n+json 55621, l10n_js_media_type = /^\s*application\/(?:vnd\.oftn\.|x-)?l10n\+json\s*(?:$|;)/i 55622, XHR 55623 55624// property minification aids 55625, $locale = "locale" 55626, $default_locale = "defaultLocale" 55627, $to_locale_string = "toLocaleString" 55628, $to_lowercase = "toLowerCase" 55629 55630, array_index_of = Array.prototype.indexOf || function (item) { 55631 var 55632 len = this.length 55633 , i = 0 55634 ; 55635 55636 for (; i < len; i++) { 55637 if (i in this && this[i] === item) { 55638 return i; 55639 } 55640 } 55641 55642 return -1; 55643} 55644, request_JSON = function (uri) { 55645 var req = new XHR(), 55646 data = {}; 55647 55648 // sadly, this has to be blocking to allow for a graceful degrading API 55649 req.open("GET", uri, FALSE); 55650 req.send(null); 55651 55652 // Status codes can be inconsistent across browsers so we simply try to parse 55653 // the response text and catch any errors. This deals with failed requests as 55654 // well as malformed json files. 55655 try { 55656 data = JSON.parse(req.responseText); 55657 } catch(e) { 55658 // warn about error without stopping execution 55659 setTimeout(function () { 55660 // Error messages are not localized as not to cause an infinite loop 55661 var l10n_err = new Error("Unable to load localization data: " + uri); 55662 l10n_err.name = "Localization Error"; 55663 throw l10n_err; 55664 }, 0); 55665 } 55666 55667 return data; 55668} 55669, load = String_ctr[$to_locale_string] = function (data) {
55670 // don't handle function.toLocaleString(indentationAmount:Number) 55671 if (arguments.length > 0 && typeof data !== "number") { 55672 if (typeof data === string_type) { 55673 load(request_JSON(data)); 55674 } else if (data === FALSE) { 55675 // reset all localizations 55676 localizations = {}; 55677 } else { 55678 // Extend current localizations instead of completely overwriting them 55679 var locale, localization, message; 55680 for (locale in data) { 55681 if (has_own_prop.call(data, locale)) { 55682 localization = data[locale]; 55683 locale = locale[$to_lowercase](); 55684 55685 if (!(locale in localizations) || localization === FALSE) { 55686 // reset locale if not existing or reset flag is specified 55687 localizations[locale] = {}; 55688 } 55689 55690 if (localization === FALSE) { 55691 continue; 55692 } 55693 55694 // URL specified 55695 if (typeof localization === string_type) { 55696 if (String_ctr[$locale][$to_lowercase]().indexOf(locale) === 0) { 55697 localization = request_JSON(localization); 55698 } else { 55699 // queue loading locale if not needed 55700 if (!(locale in load_queues)) { 55701 load_queues[locale] = []; 55702 } 55703 load_queues[locale].push(localization); 55704 continue; 55705 } 55706 } 55707 55708 for (message in localization) { 55709 if (has_own_prop.call(localization, message)) { 55710 localizations[locale][message] = localization[message]; 55711 } 55712 } 55713 } 55714 } 55715 } 55716 } 55717 // Return what function.toLocaleString() normally returns 55718 return Function.prototype[$to_locale_string].apply(String_ctr, arguments); 55719} 55720, process_load_queue = function (locale) { 55721 var 55722 queue = load_queues[locale] 55723 , i = 0 55724 , len = queue.length 55725 , localization 55726 ; 55727 55728 for (; i < len; i++) { 55729 localization = {}; 55730 localization[locale] = request_JSON(queue[i]); 55731 load(localization); 55732 } 55733 55734 delete load_queues[locale]; 55735} 55736, use_default 55737, localize = String_ctr.prototype[$to_locale_string] = function () { 55738 var 55739 using_default = use_default 55740 , current_locale = String_ctr[using_default ? $default_locale : $locale] 55741 , parts = current_locale[$to_lowercase]().split("-") 55742 , i = parts.length 55743 , this_val = this.valueOf() 55744 , locale 55745 ; 55746 55747 use_default = FALSE; 55748 55749 // Iterate through locales starting at most-specific until a localization is found 55750 do { 55751 locale = parts.slice(0, i).join("-"); 55752 // load locale if not loaded 55753 if (locale in load_queues) { 55754 process_load_queue(locale); 55755 } 55756 if (locale in localizations && this_val in localizations[locale]) { 55757 return localizations[locale][this_val]; 55758 } 55759 } 55760 while (i --> 1); 55761 55762 if (!using_default && String_ctr[$default_locale]) { 55763 use_default = TRUE; 55764 return localize.call(this_val); 55765 } 55766 55767 return this_val; 55768} 55769; 55770 55771if (typeof XMLHttpRequest === undef_type && typeof ActiveXObject !== undef_type) { 55772 var AXO = ActiveXObject; 55773 55774 XHR = function () { 55775 try { 55776 return new AXO("Msxml2.XMLHTTP.6.0"); 55777 } catch (xhrEx1) {} 55778 try { 55779 return new AXO("Msxml2.XMLHTTP.3.0"); 55780 } catch (xhrEx2) {} 55781 try { 55782 return new AXO("Msxml2.XMLHTTP"); 55783 } catch (xhrEx3) {} 55784 55785 throw new Error("XMLHttpRequest not supported by this browser."); 55786 }; 55787} else { 55788 XHR = XMLHttpRequest; 55789} 55790 55791String_ctr[$default_locale] = String_ctr[$default_locale] || ""; 55792String_ctr[$locale] = nav && (nav.language || nav.userLanguage) || ""; 55793 55794if (typeof document !== undef_type) { 55795 var 55796 elts = document.getElementsByTagName("link") 55797 , i = elts.length 55798 , localization 55799 ; 55800 55801 while (i--) { 55802 var 55803 elt = elts[i] 55804 , rel = (elt.getAttribute("rel") || "")[$to_lowercase]().split(/\s+/) 55805 ; 55806 55807 if (l10n_js_media_type.test(elt.type)) { 55808 if (array_index_of.call(rel, "localizations") !== -1) { 55809 // multiple localizations 55810 load(elt.getAttribute("href")); 55811 } else if (array_index_of.call(rel, "localization") !== -1) { 55812 // single localization 55813 localization = {}; 55814 localization[(elt.getAttribute("hreflang") || "")[$to_lowercase]()] = 55815 elt.getAttribute("href"); 55816 load(localization); 55817 } 55818 } 55819 } 55820} 55821 55822}()); 55823; 55824 55825/** Class representing the Localization. */ 55826var Localize = (function () { 55827 var translationsObj = {}; 55828 55829 function init(params) { 55830 setTranslations(); 55831
vendor: 7,665 bytes, lines 55832-56103
55832 String.toLocaleString(translationsObj); 55833 if (params.hasOwnProperty('locale') && params.locale.length) 55834 String.locale = params.locale; 55835 } 55836 55837 function setTranslations() { 55838 translationsObj[1] = { 55839 "color": "colour", 55840 "inquire": "enquire", 55841 "inquiry": "enquiry", 55842 "inquiring": "enquiring" 55843 } //Canadian translations 55844 } 55845 55846 return { 55847 Init: function(params) { 55848 init(params); 55849 }, 55850 GetLocaleString: function (string) { 55851 return string.toLowerCase().toLocaleString(); 55852 } 55853 } 55854}());; 55855//! moment.js 55856//! version : 2.29.4 55857//! authors : Tim Wood, Iskren Chernev, Moment.js contributors 55858//! license : MIT 55859//! momentjs.com 55860 55861; (function (global, factory) { 55862 typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : 55863 typeof define === 'function' && define.amd ? define(factory) : 55864 global.moment = factory() 55865}(this, (function () { 55866 'use strict'; 55867 55868 var hookCallback; 55869 55870 function hooks() { 55871 return hookCallback.apply(null, arguments); 55872 } 55873 55874 // This is done to register the method called with moment() 55875 // without creating circular dependencies. 55876 function setHookCallback(callback) { 55877 hookCallback = callback; 55878 } 55879 55880 function isArray(input) { 55881 return ( 55882 input instanceof Array || 55883 Object.prototype.toString.call(input) === '[object Array]' 55884 ); 55885 } 55886 55887 function isObject(input) { 55888 // IE8 will treat undefined and null as object if it wasn't for 55889 // input != null 55890 return ( 55891 input != null && 55892 Object.prototype.toString.call(input) === '[object Object]' 55893 ); 55894 } 55895 55896 function hasOwnProp(a, b) { 55897 return Object.prototype.hasOwnProperty.call(a, b); 55898 } 55899 55900 function isObjectEmpty(obj) { 55901 if (Object.getOwnPropertyNames) { 55902 return Object.getOwnPropertyNames(obj).length === 0; 55903 } else { 55904 var k; 55905 for (k in obj) { 55906 if (hasOwnProp(obj, k)) { 55907 return false; 55908 } 55909 } 55910 return true; 55911 } 55912 } 55913 55914 function isUndefined(input) { 55915 return input === void 0; 55916 } 55917 55918 function isNumber(input) { 55919 return ( 55920 typeof input === 'number' || 55921 Object.prototype.toString.call(input) === '[object Number]' 55922 ); 55923 } 55924 55925 function isDate(input) { 55926 return ( 55927 input instanceof Date || 55928 Object.prototype.toString.call(input) === '[object Date]' 55929 ); 55930 } 55931 55932 function map(arr, fn) { 55933 var res = [], 55934 i, 55935 arrLen = arr.length; 55936 for (i = 0; i < arrLen; ++i) { 55937 res.push(fn(arr[i], i)); 55938 } 55939 return res; 55940 } 55941 55942 function extend(a, b) { 55943 for (var i in b) { 55944 if (hasOwnProp(b, i)) { 55945 a[i] = b[i]; 55946 } 55947 } 55948 55949 if (hasOwnProp(b, 'toString')) { 55950 a.toString = b.toString; 55951 } 55952 55953 if (hasOwnProp(b, 'valueOf')) { 55954 a.valueOf = b.valueOf; 55955 } 55956 55957 return a; 55958 } 55959 55960 function createUTC(input, format, locale, strict) { 55961 return createLocalOrUTC(input, format, locale, strict, true).utc(); 55962 } 55963 55964 function defaultParsingFlags() { 55965 // We need to deep clone this object. 55966 return { 55967 empty: false, 55968 unusedTokens: [], 55969 unusedInput: [], 55970 overflow: -2, 55971 charsLeftOver: 0, 55972 nullInput: false, 55973 invalidEra: null, 55974 invalidMonth: null, 55975 invalidFormat: false, 55976 userInvalidated: false, 55977 iso: false, 55978 parsedDateParts: [], 55979 era: null, 55980 meridiem: null, 55981 rfc2822: false, 55982 weekdayMismatch: false, 55983 }; 55984 } 55985 55986 function getParsingFlags(m) { 55987 if (m._pf == null) { 55988 m._pf = defaultParsingFlags(); 55989 } 55990 return m._pf; 55991 } 55992 55993 var some; 55994 if (Array.prototype.some) { 55995 some = Array.prototype.some; 55996 } else { 55997 some = function (fun) { 55998 var t = Object(this), 55999 len = t.length >>> 0, 56000 i; 56001 56002 for (i = 0; i < len; i++) { 56003 if (i in t && fun.call(this, t[i], i, t)) { 56004 return true; 56005 } 56006 } 56007 56008 return false; 56009 }; 56010 } 56011 56012 function isValid(m) { 56013 if (m._isValid == null) { 56014 var flags = getParsingFlags(m), 56015 parsedParts = some.call(flags.parsedDateParts, function (i) { 56016 return i != null; 56017 }), 56018 isNowValid = 56019 !isNaN(m._d.getTime()) && 56020 flags.overflow < 0 && 56021 !flags.empty && 56022 !flags.invalidEra && 56023 !flags.invalidMonth && 56024 !flags.invalidWeekday && 56025 !flags.weekdayMismatch && 56026 !flags.nullInput && 56027 !flags.invalidFormat && 56028 !flags.userInvalidated && 56029 (!flags.meridiem || (flags.meridiem && parsedParts)); 56030 56031 if (m._strict) { 56032 isNowValid = 56033 isNowValid && 56034 flags.charsLeftOver === 0 && 56035 flags.unusedTokens.length === 0 && 56036 flags.bigHour === undefined; 56037 } 56038 56039 if (Object.isFrozen == null || !Object.isFrozen(m)) { 56040 m._isValid = isNowValid; 56041 } else { 56042 return isNowValid; 56043 } 56044 } 56045 return m._isValid; 56046 } 56047 56048 function createInvalid(flags) { 56049 var m = createUTC(NaN); 56050 if (flags != null) { 56051 extend(getParsingFlags(m), flags); 56052 } else { 56053 getParsingFlags(m).userInvalidated = true; 56054 } 56055 56056 return m; 56057 } 56058 56059 // Plugins that add properties should also add the key here (null value), 56060 // so we can properly clone ourselves. 56061 var momentProperties = (hooks.momentProperties = []), 56062 updateInProgress = false; 56063 56064 function copyConfig(to, from) { 56065 var i, 56066 prop, 56067 val, 56068 momentPropertiesLen = momentProperties.length; 56069 56070 if (!isUndefined(from._isAMomentObject)) { 56071 to._isAMomentObject = from._isAMomentObject; 56072 } 56073 if (!isUndefined(from._i)) { 56074 to._i = from._i; 56075 } 56076 if (!isUndefined(from._f)) { 56077 to._f = from._f; 56078 } 56079 if (!isUndefined(from._l)) { 56080 to._l = from._l; 56081 } 56082 if (!isUndefined(from._strict)) { 56083 to._strict = from._strict; 56084 } 56085 if (!isUndefined(from._tzm)) { 56086 to._tzm = from._tzm; 56087 } 56088 if (!isUndefined(from._isUTC)) { 56089 to._isUTC = from._isUTC; 56090 } 56091 if (!isUndefined(from._offset)) { 56092 to._offset = from._offset; 56093 } 56094 if (!isUndefined(from._pf)) { 56095 to._pf = getParsingFlags(from); 56096 } 56097 if (!isUndefined(from._locale)) { 56098 to._locale = from._locale; 56099 } 56100 56101 if (momentPropertiesLen > 0) { 56102 for (i = 0; i < momentPropertiesLen; i++) { 56103 prop = momentProperties[i];
vendor: 53,746 bytes, lines 56104-57818
56104 val = from[prop]; 56105 if (!isUndefined(val)) { 56106 to[prop] = val; 56107 } 56108 } 56109 } 56110 56111 return to; 56112 } 56113 56114 // Moment prototype object 56115 function Moment(config) { 56116 copyConfig(this, config); 56117 this._d = new Date(config._d != null ? config._d.getTime() : NaN); 56118 if (!this.isValid()) { 56119 this._d = new Date(NaN); 56120 } 56121 // Prevent infinite loop in case updateOffset creates new moment 56122 // objects. 56123 if (updateInProgress === false) { 56124 updateInProgress = true; 56125 hooks.updateOffset(this); 56126 updateInProgress = false; 56127 } 56128 } 56129 56130 function isMoment(obj) { 56131 return ( 56132 obj instanceof Moment || (obj != null && obj._isAMomentObject != null) 56133 ); 56134 } 56135 56136 function warn(msg) { 56137 if ( 56138 hooks.suppressDeprecationWarnings === false && 56139 typeof console !== 'undefined' && 56140 console.warn 56141 ) { 56142 console.warn('Deprecation warning: ' + msg); 56143 } 56144 } 56145 56146 function deprecate(msg, fn) { 56147 var firstTime = true; 56148 56149 return extend(function () { 56150 if (hooks.deprecationHandler != null) { 56151 hooks.deprecationHandler(null, msg); 56152 } 56153 if (firstTime) { 56154 var args = [], 56155 arg, 56156 i, 56157 key, 56158 argLen = arguments.length; 56159 for (i = 0; i < argLen; i++) { 56160 arg = ''; 56161 if (typeof arguments[i] === 'object') { 56162 arg += '\n[' + i + '] '; 56163 for (key in arguments[0]) { 56164 if (hasOwnProp(arguments[0], key)) { 56165 arg += key + ': ' + arguments[0][key] + ', '; 56166 } 56167 } 56168 arg = arg.slice(0, -2); // Remove trailing comma and space 56169 } else { 56170 arg = arguments[i]; 56171 } 56172 args.push(arg); 56173 } 56174 warn( 56175 msg + 56176 '\nArguments: ' + 56177 Array.prototype.slice.call(args).join('') + 56178 '\n' + 56179 new Error().stack 56180 ); 56181 firstTime = false; 56182 } 56183 return fn.apply(this, arguments); 56184 }, fn); 56185 } 56186 56187 var deprecations = {}; 56188 56189 function deprecateSimple(name, msg) { 56190 if (hooks.deprecationHandler != null) { 56191 hooks.deprecationHandler(name, msg); 56192 } 56193 if (!deprecations[name]) { 56194 warn(msg); 56195 deprecations[name] = true; 56196 } 56197 } 56198 56199 hooks.suppressDeprecationWarnings = false; 56200 hooks.deprecationHandler = null; 56201 56202 function isFunction(input) { 56203 return ( 56204 (typeof Function !== 'undefined' && input instanceof Function) || 56205 Object.prototype.toString.call(input) === '[object Function]' 56206 ); 56207 } 56208 56209 function set(config) { 56210 var prop, i; 56211 for (i in config) { 56212 if (hasOwnProp(config, i)) { 56213 prop = config[i]; 56214 if (isFunction(prop)) { 56215 this[i] = prop; 56216 } else { 56217 this['_' + i] = prop; 56218 } 56219 } 56220 } 56221 this._config = config; 56222 // Lenient ordinal parsing accepts just a number in addition to 56223 // number + (possibly) stuff coming from _dayOfMonthOrdinalParse. 56224 // TODO: Remove "ordinalParse" fallback in next major release. 56225 this._dayOfMonthOrdinalParseLenient = new RegExp( 56226 (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) + 56227 '|' + 56228 /\d{1,2}/.source 56229 ); 56230 } 56231 56232 function mergeConfigs(parentConfig, childConfig) { 56233 var res = extend({}, parentConfig), 56234 prop; 56235 for (prop in childConfig) { 56236 if (hasOwnProp(childConfig, prop)) { 56237 if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) { 56238 res[prop] = {}; 56239 extend(res[prop], parentConfig[prop]); 56240 extend(res[prop], childConfig[prop]); 56241 } else if (childConfig[prop] != null) { 56242 res[prop] = childConfig[prop]; 56243 } else { 56244 delete res[prop]; 56245 } 56246 } 56247 } 56248 for (prop in parentConfig) { 56249 if ( 56250 hasOwnProp(parentConfig, prop) && 56251 !hasOwnProp(childConfig, prop) && 56252 isObject(parentConfig[prop]) 56253 ) { 56254 // make sure changes to properties don't modify parent config 56255 res[prop] = extend({}, res[prop]); 56256 } 56257 } 56258 return res; 56259 } 56260 56261 function Locale(config) { 56262 if (config != null) { 56263 this.set(config); 56264 } 56265 } 56266 56267 var keys; 56268 56269 if (Object.keys) { 56270 keys = Object.keys; 56271 } else { 56272 keys = function (obj) { 56273 var i, 56274 res = []; 56275 for (i in obj) { 56276 if (hasOwnProp(obj, i)) { 56277 res.push(i); 56278 } 56279 } 56280 return res; 56281 }; 56282 } 56283 56284 var defaultCalendar = { 56285 sameDay: '[Today at] LT', 56286 nextDay: '[Tomorrow at] LT', 56287 nextWeek: 'dddd [at] LT', 56288 lastDay: '[Yesterday at] LT', 56289 lastWeek: '[Last] dddd [at] LT', 56290 sameElse: 'L', 56291 }; 56292 56293 function calendar(key, mom, now) { 56294 var output = this._calendar[key] || this._calendar['sameElse']; 56295 return isFunction(output) ? output.call(mom, now) : output; 56296 } 56297 56298 function zeroFill(number, targetLength, forceSign) { 56299 var absNumber = '' + Math.abs(number), 56300 zerosToFill = targetLength - absNumber.length, 56301 sign = number >= 0; 56302 return ( 56303 (sign ? (forceSign ? '+' : '') : '-') + 56304 Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + 56305 absNumber 56306 ); 56307 } 56308 56309 var formattingTokens = 56310 /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g, 56311 localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, 56312 formatFunctions = {}, 56313 formatTokenFunctions = {}; 56314 56315 // token: 'M' 56316 // padded: ['MM', 2] 56317 // ordinal: 'Mo' 56318 // callback: function () { this.month() + 1 } 56319 function addFormatToken(token, padded, ordinal, callback) { 56320 var func = callback; 56321 if (typeof callback === 'string') { 56322 func = function () { 56323 return this[callback](); 56324 }; 56325 } 56326 if (token) { 56327 formatTokenFunctions[token] = func; 56328 } 56329 if (padded) { 56330 formatTokenFunctions[padded[0]] = function () { 56331 return zeroFill(func.apply(this, arguments), padded[1], padded[2]); 56332 }; 56333 } 56334 if (ordinal) { 56335 formatTokenFunctions[ordinal] = function () { 56336 return this.localeData().ordinal( 56337 func.apply(this, arguments), 56338 token 56339 ); 56340 }; 56341 } 56342 } 56343 56344 function removeFormattingTokens(input) { 56345 if (input.match(/\[[\s\S]/)) { 56346 return input.replace(/^\[|\]$/g, ''); 56347 } 56348 return input.replace(/\\/g, ''); 56349 } 56350 56351 function makeFormatFunction(format) { 56352 var array = format.match(formattingTokens), 56353 i, 56354 length; 56355 56356 for (i = 0, length = array.length; i < length; i++) { 56357 if (formatTokenFunctions[array[i]]) { 56358 array[i] = formatTokenFunctions[array[i]]; 56359 } else { 56360 array[i] = removeFormattingTokens(array[i]); 56361 } 56362 } 56363 56364 return function (mom) { 56365 var output = '', 56366 i; 56367 for (i = 0; i < length; i++) { 56368 output += isFunction(array[i]) 56369 ? array[i].call(mom, format) 56370 : array[i]; 56371 } 56372 return output; 56373 }; 56374 } 56375 56376 // format date using native date object 56377 function formatMoment(m, format) { 56378 if (!m.isValid()) { 56379 return m.localeData().invalidDate(); 56380 } 56381 56382 format = expandFormat(format, m.localeData()); 56383 formatFunctions[format] = 56384 formatFunctions[format] || makeFormatFunction(format); 56385 56386 return formatFunctions[format](m); 56387 } 56388 56389 function expandFormat(format, locale) { 56390 var i = 5; 56391 56392 function replaceLongDateFormatTokens(input) { 56393 return locale.longDateFormat(input) || input; 56394 } 56395 56396 localFormattingTokens.lastIndex = 0; 56397 while (i >= 0 && localFormattingTokens.test(format)) { 56398 format = format.replace( 56399 localFormattingTokens, 56400 replaceLongDateFormatTokens 56401 ); 56402 localFormattingTokens.lastIndex = 0; 56403 i -= 1; 56404 } 56405 56406 return format; 56407 } 56408 56409 var defaultLongDateFormat = { 56410 LTS: 'h:mm:ss A', 56411 LT: 'h:mm A', 56412 L: 'MM/DD/YYYY', 56413 LL: 'MMMM D, YYYY', 56414 LLL: 'MMMM D, YYYY h:mm A', 56415 LLLL: 'dddd, MMMM D, YYYY h:mm A', 56416 }; 56417 56418 function longDateFormat(key) { 56419 var format = this._longDateFormat[key], 56420 formatUpper = this._longDateFormat[key.toUpperCase()]; 56421 56422 if (format || !formatUpper) { 56423 return format; 56424 } 56425 56426 this._longDateFormat[key] = formatUpper 56427 .match(formattingTokens) 56428 .map(function (tok) { 56429 if ( 56430 tok === 'MMMM' || 56431 tok === 'MM' || 56432 tok === 'DD' || 56433 tok === 'dddd' 56434 ) { 56435 return tok.slice(1); 56436 } 56437 return tok; 56438 }) 56439 .join(''); 56440 56441 return this._longDateFormat[key]; 56442 } 56443 56444 var defaultInvalidDate = 'Invalid date'; 56445 56446 function invalidDate() { 56447 return this._invalidDate; 56448 } 56449 56450 var defaultOrdinal = '%d', 56451 defaultDayOfMonthOrdinalParse = /\d{1,2}/; 56452 56453 function ordinal(number) { 56454 return this._ordinal.replace('%d', number); 56455 } 56456 56457 var defaultRelativeTime = { 56458 future: 'in %s', 56459 past: '%s ago', 56460 s: 'a few seconds', 56461 ss: '%d seconds', 56462 m: 'a minute', 56463 mm: '%d minutes', 56464 h: 'an hour', 56465 hh: '%d hours', 56466 d: 'a day', 56467 dd: '%d days', 56468 w: 'a week', 56469 ww: '%d weeks', 56470 M: 'a month', 56471 MM: '%d months', 56472 y: 'a year', 56473 yy: '%d years', 56474 }; 56475 56476 function relativeTime(number, withoutSuffix, string, isFuture) { 56477 var output = this._relativeTime[string]; 56478 return isFunction(output) 56479 ? output(number, withoutSuffix, string, isFuture) 56480 : output.replace(/%d/i, number); 56481 } 56482 56483 function pastFuture(diff, output) { 56484 var format = this._relativeTime[diff > 0 ? 'future' : 'past']; 56485 return isFunction(format) ? format(output) : format.replace(/%s/i, output); 56486 } 56487 56488 var aliases = {}; 56489 56490 function addUnitAlias(unit, shorthand) { 56491 var lowerCase = unit.toLowerCase(); 56492 aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit; 56493 } 56494 56495 function normalizeUnits(units) { 56496 return typeof units === 'string' 56497 ? aliases[units] || aliases[units.toLowerCase()] 56498 : undefined; 56499 } 56500 56501 function normalizeObjectUnits(inputObject) { 56502 var normalizedInput = {}, 56503 normalizedProp, 56504 prop; 56505 56506 for (prop in inputObject) { 56507 if (hasOwnProp(inputObject, prop)) { 56508 normalizedProp = normalizeUnits(prop); 56509 if (normalizedProp) { 56510 normalizedInput[normalizedProp] = inputObject[prop]; 56511 } 56512 } 56513 } 56514 56515 return normalizedInput; 56516 } 56517 56518 var priorities = {}; 56519 56520 function addUnitPriority(unit, priority) { 56521 priorities[unit] = priority; 56522 } 56523 56524 function getPrioritizedUnits(unitsObj) { 56525 var units = [], 56526 u; 56527 for (u in unitsObj) { 56528 if (hasOwnProp(unitsObj, u)) { 56529 units.push({ unit: u, priority: priorities[u] }); 56530 } 56531 } 56532 units.sort(function (a, b) { 56533 return a.priority - b.priority; 56534 }); 56535 return units; 56536 } 56537 56538 function isLeapYear(year) { 56539 return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; 56540 } 56541 56542 function absFloor(number) { 56543 if (number < 0) { 56544 // -0 -> 0 56545 return Math.ceil(number) || 0; 56546 } else { 56547 return Math.floor(number); 56548 } 56549 } 56550 56551 function toInt(argumentForCoercion) { 56552 var coercedNumber = +argumentForCoercion, 56553 value = 0; 56554 56555 if (coercedNumber !== 0 && isFinite(coercedNumber)) { 56556 value = absFloor(coercedNumber); 56557 } 56558 56559 return value; 56560 } 56561 56562 function makeGetSet(unit, keepTime) { 56563 return function (value) { 56564 if (value != null) { 56565 set$1(this, unit, value); 56566 hooks.updateOffset(this, keepTime); 56567 return this; 56568 } else { 56569 return get(this, unit); 56570 } 56571 }; 56572 } 56573 56574 function get(mom, unit) { 56575 return mom.isValid() 56576 ? mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() 56577 : NaN; 56578 } 56579 56580 function set$1(mom, unit, value) { 56581 if (mom.isValid() && !isNaN(value)) { 56582 if ( 56583 unit === 'FullYear' && 56584 isLeapYear(mom.year()) && 56585 mom.month() === 1 && 56586 mom.date() === 29 56587 ) { 56588 value = toInt(value); 56589 mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit]( 56590 value, 56591 mom.month(), 56592 daysInMonth(value, mom.month()) 56593 ); 56594 } else { 56595 mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value); 56596 } 56597 } 56598 } 56599 56600 // MOMENTS 56601 56602 function stringGet(units) { 56603 units = normalizeUnits(units); 56604 if (isFunction(this[units])) { 56605 return this[units](); 56606 } 56607 return this; 56608 } 56609 56610 function stringSet(units, value) { 56611 if (typeof units === 'object') { 56612 units = normalizeObjectUnits(units); 56613 var prioritized = getPrioritizedUnits(units), 56614 i, 56615 prioritizedLen = prioritized.length; 56616 for (i = 0; i < prioritizedLen; i++) { 56617 this[prioritized[i].unit](units[prioritized[i].unit]); 56618 } 56619 } else { 56620 units = normalizeUnits(units); 56621 if (isFunction(this[units])) { 56622 return this[units](value); 56623 } 56624 } 56625 return this; 56626 } 56627 56628 var match1 = /\d/, // 0 - 9 56629 match2 = /\d\d/, // 00 - 99 56630 match3 = /\d{3}/, // 000 - 999 56631 match4 = /\d{4}/, // 0000 - 9999 56632 match6 = /[+-]?\d{6}/, // -999999 - 999999 56633 match1to2 = /\d\d?/, // 0 - 99 56634 match3to4 = /\d\d\d\d?/, // 999 - 9999 56635 match5to6 = /\d\d\d\d\d\d?/, // 99999 - 999999 56636 match1to3 = /\d{1,3}/, // 0 - 999 56637 match1to4 = /\d{1,4}/, // 0 - 9999 56638 match1to6 = /[+-]?\d{1,6}/, // -999999 - 999999 56639 matchUnsigned = /\d+/, // 0 - inf 56640 matchSigned = /[+-]?\d+/, // -inf - inf 56641 matchOffset = /Z|[+-]\d\d:?\d\d/gi, // +00:00 -00:00 +0000 -0000 or Z 56642 matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi, // +00 -00 +00:00 -00:00 +0000 -0000 or Z 56643 matchTimestamp = /[+-]?\d+(\.\d{1,3})?/, // 123456789 123456789.123 56644 // any word (or two) characters or numbers including two/three word month in arabic. 56645 // includes scottish gaelic two word and hyphenated months 56646 matchWord = 56647 /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i, 56648 regexes; 56649 56650 regexes = {}; 56651 56652 function addRegexToken(token, regex, strictRegex) { 56653 regexes[token] = isFunction(regex) 56654 ? regex 56655 : function (isStrict, localeData) { 56656 return isStrict && strictRegex ? strictRegex : regex; 56657 }; 56658 } 56659 56660 function getParseRegexForToken(token, config) { 56661 if (!hasOwnProp(regexes, token)) { 56662 return new RegExp(unescapeFormat(token)); 56663 } 56664 56665 return regexes[token](config._strict, config._locale); 56666 } 56667 56668 // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript 56669 function unescapeFormat(s) { 56670 return regexEscape( 56671 s 56672 .replace('\\', '') 56673 .replace( 56674 /\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, 56675 function (matched, p1, p2, p3, p4) { 56676 return p1 || p2 || p3 || p4; 56677 } 56678 ) 56679 ); 56680 } 56681 56682 function regexEscape(s) { 56683 return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); 56684 } 56685 56686 var tokens = {}; 56687 56688 function addParseToken(token, callback) { 56689 var i, 56690 func = callback, 56691 tokenLen; 56692 if (typeof token === 'string') { 56693 token = [token]; 56694 } 56695 if (isNumber(callback)) { 56696 func = function (input, array) { 56697 array[callback] = toInt(input); 56698 }; 56699 } 56700 tokenLen = token.length; 56701 for (i = 0; i < tokenLen; i++) { 56702 tokens[token[i]] = func; 56703 } 56704 } 56705 56706 function addWeekParseToken(token, callback) { 56707 addParseToken(token, function (input, array, config, token) { 56708 config._w = config._w || {}; 56709 callback(input, config._w, config, token); 56710 }); 56711 } 56712 56713 function addTimeToArrayFromToken(token, input, config) { 56714 if (input != null && hasOwnProp(tokens, token)) { 56715 tokens[token](input, config._a, config, token); 56716 } 56717 } 56718 56719 var YEAR = 0, 56720 MONTH = 1, 56721 DATE = 2, 56722 HOUR = 3, 56723 MINUTE = 4, 56724 SECOND = 5, 56725 MILLISECOND = 6, 56726 WEEK = 7, 56727 WEEKDAY = 8; 56728 56729 function mod(n, x) { 56730 return ((n % x) + x) % x; 56731 } 56732 56733 var indexOf; 56734 56735 if (Array.prototype.indexOf) { 56736 indexOf = Array.prototype.indexOf; 56737 } else { 56738 indexOf = function (o) { 56739 // I know 56740 var i; 56741 for (i = 0; i < this.length; ++i) { 56742 if (this[i] === o) { 56743 return i; 56744 } 56745 } 56746 return -1; 56747 }; 56748 } 56749 56750 function daysInMonth(year, month) { 56751 if (isNaN(year) || isNaN(month)) { 56752 return NaN; 56753 } 56754 var modMonth = mod(month, 12); 56755 year += (month - modMonth) / 12; 56756 return modMonth === 1 56757 ? isLeapYear(year) 56758 ? 29 56759 : 28 56760 : 31 - ((modMonth % 7) % 2); 56761 } 56762 56763 // FORMATTING 56764 56765 addFormatToken('M', ['MM', 2], 'Mo', function () { 56766 return this.month() + 1; 56767 }); 56768 56769 addFormatToken('MMM', 0, 0, function (format) { 56770 return this.localeData().monthsShort(this, format); 56771 }); 56772 56773 addFormatToken('MMMM', 0, 0, function (format) { 56774 return this.localeData().months(this, format); 56775 }); 56776 56777 // ALIASES 56778 56779 addUnitAlias('month', 'M'); 56780 56781 // PRIORITY 56782 56783 addUnitPriority('month', 8); 56784 56785 // PARSING 56786 56787 addRegexToken('M', match1to2); 56788 addRegexToken('MM', match1to2, match2); 56789 addRegexToken('MMM', function (isStrict, locale) { 56790 return locale.monthsShortRegex(isStrict); 56791 }); 56792 addRegexToken('MMMM', function (isStrict, locale) { 56793 return locale.monthsRegex(isStrict); 56794 }); 56795 56796 addParseToken(['M', 'MM'], function (input, array) { 56797 array[MONTH] = toInt(input) - 1; 56798 }); 56799 56800 addParseToken(['MMM', 'MMMM'], function (input, array, config, token) { 56801 var month = config._locale.monthsParse(input, token, config._strict); 56802 // if we didn't find a month name, mark the date as invalid. 56803 if (month != null) { 56804 array[MONTH] = month; 56805 } else { 56806 getParsingFlags(config).invalidMonth = input; 56807 } 56808 }); 56809 56810 // LOCALES 56811 56812 var defaultLocaleMonths = 56813 'January_February_March_April_May_June_July_August_September_October_November_December'.split( 56814 '_' 56815 ), 56816 defaultLocaleMonthsShort = 56817 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), 56818 MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/, 56819 defaultMonthsShortRegex = matchWord, 56820 defaultMonthsRegex = matchWord; 56821 56822 function localeMonths(m, format) { 56823 if (!m) { 56824 return isArray(this._months) 56825 ? this._months 56826 : this._months['standalone']; 56827 } 56828 return isArray(this._months) 56829 ? this._months[m.month()] 56830 : this._months[ 56831 (this._months.isFormat || MONTHS_IN_FORMAT).test(format) 56832 ? 'format' 56833 : 'standalone' 56834 ][m.month()]; 56835 } 56836 56837 function localeMonthsShort(m, format) { 56838 if (!m) { 56839 return isArray(this._monthsShort) 56840 ? this._monthsShort 56841 : this._monthsShort['standalone']; 56842 } 56843 return isArray(this._monthsShort) 56844 ? this._monthsShort[m.month()] 56845 : this._monthsShort[ 56846 MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone' 56847 ][m.month()]; 56848 } 56849 56850 function handleStrictParse(monthName, format, strict) { 56851 var i, 56852 ii, 56853 mom, 56854 llc = monthName.toLocaleLowerCase(); 56855 if (!this._monthsParse) { 56856 // this is not used 56857 this._monthsParse = []; 56858 this._longMonthsParse = []; 56859 this._shortMonthsParse = []; 56860 for (i = 0; i < 12; ++i) { 56861 mom = createUTC([2000, i]); 56862 this._shortMonthsParse[i] = this.monthsShort( 56863 mom, 56864 '' 56865 ).toLocaleLowerCase(); 56866 this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase(); 56867 } 56868 } 56869 56870 if (strict) { 56871 if (format === 'MMM') { 56872 ii = indexOf.call(this._shortMonthsParse, llc); 56873 return ii !== -1 ? ii : null; 56874 } else { 56875 ii = indexOf.call(this._longMonthsParse, llc); 56876 return ii !== -1 ? ii : null; 56877 } 56878 } else { 56879 if (format === 'MMM') { 56880 ii = indexOf.call(this._shortMonthsParse, llc); 56881 if (ii !== -1) { 56882 return ii; 56883 } 56884 ii = indexOf.call(this._longMonthsParse, llc); 56885 return ii !== -1 ? ii : null; 56886 } else { 56887 ii = indexOf.call(this._longMonthsParse, llc); 56888 if (ii !== -1) { 56889 return ii; 56890 } 56891 ii = indexOf.call(this._shortMonthsParse, llc); 56892 return ii !== -1 ? ii : null; 56893 } 56894 } 56895 } 56896 56897 function localeMonthsParse(monthName, format, strict) { 56898 var i, mom, regex; 56899 56900 if (this._monthsParseExact) { 56901 return handleStrictParse.call(this, monthName, format, strict); 56902 } 56903 56904 if (!this._monthsParse) { 56905 this._monthsParse = []; 56906 this._longMonthsParse = []; 56907 this._shortMonthsParse = []; 56908 } 56909 56910 // TODO: add sorting 56911 // Sorting makes sure if one month (or abbr) is a prefix of another 56912 // see sorting in computeMonthsParse 56913 for (i = 0; i < 12; i++) { 56914 // make the regex if we don't have it already 56915 mom = createUTC([2000, i]); 56916 if (strict && !this._longMonthsParse[i]) { 56917 this._longMonthsParse[i] = new RegExp( 56918 '^' + this.months(mom, '').replace('.', '') + '$', 56919 'i' 56920 ); 56921 this._shortMonthsParse[i] = new RegExp( 56922 '^' + this.monthsShort(mom, '').replace('.', '') + '$', 56923 'i' 56924 ); 56925 } 56926 if (!strict && !this._monthsParse[i]) { 56927 regex = 56928 '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, ''); 56929 this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i'); 56930 } 56931 // test the regex 56932 if ( 56933 strict && 56934 format === 'MMMM' && 56935 this._longMonthsParse[i].test(monthName) 56936 ) { 56937 return i; 56938 } else if ( 56939 strict && 56940 format === 'MMM' && 56941 this._shortMonthsParse[i].test(monthName) 56942 ) { 56943 return i; 56944 } else if (!strict && this._monthsParse[i].test(monthName)) { 56945 return i; 56946 } 56947 } 56948 } 56949 56950 // MOMENTS 56951 56952 function setMonth(mom, value) { 56953 var dayOfMonth; 56954 56955 if (!mom.isValid()) { 56956 // No op 56957 return mom; 56958 } 56959 56960 if (typeof value === 'string') { 56961 if (/^\d+$/.test(value)) { 56962 value = toInt(value); 56963 } else { 56964 value = mom.localeData().monthsParse(value); 56965 // TODO: Another silent failure? 56966 if (!isNumber(value)) { 56967 return mom; 56968 } 56969 } 56970 } 56971 56972 dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value)); 56973 mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth); 56974 return mom; 56975 } 56976 56977 function getSetMonth(value) { 56978 if (value != null) { 56979 setMonth(this, value); 56980 hooks.updateOffset(this, true); 56981 return this; 56982 } else { 56983 return get(this, 'Month'); 56984 } 56985 } 56986 56987 function getDaysInMonth() { 56988 return daysInMonth(this.year(), this.month()); 56989 } 56990 56991 function monthsShortRegex(isStrict) { 56992 if (this._monthsParseExact) { 56993 if (!hasOwnProp(this, '_monthsRegex')) { 56994 computeMonthsParse.call(this); 56995 } 56996 if (isStrict) { 56997 return this._monthsShortStrictRegex; 56998 } else { 56999 return this._monthsShortRegex; 57000 } 57001 } else { 57002 if (!hasOwnProp(this, '_monthsShortRegex')) { 57003 this._monthsShortRegex = defaultMonthsShortRegex; 57004 } 57005 return this._monthsShortStrictRegex && isStrict 57006 ? this._monthsShortStrictRegex 57007 : this._monthsShortRegex; 57008 } 57009 } 57010 57011 function monthsRegex(isStrict) { 57012 if (this._monthsParseExact) { 57013 if (!hasOwnProp(this, '_monthsRegex')) { 57014 computeMonthsParse.call(this); 57015 } 57016 if (isStrict) { 57017 return this._monthsStrictRegex; 57018 } else { 57019 return this._monthsRegex; 57020 } 57021 } else { 57022 if (!hasOwnProp(this, '_monthsRegex')) { 57023 this._monthsRegex = defaultMonthsRegex; 57024 } 57025 return this._monthsStrictRegex && isStrict 57026 ? this._monthsStrictRegex 57027 : this._monthsRegex; 57028 } 57029 } 57030 57031 function computeMonthsParse() { 57032 function cmpLenRev(a, b) { 57033 return b.length - a.length; 57034 } 57035 57036 var shortPieces = [], 57037 longPieces = [], 57038 mixedPieces = [], 57039 i, 57040 mom; 57041 for (i = 0; i < 12; i++) { 57042 // make the regex if we don't have it already 57043 mom = createUTC([2000, i]); 57044 shortPieces.push(this.monthsShort(mom, '')); 57045 longPieces.push(this.months(mom, '')); 57046 mixedPieces.push(this.months(mom, '')); 57047 mixedPieces.push(this.monthsShort(mom, '')); 57048 } 57049 // Sorting makes sure if one month (or abbr) is a prefix of another it 57050 // will match the longer piece. 57051 shortPieces.sort(cmpLenRev); 57052 longPieces.sort(cmpLenRev); 57053 mixedPieces.sort(cmpLenRev); 57054 for (i = 0; i < 12; i++) { 57055 shortPieces[i] = regexEscape(shortPieces[i]); 57056 longPieces[i] = regexEscape(longPieces[i]); 57057 } 57058 for (i = 0; i < 24; i++) { 57059 mixedPieces[i] = regexEscape(mixedPieces[i]); 57060 } 57061 57062 this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); 57063 this._monthsShortRegex = this._monthsRegex; 57064 this._monthsStrictRegex = new RegExp( 57065 '^(' + longPieces.join('|') + ')', 57066 'i' 57067 ); 57068 this._monthsShortStrictRegex = new RegExp( 57069 '^(' + shortPieces.join('|') + ')', 57070 'i' 57071 ); 57072 } 57073 57074 // FORMATTING 57075 57076 addFormatToken('Y', 0, 0, function () { 57077 var y = this.year(); 57078 return y <= 9999 ? zeroFill(y, 4) : '+' + y; 57079 }); 57080 57081 addFormatToken(0, ['YY', 2], 0, function () { 57082 return this.year() % 100; 57083 }); 57084 57085 addFormatToken(0, ['YYYY', 4], 0, 'year'); 57086 addFormatToken(0, ['YYYYY', 5], 0, 'year'); 57087 addFormatToken(0, ['YYYYYY', 6, true], 0, 'year'); 57088 57089 // ALIASES 57090 57091 addUnitAlias('year', 'y'); 57092 57093 // PRIORITIES 57094 57095 addUnitPriority('year', 1); 57096 57097 // PARSING 57098 57099 addRegexToken('Y', matchSigned); 57100 addRegexToken('YY', match1to2, match2); 57101 addRegexToken('YYYY', match1to4, match4); 57102 addRegexToken('YYYYY', match1to6, match6); 57103 addRegexToken('YYYYYY', match1to6, match6); 57104 57105 addParseToken(['YYYYY', 'YYYYYY'], YEAR); 57106 addParseToken('YYYY', function (input, array) { 57107 array[YEAR] = 57108 input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input); 57109 }); 57110 addParseToken('YY', function (input, array) { 57111 array[YEAR] = hooks.parseTwoDigitYear(input); 57112 }); 57113 addParseToken('Y', function (input, array) { 57114 array[YEAR] = parseInt(input, 10); 57115 }); 57116 57117 // HELPERS 57118 57119 function daysInYear(year) { 57120 return isLeapYear(year) ? 366 : 365; 57121 } 57122 57123 // HOOKS 57124 57125 hooks.parseTwoDigitYear = function (input) { 57126 return toInt(input) + (toInt(input) > 68 ? 1900 : 2000); 57127 }; 57128 57129 // MOMENTS 57130 57131 var getSetYear = makeGetSet('FullYear', true); 57132 57133 function getIsLeapYear() { 57134 return isLeapYear(this.year()); 57135 } 57136 57137 function createDate(y, m, d, h, M, s, ms) { 57138 // can't just apply() to create a date: 57139 // https://stackoverflow.com/q/181348 57140 var date; 57141 // the date constructor remaps years 0-99 to 1900-1999 57142 if (y < 100 && y >= 0) { 57143 // preserve leap years using a full 400 year cycle, then reset 57144 date = new Date(y + 400, m, d, h, M, s, ms); 57145 if (isFinite(date.getFullYear())) { 57146 date.setFullYear(y); 57147 } 57148 } else { 57149 date = new Date(y, m, d, h, M, s, ms); 57150 } 57151 57152 return date; 57153 } 57154 57155 function createUTCDate(y) { 57156 var date, args; 57157 // the Date.UTC function remaps years 0-99 to 1900-1999 57158 if (y < 100 && y >= 0) { 57159 args = Array.prototype.slice.call(arguments); 57160 // preserve leap years using a full 400 year cycle, then reset 57161 args[0] = y + 400; 57162 date = new Date(Date.UTC.apply(null, args)); 57163 if (isFinite(date.getUTCFullYear())) { 57164 date.setUTCFullYear(y); 57165 } 57166 } else { 57167 date = new Date(Date.UTC.apply(null, arguments)); 57168 } 57169 57170 return date; 57171 } 57172 57173 // start-of-first-week - start-of-year 57174 function firstWeekOffset(year, dow, doy) { 57175 var // first-week day -- which january is always in the first week (4 for iso, 1 for other) 57176 fwd = 7 + dow - doy, 57177 // first-week day local weekday -- which local weekday is fwd 57178 fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7; 57179 57180 return -fwdlw + fwd - 1; 57181 } 57182 57183 // https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday 57184 function dayOfYearFromWeeks(year, week, weekday, dow, doy) { 57185 var localWeekday = (7 + weekday - dow) % 7, 57186 weekOffset = firstWeekOffset(year, dow, doy), 57187 dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset, 57188 resYear, 57189 resDayOfYear; 57190 57191 if (dayOfYear <= 0) { 57192 resYear = year - 1; 57193 resDayOfYear = daysInYear(resYear) + dayOfYear; 57194 } else if (dayOfYear > daysInYear(year)) { 57195 resYear = year + 1; 57196 resDayOfYear = dayOfYear - daysInYear(year); 57197 } else { 57198 resYear = year; 57199 resDayOfYear = dayOfYear; 57200 } 57201 57202 return { 57203 year: resYear, 57204 dayOfYear: resDayOfYear, 57205 }; 57206 } 57207 57208 function weekOfYear(mom, dow, doy) { 57209 var weekOffset = firstWeekOffset(mom.year(), dow, doy), 57210 week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1, 57211 resWeek, 57212 resYear; 57213 57214 if (week < 1) { 57215 resYear = mom.year() - 1; 57216 resWeek = week + weeksInYear(resYear, dow, doy); 57217 } else if (week > weeksInYear(mom.year(), dow, doy)) { 57218 resWeek = week - weeksInYear(mom.year(), dow, doy); 57219 resYear = mom.year() + 1; 57220 } else { 57221 resYear = mom.year(); 57222 resWeek = week; 57223 } 57224 57225 return { 57226 week: resWeek, 57227 year: resYear, 57228 }; 57229 } 57230 57231 function weeksInYear(year, dow, doy) { 57232 var weekOffset = firstWeekOffset(year, dow, doy), 57233 weekOffsetNext = firstWeekOffset(year + 1, dow, doy); 57234 return (daysInYear(year) - weekOffset + weekOffsetNext) / 7; 57235 } 57236 57237 // FORMATTING 57238 57239 addFormatToken('w', ['ww', 2], 'wo', 'week'); 57240 addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek'); 57241 57242 // ALIASES 57243 57244 addUnitAlias('week', 'w'); 57245 addUnitAlias('isoWeek', 'W'); 57246 57247 // PRIORITIES 57248 57249 addUnitPriority('week', 5); 57250 addUnitPriority('isoWeek', 5); 57251 57252 // PARSING 57253 57254 addRegexToken('w', match1to2); 57255 addRegexToken('ww', match1to2, match2); 57256 addRegexToken('W', match1to2); 57257 addRegexToken('WW', match1to2, match2); 57258 57259 addWeekParseToken( 57260 ['w', 'ww', 'W', 'WW'], 57261 function (input, week, config, token) { 57262 week[token.substr(0, 1)] = toInt(input); 57263 } 57264 ); 57265 57266 // HELPERS 57267 57268 // LOCALES 57269 57270 function localeWeek(mom) { 57271 return weekOfYear(mom, this._week.dow, this._week.doy).week; 57272 } 57273 57274 var defaultLocaleWeek = { 57275 dow: 0, // Sunday is the first day of the week. 57276 doy: 6, // The week that contains Jan 6th is the first week of the year. 57277 }; 57278 57279 function localeFirstDayOfWeek() { 57280 return this._week.dow; 57281 } 57282 57283 function localeFirstDayOfYear() { 57284 return this._week.doy; 57285 } 57286 57287 // MOMENTS 57288 57289 function getSetWeek(input) { 57290 var week = this.localeData().week(this); 57291 return input == null ? week : this.add((input - week) * 7, 'd'); 57292 } 57293 57294 function getSetISOWeek(input) { 57295 var week = weekOfYear(this, 1, 4).week; 57296 return input == null ? week : this.add((input - week) * 7, 'd'); 57297 } 57298 57299 // FORMATTING 57300 57301 addFormatToken('d', 0, 'do', 'day'); 57302 57303 addFormatToken('dd', 0, 0, function (format) { 57304 return this.localeData().weekdaysMin(this, format); 57305 }); 57306 57307 addFormatToken('ddd', 0, 0, function (format) { 57308 return this.localeData().weekdaysShort(this, format); 57309 }); 57310 57311 addFormatToken('dddd', 0, 0, function (format) { 57312 return this.localeData().weekdays(this, format); 57313 }); 57314 57315 addFormatToken('e', 0, 0, 'weekday'); 57316 addFormatToken('E', 0, 0, 'isoWeekday'); 57317 57318 // ALIASES 57319 57320 addUnitAlias('day', 'd'); 57321 addUnitAlias('weekday', 'e'); 57322 addUnitAlias('isoWeekday', 'E'); 57323 57324 // PRIORITY 57325 addUnitPriority('day', 11); 57326 addUnitPriority('weekday', 11); 57327 addUnitPriority('isoWeekday', 11); 57328 57329 // PARSING 57330 57331 addRegexToken('d', match1to2); 57332 addRegexToken('e', match1to2); 57333 addRegexToken('E', match1to2); 57334 addRegexToken('dd', function (isStrict, locale) { 57335 return locale.weekdaysMinRegex(isStrict); 57336 }); 57337 addRegexToken('ddd', function (isStrict, locale) { 57338 return locale.weekdaysShortRegex(isStrict); 57339 }); 57340 addRegexToken('dddd', function (isStrict, locale) { 57341 return locale.weekdaysRegex(isStrict); 57342 }); 57343 57344 addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) { 57345 var weekday = config._locale.weekdaysParse(input, token, config._strict); 57346 // if we didn't get a weekday name, mark the date as invalid 57347 if (weekday != null) { 57348 week.d = weekday; 57349 } else { 57350 getParsingFlags(config).invalidWeekday = input; 57351 } 57352 }); 57353 57354 addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) { 57355 week[token] = toInt(input); 57356 }); 57357 57358 // HELPERS 57359 57360 function parseWeekday(input, locale) { 57361 if (typeof input !== 'string') { 57362 return input; 57363 } 57364 57365 if (!isNaN(input)) { 57366 return parseInt(input, 10); 57367 } 57368 57369 input = locale.weekdaysParse(input); 57370 if (typeof input === 'number') { 57371 return input; 57372 } 57373 57374 return null; 57375 } 57376 57377 function parseIsoWeekday(input, locale) { 57378 if (typeof input === 'string') { 57379 return locale.weekdaysParse(input) % 7 || 7; 57380 } 57381 return isNaN(input) ? null : input; 57382 } 57383 57384 // LOCALES 57385 function shiftWeekdays(ws, n) { 57386 return ws.slice(n, 7).concat(ws.slice(0, n)); 57387 } 57388 57389 var defaultLocaleWeekdays = 57390 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'), 57391 defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), 57392 defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), 57393 defaultWeekdaysRegex = matchWord, 57394 defaultWeekdaysShortRegex = matchWord, 57395 defaultWeekdaysMinRegex = matchWord; 57396 57397 function localeWeekdays(m, format) { 57398 var weekdays = isArray(this._weekdays) 57399 ? this._weekdays 57400 : this._weekdays[ 57401 m && m !== true && this._weekdays.isFormat.test(format) 57402 ? 'format' 57403 : 'standalone' 57404 ]; 57405 return m === true 57406 ? shiftWeekdays(weekdays, this._week.dow) 57407 : m 57408 ? weekdays[m.day()] 57409 : weekdays; 57410 } 57411 57412 function localeWeekdaysShort(m) { 57413 return m === true 57414 ? shiftWeekdays(this._weekdaysShort, this._week.dow) 57415 : m 57416 ? this._weekdaysShort[m.day()] 57417 : this._weekdaysShort; 57418 } 57419 57420 function localeWeekdaysMin(m) { 57421 return m === true 57422 ? shiftWeekdays(this._weekdaysMin, this._week.dow) 57423 : m 57424 ? this._weekdaysMin[m.day()] 57425 : this._weekdaysMin; 57426 } 57427 57428 function handleStrictParse$1(weekdayName, format, strict) { 57429 var i, 57430 ii, 57431 mom, 57432 llc = weekdayName.toLocaleLowerCase(); 57433 if (!this._weekdaysParse) { 57434 this._weekdaysParse = []; 57435 this._shortWeekdaysParse = []; 57436 this._minWeekdaysParse = []; 57437 57438 for (i = 0; i < 7; ++i) { 57439 mom = createUTC([2000, 1]).day(i); 57440 this._minWeekdaysParse[i] = this.weekdaysMin( 57441 mom, 57442 '' 57443 ).toLocaleLowerCase(); 57444 this._shortWeekdaysParse[i] = this.weekdaysShort( 57445 mom, 57446 '' 57447 ).toLocaleLowerCase(); 57448 this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase(); 57449 } 57450 } 57451 57452 if (strict) { 57453 if (format === 'dddd') { 57454 ii = indexOf.call(this._weekdaysParse, llc); 57455 return ii !== -1 ? ii : null; 57456 } else if (format === 'ddd') { 57457 ii = indexOf.call(this._shortWeekdaysParse, llc); 57458 return ii !== -1 ? ii : null; 57459 } else { 57460 ii = indexOf.call(this._minWeekdaysParse, llc); 57461 return ii !== -1 ? ii : null; 57462 } 57463 } else { 57464 if (format === 'dddd') { 57465 ii = indexOf.call(this._weekdaysParse, llc); 57466 if (ii !== -1) { 57467 return ii; 57468 } 57469 ii = indexOf.call(this._shortWeekdaysParse, llc); 57470 if (ii !== -1) { 57471 return ii; 57472 } 57473 ii = indexOf.call(this._minWeekdaysParse, llc); 57474 return ii !== -1 ? ii : null; 57475 } else if (format === 'ddd') { 57476 ii = indexOf.call(this._shortWeekdaysParse, llc); 57477 if (ii !== -1) { 57478 return ii; 57479 } 57480 ii = indexOf.call(this._weekdaysParse, llc); 57481 if (ii !== -1) { 57482 return ii; 57483 } 57484 ii = indexOf.call(this._minWeekdaysParse, llc); 57485 return ii !== -1 ? ii : null; 57486 } else { 57487 ii = indexOf.call(this._minWeekdaysParse, llc); 57488 if (ii !== -1) { 57489 return ii; 57490 } 57491 ii = indexOf.call(this._weekdaysParse, llc); 57492 if (ii !== -1) { 57493 return ii; 57494 } 57495 ii = indexOf.call(this._shortWeekdaysParse, llc); 57496 return ii !== -1 ? ii : null; 57497 } 57498 } 57499 } 57500 57501 function localeWeekdaysParse(weekdayName, format, strict) { 57502 var i, mom, regex; 57503 57504 if (this._weekdaysParseExact) { 57505 return handleStrictParse$1.call(this, weekdayName, format, strict); 57506 } 57507 57508 if (!this._weekdaysParse) { 57509 this._weekdaysParse = []; 57510 this._minWeekdaysParse = []; 57511 this._shortWeekdaysParse = []; 57512 this._fullWeekdaysParse = []; 57513 } 57514 57515 for (i = 0; i < 7; i++) { 57516 // make the regex if we don't have it already 57517 57518 mom = createUTC([2000, 1]).day(i); 57519 if (strict && !this._fullWeekdaysParse[i]) { 57520 this._fullWeekdaysParse[i] = new RegExp( 57521 '^' + this.weekdays(mom, '').replace('.', '\\.?') + '$', 57522 'i' 57523 ); 57524 this._shortWeekdaysParse[i] = new RegExp( 57525 '^' + this.weekdaysShort(mom, '').replace('.', '\\.?') + '$', 57526 'i' 57527 ); 57528 this._minWeekdaysParse[i] = new RegExp( 57529 '^' + this.weekdaysMin(mom, '').replace('.', '\\.?') + '$', 57530 'i' 57531 ); 57532 } 57533 if (!this._weekdaysParse[i]) { 57534 regex = 57535 '^' + 57536 this.weekdays(mom, '') + 57537 '|^' + 57538 this.weekdaysShort(mom, '') + 57539 '|^' + 57540 this.weekdaysMin(mom, ''); 57541 this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i'); 57542 } 57543 // test the regex 57544 if ( 57545 strict && 57546 format === 'dddd' && 57547 this._fullWeekdaysParse[i].test(weekdayName) 57548 ) { 57549 return i; 57550 } else if ( 57551 strict && 57552 format === 'ddd' && 57553 this._shortWeekdaysParse[i].test(weekdayName) 57554 ) { 57555 return i; 57556 } else if ( 57557 strict && 57558 format === 'dd' && 57559 this._minWeekdaysParse[i].test(weekdayName) 57560 ) { 57561 return i; 57562 } else if (!strict && this._weekdaysParse[i].test(weekdayName)) { 57563 return i; 57564 } 57565 } 57566 } 57567 57568 // MOMENTS 57569 57570 function getSetDayOfWeek(input) { 57571 if (!this.isValid()) { 57572 return input != null ? this : NaN; 57573 } 57574 var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay(); 57575 if (input != null) { 57576 input = parseWeekday(input, this.localeData()); 57577 return this.add(input - day, 'd'); 57578 } else { 57579 return day; 57580 } 57581 } 57582 57583 function getSetLocaleDayOfWeek(input) { 57584 if (!this.isValid()) { 57585 return input != null ? this : NaN; 57586 } 57587 var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7; 57588 return input == null ? weekday : this.add(input - weekday, 'd'); 57589 } 57590 57591 function getSetISODayOfWeek(input) { 57592 if (!this.isValid()) { 57593 return input != null ? this : NaN; 57594 } 57595 57596 // behaves the same as moment#day except 57597 // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6) 57598 // as a setter, sunday should belong to the previous week. 57599 57600 if (input != null) { 57601 var weekday = parseIsoWeekday(input, this.localeData()); 57602 return this.day(this.day() % 7 ? weekday : weekday - 7); 57603 } else { 57604 return this.day() || 7; 57605 } 57606 } 57607 57608 function weekdaysRegex(isStrict) { 57609 if (this._weekdaysParseExact) { 57610 if (!hasOwnProp(this, '_weekdaysRegex')) { 57611 computeWeekdaysParse.call(this); 57612 } 57613 if (isStrict) { 57614 return this._weekdaysStrictRegex; 57615 } else { 57616 return this._weekdaysRegex; 57617 } 57618 } else { 57619 if (!hasOwnProp(this, '_weekdaysRegex')) { 57620 this._weekdaysRegex = defaultWeekdaysRegex; 57621 } 57622 return this._weekdaysStrictRegex && isStrict 57623 ? this._weekdaysStrictRegex 57624 : this._weekdaysRegex; 57625 } 57626 } 57627 57628 function weekdaysShortRegex(isStrict) { 57629 if (this._weekdaysParseExact) { 57630 if (!hasOwnProp(this, '_weekdaysRegex')) { 57631 computeWeekdaysParse.call(this); 57632 } 57633 if (isStrict) { 57634 return this._weekdaysShortStrictRegex; 57635 } else { 57636 return this._weekdaysShortRegex; 57637 } 57638 } else { 57639 if (!hasOwnProp(this, '_weekdaysShortRegex')) { 57640 this._weekdaysShortRegex = defaultWeekdaysShortRegex; 57641 } 57642 return this._weekdaysShortStrictRegex && isStrict 57643 ? this._weekdaysShortStrictRegex 57644 : this._weekdaysShortRegex; 57645 } 57646 } 57647 57648 function weekdaysMinRegex(isStrict) { 57649 if (this._weekdaysParseExact) { 57650 if (!hasOwnProp(this, '_weekdaysRegex')) { 57651 computeWeekdaysParse.call(this); 57652 } 57653 if (isStrict) { 57654 return this._weekdaysMinStrictRegex; 57655 } else { 57656 return this._weekdaysMinRegex; 57657 } 57658 } else { 57659 if (!hasOwnProp(this, '_weekdaysMinRegex')) { 57660 this._weekdaysMinRegex = defaultWeekdaysMinRegex; 57661 } 57662 return this._weekdaysMinStrictRegex && isStrict 57663 ? this._weekdaysMinStrictRegex 57664 : this._weekdaysMinRegex; 57665 } 57666 } 57667 57668 function computeWeekdaysParse() { 57669 function cmpLenRev(a, b) { 57670 return b.length - a.length; 57671 } 57672 57673 var minPieces = [], 57674 shortPieces = [], 57675 longPieces = [], 57676 mixedPieces = [], 57677 i, 57678 mom, 57679 minp, 57680 shortp, 57681 longp; 57682 for (i = 0; i < 7; i++) { 57683 // make the regex if we don't have it already 57684 mom = createUTC([2000, 1]).day(i); 57685 minp = regexEscape(this.weekdaysMin(mom, '')); 57686 shortp = regexEscape(this.weekdaysShort(mom, '')); 57687 longp = regexEscape(this.weekdays(mom, '')); 57688 minPieces.push(minp); 57689 shortPieces.push(shortp); 57690 longPieces.push(longp); 57691 mixedPieces.push(minp); 57692 mixedPieces.push(shortp); 57693 mixedPieces.push(longp); 57694 } 57695 // Sorting makes sure if one weekday (or abbr) is a prefix of another it 57696 // will match the longer piece. 57697 minPieces.sort(cmpLenRev); 57698 shortPieces.sort(cmpLenRev); 57699 longPieces.sort(cmpLenRev); 57700 mixedPieces.sort(cmpLenRev); 57701 57702 this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); 57703 this._weekdaysShortRegex = this._weekdaysRegex; 57704 this._weekdaysMinRegex = this._weekdaysRegex; 57705 57706 this._weekdaysStrictRegex = new RegExp( 57707 '^(' + longPieces.join('|') + ')', 57708 'i' 57709 ); 57710 this._weekdaysShortStrictRegex = new RegExp( 57711 '^(' + shortPieces.join('|') + ')', 57712 'i' 57713 ); 57714 this._weekdaysMinStrictRegex = new RegExp( 57715 '^(' + minPieces.join('|') + ')', 57716 'i' 57717 ); 57718 } 57719 57720 // FORMATTING 57721 57722 function hFormat() { 57723 return this.hours() % 12 || 12; 57724 } 57725 57726 function kFormat() { 57727 return this.hours() || 24; 57728 } 57729 57730 addFormatToken('H', ['HH', 2], 0, 'hour'); 57731 addFormatToken('h', ['hh', 2], 0, hFormat); 57732 addFormatToken('k', ['kk', 2], 0, kFormat); 57733 57734 addFormatToken('hmm', 0, 0, function () { 57735 return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2); 57736 }); 57737 57738 addFormatToken('hmmss', 0, 0, function () { 57739 return ( 57740 '' + 57741 hFormat.apply(this) + 57742 zeroFill(this.minutes(), 2) + 57743 zeroFill(this.seconds(), 2) 57744 ); 57745 }); 57746 57747 addFormatToken('Hmm', 0, 0, function () { 57748 return '' + this.hours() + zeroFill(this.minutes(), 2); 57749 }); 57750 57751 addFormatToken('Hmmss', 0, 0, function () { 57752 return ( 57753 '' + 57754 this.hours() + 57755 zeroFill(this.minutes(), 2) + 57756 zeroFill(this.seconds(), 2) 57757 ); 57758 }); 57759 57760 function meridiem(token, lowercase) { 57761 addFormatToken(token, 0, 0, function () { 57762 return this.localeData().meridiem( 57763 this.hours(), 57764 this.minutes(), 57765 lowercase 57766 ); 57767 }); 57768 } 57769 57770 meridiem('a', true); 57771 meridiem('A', false); 57772 57773 // ALIASES 57774 57775 addUnitAlias('hour', 'h'); 57776 57777 // PRIORITY 57778 addUnitPriority('hour', 13); 57779 57780 // PARSING 57781 57782 function matchMeridiem(isStrict, locale) { 57783 return locale._meridiemParse; 57784 } 57785 57786 addRegexToken('a', matchMeridiem); 57787 addRegexToken('A', matchMeridiem); 57788 addRegexToken('H', match1to2); 57789 addRegexToken('h', match1to2); 57790 addRegexToken('k', match1to2); 57791 addRegexToken('HH', match1to2, match2); 57792 addRegexToken('hh', match1to2, match2); 57793 addRegexToken('kk', match1to2, match2); 57794 57795 addRegexToken('hmm', match3to4); 57796 addRegexToken('hmmss', match5to6); 57797 addRegexToken('Hmm', match3to4); 57798 addRegexToken('Hmmss', match5to6); 57799 57800 addParseToken(['H', 'HH'], HOUR); 57801 addParseToken(['k', 'kk'], function (input, array, config) { 57802 var kInput = toInt(input); 57803 array[HOUR] = kInput === 24 ? 0 : kInput; 57804 }); 57805 addParseToken(['a', 'A'], function (input, array, config) { 57806 config._isPm = config._locale.isPM(input); 57807 config._meridiem = input; 57808 }); 57809 addParseToken(['h', 'hh'], function (input, array, config) { 57810 array[HOUR] = toInt(input); 57811 getParsingFlags(config).bigHour = true; 57812 }); 57813 addParseToken('hmm', function (input, array, config) { 57814 var pos = input.length - 2; 57815 array[HOUR] = toInt(input.substr(0, pos)); 57816 array[MINUTE] = toInt(input.substr(pos)); 57817 getParsingFlags(config).bigHour = true; 57818 });
vendor: 14,575 bytes, lines 57819-58209
57819 addParseToken('hmmss', function (input, array, config) { 57820 var pos1 = input.length - 4, 57821 pos2 = input.length - 2; 57822 array[HOUR] = toInt(input.substr(0, pos1)); 57823 array[MINUTE] = toInt(input.substr(pos1, 2)); 57824 array[SECOND] = toInt(input.substr(pos2)); 57825 getParsingFlags(config).bigHour = true; 57826 }); 57827 addParseToken('Hmm', function (input, array, config) { 57828 var pos = input.length - 2; 57829 array[HOUR] = toInt(input.substr(0, pos)); 57830 array[MINUTE] = toInt(input.substr(pos)); 57831 }); 57832 addParseToken('Hmmss', function (input, array, config) { 57833 var pos1 = input.length - 4, 57834 pos2 = input.length - 2; 57835 array[HOUR] = toInt(input.substr(0, pos1)); 57836 array[MINUTE] = toInt(input.substr(pos1, 2)); 57837 array[SECOND] = toInt(input.substr(pos2)); 57838 }); 57839 57840 // LOCALES 57841 57842 function localeIsPM(input) { 57843 // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays 57844 // Using charAt should be more compatible. 57845 return (input + '').toLowerCase().charAt(0) === 'p'; 57846 } 57847 57848 var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i, 57849 // Setting the hour should keep the time, because the user explicitly 57850 // specified which hour they want. So trying to maintain the same hour (in 57851 // a new timezone) makes sense. Adding/subtracting hours does not follow 57852 // this rule. 57853 getSetHour = makeGetSet('Hours', true); 57854 57855 function localeMeridiem(hours, minutes, isLower) { 57856 if (hours > 11) { 57857 return isLower ? 'pm' : 'PM'; 57858 } else { 57859 return isLower ? 'am' : 'AM'; 57860 } 57861 } 57862 57863 var baseConfig = { 57864 calendar: defaultCalendar, 57865 longDateFormat: defaultLongDateFormat, 57866 invalidDate: defaultInvalidDate, 57867 ordinal: defaultOrdinal, 57868 dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse, 57869 relativeTime: defaultRelativeTime, 57870 57871 months: defaultLocaleMonths, 57872 monthsShort: defaultLocaleMonthsShort, 57873 57874 week: defaultLocaleWeek, 57875 57876 weekdays: defaultLocaleWeekdays, 57877 weekdaysMin: defaultLocaleWeekdaysMin, 57878 weekdaysShort: defaultLocaleWeekdaysShort, 57879 57880 meridiemParse: defaultLocaleMeridiemParse, 57881 }; 57882 57883 // internal storage for locale config files 57884 var locales = {}, 57885 localeFamilies = {}, 57886 globalLocale; 57887 57888 function commonPrefix(arr1, arr2) { 57889 var i, 57890 minl = Math.min(arr1.length, arr2.length); 57891 for (i = 0; i < minl; i += 1) { 57892 if (arr1[i] !== arr2[i]) { 57893 return i; 57894 } 57895 } 57896 return minl; 57897 } 57898 57899 function normalizeLocale(key) { 57900 return key ? key.toLowerCase().replace('_', '-') : key; 57901 } 57902 57903 // pick the locale from the array 57904 // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each 57905 // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root 57906 function chooseLocale(names) { 57907 var i = 0, 57908 j, 57909 next, 57910 locale, 57911 split; 57912 57913 while (i < names.length) { 57914 split = normalizeLocale(names[i]).split('-'); 57915 j = split.length; 57916 next = normalizeLocale(names[i + 1]); 57917 next = next ? next.split('-') : null; 57918 while (j > 0) { 57919 locale = loadLocale(split.slice(0, j).join('-')); 57920 if (locale) { 57921 return locale; 57922 } 57923 if ( 57924 next && 57925 next.length >= j && 57926 commonPrefix(split, next) >= j - 1 57927 ) { 57928 //the next array item is better than a shallower substring of this one 57929 break; 57930 } 57931 j--; 57932 } 57933 i++; 57934 } 57935 return globalLocale; 57936 } 57937 57938 function isLocaleNameSane(name) { 57939 // Prevent names that look like filesystem paths, i.e contain '/' or '\' 57940 return name.match('^[^/\\\\]*$') != null; 57941 } 57942 57943 function loadLocale(name) { 57944 var oldLocale = null, 57945 aliasedRequire; 57946 // TODO: Find a better way to register and load all the locales in Node 57947 if ( 57948 locales[name] === undefined && 57949 typeof module !== 'undefined' && 57950 module && 57951 module.exports && 57952 isLocaleNameSane(name) 57953 ) { 57954 try { 57955 oldLocale = globalLocale._abbr; 57956 aliasedRequire = require; 57957 aliasedRequire('./locale/' + name); 57958 getSetGlobalLocale(oldLocale); 57959 } catch (e) { 57960 // mark as not found to avoid repeating expensive file require call causing high CPU 57961 // when trying to find en-US, en_US, en-us for every format call 57962 locales[name] = null; // null means not found 57963 } 57964 } 57965 return locales[name]; 57966 } 57967 57968 // This function will load locale and then set the global locale. If 57969 // no arguments are passed in, it will simply return the current global 57970 // locale key. 57971 function getSetGlobalLocale(key, values) { 57972 var data; 57973 if (key) { 57974 if (isUndefined(values)) { 57975 data = getLocale(key); 57976 } else { 57977 data = defineLocale(key, values); 57978 } 57979 57980 if (data) { 57981 // moment.duration._locale = moment._locale = data; 57982 globalLocale = data; 57983 } else { 57984 if (typeof console !== 'undefined' && console.warn) { 57985 //warn user if arguments are passed but the locale could not be set 57986 console.warn( 57987 'Locale ' + key + ' not found. Did you forget to load it?' 57988 ); 57989 } 57990 } 57991 } 57992 57993 return globalLocale._abbr; 57994 } 57995 57996 function defineLocale(name, config) { 57997 if (config !== null) { 57998 var locale, 57999 parentConfig = baseConfig; 58000 config.abbr = name; 58001 if (locales[name] != null) { 58002 deprecateSimple( 58003 'defineLocaleOverride', 58004 'use moment.updateLocale(localeName, config) to change ' + 58005 'an existing locale. moment.defineLocale(localeName, ' + 58006 'config) should only be used for creating a new locale ' + 58007 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.' 58008 ); 58009 parentConfig = locales[name]._config; 58010 } else if (config.parentLocale != null) { 58011 if (locales[config.parentLocale] != null) { 58012 parentConfig = locales[config.parentLocale]._config; 58013 } else { 58014 locale = loadLocale(config.parentLocale); 58015 if (locale != null) { 58016 parentConfig = locale._config; 58017 } else { 58018 if (!localeFamilies[config.parentLocale]) { 58019 localeFamilies[config.parentLocale] = []; 58020 } 58021 localeFamilies[config.parentLocale].push({ 58022 name: name, 58023 config: config, 58024 }); 58025 return null; 58026 } 58027 } 58028 } 58029 locales[name] = new Locale(mergeConfigs(parentConfig, config)); 58030 58031 if (localeFamilies[name]) { 58032 localeFamilies[name].forEach(function (x) { 58033 defineLocale(x.name, x.config); 58034 }); 58035 } 58036 58037 // backwards compat for now: also set the locale 58038 // make sure we set the locale AFTER all child locales have been 58039 // created, so we won't end up with the child locale set. 58040 getSetGlobalLocale(name); 58041 58042 return locales[name]; 58043 } else { 58044 // useful for testing 58045 delete locales[name]; 58046 return null; 58047 } 58048 } 58049 58050 function updateLocale(name, config) { 58051 if (config != null) { 58052 var locale, 58053 tmpLocale, 58054 parentConfig = baseConfig; 58055 58056 if (locales[name] != null && locales[name].parentLocale != null) { 58057 // Update existing child locale in-place to avoid memory-leaks 58058 locales[name].set(mergeConfigs(locales[name]._config, config)); 58059 } else { 58060 // MERGE 58061 tmpLocale = loadLocale(name); 58062 if (tmpLocale != null) { 58063 parentConfig = tmpLocale._config; 58064 } 58065 config = mergeConfigs(parentConfig, config); 58066 if (tmpLocale == null) { 58067 // updateLocale is called for creating a new locale 58068 // Set abbr so it will have a name (getters return 58069 // undefined otherwise). 58070 config.abbr = name; 58071 } 58072 locale = new Locale(config); 58073 locale.parentLocale = locales[name]; 58074 locales[name] = locale; 58075 } 58076 58077 // backwards compat for now: also set the locale 58078 getSetGlobalLocale(name); 58079 } else { 58080 // pass null for config to unupdate, useful for tests 58081 if (locales[name] != null) { 58082 if (locales[name].parentLocale != null) { 58083 locales[name] = locales[name].parentLocale; 58084 if (name === getSetGlobalLocale()) { 58085 getSetGlobalLocale(name); 58086 } 58087 } else if (locales[name] != null) { 58088 delete locales[name]; 58089 } 58090 } 58091 } 58092 return locales[name]; 58093 } 58094 58095 // returns locale data 58096 function getLocale(key) { 58097 var locale; 58098 58099 if (key && key._locale && key._locale._abbr) { 58100 key = key._locale._abbr; 58101 } 58102 58103 if (!key) { 58104 return globalLocale; 58105 } 58106 58107 if (!isArray(key)) { 58108 //short-circuit everything else 58109 locale = loadLocale(key); 58110 if (locale) { 58111 return locale; 58112 } 58113 key = [key]; 58114 } 58115 58116 return chooseLocale(key); 58117 } 58118 58119 function listLocales() { 58120 return keys(locales); 58121 } 58122 58123 function checkOverflow(m) { 58124 var overflow, 58125 a = m._a; 58126 58127 if (a && getParsingFlags(m).overflow === -2) { 58128 overflow = 58129 a[MONTH] < 0 || a[MONTH] > 11 58130 ? MONTH 58131 : a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) 58132 ? DATE 58133 : a[HOUR] < 0 || 58134 a[HOUR] > 24 || 58135 (a[HOUR] === 24 && 58136 (a[MINUTE] !== 0 || 58137 a[SECOND] !== 0 || 58138 a[MILLISECOND] !== 0)) 58139 ? HOUR 58140 : a[MINUTE] < 0 || a[MINUTE] > 59 58141 ? MINUTE 58142 : a[SECOND] < 0 || a[SECOND] > 59 58143 ? SECOND 58144 : a[MILLISECOND] < 0 || a[MILLISECOND] > 999 58145 ? MILLISECOND 58146 : -1; 58147 58148 if ( 58149 getParsingFlags(m)._overflowDayOfYear && 58150 (overflow < YEAR || overflow > DATE) 58151 ) { 58152 overflow = DATE; 58153 } 58154 if (getParsingFlags(m)._overflowWeeks && overflow === -1) { 58155 overflow = WEEK; 58156 } 58157 if (getParsingFlags(m)._overflowWeekday && overflow === -1) { 58158 overflow = WEEKDAY; 58159 } 58160 58161 getParsingFlags(m).overflow = overflow; 58162 } 58163 58164 return m; 58165 } 58166 58167 // iso 8601 regex 58168 // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00) 58169 var extendedIsoRegex = 58170 /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/, 58171 basicIsoRegex = 58172 /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/, 58173 tzRegex = /Z|[+-]\d\d(?::?\d\d)?/, 58174 isoDates = [ 58175 ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/], 58176 ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/], 58177 ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/], 58178 ['GGGG-[W]WW', /\d{4}-W\d\d/, false], 58179 ['YYYY-DDD', /\d{4}-\d{3}/], 58180 ['YYYY-MM', /\d{4}-\d\d/, false], 58181 ['YYYYYYMMDD', /[+-]\d{10}/], 58182 ['YYYYMMDD', /\d{8}/], 58183 ['GGGG[W]WWE', /\d{4}W\d{3}/], 58184 ['GGGG[W]WW', /\d{4}W\d{2}/, false], 58185 ['YYYYDDD', /\d{7}/], 58186 ['YYYYMM', /\d{6}/, false], 58187 ['YYYY', /\d{4}/, false], 58188 ], 58189 // iso time formats and regexes 58190 isoTimes = [ 58191 ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/], 58192 ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/], 58193 ['HH:mm:ss', /\d\d:\d\d:\d\d/], 58194 ['HH:mm', /\d\d:\d\d/], 58195 ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/], 58196 ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/], 58197 ['HHmmss', /\d\d\d\d\d\d/], 58198 ['HHmm', /\d\d\d\d/], 58199 ['HH', /\d\d/], 58200 ], 58201 aspNetJsonRegex = /^\/?Date\((-?\d+)/i, 58202 // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3 58203 rfc2822 = 58204 /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/, 58205 obsOffsets = { 58206 UT: 0, 58207 GMT: 0, 58208 EDT: -4 * 60, 58209 EST: -5 * 60,
vendor: 25,606 bytes, lines 58210-59007
58210 CDT: -5 * 60, 58211 CST: -6 * 60, 58212 MDT: -6 * 60, 58213 MST: -7 * 60, 58214 PDT: -7 * 60, 58215 PST: -8 * 60, 58216 }; 58217 58218 // date from iso format 58219 function configFromISO(config) { 58220 var i, 58221 l, 58222 string = config._i, 58223 match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string), 58224 allowTime, 58225 dateFormat, 58226 timeFormat, 58227 tzFormat, 58228 isoDatesLen = isoDates.length, 58229 isoTimesLen = isoTimes.length; 58230 58231 if (match) { 58232 getParsingFlags(config).iso = true; 58233 for (i = 0, l = isoDatesLen; i < l; i++) { 58234 if (isoDates[i][1].exec(match[1])) { 58235 dateFormat = isoDates[i][0]; 58236 allowTime = isoDates[i][2] !== false; 58237 break; 58238 } 58239 } 58240 if (dateFormat == null) { 58241 config._isValid = false; 58242 return; 58243 } 58244 if (match[3]) { 58245 for (i = 0, l = isoTimesLen; i < l; i++) { 58246 if (isoTimes[i][1].exec(match[3])) { 58247 // match[2] should be 'T' or space 58248 timeFormat = (match[2] || ' ') + isoTimes[i][0]; 58249 break; 58250 } 58251 } 58252 if (timeFormat == null) { 58253 config._isValid = false; 58254 return; 58255 } 58256 } 58257 if (!allowTime && timeFormat != null) { 58258 config._isValid = false; 58259 return; 58260 } 58261 if (match[4]) { 58262 if (tzRegex.exec(match[4])) { 58263 tzFormat = 'Z'; 58264 } else { 58265 config._isValid = false; 58266 return; 58267 } 58268 } 58269 config._f = dateFormat + (timeFormat || '') + (tzFormat || ''); 58270 configFromStringAndFormat(config); 58271 } else { 58272 config._isValid = false; 58273 } 58274 } 58275 58276 function extractFromRFC2822Strings( 58277 yearStr, 58278 monthStr, 58279 dayStr, 58280 hourStr, 58281 minuteStr, 58282 secondStr 58283 ) { 58284 var result = [ 58285 untruncateYear(yearStr), 58286 defaultLocaleMonthsShort.indexOf(monthStr), 58287 parseInt(dayStr, 10), 58288 parseInt(hourStr, 10), 58289 parseInt(minuteStr, 10), 58290 ]; 58291 58292 if (secondStr) { 58293 result.push(parseInt(secondStr, 10)); 58294 } 58295 58296 return result; 58297 } 58298 58299 function untruncateYear(yearStr) { 58300 var year = parseInt(yearStr, 10); 58301 if (year <= 49) { 58302 return 2000 + year; 58303 } else if (year <= 999) { 58304 return 1900 + year; 58305 } 58306 return year; 58307 } 58308 58309 function preprocessRFC2822(s) { 58310 // Remove comments and folding whitespace and replace multiple-spaces with a single space 58311 return s 58312 .replace(/\([^()]*\)|[\n\t]/g, ' ') 58313 .replace(/(\s\s+)/g, ' ') 58314 .replace(/^\s\s*/, '') 58315 .replace(/\s\s*$/, ''); 58316 } 58317 58318 function checkWeekday(weekdayStr, parsedInput, config) { 58319 if (weekdayStr) { 58320 // TODO: Replace the vanilla JS Date object with an independent day-of-week check. 58321 var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr), 58322 weekdayActual = new Date( 58323 parsedInput[0], 58324 parsedInput[1], 58325 parsedInput[2] 58326 ).getDay(); 58327 if (weekdayProvided !== weekdayActual) { 58328 getParsingFlags(config).weekdayMismatch = true; 58329 config._isValid = false; 58330 return false; 58331 } 58332 } 58333 return true; 58334 } 58335 58336 function calculateOffset(obsOffset, militaryOffset, numOffset) { 58337 if (obsOffset) { 58338 return obsOffsets[obsOffset]; 58339 } else if (militaryOffset) { 58340 // the only allowed military tz is Z 58341 return 0; 58342 } else { 58343 var hm = parseInt(numOffset, 10), 58344 m = hm % 100, 58345 h = (hm - m) / 100; 58346 return h * 60 + m; 58347 } 58348 } 58349 58350 // date and time from ref 2822 format 58351 function configFromRFC2822(config) { 58352 var match = rfc2822.exec(preprocessRFC2822(config._i)), 58353 parsedArray; 58354 if (match) { 58355 parsedArray = extractFromRFC2822Strings( 58356 match[4], 58357 match[3], 58358 match[2], 58359 match[5], 58360 match[6], 58361 match[7] 58362 ); 58363 if (!checkWeekday(match[1], parsedArray, config)) { 58364 return; 58365 } 58366 58367 config._a = parsedArray; 58368 config._tzm = calculateOffset(match[8], match[9], match[10]); 58369 58370 config._d = createUTCDate.apply(null, config._a); 58371 config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); 58372 58373 getParsingFlags(config).rfc2822 = true; 58374 } else { 58375 config._isValid = false; 58376 } 58377 } 58378 58379 // date from 1) ASP.NET, 2) ISO, 3) RFC 2822 formats, or 4) optional fallback if parsing isn't strict 58380 function configFromString(config) { 58381 var matched = aspNetJsonRegex.exec(config._i); 58382 if (matched !== null) { 58383 config._d = new Date(+matched[1]); 58384 return; 58385 } 58386 58387 configFromISO(config); 58388 if (config._isValid === false) { 58389 delete config._isValid; 58390 } else { 58391 return; 58392 } 58393 58394 configFromRFC2822(config); 58395 if (config._isValid === false) { 58396 delete config._isValid; 58397 } else { 58398 return; 58399 } 58400 58401 if (config._strict) { 58402 config._isValid = false; 58403 } else { 58404 // Final attempt, use Input Fallback 58405 hooks.createFromInputFallback(config); 58406 } 58407 } 58408 58409 hooks.createFromInputFallback = deprecate( 58410 'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' + 58411 'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' + 58412 'discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.', 58413 function (config) { 58414 config._d = new Date(config._i + (config._useUTC ? ' UTC' : '')); 58415 } 58416 ); 58417 58418 // Pick the first defined of two or three arguments. 58419 function defaults(a, b, c) { 58420 if (a != null) { 58421 return a; 58422 } 58423 if (b != null) { 58424 return b; 58425 } 58426 return c; 58427 } 58428 58429 function currentDateArray(config) { 58430 // hooks is actually the exported moment object 58431 var nowValue = new Date(hooks.now()); 58432 if (config._useUTC) { 58433 return [ 58434 nowValue.getUTCFullYear(), 58435 nowValue.getUTCMonth(), 58436 nowValue.getUTCDate(), 58437 ]; 58438 } 58439 return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()]; 58440 } 58441 58442 // convert an array to a date. 58443 // the array should mirror the parameters below 58444 // note: all values past the year are optional and will default to the lowest possible value. 58445 // [year, month, day , hour, minute, second, millisecond] 58446 function configFromArray(config) { 58447 var i, 58448 date, 58449 input = [], 58450 currentDate, 58451 expectedWeekday, 58452 yearToUse; 58453 58454 if (config._d) { 58455 return; 58456 } 58457 58458 currentDate = currentDateArray(config); 58459 58460 //compute day of the year from weeks and weekdays 58461 if (config._w && config._a[DATE] == null && config._a[MONTH] == null) { 58462 dayOfYearFromWeekInfo(config); 58463 } 58464 58465 //if the day of the year is set, figure out what it is 58466 if (config._dayOfYear != null) { 58467 yearToUse = defaults(config._a[YEAR], currentDate[YEAR]); 58468 58469 if ( 58470 config._dayOfYear > daysInYear(yearToUse) || 58471 config._dayOfYear === 0 58472 ) { 58473 getParsingFlags(config)._overflowDayOfYear = true; 58474 } 58475 58476 date = createUTCDate(yearToUse, 0, config._dayOfYear); 58477 config._a[MONTH] = date.getUTCMonth(); 58478 config._a[DATE] = date.getUTCDate(); 58479 } 58480 58481 // Default to current date. 58482 // * if no year, month, day of month are given, default to today 58483 // * if day of month is given, default month and year 58484 // * if month is given, default only year 58485 // * if year is given, don't default anything 58486 for (i = 0; i < 3 && config._a[i] == null; ++i) { 58487 config._a[i] = input[i] = currentDate[i]; 58488 } 58489 58490 // Zero out whatever was not defaulted, including time 58491 for (; i < 7; i++) { 58492 config._a[i] = input[i] = 58493 config._a[i] == null ? (i === 2 ? 1 : 0) : config._a[i]; 58494 } 58495 58496 // Check for 24:00:00.000 58497 if ( 58498 config._a[HOUR] === 24 && 58499 config._a[MINUTE] === 0 && 58500 config._a[SECOND] === 0 && 58501 config._a[MILLISECOND] === 0 58502 ) { 58503 config._nextDay = true; 58504 config._a[HOUR] = 0; 58505 } 58506 58507 config._d = (config._useUTC ? createUTCDate : createDate).apply( 58508 null, 58509 input 58510 ); 58511 expectedWeekday = config._useUTC 58512 ? config._d.getUTCDay() 58513 : config._d.getDay(); 58514 58515 // Apply timezone offset from input. The actual utcOffset can be changed 58516 // with parseZone. 58517 if (config._tzm != null) { 58518 config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); 58519 } 58520 58521 if (config._nextDay) { 58522 config._a[HOUR] = 24; 58523 } 58524 58525 // check for mismatching day of week 58526 if ( 58527 config._w && 58528 typeof config._w.d !== 'undefined' && 58529 config._w.d !== expectedWeekday 58530 ) { 58531 getParsingFlags(config).weekdayMismatch = true; 58532 } 58533 } 58534 58535 function dayOfYearFromWeekInfo(config) { 58536 var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow, curWeek; 58537 58538 w = config._w; 58539 if (w.GG != null || w.W != null || w.E != null) { 58540 dow = 1; 58541 doy = 4; 58542 58543 // TODO: We need to take the current isoWeekYear, but that depends on 58544 // how we interpret now (local, utc, fixed offset). So create 58545 // a now version of current config (take local/utc/offset flags, and 58546 // create now). 58547 weekYear = defaults( 58548 w.GG, 58549 config._a[YEAR], 58550 weekOfYear(createLocal(), 1, 4).year 58551 ); 58552 week = defaults(w.W, 1); 58553 weekday = defaults(w.E, 1); 58554 if (weekday < 1 || weekday > 7) { 58555 weekdayOverflow = true; 58556 } 58557 } else { 58558 dow = config._locale._week.dow; 58559 doy = config._locale._week.doy; 58560 58561 curWeek = weekOfYear(createLocal(), dow, doy); 58562 58563 weekYear = defaults(w.gg, config._a[YEAR], curWeek.year); 58564 58565 // Default to current week. 58566 week = defaults(w.w, curWeek.week); 58567 58568 if (w.d != null) { 58569 // weekday -- low day numbers are considered next week 58570 weekday = w.d; 58571 if (weekday < 0 || weekday > 6) { 58572 weekdayOverflow = true; 58573 } 58574 } else if (w.e != null) { 58575 // local weekday -- counting starts from beginning of week 58576 weekday = w.e + dow; 58577 if (w.e < 0 || w.e > 6) { 58578 weekdayOverflow = true; 58579 } 58580 } else { 58581 // default to beginning of week 58582 weekday = dow; 58583 } 58584 } 58585 if (week < 1 || week > weeksInYear(weekYear, dow, doy)) { 58586 getParsingFlags(config)._overflowWeeks = true; 58587 } else if (weekdayOverflow != null) { 58588 getParsingFlags(config)._overflowWeekday = true; 58589 } else { 58590 temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy); 58591 config._a[YEAR] = temp.year; 58592 config._dayOfYear = temp.dayOfYear; 58593 } 58594 } 58595 58596 // constant that refers to the ISO standard 58597 hooks.ISO_8601 = function () { }; 58598 58599 // constant that refers to the RFC 2822 form 58600 hooks.RFC_2822 = function () { }; 58601 58602 // date from string and format string 58603 function configFromStringAndFormat(config) { 58604 // TODO: Move this to another part of the creation flow to prevent circular deps 58605 if (config._f === hooks.ISO_8601) { 58606 configFromISO(config); 58607 return; 58608 } 58609 if (config._f === hooks.RFC_2822) { 58610 configFromRFC2822(config); 58611 return; 58612 } 58613 config._a = []; 58614 getParsingFlags(config).empty = true; 58615 58616 // This array is used to make a Date, either with `new Date` or `Date.UTC` 58617 var string = '' + config._i, 58618 i, 58619 parsedInput, 58620 tokens, 58621 token, 58622 skipped, 58623 stringLength = string.length, 58624 totalParsedInputLength = 0, 58625 era, 58626 tokenLen; 58627 58628 tokens = 58629 expandFormat(config._f, config._locale).match(formattingTokens) || []; 58630 tokenLen = tokens.length; 58631 for (i = 0; i < tokenLen; i++) { 58632 token = tokens[i]; 58633 parsedInput = (string.match(getParseRegexForToken(token, config)) || 58634 [])[0]; 58635 if (parsedInput) { 58636 skipped = string.substr(0, string.indexOf(parsedInput)); 58637 if (skipped.length > 0) { 58638 getParsingFlags(config).unusedInput.push(skipped); 58639 } 58640 string = string.slice( 58641 string.indexOf(parsedInput) + parsedInput.length 58642 ); 58643 totalParsedInputLength += parsedInput.length; 58644 } 58645 // don't parse if it's not a known token 58646 if (formatTokenFunctions[token]) { 58647 if (parsedInput) { 58648 getParsingFlags(config).empty = false; 58649 } else { 58650 getParsingFlags(config).unusedTokens.push(token); 58651 } 58652 addTimeToArrayFromToken(token, parsedInput, config); 58653 } else if (config._strict && !parsedInput) { 58654 getParsingFlags(config).unusedTokens.push(token); 58655 } 58656 } 58657 58658 // add remaining unparsed input length to the string 58659 getParsingFlags(config).charsLeftOver = 58660 stringLength - totalParsedInputLength; 58661 if (string.length > 0) { 58662 getParsingFlags(config).unusedInput.push(string); 58663 } 58664 58665 // clear _12h flag if hour is <= 12 58666 if ( 58667 config._a[HOUR] <= 12 && 58668 getParsingFlags(config).bigHour === true && 58669 config._a[HOUR] > 0 58670 ) { 58671 getParsingFlags(config).bigHour = undefined; 58672 } 58673 58674 getParsingFlags(config).parsedDateParts = config._a.slice(0); 58675 getParsingFlags(config).meridiem = config._meridiem; 58676 // handle meridiem 58677 config._a[HOUR] = meridiemFixWrap( 58678 config._locale, 58679 config._a[HOUR], 58680 config._meridiem 58681 ); 58682 58683 // handle era 58684 era = getParsingFlags(config).era; 58685 if (era !== null) { 58686 config._a[YEAR] = config._locale.erasConvertYear(era, config._a[YEAR]); 58687 } 58688 58689 configFromArray(config); 58690 checkOverflow(config); 58691 } 58692 58693 function meridiemFixWrap(locale, hour, meridiem) { 58694 var isPm; 58695 58696 if (meridiem == null) { 58697 // nothing to do 58698 return hour; 58699 } 58700 if (locale.meridiemHour != null) { 58701 return locale.meridiemHour(hour, meridiem); 58702 } else if (locale.isPM != null) { 58703 // Fallback 58704 isPm = locale.isPM(meridiem); 58705 if (isPm && hour < 12) { 58706 hour += 12; 58707 } 58708 if (!isPm && hour === 12) { 58709 hour = 0; 58710 } 58711 return hour; 58712 } else { 58713 // this is not supposed to happen 58714 return hour; 58715 } 58716 } 58717 58718 // date from string and array of format strings 58719 function configFromStringAndArray(config) { 58720 var tempConfig, 58721 bestMoment, 58722 scoreToBeat, 58723 i, 58724 currentScore, 58725 validFormatFound, 58726 bestFormatIsValid = false, 58727 configfLen = config._f.length; 58728 58729 if (configfLen === 0) { 58730 getParsingFlags(config).invalidFormat = true; 58731 config._d = new Date(NaN); 58732 return; 58733 } 58734 58735 for (i = 0; i < configfLen; i++) { 58736 currentScore = 0; 58737 validFormatFound = false; 58738 tempConfig = copyConfig({}, config); 58739 if (config._useUTC != null) { 58740 tempConfig._useUTC = config._useUTC; 58741 } 58742 tempConfig._f = config._f[i]; 58743 configFromStringAndFormat(tempConfig); 58744 58745 if (isValid(tempConfig)) { 58746 validFormatFound = true; 58747 } 58748 58749 // if there is any input that was not parsed add a penalty for that format 58750 currentScore += getParsingFlags(tempConfig).charsLeftOver; 58751 58752 //or tokens 58753 currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10; 58754 58755 getParsingFlags(tempConfig).score = currentScore; 58756 58757 if (!bestFormatIsValid) { 58758 if ( 58759 scoreToBeat == null || 58760 currentScore < scoreToBeat || 58761 validFormatFound 58762 ) { 58763 scoreToBeat = currentScore; 58764 bestMoment = tempConfig; 58765 if (validFormatFound) { 58766 bestFormatIsValid = true; 58767 } 58768 } 58769 } else { 58770 if (currentScore < scoreToBeat) { 58771 scoreToBeat = currentScore; 58772 bestMoment = tempConfig; 58773 } 58774 } 58775 } 58776 58777 extend(config, bestMoment || tempConfig); 58778 } 58779 58780 function configFromObject(config) { 58781 if (config._d) { 58782 return; 58783 } 58784 58785 var i = normalizeObjectUnits(config._i), 58786 dayOrDate = i.day === undefined ? i.date : i.day; 58787 config._a = map( 58788 [i.year, i.month, dayOrDate, i.hour, i.minute, i.second, i.millisecond], 58789 function (obj) { 58790 return obj && parseInt(obj, 10); 58791 } 58792 ); 58793 58794 configFromArray(config); 58795 } 58796 58797 function createFromConfig(config) { 58798 var res = new Moment(checkOverflow(prepareConfig(config))); 58799 if (res._nextDay) { 58800 // Adding is smart enough around DST 58801 res.add(1, 'd'); 58802 res._nextDay = undefined; 58803 } 58804 58805 return res; 58806 } 58807 58808 function prepareConfig(config) { 58809 var input = config._i, 58810 format = config._f; 58811 58812 config._locale = config._locale || getLocale(config._l); 58813 58814 if (input === null || (format === undefined && input === '')) { 58815 return createInvalid({ nullInput: true }); 58816 } 58817 58818 if (typeof input === 'string') { 58819 config._i = input = config._locale.preparse(input); 58820 } 58821 58822 if (isMoment(input)) { 58823 return new Moment(checkOverflow(input)); 58824 } else if (isDate(input)) { 58825 config._d = input; 58826 } else if (isArray(format)) { 58827 configFromStringAndArray(config); 58828 } else if (format) { 58829 configFromStringAndFormat(config); 58830 } else { 58831 configFromInput(config); 58832 } 58833 58834 if (!isValid(config)) { 58835 config._d = null; 58836 } 58837 58838 return config; 58839 } 58840 58841 function configFromInput(config) { 58842 var input = config._i; 58843 if (isUndefined(input)) { 58844 config._d = new Date(hooks.now()); 58845 } else if (isDate(input)) { 58846 config._d = new Date(input.valueOf()); 58847 } else if (typeof input === 'string') { 58848 configFromString(config); 58849 } else if (isArray(input)) { 58850 config._a = map(input.slice(0), function (obj) { 58851 return parseInt(obj, 10); 58852 }); 58853 configFromArray(config); 58854 } else if (isObject(input)) { 58855 configFromObject(config); 58856 } else if (isNumber(input)) { 58857 // from milliseconds 58858 config._d = new Date(input); 58859 } else { 58860 hooks.createFromInputFallback(config); 58861 } 58862 } 58863 58864 function createLocalOrUTC(input, format, locale, strict, isUTC) { 58865 var c = {}; 58866 58867 if (format === true || format === false) { 58868 strict = format; 58869 format = undefined; 58870 } 58871 58872 if (locale === true || locale === false) { 58873 strict = locale; 58874 locale = undefined; 58875 } 58876 58877 if ( 58878 (isObject(input) && isObjectEmpty(input)) || 58879 (isArray(input) && input.length === 0) 58880 ) { 58881 input = undefined; 58882 } 58883 // object construction must be done this way. 58884 // https://github.com/moment/moment/issues/1423 58885 c._isAMomentObject = true; 58886 c._useUTC = c._isUTC = isUTC; 58887 c._l = locale; 58888 c._i = input; 58889 c._f = format; 58890 c._strict = strict; 58891 58892 return createFromConfig(c); 58893 } 58894 58895 function createLocal(input, format, locale, strict) { 58896 return createLocalOrUTC(input, format, locale, strict, false); 58897 } 58898 58899 var prototypeMin = deprecate( 58900 'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/', 58901 function () { 58902 var other = createLocal.apply(null, arguments); 58903 if (this.isValid() && other.isValid()) { 58904 return other < this ? this : other; 58905 } else { 58906 return createInvalid(); 58907 } 58908 } 58909 ), 58910 prototypeMax = deprecate( 58911 'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/', 58912 function () { 58913 var other = createLocal.apply(null, arguments); 58914 if (this.isValid() && other.isValid()) { 58915 return other > this ? this : other; 58916 } else { 58917 return createInvalid(); 58918 } 58919 } 58920 ); 58921 58922 // Pick a moment m from moments so that m[fn](other) is true for all 58923 // other. This relies on the function fn to be transitive. 58924 // 58925 // moments should either be an array of moment objects or an array, whose 58926 // first element is an array of moment objects. 58927 function pickBy(fn, moments) { 58928 var res, i; 58929 if (moments.length === 1 && isArray(moments[0])) { 58930 moments = moments[0]; 58931 } 58932 if (!moments.length) { 58933 return createLocal(); 58934 } 58935 res = moments[0]; 58936 for (i = 1; i < moments.length; ++i) { 58937 if (!moments[i].isValid() || moments[i][fn](res)) { 58938 res = moments[i]; 58939 } 58940 } 58941 return res; 58942 } 58943 58944 // TODO: Use [].sort instead? 58945 function min() { 58946 var args = [].slice.call(arguments, 0); 58947 58948 return pickBy('isBefore', args); 58949 } 58950 58951 function max() { 58952 var args = [].slice.call(arguments, 0); 58953 58954 return pickBy('isAfter', args); 58955 } 58956 58957 var now = function () { 58958 return Date.now ? Date.now() : +new Date(); 58959 }; 58960 58961 var ordering = [ 58962 'year', 58963 'quarter', 58964 'month', 58965 'week', 58966 'day', 58967 'hour', 58968 'minute', 58969 'second', 58970 'millisecond', 58971 ]; 58972 58973 function isDurationValid(m) { 58974 var key, 58975 unitHasDecimal = false, 58976 i, 58977 orderLen = ordering.length; 58978 for (key in m) { 58979 if ( 58980 hasOwnProp(m, key) && 58981 !( 58982 indexOf.call(ordering, key) !== -1 && 58983 (m[key] == null || !isNaN(m[key])) 58984 ) 58985 ) { 58986 return false; 58987 } 58988 } 58989 58990 for (i = 0; i < orderLen; ++i) { 58991 if (m[ordering[i]]) { 58992 if (unitHasDecimal) { 58993 return false; // only allow non-integers for smallest unit 58994 } 58995 if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) { 58996 unitHasDecimal = true; 58997 } 58998 } 58999 } 59000 59001 return true; 59002 } 59003 59004 function isValid$1() { 59005 return this._isValid; 59006 } 59007
vendor: 5,402 bytes, lines 59008-59168
59008 function createInvalid$1() { 59009 return createDuration(NaN); 59010 } 59011 59012 function Duration(duration) { 59013 var normalizedInput = normalizeObjectUnits(duration), 59014 years = normalizedInput.year || 0, 59015 quarters = normalizedInput.quarter || 0, 59016 months = normalizedInput.month || 0, 59017 weeks = normalizedInput.week || normalizedInput.isoWeek || 0, 59018 days = normalizedInput.day || 0, 59019 hours = normalizedInput.hour || 0, 59020 minutes = normalizedInput.minute || 0, 59021 seconds = normalizedInput.second || 0, 59022 milliseconds = normalizedInput.millisecond || 0; 59023 59024 this._isValid = isDurationValid(normalizedInput); 59025 59026 // representation for dateAddRemove 59027 this._milliseconds = 59028 +milliseconds + 59029 seconds * 1e3 + // 1000 59030 minutes * 6e4 + // 1000 * 60 59031 hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978 59032 // Because of dateAddRemove treats 24 hours as different from a 59033 // day when working around DST, we need to store them separately 59034 this._days = +days + weeks * 7; 59035 // It is impossible to translate months into days without knowing 59036 // which months you are are talking about, so we have to store 59037 // it separately. 59038 this._months = +months + quarters * 3 + years * 12; 59039 59040 this._data = {}; 59041 59042 this._locale = getLocale(); 59043 59044 this._bubble(); 59045 } 59046 59047 function isDuration(obj) { 59048 return obj instanceof Duration; 59049 } 59050 59051 function absRound(number) { 59052 if (number < 0) { 59053 return Math.round(-1 * number) * -1; 59054 } else { 59055 return Math.round(number); 59056 } 59057 } 59058 59059 // compare two arrays, return the number of differences 59060 function compareArrays(array1, array2, dontConvert) { 59061 var len = Math.min(array1.length, array2.length), 59062 lengthDiff = Math.abs(array1.length - array2.length), 59063 diffs = 0, 59064 i; 59065 for (i = 0; i < len; i++) { 59066 if ( 59067 (dontConvert && array1[i] !== array2[i]) || 59068 (!dontConvert && toInt(array1[i]) !== toInt(array2[i])) 59069 ) { 59070 diffs++; 59071 } 59072 } 59073 return diffs + lengthDiff; 59074 } 59075 59076 // FORMATTING 59077 59078 function offset(token, separator) { 59079 addFormatToken(token, 0, 0, function () { 59080 var offset = this.utcOffset(), 59081 sign = '+'; 59082 if (offset < 0) { 59083 offset = -offset; 59084 sign = '-'; 59085 } 59086 return ( 59087 sign + 59088 zeroFill(~~(offset / 60), 2) + 59089 separator + 59090 zeroFill(~~offset % 60, 2) 59091 ); 59092 }); 59093 } 59094 59095 offset('Z', ':'); 59096 offset('ZZ', ''); 59097 59098 // PARSING 59099 59100 addRegexToken('Z', matchShortOffset); 59101 addRegexToken('ZZ', matchShortOffset); 59102 addParseToken(['Z', 'ZZ'], function (input, array, config) { 59103 config._useUTC = true; 59104 config._tzm = offsetFromString(matchShortOffset, input); 59105 }); 59106 59107 // HELPERS 59108 59109 // timezone chunker 59110 // '+10:00' > ['10', '00'] 59111 // '-1530' > ['-15', '30'] 59112 var chunkOffset = /([\+\-]|\d\d)/gi; 59113 59114 function offsetFromString(matcher, string) { 59115 var matches = (string || '').match(matcher), 59116 chunk, 59117 parts, 59118 minutes; 59119 59120 if (matches === null) { 59121 return null; 59122 } 59123 59124 chunk = matches[matches.length - 1] || []; 59125 parts = (chunk + '').match(chunkOffset) || ['-', 0, 0]; 59126 minutes = +(parts[1] * 60) + toInt(parts[2]); 59127 59128 return minutes === 0 ? 0 : parts[0] === '+' ? minutes : -minutes; 59129 } 59130 59131 // Return a moment from input, that is local/utc/zone equivalent to model. 59132 function cloneWithOffset(input, model) { 59133 var res, diff; 59134 if (model._isUTC) { 59135 res = model.clone(); 59136 diff = 59137 (isMoment(input) || isDate(input) 59138 ? input.valueOf() 59139 : createLocal(input).valueOf()) - res.valueOf(); 59140 // Use low-level api, because this fn is low-level api. 59141 res._d.setTime(res._d.valueOf() + diff); 59142 hooks.updateOffset(res, false); 59143 return res; 59144 } else { 59145 return createLocal(input).local(); 59146 } 59147 } 59148 59149 function getDateOffset(m) { 59150 // On Firefox.24 Date#getTimezoneOffset returns a floating point. 59151 // https://github.com/moment/moment/pull/1871 59152 return -Math.round(m._d.getTimezoneOffset()); 59153 } 59154 59155 // HOOKS 59156 59157 // This function will be called whenever a moment is mutated. 59158 // It is intended to keep the offset in sync with the timezone. 59159 hooks.updateOffset = function () { }; 59160 59161 // MOMENTS 59162 59163 // keepLocalTime = true means only change the timezone, without 59164 // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]--> 59165 // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset 59166 // +0200, so we adjust the time as needed, to be valid. 59167 // 59168 // Keeping the time actually adds/subtracts (one hour)
vendor: 31,337 bytes, lines 59169-60131
59169 // from the actual represented time. That is why we call updateOffset 59170 // a second time. In case it wants us to change the offset again 59171 // _changeInProgress == true case, then we have to adjust, because 59172 // there is no such time in the given timezone. 59173 function getSetOffset(input, keepLocalTime, keepMinutes) { 59174 var offset = this._offset || 0, 59175 localAdjust; 59176 if (!this.isValid()) { 59177 return input != null ? this : NaN; 59178 } 59179 if (input != null) { 59180 if (typeof input === 'string') { 59181 input = offsetFromString(matchShortOffset, input); 59182 if (input === null) { 59183 return this; 59184 } 59185 } else if (Math.abs(input) < 16 && !keepMinutes) { 59186 input = input * 60; 59187 } 59188 if (!this._isUTC && keepLocalTime) { 59189 localAdjust = getDateOffset(this); 59190 } 59191 this._offset = input; 59192 this._isUTC = true; 59193 if (localAdjust != null) { 59194 this.add(localAdjust, 'm'); 59195 } 59196 if (offset !== input) { 59197 if (!keepLocalTime || this._changeInProgress) { 59198 addSubtract( 59199 this, 59200 createDuration(input - offset, 'm'), 59201 1, 59202 false 59203 ); 59204 } else if (!this._changeInProgress) { 59205 this._changeInProgress = true; 59206 hooks.updateOffset(this, true); 59207 this._changeInProgress = null; 59208 } 59209 } 59210 return this; 59211 } else { 59212 return this._isUTC ? offset : getDateOffset(this); 59213 } 59214 } 59215 59216 function getSetZone(input, keepLocalTime) { 59217 if (input != null) { 59218 if (typeof input !== 'string') { 59219 input = -input; 59220 } 59221 59222 this.utcOffset(input, keepLocalTime); 59223 59224 return this; 59225 } else { 59226 return -this.utcOffset(); 59227 } 59228 } 59229 59230 function setOffsetToUTC(keepLocalTime) { 59231 return this.utcOffset(0, keepLocalTime); 59232 } 59233 59234 function setOffsetToLocal(keepLocalTime) { 59235 if (this._isUTC) { 59236 this.utcOffset(0, keepLocalTime); 59237 this._isUTC = false; 59238 59239 if (keepLocalTime) { 59240 this.subtract(getDateOffset(this), 'm'); 59241 } 59242 } 59243 return this; 59244 } 59245 59246 function setOffsetToParsedOffset() { 59247 if (this._tzm != null) { 59248 this.utcOffset(this._tzm, false, true); 59249 } else if (typeof this._i === 'string') { 59250 var tZone = offsetFromString(matchOffset, this._i); 59251 if (tZone != null) { 59252 this.utcOffset(tZone); 59253 } else { 59254 this.utcOffset(0, true); 59255 } 59256 } 59257 return this; 59258 } 59259 59260 function hasAlignedHourOffset(input) { 59261 if (!this.isValid()) { 59262 return false; 59263 } 59264 input = input ? createLocal(input).utcOffset() : 0; 59265 59266 return (this.utcOffset() - input) % 60 === 0; 59267 } 59268 59269 function isDaylightSavingTime() { 59270 return ( 59271 this.utcOffset() > this.clone().month(0).utcOffset() || 59272 this.utcOffset() > this.clone().month(5).utcOffset() 59273 ); 59274 } 59275 59276 function isDaylightSavingTimeShifted() { 59277 if (!isUndefined(this._isDSTShifted)) { 59278 return this._isDSTShifted; 59279 } 59280 59281 var c = {}, 59282 other; 59283 59284 copyConfig(c, this); 59285 c = prepareConfig(c); 59286 59287 if (c._a) { 59288 other = c._isUTC ? createUTC(c._a) : createLocal(c._a); 59289 this._isDSTShifted = 59290 this.isValid() && compareArrays(c._a, other.toArray()) > 0; 59291 } else { 59292 this._isDSTShifted = false; 59293 } 59294 59295 return this._isDSTShifted; 59296 } 59297 59298 function isLocal() { 59299 return this.isValid() ? !this._isUTC : false; 59300 } 59301 59302 function isUtcOffset() { 59303 return this.isValid() ? this._isUTC : false; 59304 } 59305 59306 function isUtc() { 59307 return this.isValid() ? this._isUTC && this._offset === 0 : false; 59308 } 59309 59310 // ASP.NET json date format regex 59311 var aspNetRegex = /^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/, 59312 // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html 59313 // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere 59314 // and further modified to allow for strings containing both week and day 59315 isoRegex = 59316 /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/; 59317 59318 function createDuration(input, key) { 59319 var duration = input, 59320 // matching against regexp is expensive, do it on demand 59321 match = null, 59322 sign, 59323 ret, 59324 diffRes; 59325 59326 if (isDuration(input)) { 59327 duration = { 59328 ms: input._milliseconds, 59329 d: input._days, 59330 M: input._months, 59331 }; 59332 } else if (isNumber(input) || !isNaN(+input)) { 59333 duration = {}; 59334 if (key) { 59335 duration[key] = +input; 59336 } else { 59337 duration.milliseconds = +input; 59338 } 59339 } else if ((match = aspNetRegex.exec(input))) { 59340 sign = match[1] === '-' ? -1 : 1; 59341 duration = { 59342 y: 0, 59343 d: toInt(match[DATE]) * sign, 59344 h: toInt(match[HOUR]) * sign, 59345 m: toInt(match[MINUTE]) * sign, 59346 s: toInt(match[SECOND]) * sign, 59347 ms: toInt(absRound(match[MILLISECOND] * 1000)) * sign, // the millisecond decimal point is included in the match 59348 }; 59349 } else if ((match = isoRegex.exec(input))) { 59350 sign = match[1] === '-' ? -1 : 1; 59351 duration = { 59352 y: parseIso(match[2], sign), 59353 M: parseIso(match[3], sign), 59354 w: parseIso(match[4], sign), 59355 d: parseIso(match[5], sign), 59356 h: parseIso(match[6], sign), 59357 m: parseIso(match[7], sign), 59358 s: parseIso(match[8], sign), 59359 }; 59360 } else if (duration == null) { 59361 // checks for null or undefined 59362 duration = {}; 59363 } else if ( 59364 typeof duration === 'object' && 59365 ('from' in duration || 'to' in duration) 59366 ) { 59367 diffRes = momentsDifference( 59368 createLocal(duration.from), 59369 createLocal(duration.to) 59370 ); 59371 59372 duration = {}; 59373 duration.ms = diffRes.milliseconds; 59374 duration.M = diffRes.months; 59375 } 59376 59377 ret = new Duration(duration); 59378 59379 if (isDuration(input) && hasOwnProp(input, '_locale')) { 59380 ret._locale = input._locale; 59381 } 59382 59383 if (isDuration(input) && hasOwnProp(input, '_isValid')) { 59384 ret._isValid = input._isValid; 59385 } 59386 59387 return ret; 59388 } 59389 59390 createDuration.fn = Duration.prototype; 59391 createDuration.invalid = createInvalid$1; 59392 59393 function parseIso(inp, sign) { 59394 // We'd normally use ~~inp for this, but unfortunately it also 59395 // converts floats to ints. 59396 // inp may be undefined, so careful calling replace on it. 59397 var res = inp && parseFloat(inp.replace(',', '.')); 59398 // apply sign while we're at it 59399 return (isNaN(res) ? 0 : res) * sign; 59400 } 59401 59402 function positiveMomentsDifference(base, other) { 59403 var res = {}; 59404 59405 res.months = 59406 other.month() - base.month() + (other.year() - base.year()) * 12; 59407 if (base.clone().add(res.months, 'M').isAfter(other)) { 59408 --res.months; 59409 } 59410 59411 res.milliseconds = +other - +base.clone().add(res.months, 'M'); 59412 59413 return res; 59414 } 59415 59416 function momentsDifference(base, other) { 59417 var res; 59418 if (!(base.isValid() && other.isValid())) { 59419 return { milliseconds: 0, months: 0 }; 59420 } 59421 59422 other = cloneWithOffset(other, base); 59423 if (base.isBefore(other)) { 59424 res = positiveMomentsDifference(base, other); 59425 } else { 59426 res = positiveMomentsDifference(other, base); 59427 res.milliseconds = -res.milliseconds; 59428 res.months = -res.months; 59429 } 59430 59431 return res; 59432 } 59433 59434 // TODO: remove 'name' arg after deprecation is removed 59435 function createAdder(direction, name) { 59436 return function (val, period) { 59437 var dur, tmp; 59438 //invert the arguments, but complain about it 59439 if (period !== null && !isNaN(+period)) { 59440 deprecateSimple( 59441 name, 59442 'moment().' + 59443 name + 59444 '(period, number) is deprecated. Please use moment().' + 59445 name + 59446 '(number, period). ' + 59447 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.' 59448 ); 59449 tmp = val; 59450 val = period; 59451 period = tmp; 59452 } 59453 59454 dur = createDuration(val, period); 59455 addSubtract(this, dur, direction); 59456 return this; 59457 }; 59458 } 59459 59460 function addSubtract(mom, duration, isAdding, updateOffset) { 59461 var milliseconds = duration._milliseconds, 59462 days = absRound(duration._days), 59463 months = absRound(duration._months); 59464 59465 if (!mom.isValid()) { 59466 // No op 59467 return; 59468 } 59469 59470 updateOffset = updateOffset == null ? true : updateOffset; 59471 59472 if (months) { 59473 setMonth(mom, get(mom, 'Month') + months * isAdding); 59474 } 59475 if (days) { 59476 set$1(mom, 'Date', get(mom, 'Date') + days * isAdding); 59477 } 59478 if (milliseconds) { 59479 mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding); 59480 } 59481 if (updateOffset) { 59482 hooks.updateOffset(mom, days || months); 59483 } 59484 } 59485 59486 var add = createAdder(1, 'add'), 59487 subtract = createAdder(-1, 'subtract'); 59488 59489 function isString(input) { 59490 return typeof input === 'string' || input instanceof String; 59491 } 59492 59493 // type MomentInput = Moment | Date | string | number | (number | string)[] | MomentInputObject | void; // null | undefined 59494 function isMomentInput(input) { 59495 return ( 59496 isMoment(input) || 59497 isDate(input) || 59498 isString(input) || 59499 isNumber(input) || 59500 isNumberOrStringArray(input) || 59501 isMomentInputObject(input) || 59502 input === null || 59503 input === undefined 59504 ); 59505 } 59506 59507 function isMomentInputObject(input) { 59508 var objectTest = isObject(input) && !isObjectEmpty(input), 59509 propertyTest = false, 59510 properties = [ 59511 'years', 59512 'year', 59513 'y', 59514 'months', 59515 'month', 59516 'M', 59517 'days', 59518 'day', 59519 'd', 59520 'dates', 59521 'date', 59522 'D', 59523 'hours', 59524 'hour', 59525 'h', 59526 'minutes', 59527 'minute', 59528 'm', 59529 'seconds', 59530 'second', 59531 's', 59532 'milliseconds', 59533 'millisecond', 59534 'ms', 59535 ], 59536 i, 59537 property, 59538 propertyLen = properties.length; 59539 59540 for (i = 0; i < propertyLen; i += 1) { 59541 property = properties[i]; 59542 propertyTest = propertyTest || hasOwnProp(input, property); 59543 } 59544 59545 return objectTest && propertyTest; 59546 } 59547 59548 function isNumberOrStringArray(input) { 59549 var arrayTest = isArray(input), 59550 dataTypeTest = false; 59551 if (arrayTest) { 59552 dataTypeTest = 59553 input.filter(function (item) { 59554 return !isNumber(item) && isString(input); 59555 }).length === 0; 59556 } 59557 return arrayTest && dataTypeTest; 59558 } 59559 59560 function isCalendarSpec(input) { 59561 var objectTest = isObject(input) && !isObjectEmpty(input), 59562 propertyTest = false, 59563 properties = [ 59564 'sameDay', 59565 'nextDay', 59566 'lastDay', 59567 'nextWeek', 59568 'lastWeek', 59569 'sameElse', 59570 ], 59571 i, 59572 property; 59573 59574 for (i = 0; i < properties.length; i += 1) { 59575 property = properties[i]; 59576 propertyTest = propertyTest || hasOwnProp(input, property); 59577 } 59578 59579 return objectTest && propertyTest; 59580 } 59581 59582 function getCalendarFormat(myMoment, now) { 59583 var diff = myMoment.diff(now, 'days', true); 59584 return diff < -6 59585 ? 'sameElse' 59586 : diff < -1 59587 ? 'lastWeek' 59588 : diff < 0 59589 ? 'lastDay' 59590 : diff < 1 59591 ? 'sameDay' 59592 : diff < 2 59593 ? 'nextDay' 59594 : diff < 7 59595 ? 'nextWeek' 59596 : 'sameElse'; 59597 } 59598 59599 function calendar$1(time, formats) { 59600 // Support for single parameter, formats only overload to the calendar function 59601 if (arguments.length === 1) { 59602 if (!arguments[0]) { 59603 time = undefined; 59604 formats = undefined; 59605 } else if (isMomentInput(arguments[0])) { 59606 time = arguments[0]; 59607 formats = undefined; 59608 } else if (isCalendarSpec(arguments[0])) { 59609 formats = arguments[0]; 59610 time = undefined; 59611 } 59612 } 59613 // We want to compare the start of today, vs this. 59614 // Getting start-of-today depends on whether we're local/utc/offset or not. 59615 var now = time || createLocal(), 59616 sod = cloneWithOffset(now, this).startOf('day'), 59617 format = hooks.calendarFormat(this, sod) || 'sameElse', 59618 output = 59619 formats && 59620 (isFunction(formats[format]) 59621 ? formats[format].call(this, now) 59622 : formats[format]); 59623 59624 return this.format( 59625 output || this.localeData().calendar(format, this, createLocal(now)) 59626 ); 59627 } 59628 59629 function clone() { 59630 return new Moment(this); 59631 } 59632 59633 function isAfter(input, units) { 59634 var localInput = isMoment(input) ? input : createLocal(input); 59635 if (!(this.isValid() && localInput.isValid())) { 59636 return false; 59637 } 59638 units = normalizeUnits(units) || 'millisecond'; 59639 if (units === 'millisecond') { 59640 return this.valueOf() > localInput.valueOf(); 59641 } else { 59642 return localInput.valueOf() < this.clone().startOf(units).valueOf(); 59643 } 59644 } 59645 59646 function isBefore(input, units) { 59647 var localInput = isMoment(input) ? input : createLocal(input); 59648 if (!(this.isValid() && localInput.isValid())) { 59649 return false; 59650 } 59651 units = normalizeUnits(units) || 'millisecond'; 59652 if (units === 'millisecond') { 59653 return this.valueOf() < localInput.valueOf(); 59654 } else { 59655 return this.clone().endOf(units).valueOf() < localInput.valueOf(); 59656 } 59657 } 59658 59659 function isBetween(from, to, units, inclusivity) { 59660 var localFrom = isMoment(from) ? from : createLocal(from), 59661 localTo = isMoment(to) ? to : createLocal(to); 59662 if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) { 59663 return false; 59664 } 59665 inclusivity = inclusivity || '()'; 59666 return ( 59667 (inclusivity[0] === '(' 59668 ? this.isAfter(localFrom, units) 59669 : !this.isBefore(localFrom, units)) && 59670 (inclusivity[1] === ')' 59671 ? this.isBefore(localTo, units) 59672 : !this.isAfter(localTo, units)) 59673 ); 59674 } 59675 59676 function isSame(input, units) { 59677 var localInput = isMoment(input) ? input : createLocal(input), 59678 inputMs; 59679 if (!(this.isValid() && localInput.isValid())) { 59680 return false; 59681 } 59682 units = normalizeUnits(units) || 'millisecond'; 59683 if (units === 'millisecond') { 59684 return this.valueOf() === localInput.valueOf(); 59685 } else { 59686 inputMs = localInput.valueOf(); 59687 return ( 59688 this.clone().startOf(units).valueOf() <= inputMs && 59689 inputMs <= this.clone().endOf(units).valueOf() 59690 ); 59691 } 59692 } 59693 59694 function isSameOrAfter(input, units) { 59695 return this.isSame(input, units) || this.isAfter(input, units); 59696 } 59697 59698 function isSameOrBefore(input, units) { 59699 return this.isSame(input, units) || this.isBefore(input, units); 59700 } 59701 59702 function diff(input, units, asFloat) { 59703 var that, zoneDelta, output; 59704 59705 if (!this.isValid()) { 59706 return NaN; 59707 } 59708 59709 that = cloneWithOffset(input, this); 59710 59711 if (!that.isValid()) { 59712 return NaN; 59713 } 59714 59715 zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4; 59716 59717 units = normalizeUnits(units); 59718 59719 switch (units) { 59720 case 'year': 59721 output = monthDiff(this, that) / 12; 59722 break; 59723 case 'month': 59724 output = monthDiff(this, that); 59725 break; 59726 case 'quarter': 59727 output = monthDiff(this, that) / 3; 59728 break; 59729 case 'second': 59730 output = (this - that) / 1e3; 59731 break; // 1000 59732 case 'minute': 59733 output = (this - that) / 6e4; 59734 break; // 1000 * 60 59735 case 'hour': 59736 output = (this - that) / 36e5; 59737 break; // 1000 * 60 * 60 59738 case 'day': 59739 output = (this - that - zoneDelta) / 864e5; 59740 break; // 1000 * 60 * 60 * 24, negate dst 59741 case 'week': 59742 output = (this - that - zoneDelta) / 6048e5; 59743 break; // 1000 * 60 * 60 * 24 * 7, negate dst 59744 default: 59745 output = this - that; 59746 } 59747 59748 return asFloat ? output : absFloor(output); 59749 } 59750 59751 function monthDiff(a, b) { 59752 if (a.date() < b.date()) { 59753 // end-of-month calculations work correct when the start month has more 59754 // days than the end month. 59755 return -monthDiff(b, a); 59756 } 59757 // difference in months 59758 var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month()), 59759 // b is in (anchor - 1 month, anchor + 1 month) 59760 anchor = a.clone().add(wholeMonthDiff, 'months'), 59761 anchor2, 59762 adjust; 59763 59764 if (b - anchor < 0) { 59765 anchor2 = a.clone().add(wholeMonthDiff - 1, 'months'); 59766 // linear across the month 59767 adjust = (b - anchor) / (anchor - anchor2); 59768 } else { 59769 anchor2 = a.clone().add(wholeMonthDiff + 1, 'months'); 59770 // linear across the month 59771 adjust = (b - anchor) / (anchor2 - anchor); 59772 } 59773 59774 //check for negative zero, return zero if negative zero 59775 return -(wholeMonthDiff + adjust) || 0; 59776 } 59777 59778 hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ'; 59779 hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]'; 59780 59781 function toString() { 59782 return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ'); 59783 } 59784 59785 function toISOString(keepOffset) { 59786 if (!this.isValid()) { 59787 return null; 59788 } 59789 var utc = keepOffset !== true, 59790 m = utc ? this.clone().utc() : this; 59791 if (m.year() < 0 || m.year() > 9999) { 59792 return formatMoment( 59793 m, 59794 utc 59795 ? 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]' 59796 : 'YYYYYY-MM-DD[T]HH:mm:ss.SSSZ' 59797 ); 59798 } 59799 if (isFunction(Date.prototype.toISOString)) { 59800 // native implementation is ~50x faster, use it when we can 59801 if (utc) { 59802 return this.toDate().toISOString(); 59803 } else { 59804 return new Date(this.valueOf() + this.utcOffset() * 60 * 1000) 59805 .toISOString() 59806 .replace('Z', formatMoment(m, 'Z')); 59807 } 59808 } 59809 return formatMoment( 59810 m, 59811 utc ? 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYY-MM-DD[T]HH:mm:ss.SSSZ' 59812 ); 59813 } 59814 59815 /** 59816 * Return a human readable representation of a moment that can 59817 * also be evaluated to get a new moment which is the same 59818 * 59819 * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects 59820 */ 59821 function inspect() { 59822 if (!this.isValid()) { 59823 return 'moment.invalid(/* ' + this._i + ' */)'; 59824 } 59825 var func = 'moment', 59826 zone = '', 59827 prefix, 59828 year, 59829 datetime, 59830 suffix; 59831 if (!this.isLocal()) { 59832 func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone'; 59833 zone = 'Z'; 59834 } 59835 prefix = '[' + func + '("]'; 59836 year = 0 <= this.year() && this.year() <= 9999 ? 'YYYY' : 'YYYYYY'; 59837 datetime = '-MM-DD[T]HH:mm:ss.SSS'; 59838 suffix = zone + '[")]'; 59839 59840 return this.format(prefix + year + datetime + suffix); 59841 } 59842 59843 function format(inputString) { 59844 if (!inputString) { 59845 inputString = this.isUtc() 59846 ? hooks.defaultFormatUtc 59847 : hooks.defaultFormat; 59848 } 59849 var output = formatMoment(this, inputString); 59850 return this.localeData().postformat(output); 59851 } 59852 59853 function from(time, withoutSuffix) { 59854 if ( 59855 this.isValid() && 59856 ((isMoment(time) && time.isValid()) || createLocal(time).isValid()) 59857 ) { 59858 return createDuration({ to: this, from: time }) 59859 .locale(this.locale()) 59860 .humanize(!withoutSuffix); 59861 } else { 59862 return this.localeData().invalidDate(); 59863 } 59864 } 59865 59866 function fromNow(withoutSuffix) { 59867 return this.from(createLocal(), withoutSuffix); 59868 } 59869 59870 function to(time, withoutSuffix) { 59871 if ( 59872 this.isValid() && 59873 ((isMoment(time) && time.isValid()) || createLocal(time).isValid()) 59874 ) { 59875 return createDuration({ from: this, to: time }) 59876 .locale(this.locale()) 59877 .humanize(!withoutSuffix); 59878 } else { 59879 return this.localeData().invalidDate(); 59880 } 59881 } 59882 59883 function toNow(withoutSuffix) { 59884 return this.to(createLocal(), withoutSuffix); 59885 } 59886 59887 // If passed a locale key, it will set the locale for this 59888 // instance. Otherwise, it will return the locale configuration 59889 // variables for this instance. 59890 function locale(key) { 59891 var newLocaleData; 59892 59893 if (key === undefined) { 59894 return this._locale._abbr; 59895 } else { 59896 newLocaleData = getLocale(key); 59897 if (newLocaleData != null) { 59898 this._locale = newLocaleData; 59899 } 59900 return this; 59901 } 59902 } 59903 59904 var lang = deprecate( 59905 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.', 59906 function (key) { 59907 if (key === undefined) { 59908 return this.localeData(); 59909 } else { 59910 return this.locale(key); 59911 } 59912 } 59913 ); 59914 59915 function localeData() { 59916 return this._locale; 59917 } 59918 59919 var MS_PER_SECOND = 1000, 59920 MS_PER_MINUTE = 60 * MS_PER_SECOND, 59921 MS_PER_HOUR = 60 * MS_PER_MINUTE, 59922 MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR; 59923 59924 // actual modulo - handles negative numbers (for dates before 1970): 59925 function mod$1(dividend, divisor) { 59926 return ((dividend % divisor) + divisor) % divisor; 59927 } 59928 59929 function localStartOfDate(y, m, d) { 59930 // the date constructor remaps years 0-99 to 1900-1999 59931 if (y < 100 && y >= 0) { 59932 // preserve leap years using a full 400 year cycle, then reset 59933 return new Date(y + 400, m, d) - MS_PER_400_YEARS; 59934 } else { 59935 return new Date(y, m, d).valueOf(); 59936 } 59937 } 59938 59939 function utcStartOfDate(y, m, d) { 59940 // Date.UTC remaps years 0-99 to 1900-1999 59941 if (y < 100 && y >= 0) { 59942 // preserve leap years using a full 400 year cycle, then reset 59943 return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS; 59944 } else { 59945 return Date.UTC(y, m, d); 59946 } 59947 } 59948 59949 function startOf(units) { 59950 var time, startOfDate; 59951 units = normalizeUnits(units); 59952 if (units === undefined || units === 'millisecond' || !this.isValid()) { 59953 return this; 59954 } 59955 59956 startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate; 59957 59958 switch (units) { 59959 case 'year': 59960 time = startOfDate(this.year(), 0, 1); 59961 break; 59962 case 'quarter': 59963 time = startOfDate( 59964 this.year(), 59965 this.month() - (this.month() % 3), 59966 1 59967 ); 59968 break; 59969 case 'month': 59970 time = startOfDate(this.year(), this.month(), 1); 59971 break; 59972 case 'week': 59973 time = startOfDate( 59974 this.year(), 59975 this.month(), 59976 this.date() - this.weekday() 59977 ); 59978 break; 59979 case 'isoWeek': 59980 time = startOfDate( 59981 this.year(), 59982 this.month(), 59983 this.date() - (this.isoWeekday() - 1) 59984 ); 59985 break; 59986 case 'day': 59987 case 'date': 59988 time = startOfDate(this.year(), this.month(), this.date()); 59989 break; 59990 case 'hour': 59991 time = this._d.valueOf(); 59992 time -= mod$1( 59993 time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), 59994 MS_PER_HOUR 59995 ); 59996 break; 59997 case 'minute': 59998 time = this._d.valueOf(); 59999 time -= mod$1(time, MS_PER_MINUTE); 60000 break; 60001 case 'second': 60002 time = this._d.valueOf(); 60003 time -= mod$1(time, MS_PER_SECOND); 60004 break; 60005 } 60006 60007 this._d.setTime(time); 60008 hooks.updateOffset(this, true); 60009 return this; 60010 } 60011 60012 function endOf(units) { 60013 var time, startOfDate; 60014 units = normalizeUnits(units); 60015 if (units === undefined || units === 'millisecond' || !this.isValid()) { 60016 return this; 60017 } 60018 60019 startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate; 60020 60021 switch (units) { 60022 case 'year': 60023 time = startOfDate(this.year() + 1, 0, 1) - 1; 60024 break; 60025 case 'quarter': 60026 time = 60027 startOfDate( 60028 this.year(), 60029 this.month() - (this.month() % 3) + 3, 60030 1 60031 ) - 1; 60032 break; 60033 case 'month': 60034 time = startOfDate(this.year(), this.month() + 1, 1) - 1; 60035 break; 60036 case 'week': 60037 time = 60038 startOfDate( 60039 this.year(), 60040 this.month(), 60041 this.date() - this.weekday() + 7 60042 ) - 1; 60043 break; 60044 case 'isoWeek': 60045 time = 60046 startOfDate( 60047 this.year(), 60048 this.month(), 60049 this.date() - (this.isoWeekday() - 1) + 7 60050 ) - 1; 60051 break; 60052 case 'day': 60053 case 'date': 60054 time = startOfDate(this.year(), this.month(), this.date() + 1) - 1; 60055 break; 60056 case 'hour': 60057 time = this._d.valueOf(); 60058 time += 60059 MS_PER_HOUR - 60060 mod$1( 60061 time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), 60062 MS_PER_HOUR 60063 ) - 60064 1; 60065 break; 60066 case 'minute': 60067 time = this._d.valueOf(); 60068 time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1; 60069 break; 60070 case 'second': 60071 time = this._d.valueOf(); 60072 time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1; 60073 break; 60074 } 60075 60076 this._d.setTime(time); 60077 hooks.updateOffset(this, true); 60078 return this; 60079 } 60080 60081 function valueOf() { 60082 return this._d.valueOf() - (this._offset || 0) * 60000; 60083 } 60084 60085 function unix() { 60086 return Math.floor(this.valueOf() / 1000); 60087 } 60088 60089 function toDate() { 60090 return new Date(this.valueOf()); 60091 } 60092 60093 function toArray() { 60094 var m = this; 60095 return [ 60096 m.year(), 60097 m.month(), 60098 m.date(), 60099 m.hour(), 60100 m.minute(), 60101 m.second(), 60102 m.millisecond(), 60103 ]; 60104 } 60105 60106 function toObject() { 60107 var m = this; 60108 return { 60109 years: m.year(), 60110 months: m.month(), 60111 date: m.date(), 60112 hours: m.hours(), 60113 minutes: m.minutes(), 60114 seconds: m.seconds(), 60115 milliseconds: m.milliseconds(), 60116 }; 60117 } 60118 60119 function toJSON() { 60120 // new Date(NaN).toJSON() === null 60121 return this.isValid() ? this.toISOString() : null; 60122 } 60123 60124 function isValid$2() { 60125 return isValid(this); 60126 } 60127 60128 function parsingFlags() { 60129 return extend({}, getParsingFlags(this)); 60130 } 60131
vendor: 9,174 bytes, lines 60132-60429
60132 function invalidAt() { 60133 return getParsingFlags(this).overflow; 60134 } 60135 60136 function creationData() { 60137 return { 60138 input: this._i, 60139 format: this._f, 60140 locale: this._locale, 60141 isUTC: this._isUTC, 60142 strict: this._strict, 60143 }; 60144 } 60145 60146 addFormatToken('N', 0, 0, 'eraAbbr'); 60147 addFormatToken('NN', 0, 0, 'eraAbbr'); 60148 addFormatToken('NNN', 0, 0, 'eraAbbr'); 60149 addFormatToken('NNNN', 0, 0, 'eraName'); 60150 addFormatToken('NNNNN', 0, 0, 'eraNarrow'); 60151 60152 addFormatToken('y', ['y', 1], 'yo', 'eraYear'); 60153 addFormatToken('y', ['yy', 2], 0, 'eraYear'); 60154 addFormatToken('y', ['yyy', 3], 0, 'eraYear'); 60155 addFormatToken('y', ['yyyy', 4], 0, 'eraYear'); 60156 60157 addRegexToken('N', matchEraAbbr); 60158 addRegexToken('NN', matchEraAbbr); 60159 addRegexToken('NNN', matchEraAbbr); 60160 addRegexToken('NNNN', matchEraName); 60161 addRegexToken('NNNNN', matchEraNarrow); 60162 60163 addParseToken( 60164 ['N', 'NN', 'NNN', 'NNNN', 'NNNNN'], 60165 function (input, array, config, token) { 60166 var era = config._locale.erasParse(input, token, config._strict); 60167 if (era) { 60168 getParsingFlags(config).era = era; 60169 } else { 60170 getParsingFlags(config).invalidEra = input; 60171 } 60172 } 60173 ); 60174 60175 addRegexToken('y', matchUnsigned); 60176 addRegexToken('yy', matchUnsigned); 60177 addRegexToken('yyy', matchUnsigned); 60178 addRegexToken('yyyy', matchUnsigned); 60179 addRegexToken('yo', matchEraYearOrdinal); 60180 60181 addParseToken(['y', 'yy', 'yyy', 'yyyy'], YEAR); 60182 addParseToken(['yo'], function (input, array, config, token) { 60183 var match; 60184 if (config._locale._eraYearOrdinalRegex) { 60185 match = input.match(config._locale._eraYearOrdinalRegex); 60186 } 60187 60188 if (config._locale.eraYearOrdinalParse) { 60189 array[YEAR] = config._locale.eraYearOrdinalParse(input, match); 60190 } else { 60191 array[YEAR] = parseInt(input, 10); 60192 } 60193 }); 60194 60195 function localeEras(m, format) { 60196 var i, 60197 l, 60198 date, 60199 eras = this._eras || getLocale('en')._eras; 60200 for (i = 0, l = eras.length; i < l; ++i) { 60201 switch (typeof eras[i].since) { 60202 case 'string': 60203 // truncate time 60204 date = hooks(eras[i].since).startOf('day'); 60205 eras[i].since = date.valueOf(); 60206 break; 60207 } 60208 60209 switch (typeof eras[i].until) { 60210 case 'undefined': 60211 eras[i].until = +Infinity; 60212 break; 60213 case 'string': 60214 // truncate time 60215 date = hooks(eras[i].until).startOf('day').valueOf(); 60216 eras[i].until = date.valueOf(); 60217 break; 60218 } 60219 } 60220 return eras; 60221 } 60222 60223 function localeErasParse(eraName, format, strict) { 60224 var i, 60225 l, 60226 eras = this.eras(), 60227 name, 60228 abbr, 60229 narrow; 60230 eraName = eraName.toUpperCase(); 60231 60232 for (i = 0, l = eras.length; i < l; ++i) { 60233 name = eras[i].name.toUpperCase(); 60234 abbr = eras[i].abbr.toUpperCase(); 60235 narrow = eras[i].narrow.toUpperCase(); 60236 60237 if (strict) { 60238 switch (format) { 60239 case 'N': 60240 case 'NN': 60241 case 'NNN': 60242 if (abbr === eraName) { 60243 return eras[i]; 60244 } 60245 break; 60246 60247 case 'NNNN': 60248 if (name === eraName) { 60249 return eras[i]; 60250 } 60251 break; 60252 60253 case 'NNNNN': 60254 if (narrow === eraName) { 60255 return eras[i]; 60256 } 60257 break; 60258 } 60259 } else if ([name, abbr, narrow].indexOf(eraName) >= 0) { 60260 return eras[i]; 60261 } 60262 } 60263 } 60264 60265 function localeErasConvertYear(era, year) { 60266 var dir = era.since <= era.until ? +1 : -1; 60267 if (year === undefined) { 60268 return hooks(era.since).year(); 60269 } else { 60270 return hooks(era.since).year() + (year - era.offset) * dir; 60271 } 60272 } 60273 60274 function getEraName() { 60275 var i, 60276 l, 60277 val, 60278 eras = this.localeData().eras(); 60279 for (i = 0, l = eras.length; i < l; ++i) { 60280 // truncate time 60281 val = this.clone().startOf('day').valueOf(); 60282 60283 if (eras[i].since <= val && val <= eras[i].until) { 60284 return eras[i].name; 60285 } 60286 if (eras[i].until <= val && val <= eras[i].since) { 60287 return eras[i].name; 60288 } 60289 } 60290 60291 return ''; 60292 } 60293 60294 function getEraNarrow() { 60295 var i, 60296 l, 60297 val, 60298 eras = this.localeData().eras(); 60299 for (i = 0, l = eras.length; i < l; ++i) { 60300 // truncate time 60301 val = this.clone().startOf('day').valueOf(); 60302 60303 if (eras[i].since <= val && val <= eras[i].until) { 60304 return eras[i].narrow; 60305 } 60306 if (eras[i].until <= val && val <= eras[i].since) { 60307 return eras[i].narrow; 60308 } 60309 } 60310 60311 return ''; 60312 } 60313 60314 function getEraAbbr() { 60315 var i, 60316 l, 60317 val, 60318 eras = this.localeData().eras(); 60319 for (i = 0, l = eras.length; i < l; ++i) { 60320 // truncate time 60321 val = this.clone().startOf('day').valueOf(); 60322 60323 if (eras[i].since <= val && val <= eras[i].until) { 60324 return eras[i].abbr; 60325 } 60326 if (eras[i].until <= val && val <= eras[i].since) { 60327 return eras[i].abbr; 60328 } 60329 } 60330 60331 return ''; 60332 } 60333 60334 function getEraYear() { 60335 var i, 60336 l, 60337 dir, 60338 val, 60339 eras = this.localeData().eras(); 60340 for (i = 0, l = eras.length; i < l; ++i) { 60341 dir = eras[i].since <= eras[i].until ? +1 : -1; 60342 60343 // truncate time 60344 val = this.clone().startOf('day').valueOf(); 60345 60346 if ( 60347 (eras[i].since <= val && val <= eras[i].until) || 60348 (eras[i].until <= val && val <= eras[i].since) 60349 ) { 60350 return ( 60351 (this.year() - hooks(eras[i].since).year()) * dir + 60352 eras[i].offset 60353 ); 60354 } 60355 } 60356 60357 return this.year(); 60358 } 60359 60360 function erasNameRegex(isStrict) { 60361 if (!hasOwnProp(this, '_erasNameRegex')) { 60362 computeErasParse.call(this); 60363 } 60364 return isStrict ? this._erasNameRegex : this._erasRegex; 60365 } 60366 60367 function erasAbbrRegex(isStrict) { 60368 if (!hasOwnProp(this, '_erasAbbrRegex')) { 60369 computeErasParse.call(this); 60370 } 60371 return isStrict ? this._erasAbbrRegex : this._erasRegex; 60372 } 60373 60374 function erasNarrowRegex(isStrict) { 60375 if (!hasOwnProp(this, '_erasNarrowRegex')) { 60376 computeErasParse.call(this); 60377 } 60378 return isStrict ? this._erasNarrowRegex : this._erasRegex; 60379 } 60380 60381 function matchEraAbbr(isStrict, locale) { 60382 return locale.erasAbbrRegex(isStrict); 60383 } 60384 60385 function matchEraName(isStrict, locale) { 60386 return locale.erasNameRegex(isStrict); 60387 } 60388 60389 function matchEraNarrow(isStrict, locale) { 60390 return locale.erasNarrowRegex(isStrict); 60391 } 60392 60393 function matchEraYearOrdinal(isStrict, locale) { 60394 return locale._eraYearOrdinalRegex || matchUnsigned; 60395 } 60396 60397 function computeErasParse() { 60398 var abbrPieces = [], 60399 namePieces = [], 60400 narrowPieces = [], 60401 mixedPieces = [], 60402 i, 60403 l, 60404 eras = this.eras(); 60405 60406 for (i = 0, l = eras.length; i < l; ++i) { 60407 namePieces.push(regexEscape(eras[i].name)); 60408 abbrPieces.push(regexEscape(eras[i].abbr)); 60409 narrowPieces.push(regexEscape(eras[i].narrow)); 60410 60411 mixedPieces.push(regexEscape(eras[i].name)); 60412 mixedPieces.push(regexEscape(eras[i].abbr)); 60413 mixedPieces.push(regexEscape(eras[i].narrow)); 60414 } 60415 60416 this._erasRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); 60417 this._erasNameRegex = new RegExp('^(' + namePieces.join('|') + ')', 'i'); 60418 this._erasAbbrRegex = new RegExp('^(' + abbrPieces.join('|') + ')', 'i'); 60419 this._erasNarrowRegex = new RegExp( 60420 '^(' + narrowPieces.join('|') + ')', 60421 'i' 60422 ); 60423 } 60424 60425 // FORMATTING 60426 60427 addFormatToken(0, ['gg', 2], 0, function () { 60428 return this.weekYear() % 100; 60429 });
vendor: 9,499 bytes, lines 60430-60793
60430 60431 addFormatToken(0, ['GG', 2], 0, function () { 60432 return this.isoWeekYear() % 100; 60433 }); 60434 60435 function addWeekYearFormatToken(token, getter) { 60436 addFormatToken(0, [token, token.length], 0, getter); 60437 } 60438 60439 addWeekYearFormatToken('gggg', 'weekYear'); 60440 addWeekYearFormatToken('ggggg', 'weekYear'); 60441 addWeekYearFormatToken('GGGG', 'isoWeekYear'); 60442 addWeekYearFormatToken('GGGGG', 'isoWeekYear'); 60443 60444 // ALIASES 60445 60446 addUnitAlias('weekYear', 'gg'); 60447 addUnitAlias('isoWeekYear', 'GG'); 60448 60449 // PRIORITY 60450 60451 addUnitPriority('weekYear', 1); 60452 addUnitPriority('isoWeekYear', 1); 60453 60454 // PARSING 60455 60456 addRegexToken('G', matchSigned); 60457 addRegexToken('g', matchSigned); 60458 addRegexToken('GG', match1to2, match2); 60459 addRegexToken('gg', match1to2, match2); 60460 addRegexToken('GGGG', match1to4, match4); 60461 addRegexToken('gggg', match1to4, match4); 60462 addRegexToken('GGGGG', match1to6, match6); 60463 addRegexToken('ggggg', match1to6, match6); 60464 60465 addWeekParseToken( 60466 ['gggg', 'ggggg', 'GGGG', 'GGGGG'], 60467 function (input, week, config, token) { 60468 week[token.substr(0, 2)] = toInt(input); 60469 } 60470 ); 60471 60472 addWeekParseToken(['gg', 'GG'], function (input, week, config, token) { 60473 week[token] = hooks.parseTwoDigitYear(input); 60474 }); 60475 60476 // MOMENTS 60477 60478 function getSetWeekYear(input) { 60479 return getSetWeekYearHelper.call( 60480 this, 60481 input, 60482 this.week(), 60483 this.weekday(), 60484 this.localeData()._week.dow, 60485 this.localeData()._week.doy 60486 ); 60487 } 60488 60489 function getSetISOWeekYear(input) { 60490 return getSetWeekYearHelper.call( 60491 this, 60492 input, 60493 this.isoWeek(), 60494 this.isoWeekday(), 60495 1, 60496 4 60497 ); 60498 } 60499 60500 function getISOWeeksInYear() { 60501 return weeksInYear(this.year(), 1, 4); 60502 } 60503 60504 function getISOWeeksInISOWeekYear() { 60505 return weeksInYear(this.isoWeekYear(), 1, 4); 60506 } 60507 60508 function getWeeksInYear() { 60509 var weekInfo = this.localeData()._week; 60510 return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy); 60511 } 60512 60513 function getWeeksInWeekYear() { 60514 var weekInfo = this.localeData()._week; 60515 return weeksInYear(this.weekYear(), weekInfo.dow, weekInfo.doy); 60516 } 60517 60518 function getSetWeekYearHelper(input, week, weekday, dow, doy) { 60519 var weeksTarget; 60520 if (input == null) { 60521 return weekOfYear(this, dow, doy).year; 60522 } else { 60523 weeksTarget = weeksInYear(input, dow, doy); 60524 if (week > weeksTarget) { 60525 week = weeksTarget; 60526 } 60527 return setWeekAll.call(this, input, week, weekday, dow, doy); 60528 } 60529 } 60530 60531 function setWeekAll(weekYear, week, weekday, dow, doy) { 60532 var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy), 60533 date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear); 60534 60535 this.year(date.getUTCFullYear()); 60536 this.month(date.getUTCMonth()); 60537 this.date(date.getUTCDate()); 60538 return this; 60539 } 60540 60541 // FORMATTING 60542 60543 addFormatToken('Q', 0, 'Qo', 'quarter'); 60544 60545 // ALIASES 60546 60547 addUnitAlias('quarter', 'Q'); 60548 60549 // PRIORITY 60550 60551 addUnitPriority('quarter', 7); 60552 60553 // PARSING 60554 60555 addRegexToken('Q', match1); 60556 addParseToken('Q', function (input, array) { 60557 array[MONTH] = (toInt(input) - 1) * 3; 60558 }); 60559 60560 // MOMENTS 60561 60562 function getSetQuarter(input) { 60563 return input == null 60564 ? Math.ceil((this.month() + 1) / 3) 60565 : this.month((input - 1) * 3 + (this.month() % 3)); 60566 } 60567 60568 // FORMATTING 60569 60570 addFormatToken('D', ['DD', 2], 'Do', 'date'); 60571 60572 // ALIASES 60573 60574 addUnitAlias('date', 'D'); 60575 60576 // PRIORITY 60577 addUnitPriority('date', 9); 60578 60579 // PARSING 60580 60581 addRegexToken('D', match1to2); 60582 addRegexToken('DD', match1to2, match2); 60583 addRegexToken('Do', function (isStrict, locale) { 60584 // TODO: Remove "ordinalParse" fallback in next major release. 60585 return isStrict 60586 ? locale._dayOfMonthOrdinalParse || locale._ordinalParse 60587 : locale._dayOfMonthOrdinalParseLenient; 60588 }); 60589 60590 addParseToken(['D', 'DD'], DATE); 60591 addParseToken('Do', function (input, array) { 60592 array[DATE] = toInt(input.match(match1to2)[0]); 60593 }); 60594 60595 // MOMENTS 60596 60597 var getSetDayOfMonth = makeGetSet('Date', true); 60598 60599 // FORMATTING 60600 60601 addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear'); 60602 60603 // ALIASES 60604 60605 addUnitAlias('dayOfYear', 'DDD'); 60606 60607 // PRIORITY 60608 addUnitPriority('dayOfYear', 4); 60609 60610 // PARSING 60611 60612 addRegexToken('DDD', match1to3); 60613 addRegexToken('DDDD', match3); 60614 addParseToken(['DDD', 'DDDD'], function (input, array, config) { 60615 config._dayOfYear = toInt(input); 60616 }); 60617 60618 // HELPERS 60619 60620 // MOMENTS 60621 60622 function getSetDayOfYear(input) { 60623 var dayOfYear = 60624 Math.round( 60625 (this.clone().startOf('day') - this.clone().startOf('year')) / 864e5 60626 ) + 1; 60627 return input == null ? dayOfYear : this.add(input - dayOfYear, 'd'); 60628 } 60629 60630 // FORMATTING 60631 60632 addFormatToken('m', ['mm', 2], 0, 'minute'); 60633 60634 // ALIASES 60635 60636 addUnitAlias('minute', 'm'); 60637 60638 // PRIORITY 60639 60640 addUnitPriority('minute', 14); 60641 60642 // PARSING 60643 60644 addRegexToken('m', match1to2); 60645 addRegexToken('mm', match1to2, match2); 60646 addParseToken(['m', 'mm'], MINUTE); 60647 60648 // MOMENTS 60649 60650 var getSetMinute = makeGetSet('Minutes', false); 60651 60652 // FORMATTING 60653 60654 addFormatToken('s', ['ss', 2], 0, 'second'); 60655 60656 // ALIASES 60657 60658 addUnitAlias('second', 's'); 60659 60660 // PRIORITY 60661 60662 addUnitPriority('second', 15); 60663 60664 // PARSING 60665 60666 addRegexToken('s', match1to2); 60667 addRegexToken('ss', match1to2, match2); 60668 addParseToken(['s', 'ss'], SECOND); 60669 60670 // MOMENTS 60671 60672 var getSetSecond = makeGetSet('Seconds', false); 60673 60674 // FORMATTING 60675 60676 addFormatToken('S', 0, 0, function () { 60677 return ~~(this.millisecond() / 100); 60678 }); 60679 60680 addFormatToken(0, ['SS', 2], 0, function () { 60681 return ~~(this.millisecond() / 10); 60682 }); 60683 60684 addFormatToken(0, ['SSS', 3], 0, 'millisecond'); 60685 addFormatToken(0, ['SSSS', 4], 0, function () { 60686 return this.millisecond() * 10; 60687 }); 60688 addFormatToken(0, ['SSSSS', 5], 0, function () { 60689 return this.millisecond() * 100; 60690 }); 60691 addFormatToken(0, ['SSSSSS', 6], 0, function () { 60692 return this.millisecond() * 1000; 60693 }); 60694 addFormatToken(0, ['SSSSSSS', 7], 0, function () { 60695 return this.millisecond() * 10000; 60696 }); 60697 addFormatToken(0, ['SSSSSSSS', 8], 0, function () { 60698 return this.millisecond() * 100000; 60699 }); 60700 addFormatToken(0, ['SSSSSSSSS', 9], 0, function () { 60701 return this.millisecond() * 1000000; 60702 }); 60703 60704 // ALIASES 60705 60706 addUnitAlias('millisecond', 'ms'); 60707 60708 // PRIORITY 60709 60710 addUnitPriority('millisecond', 16); 60711 60712 // PARSING 60713 60714 addRegexToken('S', match1to3, match1); 60715 addRegexToken('SS', match1to3, match2); 60716 addRegexToken('SSS', match1to3, match3); 60717 60718 var token, getSetMillisecond; 60719 for (token = 'SSSS'; token.length <= 9; token += 'S') { 60720 addRegexToken(token, matchUnsigned); 60721 } 60722 60723 function parseMs(input, array) { 60724 array[MILLISECOND] = toInt(('0.' + input) * 1000); 60725 } 60726 60727 for (token = 'S'; token.length <= 9; token += 'S') { 60728 addParseToken(token, parseMs); 60729 } 60730 60731 getSetMillisecond = makeGetSet('Milliseconds', false); 60732 60733 // FORMATTING 60734 60735 addFormatToken('z', 0, 0, 'zoneAbbr'); 60736 addFormatToken('zz', 0, 0, 'zoneName'); 60737 60738 // MOMENTS 60739 60740 function getZoneAbbr() { 60741 return this._isUTC ? 'UTC' : ''; 60742 } 60743 60744 function getZoneName() { 60745 return this._isUTC ? 'Coordinated Universal Time' : ''; 60746 } 60747 60748 var proto = Moment.prototype; 60749 60750 proto.add = add; 60751 proto.calendar = calendar$1; 60752 proto.clone = clone; 60753 proto.diff = diff; 60754 proto.endOf = endOf; 60755 proto.format = format; 60756 proto.from = from; 60757 proto.fromNow = fromNow; 60758 proto.to = to; 60759 proto.toNow = toNow; 60760 proto.get = stringGet; 60761 proto.invalidAt = invalidAt; 60762 proto.isAfter = isAfter; 60763 proto.isBefore = isBefore; 60764 proto.isBetween = isBetween; 60765 proto.isSame = isSame; 60766 proto.isSameOrAfter = isSameOrAfter; 60767 proto.isSameOrBefore = isSameOrBefore; 60768 proto.isValid = isValid$2; 60769 proto.lang = lang; 60770 proto.locale = locale; 60771 proto.localeData = localeData; 60772 proto.max = prototypeMax; 60773 proto.min = prototypeMin; 60774 proto.parsingFlags = parsingFlags; 60775 proto.set = stringSet; 60776 proto.startOf = startOf; 60777 proto.subtract = subtract; 60778 proto.toArray = toArray; 60779 proto.toObject = toObject; 60780 proto.toDate = toDate; 60781 proto.toISOString = toISOString; 60782 proto.inspect = inspect; 60783 if (typeof Symbol !== 'undefined' && Symbol.for != null) { 60784 proto[Symbol.for('nodejs.util.inspect.custom')] = function () { 60785 return 'Moment<' + this.format() + '>'; 60786 }; 60787 } 60788 proto.toJSON = toJSON; 60789 proto.toString = toString; 60790 proto.unix = unix; 60791 proto.valueOf = valueOf; 60792 proto.creationData = creationData; 60793 proto.eraName = getEraName;
60794 proto.eraNarrow = getEraNarrow; 60795 proto.eraAbbr = getEraAbbr; 60796 proto.eraYear = getEraYear; 60797 proto.year = getSetYear; 60798 proto.isLeapYear = getIsLeapYear; 60799 proto.weekYear = getSetWeekYear; 60800 proto.isoWeekYear = getSetISOWeekYear; 60801 proto.quarter = proto.quarters = getSetQuarter; 60802 proto.month = getSetMonth; 60803 proto.daysInMonth = getDaysInMonth; 60804 proto.week = proto.weeks = getSetWeek; 60805 proto.isoWeek = proto.isoWeeks = getSetISOWeek; 60806 proto.weeksInYear = getWeeksInYear; 60807 proto.weeksInWeekYear = getWeeksInWeekYear; 60808 proto.isoWeeksInYear = getISOWeeksInYear; 60809 proto.isoWeeksInISOWeekYear = getISOWeeksInISOWeekYear; 60810 proto.date = getSetDayOfMonth; 60811 proto.day = proto.days = getSetDayOfWeek; 60812 proto.weekday = getSetLocaleDayOfWeek; 60813 proto.isoWeekday = getSetISODayOfWeek; 60814 proto.dayOfYear = getSetDayOfYear; 60815 proto.hour = proto.hours = getSetHour; 60816 proto.minute = proto.minutes = getSetMinute; 60817 proto.second = proto.seconds = getSetSecond; 60818 proto.millisecond = proto.milliseconds = getSetMillisecond; 60819 proto.utcOffset = getSetOffset; 60820 proto.utc = setOffsetToUTC; 60821 proto.local = setOffsetToLocal; 60822 proto.parseZone = setOffsetToParsedOffset; 60823 proto.hasAlignedHourOffset = hasAlignedHourOffset; 60824 proto.isDST = isDaylightSavingTime; 60825 proto.isLocal = isLocal; 60826 proto.isUtcOffset = isUtcOffset; 60827 proto.isUtc = isUtc; 60828 proto.isUTC = isUtc; 60829 proto.zoneAbbr = getZoneAbbr; 60830 proto.zoneName = getZoneName; 60831 proto.dates = deprecate( 60832 'dates accessor is deprecated. Use date instead.', 60833 getSetDayOfMonth 60834 ); 60835 proto.months = deprecate( 60836 'months accessor is deprecated. Use month instead', 60837 getSetMonth 60838 ); 60839 proto.years = deprecate( 60840 'years accessor is deprecated. Use year instead', 60841 getSetYear 60842 ); 60843 proto.zone = deprecate( 60844 'moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/', 60845 getSetZone 60846 ); 60847 proto.isDSTShifted = deprecate( 60848 'isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information', 60849 isDaylightSavingTimeShifted 60850 ); 60851 60852 function createUnix(input) { 60853 return createLocal(input * 1000); 60854 } 60855 60856 function createInZone() { 60857 return createLocal.apply(null, arguments).parseZone(); 60858 } 60859 60860 function preParsePostFormat(string) { 60861 return string; 60862 } 60863 60864 var proto$1 = Locale.prototype; 60865 60866 proto$1.calendar = calendar; 60867 proto$1.longDateFormat = longDateFormat; 60868 proto$1.invalidDate = invalidDate; 60869 proto$1.ordinal = ordinal; 60870 proto$1.preparse = preParsePostFormat; 60871 proto$1.postformat = preParsePostFormat; 60872 proto$1.relativeTime = relativeTime; 60873 proto$1.pastFuture = pastFuture; 60874 proto$1.set = set; 60875 proto$1.eras = localeEras; 60876 proto$1.erasParse = localeErasParse; 60877 proto$1.erasConvertYear = localeErasConvertYear; 60878 proto$1.erasAbbrRegex = erasAbbrRegex; 60879 proto$1.erasNameRegex = erasNameRegex; 60880 proto$1.erasNarrowRegex = erasNarrowRegex; 60881 60882 proto$1.months = localeMonths; 60883 proto$1.monthsShort = localeMonthsShort; 60884 proto$1.monthsParse = localeMonthsParse; 60885 proto$1.monthsRegex = monthsRegex; 60886 proto$1.monthsShortRegex = monthsShortRegex; 60887 proto$1.week = localeWeek; 60888 proto$1.firstDayOfYear = localeFirstDayOfYear; 60889 proto$1.firstDayOfWeek = localeFirstDayOfWeek; 60890 60891 proto$1.weekdays = localeWeekdays; 60892 proto$1.weekdaysMin = localeWeekdaysMin; 60893 proto$1.weekdaysShort = localeWeekdaysShort; 60894 proto$1.weekdaysParse = localeWeekdaysParse; 60895 60896 proto$1.weekdaysRegex = weekdaysRegex; 60897 proto$1.weekdaysShortRegex = weekdaysShortRegex; 60898 proto$1.weekdaysMinRegex = weekdaysMinRegex; 60899 60900 proto$1.isPM = localeIsPM; 60901 proto$1.meridiem = localeMeridiem; 60902 60903 function get$1(format, index, field, setter) { 60904 var locale = getLocale(), 60905 utc = createUTC().set(setter, index);
vendor: 17,890 bytes, lines 60906-61482
60906 return locale[field](utc, format); 60907 } 60908 60909 function listMonthsImpl(format, index, field) { 60910 if (isNumber(format)) { 60911 index = format; 60912 format = undefined; 60913 } 60914 60915 format = format || ''; 60916 60917 if (index != null) { 60918 return get$1(format, index, field, 'month'); 60919 } 60920 60921 var i, 60922 out = []; 60923 for (i = 0; i < 12; i++) { 60924 out[i] = get$1(format, i, field, 'month'); 60925 } 60926 return out; 60927 } 60928 60929 // () 60930 // (5) 60931 // (fmt, 5) 60932 // (fmt) 60933 // (true) 60934 // (true, 5) 60935 // (true, fmt, 5) 60936 // (true, fmt) 60937 function listWeekdaysImpl(localeSorted, format, index, field) { 60938 if (typeof localeSorted === 'boolean') { 60939 if (isNumber(format)) { 60940 index = format; 60941 format = undefined; 60942 } 60943 60944 format = format || ''; 60945 } else { 60946 format = localeSorted; 60947 index = format; 60948 localeSorted = false; 60949 60950 if (isNumber(format)) { 60951 index = format; 60952 format = undefined; 60953 } 60954 60955 format = format || ''; 60956 } 60957 60958 var locale = getLocale(), 60959 shift = localeSorted ? locale._week.dow : 0, 60960 i, 60961 out = []; 60962 60963 if (index != null) { 60964 return get$1(format, (index + shift) % 7, field, 'day'); 60965 } 60966 60967 for (i = 0; i < 7; i++) { 60968 out[i] = get$1(format, (i + shift) % 7, field, 'day'); 60969 } 60970 return out; 60971 } 60972 60973 function listMonths(format, index) { 60974 return listMonthsImpl(format, index, 'months'); 60975 } 60976 60977 function listMonthsShort(format, index) { 60978 return listMonthsImpl(format, index, 'monthsShort'); 60979 } 60980 60981 function listWeekdays(localeSorted, format, index) { 60982 return listWeekdaysImpl(localeSorted, format, index, 'weekdays'); 60983 } 60984 60985 function listWeekdaysShort(localeSorted, format, index) { 60986 return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort'); 60987 } 60988 60989 function listWeekdaysMin(localeSorted, format, index) { 60990 return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin'); 60991 } 60992 60993 getSetGlobalLocale('en', { 60994 eras: [ 60995 { 60996 since: '0001-01-01', 60997 until: +Infinity, 60998 offset: 1, 60999 name: 'Anno Domini', 61000 narrow: 'AD', 61001 abbr: 'AD', 61002 }, 61003 { 61004 since: '0000-12-31', 61005 until: -Infinity, 61006 offset: 1, 61007 name: 'Before Christ', 61008 narrow: 'BC', 61009 abbr: 'BC', 61010 }, 61011 ], 61012 dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/, 61013 ordinal: function (number) { 61014 var b = number % 10, 61015 output = 61016 toInt((number % 100) / 10) === 1 61017 ? 'th' 61018 : b === 1 61019 ? 'st' 61020 : b === 2 61021 ? 'nd' 61022 : b === 3 61023 ? 'rd' 61024 : 'th'; 61025 return number + output; 61026 }, 61027 }); 61028 61029 // Side effect imports 61030 61031 hooks.lang = deprecate( 61032 'moment.lang is deprecated. Use moment.locale instead.', 61033 getSetGlobalLocale 61034 ); 61035 hooks.langData = deprecate( 61036 'moment.langData is deprecated. Use moment.localeData instead.', 61037 getLocale 61038 ); 61039 61040 var mathAbs = Math.abs; 61041 61042 function abs() { 61043 var data = this._data; 61044 61045 this._milliseconds = mathAbs(this._milliseconds); 61046 this._days = mathAbs(this._days); 61047 this._months = mathAbs(this._months); 61048 61049 data.milliseconds = mathAbs(data.milliseconds); 61050 data.seconds = mathAbs(data.seconds); 61051 data.minutes = mathAbs(data.minutes); 61052 data.hours = mathAbs(data.hours); 61053 data.months = mathAbs(data.months); 61054 data.years = mathAbs(data.years); 61055 61056 return this; 61057 } 61058 61059 function addSubtract$1(duration, input, value, direction) { 61060 var other = createDuration(input, value); 61061 61062 duration._milliseconds += direction * other._milliseconds; 61063 duration._days += direction * other._days; 61064 duration._months += direction * other._months; 61065 61066 return duration._bubble(); 61067 } 61068 61069 // supports only 2.0-style add(1, 's') or add(duration) 61070 function add$1(input, value) { 61071 return addSubtract$1(this, input, value, 1); 61072 } 61073 61074 // supports only 2.0-style subtract(1, 's') or subtract(duration) 61075 function subtract$1(input, value) { 61076 return addSubtract$1(this, input, value, -1); 61077 } 61078 61079 function absCeil(number) { 61080 if (number < 0) { 61081 return Math.floor(number); 61082 } else { 61083 return Math.ceil(number); 61084 } 61085 } 61086 61087 function bubble() { 61088 var milliseconds = this._milliseconds, 61089 days = this._days, 61090 months = this._months, 61091 data = this._data, 61092 seconds, 61093 minutes, 61094 hours, 61095 years, 61096 monthsFromDays; 61097 61098 // if we have a mix of positive and negative values, bubble down first 61099 // check: https://github.com/moment/moment/issues/2166 61100 if ( 61101 !( 61102 (milliseconds >= 0 && days >= 0 && months >= 0) || 61103 (milliseconds <= 0 && days <= 0 && months <= 0) 61104 ) 61105 ) { 61106 milliseconds += absCeil(monthsToDays(months) + days) * 864e5; 61107 days = 0; 61108 months = 0; 61109 } 61110 61111 // The following code bubbles up values, see the tests for 61112 // examples of what that means. 61113 data.milliseconds = milliseconds % 1000; 61114 61115 seconds = absFloor(milliseconds / 1000); 61116 data.seconds = seconds % 60; 61117 61118 minutes = absFloor(seconds / 60); 61119 data.minutes = minutes % 60; 61120 61121 hours = absFloor(minutes / 60); 61122 data.hours = hours % 24; 61123 61124 days += absFloor(hours / 24); 61125 61126 // convert days to months 61127 monthsFromDays = absFloor(daysToMonths(days)); 61128 months += monthsFromDays; 61129 days -= absCeil(monthsToDays(monthsFromDays)); 61130 61131 // 12 months -> 1 year 61132 years = absFloor(months / 12); 61133 months %= 12; 61134 61135 data.days = days; 61136 data.months = months; 61137 data.years = years; 61138 61139 return this; 61140 } 61141 61142 function daysToMonths(days) { 61143 // 400 years have 146097 days (taking into account leap year rules) 61144 // 400 years have 12 months === 4800 61145 return (days * 4800) / 146097; 61146 } 61147 61148 function monthsToDays(months) { 61149 // the reverse of daysToMonths 61150 return (months * 146097) / 4800; 61151 } 61152 61153 function as(units) { 61154 if (!this.isValid()) { 61155 return NaN; 61156 } 61157 var days, 61158 months, 61159 milliseconds = this._milliseconds; 61160 61161 units = normalizeUnits(units); 61162 61163 if (units === 'month' || units === 'quarter' || units === 'year') { 61164 days = this._days + milliseconds / 864e5; 61165 months = this._months + daysToMonths(days); 61166 switch (units) { 61167 case 'month': 61168 return months; 61169 case 'quarter': 61170 return months / 3; 61171 case 'year': 61172 return months / 12; 61173 } 61174 } else { 61175 // handle milliseconds separately because of floating point math errors (issue #1867) 61176 days = this._days + Math.round(monthsToDays(this._months)); 61177 switch (units) { 61178 case 'week': 61179 return days / 7 + milliseconds / 6048e5; 61180 case 'day': 61181 return days + milliseconds / 864e5; 61182 case 'hour': 61183 return days * 24 + milliseconds / 36e5; 61184 case 'minute': 61185 return days * 1440 + milliseconds / 6e4; 61186 case 'second': 61187 return days * 86400 + milliseconds / 1000; 61188 // Math.floor prevents floating point math errors here 61189 case 'millisecond': 61190 return Math.floor(days * 864e5) + milliseconds; 61191 default: 61192 throw new Error('Unknown unit ' + units); 61193 } 61194 } 61195 } 61196 61197 // TODO: Use this.as('ms')? 61198 function valueOf$1() { 61199 if (!this.isValid()) { 61200 return NaN; 61201 } 61202 return ( 61203 this._milliseconds + 61204 this._days * 864e5 + 61205 (this._months % 12) * 2592e6 + 61206 toInt(this._months / 12) * 31536e6 61207 ); 61208 } 61209 61210 function makeAs(alias) { 61211 return function () { 61212 return this.as(alias); 61213 }; 61214 } 61215 61216 var asMilliseconds = makeAs('ms'), 61217 asSeconds = makeAs('s'), 61218 asMinutes = makeAs('m'), 61219 asHours = makeAs('h'), 61220 asDays = makeAs('d'), 61221 asWeeks = makeAs('w'), 61222 asMonths = makeAs('M'), 61223 asQuarters = makeAs('Q'), 61224 asYears = makeAs('y'); 61225 61226 function clone$1() { 61227 return createDuration(this); 61228 } 61229 61230 function get$2(units) { 61231 units = normalizeUnits(units); 61232 return this.isValid() ? this[units + 's']() : NaN; 61233 } 61234 61235 function makeGetter(name) { 61236 return function () { 61237 return this.isValid() ? this._data[name] : NaN; 61238 }; 61239 } 61240 61241 var milliseconds = makeGetter('milliseconds'), 61242 seconds = makeGetter('seconds'), 61243 minutes = makeGetter('minutes'), 61244 hours = makeGetter('hours'), 61245 days = makeGetter('days'), 61246 months = makeGetter('months'), 61247 years = makeGetter('years'); 61248 61249 function weeks() { 61250 return absFloor(this.days() / 7); 61251 } 61252 61253 var round = Math.round, 61254 thresholds = { 61255 ss: 44, // a few seconds to seconds 61256 s: 45, // seconds to minute 61257 m: 45, // minutes to hour 61258 h: 22, // hours to day 61259 d: 26, // days to month/week 61260 w: null, // weeks to month 61261 M: 11, // months to year 61262 }; 61263 61264 // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize 61265 function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) { 61266 return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture); 61267 } 61268 61269 function relativeTime$1(posNegDuration, withoutSuffix, thresholds, locale) { 61270 var duration = createDuration(posNegDuration).abs(), 61271 seconds = round(duration.as('s')), 61272 minutes = round(duration.as('m')), 61273 hours = round(duration.as('h')), 61274 days = round(duration.as('d')), 61275 months = round(duration.as('M')), 61276 weeks = round(duration.as('w')), 61277 years = round(duration.as('y')), 61278 a = 61279 (seconds <= thresholds.ss && ['s', seconds]) || 61280 (seconds < thresholds.s && ['ss', seconds]) || 61281 (minutes <= 1 && ['m']) || 61282 (minutes < thresholds.m && ['mm', minutes]) || 61283 (hours <= 1 && ['h']) || 61284 (hours < thresholds.h && ['hh', hours]) || 61285 (days <= 1 && ['d']) || 61286 (days < thresholds.d && ['dd', days]); 61287 61288 if (thresholds.w != null) { 61289 a = 61290 a || 61291 (weeks <= 1 && ['w']) || 61292 (weeks < thresholds.w && ['ww', weeks]); 61293 } 61294 a = a || 61295 (months <= 1 && ['M']) || 61296 (months < thresholds.M && ['MM', months]) || 61297 (years <= 1 && ['y']) || ['yy', years]; 61298 61299 a[2] = withoutSuffix; 61300 a[3] = +posNegDuration > 0; 61301 a[4] = locale; 61302 return substituteTimeAgo.apply(null, a); 61303 } 61304 61305 // This function allows you to set the rounding function for relative time strings 61306 function getSetRelativeTimeRounding(roundingFunction) { 61307 if (roundingFunction === undefined) { 61308 return round; 61309 } 61310 if (typeof roundingFunction === 'function') { 61311 round = roundingFunction; 61312 return true; 61313 } 61314 return false; 61315 } 61316 61317 // This function allows you to set a threshold for relative time strings 61318 function getSetRelativeTimeThreshold(threshold, limit) { 61319 if (thresholds[threshold] === undefined) { 61320 return false; 61321 } 61322 if (limit === undefined) { 61323 return thresholds[threshold]; 61324 } 61325 thresholds[threshold] = limit; 61326 if (threshold === 's') { 61327 thresholds.ss = limit - 1; 61328 } 61329 return true; 61330 } 61331 61332 function humanize(argWithSuffix, argThresholds) { 61333 if (!this.isValid()) { 61334 return this.localeData().invalidDate(); 61335 } 61336 61337 var withSuffix = false, 61338 th = thresholds, 61339 locale, 61340 output; 61341 61342 if (typeof argWithSuffix === 'object') { 61343 argThresholds = argWithSuffix; 61344 argWithSuffix = false; 61345 } 61346 if (typeof argWithSuffix === 'boolean') { 61347 withSuffix = argWithSuffix; 61348 } 61349 if (typeof argThresholds === 'object') { 61350 th = Object.assign({}, thresholds, argThresholds); 61351 if (argThresholds.s != null && argThresholds.ss == null) { 61352 th.ss = argThresholds.s - 1; 61353 } 61354 } 61355 61356 locale = this.localeData(); 61357 output = relativeTime$1(this, !withSuffix, th, locale); 61358 61359 if (withSuffix) { 61360 output = locale.pastFuture(+this, output); 61361 } 61362 61363 return locale.postformat(output); 61364 } 61365 61366 var abs$1 = Math.abs; 61367 61368 function sign(x) { 61369 return (x > 0) - (x < 0) || +x; 61370 } 61371 61372 function toISOString$1() { 61373 // for ISO strings we do not use the normal bubbling rules: 61374 // * milliseconds bubble up until they become hours 61375 // * days do not bubble at all 61376 // * months bubble up until they become years 61377 // This is because there is no context-free conversion between hours and days 61378 // (think of clock changes) 61379 // and also not between days and months (28-31 days per month) 61380 if (!this.isValid()) { 61381 return this.localeData().invalidDate(); 61382 } 61383 61384 var seconds = abs$1(this._milliseconds) / 1000, 61385 days = abs$1(this._days), 61386 months = abs$1(this._months), 61387 minutes, 61388 hours, 61389 years, 61390 s, 61391 total = this.asSeconds(), 61392 totalSign, 61393 ymSign, 61394 daysSign, 61395 hmsSign; 61396 61397 if (!total) { 61398 // this is the same as C#'s (Noda) and python (isodate)... 61399 // but not other JS (goog.date) 61400 return 'P0D'; 61401 } 61402 61403 // 3600 seconds -> 60 minutes -> 1 hour 61404 minutes = absFloor(seconds / 60); 61405 hours = absFloor(minutes / 60); 61406 seconds %= 60; 61407 minutes %= 60; 61408 61409 // 12 months -> 1 year 61410 years = absFloor(months / 12); 61411 months %= 12; 61412 61413 // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js 61414 s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, '') : ''; 61415 61416 totalSign = total < 0 ? '-' : ''; 61417 ymSign = sign(this._months) !== sign(total) ? '-' : ''; 61418 daysSign = sign(this._days) !== sign(total) ? '-' : ''; 61419 hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : ''; 61420 61421 return ( 61422 totalSign + 61423 'P' + 61424 (years ? ymSign + years + 'Y' : '') + 61425 (months ? ymSign + months + 'M' : '') + 61426 (days ? daysSign + days + 'D' : '') + 61427 (hours || minutes || seconds ? 'T' : '') + 61428 (hours ? hmsSign + hours + 'H' : '') + 61429 (minutes ? hmsSign + minutes + 'M' : '') + 61430 (seconds ? hmsSign + s + 'S' : '') 61431 ); 61432 } 61433 61434 var proto$2 = Duration.prototype; 61435 61436 proto$2.isValid = isValid$1; 61437 proto$2.abs = abs; 61438 proto$2.add = add$1; 61439 proto$2.subtract = subtract$1; 61440 proto$2.as = as; 61441 proto$2.asMilliseconds = asMilliseconds; 61442 proto$2.asSeconds = asSeconds; 61443 proto$2.asMinutes = asMinutes; 61444 proto$2.asHours = asHours; 61445 proto$2.asDays = asDays; 61446 proto$2.asWeeks = asWeeks; 61447 proto$2.asMonths = asMonths; 61448 proto$2.asQuarters = asQuarters; 61449 proto$2.asYears = asYears; 61450 proto$2.valueOf = valueOf$1; 61451 proto$2._bubble = bubble; 61452 proto$2.clone = clone$1; 61453 proto$2.get = get$2; 61454 proto$2.milliseconds = milliseconds; 61455 proto$2.seconds = seconds; 61456 proto$2.minutes = minutes; 61457 proto$2.hours = hours; 61458 proto$2.days = days; 61459 proto$2.weeks = weeks; 61460 proto$2.months = months; 61461 proto$2.years = years; 61462 proto$2.humanize = humanize; 61463 proto$2.toISOString = toISOString$1; 61464 proto$2.toString = toISOString$1; 61465 proto$2.toJSON = toISOString$1; 61466 proto$2.locale = locale; 61467 proto$2.localeData = localeData; 61468 61469 proto$2.toIsoString = deprecate( 61470 'toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', 61471 toISOString$1 61472 ); 61473 proto$2.lang = lang; 61474 61475 // FORMATTING 61476 61477 addFormatToken('X', 0, 0, 'unix'); 61478 addFormatToken('x', 0, 0, 'valueOf'); 61479 61480 // PARSING 61481 61482 addRegexToken('x', matchSigned);
61483 addRegexToken('X', matchTimestamp); 61484 addParseToken('X', function (input, array, config) { 61485 config._d = new Date(parseFloat(input) * 1000); 61486 }); 61487 addParseToken('x', function (input, array, config) { 61488 config._d = new Date(toInt(input)); 61489 }); 61490 61491 //! moment.js 61492 61493 hooks.version = '2.29.4'; 61494 61495 setHookCallback(createLocal); 61496 61497 hooks.fn = proto; 61498 hooks.min = min; 61499 hooks.max = max; 61500 hooks.now = now; 61501 hooks.utc = createUTC; 61502 hooks.unix = createUnix; 61503 hooks.months = listMonths; 61504 hooks.isDate = isDate; 61505 hooks.locale = getSetGlobalLocale; 61506 hooks.invalid = createInvalid; 61507 hooks.duration = createDuration; 61508 hooks.isMoment = isMoment; 61509 hooks.weekdays = listWeekdays; 61510 hooks.parseZone = createInZone; 61511 hooks.localeData = getLocale; 61512 hooks.isDuration = isDuration; 61513 hooks.monthsShort = listMonthsShort; 61514 hooks.weekdaysMin = listWeekdaysMin; 61515 hooks.defineLocale = defineLocale; 61516 hooks.updateLocale = updateLocale; 61517 hooks.locales = listLocales; 61518 hooks.weekdaysShort = listWeekdaysShort; 61519 hooks.normalizeUnits = normalizeUnits; 61520 hooks.relativeTimeRounding = getSetRelativeTimeRounding; 61521 hooks.relativeTimeThreshold = getSetRelativeTimeThreshold; 61522 hooks.calendarFormat = getCalendarFormat; 61523 hooks.prototype = proto; 61524 61525 // currently HTML5 input type only supports 24-hour formats 61526 hooks.HTML5_FMT = { 61527 DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm', // <input type="datetime-local" /> 61528 DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss', // <input type="datetime-local" step="1" /> 61529 DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS', // <input type="datetime-local" step="0.001" /> 61530 DATE: 'YYYY-MM-DD', // <input type="date" /> 61531 TIME: 'HH:mm', // <input type="time" /> 61532 TIME_SECONDS: 'HH:mm:ss', // <input type="time" step="1" /> 61533 TIME_MS: 'HH:mm:ss.SSS', // <input type="time" step="0.001" /> 61534 WEEK: 'GGGG-[W]WW', // <input type="week" /> 61535 MONTH: 'YYYY-MM', // <input type="month" /> 61536 }; 61537 61538 return hooks; 61539 61540})));; 61541/*! 61542 * JavaScript Cookie v2.1.4 61543 * https://github.com/js-cookie/js-cookie 61544 * 61545 * Copyright 2006, 2015 Klaus Hartl & Fagner Brack 61546 * Released under the MIT license 61547 */ 61548; (function (factory) { 61549 var registeredInModuleLoader = false; 61550 if (typeof define === 'function' && define.amd) { 61551 define(factory); 61552 registeredInModuleLoader = true; 61553 } 61554 if (typeof exports === 'object') { 61555 module.exports = factory(); 61556 registeredInModuleLoader = true; 61557 } 61558 if (!registeredInModuleLoader) { 61559 var OldCookies = window.Cookies; 61560 var api = window.Cookies = factory(); 61561 api.noConflict = function () { 61562 window.Cookies = OldCookies; 61563 return api; 61564 }; 61565 } 61566}(function () { 61567 function extend() { 61568 var i = 0; 61569 var result = {}; 61570 for (; i < arguments.length; i++) { 61571 var attributes = arguments[i]; 61572 for (var key in attributes) { 61573 result[key] = attributes[key]; 61574 } 61575 } 61576 return result; 61577 } 61578 61579 function init(converter) { 61580 function api(key, value, attributes) { 61581 var result; 61582 if (typeof document === 'undefined') { 61583 return; 61584 } 61585 61586 // Write 61587 61588 if (arguments.length > 1) { 61589 attributes = extend({ 61590 path: '/' 61591 }, api.defaults, attributes); 61592 61593 if (typeof attributes.expires === 'number') { 61594 var expires = new Date(); 61595 expires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5); 61596 attributes.expires = expires; 61597 } 61598 61599 // We're using "expires" because "max-age" is not supported by IE 61600 attributes.expires = attributes.expires ? attributes.expires.toUTCString() : ''; 61601 61602 try { 61603 result = JSON.stringify(value); 61604 if (/^[\{\[]/.test(result)) { 61605 value = result; 61606 } 61607 } catch (e) { } 61608 61609 if (!converter.write) { 61610 value = encodeURIComponent(String(value)) 61611 .replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent); 61612 } else { 61613 value = converter.write(value, key); 61614 } 61615 61616 key = encodeURIComponent(String(key)); 61617 key = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent); 61618 key = key.replace(/[\(\)]/g, escape); 61619 61620 var stringifiedAttributes = ''; 61621 61622 for (var attributeName in attributes) { 61623 if (!attributes[attributeName]) { 61624 continue; 61625 }
61626 stringifiedAttributes += '; ' + attributeName; 61627 if (attributes[attributeName] === true) { 61628 continue; 61629 } 61630 stringifiedAttributes += '=' + attributes[attributeName]; 61631 } 61632 return (document.cookie = key + '=' + value + stringifiedAttributes); 61633 } 61634 61635 // Read 61636 61637 if (!key) { 61638 result = {}; 61639 } 61640 61641 // To prevent the for loop in the first place assign an empty array 61642 // in case there are no cookies at all. Also prevents odd result when 61643 // calling "get()" 61644 var cookies = document.cookie ? document.cookie.split('; ') : []; 61645 var rdecode = /(%[0-9A-Z]{2})+/g; 61646 var i = 0; 61647 61648 for (; i < cookies.length; i++) { 61649 var parts = cookies[i].split('='); 61650 var cookie = parts.slice(1).join('='); 61651 61652 if (cookie.charAt(0) === '"') { 61653 cookie = cookie.slice(1, -1); 61654 } 61655 61656 try { 61657 var name = parts[0].replace(rdecode, decodeURIComponent); 61658 cookie = converter.read ? 61659 converter.read(cookie, name) : converter(cookie, name) || 61660 cookie.replace(rdecode, decodeURIComponent); 61661 61662 if (this.json) { 61663 try { 61664 cookie = JSON.parse(cookie); 61665 } catch (e) { } 61666 } 61667 61668 if (key === name) { 61669 result = cookie; 61670 break; 61671 } 61672 61673 if (!key) { 61674 result[name] = cookie; 61675 } 61676 } catch (e) { } 61677 } 61678 61679 return result; 61680 } 61681 61682 api.set = api; 61683 api.get = function (key) { 61684 return api.call(api, key); 61685 }; 61686 api.getJSON = function () { 61687 return api.apply({
61688 json: true 61689 }, [].slice.call(arguments)); 61690 }; 61691 api.defaults = {}; 61692 61693 api.remove = function (key, attributes) { 61694 api(key, '', extend(attributes, { 61695 expires: -1 61696 })); 61697 }; 61698 61699 api.withConverter = init; 61700 61701 return api; 61702 } 61703 61704 return init(function () { }); 61705}));; 61706// jQuery HC-Sticky 61707// ============= 61708// Version: 1.2.43 61709// Copyright: Some Web Media 61710// Author: Some Web Guy 61711// Author URL: http://twitter.com/some_web_guy 61712// Website: http://someweblog.com/ 61713// Plugin URL: https://github.com/somewebmedia/hc-sticky 61714// License: Released under the MIT License www.opensource.org/licenses/mit-license.php 61715// Description: Cross-browser jQuery plugin that makes any element attached to the page and always visible while you scroll. 61716 61717(function($, window, undefined) { 61718 "use strict"; 61719 61720 // console.log shortcut 61721 var log = function(t){console.log(t)}; 61722 61723 var $window = $(window), 61724 document = window.document, 61725 $document = $(document); 61726 61727 // detect IE version 61728 var ie = (function(){var undef, v = 3, div = document.createElement('div'), all = div.getElementsByTagName('i'); while (div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->', all[0]){}; return v > 4 ? v : undef})(); 61729 61730 /*---------------------------------------------------- 61731 Global functions 61732 ----------------------------------------------------*/ 61733 61734 // check for scroll direction and speed 61735 var getScroll = function() { 61736 var pageXOffset = window.pageXOffset !== undefined ? window.pageXOffset : (document.compatMode == "CSS1Compat" ? window.document.documentElement.scrollLeft : window.document.body.scrollLeft), 61737 pageYOffset = window.pageYOffset !== undefined ? window.pageYOffset : (document.compatMode == "CSS1Compat" ? window.document.documentElement.scrollTop : window.document.body.scrollTop); 61738 61739 if (typeof getScroll.x == 'undefined') { 61740 getScroll.x = pageXOffset; 61741 getScroll.y = pageYOffset; 61742 } 61743 if (typeof getScroll.distanceX == 'undefined') { 61744 getScroll.distanceX = pageXOffset; 61745 getScroll.distanceY = pageYOffset; 61746 } else { 61747 getScroll.distanceX = pageXOffset - getScroll.x; 61748 getScroll.distanceY = pageYOffset - getScroll.y; 61749 } 61750 61751 var diffX = getScroll.x - pageXOffset, 61752 diffY = getScroll.y - pageYOffset; 61753 61754 getScroll.direction = diffX < 0 ? 'right' : 61755 diffX > 0 ? 'left' : 61756 diffY <= 0 ? 'down' : 61757 diffY > 0 ? 'up' : 'first'; 61758 61759 getScroll.x = pageXOffset; 61760 getScroll.y = pageYOffset; 61761 }; 61762 $window.on('scroll', getScroll); 61763 61764 61765 // little original style plugin 61766 $.fn.style = function(style) { 61767 if (!style) return null; 61768 61769 var $this = $(this), 61770 value; 61771 61772 // clone element 61773 var $clone = $this.clone().css('display','none'); 61774 // randomize the name of cloned radio buttons, otherwise selections get screwed 61775 $clone.find('input:radio').attr('name','copy-' + Math.floor((Math.random()*100)+1)); 61776 // insert clone to DOM 61777 $this.after($clone); 61778 61779 var getStyle = function(el, style){ 61780 var val; 61781 if (el.currentStyle) { 61782 // replace dashes with capitalized letter, e.g. padding-left to paddingLeft 61783 val = el.currentStyle[style.replace(/-\w/g, function(s){return s.toUpperCase().replace('-','')})]; 61784 } else if (window.getComputedStyle) { 61785 val = document.defaultView.getComputedStyle(el,null).getPropertyValue(style); 61786 } 61787 // check for margin:auto 61788 val = (/margin/g.test(style)) ? ((parseInt(val) === $this[0].offsetLeft) ? val : 'auto') : val; 61789 return val; 61790 }; 61791 61792 if (typeof style == 'string') { 61793 value = getStyle($clone[0], style); 61794 } else { 61795 value = {}; 61796 $.each(style, function(i, s){ 61797 value[s] = getStyle($clone[0], s); 61798 }); 61799 } 61800 61801 // destroy clone 61802 $clone.remove(); 61803 61804 return value || null; 61805 }; 61806 61807 61808 /*---------------------------------------------------- 61809 jQuery plugin 61810 ----------------------------------------------------*/ 61811 61812 $.fn.extend({ 61813 61814 hcSticky: function(options) { 61815 61816 // check if selected element exist in DOM, user doesn't have to worry about that 61817 if (this.length == 0) return this; 61818 61819 this.pluginOptions('hcSticky', { 61820 top: 0, 61821 bottom: 0, 61822 bottomEnd: 0, 61823 innerTop: 0, 61824 innerSticker: null, 61825 className: 'sticky', 61826 wrapperClassName: 'wrapper-sticky', 61827 stickTo: null, 61828 responsive: true, 61829 followScroll: true, 61830 offResolutions: null, 61831 onStart: $.noop, 61832 onStop: $.noop, 61833 on: true, 61834 fn: null // used only by the plugin 61835 }, options || {}, { 61836 reinit: function(){ 61837 // just call itself again 61838 $(this).hcSticky(); 61839 }, 61840 stop: function(){ 61841 $(this).pluginOptions('hcSticky', {on: false}).each(function(){ 61842 var $this = $(this), 61843 options = $this.pluginOptions('hcSticky'), 61844 $wrapper = $this.parent('.' + options.wrapperClassName); 61845 61846 // set current position 61847 var top = $this.offset().top - $wrapper.offset().top; 61848 $this.css({ 61849 position: 'absolute', 61850 top: top, 61851 bottom: 'auto', 61852 left: 'auto', 61853 right: 'auto' 61854 }).removeClass(options.className); 61855 });
61856 }, 61857 off: function(){ 61858 $(this).pluginOptions('hcSticky', {on: false}).each(function(){ 61859 var $this = $(this), 61860 options = $this.pluginOptions('hcSticky'), 61861 $wrapper = $this.parent('.' + options.wrapperClassName); 61862 61863 // clear position 61864 $this.css({ 61865 position: 'relative', 61866 top: 'auto', 61867 bottom: 'auto', 61868 left: 'auto', 61869 right: 'auto' 61870 }).removeClass(options.className); 61871 61872 $wrapper.css('height', 'auto'); 61873 }); 61874 }, 61875 on: function(){ 61876 $(this).each(function(){ 61877 $(this).pluginOptions('hcSticky', { 61878 on: true, 61879 remember: { 61880 offsetTop: $window.scrollTop() 61881 } 61882 }).hcSticky(); 61883 }); 61884 }, 61885 destroy: function(){ 61886 var $this = $(this), 61887 options = $this.pluginOptions('hcSticky'), 61888 $wrapper = $this.parent('.' + options.wrapperClassName); 61889 61890 // reset position to original 61891 $this.removeData('hcStickyInit').css({ 61892 position: $wrapper.css('position'), 61893 top: $wrapper.css('top'), 61894 bottom: $wrapper.css('bottom'), 61895 left: $wrapper.css('left'), 61896 right: $wrapper.css('right') 61897 }).removeClass(options.className); 61898 61899 // remove events 61900 $window.off('resize', options.fn.resize).off('scroll', options.fn.scroll); 61901 61902 // destroy wrapper 61903 $this.unwrap(); 61904 } 61905 }); 61906 61907 // on/off settings 61908 if (options && typeof options.on != 'undefined') { 61909 if (options.on) { 61910 this.hcSticky('on'); 61911 } else { 61912 this.hcSticky('off'); 61913 } 61914 } 61915 61916 // stop on commands 61917 if (typeof options == 'string') return this; 61918 61919 // do our thing 61920 return this.each(function(){ 61921 61922 var $this = $(this), 61923 options = $this.pluginOptions('hcSticky'); 61924 61925 var $wrapper = (function(){ // wrapper exists 61926 var $this_wrapper = $this.parent('.' + options.wrapperClassName); 61927 if ($this_wrapper.length > 0) { 61928 $this_wrapper.css({ 61929 'height': $this.outerHeight(true), 61930 'width': (function(){ 61931 // check if wrapper already has width in % 61932 var width = $this_wrapper.style('width'); 61933 if (width.indexOf('%') >= 0 || width == 'auto') { 61934 if ($this.css('box-sizing') == 'border-box' || $this.css('-moz-box-sizing') == 'border-box') { 61935 $this.css('width', $this_wrapper.width()); 61936 } else { 61937 $this.css('width', $this_wrapper.width() - parseInt($this.css('padding-left') - parseInt($this.css('padding-right')))); 61938 } 61939 return width; 61940 } else { 61941 return $this.outerWidth(true); 61942 } 61943 })() 61944 }); 61945 return $this_wrapper; 61946 } else { 61947 return false; 61948 } 61949 })() || (function(){ // wrapper doesn't exist 61950 61951 var this_css = $this.style(['width', 'margin-left', 'left', 'right', 'top', 'bottom', 'float', 'display']); 61952 var display = $this.css('display'); 61953 61954 var $this_wrapper = $('<div>', { 61955 'class': options.wrapperClassName 61956 }).css({ 61957 'display': display, 61958 'height': $this.outerHeight(true), 61959 'width': (function(){ 61960 if (this_css['width'].indexOf('%') >= 0 || (this_css['width'] == 'auto' && display != 'inline-block' && display != 'inline')) { // check if element has width in % 61961 $this.css('width', parseFloat($this.css('width'))); 61962 return this_css['width']; 61963 } else if (this_css['width'] == 'auto' && (display == 'inline-block' || display == 'inline')) { 61964 return $this.width(); 61965 } else { 61966 // check if margin is set to 'auto' 61967 return (this_css['margin-left'] == 'auto') ? $this.outerWidth() : $this.outerWidth(true); 61968 } 61969 })(), 61970 'margin': (this_css['margin-left']) ? 'auto' : null, 61971 'position': (function(){ 61972 var position = $this.css('position'); 61973 return position == 'static' ? 'relative' : position; 61974 })(), 61975 'float': this_css['float'] || null, 61976 'left': this_css['left'], 61977 'right': this_css['right'], 61978 'top': this_css['top'], 61979 'bottom': this_css['bottom'], 61980 'vertical-align': 'top' 61981 });
61982 61983 $this.wrap($this_wrapper); 61984 61985 // ie7 inline-block fix 61986 if (ie === 7) { 61987 if ($('head').find('style#hcsticky-iefix').length === 0) { 61988 $('<style id="hcsticky-iefix">.' + options.wrapperClassName + ' {zoom: 1;}</style>').appendTo('head'); 61989 } 61990 } 61991 61992 // return appended element 61993 return $this.parent(); 61994 })(); 61995 61996 61997 // check if we should go further 61998 if ($this.data('hcStickyInit')) return; 61999 // leave our mark 62000 $this.data('hcStickyInit', true); 62001 62002 62003 // check if referring element is document 62004 var stickTo_document = options.stickTo && (options.stickTo == 'document' || (options.stickTo.nodeType && options.stickTo.nodeType == 9) || (typeof options.stickTo == 'object' && options.stickTo instanceof (typeof HTMLDocument != 'undefined' ? HTMLDocument : Document))) ? true : false; 62005 62006 // select container ;) 62007 var $container = options.stickTo 62008 ? stickTo_document 62009 ? $document 62010 : typeof options.stickTo == 'string' 62011 ? $(options.stickTo) 62012 : options.stickTo 62013 : $wrapper.parent(); 62014 62015 // clear sticky styles 62016 $this.css({ 62017 top: 'auto', 62018 bottom: 'auto', 62019 left: 'auto', 62020 right: 'auto' 62021 }); 62022 62023 // attach event on entire page load, maybe some images inside element has been loading, so chek height again 62024 $window.load(function(){ 62025 if ($this.outerHeight(true) > $container.height()) { 62026 $wrapper.css('height', $this.outerHeight(true)); 62027 $this.hcSticky('reinit'); 62028 } 62029 }); 62030 62031 // functions for attachiung and detaching sticky 62032 var _setFixed = function(args) { 62033 // check if already floating 62034 if ($this.hasClass(options.className)) return; 62035 62036 // apply styles 62037 args = args || {}; 62038 $this.css({ 62039 position: 'fixed', 62040 top: args.top || 0, 62041 left: args.left || $wrapper.offset().left 62042 }).addClass(options.className); 62043 62044 // start event 62045 options.onStart.apply($this[0]); 62046 // add class to wrpaeer 62047 $wrapper.addClass('sticky-active'); 62048 }, 62049 _reset = function(args) { 62050 args = args || {}; 62051 args.position = args.position || 'absolute'; 62052 args.top = args.top || 0; 62053 args.left = args.left || 0; 62054 62055 // check if we should apply css 62056 if ($this.css('position') != 'fixed' && parseInt($this.css('top')) == args.top) return; 62057 62058 // apply styles 62059 $this.css({ 62060 position: args.position, 62061 top: args.top, 62062 left: args.left 62063 }).removeClass(options.className); 62064 62065 // stop event 62066 options.onStop.apply($this[0]); 62067 // remove class from wrpaeer 62068 $wrapper.removeClass('sticky-active'); 62069 }; 62070 62071 // sticky scroll function 62072 var onScroll = function(init) { 62073 62074 // check if we need to run sticky 62075 if (!options.on || !$this.is(':visible')) return; 62076 62077 // if the element is the same height or larger than the container then let's reset it so that it returns to the original position 62078 if ($this.outerHeight(true) >= $container.height()) { 62079 _reset(); 62080 62081 return; 62082 } 62083 62084 var top_spacing = (options.innerSticker) ? $(options.innerSticker).position().top : ((options.innerTop) ? options.innerTop : 0), 62085 wrapper_inner_top = $wrapper.offset().top, 62086 bottom_limit = $container.height() - options.bottomEnd + (stickTo_document ? 0 : wrapper_inner_top), 62087 top_limit = $wrapper.offset().top - options.top + top_spacing, 62088 this_height = $this.outerHeight(true) + options.bottom, 62089 window_height = $window.height(), 62090 offset_top = $window.scrollTop(), 62091 this_document_top = $this.offset().top, 62092 this_window_top = this_document_top - offset_top, 62093 bottom_distance; 62094 62095 62096 // if sticky has been restarted with on/off wait for it to reach top or bottom 62097 if (typeof options.remember != 'undefined' && options.remember) { 62098 62099 var position_top = this_document_top - options.top - top_spacing; 62100 62101 if (this_height - top_spacing > window_height && options.followScroll) { // element bigger than window with follow scroll on 62102 62103 if (position_top < offset_top && offset_top + window_height <= position_top + $this.height()) { 62104 // element is in the middle of the screen, let our primary calculations do the work 62105 options.remember = false; 62106 } 62107 62108 } else { // element smaller than window or follow scroll turned off 62109 62110 if (options.remember.offsetTop > position_top) { 62111 // slide up 62112 if (offset_top <= position_top) { 62113 _setFixed({ 62114 top: options.top - top_spacing 62115 });
62116 options.remember = false; 62117 } 62118 } else { 62119 // slide down 62120 if (offset_top >= position_top) { 62121 _setFixed({ 62122 top: options.top - top_spacing 62123 }); 62124 options.remember = false; 62125 } 62126 } 62127 62128 } 62129 62130 return; 62131 } 62132 62133 62134 if (offset_top > top_limit) { 62135 62136 // http://geek-and-poke.com/geekandpoke/2012/7/27/simply-explained.html 62137 62138 if (bottom_limit + options.bottom - (options.followScroll && window_height < this_height ? 0 : options.top) <= offset_top + this_height - top_spacing - ((this_height - top_spacing > window_height - (top_limit - top_spacing) && options.followScroll) ? (((bottom_distance = this_height - window_height - top_spacing) > 0) ? bottom_distance : 0) : 0)) { 62139 // bottom reached end 62140 _reset({ 62141 top: bottom_limit - this_height + options.bottom - wrapper_inner_top 62142 }); 62143 } else if (this_height - top_spacing > window_height && options.followScroll) { 62144 62145 if (this_window_top + this_height <= window_height) { // element bigger than window with follow scroll on 62146 62147 if (getScroll.direction == 'down') { 62148 // scroll down 62149 _setFixed({ 62150 top: window_height - this_height 62151 }); 62152 } else { 62153 // scroll up 62154 if (this_window_top < 0 && $this.css('position') == 'fixed') { 62155 _reset({ 62156 top: this_document_top - (top_limit + options.top - top_spacing) - getScroll.distanceY 62157 }); 62158 } 62159 } 62160 62161 } else { // element smaller than window or follow scroll turned off 62162 62163 if (getScroll.direction == 'up' && this_document_top >= offset_top + options.top - top_spacing) { 62164 // scroll up 62165 _setFixed({ 62166 top: options.top - top_spacing 62167 }); 62168 } else if (getScroll.direction == 'down' && this_document_top + this_height > window_height && $this.css('position') == 'fixed') { 62169 // scroll down 62170 _reset({ 62171 top: this_document_top - (top_limit + options.top - top_spacing) - getScroll.distanceY 62172 }); 62173 } 62174 62175 } 62176 } else { 62177 // starting (top) fixed position 62178 _setFixed({ 62179 top: options.top - top_spacing 62180 }); 62181 } 62182 } else { 62183 // reset 62184 _reset(); 62185 } 62186 62187 }; 62188 62189 62190 // store resize data in case responsive is on 62191 var resize_timeout = false, 62192 $resize_clone = false; 62193 62194 var onResize = function() { 62195 62196 // check if sticky is attached to scroll event 62197 attachScroll(); 62198 62199 // check for off resolutions 62200 checkResolutions(); 62201 62202 // check if we need to run sticky 62203 if (!options.on) return; 62204 62205 var setLeft = function(){ 62206 // set new left position 62207 if ($this.css('position') == 'fixed') { 62208 $this.css('left', $wrapper.offset().left); 62209 } else { 62210 $this.css('left', 0); 62211 } 62212 }; 62213 62214 // check for width change (css media queries) 62215 if (options.responsive) { 62216 // clone element and make it invisible 62217 if (!$resize_clone) { 62218 $resize_clone = $this.clone().attr('style', '').css({ 62219 visibility: 'hidden', 62220 height: 0, 62221 overflow: 'hidden', 62222 paddingTop: 0, 62223 paddingBottom: 0, 62224 marginTop: 0, 62225 marginBottom: 0 62226 }); 62227 $wrapper.after($resize_clone); 62228 } 62229 62230 var wrapper_width = $wrapper.style('width'); 62231 var resize_clone_width = $resize_clone.style('width'); 62232 62233 if (resize_clone_width == 'auto' && wrapper_width != 'auto') { 62234 resize_clone_width = parseInt($this.css('width')); 62235 } 62236 62237 // recalculate wrpaeer width 62238 if (resize_clone_width != wrapper_width) { 62239 $wrapper.width(resize_clone_width); 62240 } 62241 62242 // clear previous timeout 62243 if (resize_timeout) { 62244 clearTimeout(resize_timeout); 62245 } 62246 // timedout destroing of cloned elements so we don't clone it again and again while resizing the window 62247 resize_timeout = setTimeout(function() { 62248 // clear timeout id 62249 resize_timeout = false; 62250 // destroy cloned element 62251 $resize_clone.remove(); 62252 $resize_clone = false; 62253 }, 250); 62254 } 62255 62256 // set new left position
62257 setLeft(); 62258 62259 // recalculate inner element width (maybe original width was in %) 62260 if ($this.outerWidth(true) != $wrapper.width()) { 62261 var this_w = ($this.css('box-sizing') == 'border-box' || $this.css('-moz-box-sizing') == 'border-box') 62262 ? $wrapper.width() 62263 : $wrapper.width() - parseInt($this.css('padding-left')) - parseInt($this.css('padding-right')); 62264 // subtract margins 62265 this_w = this_w - parseInt($this.css('margin-left')) - parseInt($this.css('margin-right')); 62266 // set new width 62267 $this.css('width', this_w); 62268 } 62269 }; 62270 62271 62272 // remember scroll and resize callbacks so we can attach and detach them 62273 $this.pluginOptions('hcSticky', {fn: { 62274 scroll: onScroll, 62275 resize: onResize 62276 }}); 62277 62278 62279 // check for off resolutions 62280 var checkResolutions = function(){ 62281 if (options.offResolutions) { 62282 // convert to array 62283 if (!$.isArray(options.offResolutions)) { 62284 options.offResolutions = [options.offResolutions]; 62285 } 62286 62287 var isOn = true; 62288 62289 $.each(options.offResolutions, function(i, rez){ 62290 if (rez < 0) { 62291 // below 62292 if ($window.width() < rez * -1) { 62293 isOn = false; 62294 $this.hcSticky('off'); 62295 } 62296 } else { 62297 // abowe 62298 if ($window.width() > rez) { 62299 isOn = false; 62300 $this.hcSticky('off'); 62301 } 62302 } 62303 }); 62304 62305 // turn on again 62306 if (isOn && !options.on) { 62307 $this.hcSticky('on'); 62308 } 62309 } 62310 }; 62311 checkResolutions(); 62312 62313 62314 // attach resize function to event 62315 $window.on('resize', onResize); 62316 62317 62318 // attaching scroll function to event 62319 var attachScroll = function(){ 62320 var isAttached = false; 62321 if ($._data(window, 'events').scroll != undefined) { 62322 $.each($._data(window, 'events').scroll, function(i, f){ 62323 if (f.handler == options.fn.scroll) { 62324 isAttached = true; 62325 } 62326 }); 62327 } 62328 if (!isAttached) { 62329 // run it once to disable glitching 62330 options.fn.scroll(true); 62331 // attach function to scroll event only once 62332 $window.on('scroll', options.fn.scroll); 62333 } 62334 }; 62335 attachScroll(); 62336 62337 }); 62338 } 62339 }); 62340 62341})(jQuery, this); 62342 62343 62344 62345// jQuery HC-PluginOptions 62346// ============= 62347// Version: 1.0 62348// Copyright: Some Web Media 62349// Author: Some Web Guy 62350// Author URL: http://twitter.com/some_web_guy 62351// Website: http://someweblog.com/ 62352// License: Released under the MIT License www.opensource.org/licenses/mit-license.php 62353 62354(function($, undefined) { 62355 "use strict"; 62356 62357 $.fn.extend({ 62358 62359 pluginOptions: function(pluginName, defaultOptions, userOptions, commands) { 62360 62361 // create object to store data 62362 if (!this.data(pluginName)) this.data(pluginName, {}); 62363 62364 // return options 62365 if (pluginName && typeof defaultOptions == 'undefined') return this.data(pluginName).options; 62366 62367 // update 62368 userOptions = userOptions || (defaultOptions || {}); 62369 62370 if (typeof userOptions == 'object' || userOptions === undefined) { 62371 62372 // options 62373 return this.each(function(){ 62374 var $this = $(this); 62375 62376 if (!$this.data(pluginName).options) { 62377 // init our options and attach to element 62378 $this.data(pluginName, {options: $.extend(defaultOptions, userOptions || {})}); 62379 // attach commands if any 62380 if (commands) { 62381 $this.data(pluginName).commands = commands; 62382 } 62383 } else { 62384 // update existing options 62385 $this.data(pluginName, $.extend($this.data(pluginName), {options: $.extend($this.data(pluginName).options, userOptions || {})})); 62386 } 62387 }); 62388 62389 } else if (typeof userOptions == 'string') { 62390 62391 return this.each(function(){ 62392 $(this).data(pluginName).commands[userOptions].call(this); 62393 }); 62394 62395 } else { 62396 62397 return this; 62398 62399 } 62400 62401 } 62402 62403 }); 62404 62405})(jQuery); 62406; 62407/*! nouislider - 10.0.0 - 2017-05-28 14:52:48 */ 62408 62409(function (factory) { 62410 62411 if ( typeof define === 'function' && define.amd ) { 62412 62413 // AMD. Register as an anonymous module. 62414 define([], factory); 62415 62416 } else if ( typeof exports === 'object' ) { 62417 62418 // Node/CommonJS 62419 module.exports = factory(); 62420 62421 } else { 62422 62423 // Browser globals 62424 window.noUiSlider = factory(); 62425 } 62426 62427}(function( ){ 62428 62429 'use strict'; 62430 62431 var VERSION = '10.0.0'; 62432 62433 62434 function isValidFormatter ( entry ) { 62435 return typeof entry === 'object' && typeof entry.to === 'function' && typeof entry.from === 'function'; 62436 } 62437 62438 function removeElement ( el ) { 62439 el.parentElement.removeChild(el); 62440 } 62441 62442 // Bindable version 62443 function preventDefault ( e ) { 62444 e.preventDefault(); 62445 } 62446 62447 // Removes duplicates from an array. 62448 function unique ( array ) { 62449 return array.filter(function(a){ 62450 return !this[a] ? this[a] = true : false; 62451 }, {}); 62452 } 62453 62454 // Round a value to the closest 'to'. 62455 function closest ( value, to ) { 62456 return Math.round(value / to) * to; 62457 } 62458 62459 // Current position of an element relative to the document. 62460 function offset ( elem, orientation ) { 62461 62462 var rect = elem.getBoundingClientRect(); 62463 var doc = elem.ownerDocument; 62464 var docElem = doc.documentElement; 62465 var pageOffset = getPageOffset(doc); 62466 62467 // getBoundingClientRect contains left scroll in Chrome on Android. 62468 // I haven't found a feature detection that proves this. Worst case 62469 // scenario on mis-match: the 'tap' feature on horizontal sliders breaks. 62470 if ( /webkit.*Chrome.*Mobile/i.test(navigator.userAgent) ) { 62471 pageOffset.x = 0; 62472 } 62473 62474 return orientation ? (rect.top + pageOffset.y - docElem.clientTop) : (rect.left + pageOffset.x - docElem.clientLeft); 62475 } 62476 62477 // Checks whether a value is numerical. 62478 function isNumeric ( a ) { 62479 return typeof a === 'number' && !isNaN( a ) && isFinite( a ); 62480 } 62481 62482 // Sets a class and removes it after [duration] ms.
62483 function addClassFor ( element, className, duration ) { 62484 if (duration > 0) { 62485 addClass(element, className); 62486 setTimeout(function(){ 62487 removeClass(element, className); 62488 }, duration); 62489 } 62490 } 62491 62492 // Limits a value to 0 - 100 62493 function limit ( a ) { 62494 return Math.max(Math.min(a, 100), 0); 62495 } 62496 62497 // Wraps a variable as an array, if it isn't one yet. 62498 // Note that an input array is returned by reference! 62499 function asArray ( a ) { 62500 return Array.isArray(a) ? a : [a]; 62501 } 62502 62503 // Counts decimals 62504 function countDecimals ( numStr ) { 62505 numStr = String(numStr); 62506 var pieces = numStr.split("."); 62507 return pieces.length > 1 ? pieces[1].length : 0; 62508 } 62509 62510 // http://youmightnotneedjquery.com/#add_class 62511 function addClass ( el, className ) { 62512 if ( el.classList ) { 62513 el.classList.add(className); 62514 } else { 62515 el.className += ' ' + className; 62516 } 62517 } 62518 62519 // http://youmightnotneedjquery.com/#remove_class 62520 function removeClass ( el, className ) { 62521 if ( el.classList ) { 62522 el.classList.remove(className); 62523 } else { 62524 el.className = el.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' '); 62525 } 62526 } 62527 62528 // https://plainjs.com/javascript/attributes/adding-removing-and-testing-for-classes-9/ 62529 function hasClass ( el, className ) { 62530 return el.classList ? el.classList.contains(className) : new RegExp('\\b' + className + '\\b').test(el.className); 62531 } 62532 62533 // https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollY#Notes 62534 function getPageOffset ( doc ) { 62535 62536 var supportPageOffset = window.pageXOffset !== undefined; 62537 var isCSS1Compat = ((doc.compatMode || "") === "CSS1Compat"); 62538 var x = supportPageOffset ? window.pageXOffset : isCSS1Compat ? doc.documentElement.scrollLeft : doc.body.scrollLeft; 62539 var y = supportPageOffset ? window.pageYOffset : isCSS1Compat ? doc.documentElement.scrollTop : doc.body.scrollTop; 62540 62541 return { 62542 x: x, 62543 y: y 62544 }; 62545 } 62546 62547 // we provide a function to compute constants instead 62548 // of accessing window.* as soon as the module needs it 62549 // so that we do not compute anything if not needed 62550 function getActions ( ) { 62551 62552 // Determine the events to bind. IE11 implements pointerEvents without 62553 // a prefix, which breaks compatibility with the IE10 implementation. 62554 return window.navigator.pointerEnabled ? { 62555 start: 'pointerdown', 62556 move: 'pointermove', 62557 end: 'pointerup' 62558 } : window.navigator.msPointerEnabled ? { 62559 start: 'MSPointerDown', 62560 move: 'MSPointerMove', 62561 end: 'MSPointerUp' 62562 } : { 62563 start: 'mousedown touchstart', 62564 move: 'mousemove touchmove', 62565 end: 'mouseup touchend' 62566 }; 62567 } 62568 62569 // https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md 62570 // Issue #785 62571 function getSupportsPassive ( ) { 62572 62573 var supportsPassive = false; 62574 62575 try { 62576 62577 var opts = Object.defineProperty({}, 'passive', { 62578 get: function() { 62579 supportsPassive = true; 62580 } 62581 }); 62582 62583 window.addEventListener('test', null, opts); 62584 62585 } catch (e) {} 62586 62587 return supportsPassive; 62588 } 62589 62590 function getSupportsTouchActionNone ( ) { 62591 return window.CSS && CSS.supports && CSS.supports('touch-action', 'none'); 62592 } 62593 62594 62595// Value calculation 62596 62597 // Determine the size of a sub-range in relation to a full range. 62598 function subRangeRatio ( pa, pb ) { 62599 return (100 / (pb - pa)); 62600 } 62601 62602 // (percentage) How many percent is this value of this range? 62603 function fromPercentage ( range, value ) { 62604 return (value * 100) / ( range[1] - range[0] ); 62605 } 62606 62607 // (percentage) Where is this value on this range? 62608 function toPercentage ( range, value ) { 62609 return fromPercentage( range, range[0] < 0 ? 62610 value + Math.abs(range[0]) : 62611 value - range[0] ); 62612 } 62613 62614 // (value) How much is this percentage on this range? 62615 function isPercentage ( range, value ) { 62616 return ((value * ( range[1] - range[0] )) / 100) + range[0]; 62617 } 62618 62619 62620// Range conversion 62621 62622 function getJ ( value, arr ) { 62623 62624 var j = 1; 62625 62626 while ( value >= arr[j] ){ 62627 j += 1; 62628 } 62629 62630 return j; 62631 } 62632 62633 // (percentage) Input a value, find where, on a scale of 0-100, it applies. 62634 function toStepping ( xVal, xPct, value ) { 62635 62636 if ( value >= xVal.slice(-1)[0] ){ 62637 return 100; 62638 } 62639 62640 var j = getJ( value, xVal ), va, vb, pa, pb; 62641 62642 va = xVal[j-1]; 62643 vb = xVal[j]; 62644 pa = xPct[j-1]; 62645 pb = xPct[j]; 62646 62647 return pa + (toPercentage([va, vb], value) / subRangeRatio (pa, pb)); 62648 } 62649 62650 // (value) Input a percentage, find where it is on the specified range. 62651 function fromStepping ( xVal, xPct, value ) { 62652 62653 // There is no range group that fits 100 62654 if ( value >= 100 ){ 62655 return xVal.slice(-1)[0]; 62656 } 62657 62658 var j = getJ( value, xPct ), va, vb, pa, pb; 62659 62660 va = xVal[j-1]; 62661 vb = xVal[j]; 62662 pa = xPct[j-1]; 62663 pb = xPct[j]; 62664 62665 return isPercentage([va, vb], (value - pa) * subRangeRatio (pa, pb)); 62666 } 62667 62668 // (percentage) Get the step that applies at a certain value. 62669 function getStep ( xPct, xSteps, snap, value ) { 62670 62671 if ( value === 100 ) { 62672 return value; 62673 } 62674 62675 var j = getJ( value, xPct ), a, b; 62676 62677 // If 'snap' is set, steps are used as fixed points on the slider. 62678 if ( snap ) { 62679 62680 a = xPct[j-1]; 62681 b = xPct[j]; 62682 62683 // Find the closest position, a or b. 62684 if ((value - a) > ((b-a)/2)){ 62685 return b; 62686 } 62687 62688 return a; 62689 } 62690 62691 if ( !xSteps[j-1] ){ 62692 return value; 62693 } 62694 62695 return xPct[j-1] + closest( 62696 value - xPct[j-1], 62697 xSteps[j-1] 62698 ); 62699 } 62700 62701 62702// Entry parsing 62703 62704 function handleEntryPoint ( index, value, that ) { 62705 62706 var percentage; 62707 62708 // Wrap numerical input in an array. 62709 if ( typeof value === "number" ) { 62710 value = [value]; 62711 } 62712
62713 // Reject any invalid input, by testing whether value is an array. 62714 if ( Object.prototype.toString.call( value ) !== '[object Array]' ){ 62715 throw new Error("noUiSlider (" + VERSION + "): 'range' contains invalid value."); 62716 } 62717 62718 // Covert min/max syntax to 0 and 100. 62719 if ( index === 'min' ) { 62720 percentage = 0; 62721 } else if ( index === 'max' ) { 62722 percentage = 100; 62723 } else { 62724 percentage = parseFloat( index ); 62725 } 62726 62727 // Check for correct input. 62728 if ( !isNumeric( percentage ) || !isNumeric( value[0] ) ) { 62729 throw new Error("noUiSlider (" + VERSION + "): 'range' value isn't numeric."); 62730 } 62731 62732 // Store values. 62733 that.xPct.push( percentage ); 62734 that.xVal.push( value[0] ); 62735 62736 // NaN will evaluate to false too, but to keep 62737 // logging clear, set step explicitly. Make sure 62738 // not to override the 'step' setting with false. 62739 if ( !percentage ) { 62740 if ( !isNaN( value[1] ) ) { 62741 that.xSteps[0] = value[1]; 62742 } 62743 } else { 62744 that.xSteps.push( isNaN(value[1]) ? false : value[1] ); 62745 } 62746 62747 that.xHighestCompleteStep.push(0); 62748 } 62749 62750 function handleStepPoint ( i, n, that ) { 62751 62752 // Ignore 'false' stepping. 62753 if ( !n ) { 62754 return true; 62755 } 62756 62757 // Factor to range ratio 62758 that.xSteps[i] = fromPercentage([ 62759 that.xVal[i] 62760 ,that.xVal[i+1] 62761 ], n) / subRangeRatio ( 62762 that.xPct[i], 62763 that.xPct[i+1] ); 62764 62765 var totalSteps = (that.xVal[i+1] - that.xVal[i]) / that.xNumSteps[i]; 62766 var highestStep = Math.ceil(Number(totalSteps.toFixed(3)) - 1); 62767 var step = that.xVal[i] + (that.xNumSteps[i] * highestStep); 62768 62769 that.xHighestCompleteStep[i] = step; 62770 } 62771 62772 62773// Interface 62774 62775 function Spectrum ( entry, snap, singleStep ) { 62776 62777 this.xPct = []; 62778 this.xVal = []; 62779 this.xSteps = [ singleStep || false ]; 62780 this.xNumSteps = [ false ]; 62781 this.xHighestCompleteStep = []; 62782 62783 this.snap = snap; 62784 62785 var index, ordered = [ /* [0, 'min'], [1, '50%'], [2, 'max'] */ ]; 62786 62787 // Map the object keys to an array. 62788 for ( index in entry ) { 62789 if ( entry.hasOwnProperty(index) ) { 62790 ordered.push([entry[index], index]); 62791 } 62792 } 62793 62794 // Sort all entries by value (numeric sort). 62795 if ( ordered.length && typeof ordered[0][0] === "object" ) { 62796 ordered.sort(function(a, b) { return a[0][0] - b[0][0]; }); 62797 } else { 62798 ordered.sort(function(a, b) { return a[0] - b[0]; }); 62799 } 62800 62801 62802 // Convert all entries to subranges. 62803 for ( index = 0; index < ordered.length; index++ ) { 62804 handleEntryPoint(ordered[index][1], ordered[index][0], this); 62805 } 62806 62807 // Store the actual step values. 62808 // xSteps is sorted in the same order as xPct and xVal. 62809 this.xNumSteps = this.xSteps.slice(0); 62810 62811 // Convert all numeric steps to the percentage of the subrange they represent. 62812 for ( index = 0; index < this.xNumSteps.length; index++ ) { 62813 handleStepPoint(index, this.xNumSteps[index], this); 62814 } 62815 } 62816 62817 Spectrum.prototype.getMargin = function ( value ) { 62818 62819 var step = this.xNumSteps[0]; 62820 62821 if ( step && ((value / step) % 1) !== 0 ) { 62822 throw new Error("noUiSlider (" + VERSION + "): 'limit', 'margin' and 'padding' must be divisible by step."); 62823 } 62824 62825 return this.xPct.length === 2 ? fromPercentage(this.xVal, value) : false; 62826 }; 62827 62828 Spectrum.prototype.toStepping = function ( value ) { 62829 62830 value = toStepping( this.xVal, this.xPct, value ); 62831 62832 return value; 62833 }; 62834 62835 Spectrum.prototype.fromStepping = function ( value ) { 62836 62837 return fromStepping( this.xVal, this.xPct, value ); 62838 }; 62839 62840 Spectrum.prototype.getStep = function ( value ) { 62841 62842 value = getStep(this.xPct, this.xSteps, this.snap, value ); 62843 62844 return value; 62845 }; 62846 62847 Spectrum.prototype.getNearbySteps = function ( value ) { 62848 62849 var j = getJ(value, this.xPct); 62850 62851 return { 62852 stepBefore: { startValue: this.xVal[j-2], step: this.xNumSteps[j-2], highestStep: this.xHighestCompleteStep[j-2] }, 62853 thisStep: { startValue: this.xVal[j-1], step: this.xNumSteps[j-1], highestStep: this.xHighestCompleteStep[j-1] }, 62854 stepAfter: { startValue: this.xVal[j-0], step: this.xNumSteps[j-0], highestStep: this.xHighestCompleteStep[j-0] } 62855 }; 62856 }; 62857 62858 Spectrum.prototype.countStepDecimals = function () { 62859 var stepDecimals = this.xNumSteps.map(countDecimals); 62860 return Math.max.apply(null, stepDecimals); 62861 }; 62862 62863 // Outside testing 62864 Spectrum.prototype.convert = function ( value ) {
62865 return this.getStep(this.toStepping(value)); 62866 }; 62867 62868/* Every input option is tested and parsed. This'll prevent 62869 endless validation in internal methods. These tests are 62870 structured with an item for every option available. An 62871 option can be marked as required by setting the 'r' flag. 62872 The testing function is provided with three arguments: 62873 - The provided value for the option; 62874 - A reference to the options object; 62875 - The name for the option; 62876 62877 The testing function returns false when an error is detected, 62878 or true when everything is OK. It can also modify the option 62879 object, to make sure all values can be correctly looped elsewhere. */ 62880 62881 var defaultFormatter = { 'to': function( value ){ 62882 return value !== undefined && value.toFixed(2); 62883 }, 'from': Number }; 62884 62885 function validateFormat ( entry ) { 62886 62887 // Any object with a to and from method is supported. 62888 if ( isValidFormatter(entry) ) { 62889 return true; 62890 } 62891 62892 throw new Error("noUiSlider (" + VERSION + "): 'format' requires 'to' and 'from' methods."); 62893 } 62894 62895 function testStep ( parsed, entry ) { 62896 62897 if ( !isNumeric( entry ) ) { 62898 throw new Error("noUiSlider (" + VERSION + "): 'step' is not numeric."); 62899 } 62900 62901 // The step option can still be used to set stepping 62902 // for linear sliders. Overwritten if set in 'range'. 62903 parsed.singleStep = entry; 62904 } 62905 62906 function testRange ( parsed, entry ) { 62907 62908 // Filter incorrect input. 62909 if ( typeof entry !== 'object' || Array.isArray(entry) ) { 62910 throw new Error("noUiSlider (" + VERSION + "): 'range' is not an object."); 62911 } 62912 62913 // Catch missing start or end. 62914 if ( entry.min === undefined || entry.max === undefined ) { 62915 throw new Error("noUiSlider (" + VERSION + "): Missing 'min' or 'max' in 'range'."); 62916 } 62917 62918 // Catch equal start or end. 62919 if ( entry.min === entry.max ) { 62920 throw new Error("noUiSlider (" + VERSION + "): 'range' 'min' and 'max' cannot be equal."); 62921 } 62922 62923 parsed.spectrum = new Spectrum(entry, parsed.snap, parsed.singleStep); 62924 } 62925 62926 function testStart ( parsed, entry ) { 62927 62928 entry = asArray(entry); 62929 62930 // Validate input. Values aren't tested, as the public .val method 62931 // will always provide a valid location. 62932 if ( !Array.isArray( entry ) || !entry.length ) { 62933 throw new Error("noUiSlider (" + VERSION + "): 'start' option is incorrect."); 62934 } 62935 62936 // Store the number of handles. 62937 parsed.handles = entry.length; 62938 62939 // When the slider is initialized, the .val method will 62940 // be called with the start options. 62941 parsed.start = entry; 62942 } 62943 62944 function testSnap ( parsed, entry ) { 62945 62946 // Enforce 100% stepping within subranges. 62947 parsed.snap = entry; 62948 62949 if ( typeof entry !== 'boolean' ){ 62950 throw new Error("noUiSlider (" + VERSION + "): 'snap' option must be a boolean."); 62951 } 62952 } 62953 62954 function testAnimate ( parsed, entry ) { 62955 62956 // Enforce 100% stepping within subranges. 62957 parsed.animate = entry; 62958 62959 if ( typeof entry !== 'boolean' ){ 62960 throw new Error("noUiSlider (" + VERSION + "): 'animate' option must be a boolean."); 62961 } 62962 } 62963 62964 function testAnimationDuration ( parsed, entry ) { 62965 62966 parsed.animationDuration = entry; 62967 62968 if ( typeof entry !== 'number' ){ 62969 throw new Error("noUiSlider (" + VERSION + "): 'animationDuration' option must be a number."); 62970 } 62971 } 62972 62973 function testConnect ( parsed, entry ) { 62974 62975 var connect = [false]; 62976 var i; 62977 62978 // Map legacy options 62979 if ( entry === 'lower' ) { 62980 entry = [true, false]; 62981 } 62982 62983 else if ( entry === 'upper' ) { 62984 entry = [false, true]; 62985 } 62986 62987 // Handle boolean options 62988 if ( entry === true || entry === false ) { 62989 62990 for ( i = 1; i < parsed.handles; i++ ) { 62991 connect.push(entry); 62992 } 62993 62994 connect.push(false); 62995 } 62996 62997 // Reject invalid input 62998 else if ( !Array.isArray( entry ) || !entry.length || entry.length !== parsed.handles + 1 ) { 62999 throw new Error("noUiSlider (" + VERSION + "): 'connect' option doesn't match handle count."); 63000 } 63001 63002 else { 63003 connect = entry; 63004 } 63005 63006 parsed.connect = connect; 63007 } 63008 63009 function testOrientation ( parsed, entry ) { 63010 63011 // Set orientation to an a numerical value for easy 63012 // array selection. 63013 switch ( entry ){ 63014 case 'horizontal': 63015 parsed.ort = 0; 63016 break; 63017 case 'vertical': 63018 parsed.ort = 1; 63019 break; 63020 default: 63021 throw new Error("noUiSlider (" + VERSION + "): 'orientation' option is invali
63021d."); 63022 } 63023 } 63024 63025 function testMargin ( parsed, entry ) { 63026 63027 if ( !isNumeric(entry) ){ 63028 throw new Error("noUiSlider (" + VERSION + "): 'margin' option must be numeric."); 63029 } 63030 63031 // Issue #582 63032 if ( entry === 0 ) { 63033 return; 63034 } 63035 63036 parsed.margin = parsed.spectrum.getMargin(entry); 63037 63038 if ( !parsed.margin ) { 63039 throw new Error("noUiSlider (" + VERSION + "): 'margin' option is only supported on linear sliders."); 63040 } 63041 } 63042 63043 function testLimit ( parsed, entry ) { 63044 63045 if ( !isNumeric(entry) ){ 63046 throw new Error("noUiSlider (" + VERSION + "): 'limit' option must be numeric."); 63047 } 63048 63049 parsed.limit = parsed.spectrum.getMargin(entry); 63050 63051 if ( !parsed.limit || parsed.handles < 2 ) { 63052 throw new Error("noUiSlider (" + VERSION + "): 'limit' option is only supported on linear sliders with 2 or more handles."); 63053 } 63054 } 63055 63056 function testPadding ( parsed, entry ) { 63057 63058 if ( !isNumeric(entry) ){ 63059 throw new Error("noUiSlider (" + VERSION + "): 'padding' option must be numeric."); 63060 } 63061 63062 if ( entry === 0 ) { 63063 return; 63064 } 63065 63066 parsed.padding = parsed.spectrum.getMargin(entry); 63067 63068 if ( !parsed.padding ) { 63069 throw new Error("noUiSlider (" + VERSION + "): 'padding' option is only supported on linear sliders."); 63070 } 63071 63072 if ( parsed.padding < 0 ) { 63073 throw new Error("noUiSlider (" + VERSION + "): 'padding' option must be a positive number."); 63074 } 63075 63076 if ( parsed.padding >= 50 ) { 63077 throw new Error("noUiSlider (" + VERSION + "): 'padding' option must be less than half the range."); 63078 } 63079 } 63080 63081 function testDirection ( parsed, entry ) { 63082 63083 // Set direction as a numerical value for easy parsing. 63084 // Invert connection for RTL sliders, so that the proper 63085 // handles get the connect/background classes. 63086 switch ( entry ) { 63087 case 'ltr': 63088 parsed.dir = 0; 63089 break; 63090 case 'rtl': 63091 parsed.dir = 1; 63092 break; 63093 default: 63094 throw new Error("noUiSlider (" + VERSION + "): 'direction' option was not recognized."); 63095 } 63096 } 63097 63098 function testBehaviour ( parsed, entry ) { 63099 63100 // Make sure the input is a string. 63101 if ( typeof entry !== 'string' ) { 63102 throw new Error("noUiSlider (" + VERSION + "): 'behaviour' must be a string containing options."); 63103 } 63104 63105 // Check if the string contains any keywords. 63106 // None are required. 63107 var tap = entry.indexOf('tap') >= 0; 63108 var drag = entry.indexOf('drag') >= 0; 63109 var fixed = entry.indexOf('fixed') >= 0; 63110 var snap = entry.indexOf('snap') >= 0; 63111 var hover = entry.indexOf('hover') >= 0; 63112 63113 if ( fixed ) { 63114 63115 if ( parsed.handles !== 2 ) { 63116 throw new Error("noUiSlider (" + VERSION + "): 'fixed' behaviour must be used with 2 handles"); 63117 } 63118 63119 // Use margin to enforce fixed state 63120 testMargin(parsed, parsed.start[1] - parsed.start[0]); 63121 } 63122 63123 parsed.events = { 63124 tap: tap || snap, 63125 drag: drag, 63126 fixed: fixed, 63127 snap: snap, 63128 hover: hover 63129 }; 63130 } 63131 63132 function testTooltips ( parsed, entry ) { 63133 63134 if ( entry === false ) { 63135 return; 63136 } 63137 63138 else if ( entry === true ) { 63139 63140 parsed.tooltips = []; 63141 63142 for ( var i = 0; i < parsed.handles; i++ ) { 63143 parsed.tooltips.push(true); 63144 } 63145 } 63146 63147 else { 63148 63149 parsed.tooltips = asArray(entry); 63150 63151 if ( parsed.tooltips.length !== parsed.handles ) { 63152 throw new Error("noUiSlider (" + VERSION + "): must pass a formatter for all handles."); 63153 } 63154 63155 parsed.tooltips.forEach(function(formatter){ 63156 if ( typeof formatter !== 'boolean' && (typeof formatter !== 'object' || typeof formatter.to !== 'function') ) { 63157 throw new Error("noUiSlider (" + VERSION + "): 'tooltips' must be passed a formatter or 'false'."); 63158 } 63159 }); 63160 } 63161 } 63162 63163 function testAriaFormat ( parsed, entry ) { 63164 parsed.ariaFormat = entry; 63165 validateFormat(entry); 63166 } 63167 63168 function testFormat ( parsed, entry ) { 63169 parsed.format = entry; 63170 validateFormat(entry); 63171 } 63172 63173 function testCssPrefix ( parsed, entry ) { 63174 63175 if ( entry !== undefined && typeof entry !== 'string' && entry !== false ) { 63176 throw new Error("noUiSlider (" + VERSION + "): 'cssPrefix' must be a string or `false`."); 63177 } 63178 63179 parsed.cssPrefix = entry; 63180 } 63181
63182 function testCssClasses ( parsed, entry ) { 63183 63184 if ( entry !== undefined && typeof entry !== 'object' ) { 63185 throw new Error("noUiSlider (" + VERSION + "): 'cssClasses' must be an object."); 63186 } 63187 63188 if ( typeof parsed.cssPrefix === 'string' ) { 63189 parsed.cssClasses = {}; 63190 63191 for ( var key in entry ) { 63192 if ( !entry.hasOwnProperty(key) ) { continue; } 63193 63194 parsed.cssClasses[key] = parsed.cssPrefix + entry[key]; 63195 } 63196 } else { 63197 parsed.cssClasses = entry; 63198 } 63199 } 63200 63201 function testUseRaf ( parsed, entry ) { 63202 if ( entry === true || entry === false ) { 63203 parsed.useRequestAnimationFrame = entry; 63204 } else { 63205 throw new Error("noUiSlider (" + VERSION + "): 'useRequestAnimationFrame' option should be true (default) or false."); 63206 } 63207 } 63208 63209 // Test all developer settings and parse to assumption-safe values. 63210 function testOptions ( options ) { 63211 63212 // To prove a fix for #537, freeze options here. 63213 // If the object is modified, an error will be thrown. 63214 // Object.freeze(options); 63215 63216 var parsed = { 63217 margin: 0, 63218 limit: 0, 63219 padding: 0, 63220 animate: true, 63221 animationDuration: 300, 63222 ariaFormat: defaultFormatter, 63223 format: defaultFormatter 63224 }; 63225 63226 // Tests are executed in the order they are presented here. 63227 var tests = { 63228 'step': { r: false, t: testStep }, 63229 'start': { r: true, t: testStart }, 63230 'connect': { r: true, t: testConnect }, 63231 'direction': { r: true, t: testDirection }, 63232 'snap': { r: false, t: testSnap }, 63233 'animate': { r: false, t: testAnimate }, 63234 'animationDuration': { r: false, t: testAnimationDuration }, 63235 'range': { r: true, t: testRange }, 63236 'orientation': { r: false, t: testOrientation }, 63237 'margin': { r: false, t: testMargin }, 63238 'limit': { r: false, t: testLimit }, 63239 'padding': { r: false, t: testPadding }, 63240 'behaviour': { r: true, t: testBehaviour }, 63241 'ariaFormat': { r: false, t: testAriaFormat }, 63242 'format': { r: false, t: testFormat }, 63243 'tooltips': { r: false, t: testTooltips }, 63244 'cssPrefix': { r: false, t: testCssPrefix },
63245 'cssClasses': { r: false, t: testCssClasses }, 63246 'useRequestAnimationFrame': { r: false, t: testUseRaf } 63247 }; 63248 63249 var defaults = { 63250 'connect': false, 63251 'direction': 'ltr', 63252 'behaviour': 'tap', 63253 'orientation': 'horizontal', 63254 'cssPrefix' : 'noUi-', 63255 'cssClasses': { 63256 target: 'target', 63257 base: 'base', 63258 origin: 'origin', 63259 handle: 'handle', 63260 handleLower: 'handle-lower', 63261 handleUpper: 'handle-upper', 63262 horizontal: 'horizontal', 63263 vertical: 'vertical', 63264 background: 'background', 63265 connect: 'connect', 63266 ltr: 'ltr', 63267 rtl: 'rtl', 63268 draggable: 'draggable', 63269 drag: 'state-drag', 63270 tap: 'state-tap', 63271 active: 'active', 63272 tooltip: 'tooltip', 63273 pips: 'pips', 63274 pipsHorizontal: 'pips-horizontal', 63275 pipsVertical: 'pips-vertical', 63276 marker: 'marker', 63277 markerHorizontal: 'marker-horizontal', 63278 markerVertical: 'marker-vertical', 63279 markerNormal: 'marker-normal', 63280 markerLarge: 'marker-large', 63281 markerSub: 'marker-sub', 63282 value: 'value', 63283 valueHorizontal: 'value-horizontal', 63284 valueVertical: 'value-vertical', 63285 valueNormal: 'value-normal', 63286 valueLarge: 'value-large', 63287 valueSub: 'value-sub' 63288 }, 63289 'useRequestAnimationFrame': true 63290 }; 63291 63292 // AriaFormat defaults to regular format, if any. 63293 if ( options.format && !options.ariaFormat ) { 63294 options.ariaFormat = options.format; 63295 } 63296 63297 // Run all options through a testing mechanism to ensure correct 63298 // input. It should be noted that options might get modified to 63299 // be handled properly. E.g. wrapping integers in arrays. 63300 Object.keys(tests).forEach(function( name ){ 63301 63302 // If the option isn't set, but it is required, throw an error. 63303 if ( options[name] === undefined && defaults[name] === undefined ) { 63304 63305 if ( tests[name].r ) { 63306 throw new Error("noUiSlider (" + VERSION + "): '" + name + "' is required."); 63307 } 63308 63309 return true; 63310 } 63311 63312 tests[name].t( parsed, options[name] === undefined ? defaults[name] : options[name] ); 63313 }); 63314 63315 // Forward pips options
63316 parsed.pips = options.pips; 63317 63318 var styles = [['left', 'top'], ['right', 'bottom']]; 63319 63320 // Pre-define the styles. 63321 parsed.style = styles[parsed.dir][parsed.ort]; 63322 parsed.styleOposite = styles[parsed.dir?0:1][parsed.ort]; 63323 63324 return parsed; 63325 } 63326 63327 63328function closure ( target, options, originalOptions ){ 63329 63330 var actions = getActions(); 63331 var supportsTouchActionNone = getSupportsTouchActionNone(); 63332 var supportsPassive = supportsTouchActionNone && getSupportsPassive(); 63333 63334 // All variables local to 'closure' are prefixed with 'scope_' 63335 var scope_Target = target; 63336 var scope_Locations = []; 63337 var scope_Base; 63338 var scope_Handles; 63339 var scope_HandleNumbers = []; 63340 var scope_ActiveHandle = false; 63341 var scope_Connects; 63342 var scope_Spectrum = options.spectrum; 63343 var scope_Values = []; 63344 var scope_Events = {}; 63345 var scope_Self; 63346 var scope_Pips; 63347 var scope_Listeners = null; 63348 var scope_Document = target.ownerDocument; 63349 var scope_DocumentElement = scope_Document.documentElement; 63350 var scope_Body = scope_Document.body; 63351 63352 63353 // Creates a node, adds it to target, returns the new node. 63354 function addNodeTo ( target, className ) { 63355 63356 var div = scope_Document.createElement('div'); 63357 63358 if ( className ) { 63359 addClass(div, className); 63360 } 63361 63362 target.appendChild(div); 63363 63364 return div; 63365 } 63366 63367 // Append a origin to the base 63368 function addOrigin ( base, handleNumber ) { 63369 63370 var origin = addNodeTo(base, options.cssClasses.origin); 63371 var handle = addNodeTo(origin, options.cssClasses.handle); 63372 63373 handle.setAttribute('data-handle', handleNumber); 63374 63375 // https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex 63376 // 0 = focusable and reachable 63377 handle.setAttribute('tabindex', '0'); 63378 handle.setAttribute('role', 'slider'); 63379 handle.setAttribute('aria-orientation', options.ort ? 'vertical' : 'horizontal'); 63380 63381 if ( handleNumber === 0 ) { 63382 addClass(handle, options.cssClasses.handleLower); 63383 } 63384 63385 else if ( handleNumber === options.handles - 1 ) { 63386 addClass(handle, options.cssClasses.handleUpper); 63387 } 63388 63389 return origin; 63390 } 63391 63392 // Insert nodes for connect elements 63393 function addConnect ( base, add ) { 63394 63395 if ( !add ) { 63396 return false; 63397 } 63398 63399 return addNodeTo(base, options.cssClasses.connect); 63400 } 63401 63402 // Add handles to the slider base. 63403 function addElements ( connectOptions, base ) { 63404 63405 scope_Handles = []; 63406 scope_Connects = []; 63407 63408 scope_Connects.push(addConnect(base, connectOptions[0])); 63409 63410 // [::::O====O====O====] 63411 // connectOptions = [0, 1, 1, 1] 63412 63413 for ( var i = 0; i < options.handles; i++ ) { 63414 // Keep a list of all added handles. 63415 scope_Handles.push(addOrigin(base, i)); 63416 scope_HandleNumbers[i] = i; 63417 scope_Connects.push(addConnect(base, connectOptions[i + 1])); 63418 } 63419 } 63420 63421 // Initialize a single slider. 63422 function addSlider ( target ) { 63423 63424 // Apply classes and data to the target. 63425 addClass(target, options.cssClasses.target); 63426 63427 if ( options.dir === 0 ) { 63428 addClass(target, options.cssClasses.ltr); 63429 } else { 63430 addClass(target, options.cssClasses.rtl); 63431 } 63432 63433 if ( options.ort === 0 ) { 63434 addClass(target, options.cssClasses.horizontal); 63435 } else { 63436 addClass(target, options.cssClasses.vertical); 63437 } 63438 63439 scope_Base = addNodeTo(target, options.cssClasses.base); 63440 } 63441 63442 63443 function addTooltip ( handle, handleNumber ) { 63444 63445 if ( !options.tooltips[handleNumber] ) { 63446 return false; 63447 } 63448 63449 return addNodeTo(handle.firstChild, options.cssClasses.tooltip); 63450 } 63451 63452 // The tooltips option is a shorthand for using the 'update' event. 63453 function tooltips ( ) { 63454 63455 // Tooltips are added with options.tooltips in original order. 63456 var tips = scope_Handles.map(addTooltip); 63457 63458 bindEvent('update', function(values, handleNumber, unencoded) { 63459 63460 if ( !tips[handleNumber] ) { 63461 return; 63462 } 63463 63464 var formattedValue = values[handleNumber]; 63465 63466 if ( options.tooltips[handleNumber] !== true ) { 63467 formattedValue = options.tooltips[handleNumber].to(unencoded[handleNumber]); 63468 } 63469 63470 tips[handleNumber].innerHTML = formattedValue; 63471 }); 63472 } 63473 63474 63475 function aria ( ) { 63476 63477 bindEvent('update', function ( values, handleNumber, unencoded, tap, positions ) { 63478 63479 // Update Aria Values for all handles, as a change in one changes min and max values for the next.
63480 scope_HandleNumbers.forEach(function( handleNumber ){ 63481 63482 var handle = scope_Handles[handleNumber]; 63483 63484 var min = checkHandlePosition(scope_Locations, handleNumber, 0, true, true, true); 63485 var max = checkHandlePosition(scope_Locations, handleNumber, 100, true, true, true); 63486 63487 var now = positions[handleNumber]; 63488 var text = options.ariaFormat.to(unencoded[handleNumber]); 63489 63490 handle.children[0].setAttribute('aria-valuemin', min.toFixed(1)); 63491 handle.children[0].setAttribute('aria-valuemax', max.toFixed(1)); 63492 handle.children[0].setAttribute('aria-valuenow', now.toFixed(1)); 63493 handle.children[0].setAttribute('aria-valuetext', text); 63494 }); 63495 }); 63496 } 63497 63498 63499 function getGroup ( mode, values, stepped ) { 63500 63501 // Use the range. 63502 if ( mode === 'range' || mode === 'steps' ) { 63503 return scope_Spectrum.xVal; 63504 } 63505 63506 if ( mode === 'count' ) { 63507 63508 if ( !values ) { 63509 throw new Error("noUiSlider (" + VERSION + "): 'values' required for mode 'count'."); 63510 } 63511 63512 // Divide 0 - 100 in 'count' parts. 63513 var spread = ( 100 / (values - 1) ); 63514 var v; 63515 var i = 0; 63516 63517 values = []; 63518 63519 // List these parts and have them handled as 'positions'. 63520 while ( (v = i++ * spread) <= 100 ) { 63521 values.push(v); 63522 } 63523 63524 mode = 'positions'; 63525 } 63526 63527 if ( mode === 'positions' ) { 63528 63529 // Map all percentages to on-range values. 63530 return values.map(function( value ){ 63531 return scope_Spectrum.fromStepping( stepped ? scope_Spectrum.getStep( value ) : value ); 63532 }); 63533 } 63534 63535 if ( mode === 'values' ) { 63536 63537 // If the value must be stepped, it needs to be converted to a percentage first. 63538 if ( stepped ) { 63539 63540 return values.map(function( value ){ 63541 63542 // Convert to percentage, apply step, return to value. 63543 return scope_Spectrum.fromStepping( scope_Spectrum.getStep( scope_Spectrum.toStepping( value ) ) ); 63544 }); 63545 63546 } 63547 63548 // Otherwise, we can simply use the values. 63549 return values; 63550 } 63551 } 63552 63553 function generateSpread ( density, mode, group ) { 63554 63555 function safeIncrement(value, increment) { 63556 // Avoid floating point variance by dropping the smallest decimal places. 63557 return (value + increment).toFixed(7) / 1; 63558 } 63559 63560 var indexes = {}; 63561 var firstInRange = scope_Spectrum.xVal[0]; 63562 var lastInRange = scope_Spectrum.xVal[scope_Spectrum.xVal.length-1]; 63563 var ignoreFirst = false; 63564 var ignoreLast = false; 63565 var prevPct = 0; 63566 63567 // Create a copy of the group, sort it and filter away all duplicates. 63568 group = unique(group.slice().sort(function(a, b){ return a - b; })); 63569 63570 // Make sure the range starts with the first element. 63571 if ( group[0] !== firstInRange ) { 63572 group.unshift(firstInRange); 63573 ignoreFirst = true; 63574 } 63575 63576 // Likewise for the last one. 63577 if ( group[group.length - 1] !== lastInRange ) { 63578 group.push(lastInRange); 63579 ignoreLast = true; 63580 } 63581 63582 group.forEach(function ( current, index ) { 63583 63584 // Get the current step and the lower + upper positions. 63585 var step; 63586 var i; 63587 var q; 63588 var low = current; 63589 var high = group[index+1]; 63590 var newPct; 63591 var pctDifference; 63592 var pctPos; 63593 var type; 63594 var steps; 63595 var realSteps; 63596 var stepsize; 63597 63598 // When using 'steps' mode, use the provided steps. 63599 // Otherwise, we'll step on to the next subrange. 63600 if ( mode === 'steps' ) { 63601 step = scope_Spectrum.xNumSteps[ index ]; 63602 } 63603 63604 // Default to a 'full' step. 63605 if ( !step ) { 63606 step = high-low; 63607 } 63608 63609 // Low can be 0, so test for false. If high is undefined, 63610 // we are at the last subrange. Index 0 is already handled. 63611 if ( low === false || high === undefined ) { 63612 return; 63613 } 63614 63615 // Make sure step isn't 0, which would cause an infinite loop (#654) 63616 step = Math.max(step, 0.0000001); 63617 63618 // Find all steps in the subrange. 63619 for ( i = low; i <= high; i = safeIncrement(i, step) ) { 63620 63621 // Get the percentage value for the current step, 63622 // calculate the size for the subrange. 63623 newPct = scope_Spectrum.toStepping( i ); 63624 pctDifference = newPct - prevPct; 63625 63626 steps = pctDifference / density; 63627 realSteps = Math.round(steps); 63628 63629 // This ratio represents the ammount of percentage-space a point indicates. 63630 // For a density 1 the points/percentage = 1. For density 2, that percentage needs to be re-devided. 63631 // Round the percentage offset to an even number, then divide by two 63632 // to spread the offset on both sides of the range. 63633 stepsize = pctDifference/realSteps; 63634 63635 // Divide all points evenly, adding the correct number to this subrange. 63636 // Run up to <= so that 100% gets a point, event if ignoreLast is set. 63637 for ( q = 1; q <= realSteps; q += 1 ) { 63638 63639 // The ratio between the rounded value and the actual size might be ~1% off. 63640 // Correct the percentage offset by the number of points 63641 // per subrange. density = 1 will result in 100 points on the 63642 // full range, 2 for 50, 4 for 25, etc. 63643 pctPos = prevPct + ( q * stepsize ); 63644 indexes[pctPos.toFixed(5)] = ['x', 0]; 63645 } 63646 63647 // Determine the point type. 63648 type = (group.indexOf(i) > -1) ? 1 : ( mode === 'steps' ? 2 : 0 ); 63649 63650 // Enforce the 'ignoreFirst' option by overwriting the type for 0. 63651 if ( !index && ignoreFirst ) { 63652 type = 0; 63653 } 63654 63655 if ( !(i === high && ignoreLast)) { 63656 // Mark the 'type' of this point. 0 = plain, 1 = real value, 2 = step value. 63657 indexes[newPct.toFixed(5)] = [i, type]; 63658 } 63659 63660 // Update the percentage count. 63661 prevPct = newPct; 63662 } 63663 }); 63664 63665 return indexes; 63666 } 63667 63668 function addMarking ( spread, filterFunc, formatter ) { 63669 63670 var element = scope_Document.createElement('div'); 63671 63672 var valueSizeClasses = [
63673 options.cssClasses.valueNormal, 63674 options.cssClasses.valueLarge, 63675 options.cssClasses.valueSub 63676 ]; 63677 var markerSizeClasses = [ 63678 options.cssClasses.markerNormal, 63679 options.cssClasses.markerLarge, 63680 options.cssClasses.markerSub 63681 ]; 63682 var valueOrientationClasses = [ 63683 options.cssClasses.valueHorizontal, 63684 options.cssClasses.valueVertical 63685 ]; 63686 var markerOrientationClasses = [ 63687 options.cssClasses.markerHorizontal, 63688 options.cssClasses.markerVertical 63689 ]; 63690 63691 addClass(element, options.cssClasses.pips); 63692 addClass(element, options.ort === 0 ? options.cssClasses.pipsHorizontal : options.cssClasses.pipsVertical); 63693 63694 function getClasses( type, source ){ 63695 var a = source === options.cssClasses.value; 63696 var orientationClasses = a ? valueOrientationClasses : markerOrientationClasses; 63697 var sizeClasses = a ? valueSizeClasses : markerSizeClasses; 63698 63699 return source + ' ' + orientationClasses[options.ort] + ' ' + sizeClasses[type]; 63700 } 63701 63702 function addSpread ( offset, values ){ 63703 63704 // Apply the filter function, if it is set. 63705 values[1] = (values[1] && filterFunc) ? filterFunc(values[0], values[1]) : values[1]; 63706 63707 // Add a marker for every point 63708 var node = addNodeTo(element, false); 63709 node.className = getClasses(values[1], options.cssClasses.marker); 63710 node.style[options.style] = offset + '%'; 63711 63712 // Values are only appended for points marked '1' or '2'. 63713 if ( values[1] ) { 63714 node = addNodeTo(element, false); 63715 node.className = getClasses(values[1], options.cssClasses.value); 63716 node.style[options.style] = offset + '%'; 63717 node.innerText = formatter.to(values[0]); 63718 } 63719 } 63720 63721 // Append all points. 63722 Object.keys(spread).forEach(function(a){ 63723 addSpread(a, spread[a]); 63724 }); 63725 63726 return element; 63727 } 63728 63729 function removePips ( ) { 63730 if ( scope_Pips ) { 63731 removeElement(scope_Pips); 63732 scope_Pips = null; 63733 } 63734 } 63735 63736 function pips ( grid ) { 63737 63738 // Fix #669 63739 removePips(); 63740 63741 var mode = grid.mode; 63742 var density = grid.density || 1; 63743 var filter = grid.filter || false; 63744 var values = grid.values || false; 63745 var stepped = grid.stepped || false; 63746 var group = getGroup( mode, values, stepped ); 63747 var spread = generateSpread( density, mode, group ); 63748 var format = grid.format || { 63749 to: Math.round 63750 }; 63751 63752 scope_Pips = scope_Target.appendChild(addMarking( 63753 spread, 63754 filter, 63755 format 63756 )); 63757 63758 return scope_Pips; 63759 } 63760 63761 63762 // Shorthand for base dimensions. 63763 function baseSize ( ) { 63764 var rect = scope_Base.getBoundingClientRect(), alt = 'offset' + ['Width', 'Height'][options.ort]; 63765 return options.ort === 0 ? (rect.width||scope_Base[alt]) : (rect.height||scope_Base[alt]); 63766 } 63767 63768 // Handler for attaching events trough a proxy. 63769 function attachEvent ( events, element, callback, data ) { 63770 63771 // This function can be used to 'filter' events to the slider. 63772 // element is a node, not a nodeList 63773 63774 var method = function ( e ){ 63775 63776 if ( scope_Target.hasAttribute('disabled') ) { 63777 return false; 63778 } 63779 63780 // Stop if an active 'tap' transition is taking place. 63781 if ( hasClass(scope_Target, options.cssClasses.tap) ) { 63782 return false; 63783 } 63784 63785 e = fixEvent(e, data.pageOffset); 63786 63787 // Handle reject of multitouch 63788 if ( !e ) { 63789 return false; 63790 } 63791 63792 // Ignore right or middle clicks on start #454 63793 if ( events === actions.start && e.buttons !== undefined && e.buttons > 1 ) { 63794 return false; 63795 } 63796 63797 // Ignore right or middle clicks on start #454 63798 if ( data.hover && e.buttons ) { 63799 return false; 63800 } 63801 63802 // 'supportsPassive' is only true if a browser also supports touch-action: none in CSS. 63803 // iOS safari does not, so it doesn't get to benefit from passive scrolling. iOS does support 63804 // touch-action: manipulation, but that allows panning, which breaks 63805 // sliders after zooming/on non-responsive pages. 63806 // See: https://bugs.webkit.org/show_bug.cgi?id=133112 63807 if ( !supportsPassive ) { 63808 e.preventDefault(); 63809 } 63810 63811 e.calcPoint = e.points[ options.ort ]; 63812 63813 // Call the event handler with the event [ and additional data ]. 63814 callback ( e, data ); 63815 }; 63816 63817 var methods = []; 63818 63819 // Bind a closure on the target for every event type. 63820 events.split(' ').forEach(function( eventName ){ 63821 element.addEventListener(eventName, method, supportsPassive ? { passive: true } : false); 63822 methods.push([eventName, method]); 63823 }); 63824 63825 return methods; 63826 } 63827 63828 // Provide a clean event with standardized offset values. 63829 function fixEvent ( e, pageOffset ) { 63830 63831 // Filter the event to register the type, which can be 63832 // touch, mouse or pointer. Offset changes need to be 63833 // made on an event specific basis. 63834 var touch = e.type.indexOf('touch') === 0; 63835 var mouse = e.type.indexOf('mouse') === 0; 63836 var pointer = e.type.indexOf('pointer') === 0; 63837 63838 var x; 63839 var y; 63840 63841 // IE10 implemented pointer events with a prefix; 63842 if ( e.type.indexOf('MSPointer') === 0 ) { 63843 pointer = true; 63844 } 63845 63846 if ( touch ) { 63847 63848 // Fix bug when user touches with two or more fingers on mobile devices. 63849 // It's useful when you have two or more sliders on one page, 63850 // that can be touched simultaneously. 63851 // #649, #663, #668 63852 if ( e.touches.length > 1 ) { 63853 return false; 63854 } 63855 63856 // noUiSlider supports one movement at a time, 63857 // so we can select the first 'changedTouch'. 63858 x = e.changedTouches[0].pageX; 63859 y = e.changedTouches[0].pageY; 63860 } 63861 63862 pageOffset = pageOffset || getPageOffset(scope_Document); 63863 63864 if ( mouse || pointer ) { 63865 x = e.clientX + pageOffset.x; 63866 y = e.clientY + pageOffset.y; 63867 } 63868 63869 e.pageOffset = pageOffset; 63870 e.points = [x, y]; 63871 e.cursor = mouse || pointer; // Fix #435 63872 63873 return e; 63874 } 63875 63876 // Translate a coordinate in the document to a percentage on the slider 63877 function calcPointToPercentage ( calcPoint ) { 63878 var location = calcPoint - offset(scope_Base, options.ort); 63879 var proposal = ( location * 100 ) / baseSize(); 63880 return options.dir ? 100 - proposal : proposal; 63881 } 63882 63883 // Find handle closest to a certain percentage on the slider 63884 function getClosestHandle ( proposal ) { 63885 63886 var closest = 100; 63887 var handleNumber = false; 63888
63889 scope_Handles.forEach(function(handle, index){ 63890 63891 // Disabled handles are ignored 63892 if ( handle.hasAttribute('disabled') ) { 63893 return; 63894 } 63895 63896 var pos = Math.abs(scope_Locations[index] - proposal); 63897 63898 if ( pos < closest ) { 63899 handleNumber = index; 63900 closest = pos; 63901 } 63902 }); 63903 63904 return handleNumber; 63905 } 63906 63907 // Moves handle(s) by a percentage 63908 // (bool, % to move, [% where handle started, ...], [index in scope_Handles, ...]) 63909 function moveHandles ( upward, proposal, locations, handleNumbers ) { 63910 63911 var proposals = locations.slice(); 63912 63913 var b = [!upward, upward]; 63914 var f = [upward, !upward]; 63915 63916 // Copy handleNumbers so we don't change the dataset 63917 handleNumbers = handleNumbers.slice(); 63918 63919 // Check to see which handle is 'leading'. 63920 // If that one can't move the second can't either. 63921 if ( upward ) { 63922 handleNumbers.reverse(); 63923 } 63924 63925 // Step 1: get the maximum percentage that any of the handles can move 63926 if ( handleNumbers.length > 1 ) { 63927 63928 handleNumbers.forEach(function(handleNumber, o) { 63929 63930 var to = checkHandlePosition(proposals, handleNumber, proposals[handleNumber] + proposal, b[o], f[o], false); 63931 63932 // Stop if one of the handles can't move. 63933 if ( to === false ) { 63934 proposal = 0; 63935 } else { 63936 proposal = to - proposals[handleNumber]; 63937 proposals[handleNumber] = to; 63938 } 63939 }); 63940 } 63941 63942 // If using one handle, check backward AND forward 63943 else { 63944 b = f = [true]; 63945 } 63946 63947 var state = false; 63948 63949 // Step 2: Try to set the handles with the found percentage 63950 handleNumbers.forEach(function(handleNumber, o) { 63951 state = setHandle(handleNumber, locations[handleNumber] + proposal, b[o], f[o]) || state; 63952 }); 63953 63954 // Step 3: If a handle moved, fire events 63955 if ( state ) { 63956 handleNumbers.forEach(function(handleNumber){ 63957 fireEvent('update', handleNumber); 63958 fireEvent('slide', handleNumber); 63959 }); 63960 } 63961 } 63962 63963 // External event handling 63964 function fireEvent ( eventName, handleNumber, tap ) { 63965 63966 Object.keys(scope_Events).forEach(function( targetEvent ) { 63967 63968 var eventType = targetEvent.split('.')[0]; 63969 63970 if ( eventName === eventType ) { 63971 scope_Events[targetEvent].forEach(function( callback ) { 63972 63973 callback.call( 63974 // Use the slider public API as the scope ('this') 63975 scope_Self, 63976 // Return values as array, so arg_1[arg_2] is always valid. 63977 scope_Values.map(options.format.to), 63978 // Handle index, 0 or 1 63979 handleNumber, 63980 // Unformatted slider values 63981 scope_Values.slice(), 63982 // Event is fired by tap, true or false 63983 tap || false, 63984 // Left offset of the handle, in relation to the slider 63985 scope_Locations.slice() 63986 ); 63987 }); 63988 } 63989 }); 63990 } 63991 63992 63993 // Fire 'end' when a mouse or pen leaves the document. 63994 function documentLeave ( event, data ) { 63995 if ( event.type === "mouseout" && event.target.nodeName === "HTML" && event.relatedTarget === null ){ 63996 eventEnd (event, data); 63997 } 63998 } 63999 64000 // Handle movement on document for handle and range drag. 64001 function eventMove ( event, data ) { 64002 64003 // Fix #498 64004 // Check value of .buttons in 'start' to work around a bug in IE10 mobile (data.buttonsProperty). 64005 // https://connect.microsoft.com/IE/feedback/details/927005/mobile-ie10-windows-phone-buttons-property-of-pointermove-event-always-zero 64006 // IE9 has .buttons and .which zero on mousemove. 64007 // Firefox breaks the spec MDN defines. 64008 if ( navigator.appVersion.indexOf("MSIE 9") === -1 && event.buttons === 0 && data.buttonsProperty !== 0 ) { 64009 return eventEnd(event, data); 64010 } 64011 64012 // Check if we are moving up or down 64013 var movement = (options.dir ? -1 : 1) * (event.calcPoint - data.startCalcPoint); 64014 64015 // Convert the movement into a percentage of the slider width/height 64016 var proposal = (movement * 100) / data.baseSize; 64017 64018 moveHandles(movement > 0, proposal, data.locations, data.handleNumbers); 64019 } 64020 64021 // Unbind move events on document, call callbacks. 64022 function eventEnd ( event, data ) { 64023 64024 // The handle is no longer active, so remove the class. 64025 if ( scope_ActiveHandle ) {
64026 removeClass(scope_ActiveHandle, options.cssClasses.active); 64027 scope_ActiveHandle = false; 64028 } 64029 64030 // Remove cursor styles and text-selection events bound to the body. 64031 if ( event.cursor ) { 64032 scope_Body.style.cursor = ''; 64033 scope_Body.removeEventListener('selectstart', preventDefault); 64034 } 64035 64036 // Unbind the move and end events, which are added on 'start'. 64037 scope_Listeners.forEach(function( c ) { 64038 scope_DocumentElement.removeEventListener(c[0], c[1]); 64039 }); 64040 64041 // Remove dragging class. 64042 removeClass(scope_Target, options.cssClasses.drag); 64043 64044 setZindex(); 64045 64046 data.handleNumbers.forEach(function(handleNumber){ 64047 fireEvent('change', handleNumber); 64048 fireEvent('set', handleNumber); 64049 fireEvent('end', handleNumber); 64050 }); 64051 } 64052 64053 // Bind move events on document. 64054 function eventStart ( event, data ) { 64055 64056 if ( data.handleNumbers.length === 1 ) { 64057 64058 var handle = scope_Handles[data.handleNumbers[0]]; 64059 64060 // Ignore 'disabled' handles 64061 if ( handle.hasAttribute('disabled') ) { 64062 return false; 64063 } 64064 64065 // Mark the handle as 'active' so it can be styled. 64066 scope_ActiveHandle = handle.children[0]; 64067 addClass(scope_ActiveHandle, options.cssClasses.active); 64068 } 64069 64070 // A drag should never propagate up to the 'tap' event. 64071 event.stopPropagation(); 64072 64073 // Attach the move and end events. 64074 var moveEvent = attachEvent(actions.move, scope_DocumentElement, eventMove, { 64075 startCalcPoint: event.calcPoint, 64076 baseSize: baseSize(), 64077 pageOffset: event.pageOffset, 64078 handleNumbers: data.handleNumbers, 64079 buttonsProperty: event.buttons, 64080 locations: scope_Locations.slice() 64081 }); 64082 64083 var endEvent = attachEvent(actions.end, scope_DocumentElement, eventEnd, { 64084 handleNumbers: data.handleNumbers 64085 }); 64086 64087 var outEvent = attachEvent("mouseout", scope_DocumentElement, documentLeave, { 64088 handleNumbers: data.handleNumbers 64089 }); 64090 64091 scope_Listeners = moveEvent.concat(endEvent, outEvent); 64092 64093 // Text selection isn't an issue on touch devices, 64094 // so adding cursor styles can be skipped. 64095 if ( event.cursor ) { 64096 64097 // Prevent the 'I' cursor and extend the range-drag cursor. 64098 scope_Body.style.cursor = getComputedStyle(event.target).cursor; 64099 64100 // Mark the target with a dragging state. 64101 if ( scope_Handles.length > 1 ) { 64102 addClass(scope_Target, options.cssClasses.drag); 64103 } 64104 64105 // Prevent text selection when dragging the handles. 64106 // In noUiSlider <= 9.2.0, this was handled by calling preventDefault on mouse/touch start/move, 64107 // which is scroll blocking. The selectstart event is supported by FireFox starting from version 52, 64108 // meaning the only holdout is iOS Safari. This doesn't matter: text selection isn't triggered there. 64109 // The 'cursor' flag is false. 64110 // See: http://caniuse.com/#search=selectstart 64111 scope_Body.addEventListener('selectstart', preventDefault, false); 64112 } 64113 64114 data.handleNumbers.forEach(function(handleNumber){ 64115 fireEvent('start', handleNumber); 64116 }); 64117 } 64118 64119 // Move closest handle to tapped location. 64120 function eventTap ( event ) { 64121 64122 // The tap event shouldn't propagate up 64123 event.stopPropagation(); 64124 64125 var proposal = calcPointToPercentage(event.calcPoint); 64126 var handleNumber = getClosestHandle(proposal); 64127 64128 // Tackle the case that all handles are 'disabled'. 64129 if ( handleNumber === false ) { 64130 return false; 64131 } 64132 64133 // Flag the slider as it is now in a transitional state. 64134 // Transition takes a configurable amount of ms (default 300). Re-enable the slider after that. 64135 if ( !options.events.snap ) { 64136 addClassFor(scope_Target, options.cssClasses.tap, options.animationDuration); 64137 } 64138 64139 setHandle(handleNumber, proposal, true, true); 64140 64141 setZindex(); 64142 64143 fireEvent('slide', handleNumber, true); 64144 fireEvent('update', handleNumber, true); 64145 fireEvent('change', handleNumber, true); 64146 fireEvent('set', handleNumber, true); 64147 64148 if ( options.events.snap ) { 64149 eventStart(event, { handleNumbers: [handleNumber] }); 64150 } 64151 } 64152 64153 // Fires a 'hover' event for a hovered mouse/pen position. 64154 function eventHover ( event ) { 64155 64156 var proposal = calcPointToPercentage(event.calcPoint); 64157 64158 var to = scope_Spectrum.getStep(proposal); 64159 var value = scope_Spectrum.fromStepping(to); 64160
64161 Object.keys(scope_Events).forEach(function( targetEvent ) { 64162 if ( 'hover' === targetEvent.split('.')[0] ) { 64163 scope_Events[targetEvent].forEach(function( callback ) { 64164 callback.call( scope_Self, value ); 64165 }); 64166 } 64167 }); 64168 } 64169 64170 // Attach events to several slider parts. 64171 function bindSliderEvents ( behaviour ) { 64172 64173 // Attach the standard drag event to the handles. 64174 if ( !behaviour.fixed ) { 64175 64176 scope_Handles.forEach(function( handle, index ){ 64177 64178 // These events are only bound to the visual handle 64179 // element, not the 'real' origin element. 64180 attachEvent ( actions.start, handle.children[0], eventStart, { 64181 handleNumbers: [index] 64182 }); 64183 }); 64184 } 64185 64186 // Attach the tap event to the slider base. 64187 if ( behaviour.tap ) { 64188 attachEvent (actions.start, scope_Base, eventTap, {}); 64189 } 64190 64191 // Fire hover events 64192 if ( behaviour.hover ) { 64193 attachEvent (actions.move, scope_Base, eventHover, { hover: true }); 64194 } 64195 64196 // Make the range draggable. 64197 if ( behaviour.drag ){ 64198 64199 scope_Connects.forEach(function( connect, index ){ 64200 64201 if ( connect === false || index === 0 || index === scope_Connects.length - 1 ) { 64202 return; 64203 } 64204 64205 var handleBefore = scope_Handles[index - 1]; 64206 var handleAfter = scope_Handles[index]; 64207 var eventHolders = [connect]; 64208 64209 addClass(connect, options.cssClasses.draggable); 64210 64211 // When the range is fixed, the entire range can 64212 // be dragged by the handles. The handle in the first 64213 // origin will propagate the start event upward, 64214 // but it needs to be bound manually on the other. 64215 if ( behaviour.fixed ) { 64216 eventHolders.push(handleBefore.children[0]); 64217 eventHolders.push(handleAfter.children[0]); 64218 } 64219 64220 eventHolders.forEach(function( eventHolder ) { 64221 attachEvent ( actions.start, eventHolder, eventStart, { 64222 handles: [handleBefore, handleAfter], 64223 handleNumbers: [index - 1, index] 64224 }); 64225 }); 64226 }); 64227 } 64228 } 64229 64230 64231 // Split out the handle positioning logic so the Move event can use it, too 64232 function checkHandlePosition ( reference, handleNumber, to, lookBackward, lookForward, getValue ) { 64233 64234 // For sliders with multiple handles, limit movement to the other handle. 64235 // Apply the margin option by adding it to the handle positions. 64236 if ( scope_Handles.length > 1 ) { 64237 64238 if ( lookBackward && handleNumber > 0 ) { 64239 to = Math.max(to, reference[handleNumber - 1] + options.margin); 64240 } 64241 64242 if ( lookForward && handleNumber < scope_Handles.length - 1 ) { 64243 to = Math.min(to, reference[handleNumber + 1] - options.margin); 64244 } 64245 } 64246 64247 // The limit option has the opposite effect, limiting handles to a 64248 // maximum distance from another. Limit must be > 0, as otherwise 64249 // handles would be unmoveable. 64250 if ( scope_Handles.length > 1 && options.limit ) { 64251 64252 if ( lookBackward && handleNumber > 0 ) { 64253 to = Math.min(to, reference[handleNumber - 1] + options.limit); 64254 } 64255 64256 if ( lookForward && handleNumber < scope_Handles.length - 1 ) { 64257 to = Math.max(to, reference[handleNumber + 1] - options.limit); 64258 } 64259 } 64260 64261 // The padding option keeps the handles a certain distance from the 64262 // edges of the slider. Padding must be > 0. 64263 if ( options.padding ) { 64264 64265 if ( handleNumber === 0 ) { 64266 to = Math.max(to, options.padding); 64267 } 64268 64269 if ( handleNumber === scope_Handles.length - 1 ) { 64270 to = Math.min(to, 100 - options.padding); 64271 } 64272 } 64273 64274 to = scope_Spectrum.getStep(to); 64275 64276 // Limit percentage to the 0 - 100 range 64277 to = limit(to); 64278 64279 // Return false if handle can't move 64280 if ( to === reference[handleNumber] && !getValue ) { 64281 return false; 64282 } 64283 64284 return to; 64285 } 64286 64287 function toPct ( pct ) { 64288 return pct + '%'; 64289 } 64290 64291 // Updates scope_Locations and scope_Values, updates visual state 64292 function updateHandlePosition ( handleNumber, to ) { 64293 64294 // Update locations. 64295 scope_Locations[handleNumber] = to; 64296 64297 // Convert the value to the slider stepping/range. 64298 scope_Values[handleNumber] = scope_Spectrum.fromStepping(to); 64299 64300 // Called synchronously or on the next animationFrame 64301 var stateUpdate = function() { 64302 scope_Handles[handleNumber].style[options.style] = toPct(to); 64303 updateConnect(handleNumber); 64304 updateConnect(handleNumber + 1); 64305 }; 64306 64307 // Set the handle to the new position. 64308 // Use requestAnimationFrame for efficient painting. 64309 // No significant effect in Chrome, Edge sees dramatic performace improvements. 64310 // Option to disable is useful for unit tests, and single-step debugging. 64311 if ( window.requestAnimationFrame && options.useRequestAnimationFrame ) { 64312 window.requestAnimationFrame(stateUpdate); 64313 } else { 64314 stateUpdate(); 64315 } 64316 } 64317 64318 function setZindex ( ) { 64319
64320 scope_HandleNumbers.forEach(function(handleNumber){ 64321 // Handles before the slider middle are stacked later = higher, 64322 // Handles after the middle later is lower 64323 // [[7] [8] .......... | .......... [5] [4] 64324 var dir = (scope_Locations[handleNumber] > 50 ? -1 : 1); 64325 var zIndex = 3 + (scope_Handles.length + (dir * handleNumber)); 64326 scope_Handles[handleNumber].childNodes[0].style.zIndex = zIndex; 64327 }); 64328 } 64329 64330 // Test suggested values and apply margin, step. 64331 function setHandle ( handleNumber, to, lookBackward, lookForward ) { 64332 64333 to = checkHandlePosition(scope_Locations, handleNumber, to, lookBackward, lookForward, false); 64334 64335 if ( to === false ) { 64336 return false; 64337 } 64338 64339 updateHandlePosition(handleNumber, to); 64340 64341 return true; 64342 } 64343 64344 // Updates style attribute for connect nodes 64345 function updateConnect ( index ) { 64346 64347 // Skip connects set to false 64348 if ( !scope_Connects[index] ) { 64349 return; 64350 } 64351 64352 var l = 0; 64353 var h = 100; 64354 64355 if ( index !== 0 ) { 64356 l = scope_Locations[index - 1]; 64357 } 64358 64359 if ( index !== scope_Connects.length - 1 ) { 64360 h = scope_Locations[index]; 64361 } 64362 64363 scope_Connects[index].style[options.style] = toPct(l); 64364 scope_Connects[index].style[options.styleOposite] = toPct(100 - h); 64365 } 64366 64367 // ... 64368 function setValue ( to, handleNumber ) { 64369 64370 // Setting with null indicates an 'ignore'. 64371 // Inputting 'false' is invalid. 64372 if ( to === null || to === false ) { 64373 return; 64374 } 64375 64376 // If a formatted number was passed, attemt to decode it. 64377 if ( typeof to === 'number' ) { 64378 to = String(to); 64379 } 64380 64381 to = options.format.from(to); 64382
64383 // Request an update for all links if the value was invalid. 64384 // Do so too if setting the handle fails. 64385 if ( to !== false && !isNaN(to) ) { 64386 setHandle(handleNumber, scope_Spectrum.toStepping(to), false, false); 64387 } 64388 } 64389 64390 // Set the slider value. 64391 function valueSet ( input, fireSetEvent ) { 64392 64393 var values = asArray(input); 64394 var isInit = scope_Locations[0] === undefined; 64395 64396 // Event fires by default 64397 fireSetEvent = (fireSetEvent === undefined ? true : !!fireSetEvent); 64398 64399 values.forEach(setValue); 64400 64401 // Animation is optional. 64402 // Make sure the initial values were set before using animated placement. 64403 if ( options.animate && !isInit ) { 64404 addClassFor(scope_Target, options.cssClasses.tap, options.animationDuration); 64405 } 64406 64407 // Now that all base values are set, apply constraints 64408 scope_HandleNumbers.forEach(function(handleNumber){ 64409 setHandle(handleNumber, scope_Locations[handleNumber], true, false); 64410 }); 64411 64412 setZindex(); 64413 64414 scope_HandleNumbers.forEach(function(handleNumber){ 64415 64416 fireEvent('update', handleNumber); 64417 64418 // Fire the event only for handles that received a new value, as per #579 64419 if ( values[handleNumber] !== null && fireSetEvent ) { 64420 fireEvent('set', handleNumber); 64421 } 64422 }); 64423 } 64424 64425 // Reset slider to initial values 64426 function valueReset ( fireSetEvent ) { 64427 valueSet(options.start, fireSetEvent); 64428 } 64429 64430 // Get the slider value. 64431 function valueGet ( ) { 64432 64433 var values = scope_Values.map(options.format.to); 64434 64435 // If only one handle is used, return a single value. 64436 if ( values.length === 1 ){ 64437 return values[0]; 64438 } 64439 64440 return values; 64441 } 64442 64443 // Removes classes from the root and empties it. 64444 function destroy ( ) { 64445 64446 for ( var key in options.cssClasses ) { 64447 if ( !options.cssClasses.hasOwnProperty(key) ) { continue; } 64448 removeClass(scope_Target, options.cssClasses[key]); 64449 } 64450 64451 while (scope_Target.firstChild) { 64452 scope_Target.removeChild(scope_Target.firstChild); 64453 } 64454 64455 delete scope_Target.noUiSlider; 64456 } 64457 64458 // Get the current step size for the slider. 64459 function getCurrentStep ( ) { 64460 64461 // Check all locations, map them to their stepping point. 64462 // Get the step point, then find it in the input list. 64463 return scope_Locations.map(function( location, index ){ 64464 64465 var nearbySteps = scope_Spectrum.getNearbySteps( location ); 64466 var value = scope_Values[index]; 64467 var increment = nearbySteps.thisStep.step; 64468 var decrement = null; 64469 64470 // If the next value in this step moves into the next step, 64471 // the increment is the start of the next step - the current value 64472 if ( increment !== false ) { 64473 if ( value + increment > nearbySteps.stepAfter.startValue ) { 64474 increment = nearbySteps.stepAfter.startValue - value; 64475 } 64476 } 64477 64478 64479 // If the value is beyond the starting point 64480 if ( value > nearbySteps.thisStep.startValue ) { 64481 decrement = nearbySteps.thisStep.step; 64482 } 64483 64484 else if ( nearbySteps.stepBefore.step === false ) { 64485 decrement = false; 64486 } 64487 64488 // If a handle is at the start of a step, it always steps back into the previous step first 64489 else { 64490 decrement = value - nearbySteps.stepBefore.highestStep; 64491 } 64492 64493 64494 // Now, if at the slider edges, there is not in/decrement 64495 if ( location === 100 ) { 64496 increment = null; 64497 } 64498 64499 else if ( location === 0 ) { 64500 decrement = null; 64501 } 64502 64503 // As per #391, the comparison for the decrement step can have some rounding issues. 64504 var stepDecimals = scope_Spectrum.countStepDecimals(); 64505 64506 // Round per #391 64507 if ( increment !== null && increment !== false ) { 64508 increment = Number(increment.toFixed(stepDecimals)); 64509 } 64510 64511 if ( decrement !== null && decrement !== false ) { 64512 decrement = Number(decrement.toFixed(stepDecimals)); 64513 } 64514 64515 return [decrement, increment]; 64516 }); 64517 } 64518 64519 // Attach an event to this slider, possibly including a namespace 64520 function bindEvent ( namespacedEvent, callback ) { 64521 scope_Events[namespacedEvent] = scope_Events[namespacedEvent] || []; 64522 scope_Events[namespacedEvent].push(callback); 64523 64524 // If the event bound is 'update,' fire it immediately for all handles. 64525 if ( namespacedEvent.split('.')[0] === 'update' ) {
64526 scope_Handles.forEach(function(a, index){ 64527 fireEvent('update', index); 64528 }); 64529 } 64530 } 64531 64532 // Undo attachment of event 64533 function removeEvent ( namespacedEvent ) { 64534 64535 var event = namespacedEvent && namespacedEvent.split('.')[0]; 64536 var namespace = event && namespacedEvent.substring(event.length); 64537 64538 Object.keys(scope_Events).forEach(function( bind ){ 64539 64540 var tEvent = bind.split('.')[0], 64541 tNamespace = bind.substring(tEvent.length); 64542 64543 if ( (!event || event === tEvent) && (!namespace || namespace === tNamespace) ) { 64544 delete scope_Events[bind]; 64545 } 64546 }); 64547 } 64548 64549 // Updateable: margin, limit, padding, step, range, animate, snap 64550 function updateOptions ( optionsToUpdate, fireSetEvent ) { 64551 64552 // Spectrum is created using the range, snap, direction and step options. 64553 // 'snap' and 'step' can be updated. 64554 // If 'snap' and 'step' are not passed, they should remain unchanged. 64555 var v = valueGet(); 64556 64557 var updateAble = ['margin', 'limit', 'padding', 'range', 'animate', 'snap', 'step', 'format']; 64558 64559 // Only change options that we're actually passed to update. 64560 updateAble.forEach(function(name){ 64561 if ( optionsToUpdate[name] !== undefined ) { 64562 originalOptions[name] = optionsToUpdate[name]; 64563 } 64564 }); 64565 64566 var newOptions = testOptions(originalOptions); 64567 64568 // Load new options into the slider state 64569 updateAble.forEach(function(name){ 64570 if ( optionsToUpdate[name] !== undefined ) { 64571 options[name] = newOptions[name]; 64572 } 64573 }); 64574 64575 scope_Spectrum = newOptions.spectrum; 64576 64577 // Limit, margin and padding depend on the spectrum but are stored outside of it. (#677) 64578 options.margin = newOptions.margin; 64579 options.limit = newOptions.limit; 64580 options.padding = newOptions.padding; 64581 64582 // Update pips, removes existing. 64583 if ( options.pips ) { 64584 pips(options.pips); 64585 } 64586 64587 // Invalidate the current positioning so valueSet forces an update. 64588 scope_Locations = []; 64589 valueSet(optionsToUpdate.start || v, fireSetEvent); 64590 } 64591 64592 // Throw an error if the slider was already initialized. 64593 if ( scope_Target.noUiSlider ) { 64594 throw new Error("noUiSlider (" + VERSION + "): Slider was already initialized."); 64595 } 64596 64597 // Create the base element, initialise HTML and set classes. 64598 // Add handles and connect elements. 64599 addSlider(scope_Target); 64600 addElements(options.connect, scope_Base); 64601 64602 scope_Self = { 64603 destroy: destroy, 64604 steps: getCurrentStep, 64605 on: bindEvent, 64606 off: removeEvent, 64607 get: valueGet, 64608 set: valueSet, 64609 reset: valueReset, 64610 // Exposed for unit testing, don't use this in your application. 64611 __moveHandles: function(a, b, c) { moveHandles(a, b, scope_Locations, c); }, 64612 options: originalOptions, // Issue #600, #678 64613 updateOptions: updateOptions, 64614 target: scope_Target, // Issue #597 64615 removePips: removePips, 64616 pips: pips // Issue #594 64617 }; 64618 64619 // Attach user events. 64620 bindSliderEvents(options.events); 64621 64622 // Use the public value method to set the start values. 64623 valueSet(options.start); 64624 64625 if ( options.pips ) { 64626 pips(options.pips); 64627 } 64628 64629 if ( options.tooltips ) { 64630 tooltips(); 64631 } 64632 64633 aria(); 64634 64635 return scope_Self; 64636 64637} 64638 64639 64640 // Run the standard initializer 64641 function initialize ( target, originalOptions ) { 64642 64643 if ( !target || !target.nodeName ) { 64644 throw new Error("noUiSlider (" + VERSION + "): create requires a single element, got: " + target); 64645 } 64646 64647 // Test the options and create the slider environment; 64648 var options = testOptions( originalOptions, target ); 64649 var api = closure( target, options, originalOptions ); 64650 64651 target.noUiSlider = api; 64652 64653 return api; 64654 } 64655 64656 // Use an object instead of a function for future expansibility; 64657 return { 64658 version: VERSION, 64659 create: initialize 64660 }; 64661 64662}));; 64663/** 64664 * stacktable.js 64665 * Author & copyright (c) 2012: John Polacek 64666 * CardTable by: Justin McNally (2015) 64667 * Dual MIT & GPL license 64668 * 64669 * Page: http://johnpolacek.github.com/stacktable.js 64670 * Repo: https://github.com/johnpolacek/stacktable.js/ 64671 * 64672 * jQuery plugin for stacking tables on small screens 64673 * Requires jQuery version 1.7 or above 64674 * 64675 */ 64676; (function ($) {
vendor: 5,343 bytes, lines 64677-64785
64677 $.fn.cardtable = function (options) { 64678 var $tables = this, 64679 defaults = { headIndex: 0 }, 64680 settings = $.extend({}, defaults, options), 64681 headIndex; 64682 64683 // checking the "headIndex" option presence... or defaults it to 0 64684 if (options && options.headIndex) 64685 headIndex = options.headIndex; 64686 else 64687 headIndex = 0; 64688 64689 return $tables.each(function () { 64690 var $table = $(this); 64691 if ($table.hasClass('stacktable')) { 64692 return; 64693 } 64694 var table_css = $(this).prop('class'); 64695 var $stacktable = $('<div></div>'); 64696 if (typeof settings.myClass !== 'undefined') $stacktable.addClass(settings.myClass); 64697 var markup = ''; 64698 var $caption, $topRow, headMarkup, bodyMarkup, tr_class; 64699 64700 $table.addClass('stacktable large-only'); 64701 64702 $caption = $table.find(">caption").clone(); 64703 $topRow = $table.find('>thead>tr,>tbody>tr,>tfoot>tr,>tr').eq(0); 64704 64705 // avoid duplication when paginating 64706 $table.siblings().filter('.small-only').remove(); 64707 64708 // using rowIndex and cellIndex in order to reduce ambiguity 64709 $table.find('>tbody>tr').each(function () { 64710 64711 // declaring headMarkup and bodyMarkup, to be used for separately head and body of single records 64712 headMarkup = ''; 64713 bodyMarkup = ''; 64714 tr_class = $(this).prop('class'); 64715 // for the first row, "headIndex" cell is the head of the table 64716 // for the other rows, put the "headIndex" cell as the head for that row 64717 // then iterate through the key/values 64718 $(this).find('>td,>th').each(function (cellIndex) { 64719 if ($(this).html() !== '') { 64720 bodyMarkup += '<tr class="' + tr_class + '">'; 64721 if ($topRow.find('>td,>th').eq(cellIndex).html()) { 64722 bodyMarkup += '<td class="st-key">' + $topRow.find('>td,>th').eq(cellIndex).html() + '</td>'; 64723 } else { 64724 bodyMarkup += '<td class="st-key"></td>'; 64725 } 64726 bodyMarkup += '<td class="st-val ' + $(this).prop('class') + '">' + $(this).html() + '</td>'; 64727 bodyMarkup += '</tr>'; 64728 } 64729 }); 64730 64731 markup += '<table class=" ' + table_css + ' stacktable small-only"><tbody>' + headMarkup + bodyMarkup + '</tbody></table>'; 64732 }); 64733 64734 $table.find('>tfoot>tr>td').each(function (rowIndex, value) { 64735 if ($.trim($(value).text()) !== '') { 64736 markup += '<table class="' + table_css + ' stacktable small-only"><tbody><tr><td>' + $(value).html() + '</td></tr></tbody></table>'; 64737 } 64738 }); 64739 64740 $stacktable.prepend($caption); 64741 $stacktable.append($(markup)); 64742 $table.before($stacktable); 64743 }); 64744 }; 64745 64746 $.fn.stacktable = function (options) { 64747 var $tables = this, 64748 defaults = { headIndex: 0, displayHeader: true, ignoreIndex: [], orderIndex: [], excludeRow: '', getCustomTableHtml: function (id) { return '' } }, 64749 settings = $.extend({}, defaults, options), 64750 headIndex; 64751 64752 // checking the "headIndex" option presence... or defaults it to 0 64753 if (options && options.headIndex) 64754 headIndex = options.headIndex; 64755 else 64756 headIndex = 0; 64757 64758 return $tables.each(function () { 64759 var table_css = $(this).prop('class'); 64760 var table_id = typeof($(this).data('id')) !== 'undefined' ? $(this).data('id') : 0; 64761 64762 var $stacktable = $('<table class="' + table_css + ' stacktable small-only"><tbody></tbody></table>'); 64763 if (typeof settings.myClass !== 'undefined') $stacktable.addClass(settings.myClass); 64764 var markup = ''; 64765 var $table, $caption, $topRow, headMarkup, bodyMarkup, tr_class, displayHeader; 64766 64767 $table = $(this); 64768 $table.addClass('stacktable large-only'); 64769 $caption = $table.find(">caption").clone(); 64770 $topRow = $table.find('>thead>tr,>tbody>tr,>tfoot>tr').eq(0); 64771 64772 displayHeader = $table.data('display-header') === undefined ? settings.displayHeader : $table.data('display-header'); 64773 64774 // using rowIndex and cellIndex in order to reduce ambiguity 64775 $table.find('>tbody>tr, >thead>tr').not(settings.excludeRow).each(function (rowIndex) { 64776 // declaring headMarkup and bodyMarkup, to be used for separately head and body of single records 64777 headMarkup = ''; 64778 bodyMarkup = ''; 64779 tr_class = $(this).prop('class'); 64780 64781 // for the first row, "headIndex" cell is the head of the table 64782 if (rowIndex === 0) { 64783 // the main heading goes into the markup variable 64784 if (displayHeader) { 64785 markup += '<tr class=" ' + tr_class + ' "><th class="st-head-row st-head-row-main" colspan="2">' + $(this).find('>th,>
64785td').eq(headIndex).html() + '</th></tr>'; 64786 } 64787 } else { 64788 // for the other rows, put the "headIndex" cell as the head for that row 64789 // then iterate through the key/values 64790 64791 var customFunc = function (cellIndex) { 64792 var $target = $table.find('>tbody>tr, >thead>tr').eq(rowIndex).find('td').eq(cellIndex); 64793 64794 // Check if target exists and check custom list to see if we should ignore any indices 64795 if ($target && $.inArray(cellIndex, settings.ignoreIndex) === -1) { 64796 if (cellIndex === headIndex) { 64797 headMarkup = '<tr class="' + tr_class + '"><th class="st-head-row" colspan="2">' + $target.html() + '</th></tr>'; 64798 } else { 64799 if ($target.html() !== '') { 64800 bodyMarkup += '<tr class="' + tr_class + '">'; 64801 64802 var content = $topRow.find('>td,>th').eq(cellIndex).html(); 64803 64804 if (content.length) { 64805 bodyMarkup += '<td class="st-key">' + $topRow.find('>td,>th').eq(cellIndex).html() + '</td>'; 64806 } else { 64807 bodyMarkup += ''; 64808 } 64809 64810 // If there is no content in header, only return a single cell and span 2 columns 64811 bodyMarkup += '<td class="st-val ' + $target.prop('class') + '"' + (!content.length ? ' colspan="2"' : '') + '>' + $target.html() + '</td>'; 64812 bodyMarkup += '</tr>'; 64813 } 64814 } 64815 } 64816 } 64817 64818 // If a custom order array has been specified, use this instead 64819 if (!settings.orderIndex.length) { 64820 var cells = $(this).find('>td,>th'); 64821 cells.each(customFunc); 64822 } else { 64823 settings.orderIndex.forEach(function (value) { 64824 customFunc(value); 64825 }); 64826 } 64827 64828 markup += headMarkup + bodyMarkup; 64829 } 64830 }); 64831 64832 $stacktable.prepend($caption); 64833 $stacktable.append($(markup)); 64834 $table.before($stacktable); 64835 64836 // Get custom table HTML passed in from parameters to append to the end of table via cell 64837 if (settings.getCustomTableHtml(table_id).length) { 64838 $stacktable.find('tbody').append( 64839 $('<tr />').append( 64840 $('<td />').append( 64841 $('<table />', { 'class': 'table' }).append( 64842 settings.getCustomTableHtml(table_id) 64843 ) 64844 ) 64845 ) 64846 ); 64847 } 64848 }); 64849 }; 64850 64851 $.fn.stackcolumns = function (options) { 64852 var $tables = this, 64853 defaults = {}, 64854 settings = $.extend({}, defaults, options); 64855 64856 return $tables.each(function () { 64857 var $table = $(this); 64858 var $caption = $table.find(">caption").clone(); 64859 var num_cols = $table.find('>thead>tr,>tbody>tr,>tfoot>tr').eq(0).find('>td,>th').length; //first table <tr> must not contain colspans, or add sum(colspan-1) here. 64860 if (num_cols < 3) //stackcolumns has no effect on tables with less than 3 columns 64861 return; 64862 64863 var $stackcolumns = $('<table class="stacktable small-only"></table>'); 64864 if (typeof settings.myClass !== 'undefined') $stackcolumns.addClass(settings.myClass); 64865 $table.addClass('stacktable large-only'); 64866 var tb = $('<tbody></tbody>'); 64867 var col_i = 1; //col index starts at 0 -> start copy at second column. 64868 64869 while (col_i < num_cols) { 64870 $table.find('>thead>tr,>tbody>tr,>tfoot>tr').each(function (index) { 64871 var tem = $('<tr></tr>'); // todo opt. copy styles of $this; todo check if parent is thead or tfoot to handle accordingly 64872 if (index === 0) tem.addClass("st-head-row st-head-row-main"); 64873 var first = $(this).find('>td,>th').eq(0).clone().addClass("st-key"); 64874 var target = col_i;
vendor: 1,950 bytes, lines 64875-64931
64875 // if colspan apply, recompute target for second cell. 64876 if ($(this).find("*[colspan]").length) { 64877 var i = 0; 64878 $(this).find('>td,>th').each(function () { 64879 var cs = $(this).attr("colspan"); 64880 if (cs) { 64881 cs = parseInt(cs, 10); 64882 target -= cs - 1; 64883 if ((i + cs) > (col_i)) //out of current bounds 64884 target += i + cs - col_i - 1; 64885 i += cs; 64886 } else { 64887 i++; 64888 } 64889 64890 if (i > col_i) 64891 return false; //target is set; break. 64892 }); 64893 } 64894 var second = $(this).find('>td,>th').eq(target).clone().addClass("st-val").removeAttr("colspan"); 64895 tem.append(first, second); 64896 tb.append(tem); 64897 }); 64898 ++col_i; 64899 } 64900 64901 $stackcolumns.append($(tb)); 64902 $stackcolumns.prepend($caption); 64903 $table.before($stackcolumns); 64904 }); 64905 }; 64906 64907}(jQuery)); 64908; 64909/*! 64910 * sweetalert2 v6.6.8 64911 * Released under the MIT License. 64912 */ 64913(function (global, factory) { 64914 typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : 64915 typeof define === 'function' && define.amd ? define(factory) : 64916 (global.Sweetalert2 = factory()); 64917}(this, (function () { 'use strict'; 64918 64919var defaultParams = { 64920 title: '', 64921 titleText: '', 64922 text: '', 64923 html: '', 64924 type: null, 64925 customClass: '', 64926 target: 'body', 64927 animation: true, 64928 allowOutsideClick: true, 64929 allowEscapeKey: true, 64930 allowEnterKey: true, 64931 showConfirmButton: true,
64932 showCancelButton: false, 64933 preConfirm: null, 64934 confirmButtonText: 'OK', 64935 confirmButtonColor: '#3085d6', 64936 confirmButtonClass: null, 64937 cancelButtonText: 'Cancel', 64938 cancelButtonColor: '#aaa', 64939 cancelButtonClass: null, 64940 buttonsStyling: true, 64941 reverseButtons: false, 64942 focusCancel: false, 64943 showCloseButton: false, 64944 showLoaderOnConfirm: false, 64945 imageUrl: null, 64946 imageWidth: null, 64947 imageHeight: null, 64948 imageClass: null, 64949 timer: null, 64950 width: 500, 64951 padding: 20, 64952 background: '#fff', 64953 input: null, 64954 inputPlaceholder: '', 64955 inputValue: '', 64956 inputOptions: {}, 64957 inputAutoTrim: true, 64958 inputClass: null, 64959 inputAttributes: {}, 64960 inputValidator: null, 64961 progressSteps: [], 64962 currentProgressStep: null, 64963 progressStepsDistance: '40px', 64964 onOpen: null, 64965 onClose: null, 64966 useRejections: true 64967}; 64968 64969var swalPrefix = 'swal2-'; 64970 64971var prefix = function prefix(items) { 64972 var result = {}; 64973 for (var i in items) { 64974 result[items[i]] = swalPrefix + items[i]; 64975 } 64976 return result; 64977}; 64978 64979var swalClasses = prefix(['container', 'shown', 'iosfix', 'modal', 'overlay', 'fade', 'show', 'hide', 'noanimation', 'close', 'title', 'content', 'buttonswrapper', 'confirm', 'cancel', 'icon', 'image', 'input', 'file', 'range', 'select', 'radio', 'checkbox', 'textarea', 'inputerror', 'validationerror', 'progresssteps', 'activeprogressstep', 'progresscircle', 'progressline', 'loading', 'styled']); 64980 64981var iconTypes = prefix(['success', 'warning', 'info', 'question', 'error']); 64982 64983/* 64984 * Set hover, active and focus-states for buttons (source: http://www.sitepoint.com/javascript-generate-lighter-darker-color) 64985 */ 64986var colorLuminance = function colorLuminance(hex, lum) { 64987 // Validate hex string 64988 hex = String(hex).replace(/[^0-9a-f]/gi, ''); 64989 if (hex.length < 6) { 64990 hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2]; 64991 } 64992 lum = lum || 0; 64993 64994 // Convert to decimal and change luminosity 64995 var rgb = '#'; 64996 for (var i = 0; i < 3; i++) { 64997 var c = parseInt(hex.substr(i * 2, 2), 16); 64998 c = Math.round(Math.min(Math.max(0, c + c * lum), 255)).toString(16); 64999 rgb += ('00' + c).substr(c.length); 65000 } 65001 65002 return rgb; 65003}; 65004 65005var uniqueArray = function uniqueArray(arr) { 65006 var result = []; 65007 for (var i in arr) { 65008 if (result.indexOf(arr[i]) === -1) { 65009 result.push(arr[i]); 65010 } 65011 } 65012 return result; 65013}; 65014 65015/* global MouseEvent */ 65016 65017// Remember state in cases where opening and handling a modal will fiddle with it. 65018var states = { 65019 previousWindowKeyDown: null, 65020 previousActiveElement: null, 65021 previousBodyPadding: null 65022 65023 /* 65024 * Add modal + overlay to DOM 65025 */ 65026};var init = function init(params) { 65027 // Clean up the old modal if it exists 65028 var c = getContainer(); 65029 if (c) { 65030 c.parentNode.removeChild(c); 65031 } 65032 65033 if (typeof document === 'undefined') { 65034 console.error('SweetAlert2 requires document to initialize'); 65035 return; 65036 } 65037 65038 var container = document.createElement('div'); 65039 container.className = swalClasses.container; 65040 container.innerHTML = sweetHTML; 65041 65042 var targetElement = typeof params.target === 'string' ? document.querySelector(params.target) : params.target; 65043 targetElement.appendChild(container); 65044 65045 var modal = getModal(); 65046 var input = getChildByClass(modal, swalClasses.input); 65047 var file = getChildByClass(modal, swalClasses.file); 65048 var range = modal.querySelector('.' + swalClasses.range + ' input'); 65049 var rangeOutput = modal.querySelector('.' + swalClasses.range + ' output'); 65050 var select = getChildByClass(modal, swalClasses.select); 65051 var checkbox = modal.querySelector('.' + swalClasses.checkbox + ' input'); 65052 var textarea = getChildByClass(modal, swalClasses.textarea); 65053 65054 input.oninput = function () { 65055 sweetAlert.resetValidationError(); 65056 }; 65057 65058 input.onkeydown = function (event) { 65059 setTimeout(function () { 65060 if (event.keyCode === 13 && params.allowEnterKey) { 65061 event.stopPropagation(); 65062 sweetAlert.clickConfirm(); 65063 } 65064 }, 0); 65065 }; 65066 65067 file.onchange = function () { 65068 sweetAlert.resetValidationError(); 65069 }; 65070 65071 range.oninput = function () { 65072 sweetAlert.resetValidationError(); 65073 rangeOutput.value = range.value; 65074 }; 65075 65076 range.onchange = function () { 65077 sweetAlert.resetValidationError(); 65078 range.previousSibling.value = range.value; 65079 }; 65080 65081 select.onchange = function () { 65082 sweetAlert.resetValidationError(); 65083 }; 65084 65085 checkbox.onchange = function () { 65086 sweetAlert.resetValidationError(); 65087 }; 65088 65089 textarea.oninput = function () { 65090 sweetAlert.resetValidationError(); 65091 }; 65092 65093 return modal; 65094}; 65095 65096/* 65097 * Manipulate DOM 65098 */ 65099 65100var sweetHTML = ('\n <div role="dialog" aria-labelledby="' + swalClasses.title + '" aria-describedby="' + swalClasses.content + '" class="' + swalClasses.modal + '" tabindex="-1">\n <ul class="' + swalClasses.progresssteps + '"></ul>\n <div class="' + swalClasses.icon + ' ' + iconTypes.error + '">\n <span class="swal2-x-mark"><span class="swal2-x-mark-line-left"></span><span class="swal2-x-mark-line-right"></span></span>\n </div>\n <div class="' + swalClasses.icon + ' ' + iconTypes.question + '">?</div>\n <div class="' + swalClasses.icon + ' ' + iconTypes.warning + '">!</div>\n <div class="' + swalClasses.icon + ' ' + iconTypes.info + '">i</div>\n <div class="' + swalClasses.icon + ' ' + iconTypes.success + '">\n <div class="swal2-success-circular-line-left"></div>\n <span class="swal2-success-line-tip"></span> <span class="swal2-success-line-long"></span>\n <div class="swal2-success-ring"></div> <div class="swal2-success-fix"></div>\n <div class="swal2-success-circular-line-right"></div>\n </div>\n <img class="' + swalClasses.image + '" />\n <h2 class="' + swalClasses.title + '" id="' + swalClasses.title + '"></h2>\n <div id="' + swalClasses.content + '" class="' + swalClasses.content + '"></div>\n <input class="' + swalClasses.input + '" />\n <input type="file" class="' + swalClasses.file + '" />\n <div class="' + swalClasses.range + '">\n <output></output>\n <input type="range" />\n </div>\n <select class="' + swalClasses.select + '"></select>\n <div class="' + swalClasses.radio + '"></div>\n <label for="' + swalClasses.checkbox + '" class="' + swalClasses.checkbox + '">\n <input type="checkbox" />\n </label>\n <textarea class="' + swalClasses.textarea + '"></textarea>\n <div class="' + swalClasses.validationerror + '"></div>\n <div class="' + swalClasses.buttonswrapper + '">\n <button type="button" class="' + swalClasses.confirm + '">OK</button>\n <button type="button" class="' + swalClasses.cancel + '">Cancel</button>\n </div>\n <button type="button" class="' + swalClasses.close + '" aria-label="Close this dialog">\xD7</button>\n </div>\n').replace(/(^|\n)\s*/g, ''); 65101 65102var getContainer = function getContainer() { 65103 return document.body.querySelector('.' + swalClasses.container); 65104};
65105 65106var getModal = function getModal() { 65107 return getContainer() ? getContainer().querySelector('.' + swalClasses.modal) : null; 65108}; 65109 65110var getIcons = function getIcons() { 65111 var modal = getModal(); 65112 return modal.querySelectorAll('.' + swalClasses.icon); 65113}; 65114 65115var elementByClass = function elementByClass(className) { 65116 return getContainer() ? getContainer().querySelector('.' + className) : null; 65117}; 65118 65119var getTitle = function getTitle() { 65120 return elementByClass(swalClasses.title); 65121}; 65122 65123var getContent = function getContent() { 65124 return elementByClass(swalClasses.content); 65125}; 65126 65127var getImage = function getImage() { 65128 return elementByClass(swalClasses.image); 65129}; 65130 65131var getButtonsWrapper = function getButtonsWrapper() { 65132 return elementByClass(swalClasses.buttonswrapper); 65133}; 65134 65135var getProgressSteps = function getProgressSteps() { 65136 return elementByClass(swalClasses.progresssteps); 65137}; 65138 65139var getValidationError = function getValidationError() { 65140 return elementByClass(swalClasses.validationerror); 65141}; 65142 65143var getConfirmButton = function getConfirmButton() { 65144 return elementByClass(swalClasses.confirm); 65145}; 65146 65147var getCancelButton = function getCancelButton() { 65148 return elementByClass(swalClasses.cancel); 65149}; 65150 65151var getCloseButton = function getCloseButton() { 65152 return elementByClass(swalClasses.close); 65153}; 65154 65155var getFocusableElements = function getFocusableElements(focusCancel) { 65156 var buttons = [getConfirmButton(), getCancelButton()]; 65157 if (focusCancel) { 65158 buttons.reverse(); 65159 } 65160 var focusableElements = buttons.concat(Array.prototype.slice.call(getModal().querySelectorAll('button, input:not([type=hidden]), textarea, select, a, *[tabindex]:not([tabindex="-1"])'))); 65161 return uniqueArray(focusableElements); 65162}; 65163 65164var hasClass = function hasClass(elem, className) { 65165 if (elem.classList) { 65166 return elem.classList.contains(className); 65167 } 65168 return false; 65169}; 65170 65171var focusInput = function focusInput(input) { 65172 input.focus(); 65173 65174 // place cursor at end of text in text input 65175 if (input.type !== 'file') { 65176 // http://stackoverflow.com/a/2345915/1331425 65177 var val = input.value; 65178 input.value = ''; 65179 input.value = val; 65180 } 65181}; 65182 65183var addClass = function addClass(elem, className) { 65184 if (!elem || !className) { 65185 return; 65186 } 65187 var classes = className.split(/\s+/).filter(Boolean); 65188 classes.forEach(function (className) { 65189 elem.classList.add(className); 65190 }); 65191}; 65192 65193var removeClass = function removeClass(elem, className) { 65194 if (!elem || !className) { 65195 return; 65196 } 65197 var classes = className.split(/\s+/).filter(Boolean); 65198 classes.forEach(function (className) { 65199 elem.classList.remove(className); 65200 }); 65201}; 65202 65203var getChildByClass = function getChildByClass(elem, className) { 65204 for (var i = 0; i < elem.childNodes.length; i++) { 65205 if (hasClass(elem.childNodes[i], className)) { 65206 return elem.childNodes[i]; 65207 } 65208 } 65209}; 65210 65211var show = function show(elem, display) { 65212 if (!display) { 65213 display = 'block'; 65214 } 65215 elem.style.opacity = ''; 65216 elem.style.display = display; 65217}; 65218 65219var hide = function hide(elem) { 65220 elem.style.opacity = ''; 65221 elem.style.display = 'none'; 65222}; 65223 65224var empty = function empty(elem) { 65225 while (elem.firstChild) { 65226 elem.removeChild(elem.firstChild); 65227 } 65228}; 65229 65230// borrowed from jqeury $(elem).is(':visible') implementation 65231var isVisible = function isVisible(elem) { 65232 return elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length; 65233}; 65234 65235var removeStyleProperty = function removeStyleProperty(elem, property) { 65236 if (elem.style.removeProperty) { 65237 elem.style.removeProperty(property); 65238 } else { 65239 elem.style.removeAttribute(property); 65240 } 65241}; 65242 65243var fireClick = function fireClick(node) { 65244 if (!isVisible(node)) { 65245 return false; 65246 } 65247 65248 // Taken from http://www.nonobtrusive.com/2011/11/29/programatically-fire-crossbrowser-click-event-with-javascript/ 65249 // Then fixed for today's Chrome browser. 65250 if (typeof MouseEvent === 'function') { 65251 // Up-to-date approach 65252 var mevt = new MouseEvent('click', { 65253 view: window, 65254 bubbles: false, 65255 cancelable: true 65256 });
65257 node.dispatchEvent(mevt); 65258 } else if (document.createEvent) { 65259 // Fallback 65260 var evt = document.createEvent('MouseEvents'); 65261 evt.initEvent('click', false, false); 65262 node.dispatchEvent(evt); 65263 } else if (document.createEventObject) { 65264 node.fireEvent('onclick'); 65265 } else if (typeof node.onclick === 'function') { 65266 node.onclick(); 65267 } 65268}; 65269 65270var animationEndEvent = function () { 65271 var testEl = document.createElement('div'); 65272 var transEndEventNames = { 65273 'WebkitAnimation': 'webkitAnimationEnd', 65274 'OAnimation': 'oAnimationEnd oanimationend', 65275 'msAnimation': 'MSAnimationEnd', 65276 'animation': 'animationend' 65277 }; 65278 for (var i in transEndEventNames) { 65279 if (transEndEventNames.hasOwnProperty(i) && testEl.style[i] !== undefined) { 65280 return transEndEventNames[i]; 65281 } 65282 } 65283 65284 return false; 65285}(); 65286 65287// Reset previous window keydown handler and focued element 65288var resetPrevState = function resetPrevState() { 65289 window.onkeydown = states.previousWindowKeyDown; 65290 if (states.previousActiveElement && states.previousActiveElement.focus) { 65291 var x = window.scrollX; 65292 var y = window.scrollY; 65293 states.previousActiveElement.focus(); 65294 if (x && y) { 65295 // IE has no scrollX/scrollY support 65296 window.scrollTo(x, y); 65297 } 65298 } 65299}; 65300 65301// Measure width of scrollbar 65302// https://github.com/twbs/bootstrap/blob/master/js/modal.js#L279-L286 65303var measureScrollbar = function measureScrollbar() { 65304 var supportsTouch = 'ontouchstart' in window || navigator.msMaxTouchPoints; 65305 if (supportsTouch) { 65306 return 0; 65307 } 65308 var scrollDiv = document.createElement('div'); 65309 scrollDiv.style.width = '50px'; 65310 scrollDiv.style.height = '50px'; 65311 scrollDiv.style.overflow = 'scroll'; 65312 document.body.appendChild(scrollDiv); 65313 var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth; 65314 document.body.removeChild(scrollDiv); 65315 return scrollbarWidth; 65316}; 65317 65318// JavaScript Debounce Function 65319// Simplivied version of https://davidwalsh.name/javascript-debounce-function 65320var debounce = function debounce(func, wait) { 65321 var timeout = void 0; 65322 return function () { 65323 var later = function later() { 65324 timeout = null; 65325 func(); 65326 }; 65327 clearTimeout(timeout); 65328 timeout = setTimeout(later, wait); 65329 }; 65330}; 65331 65332var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { 65333 return typeof obj; 65334} : function (obj) { 65335 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; 65336}; 65337 65338 65339 65340 65341 65342 65343 65344 65345 65346 65347 65348 65349 65350 65351 65352 65353 65354 65355 65356 65357 65358var _extends = Object.assign || function (target) { 65359 for (var i = 1; i < arguments.length; i++) { 65360 var source = arguments[i]; 65361 65362 for (var key in source) { 65363 if (Object.prototype.hasOwnProperty.call(source, key)) { 65364 target[key] = source[key]; 65365 } 65366 } 65367 } 65368 65369 return target; 65370}; 65371 65372var modalParams = _extends({}, defaultParams); 65373var queue = []; 65374var swal2Observer = void 0; 65375 65376/* 65377 * Set type, text and actions on modal 65378 */ 65379var setParameters = function setParameters(params) { 65380 // If a custom element is set, determine if it is valid 65381 if (typeof params.target === 'string' && !document.querySelector(params.target) || typeof params.target !== 'string' && !params.target.appendChild) { 65382 console.warn('SweetAlert2: Target parameter is not valid, defaulting to "body"'); 65383 params.target = 'body'; 65384 } 65385 65386 var modal = void 0; 65387 var oldModal = getModal(); 65388 var targetElement = typeof params.target === 'string' ? document.querySelector(params.target) : params.target; 65389 // If the model target has changed, refresh the modal 65390 if (oldModal && targetElement && oldModal.parentNode !== targetElement.parentNode) { 65391 modal = init(params); 65392 } else { 65393 modal = oldModal || init(params); 65394 } 65395 65396 for (var param in params) { 65397 if (!defaultParams.hasOwnProperty(param) && param !== 'extraParams') { 65398 console.warn('SweetAlert2: Unknown parameter "' + param + '"'); 65399 } 65400 } 65401 65402 // Set modal width 65403 modal.style.width = typeof params.width === 'number' ? params.width + 'px' : params.width; 65404 65405 modal.style.padding = params.padding + 'px'; 65406 modal.style.background = params.background; 65407 var successIconParts = modal.querySelectorAll('[class^=swal2-success-circular-line], .swal2-success-fix'); 65408 for (var i = 0; i < successIconParts.length; i++) { 65409 successIconParts[i].style.background = params.background; 65410 } 65411 65412 var title = getTitle(); 65413 var content = getContent(); 65414 var buttonsWrapper = getButtonsWrapper(); 65415 var confirmButton = getConfirmButton(); 65416 var cancelButton = getCancelButton(); 65417 var closeButton = getCloseButton(); 65418 65419 // Title 65420 if (params.titleText) { 65421 title.innerText = params.titleText; 65422 } else { 65423 title.innerHTML = params.title.split('\n').join('<br />'); 65424 } 65425 65426 // Content 65427 if (params.text || params.html) { 65428 if (_typeof(params.html) === 'object') { 65429 content.innerHTML = ''; 65430 if (0 in params.html) { 65431 for (var _i = 0; _i in params.html; _i++) { 65432 content.appendChild(params.html[_i].cloneNode(true)); 65433 } 65434 } else { 65435 content.appendChild(params.html.cloneNode(true)); 65436 } 65437 } else if (params.html) { 65438 content.innerHTML = params.html; 65439 } else if (params.text) { 65440 content.textContent = params.text; 65441 } 65442 show(content); 65443 } else { 65444 hide(content); 65445 } 65446 65447 // Close button 65448 if (params.showCloseButton) { 65449 show(closeButton); 65450 } else { 65451 hide(closeButton); 65452 } 65453 65454 // Custom Class 65455 modal.className = swalClasses.modal; 65456 if (params.customClass) { 65457 addClass(modal, params.customClass); 65458 } 65459 65460 // Progress steps 65461 var progressStepsContainer = getProgressSteps(); 65462 var currentProgressStep = parseInt(params.currentProgressStep === null ? sweetAlert.getQueueStep() : params.currentProgressStep, 10); 65463 if (params.progressSteps.length) { 65464 show(progressStepsContainer); 65465 empty(progressStepsContainer); 65466 if (currentProgressStep >= params.progressSteps.length) { 65467 console.warn('SweetAlert2: Invalid currentProgressStep parameter, it should be less than progressSteps.length ' + '(currentProgressStep like JS arrays starts from 0)'); 65468 } 65469 params.progressSteps.forEach(function (step, index) { 65470 var circle = document.createElement('li'); 65471 addClass(circle, swalClasses.progresscircle); 65472 circle.innerHTML = step; 65473 if (index === currentProgressStep) { 65474 addClass(circle, swalClasses.activeprogressstep); 65475 } 65476 progressStepsContainer.appendChild(circle); 65477 if (index !== params.progressSteps.length - 1) { 65478 var line = document.createElement('li'); 65479 addClass(line, swalClasses.progressline); 65480 line.style.width = params.progressStepsDistance; 65481 progressStepsContainer.appendChild(line); 65482 } 65483 });
65484 } else { 65485 hide(progressStepsContainer); 65486 } 65487 65488 // Icon 65489 var icons = getIcons(); 65490 for (var _i2 = 0; _i2 < icons.length; _i2++) { 65491 hide(icons[_i2]); 65492 } 65493 if (params.type) { 65494 var validType = false; 65495 for (var iconType in iconTypes) { 65496 if (params.type === iconType) { 65497 validType = true; 65498 break; 65499 } 65500 } 65501 if (!validType) { 65502 console.error('SweetAlert2: Unknown alert type: ' + params.type); 65503 return false; 65504 } 65505 var icon = modal.querySelector('.' + swalClasses.icon + '.' + iconTypes[params.type]); 65506 show(icon); 65507 65508 // Animate icon 65509 if (params.animation) { 65510 switch (params.type) { 65511 case 'success': 65512 addClass(icon, 'swal2-animate-success-icon'); 65513 addClass(icon.querySelector('.swal2-success-line-tip'), 'swal2-animate-success-line-tip'); 65514 addClass(icon.querySelector('.swal2-success-line-long'), 'swal2-animate-success-line-long'); 65515 break; 65516 case 'error': 65517 addClass(icon, 'swal2-animate-error-icon'); 65518 addClass(icon.querySelector('.swal2-x-mark'), 'swal2-animate-x-mark'); 65519 break; 65520 default: 65521 break; 65522 } 65523 } 65524 } 65525 65526 // Custom image 65527 var image = getImage(); 65528 if (params.imageUrl) { 65529 image.setAttribute('src', params.imageUrl); 65530 show(image); 65531 65532 if (params.imageWidth) { 65533 image.setAttribute('width', params.imageWidth); 65534 } else { 65535 image.removeAttribute('width'); 65536 } 65537 65538 if (params.imageHeight) { 65539 image.setAttribute('height', params.imageHeight); 65540 } else { 65541 image.removeAttribute('height'); 65542 } 65543 65544 image.className = swalClasses.image; 65545 if (params.imageClass) { 65546 addClass(image, params.imageClass); 65547 } 65548 } else { 65549 hide(image); 65550 } 65551 65552 // Cancel button 65553 if (params.showCancelButton) { 65554 cancelButton.style.display = 'inline-block'; 65555 } else { 65556 hide(cancelButton); 65557 } 65558 65559 // Confirm button 65560 if (params.showConfirmButton) { 65561 removeStyleProperty(confirmButton, 'display'); 65562 } else { 65563 hide(confirmButton); 65564 } 65565 65566 // Buttons wrapper 65567 if (!params.showConfirmButton && !params.showCancelButton) { 65568 hide(buttonsWrapper); 65569 } else { 65570 show(buttonsWrapper); 65571 } 65572 65573 // Edit text on cancel and confirm buttons 65574 confirmButton.innerHTML = params.confirmButtonText; 65575 cancelButton.innerHTML = params.cancelButtonText; 65576 65577 // Set buttons to selected background colors 65578 if (params.buttonsStyling) { 65579 confirmButton.style.backgroundColor = params.confirmButtonColor; 65580 cancelButton.style.backgroundColor = params.cancelButtonColor; 65581 } 65582 65583 // Add buttons custom classes 65584 confirmButton.className = swalClasses.confirm; 65585 addClass(confirmButton, params.confirmButtonClass); 65586 cancelButton.className = swalClasses.cancel; 65587 addClass(cancelButton, params.cancelButtonClass); 65588 65589 // Buttons styling 65590 if (params.buttonsStyling) { 65591 addClass(confirmButton, swalClasses.styled); 65592 addClass(cancelButton, swalClasses.styled); 65593 } else { 65594 removeClass(confirmButton, swalClasses.styled); 65595 removeClass(cancelButton, swalClasses.styled); 65596 65597 confirmButton.style.backgroundColor = confirmButton.style.borderLeftColor = confirmButton.style.borderRightColor = ''; 65598 cancelButton.style.backgroundColor = cancelButton.style.borderLeftColor = cancelButton.style.borderRightColor = ''; 65599 } 65600 65601 // CSS animation 65602 if (params.animation === true) { 65603 removeClass(modal, swalClasses.noanimation); 65604 } else { 65605 addClass(modal, swalClasses.noanimation); 65606 } 65607}; 65608 65609/* 65610 * Animations 65611 */ 65612var openModal = function openModal(animation, onComplete) { 65613 var container = getContainer(); 65614 var modal = getModal(); 65615 65616 if (animation) { 65617 addClass(modal, swalClasses.show); 65618 addClass(container, swalClasses.fade); 65619 removeClass(modal, swalClasses.hide); 65620 } else { 65621 removeClass(modal, swalClasses.fade); 65622 } 65623 show(modal); 65624 65625 // scrolling is 'hidden' until animation is done, after that 'auto' 65626 container.style.overflowY = 'hidden'; 65627 if (animationEndEvent && !hasClass(modal, swalClasses.noanimation)) { 65628 modal.addEventListener(animationEndEvent, function swalCloseEventFinished() { 65629 modal.removeEventListener(animationEndEvent, swalCloseEventFinished); 65630 container.style.overflowY = 'auto'; 65631 });
65632 } else { 65633 container.style.overflowY = 'auto'; 65634 } 65635 65636 addClass(document.documentElement, swalClasses.shown); 65637 addClass(document.body, swalClasses.shown); 65638 addClass(container, swalClasses.shown); 65639 fixScrollbar(); 65640 iOSfix(); 65641 states.previousActiveElement = document.activeElement; 65642 if (onComplete !== null && typeof onComplete === 'function') { 65643 setTimeout(function () { 65644 onComplete(modal); 65645 }); 65646 } 65647}; 65648 65649var fixScrollbar = function fixScrollbar() { 65650 // for queues, do not do this more than once 65651 if (states.previousBodyPadding !== null) { 65652 return; 65653 } 65654 // if the body has overflow 65655 if (document.body.scrollHeight > window.innerHeight) { 65656 // add padding so the content doesn't shift after removal of scrollbar 65657 states.previousBodyPadding = document.body.style.paddingRight; 65658 document.body.style.paddingRight = measureScrollbar() + 'px'; 65659 } 65660}; 65661 65662var undoScrollbar = function undoScrollbar() { 65663 if (states.previousBodyPadding !== null) { 65664 document.body.style.paddingRight = states.previousBodyPadding; 65665 states.previousBodyPadding = null; 65666 } 65667}; 65668 65669// Fix iOS scrolling http://stackoverflow.com/q/39626302/1331425 65670var iOSfix = function iOSfix() { 65671 var iOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream; 65672 if (iOS && !hasClass(document.body, swalClasses.iosfix)) { 65673 var offset = document.body.scrollTop; 65674 document.body.style.top = offset * -1 + 'px'; 65675 addClass(document.body, swalClasses.iosfix); 65676 } 65677}; 65678 65679var undoIOSfix = function undoIOSfix() { 65680 if (hasClass(document.body, swalClasses.iosfix)) { 65681 var offset = parseInt(document.body.style.top, 10); 65682 removeClass(document.body, swalClasses.iosfix); 65683 document.body.style.top = ''; 65684 document.body.scrollTop = offset * -1; 65685 } 65686}; 65687 65688// SweetAlert entry point 65689var sweetAlert = function sweetAlert() { 65690 for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { 65691 args[_key] = arguments[_key]; 65692 } 65693 65694 if (args[0] === undefined) { 65695 console.error('SweetAlert2 expects at least 1 attribute!'); 65696 return false; 65697 } 65698 65699 var params = _extends({}, modalParams); 65700 65701 switch (_typeof(args[0])) { 65702 case 'string': 65703 params.title = args[0]; 65704 params.html = args[1]; 65705 params.type = args[2]; 65706 65707 break; 65708 65709 case 'object': 65710 _extends(params, args[0]); 65711 params.extraParams = args[0].extraParams; 65712 65713 if (params.input === 'email' && params.inputValidator === null) { 65714 params.inputValidator = function (email) { 65715 return new Promise(function (resolve, reject) { 65716 var emailRegex = /^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/; 65717 if (emailRegex.test(email)) { 65718 resolve(); 65719 } else { 65720 reject('Invalid email address'); 65721 } 65722 }); 65723 }; 65724 } 65725 65726 if (params.input === 'url' && params.inputValidator === null) { 65727 params.inputValidator = function (url) { 65728 return new Promise(function (resolve, reject) { 65729 // taken from https://stackoverflow.com/a/3809435/1331425 65730 var urlRegex = /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_+.~#?&//=]*)$/; 65731 if (urlRegex.test(url)) { 65732 resolve(); 65733 } else { 65734 reject('Invalid URL'); 65735 } 65736 }); 65737 }; 65738 } 65739 break; 65740 65741 default: 65742 console.error('SweetAlert2: Unexpected type of argument! Expected "string" or "object", got ' + _typeof(args[0])); 65743 return false; 65744 } 65745 65746 setParameters(params); 65747 65748 var container = getContainer(); 65749 var modal = getModal(); 65750 65751 return new Promise(function (resolve, reject) { 65752 // Close on timer 65753 if (params.timer) { 65754 modal.timeout = setTimeout(function () { 65755 sweetAlert.closeModal(params.onClose); 65756 if (params.useRejections) { 65757 reject('timer'); 65758 } else { 65759 resolve({ dismiss: 'timer' }); 65760 } 65761 }, params.timer); 65762 } 65763 65764 // Get input element by specified type or, if type isn't specified, by params.input 65765 var getInput = function getInput(inputType) { 65766 inputType = inputType || params.input; 65767 if (!inputType) { 65768 return null; 65769 } 65770 switch (inputType) { 65771 case 'select': 65772 case 'textarea': 65773 case 'file': 65774 return getChildByClass(modal, swalClasses[inputType]); 65775 case 'checkbox': 65776 return modal.querySelector('.' + swalClasses.checkbox + ' input'); 65777 case 'radio': 65778 return modal.querySelector('.' + swalClasses.radio + ' input:checked') || modal.querySelector('.' + swalClasses.radio + ' input:first-child'); 65779 case 'range': 65780 return modal.querySelector('.' + swalClasses.range + ' input'); 65781 default: 65782 return getChildByClass(modal, swalClasses.input); 65783 } 65784 }; 65785 65786 // Get the value of the modal input 65787 var getInputValue = function getInputValue() { 65788 var input = getInput(); 65789 if (!input) { 65790 return null; 65791 } 65792 switch (params.input) { 65793 case 'checkbox': 65794 return input.checked ? 1 : 0; 65795 case 'radio': 65796 return input.checked ? input.value : null; 65797 case 'file': 65798 return input.files.length ? input.files[0] : null; 65799 default: 65800 return params.inputAutoTrim ? input.value.trim() : input.value; 65801 } 65802 }; 65803 65804 // input autofocus 65805 if (params.input) { 65806 setTimeout(function () { 65807 var input = getInput(); 65808 if (input) { 65809 focusInput(input); 65810 } 65811 }, 0); 65812 } 65813 65814 var confirm = function confirm(value) { 65815 if (params.showLoaderOnConfirm) { 65816 sweetAlert.showLoading(); 65817 } 65818 65819 if (params.preConfirm) { 65820 params.preConfirm(value, params.extraParams).then(function (preConfirmValue) { 65821 sweetAlert.closeModal(params.onClose); 65822 resolve(preConfirmValue || value); 65823 }, function (error) { 65824 sweetAlert.hideLoading(); 65825 if (error) { 65826 sweetAlert.showValidationError(error); 65827 } 65828 }); 65829 } else { 65830 sweetAlert.closeModal(params.onClose); 65831 if (params.useRejections) { 65832 resolve(value); 65833 } else { 65834 resolve({ value: value });
65835 } 65836 } 65837 }; 65838 65839 // Mouse interactions 65840 var onButtonEvent = function onButtonEvent(event) { 65841 var e = event || window.event; 65842 var target = e.target || e.srcElement; 65843 var confirmButton = getConfirmButton(); 65844 var cancelButton = getCancelButton(); 65845 var targetedConfirm = confirmButton && (confirmButton === target || confirmButton.contains(target)); 65846 var targetedCancel = cancelButton && (cancelButton === target || cancelButton.contains(target)); 65847 65848 switch (e.type) { 65849 case 'mouseover': 65850 case 'mouseup': 65851 if (params.buttonsStyling) { 65852 if (targetedConfirm) { 65853 confirmButton.style.backgroundColor = colorLuminance(params.confirmButtonColor, -0.1); 65854 } else if (targetedCancel) { 65855 cancelButton.style.backgroundColor = colorLuminance(params.cancelButtonColor, -0.1); 65856 } 65857 } 65858 break; 65859 case 'mouseout': 65860 if (params.buttonsStyling) { 65861 if (targetedConfirm) { 65862 confirmButton.style.backgroundColor = params.confirmButtonColor; 65863 } else if (targetedCancel) { 65864 cancelButton.style.backgroundColor = params.cancelButtonColor; 65865 } 65866 } 65867 break; 65868 case 'mousedown': 65869 if (params.buttonsStyling) { 65870 if (targetedConfirm) { 65871 confirmButton.style.backgroundColor = colorLuminance(params.confirmButtonColor, -0.2); 65872 } else if (targetedCancel) { 65873 cancelButton.style.backgroundColor = colorLuminance(params.cancelButtonColor, -0.2); 65874 } 65875 } 65876 break; 65877 case 'click': 65878 // Clicked 'confirm' 65879 if (targetedConfirm && sweetAlert.isVisible()) { 65880 sweetAlert.disableButtons(); 65881 if (params.input) { 65882 var inputValue = getInputValue(); 65883 65884 if (params.inputValidator) { 65885 sweetAlert.disableInput(); 65886 params.inputValidator(inputValue, params.extraParams).then(function () { 65887 sweetAlert.enableButtons(); 65888 sweetAlert.enableInput(); 65889 confirm(inputValue); 65890 }, function (error) { 65891 sweetAlert.enableButtons(); 65892 sweetAlert.enableInput(); 65893 if (error) { 65894 sweetAlert.showValidationError(error); 65895 } 65896 }); 65897 } else { 65898 confirm(inputValue); 65899 } 65900 } else { 65901 confirm(true); 65902 } 65903 65904 // Clicked 'cancel' 65905 } else if (targetedCancel && sweetAlert.isVisible()) { 65906 sweetAlert.disableButtons(); 65907 sweetAlert.closeModal(params.onClose); 65908 if (params.useRejections) { 65909 reject('cancel'); 65910 } else { 65911 resolve({ dismiss: 'cancel' }); 65912 } 65913 } 65914 break; 65915 default: 65916 } 65917 }; 65918 65919 var buttons = modal.querySelectorAll('button'); 65920 for (var i = 0; i < buttons.length; i++) { 65921 buttons[i].onclick = onButtonEvent; 65922 buttons[i].onmouseover = onButtonEvent; 65923 buttons[i].onmouseout = onButtonEvent; 65924 buttons[i].onmousedown = onButtonEvent; 65925 } 65926 65927 // Closing modal by close button 65928 getCloseButton().onclick = function () { 65929 sweetAlert.closeModal(params.onClose); 65930 if (params.useRejections) { 65931 reject('close'); 65932 } else { 65933 resolve({ dismiss: 'close' }); 65934 } 65935 }; 65936 65937 // Closing modal by overlay click 65938 container.onclick = function (e) { 65939 if (e.target !== container) { 65940 return; 65941 } 65942 if (params.allowOutsideClick) { 65943 sweetAlert.closeModal(params.onClose); 65944 if (params.useRejections) { 65945 reject('overlay'); 65946 } else { 65947 resolve({ dismiss: 'overlay' }); 65948 } 65949 } 65950 }; 65951 65952 var buttonsWrapper = getButtonsWrapper(); 65953 var confirmButton = getConfirmButton(); 65954 var cancelButton = getCancelButton(); 65955 65956 // Reverse buttons (Confirm on the right side) 65957 if (params.reverseButtons) { 65958 confirmButton.parentNode.insertBefore(cancelButton, confirmButton); 65959 } else { 65960 confirmButton.parentNode.insertBefore(confirmButton, cancelButton); 65961 } 65962 65963 // Focus handling 65964 var setFocus = function setFocus(index, increment) { 65965 var focusableElements = getFocusableElements(params.focusCancel); 65966 // search for visible elements and select the next possible match 65967 for (var _i3 = 0; _i3 < focusableElements.length; _i3++) { 65968 index = index + increment; 65969 65970 // rollover to first item 65971 if (index === focusableElements.length) { 65972 index = 0; 65973 65974 // go to last item 65975 } else if (index === -1) { 65976 index = focusableElements.length - 1; 65977 } 65978 65979 // determine if element is visible 65980 var el = focusableElements[index]; 65981 if (isVisible(el)) { 65982 return el.focus(); 65983 } 65984 } 65985 }; 65986 65987 var handleKeyDown = function handleKeyDown(event) { 65988 var e = event || window.event; 65989 var keyCode = e.keyCode || e.which; 65990 65991 if ([9, 13, 32, 27, 37, 38, 39, 40].indexOf(keyCode) === -1) { 65992 // Don't do work on keys we don't care about. 65993 return; 65994 } 65995 65996 var targetElement = e.target || e.srcElement; 65997 65998 var focusableElements = getFocusableElements(params.focusCancel); 65999 var btnIndex = -1; // Find the button - note, this is a nodelist, not an array. 66000 for (var _i4 = 0;
66000 _i4 < focusableElements.length; _i4++) { 66001 if (targetElement === focusableElements[_i4]) { 66002 btnIndex = _i4; 66003 break; 66004 } 66005 } 66006 66007 // TAB 66008 if (keyCode === 9) { 66009 if (!e.shiftKey) { 66010 // Cycle to the next button 66011 setFocus(btnIndex, 1); 66012 } else { 66013 // Cycle to the prev button 66014 setFocus(btnIndex, -1); 66015 } 66016 e.stopPropagation(); 66017 e.preventDefault(); 66018 66019 // ARROWS - switch focus between buttons 66020 } else if (keyCode === 37 || keyCode === 38 || keyCode === 39 || keyCode === 40) { 66021 // focus Cancel button if Confirm button is currently focused 66022 if (document.activeElement === confirmButton && isVisible(cancelButton)) { 66023 cancelButton.focus(); 66024 // and vice versa 66025 } else if (document.activeElement === cancelButton && isVisible(confirmButton)) { 66026 confirmButton.focus(); 66027 } 66028 66029 // ENTER/SPACE 66030 } else if (keyCode === 13 || keyCode === 32) { 66031 if (btnIndex === -1 && params.allowEnterKey) { 66032 // ENTER/SPACE clicked outside of a button. 66033 if (params.focusCancel) { 66034 fireClick(cancelButton, e); 66035 } else { 66036 fireClick(confirmButton, e); 66037 } 66038 e.stopPropagation(); 66039 e.preventDefault(); 66040 } 66041 66042 // ESC 66043 } else if (keyCode === 27 && params.allowEscapeKey === true) { 66044 sweetAlert.closeModal(params.onClose); 66045 if (params.useRejections) { 66046 reject('esc'); 66047 } else { 66048 resolve({ dismiss: 'esc' }); 66049 } 66050 } 66051 }; 66052 66053 if (!window.onkeydown || window.onkeydown.toString() !== handleKeyDown.toString()) { 66054 states.previousWindowKeyDown = window.onkeydown; 66055 window.onkeydown = handleKeyDown; 66056 } 66057 66058 // Loading state 66059 if (params.buttonsStyling) { 66060 confirmButton.style.borderLeftColor = params.confirmButtonColor; 66061 confirmButton.style.borderRightColor = params.confirmButtonColor; 66062 } 66063 66064 /** 66065 * Show spinner instead of Confirm button and disable Cancel button 66066 */ 66067 sweetAlert.hideLoading = sweetAlert.disableLoading = function () { 66068 if (!params.showConfirmButton) { 66069 hide(confirmButton); 66070 if (!params.showCancelButton) { 66071 hide(getButtonsWrapper()); 66072 } 66073 } 66074 removeClass(buttonsWrapper, swalClasses.loading); 66075 removeClass(modal, swalClasses.loading); 66076 confirmButton.disabled = false; 66077 cancelButton.disabled = false; 66078 }; 66079 66080 sweetAlert.getTitle = function () { 66081 return getTitle(); 66082 }; 66083 sweetAlert.getContent = function () { 66084 return getContent(); 66085 }; 66086 sweetAlert.getInput = function () { 66087 return getInput(); 66088 }; 66089 sweetAlert.getImage = function () { 66090 return getImage(); 66091 }; 66092 sweetAlert.getButtonsWrapper = function () { 66093 return getButtonsWrapper(); 66094 }; 66095 sweetAlert.getConfirmButton = function () { 66096 return getConfirmButton(); 66097 }; 66098 sweetAlert.getCancelButton = function () { 66099 return getCancelButton(); 66100 }; 66101 66102 sweetAlert.enableButtons = function () { 66103 confirmButton.disabled = false; 66104 cancelButton.disabled = false; 66105 }; 66106 66107 sweetAlert.disableButtons = function () { 66108 confirmButton.disabled = true; 66109 cancelButton.disabled = true; 66110 }; 66111 66112 sweetAlert.enableConfirmButton = function () { 66113 confirmButton.disabled = false; 66114 }; 66115 66116 sweetAlert.disableConfirmButton = function () { 66117 confirmButton.disabled = true; 66118 }; 66119 66120 sweetAlert.enableInput = function () { 66121 var input = getInput(); 66122 if (!input) { 66123 return false; 66124 } 66125 if (input.type === 'radio') { 66126 var radiosContainer = input.parentNode.parentNode; 66127 var radios = radiosContainer.querySelectorAll('input'); 66128 for (var _i5 = 0; _i5 < radios.length; _i5++) { 66129 radios[_i5].disabled = false; 66130 } 66131 } else { 66132 input.disabled = false; 66133 } 66134 }; 66135 66136 sweetAlert.disableInput = function () { 66137 var input = getInput(); 66138 if (!input) { 66139 return false; 66140 } 66141 if (input && input.type === 'radio') { 66142 var radiosContainer = input.parentNode.parentNode; 66143 var radios = radiosContainer.querySelectorAll('input'); 66144 for (var _i6 = 0; _i6 < radios.length; _i6++) { 66145 radios[_i6].disabled = true; 66146 } 66147 } else { 66148 input.disabled = true; 66149 } 66150 }; 66151 66152 // Set modal min-height to disable scrolling inside the modal 66153 sweetAlert.recalculateHeight = debounce(function () { 66154 var modal = getModal(); 66155 if (!modal) { 66156 return; 66157 } 66158 var prevState = modal.style.display; 66159 modal.style.minHeight = ''; 66160 show(modal); 66161 modal.style.minHeight = modal.scrollHeight + 1 + 'px'; 66162 modal.style.display = prevState; 66163 }, 50); 66164 66165 // Show block with validation error 66166 sweetAlert.showValidationError = function (error) {
66167 var validationError = getValidationError(); 66168 validationError.innerHTML = error; 66169 show(validationError); 66170 66171 var input = getInput(); 66172 if (input) { 66173 focusInput(input); 66174 addClass(input, swalClasses.inputerror); 66175 } 66176 }; 66177 66178 // Hide block with validation error 66179 sweetAlert.resetValidationError = function () { 66180 var validationError = getValidationError(); 66181 hide(validationError); 66182 sweetAlert.recalculateHeight(); 66183 66184 var input = getInput(); 66185 if (input) { 66186 removeClass(input, swalClasses.inputerror); 66187 } 66188 }; 66189 66190 sweetAlert.getProgressSteps = function () { 66191 return params.progressSteps; 66192 }; 66193 66194 sweetAlert.setProgressSteps = function (progressSteps) { 66195 params.progressSteps = progressSteps; 66196 setParameters(params); 66197 }; 66198 66199 sweetAlert.showProgressSteps = function () { 66200 show(getProgressSteps()); 66201 }; 66202 66203 sweetAlert.hideProgressSteps = function () { 66204 hide(getProgressSteps()); 66205 }; 66206 66207 sweetAlert.enableButtons(); 66208 sweetAlert.hideLoading(); 66209 sweetAlert.resetValidationError(); 66210 66211 // inputs 66212 var inputTypes = ['input', 'file', 'range', 'select', 'radio', 'checkbox', 'textarea']; 66213 var input = void 0; 66214 for (var _i7 = 0; _i7 < inputTypes.length; _i7++) { 66215 var inputClass = swalClasses[inputTypes[_i7]]; 66216 var inputContainer = getChildByClass(modal, inputClass); 66217 input = getInput(inputTypes[_i7]); 66218 66219 // set attributes 66220 if (input) { 66221 for (var j in input.attributes) { 66222 if (input.attributes.hasOwnProperty(j)) { 66223 var attrName = input.attributes[j].name; 66224 if (attrName !== 'type' && attrName !== 'value') { 66225 input.removeAttribute(attrName); 66226 } 66227 } 66228 } 66229 for (var attr in params.inputAttributes) { 66230 input.setAttribute(attr, params.inputAttributes[attr]); 66231 } 66232 } 66233 66234 // set class 66235 inputContainer.className = inputClass; 66236 if (params.inputClass) { 66237 addClass(inputContainer, params.inputClass); 66238 } 66239 66240 hide(inputContainer); 66241 } 66242 66243 var populateInputOptions = void 0; 66244 switch (params.input) { 66245 case 'text': 66246 case 'email': 66247 case 'password': 66248 case 'number': 66249 case 'tel': 66250 case 'url': 66251 input = getChildByClass(modal, swalClasses.input); 66252 input.value = params.inputValue; 66253 input.placeholder = params.inputPlaceholder; 66254 input.type = params.input; 66255 show(input); 66256 break; 66257 case 'file': 66258 input = getChildByClass(modal, swalClasses.file); 66259 input.placeholder = params.inputPlaceholder; 66260 input.type = params.input; 66261 show(input); 66262 break; 66263 case 'range': 66264 var range = getChildByClass(modal, swalClasses.range); 66265 var rangeInput = range.querySelector('input'); 66266 var rangeOutput = range.querySelector('output'); 66267 rangeInput.value = params.inputValue; 66268 rangeInput.type = params.input; 66269 rangeOutput.value = params.inputValue; 66270 show(range); 66271 break; 66272 case 'select': 66273 var select = getChildByClass(modal, swalClasses.select); 66274 select.innerHTML = ''; 66275 if (params.inputPlaceholder) { 66276 var placeholder = document.createElement('option'); 66277 placeholder.innerHTML = params.inputPlaceholder; 66278 placeholder.value = ''; 66279 placeholder.disabled = true; 66280 placeholder.selected = true; 66281 select.appendChild(placeholder); 66282 } 66283 populateInputOptions = function populateInputOptions(inputOptions) { 66284 for (var optionValue in inputOptions) { 66285 var option = document.createElement('option'); 66286 option.value = optionValue; 66287 option.innerHTML = inputOptions[optionValue]; 66288 if (params.inputValue === optionValue) { 66289 option.selected = true; 66290 } 66291 select.appendChild(option); 66292 } 66293 show(select); 66294 select.focus(); 66295 }; 66296 break; 66297 case 'radio': 66298 var radio = getChildByClass(modal, swalClasses.radio); 66299 radio.innerHTML = ''; 66300 populateInputOptions = function populateInputOptions(inputOptions) { 66301 for (var radioValue in inputOptions) { 66302 var radioInput = document.createElement('input'); 66303 var radioLabel = document.createElement('label'); 66304 var radioLabelSpan = document.createElement('span'); 66305 radioInput.type = 'radio'; 66306 radioInput.name = swalClasses.radio; 66307 radioInput.value = radioValue; 66308 if (params.inputValue === radioValue) { 66309 radioInput.checked = true; 66310 } 66311 radioLabelSpan.innerHTML = inputOptions[radioValue]; 66312 radioLabel.appendChild(radioInput); 66313 radioLabel.appendChild(radioLabelSpan); 66314 radioLabel.for = radioInput.id; 66315 radio.appendChild(radioLabel); 66316 } 66317 show(radio); 66318 var radios = radio.querySelectorAll('input'); 66319 if (radios.length) { 66320 radios[0].focus(); 66321 } 66322 }; 66323 break; 66324 case 'checkbox': 66325 var checkbox = getChildByClass(modal, swalClasses.checkbox); 66326 var checkboxInput = getInput('checkbox'); 66327 checkboxInput.type = 'checkbox'; 66328 checkboxInput.value = 1; 66329 checkboxInput.id = swalClasses.checkbox; 66330 checkboxInput.checked = Boolean(params.inputValue); 66331 var label = checkbox.getElementsByTagName('span'); 66332 if (label.length) { 66333 checkbox.removeChild(label[0]); 66334 } 66335 label = document.createElement('span'); 66336 label.innerHTML = params.inputPlaceholder; 66337 checkbox.appendChild(label); 66338 show(checkbox); 66339 break; 66340 case 'textarea': 66341 var textarea = getChildByClass(modal, swalClasses.textarea); 66342 textarea.value = params.inputValue; 66343 textarea.placeholder = params.inputPlaceholder; 66344 show(textarea); 66345 break; 66346 case null: 66347 break; 66348 default: 66349 console.error('SweetAlert2: Unexpected type of input! Expected "text", "email", "password", "number", "tel", "select", "radio", "checkbox", "textarea", "file" or "url", got "' + params.input + '"'); 66350 break; 66351 } 66352 66353 if (params.input === 'select' || params.input === 'radio') { 66354 if (params.inputOptions instanceof Promise) { 66355 sweetAlert.showLoading(); 66356 params.inputOptions.then(function (inputOptions) { 66357 sweetAlert.hideLoading(); 66358 populateInputOptions(inputOptions); 66359 }); 66360 } else if (_typeof(params.inputOptions) === 'object') { 66361 populateInputOptions(params.inputOptions); 66362 } else { 66363 console.error('SweetAlert2: Unexpected type of inputOptions! Expected object or Promise, got ' + _typeof(params.inputOptions)); 66364 } 66365 } 66366 66367 openModal(params.animation, params.onOpen); 66368 66369 // Focus the first element (input or button) 66370 if (params.allowEnterKey) { 66371 setFocus(-1, 1); 66372 } else { 66373 if (document.activeElement) { 66374 document.activeElement.blur(); 66375 } 66376 } 66377 66378 // fix scroll 66379 getContainer().scrollTop = 0; 66380 66381 // Observe changes inside the modal and adjust height 66382 if (typeof MutationObserver !== 'undefined' && !swal2Observer) { 66383 swal2Observer = new MutationObserver(sweetAlert.recalculateHeight); 66384 swal2Observer.observe(modal, { childList: true, characterData: true, subtree: true });
66385 } 66386 }); 66387}; 66388 66389/* 66390 * Global function to determine if swal2 modal is shown 66391 */ 66392sweetAlert.isVisible = function () { 66393 return !!getModal(); 66394}; 66395 66396/* 66397 * Global function for chaining sweetAlert modals 66398 */ 66399sweetAlert.queue = function (steps) { 66400 queue = steps; 66401 var resetQueue = function resetQueue() { 66402 queue = []; 66403 document.body.removeAttribute('data-swal2-queue-step'); 66404 }; 66405 var queueResult = []; 66406 return new Promise(function (resolve, reject) { 66407 (function step(i, callback) { 66408 if (i < queue.length) { 66409 document.body.setAttribute('data-swal2-queue-step', i); 66410 66411 sweetAlert(queue[i]).then(function (result) { 66412 queueResult.push(result); 66413 step(i + 1, callback); 66414 }, function (dismiss) { 66415 resetQueue(); 66416 reject(dismiss); 66417 }); 66418 } else { 66419 resetQueue(); 66420 resolve(queueResult); 66421 } 66422 })(0); 66423 }); 66424}; 66425 66426/* 66427 * Global function for getting the index of current modal in queue 66428 */ 66429sweetAlert.getQueueStep = function () { 66430 return document.body.getAttribute('data-swal2-queue-step'); 66431}; 66432 66433/* 66434 * Global function for inserting a modal to the queue 66435 */ 66436sweetAlert.insertQueueStep = function (step, index) { 66437 if (index && index < queue.length) { 66438 return queue.splice(index, 0, step); 66439 } 66440 return queue.push(step); 66441}; 66442 66443/* 66444 * Global function for deleting a modal from the queue 66445 */ 66446sweetAlert.deleteQueueStep = function (index) { 66447 if (typeof queue[index] !== 'undefined') { 66448 queue.splice(index, 1); 66449 } 66450}; 66451 66452/* 66453 * Global function to close sweetAlert 66454 */ 66455sweetAlert.close = sweetAlert.closeModal = function (onComplete) { 66456 var container = getContainer(); 66457 var modal = getModal(); 66458 if (!modal) { 66459 return; 66460 } 66461 removeClass(modal, swalClasses.show); 66462 addClass(modal, swalClasses.hide); 66463 clearTimeout(modal.timeout); 66464 66465 resetPrevState(); 66466 66467 var removeModalAndResetState = function removeModalAndResetState() { 66468 if (container.parentNode) { 66469 container.parentNode.removeChild(container); 66470 } 66471 removeClass(document.documentElement, swalClasses.shown); 66472 removeClass(document.body, swalClasses.shown); 66473 undoScrollbar(); 66474 undoIOSfix(); 66475 }; 66476 66477 // If animation is supported, animate 66478 if (animationEndEvent && !hasClass(modal, swalClasses.noanimation)) { 66479 modal.addEventListener(animationEndEvent, function swalCloseEventFinished() { 66480 modal.removeEventListener(animationEndEvent, swalCloseEventFinished); 66481 if (hasClass(modal, swalClasses.hide)) { 66482 removeModalAndResetState(); 66483 } 66484 }); 66485 } else { 66486 // Otherwise, remove immediately 66487 removeModalAndResetState(); 66488 } 66489 if (onComplete !== null && typeof onComplete === 'function') { 66490 setTimeout(function () { 66491 onComplete(modal); 66492 }); 66493 } 66494}; 66495 66496/* 66497 * Global function to click 'Confirm' button 66498 */ 66499sweetAlert.clickConfirm = function () { 66500 return getConfirmButton().click(); 66501}; 66502 66503/* 66504 * Global function to click 'Cancel' button 66505 */ 66506sweetAlert.clickCancel = function () { 66507 return getCancelButton().click(); 66508}; 66509 66510/** 66511 * Show spinner instead of Confirm button and disable Cancel button 66512 */ 66513sweetAlert.showLoading = sweetAlert.enableLoading = function () { 66514 var modal = getModal(); 66515 if (!modal) { 66516 sweetAlert(''); 66517 } 66518 var buttonsWrapper = getButtonsWrapper(); 66519 var confirmButton = getConfirmButton(); 66520 var cancelButton = getCancelButton(); 66521 66522 show(buttonsWrapper); 66523 show(confirmButton, 'inline-block'); 66524 addClass(buttonsWrapper, swalClasses.loading); 66525 addClass(modal, swalClasses.loading); 66526 confirmButton.disabled = true; 66527 cancelButton.disabled = true; 66528}; 66529 66530/** 66531 * Is valid parameter 66532 * @param {String} paramName 66533 */ 66534sweetAlert.isValidParameter = function (paramName) { 66535 return defaultParams.hasOwnProperty(paramName) || paramName === 'extraParams'; 66536}; 66537 66538/** 66539* Set default params for each popup 66540* @param {Object} userParams 66541*/ 66542sweetAlert.setDefaults = function (userParams) { 66543 if (!userParams || (typeof userParams === 'undefined' ? 'undefined' : _typeof(userParams)) !== 'object') { 66544 return console.error('SweetAlert2: the argument for setDefaults() is required and has to be a object'); 66545 } 66546 66547 for (var param in userParams) { 66548 if (!sweetAlert.isValidParameter(param)) { 66549 console.warn('SweetAlert2: Unknown parameter "' + param + '"'); 66550 delete userParams[param]; 66551 } 66552 } 66553 66554 _extends(modalParams, userParams); 66555}; 66556 66557/** 66558 * Reset default params for each popup 66559 */ 66560sweetAlert.resetDefaults = function () { 66561 modalParams = _extends({}, defaultParams); 66562}; 66563 66564sweetAlert.noop = function () {}; 66565 66566sweetAlert.version = '6.6.8'; 66567 66568sweetAlert.default = sweetAlert; 66569 66570return sweetAlert; 66571 66572}))); 66573if (window.Sweetalert2) window.sweetAlert = window.swal = window.Sweetalert2; 66574; 66575/*! 66576* jquery.inputmask.bundle.js 66577* https://github.com/RobinHerbots/Inputmask 66578* Copyright (c) 2010 - 2017 Robin Herbots 66579* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php) 66580* Version: 4.0.1-31 66581*/ 66582 66583!function(modules) { 66584 function __webpack_require__(moduleId) { 66585 if (installedModules[moduleId]) return installedModules[moduleId].exports; 66586 var module = installedModules[moduleId] = { 66587 i: moduleId, 66588 l: !1, 66589 exports: {} 66590 }; 66591 return modules[moduleId].call(module.exports, module, module.exports, __webpack_require__), 66592 module.l = !0, module.exports; 66593 } 66594 var installedModules = {}; 66595 __webpack_require__.m = modules, __webpack_require__.c = installedModules, __webpack_require__.i = function(value) { 66596 return value; 66597 }, __webpack_require__.d = function(exports, name, getter) { 66598 __webpack_require__.o(exports, name) || Object.defineProperty(exports, name, { 66599 configurable: !1, 66600 enumerable: !0, 66601 get: getter 66602 }); 66603 }, __webpack_require__.n = function(module) {
66604 var getter = module && module.__esModule ? function() { 66605 return module.default; 66606 } : function() { 66607 return module; 66608 }; 66609 return __webpack_require__.d(getter, "a", getter), getter; 66610 }, __webpack_require__.o = function(object, property) { 66611 return Object.prototype.hasOwnProperty.call(object, property); 66612 }, __webpack_require__.p = "", __webpack_require__(__webpack_require__.s = 9); 66613}([ function(module, exports, __webpack_require__) { 66614 "use strict"; 66615 var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__; 66616 "function" == typeof Symbol && Symbol.iterator; 66617 !function(factory) { 66618 __WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(2) ], __WEBPACK_AMD_DEFINE_FACTORY__ = factory, 66619 void 0 !== (__WEBPACK_AMD_DEFINE_RESULT__ = "function" == typeof __WEBPACK_AMD_DEFINE_FACTORY__ ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__) && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__); 66620 }(function($) { 66621 return $; 66622 }); 66623}, function(module, exports, __webpack_require__) { 66624 "use strict"; 66625 var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__, _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj) { 66626 return typeof obj; 66627 } : function(obj) { 66628 return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; 66629 }; 66630 !function(factory) { 66631 __WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(0), __webpack_require__(11), __webpack_require__(10) ], 66632 __WEBPACK_AMD_DEFINE_FACTORY__ = factory, void 0 !== (__WEBPACK_AMD_DEFINE_RESULT__ = "function" == typeof __WEBPACK_AMD_DEFINE_FACTORY__ ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__) && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__); 66633 }(function($, window, document, undefined) { 66634 function Inputmask(alias, options, internal) { 66635 if (!(this instanceof Inputmask)) return new Inputmask(alias, options, internal); 66636 this.el = undefined, this.events = {}, this.maskset = undefined, this.refreshValue = !1, 66637 !0 !== internal && ($.isPlainObject(alias) ? options = alias : (options = options || {}, 66638 options.alias = alias), this.opts = $.extend(!0, {}, this.defaults, options), this.noMasksCache = options && options.definitions !== undefined, 66639 this.userOptions = options || {}, this.isRTL = this.opts.numericInput, resolveAlias(this.opts.alias, options, this.opts)); 66640 } 66641 function resolveAlias(aliasStr, options, opts) { 66642 var aliasDefinition = Inputmask.prototype.aliases[aliasStr]; 66643 return aliasDefinition ? (aliasDefinition.alias && resolveAlias(aliasDefinition.alias, undefined, opts), 66644 $.extend(!0, opts, aliasDefinition), $.extend(!0, opts, options), !0) : (null === opts.mask && (opts.mask = aliasStr), 66645 !1); 66646 } 66647 function generateMaskSet(opts, nocache) { 66648 function generateMask(mask, metadata, opts) { 66649 var regexMask = !1; 66650 if (null !== mask && "" !== mask || (regexMask = null !== opts.regex, regexMask ? (mask = opts.regex, 66651 mask = mask.replace(/^(\^)(.*)(\$)$/, "$2")) : (regexMask = !0, mask = ".*")), 1 === mask.length && !1 === opts.greedy && 0 !== opts.repeat && (opts.placeholder = ""), 66652 opts.repeat > 0 || "*" === opts.repeat || "+" === opts.repeat) { 66653 var repeatStart = "*" === opts.repeat ? 0 : "+" === opts.repeat ? 1 : opts.repeat; 66654 mask = opts.groupmarker.start + mask + opts.groupmarker.end + opts.quantifiermarker.start + repeatStart + "," + opts.repeat + opts.quantifiermarker.end; 66655 } 66656 var masksetDefinition, maskdefKey = regexMask ? "regex_" + opts.regex : opts.numericInput ? mask.split("").reverse().join("") : mask; 66657 return Inputmask.prototype.masksCache[maskdefKey] === undefined || !0 === nocache ? (masksetDefinition = { 66658 mask: mask,
66659 maskToken: Inputmask.prototype.analyseMask(mask, regexMask, opts), 66660 validPositions: {}, 66661 _buffer: undefined, 66662 buffer: undefined, 66663 tests: {}, 66664 metadata: metadata, 66665 maskLength: undefined 66666 }, !0 !== nocache && (Inputmask.prototype.masksCache[maskdefKey] = masksetDefinition, 66667 masksetDefinition = $.extend(!0, {}, Inputmask.prototype.masksCache[maskdefKey]))) : masksetDefinition = $.extend(!0, {}, Inputmask.prototype.masksCache[maskdefKey]), 66668 masksetDefinition; 66669 } 66670 if ($.isFunction(opts.mask) && (opts.mask = opts.mask(opts)), $.isArray(opts.mask)) { 66671 if (opts.mask.length > 1) { 66672 opts.keepStatic = null === opts.keepStatic || opts.keepStatic; 66673 var altMask = opts.groupmarker.start; 66674 return $.each(opts.numericInput ? opts.mask.reverse() : opts.mask, function(ndx, msk) { 66675 altMask.length > 1 && (altMask += opts.groupmarker.end + opts.alternatormarker + opts.groupmarker.start), 66676 msk.mask === undefined || $.isFunction(msk.mask) ? altMask += msk : altMask += msk.mask; 66677 }), altMask += opts.groupmarker.end, generateMask(altMask, opts.mask, opts); 66678 } 66679 opts.mask = opts.mask.pop(); 66680 } 66681 return opts.mask && opts.mask.mask !== undefined && !$.isFunction(opts.mask.mask) ? generateMask(opts.mask.mask, opts.mask, opts) : generateMask(opts.mask, opts.mask, opts); 66682 } 66683 function maskScope(actionObj, maskset, opts) { 66684 function getMaskTemplate(baseOnInput, minimalPos, includeMode) { 66685 minimalPos = minimalPos || 0; 66686 var ndxIntlzr, test, testPos, maskTemplate = [], pos = 0, lvp = getLastValidPosition(); 66687 do { 66688 !0 === baseOnInput && getMaskSet().validPositions[pos] ? (testPos = getMaskSet().validPositions[pos], 66689 test = testPos.match, ndxIntlzr = testPos.locator.slice(), maskTemplate.push(!0 === includeMode ? testPos.input : !1 === includeMode ? test.nativeDef : getPlaceholder(pos, test))) : (testPos = getTestTemplate(pos, ndxIntlzr, pos - 1), 66690 test = testPos.match, ndxIntlzr = testPos.locator.slice(), (!1 === opts.jitMasking || pos < lvp || "number" == typeof opts.jitMasking && isFinite(opts.jitMasking) && opts.jitMasking > pos) && maskTemplate.push(!1 === includeMode ? test.nativeDef : getPlaceholder(pos, test))), 66691 pos++; 66692 } while ((maxLength === undefined || pos < maxLength) && (null !== test.fn || "" !== test.def) || minimalPos > pos); 66693 return "" === maskTemplate[maskTemplate.length - 1] && maskTemplate.pop(), getMaskSet().maskLength = pos + 1, 66694 maskTemplate; 66695 } 66696 function getMaskSet() { 66697 return maskset; 66698 } 66699 function resetMaskSet(soft) { 66700 var maskset = getMaskSet(); 66701 maskset.buffer = undefined, !0 !== soft && (maskset.validPositions = {}, maskset.p = 0); 66702 } 66703 function getLastValidPosition(closestTo, strict, validPositions) { 66704 var before = -1, after = -1, valids = validPositions || getMaskSet().validPositions; 66705 closestTo === undefined && (closestTo = -1); 66706 for (var posNdx in valids) { 66707 var psNdx = parseInt(posNdx); 66708 valids[psNdx] && (strict || !0 !== valids[psNdx].generatedInput) && (psNdx <= closestTo && (before = psNdx), 66709 psNdx >= closestTo && (after = psNdx)); 66710 } 66711 return -1 !== before && closestTo - before > 1 || after < closestTo ? before : after; 66712 } 66713 function stripValidPositions(start, end, nocheck, strict) { 66714 var i, startPos = start, positionsClone = $.extend(!0, {}, getMaskSet().validPositions), needsValidation = !1; 66715 for (getMaskSet().p = start, i = end - 1; i >= startPos; i--) getMaskSet().validPositions[i] !== undefined && (!0 !== nocheck && (!getMaskSet().validPositions[i].match.optionality && function(pos) { 66716 var posMatch = getMaskSet().validPositions[pos]; 66717 if (posMatch !== undefined && null === posMatch.match.fn) { 66718 var prevMatch = getMaskSet().validPositions[pos - 1], nextMatch = getMaskSet().validPositions[pos + 1]; 66719 return prevMatch !== undefined && nextMatch !== undefined; 66720 } 66721 return !1; 66722 }(i) || !1 === opts.canClearPosition(getMaskSet(), i, getLastValidPosition(), str
66722ict, opts)) || delete getMaskSet().validPositions[i]); 66723 for (resetMaskSet(!0), i = startPos + 1; i <= getLastValidPosition(); ) { 66724 for (;getMaskSet().validPositions[startPos] !== undefined; ) startPos++; 66725 if (i < startPos && (i = startPos + 1), getMaskSet().validPositions[i] === undefined && isMask(i)) i++; else { 66726 var t = getTestTemplate(i); 66727 !1 === needsValidation && positionsClone[startPos] && positionsClone[startPos].match.def === t.match.def ? (getMaskSet().validPositions[startPos] = $.extend(!0, {}, positionsClone[startPos]), 66728 getMaskSet().validPositions[startPos].input = t.input, delete getMaskSet().validPositions[i], 66729 i++) : positionCanMatchDefinition(startPos, t.match.def) ? !1 !== isValid(startPos, t.input || getPlaceholder(i), !0) && (delete getMaskSet().validPositions[i], 66730 i++, needsValidation = !0) : isMask(i) || (i++, startPos--), startPos++; 66731 } 66732 } 66733 resetMaskSet(!0); 66734 } 66735 function determineTestTemplate(tests, guessNextBest) { 66736 for (var testPos, testPositions = tests, lvp = getLastValidPosition(), lvTest = getMaskSet().validPositions[lvp] || getTests(0)[0], lvTestAltArr = lvTest.alternation !== undefined ? lvTest.locator[lvTest.alternation].toString().split(",") : [], ndx = 0; ndx < testPositions.length && (testPos = testPositions[ndx], 66737 !(testPos.match && (opts.greedy && !0 !== testPos.match.optionalQuantifier || (!1 === testPos.match.optionality || !1 === testPos.match.newBlockMarker) && !0 !== testPos.match.optionalQuantifier) && (lvTest.alternation === undefined || lvTest.alternation !== testPos.alternation || testPos.locator[lvTest.alternation] !== undefined && checkAlternationMatch(testPos.locator[lvTest.alternation].toString().split(","), lvTestAltArr))) || !0 === guessNextBest && (null !== testPos.match.fn || /[0-9a-bA-Z]/.test(testPos.match.def))); ndx++) ; 66738 return testPos; 66739 } 66740 function getTestTemplate(pos, ndxIntlzr, tstPs) { 66741 return getMaskSet().validPositions[pos] || determineTestTemplate(getTests(pos, ndxIntlzr ? ndxIntlzr.slice() : ndxIntlzr, tstPs)); 66742 } 66743 function getTest(pos) { 66744 return getMaskSet().validPositions[pos] ? getMaskSet().validPositions[pos] : getTests(pos)[0]; 66745 } 66746 function positionCanMatchDefinition(pos, def) { 66747 for (var valid = !1, tests = getTests(pos), tndx = 0; tndx < tests.length; tndx++) if (tests[tndx].match && tests[tndx].match.def === def) { 66748 valid = !0; 66749 break; 66750 } 66751 return valid; 66752 } 66753 function getTests(pos, ndxIntlzr, tstPs) { 66754 function resolveTestFromToken(maskToken, ndxInitializer, loopNdx, quantifierRecurse) { 66755 function handleMatch(match, loopNdx, quantifierRecurse) { 66756 function isFirstMatch(latestMatch, tokenGroup) { 66757 var firstMatch = 0 === $.inArray(latestMatch, tokenGroup.matches); 66758 return firstMatch || $.each(tokenGroup.matches, function(ndx, match) { 66759 if (!0 === match.isQuantifier && (firstMatch = isFirstMatch(latestMatch, tokenGroup.matches[ndx - 1]))) return !1; 66760 }), firstMatch; 66761 } 66762 function resolveNdxInitializer(pos, alternateNdx, targetAlternation) { 66763 var bestMatch, indexPos; 66764 if (getMaskSet().validPositions[pos - 1] && targetAlternation && getMaskSet().tests[pos]) for (var vpAlternation = getMaskSet().validPositions[pos - 1].locator, tpAlternation = getMaskSet().tests[pos][0].locator, i = 0; i < targetAlternation; i++) if (vpAlternation[i] !== tpAlternation[i]) return vpAlternation.slice(targetAlternation + 1); 66765 return (getMaskSet().tests[pos] || getMaskSet().validPositions[pos]) && $.each(getMaskSet().tests[pos] || [ getMaskSet().validPositions[pos] ], function(ndx, lmnt) { 66766 var alternation = targetAlternation !== undefined ? targetAlternation : lmnt.alternation, ndxPos = lmnt.locator[alternation] !== undefined ? lmnt.locator[alternation].toString().indexOf(alternateNdx) : -1; 66767 (indexPos === undefined || ndxPos < indexPos) && -1 !== ndxPos && (bestMatch = lmnt, 66768 indexPos = ndxPos); 66769 }), bestMatch ? bestMatch.locator.slice((targetAlternation !== undefined ? targetAlternation : bestMatch.alternation) + 1) : targetAlternation !== undefined ? resolveNdxInitializer(pos, alternateNdx) : undefined; 66770 } 66771 if (testPos > 1e4) throw "Inputmask: There is probably an error in your mask definition or in the code. Create an issue on github with an example of the mask you are using. " + getMaskSet().mask; 66772 if (testPos === pos && match.matches === undefined) return matches.push({ 66773 match: match, 66774 locator: loopNdx.reverse(), 66775 cd: cacheDependency 66776 }), !0; 66777 if (match.matches !== undefined) { 66778 if (match.isGroup && quantifierRecurse !== match) { 66779 if (match = handleMatch(maskToken.matches[$.inArray(match, maskToken.matches) + 1], loopNdx)) return !0; 66780 } else if (match.isOptional) { 66781 var optionalToken = match; 66782 if (match = resolveTestFromToken(match, ndxInitializer, loopNdx, quantifierRecurse)) { 66783 if (latestMatch = matches[matches.length - 1].match, !isFirstMatch(latestMatch, optionalToken)) return !0; 66784 insertStop = !0, testPos = pos; 66785 } 66786 } else if (match.isAlternator) { 66787 var maltMatches, alternateToken = match, malternateMatches = [], currentMatches = matches.slice(), loopNdxCnt = loopNdx.length, altIndex = ndxInitializer.length > 0 ? ndxInitializer.shift() : -1; 66788 if (-1 === altIndex || "string" == typeof altIndex) { 66789 var amndx, currentPos = testPos, ndxInitializerClone = ndxInitializer.slice(), altIndexArr = []; 66790 if ("string" == typeof altIndex) altIndexArr = altIndex.split(","); else for (amndx = 0;
66790 amndx < alternateToken.matches.length; amndx++) altIndexArr.push(amndx); 66791 for (var ndx = 0; ndx < altIndexArr.length; ndx++) { 66792 if (amndx = parseInt(altIndexArr[ndx]), matches = [], ndxInitializer = resolveNdxInitializer(testPos, amndx, loopNdxCnt) || ndxInitializerClone.slice(), 66793 !0 !== (match = handleMatch(alternateToken.matches[amndx] || maskToken.matches[amndx], [ amndx ].concat(loopNdx), quantifierRecurse) || match) && match !== undefined && altIndexArr[altIndexArr.length - 1] < alternateToken.matches.length) { 66794 var ntndx = $.inArray(match, maskToken.matches) + 1; 66795 maskToken.matches.length > ntndx && (match = handleMatch(maskToken.matches[ntndx], [ ntndx ].concat(loopNdx.slice(1, loopNdx.length)), quantifierRecurse)) && (altIndexArr.push(ntndx.toString()), 66796 $.each(matches, function(ndx, lmnt) { 66797 lmnt.alternation = loopNdx.length - 1; 66798 })); 66799 } 66800 maltMatches = matches.slice(), testPos = currentPos, matches = []; 66801 for (var ndx1 = 0; ndx1 < maltMatches.length; ndx1++) { 66802 var altMatch = maltMatches[ndx1], dropMatch = !1; 66803 altMatch.alternation = altMatch.alternation || loopNdxCnt; 66804 for (var ndx2 = 0; ndx2 < malternateMatches.length; ndx2++) { 66805 var altMatch2 = malternateMatches[ndx2]; 66806 if ("string" != typeof altIndex || -1 !== $.inArray(altMatch.locator[altMatch.alternation].toString(), altIndexArr)) { 66807 if (function(source, target) { 66808 return source.match.nativeDef === target.match.nativeDef || source.match.def === target.match.nativeDef || source.match.nativeDef === target.match.def; 66809 }(altMatch, altMatch2)) { 66810 dropMatch = !0, altMatch.alternation === altMatch2.alternation && -1 === altMatch2.locator[altMatch2.alternation].toString().indexOf(altMatch.locator[altMatch.alternation]) && (altMatch2.locator[altMatch2.alternation] = altMatch2.locator[altMatch2.alternation] + "," + altMatch.locator[altMatch.alternation], 66811 altMatch2.alternation = altMatch.alternation), altMatch.match.nativeDef === altMatch2.match.def && (altMatch.locator[altMatch.alternation] = altMatch2.locator[altMatch2.alternation], 66812 malternateMatches.splice(malternateMatches.indexOf(altMatch2), 1, altMatch)); 66813 break; 66814 } 66815 if (altMatch.match.def === altMatch2.match.def) { 66816 dropMatch = !1; 66817 break; 66818 } 66819 if (function(source, target) { 66820 return null === source.match.fn && null !== target.match.fn && target.match.fn.test(source.match.def, getMaskSet(), pos, !1, opts, !1); 66821 }(altMatch, altMatch2) || function(source, target) { 66822 return null !== source.match.fn && null !== target.match.fn && target.match.fn.test(source.match.def.replace(/[\[\]]/g, ""), getMaskSet(), pos, !1, opts, !1); 66823 }(altMatch, altMatch2)) { 66824 altMatch.alternation === altMatch2.alternation && -1 === altMatch.locator[altMatch.alternation].toString().indexOf(altMatch2.locator[altMatch2.alternation].toString().split("")[0]) && (altMatch.na = altMatch.na || altMatch.locator[altMatch.alternation].toString(), 66825 -1 === altMatch.na.indexOf(altMatch.locator[altMatch.alternation].toString().split("")[0]) && (altMatch.na = altMatch.na + "," + altMatch.locator[altMatch2.alternation].toString().split("")[0]), 66826 dropMatch = !0, altMatch.locator[altMatch.alternation] = altMatch2.locator[altMatch2.alternation].toString().split("")[0] + "," + altMatch.locator[altMatch.alternation], 66827 malternateMatches.splice(malternateMatches.indexOf(altMatch2), 0, altMatch)); 66828 break; 66829 } 66830 } 66831 } 66832 dropMatch || malternateMatches.push(altMatch); 66833 } 66834 } 66835 "string" == typeof altIndex && (malternateMatches = $.map(malternateMatches, function(lmnt, ndx) { 66836 if (isFinite(ndx)) { 66837 var alternation = lmnt.alternation, altLocArr = lmnt.locator[alternation].toString().split(","); 66838 lmnt.locator[alternation] = undefined, lmnt.alternation = undefined; 66839 for (var alndx = 0; alndx < altLocArr.length; alndx++) -1 !== $.inArray(altLocArr[alndx], altIndexArr) && (lmnt.locator[alternation] !== undefined ? (lmnt.locator[alternation] += ",", 66840 lmnt.locator[alternation] += altLocArr[alndx]) : lmnt.locator[alternation] = parseInt(altLocArr[alndx]), 66841 lmnt.alternation = alternation); 66842 if (lmnt.locator[alternation] !== undefined) return lmnt; 66843 } 66844 })), matches = currentMatches.concat(malternateMatches), testPos = pos, insertStop = matches.length > 0, 66845 match = malternateMatches.length > 0, ndxInitializer = ndxInitializerClone.slice(); 66846 } else match = handleMatch(alternateToken.matches[altIndex] || maskToken.matches[altIndex], [ altIndex ].concat(loopNdx), quantifierRecurse); 66847 if (match) return !0; 66848 } else if (match.isQuantifier && quantifierRecurse !== maskToken.matches[$.inArray(match, maskToken.matches) - 1]) for (var qt = match, qndx = ndxInitializer.length > 0 ? ndxInitializer.shift() : 0; qndx < (isNaN(qt.quantifier.max) ? qndx + 1 : qt.quantifier.max) && testPos <= pos; qndx++) { 66849 var tokenGroup = maskToken.matches[$.inArray(qt, maskToken.matches) - 1]; 66850 if (match = handleMatch(tokenGroup, [ qndx ].concat(loopNdx), tokenGroup)) { 66851 if (latestMatch = matches[matches.length - 1].match, latestMatch.optionalQuantifier = qndx > qt.quantifier.min - 1, 66852 isFirstMatch(latestMatch, tokenGroup)) { 66853 if (qndx > qt.quantifier.min - 1) { 66854 insertStop = !0, testPos = pos; 66855 break; 66856 } 66857 return !0; 66858 } 66859 return !0; 66860 } 66861 } else if (match = resolveTestFromToken(match, ndxInitializer, loopNdx, quantifierRecurse)) return !0; 66862 } else testPos++; 66863 } 66864 for (var tndx = ndxInitializer.length > 0 ? ndxInitializer.shift() : 0; tndx < maskToken.matches.length; tndx++) if (!0 !== maskToken.matches[tndx].isQuantifier) { 66865 var match = handleMatch(maskToken.matches[tndx], [ tndx ].concat(loopNdx), quantifierRecurse); 66866 if (match && testPos === pos) return match; 66867 if (testPos > pos) break; 66868 } 66869 } 66870 function filterTests(tests) { 66871 if (opts.keepStatic && pos > 0 && tests.length > 1 + ("" === tests[tests.length - 1].match.def ? 1 : 0) && !0 !== tests[0].match.optionality && !0 !== tests[0].match.optionalQuantifier && null === tests[0].match.fn && !/[0-9a-bA-Z]/.test(tests[0].match.def)) { 66872 if (getMaskSet().validPositions[pos - 1] === undefined) return [ determineTestTemplate(tests) ]; 66873 if (getMaskSet().validPositions[pos - 1].alternation === tests[0].alternation) return [ determineTestTemplate(tests) ]; 66874 if (getMaskSet().validPositions[pos - 1]) return [ determineTestTemplate(tests) ]; 66875 } 66876 return tests; 66877 } 66878 var latestMatch, maskTokens = getMaskSet().maskToken, testPos = ndxIntlzr ? tstPs : 0, ndxInitializer = ndxIntlzr ? ndxIntlzr.slice() : [ 0 ], matches = [], insertStop = !1, cacheDependency = ndxIntlzr ? ndxIntlzr.join("") : ""; 66879 if (pos > -1) { 66880 if (ndxIntlzr === undefined) { 66881 for (var test, previousPos = pos - 1; (test = getMaskSet().validPositions[previousPos] || getMaskSet().tests[previousPos]) === undefined && previousPos > -1; ) previousPos--; 66882 test !== undefined && previousPos > -1 && (ndxInitializer = function(tests) { 66883 var locator = []; 66884 return $.isArray(tests) || (tests = [ tests ]), tests.length > 0 && (tests[0].alternation === undefined ? (locator = determineTestTemplate(tests.slice()).locator.slice(), 66885 0 === locator.length && (locator = tests[0].locator.slice())) : $.each(tests, function(ndx, tst) { 66886 if ("" !== tst.def) if (0 === locator.length) locator = t
66886st.locator.slice(); else for (var i = 0; i < locator.length; i++) tst.locator[i] && -1 === locator[i].toString().indexOf(tst.locator[i]) && (locator[i] += "," + tst.locator[i]); 66887 })), locator; 66888 }(test), cacheDependency = ndxInitializer.join(""), testPos = previousPos); 66889 } 66890 if (getMaskSet().tests[pos] && getMaskSet().tests[pos][0].cd === cacheDependency) return filterTests(getMaskSet().tests[pos]); 66891 for (var mtndx = ndxInitializer.shift(); mtndx < maskTokens.length; mtndx++) { 66892 if (resolveTestFromToken(maskTokens[mtndx], ndxInitializer, [ mtndx ]) && testPos === pos || testPos > pos) break; 66893 } 66894 } 66895 return (0 === matches.length || insertStop) && matches.push({ 66896 match: { 66897 fn: null, 66898 cardinality: 0, 66899 optionality: !0, 66900 casing: null, 66901 def: "", 66902 placeholder: "" 66903 }, 66904 locator: [], 66905 cd: cacheDependency 66906 }), ndxIntlzr !== undefined && getMaskSet().tests[pos] ? filterTests($.extend(!0, [], matches)) : (getMaskSet().tests[pos] = $.extend(!0, [], matches), 66907 filterTests(getMaskSet().tests[pos])); 66908 } 66909 function getBufferTemplate() { 66910 return getMaskSet()._buffer === undefined && (getMaskSet()._buffer = getMaskTemplate(!1, 1), 66911 getMaskSet().buffer === undefined && (getMaskSet().buffer = getMaskSet()._buffer.slice())), 66912 getMaskSet()._buffer; 66913 } 66914 function getBuffer(noCache) { 66915 return getMaskSet().buffer !== undefined && !0 !== noCache || (getMaskSet().buffer = getMaskTemplate(!0, getLastValidPosition(), !0)), 66916 getMaskSet().buffer; 66917 } 66918 function refreshFromBuffer(start, end, buffer) { 66919 var i, p; 66920 if (!0 === start) resetMaskSet(), start = 0, end = buffer.length; else for (i = start; i < end; i++) delete getMaskSet().validPositions[i]; 66921 for (p = start, i = start; i < end; i++) if (resetMaskSet(!0), buffer[i] !== opts.skipOptionalPartCharacter) { 66922 var valResult = isValid(p, buffer[i], !0, !0); 66923 !1 !== valResult && (resetMaskSet(!0), p = valResult.caret !== undefined ? valResult.caret : valResult.pos + 1); 66924 } 66925 } 66926 function casing(elem, test, pos) { 66927 switch (opts.casing || test.casing) { 66928 case "upper": 66929 elem = elem.toUpperCase(); 66930 break; 66931 66932 case "lower": 66933 elem = elem.toLowerCase(); 66934 break; 66935 66936 case "title": 66937 var posBefore = getMaskSet().validPositions[pos - 1]; 66938 elem = 0 === pos || posBefore && posBefore.input === String.fromCharCode(Inputmask.keyCode.SPACE) ? elem.toUpperCase() : elem.toLowerCase(); 66939 break; 66940 66941 default: 66942 if ($.isFunction(opts.casing)) { 66943 var args = Array.prototype.slice.call(arguments); 66944 args.push(getMaskSet().validPositions), elem = opts.casing.apply(this, args); 66945 } 66946 } 66947 return elem; 66948 } 66949 function checkAlternationMatch(altArr1, altArr2, na) { 66950 for (var naNdx, altArrC = opts.greedy ? altArr2 : altArr2.slice(0, 1), isMatch = !1, naArr = na !== undefined ? na.split(",") : [], i = 0; i < naArr.length; i++) -1 !== (naNdx = altArr1.indexOf(naArr[i])) && altArr1.splice(naNdx, 1); 66951 for (var alndx = 0; alndx < altArr1.length; alndx++) if (-1 !== $.inArray(altArr1[alndx], altArrC)) { 66952 isMatch = !0; 66953 break; 66954 } 66955 return isMatch; 66956 } 66957 function isValid(pos, c, strict, fromSetValid, fromAlternate, validateOnly) { 66958 function isSelection(posObj) { 66959 var selection = isRTL ? posObj.begin - posObj.end > 1 || posObj.begin - posObj.end == 1 : posObj.end - posObj.begin > 1 || posObj.end - posObj.begin == 1; 66960 return selection && 0 === posObj.begin && posObj.end === getMaskSet().maskLength ? "full" : selection; 66961 } 66962 function _isValid(position, c, strict) { 66963 var rslt = !1; 66964 return $.each(getTests(position), function(ndx, tst) { 66965 for (var test = tst.match, loopend = c ? 1 : 0, chrs = "", i = test.cardinality; i > loopend; i--) chrs += getBufferElement(position - (i - 1)); 66966 if (c && (chrs += c), getBuffer(!0), !1 !== (rslt = null != test.fn ? test.fn.test(chrs, getMaskSet(), position, strict, opts, isSelection(pos)) : (c === test.def || c === opts.skipOptionalPartCharacter) && "" !== test.def && {
66967 c: getPlaceholder(position, test, !0) || test.def, 66968 pos: position 66969 })) { 66970 var elem = rslt.c !== undefined ? rslt.c : c; 66971 elem = elem === opts.skipOptionalPartCharacter && null === test.fn ? getPlaceholder(position, test, !0) || test.def : elem; 66972 var validatedPos = position, possibleModifiedBuffer = getBuffer(); 66973 if (rslt.remove !== undefined && ($.isArray(rslt.remove) || (rslt.remove = [ rslt.remove ]), 66974 $.each(rslt.remove.sort(function(a, b) { 66975 return b - a; 66976 }), function(ndx, lmnt) { 66977 stripValidPositions(lmnt, lmnt + 1, !0); 66978 })), rslt.insert !== undefined && ($.isArray(rslt.insert) || (rslt.insert = [ rslt.insert ]), 66979 $.each(rslt.insert.sort(function(a, b) { 66980 return a - b; 66981 }), function(ndx, lmnt) { 66982 isValid(lmnt.pos, lmnt.c, !0, fromSetValid); 66983 })), rslt.refreshFromBuffer) { 66984 var refresh = rslt.refreshFromBuffer; 66985 if (refreshFromBuffer(!0 === refresh ? refresh : refresh.start, refresh.end, possibleModifiedBuffer), 66986 rslt.pos === undefined && rslt.c === undefined) return rslt.pos = getLastValidPosition(), 66987 !1; 66988 if ((validatedPos = rslt.pos !== undefined ? rslt.pos : position) !== position) return rslt = $.extend(rslt, isValid(validatedPos, elem, !0, fromSetValid)), 66989 !1; 66990 } else if (!0 !== rslt && rslt.pos !== undefined && rslt.pos !== position && (validatedPos = rslt.pos, 66991 refreshFromBuffer(position, validatedPos, getBuffer().slice()), validatedPos !== position)) return rslt = $.extend(rslt, isValid(validatedPos, elem, !0)), 66992 !1; 66993 return (!0 === rslt || rslt.pos !== undefined || rslt.c !== undefined) && (ndx > 0 && resetMaskSet(!0), 66994 setValidPosition(validatedPos, $.extend({}, tst, { 66995 input: casing(elem, test, validatedPos) 66996 }), fromSetValid, isSelection(pos)) || (rslt = !1), !1); 66997 } 66998 }), rslt; 66999 } 67000 function setValidPosition(pos, validTest, fromSetValid, isSelection) { 67001 if (isSelection || opts.insertMode && getMaskSet().validPositions[pos] !== undefined && fromSetValid === undefined) { 67002 var i, positionsClone = $.extend(!0, {}, getMaskSet().validPositions), lvp = getLastValidPosition(undefined, !0); 67003 for (i = pos; i <= lvp; i++) delete getMaskSet().validPositions[i]; 67004 getMaskSet().validPositions[pos] = $.extend(!0, {}, validTest); 67005 var j, valid = !0, vps = getMaskSet().validPositions, needsValidation = !1, initialLength = getMaskSet().maskLength; 67006 for (i = j = pos; i <= lvp; i++) { 67007 var t = positionsClone[i]; 67008 if (t !== undefined) for (var posMatch = j; posMatch < getMaskSet().maskLength && (null === t.match.fn && vps[i] && (!0 === vps[i].match.optionalQuantifier || !0 === vps[i].match.optionality) || null != t.match.fn); ) { 67009 if (posMatch++, !1 === needsValidation && positionsClone[posMatch] && positionsClone[posMatch].match.def === t.match.def) getMaskSet().validPositions[posMatch] = $.extend(!0, {}, positionsClone[posMatch]), 67010 getMaskSet().validPositions[posMatch].input = t.input, fillMissingNonMask(posMatch), 67011 j = posMatch, valid = !0; else if (positionCanMatchDefinition(posMatch, t.match.def)) { 67012 var result = isValid(posMatch, t.input, !0, !0); 67013 valid = !1 !== result, j = result.caret || result.insert ? getLastValidPosition() : posMatch, 67014 needsValidation = !0; 67015 } else if (!(valid = !0 === t.generatedInput) && posMatch >= getMaskSet().maskLength - 1) break; 67016 if (getMaskSet().maskLength < initialLength && (getMaskSet().maskLength = initialLength), 67017 valid) break; 67018 } 67019 if (!valid) break; 67020 } 67021 if (!valid) return getMaskSet().validPositions = $.extend(!0, {}, positionsClone), 67022 resetMaskSet(!0), !1; 67023 } else getMaskSet().validPositions[pos] = $.extend(!0, {}, validTest); 67024 return resetMaskSet(!0), !0; 67025 } 67026 function fillMissingNonMask(maskPos) { 67027 for (var pndx = maskPos - 1; pndx > -1 && !getMaskSet().validPositions[pndx]; pndx--) ; 67028 var testTemplate, testsFromPos; 67029 for (pndx++;
67029 pndx < maskPos; pndx++) getMaskSet().validPositions[pndx] === undefined && (!1 === opts.jitMasking || opts.jitMasking > pndx) && (testsFromPos = getTests(pndx, getTestTemplate(pndx - 1).locator, pndx - 1).slice(), 67030 "" === testsFromPos[testsFromPos.length - 1].match.def && testsFromPos.pop(), (testTemplate = determineTestTemplate(testsFromPos)) && (testTemplate.match.def === opts.radixPointDefinitionSymbol || !isMask(pndx, !0) || $.inArray(opts.radixPoint, getBuffer()) < pndx && testTemplate.match.fn && testTemplate.match.fn.test(getPlaceholder(pndx), getMaskSet(), pndx, !1, opts)) && !1 !== (result = _isValid(pndx, getPlaceholder(pndx, testTemplate.match, !0) || (null == testTemplate.match.fn ? testTemplate.match.def : "" !== getPlaceholder(pndx) ? getPlaceholder(pndx) : getBuffer()[pndx]), !0)) && (getMaskSet().validPositions[result.pos || pndx].generatedInput = !0)); 67031 } 67032 strict = !0 === strict; 67033 var maskPos = pos; 67034 pos.begin !== undefined && (maskPos = isRTL && !isSelection(pos) ? pos.end : pos.begin); 67035 var result = !0, positionsClone = $.extend(!0, {}, getMaskSet().validPositions); 67036 if ($.isFunction(opts.preValidation) && !strict && !0 !== fromSetValid && !0 !== validateOnly && (result = opts.preValidation(getBuffer(), maskPos, c, isSelection(pos), opts)), 67037 !0 === result) { 67038 if (fillMissingNonMask(maskPos), isSelection(pos) && (handleRemove(undefined, Inputmask.keyCode.DELETE, pos, !0, !0), 67039 maskPos = getMaskSet().p), maskPos < getMaskSet().maskLength && (maxLength === undefined || maskPos < maxLength) && (result = _isValid(maskPos, c, strict), 67040 (!strict || !0 === fromSetValid) && !1 === result && !0 !== validateOnly)) { 67041 var currentPosValid = getMaskSet().validPositions[maskPos]; 67042 if (!currentPosValid || null !== currentPosValid.match.fn || currentPosValid.match.def !== c && c !== opts.skipOptionalPartCharacter) { 67043 if ((opts.insertMode || getMaskSet().validPositions[seekNext(maskPos)] === undefined) && !isMask(maskPos, !0)) for (var nPos = maskPos + 1, snPos = seekNext(maskPos); nPos <= snPos; nPos++) if (!1 !== (result = _isValid(nPos, c, strict))) { 67044 !function(originalPos, newPos) { 67045 var vp = getMaskSet().validPositions[newPos]; 67046 if (vp) for (var targetLocator = vp.locator, tll = targetLocator.length, ps = originalPos; ps < newPos; ps++) if (getMaskSet().validPositions[ps] === undefined && !isMask(ps, !0)) { 67047 var tests = getTests(ps).slice(), bestMatch = determineTestTemplate(tests, !0), equality = -1; 67048 "" === tests[tests.length - 1].match.def && tests.pop(), $.each(tests, function(ndx, tst) { 67049 for (var i = 0; i < tll; i++) { 67050 if (tst.locator[i] === undefined || !checkAlternationMatch(tst.locator[i].toString().split(","), targetLocator[i].toString().split(","), tst.na)) { 67051 var targetAI = targetLocator[i], bestMatchAI = bestMatch.locator[i], tstAI = tst.locator[i]; 67052 targetAI - bestMatchAI > Math.abs(targetAI - tstAI) && (bestMatch = tst); 67053 break; 67054 } 67055 equality < i && (equality = i, bestMatch = tst); 67056 } 67057 }), bestMatch = $.extend({}, bestMatch, { 67058 input: getPlaceholder(ps, bestMatch.match, !0) || bestMatch.match.def 67059 }), bestMatch.generatedInput = !0, setValidPosition(ps, bestMatch, !0), getMaskSet().validPositions[newPos] = undefined, 67060 _isValid(newPos, vp.input, !0); 67061 } 67062 }(maskPos, result.pos !== undefined ? result.pos : nPos), maskPos = nPos; 67063 break; 67064 } 67065 } else result = { 67066 caret: seekNext(maskPos) 67067 }; 67068 } 67069 !1 === result && opts.keepStatic && !strict && !0 !== fromAlternate && (result = function(pos, c, strict) { 67070 var lastAlt, alternation, altPos, prevAltPos, i, validPos, altNdxs, decisionPos, validPsClone = $.extend(!0, {}, getMaskSet().validPositions), isValidRslt = !1, lAltPos = getLastValidPosition(); 67071 for (prevAltPos = getMaskSet().validPositions[lAltPos]; lAltPos >= 0; lAltPos--) if ((altPos = getMaskSet().validPositions[lAltPos]) && altPos.alternation !== undefined) { 67072 if (lastAlt = lAltPos, alternation = getMaskSet().validPositions[lastAlt].alternation, 67073 prevAltPos.locator[altPos.alternation] !== altPos.locator[altPos.alternation]) break; 67074 prevAltPos = altPos; 67075 } 67076 if (alternation !== undefined) { 67077 decisionPos = parseInt(lastAlt); 67078 var decisionTaker = prevAltPos.locator[prevAltPos.alternation || alternation] !== undefined ? prevAltPos.locator[prevAltPos.alternation || alternation] : altNdxs[0]; 67079 decisionTaker.length > 0 && (decisionTaker = decisionTaker.split(",")[0]); 67080 var possibilityPos = getMaskSet().validPositions[decisionPos], prevPos = getMaskSet().validPositions[decisionPos - 1]; 67081 $.each(getTests(decisionPos, prevPos ? prevPos.locator : undefined, decisionPos - 1), function(ndx, test) { 67082 altNdxs = test.locator[alternation] ? test.locator[alternation].toString().split(",") : []; 67083 for (var mndx = 0; mndx < altNdxs.length; mndx++) {
67084 var validInputs = [], staticInputsBeforePos = 0, staticInputsBeforePosAlternate = 0, verifyValidInput = !1; 67085 if (decisionTaker < altNdxs[mndx] && (test.na === undefined || -1 === $.inArray(altNdxs[mndx], test.na.split(",")) || -1 === $.inArray(decisionTaker.toString(), altNdxs))) { 67086 getMaskSet().validPositions[decisionPos] = $.extend(!0, {}, test); 67087 var possibilities = getMaskSet().validPositions[decisionPos].locator; 67088 for (getMaskSet().validPositions[decisionPos].locator[alternation] = parseInt(altNdxs[mndx]), 67089 null == test.match.fn ? (possibilityPos.input !== test.match.def && (verifyValidInput = !0, 67090 !0 !== possibilityPos.generatedInput && validInputs.push(possibilityPos.input)), 67091 staticInputsBeforePosAlternate++, getMaskSet().validPositions[decisionPos].generatedInput = !/[0-9a-bA-Z]/.test(test.match.def), 67092 getMaskSet().validPositions[decisionPos].input = test.match.def) : getMaskSet().validPositions[decisionPos].input = possibilityPos.input, 67093 i = decisionPos + 1; i < getLastValidPosition(undefined, !0) + 1; i++) validPos = getMaskSet().validPositions[i], 67094 validPos && !0 !== validPos.generatedInput && /[0-9a-bA-Z]/.test(validPos.input) ? validInputs.push(validPos.input) : i < pos && staticInputsBeforePos++, 67095 delete getMaskSet().validPositions[i]; 67096 for (verifyValidInput && validInputs[0] === test.match.def && validInputs.shift(), 67097 resetMaskSet(!0), isValidRslt = !0; validInputs.length > 0; ) { 67098 var input = validInputs.shift(); 67099 if (input !== opts.skipOptionalPartCharacter && !(isValidRslt = isValid(getLastValidPosition(undefined, !0) + 1, input, !1, fromSetValid, !0))) break; 67100 } 67101 if (isValidRslt) { 67102 getMaskSet().validPositions[decisionPos].locator = possibilities; 67103 var targetLvp = getLastValidPosition(pos) + 1; 67104 for (i = decisionPos + 1; i < getLastValidPosition() + 1; i++) ((validPos = getMaskSet().validPositions[i]) === undefined || null == validPos.match.fn) && i < pos + (staticInputsBeforePosAlternate - staticInputsBeforePos) && staticInputsBeforePosAlternate++; 67105 pos += staticInputsBeforePosAlternate - staticInputsBeforePos, isValidRslt = isValid(pos > targetLvp ? targetLvp : pos, c, strict, fromSetValid, !0); 67106 } 67107 if (isValidRslt) return !1; 67108 resetMaskSet(), getMaskSet().validPositions = $.extend(!0, {}, validPsClone); 67109 } 67110 } 67111 }); 67112 } 67113 return isValidRslt; 67114 }(maskPos, c, strict)), !0 === result && (result = { 67115 pos: maskPos 67116 }); 67117 } 67118 if ($.isFunction(opts.postValidation) && !1 !== result && !strict && !0 !== fromSetValid && !0 !== validateOnly) { 67119 var postResult = opts.postValidation(getBuffer(!0), result, opts); 67120 if (postResult.refreshFromBuffer && postResult.buffer) { 67121 var refresh = postResult.refreshFromBuffer; 67122 refreshFromBuffer(!0 === refresh ? refresh : refresh.start, refresh.end, postResult.buffer); 67123 } 67124 result = !0 === postResult ? result : postResult; 67125 } 67126 return result && result.pos === undefined && (result.pos = maskPos), !1 !== result && !0 !== validateOnly || (resetMaskSet(!0), 67127 getMaskSet().validPositions = $.extend(!0, {}, positionsClone)), result; 67128 } 67129 function isMask(pos, strict) { 67130 var test = getTestTemplate(pos).match; 67131 if ("" === test.def && (test = getTest(pos).match), null != test.fn) return test.fn; 67132 if (!0 !== strict && pos > -1) { 67133 var tests = getTests(pos); 67134 return tests.length > 1 + ("" === tests[tests.length - 1].match.def ? 1 : 0); 67135 } 67136 return !1; 67137 } 67138 function seekNext(pos, newBlock) { 67139 var maskL = getMaskSet().maskLength; 67140 if (pos >= maskL) return maskL; 67141 var position = pos; 67142 for (getTests(maskL + 1).length > 1 && (getMaskTemplate(!0, maskL + 1, !0), maskL = getMaskSet().maskLength); ++position < maskL && (!0 === newBlock && (!0 !== getTest(position).match.newBlockMarker || !isMask(position)) || !0 !== newBlock && !isMask(position)); ) ; 67143 return position; 67144 } 67145 function seekPrevious(pos, newBlock) { 67146 var tests, position = pos; 67147 if (position <= 0) return 0; 67148 for (;
67148--position > 0 && (!0 === newBlock && !0 !== getTest(position).match.newBlockMarker || !0 !== newBlock && !isMask(position) && (tests = getTests(position), 67149 tests.length < 2 || 2 === tests.length && "" === tests[1].match.def)); ) ; 67150 return position; 67151 } 67152 function getBufferElement(position) { 67153 return getMaskSet().validPositions[position] === undefined ? getPlaceholder(position) : getMaskSet().validPositions[position].input; 67154 } 67155 function writeBuffer(input, buffer, caretPos, event, triggerInputEvent) { 67156 if (event && $.isFunction(opts.onBeforeWrite)) { 67157 var result = opts.onBeforeWrite.call(inputmask, event, buffer, caretPos, opts); 67158 if (result) { 67159 if (result.refreshFromBuffer) { 67160 var refresh = result.refreshFromBuffer; 67161 refreshFromBuffer(!0 === refresh ? refresh : refresh.start, refresh.end, result.buffer || buffer), 67162 buffer = getBuffer(!0); 67163 } 67164 caretPos !== undefined && (caretPos = result.caret !== undefined ? result.caret : caretPos); 67165 } 67166 } 67167 input !== undefined && (input.inputmask._valueSet(buffer.join("")), caretPos === undefined || event !== undefined && "blur" === event.type ? renderColorMask(input, caretPos, 0 === buffer.length) : android && event && "input" === event.type ? setTimeout(function() { 67168 caret(input, caretPos); 67169 }, 0) : caret(input, caretPos), !0 === triggerInputEvent && (skipInputEvent = !0, 67170 $(input).trigger("input"))); 67171 } 67172 function getPlaceholder(pos, test, returnPL) { 67173 if (test = test || getTest(pos).match, test.placeholder !== undefined || !0 === returnPL) return $.isFunction(test.placeholder) ? test.placeholder(opts) : test.placeholder; 67174 if (null === test.fn) { 67175 if (pos > -1 && getMaskSet().validPositions[pos] === undefined) { 67176 var prevTest, tests = getTests(pos), staticAlternations = []; 67177 if (tests.length > 1 + ("" === tests[tests.length - 1].match.def ? 1 : 0)) for (var i = 0; i < tests.length; i++) if (!0 !== tests[i].match.optionality && !0 !== tests[i].match.optionalQuantifier && (null === tests[i].match.fn || prevTest === undefined || !1 !== tests[i].match.fn.test(prevTest.match.def, getMaskSet(), pos, !0, opts)) && (staticAlternations.push(tests[i]), 67178 null === tests[i].match.fn && (prevTest = tests[i]), staticAlternations.length > 1 && /[0-9a-bA-Z]/.test(staticAlternations[0].match.def))) return opts.placeholder.charAt(pos % opts.placeholder.length); 67179 } 67180 return test.def; 67181 } 67182 return opts.placeholder.charAt(pos % opts.placeholder.length); 67183 } 67184 function checkVal(input, writeOut, strict, nptvl, initiatingEvent) { 67185 function isTemplateMatch(ndx, charCodes) { 67186 return -1 !== getBufferTemplate().slice(ndx, seekNext(ndx)).join("").indexOf(charCodes) && !isMask(ndx) && getTest(ndx).match.nativeDef === charCodes.charAt(charCodes.length - 1); 67187 } 67188 var inputValue = nptvl.slice(), charCodes = "", initialNdx = -1, result = undefined; 67189 if (resetMaskSet(), strict || !0 === opts.autoUnmask) initialNdx = seekNext(initialNdx); else { 67190 var staticInput = getBufferTemplate().slice(0, seekNext(-1)).join(""), matches = inputValue.join("").match(new RegExp("^" + Inputmask.escapeRegex(staticInput), "g")); 67191 matches && matches.length > 0 && (inputValue.splice(0, matches.length * staticInput.length), 67192 initialNdx = seekNext(initialNdx)); 67193 } 67194 if (-1 === initialNdx ? (getMaskSet().p = seekNext(initialNdx), initialNdx = 0) : getMaskSet().p = initialNdx,
67195 $.each(inputValue, function(ndx, charCode) { 67196 if (charCode !== undefined) if (getMaskSet().validPositions[ndx] === undefined && inputValue[ndx] === getPlaceholder(ndx) && isMask(ndx, !0) && !1 === isValid(ndx, inputValue[ndx], !0, undefined, undefined, !0)) getMaskSet().p++; else { 67197 var keypress = new $.Event("_checkval"); 67198 keypress.which = charCode.charCodeAt(0), charCodes += charCode; 67199 var lvp = getLastValidPosition(undefined, !0), lvTest = getMaskSet().validPositions[lvp], nextTest = getTestTemplate(lvp + 1, lvTest ? lvTest.locator.slice() : undefined, lvp); 67200 if (!isTemplateMatch(initialNdx, charCodes) || strict || opts.autoUnmask) { 67201 var pos = strict ? ndx : null == nextTest.match.fn && nextTest.match.optionality && lvp + 1 < getMaskSet().p ? lvp + 1 : getMaskSet().p; 67202 result = EventHandlers.keypressEvent.call(input, keypress, !0, !1, strict, pos), 67203 initialNdx = pos + 1, charCodes = ""; 67204 } else result = EventHandlers.keypressEvent.call(input, keypress, !0, !1, !0, lvp + 1); 67205 if (!1 !== result && !strict && $.isFunction(opts.onBeforeWrite)) { 67206 var origResult = result; 67207 if (result = opts.onBeforeWrite.call(inputmask, keypress, getBuffer(), result.forwardPosition, opts), 67208 (result = $.extend(origResult, result)) && result.refreshFromBuffer) { 67209 var refresh = result.refreshFromBuffer; 67210 refreshFromBuffer(!0 === refresh ? refresh : refresh.start, refresh.end, result.buffer), 67211 resetMaskSet(!0), result.caret && (getMaskSet().p = result.caret, result.forwardPosition = result.caret); 67212 } 67213 } 67214 } 67215 }), writeOut) { 67216 var caretPos = undefined; 67217 document.activeElement === input && result && (caretPos = opts.numericInput ? seekPrevious(result.forwardPosition) : result.forwardPosition), 67218 writeBuffer(input, getBuffer(), caretPos, initiatingEvent || new $.Event("checkval"), initiatingEvent && "input" === initiatingEvent.type); 67219 } 67220 } 67221 function unmaskedvalue(input) { 67222 if (input) { 67223 if (input.inputmask === undefined) return input.value; 67224 input.inputmask && input.inputmask.refreshValue && EventHandlers.setValueEvent.call(input); 67225 } 67226 var umValue = [], vps = getMaskSet().validPositions; 67227 for (var pndx in vps) vps[pndx].match && null != vps[pndx].match.fn && umValue.push(vps[pndx].input); 67228 var unmaskedValue = 0 === umValue.length ? "" : (isRTL ? umValue.reverse() : umValue).join(""); 67229 if ($.isFunction(opts.onUnMask)) { 67230 var bufferValue = (isRTL ? getBuffer().slice().reverse() : getBuffer()).join(""); 67231 unmaskedValue = opts.onUnMask.call(inputmask, bufferValue, unmaskedValue, opts); 67232 } 67233 return unmaskedValue; 67234 } 67235 function caret(input, begin, end, notranslate) { 67236 function translatePosition(pos) { 67237 if (!0 !== notranslate && isRTL && "number" == typeof pos && (!opts.greedy || "" !== opts.placeholder)) { 67238 pos = getBuffer().join("").length - pos; 67239 } 67240 return pos; 67241 } 67242 var range; 67243 if (begin === undefined) return input.setSelectionRange ? (begin = input.selectionStart, 67244 end = input.selectionEnd) : window.getSelection ? (range = window.getSelection().getRangeAt(0), 67245 range.commonAncestorContainer.parentNode !== input && range.commonAncestorContainer !== input || (begin = range.startOffset, 67246 end = range.endOffset)) : document.selection && document.selection.createRange && (range = document.selection.createRange(), 67247 begin = 0 - range.duplicate().moveStart("character", -input.inputmask._valueGet().length), 67248 end = begin + range.text.length), { 67249 begin: translatePosition(begin),
67250 end: translatePosition(end) 67251 }; 67252 if (begin.begin !== undefined && (end = begin.end, begin = begin.begin), "number" == typeof begin) { 67253 begin = translatePosition(begin), end = translatePosition(end), end = "number" == typeof end ? end : begin; 67254 var scrollCalc = parseInt(((input.ownerDocument.defaultView || window).getComputedStyle ? (input.ownerDocument.defaultView || window).getComputedStyle(input, null) : input.currentStyle).fontSize) * end; 67255 if (input.scrollLeft = scrollCalc > input.scrollWidth ? scrollCalc : 0, mobile || !1 !== opts.insertMode || begin !== end || end++, 67256 input.setSelectionRange) input.selectionStart = begin, input.selectionEnd = end; else if (window.getSelection) { 67257 if (range = document.createRange(), input.firstChild === undefined || null === input.firstChild) { 67258 var textNode = document.createTextNode(""); 67259 input.appendChild(textNode); 67260 } 67261 range.setStart(input.firstChild, begin < input.inputmask._valueGet().length ? begin : input.inputmask._valueGet().length), 67262 range.setEnd(input.firstChild, end < input.inputmask._valueGet().length ? end : input.inputmask._valueGet().length), 67263 range.collapse(!0); 67264 var sel = window.getSelection(); 67265 sel.removeAllRanges(), sel.addRange(range); 67266 } else input.createTextRange && (range = input.createTextRange(), range.collapse(!0), 67267 range.moveEnd("character", end), range.moveStart("character", begin), range.select()); 67268 renderColorMask(input, { 67269 begin: begin, 67270 end: end 67271 }); 67272 } 67273 } 67274 function determineLastRequiredPosition(returnDefinition) { 67275 var pos, testPos, buffer = getBuffer(), bl = buffer.length, lvp = getLastValidPosition(), positions = {}, lvTest = getMaskSet().validPositions[lvp], ndxIntlzr = lvTest !== undefined ? lvTest.locator.slice() : undefined; 67276 for (pos = lvp + 1; pos < buffer.length; pos++) testPos = getTestTemplate(pos, ndxIntlzr, pos - 1), 67277 ndxIntlzr = testPos.locator.slice(), positions[pos] = $.extend(!0, {}, testPos); 67278 var lvTestAlt = lvTest && lvTest.alternation !== undefined ? lvTest.locator[lvTest.alternation] : undefined; 67279 for (pos = bl - 1; pos > lvp && (testPos = positions[pos], (testPos.match.optionality || testPos.match.optionalQuantifier && testPos.match.newBlockMarker || lvTestAlt && (lvTestAlt !== positions[pos].locator[lvTest.alternation] && null != testPos.match.fn || null === testPos.match.fn && testPos.locator[lvTest.alternation] && checkAlternationMatch(testPos.locator[lvTest.alternation].toString().split(","), lvTestAlt.toString().split(",")) && "" !== getTests(pos)[0].def)) && buffer[pos] === getPlaceholder(pos, testPos.match)); pos--) bl--; 67280 return returnDefinition ? { 67281 l: bl, 67282 def: positions[bl] ? positions[bl].match : undefined 67283 } : bl; 67284 } 67285 function clearOptionalTail(buffer) { 67286 for (var validPos, rl = determineLastRequiredPosition(), bl = buffer.length, lv = getMaskSet().validPositions[getLastValidPosition()]; rl < bl && !isMask(rl, !0) && (validPos = lv !== undefined ? getTestTemplate(rl, lv.locator.slice(""), lv) : getTest(rl)) && !0 !== validPos.match.optionality && (!0 !== validPos.match.optionalQuantifier && !0 !== validPos.match.newBlockMarker || rl + 1 === bl && "" === (lv !== undefined ? getTestTemplate(rl + 1, lv.locator.slice(""), lv) : getTest(rl + 1)).match.def); ) rl++; 67287 for (;(validPos = getMaskSet().validPositions[rl - 1]) && validPos && validPos.match.optionality && validPos.input === opts.skipOptionalPartCharacter; ) rl--; 67288 return buffer.splice(rl), buffer; 67289 } 67290 function isComplete(buffer) { 67291 if ($.isFunction(opts.isComplete)) return opts.isComplete(buffer, opts); 67292 if ("*" === opts.repeat) return undefined; 67293 var complete = !1, lrp = determineLastRequiredPosition(!0), aml = seekPrevious(lrp.l); 67294 if (lrp.def === undefined || lrp.def.newBlockMarker || lrp.def.optionality || lrp.def.optionalQuantifier) { 67295 complete = !0; 67296 for (var i = 0; i <= aml; i++) { 67297 var test = getTestTemplate(i).match; 67298 if (null !== test.fn && getMaskSet().validPositions[i] === undefined && !0 !== test.optionality && !0 !== test.optionalQuantifier || null === test.fn && buffer[i] !== getPlaceholder(i, test)) { 67299 complete = !1; 67300 break; 67301 } 67302 } 67303 } 67304 return complete; 67305 } 67306 function handleRemove(input, k, pos, strict, fromIsValid) { 67307 if ((opts.numericInput || isRTL) && (k === Inputmask.keyCode.BACKSPACE ? k = Inputmask.keyCode.DELETE : k === Inputmask.keyCode.DELETE && (k = Inputmask.keyCode.BACKSPACE), 67308 isRTL)) { 67309 var pend = pos.end; 67310 pos.end = pos.begin, pos.begin = pend; 67311 } 67312 k === Inputmask.keyCode.BACKSPACE && (pos.end - pos.begin < 1 || !1 === opts.insertMode) ? (pos.begin = seekPrevious(pos.begin), 67313 getMaskSet().validPositions[pos.begin] !== undefined && getMaskSet().validPositions[pos.begin].input === opts.groupSeparator && pos.begin--) : k === Inputmask.keyCode.DELETE && pos.begin === pos.end && (pos.end = isMask(pos.end, !0) && getMaskSet().validPositions[pos.end] && getMaskSet().validPositions[pos.end].input !== opts.radixPoint ? pos.end + 1 : seekNext(pos.end) + 1, 67314 getMaskSet().validPositions[pos.begin] !== undefined && getMaskSet().validPositions[pos.begin].input === opts.groupSeparator && pos.end++),
67315 stripValidPositions(pos.begin, pos.end, !1, strict), !0 !== strict && function() { 67316 if (opts.keepStatic) { 67317 for (var validInputs = [], lastAlt = getLastValidPosition(-1, !0), positionsClone = $.extend(!0, {}, getMaskSet().validPositions), prevAltPos = getMaskSet().validPositions[lastAlt]; lastAlt >= 0; lastAlt--) { 67318 var altPos = getMaskSet().validPositions[lastAlt]; 67319 if (altPos) { 67320 if (!0 !== altPos.generatedInput && /[0-9a-bA-Z]/.test(altPos.input) && validInputs.push(altPos.input), 67321 delete getMaskSet().validPositions[lastAlt], altPos.alternation !== undefined && altPos.locator[altPos.alternation] !== prevAltPos.locator[altPos.alternation]) break; 67322 prevAltPos = altPos; 67323 } 67324 } 67325 if (lastAlt > -1) for (getMaskSet().p = seekNext(getLastValidPosition(-1, !0)); validInputs.length > 0; ) { 67326 var keypress = new $.Event("keypress"); 67327 keypress.which = validInputs.pop().charCodeAt(0), EventHandlers.keypressEvent.call(input, keypress, !0, !1, !1, getMaskSet().p); 67328 } else getMaskSet().validPositions = $.extend(!0, {}, positionsClone); 67329 } 67330 }(); 67331 var lvp = getLastValidPosition(pos.begin, !0); 67332 if (lvp < pos.begin) getMaskSet().p = seekNext(lvp); else if (!0 !== strict && (getMaskSet().p = pos.begin, 67333 !0 !== fromIsValid)) for (;getMaskSet().p < lvp && getMaskSet().validPositions[getMaskSet().p] === undefined; ) getMaskSet().p++; 67334 } 67335 function initializeColorMask(input) { 67336 function findCaretPos(clientx) { 67337 var caretPos, e = document.createElement("span"); 67338 for (var style in computedStyle) isNaN(style) && -1 !== style.indexOf("font") && (e.style[style] = computedStyle[style]); 67339 e.style.textTransform = computedStyle.textTransform, e.style.letterSpacing = computedStyle.letterSpacing, 67340 e.style.position = "absolute", e.style.height = "auto", e.style.width = "auto", 67341 e.style.visibility = "hidden", e.style.whiteSpace = "nowrap", document.body.appendChild(e); 67342 var itl, inputText = input.inputmask._valueGet(), previousWidth = 0; 67343 for (caretPos = 0, itl = inputText.length; caretPos <= itl; caretPos++) { 67344 if (e.innerHTML += inputText.charAt(caretPos) || "_", e.offsetWidth >= clientx) { 67345 var offset1 = clientx - previousWidth, offset2 = e.offsetWidth - clientx; 67346 e.innerHTML = inputText.charAt(caretPos), offset1 -= e.offsetWidth / 3, caretPos = offset1 < offset2 ? caretPos - 1 : caretPos; 67347 break; 67348 } 67349 previousWidth = e.offsetWidth; 67350 } 67351 return document.body.removeChild(e), caretPos; 67352 } 67353 var computedStyle = (input.ownerDocument.defaultView || window).getComputedStyle(input, null), template = document.createElement("div"); 67354 template.style.width = computedStyle.width, template.style.textAlign = computedStyle.textAlign, 67355 colorMask = document.createElement("div"), colorMask.className = "im-colormask", 67356 input.parentNode.insertBefore(colorMask, input), input.parentNode.removeChild(input), 67357 colorMask.appendChild(template), colorMask.appendChild(input), input.style.left = template.offsetLeft + "px", 67358 $(input).on("click", function(e) { 67359 return caret(input, findCaretPos(e.clientX)), EventHandlers.clickEvent.call(input, [ e ]); 67360 }), $(input).on("keydown", function(e) { 67361 e.shiftKey || !1 === opts.insertMode || setTimeout(function() { 67362 renderColorMask(input); 67363 }, 0); 67364 }); 67365 } 67366 function renderColorMask(input, caretPos, clear) { 67367 function handleStatic() { 67368 isStatic || null !== test.fn && testPos.input !== undefined ? isStatic && (null !== test.fn && testPos.input !== undefined || "" === test.def) && (isStatic = !1, 67369 maskTemplate += "</span>") : (isStatic = !0, maskTemplate += "<span class='im-static'>"); 67370 } 67371 function handleCaret(force) { 67372 !0 !== force && pos !== caretPos.begin || document.activeElement !== input || (maskTemplate += "<span class='im-caret' style='border-right-width: 1px;border-right-style: solid;'></span>"); 67373 } 67374 var test, testPos, ndxIntlzr, maskTemplate = "", isStatic = !1, pos = 0; 67375 if (colorMask !== undefined) { 67376 var buffer = getBuffer(); 67377 if (caretPos === undefined ? caretPos = caret(input) : caretPos.begin === undefined && (caretPos = { 67378 begin: caretPos, 67379 end: caretPos 67380 }), !0 !== clear) { 67381 var lvp = getLastValidPosition(); 67382 do { 67383 handleCaret(), getMaskSet().validPositions[pos] ? (testPos = getMaskSet().validPositions[pos], 67384 test = testPos.match, ndxIntlzr = testPos.locator.slice(), handleStatic(), maskTemplate += buffer[pos]) : (testPos = getTestTemplate(pos, ndxIntlzr, pos - 1), 67385 test = testPos.match, ndxIntlzr = testPos.locator.slice(), (!1 === opts.jitMasking || pos < lvp || "number" == typeof opts.jitMasking && isFinite(opts.jitMasking) && opts.jitMasking > pos) && (handleStatic(), 67386 maskTemplate += getPlaceholder(pos, test))), pos++; 67387 } while ((maxLength === undefined || pos < maxLength) && (null !== test.fn || "" !== test.def) || lvp > pos || isStatic); 67388 -1 === maskTemplate.indexOf("im-caret") && handleCaret(!0), isStatic && handleStatic(); 67389 } 67390 var template = colorMask.getElementsByTagName("div")[0]; 67391 template.innerHTML = maskTemplate, input.inputmask.positionColorMask(input, template); 67392 } 67393 } 67394 maskset = maskset || this.maskset, opts = opts || this.opts;
67395 var undoValue, $el, maxLength, colorMask, inputmask = this, el = this.el, isRTL = this.isRTL, skipKeyPressEvent = !1, skipInputEvent = !1, ignorable = !1, mouseEnter = !1, EventRuler = { 67396 on: function(input, eventName, eventHandler) { 67397 var ev = function(e) { 67398 if (this.inputmask === undefined && "FORM" !== this.nodeName) { 67399 var imOpts = $.data(this, "_inputmask_opts"); 67400 imOpts ? new Inputmask(imOpts).mask(this) : EventRuler.off(this); 67401 } else { 67402 if ("setvalue" === e.type || "FORM" === this.nodeName || !(this.disabled || this.readOnly && !("keydown" === e.type && e.ctrlKey && 67 === e.keyCode || !1 === opts.tabThrough && e.keyCode === Inputmask.keyCode.TAB))) { 67403 switch (e.type) { 67404 case "input": 67405 if (!0 === skipInputEvent) return skipInputEvent = !1, e.preventDefault(); 67406 break; 67407 67408 case "keydown": 67409 skipKeyPressEvent = !1, skipInputEvent = !1; 67410 break; 67411 67412 case "keypress": 67413 if (!0 === skipKeyPressEvent) return e.preventDefault(); 67414 skipKeyPressEvent = !0; 67415 break; 67416 67417 case "click": 67418 if (iemobile || iphone) { 67419 var that = this, args = arguments; 67420 return setTimeout(function() { 67421 eventHandler.apply(that, args); 67422 }, 0), !1; 67423 } 67424 } 67425 var returnVal = eventHandler.apply(this, arguments); 67426 return !1 === returnVal && (e.preventDefault(), e.stopPropagation()), returnVal; 67427 } 67428 e.preventDefault(); 67429 } 67430 }; 67431 input.inputmask.events[eventName] = input.inputmask.events[eventName] || [], input.inputmask.events[eventName].push(ev), 67432 -1 !== $.inArray(eventName, [ "submit", "reset" ]) ? null !== input.form && $(input.form).on(eventName, ev) : $(input).on(eventName, ev); 67433 }, 67434 off: function(input, event) { 67435 if (input.inputmask && input.inputmask.events) { 67436 var events; 67437 event ? (events = [], events[event] = input.inputmask.events[event]) : events = input.inputmask.events, 67438 $.each(events, function(eventName, evArr) { 67439 for (;evArr.length > 0; ) { 67440 var ev = evArr.pop(); 67441 -1 !== $.inArray(eventName, [ "submit", "reset" ]) ? null !== input.form && $(input.form).off(eventName, ev) : $(input).off(eventName, ev); 67442 } 67443 delete input.inputmask.events[eventName]; 67444 }); 67445 } 67446 } 67447 }, EventHandlers = { 67448 keydownEvent: function(e) { 67449 var input = this, $input = $(input), k = e.keyCode, pos = caret(input); 67450 if (k === Inputmask.keyCode.BACKSPACE || k === Inputmask.keyCode.DELETE || iphone && k === Inputmask.keyCode.BACKSPACE_SAFARI || e.ctrlKey && k === Inputmask.keyCode.X && !function(eventName) { 67451 var el = document.createElement("input"), evName = "on" + eventName, isSupported = evName in el; 67452 return isSupported || (el.setAttribute(evName, "return;"), isSupported = "function" == typeof el[evName]), 67453 el = null, isSupported; 67454 }("cut")) e.preventDefault(), handleRemove(input, k, pos), writeBuffer(input, getBuffer(!0), getMaskSet().p, e, input.inputmask._valueGet() !== getBuffer().join("")), 67455 input.inputmask._valueGet() === getBufferTemplate().join("") ? $input.trigger("cleared") : !0 === isComplete(getBuffer()) && $input.trigger("complete"); else if (k === Inputmask.keyCode.END || k === Inputmask.keyCode.PAGE_DOWN) { 67456 e.preventDefault(); 67457 var caretPos = seekNext(getLastValidPosition()); 67458 opts.insertMode || caretPos !== getMaskSet().maskLength || e.shiftKey || caretPos--, 67459 caret(input, e.shiftKey ? pos.begin : caretPos, caretPos, !0); 67460 } else k === Inputmask.keyCode.HOME && !e.shiftKey || k === Inputmask.keyCode.PAGE_UP ? (e.preventDefault(), 67461 caret(input, 0, e.shiftKey ? pos.begin : 0, !0)) : (opts.undoOnEscape && k === Inputmask.keyCode.ESCAPE || 90 === k && e.ctrlKey) && !0 !== e.altKey ? (checkVal(input, !0, !1, undoValue.split("")), 67462 $input.trigger("click")) : k !== Inputmask.keyCode.INSERT || e.shiftKey || e.ctrlKey ? !0 === opts.tabThrough && k === Inputmask.keyCode.TAB ? (!0 === e.shiftKey ? (null === getTest(pos.begin).match.fn && (pos.begin = seekNext(pos.begin)), 67463 pos.end = seekPrevious(pos.begin, !0), pos.begin = seekPrevious(pos.end, !0)) : (pos.begin = seekNext(pos.begin, !0), 67464 pos.end = seekNext(pos.begin, !0), pos.end < getMaskSet().maskLength && pos.end--), 67465 pos.begin < getMaskSet().maskLength && (e.preventDefault(), caret(input, pos.begin, pos.end))) : e.shiftKey || !1 === opts.insertMode && (k === Inputmask.keyCode.RIGHT ? setTimeout(function() { 67466 var caretPos = caret(input); 67467 caret(input, caretPos.begin); 67468 }, 0) : k === Inputmask.keyCode.LEFT && setTimeout(function() { 67469 var caretPos = caret(input); 67470 caret(input, isRTL ? caretPos.begin + 1 : caretPos.begin - 1); 67471 }, 0)) : (opts.insertMode = !opts.insertMode, caret(input, opts.insertMode || pos.begin !== getMaskSet().maskLength ? pos.begin : pos.begin - 1)); 67472 opts.onKeyDown.call(this, e, getBuffer(), caret(input).begin, opts), ignorable = -1 !== $.inArray(k, opts.ignorables); 67473 },
67474 keypressEvent: function(e, checkval, writeOut, strict, ndx) { 67475 var input = this, $input = $(input), k = e.which || e.charCode || e.keyCode; 67476 if (!(!0 === checkval || e.ctrlKey && e.altKey) && (e.ctrlKey || e.metaKey || ignorable)) return k === Inputmask.keyCode.ENTER && undoValue !== getBuffer().join("") && (undoValue = getBuffer().join(""), 67477 setTimeout(function() { 67478 $input.trigger("change"); 67479 }, 0)), !0; 67480 if (k) { 67481 46 === k && !1 === e.shiftKey && "" !== opts.radixPoint && (k = opts.radixPoint.charCodeAt(0)); 67482 var forwardPosition, pos = checkval ? { 67483 begin: ndx, 67484 end: ndx 67485 } : caret(input), c = String.fromCharCode(k); 67486 getMaskSet().writeOutBuffer = !0; 67487 var valResult = isValid(pos, c, strict); 67488 if (!1 !== valResult && (resetMaskSet(!0), forwardPosition = valResult.caret !== undefined ? valResult.caret : checkval ? valResult.pos + 1 : seekNext(valResult.pos), 67489 getMaskSet().p = forwardPosition), !1 !== writeOut && (setTimeout(function() { 67490 opts.onKeyValidation.call(input, k, valResult, opts); 67491 }, 0), getMaskSet().writeOutBuffer && !1 !== valResult)) { 67492 var buffer = getBuffer(); 67493 writeBuffer(input, buffer, opts.numericInput && valResult.caret === undefined ? seekPrevious(forwardPosition) : forwardPosition, e, !0 !== checkval), 67494 !0 !== checkval && setTimeout(function() { 67495 !0 === isComplete(buffer) && $input.trigger("complete"); 67496 }, 0); 67497 } 67498 if (e.preventDefault(), checkval) return !1 !== valResult && (valResult.forwardPosition = forwardPosition), 67499 valResult; 67500 } 67501 }, 67502 pasteEvent: function(e) { 67503 var tempValue, input = this, ev = e.originalEvent || e, $input = $(input), inputValue = input.inputmask._valueGet(!0), caretPos = caret(input); 67504 isRTL && (tempValue = caretPos.end, caretPos.end = caretPos.begin, caretPos.begin = tempValue); 67505 var valueBeforeCaret = inputValue.substr(0, caretPos.begin), valueAfterCaret = inputValue.substr(caretPos.end, inputValue.length); 67506 if (valueBeforeCaret === (isRTL ? getBufferTemplate().reverse() : getBufferTemplate()).slice(0, caretPos.begin).join("") && (valueBeforeCaret = ""), 67507 valueAfterCaret === (isRTL ? getBufferTemplate().reverse() : getBufferTemplate()).slice(caretPos.end).join("") && (valueAfterCaret = ""), 67508 isRTL && (tempValue = valueBeforeCaret, valueBeforeCaret = valueAfterCaret, valueAfterCaret = tempValue), 67509 window.clipboardData && window.clipboardData.getData) inputValue = valueBeforeCaret + window.clipboardData.getData("Text") + valueAfterCaret; else { 67510 if (!ev.clipboardData || !ev.clipboardData.getData) return !0; 67511 inputValue = valueBeforeCaret + ev.clipboardData.getData("text/plain") + valueAfterCaret; 67512 } 67513 var pasteValue = inputValue; 67514 if ($.isFunction(opts.onBeforePaste)) { 67515 if (!1 === (pasteValue = opts.onBeforePaste.call(inputmask, inputValue, opts))) return e.preventDefault(); 67516 pasteValue || (pasteValue = inputValue); 67517 } 67518 return checkVal(input, !1, !1, isRTL ? pasteValue.split("").reverse() : pasteValue.toString().split("")), 67519 writeBuffer(input, getBuffer(), seekNext(getLastValidPosition()), e, undoValue !== getBuffer().join("")), 67520 !0 === isComplete(getBuffer()) && $input.trigger("complete"), e.preventDefault(); 67521 }, 67522 inputFallBackEvent: function(e) { 67523 var input = this, inputValue = input.inputmask._valueGet(); 67524 if (getBuffer().join("") !== inputValue) { 67525 var caretPos = caret(input); 67526 if (!1 === function(input, inputValue, caretPos) { 67527 if ("." === inputValue.charAt(caretPos.begin - 1) && "" !== opts.radixPoint && (inputValue = inputValue.split(""), 67528 inputValue[caretPos.begin - 1] = opts.radixPoint.charAt(0), inputValue = inputValue.join("")), 67529 inputValue.charAt(caretPos.begin - 1) === opts.radixPoint && inputValue.length > getBuffer().length) { 67530 var keypress = new $.Event("keypress"); 67531 return keypress.which = opts.radixPoint.charCodeAt(0), EventHandlers.keypressEvent.call(input, keypress, !0, !0, !1, caretPos.begin - 1), 67532 !1; 67533 } 67534 }(input, inputValue, caretPos)) return !1; 67535 if (inputValue = inputValue.replace(new RegExp("(" + Inputmask.escapeRegex(getBufferTemplate().join("")) + ")*"), ""), 67536 !1 === function(input, inputValue, caretPos) { 67537 if (iemobile) { 67538 var inputChar = inputValue.replace(getBuffer().join(""), ""); 67539 if (1 === inputChar.length) { 67540 var keypress = new $.Event("keypress"); 67541 return keypress.which = inputChar.charCodeAt(0), EventHandlers.keypressEvent.call(input, keypress, !0, !0, !1, getMaskSet().validPositions[caretPos.begin - 1] ? caretPos.begin : caretPos.begin - 1), 67542 !1; 67543 } 67544 } 67545 }(input, inputValue, caretPos)) return !1; 67546 caretPos.begin > inputValue.length && (caret(input, inputValue.length), caretPos = caret(input)); 67547 var buffer = getBuffer().join(""), frontPart = inputValue.substr(0, caretPos.begin), backPart = inputValue.substr(caretPos.begin), frontBufferPart = buffer.substr(0, caretPos.begin), backBufferPart = buffer.substr(caretPos.begin), selection = caretPos, entries = "", isEntry = !1; 67548 if (frontPart !== frontBufferPart) { 67549 selection.begin = 0; 67550 for (var fpl = (isEntry = frontPart.length >= frontBufferPart.length) ? frontPart.length : frontBufferPart.length, i = 0; frontPart.charAt(i) === frontBufferPart.charAt(i) && i < fpl; i++) selection.begin++; 67551 isEntry && (entries += frontPart.slice(selection.begin, selection.end)); 67552 } 67553 backPart !== backBufferPart && (backPart.length > backBufferPart.length ? isEntry && (selection.end = selection.begin) : backPart.length < backBufferPart.length ? selection.end += backBufferPart.length - backPart.length : backPart.charAt(0) !== backBufferPart.charAt(0) && selection.end++), 67554 writeBuffer(input, getBuffer(), selection), entr
67554ies.length > 0 ? $.each(entries.split(""), function(ndx, entry) { 67555 var keypress = new $.Event("keypress"); 67556 keypress.which = entry.charCodeAt(0), ignorable = !1, EventHandlers.keypressEvent.call(input, keypress); 67557 }) : (selection.begin === selection.end - 1 && caret(input, seekPrevious(selection.begin + 1), selection.end), 67558 e.keyCode = Inputmask.keyCode.DELETE, EventHandlers.keydownEvent.call(input, e)), 67559 e.preventDefault(); 67560 } 67561 }, 67562 setValueEvent: function(e) { 67563 this.inputmask.refreshValue = !1; 67564 var input = this, value = input.inputmask._valueGet(!0); 67565 $.isFunction(opts.onBeforeMask) && (value = opts.onBeforeMask.call(inputmask, value, opts) || value), 67566 value = value.split(""), checkVal(input, !0, !1, isRTL ? value.reverse() : value), 67567 undoValue = getBuffer().join(""), (opts.clearMaskOnLostFocus || opts.clearIncomplete) && input.inputmask._valueGet() === getBufferTemplate().join("") && input.inputmask._valueSet(""); 67568 }, 67569 focusEvent: function(e) { 67570 var input = this, nptValue = input.inputmask._valueGet(); 67571 opts.showMaskOnFocus && (!opts.showMaskOnHover || opts.showMaskOnHover && "" === nptValue) && (input.inputmask._valueGet() !== getBuffer().join("") ? writeBuffer(input, getBuffer(), seekNext(getLastValidPosition())) : !1 === mouseEnter && caret(input, seekNext(getLastValidPosition()))), 67572 !0 === opts.positionCaretOnTab && !1 === mouseEnter && "" !== nptValue && (writeBuffer(input, getBuffer(), caret(input)), 67573 EventHandlers.clickEvent.apply(input, [ e, !0 ])), undoValue = getBuffer().join(""); 67574 }, 67575 mouseleaveEvent: function(e) { 67576 var input = this; 67577 if (mouseEnter = !1, opts.clearMaskOnLostFocus && document.activeElement !== input) { 67578 var buffer = getBuffer().slice(), nptValue = input.inputmask._valueGet(); 67579 nptValue !== input.getAttribute("placeholder") && "" !== nptValue && (-1 === getLastValidPosition() && nptValue === getBufferTemplate().join("") ? buffer = [] : clearOptionalTail(buffer), 67580 writeBuffer(input, buffer)); 67581 } 67582 }, 67583 clickEvent: function(e, tabbed) { 67584 function doRadixFocus(clickPos) { 67585 if ("" !== opts.radixPoint) { 67586 var vps = getMaskSet().validPositions; 67587 if (vps[clickPos] === undefined || vps[clickPos].input === getPlaceholder(clickPos)) { 67588 if (clickPos < seekNext(-1)) return !0; 67589 var radixPos = $.inArray(opts.radixPoint, getBuffer()); 67590 if (-1 !== radixPos) { 67591 for (var vp in vps) if (radixPos < vp && vps[vp].input !== getPlaceholder(vp)) return !1; 67592 return !0; 67593 } 67594 } 67595 } 67596 return !1; 67597 } 67598 var input = this; 67599 setTimeout(function() { 67600 if (document.activeElement === input) { 67601 var selectedCaret = caret(input); 67602 if (tabbed && (isRTL ? selectedCaret.end = selectedCaret.begin : selectedCaret.begin = selectedCaret.end), 67603 selectedCaret.begin === selectedCaret.end) switch (opts.positionCaretOnClick) { 67604 case "none": 67605 break; 67606 67607 case "radixFocus": 67608 if (doRadixFocus(selectedCaret.begin)) { 67609 var radixPos = getBuffer().join("").indexOf(opts.radixPoint); 67610 caret(input, opts.numericInput ? seekNext(radixPos) : radixPos); 67611 break; 67612 } 67613 67614 default: 67615 var clickPosition = selectedCaret.begin, lvclickPosition = getLastValidPosition(clickPosition, !0), lastPosition = seekNext(lvclickPosition); 67616 if (clickPosition < lastPosition) caret(input, isMask(clickPosition, !0) || isMask(clickPosition - 1, !0) ? clickPosition : seekNext(clickPosition)); else { 67617 var lvp = getMaskSet().validPositions[lvclickPosition], tt = getTestTemplate(lastPosition, lvp ? lvp.match.locator : undefined, lvp), placeholder = getPlaceholder(lastPosition, tt.match); 67618 if ("" !== placeholder && getBuffer()[lastPosition] !== placeholder && !0 !== tt.match.optionalQuantifier && !0 !== tt.match.newBlockMarker || !isMask(lastPosition, !0) && tt.match.def === placeholder) { 67619 var newPos = seekNext(lastPosition); 67620 (clickPosition >= newPos || clickPosition === lastPosition) && (lastPosition = newPos); 67621 } 67622 caret(input, lastPosition); 67623 } 67624 } 67625 } 67626 }, 0); 67627 }, 67628 dblclickEvent: function(e) { 67629 var input = this; 67630 setTimeout(function() { 67631 caret(input, 0, seekNext(getLastValidPosition())); 67632 }, 0); 67633 }, 67634 cutEvent: function(e) { 67635 var input = this, $input = $(input), pos = caret(input), ev = e.originalEvent || e, clipboardData = window.clipboardData || ev.clipboardData, clipData = isRTL ? getBuffer().slice(pos.end, pos.begin) : getBuffer().slice(pos.begin, pos.end); 67636 clipboardData.setData("text", isRTL ? clipData.reverse().join("") : clip
67636Data.join("")), 67637 document.execCommand && document.execCommand("copy"), handleRemove(input, Inputmask.keyCode.DELETE, pos), 67638 writeBuffer(input, getBuffer(), getMaskSet().p, e, undoValue !== getBuffer().join("")), 67639 input.inputmask._valueGet() === getBufferTemplate().join("") && $input.trigger("cleared"); 67640 }, 67641 blurEvent: function(e) { 67642 var $input = $(this), input = this; 67643 if (input.inputmask) { 67644 var nptValue = input.inputmask._valueGet(), buffer = getBuffer().slice(); 67645 "" !== nptValue && (opts.clearMaskOnLostFocus && (-1 === getLastValidPosition() && nptValue === getBufferTemplate().join("") ? buffer = [] : clearOptionalTail(buffer)), 67646 !1 === isComplete(buffer) && (setTimeout(function() { 67647 $input.trigger("incomplete"); 67648 }, 0), opts.clearIncomplete && (resetMaskSet(), buffer = opts.clearMaskOnLostFocus ? [] : getBufferTemplate().slice())), 67649 writeBuffer(input, buffer, undefined, e)), undoValue !== getBuffer().join("") && (undoValue = buffer.join(""), 67650 $input.trigger("change")); 67651 } 67652 }, 67653 mouseenterEvent: function(e) { 67654 var input = this; 67655 mouseEnter = !0, document.activeElement !== input && opts.showMaskOnHover && input.inputmask._valueGet() !== getBuffer().join("") && writeBuffer(input, getBuffer()); 67656 }, 67657 submitEvent: function(e) { 67658 undoValue !== getBuffer().join("") && $el.trigger("change"), opts.clearMaskOnLostFocus && -1 === getLastValidPosition() && el.inputmask._valueGet && el.inputmask._valueGet() === getBufferTemplate().join("") && el.inputmask._valueSet(""), 67659 opts.removeMaskOnSubmit && (el.inputmask._valueSet(el.inputmask.unmaskedvalue(), !0), 67660 setTimeout(function() { 67661 writeBuffer(el, getBuffer()); 67662 }, 0)); 67663 }, 67664 resetEvent: function(e) { 67665 el.inputmask.refreshValue = !0, setTimeout(function() { 67666 $el.trigger("setvalue"); 67667 }, 0); 67668 } 67669 }; 67670 Inputmask.prototype.positionColorMask = function(input, template) { 67671 input.style.left = template.offsetLeft + "px"; 67672 }; 67673 var valueBuffer; 67674 if (actionObj !== undefined) switch (actionObj.action) { 67675 case "isComplete": 67676 return el = actionObj.el, isComplete(getBuffer()); 67677 67678 case "unmaskedvalue": 67679 return el !== undefined && actionObj.value === undefined || (valueBuffer = actionObj.value, 67680 valueBuffer = ($.isFunction(opts.onBeforeMask) ? opts.onBeforeMask.call(inputmask, valueBuffer, opts) || valueBuffer : valueBuffer).split(""), 67681 checkVal(undefined, !1, !1, isRTL ? valueBuffer.reverse() : valueBuffer), $.isFunction(opts.onBeforeWrite) && opts.onBeforeWrite.call(inputmask, undefined, getBuffer(), 0, opts)), 67682 unmaskedvalue(el); 67683 67684 case "mask": 67685 !function(elem) { 67686 EventRuler.off(elem); 67687 var isSupported = function(input, opts) { 67688 var elementType = input.getAttribute("type"), isSupported = "INPUT" === input.tagName && -1 !== $.inArray(elementType, opts.supportsInputType) || input.isContentEditable || "TEXTAREA" === input.tagName; 67689 if (!isSupported) if ("INPUT" === input.tagName) { 67690 var el = document.createElement("input"); 67691 el.setAttribute("type", elementType), isSupported = "text" === el.type, el = null; 67692 } else isSupported = "partial"; 67693 return !1 !== isSupported ? function(npt) { 67694 function getter() { 67695 return this.inputmask ? this.inputmask.opts.autoUnmask ? this.inputmask.unmaskedvalue() : -1 !== getLastValidPosition() || !0 !== opts.nullable ? document.activeElement === this && opts.clearMaskOnLostFocus ? (isRTL ? clearOptionalTail(getBuffer().slice()).reverse() : clearOptionalTail(getBuffer().slice())).join("") : valueGet.call(this) : "" : valueGet.call(this); 67696 } 67697 function setter(value) { 67698 valueSet.call(this, value), this.inputmask && $(this).trigger("setvalue"); 67699 } 67700 var valueGet, valueSet; 67701 if (!npt.inputmask.__valueGet) { 67702 if (!0 !== opts.noValuePatching) { 67703 if (Object.getOwnPropertyDescriptor) { 67704 "function" != typeof Object.getPrototypeOf && (Object.getPrototypeOf = "object" === _typeof("test".__proto__) ? function(object) { 67705 return object.__proto__; 67706 } : function(object) { 67707 return object.constructor.prototype; 67708 }); 67709 var valueProperty = Object.getPrototypeOf ? Object.getOwnPropertyDescriptor(Object.getPrototypeOf(npt), "value") : undefined; 67710 valueProperty && valueProperty.get && valueProperty.set ? (valueGet = valueProperty.get, 67711 valueSet = valueProperty.set, Object.defineProperty(npt, "value", { 67712 get: getter, 67713 set: setter, 67714 configurable: !0 67715 })) : "INPUT" !== npt.tagName && (valueGet = function() { 67716 return this.textContent; 67717 }, valueSet = function(value) { 67718 this.textContent = value; 67719 }, Object.defineProperty(npt, "value", { 67720 get: getter, 67721 set: setter, 67722 configurable: !0 67723 })); 67724 } else document.__lookupGetter__ && npt.__lookupGetter__("value") && (valueGet = npt.__lookupGetter__("value"), 67725 valueSet = npt.__lookupSetter__("value"), npt.__defineGetter__("value", getter), 67726 npt.__defineSetter__("value", setter)); 67727 npt.inputmask.__valueGet = valueGet, npt.inputmask.__valueSet = valueSet; 67728 } 67729 npt.inputmask._valueGet = function(overruleRTL) { 67730 return isRTL && !0 !== overruleRTL ? valueGet.call(this.el).split("").reverse().join("") : valueGet.call(this.el); 67731 }, npt.inputmask._valueSet = function(value, overruleRTL) { 67732 valueSet.call(this.el, null === value || value === undefined ? "" : !0 !== overruleRTL && isRTL ? value.split("").reverse().join("") : value); 67733 }, valueGet === undefined && (valueGet = function() { 67734 return this.value; 67735 }, valueSet = function(value) { 67736 this.value = value; 67737 }, function(type) { 67738 if ($.valHooks && ($.valHooks[type] === undefined || !0 !== $.valHooks[type].inputmaskpatch)) { 67739 var valhookGet = $.valHooks[type] && $.valHooks[type].get ? $.valHooks[type].get : function(elem) { 67740 return elem.value; 67741 }, valhookSet = $.valHooks[type] && $.valHooks[type].set ? $.valHooks[type].set : function(elem, value) { 67742 return elem.value = value, elem; 67743 }; 67744 $.valHooks[type] = { 67745 get: function(elem) { 67746 if (elem.inputmask) { 67747 if (elem.inputmask.opts.autoUnmask) return elem.inputmask.unmaskedvalue(); 67748 var result = valhookGet(elem); 67749 return -1 !== getLastValidPosition(undefined, undefined, elem.inputmask.maskset.validPositions) || !0 !== opts.nullable ? result : ""; 67750 } 67751 return valhookGet(elem); 67752 }, 67753 set: function(elem, value) { 67754 var result, $elem = $(elem); 67755 return result = valhookSet(elem, value), elem.inputmask && $elem.trigger("setvalue"), 67756 result; 67757 }, 67758 inputmaskpatch: !0 67759 }; 67760 } 67761 }(npt.type), function(npt) { 67762 EventRuler.on(npt, "mouseenter", function(event) { 67763 var $input = $(this); 67764 this.inputmask._valueGet() !== getBuffer().join("") && $input.trigger("setvalue"); 67765 }); 67766 }(npt)); 67767 } 67768 }(input) : input.inputmask = undefined, isSupported; 67769 }(elem, opts); 67770 if (!1 !== isSupported && (el = elem, $el = $(el), maxLength = el !== undefined ? el.maxLength : undefined, 67771 -1 === maxLength && (maxLength = undefined), !0 === opts.colorMask && initializeColorMask(el), 67772 android && (el.hasOwnProperty("inputmode") && (el.inputmode = opts.inputmode, el.setAttribute("inputmode", opts.inputmode)), 67773 "rtfm" === opts.androidHack && (!0 !== opts.colorMask && initializeColorMask(el), 67774 el.type = "password")), !0 === isSupported && (EventRuler.on(el, "submit", EventHandlers.submitEvent), 67775 EventRuler.on(el, "reset", EventHandlers.resetEvent), EventRuler.on(el, "mouseenter", EventHandlers.mouseenterEvent), 67776 EventRuler.on(el, "blur", EventHandlers.blurEvent), EventRuler.on(el, "focus", EventHandlers.focusEvent), 67777 EventRuler.on(el, "mouseleave", EventHandlers.mouseleaveEvent), !0 !== opts.colorMask && EventRuler.on(el, "click", EventHandlers.clickEvent), 67778 EventRuler.on(el, "dblclick", EventHandlers.dblclickEvent), EventRuler.on(el, "paste", EventHandlers.pasteEvent), 67779 EventRuler.on(el, "dragdrop", EventHandlers.pasteEvent), EventRuler.on(el, "drop", EventHandlers.pasteEvent), 67780 EventRuler.on(el, "cut", EventHandlers.cutEvent), EventRuler.on(el, "complete", opts.oncomplete), 67781 EventRuler.on(el, "incomplete", opts.onincomplete), EventRuler.on(el, "cleared", opts.oncleared), 67782 android || !0 === opts.inputEventOnly ? el.removeAttribute("maxLength") : (EventRuler.on(el, "keydown", EventHandlers.keydownEvent), 67783 EventRuler.on(el, "keypress", EventHandlers.keypressEvent)), EventRuler.on(el, "compositionstart", $.noop), 67784 EventRuler.on(el, "compositionupdate", $.noop), EventRuler.on(el, "compositionend", $.noop), 67785 EventRuler.on(el, "keyup", $.noop), EventRuler.on(el, "input", EventHandlers.inputFallBackEvent), 67786 EventRuler.on(el, "beforeinput", $.noop)), EventRuler.on(el, "setvalue", EventHandlers.setValueEvent), 67787 undoValue = getBufferTemplate().join(""), "" !== el.inputmask._valueGet(!0) || !1 === opts.clearMaskOnLostFocus || document.activeElement === el)) { 67788 var initialValue = $.isFunction(opts.onBeforeMask) ? opts.onBeforeMask.call(inputmask, el.inputmask._valueGet(!0), opts) || el.inputmask._valueGet(!0) : el.inputmask._valueGet(!0); 67789 "" !== initialValue && checkVal(el, !0, !1, isRTL ? initialValue.split("").reverse() : initialValue.split("")); 67790 var buffer = getBuffer().slice(); 67791 undoValue = buffer.join(""), !1 === isComplete(buffer) && opts.clearIncomplete && resetMaskSet(), 67792 opts.clearMaskOnLostFocus && document.activeElement !== el && (-1 === getLastValidPosition() ? buffer = [] : clearOptionalTail(buffer)), 67793 writeBuffer(el, buffer), document.activeElement === el && caret(el, seekNext(getLastValidPosition())); 67794 } 67795 }(el); 67796 break; 67797 67798 case "format": 67799 return valueBuffer = ($.isFunction(opts.onBeforeMask) ? opts.onBeforeMask.call(inputmask, actionObj.value, opts) || actionObj.value : actionObj.value).split(""), 67800 checkVal(undefined, !0, !1, isRTL ? valueBuffer.reverse() : valueBuffer), actionObj.metadata ? { 67801 value: isRTL ? getBuffer().slice().reverse().join("") : getBuffer().join(""), 67802 metadata: maskScope.call(this, { 67803 action: "getmetadata" 67804 }, maskset, opts) 67805 } : isRTL ? getBuffer().slice().reverse().join("") : getBuffer().join(""); 67806 67807 case "isValid": 67808 actionObj.value ? (valueBuffer = actionObj.value.split(""), checkVal(undefined, !0, !0, isRTL ? valueBuffer.reverse() : valueBuffer)) : actionObj.value = getBuffer().join(""); 67809 for (var buffer = getBuffer(), rl = determineLastRequiredPosition(), lmib = buffer.length - 1; lmib > rl && !isMask(lmib); lmib--) ; 67810 return buffer.splice(rl, lmib + 1 - rl), isComplete(buffer) && actionObj.value === getBuffer().join(""); 67811 67812 case "getemptymask": 67813 return getBufferTemplate().join(""); 67814 67815 case "remove": 67816 if (el && el.inputmask) { 67817 $el = $(el), el.inputmask._valueSet(opts.autoUnmask ? unmaskedvalue(el) : el.inputmask._valueGet(!0)), 67818 EventRuler.off(el);
67819 Object.getOwnPropertyDescriptor && Object.getPrototypeOf ? Object.getOwnPropertyDescriptor(Object.getPrototypeOf(el), "value") && el.inputmask.__valueGet && Object.defineProperty(el, "value", { 67820 get: el.inputmask.__valueGet, 67821 set: el.inputmask.__valueSet, 67822 configurable: !0 67823 }) : document.__lookupGetter__ && el.__lookupGetter__("value") && el.inputmask.__valueGet && (el.__defineGetter__("value", el.inputmask.__valueGet), 67824 el.__defineSetter__("value", el.inputmask.__valueSet)), el.inputmask = undefined; 67825 } 67826 return el; 67827 67828 case "getmetadata": 67829 if ($.isArray(maskset.metadata)) { 67830 var maskTarget = getMaskTemplate(!0, 0, !1).join(""); 67831 return $.each(maskset.metadata, function(ndx, mtdt) { 67832 if (mtdt.mask === maskTarget) return maskTarget = mtdt, !1; 67833 }), maskTarget; 67834 } 67835 return maskset.metadata; 67836 } 67837 } 67838 var ua = navigator.userAgent, mobile = /mobile/i.test(ua), iemobile = /iemobile/i.test(ua), iphone = /iphone/i.test(ua) && !iemobile, android = /android/i.test(ua) && !iemobile; 67839 return Inputmask.prototype = { 67840 dataAttribute: "data-inputmask", 67841 defaults: { 67842 placeholder: "_", 67843 optionalmarker: { 67844 start: "[", 67845 end: "]" 67846 }, 67847 quantifiermarker: { 67848 start: "{", 67849 end: "}" 67850 }, 67851 groupmarker: { 67852 start: "(", 67853 end: ")" 67854 }, 67855 alternatormarker: "|", 67856 escapeChar: "\\", 67857 mask: null, 67858 regex: null, 67859 oncomplete: $.noop, 67860 onincomplete: $.noop, 67861 oncleared: $.noop, 67862 repeat: 0, 67863 greedy: !0, 67864 autoUnmask: !1, 67865 removeMaskOnSubmit: !1, 67866 clearMaskOnLostFocus: !0, 67867 insertMode: !0, 67868 clearIncomplete: !1, 67869 alias: null, 67870 onKeyDown: $.noop, 67871 onBeforeMask: null, 67872 onBeforePaste: function(pastedValue, opts) { 67873 return $.isFunction(opts.onBeforeMask) ? opts.onBeforeMask.call(this, pastedValue, opts) : pastedValue; 67874 }, 67875 onBeforeWrite: null, 67876 onUnMask: null, 67877 showMaskOnFocus: !0, 67878 showMaskOnHover: !0, 67879 onKeyValidation: $.noop, 67880 skipOptionalPartCharacter: " ", 67881 numericInput: !1, 67882 rightAlign: !1, 67883 undoOnEscape: !0, 67884 radixPoint: "", 67885 radixPointDefinitionSymbol: undefined, 67886 groupSeparator: "", 67887 keepStatic: null, 67888 positionCaretOnTab: !0, 67889 tabThrough: !1, 67890 supportsInputType: [ "text", "tel", "password" ], 67891 ignorables: [ 8, 9, 13, 19, 27, 33, 34, 35, 36, 37, 38, 39, 40, 45, 46, 93, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 0, 229 ], 67892 isComplete: null, 67893 canClearPosition: $.noop, 67894 preValidation: null, 67895 postValidation: null, 67896 staticDefinitionSymbol: undefined, 67897 jitMasking: !1, 67898 nullable: !0, 67899 inputEventOnly: !1, 67900 noValuePatching: !1, 67901 positionCaretOnClick: "lvp", 67902 casing: null, 67903 inputmode: "verbatim", 67904 colorMask: !1, 67905 androidHack: !1, 67906 importDataAttributes: !0 67907 }, 67908 definitions: { 67909 "9": { 67910 validator: "[0-9]", 67911 cardinality: 1, 67912 definitionSymbol: "*" 67913 }, 67914 a: { 67915 validator: "[A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]", 67916 cardinality: 1, 67917 definitionSymbol: "*" 67918 }, 67919 "*": { 67920 validator: "[0-9A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]", 67921 cardinality: 1 67922 } 67923 }, 67924 aliases: {}, 67925 masksCache: {}, 67926 mask: function(elems) { 67927 function importAttributeOptions(npt, opts, userOptions, dataAttribute) { 67928 if (!0 === opts.importDataAttributes) { 67929 var option, dataoptions, optionData, p, importOption = function(option, optionData) { 67930 null !== (optionData = optionData !== undefined ? optionData : npt.getAttribute(dataAttribute + "-" + option)) && ("string" == typeof optionData && (0 === option.indexOf("on") ? optionData = window[optionData] : "false" === optionData ? optionData = !1 : "true" === optionData && (
67930optionData = !0)), 67931 userOptions[option] = optionData); 67932 }, attrOptions = npt.getAttribute(dataAttribute); 67933 if (attrOptions && "" !== attrOptions && (attrOptions = attrOptions.replace(new RegExp("'", "g"), '"'), 67934 dataoptions = JSON.parse("{" + attrOptions + "}")), dataoptions) { 67935 optionData = undefined; 67936 for (p in dataoptions) if ("alias" === p.toLowerCase()) { 67937 optionData = dataoptions[p]; 67938 break; 67939 } 67940 } 67941 importOption("alias", optionData), userOptions.alias && resolveAlias(userOptions.alias, userOptions, opts); 67942 for (option in opts) { 67943 if (dataoptions) { 67944 optionData = undefined; 67945 for (p in dataoptions) if (p.toLowerCase() === option.toLowerCase()) { 67946 optionData = dataoptions[p]; 67947 break; 67948 } 67949 } 67950 importOption(option, optionData); 67951 } 67952 } 67953 return $.extend(!0, opts, userOptions), ("rtl" === npt.dir || opts.rightAlign) && (npt.style.textAlign = "right"), 67954 ("rtl" === npt.dir || opts.numericInput) && (npt.dir = "ltr", npt.removeAttribute("dir"), 67955 opts.isRTL = !0), opts; 67956 } 67957 var that = this; 67958 return "string" == typeof elems && (elems = document.getElementById(elems) || document.querySelectorAll(elems)), 67959 elems = elems.nodeName ? [ elems ] : elems, $.each(elems, function(ndx, el) { 67960 var scopedOpts = $.extend(!0, {}, that.opts); 67961 importAttributeOptions(el, scopedOpts, $.extend(!0, {}, that.userOptions), that.dataAttribute); 67962 var maskset = generateMaskSet(scopedOpts, that.noMasksCache); 67963 maskset !== undefined && (el.inputmask !== undefined && (el.inputmask.opts.autoUnmask = !0, 67964 el.inputmask.remove()), el.inputmask = new Inputmask(undefined, undefined, !0), 67965 el.inputmask.opts = scopedOpts, el.inputmask.noMasksCache = that.noMasksCache, el.inputmask.userOptions = $.extend(!0, {}, that.userOptions), 67966 el.inputmask.isRTL = scopedOpts.isRTL || scopedOpts.numericInput, el.inputmask.el = el, 67967 el.inputmask.maskset = maskset, $.data(el, "_inputmask_opts", scopedOpts), maskScope.call(el.inputmask, { 67968 action: "mask" 67969 })); 67970 }), elems && elems[0] ? elems[0].inputmask || this : this; 67971 }, 67972 option: function(options, noremask) { 67973 return "string" == typeof options ? this.opts[options] : "object" === (void 0 === options ? "undefined" : _typeof(options)) ? ($.extend(this.userOptions, options), 67974 this.el && !0 !== noremask && this.mask(this.el), this) : void 0; 67975 }, 67976 unmaskedvalue: function(value) { 67977 return this.maskset = this.maskset || generateMaskSet(this.opts, this.noMasksCache), 67978 maskScope.call(this, { 67979 action: "unmaskedvalue", 67980 value: value 67981 }); 67982 }, 67983 remove: function() { 67984 return maskScope.call(this, { 67985 action: "remove" 67986 }); 67987 }, 67988 getemptymask: function() { 67989 return this.maskset = this.maskset || generateMaskSet(this.opts, this.noMasksCache), 67990 maskScope.call(this, { 67991 action: "getemptymask" 67992 }); 67993 }, 67994 hasMaskedValue: function() { 67995 return !this.opts.autoUnmask; 67996 }, 67997 isComplete: function() { 67998 return this.maskset = this.maskset || generateMaskSet(this.opts, this.noMasksCache), 67999 maskScope.call(this, { 68000 action: "isComplete" 68001 }); 68002 }, 68003 getmetadata: function() { 68004 return this.maskset = this.maskset || generateMaskSet(this.opts, this.noMasksCache), 68005 maskScope.call(this, { 68006 action: "getmetadata" 68007 }); 68008 }, 68009 isValid: function(value) { 68010 return this.maskset = this.maskset || generateMaskSet(this.opts, this.noMasksCache), 68011 maskScope.call(this, { 68012 action: "isValid", 68013 value: value 68014 }); 68015 }, 68016 format: function(value, metadata) { 68017 return this.maskset = this.maskset || generateMaskSet(this.opts, this.noMasksCache), 68018 maskScope.call(this, { 68019 action: "format", 68020 value: value, 68021 metadata: metadata 68022 }); 68023 }, 68024 analyseMask: function(mask, regexMask, opts) { 68025 function MaskToken(isGroup, isOptional, isQuantifier, isAlternator) { 68026 this.matches = [], this.openGroup = isGroup || !1, this.alternatorGroup = !1, this.isGroup = isGroup || !1, 68027 this.isOptional = isOptional || !1, this.isQuantifier = is
68027Quantifier || !1, this.isAlternator = isAlternator || !1, 68028 this.quantifier = { 68029 min: 1, 68030 max: 1 68031 }; 68032 } 68033 function insertTestDefinition(mtoken, element, position) { 68034 position = position !== undefined ? position : mtoken.matches.length; 68035 var prevMatch = mtoken.matches[position - 1]; 68036 if (regexMask) 0 === element.indexOf("[") || escaped && /\\d|\\s|\\w]/i.test(element) || "." === element ? mtoken.matches.splice(position++, 0, { 68037 fn: new RegExp(element, opts.casing ? "i" : ""), 68038 cardinality: 1, 68039 optionality: mtoken.isOptional, 68040 newBlockMarker: prevMatch === undefined || prevMatch.def !== element, 68041 casing: null, 68042 def: element, 68043 placeholder: undefined, 68044 nativeDef: element 68045 }) : (escaped && (element = element[element.length - 1]), $.each(element.split(""), function(ndx, lmnt) { 68046 prevMatch = mtoken.matches[position - 1], mtoken.matches.splice(position++, 0, { 68047 fn: null, 68048 cardinality: 0, 68049 optionality: mtoken.isOptional, 68050 newBlockMarker: prevMatch === undefined || prevMatch.def !== lmnt && null !== prevMatch.fn, 68051 casing: null, 68052 def: opts.staticDefinitionSymbol || lmnt, 68053 placeholder: opts.staticDefinitionSymbol !== undefined ? lmnt : undefined, 68054 nativeDef: lmnt 68055 }); 68056 })), escaped = !1; else { 68057 var maskdef = (opts.definitions ? opts.definitions[element] : undefined) || Inputmask.prototype.definitions[element]; 68058 if (maskdef && !escaped) { 68059 for (var prevalidators = maskdef.prevalidator, prevalidatorsL = prevalidators ? prevalidators.length : 0, i = 1; i < maskdef.cardinality; i++) { 68060 var prevalidator = prevalidatorsL >= i ? prevalidators[i - 1] : [], validator = prevalidator.validator, cardinality = prevalidator.cardinality; 68061 mtoken.matches.splice(position++, 0, { 68062 fn: validator ? "string" == typeof validator ? new RegExp(validator, opts.casing ? "i" : "") : new function() { 68063 this.test = validator; 68064 }() : new RegExp("."), 68065 cardinality: cardinality || 1, 68066 optionality: mtoken.isOptional, 68067 newBlockMarker: prevMatch === undefined || prevMatch.def !== (maskdef.definitionSymbol || element), 68068 casing: maskdef.casing, 68069 def: maskdef.definitionSymbol || element, 68070 placeholder: maskdef.placeholder, 68071 nativeDef: element 68072 }), prevMatch = mtoken.matches[position - 1]; 68073 } 68074 mtoken.matches.splice(position++, 0, { 68075 fn: maskdef.validator ? "string" == typeof maskdef.validator ? new RegExp(maskdef.validator, opts.casing ? "i" : "") : new function() { 68076 this.test = maskdef.validator; 68077 }() : new RegExp("."), 68078 cardinality: maskdef.cardinality, 68079 optionality: mtoken.isOptional, 68080 newBlockMarker: prevMatch === undefined || prevMatch.def !== (maskdef.definitionSymbol || element), 68081 casing: maskdef.casing, 68082 def: maskdef.definitionSymbol || element, 68083 placeholder: maskdef.placeholder, 68084 nativeDef: element 68085 }); 68086 } else mtoken.matches.splice(position++, 0, { 68087 fn: null, 68088 cardinality: 0, 68089 optionality: mtoken.isOptional, 68090 newBlockMarker: prevMatch === undefined || prevMatch.def !== element && null !== prevMatch.fn, 68091 casing: null, 68092 def: opts.staticDefinitionSymbol || element, 68093 placeholder: opts.staticDefinitionSymbol !== undefined ? element : undefined, 68094 nativeDef: element 68095 }), escaped = !1; 68096 } 68097 } 68098 function verifyGroupMarker(maskToken) { 68099 maskToken && maskToken.matches && $.each(maskToken.matches, function(ndx, token) { 68100 var nextToken = maskToken.matches[ndx + 1];
68101 (nextToken === undefined || nextToken.matches === undefined || !1 === nextToken.isQuantifier) && token && token.isGroup && (token.isGroup = !1, 68102 regexMask || (insertTestDefinition(token, opts.groupmarker.start, 0), !0 !== token.openGroup && insertTestDefinition(token, opts.groupmarker.end))), 68103 verifyGroupMarker(token); 68104 }); 68105 } 68106 function defaultCase() { 68107 if (openenings.length > 0) { 68108 if (currentOpeningToken = openenings[openenings.length - 1], insertTestDefinition(currentOpeningToken, m), 68109 currentOpeningToken.isAlternator) { 68110 alternator = openenings.pop(); 68111 for (var mndx = 0; mndx < alternator.matches.length; mndx++) alternator.matches[mndx].isGroup = !1; 68112 openenings.length > 0 ? (currentOpeningToken = openenings[openenings.length - 1], 68113 currentOpeningToken.matches.push(alternator)) : currentToken.matches.push(alternator); 68114 } 68115 } else insertTestDefinition(currentToken, m); 68116 } 68117 function reverseTokens(maskToken) { 68118 maskToken.matches = maskToken.matches.reverse(); 68119 for (var match in maskToken.matches) if (maskToken.matches.hasOwnProperty(match)) { 68120 var intMatch = parseInt(match); 68121 if (maskToken.matches[match].isQuantifier && maskToken.matches[intMatch + 1] && maskToken.matches[intMatch + 1].isGroup) { 68122 var qt = maskToken.matches[match]; 68123 maskToken.matches.splice(match, 1), maskToken.matches.splice(intMatch + 1, 0, qt); 68124 } 68125 maskToken.matches[match].matches !== undefined ? maskToken.matches[match] = reverseTokens(maskToken.matches[match]) : maskToken.matches[match] = function(st) { 68126 return st === opts.optionalmarker.start ? st = opts.optionalmarker.end : st === opts.optionalmarker.end ? st = opts.optionalmarker.start : st === opts.groupmarker.start ? st = opts.groupmarker.end : st === opts.groupmarker.end && (st = opts.groupmarker.start), 68127 st; 68128 }(maskToken.matches[match]); 68129 } 68130 return maskToken; 68131 } 68132 var match, m, openingToken, currentOpeningToken, alternator, lastMatch, groupToken, tokenizer = /(?:[?*+]|\{[0-9\+\*]+(?:,[0-9\+\*]*)?\})|[^.?*+^${[]()|\\]+|./g, regexTokenizer = /\[\^?]?(?:[^\\\]]+|\\[\S\s]?)*]?|\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9][0-9]*|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|c[A-Za-z]|[\S\s]?)|\((?:\?[:=!]?)?|(?:[?*+]|\{[0-9]+(?:,[0-9]*)?\})\??|[^.?*+^${[()|\\]+|./g, escaped = !1, currentToken = new MaskToken(), openenings = [], maskTokens = []; 68133 for (regexMask && (opts.optionalmarker.start = undefined, opts.optionalmarker.end = undefined); match = regexMask ? regexTokenizer.exec(mask) : tokenizer.exec(mask); ) { 68134 if (m = match[0], regexMask) switch (m.charAt(0)) { 68135 case "?": 68136 m = "{0,1}"; 68137 break; 68138 68139 case "+": 68140 case "*": 68141 m = "{" + m + "}"; 68142 } 68143 if (escaped) defaultCase(); else switch (m.charAt(0)) { 68144 case opts.escapeChar: 68145 escaped = !0, regexMask && defaultCase(); 68146 break; 68147 68148 case opts.optionalmarker.end: 68149 case opts.groupmarker.end: 68150 if (openingToken = openenings.pop(), openingToken.openGroup = !1, openingToken !== undefined) if (openenings.length > 0) { 68151 if (currentOpeningToken = openenings[openenings.length - 1], currentOpeningToken.matches.push(openingToken), 68152 currentOpeningToken.isAlternator) { 68153 alternator = openenings.pop(); 68154 for (var mndx = 0; mndx < alternator.matches.length; mndx++) alternator.matches[mndx].isGroup = !1, 68155 alternator.matches[mndx].alternatorGroup = !1; 68156 openenings.length > 0 ? (currentOpeningToken = openenings[openenings.length - 1], 68157 currentOpeningToken.matches.push(alternator)) : currentToken.matches.push(alternator); 68158 } 68159 } else currentToken.matches.push(openingToken); else defaultCase(); 68160 break; 68161 68162 case opts.optionalmarker.start: 68163 openenings.push(new MaskToken(!1, !0)); 68164 break; 68165 68166 case opts.groupmarker.start: 68167 openenings.push(new MaskToken(!0)); 68168 break; 68169 68170 case opts.quantifiermarker.start: 68171 var quantifier = new MaskToken(!1, !1, !0); 68172 m = m.replace(/[{}]/g, ""); 68173 var mq = m.split(","), mq0 = isNaN(mq[0]) ? mq[0] : parseInt(mq[0]), mq1 = 1 === mq.length ? mq0 : isNaN(mq[1]) ? mq[1] : parseInt(mq[1]); 68174 if ("*" !== mq1 && "+" !== mq1 || (mq0 = "*" === mq1 ? 0 : 1), quantifier.quantifier = { 68175 min: mq0, 68176 max: mq1 68177 }, openenings.length > 0) { 68178 var matches = openenings[openenings.length - 1].matches; 68179 match = matches.pop(), match.isGroup || (groupToken = new MaskToken(!0), groupToken.matches.push(match), 68180 match = groupToken), matches.push(match), matches.push(quantifier); 68181 } else match = currentToken.matches.pop(), match.isGroup || (regexMask && null === match.fn && "." === match.def && (match.fn = new RegExp(match.def, opts.casing ? "i" : "")), 68182 groupToken = new MaskToken(!0), groupToken.matches.push(match), match = groupToken), 68183 currentToken.matches.push(match), currentToken.matches.push(quantifier); 68184 break; 68185 68186 case opts.alternatormarker: 68187 if (openenings.length > 0) { 68188 currentOpeningToken = openenings[openenings.length - 1]; 68189 var subToken = currentOpeningToken.matches[currentOpeningToken.matches.length - 1]; 68190 lastMatch = currentOpeningToken.openGroup && (subToken.matches === undefined || !1 === subToken.isGroup && !1 === subToken.isAlternator) ? openenings.pop() : currentOpeningToken.matches.pop(); 68191 } else lastMatch = currentToken.matches.pop(); 68192 if (lastMatch.isAlternator) openenings.push(lastMatch); else if (lastMatch.alternatorGroup ? (alternator = openenings.pop(), 68193 lastMatch.alternatorGroup = !1) : alternator = new MaskToken(!1, !1, !1, !0), alternator.matches.push(lastMatch), 68194 openenings.push(alternator), lastMatch.openGroup) { 68195 lastMatch.openGroup = !1; 68196 var alternatorGroup = new MaskToken(!0); 68197 alternatorGroup.alternatorGroup = !0, openenings.push(alternatorGroup); 68198 } 68199 break; 68200 68201 default: 68202 defaultCase(); 68203 } 68204 } 68205 for (;openenings.length > 0; ) openingToken = openenings.pop(), currentToken.matches.push(openingToken); 68206 return currentToken.matches.length > 0 && (verifyGroupMarker(currentToken), maskTokens.push(currentToken)), 68207 (opts.numericInput || opts.isRTL) && reverseTokens(maskTokens[0]), maskTokens; 68208 } 68209 }, Inputmask.extendDefaults = function(options) { 68210 $.extend(!0, Inputmask.prototype.defaults, options); 68211 }, Inputmask.extendDefinitions = function(definition) { 68212 $.extend(!0, Inputmask.prototype.definitions, definition); 68213 }, Inputmask.extendAliases = function(alias) { 68214 $.extend(!0, Inputmask.prototype.aliases, alias); 68215 }, Inputmask.format = function(value, options, metadata) { 68216 return Inputmask(options).format(value, metadata); 68217 }, Inputmask.unmask = function(value, options) { 68218 return Inputmask(options).unmaskedvalue(value); 68219 }, Inputmask.isValid = function(value, options) { 68220 return Inputmask(options).isValid(value); 68221 }, Inputmask.remove = function(elems) { 68222 $.each(elems, function(ndx, el) { 68223 el.inputmask && el.inputmask.remove(); 68224 }); 68225 }, Inputmask.escapeRegex = function(str) { 68226 var specials = [ "/", ".", "*", "+", "?", "|", "(", ")", "[", "]", "{", "}", "\\", "$", "^" ]; 68227 return str.replace(new RegExp("(\\" + specials.join("|\\") + ")", "gim"), "\\$1"); 68228 }, Inputmask.keyCode = { 68229 ALT: 18, 68230 BACKSPACE: 8, 68231 BACKSPACE_SAFARI: 127, 68232 CAPS_LOCK: 20, 68233 COMMA: 188, 68234 COMMAND: 91, 68235 COMMAND_LEFT: 91, 68236 COMMAND_RIGHT: 93, 68237 CONTROL: 17, 68238 DELETE: 46, 68239 DOWN: 40, 68240 END: 35, 68241 ENTER: 13, 68242 ESCAPE: 27, 68243 HOME: 36, 68244 INSERT: 45, 68245 LEFT: 37, 68246 MENU: 93, 68247 NUMPAD_ADD: 107, 68248 NUMPAD_DECIMAL: 110, 68249 NUMPAD_DIVIDE: 111, 68250 NUMPAD_ENTER: 108, 68251 NUMPAD_MULTIPLY: 106, 68252 NUMPAD_SUBTRACT: 109,
vendor: 26,558 bytes, lines 68253-68735
68253 PAGE_DOWN: 34, 68254 PAGE_UP: 33, 68255 PERIOD: 190, 68256 RIGHT: 39, 68257 SHIFT: 16, 68258 SPACE: 32, 68259 TAB: 9, 68260 UP: 38, 68261 WINDOWS: 91, 68262 X: 88 68263 }, Inputmask; 68264 }); 68265}, function(module, exports) { 68266 module.exports = jQuery; 68267}, function(module, exports, __webpack_require__) { 68268 "use strict"; 68269 var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__; 68270 "function" == typeof Symbol && Symbol.iterator; 68271 !function(factory) { 68272 __WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(0), __webpack_require__(1) ], 68273 __WEBPACK_AMD_DEFINE_FACTORY__ = factory, void 0 !== (__WEBPACK_AMD_DEFINE_RESULT__ = "function" == typeof __WEBPACK_AMD_DEFINE_FACTORY__ ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__) && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__); 68274 }(function($, Inputmask) { 68275 function isLeapYear(year) { 68276 return isNaN(year) || 29 === new Date(year, 2, 0).getDate(); 68277 } 68278 return Inputmask.extendAliases({ 68279 "dd/mm/yyyy": { 68280 mask: "1/2/y", 68281 placeholder: "dd/mm/yyyy", 68282 regex: { 68283 val1pre: new RegExp("[0-3]"), 68284 val1: new RegExp("0[1-9]|[12][0-9]|3[01]"), 68285 val2pre: function(separator) { 68286 var escapedSeparator = Inputmask.escapeRegex.call(this, separator); 68287 return new RegExp("((0[1-9]|[12][0-9]|3[01])" + escapedSeparator + "[01])"); 68288 }, 68289 val2: function(separator) { 68290 var escapedSeparator = Inputmask.escapeRegex.call(this, separator); 68291 return new RegExp("((0[1-9]|[12][0-9])" + escapedSeparator + "(0[1-9]|1[012]))|(30" + escapedSeparator + "(0[13-9]|1[012]))|(31" + escapedSeparator + "(0[13578]|1[02]))"); 68292 } 68293 }, 68294 leapday: "29/02/", 68295 separator: "/", 68296 yearrange: { 68297 minyear: 1900, 68298 maxyear: 2099 68299 }, 68300 isInYearRange: function(chrs, minyear, maxyear) { 68301 if (isNaN(chrs)) return !1; 68302 var enteredyear = parseInt(chrs.concat(minyear.toString().slice(chrs.length))), enteredyear2 = parseInt(chrs.concat(maxyear.toString().slice(chrs.length))); 68303 return !isNaN(enteredyear) && (minyear <= enteredyear && enteredyear <= maxyear) || !isNaN(enteredyear2) && (minyear <= enteredyear2 && enteredyear2 <= maxyear); 68304 }, 68305 determinebaseyear: function(minyear, maxyear, hint) { 68306 var currentyear = new Date().getFullYear(); 68307 if (minyear > currentyear) return minyear; 68308 if (maxyear < currentyear) { 68309 for (var maxYearPrefix = maxyear.toString().slice(0, 2), maxYearPostfix = maxyear.toString().slice(2, 4); maxyear < maxYearPrefix + hint; ) maxYearPrefix--; 68310 var maxxYear = maxYearPrefix + maxYearPostfix; 68311 return minyear > maxxYear ? minyear : maxxYear; 68312 } 68313 if (minyear <= currentyear && currentyear <= maxyear) { 68314 for (var currentYearPrefix = currentyear.toString().slice(0, 2); maxyear < currentYearPrefix + hint; ) currentYearPrefix--; 68315 var currentYearAndHint = currentYearPrefix + hint; 68316 return currentYearAndHint < minyear ? minyear : currentYearAndHint; 68317 } 68318 return currentyear; 68319 }, 68320 onKeyDown: function(e, buffer, caretPos, opts) { 68321 var $input = $(this); 68322 if (e.ctrlKey && e.keyCode === Inputmask.keyCode.RIGHT) { 68323 var today = new Date(); 68324 $input.val(today.getDate().toString() + (today.getMonth() + 1).toString() + today.getFullYear().toString()), 68325 $input.trigger("setvalue"); 68326 } 68327 }, 68328 getFrontValue: function(mask, buffer, opts) { 68329 for (var start = 0, length = 0, i = 0; i < mask.length && "2" !== mask.charAt(i); i++) { 68330 var definition = opts.definitions[mask.charAt(i)]; 68331 definition ? (start += length, length = definition.cardinality) : length++; 68332 } 68333 return buffer.join("").substr(start, length); 68334 }, 68335 postValidation: function(buffer, currentResult, opts) { 68336 var dayMonthValue, year, bufferStr = buffer.join(""); 68337 return 0 === opts.mask.indexOf("y") ? (year = bufferStr.substr(0, 4), dayMonthValue = bufferStr.substring(4, 10)) : (year = bufferStr.substring(6, 10), 68338 dayMonthValue = bufferStr.substr(0, 6)), currentResult && (dayMonthValue !== opts.leapday || isLeapYear(year)); 68339 }, 68340 definitions: { 68341 "1": { 68342 validator: function(chrs, maskset, pos, strict, opts) { 68343 var isValid = opts.regex.val1.test(chrs); 68344 return strict || isValid || chrs.charAt(1) !== opts.separator && -1 === "-./".indexOf(chrs.charAt(1)) || !(isValid = opts.regex.val1.test("0" + chrs.charAt(0))) ? isValid : (maskset.buffer[pos - 1] = "0", 68345 { 68346 refreshFromBuffer: { 68347 start: pos - 1, 68348 end: pos 68349 }, 68350 pos: pos, 68351 c: chrs.charAt(0) 68352 }); 68353 }, 68354 cardinality: 2, 68355 prevalidator: [ { 68356 validator: function(chrs, maskset, pos, strict, opts) { 68357 var pchrs = chrs; 68358 isNaN(maskset.buffer[pos + 1]) || (pchrs += maskset.buffer[pos + 1]); 68359 var isValid = 1 === pchrs.length ? opts.regex.val1pre.test(pchrs) : opts.regex.val1.test(pchrs); 68360 if (!strict && !isValid) { 68361 if (isValid = opts.regex.val1.test(chrs + "0")) return maskset.buffer[pos] = chrs, 68362 maskset.buffer[++pos] = "0", { 68363 pos: pos, 68364 c: "0" 68365 }; 68366 if (isValid = opts.regex.val1.test("0" + chrs)) return maskset.buffer[pos] = "0", 68367 pos++, { 68368 pos: pos 68369 }; 68370 } 68371 return isValid; 68372 }, 68373 cardinality: 1 68374 } ] 68375 }, 68376 "2": { 68377 validator: function(chrs, maskset, pos, strict, opts) { 68378 var frontValue = opts.getFrontValue(maskset.mask, maskset.buffer, opts); 68379 -1 !== frontValue.indexOf(opts.placeholder[0]) && (frontValue = "01" + opts.separator); 68380 var isValid = opts.regex.val2(opts.separator).test(frontValue + chrs); 68381 return strict || isValid || chrs.charAt(1) !== opts.separator && -1 === "-./".indexOf(chrs.charAt(1)) || !(isValid = opts.regex.val2(opts.separator).test(frontValue + "0" + chrs.charAt(0))) ? isValid : (maskset.buffer[pos - 1] = "0", 68382 { 68383 refreshFromBuffer: { 68384 start: pos - 1, 68385 end: pos 68386 }, 68387 pos: pos, 68388 c: chrs.charAt(0) 68389 }); 68390 }, 68391 cardinality: 2, 68392 prevalidator: [ { 68393 validator: function(chrs, maskset, pos, strict, opts) { 68394 isNaN(maskset.buffer[pos + 1]) || (chrs += maskset.buffer[pos + 1]); 68395 var frontValue = opts.getFrontValue(maskset.mask, maskset.buffer, opts); 68396 -1 !== frontValue.indexOf(opts.placeholder[0]) && (frontValue = "01" + opts.separator); 68397 var isValid = 1 === chrs.length ? opts.regex.val2pre(opts.separator).test(frontValue + chrs) : opts.regex.val2(opts.separator).test(frontValue + chrs); 68398 return strict || isValid || !(isValid = opts.regex.val2(opts.separator).test(frontValue + "0" + chrs)) ? isValid : (maskset.buffer[pos] = "0", 68399 pos++, { 68400 pos: pos 68401 }); 68402 }, 68403 cardinality: 1 68404 } ] 68405 }, 68406 y: { 68407 validator: function(chrs, maskset, pos, strict, opts) { 68408 return opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear); 68409 }, 68410 cardinality: 4, 68411 prevalidator: [ { 68412 validator: function(chrs, maskset, pos, strict, opts) { 68413 var isValid = opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear); 68414 if (!strict && !isValid) { 68415 var yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs + "0").toString().slice(0, 1); 68416 if (isValid = opts.isInYearRange(yearPrefix + chrs, opts.yearrange.minyear, opts.yearrange.maxyear)) return maskset.buffer[pos++] = yearPrefix.charAt(0), 68417 { 68418 pos: pos 68419 }; 68420 if (yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs + "0").toString().slice(0, 2), 68421 isValid = opts.isInYearRange(yearPrefix + chrs, opts.yearrange.minyear, opts.yearrange.maxyear)) return maskset.buffer[pos++] = yearPrefix.charAt(0), 68422 maskset.buffer[pos++] = yearPrefix.charAt(1), { 68423 pos: pos 68424 }; 68425 } 68426 return isValid; 68427 }, 68428 cardinality: 1 68429 }, { 68430 validator: function(chrs, maskset, pos, strict, opts) { 68431 var isValid = opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear); 68432 if (!strict && !isValid) { 68433 var yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs).toString().slice(0, 2); 68434 if (isValid = opts.isInYearRange(chrs[0] + yearPrefix[1] + chrs[1], opts.yearrange.minyear, opts.yearrange.maxyear)) return maskset.buffer[pos++] = yearPrefix.charAt(1), 68435 { 68436 pos: pos 68437 }; 68438 if (yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs).toString().slice(0, 2), 68439 isValid = opts.isInYearRange(yearPrefix + chrs, opts.yearrange.minyear, opts.yearrange.maxyear)) return maskset.buffer[pos - 1] = yearPrefix.charAt(0), 68440 maskset.buffer[pos++] = yearPrefix.charAt(1), maskset.buffer[pos++] = chrs.charAt(0), 68441 { 68442 refreshFromBuffer: { 68443 start: pos - 3, 68444 end: pos 68445 }, 68446 pos: pos 68447 }; 68448 } 68449 return isValid; 68450 }, 68451 cardinality: 2 68452 }, { 68453 validator: function(chrs, maskset, pos, strict, opts) { 68454 return opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear); 68455 }, 68456 cardinality: 3 68457 } ] 68458 } 68459 }, 68460 insertMode: !1, 68461 autoUnmask: !1 68462 }, 68463 "mm/dd/yyyy": { 68464 placeholder: "mm/dd/yyyy", 68465 alias: "dd/mm/yyyy", 68466 regex: { 68467 val2pre: function(separator) { 68468 var escapedSeparator = Inputmask.escapeRegex.call(this, separator); 68469 return new RegExp("((0[13-9]|1[012])" + escapedSeparator + "[0-3])|(02" + escapedSeparator + "[0-2])"); 68470 }, 68471 val2: function(separator) { 68472 var escapedSeparator = Inputmask.escapeRegex.call(this, separator); 68473 return new RegExp("((0[1-9]|1[012])" + escapedSeparator + "(0[1-9]|[12][0-9]))|((0[13-9]|1[012])" + escapedSeparator + "30)|((0[13578]|1[02])" + escapedSeparator + "31)"); 68474 }, 68475 val1pre: new RegExp("[01]"), 68476 val1: new RegExp("0[1-9]|1[012]") 68477 }, 68478 leapday: "02/29/", 68479 onKeyDown: function(e, buffer, caretPos, opts) { 68480 var $input = $(this); 68481 if (e.ctrlKey && e.keyCode === Inputmask.keyCode.RIGHT) { 68482 var today = new Date(); 68483 $input.val((today.getMonth() + 1).toString() + today.getDate().toString() + today.getFullYear().toString()), 68484 $input.trigger("setvalue"); 68485 } 68486 } 68487 }, 68488 "yyyy/mm/dd": { 68489 mask: "y/1/2", 68490 placeholder: "yyyy/mm/dd", 68491 alias: "mm/dd/yyyy", 68492 leapday: "/02/29", 68493 onKeyDown: function(e, buffer, caretPos, opts) { 68494 var $input = $(this); 68495 if (e.ctrlKey && e.keyCode === Inputmask.keyCode.RIGHT) { 68496 var today = new Date(); 68497 $input.val(today.getFullYear().toString() + (today.getMonth() + 1).toString() + today.getDate().toString()), 68498 $input.trigger("setvalue"); 68499 } 68500 } 68501 }, 68502 "dd.mm.yyyy": { 68503 mask: "1.2.y", 68504 placeholder: "dd.mm.yyyy", 68505 leapday: "29.02.", 68506 separator: ".", 68507 alias: "dd/mm/yyyy" 68508 }, 68509 "dd-mm-yyyy": { 68510 mask: "1-2-y", 68511 placeholder: "dd-mm-yyyy", 68512 leapday: "29-02-", 68513 separator: "-", 68514 alias: "dd/mm/yyyy" 68515 }, 68516 "mm.dd.yyyy": { 68517 mask: "1.2.y", 68518 placeholder: "mm.dd.yyyy", 68519 leapday: "02.29.", 68520 separator: ".", 68521 alias: "mm/dd/yyyy" 68522 }, 68523 "mm-dd-yyyy": { 68524 mask: "1-2-y", 68525 placeholder: "mm-dd-yyyy", 68526 leapday: "02-29-", 68527 separator: "-", 68528 alias: "mm/dd/yyyy" 68529 }, 68530 "yyyy.mm.dd": { 68531 mask: "y.1.2", 68532 placeholder: "yyyy.mm.dd", 68533 leapday: ".02.29", 68534 separator: ".", 68535 alias: "yyyy/mm/dd" 68536 }, 68537 "yyyy-mm-dd": { 68538 mask: "y-1-2", 68539 placeholder: "yyyy-mm-dd", 68540 leapday: "-02-29", 68541 separator: "-", 68542 alias: "yyyy/mm/dd" 68543 }, 68544 datetime: { 68545 mask: "1/2/y h:s", 68546 placeholder: "dd/mm/yyyy hh:mm", 68547 alias: "dd/mm/yyyy", 68548 regex: { 68549 hrspre: new RegExp("[012]"), 68550 hrs24: new RegExp("2[0-4]|1[3-9]"), 68551 hrs: new RegExp("[01][0-9]|2[0-4]"), 68552 ampm: new RegExp("^[a|p|A|P][m|M]"), 68553 mspre: new RegExp("[0-5]"), 68554 ms: new RegExp("[0-5][0-9]") 68555 }, 68556 timeseparator: ":", 68557 hourFormat: "24", 68558 definitions: { 68559 h: { 68560 validator: function(chrs, maskset, pos, strict, opts) { 68561 if ("24" === opts.hourFormat && 24 === parseInt(chrs, 10)) return maskset.buffer[pos - 1] = "0", 68562 maskset.buffer[pos] = "0", { 68563 refreshFromBuffer: { 68564 start: pos - 1, 68565 end: pos 68566 }, 68567 c: "0" 68568 }; 68569 var isValid = opts.regex.hrs.test(chrs); 68570 if (!strict && !isValid && (chrs.charAt(1) === opts.timeseparator || -1 !== "-.:".indexOf(chrs.charAt(1))) && (isValid = opts.regex.hrs.test("0" + chrs.charAt(0)))) return maskset.buffer[pos - 1] = "0", 68571 maskset.buffer[pos] = chrs.charAt(0), pos++, { 68572 refreshFromBuffer: { 68573 start: pos - 2, 68574 end: pos 68575 }, 68576 pos: pos, 68577 c: opts.timeseparator 68578 }; 68579 if (isValid && "24" !== opts.hourFormat && opts.regex.hrs24.test(chrs)) { 68580 var tmp = parseInt(chrs, 10); 68581 return 24 === tmp ? (maskset.buffer[pos + 5] = "a", maskset.buffer[pos + 6] = "m") : (maskset.buffer[pos + 5] = "p", 68582 maskset.buffer[pos + 6] = "m"), tmp -= 12, tmp < 10 ? (maskset.buffer[pos] = tmp.toString(), 68583 maskset.buffer[pos - 1] = "0") : (maskset.buffer[pos] = tmp.toString().charAt(1), 68584 maskset.buffer[pos - 1] = tmp.toString().charAt(0)), { 68585 refreshFromBuffer: { 68586 start: pos - 1, 68587 end: pos + 6 68588 }, 68589 c: maskset.buffer[pos] 68590 }; 68591 } 68592 return isValid; 68593 }, 68594 cardinality: 2, 68595 prevalidator: [ { 68596 validator: function(chrs, maskset, pos, strict, opts) { 68597 var isValid = opts.regex.hrspre.test(chrs); 68598 return strict || isValid || !(isValid = opts.regex.hrs.test("0" + chrs)) ? isValid : (maskset.buffer[pos] = "0", 68599 pos++, { 68600 pos: pos 68601 }); 68602 }, 68603 cardinality: 1 68604 } ] 68605 }, 68606 s: { 68607 validator: "[0-5][0-9]", 68608 cardinality: 2, 68609 prevalidator: [ { 68610 validator: function(chrs, maskset, pos, strict, opts) { 68611 var isValid = opts.regex.mspre.test(chrs); 68612 return strict || isValid || !(isValid = opts.regex.ms.test("0" + chrs)) ? isValid : (maskset.buffer[pos] = "0", 68613 pos++, { 68614 pos: pos 68615 }); 68616 }, 68617 cardinality: 1 68618 } ] 68619 }, 68620 t: { 68621 validator: function(chrs, maskset, pos, strict, opts) { 68622 return opts.regex.ampm.test(chrs + "m"); 68623 }, 68624 casing: "lower", 68625 cardinality: 1 68626 } 68627 }, 68628 insertMode: !1, 68629 autoUnmask: !1 68630 }, 68631 datetime12: { 68632 mask: "1/2/y h:s t\\m", 68633 placeholder: "dd/mm/yyyy hh:mm xm", 68634 alias: "datetime", 68635 hourFormat: "12" 68636 }, 68637 "mm/dd/yyyy hh:mm xm": { 68638 mask: "1/2/y h:s t\\m", 68639 placeholder: "mm/dd/yyyy hh:mm xm", 68640 alias: "datetime12", 68641 regex: { 68642 val2pre: function(separator) { 68643 var escapedSeparator = Inputmask.escapeRegex.call(this, separator); 68644 return new RegExp("((0[13-9]|1[012])" + escapedSeparator + "[0-3])|(02" + escapedSeparator + "[0-2])"); 68645 }, 68646 val2: function(separator) { 68647 var escapedSeparator = Inputmask.escapeRegex.call(this, separator); 68648 return new RegExp("((0[1-9]|1[012])" + escapedSeparator + "(0[1-9]|[12][0-9]))|((0[13-9]|1[012])" + escapedSeparator + "30)|((0[13578]|1[02])" + escapedSeparator + "31)"); 68649 }, 68650 val1pre: new RegExp("[01]"), 68651 val1: new RegExp("0[1-9]|1[012]") 68652 }, 68653 leapday: "02/29/", 68654 onKeyDown: function(e, buffer, caretPos, opts) { 68655 var $input = $(this); 68656 if (e.ctrlKey && e.keyCode === Inputmask.keyCode.RIGHT) { 68657 var today = new Date(); 68658 $input.val((today.getMonth() + 1).toString() + today.getDate().toString() + today.getFullYear().toString()), 68659 $input.trigger("setvalue"); 68660 } 68661 } 68662 }, 68663 "hh:mm t": { 68664 mask: "h:s t\\m", 68665 placeholder: "hh:mm xm", 68666 alias: "datetime", 68667 hourFormat: "12" 68668 }, 68669 "h:s t": { 68670 mask: "h:s t\\m", 68671 placeholder: "hh:mm xm", 68672 alias: "datetime", 68673 hourFormat: "12" 68674 }, 68675 "hh:mm:ss": { 68676 mask: "h:s:s", 68677 placeholder: "hh:mm:ss", 68678 alias: "datetime", 68679 autoUnmask: !1 68680 }, 68681 "hh:mm": { 68682 mask: "h:s", 68683 placeholder: "hh:mm", 68684 alias: "datetime", 68685 autoUnmask: !1 68686 }, 68687 date: { 68688 alias: "dd/mm/yyyy" 68689 }, 68690 "mm/yyyy": { 68691 mask: "1/y", 68692 placeholder: "mm/yyyy", 68693 leapday: "donotuse", 68694 separator: "/", 68695 alias: "mm/dd/yyyy" 68696 }, 68697 shamsi: { 68698 regex: { 68699 val2pre: function(separator) { 68700 var escapedSeparator = Inputmask.escapeRegex.call(this, separator); 68701 return new RegExp("((0[1-9]|1[012])" + escapedSeparator + "[0-3])"); 68702 }, 68703 val2: function(separator) { 68704 var escapedSeparator = Inputmask.escapeRegex.call(this, separator); 68705 return new RegExp("((0[1-9]|1[012])" + escapedSeparator + "(0[1-9]|[12][0-9]))|((0[1-9]|1[012])" + escapedSeparator + "30)|((0[1-6])" + escapedSeparator + "31)"); 68706 }, 68707 val1pre: new RegExp("[01]"), 68708 val1: new RegExp("0[1-9]|1[012]") 68709 }, 68710 yearrange: { 68711 minyear: 1300, 68712 maxyear: 1499 68713 }, 68714 mask: "y/1/2", 68715 leapday: "/12/30", 68716 placeholder: "yyyy/mm/dd", 68717 alias: "mm/dd/yyyy", 68718 clearIncomplete: !0 68719 }, 68720 "yyyy-mm-dd hh:mm:ss": { 68721 mask: "y-1-2 h:s:s", 68722 placeholder: "yyyy-mm-dd hh:mm:ss", 68723 alias: "datetime", 68724 separator: "-", 68725 leapday: "-02-29", 68726 regex: { 68727 val2pre: function(separator) { 68728 var escapedSeparator = Inputmask.escapeRegex.call(this, separator); 68729 return new RegExp("((0[13-9]|1[012])" + escapedSeparator + "[0-3])|(02" + escapedSeparator + "[0-2])"); 68730 }, 68731 val2: function(separator) { 68732 var escapedSeparator = Inputmask.escapeRegex.call(this, separator); 68733 return new RegExp("((0[1-9]|1[012])" + escapedSeparator + "(0[1-9]|[12][0-9]))|((0[13-9]|1[012])" + escapedSeparator + "30)|((0[13578]|1[02])" + escapedSeparator + "31)"); 68734 }, 68735 val1pre: new RegExp("[01]"),
68736 val1: new RegExp("0[1-9]|1[012]") 68737 }, 68738 onKeyDown: function(e, buffer, caretPos, opts) {} 68739 } 68740 }), Inputmask; 68741 }); 68742}, function(module, exports, __webpack_require__) { 68743 "use strict"; 68744 var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__; 68745 "function" == typeof Symbol && Symbol.iterator; 68746 !function(factory) { 68747 __WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(0), __webpack_require__(1) ], 68748 __WEBPACK_AMD_DEFINE_FACTORY__ = factory, void 0 !== (__WEBPACK_AMD_DEFINE_RESULT__ = "function" == typeof __WEBPACK_AMD_DEFINE_FACTORY__ ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__) && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__); 68749 }(function($, Inputmask) { 68750 return Inputmask.extendDefinitions({ 68751 A: { 68752 validator: "[A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]", 68753 cardinality: 1, 68754 casing: "upper" 68755 }, 68756 "&": { 68757 validator: "[0-9A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]", 68758 cardinality: 1, 68759 casing: "upper" 68760 }, 68761 "#": { 68762 validator: "[0-9A-Fa-f]", 68763 cardinality: 1, 68764 casing: "upper" 68765 } 68766 }), Inputmask.extendAliases({ 68767 url: { 68768 definitions: { 68769 i: { 68770 validator: ".", 68771 cardinality: 1 68772 } 68773 }, 68774 mask: "(\\http://)|(\\http\\s://)|(ftp://)|(ftp\\s://)i{+}", 68775 insertMode: !1, 68776 autoUnmask: !1, 68777 inputmode: "url" 68778 }, 68779 ip: { 68780 mask: "i[i[i]].i[i[i]].i[i[i]].i[i[i]]", 68781 definitions: { 68782 i: { 68783 validator: function(chrs, maskset, pos, strict, opts) { 68784 return pos - 1 > -1 && "." !== maskset.buffer[pos - 1] ? (chrs = maskset.buffer[pos - 1] + chrs, 68785 chrs = pos - 2 > -1 && "." !== maskset.buffer[pos - 2] ? maskset.buffer[pos - 2] + chrs : "0" + chrs) : chrs = "00" + chrs, 68786 new RegExp("25[0-5]|2[0-4][0-9]|[01][0-9][0-9]").test(chrs); 68787 }, 68788 cardinality: 1 68789 } 68790 }, 68791 onUnMask: function(maskedValue, unmaskedValue, opts) { 68792 return maskedValue; 68793 }, 68794 inputmode: "numeric" 68795 }, 68796 email: { 68797 mask: "*{1,64}[.*{1,64}][.*{1,64}][.*{1,63}]@-{1,63}.-{1,63}[.-{1,63}][.-{1,63}]", 68798 greedy: !1, 68799 onBeforePaste: function(pastedValue, opts) { 68800 return pastedValue = pastedValue.toLowerCase(), pastedValue.replace("mailto:", ""); 68801 }, 68802 definitions: { 68803 "*": { 68804 validator: "[0-9A-Za-z!#$%&'*+/=?^_`{|}~-]", 68805 cardinality: 1, 68806 casing: "lower" 68807 }, 68808 "-": { 68809 validator: "[0-9A-Za-z-]", 68810 cardinality: 1, 68811 casing: "lower" 68812 } 68813 }, 68814 onUnMask: function(maskedValue, unmaskedValue, opts) { 68815 return maskedValue; 68816 }, 68817 inputmode: "email" 68818 }, 68819 mac: { 68820 mask: "##:##:##:##:##:##" 68821 }, 68822 vin: { 68823 mask: "V{13}9{4}", 68824 definitions: { 68825 V: { 68826 validator: "[A-HJ-NPR-Za-hj-npr-z\\d]", 68827 cardinality: 1, 68828 casing: "upper" 68829 } 68830 }, 68831 clearIncomplete: !0, 68832 autoUnmask: !0 68833 } 68834 }), Inputmask; 68835 });
68836}, function(module, exports, __webpack_require__) { 68837 "use strict"; 68838 var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__; 68839 "function" == typeof Symbol && Symbol.iterator; 68840 !function(factory) { 68841 __WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(0), __webpack_require__(1) ], 68842 __WEBPACK_AMD_DEFINE_FACTORY__ = factory, void 0 !== (__WEBPACK_AMD_DEFINE_RESULT__ = "function" == typeof __WEBPACK_AMD_DEFINE_FACTORY__ ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__) && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__); 68843 }(function($, Inputmask, undefined) { 68844 function autoEscape(txt, opts) { 68845 for (var escapedTxt = "", i = 0; i < txt.length; i++) Inputmask.prototype.definitions[txt.charAt(i)] || opts.definitions[txt.charAt(i)] || opts.optionalmarker.start === txt.charAt(i) || opts.optionalmarker.end === txt.charAt(i) || opts.quantifiermarker.start === txt.charAt(i) || opts.quantifiermarker.end === txt.charAt(i) || opts.groupmarker.start === txt.charAt(i) || opts.groupmarker.end === txt.charAt(i) || opts.alternatormarker === txt.charAt(i) ? escapedTxt += "\\" + txt.charAt(i) : escapedTxt += txt.charAt(i); 68846 return escapedTxt; 68847 } 68848 return Inputmask.extendAliases({ 68849 numeric: { 68850 mask: function(opts) { 68851 if (0 !== opts.repeat && isNaN(opts.integerDigits) && (opts.integerDigits = opts.repeat), 68852 opts.repeat = 0, opts.groupSeparator === opts.radixPoint && ("." === opts.radixPoint ? opts.groupSeparator = "," : "," === opts.radixPoint ? opts.groupSeparator = "." : opts.groupSeparator = ""), 68853 " " === opts.groupSeparator && (opts.skipOptionalPartCharacter = undefined), opts.autoGroup = opts.autoGroup && "" !== opts.groupSeparator, 68854 opts.autoGroup && ("string" == typeof opts.groupSize && isFinite(opts.groupSize) && (opts.groupSize = parseInt(opts.groupSize)), 68855 isFinite(opts.integerDigits))) { 68856 var seps = Math.floor(opts.integerDigits / opts.groupSize), mod = opts.integerDigits % opts.groupSize; 68857 opts.integerDigits = parseInt(opts.integerDigits) + (0 === mod ? seps - 1 : seps), 68858 opts.integerDigits < 1 && (opts.integerDigits = "*"); 68859 } 68860 opts.placeholder.length > 1 && (opts.placeholder = opts.placeholder.charAt(0)), 68861 "radixFocus" === opts.positionCaretOnClick && "" === opts.placeholder && !1 === opts.integerOptional && (opts.positionCaretOnClick = "lvp"), 68862 opts.definitions[";"] = opts.definitions["~"], opts.definitions[";"].definitionSymbol = "~", 68863 !0 === opts.numericInput && (opts.positionCaretOnClick = "radixFocus" === opts.positionCaretOnClick ? "lvp" : opts.positionCaretOnClick, 68864 opts.digitsOptional = !1, isNaN(opts.digits) && (opts.digits = 2), opts.decimalProtect = !1); 68865 var mask = "[+]"; 68866 if (mask += autoEscape(opts.prefix, opts), !0 === opts.integerOptional ? mask += "~{1," + opts.integerDigits + "}" : mask += "~{" + opts.integerDigits + "}", 68867 opts.digits !== undefined) { 68868 opts.radixPointDefinitionSymbol = opts.decimalProtect ? ":" : opts.radixPoint; 68869 var dq = opts.digits.toString().split(","); 68870 isFinite(dq[0] && dq[1] && isFinite(dq[1])) ? mask += opts.radixPointDefinitionSymbol + ";{" + opts.digits + "}" : (isNaN(opts.digits) || parseInt(opts.digits) > 0) && (opts.digitsOptional ? mask += "[" + opts.radixPointDefinitionSymbol + ";{1," + opts.digits + "}]" : mask += opts.radixPointDefinitionSymbol + ";{" + opts.digits + "}"); 68871 } 68872 return mask += autoEscape(opts.suffix, opts), mask += "[-]", opts.greedy = !1, mask; 68873 }, 68874 placeholder: "", 68875 greedy: !1, 68876 digits: "*", 68877 digitsOptional: !0, 68878 enforceDigitsOnBlur: !1, 68879 radixPoint: ".", 68880 positionCaretOnClick: "radixFocus", 68881 groupSize: 3, 68882 groupSeparator: "", 68883 autoGroup: !1, 68884 allowMinus: !0, 68885 negationSymbol: { 68886 front: "-", 68887 back: "" 68888 }, 68889 integerDigits: "+", 68890 integerOptional: !0, 68891 prefix: "", 68892 suffix: "", 68893 rightAlign: !0, 68894 decimalProtect: !0, 68895 min: null, 68896 max: null, 68897 step: 1, 68898 insertMode: !0, 68899 autoUnmask: !1, 68900 unmaskAsNumber: !1, 68901 inputmode: "numeric", 68902 preValidation: function(buffer, pos, c, isSelection, opts) { 68903 if ("-" === c || c === opts.negationSymbol.front) return !0 === opts.allowMinus && (opts.isNegative = opts.isNegative === undefined || !opts.isNegative, 68904 "" === buffer.join("") || { 68905 caret: pos, 68906 dopost: !0 68907 }); 68908 if (!1 === isSelection && c === opts.radixPoint && opts.digits !== undefined && (isNaN(opts.digits) || parseInt(opts.digits) > 0)) { 68909 var radixPos = $.inArray(opts.radixPoint, buffer); 68910 if (-1 !== radixPos) return !0 === opts.numericInput ? pos === radixPos : { 68911 caret: radixPos + 1 68912 }; 68913 } 68914 return !0; 68915 }, 68916 postValidation: function(buffer, currentResult, opts) { 68917 var suffix = opts.suffix.split(""), prefix = opts.prefix.split(""); 68918 if (currentResult.pos === undefined && currentResult.caret !== undefined && !0 !== currentResult.dopost) return currentResult; 68919 var caretPos = currentResult.caret !== undefined ? currentResult.caret : currentResult.pos, maskedValue = buffer.slice(); 68920 opts.numericInput && (caretPos = maskedValue.length - caretPos - 1, maskedValue = maskedValue.reverse()); 68921 var charAtPos = maskedValue[caretPos]; 68922 if (charAtPos === opts.groupSeparator && (caretPos += 1, charAtPos = maskedValue[caretPos]), 68923 caretPos === maskedValue.length - opts.suffix.length - 1 && charAtPos === opts.radixPoint) return currentResult; 68924 charAtPos !== undefined && charAtPos !== opts.radixPoint && charAtPos !== opts.negationSymbol.front && charAtPos !== opts.negationSymbol.back && (maskedValue[caretPos] = "?", 68925 opts.prefix.length > 0 && caretPos >= (!1 === opts.isNegative ? 1 : 0) && caretPos < opts.prefix.length - 1 + (!1 === opts.isNegative ? 1 : 0) ? prefix[caretPos - (!1 === opts.isNegative ? 1 : 0)] = "?" : opts.suffix.length > 0 && caretPos >= maskedValue.length - opts.suffix.length - (!1 === opts.isNegative ? 1 : 0) && (suffix[caretPos - (maskedValue.length - opts.suffix.length - (!1 === opts.isNegative ? 1 : 0))] = "?")), 68926 prefix = prefix.join(""), suffix = suffix.join(""); 68927 var processValue = maskedValue.join("").replace(prefix, ""); 68928 if (processValue = processValue.replace(suffix, ""), processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""), 68929 processValue = processValue.replace(new RegExp("[-" + Inputmask.escapeRegex(opts.negationSymbol.front) + "]", "g"), ""), 68930 processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.negationSymbol.back) + "$"), ""), 68931 isNaN(opts.placeholder) && (processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.placeholder), "g"), "")), 68932 processValue.length > 1 && 1 !== processValue.indexOf(opts.radixPoint) && ("0" === charAtPos && (processValue = processValue.replace(/^\?/g, "")), 68933 processValue = processValue.replace(/^0/g, "")), processValue.charAt(0) === opts.radixPoint && "" !== opts.radixPoint && !0 !== opts.numericInput && (processValue = "0" + processValue), 68934 "" !== processValue) { 68935 if (processValue = processValue.split(""), (!opts.digitsOptional || opts.enforceDigitsOnBlur && "blur" === currentResult.event) && isFinite(opts.digits)) { 68936 var radixPosition = $.inArray(opts.radixPoint, processValue), rpb = $.inArray(opts.radixPoint, maskedValue); 68937 -1 === radixPosition && (processValue.push(opts.radixPoint), radixPosition = processValue.length - 1); 68938 for (var i = 1; i <= opts.digits; i++) opts.digitsOptional && (!opts.enforceDigitsOnBlur || "blur" !== currentResult.event) || processValue[radixPosition + i] !== undefined && processValue[radixPosition + i] !== opts.placeholder.charAt(0) ? -1 !== rpb && maskedValue[rpb + i] !== undefined && (processValue[radixPosition + i] = processValue[radixPosition + i] || maskedValue[rpb + i]) : processValue[radixPosition + i] = currentResult.placeholder || opts.placeholder.charAt(0);
68939 } 68940 if (!0 !== opts.autoGroup || "" === opts.groupSeparator || charAtPos === opts.radixPoint && currentResult.pos === undefined && !currentResult.dopost) processValue = processValue.join(""); else { 68941 var addRadix = processValue[processValue.length - 1] === opts.radixPoint && currentResult.c === opts.radixPoint; 68942 processValue = Inputmask(function(buffer, opts) { 68943 var postMask = ""; 68944 if (postMask += "(" + opts.groupSeparator + "*{" + opts.groupSize + "}){*}", "" !== opts.radixPoint) { 68945 var radixSplit = buffer.join("").split(opts.radixPoint); 68946 radixSplit[1] && (postMask += opts.radixPoint + "*{" + radixSplit[1].match(/^\d*\??\d*/)[0].length + "}"); 68947 } 68948 return postMask; 68949 }(processValue, opts), { 68950 numericInput: !0, 68951 jitMasking: !0, 68952 definitions: { 68953 "*": { 68954 validator: "[0-9?]", 68955 cardinality: 1 68956 } 68957 } 68958 }).format(processValue.join("")), addRadix && (processValue += opts.radixPoint), 68959 processValue.charAt(0) === opts.groupSeparator && processValue.substr(1); 68960 } 68961 } 68962 if (opts.isNegative && "blur" === currentResult.event && (opts.isNegative = "0" !== processValue), 68963 processValue = prefix + processValue, processValue += suffix, opts.isNegative && (processValue = opts.negationSymbol.front + processValue, 68964 processValue += opts.negationSymbol.back), processValue = processValue.split(""), 68965 charAtPos !== undefined) if (charAtPos !== opts.radixPoint && charAtPos !== opts.negationSymbol.front && charAtPos !== opts.negationSymbol.back) caretPos = $.inArray("?", processValue), 68966 caretPos > -1 ? processValue[caretPos] = charAtPos : caretPos = currentResult.caret || 0; else if (charAtPos === opts.radixPoint || charAtPos === opts.negationSymbol.front || charAtPos === opts.negationSymbol.back) { 68967 var newCaretPos = $.inArray(charAtPos, processValue); 68968 -1 !== newCaretPos && (caretPos = newCaretPos); 68969 } 68970 opts.numericInput && (caretPos = processValue.length - caretPos - 1, processValue = processValue.reverse()); 68971 var rslt = { 68972 caret: charAtPos === undefined || currentResult.pos !== undefined ? caretPos + (opts.numericInput ? -1 : 1) : caretPos, 68973 buffer: processValue, 68974 refreshFromBuffer: currentResult.dopost || buffer.join("") !== processValue.join("") 68975 }; 68976 return rslt.refreshFromBuffer ? rslt : currentResult; 68977 }, 68978 onBeforeWrite: function(e, buffer, caretPos, opts) { 68979 if (e) switch (e.type) { 68980 case "keydown": 68981 return opts.postValidation(buffer, { 68982 caret: caretPos, 68983 dopost: !0 68984 }, opts); 68985 68986 case "blur": 68987 case "checkval": 68988 var unmasked; 68989 if (function(opts) { 68990 opts.parseMinMaxOptions === undefined && (null !== opts.min && (opts.min = opts.min.toString().replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""), 68991 "," === opts.radixPoint && (opts.min = opts.min.replace(opts.radixPoint, ".")), 68992 opts.min = isFinite(opts.min) ? parseFloat(opts.min) : NaN, isNaN(opts.min) && (opts.min = Number.MIN_VALUE)), 68993 null !== opts.max && (opts.max = opts.max.toString().replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""), 68994 "," === opts.radixPoint && (opts.max = opts.max.replace(opts.radixPoint, ".")), 68995 opts.max = isFinite(opts.max) ? parseFloat(opts.max) : NaN, isNaN(opts.max) && (opts.max = Number.MAX_VALUE)), 68996 opts.parseMinMaxOptions = "done"); 68997 }(opts), null !== opts.min || null !== opts.max) { 68998 if (unmasked = opts.onUnMask(buffer.join(""), undefined, $.extend({}, opts, { 68999 unmaskAsNumber: !0 69000 })), null !== opts.min && unmasked < opts.min) return opts.isNegative = opts.min < 0, 69001 opts.postValidation(opts.min.toString().replace(".", opts.radixPoint).split(""), { 69002 caret: caretPos, 69003 dopost: !0, 69004 placeholder: "0" 69005 }, opts); 69006 if (null !== opts.max && unmasked > opts.max) return opts.isNegative = opts.max < 0, 69007 opts.postValidation(opts.max.toString().replace(".", opts.radixPoint).split(""), { 69008 caret: caretPos, 69009 dopost: !0, 69010 placeholder: "0" 69011 }, opts); 69012 } 69013 return opts.postValidation(buffer, { 69014 caret: caretPos, 69015 placeholder: "0", 69016 event: "blur" 69017 }, opts); 69018 69019 case "_checkval": 69020 return { 69021 caret: caretPos 69022 }; 69023 } 69024 }, 69025 regex: { 69026 integerPart: function(opts, emptyCheck) { 69027 return emptyCheck ? new RegExp("[" + Inputmask.escapeRegex(opts.negationSymbol.front) + "+]?") : new RegExp("[" + Inputmask.escapeRegex(opts.negationSymbol.front) + "+]?\\d+"); 69028 }, 69029 integerNPart: function(opts) { 69030 return new RegExp("[\\d" + Inputmask.escapeRegex(opts.groupSeparator) + Inputmask.escapeRegex(opts.placeholder.charAt(0)) + "]+"); 69031 } 69032 }, 69033 definitions: { 69034 "~": { 69035 validator: function(chrs, maskset, pos, strict, opts, isSelection) { 69036 var isValid = strict ? new RegExp("[0-9" + Inputmask.escapeRegex(opts.groupSeparator) + "]").test(chrs) : new RegExp("[0-9]").test(chrs); 69037 if (!0 === isValid) { 69038 if (!0 !== opts.numericInput && maskset.validPositions[pos] !== undefined && "~" === maskset.validPositions[pos].match.def && !isSelection) { 69039 var processValue = maskset.buffer.join(""); 69040 processValue = processValue.replace(new RegExp("[-" + Inputmask.escapeRegex(opts.negationSymbol.front) + "]", "g"), ""), 69041 processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.negationSymbol.back) + "$"), ""); 69042 var pvRadixSplit = processValue.split(opts.radixPoint); 69043 pvRadixSplit.length > 1 && (pvRadixSplit[1] = pvRadixSplit[1].replace(/0/g, opts.placeholder.charAt(0))), 69044 "0" === pvRadixSplit[0] && (pvRadixSplit[0] = pvRadixSplit[0].replace(/0/g, opts.placeholder.charAt(0))), 69045 processValue = pvRadixSplit[0] + opts.radixPoint + pvRadixSplit[1] || ""; 69046 var bufferTemplate = maskset._buffer.join(""); 69047 for (processValue === opts.radixPoint && (processValue = bufferTemplate); null === processValue.match(Inputmask.escapeRegex(bufferTemplate) + "$"); ) bufferTemplate = bufferTemplate.slice(1); 69048 processValue = processValue.replace(bufferTemplate, ""), processValue = processValue.split(""), 69049 isValid = processValue[pos] === undefined ? { 69050 pos: pos, 69051 remove: pos 69052 } : { 69053 pos: pos 69054 }; 69055 } 69056 } else strict || chrs !== opts.radixPoint || maskset.validPositions[pos - 1] !== undefined || (maskset.buffer[pos] = "0", 69057 isValid = { 69058 pos: pos + 1 69059 }); 69060 return isValid; 69061 }, 69062 cardinality: 1 69063 }, 69064 "+": { 69065 validator: function(chrs, maskset, pos, strict, opts) { 69066 return opts.allowMinus && ("-" === chrs || chrs === opts.negationSymbol.front); 69067 }, 69068 cardinality: 1, 69069 placeholder: "" 69070 }, 69071 "-": { 69072 validator: function(chrs, maskset, pos, strict, opts) { 69073 return opts.allowMinus && chrs === opts.negationSymbol.back; 69074 }, 69075 cardinality: 1, 69076 placeholder: "" 69077 }, 69078 ":": { 69079 validator: function(chrs, maskset, pos, strict, opts) { 69080 var radix = "[" + Inputmask.escapeRegex(opts.radixPoint) + "]", isValid = new RegExp(radix).test(chrs); 69081 return isValid && maskset.validPositions[pos] && maskset.validPositions[pos].match.placeholder === opts.radixPoint && (isValid = { 69082 caret: pos + 1 69083 }), isValid; 69084 }, 69085 cardinality: 1, 69086 placeholder: function(opts) { 69087 return opts.radixPoint; 69088 } 69089 } 69090 }, 69091 onUnMask: function(maskedValue, unmaskedValue, opts) { 69092 if ("" === unmaskedValue && !0 === opts.nullable) return unmaskedValue; 69093 var processValue = maskedValue.replace(opts.prefix, ""); 69094 return processValue = processValue.replace(opts.suffix, ""), processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""), 69095 "" !== opts.placeholder.charAt(0) && (processValue = processValue.replace(new RegExp(opts.placeholder.charAt(0), "g"), "0")), 69096 opts.unmaskAsNumber ? ("" !== opts.radixPoint && -1 !== processValue.indexOf(opts.radixPoint) && (processValue = processValue.replace(Inputmask.escapeRegex.call(this, opts.radixPoint), ".")), 69097 processValue = processValue.replace(new RegExp("^" + Inputmask.escapeRegex(opts.negationSymbol.front)), "-"), 69098 processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.negationSymbol.back) + "$"), ""), 69099 Number(processValue)) : processValue; 69100 }, 69101 isComplete: function(buffer, opts) { 69102 var maskedValue = buffer.join(""); 69103 if (buffer.slice().join("") !== maskedValue) return !1; 69104 var processValue = maskedValue.replace(opts.prefix, ""); 69105 return processValue = processValue.replace(opts.suffix, ""), processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""), 69106 "," === opts.radixPoint && (processValue = processValue.replace(Inputmask.escapeRegex(opts.radixPoint), ".")), 69107 isFinite(processValue); 69108 }, 69109 onBeforeMask: function(initialValue, opts) { 69110 if (opts.isNegative = undefined, initialValue = initialValue.toString().charAt(initialValue.length - 1) === opts.radixPoint ? initialValue.toString().substr(0, initialValue.length - 1) : initialValue.toString(), 69111 "" !== opts.radixPoint && isFinite(initialValue)) { 69112 var vs = initialValue.split("."), groupSize = "" !== opts.groupSeparator ? parseInt(opts.groupSize) : 0; 69113 2 === vs.length && (vs[0].length > groupSize || vs[1].length > groupSize || vs[0].length <= groupSize && vs[1].length < groupSize) && (initialValue = initialValue.replace(".", opts.radixPoint)); 69114 } 69115 var kommaMatches = initialValue.match(/,/g), dotMatches = initialValue.match(/\./g); 69116 if (dotMatches && kommaMatches ? dotMatches.length > kommaMatches.length ? (initialValue = initialValue.replace(/\./g, ""), 69117 initialValue = initialValue.replace(",", opts.radixPoint)) : kommaMatches.length > dotMatches.length ? (initialValue = initialValue.replace(/,/g, ""), 69118 initialValue = initialValue.replace(".", opts.radixPoint)) : initialValue = initialValue.indexOf(".") < initialValue.indexOf(",") ? initialValue.replace(/\./g, "") : initialValue.replace(/,/g, "") : initialValue = initialValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""), 69119 0 === opts.digits && (-1 !== initialValue.indexOf(".") ? initialValue = initialValue.substring(0, initialValue.indexOf(".")) : -1 !== initialValue.indexOf(",") && (initialValue = initialValue.substring(0, initialValue.indexOf(",")))), 69120 "" !== opts.radixPoint && isFinite(opts.digits) && -1 !== initialValue.indexOf(opts.radixPoint)) { 69121 var valueParts = initialValue.split(opts.radixPoint), decPart = valueParts[1].match(new RegExp("\\d*"))[0]; 69122 if (parseInt(opts.digits) < decPart.toString().length) { 69123 var digitsFactor = Math.pow(10, parseInt(opts.digits)); 69124 initialValue = initialValue.replace(Inputmask.escapeRegex(opts.radixPoint), "."), 69125 initialValue = Math.round(parseFloat(initialValue) * digitsFactor) / digitsFactor, 69126 initialValue = initialValue.toString().replace(".", opts.radixPoint); 69127 } 69128 } 69129 return initialValue; 69130 }, 69131 canClearPosition: function(maskset, position, lvp, strict, opts) { 69132 var vp = maskset.validPositions[position], canClear = vp.input !== opts.radixPoint || null !== maskset.validPositions[position].match.fn && !1 === opts.decimalProtect || vp.input === opts.radixPoint && maskset.validPositions[position + 1] && null === maskset.validPositions[position + 1].match.fn || isFinite(vp.input) || position === lvp || vp.input === opts.groupSeparator || vp.input === opts.negationSymbol.front || vp.input === opts.negationSymbol.back; 69133 return !canClear || "+" !== vp.match.nativeDef && "-" !== vp.match.nativeDef || (opts.isNegative = !1), 69134 canClear; 69135 }, 69136 onKeyDown: function(e, buffer, caretPos, opts) { 69137 var $input = $(this); 69138 if (e.ctrlKey) switch (e.keyCode) { 69139 case Inputmask.keyCode.UP: 69140 $input.val(parseFloat(this.inputmask.unmaskedvalue()) + parseInt(opts.step)), $input.trigger("setvalue"); 69141 break; 69142 69143 case Inputmask.keyCode.DOW
69143N: 69144 $input.val(parseFloat(this.inputmask.unmaskedvalue()) - parseInt(opts.step)), $input.trigger("setvalue"); 69145 } 69146 } 69147 }, 69148 currency: { 69149 prefix: "$ ", 69150 groupSeparator: ",", 69151 alias: "numeric", 69152 placeholder: "0", 69153 autoGroup: !0, 69154 digits: 2, 69155 digitsOptional: !1, 69156 clearMaskOnLostFocus: !1 69157 }, 69158 decimal: { 69159 alias: "numeric" 69160 }, 69161 integer: { 69162 alias: "numeric", 69163 digits: 0, 69164 radixPoint: "" 69165 }, 69166 percentage: { 69167 alias: "numeric", 69168 digits: 2, 69169 digitsOptional: !0, 69170 radixPoint: ".", 69171 placeholder: "0", 69172 autoGroup: !1, 69173 min: 0, 69174 max: 100, 69175 suffix: " %", 69176 allowMinus: !1 69177 } 69178 }), Inputmask; 69179 }); 69180}, function(module, exports, __webpack_require__) { 69181 "use strict"; 69182 var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__; 69183 "function" == typeof Symbol && Symbol.iterator; 69184 !function(factory) { 69185 __WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(0), __webpack_require__(1) ], 69186 __WEBPACK_AMD_DEFINE_FACTORY__ = factory, void 0 !== (__WEBPACK_AMD_DEFINE_RESULT__ = "function" == typeof __WEBPACK_AMD_DEFINE_FACTORY__ ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__) && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__); 69187 }(function($, Inputmask) { 69188 function maskSort(a, b) { 69189 var maska = (a.mask || a).replace(/#/g, "9").replace(/\)/, "9").replace(/[+()#-]/g, ""), maskb = (b.mask || b).replace(/#/g, "9").replace(/\)/, "9").replace(/[+()#-]/g, ""), maskas = (a.mask || a).split("#")[0], maskbs = (b.mask || b).split("#")[0]; 69190 return 0 === maskbs.indexOf(maskas) ? -1 : 0 === maskas.indexOf(maskbs) ? 1 : maska.localeCompare(maskb); 69191 } 69192 var analyseMaskBase = Inputmask.prototype.analyseMask; 69193 return Inputmask.prototype.analyseMask = function(mask, regexMask, opts) { 69194 function reduceVariations(masks, previousVariation, previousmaskGroup) { 69195 previousVariation = previousVariation || "", previousmaskGroup = previousmaskGroup || maskGroups, 69196 "" !== previousVariation && (previousmaskGroup[previousVariation] = {}); 69197 for (var variation = "", maskGroup = previousmaskGroup[previousVariation] || previousmaskGroup, i = masks.length - 1; i >= 0; i--) mask = masks[i].mask || masks[i], 69198 variation = mask.substr(0, 1), maskGroup[variation] = maskGroup[variation] || [], 69199 maskGroup[variation].unshift(mask.substr(1)), masks.splice(i, 1); 69200 for (var ndx in maskGroup) maskGroup[ndx].length > 500 && reduceVariations(maskGroup[ndx].slice(), ndx, maskGroup); 69201 } 69202 function rebuild(maskGroup) { 69203 var mask = "", submasks = []; 69204 for (var ndx in maskGroup) $.isArray(maskGroup[ndx]) ? 1 === maskGroup[ndx].length ? submasks.push(ndx + maskGroup[ndx]) : submasks.push(ndx + opts.groupmarker.start + maskGroup[ndx].join(opts.groupmarker.end + opts.alternatormarker + opts.groupmarker.start) + opts.groupmarker.end) : submasks.push(ndx + rebuild(maskGroup[ndx])); 69205 return 1 === submasks.length ? mask += submasks[0] : mask += opts.groupmarker.start + submasks.join(opts.groupmarker.end + opts.alternatormarker + opts.groupmarker.start) + opts.groupmarker.end, 69206 mask; 69207 } 69208 var maskGroups = {}; 69209 return opts.phoneCodes && (opts.phoneCodes && opts.phoneCodes.length > 1e3 && (mask = mask.substr(1, mask.length - 2), 69210 reduceVariations(mask.split(opts.groupmarker.end + opts.alternatormarker + opts.groupmarker.start)), 69211 mask = rebuild(maskGroups)), mask = mask.replace(/9/g, "\\9")), analyseMaskBase.call(this, mask, regexMask, opts); 69212 }, Inputmask.extendAliases({ 69213 abstractphone: { 69214 groupmarker: { 69215 start: "<", 69216 end: ">" 69217 }, 69218 countrycode: "", 69219 phoneCodes: [], 69220 mask: function(opts) { 69221 return opts.definitions = { 69222 "#": Inputmask.prototype.definitions[9] 69223 }, opts.phoneCodes.sort(maskSort); 69224 }, 69225 keepStatic: !0, 69226 onBeforeMask: function(value, opts) { 69227 var processedValue = value.replace(/^0{1,2}/, "").replace(/[\s]/g, ""); 69228 return (processedValue.indexOf(opts.countrycode) > 1 || -1 === processedValue.indexOf(opts.countrycode)) && (processedValue = "+" + opts.c
69228ountrycode + processedValue), 69229 processedValue; 69230 }, 69231 onUnMask: function(maskedValue, unmaskedValue, opts) { 69232 return maskedValue.replace(/[()#-]/g, ""); 69233 }, 69234 inputmode: "tel" 69235 } 69236 }), Inputmask; 69237 }); 69238}, function(module, exports, __webpack_require__) { 69239 "use strict"; 69240 var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__, _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj) { 69241 return typeof obj; 69242 } : function(obj) { 69243 return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; 69244 }; 69245 !function(factory) { 69246 __WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(2), __webpack_require__(1) ], 69247 __WEBPACK_AMD_DEFINE_FACTORY__ = factory, void 0 !== (__WEBPACK_AMD_DEFINE_RESULT__ = "function" == typeof __WEBPACK_AMD_DEFINE_FACTORY__ ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__) && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__); 69248 }(function($, Inputmask) { 69249 return void 0 === $.fn.inputmask && ($.fn.inputmask = function(fn, options) { 69250 var nptmask, input = this[0]; 69251 if (void 0 === options && (options = {}), "string" == typeof fn) switch (fn) { 69252 case "unmaskedvalue": 69253 return input && input.inputmask ? input.inputmask.unmaskedvalue() : $(input).val(); 69254 69255 case "remove": 69256 return this.each(function() { 69257 this.inputmask && this.inputmask.remove(); 69258 }); 69259 69260 case "getemptymask": 69261 return input && input.inputmask ? input.inputmask.getemptymask() : ""; 69262 69263 case "hasMaskedValue": 69264 return !(!input || !input.inputmask) && input.inputmask.hasMaskedValue(); 69265 69266 case "isComplete": 69267 return !input || !input.inputmask || input.inputmask.isComplete(); 69268 69269 case "getmetadata": 69270 return input && input.inputmask ? input.inputmask.getmetadata() : void 0; 69271 69272 case "setvalue": 69273 $(input).val(options), input && void 0 === input.inputmask && $(input).triggerHandler("setvalue"); 69274 break; 69275 69276 case "option": 69277 if ("string" != typeof options) return this.each(function() { 69278 if (void 0 !== this.inputmask) return this.inputmask.option(options); 69279 }); 69280 if (input && void 0 !== input.inputmask) return input.inputmask.option(options); 69281 break; 69282 69283 default: 69284 return options.alias = fn, nptmask = new Inputmask(options), this.each(function() { 69285 nptmask.mask(this); 69286 }); 69287 } else { 69288 if ("object" == (void 0 === fn ? "undefined" : _typeof(fn))) return nptmask = new Inputmask(fn), 69289 void 0 === fn.mask && void 0 === fn.alias ? this.each(function() { 69290 if (void 0 !== this.inputmask) return this.inputmask.option(fn); 69291 nptmask.mask(this); 69292 }) : this.each(function() { 69293 nptmask.mask(this); 69294 }); 69295 if (void 0 === fn) return this.each(function() { 69296 nptmask = new Inputmask(options), nptmask.mask(this); 69297 }); 69298 } 69299 }), $.fn.inputmask; 69300 }); 69301}, function(module, exports, __webpack_require__) { 69302 var content = __webpack_require__(12); 69303 "string" == typeof content && (content = [ [ module.i, content, "" ] ]); 69304 __webpack_require__(14)(content, {}); 69305 content.locals && (module.exports = content.locals); 69306}, function(module, exports, __webpack_require__) { 69307 "use strict"; 69308 function _interopRequireDefault(obj) { 69309 return obj && obj.__esModule ? obj : { 69310 default: obj 69311 }; 69312 } 69313 __webpack_require__(8), __webpack_require__(3), __webpack_require__(4), __webpack_require__(5), 69314 __webpack_require__(6); 69315 var _inputmask = __webpack_require__(1), _inputmask2 = _interopRequireDefault(_inputmask), _inputmask3 = __webpack_require__(0), _inputmask4 = _interopRequireDefault(_inputmask3), _jquery = __webpack_require__(2), _jquery2 = _interopRequireDefault(_jquery); 69316 _inputmask4.default === _jquery2.default && __webpack_require__(7), window.Inputmask = _inputmask2.default; 69317}, function(module, exports, __webpack_require__) { 69318 "use strict"; 69319 var __WEBPACK_AMD_DEFINE_RESULT__; 69320 "function" == typeof Symbol && Symbol.iterator; 69321 void 0 !== (__WEBPACK_AMD_DEFINE_RESULT__ = function() { 69322 return document; 69323 }.call(exports, __webpack_require__, exports, module)) && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__); 69324}, function(module, exports, __webpack_require__) { 69325 "use strict"; 69326 var __WEBPACK_AMD_DEFINE_RESULT__; 69327 "function" == typeof Symbol && Symbol.iterator; 69328 void 0 !== (__WEBPACK_AMD_DEFINE_RESULT__ = function() { 69329 return window; 69330 }.call(exports, __webpack_require__, exports, module)) && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__); 69331}, function(module, exports, __webpack_require__) { 69332 exports = module.exports = __webpack_require__(13)(void 0), exports.push([ module.i, "span.im-caret {\r\n -webkit-animation: 1s blink step-end infinite;\r\n animation: 1s blink step-end infinite;\r\n}\r\n\r\n@keyframes blink {\r\n from, to {\r\n border-right-color: black;\r\n }\r\n 50% {\r\n border-right-color: transparent;\r\n }\r\n}\r\n\r\n@-webkit-keyframes blink {\r\n from, to {\r\n border-right-color: black;\r\n }\r\n 50% {\r\n border-right-color: transparent;\r\n }\r\n}\r\n\r\nspan.im-static {\r\n color: grey;\r\n}\r\n\r\ndiv.im-colormask {\r\n display: inline-block;\r\n border-style: inset;\r\n border-width: 2px;\r\n -webkit-appearance: textfield;\r\n -moz-appearance: textfield;\r\n appearance: textfield;\r\n}\r\n\r\ndiv.im-colormask > input {\r\n position: absolute;\r\n display: inline-block;\r\n background-color: transparent;\r\n color: transparent;\r\n -webkit-appearance: caret;\r\n -moz-appearance: caret;\r\n appearance: caret;\r\n border-style: none;\r\n left: 0; /*calculated*/\r\n}\r\n\r\ndiv.im-colormask > input:focus {\r\n outline: none;\r\n}\r\n\r\ndiv.im-colormask > div {\r\n color: black;\r\n display: inline-block;\r\n width: 100px; /*calculated*/\r\n}", "" ]); 69333}
69333, function(module, exports) { 69334 function cssWithMappingToString(item, useSourceMap) { 69335 var content = item[1] || "", cssMapping = item[3]; 69336 if (!cssMapping) return content; 69337 if (useSourceMap && "function" == typeof btoa) { 69338 var sourceMapping = toComment(cssMapping), sourceURLs = cssMapping.sources.map(function(source) { 69339 return "/*# sourceURL=" + cssMapping.sourceRoot + source + " */"; 69340 }); 69341 return [ content ].concat(sourceURLs).concat([ sourceMapping ]).join("\n"); 69342 } 69343 return [ content ].join("\n"); 69344 } 69345 function toComment(sourceMap) { 69346 return "/*# sourceMappingURL=data:application/json;charset=utf-8;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */"; 69347 } 69348 module.exports = function(useSourceMap) { 69349 var list = []; 69350 return list.toString = function() { 69351 return this.map(function(item) { 69352 var content = cssWithMappingToString(item, useSourceMap); 69353 return item[2] ? "@media " + item[2] + "{" + content + "}" : content; 69354 }).join(""); 69355 }, list.i = function(modules, mediaQuery) { 69356 "string" == typeof modules && (modules = [ [ null, modules, "" ] ]); 69357 for (var alreadyImportedModules = {}, i = 0; i < this.length; i++) { 69358 var id = this[i][0]; 69359 "number" == typeof id && (alreadyImportedModules[id] = !0); 69360 } 69361 for (i = 0; i < modules.length; i++) { 69362 var item = modules[i]; 69363 "number" == typeof item[0] && alreadyImportedModules[item[0]] || (mediaQuery && !item[2] ? item[2] = mediaQuery : mediaQuery && (item[2] = "(" + item[2] + ") and (" + mediaQuery + ")"), 69364 list.push(item)); 69365 } 69366 }, list; 69367 }; 69368}, function(module, exports, __webpack_require__) { 69369 function addStylesToDom(styles, options) { 69370 for (var i = 0; i < styles.length; i++) { 69371 var item = styles[i], domStyle = stylesInDom[item.id]; 69372 if (domStyle) { 69373 domStyle.refs++; 69374 for (var j = 0; j < domStyle.parts.length; j++) domStyle.parts[j](item.parts[j]); 69375 for (;j < item.parts.length; j++) domStyle.parts.push(addStyle(item.parts[j], options)); 69376 } else { 69377 for (var parts = [], j = 0; j < item.parts.length; j++) parts.push(addStyle(item.parts[j], options)); 69378 stylesInDom[item.id] = { 69379 id: item.id, 69380 refs: 1, 69381 parts: parts 69382 }; 69383 } 69384 } 69385 } 69386 function listToStyles(list) { 69387 for (var styles = [], newStyles = {}, i = 0; i < list.length; i++) { 69388 var item = list[i], id = item[0], css = item[1], media = item[2], sourceMap = item[3], part = { 69389 css: css, 69390 media: media, 69391 sourceMap: sourceMap 69392 }; 69393 newStyles[id] ? newStyles[id].parts.push(part) : styles.push(newStyles[id] = { 69394 id: id, 69395 parts: [ part ] 69396 }); 69397 } 69398 return styles; 69399 } 69400 function insertStyleElement(options, styleElement) { 69401 var styleTarget = getElement(options.insertInto); 69402 if (!styleTarget) throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid."); 69403 var lastStyleElementInsertedAtTop = styleElementsInsertedAtTop[styleElementsInsertedAtTop.length - 1]; 69404 if ("top" === options.insertAt) lastStyleElementInsertedAtTop ? lastStyleElementInsertedAtTop.nextSibling ? styleTarget.insertBefore(styleElement, lastStyleElementInsertedAtTop.nextSibling) : styleTarget.appendChild(styleElement) : styleTarget.insertBefore(styleElement, styleTarget.firstChild), 69405 styleElementsInsertedAtTop.push(styleElement); else { 69406 if ("bottom" !== options.insertAt) throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'."); 69407 styleTarget.appendChild(styleElement); 69408 } 69409 } 69410 function removeStyleElement(styleElement) { 69411 styleElement.parentNode.removeChild(styleElement); 69412 var idx = styleElementsInsertedAtTop.indexOf(styleElement); 69413 idx >= 0 && styleElementsInsertedAtTop.splice(idx, 1); 69414 } 69415 function createStyleElement(options) { 69416 var styleElement = document.createElement("style"); 69417 return options.attrs.type = "text/css", attachTagAttrs(styleElement, options.attrs), 69418 insertStyleElement(options, styleElement), styleElement; 69419 } 69420 function createLinkElement(options) { 69421 var linkElement = document.createElement("link"); 69422 return options.attrs.type = "text/css", options.attrs.rel = "stylesheet", attachTagAttrs(linkElement, options.attrs), 69423 insertStyleElement(options, linkElement), linkElement; 69424 } 69425 function attachTagAttrs(element, attrs) {
69426 Object.keys(attrs).forEach(function(key) { 69427 element.setAttribute(key, attrs[key]); 69428 }); 69429 } 69430 function addStyle(obj, options) { 69431 var styleElement, update, remove; 69432 if (options.singleton) { 69433 var styleIndex = singletonCounter++; 69434 styleElement = singletonElement || (singletonElement = createStyleElement(options)), 69435 update = applyToSingletonTag.bind(null, styleElement, styleIndex, !1), remove = applyToSingletonTag.bind(null, styleElement, styleIndex, !0); 69436 } else obj.sourceMap && "function" == typeof URL && "function" == typeof URL.createObjectURL && "function" == typeof URL.revokeObjectURL && "function" == typeof Blob && "function" == typeof btoa ? (styleElement = createLinkElement(options), 69437 update = updateLink.bind(null, styleElement, options), remove = function() { 69438 removeStyleElement(styleElement), styleElement.href && URL.revokeObjectURL(styleElement.href); 69439 }) : (styleElement = createStyleElement(options), update = applyToTag.bind(null, styleElement), 69440 remove = function() { 69441 removeStyleElement(styleElement); 69442 }); 69443 return update(obj), function(newObj) { 69444 if (newObj) { 69445 if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap) return; 69446 update(obj = newObj); 69447 } else remove(); 69448 }; 69449 } 69450 function applyToSingletonTag(styleElement, index, remove, obj) { 69451 var css = remove ? "" : obj.css; 69452 if (styleElement.styleSheet) styleElement.styleSheet.cssText = replaceText(index, css); else { 69453 var cssNode = document.createTextNode(css), childNodes = styleElement.childNodes; 69454 childNodes[index] && styleElement.removeChild(childNodes[index]), childNodes.length ? styleElement.insertBefore(cssNode, childNodes[index]) : styleElement.appendChild(cssNode); 69455 } 69456 } 69457 function applyToTag(styleElement, obj) { 69458 var css = obj.css, media = obj.media; 69459 if (media && styleElement.setAttribute("media", media), styleElement.styleSheet) styleElement.styleSheet.cssText = css; else { 69460 for (;styleElement.firstChild; ) styleElement.removeChild(styleElement.firstChild); 69461 styleElement.appendChild(document.createTextNode(css)); 69462 } 69463 } 69464 function updateLink(linkElement, options, obj) { 69465 var css = obj.css, sourceMap = obj.sourceMap, autoFixUrls = void 0 === options.convertToAbsoluteUrls && sourceMap; 69466 (options.convertToAbsoluteUrls || autoFixUrls) && (css = fixUrls(css)), sourceMap && (css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */"); 69467 var blob = new Blob([ css ], { 69468 type: "text/css" 69469 }), oldSrc = linkElement.href; 69470 linkElement.href = URL.createObjectURL(blob), oldSrc && URL.revokeObjectURL(oldSrc); 69471 } 69472 var stylesInDom = {}, isOldIE = function(fn) { 69473 var memo; 69474 return function() { 69475 return void 0 === memo && (memo = fn.apply(this, arguments)), memo; 69476 }; 69477 }(function() { 69478 return window && document && document.all && !window.atob; 69479 }), getElement = function(fn) { 69480 var memo = {}; 69481 return function(selector) { 69482 return void 0 === memo[selector] && (memo[selector] = fn.call(this, selector)), 69483 memo[selector]; 69484 }; 69485 }(function(styleTarget) { 69486 return document.querySelector(styleTarget); 69487 }), singletonElement = null, singletonCounter = 0, styleElementsInsertedAtTop = [], fixUrls = __webpack_require__(15); 69488 module.exports = function(list, options) { 69489 if ("undefined" != typeof DEBUG && DEBUG && "object" != typeof document) throw new Error("The style-loader cannot be used in a non-browser environment"); 69490 options = options || {}, options.attrs = "object" == typeof options.attrs ? options.attrs : {}, 69491 void 0 === options.singleton && (options.singleton = isOldIE()), void 0 === options.insertInto && (options.insertInto = "head"), 69492 void 0 === options.insertAt && (options.insertAt = "bottom"); 69493 var styles = listToStyles(list); 69494 return addStylesToDom(styles, options), function(newList) { 69495 for (var mayRemove = [], i = 0; i < styles.length; i++) { 69496 var item = styles[i], domStyle = stylesInDom[item.id]; 69497 domStyle.refs--, mayRemove.push(domStyle); 69498 } 69499 if (newList) { 69500 addStylesToDom(listToStyles(newList), options); 69501 } 69502 for (var i = 0; i < mayRemove.length; i++) { 69503 var domStyle = mayRemove[i]; 69504 if (0 === domStyle.refs) { 69505 for (var j = 0; j < domStyle.parts.length; j++) domStyle.parts[j](); 69506 delete stylesInDom[domStyle.id]; 69507 } 69508 } 69509 }; 69510 }; 69511 var replaceText = function() { 69512 var textStore = []; 69513 return function(index, replacement) { 69514 return textStore[index] = replacement, textStore.filter(Boolean).join("\n"); 69515 }; 69516 }(); 69517}
69517, function(module, exports) { 69518 module.exports = function(css) { 69519 var location = "undefined" != typeof window && window.location; 69520 if (!location) throw new Error("fixUrls requires window.location"); 69521 if (!css || "string" != typeof css) return css; 69522 var baseUrl = location.protocol + "//" + location.host, currentDir = baseUrl + location.pathname.replace(/\/[^\/]*$/, "/"); 69523 return css.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi, function(fullMatch, origUrl) { 69524 var unquotedOrigUrl = origUrl.trim().replace(/^"(.*)"$/, function(o, $1) { 69525 return $1; 69526 }).replace(/^'(.*)'$/, function(o, $1) { 69527 return $1; 69528 }); 69529 if (/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/)/i.test(unquotedOrigUrl)) return fullMatch; 69530 var newUrl; 69531 return newUrl = 0 === unquotedOrigUrl.indexOf("//") ? unquotedOrigUrl : 0 === unquotedOrigUrl.indexOf("/") ? baseUrl + unquotedOrigUrl : currentDir + unquotedOrigUrl.replace(/^\.\//, ""), 69532 "url(" + JSON.stringify(newUrl) + ")"; 69533 }); 69534 }; 69535} ]);; 69536// ================================================== 69537// fancyBox v3.1.28 69538// 69539// Licensed GPLv3 for open source use 69540// or fancyBox Commercial License for commercial use 69541// 69542// http://fancyapps.com/fancybox/ 69543// Copyright 2017 fancyApps 69544// 69545// ================================================== 69546;(function (window, document, $, undefined) { 69547 'use strict'; 69548 69549 // If there's no jQuery, fancyBox can't work 69550 // ========================================= 69551 69552 if ( !$ ) { 69553 return; 69554 } 69555 69556 // Check if fancyBox is already initialized 69557 // ======================================== 69558 69559 if ( $.fn.fancybox ) { 69560 69561 $.error('fancyBox already initialized'); 69562 69563 return; 69564 } 69565 69566 // Private default settings 69567 // ======================== 69568 69569 var defaults = { 69570 69571 // Enable infinite gallery navigation 69572 loop : false, 69573 69574 // Space around image, ignored if zoomed-in or viewport width is smaller than 800px 69575 margin : [44, 0], 69576 69577 // Horizontal space between slides 69578 gutter : 50, 69579 69580 // Enable keyboard navigation 69581 keyboard : true, 69582 69583 // Should display navigation arrows at the screen edges 69584 arrows : true, 69585 69586 // Should display infobar (counter and arrows at the top) 69587 infobar : false, 69588 69589 // Should display toolbar (buttons at the top) 69590 toolbar : true, 69591 69592 // What buttons should appear in the top right corner. 69593 // Buttons will be created using templates from `btnTpl` option 69594 // and they will be placed into toolbar (class="fancybox-toolbar"` element) 69595 buttons : [ 69596 'slideShow', 69597 'fullScreen', 69598 'thumbs', 69599 'close' 69600 ], 69601 69602 // Detect "idle" time in seconds 69603 idleTime : 4, 69604 69605 // Should display buttons at top right corner of the content 69606 // If 'auto' - they will be created for content having type 'html', 'inline' or 'ajax' 69607 // Use template from `btnTpl.smallBtn` for customization 69608 smallBtn : 'auto', 69609 69610 // Disable right-click and use simple image protection for images 69611 protect : false, 69612 69613 // Shortcut to make content "modal" - disable keyboard navigtion, hide buttons, etc 69614 modal : false, 69615 69616 image : { 69617 69618 // Wait for images to load before displaying 69619 // Requires predefined image dimensions 69620 // If 'auto' - will zoom in thumbnail if 'width' and 'height' attributes are found 69621 preload : "auto", 69622 69623 }, 69624 69625 ajax : { 69626 69627 // Object containing settings for ajax request 69628 settings : { 69629 69630 // This helps to indicate that request comes from the modal 69631 // Feel free to change naming 69632 data : { 69633 fancybox : true 69634 } 69635 } 69636 69637 }, 69638 69639 iframe : { 69640 69641 // Iframe template 69642 tpl : '<iframe id="fancybox-frame{rnd}" name="fancybox-frame{rnd}" class="fancybox-iframe" frameborder="0" vspace="0" hspace="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen allowtransparency="true" src=""></iframe>', 69643 69644 // Preload iframe before displaying it 69645 // This allows to calculate iframe content width and height 69646 // (note: Due to "Same Origin Policy", you can't get cross domain data). 69647 preload : true, 69648 69649 // Custom CSS styling for iframe wrapping element 69650 // You can use this to set custom iframe dimensions 69651 css : {}, 69652 69653 // Iframe tag attributes 69654 attr : { 69655 scrolling : 'auto' 69656 } 69657 69658 }, 69659 69660 // Open/close animation type 69661 // Possible values: 69662 // false - disable 69663 // "zoom" - zoom images from/to thumbnail 69664 // "fade" 69665 // "zoom-in-out" 69666 // 69667 animationEffect : "zoom", 69668 69669 // Duration in ms for open/close animation 69670 animationDuration : 366, 69671 69672 // Should image change opacity while zooming 69673 // If opacity is 'auto', then opacity will be changed if image and thumbnail have different aspect ratios 69674 zoomOpacity : 'auto', 69675 69676 // Transition effect between slides 69677 // 69678 // Possible values: 69679 // false - disable 69680 // "fade' 69681 // "slide' 69682 // "circular' 69683 // "tube' 69684 // "zoom-in-out' 69685 // "rotate' 69686 // 69687 transitionEffect : "fade", 69688 69689 // Duration in ms for transition animation 69690 transitionDuration : 366, 69691 69692 // Custom CSS class for slide element 69693 slideClass : '', 69694 69695 // Custom CSS class for layout 69696 baseClass : '', 69697 69698 // Base template for layout 69699 baseTpl : 69700 '<div class="fancybox-container" role="dialog" tabindex="-1">' + 69701 '<div class="fancybox-bg"></div>' + 69702 '<div class="fancybox-inner">' + 69703 '<div class="fancybox-infobar">' + 69704 '<button data-fancybox-prev title="{{PREV}}" class="fancybox-button fancybox-button--left"></button>' + 69705 '<div class="fancybox-infobar__body">' + 69706 '<span data-fancybox-index></span> / <span data-fancybox-count></span>' + 69707 '</div>' + 69708 '<button data-fancybox-next title="{{NEXT}}" class="fancybox-button fancybox-button--right"></button>' + 69709 '</div>' + 69710 '<div class="fancybox-toolbar">' + 69711 '{{BUTTONS}}' + 69712 '</div>' + 69713 '<div class="fancybox-navigation">' + 69714 '<button data-fancybox-prev title="{{PREV}}" class="fancybox-arrow fancybox-arrow--left" />' + 69715 '<button data-fancybox-next title="{{NEXT}}" class="fancybox-arrow fancybox-arrow--right" />' + 69716 '</div>' + 69717 '<div class="fancybox-stage"></div>' + 69718 '<div class="fancybox-caption-wrap">' + 69719 '<div class="fancybox-caption"></div>' + 69720 '</div>' + 69721 '</div>' + 69722 '</div>', 69723 69724 // Loading indicator template 69725 spinnerTpl : '<div class="fancybox-loading"></div>', 69726 69727 // Error message template 69728 errorTpl : '<div class="fancybox-error"><p>{{ERROR}}<p></div>', 69729 69730 btnTpl : { 69731 slideShow : '<button data-fancybox-play class="fancybox-button fancybox-button--play" title="{{PLAY_START}}"></button>', 69732 fullScreen : '<button data-fancybox-fullscreen class="fancybox-button fancybox-button--fullscreen" title="{{FULL_SCREEN}}"></button>', 69733 thumbs : '<button data-fancybox-thumbs class="fancybox-button fancybox-button--thumbs" title="{{THUMBS}}"></button>', 69734 close : '<button data-fancybox-close class="fancybox-button fancybox-button--close" title="{{CLOSE}}"></button>', 69735 69736 // This small close button will be appended to your html/inline/ajax content by default, 69737 // if "smallBtn" option is not set to false 69738 smallBtn : '<button data-fancybox-close class="fancybox-close-small" title="{{CLOSE}}"></button>' 69739 }, 69740 69741 // Container is injected into this element 69742 parentEl : 'body', 69743 69744 69745 // Focus handling 69746 // ============== 69747 69748 // Try to focus on the first focusable element after opening 69749 autoFocus : true, 69750 69751 // Put focus back to active element after closing 69752 backFocus : true, 69753
69754 // Do not let user to focus on element outside modal content 69755 trapFocus : true, 69756 69757 69758 // Module specific options 69759 // ======================= 69760 69761 fullScreen : { 69762 autoStart : false, 69763 }, 69764 69765 // Set `touch: false` to disable dragging/swiping 69766 touch : { 69767 vertical : true, // Allow to drag content vertically 69768 momentum : true // Continue movement after releasing mouse/touch when panning 69769 }, 69770 69771 // Hash value when initializing manually, 69772 // set `false` to disable hash change 69773 hash : null, 69774 69775 // Customize or add new media types 69776 // Example: 69777 /* 69778 media : { 69779 youtube : { 69780 params : { 69781 autoplay : 0 69782 } 69783 } 69784 } 69785 */ 69786 media : {}, 69787 69788 slideShow : { 69789 autoStart : false, 69790 speed : 4000 69791 }, 69792 69793 thumbs : { 69794 autoStart : false, // Display thumbnails on opening 69795 hideOnClose : true // Hide thumbnail grid when closing animation starts 69796 }, 69797 69798 // Callbacks 69799 //========== 69800 69801 // See Documentation/API/Events for more information 69802 // Example: 69803 /* 69804 afterShow: function( instance, current ) { 69805 console.info( 'Clicked element:' ); 69806 console.info( current.opts.$orig ); 69807 } 69808 */ 69809 69810 onInit : $.noop, // When instance has been initialized 69811 69812 beforeLoad : $.noop, // Before the content of a slide is being loaded 69813 afterLoad : $.noop, // When the content of a slide is done loading 69814 69815 beforeShow : $.noop, // Before open animation starts 69816 afterShow : $.noop, // When content is done loading and animating 69817 69818 beforeClose : $.noop, // Before the instance attempts to close. Return false to cancel the close. 69819 afterClose : $.noop, // After instance has been closed 69820 69821 onActivate : $.noop, // When instance is brought to front 69822 onDeactivate : $.noop, // When other instance has been activated 69823 69824 69825 // Interaction 69826 // =========== 69827 69828 // Use options below to customize taken action when user clicks or double clicks on the fancyBox area, 69829 // each option can be string or method that returns value. 69830 // 69831 // Possible values: 69832 // "close" - close instance 69833 // "next" - move to next gallery item 69834 // "nextOrClose" - move to next gallery item or close if gallery has only one item 69835 // "toggleControls" - show/hide controls 69836 // "zoom" - zoom image (if loaded) 69837 // false - do nothing 69838 69839 // Clicked on the content 69840 clickContent : function( current, event ) { 69841 return current.type === 'image' ? 'zoom' : false; 69842 }, 69843 69844 // Clicked on the slide 69845 clickSlide : 'close', 69846 69847 // Clicked on the background (backdrop) element 69848 clickOutside : 'close', 69849 69850 // Same as previous two, but for double click 69851 dblclickContent : false, 69852 dblclickSlide : false, 69853 dblclickOutside : false, 69854 69855 69856 // Custom options when mobile device is detected 69857 // ============================================= 69858 69859 mobile : { 69860 clickContent : function( current, event ) { 69861 return current.type === 'image' ? 'toggleControls' : false; 69862 }, 69863 clickSlide : function( current, event ) { 69864 return current.type === 'image' ? 'toggleControls' : 'close'; 69865 }, 69866 dblclickContent : function( current, event ) { 69867 return current.type === 'image' ? 'zoom' : false; 69868 }, 69869 dblclickSlide : function( current, event ) { 69870 return current.type === 'image' ? 'zoom' : false; 69871 } 69872 }, 69873 69874 69875 // Internationalization 69876 // ============ 69877 69878 lang : 'en', 69879 i18n : { 69880 'en' : { 69881 CLOSE : 'Close', 69882 NEXT : 'Next', 69883 PREV : 'Previous', 69884 ERROR : 'The requested content cannot be loaded. <br/> Please try again later.', 69885 PLAY_START : 'Start slideshow', 69886 PLAY_STOP : 'Pause slideshow', 69887 FULL_SCREEN : 'Full screen', 69888 THUMBS : 'Thumbnails' 69889 }, 69890 'de' : { 69891 CLOSE : 'Schliessen', 69892 NEXT : 'Weiter', 69893 PREV : 'Zurück', 69894 ERROR : 'Die angeforderten Daten konnten nicht geladen werden. <br/>
69894 Bitte versuchen Sie es später nochmal.', 69895 PLAY_START : 'Diaschau starten', 69896 PLAY_STOP : 'Diaschau beenden', 69897 FULL_SCREEN : 'Vollbild', 69898 THUMBS : 'Vorschaubilder' 69899 } 69900 } 69901 69902 }; 69903 69904 // Few useful variables and methods 69905 // ================================ 69906 69907 var $W = $(window); 69908 var $D = $(document); 69909 69910 var called = 0; 69911 69912 69913 // Check if an object is a jQuery object and not a native JavaScript object 69914 // ======================================================================== 69915 69916 var isQuery = function ( obj ) { 69917 return obj && obj.hasOwnProperty && obj instanceof $; 69918 }; 69919 69920 69921 // Handle multiple browsers for "requestAnimationFrame" and "cancelAnimationFrame" 69922 // =============================================================================== 69923 69924 var requestAFrame = (function () { 69925 return window.requestAnimationFrame || 69926 window.webkitRequestAnimationFrame || 69927 window.mozRequestAnimationFrame || 69928 window.oRequestAnimationFrame || 69929 // if all else fails, use setTimeout 69930 function (callback) { 69931 return window.setTimeout(callback, 1000 / 60); 69932 }; 69933 })(); 69934 69935 69936 // Detect the supported transition-end event property name 69937 // ======================================================= 69938 69939 var transitionEnd = (function () { 69940 var t, el = document.createElement("fakeelement"); 69941 69942 var transitions = { 69943 "transition" : "transitionend", 69944 "OTransition" : "oTransitionEnd", 69945 "MozTransition" : "transitionend", 69946 "WebkitTransition": "webkitTransitionEnd" 69947 }; 69948 69949 for (t in transitions) { 69950 if (el.style[t] !== undefined){ 69951 return transitions[t]; 69952 } 69953 } 69954 })(); 69955 69956 69957 // Force redraw on an element. 69958 // This helps in cases where the browser doesn't redraw an updated element properly. 69959 // ================================================================================= 69960 69961 var forceRedraw = function( $el ) { 69962 return ( $el && $el.length && $el[0].offsetHeight ); 69963 }; 69964 69965 69966 // Class definition 69967 // ================ 69968 69969 var FancyBox = function( content, opts, index ) { 69970 var self = this; 69971 69972 self.opts = $.extend( true, { index : index }, defaults, opts || {} ); 69973 69974 // Exclude buttons option from deep merging 69975 if ( opts && $.isArray( opts.buttons ) ) { 69976 self.opts.buttons = opts.buttons; 69977 } 69978 69979 self.id = self.opts.id || ++called; 69980 self.group = []; 69981 69982 self.currIndex = parseInt( self.opts.index, 10 ) || 0; 69983 self.prevIndex = null; 69984 69985 self.prevPos = null; 69986 self.currPos = 0; 69987 69988 self.firstRun = null; 69989 69990 // Create group elements from original item collection 69991 self.createGroup( content ); 69992 69993 if ( !self.group.length ) { 69994 return; 69995 } 69996 69997 // Save last active element and current scroll position 69998 self.$lastFocus = $(document.activeElement).blur(); 69999 70000 // Collection of gallery objects 70001 self.slides = {}; 70002 70003 self.init( content ); 70004 70005 }; 70006 70007 $.extend(FancyBox.prototype, { 70008 70009 // Create DOM structure 70010 // ==================== 70011 70012 init : function() { 70013 var self = this; 70014 70015 var testWidth, $container, buttonStr; 70016 70017 var firstItemOpts = self.group[ self.currIndex ].opts; 70018 70019 self.scrollTop = $D.scrollTop(); 70020 self.scrollLeft = $D.scrollLeft(); 70021 70022 70023 // Hide scrollbars 70024 // =============== 70025 70026 if ( !$.fancybox.getInstance() && !$.fancybox.isMobile && $( 'body' ).css('overflow') !== 'hidden' ) { 70027 testWidth = $( 'body' ).width(); 70028 70029 $( 'html' ).addClass( 'fancybox-enabled' ); 70030 70031 // Compare body width after applying "overflow: hidden" 70032 testWidth = $( 'body' ).width() - testWidth; 70033 70034 // If width has changed - compensate missing scrollbars by adding right margin 70035 if ( testWidth > 1 ) { 70036 $( 'head' ).append( '<style id="fancybox-style-noscroll" type="text/css">.compensate-for-scrollbar, .fancybox-enabled body { margin-right: ' + testWidth + 'px; }</style>' ); 70037 } 70038 } 70039 70040 70041 // Build html markup and set references 70042 // ==================================== 70043 70044 // Build html code for buttons and insert into main template 70045 buttonStr = ''; 70046 70047 $.each( firstItemOpts.buttons, function( index, value ) { 70048 buttonStr += ( firstItemOpts.btnTpl[ value ] || '' ); 70049 }); 70050 70051 // Create markup from base template, it will be initially hidden to 70052 // avoid unnecessary work like painting while initializing is not complete 70053 $container = $( self.translate( self, firstItemOpts.baseTpl.replace( '\{\{BUTTONS\}\}', buttonStr ) ) ) 70054 .addClass( 'fancybox-is-hidden' ) 70055 .attr('id', 'fancybox-container-' + self.id) 70056 .addClass( firstItemOpts.baseClass ) 70057 .data( 'FancyBox', self ) 70058 .prependTo( firstItemOpts.parentEl ); 70059 70060 // Create object holding references to jQuery wrapped nodes 70061 self.$refs = { 70062 container : $container 70063 }; 70064 70065 [ 'bg', 'inner', 'infobar', 'toolbar', 'stage', 'caption' ].forEach(function(item) { 70066 self.$refs[ item ] = $container.find( '.fancybox-' + item ); 70067 }); 70068 70069 // Check for redundant elements 70070 if ( !firstItemOpts.arrows || self.group.length < 2 ) { 70071 $container.find('.fancybox-navigation').remove(); 70072 } 70073 70074 if ( !firstItemOpts.infobar ) { 70075 self.$refs.infobar.remove(); 70076 } 70077 70078 if ( !firstItemOpts.toolbar ) { 70079 self.$refs.toolbar.remove(); 70080 } 70081 70082 self.trigger( 'onInit' ); 70083 70084 // Bring to front and enable events 70085 self.activate(); 70086 70087 // Build slides, load and reveal content 70088 self.jumpTo( self.currIndex ); 70089 }, 70090 70091 70092 // Simple i18n support - replaces object keys found in template 70093 // with corresponding values 70094 // ============================================================ 70095 70096 translate : function( obj, str ) { 70097 var arr = obj.opts.i18n[ obj.opts.lang ]; 70098 70099 return str.replace(/\{\{(\w+)\}\}/g, function(match, n) { 70100 var value = arr[n]; 70101 70102 if ( value === undefined ) { 70103 return match; 70104 } 70105 70106 return value; 70107 }); 70108 }, 70109 70110 // Create array of gally item objects 70111 // Check if each object has valid type and content 70112 // =============================================== 70113 70114 createGroup : function ( content ) { 70115 var self = this; 70116 var items = $.makeArray( content ); 70117 70118 $.each(items, function( i, item ) { 70119 var obj = {}, 70120 opts = {}, 70121 data = [], 70122 $item, 70123 type, 70124 src, 70125 srcParts; 70126 70127 // Step 1 - Make sure we have an object 70128 // ==================================== 70129 70130 if ( $.isPlainObject( item ) ) { 70131 70132 // We probably have manual usage here, something like 70133 // $.fancybox.open( [ { src : "image.jpg", type : "image" } ] ) 70134 70135 obj = item; 70136 opts = item.opts || item; 70137 70138 } else if ( $.type( item ) === 'object' && $( item ).length ) { 70139 70140 // Here we propbably have jQuery collection returned by some selector 70141 70142 $item = $( item ); 70143 data = $item.data(); 70144 70145 opts = 'options' in data ? data.options : {}; 70146 opts = $.type( opts ) === 'object' ? opts : {}; 70147 70148 obj.src = 'src' in data ? data.src : ( opts.src || $item.attr( 'href' ) ); 70149
70150 [ 'width', 'height', 'thumb', 'type', 'filter' ].forEach(function(item) { 70151 if ( item in data ) { 70152 opts[ item ] = data[ item ]; 70153 } 70154 }); 70155 70156 if ( 'srcset' in data ) { 70157 opts.image = { srcset : data.srcset }; 70158 } 70159 70160 opts.$orig = $item; 70161 70162 if ( !obj.type && !obj.src ) { 70163 obj.type = 'inline'; 70164 obj.src = item; 70165 } 70166 70167 } else { 70168 70169 // Assume we have a simple html code, for example: 70170 // $.fancybox.open( '<div><h1>Hi!</h1></div>' ); 70171 70172 obj = { 70173 type : 'html', 70174 src : item + '' 70175 }; 70176 70177 } 70178 70179 // Each gallery object has full collection of options 70180 obj.opts = $.extend( true, {}, self.opts, opts ); 70181 70182 if ( $.fancybox.isMobile ) { 70183 obj.opts = $.extend( true, {}, obj.opts, obj.opts.mobile ); 70184 } 70185 70186 70187 // Step 2 - Make sure we have content type, if not - try to guess 70188 // ============================================================== 70189 70190 type = obj.type || obj.opts.type; 70191 src = obj.src || ''; 70192 70193 if ( !type && src ) { 70194 if ( src.match(/(^data:image\/[a-z0-9+\/=]*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg|ico)((\?|#).*)?$)/i) ) { 70195 type = 'image'; 70196 70197 } else if ( src.match(/\.(pdf)((\?|#).*)?$/i) ) { 70198 type = 'pdf'; 70199 70200 } else if ( src.charAt(0) === '#' ) { 70201 type = 'inline'; 70202 } 70203 } 70204 70205 obj.type = type; 70206 70207 70208 // Step 3 - Some adjustments 70209 // ========================= 70210 70211 obj.index = self.group.length; 70212 70213 // Check if $orig and $thumb objects exist 70214 if ( obj.opts.$orig && !obj.opts.$orig.length ) { 70215 delete obj.opts.$orig; 70216 } 70217 70218 if ( !obj.opts.$thumb && obj.opts.$orig ) { 70219 obj.opts.$thumb = obj.opts.$orig.find( 'img:first' ); 70220 } 70221 70222 if ( obj.opts.$thumb && !obj.opts.$thumb.length ) { 70223 delete obj.opts.$thumb; 70224 } 70225 70226 // Caption is a "special" option, it can be passed as a method 70227 if ( $.type( obj.opts.caption ) === 'function' ) { 70228 obj.opts.caption = obj.opts.caption.apply( item, [ self, obj ] ); 70229 70230 } else if ( 'caption' in data ) { 70231 obj.opts.caption = data.caption; 70232 } 70233 70234 // Make sure we have caption as a string 70235 obj.opts.caption = obj.opts.caption === undefined ? '' : obj.opts.caption + ''; 70236 70237 // Check if url contains "filter" used to filter the content 70238 // Example: "ajax.html #something" 70239 if ( type === 'ajax' ) { 70240 srcParts = src.split(/\s+/, 2); 70241 70242 if ( srcParts.length > 1 ) { 70243 obj.src = srcParts.shift(); 70244 70245 obj.opts.filter = srcParts.shift(); 70246 } 70247 } 70248 70249 if ( obj.opts.smallBtn == 'auto' ) { 70250 70251 if ( $.inArray( type, ['html', 'inline', 'ajax'] ) > -1 ) { 70252 obj.opts.toolbar = false; 70253 obj.opts.smallBtn = true; 70254 70255 } else { 70256 obj.opts.smallBtn = false; 70257 } 70258 70259 } 70260 70261 // If the type is "pdf", then simply load file into iframe 70262 if ( type === 'pdf' ) { 70263 obj.type = 'iframe'; 70264 70265 obj.opts.iframe.preload = false; 70266 } 70267 70268 // Hide all buttons and disable interactivity for modal items 70269 if ( obj.opts.modal ) { 70270 70271 obj.opts = $.extend(true, obj.opts, { 70272 // Remove buttons 70273 infobar : 0, 70274 toolbar : 0, 70275 70276 smallBtn : 0, 70277 70278 // Disable keyboard navigation 70279 keyboard : 0, 70280 70281 // Disable some modules 70282 slideShow : 0, 70283 fullScreen : 0, 70284 thumbs : 0, 70285 touch : 0, 70286 70287 // Disable click event handlers 70288 clickContent : false, 70289 clickSlide : false, 70290 clickOutside : false, 70291 dblclickContent : false, 70292 dblclickSlide : false, 70293 dblclickOutside : false 70294 }); 70295 70296 } 70297 70298 // Step 4 - Add processed object to group 70299 // ====================================== 70300 70301 self.group.push( obj ); 70302 70303 }); 70304 70305 }, 70306 70307 70308 // Attach an event handler functions for: 70309 // - navigation buttons 70310 // - browser scrolling, resizing; 70311 // - focusing 70312 // - keyboard 70313 // - detect idle 70314 // ====================================== 70315 70316 addEvents : function() { 70317 var self = this; 70318 70319 self.removeEvents(); 70320 70321 // Make navigation elements clickable 70322 self.$refs.container.on('click.fb-close', '[data-fancybox-close]', function(e) { 70323 e.stopPropagation(); 70324 e.preventDefault(); 70325 70326 self.close( e ); 70327 70328 }).on( 'click.fb-prev touchend.fb-prev', '[data-fancybox-prev]', function(e) { 70329 e.stopPropagation(); 70330 e.preventDefault(); 70331 70332 self.previous(); 70333 70334 }).on( 'click.fb-next touchend.fb-next', '[data-fancybox-next]', function(e) { 70335 e.stopPropagation(); 70336 e.preventDefault(); 70337 70338 self.next(); 70339 70340 }); 70341 70342 70343 // Handle page scrolling and browser resizing 70344 $W.on('orientationchange.fb resize.fb', function(e) { 70345 70346 if ( e && e.originalEvent && e.originalEvent.type === "resize" ) { 70347 70348 requestAFrame(function() {
70349 self.update(); 70350 }); 70351 70352 } else { 70353 70354 self.$refs.stage.hide(); 70355 70356 setTimeout(function() { 70357 self.$refs.stage.show(); 70358 70359 self.update(); 70360 }, 500); 70361 70362 } 70363 70364 }); 70365 70366 // Trap keyboard focus inside of the modal, so the user does not accidentally tab outside of the modal 70367 // (a.k.a. "escaping the modal") 70368 $D.on('focusin.fb', function(e) { 70369 var instance = $.fancybox ? $.fancybox.getInstance() : null; 70370 70371 if ( instance.isClosing || !instance.current || !instance.current.opts.trapFocus || $( e.target ).hasClass( 'fancybox-container' ) || $( e.target ).is( document ) ) { 70372 return; 70373 } 70374 70375 if ( instance && $( e.target ).css( 'position' ) !== 'fixed' && !instance.$refs.container.has( e.target ).length ) { 70376 e.stopPropagation(); 70377 70378 instance.focus(); 70379 70380 // Sometimes page gets scrolled, set it back 70381 $W.scrollTop( self.scrollTop ).scrollLeft( self.scrollLeft ); 70382 } 70383 }); 70384 70385 70386 // Enable keyboard navigation 70387 $D.on('keydown.fb', function (e) { 70388 var current = self.current, 70389 keycode = e.keyCode || e.which; 70390 70391 if ( !current || !current.opts.keyboard ) { 70392 return; 70393 } 70394 70395 if ( $(e.target).is('input') || $(e.target).is('textarea') ) { 70396 return; 70397 } 70398 70399 // Backspace and Esc keys 70400 if ( keycode === 8 || keycode === 27 ) { 70401 e.preventDefault(); 70402 70403 self.close( e ); 70404 70405 return; 70406 } 70407 70408 // Left arrow and Up arrow 70409 if ( keycode === 37 || keycode === 38 ) { 70410 e.preventDefault(); 70411 70412 self.previous(); 70413 70414 return; 70415 } 70416 70417 // Righ arrow and Down arrow 70418 if ( keycode === 39 || keycode === 40 ) { 70419 e.preventDefault(); 70420 70421 self.next(); 70422 70423 return; 70424 } 70425 70426 self.trigger('afterKeydown', e, keycode); 70427 }); 70428 70429 70430 // Hide controls after some inactivity period 70431 if ( self.group[ self.currIndex ].opts.idleTime ) { 70432 self.idleSecondsCounter = 0; 70433 70434 $D.on('mousemove.fb-idle mouseenter.fb-idle mouseleave.fb-idle mousedown.fb-idle touchstart.fb-idle touchmove.fb-idle scroll.fb-idle keydown.fb-idle', function() { 70435 self.idleSecondsCounter = 0; 70436 70437 if ( self.isIdle ) { 70438 self.showControls(); 70439 } 70440 70441 self.isIdle = false; 70442 }); 70443 70444 self.idleInterval = window.setInterval(function() { 70445 70446 self.idleSecondsCounter++; 70447 70448 if ( self.idleSecondsCounter >= self.group[ self.currIndex ].opts.idleTime ) { 70449 self.isIdle = true; 70450 self.idleSecondsCounter = 0; 70451 70452 self.hideControls(); 70453 } 70454 70455 }, 1000); 70456 } 70457 70458 }, 70459 70460 70461 // Remove events added by the core 70462 // =============================== 70463 70464 removeEvents : function () { 70465 var self = this; 70466 70467 $W.off( 'orientationchange.fb resize.fb' ); 70468 $D.off( 'focusin.fb keydown.fb .fb-idle' ); 70469 70470 this.$refs.container.off( '.fb-close .fb-prev .fb-next' ); 70471 70472 if ( self.idleInterval ) { 70473 window.clearInterval( self.idleInterval ); 70474 70475 self.idleInterval = null; 70476 } 70477 }, 70478 70479 70480 // Change to previous gallery item 70481 // =============================== 70482 70483 previous : function( duration ) { 70484 return this.jumpTo( this.currPos - 1, duration ); 70485 }, 70486 70487 70488 // Change to next gallery item 70489 // =========================== 70490 70491 next : function( duration ) { 70492 return this.jumpTo( this.currPos + 1, duration ); 70493 }, 70494 70495 70496 // Switch to selected gallery item 70497 // =============================== 70498 70499 jumpTo : function ( pos, duration, slide ) { 70500 var self = this, 70501 firstRun, 70502 loop, 70503 current, 70504 previous, 70505 canvasWidth, 70506 currentPos, 70507 transitionProps; 70508 70509 var groupLen = self.group.length; 70510 70511 if ( self.isSliding || self.isClosing || ( self.isAnimating && self.firstRun ) ) { 70512 return; 70513 } 70514 70515 pos = parseInt( pos, 10 ); 70516 loop = self.current ? self.current.opts.loop : self.opts.loop; 70517 70518 if ( !loop && ( pos < 0 || pos >= groupLen ) ) { 70519 return false; 70520 } 70521 70522 firstRun = self.firstRun = ( self.firstRun === null ); 70523 70524 if ( groupLen < 2 && !firstRun && !!self.isSliding ) { 70525 return; 70526 } 70527 70528 previous = self.current; 70529 70530 self.prevIndex = self.currIndex; 70531 self.prevPos = self.currPos; 70532 70533 // Create slides 70534 current = self.createSlide( pos ); 70535 70536 if ( groupLen > 1 ) { 70537 if ( loop || current.index > 0 ) { 70538 self.createSlide( pos - 1 ); 70539 } 70540 70541 if ( loop || current.index < groupLen - 1 ) { 70542 self.createSlide( pos + 1 ); 70543 } 70544 } 70545 70546 self.current = current; 70547 self.currIndex = current.index; 70548 self.currPos = current.pos; 70549 70550 self.trigger( 'beforeShow', firstRun ); 70551 70552 self.updateControls(); 70553 70554 currentPos = $.fancybox.getTranslate( current.$slide ); 70555 70556 current.isMoved = ( currentPos.left !== 0 || currentPos.top !== 0 ) && !current.$slide.hasClass( 'fancybox-animated' ); 70557 current.forcedDuration = undefined; 70558 70559 if ( $.isNumeric( duration ) ) { 70560 current.forcedDuration = duration; 70561 } else { 70562 duration = current.opts[ firstRun ? 'animationDuration' : 'transitionDuration' ]; 70563 } 70564 70565 duration = parseInt( duration, 10 ); 70566 70567 // Fresh start - reveal container, current slide and start loading content 70568 if ( firstRun ) { 70569 70570 if ( current.opts.animationEffect && duration ) { 70571 self.$refs.container.css( 'transition-duration', duration + 'ms' ); 70572 } 70573 70574 self.$refs.container.removeClass( 'fancybox-is-hidden' ); 70575 70576 forceRedraw( self.$refs.container ); 70577 70578 self.$refs.container.addClass( 'fancybox-is-open' ); 70579 70580 // Make first slide visible (to display loading icon, if needed) 70581 current.$slide.addClass( 'fancybox-slide--current' ); 70582 70583 self.loadSlide( current ); 70584 70585 self.preload(); 70586 70587 return; 70588 } 70589 70590 // Clean up 70591 $.each(self.slides, function( index, slide ) { 70592 $.fancybox.stop( slide.$slide ); 70593 }); 70594 70595 // Make current that slide is visible even if content is still loading 70596 current.$slide.removeClass( 'fancybox-slide--next fancybox-slide--previous' ).addClass( 'fancybox-slide--current' ); 70597 70598 // If slides have been dragged, animate them to correct position 70599 if ( current.isMoved ) { 70600 canvasWidth = Math.round( current.$slide.width() ); 70601 70602 $.each(self.slides, function( index, slide ) { 70603 var pos = slide.pos - current.pos; 70604 70605 $.fancybox.animate( slide.$slide, { 70606 top : 0, 70607 left : ( pos * canvasWidth ) + ( pos * slide.opts.gutter ) 70608 }, duration, function() { 70609 70610 slide.$slide.removeAttr('style').removeClass( 'fancybox-slide--next fancybox-slide--previous' ); 70611 70612 if ( slide.pos === self.currPos ) { 70613 current.isMoved = false; 70614 70615 self.complete(); 70616 } 70617 }); 70618 }); 70619 70620 } else { 70621 self.$refs.stage.children().removeAttr( 'style' ); 70622 } 70623 70624 // Start transition that reveals current content 70625 // or wait when it will be loaded 70626 70627 if ( current.isLoaded ) { 70628 self.revealContent( current ); 70629 70630 } else { 70631 self.loadSlide( current ); 70632 } 70633 70634 self.preload(); 70635 70636 if ( previous.pos === current.pos ) { 70637 return; 70638 } 70639 70640 // Handle previous slide 70641 // ===================== 70642 70643 transitionProps = 'fancybox-slide--' + ( previous.pos > current.pos ? 'next' : 'previous' ); 70644 70645 previous.$slide.removeClass( 'fancybox-slide--complete fancybox-slide--current fancybox-slide--next fancybox-slide--previous' ); 70646 70647 previous.isComplete = false; 70648 70649 if ( !duration || ( !current.isMoved && !current.opts.transitionEffect ) ) { 70650 return; 70651 } 70652 70653 if ( current.isMoved ) { 70654 previous.$slide.addClass( transitionProps ); 70655 70656 } else { 70657 70658 transitionProps = 'fancybox-animated ' + transitionProps + ' fancybox-fx-' + current.opts.transitionEffect; 70659 70660 $.fancybox.animate( previous.$slide, transitionProps, duration, function() { 70661 previous.$slide.removeClass( transitionProps ).removeAttr( 'style' ); 70662 }); 70663 70664 } 70665 70666 }, 70667 70668 70669 // Create new "slide" element 70670 // These are gallery items that are actually added to DOM 70671 // ======================================================= 70672 70673 createSlide : function( pos ) { 70674 70675 var self = this; 70676 var $slide; 70677 var index; 70678 70679 index = pos % self.group.length; 70680 index = index < 0 ? self.group.length + index : index; 70681 70682 if ( !self.slides[ pos ] && self.group[ index ] ) {
70683 $slide = $('<div class="fancybox-slide"></div>').appendTo( self.$refs.stage ); 70684 70685 self.slides[ pos ] = $.extend( true, {}, self.group[ index ], { 70686 pos : pos, 70687 $slide : $slide, 70688 isLoaded : false, 70689 }); 70690 70691 self.updateSlide( self.slides[ pos ] ); 70692 } 70693 70694 return self.slides[ pos ]; 70695 }, 70696 70697 70698 // Scale image to the actual size of the image 70699 // =========================================== 70700 70701 scaleToActual : function( x, y, duration ) { 70702 70703 var self = this; 70704 70705 var current = self.current; 70706 var $what = current.$content; 70707 70708 var imgPos, posX, posY, scaleX, scaleY; 70709 70710 var canvasWidth = parseInt( current.$slide.width(), 10 ); 70711 var canvasHeight = parseInt( current.$slide.height(), 10 ); 70712 70713 var newImgWidth = current.width; 70714 var newImgHeight = current.height; 70715 70716 if ( !( current.type == 'image' && !current.hasError) || !$what || self.isAnimating) { 70717 return; 70718 } 70719 70720 $.fancybox.stop( $what ); 70721 70722 self.isAnimating = true; 70723 70724 x = x === undefined ? canvasWidth * 0.5 : x; 70725 y = y === undefined ? canvasHeight * 0.5 : y; 70726 70727 imgPos = $.fancybox.getTranslate( $what ); 70728 70729 scaleX = newImgWidth / imgPos.width; 70730 scaleY = newImgHeight / imgPos.height; 70731 70732 // Get center position for original image 70733 posX = ( canvasWidth * 0.5 - newImgWidth * 0.5 ); 70734 posY = ( canvasHeight * 0.5 - newImgHeight * 0.5 ); 70735 70736 // Make sure image does not move away from edges 70737 if ( newImgWidth > canvasWidth ) { 70738 posX = imgPos.left * scaleX - ( ( x * scaleX ) - x ); 70739 70740 if ( posX > 0 ) { 70741 posX = 0; 70742 } 70743 70744 if ( posX < canvasWidth - newImgWidth ) { 70745 posX = canvasWidth - newImgWidth; 70746 } 70747 } 70748 70749 if ( newImgHeight > canvasHeight) { 70750 posY = imgPos.top * scaleY - ( ( y * scaleY ) - y ); 70751 70752 if ( posY > 0 ) { 70753 posY = 0; 70754 } 70755 70756 if ( posY < canvasHeight - newImgHeight ) { 70757 posY = canvasHeight - newImgHeight; 70758 } 70759 } 70760 70761 self.updateCursor( newImgWidth, newImgHeight ); 70762 70763 $.fancybox.animate( $what, { 70764 top : posY, 70765 left : posX, 70766 scaleX : scaleX, 70767 scaleY : scaleY 70768 }, duration || 330, function() { 70769 self.isAnimating = false; 70770 }); 70771 70772 // Stop slideshow 70773 if ( self.SlideShow && self.SlideShow.isActive ) { 70774 self.SlideShow.stop(); 70775 } 70776 }, 70777 70778 70779 // Scale image to fit inside parent element 70780 // ======================================== 70781 70782 scaleToFit : function( duration ) { 70783 70784 var self = this; 70785 70786 var current = self.current; 70787 var $what = current.$content; 70788 var end; 70789 70790 if ( !( current.type == 'image' && !current.hasError) || !$what || self.isAnimating ) { 70791 return; 70792 } 70793 70794 $.fancybox.stop( $what ); 70795 70796 self.isAnimating = true; 70797 70798 end = self.getFitPos( current ); 70799 70800 self.updateCursor( end.width, end.height ); 70801 70802 $.fancybox.animate( $what, { 70803 top : end.top, 70804 left : end.left, 70805 scaleX : end.width / $what.width(), 70806 scaleY : end.height / $what.height() 70807 }, duration || 330, function() { 70808 self.isAnimating = false; 70809 }); 70810 70811 }, 70812 70813 // Calculate image size to fit inside viewport 70814 // =========================================== 70815 70816 getFitPos : function( slide ) { 70817 var self = this; 70818 var $what = slide.$content; 70819 70820 var imgWidth = slide.width; 70821 var imgHeight = slide.height; 70822 70823 var margin = slide.opts.margin; 70824 70825 var canvasWidth, canvasHeight, minRatio, width, height; 70826 70827 if ( !$what || !$what.length || ( !imgWidth && !imgHeight) ) { 70828 return false; 70829 } 70830 70831 // Convert "margin to CSS style: [ top, right, bottom, left ] 70832 if ( $.type( margin ) === "number" ) { 70833 margin = [ margin, margin ]; 70834 } 70835 70836 if ( margin.length == 2 ) { 70837 margin = [ margin[0], margin[1], margin[0], margin[1] ]; 70838 } 70839 70840 if ( $W.width() < 800 ) { 70841 margin = [ 0, 0, 0, 0 ]; 70842 } 70843 70844 // We can not use $slide width here, because it can have different diemensions while in transiton 70845 canvasWidth = parseInt( self.$refs.stage.width(), 10 ) - ( margin[ 1 ] + margin[ 3 ] ); 70846 canvasHeight = parseInt( self.$refs.stage.height(), 10 ) - ( margin[ 0 ] + margin[ 2 ] ); 70847 70848 minRatio = Math.min(1, canvasWidth / imgWidth, canvasHeight / imgHeight ); 70849 70850 width = Math.floor( minRatio * imgWidth ); 70851 height = Math.floor( minRatio * imgHeight ); 70852 70853 // Use floor rounding to make sure it really fits 70854 return { 70855 top : Math.floor( ( canvasHeight - height ) * 0.5 ) + margin[ 0 ], 70856 left : Math.floor( ( canvasWidth - width ) * 0.5 ) + margin[ 3 ], 70857 width : width, 70858 height : height 70859 }; 70860 70861 }, 70862 70863 70864 // Update position and content of all slides 70865 // ========================================= 70866 70867 update : function() { 70868 70869 var self = this; 70870 70871 $.each( self.slides, function( key, slide ) { 70872 self.updateSlide( slide ); 70873 }); 70874 70875 }, 70876 70877 70878 // Update slide position and scale content to fit 70879 // ============================================== 70880 70881 updateSlide : function( slide ) { 70882 70883 var self = this; 70884 var $what = slide.$content; 70885 70886 if ( $what && ( slide.width || slide.height ) ) { 70887 $.fancybox.stop( $what ); 70888 70889 $.fancybox.setTranslate( $what, self.getFitPos( slide ) ); 70890 70891 if ( slide.pos === self.currPos ) {
70892 self.updateCursor(); 70893 } 70894 } 70895 70896 slide.$slide.trigger( 'refresh' ); 70897 70898 self.trigger( 'onUpdate', slide ); 70899 70900 }, 70901 70902 // Update cursor style depending if content can be zoomed 70903 // ====================================================== 70904 70905 updateCursor : function( nextWidth, nextHeight ) { 70906 70907 var self = this; 70908 var isScaledDown; 70909 70910 var $container = self.$refs.container.removeClass('fancybox-is-zoomable fancybox-can-zoomIn fancybox-can-drag fancybox-can-zoomOut'); 70911 70912 if ( !self.current || self.isClosing ) { 70913 return; 70914 } 70915 70916 if ( self.isZoomable() ) { 70917 70918 $container.addClass( 'fancybox-is-zoomable' ); 70919 70920 if ( nextWidth !== undefined && nextHeight !== undefined ) { 70921 isScaledDown = nextWidth < self.current.width && nextHeight < self.current.height; 70922 70923 } else { 70924 isScaledDown = self.isScaledDown(); 70925 } 70926 70927 if ( isScaledDown ) { 70928 70929 // If image is scaled down, then, obviously, it can be zoomed to full size 70930 $container.addClass('fancybox-can-zoomIn'); 70931 70932 } else { 70933 70934 if ( self.current.opts.touch ) { 70935 70936 // If image size ir largen than available available and touch module is not disable, 70937 // then user can do panning 70938 $container.addClass('fancybox-can-drag'); 70939 70940 } else { 70941 $container.addClass('fancybox-can-zoomOut'); 70942 } 70943 70944 } 70945 70946 } else if ( self.current.opts.touch ) { 70947 $container.addClass('fancybox-can-drag'); 70948 } 70949 70950 }, 70951 70952 70953 // Check if current slide is zoomable 70954 // ================================== 70955 70956 isZoomable : function() { 70957 70958 var self = this; 70959 70960 var current = self.current; 70961 var fitPos; 70962 70963 if ( !current || self.isClosing ) { 70964 return; 70965 } 70966 70967 // Assume that slide is zoomable if 70968 // - image is loaded successfuly 70969 // - click action is "zoom" 70970 // - actual size of the image is smaller than available area 70971 if ( current.type === 'image' && current.isLoaded && !current.hasError && 70972 ( current.opts.clickContent === 'zoom' || ( $.isFunction( current.opts.clickContent ) && current.opts.clickContent( current ) === "zoom" ) ) 70973 ) { 70974 70975 fitPos = self.getFitPos( current ); 70976 70977 if ( current.width > fitPos.width || current.height > fitPos.height ) { 70978 return true; 70979 } 70980 70981 } 70982 70983 return false; 70984 70985 }, 70986 70987 70988 // Check if current image dimensions are smaller than actual 70989 // ========================================================= 70990 70991 isScaledDown : function() { 70992 70993 var self = this; 70994 70995 var current = self.current; 70996 var $what = current.$content; 70997 70998 var rez = false; 70999 71000 if ( $what ) { 71001 rez = $.fancybox.getTranslate( $what ); 71002 rez = rez.width < current.width || rez.height < current.height; 71003 } 71004 71005 return rez; 71006 71007 }, 71008 71009 71010 // Check if image dimensions exceed parent element 71011 // =============================================== 71012 71013 canPan : function() { 71014 71015 var self = this; 71016 71017 var current = self.current; 71018 var $what = current.$content; 71019 71020 var rez = false; 71021 71022 if ( $what ) { 71023 rez = self.getFitPos( current ); 71024 rez = Math.abs( $what.width() - rez.width ) > 1 || Math.abs( $what.height() - rez.height ) > 1; 71025 71026 } 71027 71028 return rez; 71029 71030 }, 71031 71032 71033 // Load content into the slide 71034 // =========================== 71035 71036 loadSlide : function( slide ) { 71037 71038 var self = this, type, $slide; 71039 var ajaxLoad; 71040 71041 if ( slide.isLoading ) { 71042 return; 71043 } 71044 71045 if ( slide.isLoaded ) { 71046 return; 71047 } 71048 71049 slide.isLoading = true; 71050 71051 self.trigger( 'beforeLoad', slide ); 71052 71053 type = slide.type; 71054 $slide = slide.$slide; 71055 71056 $slide 71057 .off( 'refresh' ) 71058 .trigger( 'onReset' ) 71059 .addClass( 'fancybox-slide--' + ( type || 'unknown' ) ) 71060 .addClass( slide.opts.slideClass ); 71061 71062 // Create content depending on the type 71063 71064 switch ( type ) { 71065 71066 case 'image': 71067 71068 self.setImage( slide ); 71069 71070 break; 71071 71072 case 'iframe': 71073 71074 self.setIframe( slide ); 71075 71076 break; 71077 71078 case 'html': 71079 71080 self.setContent( slide, slide.src || slide.content ); 71081 71082 break; 71083 71084 case 'inline': 71085 71086 if ( $( slide.src ).length ) { 71087 self.setContent( slide, $( slide.src ) ); 71088 71089 } else { 71090 self.setError( slide ); 71091 } 71092 71093 break; 71094 71095 case 'ajax': 71096 71097 self.showLoading( slide ); 71098 71099 ajaxLoad = $.ajax( $.extend( {}, slide.opts.ajax.settings, { 71100 url : slide.src, 71101 success : function ( data, textStatus ) { 71102 71103 if ( textStatus === 'success' ) { 71104 self.setContent( slide, data ); 71105 } 71106 71107 }, 71108 error : function ( jqXHR, textStatus ) { 71109 71110 if ( jqXHR && textStatus !== 'abort' ) { 71111 self.setError( slide ); 71112 } 71113 71114 } 71115 })); 71116 71117 $slide.one( 'onReset', function () { 71118 ajaxLoad.abort(); 71119 }); 71120 71121 break; 71122 71123 default: 71124 71125 self.setError( slide ); 71126 71127 break; 71128 71129 } 71130 71131 return true; 71132 71133 }, 71134 71135 71136 // Use thumbnail image, if possible 71137 // ================================ 71138 71139 setImage : function( slide ) { 71140 71141 var self = this; 71142 var srcset = slide.opts.image.srcset; 71143
71144 var found, temp, pxRatio, windowWidth; 71145 71146 // If we have "srcset", then we need to find matching "src" value. 71147 // This is necessary, because when you set an src attribute, the browser will preload the image 71148 // before any javascript or even CSS is applied. 71149 if ( srcset ) { 71150 pxRatio = window.devicePixelRatio || 1; 71151 windowWidth = window.innerWidth * pxRatio; 71152 71153 temp = srcset.split(',').map(function ( el ) { 71154 var ret = {}; 71155 71156 el.trim().split(/\s+/).forEach(function ( el, i ) { 71157 var value = parseInt( el.substring(0, el.length - 1), 10 ); 71158 71159 if ( i === 0 ) { 71160 return ( ret.url = el ); 71161 } 71162 71163 if ( value ) { 71164 ret.value = value; 71165 ret.postfix = el[ el.length - 1 ]; 71166 } 71167 71168 }); 71169 71170 return ret; 71171 }); 71172 71173 // Sort by value 71174 temp.sort(function (a, b) { 71175 return a.value - b.value; 71176 }); 71177 71178 // Ok, now we have an array of all srcset values 71179 for ( var j = 0; j < temp.length; j++ ) { 71180 var el = temp[ j ]; 71181 71182 if ( ( el.postfix === 'w' && el.value >= windowWidth ) || ( el.postfix === 'x' && el.value >= pxRatio ) ) { 71183 found = el; 71184 break; 71185 } 71186 } 71187 71188 // If not found, take the last one 71189 if ( !found && temp.length ) { 71190 found = temp[ temp.length - 1 ]; 71191 } 71192 71193 if ( found ) { 71194 slide.src = found.url; 71195 71196 // If we have default width/height values, we can calculate height for matching source 71197 if ( slide.width && slide.height && found.postfix == 'w' ) { 71198 slide.height = ( slide.width / slide.height ) * found.value; 71199 slide.width = found.value; 71200 } 71201 } 71202 } 71203 71204 // This will be wrapper containing both ghost and actual image 71205 slide.$content = $('<div class="fancybox-image-wrap"></div>') 71206 .addClass( 'fancybox-is-hidden' ) 71207 .appendTo( slide.$slide ); 71208 71209 71210 // If we have a thumbnail, we can display it while actual image is loading 71211 // Users will not stare at black screen and actual image will appear gradually 71212 if ( slide.opts.preload !== false && slide.opts.width && slide.opts.height && ( slide.opts.thumb || slide.opts.$thumb ) ) { 71213 71214 slide.width = slide.opts.width; 71215 slide.height = slide.opts.height; 71216 71217 slide.$ghost = $('<img />') 71218 .one('error', function() { 71219 71220 $(this).remove(); 71221 71222 slide.$ghost = null; 71223 71224 self.setBigImage( slide ); 71225 71226 }) 71227 .one('load', function() { 71228 71229 self.afterLoad( slide ); 71230 71231 self.setBigImage( slide ); 71232 71233 }) 71234 .addClass( 'fancybox-image' ) 71235 .appendTo( slide.$content ) 71236 .attr( 'src', slide.opts.thumb || slide.opts.$thumb.attr( 'src' ) ); 71237 71238 } else { 71239 71240 self.setBigImage( slide ); 71241 71242 } 71243 71244 }, 71245 71246 71247 // Create full-size image 71248 // ====================== 71249 71250 setBigImage : function ( slide ) { 71251 var self = this; 71252 var $img = $('<img />'); 71253 71254 slide.$image = $img 71255 .one('error', function() { 71256 71257 self.setError( slide ); 71258 71259 }) 71260 .one('load', function() { 71261 71262 // Clear timeout that checks if loading icon needs to be displayed 71263 clearTimeout( slide.timouts ); 71264 71265 slide.timouts = null; 71266 71267 if ( self.isClosing ) { 71268 return; 71269 } 71270
71271 slide.width = this.naturalWidth; 71272 slide.height = this.naturalHeight; 71273 71274 if ( slide.opts.image.srcset ) { 71275 $img.attr( 'sizes', '100vw' ).attr( 'srcset', slide.opts.image.srcset ); 71276 } 71277 71278 self.hideLoading( slide ); 71279 71280 if ( slide.$ghost ) { 71281 71282 slide.timouts = setTimeout(function() { 71283 slide.timouts = null; 71284 71285 slide.$ghost.hide(); 71286 71287 }, Math.min( 300, Math.max( 1000, slide.height / 1600 ) ) ); 71288 71289 } else { 71290 self.afterLoad( slide ); 71291 } 71292 71293 }) 71294 .addClass( 'fancybox-image' ) 71295 .attr('src', slide.src) 71296 .appendTo( slide.$content ); 71297 71298 if ( ( $img[0].complete || $img[0].readyState == "complete" ) && $img[0].naturalWidth && $img[0].naturalHeight ) { 71299 $img.trigger( 'load' ); 71300 71301 } else if( $img[0].error ) { 71302 $img.trigger( 'error' ); 71303 71304 } else { 71305 71306 slide.timouts = setTimeout(function() { 71307 if ( !$img[0].complete && !slide.hasError ) { 71308 self.showLoading( slide ); 71309 } 71310 71311 }, 100); 71312 71313 } 71314 71315 }, 71316 71317 71318 // Create iframe wrapper, iframe and bindings 71319 // ========================================== 71320 71321 setIframe : function( slide ) { 71322 var self = this, 71323 opts = slide.opts.iframe, 71324 $slide = slide.$slide, 71325 $iframe; 71326 71327 slide.$content = $('<div class="fancybox-content' + ( opts.preload ? ' fancybox-is-hidden' : '' ) + '"></div>') 71328 .css( opts.css ) 71329 .appendTo( $slide ); 71330 71331 $iframe = $( opts.tpl.replace(/\{rnd\}/g, new Date().getTime()) ) 71332 .attr( opts.attr ) 71333 .appendTo( slide.$content ); 71334 71335 if ( opts.preload ) { 71336 71337 self.showLoading( slide ); 71338 71339 // Unfortunately, it is not always possible to determine if iframe is successfully loaded 71340 // (due to browser security policy) 71341 71342 $iframe.on('load.fb error.fb', function(e) { 71343 this.isReady = 1; 71344 71345 slide.$slide.trigger( 'refresh' ); 71346 71347 self.afterLoad( slide ); 71348 }); 71349 71350 // Recalculate iframe content size 71351 // =============================== 71352 71353 $slide.on('refresh.fb', function() { 71354 var $wrap = slide.$content, 71355 frameWidth = opts.css.width, 71356 frameHeight = opts.css.height, 71357 scrollWidth, 71358 $contents, 71359 $body; 71360 71361 if ( $iframe[0].isReady !== 1 ) { 71362 return; 71363 } 71364 71365 // Check if content is accessible, 71366 // it will fail if frame is not with the same origin 71367 71368 try { 71369 $contents = $iframe.contents(); 71370 $body = $contents.find('body'); 71371 71372 } catch (ignore) {} 71373 71374 // Calculate dimensions for the wrapper 71375 if ( $body && $body.length ) { 71376 71377 if ( frameWidth === undefined ) { 71378 scrollWidth = $iframe[0].contentWindow.document.documentElement.scrollWidth; 71379 71380 frameWidth = Math.ceil( $body.outerWidth(true) + ( $wrap.width() - scrollWidth ) ); 71381 frameWidth += $wrap.outerWidth() - $wrap.innerWidth(); 71382 } 71383 71384 if ( frameHeight === undefined ) { 71385 frameHeight = Math.ceil( $body.outerHeight(true) ); 71386 frameHeight += $wrap.outerHeight() - $wrap.innerHeight(); 71387 } 71388 71389 // Resize wrapper to fit iframe content 71390 if ( frameWidth ) { 71391 $wrap.width( frameWidth ); 71392 } 71393 71394 if ( frameHeight ) { 71395 $wrap.height( frameHeight ); 71396 } 71397 } 71398 71399 $wrap.removeClass( 'fancybox-is-hidden' ); 71400 71401 }); 71402 71403 } else { 71404 71405 this.afterLoad( slide ); 71406 71407 } 71408 71409 $iframe.attr( 'src', slide.src ); 71410 71411 if ( slide.opts.smallBtn === true ) {
71412 slide.$content.prepend( self.translate( slide, slide.opts.btnTpl.smallBtn ) ); 71413 } 71414 71415 // Remove iframe if closing or changing gallery item 71416 $slide.one( 'onReset', function () { 71417 71418 // This helps IE not to throw errors when closing 71419 try { 71420 71421 $( this ).find( 'iframe' ).hide().attr( 'src', '//about:blank' ); 71422 71423 } catch ( ignore ) {} 71424 71425 $( this ).empty(); 71426 71427 slide.isLoaded = false; 71428 71429 }); 71430 71431 }, 71432 71433 71434 // Wrap and append content to the slide 71435 // ====================================== 71436 71437 setContent : function ( slide, content ) { 71438 71439 var self = this; 71440 71441 if ( self.isClosing ) { 71442 return; 71443 } 71444 71445 self.hideLoading( slide ); 71446 71447 slide.$slide.empty(); 71448 71449 if ( isQuery( content ) && content.parent().length ) { 71450 71451 // If content is a jQuery object, then it will be moved to the slide. 71452 // The placeholder is created so we will know where to put it back. 71453 // If user is navigating gallery fast, then the content might be already inside fancyBox 71454 // ===================================================================================== 71455 71456 // Make sure content is not already moved to fancyBox 71457 content.parent( '.fancybox-slide--inline' ).trigger( 'onReset' ); 71458 71459 // Create temporary element marking original place of the content 71460 slide.$placeholder = $( '<div></div>' ).hide().insertAfter( content ); 71461 71462 // Make sure content is visible 71463 content.css('display', 'inline-block'); 71464 71465 } else if ( !slide.hasError ) { 71466 71467 // If content is just a plain text, try to convert it to html 71468 if ( $.type( content ) === 'string' ) { 71469 content = $('<div>').append( $.trim( content ) ).contents(); 71470 71471 // If we have text node, then add wrapping element to make vertical alignment work 71472 if ( content[0].nodeType === 3 ) { 71473 content = $('<div>').html( content ); 71474 } 71475 } 71476 71477 // If "filter" option is provided, then filter content 71478 if ( slide.opts.filter ) { 71479 content = $('<div>').html( content ).find( slide.opts.filter ); 71480 } 71481 71482 } 71483 71484 slide.$slide.one('onReset', function () { 71485 71486 // Put content back 71487 if ( slide.$placeholder ) { 71488 slide.$placeholder.after( content.hide() ).remove(); 71489 71490 slide.$placeholder = null; 71491 } 71492 71493 // Remove custom close button 71494 if ( slide.$smallBtn ) { 71495 slide.$smallBtn.remove(); 71496 71497 slide.$smallBtn = null; 71498 } 71499 71500 // Remove content and mark slide as not loaded 71501 if ( !slide.hasError ) { 71502 $(this).empty(); 71503 71504 slide.isLoaded = false; 71505 } 71506 71507 }); 71508 71509 slide.$content = $( content ).appendTo( slide.$slide ); 71510 71511 if ( slide.opts.smallBtn && !slide.$smallBtn ) { 71512 slide.$smallBtn = $( self.translate( slide, slide.opts.btnTpl.smallBtn ) ).appendTo( slide.$content.filter('div').first() ); 71513 } 71514 71515 this.afterLoad( slide ); 71516 }, 71517 71518 // Display error message 71519 // ===================== 71520 71521 setError : function ( slide ) { 71522 71523 slide.hasError = true; 71524 71525 slide.$slide.removeClass( 'fancybox-slide--' + slide.type ); 71526 71527 this.setContent( slide, this.translate( slide, slide.opts.errorTpl ) ); 71528 71529 }, 71530 71531 71532 // Show loading icon inside the slide 71533 // ================================== 71534 71535 showLoading : function( slide ) { 71536 71537 var self = this; 71538 71539 slide = slide || self.current; 71540 71541 if ( slide && !slide.$spinner ) { 71542 slide.$spinner = $( self.opts.spinnerTpl ).appendTo( slide.$slide ); 71543 } 71544 71545 }, 71546 71547 // Remove loading icon from the slide 71548 // ================================== 71549 71550 hideLoading : function( slide ) { 71551 71552 var self = this; 71553 71554 slide = slide || self.current; 71555 71556 if ( slide && slide.$spinner ) { 71557 slide.$spinner.remove(); 71558 71559 delete slide.$spinner; 71560 } 71561 71562 }, 71563 71564 71565 // Adjustments after slide content has been loaded 71566 // =============================================== 71567 71568 afterLoad : function( slide ) { 71569 71570 var self = this; 71571 71572 if ( self.isClosing ) { 71573 return; 71574 } 71575 71576 slide.isLoading = false; 71577 slide.isLoaded = true; 71578 71579 self.trigger( 'afterLoad', slide ); 71580 71581 self.hideLoading( slide ); 71582 71583 if ( slide.opts.protect && slide.$content && !slide.hasError ) { 71584 71585 // Disable right click 71586 slide.$content.on( 'contextmenu.fb', function( e ) { 71587 if ( e.button == 2 ) { 71588 e.preventDefault(); 71589 } 71590 71591 return true; 71592 }); 71593 71594 // Add fake element on top of the image 71595 // This makes a bit harder for user to select image 71596 if ( slide.type === 'image' ) { 71597 $( '<div class="fancybox-spaceball"></div>' ).appendTo( slide.$content ); 71598 } 71599 71600 } 71601 71602 self.revealContent( slide ); 71603 71604 }, 71605 71606 71607 // Make content visible 71608 // This method is called right after content has been loaded or 71609 // user navigates gallery and transition should start 71610 // ============================================================ 71611 71612 revealContent : function( slide ) { 71613 71614 var self = this; 71615 var $slide = slide.$slide; 71616 71617 var effect, effectClassName, duration, opacity, end, start = false; 71618 71619 effect = slide.opts[ self.firstRun ? 'animationEffect' : 'transitionEffect' ]; 71620 duration = slide.opts[ self.firstRun ? 'animationDuration' : 'transitionDuration' ]; 71621 71622 duration = parseInt( slide.forcedDuration === undefined ? duration : slide.forcedDuration, 10 ); 71623 71624 if ( slide.isMoved || slide.pos !== self.currPos || !duration ) { 71625 effect = false; 71626 } 71627 71628 // Check if can zoom 71629 if ( effect === 'zoom' && !( slide.pos === self.currPos && duration && slide.type === 'image' && !slide.hasError && ( start = self.getThumbPos( slide ) ) ) ) { 71630 effect = 'fade'; 71631 } 71632 71633 // Zoom animation 71634 // ============== 71635 71636 if ( effect === 'zoom' ) { 71637 end = self.getFitPos( slide ); 71638 71639 end.scaleX = end.width / start.width; 71640 end.scaleY = end.height / start.height; 71641 71642 delete end.width; 71643 delete end.height; 71644 71645 // Check if we need to animate opacity 71646 opacity = slide.opts.zoomOpacity; 71647 71648 if ( opacity == 'auto' ) { 71649 opacity = Math.abs( slide.width / slide.height - start.width / start.height ) > 0.1; 71650 } 71651 71652 if ( opacity ) { 71653 start.opacity = 0.1; 71654 end.opacity = 1; 71655 } 71656 71657 // Draw image at start position 71658 $.fancybox.setTranslate( slide.$content.removeClass( 'fancybox-is-hidden' ), start ); 71659 71660 forceRedraw( slide.$content ); 71661 71662 // Start animation 71663 $.fancybox.animate( slide.$content, end, duration, function() { 71664 self.complete(); 71665 }); 71666 71667 return; 71668 } 71669 71670 71671 self.updateSlide( slide ); 71672 71673 71674 // Simply show content 71675 // =================== 71676 71677 if ( !effect ) { 71678 forceRedraw( $slide ); 71679 71680 slide.$content.removeClass( 'fancybox-is-hidden' ); 71681 71682 if ( slide.pos === self.currPos ) { 71683 self.complete(); 71684 } 71685 71686 return; 71687 } 71688 71689 $.fancybox.stop( $slide ); 71690 71691 effectClassName = 'fancybox-animated fancybox-slide--' + ( slide.pos > self.prevPos ? 'next' : 'previous' ) + ' fancybox-fx-' + effect; 71692 71693 $slide.removeAttr( 'style' ).removeClass( 'fancybox-slide--current fancybox-slide--next fancybox-slide--previous' ).addClass( effectClassName ); 71694 71695 slide.$content.removeClass( 'fancybox-is-hidden' ); 71696 71697 //Force reflow for CSS3 transitions 71698 forceRedraw( $slide ); 71699 71700 $.fancybox.animate( $slide, 'fancybox-slide--current', duration, function(e) { 71701 $slide.removeClass( effectClassName ).removeAttr( 'style' ); 71702 71703 if ( slide.pos === self.currPos ) { 71704 self.complete(); 71705 } 71706 71707 }, true); 71708 71709 }, 71710 71711 71712 // Check if we can and have to zoom from thumbnail 71713 //================================================ 71714 71715 getThumbPos : function( slide ) { 71716 71717 var self = this; 71718 var rez = false; 71719 71720 // Check if element is inside the viewport by at least 1 pixel 71721 var isElementVisible = function( $el ) { 71722 var element = $el[0]; 71723 71724 var elementRect = element.getBoundingClientRect(); 71725 var parentRects = []; 71726 71727 var visibleInAllParents; 71728 71729 while ( element.parentElement !== null ) { 71730 if ( $(element.parentElement).css('overflow') === 'hidden' || $(element.parentElement).css('overflow') === 'auto' ) { 71731 parentRects.push(element.parentElement.getBoundingClientRect()); 71732 } 71733 71734 element = element.parentElement; 71735 } 71736 71737 visibleInAllParents = parentRects.every(function(parentRect){ 71738 var visiblePixelX = Math.min(elementRect.right, parentRect.right) - Math.max(elementRect.left, parentRect.left); 71739 var visiblePixelY = Math.min(elementRect.bottom, parentRect.bottom) - Math.max(elementRect.top, parentRect.top); 71740 71741 return visiblePixelX > 0 && visiblePixelY > 0; 71742 }); 71743 71744 return visibleInAllParents && 71745 elementRect.bottom > 0 && elementRect.right > 0 && 71746 elementRect.left < $(window).width() && elementRect.top < $(window).height(); 71747 }; 71748 71749 var $thumb = slide.opts.$thumb; 71750 var thumbPos = $thumb ? $thumb.offset() : 0; 71751 var slidePos; 71752 71753 if ( thumbPos && $thumb[0].ownerDocument === document && isElementVisible( $thumb ) ) { 71754 slidePos = self.$refs.stage.offset(); 71755 71756 rez = { 71757 top : thumbPos.top - slidePos.top + parseFloat( $thumb.css( "border-top-width" ) || 0 ), 71758 left : thumbPos.left - slidePos.left + parseFloat( $thumb.css( "border-left-width" ) || 0 ), 71759 width : $thumb.width(), 71760 height : $thumb.height(), 71761 scaleX : 1, 71762 scaleY : 1 71763 }; 71764 } 71765 71766 return rez; 71767 }, 71768 71769 71770 // Final adjustments after current gallery item is moved to position 71771 // and it`s content is loaded 71772 // ================================================================== 71773 71774 complete : function() { 71775 71776 var self = this; 71777 71778 var current = self.current; 71779 var slides = {}; 71780 71781 if ( current.isMoved || !current.isLoaded || current.isComplete ) { 71782 return; 71783 } 71784 71785 current.isComplete = true; 71786 71787 current.$slide.siblings().trigger( 'onReset' ); 71788 71789 // Trigger any CSS3 transiton inside the slide 71790 forceRedraw( current.$slide ); 71791 71792 current.$slide.addClass( 'fancybox-slide--complete' ); 71793 71794 // Remove unnecessary slides 71795 $.each( self.slides, function( key, slide ) { 71796 if ( slide.pos >= self.currPos - 1 && slide.pos <= self.currPos + 1 ) { 71797 slides[ slide.pos ] = slide; 71798 71799 } else if ( slide ) { 71800 71801 $.fancybox.stop( slide.$slide ); 71802 71803 slide.$slide.off().remove(); 71804 } 71805 }); 71806 71807 self.slides = slides; 71808
71809 self.updateCursor(); 71810 71811 self.trigger( 'afterShow' ); 71812 71813 // Try to focus on the first focusable element 71814 if ( $( document.activeElement ).is( '[disabled]' ) || ( current.opts.autoFocus && !( current.type == 'image' || current.type === 'iframe' ) ) ) { 71815 self.focus(); 71816 } 71817 71818 }, 71819 71820 71821 // Preload next and previous slides 71822 // ================================ 71823 71824 preload : function() { 71825 var self = this; 71826 var next, prev; 71827 71828 if ( self.group.length < 2 ) { 71829 return; 71830 } 71831 71832 next = self.slides[ self.currPos + 1 ]; 71833 prev = self.slides[ self.currPos - 1 ]; 71834 71835 if ( next && next.type === 'image' ) { 71836 self.loadSlide( next ); 71837 } 71838 71839 if ( prev && prev.type === 'image' ) { 71840 self.loadSlide( prev ); 71841 } 71842 71843 }, 71844 71845 71846 // Try to find and focus on the first focusable element 71847 // ==================================================== 71848 71849 focus : function() { 71850 var current = this.current; 71851 var $el; 71852 71853 if ( this.isClosing ) { 71854 return; 71855 } 71856 71857 if ( current && current.isComplete ) { 71858 71859 // Look for first input with autofocus attribute 71860 $el = current.$slide.find('input[autofocus]:enabled:visible:first'); 71861 71862 if ( !$el.length ) { 71863 $el = current.$slide.find('button,:input,[tabindex],a').filter(':enabled:visible:first'); 71864 } 71865 } 71866 71867 $el = $el && $el.length ? $el : this.$refs.container; 71868 71869 $el.focus(); 71870 }, 71871 71872 71873 // Activates current instance - brings container to the front and enables keyboard, 71874 // notifies other instances about deactivating 71875 // ================================================================================= 71876 71877 activate : function () { 71878 var self = this; 71879 71880 // Deactivate all instances 71881 $( '.fancybox-container' ).each(function () { 71882 var instance = $(this).data( 'FancyBox' ); 71883 71884 // Skip self and closing instances 71885 if (instance && instance.uid !== self.uid && !instance.isClosing) { 71886 instance.trigger( 'onDeactivate' ); 71887 } 71888 71889 }); 71890 71891 if ( self.current ) { 71892 if ( self.$refs.container.index() > 0 ) { 71893 self.$refs.container.prependTo( document.body ); 71894 } 71895 71896 self.updateControls(); 71897 } 71898 71899 self.trigger( 'onActivate' ); 71900 71901 self.addEvents(); 71902 71903 }, 71904 71905 71906 // Start closing procedure 71907 // This will start "zoom-out" animation if needed and clean everything up afterwards 71908 // ================================================================================= 71909 71910 close : function( e, d ) { 71911 71912 var self = this; 71913 var current = self.current; 71914 71915 var effect, duration; 71916 var $what, opacity, start, end; 71917 71918 var done = function() { 71919 self.cleanUp( e ); 71920 }; 71921 71922 if ( self.isClosing ) { 71923 return false; 71924 } 71925 71926 self.isClosing = true; 71927 71928 // If beforeClose callback prevents closing, make sure content is centered 71929 if ( self.trigger( 'beforeClose', e ) === false ) { 71930 self.isClosing = false; 71931 71932 requestAFrame(function() { 71933 self.update(); 71934 }); 71935 71936 return false; 71937 } 71938 71939 // Remove all events 71940 // If there are multiple instances, they will be set again by "activate" method 71941 self.removeEvents(); 71942 71943 if ( current.timouts ) { 71944 clearTimeout( current.timouts ); 71945 } 71946 71947 $what = current.$content; 71948 effect = current.opts.animationEffect; 71949 duration = $.isNumeric( d ) ? d : ( effect ? current.opts.animationDuration : 0 ); 71950 71951 // Remove other slides 71952 current.$slide.off( transitionEnd ).removeClass( 'fancybox-slide--complete fancybox-slide--next fancybox-slide--previous fancybox-animated' ); 71953 71954 current.$slide.siblings().trigger( 'onReset' ).remove(); 71955 71956 // Trigger animations 71957 if ( duration ) { 71958 self.$refs.container.removeClass( 'fancybox-is-open' ).addClass( 'fancybox-is-closing' ); 71959 } 71960 71961 // Clean up 71962 self.hideLoading( current ); 71963 71964 self.hideControls(); 71965
71966 self.updateCursor(); 71967 71968 // Check if possible to zoom-out 71969 if ( effect === 'zoom' && !( e !== true && $what && duration && current.type === 'image' && !current.hasError && ( end = self.getThumbPos( current ) ) ) ) { 71970 effect = 'fade'; 71971 } 71972 71973 if ( effect === 'zoom' ) { 71974 $.fancybox.stop( $what ); 71975 71976 start = $.fancybox.getTranslate( $what ); 71977 71978 start.width = start.width * start.scaleX; 71979 start.height = start.height * start.scaleY; 71980 71981 // Check if we need to animate opacity 71982 opacity = current.opts.zoomOpacity; 71983 71984 if ( opacity == 'auto' ) { 71985 opacity = Math.abs( current.width / current.height - end.width / end.height ) > 0.1; 71986 } 71987 71988 if ( opacity ) { 71989 end.opacity = 0; 71990 } 71991 71992 start.scaleX = start.width / end.width; 71993 start.scaleY = start.height / end.height; 71994 71995 start.width = end.width; 71996 start.height = end.height; 71997 71998 $.fancybox.setTranslate( current.$content, start ); 71999 72000 $.fancybox.animate( current.$content, end, duration, done ); 72001 72002 return true; 72003 } 72004 72005 if ( effect && duration ) { 72006 72007 // If skip animation 72008 if ( e === true ) { 72009 setTimeout( done, duration ); 72010 72011 } else { 72012 $.fancybox.animate( current.$slide.removeClass( 'fancybox-slide--current' ), 'fancybox-animated fancybox-slide--previous fancybox-fx-' + effect, duration, done ); 72013 } 72014 72015 } else { 72016 done(); 72017 } 72018 72019 return true; 72020 }, 72021 72022 72023 // Final adjustments after removing the instance 72024 // ============================================= 72025 72026 cleanUp : function( e ) { 72027 var self = this, 72028 instance; 72029 72030 self.current.$slide.trigger( 'onReset' ); 72031 72032 self.$refs.container.empty().remove(); 72033 72034 self.trigger( 'afterClose', e ); 72035 72036 // Place back focus 72037 if ( self.$lastFocus && !!self.current.opts.backFocus ) { 72038 self.$lastFocus.focus(); 72039 } 72040 72041 self.current = null; 72042 72043 // Check if there are other instances 72044 instance = $.fancybox.getInstance(); 72045 72046 if ( instance ) { 72047 instance.activate(); 72048 72049 } else { 72050 $W.scrollTop( self.scrollTop ).scrollLeft( self.scrollLeft ); 72051 72052 $( 'html' ).removeClass( 'fancybox-enabled' ); 72053 72054 $( '#fancybox-style-noscroll' ).remove(); 72055 } 72056 72057 }, 72058 72059 72060 // Call callback and trigger an event 72061 // ================================== 72062 72063 trigger : function( name, slide ) { 72064 var args = Array.prototype.slice.call(arguments, 1), 72065 self = this, 72066 obj = slide && slide.opts ? slide : self.current, 72067 rez; 72068 72069 if ( obj ) { 72070 args.unshift( obj ); 72071 72072 } else { 72073 obj = self; 72074 } 72075 72076 args.unshift( self ); 72077 72078 if ( $.isFunction( obj.opts[ name ] ) ) { 72079 rez = obj.opts[ name ].apply( obj, args ); 72080 } 72081 72082 if ( rez === false ) { 72083 return rez; 72084 } 72085 72086 if ( name === 'afterClose' ) { 72087 $D.trigger( name + '.fb', args ); 72088 72089 } else { 72090 self.$refs.container.trigger( name + '.fb', args ); 72091 } 72092 72093 }, 72094 72095 72096 // Update infobar values, navigation button states and reveal caption 72097 // ================================================================== 72098 72099 updateControls : function ( force ) { 72100 72101 var self = this; 72102 72103 var current = self.current; 72104 var index = current.index; 72105 var opts = current.opts; 72106 var caption = opts.caption; 72107 var $caption = self.$refs.caption; 72108 72109 // Recalculate content dimensions 72110 current.$slide.trigger( 'refresh' ); 72111 72112 self.$caption = caption && caption.length ? $caption.html( caption ) : null; 72113
72114 if ( !self.isHiddenControls ) { 72115 self.showControls(); 72116 } 72117 72118 // Update info and navigation elements 72119 $('[data-fancybox-count]').html( self.group.length ); 72120 $('[data-fancybox-index]').html( index + 1 ); 72121 72122 $('[data-fancybox-prev]').prop('disabled', ( !opts.loop && index <= 0 ) ); 72123 $('[data-fancybox-next]').prop('disabled', ( !opts.loop && index >= self.group.length - 1 ) ); 72124 72125 }, 72126 72127 // Hide toolbar and caption 72128 // ======================== 72129 72130 hideControls : function () { 72131 72132 this.isHiddenControls = true; 72133 72134 this.$refs.container.removeClass('fancybox-show-infobar fancybox-show-toolbar fancybox-show-caption fancybox-show-nav'); 72135 72136 }, 72137 72138 showControls : function() { 72139 72140 var self = this; 72141 var opts = self.current ? self.current.opts : self.opts; 72142 var $container = self.$refs.container; 72143 72144 self.isHiddenControls = false; 72145 self.idleSecondsCounter = 0; 72146 72147 $container 72148 .toggleClass('fancybox-show-toolbar', !!( opts.toolbar && opts.buttons ) ) 72149 .toggleClass('fancybox-show-infobar', !!( opts.infobar && self.group.length > 1 ) ) 72150 .toggleClass('fancybox-show-nav', !!( opts.arrows && self.group.length > 1 ) ) 72151 .toggleClass('fancybox-is-modal', !!opts.modal ); 72152 72153 if ( self.$caption ) { 72154 $container.addClass( 'fancybox-show-caption '); 72155 72156 } else { 72157 $container.removeClass( 'fancybox-show-caption' ); 72158 } 72159 72160 }, 72161 72162 72163 // Toggle toolbar and caption 72164 // ========================== 72165 72166 toggleControls : function() { 72167 72168 if ( this.isHiddenControls ) { 72169 this.showControls(); 72170 72171 } else { 72172 this.hideControls(); 72173 } 72174 72175 }, 72176 72177 72178 }); 72179 72180 72181 $.fancybox = { 72182 72183 version : "3.1.28", 72184 defaults : defaults, 72185 72186 72187 // Get current instance and execute a command. 72188 // 72189 // Examples of usage: 72190 // 72191 // $instance = $.fancybox.getInstance(); 72192 // $.fancybox.getInstance().jumpTo( 1 ); 72193 // $.fancybox.getInstance( 'jumpTo', 1 ); 72194 // $.fancybox.getInstance( function() { 72195 // console.info( this.currIndex ); 72196 // }); 72197 // ====================================================== 72198 72199 getInstance : function ( command ) { 72200 var instance = $('.fancybox-container:not(".fancybox-is-closing"):first').data( 'FancyBox' ); 72201 var args = Array.prototype.slice.call(arguments, 1); 72202 72203 if ( instance instanceof FancyBox ) { 72204 72205 if ( $.type( command ) === 'string' ) { 72206 instance[ command ].apply( instance, args ); 72207 72208 } else if ( $.type( command ) === 'function' ) { 72209 command.apply( instance, args ); 72210 72211 } 72212 72213 return instance; 72214 } 72215 72216 return false; 72217 72218 }, 72219 72220 72221 // Create new instance 72222 // =================== 72223 72224 open : function ( items, opts, index ) { 72225 return new FancyBox( items, opts, index ); 72226 }, 72227 72228 72229 // Close current or all instances 72230 // ============================== 72231 72232 close : function ( all ) { 72233 var instance = this.getInstance(); 72234 72235 if ( instance ) { 72236 instance.close(); 72237 72238 // Try to find and close next instance 72239 72240 if ( all === true ) { 72241 this.close(); 72242 } 72243 } 72244 72245 }, 72246 72247 // Close instances and unbind all events 72248 // ============================== 72249 72250 destroy : function() { 72251 72252 this.close( true ); 72253 72254 $D.off( 'click.fb-start' ); 72255 72256 }, 72257 72258 72259 // Try to detect mobile devices 72260 // ============================ 72261 72262 isMobile : document.createTouch !== undefined && /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent), 72263 72264 72265 // Detect if 'translate3d' support is available 72266 // ============================================ 72267 72268 use3d : (function() { 72269 var div = document.createElement('div'); 72270 72271 return window.getComputedStyle && window.getComputedStyle( div ).getPropertyValue('transform') && !(document.documentMode && document.documentMode < 11);
72272 }()), 72273 72274 72275 // Helper function to get current visual state of an element 72276 // returns array[ top, left, horizontal-scale, vertical-scale, opacity ] 72277 // ===================================================================== 72278 72279 getTranslate : function( $el ) { 72280 var matrix; 72281 72282 if ( !$el || !$el.length ) { 72283 return false; 72284 } 72285 72286 matrix = $el.eq( 0 ).css('transform'); 72287 72288 if ( matrix && matrix.indexOf( 'matrix' ) !== -1 ) { 72289 matrix = matrix.split('(')[1]; 72290 matrix = matrix.split(')')[0]; 72291 matrix = matrix.split(','); 72292 } else { 72293 matrix = []; 72294 } 72295 72296 if ( matrix.length ) { 72297 72298 // If IE 72299 if ( matrix.length > 10 ) { 72300 matrix = [ matrix[13], matrix[12], matrix[0], matrix[5] ]; 72301 72302 } else { 72303 matrix = [ matrix[5], matrix[4], matrix[0], matrix[3]]; 72304 } 72305 72306 matrix = matrix.map(parseFloat); 72307 72308 } else { 72309 matrix = [ 0, 0, 1, 1 ]; 72310 72311 var transRegex = /\.*translate\((.*)px,(.*)px\)/i; 72312 var transRez = transRegex.exec( $el.eq( 0 ).attr('style') ); 72313 72314 if ( transRez ) { 72315 matrix[ 0 ] = parseFloat( transRez[2] ); 72316 matrix[ 1 ] = parseFloat( transRez[1] ); 72317 } 72318 } 72319 72320 return { 72321 top : matrix[ 0 ], 72322 left : matrix[ 1 ], 72323 scaleX : matrix[ 2 ], 72324 scaleY : matrix[ 3 ], 72325 opacity : parseFloat( $el.css('opacity') ), 72326 width : $el.width(), 72327 height : $el.height() 72328 }; 72329 72330 }, 72331 72332 72333 // Shortcut for setting "translate3d" properties for element 72334 // Can set be used to set opacity, too 72335 // ======================================================== 72336 72337 setTranslate : function( $el, props ) { 72338 var str = ''; 72339 var css = {}; 72340 72341 if ( !$el || !props ) { 72342 return; 72343 } 72344 72345 if ( props.left !== undefined || props.top !== undefined ) { 72346 str = ( props.left === undefined ? $el.position().left : props.left ) + 'px, ' + ( props.top === undefined ? $el.position().top : props.top ) + 'px'; 72347 72348 if ( this.use3d ) { 72349 str = 'translate3d(' + str + ', 0px)'; 72350 72351 } else { 72352 str = 'translate(' + str + ')'; 72353 } 72354 } 72355 72356 if ( props.scaleX !== undefined && props.scaleY !== undefined ) { 72357 str = (str.length ? str + ' ' : '') + 'scale(' + props.scaleX + ', ' + props.scaleY + ')'; 72358 } 72359 72360 if ( str.length ) { 72361 css.transform = str; 72362 } 72363 72364 if ( props.opacity !== undefined ) { 72365 css.opacity = props.opacity; 72366 } 72367 72368 if ( props.width !== undefined ) { 72369 css.width = props.width; 72370 } 72371 72372 if ( props.height !== undefined ) { 72373 css.height = props.height; 72374 } 72375 72376 return $el.css( css ); 72377 }, 72378 72379 72380 // Simple CSS transition handler 72381 // ============================= 72382 72383 animate : function ( $el, to, duration, callback, leaveAnimationName ) { 72384 var event = transitionEnd || 'transitionend'; 72385 72386 if ( $.isFunction( duration ) ) { 72387 callback = duration; 72388 duration = null; 72389 } 72390 72391 if ( !$.isPlainObject( to ) ) { 72392 $el.removeAttr('style'); 72393 } 72394 72395 $el.on( event, function(e) { 72396 72397 // Skip events from child elements and z-index change 72398 if ( e && e.originalEvent && ( !$el.is( e.originalEvent.target ) || e.originalEvent.propertyName == 'z-index' ) ) { 72399 return; 72400 } 72401 72402 $el.off( event ); 72403 72404 if ( $.isPlainObject( to ) ) { 72405 72406 if ( to.scaleX !== undefined && to.scaleY !== undefined ) { 72407 $el.css( 'transition-duration', '0ms' ); 72408 72409 to.width = Math.round( $el.width() * to.scaleX ); 72410 to.height = Math.round( $el.height() * to.scaleY ); 72411 72412 to.scaleX = 1; 72413 to.scaleY = 1; 72414 72415 $.fancybox.setTranslate( $el, to ); 72416 } 72417 72418 } else if ( leaveAnimationName !== true ) { 72419 $el.removeClass( to ); 72420 } 72421 72422 if ( $.isFunction( callback ) ) { 72423 callback( e ); 72424 } 72425 72426 }); 72427 72428 if ( $.isNumeric( duration ) ) { 72429 $el.css( 'transition-duration', duration + 'ms' ); 72430 } 72431 72432 if ( $.isPlainObject( to ) ) { 72433 $.fancybox.setTranslate( $el, to ); 72434 72435 } else { 72436 $el.addClass( to ); 72437 } 72438 72439 $el.data("timer", setTimeout(function() { 72440 $el.trigger( 'transitionend' ); 72441 }, duration + 16)); 72442 72443 }, 72444 72445 stop : function( $el ) { 72446 clearTimeout( $el.data("timer") ); 72447 72448 $el.off( transitionEnd ); 72449 } 72450 72451 }; 72452 72453 72454 // Default click handler for "fancyboxed" links 72455 // ============================================ 72456 72457 function _run( e ) { 72458 var target = e.currentTarget, 72459 opts = e.data ? e.data.options : {}, 72460 items = opts.selector ? $( opts.selector ) : ( e.data ? e.data.items : [] ), 72461 value = $( target ).attr( 'data-fancybox' ) || '', 72462 index = 0, 72463 active = $.fancybox.getInstance(); 72464 72465 e.preventDefault(); 72466 72467 // Avoid opening multiple times 72468 if ( active && active.current.opts.$orig.is( target ) ) { 72469 return; 72470 } 72471 72472 // Get all related items and find index for clicked one 72473 if ( value ) { 72474 items = items.length ? items.filter( '[data-fancybox="' + value + '"]' ) : $( '[data-fancybox="' + value + '"]' ); 72475 index = items.index( target ); 72476 72477 // Sometimes current item can not be found 72478 // (for example, when slider clones items) 72479 if ( index < 0 ) { 72480 index = 0; 72481 } 72482 72483 } else { 72484 items = [ target ]; 72485 } 72486 72487 $.fancybox.open( items, opts, index ); 72488 } 72489 72490 72491 // Create a jQuery plugin 72492 // ====================== 72493 72494 $.fn.fancybox = function (options) { 72495 var selector; 72496 72497 options = options || {}; 72498 selector = options.selector || false; 72499 72500 if ( selector ) { 72501 72502 $( 'body' ).off( 'click.fb-start', selector ).on( 'click.fb-start', selector, { 72503 options : options 72504 }, _run ); 72505 72506 } else { 72507 72508 this.off( 'click.fb-start' ).on( 'click.fb-start', { 72509 items : this, 72510 options : options 72511 }, _run); 72512 72513 } 72514 72515 return this; 72516 }; 72517 72518 72519 // Self initializing plugin 72520 // ======================== 72521 72522 $D.on( 'click.fb-start', '[data-fancybox]', _run ); 72523 72524}( window, document, window.jQuery || jQuery ));
72525 72526// ========================================================================== 72527// 72528// Media 72529// Adds additional media type support 72530// 72531// ========================================================================== 72532;(function ($) { 72533 72534 'use strict'; 72535 72536 // Formats matching url to final form 72537 72538 var format = function (url, rez, params) { 72539 if ( !url ) { 72540 return; 72541 } 72542 72543 params = params || ''; 72544 72545 if ( $.type(params) === "object" ) { 72546 params = $.param(params, true); 72547 } 72548 72549 $.each(rez, function (key, value) { 72550 url = url.replace('$' + key, value || ''); 72551 }); 72552 72553 if (params.length) { 72554 url += (url.indexOf('?') > 0 ? '&' : '?') + params; 72555 } 72556 72557 return url; 72558 }; 72559 72560 // Object containing properties for each media type 72561 72562 var defaults = { 72563 youtube : { 72564 matcher : /(youtube\.com|youtu\.be|youtube\-nocookie\.com)\/(watch\?(.*&)?v=|v\/|u\/|embed\/?)?(videoseries\?list=(.*)|[\w-]{11}|\?listType=(.*)&list=(.*))(.*)/i, 72565 params : { 72566 autoplay : 1, 72567 autohide : 1, 72568 fs : 1, 72569 rel : 0, 72570 hd : 1, 72571 wmode : 'transparent', 72572 enablejsapi : 1, 72573 html5 : 1 72574 }, 72575 paramPlace : 8, 72576 type : 'iframe', 72577 url : '//www.youtube.com/embed/$4', 72578 thumb : '//img.youtube.com/vi/$4/hqdefault.jpg' 72579 }, 72580 72581 vimeo : { 72582 matcher : /^.+vimeo.com\/(.*\/)?([\d]+)(.*)?/, 72583 params : { 72584 autoplay : 1, 72585 hd : 1, 72586 show_title : 1, 72587 show_byline : 1, 72588 show_portrait : 0, 72589 fullscreen : 1, 72590 api : 1 72591 }, 72592 paramPlace : 3, 72593 type : 'iframe', 72594 url : '//player.vimeo.com/video/$2' 72595 }, 72596 72597 metacafe : { 72598 matcher : /metacafe.com\/watch\/(\d+)\/(.*)?/, 72599 type : 'iframe', 72600 url : '//www.metacafe.com/embed/$1/?ap=1' 72601 }, 72602 72603 dailymotion : { 72604 matcher : /dailymotion.com\/video\/(.*)\/?(.*)/, 72605 params : { 72606 additionalInfos : 0, 72607 autoStart : 1 72608 }, 72609 type : 'iframe', 72610 url : '//www.dailymotion.com/embed/video/$1' 72611 }, 72612 72613 vine : { 72614 matcher : /vine.co\/v\/([a-zA-Z0-9\?\=\-]+)/, 72615 type : 'iframe', 72616 url : '//vine.co/v/$1/embed/simple' 72617 }, 72618 72619 instagram : { 72620 matcher : /(instagr\.am|instagram\.com)\/p\/([a-zA-Z0-9_\-]+)\/?/i, 72621 type : 'image', 72622 url : '//$1/p/$2/media/?size=l' 72623 }, 72624 72625 // Examples: 72626 // http://maps.google.com/?ll=48.857995,2.294297&spn=0.007666,0.021136&t=m&z=16 72627 // https://www.google.com/maps/@37.7852006,-122.4146355,14.65z 72628 // https://www.google.com/maps/place/Googleplex/@37.4220041,-122.0833494,17z/data=!4m5!3m4!1s0x0:0x6c296c66619367e0!8m2!3d37.4219998!4d-122.0840572 72629 gmap_place : { 72630 matcher : /(maps\.)?google\.([a-z]{2,3}(\.[a-z]{2})?)\/(((maps\/(place\/(.*)\/)?\@(.*),(\d+.?\d+?)z))|(\?ll=))(.*)?/i, 72631 type : 'iframe', 72632 url : function (rez) { 72633 return '//maps.google.' + rez[2] + '/?ll=' + ( rez[9] ? rez[9] + '&z=' + Math.floor( rez[10] ) + ( rez[12] ? rez[12].replace(/^\//, "&") : '' ) : rez[12] ) + '&output=' + ( rez[12] && rez[12].indexOf('layer=c') > 0 ? 'svembed' : 'embed' ); 72634 } 72635 }, 72636 72637 // Examples: 72638 // https://www.google.com/maps/search/Empire+State+Building/ 72639 // https://www.google.com/maps/search/?api=1&query=centurylink+field 72640 // https://www.google.com/maps/search/?api=1&query=47.5951518,-122.3316393 72641 gmap_search : { 72642 matcher : /(maps\.)?google\.([a-z]{2,3}(\.[a-z]{2})?)\/(maps\/search\/)(.*)/i, 72643 type : 'iframe', 72644 url : function (rez) { 72645 return '//maps.google.' + rez[2] + '/maps?q=' + rez[5].replace('query=', 'q=').replace('api=1', '') + '&output=embed'; 72646 } 72647 } 72648 }; 72649 72650 $(document).on('onInit.fb', function (e, instance) { 72651 72652 $.each(instance.group, function( i, item ) { 72653 72654 var url = item.src || '', 72655 type = false, 72656 media, 72657 thumb, 72658 rez, 72659 params, 72660 urlParams, 72661 o, 72662 provider; 72663 72664 // Skip items that already have content type 72665 if ( item.type ) { 72666 return; 72667 } 72668 72669 media = $.extend( true, {}, defaults, item.opts.media ); 72670 72671 // Look for any matching media type 72672 $.each(media, function ( n, el ) { 72673 rez = url.match(el.matcher); 72674 o = {}; 72675 provider = n; 72676 72677 if (!rez) { 72678 return; 72679 } 72680 72681 type = el.type; 72682 72683 if ( el.paramPlace && rez[ el.paramPlace ] ) {
72684 urlParams = rez[ el.paramPlace ]; 72685 72686 if ( urlParams[ 0 ] == '?' ) { 72687 urlParams = urlParams.substring(1); 72688 } 72689 72690 urlParams = urlParams.split('&'); 72691 72692 for ( var m = 0; m < urlParams.length; ++m ) { 72693 var p = urlParams[ m ].split('=', 2); 72694 72695 if ( p.length == 2 ) { 72696 o[ p[0] ] = decodeURIComponent( p[1].replace(/\+/g, " ") ); 72697 } 72698 } 72699 } 72700 72701 params = $.extend( true, {}, el.params, item.opts[ n ], o ); 72702 72703 url = $.type(el.url) === "function" ? el.url.call(this, rez, params, item) : format(el.url, rez, params); 72704 thumb = $.type(el.thumb) === "function" ? el.thumb.call(this, rez, params, item) : format(el.thumb, rez); 72705 72706 if ( provider === 'vimeo' ) { 72707 url = url.replace('&%23', '#'); 72708 } 72709 72710 return false; 72711 }); 72712 72713 // If it is found, then change content type and update the url 72714 72715 if ( type ) { 72716 item.src = url; 72717 item.type = type; 72718 72719 if ( !item.opts.thumb && !( item.opts.$thumb && item.opts.$thumb.length ) ) { 72720 item.opts.thumb = thumb; 72721 } 72722 72723 if ( type === 'iframe' ) { 72724 $.extend(true, item.opts, { 72725 iframe : { 72726 preload : false, 72727 attr : { 72728 scrolling : "no" 72729 } 72730 } 72731 }); 72732 72733 item.contentProvider = provider; 72734 72735 item.opts.slideClass += ' fancybox-slide--' + ( provider == 'gmap_place' || provider == 'gmap_search' ? 'map' : 'video' ); 72736 } 72737 72738 } else { 72739 72740 // If no content type is found, then set it to `image` as fallback 72741 item.type = 'image'; 72742 } 72743 72744 }); 72745 72746 }); 72747 72748}(window.jQuery)); 72749 72750// ========================================================================== 72751// 72752// Guestures 72753// Adds touch guestures, handles click and tap events 72754// 72755// ========================================================================== 72756;(function (window, document, $) { 72757 'use strict'; 72758 72759 var requestAFrame = (function () { 72760 return window.requestAnimationFrame || 72761 window.webkitRequestAnimationFrame || 72762 window.mozRequestAnimationFrame || 72763 window.oRequestAnimationFrame || 72764 // if all else fails, use setTimeout 72765 function (callback) { 72766 return window.setTimeout(callback, 1000 / 60); 72767 }; 72768 })(); 72769 72770 72771 var cancelAFrame = (function () { 72772 return window.cancelAnimationFrame || 72773 window.webkitCancelAnimationFrame || 72774 window.mozCancelAnimationFrame || 72775 window.oCancelAnimationFrame || 72776 function (id) { 72777 window.clearTimeout(id); 72778 }; 72779 })(); 72780 72781 72782 var pointers = function( e ) { 72783 var result = []; 72784 72785 e = e.originalEvent || e || window.e; 72786 e = e.touches && e.touches.length ? e.touches : ( e.changedTouches && e.changedTouches.length ? e.changedTouches : [ e ] ); 72787 72788 for ( var key in e ) { 72789 72790 if ( e[ key ].pageX ) { 72791 result.push( { x : e[ key ].pageX, y : e[ key ].pageY } ); 72792 72793 } else if ( e[ key ].clientX ) { 72794 result.push( { x : e[ key ].clientX, y : e[ key ].clientY } ); 72795 } 72796 } 72797 72798 return result; 72799 }; 72800 72801 var distance = function( point2, point1, what ) { 72802 if ( !point1 || !point2 ) { 72803 return 0; 72804 } 72805 72806 if ( what === 'x' ) { 72807 return point2.x - point1.x; 72808 72809 } else if ( what === 'y' ) { 72810 return point2.y - point1.y; 72811 } 72812 72813 return Math.sqrt( Math.pow( point2.x - point1.x, 2 ) + Math.pow( point2.y - point1.y, 2 ) ); 72814 }; 72815 72816 var isClickable = function( $el ) { 72817 72818 if ( $el.is('a,button,input,select,textarea,label') || $.isFunction( $el.get(0).onclick ) || $el.data('selectable') ) { 72819 return true; 72820 } 72821 72822 // Check for attributes like data-fancybox-next or data-fancybox-close 72823 for ( var i = 0, atts = $el[0].attributes, n = atts.length; i < n; i++ ) { 72824 if ( atts[i].nodeName.substr(0, 14) === 'data-fancybox-' ) { 72825 return true; 72826 } 72827 } 72828 72829 return false; 72830 }; 72831 72832 var hasScrollbars = function( el ) { 72833 var overflowY = window.getComputedStyle( el )['overflow-y']; 72834 var overflowX = window.getComputedStyle( el )['overflow-x']; 72835 72836 var vertical = (overflowY === 'scroll' || overflowY === 'auto') && el.scrollHeight > el.clientHeight; 72837 var horizontal = (overflowX === 'scroll' || overflowX === 'auto') && el.scrollWidth > el.clientWidth; 72838 72839 return vertical || horizontal; 72840 }; 72841 72842 var isScrollable = function ( $el ) { 72843 var rez = false; 72844 72845 while ( true ) { 72846 rez = hasScrollbars( $el.get(0) ); 72847 72848 if ( rez ) { 72849 break; 72850 } 72851 72852 $el = $el.parent(); 72853 72854 if ( !$el.length || $el.hasClass( 'fancybox-stage' ) || $el.is( 'body' ) ) { 72855 break; 72856 } 72857 } 72858 72859 return rez; 72860 }; 72861 72862 72863 var Guestures = function ( instance ) { 72864 var self = this; 72865 72866 self.instance = instance; 72867 72868 self.$bg = instance.$refs.bg; 72869 self.$stage = instance.$refs.stage; 72870 self.$container = instance.$refs.container; 72871 72872 self.destroy(); 72873 72874 self.$container.on( 'touchstart.fb.touch mousedown.fb.touch', $.proxy(self, 'ontouchstart') ); 72875 }; 72876 72877 Guestures.prototype.destroy = function() { 72878 this.$container.off( '.fb.touch' ); 72879 }; 72880 72881 Guestures.prototype.ontouchstart = function( e ) { 72882 var self = this; 72883 72884 var $target = $( e.target ); 72885 var instance = self.instance; 72886 var current = instance.current; 72887 var $content = current.$content; 72888 72889 var isTouchDevice = ( e.type == 'touchstart' ); 72890
72891 // Do not respond to both events 72892 if ( isTouchDevice ) { 72893 self.$container.off( 'mousedown.fb.touch' ); 72894 } 72895 72896 // Ignore clicks while zooming or closing 72897 if ( !current || self.instance.isAnimating || self.instance.isClosing ) { 72898 e.stopPropagation(); 72899 e.preventDefault(); 72900 72901 return; 72902 } 72903 72904 // Ignore right click 72905 if ( e.originalEvent && e.originalEvent.button == 2 ) { 72906 return; 72907 } 72908 72909 // Ignore taping on links, buttons, input elements 72910 if ( !$target.length || isClickable( $target ) || isClickable( $target.parent() ) ) { 72911 return; 72912 } 72913 72914 // Ignore clicks on the scrollbar 72915 if ( e.originalEvent.clientX > $target[0].clientWidth + $target.offset().left ) { 72916 return; 72917 } 72918 72919 self.startPoints = pointers( e ); 72920 72921 // Prevent zooming if already swiping 72922 if ( !self.startPoints || ( self.startPoints.length > 1 && instance.isSliding ) ) { 72923 return; 72924 } 72925 72926 self.$target = $target; 72927 self.$content = $content; 72928 self.canTap = true; 72929 72930 $(document).off( '.fb.touch' ); 72931 72932 $(document).on( isTouchDevice ? 'touchend.fb.touch touchcancel.fb.touch' : 'mouseup.fb.touch mouseleave.fb.touch', $.proxy(self, "ontouchend")); 72933 $(document).on( isTouchDevice ? 'touchmove.fb.touch' : 'mousemove.fb.touch', $.proxy(self, "ontouchmove")); 72934 72935 if ( !(instance.current.opts.touch || instance.canPan() ) || !( $target.is( self.$stage ) || self.$stage.find( $target ).length ) ) { 72936 72937 // Prevent ghosting 72938 if ( $target.is('img') ) { 72939 e.preventDefault(); 72940 } 72941 72942 return; 72943 } 72944 72945 e.stopPropagation(); 72946 72947 if ( !( $.fancybox.isMobile && ( isScrollable( self.$target ) || isScrollable( self.$target.parent() ) ) ) ) { 72948 e.preventDefault(); 72949 } 72950 72951 self.canvasWidth = Math.round( current.$slide[0].clientWidth ); 72952 self.canvasHeight = Math.round( current.$slide[0].clientHeight ); 72953 72954 self.startTime = new Date().getTime(); 72955 self.distanceX = self.distanceY = self.distance = 0; 72956 72957 self.isPanning = false; 72958 self.isSwiping = false; 72959 self.isZooming = false; 72960 72961 self.sliderStartPos = self.sliderLastPos || { top: 0, left: 0 }; 72962 self.contentStartPos = $.fancybox.getTranslate( self.$content ); 72963 self.contentLastPos = null; 72964 72965 if ( self.startPoints.length === 1 && !self.isZooming ) { 72966 self.canTap = !instance.isSliding; 72967 72968 if ( current.type === 'image' && ( self.contentStartPos.width > self.canvasWidth + 1 || self.contentStartPos.height > self.canvasHeight + 1 ) ) { 72969 72970 $.fancybox.stop( self.$content ); 72971 72972 self.$content.css( 'transition-duration', '0ms' ); 72973 72974 self.isPanning = true; 72975 72976 } else { 72977 72978 self.isSwiping = true; 72979 } 72980 72981 self.$container.addClass('fancybox-controls--isGrabbing'); 72982 } 72983 72984 if ( self.startPoints.length === 2 && !instance.isAnimating && !current.hasError && current.type === 'image' && ( current.isLoaded || current.$ghost ) ) { 72985 self.isZooming = true; 72986 72987 self.isSwiping = false; 72988 self.isPanning = false; 72989 72990 $.fancybox.stop( self.$content ); 72991 72992 self.$content.css( 'transition-duration', '0ms' ); 72993 72994 self.centerPointStartX = ( ( self.startPoints[0].x + self.startPoints[1].x ) * 0.5 ) - $(window).scrollLeft(); 72995 self.centerPointStartY = ( ( self.startPoints[0].y + self.startPoints[1].y ) * 0.5 ) - $(window).scrollTop(); 72996 72997 self.percentageOfImageAtPinchPointX = ( self.centerPointStartX - self.contentStartPos.left ) / self.contentStartPos.width; 72998 self.percentageOfImageAtPinchPointY = ( self.centerPointStartY - self.contentStartPos.top ) / self.contentStartPos.height; 72999 73000 self.startDistanceBetweenFingers = distance( self.startPoints[0], self.startPoints[1] ); 73001 } 73002 73003 }; 73004 73005 Guestures.prototype.ontouchmove = function( e ) { 73006 73007 var self = this; 73008 73009 self.newPoints = pointers( e ); 73010 73011 if ( $.fancybox.isMobile && ( isScrollable( self.$target ) || isScrollable( self.$target.parent() ) ) ) { 73012 e.stopPropagation(); 73013 73014 self.canTap = false; 73015 73016 return; 73017 } 73018 73019 if ( !( self.instance.current.opts.touch || self.instance.canPan() ) || !self.newPoints || !self.newPoints.length ) { 73020 return; 73021 } 73022 73023 self.distanceX = distance( self.newPoints[0], self.startPoints[0], 'x' ); 73024 self.distanceY = distance( self.newPoints[0], self.startPoints[0], 'y' ); 73025 73026 self.distance = distance( self.newPoints[0], self.startPoints[0] ); 73027 73028 // Skip false ontouchmove events (Chrome) 73029 if ( self.distance > 0 ) { 73030 73031 if ( !( self.$target.is( self.$stage ) || self.$stage.find( self.$target ).length ) ) { 73032 return; 73033 } 73034 73035 e.stopPropagation(); 73036 e.preventDefault(); 73037 73038 if ( self.isSwiping ) { 73039 self.onSwipe(); 73040 73041 } else if ( self.isPanning ) { 73042 self.onPan(); 73043 73044 } else if ( self.isZooming ) { 73045 self.onZoom(); 73046 } 73047 73048 } 73049 73050 }; 73051 73052 Guestures.prototype.onSwipe = function() { 73053 73054 var self = this; 73055 73056 var swiping = self.isSwiping; 73057 var left = self.sliderStartPos.left || 0; 73058 var angle; 73059 73060 if ( swiping === true ) { 73061 73062 if ( Math.abs( self.distance ) > 10 ) { 73063 73064 self.canTap = false; 73065 73066 if ( self.instance.group.length < 2 && self.instance.opts.touch.vertical ) { 73067 self.isSwiping = 'y'; 73068 73069 } else if ( self.instance.isSliding || self.instance.opts.touch.vertical === false || ( self.instance.opts.touch.vertical === 'auto' && $( window ).width() > 800 ) ) { 73070 self.isSwiping = 'x'; 73071 73072 } else { 73073 angle = Math.abs( Math.atan2( self.distanceY, self.distanceX ) * 180 / Math.PI ); 73074 73075 self.isSwiping = ( angle > 45 && angle < 135 ) ? 'y' : 'x'; 73076 } 73077 73078 self.instance.isSliding = self.isSwiping; 73079 73080 // Reset points to avoid jumping, because we dropped first swipes to calculate the angle 73081 self.startPoints = self.newPoints; 73082 73083 $.each(self.instance.slides, function( index, slide ) { 73084 $.fancybox.stop( slide.$slide ); 73085 73086 slide.$slide.css( 'transition-duration', '0ms' ); 73087 73088 slide.inTransition = false; 73089 73090 if ( slide.pos === self.instance.current.pos ) { 73091 self.sliderStartPos.left = $.fancybox.getTranslate( slide.$slide ).left; 73092 } 73093 }); 73094 73095 //self.instance.current.isMoved = true; 73096 73097 // Stop slideshow 73098 if ( self.instance.SlideShow && self.instance.SlideShow.isActive ) { 73099 self.instance.SlideShow.stop(); 73100 } 73101 } 73102 73103 } else { 73104 73105 if ( swiping == 'x' ) { 73106 73107 // Sticky edges 73108 if ( self.distanceX > 0 && ( self.instance.group.length < 2 || ( self.instance.current.index === 0 && !self.instance.current.opts.loop ) ) ) { 73109 left = left + Math.pow( self.distanceX, 0.8 ); 73110 73111 } else if ( self.distanceX < 0 && ( self.instance.group.length < 2 || ( self.instance.current.index === self.instance.group.length - 1 && !self.instance.current.opts.loop ) ) ) { 73112 left = left - Math.pow( -self.distanceX, 0.8 ); 73113 73114 } else { 73115 left = left + self.distanceX; 73116 } 73117 73118 } 73119 73120 self.sliderLastPos = { 73121 top : swiping == 'x' ? 0 : self.sliderStartPos.top + self.distanceY, 73122 left : left 73123 }; 73124 73125 if ( self.requestId ) { 73126 cancelAFrame( self.requestId ); 73127 73128 self.requestId = null; 73129 } 73130 73131 self.requestId = requestAFrame(function() { 73132 73133 if ( self.sliderLastPos ) { 73134 $.each(self.instance.slides, function( index, slide ) { 73135 var pos = slide.pos - self.instance.currPos; 73136 73137 $.fancybox.setTranslate( slide.$slide, { 73138 top : self.sliderLastPos.top, 73139 left : self.sliderLastPos.left + ( pos * self.canvasWidth ) + ( pos * slide.opts.gutter ) 73140 });
73141 }); 73142 73143 self.$container.addClass( 'fancybox-is-sliding' ); 73144 } 73145 73146 }); 73147 73148 } 73149 73150 }; 73151 73152 Guestures.prototype.onPan = function() { 73153 73154 var self = this; 73155 73156 var newOffsetX, newOffsetY, newPos; 73157 73158 self.canTap = false; 73159 73160 if ( self.contentStartPos.width > self.canvasWidth ) { 73161 newOffsetX = self.contentStartPos.left + self.distanceX; 73162 73163 } else { 73164 newOffsetX = self.contentStartPos.left; 73165 } 73166 73167 newOffsetY = self.contentStartPos.top + self.distanceY; 73168 73169 newPos = self.limitMovement( newOffsetX, newOffsetY, self.contentStartPos.width, self.contentStartPos.height ); 73170 73171 newPos.scaleX = self.contentStartPos.scaleX; 73172 newPos.scaleY = self.contentStartPos.scaleY; 73173 73174 self.contentLastPos = newPos; 73175 73176 if ( self.requestId ) { 73177 cancelAFrame( self.requestId ); 73178 73179 self.requestId = null; 73180 } 73181 73182 self.requestId = requestAFrame(function() { 73183 $.fancybox.setTranslate( self.$content, self.contentLastPos ); 73184 }); 73185 }; 73186 73187 // Make panning sticky to the edges 73188 Guestures.prototype.limitMovement = function( newOffsetX, newOffsetY, newWidth, newHeight ) { 73189 73190 var self = this; 73191 73192 var minTranslateX, minTranslateY, maxTranslateX, maxTranslateY; 73193 73194 var canvasWidth = self.canvasWidth; 73195 var canvasHeight = self.canvasHeight; 73196 73197 var currentOffsetX = self.contentStartPos.left; 73198 var currentOffsetY = self.contentStartPos.top; 73199 73200 var distanceX = self.distanceX; 73201 var distanceY = self.distanceY; 73202 73203 // Slow down proportionally to traveled distance 73204 73205 minTranslateX = Math.max(0, canvasWidth * 0.5 - newWidth * 0.5 ); 73206 minTranslateY = Math.max(0, canvasHeight * 0.5 - newHeight * 0.5 ); 73207 73208 maxTranslateX = Math.min( canvasWidth - newWidth, canvasWidth * 0.5 - newWidth * 0.5 ); 73209 maxTranslateY = Math.min( canvasHeight - newHeight, canvasHeight * 0.5 - newHeight * 0.5 ); 73210 73211 if ( newWidth > canvasWidth ) { 73212 73213 // -> 73214 if ( distanceX > 0 && newOffsetX > minTranslateX ) { 73215 newOffsetX = minTranslateX - 1 + Math.pow( -minTranslateX + currentOffsetX + distanceX, 0.8 ) || 0; 73216 } 73217 73218 // <- 73219 if ( distanceX < 0 && newOffsetX < maxTranslateX ) { 73220 newOffsetX = maxTranslateX + 1 - Math.pow( maxTranslateX - currentOffsetX - distanceX, 0.8 ) || 0; 73221 } 73222 73223 } 73224 73225 if ( newHeight > canvasHeight ) { 73226 73227 // \/ 73228 if ( distanceY > 0 && newOffsetY > minTranslateY ) { 73229 newOffsetY = minTranslateY - 1 + Math.pow(-minTranslateY + currentOffsetY + distanceY, 0.8 ) || 0; 73230 } 73231 73232 // /\ 73233 if ( distanceY < 0 && newOffsetY < maxTranslateY ) { 73234 newOffsetY = maxTranslateY + 1 - Math.pow ( maxTranslateY - currentOffsetY - distanceY, 0.8 ) || 0; 73235 } 73236 73237 } 73238 73239 return { 73240 top : newOffsetY, 73241 left : newOffsetX 73242 }; 73243 73244 }; 73245 73246 73247 Guestures.prototype.limitPosition = function( newOffsetX, newOffsetY, newWidth, newHeight ) { 73248 73249 var self = this; 73250 73251 var canvasWidth = self.canvasWidth; 73252 var canvasHeight = self.canvasHeight; 73253 73254 if ( newWidth > canvasWidth ) { 73255 newOffsetX = newOffsetX > 0 ? 0 : newOffsetX; 73256 newOffsetX = newOffsetX < canvasWidth - newWidth ? canvasWidth - newWidth : newOffsetX; 73257 73258 } else { 73259 73260 // Center horizontally 73261 newOffsetX = Math.max( 0, canvasWidth / 2 - newWidth / 2 ); 73262 73263 } 73264 73265 if ( newHeight > canvasHeight ) { 73266 newOffsetY = newOffsetY > 0 ? 0 : newOffsetY; 73267 newOffsetY = newOffsetY < canvasHeight - newHeight ? canvasHeight - newHeight : newOffsetY; 73268 73269 } else { 73270 73271 // Center vertically 73272 newOffsetY = Math.max( 0, canvasHeight / 2 - newHeight / 2 ); 73273 73274 } 73275 73276 return { 73277 top : newOffsetY, 73278 left : newOffsetX 73279 }; 73280 73281 }; 73282 73283 Guestures.prototype.onZoom = function() { 73284 73285 var self = this; 73286 73287 // Calculate current distance between points to get pinch ratio and new width and height 73288 73289 var currentWidth = self.contentStartPos.width; 73290 var currentHeight = self.contentStartPos.height; 73291 73292 var currentOffsetX = self.contentStartPos.left; 73293 var currentOffsetY = self.contentStartPos.top; 73294 73295 var endDistanceBetweenFingers = distance( self.newPoints[0], self.newPoints[1] ); 73296 73297 var pinchRatio = endDistanceBetweenFingers / self.startDistanceBetweenFingers; 73298 73299 var newWidth = Math.floor( currentWidth * pinchRatio ); 73300 var newHeight = Math.floor( currentHeight * pinchRatio ); 73301 73302 // This is the translation due to pinch-zooming 73303 var translateFromZoomingX = (currentWidth - newWidth) * self.percentageOfImageAtPinchPointX; 73304 var translateFromZoomingY = (currentHeight - newHeight) * self.percentageOfImageAtPinchPointY; 73305 73306 //Point between the two touches 73307 73308 var centerPointEndX = ((self.newPoints[0].x + self.newPoints[1].x) / 2) - $(window).scrollLeft(); 73309 var centerPointEndY = ((self.newPoints[0].y + self.newPoints[1].y) / 2) - $(window).scrollTop(); 73310 73311 // And this is the translation due to translation of the centerpoint 73312 // between the two fingers 73313 73314 var translateFromTranslatingX = centerPointEndX - self.centerPointStartX; 73315 var translateFromTranslatingY = centerPointEndY - self.centerPointStartY; 73316 73317 // The new offset is the old/current one plus the total translation 73318 73319 var newOffsetX = currentOffsetX + ( translateFromZoomingX + translateFromTranslatingX ); 73320 var newOffsetY = currentOffsetY + ( translateFromZoomingY + translateFromTranslatingY ); 73321 73322 var newPos = { 73323 top : newOffsetY, 73324 left : newOffsetX, 73325 scaleX : self.contentStartPos.scaleX * pinchRatio, 73326 scaleY : self.contentStartPos.scaleY * pinchRatio 73327 }; 73328 73329 self.canTap = false; 73330 73331 self.newWidth = newWidth; 73332 self.newHeight = newHeight; 73333 73334 self.contentLastPos = newPos; 73335 73336 if ( self.requestId ) { 73337 cancelAFrame( self.requestId ); 73338 73339 self.requestId = null; 73340 } 73341 73342 self.requestId = requestAFrame(function() { 73343 $.fancybox.setTranslate( self.$content, self.contentLastPos ); 73344 }); 73345 73346 }; 73347 73348 Guestures.prototype.ontouchend = function( e ) { 73349 73350 var self = this; 73351 var dMs = Math.max( (new Date().getTime() ) - self.startTime, 1); 73352 73353 var swiping = self.isSwiping; 73354 var panning = self.isPanning; 73355 var zooming = self.isZooming; 73356 73357 self.endPoints = pointers( e ); 73358 73359 self.$container.removeClass( 'fancybox-controls--isGrabbing' ); 73360 73361 $(document).off( '.fb.touch' ); 73362 73363 if ( self.requestId ) { 73364 cancelAFrame( self.requestId ); 73365 73366 self.requestId = null; 73367 } 73368 73369 self.isSwiping = false; 73370 self.isPanning = false; 73371 self.isZooming = false; 73372 73373 if ( self.canTap ) {
73374 return self.onTap( e ); 73375 } 73376 73377 self.speed = 366; 73378 73379 // Speed in px/ms 73380 self.velocityX = self.distanceX / dMs * 0.5; 73381 self.velocityY = self.distanceY / dMs * 0.5; 73382 73383 self.speedX = Math.max( self.speed * 0.5, Math.min( self.speed * 1.5, ( 1 / Math.abs( self.velocityX ) ) * self.speed ) ); 73384 73385 if ( panning ) { 73386 self.endPanning(); 73387 73388 } else if ( zooming ) { 73389 self.endZooming(); 73390 73391 } else { 73392 self.endSwiping( swiping ); 73393 } 73394 73395 return; 73396 }; 73397 73398 Guestures.prototype.endSwiping = function( swiping ) { 73399 73400 var self = this; 73401 var ret = false; 73402 73403 self.instance.isSliding = false; 73404 self.sliderLastPos = null; 73405 73406 // Close if swiped vertically / navigate if horizontally 73407 if ( swiping == 'y' && Math.abs( self.distanceY ) > 50 ) { 73408 73409 // Continue vertical movement 73410 $.fancybox.animate( self.instance.current.$slide, { 73411 top : self.sliderStartPos.top + self.distanceY + ( self.velocityY * 150 ), 73412 opacity : 0 73413 }, 150 ); 73414 73415 ret = self.instance.close( true, 300 ); 73416 73417 } else if ( swiping == 'x' && self.distanceX > 50 && self.instance.group.length > 1 ) { 73418 ret = self.instance.previous( self.speedX ); 73419 73420 } else if ( swiping == 'x' && self.distanceX < -50 && self.instance.group.length > 1 ) { 73421 ret = self.instance.next( self.speedX ); 73422 } 73423 73424 if ( ret === false && ( swiping == 'x' || swiping == 'y' ) ) { 73425 self.instance.jumpTo( self.instance.current.index, 150 ); 73426 } 73427 73428 self.$container.removeClass( 'fancybox-is-sliding' ); 73429 73430 }; 73431 73432 // Limit panning from edges 73433 // ======================== 73434 73435 Guestures.prototype.endPanning = function() { 73436 73437 var self = this; 73438 var newOffsetX, newOffsetY, newPos; 73439 73440 if ( !self.contentLastPos ) { 73441 return; 73442 } 73443 73444 if ( self.instance.current.opts.touch.momentum === false ) { 73445 newOffsetX = self.contentLastPos.left; 73446 newOffsetY = self.contentLastPos.top; 73447 73448 } else { 73449 73450 // Continue movement 73451 newOffsetX = self.contentLastPos.left + ( self.velocityX * self.speed ); 73452 newOffsetY = self.contentLastPos.top + ( self.velocityY * self.speed ); 73453 } 73454 73455 newPos = self.limitPosition( newOffsetX, newOffsetY, self.contentStartPos.width, self.contentStartPos.height ); 73456 73457 newPos.width = self.contentStartPos.width; 73458 newPos.height = self.contentStartPos.height; 73459 73460 $.fancybox.animate( self.$content, newPos, 330 ); 73461 }; 73462 73463 73464 Guestures.prototype.endZooming = function() { 73465 73466 var self = this; 73467 73468 var current = self.instance.current; 73469 73470 var newOffsetX, newOffsetY, newPos, reset; 73471 73472 var newWidth = self.newWidth; 73473 var newHeight = self.newHeight; 73474 73475 if ( !self.contentLastPos ) { 73476 return; 73477 } 73478 73479 newOffsetX = self.contentLastPos.left; 73480 newOffsetY = self.contentLastPos.top; 73481 73482 reset = { 73483 top : newOffsetY, 73484 left : newOffsetX, 73485 width : newWidth, 73486 height : newHeight, 73487 scaleX : 1, 73488 scaleY : 1 73489 }; 73490 73491 // Reset scalex/scaleY values; this helps for perfomance and does not break animation 73492 $.fancybox.setTranslate( self.$content, reset ); 73493 73494 if ( newWidth < self.canvasWidth && newHeight < self.canvasHeight ) { 73495 self.instance.scaleToFit( 150 ); 73496 73497 } else if ( newWidth > current.width || newHeight > current.height ) { 73498 self.instance.scaleToActual( self.centerPointStartX, self.centerPointStartY, 150 ); 73499 73500 } else { 73501 73502 newPos = self.limitPosition( newOffsetX, newOffsetY, newWidth, newHeight ); 73503 73504 // Switch from scale() to width/height or animation will not work correctly 73505 $.fancybox.setTranslate( self.content, $.fancybox.getTranslate( self.$content ) ); 73506 73507 $.fancybox.animate( self.$content, newPos, 150 ); 73508 } 73509 73510 }; 73511 73512 Guestures.prototype.onTap = function(e) { 73513 var self = this; 73514 var $target = $( e.target ); 73515 73516 var instance = self.instance; 73517 var current = instance.current; 73518 73519 var endPoints = ( e && pointers( e ) ) || self.startPoints; 73520 73521 var tapX = endPoints[0] ? endPoints[0].x - self.$stage.offset().left : 0; 73522 var tapY = endPoints[0] ? endPoints[0].y - self.$stage.offset().top : 0; 73523 73524 var where; 73525 73526 var process = function ( prefix ) { 73527 73528 var action = current.opts[ prefix ]; 73529 73530 if ( $.isFunction( action ) ) { 73531 action = action.apply( instance, [ current, e ] ); 73532 } 73533 73534 if ( !action) { 73535 return; 73536 } 73537 73538 switch ( action ) { 73539 73540 case "close" : 73541 73542 instance.close( self.startEvent ); 73543 73544 break; 73545 73546 case "toggleControls" : 73547 73548 instance.toggleControls( true ); 73549 73550 break; 73551 73552 case "next" : 73553 73554 instance.next(); 73555 73556 break; 73557 73558 case "nextOrClose" : 73559 73560 if ( instance.group.length > 1 ) { 73561 instance.next(); 73562 73563 } else { 73564 instance.close( self.startEvent ); 73565 } 73566 73567 break; 73568 73569 case "zoom" : 73570 73571 if ( current.type == 'image' && ( current.isLoaded || current.$ghost ) ) { 73572 73573 if ( instance.canPan() ) { 73574 instance.scaleToFit(); 73575 73576 } else if ( instance.isScaledDown() ) { 73577 instance.scaleToActual( tapX, tapY ); 73578 73579 } else if ( instance.group.length < 2 ) { 73580 instance.close( self.startEvent ); 73581 } 73582 } 73583 73584 break; 73585 } 73586 73587 }; 73588 73589 // Ignore right click 73590 if ( e.originalEvent && e.originalEvent.button == 2 ) { 73591 return; 73592 } 73593 73594 // Skip if current slide is not in the center 73595 if ( instance.isSliding ) { 73596 return; 73597 } 73598 73599 // Skip if clicked on the scrollbar 73600 if ( tapX > $target[0].clientWidth + $target.offset().left ) { 73601 return; 73602 } 73603 73604 // Check where is clicked 73605 if ( $target.is( '.fancybox-bg,.fancybox-inner,.fancybox-outer,.fancybox-container' ) ) { 73606 where = 'Outside'; 73607 73608 } else if ( $target.is( '.fancybox-slide' ) ) { 73609 where = 'Slide'; 73610 73611 } else if ( instance.current.$content && instance.current.$content.has( e.target ).length ) { 73612 where = 'Content'; 73613 73614 } else { 73615 return; 73616 } 73617 73618 // Check if this is a double tap 73619 if ( self.tapped ) { 73620 73621 // Stop previously created single tap 73622 clearTimeout( self.tapped ); 73623 self.tapped = null; 73624 73625 // Skip if distance between taps is too big 73626 if ( Math.abs( tapX - self.tapX ) > 50 || Math.abs( tapY - self.tapY ) > 50 || instance.isSliding ) { 73627 return this; 73628 } 73629 73630 // OK, now we assume that this is a double-tap
73631 process( 'dblclick' + where ); 73632 73633 } else { 73634 73635 // Single tap will be processed if user has not clicked second time within 300ms 73636 // or there is no need to wait for double-tap 73637 self.tapX = tapX; 73638 self.tapY = tapY; 73639 73640 if ( current.opts[ 'dblclick' + where ] && current.opts[ 'dblclick' + where ] !== current.opts[ 'click' + where ] ) { 73641 self.tapped = setTimeout(function() { 73642 self.tapped = null; 73643 73644 process( 'click' + where ); 73645 73646 }, 300); 73647 73648 } else { 73649 process( 'click' + where ); 73650 } 73651 73652 } 73653 73654 return this; 73655 }; 73656 73657 $(document).on('onActivate.fb', function (e, instance) { 73658 if ( instance && !instance.Guestures ) { 73659 instance.Guestures = new Guestures( instance ); 73660 } 73661 }); 73662 73663 $(document).on('beforeClose.fb', function (e, instance) { 73664 if ( instance && instance.Guestures ) { 73665 instance.Guestures.destroy(); 73666 } 73667 }); 73668 73669 73670}(window, document, window.jQuery)); 73671 73672// ========================================================================== 73673// 73674// SlideShow 73675// Enables slideshow functionality 73676// 73677// Example of usage: 73678// $.fancybox.getInstance().SlideShow.start() 73679// 73680// ========================================================================== 73681;(function (document, $) { 73682 'use strict'; 73683 73684 var SlideShow = function( instance ) { 73685 this.instance = instance; 73686 this.init(); 73687 }; 73688 73689 $.extend( SlideShow.prototype, { 73690 timer : null, 73691 isActive : false, 73692 $button : null, 73693 speed : 3000, 73694 73695 init : function() { 73696 var self = this; 73697 73698 self.$button = self.instance.$refs.toolbar.find('[data-fancybox-play]').on('click', function() { 73699 self.toggle(); 73700 }); 73701 73702 if ( self.instance.group.length < 2 || !self.instance.group[ self.instance.currIndex ].opts.slideShow ) { 73703 self.$button.hide(); 73704 } 73705 }, 73706 73707 set : function() { 73708 var self = this; 73709 73710 // Check if reached last element 73711 if ( self.instance && self.instance.current && (self.instance.current.opts.loop || self.instance.currIndex < self.instance.group.length - 1 )) { 73712 self.timer = setTimeout(function() { 73713 self.instance.next(); 73714 73715 }, self.instance.current.opts.slideShow.speed || self.speed); 73716 73717 } else { 73718 self.stop(); 73719 self.instance.idleSecondsCounter = 0; 73720 self.instance.showControls(); 73721 } 73722 73723 }, 73724 73725 clear : function() { 73726 var self = this; 73727 73728 clearTimeout( self.timer ); 73729 73730 self.timer = null; 73731 }, 73732 73733 start : function() { 73734 var self = this; 73735 var current = self.instance.current; 73736 73737 if ( self.instance && current && ( current.opts.loop || current.index < self.instance.group.length - 1 )) { 73738 73739 self.isActive = true; 73740 73741 self.$button 73742 .attr( 'title', current.opts.i18n[ current.opts.lang ].PLAY_STOP ) 73743 .addClass( 'fancybox-button--pause' ); 73744 73745 if ( current.isComplete ) { 73746 self.set(); 73747 } 73748 } 73749 }, 73750 73751 stop : function() { 73752 var self = this; 73753 var current = self.instance.current; 73754 73755 self.clear(); 73756 73757 self.$button 73758 .attr( 'title', current.opts.i18n[ current.opts.lang ].PLAY_START ) 73759 .removeClass( 'fancybox-button--pause' ); 73760 73761 self.isActive = false; 73762 }, 73763 73764 toggle : function() { 73765 var self = this; 73766 73767 if ( self.isActive ) { 73768 self.stop(); 73769 73770 } else { 73771 self.start(); 73772 } 73773 } 73774 73775 }); 73776 73777 $(document).on({ 73778 'onInit.fb' : function(e, instance) { 73779 if ( instance && !instance.SlideShow ) { 73780 instance.SlideShow = new SlideShow( instance ); 73781 } 73782 }, 73783 73784 'beforeShow.fb' : function(e, instance, current, firstRun) { 73785 var SlideShow = instance && instance.SlideShow; 73786 73787 if ( firstRun ) { 73788 73789 if ( SlideShow && current.opts.slideShow.autoStart ) { 73790 SlideShow.start(); 73791 } 73792 73793 } else if ( SlideShow && SlideShow.isActive ) { 73794 SlideShow.clear(); 73795 } 73796 }, 73797 73798 'afterShow.fb' : function(e, instance, current) { 73799 var SlideShow = instance && instance.SlideShow; 73800 73801 if ( SlideShow && SlideShow.isActive ) { 73802 SlideShow.set(); 73803 } 73804 }, 73805 73806 'afterKeydown.fb' : function(e, instance, current, keypress, keycode) { 73807 var SlideShow = instance && instance.SlideShow; 73808 73809 // "P" or Spacebar 73810 if ( SlideShow && current.opts.slideShow && ( keycode === 80 || keycode === 32 ) && !$(document.activeElement).is( 'button,a,input' ) ) { 73811 keypress.preventDefault(); 73812 73813 SlideShow.toggle(); 73814 } 73815 }, 73816 73817 'beforeClose.fb onDeactivate.fb' : function(e, instance) { 73818 var SlideShow = instance && instance.SlideShow; 73819 73820 if ( SlideShow ) { 73821 SlideShow.stop(); 73822 } 73823 } 73824 }); 73825 73826 // Page Visibility API to pause slideshow when window is not active 73827 $(document).on("visibilitychange", function() { 73828 var instance = $.fancybox.getInstance(); 73829 var SlideShow = instance && instance.SlideShow; 73830 73831 if ( SlideShow && SlideShow.isActive ) { 73832 if ( document.hidden ) { 73833 SlideShow.clear(); 73834 73835 } else { 73836 SlideShow.set(); 73837 } 73838 } 73839 }); 73840 73841}(document, window.jQuery)); 73842 73843// ========================================================================== 73844// 73845// FullScreen 73846// Adds fullscreen functionality 73847// 73848// ========================================================================== 73849;(function (document, $) { 73850 'use strict'; 73851 73852 // Collection of methods supported by user browser 73853 var fn = (function () { 73854 73855 var fnMap = [ 73856 [ 73857 'requestFullscreen', 73858 'exitFullscreen', 73859 'fullscreenElement', 73860 'fullscreenEnabled', 73861 'fullscreenchange', 73862 'fullscreenerror' 73863 ], 73864 // new WebKit 73865 [ 73866 'webkitRequestFullscreen', 73867 'webkitExitFullscreen', 73868 'webkitFullscreenElement', 73869 'webkitFullscreenEnabled', 73870 'webkitfullscreenchange', 73871 'webkitfullscreenerror' 73872 73873 ], 73874 // old WebKit (Safari 5.1) 73875 [ 73876 'webkitRequestFullScreen', 73877 'webkitCancelFullScreen', 73878 'webkitCurrentFullScreenElement', 73879 'webkitCancelFullScreen', 73880 'webkitfullscreenchange', 73881 'webkitfullscreenerror' 73882 73883 ], 73884 [ 73885 'mozRequestFullScreen', 73886 'mozCancelFullScreen', 73887 'mozFullScreenElement', 73888 'mozFullScreenEnabled', 73889 'mozfullscreenchange', 73890 'mozfullscreenerror' 73891 ], 73892 [ 73893 'msRequestFullscreen', 73894 'msExitFullscreen', 73895 'msFullscreenElement', 73896 'msFullscreenEnabled', 73897 'MSFullscreenChange', 73898 'MSFullscreenError' 73899 ] 73900 ]; 73901 73902 var val; 73903 var ret = {}; 73904 var i, j; 73905 73906 for ( i = 0; i < fnMap.length; i++ ) { 73907 val = fnMap[ i ]; 73908 73909 if ( val && val[ 1 ] in document ) { 73910 for ( j = 0; j < val.length; j++ ) { 73911 ret[ fnMap[ 0 ][ j ] ] = val[ j ]; 73912 } 73913 73914 return ret; 73915 } 73916 } 73917 73918 return false; 73919 })(); 73920 73921 // If browser does not have Full Screen API, then simply unset default button template and stop 73922 if ( !fn ) { 73923 73924 if ( $ && $.fancybox ) { 73925 $.fancybox.defaults.btnTpl.fullScreen = false; 73926 } 73927 73928 return; 73929 } 73930 73931 var FullScreen = { 73932 73933 request : function ( elem ) { 73934 73935 elem = elem || document.documentElement; 73936 73937 elem[ fn.requestFullscreen ]( elem.ALLOW_KEYBOARD_INPUT ); 73938 73939 }, 73940 exit : function () { 73941 73942 document[ fn.exitFullscreen ](); 73943 73944 }, 73945 toggle : function ( elem ) { 73946 73947 elem = elem || document.documentElement; 73948 73949 if ( this.isFullscreen() ) { 73950 this.exit(); 73951 73952 } else { 73953 this.request( elem ); 73954 } 73955 73956 }, 73957 isFullscreen : function() { 73958 73959 return Boolean( document[ fn.fullscreenElement ] ); 73960 73961 }, 73962 enabled : function() { 73963 73964 return Boolean( document[ fn.fullscreenEnabled ] ); 73965 73966 } 73967 }; 73968 73969 $(document).on({ 73970 'onInit.fb' : function(e, instance) { 73971 var $container; 73972 73973 var $button = instance.$refs.toolbar.find('[data-fancybox-fullscreen]'); 73974 73975 if ( instance && !instance.FullScreen && instance.group[ instance.currIndex ].opts.fullScreen ) { 73976 $container = instance.$refs.container; 73977 73978 $container.on('click.fb-fullscreen', '[data-fancybox-fullscreen]', function(e) { 73979 73980 e.stopPropagation(); 73981 e.preventDefault(); 73982 73983 FullScreen.toggle( $container[ 0 ] ); 73984 73985 }); 73986 73987 if ( instance.opts.fullScreen && instance.opts.fullScreen.autoStart === true ) { 73988 FullScreen.request( $container[ 0 ] ); 73989 } 73990 73991 // Expose API 73992 instance.FullScreen = FullScreen;
73993 73994 } else { 73995 $button.hide(); 73996 } 73997 73998 }, 73999 74000 'afterKeydown.fb' : function(e, instance, current, keypress, keycode) { 74001 74002 // "P" or Spacebar 74003 if ( instance && instance.FullScreen && keycode === 70 ) { 74004 keypress.preventDefault(); 74005 74006 instance.FullScreen.toggle( instance.$refs.container[ 0 ] ); 74007 } 74008 74009 }, 74010 74011 'beforeClose.fb' : function( instance ) { 74012 if ( instance && instance.FullScreen ) { 74013 FullScreen.exit(); 74014 } 74015 } 74016 }); 74017 74018 $(document).on(fn.fullscreenchange, function() { 74019 var instance = $.fancybox.getInstance(); 74020 74021 // If image is zooming, then force to stop and reposition properly 74022 if ( instance.current && instance.current.type === 'image' && instance.isAnimating ) { 74023 instance.current.$content.css( 'transition', 'none' ); 74024 74025 instance.isAnimating = false; 74026 74027 instance.update( true, true, 0 ); 74028 } 74029 74030 instance.trigger('onFullscreenChange', FullScreen.isFullscreen() ); 74031 74032 }); 74033 74034}(document, window.jQuery)); 74035 74036// ========================================================================== 74037// 74038// Thumbs 74039// Displays thumbnails in a grid 74040// 74041// ========================================================================== 74042;(function (document, $) { 74043 'use strict'; 74044 74045 var FancyThumbs = function( instance ) { 74046 this.instance = instance; 74047 this.init(); 74048 }; 74049 74050 $.extend( FancyThumbs.prototype, { 74051 74052 $button : null, 74053 $grid : null, 74054 $list : null, 74055 isVisible : false, 74056 74057 init : function() { 74058 var self = this; 74059 74060 var first = self.instance.group[0], 74061 second = self.instance.group[1]; 74062 74063 self.$button = self.instance.$refs.toolbar.find( '[data-fancybox-thumbs]' ); 74064 74065 if ( self.instance.group.length > 1 && self.instance.group[ self.instance.currIndex ].opts.thumbs && ( 74066 ( first.type == 'image' || first.opts.thumb || first.opts.$thumb ) && 74067 ( second.type == 'image' || second.opts.thumb || second.opts.$thumb ) 74068 )) { 74069 74070 self.$button.on('click', function() { 74071 self.toggle(); 74072 }); 74073 74074 self.isActive = true; 74075 74076 } else { 74077 self.$button.hide(); 74078 74079 self.isActive = false; 74080 } 74081 74082 }, 74083 74084 create : function() { 74085 var instance = this.instance, 74086 list, 74087 src; 74088 74089 this.$grid = $('<div class="fancybox-thumbs"></div>').appendTo( instance.$refs.container ); 74090 74091 list = '<ul>'; 74092 74093 $.each(instance.group, function( i, item ) { 74094 74095 src = item.opts.thumb || ( item.opts.$thumb ? item.opts.$thumb.attr('src') : null ); 74096 74097 if ( !src && item.type === 'image' ) { 74098 src = item.src; 74099 } 74100 74101 if ( src && src.length ) { 74102 list += '<li data-index="' + i + '" tabindex="0" class="fancybox-thumbs-loading"><img data-src="' + src + '" /></li>'; 74103 } 74104 74105 }); 74106 74107 list += '</ul>'; 74108 74109 this.$list = $( list ).appendTo( this.$grid ).on('click', 'li', function() { 74110 instance.jumpTo( $(this).data('index') ); 74111 }); 74112 74113 this.$list.find('img').hide().one('load', function() { 74114 74115 var $parent = $(this).parent().removeClass( 'fancybox-thumbs-loading' ), 74116 thumbWidth = $parent.outerWidth(), 74117 thumbHeight = $parent.outerHeight(), 74118 width, 74119 height, 74120 widthRatio, 74121 heightRatio; 74122 74123 width = this.naturalWidth || this.width; 74124 height = this.naturalHeight || this.height; 74125 74126 // Calculate thumbnail width/height and center it 74127 74128 widthRatio = width / thumbWidth; 74129 heightRatio = height / thumbHeight; 74130 74131 if ( widthRatio >= 1 && heightRatio >= 1 ) { 74132 if (widthRatio > heightRatio) { 74133 width = width / heightRatio; 74134 height = thumbHeight; 74135 74136 } else { 74137 width = thumbWidth; 74138 height = height / widthRatio; 74139 } 74140 } 74141 74142 $(this).css({ 74143 width : Math.floor(width), 74144 height : Math.floor(height), 74145 'margin-top' : Math.min( 0, Math.floor(thumbHeight * 0.3 - he
74145ight * 0.3 ) ), 74146 'margin-left' : Math.min( 0, Math.floor(thumbWidth * 0.5 - width * 0.5 ) ) 74147 }).show(); 74148 74149 }) 74150 .each(function() { 74151 this.src = $( this ).data( 'src' ); 74152 }); 74153 74154 }, 74155 74156 focus : function() { 74157 74158 if ( this.instance.current ) { 74159 this.$list 74160 .children() 74161 .removeClass( 'fancybox-thumbs-active' ) 74162 .filter( '[data-index="' + this.instance.current.index + '"]' ) 74163 .addClass( 'fancybox-thumbs-active' ) 74164 .focus(); 74165 } 74166 74167 }, 74168 74169 close : function() { 74170 this.$grid.hide(); 74171 }, 74172 74173 update : function() { 74174 74175 this.instance.$refs.container.toggleClass( 'fancybox-show-thumbs', this.isVisible ); 74176 74177 if ( this.isVisible ) { 74178 74179 if ( !this.$grid ) { 74180 this.create(); 74181 } 74182 74183 this.instance.trigger( 'onThumbsShow' ); 74184 74185 this.focus(); 74186 74187 } else if ( this.$grid ) { 74188 this.instance.trigger( 'onThumbsHide' ); 74189 } 74190 74191 // Update content position 74192 this.instance.update(); 74193 74194 }, 74195 74196 hide : function() { 74197 this.isVisible = false; 74198 this.update(); 74199 }, 74200 74201 show : function() { 74202 this.isVisible = true; 74203 this.update(); 74204 }, 74205 74206 toggle : function() { 74207 this.isVisible = !this.isVisible; 74208 this.update(); 74209 } 74210 74211 }); 74212 74213 $(document).on({ 74214 74215 'onInit.fb' : function(e, instance) { 74216 if ( instance && !instance.Thumbs ) { 74217 instance.Thumbs = new FancyThumbs( instance ); 74218 } 74219 }, 74220 74221 'beforeShow.fb' : function(e, instance, item, firstRun) { 74222 var Thumbs = instance && instance.Thumbs; 74223 74224 if ( !Thumbs || !Thumbs.isActive ) { 74225 return; 74226 } 74227 74228 if ( item.modal ) { 74229 Thumbs.$button.hide(); 74230 74231 Thumbs.hide(); 74232 74233 return; 74234 } 74235 74236 if ( firstRun && item.opts.thumbs.autoStart === true ) { 74237 Thumbs.show(); 74238 } 74239 74240 if ( Thumbs.isVisible ) { 74241 Thumbs.focus(); 74242 } 74243 }, 74244 74245 'afterKeydown.fb' : function(e, instance, current, keypress, keycode) { 74246 var Thumbs = instance && instance.Thumbs; 74247 74248 // "G" 74249 if ( Thumbs && Thumbs.isActive && keycode === 71 ) { 74250 keypress.preventDefault(); 74251 74252 Thumbs.toggle(); 74253 } 74254 }, 74255 74256 'beforeClose.fb' : function( e, instance ) { 74257 var Thumbs = instance && instance.Thumbs; 74258 74259 if ( Thumbs && Thumbs.isVisible && instance.opts.thumbs.hideOnClose !== false ) { 74260 Thumbs.close(); 74261 } 74262 } 74263 74264 }); 74265 74266}(document, window.jQuery)); 74267 74268// ========================================================================== 74269// 74270// Hash 74271// Enables linking to each modal 74272// 74273// ========================================================================== 74274;(function (document, window, $) { 74275 'use strict'; 74276 74277 // Simple $.escapeSelector polyfill (for jQuery prior v3) 74278 if ( !$.escapeSelector ) { 74279 $.escapeSelector = function( sel ) { 74280 var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g; 74281 var fcssescape = function( ch, asCodePoint ) { 74282 if ( asCodePoint ) { 74283 // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER 74284 if ( ch === "\0" ) { 74285 return "\uFFFD"; 74286 } 74287 74288 // Control characters and (dependent upon position) numbers get escaped as code points 74289 return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; 74290 } 74291 74292 // Other potentially-special ASCII characters get backslash-escaped 74293 return "\\" + ch; 74294 }; 74295 74296 return ( sel + "" ).replace( rcssescape, fcssescape ); 74297 }; 74298 } 74299 74300 // Create new history entry only once 74301 var shouldCreateHistory = true; 74302 74303 // Variable containing last hash value set by fancyBox 74304 // It will be used to determine if fancyBox needs to close after hash change is detected 74305 var currentHash = null; 74306 74307 // Throttling the history change 74308 var timerID = null; 74309 74310 // Get info about gallery name and current index from url 74311 function parseUrl() { 74312 var hash = window.location.hash.substr( 1 ); 74313 var rez = hash.split( '-' ); 74314 var index = rez.length > 1 && /^\+?\d+$/.test( rez[ rez.length - 1 ] ) ? parseInt( rez.pop( -1 ), 10 ) || 1 : 1; 74315 var gallery = rez.join( '-' ); 74316 74317 // Index is starting from 1 74318 if ( index < 1 ) { 74319 index = 1; 74320 } 74321 74322 return { 74323 hash : hash, 74324 index : index, 74325 gallery : gallery 74326 }; 74327 } 74328 74329 // Trigger click evnt on links to open new fancyBox instance 74330 function triggerFromUrl( url ) { 74331 var $el; 74332 74333 if ( url.gallery !== '' ) { 74334 74335 // If we can find element matching 'data-fancybox' atribute, then trigger click event for that .. 74336 $el = $( "[data-fancybox='" + $.escapeSelector( url.gallery ) + "']" ).eq( url.index - 1 ); 74337 74338 if ( !$el.length ) { 74339 // .. if not, try finding element by ID 74340 $el = $( "#" + $.escapeSelector( url.gallery ) + "" ); 74341 } 74342 74343 if ( $el.length ) { 74344 shouldCreateHistory = false; 74345 74346 $el.trigger( 'click' ); 74347 } 74348 74349 } 74350 } 74351 74352 // Get gallery name from current instance 74353 function getGalleryID( instance ) { 74354 var opts; 74355 74356 if ( !instance ) { 74357 return false; 74358 } 74359 74360 opts = instance.current ? instance.current.opts : instance.opts; 74361 74362 return opts.hash || ( opts.$orig ? opts.$orig.data( 'fancybox' ) : '' ); 74363 } 74364 74365 // Star when DOM becomes ready 74366 $(function() { 74367 74368 // Small delay is used to allow other scripts to process "dom ready" event 74369 setTimeout(function() { 74370 74371 // Check if this module is not disabled 74372 if ( $.fancybox.defaults.hash === false ) { 74373 return; 74374 } 74375 74376 // Update hash when opening/closing fancyBox 74377 $(document).on({ 74378 'onInit.fb' : function( e, instance ) { 74379 var url, gallery; 74380 74381 if ( instance.group[ instance.currIndex ].opts.hash === false ) { 74382 return; 74383 } 74384 74385 url = parseUrl(); 74386 gallery = getGalleryID( instance ); 74387 74388 // Make sure gallery start index matches index from hash 74389 if ( gallery && url.gallery && gallery == url.gallery ) { 74390 instance.currIndex = url.index - 1; 74391 } 74392 74393 }, 74394 74395 'beforeShow.fb' : function( e, instance, current ) { 74396 var gallery; 74397 74398 if ( !current || current.opts.hash === false ) { 74399 return; 74400 } 74401 74402 gallery = getGalleryID( instance ); 74403 74404 // Update window hash 74405 if ( gallery && gallery !== '' ) { 74406 74407 if ( window.location.hash.indexOf( gallery ) < 0 ) { 74408 instance.opts.origHash = window.location.hash; 74409 } 74410 74411 currentHash = gallery + ( instance.group.length > 1 ? '-' + ( current.index + 1 ) : '' ); 74412 74413 if ( 'replaceState' in window.history ) { 74414 if ( timerID ) { 74415 clearTimeout( timerID ); 74416 } 74417 74418 timerID = setTimeout(function() { 74419 window.history[ shouldCreateHistory ? 'pushState' : 'replaceState' ]( {} , document.title, window.location.pathname + window.location.search + '#' + currentHash ); 74420 74421 timerID = null; 74422 74423 shouldCreateHistory = false; 74424 74425 }, 300); 74426 74427 } else { 74428 window.location.hash = currentHash; 74429 } 74430 74431 } 74432 74433 }, 74434 74435 'beforeClose.fb' : function( e, instance, current ) { 74436 var gallery, origHash; 74437 74438 if ( timerID ) { 74439 clearTimeout( timerID ); 74440 } 74441 74442 if ( current.opts.hash === false ) { 74443 return; 74444 } 74445 74446 gallery = getGalleryID( instance ); 74447 origHash = instance && instance.opts.origHash ? instance.opts.origHash : ''; 74448 74449 // Remove hash from location bar 74450 if ( gallery && gallery !== '' ) { 74451 74452 if ( 'replaceState' in history ) { 74453 window.history.replaceState( {} , document.title, window.location.pathname + window.location.search + origHash ); 74454 74455 } else { 74456 window.location.hash = origHash; 74457 74458 // Keep original scroll position 74459 $( window ).scrollTop( instance.scrollTop ).scrollLeft( instance.scrollLeft ); 74460 } 74461 } 74462 74463 currentHash = null; 74464 } 74465 }); 74466 74467 // Check if need to close after url has changed 74468 $(window).on('hashchange.fb', function() { 74469 var url = parseUrl(); 74470 74471 if ( $.fancybox.getInstance() ) { 74472 if ( currentHash && currentHash !== url.gallery + '-' + url.index && !( url.index === 1 && currentHash == url.gallery ) ) { 74473 currentHash = null; 74474 74475 $.fancybox.close(); 74476 } 74477 74478 } else if ( url.gallery !== '' ) { 74479 triggerFromUrl( url ); 74480 } 74481 }); 74482 74483 // Check current hash and trigger click event on matching element to start fancyBox, if needed 74484 triggerFromUrl( parseUrl() ); 74485 74486 }, 50); 74487 74488 });
74489 74490}(document, window, window.jQuery)); 74491;
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.