1/* 2The following errors were found when attempting to minify this file: 3- Line 1675: Parse error. syntax error 4- Line 1680: Parse error. syntax error 5- Line 1681: Parse error. syntax error 6- Line 1682: Parse error. 'try' without 'catch' or 'finally' 7- Line 1684: Parse error. syntax error 8- Line 1686: Parse error. syntax error 9- Line 1688: Parse error. syntax error 10- Line 1689: Parse error. missing ; before statement 11- Line 1692: Parse error. syntax error 12- Line 1694: Parse error. syntax error 13- Line 1695: Parse error. syntax error 14- Line 1696: Parse error. invalid return 15- Line 1697: Parse error. syntax error 16- Line 5013: Parse error. illegal character 17- Line 5013: Parse error. missing ; before statement 18- Line 5013: Parse error. missing ; before statement 19- Line 5013: Parse error. unterminated regular expression literal 20- Line 5015: Parse error. missing ; before statement 21- Line 5016: Parse error. syntax error 22- Line 5020: Parse error. syntax error 23- Line 5022: Parse error. missing ; before statement 24- Line 5025: Parse error. syntax error 25- Line 5026: Parse error. syntax error 26- Line 5032: Parse error. syntax error 27- Line 5034: Parse error. missing ; before statement 28- Line 5037: Parse error. syntax error 29- Line 5038: Parse error. syntax error 30- Line 5044: Parse error. syntax error 31- Line 5046: Parse error. missing ; before statement 32- Line 5049: Parse error. syntax error 33- Line 5050: Parse error. syntax error 34- Line 5053: Parse error. syntax error 35- Line 5056: Parse error. missing ; before statement 36- Line 5062: Parse error. syntax error 37- Line 5064: Parse error. missing ; before statement 38- Line 5069: Parse error. syntax error 39- Line 5072: Parse error. missing ; before statement 40- Line 5073: Parse error. syntax error 41- Line 5092: Parse error. syntax error 42- Line 5094: Parse error. missing ; before statement 43- Line 5095: Parse error. missing ; before statement 44- Line 5096: Parse error. syntax error 45- Line 5097: Parse error. syntax error 46- Line 5099: Parse error. missing ; before statement 47- Line 5103: Parse error. syntax error 48- Line 5109: Parse error. syntax error 49- Line 5111: Parse error. missing ; before statement 50- Line 5119: Parse error. invalid return 51- Line 5145: Parse error. syntax error 52- Line 5911: Parse error. missing ; before statement 53- Line 5912: Parse error. missing ; before statement 54- Line 5913: Parse error. missing ; before statement 55- Line 5914: Parse error. missing ; before statement 56- Line 5915: Parse error. missing ; before statement 57- Line 5916: Parse error. missing ; before statement 58- Line 7183: Parse error. missing ; before statement 59- Line 7210: Parse error. syntax error 60- Line 7237: Parse error. illegal character 61- Line 7237: Parse error. illegal character 62- Line 7237: Parse error. missing ) after argument list 63- Line 7237: Parse error. missing ; before statement 64- Line 7237: Parse error. illegal character 65- Line 7237: Parse error. syntax error 66- Line 7239: Parse error. syntax error 67- Line 8198: Parse error. syntax error 68- Line 8474: Parse error. missing ; before statement 69- Line 10824: Parse error. syntax error 70- Line 10834: Parse error. missing ) in parenthetical 71- Line 10836: Parse error. syntax error 72- Line 10839: Parse error. invalid return 73- Line 10844: Parse error. invalid return 74- Line 10857: Parse error. illegal character 75- Line 10857: Parse error. missing ; before statement 76- Line 10857: Parse error. illegal character 77- Line 10860: Parse error. illegal character 78- Line 10860: Parse error. missing ; before statement 79- Line 10860: Parse error. illegal character 80- Line 10865: Parse error. illegal character 81- Line 10865: Parse error. missing ; before statement 82- Line 10865: Parse error. illegal character 83- Line 10868: Parse error. syntax error 84- Line 10870: Parse error. syntax error 85- Line 10871: Parse error. missing ; before statement 86- Line 10873: Parse error. syntax error 87- Line 10875: Parse error. syntax error 88- Line 10876: Parse error. missing ; before statement 89- Line 10913: Parse error. syntax error 90- Line 10915: Parse error. syntax error 91- Line 10928: Parse error. invalid return
92- Line 10934: Parse error. invalid return 93- Line 10948: Parse error. syntax error 94- Line 10952: Parse error. invalid return 95- Line 10953: Parse error. syntax error 96- Line 10956: Parse error. invalid return 97- Line 10962: Parse error. invalid return 98- Line 10963: Parse error. syntax error 99- Line 10965: Parse error. syntax error 100- Line 10968: Parse error. invalid return 101- Line 10973: Parse error. invalid return 102- Line 10978: Parse error. syntax error 103- Line 10979: Parse error. missing ; before statement 104- Line 10981: Parse error. syntax error 105- Line 10983: Parse error. missing ; before statement 106- Line 10988: Parse error. syntax error 107- Line 10991: Parse error. syntax error 108- Line 11002: Parse error. invalid return 109- Line 11005: Parse error. syntax error 110- Line 11006: Parse error. missing ; before statement 111- Line 11007: Parse error. syntax error 112- Line 11010: Parse error. syntax error 113- Line 11019: Parse error. invalid return 114- Line 11020: Parse error. syntax error 115- Line 11022: Parse error. syntax error 116- Line 11025: Parse error. invalid return 117- Line 11029: Parse error. invalid return 118- Line 11031: Parse error. syntax error 119- Line 11032: Parse error. syntax error 120- Line 11033: Parse error. syntax error 121- Line 11036: Parse error. syntax error 122- Line 11037: Parse error. missing ; before statement 123- Line 11040: Parse error. syntax error 124- Line 11041: Parse error. syntax error 125- Line 11043: Parse error. syntax error 126- Line 11044: Parse error. syntax error 127- Line 11047: Parse error. syntax error 128- Line 11049: Parse error. syntax error 129- Line 11051: Parse error. syntax error 130- Line 11053: Parse error. syntax error 131- Line 11055: Parse error. syntax error 132- Line 11058: Parse error. syntax error 133- Line 11064: Parse error. syntax error 134- Line 11067: Parse error. missing ; before statement 135- Line 11068: Parse error. missing ; before statement 136- Line 11069: Parse error. syntax error 137- Line 11073: Parse error. continue must be inside loop 138- Line 11078: Parse error. invalid return 139- Line 11079: Parse error. syntax error 140- Line 11085: Parse error. syntax error 141- Line 11086: Parse error. syntax error 142- Line 11087: Parse error. invalid return 143- Line 11087: Parse error. illegal character 144*/ 145/// <reference name="MicrosoftAjax.js" /> 146/// <reference name="Util.js" /> 147/// <reference path="GlobalJSFunctionsDetail.js" /> 148 149//Callback global variables for Slideshow. 150var callbackfnDocumentCenter = null; 151var callbackfnSlideshowSave = null; 152var $popUp_Slideshow = null; 153var parentID_Slideshow = null; 154var slideshowFolderDefault = ''; 155var numbersOnly = new RegExp('^[0-9]*$'); 156//Global variable for ThemeProperties modal 157var $popup_ThemeProperties = null; 158//Callback variables for Slideshow. 159var SetCursorPosition = null; 160 161// Prevents errors for Internet Explorer (modes prior to 9). 162// They will occur unless the developer tools are open. 163if (!window.console) { 164 var noop = function () { }; 165 166 // Note: MSIE will override this once the dev. tools are open. 167 window.console = { 168 log: noop, clear: noop, warn: noop, error: noop, assert: noop, 169 dir: noop, count: noop, profile: noop, profileEnd: noop, 170 trace: noop, info: noop, memoryProfile: noop, memoryProfileEnd: noop, 171 exception: noop, debug: noop, dirxml: noop, group: noop, groupEnd: noop, 172 markTimeline: noop, time: noop, timeEnd: noop, groupCollapsed: noop 173 }; 174} 175 176// User-agent sniffing for functions that rely on the user-agent 177// to determine version of Safari. Avoid using this variable and 178// check for the presence of features instead (best-practice). 179var isWebKit = (navigator.userAgent.toLowerCase().indexOf('webkit') > -1); 180 181// Determines if an array contains an object. 182// Uses == equality, case-sensitive. a containsExact() could do === equality. 183if (!Array.prototype.contains) { 184 Array.prototype.contains = function (item) { 185 for (var i = 0; i < this.length; i++) { 186 if (this[i] == item) 187 return true; 188 } 189 return false; 190 } 191} 192 193// Gets index of an item if it is present in the array, else returns -1. 194if (!Array.prototype.indexOf) { 195 Array.prototype.indexOf = function (item) { 196 for (var i = 0; i < this.length; i++) { 197 if (this[i] == item) 198 return i; 199 } 200 return -1; 201 } 202} 203 204// Implement ECMAScript 5 String.trim() and friends for browsers that 205// don't have it (e.g. Firefox prior to 3.5, Internet Explorer 6, 7, 8). 206if (!String.prototype.trim) { 207 String.prototype.trim = function () { 208 return this.replace(/^\s+/g, "").replace(/\s+$/g, ""); 209 } 210 String.prototype.trimLeft = function () { 211 return this.replace(/^\s+/g, ""); 212 } 213 String.prototype.trimRight = function () { 214 return this.replace(/\s+$/g, ""); 215 } 216} 217 218// Implement .NET-style left-padding method. 219String.prototype.padLeft = function (desiredLength, paddingChar) { 220 paddingChar += ''; 221 desiredLength = parseInt(desiredLength); 222 223 if (paddingChar.length > 1) 224 paddingChar = paddingChar.charAt(0);
225 else if (paddingChar.length < 1) 226 return this; 227 228 if (this.length >= desiredLength) 229 return this; 230 else { 231 var arr = new Array(); 232 var padNum = desiredLength - this.length; 233 234 for (var i = 0; i < padNum; i++) 235 arr.push(paddingChar); 236 237 return arr.join('') + this; 238 } 239} 240 241// Implement .NET-style right-padding method. 242String.prototype.padRight = function (desiredLength, paddingChar) { 243 paddingChar += ''; 244 desiredLength = parseInt(desiredLength); 245 246 if (paddingChar.length > 1) 247 paddingChar = paddingChar.charAt(0); 248 else if (paddingChar.length < 1) 249 return this; 250 251 if (this.length >= desiredLength) 252 return this; 253 else { 254 var arr = new Array(); 255 var padNum = desiredLength - this.length; 256 257 for (var i = 0; i < padNum; i++) 258 arr.push(paddingChar); 259 260 return this + arr.join(''); 261 } 262} 263 264String.isNullOrEmpty = function (text) { 265 return (text == null || text == ''); 266} 267 268// Adds static method to regular expressions that escapes meta-characters. 269if (!RegExp.metaEscape) { 270 RegExp.metaEscape = function (text) { 271 if (text == null) 272 return null; 273 else if (typeof (text) != "string") 274 text += ''; 275 276 return text.replace(/(\\|\/|\<|\>|\:|\.|\*|\+|\?|\$|\[|\]|\(|\)|\{|\}|\||\&)/g, '\\$1'); 277 }; 278} 279 280// Copies text data to clipboard in WebKit browsers (Chrome/Safari). 281function toWebkitClipboard(text) { 282 // Create element in DOM with text to copy. 283 var tmp = document.createElement('div'); 284 tmp.textContent = text; 285 document.body.appendChild(tmp); 286 287 // Get current user selection, and remove selection current ranges. 288 var curSelection = window.getSelection(); 289 curSelection.removeAllRanges(); 290 291 // Create new selection range with DOM element containing text to copy. 292 var textRange = document.createRange(); 293 textRange.selectNode(tmp); 294 curSelection.addRange(textRange); 295 296 // Execute COPY DHTML command. 297 document.execCommand("Copy"); 298 299 // Clean-up. 300 document.body.removeChild(tmp); 301} 302 303// Copies value in stringVal to the clipboard, displaying the successMessage if hideAlert is false. 304// NOTE: Replace this with something like toWebkitClipboard() at some point. 305function toClipboardEx(stringVal, hideAlert, successMessage) { 306 if (window.clipboardData) { // Internet Explorer 307 if (!window.clipboardData.setData("Text", stringVal) && !hideAlert) 308 hideAlert = true; 309 } 310 else if ((window.WebKitPoint || !window.netscape) && !window.opera) { 311 toWebkitClipboard(stringVal); 312 } 313 else if (window.netscape) { // Mozilla Firefox and derivitives (Netscape, Seamonkey)... 314 try { 315 // Request full access to the XPCOM (Cross-Platform COM) API. 316 netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); 317 } 318 catch (e) { 319 // Unable to obtain access, user rejected or setting in about:config not set right. 320 alert('Please type "about:config" in your browser and press enter. Type "signed.applets.codebase_principal_support" in Filter. Double click to change the value to "true". Then come back and click on the link again.\n\nIf you have already performed this action, make sure when you are asked whether to allow or deny the browser permission, that you are allowing it.'); 321 return; 322 } 323 324 // Create an instance of the clipboard class. 325 var clipBoard = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard); 326 327 // Create an instance of the Transferable class (used to talk to the clipboard). 328 var clipTrans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable); 329 330 // Set clipboard format for text only. 331 clipTrans.addDataFlavor('text/unicode'); 332 333 // Create XPCOM string, set data to copy of stringVal. 334 var clipString = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString); 335 var copyText = stringVal; 336 clipString.data = copyText; 337 338 // Note: This code may be bugged in some scenarios! 1 char does not always equal 2 bytes in UTF-16! 339 // Set data to transfer to the clipboard (length * 2, since 1 char is usually 2 bytes in UTF-16). 340 clipTrans.setTransferData("text/unicode", clipString, copyText.length * 2); 341 342 // Transfer data to the global clipboard. 343 clipBoard.setData(clipTrans, null, clipBoard.kGlobalClipboard); 344 } 345 346 if (!hideAlert) 347 alert(successMessage); 348 349 return true; 350} 351 352function toClipboard(stringVal, hideAlert) { 353 return toClipboardEx(stringVal, hideAlert, "The link has been copied to your clipboard."); 354} 355 356function getClipboard() { 357 if (window.clipboardData) { 358 return window.clipboardData.getData('Text'); 359 } else if (window.netscape) { 360 try { 361 netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); 362 } 363 catch (e) { 364 alert('Please type "about:config" in your browser and press enter. Type "signed.applets.codebase_principal_support" in Filter. Double click to change the value to "true". Then come back and click on the link again.\n\nIf you have already performed this action, make sure when you are asked whether to allow or deny the browser permission, that you are allowing it.'); 365 return; 366 } 367 368 // Create instances of the Clipboard and Transferable objects. 369 var clipBoard = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard); 370 var clipTrans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable); 371 372 // Get data from global clipboard, place in clipTrans object. 373 clipTrans.addDataFlavor('text/unicode'); 374 clipBoard.getData(clipTrans, clipBoard.kGlobalClipboard); 375 376 // Create objects to pass to getTransferData, which uses XPCOM String 377 // and Integer classes instead of those normally used by JavaScript. 378 var objStr = new Object(); var objNumBytes = new Object(); 379 try { 380 clipTrans.getTransferData('text/unicode', objStr, objNumBytes); 381 } 382 catch (error) { 383 return ''; 384 } 385 386 // Query whichever interface is available, opting to use nsISupportsWString. 387 if (objStr) { 388 if (Components.interfaces.nsISupportsWString) 389 objStr = objStr.value.QueryInterface(Components.interfaces.nsISupportsWString); 390 else if (Components.interfaces.nsISupportsString) 391 objStr = objStr.value.QueryInterface(Components.interfaces.nsISupportsString); 392 else 393 objStr = null; 394 } 395 396 // Note: This code may be bugged in some scenarios! 1 char does not always equal 2 bytes in UTF-16! 397 // Get data out of the XPCOM string and into a normal JS string. 398 if (objStr) 399 return (objStr.data.substring(0, objNumBytes.value / 2)); 400 } 401 return; 402} 403 404// Gets the computed style of an element (browser-independent). 405var getCurrentStyle = (document.defaultView ? 406 function (elem) { 407 return document.defaultView.getComputedStyle(elem, ''); 408 } : 409 function (elem) { 410 return elem.currentStyle; 411 } 412); 413 414// Gets children nodes of an HTML DOM element matching the tag name specified. 415function getChildNodesByTag(domElement, tagName) { 416 var cn = domElement.childNodes; 417 var nodesPresent = 0, retVal = new Array(); 418 retVal.length = cn.length; 419 420 tagName = tagName.toUpperCase(); 421 for (var cv = 0;
421 cv < cn.length; cv++) { 422 if (cn[cv].nodeType == 1 && cn[cv].nodeName == tagName) 423 retVal[nodesPresent++] = cn[cv]; 424 } 425 426 return retVal.slice(0, nodesPresent); 427} 428 429// Returns true on Safari browsers 1.3.4 and older (bad date object behavior in old Safari). 430// Check does not work properly if user-agent has been modified by user. 431var isSafariVersion13OrOlder = (isWebKit ? 432 function () { 433 var navAppVersion = navigator.appVersion; 434 var phraseToFind = 'AppleWebKit/'; 435 var foundStartAt = navAppVersion.indexOf(phraseToFind) + phraseToFind.length; 436 var foundEndAt = navAppVersion.indexOf(' ', foundStartAt + 1); 437 return (parseInt(navAppVersion.substring(foundStartAt, foundEndAt)) < 320); 438 } : 439 function () { 440 return false; 441 } 442); 443 444// Returns true on Safari browsers 2.0.4 and older (textbox/button not stylable before 3.x). 445// Check does not work properly if user-agent has been modified by user. 446var isSafariVersion20OrOlder = (isWebKit ? 447 function () { 448 var navAppVersion = navigator.appVersion; 449 var phraseToFind = 'AppleWebKit/'; 450 var foundStartAt = navAppVersion.indexOf(phraseToFind) + phraseToFind.length; 451 var foundEndAt = navAppVersion.indexOf(' ', foundStartAt + 1); 452 return (parseInt(navAppVersion.substring(foundStartAt, foundEndAt)) < 525); 453 } : 454 function () { 455 return false; 456 } 457); 458 459// Returns true if an event fired too soon after another event. 460// Mechanism used on older Safari browsers to prevent 461// double-fire problems (especially with key presses). 462function safariEventRateLimitBlock() { 463 if (isWebKit && isSafariVersion13OrOlder()) { 464 if (safariRateLimited != 0) 465 return true; 466 else { 467 safariRateLimited = setTimeout('safariRateLimited = 0;', 10); 468 return false; 469 } 470 } 471} 472 473// Get coordinates relative to document (works out container issues). 474// Wrote this so it works in quirks or standards mode. 475function getDocumentCoordinates(element) { 476 var htmlElem = document.body.parentNode; 477 var bodyElem = document.body; 478 var pos = { "x": 0, "y": 0 }; 479 pos.toString = function () { return this.x + ', ' + this.y; } 480 while (element != null) { 481 pos.x += element.offsetLeft; 482 pos.y += element.offsetTop; 483 switch (element.offsetParent) { 484 case htmlElem: 485 case bodyElem: 486 case null: 487 return pos; 488 } 489 element = element.offsetParent; 490 } 491} 492 493// Attach an event handler to an object (browser-independent). 494// First clause is W3C DOM method, second is DHTML (IE). 495var addEvent = (window.addEventListener ? 496 function (obj, evType, fn, useCapture) { 497 try { 498 obj.addEventListener(evType, fn, useCapture); 499 } catch (e) { } 500 return true; 501 } : 502 function (obj, evType, fn, useCapture) { 503 try { 504 return obj.attachEvent('on' + evType, fn); 505 } catch (e) { } 506 } 507); 508 509// Release an event handler from an object (browser-independent). 510// First clause is W3C DOM method, second is DHTML (IE). 511var removeEvent = (window.removeEventListener ? 512 function (obj, evType, fn, useCapture) { 513 try { 514 obj.removeEventListener(evType, fn, useCapture); 515 } catch (e) { } 516 return true; 517 } : 518 function (obj, evType, fn, useCapture) { 519 try { 520 obj.detachEvent('on' + evType, fn); 521 } catch (e) { } 522 return true; 523 } 524); 525 526// Stops a DOM event from propagating further than the current handler. 527// Note: Returning false from event handlers in IE 6/7/8 does the same thing. 528function stopEventPropagation(evObj) { 529 if (evObj.preventDefault) 530 evObj.preventDefault(); 531 532 // Calling cancelButton after stopPropagation 533 // may negate the stopPropagation so do not do it. -KB 534 if (evObj.stopPropagation) 535 evObj.stopPropagation(); 536 else if (evObj.cancelBubble) 537 evObj.cancelBubble(); 538} 539 540// These functions assists in obscuring email addresses: 541function mailTo(obj) { 542 //alert('mailto:'+eval(obj.getAttribute('id'))); 543 obj.setAttribute('href', 'mailto:' + eval(obj.getAttribute('id'))); 544} 545 546function js_mail(obj, Emails) { 547 var mail_link = Emails[0]; 548 for (var email = 1; email < Emails.length; email++) 549 if (Emails[email] != null && Emails[email] != '' && Emails[email].substr(1, 4) != 'href') mail_link = mail_link + Emails[email]; 550 551 obj.setAttribute('href', 'mailto:' + mail_link); 552} 553 554// Used to prevent right-click menu from appearing for some clients that wanted this ability. 555function antiContextMenuHook() { 556 // Note: Opera is not hookable. 557 var showAlert = function () { alert('All images are protected by Copyright. Do not use without permission.'); } 558 var mdClick = function (e) { 559 if (!document.all) { 560 if (e.button == 2 || e.button == 3) 561 showAlert(); 562 } 563 else if (event && event.button == 2) 564 showAlert(); 565 } 566 var cmClick = function (e) { 567 if (navigator.userAgent.toLowerCase().indexOf('khtml') > -1) { 568 // Safari, Konquerer 569 if (e.preventDefault) 570 e.preventDefault(); 571 showAlert(); 572 } 573 if (e.stopPropagation) 574 e.stopPropagation(); // Mozilla Firefox 2.0 575 return false; // IE 6.0 and 7.0 576 } 577 document.onmousedown = mdClick; 578 document.oncontextmenu = cmClick; 579} 580 581// Form validation functions: 582function RegExValidate(expression, value, param) { 583 var re = new RegExp(expression, param); 584 if (value != '' && value != undefined) { 585 if (value.match(re)) return true; 586 else return false; 587 } 588 else return true; 589} 590 591// Used for validating emailaddress for special scenarios like continuous periods. - VB 592function checkSpecialScenarios(s) { 593 var bugchars = '!#$^&*()|}{[]?><~%:;/,=`"'; 594 var i; 595 var lchar = ""; 596 // Search through string's characters one by one. 597 // If character is not in bag. 598 for (i = 0; i < s.length; i++) { 599 // Check that current character isn't whitespace. 600 var c = s.charAt(i); 601 if (i > 0) lchar = s.charAt(i - 1) 602 if (bugchars.indexOf(c) != -1 || (lchar == "." && c == ".")) return false; 603 } 604 return true; 605} 606 607// JavaScript version of CivicPlus.CMS.Site.Validation.IsValidEmailAddress(); 608function emailValidate(emailAddress) { 609 var emailAddressTrimmed = TrimString(emailAddress + ""); 610 if (emailAddressTrimmed != "") { 611 if (checkSpecialScenarios(emailAddressTrimmed) == false) 612 return false; 613 if (emailAddressTrimmed.replace(/[^@]/g, '').length > 1) 614 return false; 615 var parts = emailAddressTrimmed.splitRemoveEmpties('@'); 616 if (emailAddressTrimmed.substr(emailAddressTrimmed.length - 1) == '@') 617 return false; 618 if (parts.length == 2) { 619 for (var i = 0; i < parts.length; i++) { 620 if (((!RegExValidate('^[A-Z0-9]$', parts[i].substr(0, 1), 'i') || !RegExValidate('^[A-Z0-9]$', parts[i].substr(parts[i].length - 1), 'i')) && i == 1) || (!RegExValidate('^[A-Z0-9_%-\\.]+$', parts[i].substr(0, parts[i].length - 1), 'i'))) 621 return false; 622 } 623 var lastDotPos = parts[1].lastIndexOf('.'); 624 if (lastDotPos < 0 || parts[1].substr(lastDotPos).length < 3 || (!RegExValidate('^[A-Z]+$', parts[1].substr(lastDotPos + 1), 'i'))) 625 return false; 626 else 627 return true; 628 } 629 else 630 return false; 631 } 632 else 633 return false; 634} 635 636// Returns: 0 - success, 1 - illegal value, 2 - too large, 3 - too small, 4 - blank. 637function intValidateWithRange(value, min, max) { 638 if (value == '' || value == null) return 4; 639 if (RegExValidate('^(-|)[0-9]*$', value, 'i')) { 640 try { var pint = parseInt(value); } catch (ex) { return 1; } 641 if (pint < min) return 3; else if (pint > max) return 2; return 0; 642 } else 643 return 1; 644} 645 646// Split function that remotes empty entries. 647String.prototype.splitRemoveEmpties = function (separator, howmany) { 648 var splitArr; 649 var returnArr = new Array(); 650 651 if (arguments.length == 2) 652 splitArr = this.split(separator, howmany); 653 else
654 splitArr = this.split(separator); 655 656 for (var i = 0; i < splitArr.length; i++) { 657 if (splitArr[i] != '') 658 returnArr.push(splitArr[i]); 659 } 660 661 return returnArr; 662} 663 664// JavaScript equivalent of a function in GlobalFunctionsDetail.aspx. 665// Do not use this function unless you have a good reason (e.g. textarea length on client must match size on server). 666// KNOWN: Does not do entities properly, matches server behavior (where's the semi-colon?). 667function SQLSafe(strInput) { 668 return strInput.replace(/\'/g, "'").replace(/\"/g, """); 669} 670 671// Returns true if the string is empty. Will blow up on NULLs. 672function FieldIsEmpty(strInput) { 673 if (strInput == undefined) 674 return true; 675 return TrimString(strInput).length == 0; 676} 677 678// Removes leading and trailing white space from a string. Will blow up on NULLs. 679function TrimString(strInput) { 680 return strInput.replace(/^\s+/g, "").replace(/\s+$/g, ""); 681} 682 683// Returns true if the value is an integer value. 684function isInteger(strInput) { 685 var leadingZeros = calculateLeadingZeroStrings(strInput); 686 687 return leadingZeros == strInput || (strInput == leadingZeros + parseInt(strInput).toString()); 688} 689 690// Returns true if the value is a real number. 691function isRealNumber(strInput) { 692 var leadingZeros = calculateLeadingZeroStrings(strInput); 693 694 return leadingZeros == strInput || (strInput == leadingZeros + parseFloat(strInput)); 695} 696 697function calculateLeadingZeroStrings(strInput) { 698 var leadingZeros = ""; 699 700 if (strInput != null) { 701 for (var i = 0; i < strInput.length; i++) { 702 if (strInput[i] == "0") { 703 leadingZeros += "0"; 704 } 705 else { 706 break; 707 } 708 } 709 } 710 711 return leadingZeros; 712} 713 714// Date validator class. 715function dateValidator() { 716 this.firstValidDate = new Date('01/01/1753'); 717 this.lastValidDate = new Date('01/01/3000'); 718 this.strStartDateID = 'Start/Begin Date'; 719 this.strEndDateID = 'End/Stop/Expiration Date'; 720 this.strStartTimeID = 'Start Time'; 721 this.strEndTimeID = 'End Time'; 722 this.ysnRequireStartDateIfEndSpecified = false; 723 this.ysnStartDateRequired = false; 724 this.ysnEndDateRequired = false; 725 this.ysnStartTimeRequired = false; 726 this.ysnEndTimeRequired = false; 727 this.ysnAllowEqualDates = false; 728 this.ysnAllowTimeOnly = false; 729 this.ysnCent = false; //Allow only four digit years 730 var dtiEndDate; 731 var dtiStartDate; 732 var dtiStartTime; 733 var dtiEndTime; 734 this.timesAlreadyValidated = false; 735 this.datesAlreadyValidated = false; 736 737 this.setStartDate = function (date) { 738 dtiStartDate = this.cleanDate(date); 739 } 740 741 this.setEndDate = function (date) { 742 dtiEndDate = this.cleanDate(date); 743 } 744 745 this.setStartDateRequired = function (required) { 746 this.ysnStartDateRequired = required; 747 } 748 749 this.setEndDateRequired = function (required) { 750 this.ysnEndDateRequired = required; 751 } 752 753 this.setRequireStartDateIfEndSpecified = function (required) { 754 this.ysnRequireStartDateIfEndSpecified = required; 755 } 756 757 this.cleanDate = function (date) { 758 if (date) { 759 if (typeof isMobileView != 'undefined' && isMobileView) { 760 date = this.ChangeDateFormatForMobileView(date); 761 } 762 else if (RegExValidate('^([0-9-\\/]*?)([0-9]{2,4})$', date, 'i')) { 763 var year = RegExp.$2; 764 if (year.length == 2) { 765 if (year >= 50) date = RegExp.$1 + "19" + year; 766 else date = RegExp.$1 + "20" + year; 767 } 768 date = date.replace('\-', '/', 'g'); 769 } 770 } 771 return date; 772 } 773 774 this.ChangeDateFormatForMobileView = function (date) { 775 var rxDatePattern = /^\d{4}\-\d{1,2}\-\d{1,2}$/; //Regex for yyyy-mm-dd format 776 var match = date.match(rxDatePattern); 777 if (match != null) { 778 var dateArray = date.split('-'); 779 var dateFormat = getDateFormat().toLowerCase(); 780 if (dateFormat == "mm/dd/yyyy") 781 date = dateArray[1] + '/' + dateArray[2] + '/' + dateArray[0]; 782 else if (dateFormat == "dd/mm/yyyy") 783 date = dateArray[2] + '/' + dateArray[1] + '/' + dateArray[0]; 784 } 785 return date; 786 } 787 788 this.dateValidate = function (dtiDate, ysnRequired, strID) { 789 if (!ysnRequired && (dtiDate == null || dtiDate == '')) return true; 790 else if (ysnRequired && (dtiDate == null || dtiDate == '')) { 791 if (strID) this.error = strID + ' cannot be blank.'; 792 else this.error = ' cannot be blank'; 793 this.errorNumber = 1; 794 return false; 795 } 796 else if (RegExValidate('^(1[0-2]|0?[1-9])(/|-)(0?[1-9]|[1-2][0-9]|3[0-1])\\2([0-9]{4}|[0-9]{2})$', dtiDate, 'i')) {
797 var month = RegExp.$1; 798 var day = RegExp.$3; 799 var year = RegExp.$4; 800 801 if (year.length == 2 && this.ysnCent == true) { 802 if (strID) this.error = strID + ' requires a four digit year'; 803 else this.error = 'Please use a four digit year'; 804 return false; 805 } 806 if (year.length == 4 && (year > 3000 || year < 1753)) { 807 this.error = dtiDate + '\nis outside of the date range.'; 808 this.errorNumber = 2; 809 return false; 810 } 811 if (day == 31 && (month == 4 || month == 6 || month == 9 || month == 11)) { 812 this.error = 'This month doesn\'t have 31 days'; 813 this.errorNumber = 3; 814 return false; 815 } 816 if (day >= 30 && month == 2) { 817 this.error = 'February doesn\'t have ' + day + ' days'; 818 this.errorNumber = 4; 819 return false; 820 } 821 if (month == 2 && day == 29 && !(year % 4 == 0 && (year % 100 != 0 || year % 400 == 0))) { 822 this.error = 'This is not a leap year\nFebruary doesn\'t have 29 days.'; 823 this.errorNumber = 5; 824 return false; 825 } 826 return true; 827 } else { 828 if (strID) this.error = strID + ' is not a valid date format.\nPlease use ' + getDateFormat().toUpperCase() + '.'; 829 else this.error = dtiDate + '\n is an invalid date format.\nPlease use ' + getDateFormat().toUpperCase() + '.'; 830 this.errorNumber = 6; 831 return false; 832 } 833 return false; 834 } 835 836 this.dateOrderValidate = function () { 837 if (this.dateValidate(dtiStartDate, this.ysnStartDateRequired, this.strStartDateID) && this.dateValidate(dtiEndDate, this.ysnEndDateRequired, this.strEndDateID)) { 838 if (this.ysnRequireStartDateIfEndSpecified && !dtiStartDate && dtiEndDate) { 839 this.error = 'A Start Date must be specified if an End Date was entered.'; 840 this.errorNumber = 9; 841 return false; 842 } 843 if (!dtiStartDate || !dtiEndDate) return true; 844 else { 845 var StartDate = new Date(dtiStartDate); 846 var EndDate = new Date(dtiEndDate); 847 } 848 if (StartDate.getTime() < EndDate.getTime()) return true; 849 else if (StartDate.getTime() == EndDate.getTime() && this.ysnAllowEqualDates == true) { 850 this.ysnDatesAreEqual = true; 851 return true; 852 } else { 853 this.error = 'The End Date must be after the Start Date.'; 854 this.errorNumber = 7; 855 return false; 856 } 857 } 858 else return false; 859 } 860 861 this.dateValidateNew = function (dtiDate, ysnRequired, strID) { 862 var month; 863 var day; 864 var year; 865 if (dtiDate === undefined) 866 dtiDate = ''; 867 868 if (!ysnRequired && (dtiDate == '' || !dtiDate)) return true; 869 870 if (ysnRequired && dtiDate == '') { 871 if (strID) this.error = strID + ' is required'; 872 else this.error = ' is required'; 873 this.errorNumber = 1; 874 return false; 875 } 876 877 var dateFormat = getDateFormat().toLowerCase(); 878 879 if (typeof isMobileView != 'undefined' && isMobileView) { 880 dtiDate = this.ChangeDateFormatForMobileView(dtiDate); 881 } 882 883 if ((dateFormat == "mm/dd/yyyy") && (RegExValidate('^(1[0-2]|0?[1-9])(/|-)(0?[1-9]|[1-2][0-9]|3[0-1])\\2([0-9]{4}|[0-9]{2})$', dtiDate, 'i'))) { 884 month = RegExp.$1; 885 day = RegExp.$3; 886 year = RegExp.$4; 887 888 return this.validDateParts(month, day, year); 889 } 890 891 if ((dateFormat == "dd/mm/yyyy") && (RegExValidate('^(0?[1-9]|[1-2][0-9]|3[0-1])(/|-)(1[0-2]|0?[1-9])\\2([0-9]{4}|[0-9]{2})$', dtiDate, 'i'))) { 892 month = RegExp.$3; 893 day = RegExp.$1; 894 year = RegExp.$4; 895 896 return this.validDateParts(month, day, year); 897 } 898 899 if (strID) this.error = strID + ' is not a valid date format.\nPlease use ' + dateFormat.toUpperCase() + '.'; 900 else this.error = dtiDate + '\n is an invalid date format.\nPlease use ' + dateFormat.toUpperCase() + '.'; 901 this.errorNumber = 6; 902 903 return false; 904 } 905 906 this.validDateParts = function (month, day, year) { 907 if (year.length == 2 && this.ysnCent == true) { 908 if (strID) this.error = strID + ' requires a four digit year'; 909 else this.error = 'Please use a four digit year'; 910 return false; 911 } 912 if (year.length == 4 && (year > 3000 || year < 1753)) { 913 this.error = dtiDate + '\nis outside of the date range.'; 914 this.errorNumber = 2; 915 return false; 916 }
917 if (day == 31 && (month == 4 || month == 6 || month == 9 || month == 11)) { 918 this.error = 'This month doesn\'t have 31 days'; 919 this.errorNumber = 3; 920 return false; 921 } 922 if (day >= 30 && month == 2) { 923 this.error = 'February doesn\'t have ' + day + ' days'; 924 this.errorNumber = 4; 925 return false; 926 } 927 if (month == 2 && day == 29 && !(year % 4 == 0 && (year % 100 != 0 || year % 400 == 0))) { 928 this.error = 'This is not a leap year\nFebruary doesn\'t have 29 days.'; 929 this.errorNumber = 5; 930 return false; 931 } 932 return true; 933 } 934 935 this.dateOrderValidateNew = function () { 936 //If sending in US format run dateValidateNew first becuase it expects dates in daybeforemonth format 937 if (this.datesAlreadyValidated || (this.dateValidateNew(dtiStartDate, this.ysnStartDateRequired, this.strStartDateID) && this.dateValidateNew(dtiEndDate, this.ysnEndDateRequired, this.strEndDateID))) { 938 if (this.ysnRequireStartDateIfEndSpecified && !dtiStartDate && dtiEndDate) { 939 this.error = 'A Start Date must be specified if an End Date was entered.' 940 this.errorNumber = 9; return false; 941 } 942 if (!dtiStartDate || !dtiEndDate || dtiEndDate == "NaN/NaN/NaN" || dtiStartDate == "NaN/NaN/NaN") return true; 943 else { 944 //Expects dates in US format 945 var StartDate = new Date(dtiStartDate); 946 var EndDate = new Date(dtiEndDate); 947 } 948 if (StartDate.getTime() < EndDate.getTime()) return true; 949 else if (StartDate.getTime() == EndDate.getTime() && this.ysnAllowEqualDates == true) { 950 this.ysnDatesAreEqual = true; 951 return true; 952 } 953 else { 954 this.error = 'The End Date must be after the Start Date.'; 955 this.errorNumber = 7; return false; 956 } 957 } 958 else return false; 959 } 960 961 this.getStandardDate = function (dateText) { 962 $.ajax({ 963 url: '/Utility/GetDate?dateText=' + dateText, 964 async: false, 965 type: 'GET', 966 dataType: 'json', 967 success: function (data) { 968 dateText = data.date; 969 }, 970 error: function (jqXHR, textStatus, errorThrown) { 971 } 972 }); 973 974 return dateText; 975 } 976 977 this.smallDateTimeMaxValueValidate = function () { 978 var StartDate = new Date(dtiStartDate); 979 var EndDate = new Date(dtiEndDate); 980 var MaxDate = new Date('05/06/2079 23:59:59'); 981 var result = true; 982 if (StartDate <= MaxDate && EndDate <= MaxDate) { 983 result = true; 984 } 985 else if (StartDate > MaxDate) { 986 this.error = "The Start Date must be less than '5/6/2079'."; 987 this.errorNumber = 2; 988 result = false; 989 } 990 else if (EndDate > MaxDate) { 991 this.error = "The End Date must be less than '5/6/2079'."; 992 this.errorNumber = 3; 993 result = false; 994 } 995 return result; 996 } 997 998 this.format = function (format, date) { 999 if (!date) date = new Date(); 1000 var day = date.getDate(); 1001 var month = date.getMonth() + 1; 1002 var year = date.getFullYear(); 1003 return format.toLowerCase().replace(/dd/g, day).replace(/mm/g, month).replace(/y{1,4}/g, year) 1004 } 1005 1006 this.timeValidate = function (ditTime, ysnRequired, strID) { 1007 if (!ysnRequired && ditTime == '') return true; 1008 else if (ysnRequired && ditTime == '') { 1009 if (strID) this.error = strID + ' is required'; 1010 else this.error = 'Time is required'; 1011 this.errorNumber = 1; 1012 return false; 1013 } 1014 else if (RegExValidate('^(1[0-2]|0?[1-9]):([0-5]?[0-9])(:([0-5][0-9]))?$', ditTime, 'i')) return true; 1015 else { 1016 if (strID) this.error = strID + ' is not a valid time format. Please use H
1016H:MM.'; 1017 else this.error = ' is not a valid time format. Please use HH:MM.'; 1018 this.errorNumber = 8; 1019 return false; 1020 } 1021 } 1022 1023 this.timeValidate24Hour = function (ditTime, ysnRequired, strID) { 1024 if (!ysnRequired && ditTime == '') return true; 1025 else if (ysnRequired && ditTime == '') { 1026 if (strID) this.error = strID + ' is required'; 1027 else this.error = 'Time is required'; 1028 this.errorNumber = 1; 1029 return false; 1030 } 1031 else if (RegExValidate('^([01]?[0-9]|2[0-3]):([0-5]?[0-9])(:([0-5][0-9]))?$', ditTime, 'i')) return true; 1032 else { 1033 if (strID) this.error = strID + ' is not valid.'; 1034 else this.error = ' is not valid.'; 1035 this.errorNumber = 8; 1036 return false; 1037 } 1038 } 1039 this.timeOrderValidate = function () { 1040 if (!this.ysnAllowTimeOnly && ((!dtiStartDate && this.dtiStartTime) || (!dtiEndDate && this.dtiEndTime))) { 1041 this.error = 'You only submited a time.\nPlease provide a day as well.'; 1042 this.errorNumber = 10; 1043 this.startDateBlank = (!dtiStartDate && this.dtiStartTime); 1044 this.endDateBlank = (!dtiEndDate && this.dtiEndTime); 1045 return false; 1046 } 1047 if (this.timesAlreadyValidated || (this.timeValidate(this.dtiStartTime, this.ysnStartTimeRequired, this.strStartTimeID) && this.timeValidate(this.dtiEndTime, this.ysnEndTimeRequired, this.strEndTimeID))) { 1048 if (!this.ysnDatesAreEqual) return true; 1049 1050 if (!this.dtiStartTime && !this.ysnStartTimeRequired) return true; 1051 if (!this.dtiEndTime && !this.ysnEndTimeRequired) return true; 1052 1053 var dtiStartTime = this.convertTo24Hour(this.dtiStartTime, this.strStartAMPM, dtiStartDate); 1054 var dtiEndTime = this.convertTo24Hour(this.dtiEndTime, this.strEndAMPM, dtiEndDate); 1055 1056 if (dtiStartTime.getTime() < dtiEndTime.getTime()) return true; 1057 else if (dtiStartTime.getTime() == dtiEndTime.getTime() && this.ysnAllowEqualTimes == true) { 1058 this.ysnTimesAreEqual = true; 1059 return true; 1060 } 1061 else { 1062 this.error = 'The End Time must be after the Start Time if the Start and End Dates are the same.' 1063 this.errorNumber = 9; 1064 return false; 1065 } 1066 } 1067 return false; 1068 } 1069 1070 this.convertTo24Hour = function (time, AMPM, date) { 1071 if (!date) date = "1/1/70"; 1072 1073 var dtTime = time.indexOf(AMPM) == -1 ? new Date(date + " " + time + " " + AMPM) : new Date(date + " " + time); 1074 if (dtTime == 'Invalid Date') { 1075 var dayBeforeMonthOn = getDateFormat().toLocaleLowerCase() == "dd/mm/yyyy" ? true : false; 1076 if (dayBeforeMonthOn) { 1077 var dateArray = date.split('/'); 1078 date = dateArray[1] + '/' + dateArray[0] + '/' + dateArray[2]; 1079 dtTime = time.indexOf(AMPM) == -1 ? new Date(date + " " + time + " " + AMPM) : new Date(date + " " + time); 1080 } 1081 } 1082 return dtTime; 1083 } 1084} 1085 1086// Helper function for inputAlert(). 1087function inputEmailValidate(obj, required) { 1088 if (required == null || required == false) 1089 return (obj.value == '' || emailValidate(obj.value) == true) 1090 else 1091 return (obj.value != '' && emailValidate(obj.value) == true) 1092} 1093 1094// Note: This function does not match standard validation behavior! Users are supposed to see 1095// a summary of problems with their inputs and not be alerted multiple times! 1096// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 1097// Calls another validation routine, and determines success/failure on result of call (true/false). 1098// Displays error message on validation failure. Returns result of call. 1099function inputAlert(call, obj, required, errorMessage) { 1100 call = eval('input' + call + 'Validate'); 1101 if (call(obj, required) == false) { 1102 if (errorMessage == null) 1103 errorMessage = 'Please enter a single valid email address without any extra body, subject, etc. information (ie [email protected]).'; 1104 obj.setAttribute('autocomplete', 'off'); 1105 obj.focus(); 1106 obj.setAttribute('autocomplete', 'on'); 1107 alert(errorMessage); 1108 return false; 1109 } 1110 else 1111 return true; 1112} 1113 1114// Takes array of required fields and checks whether they have a value or not 1115// If empty fields found, formats a javascript alert to inform the user and returns true 1116function checkRequiredFieldsEmpty(requiredFieldList) { 1117 var badList = new Array(); 1118 for (var i = 0, len = requiredFieldList.length; i < len; i++) { 1119 var $this = requiredFieldList[i]; 1120 var $fieldId = $('#' + $this); 1121 if (($fieldId.length > 0) && (FieldIsEmpty($fieldId.val()))) { 1122 var $label = $('label[for=' + $this + ']'); 1123 if ($label.length > 0) 1124 badList.push($label.text().trim()); 1125 else 1126 badList.push($this); 1127 } 1128 } 1129 if (badList.length > 0) { 1130 var msg = badList.join(" cannot be blank.\r\n"); 1131 msg += " cannot be blank."; 1132 msg = msg.replace(/\*/g, ''); 1133 alert(msg); 1134 return true; 1135 } 1136 return false; 1137} 1138// End Form Validation functions. 1139 1140// Begin AJAX functions: 1141// See http://blogs.msdn.com/xmlteam/archive/2006/10/23/using-the-right-version-of-msxml-in-internet-explorer.aspx 1142// If you are curious why the XMLHTTP versions specified are and why others are not. 1143function makeErrorRequest(url, status) { 1144 var http_error_request = false; 1145 var origin = location.pathname; 1146 1147 if (window.XMLHttpRequest) { // Mozilla, Safari, IE7 1148 http_error_request = new XMLHttpRequest(); 1149 if (http_error_request.overrideMimeType) 1150 http_error_request.overrideMimeType("text/html"); 1151 } else if (window.ActiveXObject) { // IE6 1152 try { 1153 http_error_request = new ActiveXObject("Msxml2.XMLHTTP.6.0"); 1154 } catch (e) { 1155 try { 1156 http_error_request = new ActiveXObject("Msxml2.XMLHTTP"); // Version 3.0 1157 } catch (e) { } 1158 } 1159 } 1160 1161 http_error_request.onreadystatechange = function () { }
1162 http_error_request.open("GET", "/AJAX-error.ashx?url=" + escape(url) + "&status=" + status + "&origin=" + escape(origin), true); 1163 http_error_request.send(null); 1164 //if(status == 403) 1165 //window.location = '/admin/AccessDenied.aspx?fromURL=' + window.location.pathname.substr(7); 1166} 1167 1168// Makes AJAX request, additionally supporting POST data (makeHttpRequest doesn't). 1169// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 1170// Note: It's YOUR responsibility as a developer to make sure data 1171// placed in formData is formatted as it should be. Form data should be 1172// in Query String format with the value portions escape()'d. -KB 1173function makeHttpRequestEx(URL, formData, callbackFunc, ysnReturnXML) { 1174 1175 URL = window.location.origin + URL; 1176 1177 if (formData != null) { 1178 $.ajax({ 1179 type: 'POST', 1180 url: URL, 1181 data: formData, 1182 success: callbackFunc 1183 }); 1184 } 1185 else { 1186 $.ajax({ 1187 type: 'GET', 1188 url: URL, 1189 success: callbackFunc 1190 }); 1191} 1192} 1193 1194// NOTE: Do not use this in new code, use $.ajax() instead. 1195// Makes AJAX request. Used in n-menu code. 1196function makeHttpRequest(url, callback_function, return_xml) { 1197 var http_request = false; 1198 1199 if (window.XMLHttpRequest) { // Mozilla, Safari, IE7 1200 http_request = new XMLHttpRequest(); 1201 if (http_request.overrideMimeType && !return_xml) 1202 http_request.overrideMimeType("text/html"); 1203 } else if (window.ActiveXObject) { // IE6 1204 try { 1205 http_request = new ActiveXObject("Msxml2.XMLHTTP.6.0"); 1206 } catch (e) { 1207 try { 1208 http_request = new ActiveXObject("MSxml2.XMLHTTP"); // Version 3 1209 } catch (e) { } 1210 } 1211 } 1212 1213 if (!http_request) { 1214 alert("Unfortunately, your browser doesn't support this feature."); 1215 return false; 1216 } 1217 1218 http_request.onreadystatechange = function () { 1219 if (http_request.readyState == 4) { 1220 --ajax_call_counter; 1221 1222 //try { 1223 if (http_request.status == 200) { 1224 if (return_xml) 1225 eval(callback_function + ', http_request.responseXML)'); 1226 else { 1227 if (http_request.responseText.search(/<form action='error.asp' method=post>/i) < 0) 1228 eval(callback_function + ', http_request.responseText)'); 1229 else 1230 makeErrorRequest(url, http_request.status); 1231 } 1232 } 1233 else if (http_request.status) 1234 makeErrorRequest(url, http_request.status); 1235 //} catch (e) { 1236 // If this happens, there is no way to notify anyone 1237 // of the previous error. It might be their connection died, 1238 // or failed in some other way. 1239 1240 //alert('An error occured while reporting the previous error.'); 1241 //var USER_EXPLAIN_ERR_EN = '\n\nTechnical Details:\n' + e.name + ' - '; 1242 // IE 6 & 7: No Line Number, No Filename 1243 //if (document.all && !window.opera) { 1244 // alert(USER_EXPLAIN_ERR_EN + e.description + ' (line unavailable, code: ' + e.number + ')' + '\n\nJavaScript Callback:\n' + callback_function + ', <responseData>);'); 1245 //} 1246 // Opera and Firefox 1.5+: Line Number + Filename 1247 //else { 1248 // alert(USER_EXPLAIN_ERR_EN + e.message + '\n' + e.fileName + ', line ' + e.lineNumber + '\n\nJavaScript Callback:\n' + callback_function + ', <responseData>);'); 1249 //} 1250 //} 1251 1252 http_request = null; 1253 } 1254 } 1255 1256 http_request.open("GET", url, true); 1257 http_request.send(null); 1258} 1259// Invoked on window.onunload for pages using synchronous AHAH. 1260// Catches switches to different pages and window closes. 1261// -=-=-=-=- 1262// Note: It is synchronous instead of asynchronous to ensure 1263// the operation completes before a close. This is SHAH. 1264// 1265function destroyAHAH(e) { 1266 var http_request; 1267 1268 if (window.XMLHttpRequest) { // Mozilla, Safari, IE7 1269 http_request = new XMLHttpRequest(); 1270 if (http_request.overrideMimeType) { 1271 http_request.overrideMimeType("text/html"); 1272 } 1273 } else if (window.ActiveXObject) { // IE6 1274 try { 1275 http_request = new ActiveXObject("MSXML2.XMLHTTP.6.0"); 1276 } catch (e) { 1277 try { 1278 http_request = new ActiveXObject("MSXML2.XMLHTTP"); // Version 3 1279 } catch (e) { } 1280 } 1281 } 1282 1283 if (!http_request) return; 1284 http_request.open("GET", 'http://' + window.location.host + '/AJAX-NMenuLoader.ashx?clearCache=1', false); 1285 http_request.send(null); 1286 //alert(http_request.status + ': if 200, the session cache object was term\'d where needed be.'); 1287} 1288// End AJAX functions. 1289 1290// 1291// slideShow class 1292// vars: 1293// slideShowId constructor param for the id of the image that will have the Slide Show 1294// slideShowLink constructor param for the id of the link that will be around the image that has Slide Show, use '' for no link 1295// slideShowSpeed optional constructor param for the speed of the slide show, default = 5000 1296// filterName optional constructor param for the IE filter, default = blendTrans 1297// filterAttr1 optional constructor param for the IE filter, default = duration=3 1298// filterAttr2 optional constructor param for the IE filter 1299// filterAttr3 optional constructor param for the IE filter 1300// j counter for the object 1301// picArr array of pictures 1302// altArr array of alt text 1303// linkArr array of links 1304// methods: 1305// addImage(n, img, alt, caption, lngCaption, link) add an image with alt text and a link, n specifies which postion in the arrays 1306// runSlideShow() continually calls nextSlide to run the Slide Show 1307// nextSlide() applies the transition and advances the Slide Show image 1 spot in the arrays 1308// mouseOver() detects and loads that image to the Main Image Display & draws border around the slected
1308image & removed border from the Other small image icons 1309function slideShow(slideShowId, slideShowLink, slideShowSpeed, filterName, filterAttr1, filterAttr2, filterAttr3, slideShowLinkTarget, layout, externalLink) { 1310 if (!slideShowLinkTarget || slideShowLinkTarget == null || slideShowLinkTarget == "undefined" || slideShowLinkTarget == "") 1311 slideShowLinkTarget = "_self"; 1312 if (!layout || layout == null || layout == "undefined") 1313 layout = 1; 1314 1315 this.slideShowId = document.getElementById(slideShowId); 1316 1317 this.picArr = new Array(); 1318 this.altArr = new Array(); 1319 this.captionArr = new Array(); 1320 this.lngCaptionArr = new Array(); 1321 this.linkArr = new Array(); 1322 this.linkTargetArr = new Array(); 1323 var useStyle = false; 1324 var captionFilter = ""; 1325 var cssRule = false; 1326 var pos = 0; 1327 1328 //Get The filter for IE.// 1329 for (i = 0; i < document.styleSheets.length; i++) { 1330 var styles = document.styleSheets[i]; 1331 do { 1332 if (styles.href && styles.href.indexOf("style.css") > -1) { 1333 if (styles.cssRules) { 1334 cssRule = styles.cssRules[pos]; 1335 } 1336 else if (styles.rules) { 1337 cssRule = styles.rules[pos]; 1338 } 1339 } 1340 if (cssRule && cssRule.selectorText != undefined && cssRule.selectorText.indexOf('slideCaption') != -1) { 1341 useStyle = true; 1342 captionFilter = cssRule.style.filter; 1343 break; 1344 } 1345 pos++; 1346 } while (cssRule && !useStyle) 1347 if (useStyle) break; 1348 } 1349 var useStyle = $('.slideCaption').attr('class') == 'slideCaption'; 1350 1351 // If junk data causes one slideshow to fail the others should not. 1352 if (this.slideShowId == null) { 1353 this.addImage = function (n, img, alt, link, linkTarget, caption, lngCaption, externalLink) { } 1354 this.runSlideShow = function () { } 1355 this.nextSlide = function () { } 1356 this.mouseOver = function (elem, imgPath, altText) { } 1357 return; 1358 } 1359 1360 var tmpElem = document.createElement('a'); 1361 if (slideShowLink && slideShowLink != '') { 1362 do { 1363 slideShowLink = (slideShowLink).replace("%38", "&"); 1364 } while ((slideShowLink).indexOf("%38") != -1) 1365 tmpElem.href = slideShowLink; 1366 if (slideShowLinkTarget && slideShowLinkTarget != '') 1367 tmpElem.target = slideShowLinkTarget; 1368 1369 var ssID = this.slideShowId.id.replace("cvpSlideShowImage", ""); 1370 var capt = document.getElementById('slideCaption' + ssID); 1371 tmpElem.onclick = ""; 1372 if (capt && capt.children && capt.children.length > 0) 1373 capt.children[0].removeAttribute("onclick"); 1374 } 1375 else 1376 tmpElem.removeAttribute('href'); 1377 1378 this.j = 1; 1379 if (slideShowSpeed == null || slideShowSpeed == '') 1380 this.slideShowSpeed = 4000; 1381 else 1382 this.slideShowSpeed = slideShowSpeed * 1000; 1383 if (filterAttr1 == null || filterAttr1 == '') 1384 filterAttr1 = 2; 1385 if (filterName == null || filterName == '' || filterName.toLowerCase() == 'blendtrans') 1386 this.filterName = 'BlendTrans(duration=' + filterAttr1; 1387 else if (filterName.toLowerCase() != 'none') 1388 this.filterName = 'progid:DXImageTransform.Microsoft.' + filterName + ', duration=' + filterAttr1; 1389 if (filterAttr2 != null && filterAttr2 != '' && filterAttr2 != 'null') 1390 this.filterName = this.filterName + ',' + filterAttr2; 1391 if (filterAttr3 != null && filterAttr3 != '' && filterAttr3 != 'null') 1392 this.filterName = this.filterName + ',' + filterAttr3; 1393 if (filterName.toLowerCase() == 'none') 1394 this.filterName = filterName; 1395 else 1396 this.filterName = this.filterName + ')'; 1397 1398 switch (layout) { 1399 case 1: // Standard 1400 tmpElem.style.border = 'none'; 1401 tmpElem.style.background = 'transparent'; 1402 //tmpElem.style.border = 'medium none'; 1403 //tmpElem.style.background = 'transparent none repeat scroll 0% 0%'; 1404 tmpElem.id = slideShowId + '_link'; 1405 this.slideShowLink = tmpElem; 1406 this.slideShowId.parentNode.insertBefore(tmpElem, this.slideShowId); 1407 this.slideShowId.parentNode.removeChild(this.slideShowId); 1408 this.slideShowLink.appendChild(this.slideShowId); 1409 break; 1410 case 5: // StandardFiveBottom 1411 //DO NOT COPY for this case - follow 12 for a better code. 1412 //tmpElem.style.border = 'none'; 1413 //tmpElem.style.background = 'transparent'; 1414 tmpElem.style.border = 'medium none'; 1415 tmpElem.style.background = 'transparent none repeat scroll 0% 0%'; 1416 tmpElem.id = slideShowId + '_link'; 1417 this.slideShowLink = tmpElem; 1418 this.slideShowId.parentNode.insertBefore(tmpElem, this.slideShowId); 1419 //this.slideShowId.parentNode.removeChild(this.slideShowId); 1420 this.slideShowLink.appendChild(this.slideShowId); 1421 var tmpElemHTML = this.slideShowLink.innerHTML; 1422 1423 var td = this.slideShowId.parentNode.parentNode; 1424 this.slideShowId.parentNode.parentNode.removeChild(this.slideShowId.parentNode); 1425 1426 var newSection = document.createElement("div"); 1427 newSection.setAttribute("id", "SubSection1"); 1428 1429 var cpSlideShowWrapper1 = document.createElement("div"); 1430 cpSlideShowWrapper1.setAttribute("id", "cpSlideShowWrapper1"); 1431 cpSlideShowWrapper1.style.padding = "5px"; 1432 cpSlideShowWrapper1.style.background = "rgb(70, 43, 16) none repeat scroll 0% 0%"; 1433 cpSlideShowWrapper1.style.position = "relative"; 1434 cpSlideShowWrapper1.style.width = "416px"; 1435 //cpSlideShowWrapper1.style.-moz-background-clip = "border"; 1436 //cpSlideShowWrapper1.style.-moz-background-origin = "padding"; 1437 //cpSlideShowWrapper1.style.-moz-background-inline-policy = "continuous"; 1438 cpSlideShowWrapper1.style.height = "254px"; 1439 1440 var imageHead = document.createElement("div"); 1441 imageHead.style.padding = "4px"; 1442 imageHead.style.background = "rgb(241, 239, 234) none repeat scroll 0% 0%"; 1443 imageHead.style.align = "left"; 1444 imageHead.style.width = "406px"; 1445 //-moz-background-clip: border; 1446 //-moz-background-origin: padding; 1447 //-moz-background-inline-policy: continuous; 1448 imageHead.style.float = "left"; 1449 imageHead.style.height = "198px"; 1450 imageHead.style.align = "left"; 1451 1452 imageHead.innerHTML = tmpElemHTML; 1453 cpSlideShowWrapper1.appendChild(imageHead); 1454 1455 var imageRows = document.createElement("div"); 1456 imageRows.setAttribute("id", "imageRows"); 1457 imageRows.style.position = "relative"; 1458 imageRows.style.align = "left"; 1459 imageRows.style.margin = "5px 0px 0px 0px"; 1460 imageRows.style.width = "416px"; 1461 imageRows.style.float = "left"; 1462 imageRows.style.height = "42px"; 1463 imageRows.style.clear = "both"; 1464 1465 cpSlideShowWrapper1.appendChild(imageRows); 1466 newSection.appendChild(cpSlideShowWrapper1); 1467 td.appendChild(newSection); 1468 1469 this.slideShowId = document.getElementById(slideShowId); 1470 if (isie) { 1471 this.slideShowId.style.height = "100%"; 1472 this.slideShowId.style.width = "100%"; 1473 } 1474 else { 1475 this.slideShowId.setAttribute("height", "100%"); 1476 this.slideShowId.setAttribute("width", "100%"); 1477 } 1478 break; 1479 case 12: //This case would handle the new 12 image slideshow without Rotation. & with mouseover 1480 tmpElem.id = slideShowId + '_link'; 1481 this.slideShowLink = tmpElem; 1482 this.slideShowId.parentNode.insertBefore(tmpElem, this.slideShowId); 1483 this.slideShowLink.appendChild(this.slideShowId); 1484 var tmpElemHTML = this.slideShowLink.innerHTML; 1485 1486 var td = this.slideShowId.parentNode.parentNode; 1487 1488 // If the slideshow is in the middle of the page's content, we 1489 // have to keep track of its next sibling, so we put the 12-thumbnail 1490 // content in the new location. 1491 var nextSibling = this.slideShowLink.nextSibling; 1492 1493 this.slideShowId.parentNode.parentNode.removeChild(this.slideShowId.parentNode); 1494 1495 var newSection = document.createElement("div"); 1496 newSection.setAttribute("id", "SubSectionFor" + slideShowId); 1497 1498 var cpSlideShowWrapper1 = document.createElement("div"); 1499 cpSlideShowWrapper1.setAttribute("id", "cpSlideShowWrapper" + slideShowId); 1500 1501 //Remove these in-line style Height and Width after CSS changes 1502 cpSlideShowWrapper1.style.width = "441px"; 1503 cpSlideShowWrapper1.style.height = "190px"; 1504 cpSlideShowWrapper1.style.padding = "5px"; 1505 cpSlideShowWrapper1.style.position = "relative"; 1506 cpSlideShowWrapper1.style.clear = "both"; 1507 1508 var imageHead = document.createElement("div"); 1509 imageHead.setAttribute("id", "imageHead"); 1510 //Remove these in-line style Height and Width after CSS changes 1511 imageHead.style.width = "201px"; //185 px 1512 imageHead.style.height = "168px"; 1513 imageHead.style.padding = "8px"; 1514 imageHead.style.align = "left"; 1515 imageHead.style.styleFloat = "left"; 1516 imageHead.style.cssFloat = "left"; 1517 imageHead.innerHTML = tmpElemHTML; 1518 cpSlideShowWrapper1.appendChild(imageHead); 1519 1520 var imageRowsHeader = document.createElement("div"); 1521 imageRowsHeader.setAttribute("id", "imageRowsHeader"); 1522 imageRowsHeader.style.position = "relative"; 1523 imageRowsHeader.style.align = "right"; 1524 imageRowsHeader.style.styleFloat = "right"; 1525 imageRowsHeader.style.cssFloat = "right"; 1526 imageRowsHeader.style.width = "216px"; //247px 1527 imageRowsHeader.style.height = "18px"; 1528 1529 //Image Link 1530 var slideImageHeaderLink = document.createElement("a"); 1531 slideImageHeaderLink.setAttribute("href", "/gallery.aspx"); 1532 1533 //Image Header 1534 var slideImageHeader = document.createElement("img"); 1535 slideImageHeader.setAttribute("id", slideShowId + "Header"); 1536 slideImageHeader.setAttribute("src", "/images/pages/ImageHeader.jpg"); 1537 slideImageHeader.setAttribute("target", "_blank"); 1538 slideImageHeader.style.width = "198px"; //247px 1539 slideImageHeader.style.height = "18px"; 1540 slideImageHeader.setAttribute("border", "0"); 1541 1542 slideImageHeaderLink.appendChild(slideImageHeader); 1543 imageRowsHeader.appendChild(slideImageHeaderLink); 1544 1545 cpSlideShowWrapper1.appendChild(imageRowsHeader); 1546 1547 var imageRows = document.createElement("div"); 1548 imageRows.setAttribute("id", "imageRows"); 1549 imageRows.style.position = "relative"; 1550 imageRows.style.align = "right"; 1551 //imageRows.style.margin = "28px 0px 0px 0px"; 1552 imageRows.style.styleFloat = "right"; 1553 imageRows.style.cssFloat = "right"; 1554 imageRows.style.width = "216px"; //247px 1555 imageRows.style.height = "145px"; 1556 imageRows.style.padding = "4px"; 1557 1558 cpSlideShowWrapper1.appendChild(imageRows); 1559 newSection.appendChild(cpSlideShowWrapper1); 1560 1561 var scriptTag = td.firstChild; 1562 while (scriptTag) {
1563 if (scriptTag.nodeType == 1 && scriptTag.tagName == 'SCRIPT') 1564 break; 1565 scriptTag = scriptTag.nextSibling; 1566 } 1567 if (nextSibling != null) 1568 td.insertBefore(newSection, nextSibling); 1569 else 1570 td.insertBefore(newSection, scriptTag); 1571 1572 this.slideShowId = document.getElementById(slideShowId); 1573 //Remove these in-line style Height and Width after CSS changes 1574 if (isie) { 1575 this.slideShowId.style.height = "100%"; 1576 this.slideShowId.style.width = "100%"; 1577 } 1578 else { 1579 this.slideShowId.setAttribute("height", "100%"); 1580 this.slideShowId.setAttribute("width", "100%"); 1581 } 1582 break; 1583 default: 1584 break; 1585 } 1586 1587 this.addImage = function (n, img, alt, link, linkTarget, caption, lngCaption, isExternal) { 1588 if (layout == 12 && n > 11) 1589 return; // Allow only upto 12 thumbnail images for Standard 12 Bottom layout 1590 1591 if (!linkTarget || linkTarget == null || linkTarget == "undefined" || linkTarget == "") 1592 linkTarget = "_self"; 1593 1594 this.picArr[n] = new Image(); 1595 this.picArr[n].src = img; 1596 do { 1597 alt = (alt).replace("%39", "'"); 1598 } while ((alt).indexOf("%39") != -1) 1599 this.altArr[n] = alt; 1600 this.captionArr[n] = caption; 1601 this.lngCaptionArr[n] = lngCaption; 1602 1603 do { 1604 link = (link).replace("%38", "&"); 1605 } while ((link).indexOf("%38") != -1) 1606 this.linkArr[n] = link; 1607 1608 this.linkTargetArr[n] = linkTarget; 1609 1610 switch (layout) { 1611 case 5: 1612 var slideImage = document.createElement("img"); 1613 slideImage.setAttribute("id", slideShowId + n); 1614 if (isie) { 1615 slideImage.style.height = "40"; 1616 slideImage.style.width = "40"; 1617 } 1618 else { 1619 slideImage.setAttribute("height", "40"); 1620 slideImage.setAttribute("width", "40"); 1621 } 1622 if (n == 0) 1623 slideImage.setAttribute("border", "1"); 1624 else 1625 slideImage.setAttribute("border", "0"); 1626 slideImage.style.borderStyle = "solid"; 1627 slideImage.style.borderColor = "#FFFF00"; 1628 slideImage.setAttribute("src", img); 1629 slideImage.setAttribute("alt", alt); 1630 slideImage.setAttribute("link", link); 1631 slideImage.setAttribute("target", linkTarget); 1632 slideImage.setAttribute("class", "photoGalleryImgArray"); 1633 1634 if (n == 0) 1635 slideImage.style.margin = "0px 0px 0px 0px"; 1636 else 1637 slideImage.style.margin = "0px 0px 0px 6px"; 1638 this.imageRows = document.getElementById("imageRows"); 1639 this.imageRows.appendChild(slideImage); 1640 break; 1641 case 12: //This case would handle the new 12 image slideshow without Rotation. & with mouseover 1642 var slideImage = document.createElement("img"); 1643 slideImage.setAttribute("id", slideShowId + n); 1644 //Remove these in-line style 'Padding' after CSS changes 1645 if (n == 0) { 1646 if (isie) 1647 slideImage.style.cssText = "margin:6px 6px; border: 2px solid transparent; background-color: lightblue; padding: 3px; height:30px; width:30px;"; 1648 else 1649 slideImage.setAttribute('style', 'margin:6px 6px; border: 2px solid transparent; background-color: lightblue; padding: 3px; height:30px; width:30px;'); 1650 } 1651 else { 1652 if (isie) 1653 slideImage.style.cssText = "margin:6px 6px; border: 2px solid transparent ; background-color: white; padding: 3px; height:30px; width:30px;"; 1654 else 1655 slideImage.setAttribute('style', 'margin:6px 6px; border: 2px solid transparent ; background-color: white; padding: 3px;height:30px; width:30px;'); 1656 } 1657 slideImage.setAttribute("src", img); 1658 slideImage.setAttribute("alt", alt); 1659 slideImage.setAttribute("link", link); 1660 slideImage.setAttribute("target", linkTarget); 1661 slideImage.setAttribute("class", "photoGalleryImgArray"); 1662 var siObj = eval(slideShowId.replace("Image", "")); 1663 slideImage.onmouseover = function () { siObj.mouseOver(slideShowId + n, img, alt); }; 1664 1665 this.imageRows = document.getElementById("imageRows"); 1666 this.imageRows.appendChild(slideImage); 1667 break; 1668 default: 1669 break; 1670 } 1671 } 1672 1673 this.mouseOver = function (elem, imgPath, altText) { 1674 //Set the Main Display image to mouseOver Image 1675 this.slideShowId.setAttribute("src", imgPath); 1676 this.slideShowId.alt = altText; 1677 1678 //Loop through all other images and set the border to 1 1679 this.ImageRows = document.getElementById("imageRows"); 1680 this.ImageRows.Images = this.ImageRows.getElementsByTagName("img"); 1681 var j = 0; 1682 while (j < this.ImageRows.Images.length) { 1683 if (this.ImageRows.Images[j] == document.getElementById(elem)) { 1684 if (isie) 1685 this.ImageRows.Images[j].style.cssText = "margin:6px 6px; border: 2px solid transparent; background-color: lightblue; padding: 3px; height:30px; width:30px;"; 1686 else 1687 this.ImageRows.Images[j].setAttribute('style', 'margin:6px 6px; border: 2px solid transparent; background-color: lightblue; padding: 3px;height:30px; width:30px;'); 1688 } 1689 else { 1690 if (isie) 1691 this.ImageRows.Images[j].style.cssText = "margin:6px 6px; border: 2px solid transparent; background-color:white; padding: 3px;height:30px; width:30px;"; 1692 else 1693 this.ImageRows.Images[j].setAttribute('style', 'margin:6px 6px; border: 2px solid transparent; background-color:white; padding: 3px;height:30px; width:30px;'); 1694 } 1695 j++; 1696 } 1697 } 1698 1699 this.runSlideShow = function () { 1700 switch (layout) { 1701 case 12: 1702 case 5: 1703 //Do nothing, do not run a slideshow 1704 break; 1705 default: 1706 if (this.picArr.length > 1) { 1707 var self = this; // reference to get around context loss of this during setTimeout() 1708 this.timeoutId = setTimeout(function () { self.nextSlide(); self.runSlideShow(); }, this.slideShowSpeed); 1709 } 1710 break; 1711 } 1712 } 1713 1714 this.nextSlide = function () { 1715 var ssID = this.slideShowId.id.replace("cvpSlideShowImage", ""); 1716 var capt = document.getElementById('slideCaption' + ssID); 1717 var lngCapt = document.getElementById('slideCaptionLng' + ssID); 1718 if (document.all && this.slideShowId.filters && this.slideShowId.filters.length > 0 && this.filterName.toLowerCase() != 'none') { 1719 this.slideShowId.style.filter = this.filterName; 1720 this.slideShowId.filters.item(0).apply(); 1721 if (capt) { 1722 capt.style.filter = captionFilter + " " + this.filterName; 1723 capt.filters.item(capt.filters.length - 1).apply(); 1724 if (lngCapt) { 1725 lngCapt.style.filter = captionFilter + " " + this.filterName; 1726 lngCapt.filters.item(lngCapt.filters.length - 1).apply(); 1727 } 1728 } 1729 } 1730 this.slideShowId.setAttribute('src', this.picArr[this.j].src); 1731 this.slideShowId.setAttribute('alt', this.altArr[this.j]); 1732 this.slideShowId.setAttribute('title', this.altArr[this.j]); 1733 1734 var height = ''; 1735 var marginTop = useStyle ? "-61px" : "0px"; 1736 var paddingTop = "3px"; 1737 if (this.captionArr[this.j] == "") { 1738 height = "0px"; 1739 } 1740 else if (this.lngCaptionArr[this.j] == "") { 1741 height = "31px"; 1742 marginTop = useStyle ? "-35px" : "0px"; 1743 paddingTop = useStyle ? "-4px" : "0px"; 1744 } 1745 else 1746 height = useStyle ? "55px" : ""; 1747 1748 if (capt) { 1749 capt.innerHTML = useStyle ? this.captionArr[this.j] : "<strong>" + this.captionArr[this.j] + "</strong>"; 1750 capt.style.marginTop = marginTop; 1751 capt.style.height = height; 1752 capt.style.paddingLeft = useStyle ? "15px" : "5px"; 1753 capt.style.paddingRight = useStyle ? "10px" : "5px"; 1754 capt.style.paddingTop = paddingTop; 1755 1756 if (height != "0px" && lngCapt != null) { 1757 lngCapt.innerHTML = this.lngCaptionArr[this.j]; 1758 lngCapt.style.marginTop = useStyle ? "-38px" : "0px"; 1759 lngCapt.style.paddingLeft = useStyle ? "15px" : "5px"; 1760 lngCapt.style.paddingRight = useStyle ? "10px" : "5px"; 1761 lngCapt.style.paddingTop = paddingTop; 1762 lngCapt.style.overflow = 'hidden'; 1763 } 1764 else if (lngCapt != null) { 1765 lngCapt.style.marginTop = "0px"; 1766 lngCapt.innerHTML = ""; 1767 lngCapt.height = "0px"; 1768 } 1769 } 1770 1771 var slideLink = this.linkArr[this.j] 1772 var slideLinkTarget = this.linkTargetArr[this.j] 1773 if (slideLink && slideLink != '') { 1774 tmpElem.href = slideLink; 1775 this.slideShowLink.removeAttribute("onclick"); 1776 tmpElem.onclick = ""; 1777 if (capt) 1778 capt.innerHTML = useStyle ? "<a class = 'slideCaptionHyperlink' href=" + slideLink + " target = " + slideLinkTarget + ">" + this.captionArr[this.j] + "</a>" : 1779 "<a class = 'Hyperlink' href=" + slideLink + " target = " + slideLinkTarget + ">" + this.captionArr[this.j] + "</a>"; 1780 if (slideLinkTarget && slideLinkTarget != '') 1781 tmpElem.target = slideLinkTarget; 1782 } 1783 else { 1784 tmpElem.removeAttribute('href'); 1785 if (capt) 1786 capt.removeAttribute('href'); 1787 } 1788 if (document.all && this.slideShowId.filters && this.slideShowId.filters.length > 0 && filterName.toLowerCase() != 'none') { 1789 this.slideShowId.filters.item(0).play(); 1790 if (capt) { 1791 capt.filters.item(capt.filters.length - 1).play(); 1792 lngCapt.filters.item(lngCapt.filters.length - 1).play(); 1793 } 1794 } 1795 1796 var slideImageId, slideImage; 1797 if (layout == 5) { 1798 // Set the selected image's border 1799 if (this.j == 0) 1800 slideImageId = slideShowId + (this.picArr.length - 1); 1801 else 1802 slideImageId = slideShowId + (this.j - 1); 1803 slideImage = document.getElementById(slideImageId); 1804 slideImage.setAttribute("border", "0"); 1805 1806 slideImageId = slideShowId + this.j; 1807 slideImage = document.getElementById(slideImageId); 1808 slideImage.setAttribute("border", "1"); 1809 } 1810 1811 this.j++; 1812 if (this.j >= this.picArr.length) 1813 this.j = 0; 1814 } 1815} 1816 1817function validateMultiFileUpload(el, useWhiteList) { 1818 try { 1819 const fileNames = [...el.files].map(file => file.name); 1820 const xhr = new XMLHttpRequest(); 1821 xhr.open('POST', '/Utility/AreValidFileNames', false); 1822 xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); 1823 const data = new FormData();
1824 fileNames.forEach(fileName => { 1825 data.append("paths[]", fileName); 1826 }) 1827 1828 xhr.send(data); 1829 const response = JSON.parse(xhr.responseText); 1830 const isValid = response.every(x => x === true); 1831 1832 for (const fileName of fileNames) { 1833 if (!isAllowedFileExtension(fileName, useWhiteList) || !isValid) { 1834 return false; 1835 } 1836 } 1837 return true; 1838 } catch (e) { 1839 console.error(e); 1840 return false; 1841 } 1842} 1843 1844//el is the pointer to the input type="file" 1845//example usage: <input type="file" size="38" name="txtFile" onChange="validateFileUpload(this);"> 1846function validateFileUpload(el, useWhiteList) { 1847 var val = el.value; 1848 var cbox = document.getElementById(el.name + "_pdf"); 1849 if (cbox) { 1850 cbox.disabled = true; 1851 cbox.checked = false; 1852 } 1853 if (val.length > 0) { 1854 var isValid = false; 1855 if (val.indexOf(':\\fakepath\\') > -1) 1856 val = val.substring(12); 1857 $.ajax({ 1858 async: false, 1859 type: "POST", 1860 url: '/Utility/IsValidFileName', 1861 data: { path: val }, 1862 dataType: "json", 1863 success: function (response) { 1864 if (typeof (response.d) != "undefined") { 1865 response = response.d; 1866 } 1867 if (response.result == "True") 1868 isValid = true; 1869 } 1870 }); 1871 if (!isAllowedFileExtension(val, useWhiteList) || !isValid) { 1872 alert("The file you are trying to upload is not an allowed file type or has an invalid file name. These are the accepted characters: A-z 0-9 ~ ! ( ) - + = [ ] { } , . _"); 1873 var tempElem = el.cloneNode(false); 1874 tempElem.value = ""; 1875 el.parentNode.replaceChild(tempElem, el); 1876 el.focus(); 1877 return false; 1878 } 1879 if (cbox) { 1880 cbox.disabled = !isAllowedFileExtensionPDF(val); 1881 if (cbox.disabled) cbox.checked = false; 1882 } 1883 } 1884 return true; 1885} 1886 1887// Recommended you use isAllowedFileExtensionWhiteList() instead. Do not use this method 1888// where useWhiteList is false or null, that is not secure (uses blacklist rather than whitelist). 1889function isAllowedFileExtension(filename, useWhiteList) { 1890 if (filename + '' == '') 1891 return true; 1892 1893 // Cut out the path portion (why not use lastIndexOf()?). 1894 while (filename.indexOf("/", 0) > 0) 1895 filename = filename.substr(filename.indexOf("/", 0) + 1, filename.length - filename.indexOf("/", 0)) 1896 while (filename.indexOf("\\", 0) > 0) 1897 filename = filename.substr(filename.indexOf("\\", 0) + 1, filename.length - filename.indexOf("\\", 0)) 1898 1899 var lastPeriod = filename.indexOf(".", 0); 1900 var i = lastPeriod; 1901 1902 while (lastPeriod > 0) { 1903 i = lastPeriod; 1904 lastPeriod = filename.indexOf(".", i + 1); 1905 } 1906 1907 var fileExtension = (i > 0 ? filename.substr(i + 1, filename.length - i) : ""); 1908 1909 if (useWhiteList) 1910 return isAllowedFileExtensionWhiteList('.' + fileExtension) 1911 else { 1912 switch (fileExtension.toUpperCase()) { 1913 case "ASA": 1914 case "ASAX": 1915 case "ASBX": 1916 case "ASCX": 1917 case "ASP": 1918 case "ASPX": 1919 case "BAT": 1920 case "CAB": 1921 case "CF": 1922 case "CFM": 1923 case "CGI": 1924 case "COM": 1925 case "CONFIG": 1926 case "DLL": 1927 case "EXE": 1928 case "HTA": 1929 case "LHA": 1930 case "LHZ": 1931 case "MIM": 1932 case "PIF": 1933 case "PL": 1934 case "SYS": 1935 case "UUE": 1936 case "VBS": 1937 case "VXD": 1938 case "WEBINFO": 1939 case "WIZ": 1940 case "WSH": 1941 { 1942 return false; 1943 break; 1944 } 1945 default: 1946 { 1947 return true; 1948 break; 1949 } 1950 } 1951 } 1952} 1953 1954// Makes sure a file being uploaded for PDF conversion is supported. 1955// Note: Server logic should additionally chop out paths and other evil things (e.g. Windows Device Names like 'CON', 'AUX', etc). 1956function isAllowedFileExtensionPDF(filename) { 1957 //cut out the path portion 1958 while (filename.indexOf("/", 0) > 0) 1959 filename = filename.substr(filename.indexOf("/", 0) + 1, filename.length - filename.indexOf("/", 0)) 1960 while (filename.indexOf("\\", 0) > 0) 1961 filename = filename.substr(filename.indexOf("\\", 0) + 1, filename.length - filename.indexOf("\\", 0)) 1962 1963 var lastPeriod, i, fileExtension; 1964 lastPeriod = filename.indexOf(".", 0); 1965 i = lastPeriod; 1966 while (lastPeriod > 0) { 1967 i = lastPeriod; 1968 lastPeriod = filename.indexOf(".", i + 1); 1969 } 1970 1971 if (i > 0) 1972 fileExtension = filename.substr(i + 1, filename.length - i).toUpperCase(); 1973 else
1974 fileExtension = ""; 1975 1976 switch (fileExtension) { 1977 case "HTM": 1978 case "HTML": 1979 case "DOC": 1980 case "DOCX": 1981 case "XLS": 1982 case "XLSX": 1983 case "TXT": 1984 { 1985 return true; 1986 break; 1987 } 1988 default: 1989 { 1990 return false; 1991 break; 1992 } 1993 } 1994} 1995 1996// returns true if it is a valid US or Canadian zip code. 1997// supports ZIP, ZIP+4 and Canadian zip code format 1998// * intCountryCode is a ISO 3166-1 numeric value. 1999function isZipCode(strInput, intCountryCode) { 2000 var countryCodeRe = { 2001 840: /^\d{5}([\-]\d{4})?$/, // USA 2002 124: /^[ABCEGHJ-NPRSTVXY]\d[ABCEGHJ-NPRSTV-Z][ -]?\d[ABCEGHJ-NPRSTV-Z]\d$/i, //Canada 2003 36: /^(?:(?:[2-8]\d|9[0-7]|0?[28]|0?9(?=09))(?:\d{2}))$/ //Australia 2004 }; 2005 if (intCountryCode in countryCodeRe) { 2006 return countryCodeRe[intCountryCode].test(strInput); 2007 } 2008 return strInput.length > 0; 2009} 2010 2011// returns name to assign postal/zip code. 2012function getZipCodeName(intCountryCode) { 2013 if (intCountryCode == 840) // USA 2014 return 'Zip'; 2015 else// if (intCountryCode == 124) // Canada 2016 return 'Postal'; 2017} 2018 2019function updateAddressPlaceholdersForCanadinaClients(zipElementId, stateElementId) { 2020 document.getElementById(stateElementId).setAttribute('placeholder', 'Province'); 2021 document.getElementById(stateElementId).style.width = '5em'; 2022 document.getElementById(zipElementId).setAttribute('placeholder', 'Postal Code'); 2023} 2024 2025function getLowerCaseStateString() { 2026 if (intCountryCode == 124) 2027 return "province"; 2028 else// if (intCountryCode == 840) <- neutral setting (en-US). 2029 return "state"; 2030} 2031 2032// Gets card type. Will return one of the following values (or an empty string for unknown/invalid cards): 2033// * Master = M 2034// * Visa = V 2035// * Discover = D 2036// * American Express = A 2037function getCreditCardType(cardNumber) { 2038 switch (cardNumber.substr(0, 2)) { 2039 case "50": 2040 case "51": 2041 case "52": 2042 case "53": 2043 case "54": 2044 case "55": 2045 return "M"; 2046 case "65": 2047 return "D"; 2048 } 2049 switch (cardNumber.substr(0, 1)) { 2050 case "4": 2051 return "V"; 2052 } 2053 switch (cardNumber.substr(0, 4)) { 2054 case "6011": 2055 return "D"; 2056 } 2057 switch (cardNumber.substr(0, 2)) { 2058 case "34": 2059 case "37": 2060 return "A"; 2061 } 2062 2063 // Card unknown/invalid. 2064 return ''; 2065} 2066 2067// Validates credit card numbers. cardType is an optional argument. 2068function isValidCreditCardNumber(cardNumber, cardType) { 2069 var isValid = false; 2070 var ccCheckRegExp = /[^\d ]/; 2071 2072 isValid = !ccCheckRegExp.test(cardNumber); 2073 2074 if (isValid) { 2075 // Get card type if not explicitly specified. 2076 if (cardType == null) 2077 cardType = getCreditCardType(cardNumber); 2078 2079 // If unknown/unsupported/invalid card type, abort/fail. 2080 if (cardType == '') 2081 return false; 2082 2083 var cardNumbersOnly = cardNumber.replace(/ /g, ""); 2084 var cardNumberLength = cardNumbersOnly.length; 2085 var lengthIsValid = false; 2086 var patternIsValid = false; 2087 var patternRegExp; 2088 2089 switch (cardType) { 2090 case "V": 2091 { // visa 2092 lengthIsValid = (cardNumberLength == 13 || cardNumberLength == 16); 2093 patternRegExp = /^4/; 2094 break; 2095 } 2096 case "M": 2097 { // mastercard 2098 lengthIsValid = (cardNumberLength == 16); 2099 patternRegExp = /^5[0-5]/; 2100 break; 2101 } 2102 case "A": 2103 { // amercian express 2104 lengthIsValid = (cardNumberLength == 15); 2105 patternRegExp = /^3[4,7]/; 2106 break; 2107 } 2108 case "D": 2109 { // discover 2110 lengthIsValid = (cardNumberLength == 16); 2111 patternRegExp = /^6011/; 2112 break; 2113 } 2114 /*case "J": 2115 { // jcb 2116 lengthIsValid = (cardNumberLength == 15) || (cardNumberLength == 16); 2117 patternRegExp = /^[3,1800,2131]/; 2118 break; 2119 } 2120 case "C": 2121 { // diner's club 2122 lengthIsValid = (cardNumberLength == 14); 2123 patternRegExp = /^3[0,6,8]/; 2124 break; 2125 }*/ 2126 default: 2127 patternRegExp = /^$/; 2128 } 2129 2130 patternIsValid = patternRegExp.test(cardNumbersOnly); 2131 isValid = patternIsValid && lengthIsValid; 2132 } 2133 2134 if (isValid) { 2135 var numberProduct; 2136 var numberProductDigitIndex; 2137 var checkSumTotal = 0; 2138 2139 for (digitCounter = cardNumberLength - 1; digitCounter >= 0; digitCounter--) { 2140 checkSumTotal += parseInt(cardNumbersOnly.charAt(digitCounter)); 2141 digitCounter--; 2142 numberProduct = String((cardNumbersOnly.charAt(digitCounter) * 2)); 2143 for (var productDigitCounter = 0; productDigitCounter < numberProduct.length; productDigitCounter++) 2144 checkSumTotal += parseInt(numberProduct.charAt(productDigitCounter)); 2145 } 2146 2147 isValid = (checkSumTotal % 10 == 0); 2148 } 2149 2150 return isValid; 2151} 2152 2153// Confirms data given is legal. 2154function isDate(varDateToCheck) { 2155 var objDate = new dateValidator(); 2156 return objDate.dateValidate(varDateToCheck, true, 'Date'); 2157} 2158 2159// Confirms data given is legal. 2160function isDateNew(varDateToCheck) { 2161 var objDate = new dateValidator(); 2162 return objDate.dateValidateNew(varDateToCheck, true, 'Date'); 2163} 2164 2165// TODO: JavaScript - Remove this function. Better ways to handle this. 2166// Date comparison function. 2167function dateDiff(dtiDateEntered, dtiDateToday) { 2168 var date1 = new Date(); 2169 var date2 = new Date(); 2170 var diff = new Date(); 2171 // Initialize the first date 2172 var date1temp = new Date(dtiDateEntered); 2173 date1.setTime(date1temp.getTime()); 2174 // Initialize the second date 2175 var date2temp = new Date(dtiDateToday); 2176 date2.setTime(date2temp.getTime()); 2177 // sets difference date to difference of first date and second date 2178 diff.setTime(date1.getTime() - date2.getTime()); 2179 timediff = diff.getTime(); 2180 days = Math.floor(timediff / (86400000)); // 1000 * 60 * 60 * 24 2181 timediff -= days * (86400000); 2182 return days; 2183} 2184 2185// .NET JavaScript debugging function. 2186// TO-DO: Add sections for 'add_' and 'remove_' event prefixes. 2187function debugDisplayMembers(obj) { 2188 var getters = new Array(); 2189 var setters = new Array(); 2190 var others = new Array(); 2191 var sKey; 2192 2193 for (var key in obj) { 2194 sKey = key + ""; 2195 if (!((sKey.length > 0) && (sKey[0] == '_'))) { 2196 switch (sKey.substr(0, 4)) { 2197 case 'get_': 2198 getters.push(key); 2199 break; 2200 case 'set_': 2201 setters.push(key); 2202 break; 2203 default: 2204 others.push(key); 2205 } 2206 } 2207 } 2208 2209 getters.sort(); 2210 setters.sort(); 2211 others.sort(); 2212 2213 alert(others.join(", ") + "\r\n\r\n" + 2214 getters.join(", ") + "\r\n\r\n" + 2215 setters.join(", ")); 2216} 2217 2218// BEGIN PSEUDO-FORMS CODE 2219// Do not call any of these methods directly in your application code.
2220// Pseudo-forms are transparent, you shouldn't need to use these methods. 2221addEvent(window, 'load', initializePseudoForms, false); 2222 2223// Allows IE to recognize tag "subform". You cannot legally nest 2224// FORM tags inside FORM tags and at least Firefox pretends they're not 2225// in the DOM period. This is problematic, so the tag was renamed. 2226// Done for FORMS inside of FORMs trick to get around ASP.NET form limitations 2227// for content we cannot control (User Pages, Info Advanced HTML, etc). 2228document.createElement('subform'); 2229 2230// Initialize pseudo-forms. Called on window load. 2231function initializePseudoForms() { 2232 // Make sure we're in an HTML document (not XUL). 2233 if (document.body) { 2234 var subForms = document.body.getElementsByTagName('subform'); 2235 for (var i = 0; i < subForms.length; i++) 2236 setupPseudoForm(subForms[i]); 2237 } 2238} 2239 2240// Sets up pseudo-form. 2241function setupPseudoForm(pseudoFormElement) { 2242 // Re-routes form submission elements (no javascript used/necessary). 2243 // (those being input.type=submit, button.type=submit, and input.type=image) 2244 var rerouteElement = function (input, pseudoFormElement, newTagName, newType, copyInnerHTML) { 2245 var replacement = document.createElement(newTagName); 2246 replacement.setAttribute('type', newType); 2247 var onClickDest, onClickSrc = replacement.getAttribute('onclick'); 2248 if (onClickSrc != null) 2249 replacement.removeAttribute('onclick'); 2250 cloneAttributes(input, replacement); 2251 if (onClickSrc != null) { 2252 eval("window.tmp = function(event) { " + onClick + " }"); 2253 onClickSrc = window.tmp; 2254 window.tmp = null; 2255 onClickDest = function (ev) { 2256 ev = (window.event ? window.event : ev); 2257 if (onClickSrc(ev) == false) 2258 return; 2259 pseudoFormElement._submitter = replacement; 2260 pseudoFormElement._submevent = ev; 2261 pseudoFormElement.submit(); 2262 } 2263 } 2264 else { 2265 onClickDest = function (ev) { 2266 ev = (window.event ? window.event : ev); 2267 pseudoFormElement._submitter = replacement; 2268 pseudoFormElement._submevent = ev; 2269 pseudoFormElement.submit(); 2270 } 2271 } 2272 2273 // Return replacement routine. 2274 var fn = function () { 2275 var inputParent = input.parentNode; 2276 var inputRightAfter = input.nextSibling; 2277 var inputDisabled = input.disabled; // For Internet Explorer (it forgets). 2278 var inputHTML = (copyInnerHTML ? input.innerHTML : null); 2279 inputParent.removeChild(input); input = null; 2280 if (copyInnerHTML) 2281 replacement.innerHTML = inputHTML; 2282 inputParent.insertBefore(replacement, inputRightAfter); 2283 replacement.disabled = inputDisabled; 2284 addEvent(replacement, 'click', onClickDest, false); 2285 } 2286 return fn; 2287 } 2288 2289 // Re-route submits (needs to be done early on). 2290 var inputs, input, inc, repls; 2291 repls = new Array();
2292 inputs = pseudoFormElement.getElementsByTagName('input'); 2293 for (var i = 0; i < inputs.length; i++) { 2294 input = inputs[i]; 2295 switch (input.type.toLowerCase()) { 2296 case 'submit': 2297 repls.push(rerouteElement(input, pseudoFormElement, 'input', 'button', false)); 2298 break; 2299 case 'image': 2300 repls.push(rerouteElement(input, pseudoFormElement, 'img', 'image', false)); 2301 break; 2302 } 2303 } 2304 inputs = pseudoFormElement.getElementsByTagName('button'); 2305 for (var i = 0; i < inputs.length; i++) { 2306 input = inputs[i]; 2307 switch (input.type.toLowerCase()) { 2308 case 'submit': 2309 repls.push(rerouteElement(input, pseudoFormElement, 'button', 'button', true)); 2310 break; 2311 } 2312 } 2313 for (var i = 0; i < repls.length; i++) 2314 repls[i](); 2315 2316 // Implement properties for pseudo-form. 2317 var name = pseudoFormElement.getAttribute('name'); 2318 if (name && name != '') { 2319 document[name] = pseudoFormElement; 2320 document.forms[name] = pseudoFormElement; 2321 } 2322 pseudoFormElement.method = pseudoFormElement.getAttribute('method'); 2323 if (pseudoFormElement.method == null || pseudoFormElement.method == '') 2324 pseudoFormElement.method = 'get'; 2325 pseudoFormElement.enctype = pseudoFormElement.getAttribute('enctype'); 2326 if (pseudoFormElement.enctype == null || pseudoFormElement.enctype == '') 2327 pseudoFormElement.enctype = 'application/x-www-form-urlencoded'; 2328 pseudoFormElement.target = pseudoFormElement.getAttribute('target'); 2329 pseudoFormElement.action = pseudoFormElement.getAttribute('action'); 2330 pseudoFormElement.acceptCharset = pseudoFormElement.getAttribute('accept-charset'); 2331 2332 // Initialize. 2333 var elements = new Array(); // elements in pseudo-form (for form.elements). 2334 var simpleInputs = new Array(); // simple value inputs and textareas, no additional logic. 2335 var stateInputs = new Array(); // checkboxes and radiobuttons. 2336 var dropdowns = new Array(); // drop-downs and lists. 2337 pseudoFormElement.elements = elements; 2338 pseudoFormElement._simple = simpleInputs; 2339 pseudoFormElement._state = stateInputs; 2340 pseudoFormElement._dropdown = dropdowns; 2341 2342 // Registers element for the pseudo-form. 2343 var registerElement = function (input) { 2344 // Add to elements array. 2345 elements.push(input); 2346 // Add as property. 2347 if (input.name != '' && input.name != null) { 2348 obj = pseudoFormElement[input.name]; 2349 if (obj == null) 2350 pseudoFormElement[input.name] = input; 2351 else if (obj instanceof Array) 2352 obj.push(input); 2353 else { 2354 var arr = new Array(); 2355 arr.push(obj); 2356 arr.push(input); 2357 pseudoFormElement[input.name] = arr; 2358 } 2359 } 2360 } 2361 2362 // Add methods (can be overridden by form elements /w same names, just like real forms). 2363 pseudoFormElement.submit = function () { submitPseudoForm(this, false); } 2364 pseudoFormElement.reset = document.aspnetForm.reset; // HACK (we'll fix it if someone complains) 2365 2366 // Register elements, and categorize them for form submission. 2367 inputs = pseudoFormElement.getElementsByTagName('input'); 2368 for (var i = 0; i < inputs.length; i++) { 2369 input = inputs[i]; 2370 switch (input.type.toLowerCase()) { 2371 case 'checkbox': 2372 case 'radio': 2373 stateInputs.push(input); 2374 registerElement(input); 2375 break; 2376 case 'text': 2377 case 'hidden': 2378 case 'password': 2379 simpleInputs.push(input); 2380 registerElement(input); 2381 break; 2382 default: 2383 registerElement(input); 2384 } 2385 } 2386 inputs = pseudoFormElement.getElementsByTagName('textarea'); 2387 for (var i = 0; i < inputs.length; i++) { 2388 input = inputs[i]; 2389 simpleInputs.push(input); 2390 registerElement(input); 2391 } 2392 inputs = pseudoFormElement.getElementsByTagName('select'); 2393 for (var i = 0; i < inputs.length; i++) { 2394 input = inputs[i]; 2395 dropdowns.push(input); 2396 registerElement(input); 2397 } 2398 inputs = pseudoFormElement.getElementsByTagName('button'); 2399 for (var i = 0; i < inputs.length; i++) 2400 registerElement(inputs[i]); 2401} 2402 2403// Copies attributes from one element to another. Copy should occur 2404// before destElement is added to the DOM, as some things become read-only. 2405// ID and CLASS need to be handled specially for compatiblity reasons. 2406// Warning: TYPE is not supported (blame IE)! 2407function cloneAttributes(srcElement, destElement) { 2408 var attr; 2409 for (var i = 0; i < srcElement.attributes.length; i++) { 2410 attr = srcElement.attributes[i];
2411 switch (attr.name.toLowerCase()) { 2412 case 'name': 2413 if ((attr.value + '').toLowerCase() == 'submit') 2414 destElement.setAttribute('name', 'submit_button'); 2415 else 2416 destElement.setAttribute('name', attr.value); 2417 break; 2418 case 'class': 2419 destElement.className = attr.value; 2420 break; 2421 case 'id': 2422 destElement.id = attr.value; 2423 break; 2424 case 'type': 2425 case 'form': 2426 break; 2427 default: 2428 try { destElement.setAttribute(attr.name, attr.value); } 2429 catch (e) { } 2430 } 2431 } 2432} 2433 2434// Called by pseudo-form when submit() is invoked. 2435function submitPseudoForm(pseudoFormElement, debugMode) { 2436 var inputs, input; 2437 var spawner = pseudoFormElement._submitter; 2438 var spawnerEvent = pseudoFormElement._submevent; 2439 pseudoFormElement._submitter = null; 2440 pseudoFormElement._submevent = null; 2441 2442 // Destroy form if it already exists (possible if target not implicit/explicit "_self"). 2443 if (pseudoFormElement._form != null) 2444 document.body.removeChild(pseudoFormElement._form); 2445 pseudoFormElement._form = null; 2446 2447 // Fire pseudo-onsubmit event (remember that just like in real forms, only fires on non-J/S submits). 2448 var onsubmit = pseudoFormElement.getAttribute('onsubmit'); 2449 if (onsubmit != null && onsubmit != '' && spawnerEvent) { 2450 eval("window.tmp = function(event) { " + onsubmit + " }"); 2451 onsubmit = window.tmp; 2452 window.tmp = null; 2453 if (onsubmit(spawnerEvent) == false) 2454 return false; 2455 } 2456 2457 // Create actual form to forward submission to. 2458 var newForm = document.createElement('form'); 2459 pseudoFormElement._form = newForm; 2460 2461 // Transfer some standard HTML/XHTML attributes. 2462 newForm.dir = pseudoFormElement.dir; 2463 newForm.lang = pseudoFormElement.lang; 2464 newForm.title = pseudoFormElement.title; 2465 2466 // Setup actual form action, accept, accept-charset, encoding, method, and target. 2467 var action = pseudoFormElement.getAttribute('action'); 2468 var method = pseudoFormElement.getAttribute('method'); 2469 var target = pseudoFormElement.getAttribute('target'); 2470 var enctype = pseudoFormElement.getAttribute('enctype'); 2471 var accept = pseudoFormElement.getAttribute('accept'); 2472 var acceptCharset = pseudoFormElement.getAttribute('accept-charset'); 2473 if (action) 2474 newForm.action = action; 2475 if (method) 2476 newForm.method = method; 2477 if (target) 2478 newForm.target = target; 2479 if (enctype) 2480 newForm.enctype = enctype; 2481 if (accept) 2482 newForm.accept = accept; 2483 if (acceptCharset) 2484 newForm.acceptCharset = acceptCharset; 2485 2486 // Method used to create hidden input copies. 2487 var newHiddenInput = function (name, value) { 2488 var ret = document.createElement('input'); 2489 ret.type = 'hidden'; 2490 ret.value = value; 2491 ret.name = name; 2492 newForm.appendChild(ret); 2493 } 2494 2495 // Create element for spawner if one exists (submitted w/o JS, e.g. input.type=submit). 2496 if (spawner && spawner.name != null && spawner.name != '') 2497 newHiddenInput(spawner.name, spawner.value); 2498 2499 // Forward text, textarea, hidden, and password input values. 2500 inputs = pseudoFormElement._simple; 2501 for (var i = 0; i < inputs.length; i++) { 2502 input = inputs[i]; 2503 if ((!input.disabled) && (input.style.display != 'none')) 2504 newHiddenInput(input.name, input.value); 2505 } 2506 2507 // Forward checkbox and radio-button values. 2508 inputs = pseudoFormElement._state; 2509 for (var i = 0; i < inputs.length; i++) { 2510 input = inputs[i]; 2511 if ((!input.disabled) && (input.style.display != 'none')) { 2512 if (input.checked) 2513 newHiddenInput(input.name, input.value); 2514 } 2515 } 2516 2517 // Forward drop-down/list selections. 2518 // Blame for text/value condition and necessity of options loop lies with IE. 2519 // 1) Specifically, IE 7 and IE 7 mode don't give the implicit value if it's left off. 2520 // 2) IE 8 should support retrieval of all values from the select.value prop, but doesn't. 2521 inputs = pseudoFormElement._dropdown; 2522 for (var i = 0; i < inputs.length; i++) { 2523 input = inputs[i]; 2524 if ((!input.disabled) && (input.style.display != 'none')) { 2525 for (var j = 0; j < input.options.length; j++) { 2526 if (input.options[j].selected) { 2527 if (input.options[j].value == '') 2528 newHiddenInput(input.name, input.options[j].text); 2529 else 2530 newHiddenInput(input.name, input.options[j].value); 2531 } 2532 } 2533 } 2534 } 2535 2536 document.body.appendChild(newForm); 2537 if (debugMode) 2538 alert(newForm.innerHTML); 2539 newForm.submit(); 2540} 2541// END PSEUDO-FORMS CODE 2542 2543function phoneStripFormatting(value) { 2544 /// <summary>Strips formatting characters (for display purposes only) from the NANP phone number given.</summary> 2545 /// <param name="value" type="String">Phone number.</summary> 2546 /// <returns type="String">Phone number with formatting cahracter removed.</returns> 2547 return (value + '').replace(/\(/g, '').replace(/\)/g, '').replace(/\s/g, '').replace(/\-/g, ''); 2548} 2549 2550function phoneReformat(value, delim) { 2551 /// <summary>Reformats a number for display purposes using delimiter specified.</summary> 2552 /// <param name="value" type="String">The phone number.</summary> 2553 /// <param name="delim" type="String">The delimiter used. If argument is not passed, a hyphen is used.</summary> 2554 /// <returns type="String">Reformatted phone number.</returns> 2555 value = phoneStripFormatting(value); 2556 2557 if (delim == null) 2558 delim = '-'; 2559 2560 return value.substr(0, 3) + delim + value.substr(3, 3) + delim + value.substr(6) 2561} 2562 2563function phoneObfuscate(value, secret, delim) { 2564 /// <summary>Reformats a number for display purposes, obfuscating the first 6 digits.</summary> 2565 /// <param name="value" type="String">The phone number.</summary> 2566 /// <param name="secret" type="String">The obfuscation character or string to use in place of a digit in the number. If argument is not pased, a asterisk is used.</summary> 2567 /// <param name="delim" type="String">The delimiter used. If argument is not passed, a hyphen is used.</summary> 2568 /// <returns type="String">Reformatted, obfuscated phone number.</returns> 2569 value = phoneStripFormatting(value); 2570 2571 if (secret == null) 2572 secret = '*'; 2573 2574 if (delim == null) 2575 delim = '-'; 2576 2577 secret = secret + secret + secret + delim; 2578 return secret + secret + value.substr(6); 2579} 2580 2581function phoneValidate(value, intCountryCode) { 2582 /// <summary>Validates that phone numbers appear to adhere to the NANP format (North American Numbering Plan).</summary> 2583 /// <remarks> 2584 /// Expects area code to be present, and no country code (e.g. 555-555-0123 is valid, 1-555-555-0123 is not).
2585 /// Does not validate that numbers are legal (e.g. area code 123 is invalid, area codes cannot begin with 1). 2586 /// </remarks> 2587 /// <param name="value" type="String">Phone number.</summary> 2588 /// <returns type="Boolean">Whether or not number passed a basic format validation.</returns> 2589 value = phoneStripFormatting(value); 2590 if (value.length == 10) 2591 return numbersOnly.test(value); 2592 else if (value.length == 8 && intCountryCode == 36) //For Australia 2593 return numbersOnly.test(value); 2594 else 2595 return false; 2596} 2597 2598//gets the cookie, if it exists 2599function getCookieValue(cookiename) { 2600 var ck = document.cookie; 2601 var cn = cookiename + "="; 2602 var pos = ck.indexOf(cn); 2603 2604 if (pos != -1) { 2605 var start = pos + cn.length; 2606 var end = ck.indexOf(";", start); 2607 if (end == -1) end = ck.length; 2608 var cookieValue = ck.substring(start, end); 2609 return (cookieValue); 2610 } 2611 2612 return (null); 2613} 2614 2615window['getCookieValue'] = getCookieValue; 2616 2617function setCookieValue(cname, cvalue, exdays) { 2618 var d = new Date(); 2619 d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); 2620 var expires = "expires=" + d.toUTCString(); 2621 document.cookie = cname + "=" + cvalue + "; " + expires + "; path=/"; 2622} 2623 2624//Gets no of days between 2 dates provided in a string format('mm/dd/yyyy') 2625function dayDifference(first, second) { 2626 return Math.floor((Date.parse(first) - Date.parse(second)) / 86400000); 2627} 2628 2629// Returns whether or not file extension given is acceptable. 2630// Client-side version of FileSystemSafety.IsAllowedFileExtension(). 2631function isAllowedFileExtensionWhiteList(ext) { 2632 2633 // Check if the URL contains the string "Admin" 2634 const allowed = window.location.pathname.toLowerCase().startsWith("/admin") ? 1 : 0; 2635 2636 if (!window.acceptedFileExtensions) { 2637 window.acceptedFileExtensions = 2638 { 2639 '.123': 1, '.3g2': 1, '.3gp': 1, '.3gp2': 1, '.7z': allowed, '.aac': 1, '.abw': 1, '.abx': 1, '.accdb': 1, '.accde': 1, 2640 '.accdr': 1, '.accdt': 1, '.accfl': 1, '.ace': allowed, '.ade': 1, '.adp': 1, '.aeh': 1, '.ai': 1, '.aif': 1, '.aiff': 1, 2641 '.amr': 1, '.apng': 1, '.arc': allowed, '.art': 1, '.asc': 1, '.asf': 1, '.asx': 1, '.atom': 1, '.au': 1, '.avi': 1, 2642 '.awt': 1, '.azw': 1, '.azw1': 1, '.b64': 1, '.backup': 1, '.bin': 1, '.bmp': 1, '.bz': 1, '.bz2': 1, '.bzip': 1, 2643 '.bzip2': allowed, '.cab': allowed, '.cad': 1, '.caf': 1, '.cal': 1, '.cgm': 1, '.crtx': 1, '.css': 1, '.csv': 1, '.cwk': 1, '.dap': 1, '.db': 1, 2644 '.dbf': 1, '.dcr': 1, '.dds': 1, '.dex': 1, '.dib': 1, '.dif': 1, '.diz': 1, '.dmg': 1, '.doc': 1, '.docm': 1, 2645 '.docx': 1, '.dot': 1, '.dotm': 1, '.dotx': 1, '.drw': 1, '.ds_store': 1, '.dv': 1, '.dvr-ms': 1, '.dwf': 1, '.dwg': 1, 2646 '.dxf': 1, '.emf': 1, '.eml': 1, '.emlx': 1, '.emz': 1, '.eot': 1, '.eps': 1, '.fbp': 1, '.fdp': 1, '.fhtml': 1, 2647 '.file': 1, '.flac': 1, '.flc': 1, '.fli': 1, '.flp': 1, '.flv': 1, '.fm': 1, '.fm2': 1, '.fm3': 1, '.fm5': 1, 2648 '.fmp': 1, '.fnt': 1, '.fon': 1, '.fp': 1, '.fp3': 1, '.fp5': 1, '.fp7': 1, '.fphtml': 1, '.fpt': 1, '.fpweb': 1, 2649 '.fpx': 1, '.gg': 1, '.gif': 1, '.gnumeric': 1, '.gra': 1, '.gsm': 1, '.gz': allowed, '.hdmov': 1, '.hdp': 1, '.hqx': 1, 2650 '.htm': 1, '.html': 1, '.ical': 1, '.icns': 1, '.ico': 1, '.ics': 1, '.ifo': 1, '.indd': 1, '.isf': 1, '.isu': 1, 2651 '.ivs': 1, '.jbf': 1, '.jfif': 1, '.jpe': 1, '.jpeg': 1, '.jpf': 1, '.jpg': 1, '.jxr': 1, '.key': 1, '.kml': 1, '.kmz': 1, 2652 '.knt': 1, '.kth': 1, '.lhz': 1, '.lit': 1, '.log': 1, '.lrc': 1, '.lrf': 1, '.lrx': 1, '.lst': 1, '.lyr': 1, 2653 '.m4a': 1, '.m4b': 1, '.m4p': 1, '.m4r': 1, '.mdb': 1, '.mde': 1, '.mht': 1, '.mhtml': 1, '.mid': 1, '.midi': 1, 2654 '.mim': 1, '.mix': 1, '.mng': 1, '.mobi': 1, '.mod': 1, '.moi': 1, '.mov': 1, '.movie': 1, '.mp3': 1, '.mp4': 1, 2655 '.mpa': 1, '.mpc': 1, '.mpe': 1, '.mpeg': 1, '.mpg': 1, '.mpv2': 1, '.msg': 1, '.mswmm': 1, '.mxd': 1, '.numbers': 1, 2656 '.odb': 1, '.odf': 1, '.odg': 1, '.ods': 1, '.odx': 1, '.ofm': 1, '.oft': 1, '.ogg': 1, '.ogm': 1, '.ogv': 1, 2657 '.one': 1, '.onepkg': 1, '.opx': 1, '.osis': 1, '.ost': 1, '.otf': 1, '.oth': 1, '.p65': 1, '.p7b': 1, '.pages': 1, 2658 '.pbm': 1, '.pcast': 1, '.pcf': 1, '.pcm': 1, '.pct': 1, '.pcx': 1, '.pdc': 1, '.pdd': 1, '.pdf': 1, '.pdp': 1, 2659 '.pfx': 1, '.pgf': 1, '.pic': 1, '.pict': 1, '.pkg': 1, '.pmd': 1, '.pmf': 1, '.png': 1, '.pot': 1, '.pothtml': 1, 2660 '.potm': 1, '.potx': 1, '.ppam': 1, '.pps': 1, '.ppsm': 1, '.ppsx': 1, '.ppt': 1, '.ppthtml': 1, '.pptm': 1, '.pptx': 1, 2661 '.prc': 1, '.ps': 1, '.psd': 1, '.psp': 1, '.pspimage': 1, '.pst': 1, '.pub': 1, '.pubhtml': 1, '.pubmhtml': 1, '.qbb': 1, 2662 '.qcp': 1, '.qt': 1, '.qxd': 1, '.qxp': 1, '.ra': 1, '.ram': 1, '.ramm': 1, '.rar': allowed, '.raw': 1, '.rax': 1, 2663 '.rm': 1, '.rmh': 1, '.rmi': 1, '.rmm': 1, '.rmvb': 1, '.rmx': 1, '.rp': 1, '.rss': 1, '.rt': 1, '.rtf': 1, 2664 '.rts': 1, '.rv': 1, '.sbx': 1, '.sdf': 1, '.sea': 1, '.shs': 1, '.sit': 1, '.sitx': 1, '.smil': 1, '.snapfireshow': 1, 2665 '.snp': 1, '.stc': 1, '.svg': 1, '.svgz': 1, '.swf': 1, '.sxc': 1, '.sxi': 1, '.tab': 1, '.tar': allowed, '.tex': 1, 2666 '.tga': 1, '.thmx': 1, '.tif': 1, '.tiff': 1, '.tpz': 1, '.tr': 1, '.trm': 1, '.tsv': 1, '.ttf': 1, '.txt': 1, 2667 '.uue': 1, '.vcf': 1, '.vob': 1, '.vrml': 1, '.vsc': 1, '.vsd': 1, '.wab': 1, '.wav': 1, '.wax': 1, '.wbk': 1, 2668 '.wbmp': 1, '.wdp': 1, '.webarchive': 1, '.webloc': 1, '.wk1': 1, '.wk3': 1, '.wm': 1, '.wma': 1, '.wmf': 1, '.wmmp': 1, 2669 '.wmv': 1, '.wmx': 1, '.wpd': 1, '.wps': 1, '.wri': 1, '.wvx': 1, '.xbm': 1, '.xcf': 1, '.xg0': 1, '.xg1': 1, 2670 '.xg2': 1, '.xg3': 1, '.xg4': 1, '.xht': 1, '.xhtm': 1, '.xhtml': 1, '.xif': 1, '.xlam': 1, '.xlb': 1, '.xlc': 1, 2671 '.xld': 1, '.xlk': 1, '.xlm': 1, '.xls': 1, '.xlsb': 1, '.xlshtml': 1, '.xlsm': 1, '.xlsmhtml': 1, '.xlsx': 1, '.xlt': 1, 2672 '.xlthtml': 1, '.xltm': 1, '.xltx': 1, '.xlv': 1, '.xlw': 1, '.xml': 1, '.xpi': 1, '.xps': 1, '.xsf': 1, '.xsn': 1, 2673 '.xtp': 1, '.zabw': 1, '.zip': allowed, '.zipx': allowed 2674 }; 2675 } 2676 2677 return (window.acceptedFileExtensions[(ext + '').toLowerCase()] === 1); 2678} 2679 2680function handleServiceMethodError(error) { 2681 throw new Error('A server-side error occurred during the execution of an AJAX request (' + 2682 error.get_exceptionType() + 2683 ')!\r\n\r\nAdditional Information:\r\n' + 2684 error.get_message() + 2685 '\r\n\r\nStack Trace:\r\n' + 2686 error.get_stackTrace().trim()); 2687} 2688 2689function toggleDisplay(elem) { 2690 elem.style.display = 2691 (elem.style.display == 'none' ? '' : 'none'); 2692} 2693 2694// BEGIN Old Character Counter 2695var APENDED_TEXT_LEN = typeof intCountryCode !== 'undefined' && intCountryCode === 840 && typeof FeatureToggles !== 'undefined' ? 9 : 0; 2696var MAX_MESSAGE_SIZE_SMS = 160 - APENDED_TEXT_LEN; 2697var trackLengths = new Array(); 2698 2699function registerCharCounter(input, outputElemID, maxMessageSize) { 2700 var outputElem = document.getElementById(outputElemID); 2701 var id = input.id; 2702 var tracker; 2703 2704 tracker = new Object(); 2705 tracker.oldLength = -1; 2706 tracker.outputElem = outputElem; 2707 tracker.input = input; 2708 trackLengths[id] = tracker; 2709 2710 setInterval( 2711 'var tracker = trackLengths[\'' + id + '\'];\r\n' + 2712 'var newLength = (tracker.input.value + \'\').length;\r\n' + 2713 'if (newLength != tracker.oldLength) {\r\n' + 2714 ' if (newLength > ' + maxMessageSize + ')' + 2715 ' tracker.outputElem.innerHTML = (newLength - ' + maxMessageSize + ') + " Characters Over";\r\n' + 2716 ' else\r\n' + 2717 ' tracker.outputElem.innerHTML = (' + maxMessageSize + ' - newLength) + " Characters Remaining";\r\n' + 2718 ' \r\n' + 2719 ' tracker.oldLength = newLength;\r\n' + 2720 '}\r\n', 100); 2721} 2722// END Old Character Counter 2723 2724function elemInsideOrEq(elemFirst, elemSecond) { 2725 /// <summary>Gets whether or not second element specified is inside or is equal to first element.</summary> 2726 /// <param name="elemFirst" type="domElement">First element.</param> 2727 /// <param name="elemSecond" type="domElement">Second element.</param> 2728 if (elemFirst == elemSecond) 2729 return true; 2730 2731 if (elemFirst && elemSecond) { 2732 elemSecond = elemSecond.parentNode; 2733 2734 while (elemSecond != null) { 2735 if (elemSecond == elemFirst) 2736 return true; 2737 2738 elemSecond = elemSecond.parentNode; 2739 } 2740 } 2741 2742 return false; 2743} 2744 2745// Do not use in new code. Use jQuery with event.preventDefault(). 2746function hookAnchorClick(anchor, fn) { 2747 /// <summary>Hooks an anchor onclick and prevents default HREF behavior.</summary> 2748 /// <param name="anchor" type="domElement">The DOM element to attach the event handler for.</param> 2749 /// <param name="fn" type="Function">Function to be called when anchor is clicked. Should have sender and event argument, in that order.</param> 2750 var clickHandler = function (event) { 2751 var sender; 2752 2753 if (window.event) { 2754 event = window.event; 2755 sender = event.srcElement; 2756 } 2757 else 2758 sender = event.target; 2759 2760 fn(sender, event); 2761 2762 if (event.stopPropagation) 2763 event.stopPropagation(); 2764 else 2765 event.cancelBubble = true; 2766 2767 return false; 2768 } 2769 2770 // HACK: MSIE/Opera onclick fails to operate correctly. 2771 if (isie || isie8 || isie7 || isie6 || (document.documentMode < 8) || window.opera) 2772 anchor.onmousedown = clickHandler; 2773 else
2774 anchor.onclick = clickHandler; 2775} 2776 2777// For ClientCharacterCounter control. 2778var registeredCounters = null; 2779function registerCounter(assocElem, counterElem, fmtStandard, fmtOver, maxChars) { 2780 if (assocElem == null || counterElem == null || maxChars == null || fmtStandard == null || fmtOver == null) 2781 return; 2782 2783 if (registeredCounters == null) { 2784 registeredCounters = []; 2785 2786 setInterval(function () { 2787 for (var i = 0, l = registeredCounters.length; i < l; i++) { 2788 if (registeredCounters[i].counter && registeredCounters[i].input) { 2789 var len; 2790 if (typeof registeredCounters[i].input.value === 'undefined') 2791 len = registeredCounters[i].input.val().length; 2792 else 2793 len = registeredCounters[i].input.value.length; 2794 var prevLen = registeredCounters[i].prevLen; 2795 2796 if (len == prevLen) 2797 continue; 2798 else { 2799 registeredCounters[i].prevLen = len; 2800 2801 var max = registeredCounters[i].maxChars; 2802 var numToDisplay = max - len; 2803 2804 var fmtToUse = (numToDisplay >= 0 2805 ? registeredCounters[i].fmtStandard 2806 : registeredCounters[i].fmtOver); 2807 2808 if (numToDisplay >= 0) 2809 registeredCounters[i].counter.className = 'counterUnderLimit'; 2810 else 2811 registeredCounters[i].counter.className = 'counterOverLimit'; 2812 2813 numToDisplay = Math.abs(numToDisplay); 2814 2815 registeredCounters[i].counter.innerHTML = fmtToUse 2816 .replace(/\{0\}/g, numToDisplay) 2817 .replace(/\{1\}/g, (numToDisplay == 1 ? '' : 's')); 2818 } 2819 } 2820 } 2821 }, 100); 2822 } 2823 2824 registeredCounters.push({ 2825 "fmtStandard": fmtStandard, 2826 "fmtOver": fmtOver, 2827 "counter": counterElem, 2828 "input": assocElem, 2829 "prevLen": -1, 2830 "maxChars": maxChars 2831 }); 2832} 2833 2834// Detects if nextElementSibling/previousElementSibling are present. 2835function detectElementSiblingSupport() { 2836 var p = document.createElement('div'); 2837 var c1 = document.createElement('div'); 2838 var c2 = document.createElement('div'); 2839 2840 p.appendChild(c1); 2841 p.appendChild(c2); 2842 2843 return (c1.nextElementSibling != null); 2844} 2845 2846// Gets next sibling element. Version for browsers missing nextElementSibling DOM property. 2847function nextElementSibling(elem) { 2848 elem = elem.nextSibling; 2849 2850 while (elem != null) { 2851 if (elem.nodeType == 1) 2852 return elem; 2853 2854 elem = elem.nextSibling; 2855 } 2856 2857 return null; 2858} 2859 2860// Gets previous sibling element. Version for browsers missing previousElementSibling DOM property. 2861function previousElementSibling(elem) { 2862 elem = elem.previousSibling; 2863 2864 while (elem != null) { 2865 if (elem.nodeType == 1) 2866 return elem; 2867 2868 elem = elem.previousSibling; 2869 } 2870 2871 return null; 2872} 2873 2874// Gets first child element. Version for browsers missing firstElementChild DOM property. 2875function firstElementChild(elem) { 2876 elem = elem.firstChild; 2877 2878 while (elem != null) { 2879 if (elem.nodeType == 1) 2880 return elem; 2881 2882 elem = elem.nextSibling; 2883 } 2884 2885 return null; 2886} 2887 2888if (detectElementSiblingSupport()) { 2889 // If browsers support built-in DOM properties, just use those. 2890 nextElementSibling = function (elem) { return elem.nextElementSibling; } 2891 previousElementSibling = function (elem) { return elem.previousElementSibling; } 2892 firstElementChild = function (elem) { return elem.firstElementChild; } 2893} 2894 2895function haltEvent(event, windowEvent) { 2896 if (windowEvent & !window.opera) 2897 windowEvent.cancelBubble(); 2898 else { 2899 if (event.stopPropagation) 2900 event.stopPropagation(); 2901 2902 if (event.preventDefault) 2903 event.preventDefault(); 2904 } 2905} 2906 2907// Gets absolute left offset. 2908function absoluteOffsetLeft(oElem) { 2909 var oLeft = 0; 2910 2911 while (oElem != null) { 2912 oLeft += oElem.offsetLeft; 2913 oElem = oElem.offsetParent; 2914 } 2915 2916 return oLeft; 2917} 2918 2919function imposeMaxLength(e, Object, MaxLen) { 2920 //Truncate to maximum length 2921 if (Object.value.length > MaxLen) 2922 Object.value = Object.value.substring(0, MaxLen); 2923 2924 //ALLOW: BACKSPACE DELETE LEFT ARROW UP ARROW RIGHT ARROW DOWN ARROW 2925 if ((e.keyCode == '8') || (e.keyCode == '46') || (e.keyCode == '37') || (e.keyCode == '38') || (e.keyCode == '39') || (e.keyCode == '40')) 2926 return true; 2927 2928 return (Object.value.length <= MaxLen); 2929} 2930 2931function checkURL(val, showAlert) {
2932 val = TrimString(val); 2933 if (val != '' && (val.substr(0, 7) != 'http://' && val.substr(0, 8) != 'https://' && val.substr(0, 6) != 'ftp://' && val.substr(0, 1) != '/')) { 2934 if (arguments.length == 1 || showAlert) 2935 alert('All URLs must begin with http:// or https:// or ftp://.\nAll internal links must start with a /.'); 2936 2937 return false; 2938 } 2939 return true; 2940} 2941 2942function toSQLSafe(formvar) { 2943 var s = String(formvar); 2944 s = (s.replace(/'/gi, "'")).replace(/"/gi, """); 2945 return s; 2946} 2947 2948function cancelFE(needsConfirm) { 2949 if (needsConfirm) { 2950 if (!confirm("You will discard any unsaved changes. Do you want to proceed?")) 2951 return; 2952 } 2953 window.parent.closeModalDialog('editItemBehavior'); 2954 return false; 2955} 2956 2957function getThumbNailPath(path, width, height) { 2958 var lastSlashPos = path.lastIndexOf('/'); 2959 var filename = path.substr(lastSlashPos + 1); 2960 var directory = path.substr(0, lastSlashPos); 2961 var lastDotPos = filename.lastIndexOf('.'); 2962 var filenameWithOutExtension = filename.substr(0, lastDotPos) 2963 var fileExtension = filename.substr(lastDotPos) 2964 return directory + "/ThumbNails/" + filenameWithOutExtension + "_" + width + "x" + height + "_thumb" + fileExtension; 2965} 2966 2967function measureHtml(html, fontStyle) { 2968 var tmp = document.createElement('span'); 2969 tmp.style.display = 'inline'; 2970 tmp.style.position = 'absolute'; 2971 tmp.style.top = '-1000px'; 2972 tmp.style.left = '-1000px'; 2973 tmp.style.font = fontStyle; 2974 tmp.innerHTML = html; 2975 2976 document.body.appendChild(tmp); 2977 var retVal = { width: tmp.clientWidth, height: tmp.clientHeight }; 2978 document.body.removeChild(tmp); 2979 2980 return retVal; 2981} 2982 2983function fileValidateError(errorType) { 2984 if (errorType == 1) 2985 alert("A file you tried to upload was not of a permitted type. Only *.jpeg, *.jpg, *.gif, *.png, *.bmp are allowed"); 2986 else 2987 alert("You have an invalid character in your filename. These are the accepted characters: a-z 0-9 ~ !( ) - + = [ ] { } , . $"); 2988} 2989 2990function getNumericThousandsSeparator() { 2991 var dummy = new Number(11111111); 2992 var thousandSep = dummy.toLocaleString().replace(/1/g, ''); 2993 return (thousandSep.length > 0 ? thousandSep.charAt(0) : ','); 2994} 2995 2996function getNumericDecimalSeparator() { 2997 var dummy = new Number(1.1); 2998 var thousandSep = dummy.toLocaleString().replace(/1/g, ''); 2999 return (thousandSep.length > 0 ? thousandSep.charAt(0) : '.'); 3000} 3001 3002function ChangeDateFormat(elem) { 3003 if (elem.value != "") { 3004 var Error = false; 3005 var dateSplit = (elem.value).split("/"); 3006 3007 if (dateSplit.length == 3) { 3008 if (dateSplit[0] <= 12 && dateSplit[1] <= 31) { 3009 var d = new Date(elem.value); 3010 var currentDate = new Date(); 3011 3012 var selectedDate = d.getDate(); 3013 var selectedMonth = d.getMonth(); 3014 var SelectedYear = d.getFullYear(); 3015 3016 if (isNaN(selectedDate)) 3017 Error = true; 3018 else if (isNaN(selectedDate)) 3019 Error = true; 3020 else if (isNaN(selectedDate)) 3021 Error = true; 3022 if (Error == false) { 3023 if (selectedDate.toString().length == 1) 3024 selectedDate = '0' + selectedDate; 3025 3026 selectedMonth++; 3027 3028 if (selectedMonth.toString().length == 1) 3029 selectedMonth = '0' + selectedMonth; 3030 3031 currentYear = currentDate.getFullYear(); 3032 3033 if (SelectedYear.toString().substr(0, 2) < 20) 3034 SelectedYear = currentYear; 3035 elem.value = selectedMonth + '/' + selectedDate + '/' + SelectedYear; 3036 } 3037 } 3038 else 3039 Error = true; 3040 } 3041 else 3042 Error = true; 3043 3044 if (Error == true) { 3045 alert('Date should be in the format MM/DD/YYY'); 3046 elem.value = ""; 3047 } 3048 } 3049} 3050 3051function ChangeDateFormatNew(elem) { 3052 return isDateNew(elem.value); 3053} 3054 3055function isSilverlightInstalled() { 3056 var isSilverlightInstalled = false; 3057 try { 3058 //check on IE 3059 try { 3060 var slControl = new ActiveXObject('AgControl.AgControl'); 3061 isSilverlightInstalled = true; 3062 isSilverlightInstalled = true; 3063 } 3064 catch (e) { 3065 //either not installed or not IE. Check Firefox. 3066 if (navigator.plugins["Silverlight Plug-In"]) { 3067 isSilverlightInstalled = true; 3068 } 3069 } 3070 } 3071 catch (e) { 3072 //we don't want to leak exceptions. However, you may want 3073 //to add exception tracking code here. 3074 } 3075 return isSilverlightInstalled; 3076} 3077 3078function setModalClass(cssClass, behaviorID) { 3079 var modalContainer = document.getElementById(behaviorID._PopupControlID); 3080 3081 if (modalContainer) 3082 modalContainer.className = 'modalContainer modalContainerCP ' + cssClass; 3083} 3084 3085function setModalClassFE(cssClass, behaviorID) { 3086 var modalContainer = document.getElementById(behaviorID._PopupControlID); 3087 3088 if (modalContainer) 3089 modalContainer.className = 'modalContainer ' + cssClass; 3090} 3091 3092//------------------- Copy Link ---------------------// 3093function showCopyLinkWindow(relatedLink, absoluteAddress, behavior, ifrID) { 3094 if (behavior) { 3095 setModalClass('modalCopyLink', behavior); 3096 var iFrame = document.getElementById(ifrID); 3097 iFrame.src = '/common/admin/CopyLink.aspx?relatedLink=' + encodeURIComponent(relatedLink) + '&absoluteAddress=' + encodeURIComponent(absoluteAddress); 3098 iFrame.style.display = 'block'; 3099 behavior.show(); 3100 } else { 3101 openCpModal({ 3102 title: 'Copy Link', 3103 className: 'modalCopyLink', 3104 isFrontEnd: false, 3105 useIframe: true, 3106 url: '/common/admin/CopyLink.aspx?relatedLink=' + encodeURIComponent(relatedLink) + '&absoluteAddress=' + encodeURIComponent(absoluteAddress) 3107 }); 3108 } 3109} 3110 3111function showCopyLinkWindowUsingAddress(absoluteAddress) { 3112 var relatedUrl = absoluteAddress.replace(window.location.host, ''); 3113 relatedUrl = relatedUrl.replace(window.location.protocol + '//', ''); 3114 3115 var behavior = $find('copyLinkBehavior'); 3116 if (behavior) 3117 showCopyLinkWindow(relatedUrl, absoluteAddress, behavior, 'copyLinkDialog'); 3118 else
3119 showCopyLinkWindow(relatedUrl, absoluteAddress, $find('editItemBehavior'), 'liveEditDialog'); 3120} 3121 3122function showCopyLinkWindowUsingRelatedLink(relatedUrl) { 3123 var absoluteUrl = window.location.protocol + '//' + window.location.host + relatedUrl; 3124 3125 var behavior = $find('copyLinkBehavior'); 3126 if (behavior) 3127 showCopyLinkWindow(relatedUrl, absoluteUrl, behavior, 'copyLinkDialog'); 3128 else 3129 showCopyLinkWindow(relatedUrl, absoluteUrl, $find('editItemBehavior'), 'liveEditDialog'); 3130} 3131 3132function closeCopyModal() { 3133 var behavior = $find('copyLinkBehavior'); 3134 if (behavior) 3135 behavior.hide(); 3136 else { 3137 behavior = $find('editItemBehavior'); 3138 if (behavior) 3139 behavior.hide(); 3140 else 3141 closeCpModal(); 3142 } 3143} 3144//------------------- Copy Link End---------------------// 3145 3146//Parses the query string for the specified paramter and returns the value 3147//Returns "" if the parameter is not found 3148function GetQueryStringParameter(name) { 3149 name = name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); 3150 var regexS = "[\\?&]" + name + "=([^&#]*)"; 3151 var regex = new RegExp(regexS); 3152 var results = regex.exec(window.location.href); 3153 if (results == null) 3154 return ""; 3155 else 3156 return results[1]; 3157} 3158 3159function setModalTitle(title, behaviorID) { 3160 if (behaviorID) { 3161 $('#' + behaviorID._PopupControlID).find('.modalTitle').text(title); 3162 } 3163 else { 3164 //if behaviorID is not provided, do the same as setModalTitle on FrontEnd.js 3165 var titleElem = document.getElementById('ctl00_LiveEditModalTitle'); 3166 3167 if (titleElem == null) 3168 titleElem = document.getElementById('ctl00_ct100_LiveEditModalTitle'); 3169 3170 if (titleElem == null) 3171 titleElem = document.getElementById('ctl00_ctl00_NotifyMeModalTitle'); 3172 3173 if (titleElem) 3174 titleElem.innerHTML = title; 3175 } 3176} 3177 3178//------------------- Copy Link End---------------------// 3179 3180function isNull(object, replacement) { 3181 return object == null ? replacement : object; 3182} 3183 3184// Validates domain of email with service (ensures MX record present, DNS name valid, acceptable format). 3185// The callbacks object should contain the following methods: 3186// * badFormat - Email format invalid. Will also be thrown for null/empty email addresses. 3187// * mxMissing - MX record missing for the domain. 3188// * dnsError - A DNS error occurred (domain invalid, invalid characters in domain, etc). 3189// * success - The email appears to be valid. 3190function validateEmailDomain(emailAddress, callbacks) { 3191 $.ajax({ 3192 type: "POST", 3193 url: "/Services/ValidateEmail.ashx", 3194 data: { email: emailAddress }, 3195 success: function (data, textStatus, jqXHR) { 3196 switch (data.d) { 3197 case 1: 3198 callbacks.badFormat(emailAddress); 3199 break; 3200 case 2: 3201 callbacks.mxMissing(emailAddress); 3202 break; 3203 case 3: 3204 callbacks.dnsError(emailAddress); 3205 break; 3206 case 0: 3207 default: 3208 callbacks.success(emailAddress); 3209 break; 3210 } 3211 } 3212 }); 3213} 3214 3215//Called when opening action menu. 3216function openPopUp(id, event) { 3217 var $popUp = $(document.getElementById(id)); 3218 3219 if ($popUp.hasClass('popped')) { 3220 //do not do anything if popup is already open. 3221 return false; 3222 } 3223 3224 //Hide all popups already open if nesessary. 3225 $('.popUp').fadeOut(200).removeClass('popped'); 3226 $('.popUpParent').removeClass('popped'); 3227 3228 //Open popup 3229 $popUp.fadeIn(200); 3230 $popUp.addClass('popped'); 3231 $popUp.parents('.popUpParent').addClass('popped'); 3232 3233 //prevent triggering any other event. 3234 if (window.event) 3235 window.event.cancelBubble = true; 3236 else 3237 event.stopPropagation(); 3238} 3239 3240function SignIn() { 3241 window.location.href = '/MyAccount?from=url&url=' + window.location.pathname + window.location.search; 3242} 3243 3244function SignOut() { 3245 window.location.href = '/publiclogin.aspx?out=true&txtRedirect=' + window.location.pathname.substring(1) + window.location.search; 3246} 3247 3248function removeIEParagraphs(editor) { 3249 editor.attachEventHandler("onkeyup", function (e) { 3250 if (e.keyCode == 8 || e.keyCode == 46 || e.keyCode == 13) { 3251 var result = ''; 3252 var re = new RegExp("<[P]> <\\/[P]>", "gi"); 3253 3254 var m = re.exec(editor.get_html(true)); 3255 3256 if (m == null) { 3257 return; 3258 } else { 3259 result = editor.get_html(true).replace(re, '<BR>'); 3260 editor.set_html(result); 3261 } 3262 } 3263 }); 3264} 3265 3266//To toggle the slide show and image manger menu items based on if the img is a from a slide show or not. 3267function setMenuItems(editor) { 3268 var contextMenu = editor.getContextMenuByTagName("IMG"); 3269 if (!contextMenu) return; 3270 3271 //Attach to the context menu show event, obtain editor selection and determine which tools to show 3272 contextMenu.add_show(function () { 3273 //Must be an image, the context menu would not fire 3274 var sel = editor.getSelectedElement(); 3275 3276 //An array of menu item objects 3277 var menuItems = contextMenu.get_items();
3278 var menuItem = null; 3279 3280 //reset to show all and then disable the menu item based on currently selection 3281 for (i = 0; i < menuItems.length; i++) { 3282 menuItems[i].get_element().style.display = ""; 3283 menuItems[i].get_element().parentNode.style.display = ""; 3284 } //end for 3285 3286 if (sel.getAttribute("slideshowimage")) { 3287 menuItem = menuItems[menuItems.length - 3]; 3288 menuItem.get_element().style.display = "none"; 3289 menuItem.get_element().parentNode.style.display = "none"; 3290 3291 menuItem = menuItems[menuItems.length - 2]; 3292 menuItem.get_element().style.display = "none"; 3293 menuItem.get_element().parentNode.style.display = "none"; 3294 } else { 3295 menuItem = menuItems[menuItems.length - 1]; 3296 menuItem.get_element().style.display = "none"; 3297 menuItem.get_element().parentNode.style.display = "none"; 3298 } 3299 }); 3300} 3301 3302function integersOnly(e, input) { 3303 var charCode = (e.which) ? e.which : e.keyCode; 3304 3305 var keyChar = String.fromCharCode(charCode); 3306 var currentValue = $(input).val(); 3307 var allowNegativeSign = !$(input).hasClass("positive") && currentValue.indexOf('-') == -1 && (currentValue.length == 0 || currentValue == window.getSelection().toString()); 3308 if (keyChar == '-' && allowNegativeSign) 3309 return true; 3310 3311 if (charCode > 31 && (charCode < 48 || charCode > 57)) 3312 return false; 3313 3314 return true; 3315} 3316 3317function decimalOnly(e, input, skipSelected) { 3318 skipSelected = (skipSelected == undefined || skipSelected == null) ? false : skipSelected; 3319 3320 var charCode = (e.which) ? e.which : e.keyCode; 3321 3322 var keyChar = String.fromCharCode(charCode); 3323 var currentValue = $(input).val(); 3324 var hasDecimalPoint = currentValue.indexOf('.') != -1; 3325 if ((keyChar == '.' && !hasDecimalPoint)) 3326 return true; 3327 3328 if (!skipSelected && isTextSelected(input)) 3329 return true; 3330 3331 return integersOnly(e, input); 3332} 3333 3334function isTextSelected(input) { 3335 if (typeof input.selectionStart == "number") { 3336 return input.selectionStart == 0 && input.selectionEnd == input.value.length; 3337 } else if (typeof document.selection != "undefined") { 3338 input.focus(); 3339 return document.selection.createRange().text == input.value; 3340 } 3341} 3342 3343function validFileName(e) { 3344 var charCode = (e.which) ? e.which : e.keyCode; 3345 var keyChar = String.fromCharCode(charCode); 3346 var invalidCharacters = "\\/:*?\"<>|',"; 3347 3348 return invalidCharacters.indexOf(keyChar) < 0; 3349} 3350 3351function isValidURL(value) { 3352 return /^(https?:\/\/|ftp:\/\/|\/).+/i.test(value); 3353} 3354function isValidAbsoluteURL(value) { 3355 try { 3356 var parsedUrl = new URL(value, window.location.href); 3357 } catch (e) { 3358 return false; 3359 } 3360 return /^(https?|ftp):\/\//i.test(value) && /^(https?|ftp):$/.test(parsedUrl.protocol) && parsedUrl.host != ''; 3361} 3362 3363function validateLink(link) { 3364 if (link != '') { 3365 if ((link.indexOf('http://') == -1) && 3366 (link.indexOf('https://') == -1) && 3367 (link.substr(0, 1) != '/')) { 3368 return false; 3369 } 3370 } 3371 return true; 3372} 3373 3374// Check if string is a whole number(digits only). 3375function isWholeNumber(val) { 3376 return String(val).search(/^(([1-9]{1}\d{0,2},(\d{3},)*\d{3})|([1-9]{1}\d{0,}))$/) != -1; 3377} 3378 3379// Checks that an input string is a decimal number 3380function isDecimalOrZero(val) { 3381 isDecimal_re = /^\d{1,5}(\.\d{1,2})?$/; 3382 return String(val).search(isDecimal_re) != -1; 3383} 3384 3385//Allows login to CPC 3386function RebuildCSS(menu) { 3387 if (confirm('This will take some time\nand the site may look funny during the process.\nAre you sure?')) { 3388 var frmARC = document.forms.frmAdminRebuldCSS; 3389 frmARC.ysnNeedInclude.value = '1'; 3390 frmARC.intMenu.value = menu; 3391 frmARC.submit(); 3392 } 3393} 3394 3395//Allows login to CPC 3396function adminGetHelp(helpUrl, newWindow) { 3397 document.cpconnect.action = document.cpconnect.action.split('?')[0] + '?from=url&url=' + encodeURIComponent(helpUrl); 3398 cpconnecttLogin(); 3399} 3400 3401function connectCPC() { 3402 document.cpconnect.action = document.cpconnect.action.split('?')[0]; 3403 var ifr = document.createElement('iframe'); 3404 ifr.name = "submitCPCFrame"; 3405 ifr.id = "submitCPCFrame"; 3406 ifr.style.display = 'none'; 3407 var frm = $(document.cpconnect).clone().get(0);
3408 frm.name = "iframeCPCConnect" 3409 frm.target = 'submitCPCFrame'; 3410 ifr.appendChild(frm); 3411 document.body.appendChild(ifr); 3412 frm.submit(); 3413} 3414 3415function showFeatureNotAvailablePopup(hypothesisID) { 3416 var data = { 3417 id: hypothesisID 3418 }; 3419 3420 $('.emailPage').removeClass('emailPage'); 3421 3422 $.ajax({ 3423 url: '/FeatureNotAvailable/Popup', 3424 type: 'GET', 3425 data: { 3426 hypothesisID: hypothesisID 3427 }, 3428 cache: false, 3429 success: function (response) { 3430 if (response.action == 'modal') { 3431 openCpModal({ 3432 title: 'Feature Not Yet Available', 3433 className: 'featureNotAvailableModal moduleContentNew modalContainer', 3434 htmlContent: response.html, 3435 autoAdjust: true, 3436 isFrontEnd: true, 3437 elementID: 'featureNotAvailableModal' 3438 }); 3439 } else { 3440 window.location = '/FeatureNotAvailable?hypothesisID=' 3441 + hypothesisID 3442 + '&referrerUrl=' + window.location; 3443 } 3444 }, 3445 beforeSend: function () { 3446 ajaxPostBackStart('Loading'); 3447 }, 3448 complete: function () { 3449 ajaxPostBackEnd(); 3450 } 3451 }); 3452} 3453 3454function getDateFormat() { 3455 if (!gDateFormat) { 3456 $.ajax({ 3457 url: "/GetDateFormat", 3458 type: "GET", 3459 success: function (response) { 3460 if (response.DateFormat) 3461 gDateFormat = response.DateFormat; 3462 }, 3463 error: function (xhr, textStatus, exception) { 3464 gDateFormat = "MM/dd/yyyy"; 3465 }, 3466 async: false 3467 }); 3468 } 3469 3470 return gDateFormat == null ? "MM/dd/yyyy" : gDateFormat; 3471 3472} 3473 3474function getdDateFormat() { 3475 var dateFormat; 3476 3477 $.ajax({ 3478 url: '/Utility/GetdDateFormat', 3479 async: false, 3480 type: 'GET', 3481 dataType: 'json', 3482 success: function (data) { 3483 dateFormat = data.dateFormat; 3484 }, 3485 error: function (jqXHR, textStatus, errorThrown) { 3486 dateFormat = "mm/dd/yyyy"; 3487 } 3488 }); 3489 3490 return dateFormat; 3491} 3492 3493function getDateFromInput(datePickerID, keepDayBeforeMonth) { 3494 var datePicker = $(datePickerID); 3495 var date; 3496 var dateFormat = keepDayBeforeMonth ? getDateFormat() : "mm/dd/yyyy"; 3497 //See if datepicker if so becuase of UK format we cannot just grab the value 3498 if (!isNaN(datePicker.data('tDatePicker')) && datePicker.data('tDatePicker') && datePicker.data('tDatePicker').value()) { 3499 var dateValTmp = new dateValidator(); 3500 date = dateValTmp.format(dateFormat,new Date(datePicker.data('tDatePicker').value())); 3501 } else { 3502 if (datePicker.val()) { 3503 var dayBeforeMonthOn = getDateFormat().toLocaleLowerCase() == "dd/mm/yyyy" ? true : false; 3504 //Check if valid date before trying to format 3505 var dateString = checkDateFormatReturnUSString(datePicker.val(), dayBeforeMonthOn); 3506 var dateVal = new dateValidator(); 3507 if (dateVal.dateValidateNew(dateString, false)) { 3508 date = dateVal.format(dateFormat,new Date(checkDateFormatReturnUSString(dateString, false))); 3509 } else {
3510 //Send the date string formatted eventhough invalid date. Allow date validation to return approiate error 3511 if (keepDayBeforeMonth) { 3512 date = dateString; 3513 } else { 3514 date = checkDateFormatReturnUSString(dateString, true); 3515 } 3516 } 3517 } 3518 } 3519 return date; 3520} 3521 3522function formatUkDateReturnUSString(dateStr, isForce) { 3523 var retVal; 3524 if (isForce || getDateFormat().toLocaleLowerCase() == "dd/mm/yyyy") { 3525 dateStr = dateStr.replace(/\-/g, '/'); 3526 dateStr = dateStr.split("/"); 3527 retVal = dateStr[1] + "/" + dateStr[0] + "/" + dateStr[2]; 3528 } else { 3529 retVal = dateStr; 3530 } 3531 return retVal; 3532} 3533 3534function formatRFC3339DateReturnString(dateStr, keepDayBeforeMonth) { 3535 var retVal; 3536 var dateStrMod = dateStr.replace(/\-/g, '/'); 3537 dateStrMod = dateStr.split("/"); 3538 if (dateStrMod.length == 3 && dateStrMod[0].length == 4) { 3539 if (keepDayBeforeMonth && getDateFormat().toLowerCase() == "dd/mm/yyyy") { 3540 retVal = dateStrMod[2] + "/" + dateStrMod[1] + "/" + dateStrMod[0]; 3541 } else { 3542 retVal = dateStrMod[1] + "/" + dateStrMod[2] + "/" + dateStrMod[0]; 3543 } 3544 } else { 3545 retVal = dateStr; 3546 } 3547 return retVal; 3548} 3549 3550function checkDateFormatReturnUSString(dateStr, keepDayBeforeMonth) { 3551 var retVal; 3552 if (dateStr) { 3553 var splitDate = dateStr; 3554 dateStr = dateStr.replace(/\-/g, '/'); 3555 splitDate = dateStr.split("/"); 3556 if (splitDate.length == 3) { 3557 if (splitDate[0].length == 4) { 3558 retVal = formatRFC3339DateReturnString(dateStr, keepDayBeforeMonth); 3559 } else if (keepDayBeforeMonth) { 3560 retVal = dateStr; 3561 } else { 3562 var dateVal = new dateValidator(); 3563 retVal = formatUkDateReturnUSString(dateVal.cleanDate(dateStr)); 3564 } 3565 } else { 3566 retVal = dateStr; 3567 } 3568 } 3569 return retVal; 3570} 3571 3572//IE no longer displays as IE by design code to determin if it is IE11 3573function isIE11() { 3574 var trident = !!navigator.userAgent.match(/Trident\/7.0/); 3575 var net = !!navigator.userAgent.match(/.NET4.0E/); 3576 return trident && net; 3577} 3578 3579function isValidUrl(url) { 3580 return url.match(/^(ht|f)tps?:\/\/[a-z0-9-\.]+\.[a-z]{2,4}\/?([^\s<>\#%"\,\{\}\\|\\\^\[\]`]+)?$/); 3581} 3582 3583function isValidAbsoluteUrl(value) { 3584 return isValidAbsoluteURL(value); 3585} 3586 3587//Replaces the given tag with the tag to replace inside the element for all occurences of the tag within the element. 3588//$element - The element to perform the replace to 3589//tagToReplace - Tag to be replaced replace provided as string, ex: "i", "b", "strong" etc 3590//tagToReplaceWith - Tag to replace with, provided as string, ex: "i", "b", "strong" etc 3591function replaceTag($element, tagToReplace, tagToReplaceWith) { 3592 var $tagElemsToReplace = $element.find(tagToReplace); 3593 $tagElemsToReplace.each(function () { 3594 var $tagElem = $(this); 3595 var tagElemeHtml = $tagElem.html(); 3596 $tagElem.replaceWith('<' + tagToReplaceWith + '>' + tagElemeHtml + '</' + tagToReplaceWith + '>'); 3597 }); 3598} 3599 3600window.addEventListener("load", function () { 3601 if (MutationObserver != null) { 3602 if ($('.contentContainerOld').length > 0 && ($('.spellchecker').length > 0 || $('[id^="DialogOpener"]').length > 0)) { 3603 var observer = new MutationObserver(function moveTelerikModalOverlay(mutations) { 3604 mutations.forEach(function (mutation) { 3605 if (!mutation.addedNodes) return; 3606 3607 for (var i = 0; i < mutation.addedNodes.length; i++) { 3608 // do things to your newly added nodes here 3609 var node = mutation.addedNodes[i]; 3610 3611 if (node.classList != null && node.classList.contains("TelerikModalOverlay")) { 3612 $('.contentContainerOld').after(node); 3613 } 3614 } 3615 }); 3616 }); 3617 3618 observer.observe(document.getElementsByClassName('contentContainerOld')[0], { 3619 childList: true, 3620 subtree: true, 3621 attributes: false, 3622 characterData: false 3623 }); 3624 } 3625 } 3626}); 3627 3628if (!Array.prototype.includes) { 3629 Array.prototype.includes = function (searchElement) { 3630 'use strict'; 3631 if (this == null) { 3632 throw new TypeError('Array.prototype.includes called on null or undefined'); 3633 } 3634 3635 var O = Object(this); 3636 var len = parseInt(O.length, 10) || 0; 3637 if (len === 0) { 3638 return false; 3639 } 3640 var n = parseInt(arguments[1], 10) || 0; 3641 var k; 3642 if (n >= 0) { 3643 k = n; 3644 } else { 3645 k = len + n; 3646 if (k < 0) { k = 0; } 3647 } 3648 var currentElement; 3649 while (k < len) { 3650 currentElement = O[k]; 3651 if (searchElement === currentElement || 3652 (searchElement !== searchElement && currentElement !== currentElement)) { // NaN !== NaN 3653 return true; 3654 } 3655 k++; 3656 } 3657 return false; 3658 }; 3659} 3660 3661function isMsie() { 3662 ua = navigator.userAgent; 3663 /* MSIE used to detect old browsers and Trident used to newer ones*/
3664 var is_ie = ua.indexOf("MSIE ") > -1 || ua.indexOf("Trident/") > -1; 3665 3666 return is_ie; 3667} 3668 3669function isMozilla() { 3670 return navigator.userAgent.toLowerCase().indexOf('firefox') > -1; 3671} 3672 3673function browserVersion() { 3674 ua = navigator.userAgent; 3675 var browserVersion = null; 3676 var verOffset = null; 3677 if (isMsie()) { 3678 verOffset = ua.indexOf("rv:"); 3679 browserVersion = ua.slice(verOffset + 3).slice(0, 4); 3680 } 3681 else if (isMozilla()) { 3682 verOffset = ua.indexOf("Firefox") 3683 browserVersion= ua.substring(verOffset + 8) 3684 } 3685 return browserVersion; 3686} 3687 3688function setDatepickerHighlightedDate(date, datePickerId) { 3689 var dateFormat = getdDateFormat(); 3690 var momentDate = moment(date, dateFormat.toUpperCase()).format('MM/DD/YYYY'); 3691 if (momentDate.toLowerCase() !== "invalid date") { 3692 $('#' + datePickerId).pickadate('picker').set('highlight', date, { format: dateFormat }); 3693 } 3694} 3695; 3696/// <reference path="../../Common/Controls/jquery-ui-1.14.2/jquery-ui.js" /> 3697if (!window.Core) { 3698 window.Core = new CoreNamespace(); 3699} 3700 3701function AJAX(url, type, json, callBack, showLoadingMessage, contentType, forceCallBack, suppressErrorMessage) { 3702 contentType = contentType || 'application/x-www-form-urlencoded; charset=UTF-8'; 3703 showLoadingMessage = showLoadingMessage == null ? true : showLoadingMessage; 3704 forceCallBack = forceCallBack == null ? false : forceCallBack; 3705 if (typeof (suppressErrorMessage) === 'undefined') suppressErrorMessage = false; 3706 $.ajax({ 3707 url: url, 3708 type: type, 3709 contentType: contentType, 3710 data: json, 3711 success: function (response) { 3712 if (response.ErrorMessage && !forceCallBack) { 3713 if (response.ErrorMessage.indexOf('You do not have permission to perform this action.') != -1 && !isUserLoggedIn()) { // 079B4F43 3714 alert('You are not logged in. Please login to continue.'); 3715 location.href = '/myaccount?from=url&url=' + window.location.pathname; 3716 } else { 3717 alert(response.ErrorMessage); 3718 } 3719 } 3720 else if (response.RedirectURL && !forceCallBack) 3721 window.location.href = response.RedirectURL; 3722 else if (callBack) 3723 callBack(response); 3724 }, 3725 beforeSend: function () { 3726 if (showLoadingMessage) { 3727 ajaxPostBackStart('Loading'); 3728 } 3729 }, 3730 complete: function () { 3731 if (showLoadingMessage) { 3732 ajaxPostBackEnd(); 3733 } 3734 }, 3735 error: function (xhr, textStatus, exception) { 3736 if (!suppressErrorMessage) { 3737 alert('Error: ' + xhr.statusText + '\nStatus: ' + xhr.status); 3738 } 3739 } 3740 }); 3741} 3742 3743function isUserLoggedIn() { 3744 var result = true; // if there is an error lets not show the login message. 3745 $.ajaxSetup({ async: false, ignoreEditor: true }); 3746 $.post('/Utility/IsUserLoggedIn', function (data) { 3747 result = data; 3748 }); 3749 $.ajaxSetup({ async: true, ignoreEditor: false }); 3750 return result; 3751} 3752 3753///Method to pause a javascript execution for x seconds, works like sleep(). VB 3754function sleep(seconds) { 3755 var max_sec = new Date().getTime(); 3756 while (new Date() < max_sec + seconds * 1000) { } 3757 return true; 3758} 3759 3760if (!String.prototype.format) { 3761 String.prototype.format = function () { 3762 var args = arguments; 3763 return this.replace(/{(\d+)}/g, function (match, number) { 3764 return typeof args[number] != 'undefined' 3765 ? args[number] 3766 : match 3767 ; 3768 }); 3769 }; 3770} 3771 3772if (!String.prototype.isNullOrWhiteSpace) { 3773 String.prototype.isNullOrWhiteSpace = function () { 3774 return this == null || this.trim() == ''; 3775 }; 3776} 3777 3778function isValidMoney(value) { 3779 var isValid = false; 3780 if (value && value != '') 3781 isValid = /^\$?\s*\d+(,\d{3})*(\.\d{1,2})?$/.test(value); 3782 return isValid; 3783}; 3784 3785if (typeof String.prototype.startsWith != 'function') { 3786 String.prototype.startsWith = function (str) { 3787 return this.slice(0, str.length) == str; 3788 }; 3789} 3790 3791String.prototype.format = String.prototype.f = function () { 3792 var s = this, 3793 i = arguments.length; 3794 3795 while (i--) { 3796 s = s.replace(new RegExp('\\{' + i + '\\}', 'gm'), arguments[i]); 3797 } 3798 return s; 3799}; 3800 3801//Creates a javascript namespace, if one already exists, just returns that namespace. 3802function createNamespace(namespaceString) { 3803 var parts = namespaceString.split('.'), 3804 parent = window, 3805 currentPart = '', 3806 nsLength = parts.length; 3807 3808 for (var i = 0, length = nsLength; i < length; i++) { 3809 currentPart = parts[i];
3810 parent[currentPart] = parent[currentPart] || {}; 3811 parent = parent[currentPart]; 3812 } 3813 return parent; 3814} 3815$(function () { 3816 3817 // Ensures a dependency exists. If it doesn't acquire it. 3818 function ensure(dependencyExists, dependencyUrl, onceItExistsCallback) { 3819 if (dependencyExists) { 3820 onceItExistsCallback(); 3821 return; 3822 } 3823 $.getScript(dependencyUrl, onceItExistsCallback); 3824 } 3825 3826 var ajaxControlToolkit = window.AjaxControlToolkit; 3827 // This is hack override in order to fix problems with Ajax Toolkit Drag and Drop in newer browsers. It substitutes in jQuery Draggable if it is available. 3828 // A more proper fix is ideal, but extremely expensive as it would require replacing over a hundred instances of invocations of the old modal. 3829 // There isn't a clean way to integrate in the new modal system. JE 3830 // https://system.netsuite.com/app/crm/support/issuedb/issue.nl?id=3809568&l=T 3831 if (ajaxControlToolkit && ajaxControlToolkit.ModalPopupBehavior) { 3832 ajaxControlToolkit.ModalPopupBehavior.prototype._attachPopup = function () { 3833 /// <summary> 3834 /// Attach the event handlers for the popup 3835 /// </summary> 3836 3837 if (this._DropShadow && !this._dropShadowBehavior) { 3838 this._dropShadowBehavior = $create(ajaxControlToolkit.DropShadowBehavior, {}, null, null, this._popupElement); 3839 } 3840 3841 var _this = this; 3842 // Drag and Drop Replacement. Acquire any dependencies on the fly. 3843 ensure($.ui, "/Common/Controls/jquery-ui-1.14.2/jquery-ui.min.js", function () { 3844 $("#" + _this._PopupControlID).draggable({ handle: '#' + _this._PopupDragHandleControlID }); 3845 $("#" + _this._PopupDragHandleControlID).css('cursor', 'move'); 3846 }); 3847 3848 $addHandler(window, 'resize', this._resizeHandler); 3849 $addHandler(window, 'scroll', this._scrollHandler); 3850 this._windowHandlersAttached = true; 3851 } 3852 } 3853}); 3854 3855String.prototype.replaceAll = function (search, replacement) { 3856 var target = this; 3857 return target.replace(new RegExp(search, 'g'), replacement); 3858}; 3859 3860function executeViewMapPostClickActions($element) { 3861 //Hide the view map element post click(to avoid clicking repeatedly) 3862 $element.hide('fast'); 3863 3864 //Collect analytics around map clicks 3865 var url = '/CollectGoogleMapClicks/Execute'; 3866 var moduleId = $element.data('moduleid'); 3867 $.ajax({ 3868 url: url, 3869 type: 'POST', 3870 data: { 3871 url: window.location.href, 3872 moduleId: moduleId 3873 }, 3874 success: function (json) { 3875 //send data to telemetry 3876 appInsights.trackEvent("googlemapclicked", json); 3877 }, 3878 error: function (xhr, textStatus, exception) { 3879 alert("Error: " + xhr.statusText + "\nStatus: " + xhr.status); 3880 } 3881 }); 3882} 3883 3884function importModal(options) { 3885 if (window.ImportModalInstance === undefined) { 3886 var script = document.createElement("script"); 3887 script.onload = function () { 3888 window.ImportModalInstance.init(options); 3889 }; 3890 script.src = "/Assets/Scripts/ImportModal.js"; 3891 document.head.appendChild(script); 3892 } 3893 else 3894 window.ImportModalInstance.init(options); 3895} 3896 3897function exportModal(options) { 3898 if (window.ExportModalInstance === undefined) { 3899 var script = document.createElement("script"); 3900 script.onload = function () { 3901 window.ExportModalInstance.init(options); 3902 }; 3903 script.src = "/Assets/Scripts/ExportModal.js"; 3904 document.head.appendChild(script); 3905 } 3906 else 3907 window.ExportModalInstance.init(options); 3908} 3909 3910document.addEventListener("DOMContentLoaded", function () { 3911 var modal = document.querySelector(".importModal"); 3912 if (modal !== null) { 3913 try { 3914 if (!modal.classList.contains("processed")) { 3915 var options = modal.dataset.importconfig; 3916 if (options) { 3917 modal.addEventListener("click", 3918 function (e) { 3919 e.preventDefault(); 3920 importModal(JSON.parse(options)); 3921 }); 3922 //Avoid further processing if the event gets triggered multiple times during page load 3923 modal.classList.add("processed"); 3924 } 3925 } 3926 } catch (err) { 3927 console.error("Unable to initialize import modal"); 3928 } 3929 } 3930 var modalExport = document.querySelector(".exportModal"); 3931 if (modalExport !== null) { 3932 try { 3933 if (!modalExport.classList.contains("processed")) { 3934 var options = modalExport.dataset.exportconfig; 3935 if (options) { 3936 modalExport.addEventListener("click", 3937 function (e) { 3938 e.preventDefault(); 3939 exportModal(JSON.parse(options)); 3940 });
3941 //Avoid further processing if the event gets triggered multiple times during page load 3942 modalExport.classList.add("processed"); 3943 } 3944 } 3945 } catch (err) { 3946 console.error("Unable to initialize export modal"); 3947 } 3948 } 3949}); 3950$(document).ready(function () { 3951 if (window.isResponsiveEnabled && !window.pageHandleResponsive) { 3952 function executeRWDResizeEvents(event) { 3953 var listener = function (e) { 3954 if ($('#hdnPageID').length == 0) { 3955 var breakpointWidth = 600, 3956 viewportWidth = $(window).width(), 3957 currentCookieValue = getCookieValue('viewportWidth'); 3958 currentCookieValue = currentCookieValue == null || currentCookieValue == '' ? 0 : Number(currentCookieValue); 3959 document.cookie = 'viewportWidth=' + viewportWidth + '; path=/'; 3960 if ((viewportWidth < breakpointWidth && currentCookieValue >= breakpointWidth) || 3961 (viewportWidth >= breakpointWidth && currentCookieValue < breakpointWidth)) { 3962 window.location.reload(); 3963 } 3964 } 3965 }; 3966 3967 if (window.addEventListener) { 3968 window.addEventListener(event, listener, false); 3969 } else if (window.attachEvent) { 3970 window.attachEvent("on" + event, listener); 3971 } 3972 } 3973 3974 executeRWDResizeEvents('resize'); 3975 } 3976 3977 // Always reset the viewport width now that the document is fully loaded and we can make it more accurate. 3978 // (Sometimes on load it comes back much wider than it should) 3979 document.cookie = 'viewportWidth=' + $(window).width() + '; path=/'; 3980}); 3981; 3982function Animations() { 3983 const animationsJsonEl = $('.activeWidgetSkinComponentsOnPageJson'); 3984 const animationsJson = animationsJsonEl.html(); 3985 if (animationsJson) 3986 this.components = JSON.parse(animationsJson); 3987 this.selectors = [ 3988 '', '.widgetHeader', '.widgetBody', '.widgetItem', '.widgetTitle', '.widgetMeta', '.widgetBody .bullets', 3989 'a:link', '.readOn:link', '.widgetViewAll:link', '.widgetRSS:link', '.widgetFooter', '.cpTabs', 3990 '.cpTabs > li > a:link', '.cpTabPanel', 3991 '.separated .half:after, .separated .third:after, .separated .fourth:after, .separated .fifth:after, .separated.cpGrid .col:after ', '.miniCalendarHeader', '.miniCalendar > table', '.miniCalendar th', '.miniCalendar td > span', '.miniCalendar td > a', '.miniCalendar .today > span', '.miniCalendar .not > span', '.miniCalendar' 3992 ]; 3993 animationsJsonEl.remove(); 3994} 3995 3996Animations.prototype.Apply = function () { 3997 var self = this; 3998 self.addClassToContainers(); 3999 self.bindContainerTriggers(); 4000 self.addClassAndTriggerToSkinComponents(); 4001}; 4002 4003/// Gets the css class to be applied from the hidden element already present on the page and applies the css class to the Container(Structural/Content) 4004Animations.prototype.addClassToContainers = function () { 4005 var $hiddenAnimationElements = $('.hiddenAnimations'); 4006 if ($hiddenAnimationElements != null) { 4007 $hiddenAnimationElements.each(function () { 4008 //Get hidden element 4009 var $hiddenAnimationElement = $(this); 4010 //Get css class from it 4011 var cssClass = $hiddenAnimationElement.data('animationclass'); 4012 var startCssClass = cssClass + '_Start'; 4013 var triggerData = $hiddenAnimationElement.data('trigger'); 4014 //Apply that class to parent container, depending on container type 4015 //For Strctural container 4016 if ($hiddenAnimationElement.parent('[data-cprole=structuralContainer]') != null) { 4017 $hiddenAnimationElement.parent('[data-cprole=structuralContainer]').addClass(startCssClass); 4018 $hiddenAnimationElement.parent('[data-cprole=structuralContainer]').addClass(triggerData); 4019 setTimeout(function () { 4020 $hiddenAnimationElement.parent('[data-cprole=structuralContainer]').addClass(cssClass); 4021 $hiddenAnimationElement.parent('[data-cprole=structuralContainer]').removeClass(startCssClass); 4022 }, 4023 10); 4024 } 4025 //For Content Container 4026 if ($hiddenAnimationElement.parent('[data-cprole=contentContainer]') != null) { 4027 $hiddenAnimationElement.parent('[data-cprole=contentContainer]').addClass(startCssClass); 4028 $hiddenAnimationElement.parent('[data-cprole=contentContainer]').addClass(triggerData); 4029 setTimeout(function () { 4030 $hiddenAnimationElement.parent('[data-cprole=contentContainer]').addClass(cssClass); 4031 $hiddenAnimationElement.parent('[data-cprole=contentContainer]').removeClass(startCssClass); 4032 }, 4033 10); 4034 } 4035 }); 4036 } 4037}; 4038 4039//Apply animation class to widget skin components on page 4040Animations.prototype.addClassAndTriggerToSkinComponents = function () { 4041 var self = this; 4042 var $widgetsHavingSkinsApplied = $("[class*='skin']"); 4043 4044 if ($widgetsHavingSkinsApplied != null) { 4045 //array of unique skin ids 4046 var $uniqueSkinIds = []; 4047 $widgetsHavingSkinsApplied.each(function () { 4048 //Get skin class 4049 var skinClass = $(this).attr('class').match(/.skin\d+/g)[0]; 4050 //Parse skinId off of skin class 4051 var skinId = parseInt(skinClass.match(/\d+/)[0]); 4052 //Insert if not there in array 4053 if ($.inArray(skinId, $uniqueSkinIds) === -1) 4054 $uniqueSkinIds.push(skinId); 4055 }); 4056 4057 $.each($uniqueSkinIds, function (index, value) { 4058 var skinId = value; 4059 for (var i = 0; i < self.selectors.length; i++) { 4060 //Find all widget skincomponents on the page using this skin.
4061 var $skinComponentsOnPageUsingThisSkin = $('.skin' + skinId + ' ' + self.selectors[i] + ''); 4062 var animationClass = self.classAndTrigger(skinId, i).className; 4063 var animationTrigger = self.classAndTrigger(skinId, i).triggerName; 4064 var scrollOffset = self.classAndTrigger(skinId, i).scrollOffset; 4065 if (animationClass !== undefined) { 4066 //Apply animation class 4067 $skinComponentsOnPageUsingThisSkin.addClass(animationClass + '_Start').addClass(animationClass).removeClass(animationClass + '_Start'); 4068 } 4069 if (animationTrigger !== undefined && animationTrigger !== 'hover') { 4070 //Apply animation trigger 4071 $skinComponentsOnPageUsingThisSkin.addClass(animationTrigger + 'AnimationTrigger'); 4072 $skinComponentsOnPageUsingThisSkin.data("scrolloffset", scrollOffset); 4073 } 4074 } 4075 }); 4076 } 4077}; 4078 4079///Get animation class given the component and skin Id 4080Animations.prototype.classAndTrigger = function (skinId, componentTypeId) { 4081 var self = this; 4082 var components = self.components; 4083 var classAndTrigger = {}; 4084 if (components && components.length > 0) { 4085 for (var i = 0; i < components.length; i++) { 4086 if (components[i].WidgetSkinID === skinId && components[i].ComponentType === componentTypeId) { 4087 classAndTrigger.className = components[i].AnimationClass; 4088 classAndTrigger.triggerName = components[i].TriggerNameLowerCase; 4089 classAndTrigger.scrollOffset = components[i].ScrollOffset; 4090 return classAndTrigger; 4091 } 4092 } 4093 } 4094 return classAndTrigger; 4095}; 4096 4097/// Gets the css class to be applied from the hidden element already present on the page and applies the css class to the Nav container(Main/Side) 4098Animations.prototype.applyAnimationClassToNavContainers = function ($olSubMenu, menuType) { 4099 var mainMenu = 2; 4100 var sideMenu = 1; 4101 var cssClass; 4102 var triggerData; 4103 var $mainNavHiddenElement = $('#mainNav').children('[class*="hiddenAnimations"]'); 4104 var $secondaryNavHiddenElement = $('#secondaryNav').children('[class*="hiddenAnimations"]'); 4105 4106 if ($('#mainNav').length > 0 && menuType === mainMenu) { 4107 cssClass = $mainNavHiddenElement.data('animationclass'); 4108 triggerData = $mainNavHiddenElement.data('trigger'); 4109 $olSubMenu.addClass(cssClass); 4110 setTimeout(function () { 4111 $olSubMenu.addClass(cssClass); 4112 $olSubMenu.addClass('animation-triggered'); 4113 $olSubMenu.removeClass(cssClass + '_Start'); 4114 }, 4115 10); 4116 }; 4117 if ($('#secondaryNav').length > 0 && menuType === sideMenu) { 4118 cssClass = $secondaryNavHiddenElement.data('animationclass'); 4119 triggerData = $secondaryNavHiddenElement.data('trigger'); 4120 $olSubMenu.addClass(cssClass); 4121 setTimeout(function () { 4122 $olSubMenu.addClass(cssClass); 4123 $olSubMenu.addClass('animation-triggered'); 4124 $olSubMenu.removeClass(cssClass + '_Start'); 4125 }, 4126 10); 4127 }; 4128}; 4129 4130Animations.prototype.applyAnimationClassToMegaMenuContainer = function ($megaMenuContainer, timeOut) { 4131 var cssClass; 4132 var $megaMenuHiddenElement = $('.megaMenuContainer').children('[class*="hiddenAnimations"]'); 4133 4134 $megaMenuContainer.mouseleave(function () { 4135 if (!$('.megaMenuContainer').children('.pinned').length > 0) { 4136 $(this).removeClass('animation-triggered'); 4137 } 4138 }); 4139 4140 if ($('.megaMenuContainer').length > 0) { 4141 cssClass = $megaMenuHiddenElement.data('animationclass'); 4142 setTimeout(function () { 4143 $megaMenuContainer.addClass('animation-triggered'); 4144 $megaMenuContainer.removeClass(cssClass + '_Start'); 4145 }, 4146 timeOut); 4147 }; 4148}; 4149 4150/// Gets the css class to be applied from the hidden element already present on the page and applies the css class to the Nav container(Main/Side) 4151Animations.prototype.applyInitial = function ($olSubMenu, menuType) { 4152 var mainMenu = 2; 4153 var sideMenu = 1; 4154 var cssClass; 4155 var triggerData; 4156 var $mainNavHiddenElement = $('#mainNav').children('[class*="hiddenAnimations"]'); 4157 var $secondaryNavHiddenElement = $('#secondaryNav').children('[class*="hiddenAnimations"]'); 4158 if ($('#mainNav').length > 0 && menuType === mainMenu) { 4159 cssClass = $mainNavHiddenElement.data('animationclass'); 4160 triggerData = $mainNavHiddenElement.data('trigger'); 4161 $olSubMenu.addClass(cssClass + '_Start').addClass(triggerData); 4162 }; 4163 if ($('#secondaryNav').length > 0 && menuType === sideMenu) { 4164 cssClass = $secondaryNavHiddenElement.data('animationclass'); 4165 triggerData = $secondaryNavHiddenElement.data('trigger'); 4166 $olSubMenu.addClass(cssClass + '_Start').addClass(triggerData); 4167 }; 4168}; 4169 4170Animations.prototype.bindContainerTriggers = function () { 4171 $(document) 4172 .delegate('[class*="clickAnimationTrigger"]', 4173 'click', 4174 function () { 4175 $(this).addClass('animation-triggered'); 4176 }); 4177 4178 $(window).scroll(function () { 4179 $('.scrollAnimationTrigger').not('.cpCarousel .widgetItem.scrollAnimationTrigger').each(function () { 4180 var scrollOffsetPercentage = $(this).data('scrolloffset') / 100; 4181 if (isNaN(scrollOffsetPercentage)) 4182 scrollOffsetPercentage = $(this).children().first().data('scrolloffset') / 100; 4183 if (scrollOffsetPercentage != 0 && ($(window).scrollTop() + ($(window).height() * (1 - scrollOffsetPercentage))) > 4184 $(this).offset().top && ($(this).offset().top + $(this).height()) > $(window).scrollTop()) 4185 $(this).addClass('animation-triggered'); 4186 }); 4187 4188 $('.cpCarousel .widgetItem.scrollAnimationTrigger').each( 4189 function () { 4190 $(this).addClass('animation-triggered'); 4191 } 4192 ); 4193 }); 4194}; 4195function StickyStructuralContainers() { 4196 //Add sticky class to structuralStructuralContainer 4197 var stickyContainers = $('div.stickyInnerDiv.sticky'); 4198 if (stickyContainers.length > 0) { 4199 stickyContainers.each(function () { 4200 $(this).parent().addClass('stickyStructuralContainer stickySticky'); 4201 }); 4202 $.when(window.Pages && window.Pages.rwdReady).done(function() { 4203 var $stickyContainer = $(".stickyStructuralContainer.stickySticky"); 4204 var pos = $stickyContainer.css('position'); 4205 var isStickyCurrently = pos === 'fixed' || pos === 'sticky'; 4206 var divToolbars = $("#divToolbars")[0]; 4207 if (divToolbars && isStickyCurrently) { 4208 $stickyContainer.css('top', 4209 (divToolbars.getBoundingClientRect().height + parseInt($('#divToolbars').css('margin-top'))) + "px"); 4210 } 4211 }); 4212 } 4213 4214 //Add sticky class to structural container inside of stickyStructuralContainer
4215 var structuralContainersUnderSticky = $('div.structuralUnderStickyInnerDiv'); 4216 if (structuralContainersUnderSticky.length > 0) { 4217 structuralContainersUnderSticky.each(function () { 4218 //To prevent adding classes to main structural container 4219 if ($(this).find('div.structuralUnderStickyInnerDiv').length == 0) { 4220 $(this).parent().addClass($(this).attr('class')); 4221 } 4222 }); 4223 } 4224} 4225 4226StickyStructuralContainers.prototype.init = function () { 4227 var self = this; 4228 var stickyContainers = $('div.stickyInnerDiv.sticky'); 4229 var paddingCalc = $("#divToolbars").outerHeight() - parseInt($("#divToolbars").css('padding-top')); 4230 if (stickyContainers.length > 0) { 4231 var bottomOfSticky = $('.stickyStructuralContainer.stickySticky').outerHeight(); 4232 $('#bodyWrapper').addClass('noTransition'); 4233 $('.stickyStructuralContainer.stickySticky').next().css('padding-top', bottomOfSticky + 'px'); 4234 4235 if (stickyContainers.find('.anchorOffset')) { 4236 document.documentElement.style.setProperty('--header-offset', bottomOfSticky + $('#divToolbars').outerHeight() + 10 + 'px'); 4237 } 4238 } 4239 4240 //Adjusted / re - calculate the padding for sibling of sticky structural container. 4241 window.Pages.onResizeHandlers = window.Pages.onResizeHandlers || []; 4242 window.Pages.onResizeHandlers.push(function () { 4243 $('.stickySticky').each(function () { 4244 var padding = $(this).outerHeight() - 1 + 'px'; 4245 var self = this; 4246 if ($('.stickySticky').next().attr('data-cprole') == "banner") { 4247 $('.stickySticky').next().find('[id^="structuralContainer"]').first().css('padding-top', padding); 4248 } else { 4249 window.setTimeout(function () { 4250 $(self).next().css('padding-top', padding); 4251 }, 500); 4252 } 4253 }); 4254 }); 4255 4256 //set up scroll events 4257 var stickyCollapsedContainers = $('div.stickyInnerDiv.stickyCollapsedWhenScrolled'); 4258 if (stickyCollapsedContainers.length > 0 && !window.isMobileBrowserIncludingTablets) { 4259 stickyCollapsedContainers.each(function () { 4260 $(this).parent().addClass('stickyStructuralContainer stickyStickyCollapsedWhenScrolled'); 4261 if ($(this).hasClass('stickyFadeAnimation')) { 4262 $(this).parent().addClass('stickyStickyFadeAnimation'); 4263 } else if ($(this).hasClass('stickySlideDownAnimation')) { 4264 $(this).parent().addClass('stickyStickySlideDownAnimation'); 4265 } 4266 }); 4267 4268 var bottomOfStickyCollapsed = $('.stickyStructuralContainer.stickyStickyCollapsedWhenScrolled').offset().top + 4269 $('.stickyStructuralContainer.stickyStickyCollapsedWhenScrolled').outerHeight() - 4270 $("#divToolbars").height(); 4271 var hideWhenExpandedHeights = self.getAllHeights($('.stickyStructuralContainer.stickyStickyCollapsedWhenScrolled .structuralUnderStickyInnerDiv.hideWhenExpanded')); 4272 var hideWhenCollapsedHeights = self.getAllHeights($('.stickyStructuralContainer.stickyStickyCollapsedWhenScrolled .structuralUnderStickyInnerDiv.hideWhenCollapsed')); 4273 4274 var scrollDownTrigger = self.getStickyScrollBreakpoint(bottomOfStickyCollapsed, hideWhenExpandedHeights, hideWhenCollapsedHeights); 4275 4276 self.showHideStickyContainers(true, scrollDownTrigger, paddingCalc); 4277 4278 self.bindScrollForSticky(bottomOfStickyCollapsed, 4279 hideWhenExpandedHeights, 4280 hideWhenCollapsedHeights); 4281 4282 if (stickyCollapsedContainers.find('.anchorOffset')) { 4283 document.documentElement.style.setProperty('--header-offset', bottomOfStickyCollapsed + $('#divToolbars').outerHeight() + 10 + 'px'); 4284 } 4285 } 4286 else { 4287 stickyContainers = $('div.stickyInnerDiv'); 4288 if (stickyContainers.length > 0 && stickyContainers.find('.structuralUnderStickyInnerDiv.showInMobile').length > 0) { 4289 stickyContainers.find('.structuralUnderStickyInnerDiv').not('.showInMobile') 4290 .each(function () { 4291 $(this).hide(); 4292 }); 4293 } 4294 } 4295} 4296 4297StickyStructuralContainers.prototype.bindScrollForSticky = function (bottomOfStickyCollapsed, hideWhenExpandedHeights, hideWhenCollapsedHeights) { 4298 var self = this; 4299 var scrollDownTrigger = self.getStickyScrollBreakpoint(bottomOfStickyCollapsed, hideWhenExpandedHeights, hideWhenCollapsedHeights); 4300 var paddingCalc = $("#divToolbars").outerHeight() - parseInt($("#divToolbars").css('padding-top')); 4301 4302 $(window) 4303 .scroll(function () { 4304 self.showHideStickyContainers(false, scrollDownTrigger, paddingCalc); 4305 }); 4306} 4307 4308StickyStructuralContainers.prototype.showHideStickyContainers = function (initialLoad, scrollDownTrigger, paddingCalc) { 4309 var $stickyStructuralContainer = $('.stickyStructuralContainer.stickyStickyCollapsedWhenScrolled'); 4310 var wS = $(window).scrollTop(); 4311 4312 if (wS >= scrollDownTrigger + paddingCalc) { 4313 $stickyStructuralContainer.addClass('stickyCollapsed'); 4314 4315 $(".stickyStructuralContainer.stickyStickyCollapsedWhenScrolled") 4316 .css('top', $("#divToolbars").outerHeight() + "px"); 4317 4318 //Structrual overrides content container so show/hide if content container doesn't have a structural container around it 4319 $('.stickyStructuralContainer.stickyStickyCollapsedWhenScrolled .hideWhenExpanded') 4320 .each(function () { 4321 if ($(this).parents('.structuralUnderStickyInnerDiv') === 0) { 4322 $(this).show(); 4323 } 4324 }); 4325 4326 $('.stickyStructuralContainer.stickyStickyCollapsedWhenScrolled .hideWhenCollapsed') 4327 .each(function () { 4328 if ($(this).parents('.structuralUnderStickyInnerDiv') === 0) { 4329 $(this).hide(); 4330 } 4331 }); 4332 4333 //Structrual overrides content container so show/hide structural containers and any content containers under it that would be opposite behavior 4334 $('.stickyStructuralContainer.stickyStickyCollapsedWhenScrolled .structuralUnderStickyInnerDiv.hideWhenCollapsed').hide(); 4335 $('.stickyStructuralContainer.stickyStickyCollapsedWhenScrolled .structuralUnderStickyInnerDiv.hideWhenExpanded').show(); 4336 $('.stickyStructuralContainer.stickyStickyCollapsedWhenScrolled .hideWhenExpanded').find('.hideWhenCollapsed').show(); 4337 $('.stickyStructuralContainer.stickyStickyCollapsedWhenScrolled .hideWhenCollapsed').find('.hideWhenExpanded').hide(); 4338 4339 //Animate the slide down 4340 $('.stickyStructuralContainer.stickyStickyCollapsedWhenScrolled.stickyStickyFadeAnimation.stickyCollapsed') 4341 .addClass('stickyAnimFade'); 4342 $('.stickyStructuralContainer.stickyStickyCollapsedWhenScrolled.stickyStickySlideDownAnimation.stickyCollapsed') 4343 .addClass('stickyAnimSlideDown'); 4344 4345 if ($('.stickyStructuralContainer.stickyStickyCollapsedWhenScrolled.stickyCollapsed').length > 0 && 4346 !$('.stickyStructuralContainer.stickyStickyCollapsedWhenScrolled.stickyCollapsed').hasClass('stickyAnimComplete') 4347 ) { 4348 setTimeout(function () { 4349 $('.stickyStructuralContainer.stickyStickyCollapsedWhenScrolled.stickyCollapsed') 4350 .addClass('stickyAnimComplete'); 4351 }, 4352 0); 4353 4354 $('#stickyPlaceholder').css('height', scrollDownTrigger + paddingCalc + 'px'); 4355 if (!window.isRemoveSetHeights) 4356 SetHeights();
4357 } 4358 4359 } else { 4360 if (($('.stickyStructuralContainer.stickyStickyCollapsedWhenScrolled.stickyCollapsed').length > 0 && 4361 $('.stickyStructuralContainer.stickyStickyCollapsedWhenScrolled.stickyCollapsed').hasClass('stickyAnimComplete')) 4362 || initialLoad) { 4363 $(".stickyStructuralContainer.stickyStickyCollapsedWhenScrolled").css('top', 'auto'); 4364 4365 //Structrual overrides content container so show/hide if content container doesn't have a structural container around it 4366 $('.stickyStructuralContainer.stickyStickyCollapsedWhenScrolled .hideWhenExpanded') 4367 .each(function () { 4368 if ($(this).parents('.structuralUnderStickyInnerDiv') === 0) { 4369 $(this).hide(); 4370 } 4371 }); 4372 4373 $('.stickyStructuralContainer.stickyStickyCollapsedWhenScrolled .hideWhenCollapsed') 4374 .each(function () { 4375 if ($(this).parents('.structuralUnderStickyInnerDiv') === 0) { 4376 $(this).show(); 4377 } 4378 }); 4379 4380 //Structrual overrides content container so show/hide structural containers and any content containers under it that would be opposite behavior 4381 $('.stickyStructuralContainer.stickyStickyCollapsedWhenScrolled .structuralUnderStickyInnerDiv.hideWhenExpanded').hide(); 4382 $('.stickyStructuralContainer.stickyStickyCollapsedWhenScrolled .structuralUnderStickyInnerDiv.hideWhenCollapsed').show(); 4383 $('.stickyStructuralContainer.stickyStickyCollapsedWhenScrolled .hideWhenExpanded').find('.hideWhenCollapsed').hide(); 4384 $('.stickyStructuralContainer.stickyStickyCollapsedWhenScrolled .hideWhenCollapsed').find('.hideWhenExpanded').show(); 4385 4386 $('#stickyPlaceholder').css('height', '0'); 4387 4388 $('.stickyStructuralContainer.stickyStickyCollapsedWhenScrolled.stickyStickyFadeAnimation.stickyCollapsed') 4389 .removeClass('stickyAnimFade'); 4390 $('.stickyStructuralContainer.stickyStickyCollapsedWhenScrolled.stickyStickySlideDownAnimation.stickyCollapsed') 4391 .removeClass('stickyAnimSlideDown'); 4392 $stickyStructuralContainer.removeClass('stickyCollapsed stickyAnimComplete'); 4393 if (!window.isRemoveSetHeights) 4394 SetHeights(); 4395 } 4396 } 4397} 4398 4399StickyStructuralContainers.prototype.getAllHeights = function (elements) { 4400 var heights = 0; 4401 if (elements && elements.length > 0) { 4402 elements.each(function () { 4403 if ($(this).parents('.structuralUnderStickyInnerDiv.hideWhenExpanded').length === 0 4404 && $(this).parents('.structuralUnderStickyInnerDiv.hideWhenCollapsed').length === 0) 4405 heights += $(this).height(); 4406 }); 4407 } 4408 return heights; 4409} 4410 4411 4412StickyStructuralContainers.prototype.getStickyScrollBreakpoint = function (bottomOfStickyCollapsed, hideWhenExpandedHeights, hideWhenCollapsedHeights) { 4413 var scrollDownTrigger; 4414 var $stickyStructuralContainer = $('.stickyStructuralContainer.stickyStickyCollapsedWhenScrolled'); 4415 var toolBarAndStickyHeight = $stickyStructuralContainer.outerHeight() - 4416 $("#divToolbars").height(); 4417 4418 //Logic for when there are structural containers 4419 if ($('.stickyStructuralContainer.stickyStickyCollapsedWhenScrolled .structuralUnderStickyInnerDiv.hideWhenCollapsed').length > 0 4420 || $('.stickyStructuralContainer.stickyStickyCollapsedWhenScrolled .structuralUnderStickyInnerDiv.hideWhenExpanded').length > 0) { 4421 //If page loaded and already collapsed and has both show and hide containers 4422 if ($('.stickyStructuralContainer.stickyStickyCollapsedWhenScrolled.stickyCollapsed .structuralUnderStickyInnerDiv.hideWhenCollapsed').length > 0 && 4423 $('.stickyStructuralContainer.stickyStickyCollapsedWhenScrolled.stickyCollapsed .structuralUnderStickyInnerDiv.hideWhenExpanded').length > 0) { 4424 scrollDownTrigger = hideWhenCollapsedHeights + toolBarAndStickyHeight - hideWhenExpandedHeights; 4425 //If page loaded and NOT collapsed and has both show and hide containers 4426 } else if ($('.stickyStructuralContainer.stickyStickyCollapsedWhenScrolled .structuralUnderStickyInnerDiv.hideWhenCollapsed').length > 0 && 4427 $('.stickyStructuralContainer.stickyStickyCollapsedWhenScrolled .structuralUnderStickyInnerDiv.hideWhenExpanded').length > 0) { 4428 scrollDownTrigger = toolBarAndStickyHeight; 4429 //If page loaded and collapsed and has only visible containers when collapsed 4430 } else if ( 4431 $('.stickyStructuralContainer.stickyStickyCollapsedWhenScrolled.stickyCollapsed .structuralUnderStickyInnerDiv.hideWhenExpanded').length > 0) { 4432 scrollDownTrigger = toolBarAndStickyHeight - hideWhenExpandedHeights; 4433 //If page loaded and collapsed and has only visible containers when expanded 4434 } else if ( 4435 $('.stickyStructuralContainer.stickyStickyCollapsedWhenScrolled.stickyCollapsed .structuralUnderStickyInnerDiv.hideWhenCollapsed').length > 0) { 4436 scrollDownTrigger = hideWhenCollapsedHeights + toolBarAndStickyHeight; 4437 //If page loaded and NOT collapsed and has only one style of visible container (collapsed or non) 4438 } else if ($('.stickyStructuralContainer.stickyStickyCollapsedWhenScrolled .structuralUnderStickyInnerDiv.hideWhenCollapsed').length > 0 || 4439 $('.stickyStructuralContainer.stickyStickyCollapsedWhenScrolled .structuralUnderStickyInnerDiv.hideWhenExpanded').length > 0) { 4440 scrollDownTrigger = toolBarAndStickyHeight; 4441 } else { 4442 scrollDownTrigger = toolBarAndStickyHeight; 4443 } 4444 //Logic for when there are only content containers. Same scenarios as strucrual 4445 } else { 4446 if ($('.stickyStructuralContainer.stickyStickyCollapsedWhenScrolled.stickyCollapsed .hideWhenCollapsed').length > 0 && 4447 $('.stickyStructuralContainer.stickyStickyCollapsedWhenScrolled.stickyCollapsed .hideWhenExpanded').length > 0) { 4448 scrollDownTrigger = hideWhenCollapsedHeights + toolBarAndStickyHeight - hideWhenExpandedHeights; 4449 } else if ($('.stickyStructuralContainer.stickyStickyCollapsedWhenScrolled .hideWhenCollapsed').length > 0 && 4450 $('.stickyStructuralContainer.stickyStickyCollapsedWhenScrolled .hideWhenExpanded').length > 0) { 4451 scrollDownTrigger = toolBarAndStickyHeight; 4452 } else if ( 4453 $('.stickyStructuralContainer.stickyStickyCollapsedWhenScrolled.stickyCollapsed .hideWhenExpanded').length > 0) { 4454 scrollDownTrigger = toolBarAndStickyHeight - hideWhenExpandedHeights; 4455 } else if ( 4456 $('.stickyStructuralContainer.stickyStickyCollapsedWhenScrolled.stickyCollapsed .hideWhenCollapsed').length > 0) { 4457 scrollDownTrigger = hideWhenCollapsedHeights + toolBarAndStickyHeight; 4458 } else if ($('.stickyStructuralContainer.stickyStickyCollapsedWhenScrolled .hideWhenCollapsed').length > 0 || 4459 $('.stickyStructuralContainer.stickyStickyCollapsedWhenScrolled .hideWhenExpanded').length > 0) { 4460 scrollDownTrigger = toolBarAndStickyHeight; 4461 } else { 4462 scrollDownTrigger = toolBarAndStickyHeight; 4463 } 4464 } 4465 4466 return scrollDownTrigger; 4467}; 4468var commonLocalization = null; 4469var userAgent = window.navigator.userAgent; 4470var iOSSafari = userAgent.match(/iP(ad|hone)/i) && userAgent.match(/WebKit/i) && !userAgent.match(/CriOS/i); 4471var hashRegex = /^(#cc[A-z0-9]{8}-[A-z0-9]{4}-[A-z0-9]{4}-[A-z0-9]{4}-[A-z0-9]{12})$/; 4472var stickyStructuralContainers = null; 4473 4474if (window.location.hash && hashRegex.test(window.location.hash)) { 4475 var targetHash = window.location.hash; 4476 window.location.hash = ''; 4477 scroll(0, 0); 4478 setTimeout(function () { 4479 scroll(0, 0); 4480 }, 1); 4481} 4482 4483if (window.isResponsiveEnabled) { 4484 loadMediaFramework(); 4485} 4486 4487function loadMediaFramework() { 4488 Modernizr.load([ 4489 //test old browsers to use polyfills 4490 { 4491 test: window.addEventListener, 4492 nope: "/Assets/Scripts/RWD/eventListener.js" 4493 }, 4494 { 4495 test: window.matchMedia, 4496 nope: "/Assets/Scripts/RWD/media.match.js" 4497 }, 4498 { 4499 test: Modernizr.touch, 4500 yep: "/Assets/Scripts/RWD/quo.debug.js" 4501 }, 4502 //Load Media Framework after polyfills if needed 4503 getAbsoluteUrl("/Assets/Scripts/RWD/MediaFramework.js") 4504 ]); 4505} 4506 4507(function () { 4508 var timer = 4000; 4509 var incrementTimer = function () { timer = timer * 1.25; }; 4510 4511 var timeOutFunction = function () { 4512 setTimeout(timeOutFunction, timer); 4513 setBannerHeights();
4514 incrementTimer(); 4515 }; 4516 timeOutFunction(); 4517}()); 4518 4519$(document).ready(function () { 4520 4521 if (!window.isResponsiveEnabled) { 4522 //Setup execution of events when resizing 4523 var timeout = 250; //time out to debounce event 4524 window.Pages = window.Pages || {}; 4525 window.Pages.onResizeHandlers = window.Pages.onResizeHandlers || []; 4526 4527 if (typeof updateMegaMenusOnBrowserResize === 'function') 4528 window.Pages.onResizeHandlers.push(updateMegaMenusOnBrowserResize); 4529 4530 if ($('#hdnWidgetManager').length == 0 && typeof rearrangeFlyoutsOnResizeEvents === 'function') 4531 window.Pages.onResizeHandlers.push(rearrangeFlyoutsOnResizeEvents); 4532 4533 function executeResizeEvents(event) { 4534 var timer; 4535 var listener = function (e) { 4536 //Execute the handlers for resize events. 4537 timer && clearTimeout(timer); 4538 timer = setTimeout(function () { 4539 for (var i = 0; i < window.Pages.onResizeHandlers.length; i++) { 4540 if (typeof (window.Pages.onResizeHandlers[i]) === 'function') { 4541 window.Pages.onResizeHandlers[i](); 4542 } 4543 } 4544 }, timeout); 4545 }; 4546 4547 if (window.addEventListener) { 4548 window.addEventListener(event, listener, false); 4549 } else if (window.attachEvent) { 4550 window.attachEvent("on" + event, listener); 4551 } 4552 } 4553 4554 executeResizeEvents('resize'); 4555 executeResizeEvents('orientationChange'); 4556 } 4557 4558 if (window.isResponsiveEnabled) { 4559 //Inserts data-label on each table cell in froala editor. Needed for responsive view 4560 $.each($.find('.fr-view table'), function (tableIndex, tableValue) { 4561 $(tableValue).parent().addClass('responsiveEditor'); 4562 if($(tableValue).find('thead th').length === 1) { 4563 $(this).addClass('singleHeaderTable'); 4564 } 4565 $.each($(tableValue).find('thead th'), function (headerIndex, headerValue) { 4566 $.each($(tableValue).find('tbody tr'), function (rowIndex, rowValue) { 4567 $($(rowValue).find('td')[headerIndex]).attr('data-label', headerValue.textContent); 4568 }); 4569 }); 4570 }); 4571 } 4572 4573 $('#divToolbars').css('overflow-x', 'visible'); 4574 $('#divToolbars').css('overflow-y', 'visible'); 4575 4576 browserFailOvers(); 4577 4578 var GetCookie = function (cname) { 4579 var name = cname + "="; 4580 var ca = document.cookie.split(';'); 4581 for (var i = 0; i < ca.length; i++) { 4582 var c = ca[i]; 4583 while (c.charAt(0) == ' ') c = c.substring(1); 4584 if (c.indexOf(name) == 0) return c.substring(name.length, c.length); 4585 } 4586 return ""; 4587 } 4588 4589 var IsLiveEditOn = function () { 4590 return GetCookie("enableLiveEdit") === "true"; 4591 }; 4592 4593 if (IsLiveEditOn() && isUserLoggedIn()) { 4594 $('body').addClass('liveEditOn'); 4595 } 4596 4597 setTimeout(function () { 4598 $('.mobile.header .mobileMenu').css('top', $('#divToolbars .mobileAlertBar').outerHeight(true)); 4599 }, 10); 4600 4601 $('div.mobile.header > a.mobileMenu').unbind().click(function (e) { 4602 e.preventDefault(); 4603 $('#menuPanel').css('top', $('#divToolbars').outerHeight(true)); 4604 $('#menuPanel').toggle('slide'); 4605 window.scrollTo(0, 0); 4606 }); 4607 4608 // Set Heights really fast at first then after 4 seconds slow it down. 4609 if (typeof SetHeights === 'function') { 4610 4611 var stretchContainers = (typeof window.dynamicStretchContainers === 'function'); 4612 var setHeightInterval = setInterval(function () { 4613 if (!window.isRemoveSetHeights) 4614 SetHeights();
4615 if (stretchContainers) window.dynamicStretchContainers(); 4616 }, 50); 4617 4618 setTimeout(function () { 4619 clearInterval(setHeightInterval); 4620 if (IsLiveEditOn()) { 4621 setInterval(function () { 4622 if (!window.isRemoveSetHeights) 4623 SetHeights(); 4624 if (stretchContainers) window.dynamicStretchContainers(); 4625 }, 2000); 4626 } 4627 }, 4000); 4628 4629 } 4630 4631 //Do not execute for WidgetManager, it has a slightly different logic thats handled in WidgetManager code itself. 4632 if ($('#hdnWidgetManager').length == 0) { 4633 if (typeof rearrangeFlyouts === 'function') { 4634 setTimeout(function () { 4635 setInterval(function () { 4636 rearrangeFlyouts(false); 4637 }, 2000); 4638 }, 2000); 4639 } 4640 } 4641 4642 window.setTimeout(function () { moveMegaMenusInDOM({ direction: $('#megaMenuPopupDirection').val() }); }, 50); 4643 4644 frontEnd_removeAttributesFromGraphicLinks(); 4645 4646 if ($('.viewArchiveLink').length > 0) { 4647 $('body').addClass('cpViewArchiveOn'); 4648 } 4649 4650 //workaround to make legacy LE modal to be centered correctly 4651 $("body").append($("#ctl00_ctl00_MainContent_ctl00_liveEditPopupWindow")).append($("#editItemBehavior_backgroundElement")); 4652 4653 //Workaround to adjust the toolbar dropdowns dynamically based on the .cpToolbar height + some other initialization stuff for Layout. 4654 Core.Layout.toggleFeatureColumn(); 4655 4656 Core.Layout.attachTabbedWidgetTabHandlers(); 4657 4658 //when clicking on error details links 4659 $("a.errorDetails").on("click.errorDetails", function (e) { 4660 e.preventDefault(); 4661 $(this).next("div").slideToggle('fast'); 4662 }); 4663 4664 $("img.imageHover").on("mouseenter.imageHover", function () { 4665 $(this).attr('src', $(this).data("hover")); 4666 }).on("mouseleave.imageHover", function () { 4667 $(this).attr('src', $(this).data("image")); 4668 }); 4669 4670 // Setup handlers for My Account toolbar 4671 var $Favorites = $('#favoritesList'); 4672 var $UserMenu = $('.cpToolbar .userMenu .popOut'); 4673 $Favorites.hide(); 4674 $UserMenu.hide(); 4675 4676 $('a[href="#favoritesList"]').click(function (e) { 4677 e.preventDefault(); 4678 if ($Favorites.hasClass('open')) { 4679 $Favorites.slideUp(200); 4680 } else { 4681 slideToggle($Favorites, true, 200); 4682 } 4683 $Favorites.toggleClass('open'); 4684 }); 4685 4686 $('.cpToolbar .popOutContainer > a').click(function (e) { 4687 if ($UserMenu.hasClass('open')) { 4688 $UserMenu.slideUp(200); 4689 } else { 4690 $UserMenu.slideDown(200); 4691 } 4692 $UserMenu.toggleClass('open'); 4693 }); 4694 4695 //Authentication 4696 $('.requireSignIn').on("keypress", function () { 4697 $(this).click(); 4698 }); 4699 4700 $('.requireSignIn').on("mouseup", function (event) { 4701 event.preventDefault(); 4702 $(this).click(function (event) { event.preventDefault(); }); 4703 var $self = $(this); 4704 $.ajax({ 4705 url: '/Saml/IsSamlLoginEnabled?loginPage=LoginPageMyAccount', 4706 type: 'GET', 4707 success: function (response) { RequireSignInSuccess(response, $self) }, 4708 async: false 4709 }); 4710 }); 4711 4712 function RequireSignInSuccess(response, $elem) { 4713 if (response.IsSamlLoginEnabled) { 4714 window.location = '/Admin/Saml/LogonRequest?RelayState=' + window.location.pathname.substring(1); 4715 } 4716 else { 4717 var popupBasedAuthenticationJs = new PopupBasedAuthentication(); 4718 popupBasedAuthenticationJs.requireLoggedIn($elem.attr('href'), ''); 4719 } 4720 } 4721 4722 flipHandlesIfNecessary(); 4723 $(window).scroll(function () { 4724 $('.flipHandles').removeClass('flipHandles'); 4725 }); 4726 4727 if (location.search.toLowerCase().indexOf('preview=yes') > -1 || location.search.toLowerCase().indexOf('print=yes') > -1) { 4728 $('body').addClass('printPreview'); 4729 } 4730 else { 4731 $('body').removeClass('printPreview'); 4732 } 4733 4734 $('#viewFullWebsiteOnMobile').unbind('click').click(function () { 4735 var curDate = new Date(); 4736 curDate.setHours(curDate.getHours() + 2); 4737 var curDateInUTCStringFormat = curDate.toUTCString(); 4738 document.cookie = "forceMobileOff=true; expires=" + curDateInUTCStringFormat + "; path=/"; 4739 }); 4740 4741 $('#backToMobileView').unbind('click').click(function () { 4742 //expire the cookie 4743 document.cookie = "forceMobileOff=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/"; 4744 }); 4745 4746 if ($("iframe").length > 0) { 4747 $.getScript('/Assets/Scripts/attrchange.js', function () { 4748 $.getScript('/Assets/Scripts/attrchange_ext.js', function () { 4749 $("iframe").attrchange({ callback: function (event) { if (!window.isRemoveSetHeights) SetHeights(); } }); 4750 }); 4751 }); 4752 } 4753 4754 //Apply classes to parent containers and initialize the stickyStructuralContainers class
4755 if (typeof (StickyStructuralContainers) === 'function') { 4756 stickyStructuralContainers = new StickyStructuralContainers(); 4757 } 4758 4759 var liveEditEnabled = getCookieValue("enableLiveEdit") === "true"; 4760 if (typeof (Animations) === 'function') { 4761 var animations = new Animations(); 4762 //If live edit enabled, give it a delay for animation classes to apply properly. 4763 if (liveEditEnabled) { 4764 setTimeout(function () { 4765 animations.Apply(); 4766 }, 4767 100); 4768 } else { 4769 //Apply animation classes and triggers 4770 animations.Apply(); 4771 } 4772 } 4773 4774 //Fixes image cache problem on iOS safari 4775 if (/iPhone|iPad|iPod/i.test(navigator.userAgent)) { 4776 $(".graphicButtonLink").removeAttr("onmouseover"); 4777 } 4778 4779 $('.cp-modificationProhibited').on("click", function () { 4780 if ($(this).hasClass('cp-modificationProhibited')) { 4781 showWidgetDisabledPopUp(); 4782 } 4783 }); 4784 4785 $('.pageCopyEditWidgetModal').on("click", function () { 4786 savePageCopy(); 4787 }); 4788 4789 $('.closeEditWidgetModal').on("click", function () { 4790 closeModal(); 4791 }); 4792 4793 $('.viewMap, .viewMapAsLink').on("click", function () { 4794 executeViewMapPostClickActions($(this)); 4795 }); 4796 4797 // Mobile skip link handler 4798 if (window.FeatureToggles && window.FeatureToggles.isActive("CMS.JqueryUpgrade.UpgradeTo371")) 4799 initializeSkipLinkHandlers(); 4800}); 4801 4802$(window).on("load", function () { 4803 if (stickyStructuralContainers) { 4804 stickyStructuralContainers.init(); 4805 // Fire resize handlers to recalculate any height adjustments required after sticky container setup. 4806 var resizeHandlers = window.Pages && window.Pages.onResizeHandlers || []; 4807 resizeHandlers.forEach(function (handler) { handler(); }); 4808 } 4809 $('[class*="pageloadAnimationTrigger"]').each( 4810 function () { 4811 $(this).addClass('animation-triggered'); 4812 }); 4813 4814 setTimeout(function () { 4815 //Fix for blank target elements with rel attributes to avoid phishing attack. 4816 var blankTargetElements = $("[target='_blank']"); 4817 $.each(blankTargetElements, function (index, element) { 4818 $(element).attr("rel", "noopener"); 4819 }); 4820 }, 175); 4821 4822 $('body').find('table').removeAttr('border'); 4823 $('body').find('table').removeAttr('cellspacing'); 4824 $('body').find('table').removeAttr('cellpadding'); 4825}); 4826 4827function flipHandlesIfNecessary() { 4828 $('.widget').unbind('mouseover').mouseover(function (e) { 4829 var $this = $(this); 4830 var $innerCol = $this.parents('div.inner.col'); 4831 if ($innerCol != null && !$innerCol.hasClass('flipHandles') && $('#ysnEnableLiveEdit').is(':checked')) { 4832 var $removeHandle = $innerCol.find('.handle.remove'); 4833 var $toolbarHeight = $('.cpToolbars').outerHeight(true); 4834 var $removeHandleHeight = $removeHandle.outerHeight(); 4835 if ($removeHandle.length > 0) { 4836 var $removeHandleTop = $removeHandle.offset().top - $(document).scrollTop(); 4837 if (parseFloat($toolbarHeight - $removeHandleTop) >= parseFloat($removeHandleHeight / 3)) 4838 $innerCol.addClass('flipHandles'); 4839 else 4840 $innerCol.removeClass('flipHandles'); 4841 } 4842 } 4843 }); 4844} 4845 4846function reinitCarousels() { 4847 if (window.carouselsToInit && window.carouselsToInit != undefined) { 4848 for (var i = 0; i < window.carouselsToInit.length; i++) { 4849 carouselsToInit[i](); 4850 } 4851 } 4852} 4853 4854function SetHeights() { 4855 if ($('body').hasClass('mobile') || $('.pageContent.dragging').length > 1 || !window.Core.performSetHeights) { 4856 return; 4857 } 4858 4859 var originalScrollPosition = $('body').scrollTop(); 4860 if (!originalScrollPosition) { 4861 originalScrollPosition = $('html').scrollTop(); 4862 } 4863 4864 // Grow the heights and set them in place. 4865 $('.inner.col, .outer.col, .resize, .indicator.vertical, div.widgetSpacer').css('height', 'auto'); 4866 4867 var adjustColumnHeights = function () { 4868 if (typeof CustomAdjustHeights === 'function') { 4869 CustomAdjustHeights(); 4870 return; 4871 } 4872 $('.row.nest.wide').each(function () { 4873 var height = $(this).outerHeight(); 4874 if (height < 15) { 4875 height = 15; 4876 } 4877 $(this).children('.inner.col, .resize, .indicator.vertical').css('height', height + "px"); 4878 }); 4879 4880 $('.row.outer.wide:not(.autoWidths)').each(function () { 4881 var height = $(this).outerHeight(); 4882 if (height < 15) { 4883 height = 15; 4884 } 4885 $(this).children('.outer.col, .resize, .indicator.vertical, .row.nest.first.last > .inner.col') 4886 .css('height', height + "px"); 4887 $(this).find('.outer.col > .row.nest.first.last > .inner.col').css('height', height + "px"); 4888 4889 }); 4890 }; 4891 4892 adjustColumnHeights();
4893 4894 var autoWidthRowsHandler = function ($this) { 4895 var height = 15; 4896 $this.children('.col').each(function () { 4897 var columnHeight = $(this).outerHeight(); 4898 if (columnHeight > height) { 4899 height = columnHeight; 4900 } 4901 }); 4902 $this.find('.indicator.vertical').height(height); 4903 }; 4904 4905 $('.outer.row.autoWidths.wide').each(function () { 4906 autoWidthRowsHandler($(this)); 4907 4908 $(this).find('.row').each(function () { 4909 autoWidthRowsHandler($(this)); 4910 }); 4911 }); 4912 4913 if (!window.isResponsiveEnabled || getCookieValue("enableLiveEdit") === "true") { 4914 $('div.widgetSpacer').each(function () { 4915 var $spacer = $(this); 4916 var $innerCol = $spacer.parent(), 4917 $innerRow = $innerCol.parent(); 4918 4919 if ($innerRow.hasClass("first") && $innerRow.hasClass("last")) { 4920 var outerRowHeight = $innerRow.parent().parent().height(), 4921 innerColPadding = $innerCol.css("padding-top").replace("px", ""), 4922 spacerHeight = outerRowHeight - (2 * parseInt(innerColPadding, 10)); 4923 $spacer.height(spacerHeight); 4924 $innerCol.height(spacerHeight); 4925 } else { 4926 var innerColHeight = $innerCol.innerHeight(); 4927 if (innerColHeight > 30) 4928 $spacer.height(innerColHeight); 4929 else 4930 $spacer.height(30); //default spacer height 4931 } 4932 }); 4933 } 4934 4935 adjustColumnHeights(); 4936 4937 $('.outer.col').height('auto'); 4938 if (!iOSSafari) { 4939 $('html,body').scrollTop(originalScrollPosition); 4940 } 4941 setBannerHeights(); 4942 reinitCarousels(); 4943} 4944 4945function frontEnd_removeAttributesFromGraphicLinks() { 4946 $('.widgetGraphicLinks li.GraphicLinks > a > img').removeAttr('height').removeAttr('width'); 4947} 4948 4949function closeModalDialog(behaviourID) { 4950 var behavior = $find(behaviourID); 4951 4952 if (behavior) 4953 behavior.hide(); 4954 else 4955 closeCpModal(); 4956} 4957 4958function SetMegaMenuToOpenAbove() { 4959 moveMegaMenusInDOM({ direction: '1' }); 4960} 4961function SetMegaMenuToOpenBelow() { 4962 moveMegaMenusInDOM({ direction: '0' }); 4963} 4964
4965function changeModalDialogHeight(height, showDetails) { 4966 var ifr = document.getElementById('liveEditDialog'); 4967 if (ifr) 4968 ifr.style.height = height + 'px'; 4969 if (showDetails != '') 4970 document.cookie = "showAddDetails=" + showDetails + ";"; 4971} 4972 4973function setModalClassForEditItemBehavior(cssClass, showDetails) { 4974 var behaviorID = $find('editItemBehavior'); 4975 var modalContainer = document.getElementById(behaviorID._PopupControlID); 4976 if (modalContainer) 4977 modalContainer.className = 'modalContainer modalContainerCP ' + cssClass; 4978 if (showDetails != '') 4979 document.cookie = "showAddDetails=" + showDetails + ";"; 4980} 4981 4982function loadStyleSheet(href, id) { 4983 var styleSheet = document.createElement('link'); 4984 styleSheet.type = 'text/css'; 4985 styleSheet.rel = 'stylesheet'; 4986 styleSheet.setAttribute('href', href); 4987 if (id) { 4988 styleSheet.setAttribute('id', id); 4989 } 4990 var head = document.getElementsByTagName('head')[0]; 4991 head.appendChild(styleSheet); 4992} 4993 4994function enableLiveEdit(checked) { 4995 4996 var $liveEditTabs = $('#liveEditTabs'); 4997 if (checked) { 4998 document.cookie = "enableLiveEdit=true; expires=12/31/2999; path=/"; 4999 $('.handle').show(); 5000 $('#bodyWrapper').removeClass('noTransition'); 5001 $('#LiveEditCSS').prop('disabled', false); 5002 var versionTitle = $('#versionHeadLine').text(); 5003 $('#versionHeadLine').html('<a id="versionHeadLineOptionsHandle" href="#" class="handle options" title="Version Options">Version Options</a>'); 5004 $('#versionHeadLine').append($('<span contenteditable="true">').attr('data-versiontitle', versionTitle).text(versionTitle)); 5005 $('#versionHeadLineOptionsHandle').unbind().click(function () { 5006 versionActions(ContentCollectionInstance.VersionID, 'edit', { "pageID": ContentCollectionInstance.PageID, "versionID": ContentCollectionInstance.VersionID }); 5007 }); 5008 if ($('#404Content').length > 0 || $('#pagePageID').val() === '') { 5009 location.reload(); 5010 } else if ($liveEditTabs.length > 0) { 5011 redrawContextualInnerToolbar(window.ContentCollectionInstance.PageID, window.ContentCollectionInstance.VersionID); 5012 window.ContentCollectionInstance.reloadContent(); 5013 InitializeContainers(); 5014 setTimeout(window.ContentCollectionInstance.refreshNavContainers, 10); 5015 refreshMegaMenusForLiveEdit(); 5016 showLiveEditElement($liveEditTabs); 5017 if (liveEditTabs.currentState !== 'closed') { 5018 liveEditTabs.setBodyPadding(); 5019 } 5020 } else { 5021 $.ajax({ 5022 url: '/LiveEditMarkup', 5023 type: 'GET', 5024 cache: false, 5025 async: false, 5026 success: function (response) { 5027 var $body = $('body'); 5028 $body.append(response).addClass('liveEditOn'); 5029 loadStyleSheet('/Areas/Pages/Assets/Styles/Home.css'); 5030 loadStyleSheet('/Assets/AdminRefresh/LiveEdit/Styles/LiveEdit.css', 'LiveEditCSS'); 5031 if (!window.ContentCollectionInstance) { 5032 window.ContentCollectionInstance = new ContentCollectionClass(); 5033 window.ContentCollectionInstance.init(); 5034 } 5035 5036 if (!window.ResizeData) { 5037 window.ResizeData = new ResizeClass(); 5038 } 5039 redrawContextualInnerToolbar(window.ContentCollectionInstance.PageID, window.ContentCollectionInstance.VersionID); 5040 var moduleID = $('#pageModuleID').val(); 5041 if (moduleID == '') { 5042 moduleID = 76; 5043 } else { 5044 moduleID = Number(moduleID); 5045 } 5046 renderLiveEditTabs(moduleID); 5047 5048 window.ContentCollectionInstance.reloadContent(); 5049 InitializeContainers(); 5050 setTimeout(window.ContentCollectionInstance.refreshNavContainers, 10); 5051 refreshMegaMenusForLiveEdit(); 5052 }, 5053 error: function (xhr, textStatus, exception) { 5054 alert("Error: " + xhr.statusText + "\nStatus: " + xhr.status); 5055 } 5056 }); 5057 } 5058 triggerStickyStructuralInitLogic(); 5059 //no responsive when live edit enabled, so default to wide view 5060 $('.widget.narrow').each(function () { 5061 var $this = $(this); 5062 $this.removeClass('narrow').addClass('wide'); 5063 }); 5064 $('.tabbedWidgetNarrow.cpTabs:not(.accordion)').hide(); 5065 $('.tabbedWidget.cpTabs').show(); 5066 Core.Layout.attachTabbedWidgetTabHandlers(); 5067 if ($('script:contains("audioeye.com")').length >= 1) { 5068 $('script:contains("audioeye.com")').remove(); 5069 } 5070 } 5071 else { 5072 document.cookie = "enableLiveEdit=false; expires=12/31/2999; path=/"; 5073 $('#liveEditMenu').hide(); 5074 setTimeout(window.ContentCollectionInstance.refreshNavContainers, 10); 5075 refreshMegaMenusForLiveEdit(); 5076 var publishedVersion = $liveEditTabs.length > 0 && $('#hdnVersionStatus').val() === '40'; 5077 var isPublishedVersionAndContainsTabbedWidget = publishedVersion && $('.widgetTabbed').length > 0;
5078 if (!publishedVersion || isPublishedVersionAndContainsTabbedWidget) 5079 location.reload(); 5080 5081 $('body.liveEditOn').removeClass('liveEditOn').addClass('liveEditOff'); 5082 window.ContentCollectionInstance.reloadContent(null, null, true); 5083 loadMediaFramework(); 5084 $('#bodyWrapper').attr('style', ''); 5085 $('#versionHeadLineOptionsHandle').remove(); 5086 $('#versionHeadLine').text($('#versionHeadLine').text()); 5087 $('a.editCustomHtml').hide(); 5088 hideLiveEditElement($liveEditTabs); 5089 hideLiveEditElement($('#innerToolbar')); 5090 triggerStickyStructuralInitLogic(); 5091 setTimeout(function () { 5092 $('#LiveEditCSS').prop('disabled', true); 5093 }, 666); 5094 //For some reason, loadMediaFramework doesnt load MediaFramework.js on disabling live edit, this forces it to download it again hence fixing a responsive issue. 5095 if (window.cpMedia) { 5096 window.cpMedia = undefined; 5097 var scriptSrc = ''; 5098 var script = document.createElement('script'); 5099 script.async = false; 5100 script.type = 'text/javascript'; 5101 scriptSrc = '/Assets/Scripts/RWD/MediaFramework.js'; 5102 script.src = scriptSrc; 5103 document.body.appendChild(script); 5104 } 5105 Core.Layout.attachTabbedWidgetTabHandlers(); 5106 $.ajax({ 5107 url: '/IncludeScript/AudioEyeScript/', 5108 type: 'GET', 5109 cache: false, 5110 async: false, 5111 success: function (response) { 5112 if (response) { 5113 var scriptText = $(response)[2].innerText; 5114 var s = document.createElement("script"); 5115 s.type = "text/javascript"; 5116 s.text = scriptText; 5117 document.body.appendChild(s); 5118 } 5119 }, 5120 error: function (xhr, textStatus, exception) { 5121 alert("Error: " + xhr.statusText + "\nStatus: " + xhr.status); 5122 } 5123 }); 5124 } 5125 5126 //If IE, simply perform location.reload in order to execute _rootfrontend file again to render the IE meta tag according to settings. This tag cannot be 5127 //added dynamically, so a reload is required for (https://civicplus.tpondemand.com/entity/29964). 5128 if (window.isie) { 5129 location.reload(); 5130 return; 5131 } 5132 5133} 5134 5135function refreshMegaMenusForLiveEdit() { 5136 setTimeout(function () { 5137 var megaMenuContentContainers = $('[data-displaymegamenu="True"]') 5138 .map(function () { 5139 $('#mainNavMegaMenu' + $(this).data('pageid') + ' div.pageContent').html('Loading...'); 5140 return $('#mainNavMegaMenu' + $(this).data('pageid') + ' div.pageContent').data('containerid'); 5141 }).toArray(); 5142 window.Pages.megaMenuLoaded.resolve(); 5143 reloadSharedContentContainers(megaMenuContentContainers); 5144 }, 200); 5145} 5146 5147function showHideUnpublishedItems(checked) { 5148 if (checked) { 5149 document.cookie = "showAll=true; expires=12/31/2999 23:59:59; path=/"; 5150 document.getElementById('ysnLiveEditShowMyActionItems').checked = true; 5151 document.getElementById('ysnLiveEditShowMyActionItems').disabled = true; 5152 } 5153} 5154 5155function showHideUnpublishedItems(checked) { 5156 var actionItemsCheckbox = document.getElementById('ysnLiveEditShowMyActionItems'); 5157 document.cookie = `showAll=${checked}; expires=12/31/2999 23:59:59; path=/`; 5158 5159 if (actionItemsCheckbox) { 5160 actionItemsCheckbox.checked = checked; 5161 actionItemsCheckbox.disabled = checked; 5162 showHideActionItems(checked); 5163 } 5164} 5165 5166function showHideActionItems(checked) { 5167 if (checked) 5168 document.cookie = "showActionItems=true; expires=12/31/2999 23:59:59; path=/"; 5169 else 5170 document.cookie = "showActionItems=false; expires=12/31/2999 23:59:59; path=/"; 5171 5172 if (typeof redrawContent == 'function') 5173 redrawContent(); 5174 else 5175 location.reload(true); 5176} 5177 5178function showHideLiveEditControl(checked) { 5179 if (checked) 5180 document.cookie = "showLiveEditControls=true; expires=12/31/2999 23:59:59;"; 5181 else 5182 document.cookie = "showLiveEditControls=false; expires=12/31/2999 23:59:59;"; 5183 5184 //if (typeof redrawContent == 'function' && !$.browser.msie) 5185 // redrawContent(); 5186 //else 5187 location.reload(true); 5188} 5189 5190function disableCustomHtmlRendering(checked) { 5191 if (checked) 5192 document.cookie = "disableCustomHtmlRendering=true; expires=12/31/2999 23:59:59; path=/"; 5193 else 5194 document.cookie = "disableCustomHtmlRendering=false; expires=12/31/2999 23:59:59; path=/"; 5195 5196 location.reload(true); 5197} 5198 5199// Print preview. 5200function pPreview(mode) { 5201 var printStr = 'PREVIEW=YES'; 5202 if (mode == 1) 5203 printStr = 'PRINT=YES'; 5204 var url = document.URL.split("#")[0]; 5205 window.open(url + (url.indexOf("?") == -1 ? '?' : '&') + printStr, '_blank'); 5206} 5207 5208function Navigate(txtAction) { 5209 if (txtAction.lastIndexOf("&") == txtAction.length - 1) 5210 txtAction = txtAction.slice(0, -1); 5211 document.frmNavigate.action = txtAction; 5212 location.href = txtAction; 5213} 5214 5215// todo: rename to openModalDialog, to match closeModalDialog 5216function openGenericModalDialog(height, className, title, src) { 5217 document.getElementById('ctl00_LiveEditModalTitle').innerHTML = title; 5218 5219 behavior = $find('editItemBehavior'); 5220 5221 if (behavior) { 5222 var ifr = document.getElementById('liveEditDialog'); 5223 var target = document.getElementById('ctl00_ctl00_MainContent_ctl00_liveEditPopupWindow'); 5224 5225 ifr.src = src; 5226 5227 if (className) 5228 target.className = 'modalContainer ' + className; 5229 if (height) 5230 ifr.style.height = height; 5231 5232 ifr.style.display = 'block'; 5233 5234 behavior.show(); 5235 } 5236} 5237 5238function expandCollapseCategory(catID) { 5239 if (commonLocalization == null) { 5240 commonLocalization = GetJson('/Localization/Index'); 5241 } 5242 5243 if (document.getElementById(catID).style.display == 'none') { 5244 $('#cat' + catID + ' > a').attr('title', commonLocalization.CollapseThisCategory); 5245 document.getElementById(catID).style.display = 'block'; 5246 document.getElementById('a_' + catID).innerHTML = '▼'; 5247 } 5248 else { 5249 $('#cat' + catID + ' > a').attr('title', commonLocalization.ExpandThisCategory); 5250 document.getElementById(catID).style.display = 'none'; 5251 document.getElementById('a_' + catID).innerHTML = '►'; 5252 } 5253} 5254 5255function slideToggle(element, bShow, duration) { 5256 var $el = $(element) 5257 , visible = $el.is(":visible"); 5258 5259 // if the bShow isn't present, get the current visibility and reverse it 5260 if (arguments.length == 1) bShow = !visible; 5261 5262 // if the current visiblilty is the same as the requested state, cancel 5263 if (bShow == visible) return false; 5264 5265 $.each($el, function (i, e) { 5266 var $e = $(e); 5267 var visible = $e.is(":visible"); 5268 var height = $e.show().height(); 5269 if (!$e.data("originalHeight")) { 5270 $e.data("originalHeight", height); 5271 }; 5272 if (!visible) $e.hide().css({ height: 0 }); 5273 }); 5274 5275 // expand the knowledge (instead of slideDown/Up, use custom animation which applies fix) 5276 if (bShow) { 5277 $.each($el, function (i, e) { 5278 $e = $(e); 5279 $e.show().animate({ height: $e.data("originalHeight") }, { duration: duration }); 5280 }); 5281 } else { 5282 $el.animate({ height: 0 }, { 5283 duration: duration, complete: function () { 5284 $el.hide(); 5285 } 5286 }); 5287 } 5288 $el.queue(function () { $el.height('auto'); $(this).dequeue(); }); 5289} 5290 5291 5292$(window).on("load", function () { 5293 removeEmptyFeaturedAreas(); 5294 //Run these once here since window.load invokes after images are loaded as well in the DOM. This fixes one of the issues where the landscape version of the page on ipad etc has images all messed up 5295 //since SetHeights run before the images are loaded in the DOM 5296 if (window.isResponsiveEnabled) { 5297 if (typeof SetHeights === 'function' && !window.isRemoveSetHeights) 5298 SetHeights();
5299 if (typeof dynamicStretchContainers === 'function') 5300 dynamicStretchContainers(); 5301 } 5302}); 5303 5304function GetSignIn() { 5305 $.get('Services/ForgotPassword.ashx?Username=' + encodeURIComponent(userName), function (data) { 5306 if (data == -1) 5307 alert($("#Localization_AccountDoesNotExist").val()); 5308 else 5309 alert($("#Localization_PasswordReminder").val()); 5310 }); 5311} 5312 5313function PerformSignIn() { 5314 var userName = $('#UserName').val(); 5315 var password = $('#Password').val(); 5316 var rememberMe = $('#RememberMe').val(); 5317 var emailAddress = $('#UserName').val(); 5318 var url; 5319 $.post('/MyAccount/SignInJson?' + 5320 'UserName=' + userName + 5321 '&Password=' + password + 5322 '&RememberMe=' + rememberMe + 5323 '&EmailAddress=' + emailAddress 5324 , function (data) { 5325 if (data.status != 1) 5326 alert(data.msg); 5327 else { 5328 if (data.HasAcceptedTerms == true) { 5329 url = getParameterByName('url'); 5330 url = url == '' ? window.location.href : url; 5331 try { 5332 var redirectUrl = new URL(url, window.location.href); 5333 if (redirectUrl.protocol === window.location.protocol && redirectUrl.host === window.location.host) 5334 window.location.href = redirectUrl.href; 5335 } catch (e) { } 5336 } 5337 else { 5338 window.location.href = '/MyAccount/Terms'; 5339 } 5340 } 5341 }); 5342} 5343 5344function SignIn() { 5345 window.location.href = '/MyAccount?from=url&url=' + window.location.pathname + window.location.search; 5346} 5347 5348function SignOut() { 5349 var url = '/publiclogin.aspx?out=true&txtRedirect=' + window.location.pathname.substring(1) + window.location.search; 5350 var dn = getParameterByName('dn'); 5351 if (dn != undefined) { 5352 if (!dn.toLowerCase().startsWith('http')) 5353 dn = 'http://' + dn; 5354 try { 5355 var dnUrl = new URL(dn); 5356 if (dnUrl.protocol === 'http:' || dnUrl.protocol === 'https:') { 5357 url = dn + url; 5358 } 5359 } catch (e) { } 5360 } 5361 5362 window.location.href = url; 5363} 5364 5365function getParameterByName(name) { 5366 var match = RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search); 5367 return match && decodeURIComponent(match[1].replace(/\+/g, ' ')); 5368} 5369 5370//Share current page url using common mvc modal (only for mvc modules) 5371function openShareEmailPageModal(subject) { 5372 var emailSubject = (subject && subject != '') ? subject : document.title; 5373 openCpModal({ 5374 type: 'POST', 5375 data: { 5376 subject: emailSubject 5377 }, 5378 title: 'Email This Page', 5379 className: 'emailPage', 5380 url: '/EmailPage/Home/EmailPageModal' 5381 }); 5382} 5383 5384function openShareEmailPageModalWithReferrel(subject, urlReferrer) { 5385 var emailSubject = (subject && subject != '') ? subject : document.title; 5386 openCpModal({ 5387 type: 'POST', 5388 data: { 5389 subject: emailSubject, 5390 specificUrlReferrer: urlReferrer 5391 }, 5392 title: 'Email This Page', 5393 className: 'emailPage', 5394 url: '/EmailPage/Home/EmailPageModalWithSpecificUrl', 5395 elementID: 'mvcModal' 5396 }); 5397} 5398 5399//Share current page url redirecting to email page (for legacy pages do not support new mvc modal) 5400function openShareEmailPage(subject) { 5401 var emailSubject = (subject && subject != '') ? subject : document.title; 5402 window.location.href = '/EmailPage/?subject=' + escape(emailSubject); 5403} 5404 5405//Layout Banners 5406function renderBanner(bannerPlaceHolderID, bannerSlotID, bannerOption, bannerImage, imageFolder, imageTag) { 5407 var $bannerSlot = $('#' + bannerSlotID); 5408 var $bannerPlaceHolder = $('#' + bannerPlaceHolderID); 5409 var images = bannerOption.BannerImages; 5410 const sequenceId = Date.now() % (images.length || 1); 5411 bannerImage = bannerOption.BannerMode === 2 ? images[sequenceId] : bannerImage; 5412 //render external banner 5413 $bannerPlaceHolder.replaceWith(createBannerExternalMarkup($bannerSlot, bannerOption, bannerImage, imageFolder, imageTag)); 5414 var stickyContainers = $('div.stickyInnerDiv.sticky'); 5415 if (stickyContainers.length > 0) { 5416 $('#bodyWrapper .bannerObject.external').css('top', '0'); 5417 } 5418 setTimeout(function () { 5419 if (!window.isRemoveSetHeights) 5420 SetHeights(); 5421 }, 5500); 5422} 5423 5424function centerImage(parentWidth, parentHeight, imageWidth, imageHeight) { 5425 var left = 0; 5426 //Adjust width to view port proportionally 5427 var proportionRatio = 1; 5428 if (imageWidth > parentWidth) { 5429 proportionRatio = (imageWidth - parentWidth) / imageWidth; 5430 imageHeight -= imageHeight * proportionRatio; 5431 } else if (imageWidth < parentWidth) { 5432 proportionRatio = (parentWidth - imageWidth) / imageWidth; 5433 imageHeight += imageHeight * proportionRatio; 5434 } 5435 imageWidth = parentWidth; 5436 5437 if (imageHeight < parentHeight) { 5438 //Readjust Height to view port proportionally 5439 proportionRatio = (parentHeight - imageHeight) / imageHeight; 5440 imageWidth += imageWidth * proportionRatio; imageHeight = parentHeight; 5441 left = -1 * (imageWidth - parentWidth) / 2; //move left to center image 5442 } 5443 5444 return { imageWidth: imageWidth, imageHeight: imageHeight, left: left }; 5445} 5446 5447function createBannerExternalMarkup($bannerSlot, bannerOption, bannerImage, imageFolder, imageTag) { 5448 if (!window.isRemoveSetHeights) 5449 SetHeights();
5450 if (typeof window.dynamicStretchContainers === 'function') window.dynamicStretchContainers(); 5451 5452 var parentHeight = $bannerSlot.parent().outerHeight(true); 5453 var windowHeight = $(window).height(); 5454 var imageHeight = bannerImage.Height; 5455 var isBackgroundBanner = $bannerSlot.parent().attr("id") == "bodyWrapper" || $bannerSlot.parent().parent().attr("id") == "bodyWrapper"; 5456 var left = 0; 5457 5458 if (isBackgroundBanner && windowHeight > parentHeight) { 5459 parentHeight = windowHeight; 5460 } 5461 5462 var imageWidth = bannerImage.Width; 5463 if (bannerOption.ImageScale) { 5464 var parentWidth = $bannerSlot.outerWidth(true); 5465 if (isBackgroundBanner) { 5466 parentHeight = windowHeight; 5467 } 5468 var centerValues = centerImage(parentWidth, parentHeight, imageWidth, imageHeight); 5469 imageWidth = centerValues.imageWidth; 5470 parentHeight = centerValues.imageHeight; 5471 left = centerValues.left; 5472 } 5473 5474 if (bannerImage.FileName.startsWith('/')) { 5475 imageFolder = ''; 5476 } 5477 5478 var $img = (!imageTag) 5479 ? $('<img class="bannerObject" src="' + imageFolder + bannerImage.FileName + '" alt="">') 5480 : $(imageTag); 5481 $img.attr("width", imageWidth + "px"); 5482 $img.css("position", "absolute"); 5483 5484 switch (bannerOption.ImageAlignment) { 5485 case 1: 5486 case "Left": 5487 $img.css("left", "0"); 5488 $img.css("margin", "0"); 5489 break; 5490 case 2: 5491 case "Center": 5492 $img.css("left", "50%"); 5493 $img.css("margin", "0 0 0 -" + Math.round(bannerImage.Width / 2) + "px"); 5494 break; 5495 case 3: 5496 case "Right": 5497 $img.css("right", "0px"); 5498 $img.css("margin", "0"); 5499 break; 5500 } 5501 5502 var position = 'position: ' + (bannerOption.ImageScroll ? 'absolute;' : 'fixed;'); 5503 var $bodyWrapper = $("#bodyWrapper"); 5504 if (!bannerOption.ImageScroll) { 5505 left += parseInt($bodyWrapper.css("padding-left"), 10); //workaround for fixed position 5506 } 5507 5508 var html = '<div class="bannerObject external" id="bannerDiv' + $bannerSlot.attr('id') + '" style="min-height: ' + parentHeight + 'px ;top: 0px; left: ' + left + 'px; right: 0; ' + position + ' overflow: hidden; z-index: -999999; padding: 0px;"></div>'; 5509 5510 var $html = $(html).append($img); 5511 $html.attr('data-image-scale', bannerOption.ImageScale); 5512 5513 var oldScreenHeight = screen.height; 5514 var oldScreenWidth = screen.width; 5515 //bind windows resize event if needed 5516 $(window).unbind('resize.banner' + bannerOption.SlotName); 5517 if (bannerOption.ImageScale) { 5518 $(window).bind('resize.banner' + bannerOption.SlotName, function () { 5519 if (screen.height !== oldScreenHeight && screen.width !== oldScreenWidth) { 5520 oldScreenHeight = screen.height; 5521 oldScreenWidth = screen.width; 5522 resize($bannerSlot); 5523 } 5524 }); 5525 } 5526 ///private function that takes care of resizing when image scale 5527 var resize = function ($bannerSlotContainer) { 5528 var parentHeight = $bannerSlotContainer.parent().outerHeight(true); 5529 var windowHeight = $(window).height(); 5530 var left = 0; 5531 5532 if (isBackgroundBanner && windowHeight > parentHeight) { 5533 parentHeight = windowHeight; 5534 } 5535 5536 var imageWidth = bannerImage.Width; 5537 if (bannerOption.ImageScale) { 5538 var parentWidth = $bannerSlotContainer.outerWidth(true); 5539 if (isBackgroundBanner) { 5540 parentHeight = windowHeight; 5541 } 5542 var centerValues = centerImage(parentWidth, parentHeight, imageWidth, imageHeight); 5543 imageWidth = centerValues.imageWidth; 5544 parentHeight = centerValues.imageHeight; 5545 left = centerValues.left; 5546 } 5547 5548 if (!bannerOption.ImageScroll) { 5549 left += parseInt($bodyWrapper.css("padding-left"), 10); //workaround for fixed position 5550 } 5551 5552 $html.css("left", left); 5553 $html.find('img.bannerObject').width(imageWidth); 5554 $html.css("min-height", parentHeight + "px"); 5555 }; 5556 5557 window.Pages = window.Pages || {}; 5558 window.Pages.Banners = window.Pages.Banners || {}; 5559 $(window.Pages.Banners).bind('ExternalBannersResize', function () { resize($bannerSlot); }); // resize external banners 5560 5561 if (jQuery.resize) { 5562 $bannerSlot.children(":not(.bannerObject, script)").unbind("resize").bind("resize", function () { $(window.Pages.Banners).trigger('ExternalBannersResize'); }); 5563 } 5564 5565 if (bannerOption.ImageScale) { 5566 window.Pages.onResizeHandlers = window.Pages.onResizeHandlers || []; 5567 window.Pages.onResizeHandlers.push(function () { 5568 $(window.Pages.Banners).trigger('ExternalBannersResize'); 5569 }); 5570 } 5571 5572 setTimeout(function () { 5573 if (!window.isRemoveSetHeights) 5574 SetHeights();
5575 }, 8000); 5576 return $html; 5577}; 5578 5579function setBannerHeights() { 5580 $('div.bannerObject.external').each(function () { 5581 var $this = $(this); 5582 var isBackgroundBanner = $this.parent().attr("id") == "bodyWrapper" || $this.parent().parent().attr("id") == "bodyWrapper"; 5583 var parentHeight = parentHeight = $this.parent().outerHeight(true); 5584 var windowHeight = $(window).height(); 5585 5586 if (isBackgroundBanner && windowHeight > parentHeight) { 5587 parentHeight = windowHeight; 5588 } 5589 5590 if ($this.attr('data-image-scale') === "true") { 5591 $this.css('min-height', $this.find('img').height()); 5592 } else { 5593 $this.css('min-height', parentHeight); 5594 } 5595 }); 5596} 5597 5598//Creates slideshow markup for external banners. 5599function createBannerExternalMarkupForSlideshow($bannerSlot, bannerOption, imageFolder, bannerImagesJSON, bannerMode, rotatingSequence) { 5600 if (!window.isRemoveSetHeights) 5601 SetHeights(); 5602 if (typeof window.dynamicStretchContainers === 'function') window.dynamicStretchContainers(); 5603 5604 var parentHeight = $bannerSlot.parent().outerHeight(true); 5605 var parentWidth = $bannerSlot.outerWidth(true); 5606 var windowHeight = $(window).height(); 5607 var isBackgroundBanner = $bannerSlot.parent().attr("id") == "bodyWrapper" || $bannerSlot.parent().parent().attr("id") == "bodyWrapper"; 5608 var greaterImageWidth = 0, greaterImageHeight = 0; 5609 var left = 0; 5610 5611 if (isBackgroundBanner && windowHeight > parentHeight) { 5612 parentHeight = windowHeight; 5613 } 5614 5615 var img = ''; 5616 for (var i = 0; i < bannerImagesJSON.length; i++) { 5617 var bannerImage = bannerImagesJSON[i]; 5618 var imageWidth = bannerImagesJSON[i].Width; 5619 if (imageWidth > greaterImageWidth) 5620 greaterImageWidth = imageWidth; 5621 if (bannerImagesJSON[i].Height > greaterImageHeight) 5622 greaterImageHeight = bannerImagesJSON[i].Height; 5623 var alignmentCss = ""; 5624 switch (bannerOption.ImageAlignment) { 5625 case 1: 5626 case "Left": 5627 alignmentCss += 'left: 0; margin: 0;'; 5628 break; 5629 case 2: 5630 case "Center": 5631 alignmentCss += ' left: 50%; margin: 0 0 0 -' + Math.round(bannerImage.Width / 2) + 'px;'; 5632 break; 5633 case 3: 5634 case "Right": 5635 alignmentCss += ' right: 0px; margin: 0;'; 5636 break; 5637 } 5638 if (bannerOption.ImageScale) { 5639 imageWidth = parentWidth; 5640 } 5641 5642 var tempImageFolder = imageFolder; 5643 if (bannerImagesJSON[i].FileName.startsWith('/')) { 5644 tempImageFolder = ''; 5645 } 5646 5647 if (bannerMode === 'Slideshow') { 5648 if (i > 0) { 5649 img += '<img class="bannerObject" width="' + imageWidth + 'px" style="position: absolute; display: none;' + alignmentCss + '" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-is-delayed="true" data-delayed-image="' + tempImageFolder + bannerImagesJSON[i].FileName + '" alt="">'; 5650 } else { 5651 img += '<img class="bannerObject" width="' + imageWidth + 'px" style="position: absolute;' + alignmentCss + '" src="' + tempImageFolder + bannerImagesJSON[i].FileName + '" data-is-delayed="false" alt="">'; 5652 } 5653 } 5654 else if (bannerMode === 'Rotating') { 5655 if (rotatingSequence < 0) { 5656 rotatingSequence = 0; 5657 } 5658 var rotSeqLessOne = rotatingSequence === 0 ? bannerImagesJSON.length - 1 : rotatingSequence - 1; 5659 var rotSeqPlusOne = rotatingSequence === bannerImagesJSON.length - 1 ? 0 : rotatingSequence + 1; 5660 if (bannerOption.SlideshowControlsPosition === 0 || bannerOption.SlideshowControlsPosition === 'None') { 5661 if (i === rotatingSequence) { 5662 img += '<img class="bannerObject" width="' + imageWidth + 'px" style="position: absolute;' + alignmentCss + '" src="' + tempImageFolder + bannerImagesJSON[i].FileName + '" data-is-delayed="false" alt="">'; 5663 } 5664 } else { 5665 if (i === rotSeqLessOne || i === rotatingSequence || i === rotSeqPlusOne) { 5666 img += '<img class="bannerObject" width="' + imageWidth + 'px" style="position: absolute;' + alignmentCss + '" src="' + tempImageFolder + bannerImagesJSON[i].FileName + '" data-is-delayed="false" alt="">'; 5667 } else { 5668 img += '<img class="bannerObject" width="' + imageWidth + 'px" style="position: absolute;' + alignmentCss + '" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-is-delayed="true" data-delayed-image="' + tempImageFolder + bannerImagesJSON[i].FileName + '" alt="">'; 5669 } 5670 } 5671 } 5672 5673 } 5674 5675 var position = 'position: ' + (bannerOption.ImageScroll ? 'absolute;' : 'fixed;'); 5676 var $bodyWrapper = $("#bodyWrapper"); 5677 if (!bannerOption.ImageScroll) { 5678 left += parseInt($bodyWrapper.css("padding-left"), 10); //workaround for fixed position 5679 } 5680 var html = '<div class="bannerObject external" id="bannerDiv' + $bannerSlot.attr('id') + '" style="min-height: ' + parentHeight + 'px ;top: 0; left: ' + left + 'px; right: 0; ' + position + ' overflow: hidden; z-index: -999999; padding: 0px;">' 5681 + img + '</div>'; 5682 5683 var $html = $(html); 5684 $html.attr('data-image-scale', bannerOption.ImageScale); 5685 5686 ///private function that takes care of resizing when image scale 5687 var resize = function ($bannerSlotContainer) { 5688 var parentHeight = $bannerSlotContainer.parent().outerHeight(true); 5689 var windowHeight = $(window).height(); 5690 var left = 0; 5691
5692 if (isBackgroundBanner && windowHeight > parentHeight) { 5693 parentHeight = windowHeight; 5694 } 5695 5696 var imageWidth = greaterImageWidth; 5697 if (bannerOption.ImageScale) { 5698 var parentWidth = $bannerSlotContainer.outerWidth(true); 5699 if (isBackgroundBanner) { 5700 parentHeight = windowHeight; 5701 } 5702 var centerValues = centerImage(parentWidth, parentHeight, imageWidth, greaterImageHeight); 5703 imageWidth = centerValues.imageWidth; 5704 parentHeight = centerValues.imageHeight; 5705 left = centerValues.left; 5706 } 5707 5708 if (!bannerOption.ImageScroll) { 5709 left += parseInt($bodyWrapper.css("padding-left"), 10); //workaround for fixed position 5710 } 5711 5712 $html.css("left", left); 5713 $html.find('img.bannerObject').width(imageWidth); 5714 $html.css("min-height", parentHeight + "px"); 5715 }; 5716 5717 var displayArrows = function ($bannerSlotContainer) { 5718 var $bannerSlideshowControls = $('#bannerSlideshowControls_' + $bannerSlotContainer[0].id); 5719 var windowWidth = $(window).width(); 5720 if ($bannerSlideshowControls.length > 0 && windowWidth < 416) { 5721 $bannerSlideshowControls.hide(); 5722 $html.removeClass('fixedBanner'); 5723 } else if ($bannerSlideshowControls.length > 0 && windowWidth >= 416 && !$bannerSlideshowControls.hasClass("none")) { 5724 $bannerSlideshowControls.show().removeAttr('style'); 5725 $html.addClass('fixedBanner'); 5726 } 5727 } 5728 5729 //bind windows resize event if needed 5730 $(window).unbind('resize.banner' + bannerOption.SlotName); 5731 if (bannerOption.ImageScale) { 5732 window.Pages.onResizeHandlers = window.Pages.onResizeHandlers || []; 5733 window.Pages.onResizeHandlers.push(function () { 5734 resize($bannerSlot); 5735 }); 5736 resize($bannerSlot); 5737 } 5738 5739 window.Pages.onResizeHandlers = window.Pages.onResizeHandlers || []; 5740 window.Pages.onResizeHandlers.push(function () { 5741 displayArrows($bannerSlot); 5742 }); 5743 5744 var $bannerSlideshowControls = $('#bannerSlideshowControls_' + $bannerSlot[0].id); 5745 if ($bannerSlideshowControls.length > 0) { 5746 $html.addClass('fixedBanner'); 5747 } 5748 5749 return $html; 5750} 5751 5752//Render Slideshow for External banners. 5753function renderExternalBannerSlideshow(bannerSlotID, bannerOption, imageFolder, bannerMode) { 5754 var bannerImagesJSON = bannerOption.BannerImages; 5755 5756 if (!bannerOption.SlideShowSlideTiming) { 5757 bannerOption.SlideShowSlideTiming = 1; 5758 } 5759 if (!bannerOption.SlideShowTransitionTiming) { 5760 bannerOption.SlideShowTransitionTiming = 1; 5761 } 5762 5763 const rotatingSequence = bannerMode === 'Rotating' ? Date.now() % (bannerImagesJSON.length || 1) : 0; 5764 5765 var slideTransitionTiming = parseFloat(bannerOption.SlideShowSlideTiming) * 1000; 5766 var transitionTiming = parseFloat(bannerOption.SlideShowTransitionTiming) * 1000; 5767 5768 var $bannerSlot = $('#' + bannerSlotID); 5769 var imagesHtml = createBannerExternalMarkupForSlideshow($bannerSlot, bannerOption, imageFolder, bannerImagesJSON, bannerMode, rotatingSequence); 5770 5771 var $imagesHtml = $(imagesHtml); 5772 $imagesHtml.insertAfter($('#bannerImagesJSON' + bannerOption.BannerOptionID)); 5773 5774 var images = null; 5775 images = $('div#bannerDiv' + bannerSlotID).find('img.bannerObject'); 5776 5777 if (bannerOption.SlideshowTransition == '1') // 1 corresponds to "none" 5778 { 5779 transitionTiming = 0; // A 0 transition time is the same as no transition. 5780 } 5781 5782 //Moves banner controls to the body level of the DOM to avoid layout issues with z-index 5783 if ($('.bannerSlideshowControlsNew.centered.container').length > 0) { 5784 var $banner = $('#' + bannerSlotID); 5785 $banner.prepend($('#bannerSlideshowControls_' + bannerSlotID)); 5786 } 5787 else { 5788 $(document.body).append($('#bannerSlideshowControls_' + bannerSlotID)); 5789 } 5790 5791 var ss = new SimpleSlideshow(images, transitionTiming, slideTransitionTiming, bannerMode, parseInt(rotatingSequence)); 5792 5793 if (window.FeatureToggles.isActive("CMS.DesignCenter.EnablePauseAndPlayForBannerSlideshow")) { 5794 $('#bannerSlideshowPlayPauseBtn_' + bannerSlotID).click(function () { 5795 ss.togglePause(); 5796 }); 5797 } 5798} 5799 5800function SimpleSlideshow($images, transitionTime, slideTime, bannerMode, rotatingSequence) { 5801 "use strict"; 5802 var slideshowRef = this; 5803 var $imageToBeShown = null; 5804 var $currentImage = null; 5805 var $nextImage = null; 5806 var $previousImage = null; 5807 //Setting the imageToShowIndex = -1 make sure that the 1st image showing in the slideshow is the 1st image in the slideshow. 5808 var imageToShowIndex = -1; 5809 var nextImageIndex = -1; 5810 var previousImageIndex = 0; 5811 var paused = false; 5812 var numberOfImages = $images.length; 5813 var onLoad = false; 5814 //Setting imageToShowIndex as the next rotating sequence if slideshow enhancements are enabled and option is refreshing 5815 if (bannerMode === 'Rotating' && numberOfImages > 1) { 5816 imageToShowIndex = rotatingSequence - 1; 5817 onLoad = true; 5818 } 5819 5820 var DEBUG = false; 5821 var diag = function (msg) { 5822 if (DEBUG) { 5823 console.log('[Simple Slideshow] ' + msg); 5824 } 5825 }; 5826 5827 slideshowRef.autoFadeNext = function () { 5828 if (!paused && bannerMode == 'Slideshow') { 5829 slideshowRef.goToNext(); 5830 } 5831 }; 5832 5833 slideshowRef.goToNext = function () { 5834 imageToShowIndex = imageToShowIndex >= (numberOfImages - 1) ? 0 : imageToShowIndex + 1; 5835 previousImageIndex = imageToShowIndex == 0 ? numberOfImages - 1 : imageToShowIndex - 1; 5836 nextImageIndex = imageToShowIndex < numberOfImages - 1 ? imageToShowIndex + 1 : 0; 5837 5838 $imageToBeShown = $($images[imageToShowIndex]); 5839 $nextImage = $($images[nextImageIndex]); 5840 if ($nextImage.data('is-delayed') == true) { 5841 $nextImage.attr('src', $nextImage.data('delayed-image'));
5842 (new Image()).src = $nextImage.data('delayed-image'); 5843 $nextImage.data('is-delayed', 'false'); 5844 $nextImage.data('delayed-image', ''); 5845 } 5846 $currentImage = $($images[previousImageIndex]); 5847 diag('Automatic transition next. Image To Show Index: ' + 5848 imageToShowIndex + 5849 ', Previous Image Index: ' + 5850 previousImageIndex); 5851 slideshowRef.sendBehindFront($imageToBeShown).show(); 5852 5853 if (!onLoad) { 5854 5855 if (numberOfImages == 1) { 5856 slideshowRef.sendToFront($currentImage).show(); 5857 } 5858 else if (numberOfImages > 1) { 5859 slideshowRef.sendToFront($currentImage) 5860 .show() 5861 .fadeOut(transitionTime, 5862 function () { 5863 diag('Fade out.'); 5864 setTimeout(slideshowRef.autoFadeNext, slideTime); 5865 }); 5866 } 5867 } 5868 }; 5869 5870 slideshowRef.goToPrevious = function () { 5871 imageToShowIndex = imageToShowIndex == 0 ? numberOfImages - 1 : imageToShowIndex - 1; 5872 previousImageIndex = imageToShowIndex == 0 ? numberOfImages - 1 : imageToShowIndex - 1; 5873 nextImageIndex = imageToShowIndex < numberOfImages - 1 ? imageToShowIndex + 1 : 0; 5874 5875 $imageToBeShown = $($images[imageToShowIndex]); 5876 $previousImage = $($images[previousImageIndex]); 5877 if ($previousImage.data('is-delayed') == true) { 5878 $previousImage.attr('src', $previousImage.data('delayed-image')); 5879 (new Image()).src = $previousImage.data('delayed-image'); 5880 $previousImage.data('is-delayed', 'false'); 5881 $previousImage.data('delayed-image', ''); 5882 } 5883 $currentImage = $($images[nextImageIndex]); 5884 5885 diag('Automatic transition next. Image To Show Index: ' + 5886 imageToShowIndex + 5887 ', Previous Image Index: ' + 5888 nextImageIndex); 5889 slideshowRef.sendBehindFront($imageToBeShown).show(); 5890 slideshowRef.sendToFront($currentImage) 5891 .show() 5892 .fadeOut(transitionTime, 5893 function () { 5894 diag('Fade out.'); 5895 setTimeout(slideshowRef.autoFadeNext, slideTime); 5896 }); 5897 5898 }; 5899 5900 this.pause = function () { 5901 paused = true; 5902 togglePlayPauseButton(); 5903 } 5904 5905 this.play = function () { 5906 paused = false; 5907 togglePlayPauseButton(); 5908 slideshowRef.autoFadeNext(); 5909 }; 5910 5911 this.togglePause = function () { 5912 if (paused) { 5913 this.play(); 5914 } else { 5915 this.pause(); 5916 } 5917 }; 5918 5919 function togglePlayPauseButton() { 5920 if (paused) { 5921 $('#slideshowPlayIcon').show(); 5922 $('#slideshowPauseIcon').hide(); 5923 $('.bannerSlideshowPlayPause-btn').attr('aria-label', 'Play Slideshow'); 5924 } else { 5925 $('#slideshowPlayIcon').hide(); 5926 $('#slideshowPauseIcon').show(); 5927 $('.bannerSlideshowPlayPause-btn').attr('aria-label', 'Pause Slideshow'); 5928 } 5929 } 5930 5931 this.sendToFront = function ($image) { 5932 $image.css('z-index', '3'); 5933 return $image; 5934 }; 5935 5936 this.sendBehindFront = function ($image) { 5937 $image.css('z-index', '2'); 5938 return $image; 5939 }; 5940 5941 window.setTimeout(function () { 5942 slideshowRef.autoFadeNext(); 5943 }, 500); 5944 5945 if (bannerMode == 'Rotating' && numberOfImages > 1) { 5946 this.goToNext(); 5947 } 5948 5949 var disabledNext = false; 5950 var disabledPrevious = false; 5951 $('a[id*="arrowNext_"],button[id*="arrowNext_"]').click(function (e) { 5952 if (disabledNext) { 5953 e.preventDefault(); 5954 return false; 5955 } 5956 slideshowRef.pause(); 5957 slideshowRef.goToNext(); 5958 disabledNext = true; 5959 setTimeout(function () { 5960 disabledNext = false; 5961 }, 1000); 5962 e.preventDefault(); 5963 }); 5964 5965 $('a[id*="arrowPrev_"],button[id*="arrowPrev_"]').click(function (e) { 5966 if (disabledPrevious) { 5967 e.preventDefault(); 5968 return false; 5969 } 5970 slideshowRef.pause(); 5971 slideshowRef.goToPrevious(); 5972 disabledPrevious = true; 5973 setTimeout(function () { 5974 disabledPrevious = false; 5975 }, 1000); 5976 e.preventDefault(); 5977 }); 5978 onLoad = false; 5979} 5980 5981//External banner for videos 5982function renderBannerVideo(bannerPlaceHolderID, bannerSlotID, bannerVideo, videoTag) { 5983 if (bannerVideo == null) 5984 return; 5985 var $bannerSlot = $('#' + bannerSlotID); 5986 var $bannerPlaceHolder = $('#' + bannerPlaceHolderID); 5987 var isBackgroundBanner = $bannerSlot.parent().attr("id") == "bodyWrapper" || $bannerSlot.parent().parent().attr("id") == "bodyWrapper"; 5988 5989 var html = '<div class="bannerObject external" id="bannerDiv' + $bannerSlot.attr('id') + '" style="top: 0; left: 0px; right: 0; position: absolute; overflow: hidden; z-index: -999999; padding: 0px;"></div>'; 5990 var $html = $(html); 5991 5992 // Inserting html elements before resizing because they need to be on DOM beforehand. 5993 $bannerPlaceHolder.after($html);
5994 // Workaround. videotag needs to be added with jquery html() function in order to prevent issues with cache JQuery version has 5995 $bannerPlaceHolder.next().html(videoTag); 5996 5997 ///private function that takes care of resizing for video 5998 var resize = function ($bannerSlotContainer) { 5999 var parentHeight = $bannerSlotContainer.parent().outerHeight(true); 6000 var windowHeight = $(window).height(); 6001 var left = 0; 6002 6003 if (isBackgroundBanner && windowHeight > parentHeight) { 6004 parentHeight = windowHeight; 6005 } 6006 6007 var videoHeight = bannerVideo.VideoHeight; 6008 var videoWidth = bannerVideo.VideoWidth; 6009 //by default video will always scale 6010 var parentWidth = $bannerSlotContainer.outerWidth(true); 6011 if (isBackgroundBanner) { 6012 parentHeight = windowHeight; 6013 } 6014 var centerValues = centerImage(parentWidth, parentHeight, videoWidth, videoHeight); 6015 videoWidth = centerValues.imageWidth; 6016 parentHeight = centerValues.imageHeight; 6017 left = centerValues.left; 6018 6019 var $html = $bannerPlaceHolder.next(); 6020 $html.css("left", left); 6021 $html.find('video').css("width", videoWidth + "px"); 6022 $html.find('img').css("width", videoWidth + "px"); 6023 $html.css("min-height", parentHeight + "px"); 6024 }; 6025 6026 //bind windows resize event if needed 6027 $(window).unbind('resize.banner' + bannerSlotID); 6028 window.Pages.onResizeHandlers = window.Pages.onResizeHandlers || []; 6029 window.Pages.onResizeHandlers.push(function () { 6030 resize($bannerSlot); 6031 }); 6032 //adjust resize first time 6033 resize($bannerSlot); 6034 6035 // Pause/Play button event binding 6036 6037 if (window.FeatureToggles.isActive("CMS.DesignCenter.EnablePauseAndPlayForBannerVideo") && $('button[id*="bannerVideoToggleBtn_"]').length) { 6038 $('button[id*="bannerVideoToggleBtn_"]').click(function (e) { 6039 e.preventDefault(); 6040 toggleVideoPlayPause($bannerSlot) 6041 }); 6042 } 6043 6044 if (window.FeatureToggles.isActive("CMS.DesignCenter.EnablePauseAndPlayForBannerVideo")){ 6045 $('button[id*="bannerVideoToggleBtn_"]').on('keydown', function (e) { 6046 if (e.key === 'Enter' || e.key === ' ') { 6047 e.preventDefault(); 6048 toggleVideoPlayPause($bannerSlot); 6049 } 6050 }); 6051 } 6052} 6053 6054function toggleVideoPlayPause($bannerSlot) { 6055 let playIcon = $("#videoPlayIcon"); 6056 let pauseIcon = $("#videoPauseIcon"); 6057 let iconTitle = $("#videoIconTitle"); 6058 let button = $(".bannerVideoToggle-btn"); 6059 let $bannerObject = $bannerSlot.children('.bannerObject'); 6060 let video = $bannerObject.find('video')[0]; 6061 if (video) { 6062 if (video.paused) { 6063 video.play(); 6064 playIcon.hide(); 6065 pauseIcon.show(); 6066 button.attr("aria-label", "Pause Video"); 6067 iconTitle.text("Pause Video"); 6068 } 6069 else { 6070 video.pause(); 6071 playIcon.show(); 6072 pauseIcon.hide(); 6073 button.attr("aria-label", "Play Video"); 6074 iconTitle.text("Play Video"); 6075 } 6076 } 6077} 6078 6079//removes empty feature areas 6080function removeEmptyFeaturedAreas() { 6081 $('div[id^="featureArea"]').each(function () { 6082 if ($(this).html().trim() == "") { 6083 $(this).parent().css("display", "none"); 6084 } 6085 }); 6086 6087 $('div[id^="featureContent"]').each(function () { 6088 if ($(this).html().trim() == "") { 6089 $(this).css("display", "none"); 6090 } 6091 }); 6092} 6093 6094function setWidgetServiceHovering($widgetHeader, bindKeyPress, additionalLogic) { 6095 if (window.isMobileBrowserIncludingTablets) { 6096 setWidgetServiceClicking($widgetHeader, bindKeyPress, additionalLogic); 6097 return; 6098 } 6099 var $widgetBody = $widgetHeader.next(); 6100 var $parent = $widgetHeader.parent(); 6101 var timeOutID = null; 6102 var hideDelay = 400; 6103 var showDelay = 300; 6104 $widgetHeader.bind("mouseenter.services", function () { 6105 clearTimeout(timeOutID); 6106 timeOutID = setTimeout(function () { 6107 if (!$widgetBody.is(':visible')) 6108 adjustFlyoutPosition($parent, $widgetBody); 6109 $widgetBody.show(); 6110 additionalLogic(); 6111 }, showDelay); 6112 }); 6113 $widgetHeader.bind("mouseleave.services", function () { 6114 clearTimeout(timeOutID); 6115 timeOutID = setTimeout(function () { 6116 $widgetBody.hide(); 6117 additionalLogic(); 6118 }, hideDelay); 6119 }); 6120 $widgetBody.children().bind("mouseenter.services", function () { 6121 clearTimeout(timeOutID); 6122 timeOutID = setTimeout(function () { 6123 if (!$widgetBody.is(':visible')) 6124 adjustFlyoutPosition($parent, $widgetBody); 6125 $widgetBody.show(); 6126 additionalLogic(); 6127 }, showDelay); 6128 });
6129 $widgetBody.children().bind("mouseleave.services", function () { 6130 clearTimeout(timeOutID); 6131 timeOutID = setTimeout(function () { 6132 $widgetBody.hide(); 6133 additionalLogic(); 6134 }, hideDelay); 6135 }); 6136 6137 if (bindKeyPress) { 6138 $widgetHeader.unbind("keypress").bind("keypress", function (e) { 6139 if (e.which === 13) { 6140 $widgetHeader.trigger("mouseenter.services"); 6141 } 6142 }); 6143 } 6144} 6145 6146function setWidgetServiceClicking($widgetHeader, bindKeyPress, additionalLogic) { 6147 var $widgetBody = $widgetHeader.next(); 6148 var $parent = $widgetHeader.parent(); 6149 6150 var click = function (e) { 6151 e.stopPropagation(); 6152 e.preventDefault(); 6153 //If the Flyout is for a megamenu, add a class of forMegaMenu. 6154 if ($widgetHeader.parents('.megaMenu').length > 0) 6155 $widgetBody.addClass('forMegaMenu'); 6156 if (!$widgetBody.is(':visible')) 6157 adjustFlyoutPosition($parent, $widgetBody); 6158 $widgetBody.toggle(); 6159 if (!window.isRemoveSetHeights) 6160 SetHeights(); 6161 6162 additionalLogic(); 6163 }; 6164 6165 $widgetHeader.unbind("click").bind("click", click); 6166 6167 if (bindKeyPress) { 6168 $widgetHeader.unbind("keypress").bind("keypress", function (e) { 6169 if (e.which === 13) { 6170 click(e); 6171 } 6172 }); 6173 } 6174} 6175 6176function setWidgetSearchClicking($widgetHeader) { 6177 var $widgetBody = $widgetHeader.next(); 6178 $widgetHeader.unbind("click").bind("click", function (e) { 6179 e.stopPropagation(); 6180 e.preventDefault(); 6181 $widgetBody.toggle(); 6182 if (!window.isRemoveSetHeights) 6183 SetHeights() 6184 }); 6185} 6186 6187//removes empty feature content areas for IE7 6188function removeEmptyFeaturedAreas() { 6189 $('div[class^="html5aside"]').each(function () { 6190 if ($(this).html().trim() === "") { 6191 $(this).remove(); 6192 } 6193 }); 6194} 6195 6196 6197LayoutClass.prototype.debouncedStyleSheetUpdate = (function () { 6198 var writeStylesTimeouts = {}; 6199 var DEBUG = false; 6200 6201 var diag = DEBUG && console && console.log ? 6202 function (msg) { 6203 console.log('[Debounced Stylesheet Update] ' + msg); 6204 } 6205 : function () { }; 6206 6207 6208 // Original Function We are Debouncing to update stylesheet. 6209 var updateStylesheet = function (styleSheetID, styles, isEditor) { 6210 diag('Debounced Call'); 6211 var styleSheet = document.getElementById(styleSheetID); 6212 isEditor = isEditor === undefined ? false : isEditor; 6213 if (!isEditor) { 6214 //Include misc styles from Theme properties. 6215 if ($('#hdnThemePropertiesMiscStyles').length > 0 && $('#hdnThemePropertiesMiscStyles').html() != '') 6216 styles += $('#hdnThemePropertiesMiscStyles').html(); 6217 } 6218 if (styleSheet == null) { 6219 styleSheet = document.createElement('style'); 6220 styleSheet.id = styleSheetID; 6221 styleSheet.setAttribute('type', 'text/css'); 6222 var head = document.getElementsByTagName('head')[0]; 6223 head.appendChild(styleSheet); 6224 } 6225 if (styleSheet.styleSheet) { 6226 styleSheet.styleSheet.cssText = styles; //IE only 6227 } else { 6228 styleSheet.innerHTML = styles; 6229 } 6230 }; 6231 6232 return function (styleSheetID, styles) { 6233 diag('Bounce Call'); 6234 if (writeStylesTimeouts[styleSheetID]) { 6235 clearTimeout(writeStylesTimeouts[styleSheetID]); 6236 } 6237 writeStylesTimeouts[styleSheetID] = setTimeout(function () { updateStylesheet(styleSheetID, styles); }, 100); 6238 }; 6239}()); 6240 6241LayoutClass.prototype.updateStylesheet = function (styleSheetID, styles) { 6242 this.debouncedStyleSheetUpdate(styleSheetID, styles); 6243}; 6244 6245//Usage: Core.Layout.toggleFeatureColumn(); 6246LayoutClass.prototype.toggleFeatureColumn = function () { 6247 if ($('#pageShowFeatureColumn').val() == 'True') { 6248 $('body').addClass('withFeatureColumn'); 6249 $('#featureColumn').show(); 6250 } else { 6251 $('body').removeClass('withFeatureColumn'); 6252 $('#featureColumn').hide(); 6253 } 6254 6255 if (typeof SetHeights == 'function' && !window.isRemoveSetHeights) { 6256 SetHeights(); 6257 } 6258}; 6259 6260//Usage: Core.Layout.stretchContainers(containerSelectors); 6261LayoutClass.prototype.stretchContainers = function (containerSelectors) { 6262 this.unstretchContainers(containerSelectors); 6263 $(containerSelectors).each(function () { 6264 var $container = $(this); 6265 var height = $container.outerHeight(); 6266 $container.siblings().each(function () { 6267 var $sibling = $(this); 6268 if ($sibling.css('float') != 'none') { 6269 var siblingHeight = $sibling.outerHeight(); 6270 height = siblingHeight > height ? siblingHeight : height; 6271 } 6272 }); 6273 if (height >= ($container.outerHeight())) { 6274 6275 var desiredContainerHeight = height; 6276 var $innermostWrapper = $container; 6277 6278 //The paddings of the container itself needs to be considered as well since we allow for paddings on the structural containers too. 6279 //This fixes the height issues we have been having with several sites(neighboring containers dont match he
6279ight) Vishal 6280 var $wrappers = $innermostWrapper; 6281 6282 while ($innermostWrapper.children('.inner').length) { 6283 $wrappers = $wrappers.add($innermostWrapper.children('.inner')); 6284 $innermostWrapper = $innermostWrapper.children('.inner'); 6285 } 6286 6287 var paddingHeight = 0; 6288 6289 $wrappers.each(function () { 6290 $this = $(this); 6291 paddingHeight += parseFloat($this.css('paddingTop')) + parseFloat($this.css('paddingBottom')) + parseFloat($this.css('borderBottomWidth')) + parseFloat($this.css('borderTopWidth')); 6292 }); 6293 6294 var calculatedHeight = desiredContainerHeight - paddingHeight; 6295 var heightString = calculatedHeight.toString() + 'px'; 6296 $innermostWrapper.css('min-height', heightString); 6297 } 6298 }); 6299 6300 setTimeout(function () { 6301 if (!window.isRemoveSetHeights) 6302 SetHeights(); 6303 }, 8000); 6304}; 6305 6306//Usage: Core.Layout.unstretchContainers(containerSelectors); 6307LayoutClass.prototype.unstretchContainers = function (containerSelectors) { 6308 $(containerSelectors).each(function () { 6309 var $container = $(this); 6310 $container.css('min-height', '0'); 6311 $('.inner', $container).css('min-height', '0'); 6312 }); 6313}; 6314 6315//Usage: Core.Layout.dynamicJavascript(javaScriptCode); 6316LayoutClass.prototype.dynamicJavascript = function (javaScriptCode) { 6317 var code = javaScriptCode.replace(/\\'/g, "'").replace(/\\\"/g, "\"").replace(/\\\t/g, "\t").replace(/\\\r/g, "\r").replace(/\\\n/g, "\n").replace(/\\\f/g, "\f").replace(/\\\\/g, "\\"); 6318 var myFucn = new Function(code); 6319 myFucn(); 6320}; 6321 6322//Usage: Core.Layout.setColumnWidth($widget); 6323LayoutClass.prototype.setColumnWidth = function ($widget) { 6324 var width = $('input.auto.update.widgetOption.common[name=WidgetWidth]').val(); 6325 $widget.closest('div.outer.col').css('width', width ? width + '%' : ""); 6326}; 6327 6328function LayoutClass() { 6329 this.filter = null; 6330} 6331 6332if (!window.Core.Layout) { 6333 window.Core.Layout = new LayoutClass(); 6334} 6335// Handles polling login status after ajax requests lazily, and notifying the user if they should be notified. 6336// The whole intention of this block of code is to alert the user they aren't logged in after executing an AJAX request 6337// without colliding with other AJAX requests or affecting user experience. This is only done if the user is initially logged in. 6338$(function () { 6339 var DEBUG = false; 6340 6341 var diag = function (msg) { 6342 if (DEBUG) { 6343 console.log("[Send User Home If Logged Out] " + msg); 6344 } 6345 }; 6346 6347 // We want to be able to start/load this at a specific time (after all of the initial ajax calls complete) so I wrapped it in a function. 6348 var isLoggedInModule = function () { 6349 "use strict"; 6350 diag('Initializing Send User Home If Logged Out module.'); 6351 var ns = this; 6352 var notLoggedInMessage = 'You are no longer logged in. Please login to continue.'; 6353 var loginCheckPending = false; 6354 6355 ns.initiallyLoggedInWithLiveEdit = $('[href="#liveEditMenu"]').hasClass('on'); 6356 6357 if (!ns.initiallyLoggedInWithLiveEdit) { 6358 diag('Initialization Stopped - Not initially logged in with Live Edit On.'); 6359 return; // We don't need to notify them they aren't logged in, if they aren't logged in initially. 6360 } 6361 6362 $.ajaxSetup({ 6363 beforeSend: function () { 6364 ns.isAjaxOccuring = true; 6365 }, 6366 complete: function () { 6367 diag('Ajax Call Completed (hook) - ' + (loginCheckPending ? 'Login Check is Pending.' : 'Login Check is not already Pending.')); 6368 ns.isAjaxOccuring = false; 6369 // If an ajax call is already occuring wait until it is finished. We don't want to affect the user experience with normal AJAX calls. 6370 if (!loginCheckPending) { 6371 lazyExecute( 6372 alertIfUserNotLoggedIn, 6373 function () { return !ns.isAjaxOccuring; }, 6374 2000 6375 ); 6376 } 6377 } 6378 }); 6379 6380 // Executes a function based on a condition lazily, checking a given predicate at a set interval. 6381 var lazyExecute = function (fn, executeWhenPredicate, pollingTime) { 6382 diag('Lazy Execution Triggered.'); 6383 loginCheckPending = true; 6384 var intervalExecuter = null; 6385 var internalHandler = function () { 6386 diag('Attempting to execute login check.'); 6387 if (executeWhenPredicate()) { 6388 fn(); 6389 clearInterval(intervalExecuter); 6390 diag('Login check is no longer pending. Login check invoked.'); 6391 loginCheckPending = false; 6392 } else { 6393 diag('AJAX request in progress. Trying again in a short bit.'); 6394 } 6395 }; 6396 6397 intervalExecuter = setInterval(internalHandler, pollingTime); 6398 } 6399 6400 var alertIfUserNotLoggedIn = function () { 6401 if (!isUserLoggedIn()) { 6402 alert('You are no longer logged in. Please login to continue.'); 6403 location.href = '/myaccount?from=url&url=' + window.location.pathname; 6404 } 6405 } 6406 } 6407 6408 // We don't need to start checking if the user is logged in until after everything is probably loaded. I went with 10 seconds 6409 setTimeout(isLoggedInModule, 6000); 6410}); 6411 6412//Begin Authentication 6413if (!window.location.origin) { 6414 window.location.origin = window.location.protocol + "//" + window.location.host; 6415} 6416 6417function popupSignIn(redirectUrl, parameterSet, jsCallback) { 6418 var popupBasedAuthenticationJs = new PopupBasedAuthentication(); 6419 6420 popupBasedAuthenticationJs.setupJsCallback(jsCallback); 6421 popupBasedAuthenticationJs.requireLoggedIn(redirectUrl, parameterSet); 6422};
6423 6424function internetExplorerMessagingHandlerForPopup(data) { 6425 var popupBasedAuthenticationJs = new PopupBasedAuthentication(); 6426 popupBasedAuthenticationJs.internetExplorerMessageHandling(data); 6427}; 6428 6429var internetExplorerVersion = (function () { 6430 var undef; 6431 6432 var agent = navigator.userAgent; 6433 var reg = /MSIE\s?(\d+)(?:\.(\d+))?/i; 6434 var matches = agent.match(reg); 6435 if (matches != null) { 6436 return matches[1]; 6437 } 6438 return undef; 6439}()); 6440//End authentication 6441 6442/******************************************************************************** 6443Logic for moving mega menus in DOM and updating their attributes. 6444/*******************************************************************************/ 6445function moveMegaMenusInDOM(data) { 6446 //Grab all the flyouts that are not moved yet and are not tooltips and not in WidgetManager 6447 var $megaMenus = $('.megaMenuContainer').not('.moved'); 6448 var $megaMenusAlreadyMoved = $('.megaMenuContainer.moved'); 6449 6450 var parentID; 6451 var marginLeft, marginTop; 6452 $megaMenus.each(function (e) { 6453 $(this).appendTo('body'); 6454 $(this).addClass('moved').addClass('megaMenu'); 6455 $(this).css('position', 'absolute'); 6456 $(this).css('z-index', '100'); 6457 updateMegaMenuAttributes($(this), data); 6458 }); 6459 $megaMenusAlreadyMoved.each(function (e) { 6460 updateMegaMenuAttributes($(this), data); 6461 }); 6462} 6463 6464function updateMegaMenusOnBrowserResize() { 6465 var $megaMenus = $('.megaMenuContainer'); 6466 $megaMenus.each(function () { 6467 updateMegaMenuAttributes($(this)); 6468 }); 6469} 6470 6471function updateMegaMenuAttributes($this, data) { 6472 //Enums 6473 var MegaMenuWidthReferenceEnum = { MainNavigation: 0, SitesContent: 1 }; 6474 var MegaMenuPopupDirectionEnum = { Below: 0, Above: 1 }; 6475 var widthReference = $('#megaMenuWidthReference').val(); 6476 var direction = $('#megaMenuPopupDirection').val(); 6477 6478 //If data has been provded, use it!. 6479 if (data != null) { 6480 if (data.widthReference != null) 6481 widthReference = data.widthReference; 6482 if (data.direction != null) 6483 direction = data.direction; 6484 } 6485 6486 //Get the main nav. 6487 var $mainNav = $('.siteNav.mainNav'); 6488 //Get the closest parent having a siteWrap class. 6489 var $siteWrap = $mainNav.closest('.siteWrap'); 6490 6491 var $referenceElem = null; 6492 if (widthReference == MegaMenuWidthReferenceEnum.MainNavigation) 6493 $referenceElem = $mainNav; 6494 else 6495 $referenceElem = $siteWrap; 6496 6497 if ($referenceElem != null && $referenceElem.length > 0) { 6498 //Set left position of megamenu 6499 $this.css('left', $referenceElem.offset().left + parseFloat($referenceElem.css('padding-left'))); 6500 //Set width of megamenu 6501 $this.css('width', $referenceElem.width()); 6502 } 6503 if (direction == null || direction == MegaMenuPopupDirectionEnum.Below) { 6504 //Set top position of megamenu. 6505 //NOTE: Even if the widthReference is set to SitesContent, the top position is calculated always using siteNav.mainNav since thats where the megamenu needs to be displayed. 6506 //The siteWrap is some scenarios contains all the content pushing the megamnus to show even below the footer. Vishal 6507 $this.css('top', $mainNav.offset().top + $mainNav.height()); 6508 } 6509 else { 6510 //Set top position of megamenu 6511 $this.css('top', '-' + ($this.height() - $('#divToolbars').height()) + 'px'); 6512 } 6513} 6514 6515function adjustMegaMenuDisplay(widthReference, direction) { 6516 var $megaMenu = $('#sampleMegaMenu'); 6517 updateMegaMenuAttributes($megaMenu, { widthReference: widthReference, direction: direction }); 6518} 6519/******************************************************************************** 6520Logic for moving mega menus in DOM and updating their attributes. 6521/*******************************************************************************/ 6522 6523/*********************************************************************************************************** 6524Common editor rendering functions used in multiple widgets(editor and InfoAdvanced so far) 6525/**********************************************************************************************************/
6526function renderSlideshowIfApplicable($element) { 6527 var $slideshow = $element.find('.cpSlideshowImages'); 6528 $slideshow.each(function (e) { 6529 var $this = $(this); 6530 var imgWidth = $this.attr('data-width'); 6531 var className = $this.attr('class'); 6532 var id = $this.attr('id'); 6533 var html = getSlideshowContent(id); 6534 6535 $this.replaceWith(html); 6536 6537 // Froala specific data 6538 //Add froala related classes and image attributes only after html is replaced. 6539 if (className.indexOf('fr-') > -1) { 6540 var inlineStyles = $this.attr("style"); 6541 var $images = $('.cpSlideshowJS' + id + ' img[data-delayed-image]'); 6542 $images.each(function (index) { 6543 var $image = $(this); 6544 $image.attr("style", inlineStyles); 6545 }); 6546 6547 // In-line and block classes 6548 if (this.classList.contains('fr-dib')) 6549 $('.cpSlideshowJS' + id).addClass('fr-dib'); 6550 else if (this.classList.contains('fr-dii')) 6551 $('.cpSlideshowJS' + id).addClass('fr-dii'); 6552 // Alignment classes 6553 if (this.classList.contains('fr-fil')) 6554 $('.cpSlideshowJS' + id).addClass('fr-fil'); 6555 else if (this.classList.contains('fr-fir')) 6556 $('.cpSlideshowJS' + id).addClass('fr-fir'); 6557 } 6558 6559 //If the slideshow has an alignment set in the editor, that alignment needs to be applied to the ol surrounding the images in slideshow. 6560 if (className.indexOf('float') > 0) { 6561 var applyClass = ''; 6562 switch (className) { 6563 case 'cpSlideshowImages floatRight': 6564 applyClass = 'floatRight'; 6565 break; 6566 case 'cpSlideshowImages floatLeft': 6567 applyClass = 'floatLeft'; 6568 break; 6569 case 'cpSlideshowImages floatCenter': 6570 applyClass = 'floatCenter'; 6571 break; 6572 case 'cpSlideshowImages floatJustify': 6573 applyClass = 'floatJustify'; 6574 break; 6575 } 6576 $('.cpSlideshowJS' + id).addClass(applyClass); 6577 } 6578 6579 // Changing the container size for an inline slideshow 6580 var $container = $('#divSlideshow' + id); 6581 var hasDii = $container.hasClass('fr-dii'); 6582 var hasFil = $container.hasClass('fr-fil'); 6583 var hasFir = $container.hasClass('fr-fir'); 6584 6585 if (hasDii && (hasFil || hasFir || (!hasFil && !hasFir))) { 6586 $container.css('width', imgWidth); 6587 $container.css('margin-right', '5px 5px 5px 0px'); 6588 } 6589 }); 6590} 6591 6592function getSlideshowContent(slideshowID) { 6593 var slideshowHtml = ''; 6594 $.ajax({ 6595 url: location.protocol + '//' + window.location.hostname + '/Slideshow/Render/' + slideshowID, 6596 type: 'POST', 6597 cache: false, 6598 async: false, 6599 success: function (response) { 6600 slideshowHtml = response; 6601 }, 6602 error: function (xhr, textStatus, exception) { 6603 alert("Error: " + xhr.statusText + "\nStatus: " + xhr.status); 6604 } 6605 }); 6606 return slideshowHtml; 6607} 6608/***************************************************************************************************************** 6609Common editor rendering functions used in multiple widgets(editor and InfoAdvanced so far) Ends 6610/****************************************************************************************************************/ 6611 6612///Gets absolute Url when given a relative Url. Useful for certain scenarios where http call is made under https hood and it fails. 6613function getAbsoluteUrl(relativeUrl) { 6614 var myAccount = $('#MyAccountLoginPage').val(); 6615 6616 if (myAccount != null && myAccount.toLowerCase() == "true") { 6617 var basePath = location.protocol + '//' + location.hostname + (typeof (location.port) !== 'undefined' && location.port != '' && location.port != '80' ? ':' + location.port : ''); 6618 return basePath + relativeUrl; 6619 } 6620 6621 return relativeUrl; 6622} 6623 6624function fireMediaQueriesIfNeeded($parent) { 6625 if (window.cpMedia) { 6626 fireMediaElementQueriesOfChildren($parent); 6627 } 6628} 6629 6630function loadMaps() { 6631 downloadGoogleMapsCustomScript(); 6632} 6633 6634function googleMapsCustomScriptDownloaded() { 6635 $('.googleMap').each(function (index, item) { 6636 new CivicPlus.Maps().LoadMap(item); 6637 }); 6638} 6639 6640function downloadGoogleMapsCustomScript() { 6641 if (typeof (CivicPlus) !== 'undefined') 6642 CivicPlus.Maps = {}; 6643 var script = document.createElement('script'); 6644 script.type = 'text/javascript'; 6645 if (script.readyState) { //IE 6646 script.onreadystatechange = function () { 6647 if (script.readyState === "loaded" || script.readyState === "complete") { 6648 script.onreadystatechange = null; 6649 if (window.googleMapsMode !== 2)//dynamic but lazy loaded 6650 googleMapsCustomScriptDownloaded(); 6651 } 6652 }; 6653 } else { //Others 6654 script.onload = function () { 6655 if (window.googleMapsMode !== 2)//dynamic but lazy loaded 6656 googleMapsCustomScriptDownloaded(); 6657 }; 6658 } 6659 6660 script.src = '/Assets/Scripts/GoogleMaps.js'; 6661 document.getElementsByTagName("head")[0].appendChild(script); 6662} 6663 6664function loadGoogleMapsScript(mode, callback) { 6665 var script; 6666 window.googleMapsMode = mode; 6667 if ($('div.widgetStaffDirectory').length > 0 || $('.DirectoryNormalText .mapWrap .googleMap').length > 0) { 6668 if ($('#GoogleMapsJS').length == 0) { 6669 script = document.createElement('script'); 6670 var key = document.getElementById('GoogleMapsKey').value; 6671 script.id = 'GoogleMapsJS'; 6672 script.type = 'text/javascript'; 6673 if (key != null) {
6674 script.src = 'https://maps.googleapis.com/maps/api/js?v=3.exp&key=' + encodeURIComponent(key) + '&callback='; 6675 } 6676 else { 6677 script.src = 'https://maps.googleapis.com/maps/api/js?v=3.exp&callback='; 6678 } 6679 script.src += mode !== 2 ? callback : 'downloadGoogleMapsCustomScript'; 6680 document.body.appendChild(script); 6681 } else { 6682 if (window.google && window.google.maps) { 6683 loadMaps(); 6684 } 6685 } 6686 } 6687} 6688$(window).on("load", function () { 6689 if (typeof targetHash !== "undefined" && targetHash) { 6690 smoothScroll(targetHash); 6691 } 6692 6693 $("a[href*='#']:not(a[href^='/#'], [href='#'])").click(function () { 6694 var $this = $(this)[0]; 6695 if (hashRegex.test($this.hash)) { 6696 if ($this.target !== '_blank') { 6697 if (location.pathname 6698 .replace(/^\//, '') === 6699 this.pathname.replace(/^\//, '') && 6700 location.hostname === this.hostname) { 6701 return smoothScroll(this.hash); 6702 } 6703 } 6704 } 6705 }); 6706 if (window.location && window.location.hash && $(window.location.hash.replace('/', '\\/')).offset()) { 6707 setTimeout(function () { 6708 $('html, body').animate({ 6709 scrollTop: $(window.location.hash).offset().top - calculateTotalFixedHeight() 6710 }, 300); 6711 }, 2000); 6712 } 6713}); 6714//Calculates the total fixed length 6715function calculateTotalFixedHeight() { 6716 var totalHeight = 0; 6717 6718 if ($('.fixedTop_ts').height()) { 6719 totalHeight += $('.fixedTop_ts').height(); 6720 } 6721 if ($('#divToolbars').height()) { 6722 totalHeight += $('#divToolbars').height(); 6723 } 6724 if ($('div.cp-Toolbars').height()) { 6725 totalHeight += $('div.cp-Toolbars').height(); 6726 } 6727 if ($('.stickyStructuralContainer').height()) { 6728 totalHeight += $('.stickyStructuralContainer').height(); 6729 } 6730 6731 return totalHeight; 6732} 6733 6734function smoothScroll(hash) { 6735 var target = $(hash); 6736 target = target.length ? target : $('[name=' + hash.slice(1) + ']'); 6737 if (!target.length) { 6738 return false; 6739 } 6740 var speed = target[0].getAttribute('data-smoothscrolling') ? 1333 : 1; 6741 var cpToolbarsHeight = $('div.cp-Toolbars').height() || 0; 6742 $('html, body').animate({ 6743 scrollTop: target.offset().top - ($('#divToolbars').height() + cpToolbarsHeight) 6744 }, speed); 6745 window.location.hash = ''; // Fixes chrome focus bug 6746 window.location.hash = hash; 6747 return false; 6748} 6749 6750function hideLiveEditElement(target) { 6751 target.addClass('hide'); 6752 setTimeout(function () { 6753 target.hide(); 6754 }, 666); 6755} 6756 6757function showLiveEditElement(target) { 6758 target.show(); 6759 setTimeout(function () { 6760 target.removeClass('hide'); 6761 }, 1); 6762} 6763 6764function redrawContextualInnerToolbar(pageID, versionID) { 6765 if (versionID > 0) { 6766 var url = '/Pages/Toolbar/Contextual?pageID=' + pageID + '&versionID=' + versionID; 6767 $.ajax({ 6768 url: url, 6769 type: 'GET', 6770 cache: false, 6771 success: function (response) { 6772 $('#informativeToolBar').remove(); 6773 var $toolbar = $('#innerToolbar'); 6774 if ($toolbar.length > 0) { 6775 $toolbar.replaceWith(response); 6776 } else { 6777 $('#divToolbars').append(response); 6778 } 6779 var toolbarHeight = $('#divToolbars').height() + 'px'; 6780 $('#bodyWrapper').css('padding-top', toolbarHeight); 6781 if (window.liveEditTabs != null && typeof (window.liveEditTabs.updateMaxHeightTabs) == "function") 6782 window.liveEditTabs.updateMaxHeightTabs(); 6783 InitializeToolbar(); 6784 if (window.Toolbars && window.Toolbars.ContextualToolbar) { 6785 $(window.Toolbars.ContextualToolbar).trigger('Loaded'); 6786 } 6787 $('.widgetSpacer').each(function () { 6788 var $this = $(this); 6789 if (!$this.hasClass('adminWrap')) { 6790 $this.addClass('adminWrap'); 6791 } 6792 }); 6793 }, 6794 error: function (xhr, textStatus, exception) { 6795 if (xhr.status !== 0 && xhr.readyState !== 0) 6796 alert('Error: ' + xhr.statusText + '\nStatus: ' + xhr.status); 6797 } 6798 }); 6799 } 6800} 6801 6802function InitializeToolbar() { 6803 $('#lnkVersionSaveAsCopy', '#ulVersionToolBar').unbind('click').click(function (e) { 6804 e.preventDefault(); 6805 if (!$(this).hasClass('inactive')) { 6806 SaveAsCopy(); 6807 } 6808 }); 6809 $('#lnkVersionCancel', '#ulVersionToolBar').unbind('click').click(function (e) { 6810 e.preventDefault(); 6811 if (!$(this).hasClass('inactive')) { 6812 AbandonWorkingCopy(); 6813 } 6814 }); 6815 $('#layoutPageSelector', "#LayoutToolBar").unbind('change').change(function () { 6816 var pageId = parseInt($(this).val(), 10); 6817 if (!isNaN(pageId)) 6818 window.location.href = "/" + pageId; 6819 }); 6820} 6821 6822function triggerStickyStructuralInitLogic() { 6823 setTimeout(function () { 6824 new StickyStructuralContainers().init(); 6825 }, 666); 6826} 6827 6828//Function to toggle for widget link. 6829function toggleWidgetsLink(isEnabled) { 6830 var widgetLink = $('#innerLnkwidgets'); 6831 6832 if (widgetLink) { 6833 if (isEnabled) { 6834 widgetLink.prop('disabled', false).removeClass('cp-modificationProhibited'); 6835 widgetLink[0].href = '#liveEditTab_widgets'; 6836 addClassToWidgets(true); 6837 } 6838 else { 6839 widgetLink.prop('disabled', true).addClass('cp-modificationProhibited'); 6840 widgetLink[0].href = '#'; 6841 addClassToWidgets(false); 6842 } 6843 } 6844} 6845 6846//Function to show/hide widget disabled popup. 6847function showWidgetDisabledPopUp() { 6848 var options = { 6849 title: 'Widget Edit', 6850 elementID: 'widgetDisabledPopup', 6851 autoAdjust: false, 6852 className: 'adminWrap accountActivation widgetPopUp popup-position', 6853 isFrontEnd: false, 6854 htmlContent: '<div class="modalScreen socialSignIn"><p>To modify this content, you\'ll have to create a copy of the page first.</p><p><a class="widget-disable socialButton twitter toTwitterPageSelect pageCopyEditWidgetModal cursor-pointer"><span class="socialButton-override">Copy Page</span></a><a class="widget-disable socialButton twitter toTwitterPageSelect closeEditWidgetModal cursor-pointer" style="padding-left:20px;"><span class="socialButton-override">Cancel</span></a></p></div>', 6855 draggable: true 6856 } 6857 6858 openCpModal(options); 6859} 6860 6861//Function to save page copy. 6862function savePageCopy() { 6863 SaveAsCopy(); 6864 closeModal(); 6865} 6866 6867//Function to close the modal 6868function closeModal() { 6869 hideModal('.modalContainer.modalContainerCP'); 6870} 6871 6872//Function to add class to widgets 6873function addClassToWidgets(isEnabled) { 6874 var pageContent = $('.pageContent div'); 6875 $.each(pageContent, function (index, item) { 6876 if (isEnabled) { 6877 $(item).removeClass('cp-modificationProhibited'); 6878 } 6879 else { 6880 $(item).addClass('cp-modificationProhibited'); 6881 } 6882 }); 6883} 6884 6885function initializeSkipLinkHandlers() { 6886 var skipLinks = document.querySelectorAll('#skipToContentLinks a'); 6887 if (!skipLinks.length) 6888 return; 6889 6890 skipLinks.forEach(function (link) { 6891 link.addEventListener('touchstart', handleSkipLinkActivation, { passive: false }); 6892 link.addEventListener('click', handleSkipLinkActivation); 6893 link.addEventListener('keydown', function (e) { 6894 if (e.key === 'Enter' || e.key === ' ') { 6895 handleSkipLinkActivation.call(link, e); 6896 } 6897 }); 6898 }); 6899} 6900 6901function handleSkipLinkActivation(e) { 6902 e.preventDefault(); 6903 e.stopPropagation(); 6904 6905 // Prevent duplicate execution on mobile (touchstart + click) 6906 if (e.type === 'click' && e.isTrusted === false) { 6907 return; 6908 } 6909 6910 // handle rapid touches (300ms threshold) 6911 var now = Date.now(); 6912 var lastActivation = this.dataset.lastActivation || 0; 6913 if (now - lastActivation < 300) { 6914 return; 6915 } 6916 6917 this.dataset.lastActivation = now; 6918 var href = this.getAttribute('href'); 6919 if (!href || href[0] !== '#' || href.length < 2) 6920 return; 6921 6922 var target = document.querySelector(href); 6923 if (!target) return; 6924 6925 var previousTabIndex = target.getAttribute('tabindex'); 6926 if (previousTabIndex === null) { 6927 target.setAttribute('tabindex', '-1'); 6928 } 6929 6930 void document.body.offsetHeight; 6931 6932 // Get toolbar elements 6933 var $divToolbars = $('#divToolbars'); 6934 var $cpToolbars = $('div.cp-Toolbars'); 6935 6936 var divToolbarsHeight = $divToolbars.length && $divToolbars.is(':visible') ? ($divToolbars.outerHeight(true) || 0) : 0; 6937 var cpToolbarsHeight = $cpToolbars.length && $cpToolbars.is(':visible') ? ($cpToolbars.outerHeight(true) || 0) : 0; 6938 6939 var toolbarHeight = divToolbarsHeight + cpToolbarsHeight; 6940 var $target = $(target); 6941 var targetOffsetTop = $target.offset().top; 6942 var targetTop = targetOffsetTop - toolbarHeight; 6943 6944 $('html, body').animate({scrollTop: targetTop}, 300, function () { 6945 try {
6946 target.focus({ preventScroll: true }); 6947 } catch (focusErr) { 6948 target.focus(); 6949 } 6950 }); 6951} 6952; 6953//Usage: Core.Layout.attachTabbedWidgetTabHandlers(); 6954LayoutClass.prototype.attachTabbedWidgetTabHandlers = function () { 6955 window.Pages.tabChangeHandlers = window.Pages.tabChangeHandlers || []; 6956 6957 storePanelScripts(); 6958 6959 // Hiding all panels, then showing the first one 6960 $('.tabbedWidget.cpTabPanel').hide(); 6961 $('.tabbedWidget.cpTabPanel.showing').show(); 6962 6963 $('.tabbedWidget.cpTabs, .tabbedWidgetNarrow.cpTabs').each(function (e) { 6964 var $tabs = $(this); 6965 var activateTab = function ($tab) { 6966 $tab.trigger('click'); 6967 }; 6968 6969 // Keyboard navigation for tabs (WCAG 2.1 AA) 6970 $tabs.find('li:not(.newTab) > a[role="tab"]').unbind('keydown.tabWidget').bind('keydown.tabWidget', function (e) { 6971 var $currentTab = $(this); 6972 var $tabList = $currentTab.closest('ol'); 6973 var $allTabs = $tabList.find('li:not(.newTab) > a[role="tab"]'); 6974 var currentIndex = $allTabs.index($currentTab); 6975 var newIndex = -1; 6976 6977 switch (e.key) { 6978 case 'ArrowRight': 6979 case 'Right': 6980 e.preventDefault(); 6981 newIndex = (currentIndex + 1) % $allTabs.length; 6982 break; 6983 case 'ArrowLeft': 6984 case 'Left': 6985 e.preventDefault(); 6986 newIndex = (currentIndex - 1 + $allTabs.length) % $allTabs.length; 6987 break; 6988 case 'Home': 6989 e.preventDefault(); 6990 newIndex = 0; 6991 break; 6992 case 'End': 6993 e.preventDefault(); 6994 newIndex = $allTabs.length - 1; 6995 break; 6996 case 'Enter': 6997 case ' ': 6998 e.preventDefault(); 6999 $currentTab.click(); 7000 return; 7001 default: 7002 return; 7003 } 7004 7005 if (newIndex >= 0) { 7006 // Roving tabindex: set all tabs to -1, focused tab to 0 7007 $allTabs.attr('tabindex', '-1'); 7008 var $newTab = $allTabs.eq(newIndex); 7009 $newTab.attr('tabindex', '0').focus(); 7010 activateTab($newTab); 7011 } 7012 }); 7013 7014 // Keyboard navigation for accordion buttons 7015 $tabs.find('li:not(.newTab) > a[role="button"]').unbind('keydown.tabWidget').bind('keydown.tabWidget', function (e) { 7016 if (e.key === 'Enter' || e.key === ' ') { 7017 e.preventDefault(); 7018 $(this).click(); 7019 } 7020 }); 7021 7022 // When a tab is clicked 7023 $tabs.find('li:not(.newTab) > a').unbind('click').click(function (e) { 7024 e.preventDefault(); 7025 var $selectedTab = $(this); 7026 var selectedTabHref = attrOrProps($selectedTab, 'href'); 7027 var hashTabOffset = selectedTabHref.indexOf('#'); 7028 var target = selectedTabHref.slice(hashTabOffset); 7029 var anchor = this; 7030 var $target = $('div' + target); 7031 var $targetli = $selectedTab.parent(); 7032 var isNarrow = $selectedTab.parent().parent().hasClass('tabbedWidgetNarrow'); 7033 var isAccordion = $selectedTab.parent().parent().hasClass('accordion'); 7034 var $parentTab = $selectedTab.parent().parent().parent(); 7035 var tabAriaAttribute = isAccordion ? "aria-expanded" : "aria-selected"; 7036 7037 var showTab = function () { 7038 $target.addClass('showing').slideDown(function () { 7039 doAfterSwitchingTabs($target); 7040 if (document.body.classList.contains("narrow")) { 7041 anchor.scrollIntoView({behavior: "smooth", block: "start", inline: "nearest"}); 7042 } 7043 }).css({'overflow': ''}); 7044 } 7045 // Checking to see if it's showing already 7046 if (!$target.hasClass('showing') || isAccordion === true) { 7047 // Making the current tab inactive, and the new one active 7048 var $widget = $selectedTab.parents('.widget.widgetTabbed'); 7049 7050 if (isAccordion === false) { 7051 if ($widget.hasClass('narrow')) { 7052 $selectedTab.parent().parent().siblings('ol').find('li.active').removeClass('active'); 7053 $selectedTab.parent().parent().siblings('ol').find('a[' + tabAriaAttribute + '="true"]').attr(tabAriaAttribute, "false"); 7054 // Update roving tabindex on sibling tab lists 7055 $selectedTab.parent().parent().siblings('ol').find('a[role="tab"]').attr('tabindex', '-1'); 7056 } else { 7057 $parentTab.children().first().find('li.active').removeClass('active'); 7058 $parentTab.children().first().find('a[' + tabAriaAttribute + '="true"]').attr(tabAriaAttribute, "false"); 7059 // Update roving tabindex on the primary tab list 7060 $parentTab.children().first().find('a[role="tab"]').attr('tabindex', '-1'); 7061 } 7062 } 7063 7064 var tabButton = $widget.find('a[href="' + target + '"]'); 7065 7066 if (isNarrow && isAccordion === false) { 7067 tabButton.attr(tabAriaAttribute, "true"); 7068 tabButton.attr('tabindex', '0'); 7069 tabButton.parent().addClass('active'); 7070 } 7071 // Hiding the current panel, showing the new one 7072 if (!isNarrow) { 7073 tabButton.attr(tabAriaAttribute, "true"); 7074 tabButton.attr('tabindex', '0'); 7075 tabButton.parent().addClass('active'); 7076 $target.siblings('.showing').removeClass('showing').hide(); 7077 $target.addClass('showing').show(); 7078 doAfterSwitchingTabs($target); 7079 } else { 7080 if(isAccordion === false) 7081 { 7082 $target.siblings('.showing').removeClass('showing').slideUp(); 7083 7084 showTab(); 7085 } 7086 else 7087 { 7088 if ($targetli.hasClass('active')) { 7089 $targetli.removeClass('active'); 7090 $targetli.find("a").attr(tabAriaAttribute, "false"); 7091 } else { 7092 $targetli.addClass('active'); 7093 $targetli.find("a").attr(tabAriaAttribute, "true"); 7094 } 7095 $target.hasClass('showing') ? $target.removeClass('showing').slideUp() : showTab(); 7096 } 7097 } 7098 7099 var $arr = ($target).contents().find('.videoPlayer'); 7100 if ($arr.length > 0) { 7101 ($target).contents().find('.videoPlayer').children('iframe').trigger('onload'); 7102 } 7103 } 7104 //Checking any on tab change handlers were added 7105 if (window.Pages.tabChangeHandlers.length > 0) {
7106 window.Pages.tabChangeHandlers.forEach(function (car) { car(); }); 7107 } 7108 }); 7109 }); 7110 7111 $('.nextAction.tabName').unbind('click').click(function (e) { 7112 e.preventDefault(); 7113 }); 7114 7115 $.fn.hasData = function (prop) { 7116 return this.filter( 7117 function () { return $(this).data(prop) != null; } 7118 ); 7119 }; 7120 7121 var updateChildWidgetClasses = function ($target) { 7122 // Apply wide/narrow classes based on parent tabbed widget state 7123 var liveEditEnabled = getCookieValue("enableLiveEdit") === "true"; 7124 if (liveEditEnabled) 7125 return; 7126 7127 var $parentTabbedWidget = $target.closest('.widget.widgetTabbed'); 7128 var isParentNarrow = $parentTabbedWidget.hasClass('narrow'); 7129 var $childWidgets = $target.find('.widget').not('[data-elementqueryclasses]'); 7130 7131 if (isParentNarrow) { 7132 $childWidgets.addClass('narrow').removeClass('wide'); 7133 $target.find('[data-event-list-row="true"]').addClass('narrow').removeClass('wide'); 7134 } else { 7135 $childWidgets.addClass('wide').removeClass('narrow'); 7136 $target.find('[data-event-list-row="true"]').addClass('wide').removeClass('narrow'); 7137 } 7138 }; 7139 7140 var doAfterSwitchingTabs = function ($target) { 7141 fireMediaQueriesIfNeeded($target); 7142 7143 updateChildWidgetClasses($target); 7144 7145 if (!window.isRemoveSetHeights) 7146 SetHeights(); 7147 7148 reloadPanelScripts($target[0]); 7149 }; 7150}; 7151 7152///Matches the rest of the tab's height with the highest tab in a tabbed widget. 7153function setTabbedWidgetsTabHeight(tabWrapperID) { 7154 if (tabWrapperID == null || typeof tabWrapperID == 'undefined') { 7155 $('.tabbedWidget.cpTabs').not('.left,.right').each(function (e) { 7156 var $this = $(this); 7157 $this.find('li').each(function () { 7158 var $thisLi = $(this); 7159 if ($thisLi.css('height') != '0px') 7160 $thisLi.find('a').css('height', $thisLi.css('height')); 7161 }) 7162 }); 7163 } 7164 else { 7165 var $wrapper = $('#' + tabWrapperID); 7166 $wrapper.find('ol.tabbedWidget.cpTabs').not('.left,.right').find('li').each(function () { 7167 var $thisLi = $(this); 7168 if (!$thisLi.is(':hidden')) { 7169 if ($thisLi.css('height') != '0px') 7170 $thisLi.find('a').css('height', $thisLi.css('height')); 7171 } 7172 }); 7173 } 7174} 7175 7176function storePanelScripts() { 7177 var panels = document.querySelectorAll('.tabbedWidget.cpTabPanel'); 7178 for (var i = 0; i < panels.length; i++) { 7179 var panel = panels[i]; 7180 if (panel.style.display === 'none') { 7181 var containers = panel.querySelectorAll('[id^="customHtml"]'); 7182 for (var j = 0; j < containers.length; j++) { 7183 var container = containers[j]; 7184 if (!container.getAttribute('data-original-html')) { 7185 var scripts = container.getElementsByTagName('script'); 7186 if (scripts.length > 0) { 7187 container.setAttribute('data-original-html', container.innerHTML); 7188 } 7189 } 7190 } 7191 } 7192 } 7193} 7194 7195function reloadPanelScripts(panelElement) { 7196 if (!panelElement) 7197 return; 7198 7199 var containers = panelElement.querySelectorAll('[id^="customHtml"]'); 7200 if (!containers || containers.length === 0) 7201 return; 7202 7203 for (var i = 0; i < containers.length; i++) { 7204 var container = containers[i]; 7205 var originalHtml = container.getAttribute('data-original-html'); 7206 if (!originalHtml) 7207 continue; 7208 7209 container.innerHTML = originalHtml; 7210 7211 var scripts = container.getElementsByTagName('script'); 7212 var scriptsArray = Array.prototype.slice.call(scripts); 7213 for (var j = 0; j < scriptsArray.length; j++) { 7214 var oldScript = scriptsArray[j]; 7215 var newScript = document.createElement('script'); 7216 if (oldScript.src) { 7217 newScript.src = oldScript.src; 7218 } else { 7219 newScript.textContent = oldScript.textContent || oldScript.innerText; 7220 } 7221 oldScript.parentNode.replaceChild(newScript, oldScript); 7222 } 7223 } 7224} 7225; 7226/**** Functions to handle Main/Left Menu on Front-end. *****/ 7227//Global variables 7228var MAIN_MENU = 2; 7229var SIDE_MENU = 1; 7230var menuManager = new MenuManager(); 7231var accessibleMenuToggleEnabled = window.FeatureToggles.isActive("CMS.Pages.AccessibleMainMenuWithIndicators"); 7232//setup RWD menu 7233window.Pages = window.Pages || {}; 7234$.when(window.Pages.rwdReady, menuManager.mainMenuReady).done(function () { 7235 menuManager.initRWD(); 7236 var isLoggedBackendUser = $('#helpMenu').length == 1; 7237 var mql = matchMedia(window.mainMenuMediaQuery); 7238 var isFirstTimeRun = true; 7239 var executeOnce = function () { 7240 fireAllMediaElementQueries(); 7241 if (typeof rearrangeFlyouts === 'function') 7242 rearrangeFlyouts(false); 7243 window.Pages.onResizeHandlersExecute(); 7244 window.Pages.toolBarDeferred.resolve(); 7245 }; 7246 if (!mql.matches) { 7247 executeOnce(); 7248 isFirstTimeRun = false; 7249 } 7250 cpMedia.register(window.mainMenuMediaQuery, { 7251 setup: function () { 7252 if (isLoggedBackendUser) 7253 $('div.cpToolbar.user').removeClass('public').addClass('admin adminWrap'); 7254 }, 7255 match: function () { 7256 $('body').addClass('narrow').removeClass('wide'); 7257 if (isLoggedBackendUser) 7258 $('div.cpToolbar.user').removeClass('admin adminWrap').addClass('public'); 7259 menuManager.moveToMobile(); 7260 resetBodyPadding && resetBodyPadding(); 7261 if (isFirstTimeRun) { 7262 executeOnce(); 7263 } 7264 isFirstTimeRun = false; 7265 }, 7266 unmatch: function () { 7267 $('body').addClass('wide').removeClass('narrow'); 7268 if (isLoggedBackendUser) 7269 $('div.cpToolbar.user').removeClass('public').addClass('admin adminWrap'); 7270 menuManager.moveToDesktop(); 7271 } 7272 }); 7273}); 7274 7275//Defines menu class to handle Main/Left Menu on Front-end. 7276function MenuManager() { 7277 //object variables 7278 this.$divListSubMenus = null; //hide div where submenus are be placed. 7279 //this.$containerSubMenus = $('#containerSubMenus'); ; //no hidden div to hold the submenus of main menu being displayed. Workaround to solve z-index issues. could be removed along with its related code after redo layout project! 7280 this.menuTimeoutID = null; 7281 this.mainMenuMaxSubMenuLevels = 0; 7282 this.sideMenuMaxSubMenuLevels = 0; 7283 this.popdownDelaySideMenu = 500; 7284 this.popdownDelayTopMenu = 500; 7285 this.popupDelaySideMenu = 300; 7286 this.popupDelayTopMenu = 300; 7287 this.isMainMenuEditable = false; 7288 this.isMainMenuBeingDragged = false; 7289 this.isSideMenuEditable = false; 7290 this.isSideMenuBeingDragged = false;
7291 this.sideMenuHasCustomLinks = false; 7292 this.bouncing = true; 7293 this.initialized = false; 7294 this.setupDraggable = false; 7295 this.mobileMainNav = false; 7296 this.mainMenuInit = false; 7297 this.mainMenuReady = $.Deferred(); 7298 this.$mainNavHolderMobile = null; 7299 this.$mainNav = null; 7300 this.$mainNavMenu = null; 7301 this.rwdInitNavOpenButton = false; 7302 this.mainMenuTextResizer = false; 7303 this.mainMenuTextResizerRatio = 0.5; 7304 this.isAdjustingMainMenuItemsWidth = false; 7305 7306 //Initialize menu manger after document was load 7307 this.init = function () { 7308 var self = this; // Reference to current object 7309 if (!self.initialized) { 7310 self.initialized = true; 7311 this.resetSubMenus(); 7312 7313 // Hide all submenus after clicking any menu item 7314 $('li.subMenuItem > a.navMenuItem, li.topMenuItem > a.navMainItem').on("click", function () { 7315 menuManager.hideAllSubMenus(MAIN_MENU); 7316 menuManager.hideAllSubMenus(SIDE_MENU); 7317 }); 7318 7319 // Hide submenu/s when the Escape key is pressed 7320 document.addEventListener('keydown', function (event) { 7321 if (event.key === "Escape") { 7322 // Only handle if focus is inside a menu or submenu 7323 if (!document.activeElement.closest('#secondaryNav, #mainNav, .mainNavMegaMenu, .secondarySubMenu, .mainSubMenu')) { 7324 return; 7325 } 7326 7327 let menuButton = null; 7328 const previouslyFocusedElement = document.activeElement; 7329 7330 const subMenuContainer = previouslyFocusedElement.closest("ol[id^='ParentMainItem']"); 7331 if (subMenuContainer) { 7332 // Get the parent menu item id (e.g., MainItem2151 for ParentMainItem2151) 7333 const parentItemId = subMenuContainer.id.replace('Parent', ''); 7334 const parentMenuItem = document.getElementById(parentItemId); 7335 if (parentMenuItem) { 7336 7337 var liElement = parentMenuItem; 7338 const currentLi = previouslyFocusedElement.closest('li'); 7339 const currentLiAnchor = currentLi ? currentLi.querySelector('a') : null; 7340 if (currentLi && currentLi['ariaHasPopup'] === "true" && currentLiAnchor.getAttribute('aria-expanded') === "true") { 7341 liElement = currentLi; 7342 } 7343 7344 menuManager.hideSubMenu($(liElement)); 7345 7346 // Find the anchor inside the parent menu item 7347 const anchor = liElement.querySelector('a'); 7348 menuButton = anchor; 7349 } 7350 } else { 7351 // Logic for mega menus 7352 const menuContainer = previouslyFocusedElement.closest("aside[id^='mainNavMegaMenu'], ol[id^='ParentMainItem']"); 7353 if (menuContainer) { 7354 const itemID = menuContainer.id.match(/\d+$/)?.[0]; 7355 menuButton = findMainNavButton(itemID); 7356 } 7357 7358 // Hide all submenus 7359 menuManager.hideAllSubMenus(MAIN_MENU); 7360 menuManager.hideAllSubMenus(SIDE_MENU); 7361 } 7362 7363 // Return focus to the parent menu item if applicable 7364 if (menuButton) { 7365 menuButton.focus(); 7366 self.toggleIndicator($(menuButton)); 7367 return; 7368 } else { 7369 self.toggleIndicator($(previouslyFocusedElement)); 7370 } 7371 } 7372 }); 7373 7374 /* 7375 Recursively traverses the menu hierarchy to find the main navigation button corresponding to a given menu item ID. 7376 7377 @param {string} itemID - The ID of the menu item to find the button for. 7378 @returns {HTMLElement|null} - The main navigation button element, or null if not found. 7379 */ 7380 function findMainNavButton(itemID) { 7381 const menuItem = document.querySelector(`#MainItem${itemID}`); 7382 const parent = menuItem && menuItem.closest("ol[id^='ParentMainItem']"); 7383 const parentID = parent && parent.id.match(/\d+$/)?.[0]; 7384 7385 if (parentID) { 7386 return findMainNavButton(parentID); 7387 } else { 7388 return menuItem.querySelector('a'); 7389 } 7390 } 7391 } 7392 if (self.setupDraggable) 7393 self.attachDragAndDropHandlers(); 7394 }; 7395 7396 this.initRWD = function () { 7397 var self = this; // Reference to current object 7398 self.$mainNavHolderMobile = $("#mainNavHolderMobile"); 7399 self.$mainNav = $("#mainNav"); 7400 self.$mainNavMenu = $("#mainNavMenu"); 7401 if (self.isAdjustingMainMenuItemsWidth) { 7402 self.resetMainItemsWidth("#mainNavMenu"); 7403 self.adjustMainItemsWidth("#mainNavMenu"); 7404 } 7405 if (self.mainMenuTextResizer) 7406 self.$mainNavMenu.responsiveMenuText({ ratio: self.mainMenuTextResizerRatio }); 7407 }; 7408 7409 this.resetSubMenus = function () { 7410 var self = this; // Reference to current object 7411 if (self.$divListSubMenus != null) 7412 self.$divListSubMenus.remove(); 7413 var $divListSubMenus = $('<div id="divListSubMenus" style="display:block; visibility:hidden; position:absolute; left:-9999px; top:-9999px;" class="siteNav"></div>'); 7414 //Trick to get width from hidden elements needed to calculate bouncing. If above styles creates problems use hack from http://stackoverflow.com/questions/1472303/jquery-get-width-of-element-when-not-visible-display-none 7415 var docFrag = $(document.createDocumentFragment()); 7416 docFrag[0].appendChild($divListSubMenus[0].cloneNode(true)); 7417 self.$divListSubMenus = docFrag.children();
7418 $divListSubMenus.remove(); 7419 }; 7420 7421 /*var $body = $("body"); 7422 this.isNarrowSite = function () { 7423 //return $body.hasClass("narrow"); 7424 return true; 7425 };*/ 7426} 7427 7428MenuManager.prototype.moveToMobile = function () { 7429 var menusToClose = document.getElementsByClassName("megaMenuContainer"); 7430 for (i = 0; i < menusToClose.length; i++) { 7431 menusToClose[i].style.display = "none"; 7432 } 7433 7434 var self = this; // Reference to current object 7435 if (!self.mobileMainNav) { 7436 self.mobileMainNav = true; 7437 if (self.mainMenuTextResizer && self.$mainNavMenu.data('responsiveMenuText')) 7438 self.$mainNavMenu.responsiveMenuText('dispose'); 7439 if ($("#nav-open-btn").length === 0) { 7440 $('#divToolbars').append($('<a class="nav-btn" id="nav-open-btn" href="#nav" aria-haspopup="true" role="menu">Menu</a>')); 7441 self.applyResponsiveMenuSettings(); 7442 self.initNavOpenButton(); 7443 } 7444 self.$mainNav.before($('<div id="mainNavOriginalPosition" style="display:none;"></div>')); 7445 self.$mainNavHolderMobile.append(self.$mainNav); 7446 self.$mainNavMenu.wrap('<div id="rwd-menu" class="rwd-menuwrapper">'); 7447 self.$mainNavMenu.attr('aria-hidden', 'true'); 7448 var $menu = $('#rwd-menu'); 7449 7450 $menu.rwdmenu(); 7451 7452 $menu.onclick = function () { }; 7453 7454 if (self.isAdjustingMainMenuItemsWidth) 7455 self.resetMainItemsWidth("#mainNavMenu"); 7456 } 7457}; 7458 7459MenuManager.prototype.applyResponsiveMenuSettings = function () { 7460 var signInBar = $('.cpToolbar.user.public'); 7461 var adminToolbar = $('.cp-Admin-Legacy-Toolbar'); 7462 var alertBar = $('.alertToolbar'); 7463 var navButton = $("#nav-open-btn"); 7464 var fullWidth = window.fullWidthResponsiveMenu; 7465 var fixedMenu = window.fixedResponsiveMenu; 7466 7467 var responsiveMenuButtonHeight = window.responsiveMenuHeight !== '' ? window.responsiveMenuHeight : "34"; 7468 var responsiveMenuButtonHeightWithPx = ""; 7469 if (responsiveMenuButtonHeight.indexOf('px') === -1) responsiveMenuButtonHeightWithPx = responsiveMenuButtonHeight + 'px'; 7470 7471 if (responsiveMenuButtonHeight > 34) //dont assign any inline styles if height < 34 7472 { 7473 responsiveMenuButtonHeight -= (signInBar.length && 8); 7474 var responsiveMenuButtonHeightNavbtnWithpx = ""; 7475 if (responsiveMenuButtonHeight.toString().indexOf('px') === -1) responsiveMenuButtonHeightNavbtnWithpx = responsiveMenuButtonHeight + 'px'; 7476 7477 // Set the button height 7478 if (responsiveMenuButtonHeight !== "px") navButton.css("height", responsiveMenuButtonHeightNavbtnWithpx).css("line-height", responsiveMenuButtonHeightNavbtnWithpx); 7479 } 7480 7481 var responsiveMenuFontSize = window.responsiveMenuFontSize; 7482 if (responsiveMenuFontSize.indexOf('px') === -1) responsiveMenuFontSize += 'px'; 7483 // Set the button font-size 7484 if (responsiveMenuFontSize !== 'px') navButton.css('font-size', responsiveMenuFontSize); 7485 7486 if ((fullWidth || alertBar.length) && !signInBar.length) { 7487 // Apply styles for the full-width button 7488 navButton.css("right", "0"); 7489 navButton.css("bottom", "auto"); 7490 } 7491 7492 // Special case: Forces full-width in order to avoid empty gap on right side of hamburger menu - see bug https://civicplus.tpondemand.com/entity/77390-an-extra-spacing-appears-below-the 7493 if (!fixedMenu && !fullWidth && !alertBar.length && !signInBar.length) { 7494 // Apply styles for the full-width button 7495 navButton.css("right", "0"); 7496 navButton.css("bottom", "auto"); 7497 } 7498 if (adminToolbar && adminToolbar.length != 0) { 7499 navButton.css("margin-top", "71px"); 7500 } 7501 if (signInBar.length) { 7502 // Fix sign in bar height 7503 signInBar.css("height", responsiveMenuButtonHeightWithPx); 7504 7505 // Fix sign in button height 7506 signInBar.find(".button").css("height", responsiveMenuButtonHeightWithPx).css("line-height", responsiveMenuButtonHeightWithPx); 7507 7508 if (window.fixedResponsiveMenu && $('#nav-open-btn').length) { 7509 $('.cpToolbar.user.public').css("z-index" , "101"); 7510 } 7511 } 7512 7513 if (fixedMenu) { 7514 // Move the menu button and menu to #outer-wrap (outside of transform) 7515 $("#nav-open-btn, #mainNavHolderMobile").appendTo("#outer-wrap"); 7516 7517 // Make fixed 7518 navButton.css("position", "fixed"); 7519 7520 // Prevent overlapping in the menu 7521 $("#mainNavHolderMobile").css("position", "fixed").css("top", responsiveMenuButtonHeightWithPx).css("left", "0").css("right", "0").css("bottom", "0"); 7522 7523 // Remove main nav transform, fix z-index issues 7524 $("<style>.js-navopen #mainNav { transform: none; } .mainNavHolderMobile{ z-index: -1;}.js-navopen .mainNavHolderMobile{z-index: 1;}</style>").appendTo("body"); 7525 7526 // Prevent overflow of the menu 7527 $("#mainNav").css("overflow-y", "auto"); 7528 7529 if (signInBar.length) { 7530 // Move the sign in bar to #outer-wrap (outside of transform) 7531 signInBar.appendTo("#outer-wrap"); 7532 signInBar.css("top", "0").css("left", "0").css("right", "0").css("position", "fixed"); 7533 } 7534 7535 if (fullWidth || signInBar.length || alertBar.length) { 7536 // Add padding-top to #outer-wrap (prevent the button/sign in bar from overlapping stuff) 7537 $("#outer-wrap").css("padding-top", responsiveMenuButtonHeightWithPx); 7538 } 7539 } 7540}; 7541 7542MenuManager.prototype.moveToDesktop = function () { 7543 var self = this; // Reference to current object 7544 if (self.mobileMainNav) { 7545 self.mobileMainNav = false; 7546 $("#mainNavOriginalPosition").replaceWith(self.$mainNav); 7547 self.$mainNavMenu.unwrap().rwdmenu('destroy'); 7548 if (self.isAdjustingMainMenuItemsWidth) 7549 self.adjustMainItemsWidth("#mainNavMenu"); 7550 if (self.mainMenuTextResizer) 7551 self.$mainNavMenu.responsiveMenuText({ ratio: self.mainMenuTextResizerRatio }); 7552 self.$mainNavMenu.attr('aria-hidden', 'false'); 7553 self.$mainNav.css("overflow-y", ""); 7554 } 7555}; 7556 7557MenuManager.prototype.initNavOpenButton = function () { 7558 var self = this; // Reference to current object 7559 if (self.rwdInitNavOpenButton) 7560 return; 7561 self.rwdInitNavOpenButton = true; 7562 7563 var trim = function (str) { 7564 return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, ''); 7565 }; 7566 7567 var hasClass = function (el, cn) { 7568 return (' ' + el.className + ' ').indexOf(' ' + cn + ' ') !== -1; 7569 }; 7570 7571 var addClass = function (el, cn) { 7572 if (!hasClass(el, cn)) { 7573 el.className = (el.className === '') ? cn : el.className + ' ' + cn; 7574 } 7575 }; 7576 7577 var removeClass = function (el, cn) { 7578 el.className = trim((' ' + el.className + ' ').replace(' ' + cn + ' ', ' ')); 7579 }; 7580 7581 var hasParent = function (el, id) { 7582 if (el) { 7583 do { 7584 if (el.id === id) { 7585 return true; 7586 }
7587 if (el.nodeType === 9) { 7588 break; 7589 } 7590 } 7591 while ((el = el.parentNode)); 7592 } 7593 return false; 7594 }; 7595 7596 var doc = document.documentElement; 7597 7598 var transform_prop = window.Modernizr.prefixed('transform'), 7599 transition_prop = window.Modernizr.prefixed('transition'), 7600 transition_end = (function () { 7601 var props = { 7602 'WebkitTransition': 'webkitTransitionEnd', 7603 'MozTransition': 'transitionend', 7604 'OTransition': 'oTransitionEnd otransitionend', 7605 'msTransition': 'MSTransitionEnd', 7606 'transition': 'transitionend' 7607 }; 7608 return props.hasOwnProperty(transition_prop) ? props[transition_prop] : false; 7609 })(); 7610 7611 var inner = $("#inner-wrap")[0]; 7612 var nav_open = false; 7613 var nav_class = 'js-navopen'; 7614 7615 var closeNavEnd = function (e) { 7616 if (e && e.target === inner) { 7617 document.removeEventListener(transition_end, closeNavEnd, false); 7618 } 7619 nav_open = false; 7620 }; 7621 7622 var closeNav = function () { 7623 if (nav_open) { 7624 // close navigation after transition or immediately 7625 var duration = (transition_end && transition_prop) ? parseFloat(window.getComputedStyle(inner, '')[transition_prop + 'Duration']) : 0; 7626 if (duration > 0) { 7627 document.addEventListener(transition_end, closeNavEnd, false); 7628 } else { 7629 closeNavEnd(null); 7630 } 7631 } 7632 removeClass(doc, nav_class); 7633 $('ol#mainNavMenu').find('li.rwd-close').remove(); 7634 $('ol#mainNavMenu').attr('aria-hidden', 'true'); 7635 nav_open = false; 7636 }; 7637 7638 var openNav = function () { 7639 if (nav_open) { 7640 return; 7641 } 7642 addClass(doc, nav_class); 7643 $('ol#mainNavMenu').attr('aria-hidden', 'false'); 7644 var $firstItem = $('ol#mainNavMenu').find('li > a').first(); 7645 if (!$firstItem.hasClass('backMenuLink') && !$firstItem.hasClass('closeMenuLink')) { 7646 var $close = $('<li class="rwd-close"><a href="#" style="z-index:2;" class="navMenuItem closeMenuLink" aria-haspopup="false" role="menuitem">Close Menu</a></li>'); 7647 $('#mainNavMenu').prepend($close); 7648 $firstItem = $('ol#mainNavMenu').find('li > a').first(); 7649 $firstItem.bind('click', function (e) { 7650 e.preventDefault(); 7651 closeNav(); 7652 }); 7653 } 7654 $firstItem.focus(); 7655 nav_open = true; 7656 }; 7657 7658 var toggleNav = function (e) { 7659 if (nav_open && hasClass(doc, nav_class)) { 7660 closeNav(); 7661 } else { 7662 openNav(); 7663 } 7664 if (e) { 7665 e.preventDefault(); 7666 } 7667 }; 7668 7669 // open nav with main "nav" button 7670 document.getElementById('nav-open-btn').addEventListener('click', toggleNav, false); 7671 7672 /* close nav with main "close" button 7673 document.getElementById('nav-close-btn').addEventListener('click', toggleNav, false); 7674 */ 7675 7676 // close nav by touching the partial off-screen content 7677 document.addEventListener('click', function (e) { 7678 if (nav_open && !hasParent(e.target, 'mainNav') && !hasClass(e.target, 'nav-btn')) { 7679 e.preventDefault(); 7680 closeNav(); 7681 } 7682 }, 7683 true); 7684}; 7685 7686//Configure a menu. This function should be call only inside $(document).ready 7687MenuManager.prototype.setupMenu = function (menuID, menuContainerID, menuType, setupDraggable, urlToGetHiddenMenus) { 7688 var self = this; // Reference to current object 7689 self.setupDraggable = setupDraggable; 7690 7691 //Initialize menu manger after DOM elements are loaded 7692 self.init(); 7693 7694 $('#' + menuID).data('menu', { type: menuType, level: 1, parentID: null }); 7695 7696 //mouse over on menu items from first level 7697 $("li.topMenuItem", '#' + menuID).mouseover(function (e) { 7698 e.stopPropagation(); 7699 }); 7700 7701 //mouse enter on menu items from first level 7702 $("li.topMenuItem", '#' + menuID).mouseenter(function () { 7703 var $li = $(this); 7704 self.menuMouseOver($li); 7705 7706 //return false; //do not bubble mouse over events on other nested li tags 7707 }); 7708 7709 7710 7711 //mouse out on menu items from first level 7712 $("li.topMenuItem", '#' + menuID).mouseleave(function () { 7713 var $li = $(this); 7714 self.menuMouseOut($li); 7715 }); 7716 7717 $.ajax({ 7718 url: urlToGetHiddenMenus, 7719 type: 'get', 7720 async: true, //let the page continue loading/processing meanwhile submenus are loaded 7721 cache: false, 7722 dataType: 'html', 7723 success: function (response) { 7724 if (response.ErrorMessage) 7725 alert(response.ErrorMessage); 7726 else { 7727 //Append submenus into divListSubMenus and bind menuMouseOut function on mouseleave event for all <li>. 7728 //create temporary container. 7729 var tempContainerID = 'dummyDivTemp' + menuID;
7730 var $tempContainer = $('<div id="' + tempContainerID + '" style="display:block;"></div>').append(response); 7731 7732 //set up hasChildren class on top level items 7733 $('#' + menuID + ' li').each(function () { 7734 var $this = $(this); 7735 var id = $this.attr('id'); //.replace(/item|leftItem/i, ''); 7736 if (id != null) { 7737 var $olSubMenu = $tempContainer.find('#Parent' + id).find('li').not(".addPage"); 7738 if ($olSubMenu.length > 0) { 7739 var $targetElement = $this.children('a').length ? $this.children('a') : $this; 7740 $targetElement.attr('aria-haspopup', 'true'); 7741 $targetElement.attr('aria-expanded', 'false'); 7742 //for secondary menus, set up withChildren class on top level items 7743 if (menuType === SIDE_MENU && $this.data("displayMainItemSubMenuIndicators") == "True") { 7744 $this.children('a.secondaryNavItem').addClass('withChildren'); 7745 } 7746 } 7747 } 7748 }); 7749 7750 //This needs to be executed once to bind draggable to main and side menu's root elements. 7751 if (setupDraggable) { 7752 //init drag and drop for menu items 7753 $('#' + menuID).find("li").each(function () { 7754 //set as droppable all submenu items on main menu 7755 self.setupDroppableElement($(this), menuType); 7756 }); 7757 7758 $('#' + menuID).find(".grippy").each(function () { 7759 //setup grip icons as draggable elements for main menu sub items. 7760 self.setupDraggableElement($(this), menuType, '#' + menuContainerID); 7761 }); 7762 } 7763 7764 //move submenus to main submenus container. 7765 self.$divListSubMenus.append($tempContainer.children()/*$('#' + tempContainerID + ' ol')*/); 7766 $tempContainer.remove(); 7767 } 7768 }, 7769 error: function (xhr, textStatus, exception) { 7770 if (xhr.status != 0) 7771 alert("Error retrieving sub-menus for menuID '" + menuID + "' : " + xhr.statusText + "\ntextStatus: " + xhr.status); 7772 } 7773 }); 7774}; 7775 7776//Handles mouse over event on menu items 7777MenuManager.prototype.menuMouseOver = function ($li) { 7778 var self = this; // Reference to current object 7779 if (self.mobileMainNav || ($('.pageContent.cpGrid.dragging').length > 0) || ($('.pageContent.cpGrid.pinned').length > 0)) { 7780 return; 7781 } 7782 this.resetMouseOvers(); 7783 $li.addClass('mouseover'); 7784 $li.parentsUntil('#mainNavMenu').children('a').addClass('mouseover'); 7785 clearTimeout(self.menuTimeoutID); 7786 7787 var $parent = $li.parent(); 7788 var menuData = $parent.data('menu'); 7789 7790 7791 //bail when is currently dragging an item to a different type of menu only if there is not custom links on side menu 7792 if (!self.sideMenuHasCustomLinks && self.isMainMenuBeingDragged && menuData.type === SIDE_MENU) 7793 return; 7794 if (!self.sideMenuHasCustomLinks && self.isSideMenuBeingDragged && menuData.type === MAIN_MENU) 7795 return; 7796 7797 if ((menuData.type === MAIN_MENU && self.isMainMenuEditable && (self.isMainMenuBeingDragged || self.isSideMenuBeingDragged) && $li.hasClass('liDropabble') && !$li.hasClass('beingDragged')) 7798 || (menuData.type === SIDE_MENU && self.isSideMenuEditable && (self.isMainMenuBeingDragged || self.isSideMenuBeingDragged) && $li.hasClass('liDropabble') && !$li.hasClass('beingDragged'))) { 7799 //set elements settings when element is over 7800 $li.addClass('hover'); 7801 } 7802 7803 $('#mainNav').css('z-index', '10'); 7804 7805 //hide if needed submenus from siblings 7806 if ($li.hasClass('topMenuItem')) { 7807 //for top level menu items hide all the submenus before displaying another level 7808 self.hideAllSubMenus(menuData.type, $li); 7809 } else { 7810 //for all other submenus which are naturally inside DOM elements 7811 $parent.children().each(function () { 7812 if ($(this) != $li) 7813 self.hideSubMenu($(this)); 7814 }); 7815 } 7816 7817 //When opening different type of menu, hide submenus from the other types menu 7818 if (menuData.type === MAIN_MENU) { 7819 self.hideAllSubMenus(SIDE_MENU); 7820 } else if (menuData.type === SIDE_MENU) { 7821 self.hideAllSubMenus(MAIN_MENU); 7822 } 7823 7824 // As the sub-menu is displayed, we let the screen reader know the menu has expanded. 7825 var $anchor = $li.find('a'); 7826 if ($anchor.length && $anchor.attr('aria-haspopup') === 'true') { 7827 $anchor.attr('aria-expanded', 'true'); 7828 self.toggleIndicator($anchor); 7829 } 7830 else if ($anchor.length && $anchor.attr('aria-haspopup') != 'true') { 7831 return; 7832 } 7833 7834 7835 if (!$li.hasClass('beingDragged')) { 7836 var id = $li.attr('id'); //.replace(/item|leftItem/i, ''); 7837 var pageID = $li.data('pageid'); 7838 var displayMegaMenu = $li.data('displaymegamenu');
7839 var delay = $li.hasClass('topMenuItem') ? self.popupDelayTopMenu : self.popupDelaySideMenu; 7840 7841 //This is to pick the list with with the most sub menus and remove the rest. Prevents issue with not displaying all submenus when there is more than one of the same 7842 //submenu being rendered, since the first rendered sub menu will be used for all submenu duplicates even though it may not have all the submenus included. 7843 //https://civicplus.tpondemand.com/entity/22126 7844 var maxSubMenus = 0; 7845 var maxResult; 7846 if (self.$divListSubMenus.find('#Parent' + id).length > 1) { 7847 $(self.$divListSubMenus.find('#Parent' + id)).each(function () { 7848 if ($(this).children().length > maxSubMenus) { 7849 maxSubMenus = $(this).children().length; 7850 maxResult = this; 7851 } 7852 $(this).addClass('removal'); 7853 }); 7854 } 7855 $(maxResult).removeClass('removal'); 7856 self.$divListSubMenus.remove(".removal"); 7857 self.$divListSubMenus.children().append(maxResult); 7858 7859 var $olSubMenu = self.$divListSubMenus.find('#Parent' + id); 7860 $('.megaMenuContainer.hover').hide().removeClass('hover'); 7861 if (displayMegaMenu == 'True') { 7862 if (menuData.type === MAIN_MENU) { 7863 //Hack to get the heights of the megaMenu elements correctly, in state of display none, incorrect height is being returned. Vishal 7864 var $megaMenuContainer = $('.mainNavMegaMenu.megaMenuContainer.pageID_' + pageID); 7865 $megaMenuContainer.css('visibility', 'hidden'); 7866 $megaMenuContainer.css("overflow", "hidden"); 7867 $megaMenuContainer.css("height", "0"); 7868 $megaMenuContainer.css("padding", "0"); 7869 $megaMenuContainer.show(); 7870 7871 7872 //Apply menu animation's start state 7873 var applyAnimation = function ($megaMenuContainer, timeout) { 7874 if (typeof (Animations) === 'function') { 7875 var animations = new Animations(); 7876 animations.applyAnimationClassToMegaMenuContainer($megaMenuContainer, timeout); 7877 } 7878 } 7879 7880 var timeout = delay ? delay : 0; 7881 self.menuTimeoutID = window.setTimeout(function () { 7882 updateMegaMenuAttributes($megaMenuContainer); 7883 fireMediaQueriesIfNeeded($megaMenuContainer); 7884 $megaMenuContainer.show(); 7885 $megaMenuContainer.css("visibility", ""); 7886 $megaMenuContainer.css("overflow", ""); 7887 $megaMenuContainer.css("height", ""); 7888 $megaMenuContainer.css("padding", ""); 7889 applyAnimation($megaMenuContainer, timeout); 7890 if (!window.isRemoveSetHeights) 7891 SetHeights(); 7892 }, timeout); 7893 } 7894 else { 7895 delay ? self.menuTimeoutID = setTimeout(function () { 7896 $('.secondaryNavMegaMenu.megaMenuContainer.pageID_' + pageID).show(); 7897 if (!window.isRemoveSetHeights) 7898 SetHeights(); 7899 }, delay) : $('.secondaryNavMegaMenu.megaMenuContainer.pageID_' + pageID).show(); 7900 } 7901 } 7902 7903 //For side menu, there isnt a mega menu, so render regular sub menu irrespective of displayMegaMenu setting. 7904 if (displayMegaMenu != 'True' || menuData.type === SIDE_MENU) { 7905 if ($olSubMenu.length > 1) { 7906 //remove duplicates. they might have been added by different menu (main/side) 7907 $olSubMenu.slice(1).remove(); 7908 $olSubMenu = self.$divListSubMenus.find('#Parent' + id); 7909 $olSubMenu.removeClass('takenIntoAccount'); 7910 } 7911 if ($olSubMenu.length == 1) { 7912 $olSubMenu.removeClass('takenIntoAccount'); 7913 $olSubMenu.data('menu', { type: menuData.type, level: menuData.level + 1, parentID: $parent.attr('id') }); 7914 var allowedToShow = ($olSubMenu.data('menu').type === MAIN_MENU) ? $olSubMenu.data('menu').level <= self.mainMenuMaxSubMenuLevels : $olSubMenu.data('menu').level <= self.sideMenuMaxSubMenuLevels; 7915 if (allowedToShow) { 7916 delay ? self.menuTimeoutID = setTimeout(function () { self.showSubMenu($li, $olSubMenu); }, delay) : self.showSubMenu($li, $olSubMenu); 7917 } 7918 } 7919 } 7920 7921 if (displayMegaMenu == 'True' && !window.isRemoveSetHeights) { 7922 SetHeights(); 7923 } 7924 } 7925}; 7926 7927//Display submenu items 7928MenuManager.prototype.showSubMenu = function ($li, $olSubMenu) { 7929 var self = this; // Reference to current object 7930 var menuType = $olSubMenu.data('menu').type; 7931 var animations = null; 7932 7933 //Apply menu animation's start state 7934 if (typeof (Animations) === 'function') { 7935 animations = new Animations(); 7936 animations.applyInitial($olSubMenu, menuType); 7937 } 7938 7939 //Bind mouseenter for second level submenus 7940 //Also set the tab index for each <li> 7941 $olSubMenu.children().each(function () { 7942 if (self.type != "hidden") { 7943 var $input = $(this); 7944 } 7945 //mouse over on menu items from second and subsequent levels. 7946 $(this).bind("mouseenter.menu", function () { 7947 var $li = $(this); 7948 self.menuMouseOver($li); 7949 return false; //do not bubble mouse over events on other nested li tags 7950 }); 7951 }); 7952 7953 //Bind mouseleave for second level submenus 7954 $olSubMenu.children().each(function () { 7955 //mouse over on menu items from second and subsequent levels. 7956 $(this).bind("mouseleave.menu", function () { 7957 var $li = $(this); 7958 if (!$olSubMenu.is(":hover")) { 7959 self.menuMouseOut($li); 7960 } 7961 }); 7962 }); 7963 7964 var bouncing = self.bouncing && 7965 ((menuType === MAIN_MENU && $olSubMenu.data('menu').level > 2) 7966 || (menuType === SIDE_MENU)); 7967 7968 var $parentOl = $li.parent(); 7969 var parentLeftLi = $li.offset().left; 7970 7971 self.moveSubMenuInDOM($olSubMenu, menuType); 7972 7973 if (bouncing) { 7974 //logic to bounce submenu to be opened if needed. 7975 var subMenuWidth = $olSubMenu.outerWidth(); //get width from submenu which is hidden (required to add extra styles on divListSubMenus) 7976 7977 var isOpeningToRight = !$parentOl.hasClass('flipLeft'); 7978 if (isOpeningToRight) { 7979 var winWidth = $(window).width(); 7980 var parentWidthLi = $parentOl.outerWidth(); 7981 7982 if ((winWidth - parentLeftLi - parentWidthLi) <= (subMenuWidth + 3)) { 7983 $olSubMenu.addClass('flipLeft'); 7984 } 7985 } else { 7986 if ((parentLeftLi) <= (subMenuWidth + 3)) { 7987 $olSubMenu.addClass('flipRight'); 7988 } else { 7989 $olSubMenu.addClass('flipLeft'); 7990 } 7991 } 7992 } 7993 self.positionSubMenuInDOM($olSubMenu, $li, menuType); 7994 7995 if (self.setupDraggable) { 7996 //init drag and drop for menu items 7997 $olSubMenu.find("li").each(function () { 7998 //set as droppable all submenu items on main menu 7999 self.setupDroppableElement($(this), menuType); 8000 }); 8001 8002 $olSubMenu.find(".grippy").each(function () { 8003 //setup grip icons as draggable elements for main menu sub items. 8004 self.setupDraggableElement($(this), menuType, menuType == MAIN_MENU ? '#mainNav' : '#secondaryNav'); 8005 }); 8006 } 8007
8008 //If Animation manager toggled on, implement the menu animations 8009 if (animations != null) { 8010 animations.applyAnimationClassToNavContainers($olSubMenu, menuType); 8011 } 8012}; 8013 8014//Handles mouse out event on menu items 8015MenuManager.prototype.menuMouseOut = function ($li) { 8016 var self = this; // Reference to current object 8017 8018 if (self.mobileMainNav) return; 8019 var parentMenuID = $li.parents('ol').attr('id') || ''; 8020 var menuType = $li.attr('id') != null ? ($li.attr('id').match(/MainItem/) != null ? MAIN_MENU : SIDE_MENU) : (($li.hasClass('secondaryNavItem') || parentMenuID.match(/SideItem/) != null) ? SIDE_MENU : MAIN_MENU); 8021 //log("popdownDelaySideMenu" + popdownDelaySideMenu); 8022 var delay = $li.hasClass('topMenuItem') ? self.popdownDelayTopMenu : self.popdownDelaySideMenu; 8023 if (self.isMainMenuBeingDragged || self.isSideMenuBeingDragged) { 8024 //reset elements settings 8025 $li.removeClass('hover'); 8026 } 8027 8028 $('#mainNav').css('z-index', ''); 8029 8030 clearTimeout(self.menuTimeoutID); 8031 self.menuTimeoutID = setTimeout(function () { 8032 /*if ($li.parent().data('menu').type == MAIN_MENU) 8033 self.hideAllSubMenus(MAIN_MENU); //workaround related with containerSubMenus 8034 else*/ 8035 $('#bodyWrapper').animate({ 'padding-bottom': 0 }, 'fast'); 8036 $('#bodyWrapper').data('maxPaddingBottom', '0'); 8037 $('.takenIntoAccount').removeClass('takenIntoAccount'); 8038 if (!$li.hasClass('topMenuItem')) 8039 self.hideAllSubMenus(menuType, $li); 8040 else 8041 self.hideSubMenu($li); 8042 }, delay); 8043}; 8044 8045MenuManager.prototype.hideAllSubMenus = function (menuType, $currentLi) { 8046 var self = this; // Reference to current object 8047 switch (menuType) { 8048 case SIDE_MENU: //hide sub menus for left menu 8049 $("li.topMenuItem", ".secondaryNav ol.rootNavMenu").each(function () { 8050 if ($currentLi && $(this).attr('id') === $currentLi.attr('id')) 8051 return true; //continue. don't hide current top menu item opened if provided 8052 self.hideSubMenu($(this)); 8053 }); 8054 break; 8055 case MAIN_MENU: //hide sub menus for main menu 8056 /*var openMenuID = self.$containerSubMenus.find('ol:first').attr('id'); 8057 if ($currentLi && openMenuID === ('Parent' + $currentLi.attr('id'))) 8058 return true; //continue. don't hide current top menu item opened if provided 8059 self.hideSubMenu(self.$containerSubMenus);*/ 8060 $("li.topMenuItem", "#mainNavMenu").each(function () { 8061 if ($currentLi && $(this).attr('id') === $currentLi.attr('id')) 8062 return true; //continue. don't hide current top menu item opened if provided 8063 self.hideSubMenu($(this)); 8064 }); 8065 break; 8066 default: //hide submenus for all type of menus 8067 //self.hideSubMenu(self.$containerSubMenus); 8068 $("li.topMenuItem", "#mainNavMenu").each(function () { 8069 self.hideSubMenu($(this)); 8070 }); 8071 $("li.topMenuItem", "#sideNavMenu").each(function () { 8072 self.hideSubMenu($(this)); 8073 }); 8074 break; 8075 } 8076}; 8077 8078MenuManager.prototype.isSubMenuTrigger = function ($elem) { 8079 return $elem.closest(".rwd-menu").length === 0 && $elem.attr("aria-haspopup") === "true"; 8080}; 8081 8082MenuManager.prototype.toggleSubMenu = function ($elem) { 8083 var expanded = $elem.attr("aria-expanded") === "true"; 8084 var $li = $elem.closest("li"); 8085 if (expanded) { 8086 menuManager.hideSubMenu($li); 8087 } else { 8088 menuManager.menuMouseOver($li); 8089 } 8090}; 8091 8092MenuManager.prototype.getFirstSubmenuItem = function ($elem) { 8093 var $parentLi = $elem.parent('li'); 8094 var pageId = $parentLi.data('pageid'); 8095 var displayMegaMenu = $parentLi.data('displaymegamenu'); 8096 8097 if (displayMegaMenu === 'True') { 8098 var $megaMenuContainer = $('.mainNavMegaMenu.megaMenuContainer.pageID_' + pageId); 8099 if ($megaMenuContainer.length > 0) { 8100 return $megaMenuContainer.find('a[role="menuitem"]').first(); 8101 } 8102 } 8103 8104 var firstAnchorId = "pagelink" + pageId; 8105 return $('#' + firstAnchorId); 8106}; 8107 8108MenuManager.prototype.setFocusToFirstSubmenuitem = function ($elem) { 8109 var $firstAnchor = menuManager.getFirstSubmenuItem($elem); 8110 if ($firstAnchor.length) { 8111 $firstAnchor[0].focus(); 8112 return true; 8113 } 8114 return false; 8115}; 8116 8117MenuManager.prototype.setFocusToLastTopLevelItem = function () { 8118 // Close any open submenus when tabbing out, but do not move focus. 8119 // Let the browser preserve the natural tab order so Shift+Tab re-enters 8120 // the menubar on the first top-level item rather than the last focused item. 8121 if (accessibleMenuToggleEnabled) { 8122 menuManager.hideAllSubMenus(MAIN_MENU); 8123 } 8124}; 8125 8126MenuManager.prototype.getLastSubmenuItem = function ($elem) { 8127 var $parentLi = $elem.parent('li'); 8128 var pageId = $parentLi.data('pageid'); 8129 var displayMegaMenu = $parentLi.data('displaymegamenu'); 8130 8131 if (displayMegaMenu === 'True' || displayMegaMenu === true) { 8132 var $megaMenuContainer = $('.mainNavMegaMenu.megaMenuContainer.pageID_' + pageId); 8133 if ($megaMenuContainer.length > 0) { 8134 return $megaMenuContainer.find('a[role="menuitem"]').last(); 8135 } 8136 } 8137 8138 var parentOlId = $parentLi.attr('id'); 8139 var $submenu = $('#Parent' + parentOlId); 8140 if ($submenu.length > 0) { 8141 return $submenu.find('a[role="menuitem"]').last(); 8142 } 8143 return $(); 8144}; 8145 8146MenuManager.prototype.setFocusToLastSubmenuitem = function ($elem) { 8147 var $lastAnchor = menuManager.getLastSubmenuItem($elem); 8148 if ($lastAnchor.length) { 8149 $lastAnchor[0].focus(); 8150 return true; 8151 } 8152 return false; 8153}; 8154 8155MenuManager.prototype.toggleIndicator = function ($anchor) { 8156 if (window.FeatureToggles.isActive("CMS.Pages.AccessibleMainMenuWithIndicators")) { 8157 if ($anchor.attr('aria-expanded') === 'true') { 8158 if ($anchor.hasClass("arrowDown")) 8159 $anchor.removeClass("arrowDown").addClass("arrowUp"); 8160 else if ($anchor.hasClass("arrowRight")) 8161 $anchor.removeClass("arrowRight").addClass("arrowDownSubMenu"); 8162 } else { 8163 if ($anchor.hasClass("arrowUp")) 8164 $anchor.removeClass("arrowUp").addClass("arrowDown"); 8165 else if ($anchor.hasClass("arrowDownSubMenu")) 8166 $anchor.removeClass("arrowDownSubMenu").addClass("arrowRight"); 8167 } 8168 } 8169} 8170 8171MenuManager.prototype.hideSubMenu = function ($li) { 8172 var self = this; // Reference to current object 8173 8174 // As the sub-menu is closed, we let the screen reader know that the menu is no longer expanded. 8175 var $anchor = $li.find('a'); 8176 if ($anchor.length && $anchor.attr('aria-haspopup') === 'true') { 8177 $anchor.attr('aria-expanded', 'false'); 8178 self.toggleIndicator($anchor); 8179 } 8180 8181 var displayMegaMenu = $li.data('displaymegamenu'); 8182 var mainMenu = $li.parents('nav').hasClass('mainNav') | $li.parents('ol').hasClass('mainSubMenu'); 8183 //When a menu item is set to display as mega menu, we still display regular sub menu for secondary nav, since it doesnt have a megamenu. So while hiding, hide the regular submenu for side navigation. 8184 if (displayMegaMenu != 'True' || !mainMenu) { 8185 if ($('#mainNavMenu').find('.navMenu').length == 0) { 8186 $('#mainNavMenu li a.mouseover').removeClass('mouseover'); 8187 } 8188 var id = $li.attr('id'); 8189 var $olSubMenu = $('#Parent' + id); 8190 if ($olSubMenu.length == 1) { 8191 //moves sub menu to hidden div 8192 $olSubMenu.appendTo(self.$divListSubMenus); 8193 //reset data of the menu 8194 $olSubMenu.removeData('menu'); 8195 if (self.bouncing) { 8196 //remove bouncing classes 8197 $olSubMenu.removeClass('flipLeft flipRight'); 8198 } 8199 $olSubMenu.css({ position: '', top: '', left: '', zIndex: '' }); 8200 //moves recursively its children if needed 8201 $olSubMenu.children().each(function () { 8202 self.hideSubMenu($(this)); 8203 $(this).unbind("mouseenter.menu"); 8204 }); 8205 8206 //Remove animation trigger class 8207 $olSubMenu.removeClass('animation-triggered'); 8208 } 8209 } else { 8210 var pageID = $li.data('pageid'); 8211 var megaMenuContainer = $('.mainNavMegaMenu.megaMenuContainer.pageID_' + pageID); 8212 if (!megaMenuContainer.hasClass('hover') && $('.megaMenuContainer .handle.pin.pinned').length === 0) { 8213 //$('#megaMenu').hide(); 8214 megaMenuContainer.hide(); 8215 $('#mainNav').css('z-index', ''); 8216 $('.megaMenuContainer').css("display", "none"); 8217 $('.megaMenuContainer').removeClass('animation-triggered'); 8218 } 8219 if (!$('.secondaryNavMegaMenu.megaMenuContainer.pageID_' + pageID).hasClass('hover')) { 8220 $('.secondaryNavMegaMenu.megaMenuContainer.pageID_' + pageID).hide(); 8221 } 8222 } 8223}; 8224 8225//Supports legacy code to set delays when opening/close submenus 8226MenuManager.prototype.setMOMMode = function (mommode, menuType) { 8227 //support legacy code 8228 if (menuType === MAIN_MENU) { 8229 switch (mommode) { 8230 case 0: 8231 self.popdownDelayTopMenu = 3; 8232 self.popupDelayTopMenu = false; 8233 self.mainMenuMaxSubMenuLevels = 0; 8234 break; 8235 case 2: 8236 self.popdownDelayTopMenu = 500; 8237 self.popupDelayTopMenu = 500; 8238 break; 8239 case 3: 8240 self.popdownDelayTopMenu = 500; 8241 self.popupDelayTopMenu = false; 8242 break; 8243 } 8244 } else if (menuType === SIDE_MENU) { 8245 switch (mommode) { 8246 case 0: 8247 self.popdownDelaySideMenu = 3; 8248 self.popupDelaySideMenu = false; 8249 self.sideMenuMaxSubMenuLevels = 0; 8250 break; 8251 case 2: 8252 self.popdownDelaySideMenu = 500; 8253 self.popupDelaySideMenu = 500; 8254 break; 8255 case 3: 8256 self.popdownDelaySideMenu = 500; 8257 self.popupDelaySideMenu = false; 8258 break; 8259 } 8260 } 8261}; 8262 8263MenuManager.prototype.adjustMainItemsWidth = function (menuSelector) { 8264 this.isAdjustingMainMenuItemsWidth = true; 8265 return adjustMainItemsWidth(menuSelector); 8266}; 8267 8268MenuManager.prototype.isMegaMenuItem = function ($elem) { 8269 var $parent = $elem.parent('li'); 8270 if ($parent != null && $parent.data('displaymegamenu') == 'True') { 8271 return true; 8272 } 8273 8274 var $megaMenuContainer = $elem.closest('.mainNavMegaMenu'); 8275 if ($megaMenuContainer.length > 0) { 8276 return true; 8277 } 8278 8279 return false; 8280}; 8281 8282MenuManager.prototype.isFirstSubmenuItem = function ($elem) { 8283 var $submenu = $elem.closest('.mainSubMenu, .mainNavMegaMenu'); 8284 if ($submenu.length === 0) return false; 8285 8286 var $allItems = $submenu.find('a[role="menuitem"]'); 8287 return $allItems.index($elem) === 0; 8288}; 8289 8290MenuManager.prototype.isLastSubmenuItem = function ($elem) { 8291 var $submenu = $elem.closest('.mainSubMenu, .mainNavMegaMenu'); 8292 if ($submenu.length === 0) return false; 8293 8294 var $allItems = $submenu.find('a[role="menuitem"]'); 8295 return $allItems.index($elem) === $allItems.length - 1; 8296}; 8297
8298MenuManager.prototype.focusPrevSubmenuItem = function ($elem) { 8299 var $prev = $elem.parent('li').prev('li').find('a:first'); 8300 if ($prev.length > 0) { 8301 $prev.focus(); 8302 } 8303}; 8304 8305MenuManager.prototype.focusNextSubmenuItem = function ($elem) { 8306 var $next = $elem.parent('li').next('li').find('a:first'); 8307 if ($next.length > 0) { 8308 $next.focus(); 8309 } 8310}; 8311 8312MenuManager.prototype.findTopLevelParentId = function ($elem) { 8313 // For mega menus 8314 var $megaMenu = $elem.closest('.mainNavMegaMenu'); 8315 if ($megaMenu.length > 0) { 8316 var pageId = $megaMenu.attr('id').replace('mainNavMegaMenu', ''); 8317 return 'MainItem' + pageId; 8318 } 8319 8320 // For regular submenus - find the submenu that contains the current element 8321 var $submenu = $elem.closest('ol[id^="ParentMainItem"]'); 8322 if ($submenu.length === 0) { 8323 return null; 8324 } 8325 8326 // Get the ID of the menu item that OWNS this submenu 8327 var ownerId = $submenu.attr('id').replace('ParentMainItem', ''); // e.g., "27" from "ParentMainItem27" 8328 8329 // Recursive helper to find the top-level parent 8330 var findTopLevel = function (id) { 8331 var $item = document.querySelector('#MainItem' + id); 8332 if (!$item) return null; 8333 8334 var $parentSubmenu = $item.closest("ol[id^='ParentMainItem']"); 8335 8336 if (!$parentSubmenu) { 8337 // This item is not inside any submenu, so it's top-level 8338 return 'MainItem' + id; 8339 } 8340 8341 // Get the parent's owner ID and recurse 8342 var parentOwnerId = $parentSubmenu.id.match(/\d+$/)?.[0]; 8343 return parentOwnerId ? findTopLevel(parentOwnerId) : 'MainItem' + id; 8344 }; 8345 8346 return findTopLevel(ownerId); 8347}; 8348 8349MenuManager.prototype.getSubmenuParentId = function ($elem) { 8350 var $submenu = $elem.closest('.mainSubMenu'); 8351 if ($submenu.length > 0) { 8352 // For regular submenus, extract parent ID from submenu's id (e.g., "ParentMainItem123") 8353 return $submenu.attr('id').replace('Parent', ''); 8354 } 8355 8356 var $megaMenu = $elem.closest('.mainNavMegaMenu'); 8357 if ($megaMenu.length > 0) { 8358 // For mega menus, extract from mega menu container id (e.g., "mainNavMegaMenu123") 8359 return 'MainItem' + $megaMenu.attr('id').replace('mainNavMegaMenu', ''); 8360 } 8361 8362 return null; 8363}; 8364 8365MenuManager.prototype.handleUpKeyOnTopLevelItem = function ($elem) { 8366 if (!accessibleMenuToggleEnabled || !this.isSubMenuTrigger($elem)) { 8367 return false; 8368 } 8369 8370 var isExpanded = $elem.attr('aria-expanded') === 'true'; 8371 if (!isExpanded) { 8372 this.toggleSubMenu($elem); 8373 } 8374 8375 var self = this; 8376 setTimeout(function () { 8377 self.setFocusToLastSubmenuitem($elem); 8378 }, isExpanded ? 0 : 300); 8379 8380 return true; 8381}; 8382 8383MenuManager.prototype.handleDownKeyOnTopLevelItem = function ($elem) { 8384 if (!accessibleMenuToggleEnabled || !this.isSubMenuTrigger($elem)) { 8385 return false; 8386 } 8387 8388 var isExpanded = $elem.attr('aria-expanded') === 'true'; 8389 if (!isExpanded) { 8390 this.toggleSubMenu($elem); 8391 } 8392 8393 var self = this; 8394 setTimeout(function () { 8395 self.setFocusToFirstSubmenuitem($elem); 8396 }, isExpanded ? 0 : 300); 8397 8398 return true; 8399}; 8400 8401MenuManager.prototype.handleUpKeyInSubmenu = function ($elem, options) { 8402 options = options || {}; 8403 8404 // Existing behavior for non-toggle mode 8405 if (!accessibleMenuToggleEnabled) { 8406 if (this.isFirstSubmenuItem($elem) && options.onFirstItem) { 8407 options.onFirstItem($elem); 8408 } else { 8409 this.focusPrevSubmenuItem($elem); 8410 } 8411 return; 8412 } 8413 8414 // New behavior with toggle enabled 8415 if (this.isFirstSubmenuItem($elem)) { 8416 var parentId = this.getSubmenuParentId($elem); 8417 if (parentId) { 8418 this.setFocusToLastSubmenuitem($('#' + parentId).find('a:first')); 8419 } 8420 } else { 8421 this.focusPrevSubmenuItem($elem); 8422 } 8423}; 8424 8425MenuManager.prototype.handleDownKeyInSubmenu = function ($elem) { 8426 // Existing behavior for non-toggle mode 8427 if (!accessibleMenuToggleEnabled) { 8428 this.focusNextSubmenuItem($elem); 8429 return; 8430 } 8431 8432 // New behavior with toggle enabled 8433 if (this.isLastSubmenuItem($elem)) { 8434 var parentId = this.getSubmenuParentId($elem); 8435 if (parentId) { 8436 this.setFocusToFirstSubmenuitem($('#' + parentId).find('a:first')); 8437 } 8438 } else { 8439 this.focusNextSubmenuItem($elem); 8440 } 8441}; 8442 8443MenuManager.prototype.getAdjacentTopLevelItem = function ($currentLi, direction) { 8444 var $targetLi = direction === 'prev' ? $currentLi.prev('li.topMenuItem') : $currentLi.next('li.topMenuItem'); 8445 8446 if ($targetLi.length === 0) { 8447 var $siblings = $currentLi.parent().children('li.topMenuItem');
8448 $targetLi = direction === 'prev' ? $siblings.last() : $siblings.first(); 8449 } 8450 8451 return $targetLi; 8452}; 8453 8454MenuManager.prototype.handleLeftKeyOnTopLevelItem = function ($anchor, openSubmenu) { 8455 var $currentLi = $anchor.parent('li.topMenuItem'); 8456 var $prevLi = this.getAdjacentTopLevelItem($currentLi, 'prev'); 8457 var $targetAnchor = $prevLi.find('a:first'); 8458 $targetAnchor.focus(); 8459 8460 if (openSubmenu && this.isSubMenuTrigger($targetAnchor)) { 8461 clearTimeout(this.menuTimeoutID); 8462 this.openSubmenuImmediately($prevLi); 8463 } 8464}; 8465 8466MenuManager.prototype.handleRightKeyOnTopLevelItem = function ($anchor, openSubmenu) { 8467 var $currentLi = $anchor.parent('li.topMenuItem'); 8468 var $nextLi = this.getAdjacentTopLevelItem($currentLi, 'next'); 8469 var $targetAnchor = $nextLi.find('a:first'); 8470 $targetAnchor.focus(); 8471 8472 if (openSubmenu && this.isSubMenuTrigger($targetAnchor)) { 8473 clearTimeout(this.menuTimeoutID); 8474 this.openSubmenuImmediately($nextLi); 8475 } 8476}; 8477 8478MenuManager.prototype.handleLeftKeyInSubmenu = function ($elem, shouldOpenSubmenu) { 8479 var self = this; 8480 // Check if current item has a parent submenu item 8481 var $currentSubmenu = $elem.closest('ol.mainSubMenu'); 8482 if ($currentSubmenu.length === 0) { 8483 return; 8484 } 8485 8486 var parentItemId = $currentSubmenu.attr('id').replace('Parent', ''); 8487 var $parentItem = $('#' + parentItemId); 8488 var $parentAnchor = $parentItem.find('a:first'); 8489 8490 // Check if the parent item is a submenu item 8491 var $parentSubmenu = $parentItem.closest('ol.mainSubMenu'); 8492 var parentIsSubmenuItem = $parentSubmenu.length > 0; 8493 8494 if (parentIsSubmenuItem) { 8495 this.hideSubMenu($parentItem); 8496 $parentAnchor.focus(); 8497 return; 8498 } 8499 8500 var parentId = this.getSubmenuParentId($elem); 8501 if (!parentId) 8502 return; 8503 8504 var $parentLi = $('#' + parentId); 8505 8506 this.hideSubMenu($parentLi); 8507 8508 var $prevLi = $parentLi.prev('li.topMenuItem'); 8509 if ($prevLi.length === 0) { 8510 $prevLi = $parentLi.parent().children('li.topMenuItem').last(); 8511 } 8512 8513 var $prevAnchor = $prevLi.find('a:first'); 8514 $prevAnchor.focus(); 8515 8516 if (shouldOpenSubmenu && this.isSubMenuTrigger($prevAnchor)) { 8517 this.openSubmenuImmediately($prevLi); 8518 var isExpanded = $prevAnchor.attr('aria-expanded') === 'true'; 8519 8520 if (isExpanded) { 8521 setTimeout(function () { 8522 self.setFocusToFirstSubmenuitem($prevAnchor); 8523 }, 300); 8524 } 8525 } 8526}; 8527 8528MenuManager.prototype.handleRightKeyInSubmenu = function ($elem, shouldOpenSubmenu) { 8529 var self = this; 8530 8531 // Check if current item has child submenu 8532 if (this.isSubMenuTrigger($elem)) { 8533 var isExpanded = $elem.attr('aria-expanded') === 'true'; 8534 if (!isExpanded) { 8535 var $parentLi = $elem.parent('li'); 8536 this.openSubmenuImmediately($parentLi); 8537 setTimeout(function () { 8538 self.setFocusToFirstSubmenuitem($elem); 8539 }, 300); 8540 return; 8541 } 8542 } 8543 8544 var topLevelParentId = this.findTopLevelParentId($elem); 8545 if (!topLevelParentId) { 8546 return; 8547 } 8548 8549 this.hideAllSubMenus(MAIN_MENU); 8550 8551 var $topLevelParent = $('#' + topLevelParentId); 8552 var $nextLi = $topLevelParent.next('li.topMenuItem'); 8553 if ($nextLi.length === 0) { 8554 $nextLi = $('#mainNavMenu > li.topMenuItem').first(); 8555 } 8556 8557 var $nextAnchor = $nextLi.children('a:first'); 8558 if ($nextAnchor.length > 0) { 8559 $nextAnchor.focus(); 8560 if (shouldOpenSubmenu) { 8561 // Check if target is a mega menu OR regular submenu 8562 var isMegaMenu = $nextLi.attr('data-displaymegamenu') === 'True'; 8563 var hasSubmenu = this.isSubMenuTrigger($nextAnchor); 8564 8565 if (isMegaMenu || hasSubmenu) { 8566 self.menuMouseOver($nextLi); 8567 8568 setTimeout(function () { 8569 self.setFocusToFirstSubmenuitem($nextAnchor); 8570 }, 300); 8571 } 8572 } 8573 } 8574}; 8575 8576MenuManager.prototype.openSubmenuImmediately = function ($li) { 8577 var self = this; 8578 var savedDelay = self.popupDelayTopMenu; 8579 self.popupDelayTopMenu = 0; // Disable delay temporarily 8580 self.menuMouseOver($li); 8581 self.popupDelayTopMenu = savedDelay; // Restore delay 8582}; 8583 8584MenuManager.prototype.shouldOpenSubmenuOnNavigation = function ($elem) { 8585 // Find if current element is in a submenu 8586 var $currentSubmenu = $elem.closest('ol.mainSubMenu'); 8587 if ($currentSubmenu.length === 0) { 8588 return false; 8589 } 8590 8591 // Get the parent menu item of this submenu 8592 var parentItemId = $currentSubmenu.attr('id').replace('Parent', ''); 8593 var $parentItem = $('#' + parentItemId); 8594 8595 // Check if parent is a top-level item or nested submenu item 8596 var $parentSubmenu = $parentItem.closest('ol.mainSubMenu'); 8597 8598 if ($parentSubmenu.length === 0) { 8599 // Parent is top-level,so we should open next submenu 8600 return true; 8601 } else { 8602 // Parent is in a nested submenu, check its aria-expanded 8603 var $parentAnchor = $parentItem.find('a:first'); 8604 return $parentAnchor.attr('aria-expanded') === 'true'; 8605 } 8606}; 8607 8608MenuManager.prototype.isTopLevelMenuItem = function ($elem) { 8609 return $elem.hasClass('navMainItem') || $elem.closest('li').hasClass('topMenuItem'); 8610};
8611 8612MenuManager.prototype.setActiveTopLevelItem = function ($elem) { 8613 if (!accessibleMenuToggleEnabled || !this.isTopLevelMenuItem($elem)) { 8614 return; 8615 } 8616 8617 // Roving tabindex pattern 8618 let $topLevelAnchor = $elem.hasClass('navMainItem') ? $elem : $elem.closest('li.topMenuItem').find('a.navMainItem').first(); 8619 if ($topLevelAnchor.length === 0) { 8620 return; 8621 } 8622 8623 $('#mainNavMenu > li.topMenuItem > a.navMainItem').attr('tabindex', '-1'); 8624 $topLevelAnchor.attr('tabindex', '0'); 8625}; 8626 8627MenuManager.prototype.handleUpKeyOnAnyTopLevelItem = function ($elem) { 8628 if (this.isMegaMenuItem($elem)) { 8629 return false; 8630 } 8631 8632 return this.handleUpKeyOnTopLevelItem($elem); 8633}; 8634 8635MenuManager.prototype.handleLeftKeyOnAnyTopLevelItem = function ($elem) { 8636 if (accessibleMenuToggleEnabled) { 8637 var shouldOpenSubmenu = $elem.attr('aria-expanded') === 'true'; 8638 this.handleLeftKeyOnTopLevelItem($elem, shouldOpenSubmenu); 8639 return; 8640 } 8641 8642 this.navigateToSiblingTopLevelItem($elem, 'prev'); 8643}; 8644 8645MenuManager.prototype.handleRightKeyOnAnyTopLevelItem = function ($elem) { 8646 if (accessibleMenuToggleEnabled) { 8647 var shouldOpenSubmenu = $elem.attr('aria-expanded') === 'true'; 8648 this.handleRightKeyOnTopLevelItem($elem, shouldOpenSubmenu); 8649 return; 8650 } 8651 8652 this.navigateToSiblingTopLevelItem($elem, 'next'); 8653}; 8654 8655MenuManager.prototype.navigateToSiblingTopLevelItem = function ($elem, direction) { 8656 var $currentLi = $elem.parent('li.topMenuItem'); 8657 var $targetLi = this.getAdjacentTopLevelItem($currentLi, direction); 8658 $targetLi.find('a:first').focus(); 8659}; 8660 8661function adjustMainItemsWidth(menuSelector) { 8662 var widths = []; 8663 var $items = []; 8664 $(menuSelector).data('autowidth', true).find(".topMenuItem").each(function () { 8665 widths.push($(this).outerWidth()); 8666 $items.push($(this)); 8667 }); 8668 if (widths.length > 0) { 8669 var totalWidth = 0; 8670 var i; 8671 for (i = 0; i < widths.length; i++) { 8672 totalWidth += widths[i]; 8673 } 8674 var menuWidth = $(menuSelector).outerWidth(); 8675 var availableWidth = menuWidth - totalWidth; 8676 var paddingPerItem = availableWidth / $items.length; 8677 for (i = 0; i < $items.length; i++) { 8678 var width = (100 * (widths[i] + paddingPerItem) / menuWidth); 8679 //This is to account for the anomoly of the last menu item wrapping for one client (Anoka County) only in Mac Safari 8680 //A site-specific solution was sought but none found that was acceptable 8681 if (navigator.userAgent.indexOf("Safari") > -1 && navigator.userAgent.indexOf('Chrome') == -1 && i == $items.length - 1) { 8682 width = width - 1; 8683 } 8684 $items[i].outerWidth(width + "%"); 8685 } 8686 } 8687} 8688 8689MenuManager.prototype.resetMainItemsWidth = function (menuSelector) { 8690 $(menuSelector).find(".topMenuItem").each(function () { 8691 $(this).css("width", "auto"); 8692 }); 8693}; 8694 8695function log(text) { 8696 console.log(text); 8697} 8698 8699/**** End-Functions to handle Main/Left Menu on Front-end. *****/ 8700 8701/***** Drag and Drop functions to handle main/side menus ********/ 8702 8703//Handles when an element was dropped 8704MenuManager.prototype.dragHandler = function ($element, dragInfo) { 8705 var self = this; // Reference to current object 8706 8707 //var miLeave = 0; 8708 var menuItemLeave = function ($menuItemOver) { 8709 $menuItemOver.removeClass('hover'); 8710 //miLeave++; 8711 //log("Leave event " + (miLeave) + ", liID=" + $menuItemOver.attr('id') + ", class=" + $menuItemOver.attr('class')); 8712 //$('#log3').val("Leave event " + (miLeave) + ", liID=" + $menuItemOver.attr('id') + ", class=" + $menuItemOver.attr('class')); 8713 }; 8714 8715 if ($element.length != 0 && !$element.hasClass('thingToDrag')) { //workaround to avoid executing drag handler when mouse pointer is over drag helper 8716 //resetElementOver(); 8717 //dragInfo.currentElementOver = { $element: null, $li: null, isAddPage: null, $ol: null }; 8718 dragInfo.resetCurrentElementOver(); 8719 // This element will hold info to keep track of the current element that the mouse pointer is over. 8720 dragInfo.currentElementOver.$element = $element; 8721 //$('#log1').val('element ID:' + $element.attr('id') + ', class=' + $element.attr('class') + ", tag=" + $element.get(0).nodeName + "html=" + $element.html()); 8722 8723 if ($element.hasClass('inside')) { 8724 //when mouse is over any DOM element inside an LI MenuItem 8725 var $li = $element.closest('li'); 8726 8727 dragInfo.currentElementOver.$li = $li; 8728 } else if ($element.hasClass('liDropabble')) { 8729 //when mouse is over LI form field element 8730 dragInfo.currentElementOver.$li = $element; 8731 } 8732 8733 if (dragInfo.currentElementOver.$li != null && dragInfo.currentElementOver.$li.hasClass('liDropabble')) { 8734 //Over a valid droppable li 8735 dragInfo.currentElementOver.$ol = dragInfo.currentElementOver.$li.parent(); 8736 //$('#log2').val("inside.. . currentLI=" + dragInfo.currentElementOver.$li.attr('id')); 8737 } 8738 8739 // Logic to determines if mouse pointer is out of a menu item. 8740 if (dragInfo.$prevMenuItemOver != null && (dragInfo.currentElementOver.$li == null || dragInfo.currentElementOver.$li[0] != dragInfo.$prevMenuItemOver[0])) { 8741 //fire menu item leave event 8742 menuItemLeave(dragInfo.$prevMenuItemOver); 8743 } 8744 dragInfo.$prevMenuItemOver = dragInfo.currentElementOver.$li; 8745 8746 //mouse is over a valid form field to resize.?? 8747 } 8748}; 8749 8750///Handles when an element was dropped 8751MenuManager.prototype.dropHandler = function (dragInfo) { 8752 var self = this; // Reference to current object 8753 8754 var validPosition = false; 8755 if (dragInfo.currentElementOver != null && dragInfo.currentElementOver.$li != null && dragInfo.currentElementOver.$li.hasClass('liDropabble') && !dragInfo.currentElementOver.$li.hasClass('beingDragged')) { 8756 var $liTarget = dragInfo.currentElementOver.$li; 8757 $liTarget.removeClass('hover'); 8758
8759 if (self.sideMenuHasCustomLinks || dragInfo.$draggedElement.data('drag').menuType === $liTarget.data('drag').menuType) { 8760 validPosition = true; 8761 //var msgSource = "ID=" + dragInfo.$draggedElement.data('drag').itemID + ",parentID=" + dragInfo.$draggedElement.data('drag').parentID + ",prevItemID=" + dragInfo.$draggedElement.data('drag').prevItemID + ",isAddPage=" + dragInfo.$draggedElement.data('drag').isAddPage; 8762 //var msgTarget = "ID=" + $liTarget.data('drag').itemID + ",parentID=" + $liTarget.data('drag').parentID + ",prevItemID=" + $liTarget.data('drag').prevItemID + ",isAddPage=" + $liTarget.data('drag').isAddPage; 8763 //alert("dropped source=" + msgSource + "\nOn target=" + msgTarget); 8764 var url = ''; 8765 var addingPage = false; 8766 if (dragInfo.$draggedElement.data('drag').isAddPage) { 8767 //Creating a new page in a specific menu position 8768 addingPage = true; 8769 url = "/Pages/Page/Add"; 8770 } else { 8771 //Moving an existing menu item on different position 8772 url = "/Pages/PageStatus/Move/" + dragInfo.$draggedElement.data('drag').itemID; 8773 } 8774 //logic to build position where menu item was dropped 8775 url += "?parentID=" + $liTarget.data('drag').parentID; 8776 if ($liTarget.data('drag').isAddPage) { 8777 if ($liTarget.data('drag').prevItemID != null) 8778 url += "&refPageID={1}&position=Next".replace("{1}", $liTarget.data('drag').prevItemID); 8779 else 8780 url += "&position=Child"; 8781 } else { 8782 url += "&refPageID={1}&position=Previous".replace("{1}", $liTarget.data('drag').itemID); 8783 if ($liTarget.hasClass('topMenuItem') && $liTarget.data('drag').menuType == MAIN_MENU) { 8784 //Check whether or not is possible to copy layout from top sibling page 8785 var message = ''; 8786 $.ajax({
8787 url: '/Layout/CopyAssociation/CheckTopPages?copyLayoutFrom={0}' 8788 .replace('{0}', $liTarget.data('drag').itemID), 8789 type: 'POST', 8790 async: false, //Needs to be a sync request 8791 success: function (response) { 8792 if (response.ErrorMessage) { 8793 alert(response.ErrorMessage); 8794 } else if (response.Message) { 8795 message = response.Message; 8796 } 8797 }, 8798 error: function (xhr, textStatus, exception) { 8799 alert("Error: " + xhr.statusText + "\nStatus: " + xhr.status); 8800 } 8801 }); 8802 if (message.length > 0 && confirm(message)) { 8803 url += "©LayoutFrom=" + $liTarget.data('drag').itemID; 8804 } 8805 } 8806 } 8807 8808 if (addingPage) { 8809 window.location.href = url; 8810 } else { 8811 $.ajax({ 8812 url: url, 8813 type: 'POST', 8814 success: function (response) { 8815 if (response.ErrorMessage) { 8816 alert(response.ErrorMessage); 8817 ajaxPostBackEnd(); 8818 } else if (response.RedirectURL && response.RedirectURL !== location.href) { 8819 location.href = response.RedirectURL; 8820 } else { 8821 location.reload(true); 8822 } 8823 }, 8824 beforeSend: function () { 8825 ajaxPostBackStart('Loading'); 8826 }, 8827 error: function (xhr, textStatus, exception) { 8828 alert("Error: " + xhr.statusText + "\nStatus: " + xhr.status); 8829 ajaxPostBackEnd(); 8830 } 8831 }); 8832 } 8833 } 8834 } 8835}; 8836 8837MenuManager.prototype.setupDraggableElement = function ($element, menuType, containerSelectorToAppend) { 8838 var self = this; // Reference to current object 8839 8840 //Unbind the event before binding it again. Both solutions below work. 8841 $element.unbind('draginit dragstart drag dragend'); 8842 //$element.drag('destroy'); 8843 // Prevents IE from selecting text while starting a drag. 8844 $element.bind('selectstart', function (event) { 8845 event.preventDefault(); 8846 return false; 8847 }); 8848 8849 var dragInfo = null; 8850 8851 var relativeContainerOffSet = { top: 0, left: 0 }; 8852 var draggedRelativeElementOffset = { top: 0, left: 0 }; 8853 var isAddPageElem = $element.hasClass('addPage'); 8854 8855 //jquery event drag 2.0 plugin. 8856 $element.drag("start", function () { 8857 if (self.mobileMainNav) return false; 8858 self.isMainMenuBeingDragged = (menuType == MAIN_MENU); 8859 self.isSideMenuBeingDragged = (menuType == SIDE_MENU); 8860 8861 var $draggedElement = null; 8862 if ($(this).hasClass('grippy')) 8863 $draggedElement = $(this).parent('li'); //page menu items 8864 else if ($(this).hasClass('addPage')) 8865 $draggedElement = $(this); //Add Page menu items 8866 8867 $draggedElement.addClass('beingDragged'); 8868 8869 /*if ($draggedElement.hasClass('topMenuItem') && (menuType == MAIN_MENU)) { 8870 //workaround to hide top level menu items on main menu. (hideMenu don't work since submenus are not naturally on DOM) 8871 self.hideAllSubMenus(MAIN_MENU); 8872 } 8873 else*/ 8874 self.hideSubMenu($draggedElement); 8875 8876 dragInfo = { 8877 $draggedElement: $draggedElement, 8878 currentElementOver: { $element: null, $li: null, isAddPage: null, $ol: null }, 8879 $prevMenuItemOver: null, 8880 resetCurrentElementOver: function () { 8881 this.currentElementOver.$element = null; 8882 this.currentElementOver.$li = null; 8883 this.currentElementOver.$ol = null; 8884 this.currentElementOver.isAddPage = null; 8885 } 8886 }; 8887 8888 //If container for thing to drag has relative position, gets its offset to subtract coordinates while dragging. 8889 relativeContainerOffSet = ($(containerSelectorToAppend).css("position") == "relative") ? $(containerSelectorToAppend).offset() : { top: 0, left: 0 }; 8890 8891 var hasChildren = $draggedElement.hasClass('hasChildren'); 8892 var menuText = $draggedElement.children('a.navMenuItem, a.navMainItem').text(); 8893 if (menuText == '') { 8894 menuText = $draggedElement.children('div.accordionNavItem').children('a.navMenuItem').text(); 8895 } 8896 var $dragHelper = $('<a/>', { 8897 'class': 'thingToDrag navMenuItem' + (hasChildren ? ' withChildren' : '') 8898 }).css('z-index', 1002).text(menuText); 8899 return $dragHelper.appendTo(containerSelectorToAppend); 8900 }).drag(function (e, dd) { 8901 //if draggable element has relative position, gets the offset where the mouse was clicked to add coordinates while dragging. 8902 draggedRelativeElementOffset = (isAddPageElem) ? { top: dd.startY - dd.originalY, left: dd.startX - dd.originalX } : { top: 0, left: 0 }; 8903 8904 $(dd.proxy).css({ 8905 top: (dd.offsetY + draggedRelativeElementOffset.top - relativeContainerOffSet.top) + 15, 8906 left: (dd.offsetX + draggedRelativeElementOffset.left - relativeContainerOffSet.left) - 10 8907 }); 8908 //$('#log4').val('dd.offsetX=' + dd.offsetX + ',dd.offsetY=' + dd.offsetY + ',e.clientX=' + e.clientX + ',e.clientY=' + e.clientY + ',e.pageX=' + e.pageX + ',e.pageY=' + e.pageY); 8909 var $elementOver = $(document.elementFromPoint(e.originalEvent.clientX, e.originalEvent.clientY)); 8910 // Execute drag handler 8911 if (dragInfo != null) 8912 self.dragHandler($elementOver, dragInfo); 8913 }, { relative: false }) 8914 .drag("end", function (ev, dd) { 8915 if (self.mobileMainNav) return false; 8916 $(dd.proxy).remove(); 8917 8918 if (dragInfo != null) { 8919 self.dropHandler(dragInfo); 8920 dragInfo.$draggedElement.removeClass('beingDragged'); 8921 dragInfo.$draggedElement = null; 8922 dragInfo.$prevMenuItemOver = null; 8923 dragInfo = null; 8924 } 8925 self.isMainMenuBeingDragged = false; 8926 self.isSideMenuBeingDragged = false; 8927 }); 8928}; 8929 8930MenuManager.prototype.setupDroppableElement = function ($element, menuType) { 8931 var self = this; // Reference to current object 8932 if (!self.mobileMainNav && $element.find('div.indicator').length == 1 && !$element.hasClass('liDropabble')) { 8933 $element.addClass('liDropabble'); 8934 8935 //initialize drag jquery data for droppable elements 8936 var isAddPage = $element.hasClass('addPage'); 8937 var itemID = !isAddPage ? $element.attr('id').replace(/MainItem|SideItem/i, '') : ''; 8938 var prevItemID = ($element.prev().length == 1) ? $element.prev().attr('id').replace(/MainItem|SideItem/i, '') : null; 8939 var parentID = $element.parent().attr('id').replace(/ParentMainItem|ParentSideItem/i, ''); 8940 if (isNaN(parentID)) //for top level menu items 8941 parentID = $element.parent().data('parent'); 8942 8943 $element.data('drag', { itemID: itemID, parentID: parentID, prevItemID: prevItemID, isAddPage: isAddPage, menuType: menuType }); 8944 8945 /// Setups recursively all children DOM elements with class needed by drag algorithm to recognize which element mouse pointer is 8946 var setUpChildren = function ($children) { 8947 if ($children.length > 0) { 8948 $children.each(function () { 8949 $children.addClass('inside'); 8950 setUpChildren($(this).children()); 8951 }); 8952 } 8953 }; 8954 8955 setUpChildren($element.children()); 8956 } 8957}; 8958 8959MenuManager.prototype.setupDroppableAccordionElement = function ($element) { 8960 var self = this; 8961 if (!self.mobileMainNav && $element.find('div.indicator').length > 0 && !$element.hasClass('liDropabble')) { 8962 $element.addClass('liDropabble'); 8963 8964 //initialize drag jquery data for droppable elements 8965 var isAddPage = $element.hasClass('addPage'); 8966 var itemID = !isAddPage ? $element.attr('id').replace(/MainItem|SideItem/i, '') : ''; 8967 var prevItemID = ($element.prev().length == 1) ? $element.prev().attr('id').replace(/MainItem|SideItem/i, '') : null; 8968 var $parent = $element.parents('li:first'); 8969 if ($parent.length == 0) { 8970 $parent = $element.parents('ol:first'); 8971 } 8972 var parentID = $parent.attr('id').replace(/ParentMainItem|ParentSideItem/i, ''); 8973 if (isNaN(parentID)) //for top level menu items 8974 parentID = $element.parent().data('parent'); 8975 8976 $element.data('drag', { itemID: itemID, parentID: parentID, prevItemID: prevItemID, isAddPage: isAddPage, menuType: SIDE_MENU }); 8977 8978 /// Setups recursively all children DOM elements with class needed by drag algorithm to recognize which element mouse pointer is 8979 var setUpChildren = function ($children) { 8980 $children.each(function () { 8981 $children.addClass('inside'); 8982 setUpChildren($(this).children()); 8983 }); 8984 }; 8985 8986 setUpChildren($element.children()); 8987 } 8988 8989 $element.unbind('mouseenter').mouseenter(function (e) { 8990 e.stopPropagation(); 8991 if (self.isSideMenuBeingDragged) { 8992 $element.addClass('hover'); 8993 } 8994 }); 8995 8996 $element.unbind('mouseleave').mouseleave(function (e) { 8997 $element.removeClass('hover'); 8998 }); 8999}; 9000 9001///Moves the submenu to be displayed at the bottom of the DOM. 9002MenuManager.prototype.moveSubMenuInDOM = function ($submenu, menuType) { 9003 9004 //Remove any old .pop elements from the DOM to reload the new one. 9005 if ($('body').find($submenu).length > 0) 9006 $('body').find($submenu).remove(); 9007 9008 //$submenu is the ol, $parent is the li. 9009 $submenu.addClass('subMenuMoved').appendTo('body'); 9010 9011 var className = menuType == MAIN_MENU ? 'mainSubMenu' : 'secondarySubMenu'; 9012 $submenu.addClass(className); 9013 $submenu.addClass('moved'); 9014 9015 $submenu.css('position', 'absolute'); 9016 $submenu.css('z-index', '100'); 9017} 9018 9019///Updates the position of submenus in the DOM. 9020MenuManager.prototype.positionSubMenuInDOM = function ($submenu, $li, menuType) { 9021 var topMainNavigationLink = menuType == MAIN_MENU && $li.hasClass('topMenuItem'); 9022 var self = this; 9023 self.updateSubMenuPositionAttributes($submenu, topMainNavigationLink, menuType); 9024 //If after the submenu is positioned, it has a class of flipLeft, remove it since that causes some display issues on the front-end. Vishal 9025 if ($submenu.hasClass('flipLeft')) 9026 $submenu.removeClass('flipLeft').addClass('flippedLeft'); 9027};
9028 9029MenuManager.prototype.updateSubMenuPositionAttributes = function ($submenu, topMainNavigationLink, menuType) { 9030 //Get the main nav. 9031 var parentID = $submenu.attr('id').replace(/Parent/, ''); 9032 var $parent = $('#' + parentID); 9033 9034 $submenu.removeClass('flippedLeft'); 9035 9036 if ($('#bodyWrapper').data('maxPaddingBottom') == undefined) 9037 $('#bodyWrapper').data('maxPaddingBottom', 0); 9038 9039 //Reset bottom-padding on body wrapper to allow accurate calculation 9040 $('#bodyWrapper').css('padding-bottom', $('#bodyWrapper').data('maxPaddingBottom')); 9041 9042 var docHeight = $(document).height(); 9043 var menuVisibleSpaceAvailable = docHeight - $parent.offset().top; 9044 var submenuHeight = $submenu.height(); 9045 9046 //If the parent submenu opened in towards left, let all the subsequent submenus open in the same flow. 9047 if ($parent.length > 0 && $parent.parents('ol.subMenuMoved').hasClass('flippedLeft')) 9048 $submenu.addClass('flipLeft'); 9049 9050 if (menuVisibleSpaceAvailable < submenuHeight && !$submenu.hasClass('takenIntoAccount')) { 9051 //20 is just a default safe padding apart from the calculations. 9052 $('#bodyWrapper').css('padding-bottom', (submenuHeight - menuVisibleSpaceAvailable + parseFloat($('#bodyWrapper').data('maxPaddingBottom')) + 20)); 9053 $('#bodyWrapper').data('maxPaddingBottom', $('#bodyWrapper').css('padding-bottom')); 9054 $submenu.addClass('takenIntoAccount'); 9055 if (!$submenu.hasClass('safePaddingApplied')) { 9056 //Add a padding-bottom of 10px to the submenu to be more presentable 9057 $submenu.css('padding-bottom', '10px'); 9058 $submenu.addClass('safePaddingApplied'); 9059 } 9060 } 9061 if (menuType == MAIN_MENU) { 9062 //Set top position of main submenu 9063 $submenu.css('top', $parent.offset().top + (topMainNavigationLink ? $parent.height() : 0)); 9064 9065 if ($submenu.hasClass('flipLeft')) { 9066 var width = $submenu.find('li:first').width(); 9067 //Set left position of side submenu 9068 $submenu.css('left', $parent.offset().left - width); 9069 } 9070 else { 9071 //Set left position of main submenu 9072 $submenu.css('left', $parent.offset().left + (topMainNavigationLink ? 0 : $parent.width())); 9073 } 9074 } 9075 else { 9076 //Set top position of side submenu 9077 $submenu.css('top', $parent.offset().top); 9078 9079 if ($submenu.hasClass('flipLeft')) { 9080 var width = $submenu.find('li:first').width(); 9081 //Set left position of side submenu 9082 $submenu.css('left', $parent.offset().left - width); 9083 } 9084 else { 9085 //Set left position of side submenu 9086 $submenu.css('left', $parent.offset().left + $parent.width()); 9087 } 9088 } 9089}; 9090/***** End - Drag and Drop functions to handle main/side menus ********/ 9091 9092/***** Start - Mega Menu methods ********/ 9093MenuManager.prototype.pinMegaMenuOpen = function ($this) { 9094 var $megaMenuGrid = $this.parents('.megaMenuContainer').children('.pageContent.cpGrid'); 9095 if ($megaMenuGrid.is(':visible')) { 9096 $('#mainNav').css('z-index', '10'); 9097 $megaMenuGrid.addClass('pinned'); 9098 $megaMenuGrid.find('.handle.pin').addClass('pinned'); 9099 if (typeof PageEditLocalization != 'undefined') { 9100 $megaMenuGrid.find('.handle.pin').attr('title', pageEditLocalization.UnpinMegaMenu); 9101 } 9102 } 9103}; 9104 9105MenuManager.prototype.resetMouseOvers = function () { 9106 $('#mainNav').css('z-index', '').find('*').removeClass('mouseover'); 9107 $('#secondaryNav').find('*').removeClass('mouseover'); 9108}; 9109 9110/// Setup 9111MenuManager.prototype.initializeMegaMenus = function () { 9112 var self = this; 9113 if (typeof window.DesignCenter === 'undefined' || typeof window.DesignCenter.themeJSON === 'undefined') { // If we aren't in design center.... 9114 $('#megaMenu,.megaMenuContainer').unbind('mouseenter').mouseenter(function (e) { 9115 e.stopPropagation(); 9116 var $megaMenuContainer = $(this).attr('id') == 'megaMenu' ? $('.megaMenuContainer:visible') : $(this); 9117 var pageID = $megaMenuContainer.attr('id').match(/\d+$/)[0]; 9118 $('#mainNav [data-pageid=' + pageID + '] a').addClass('mouseover'); 9119 9120 $megaMenuContainer.addClass('hover'); 9121 }); 9122 9123 $('.megaMenuContainer').unbind('mouseleave').mouseleave(function (e) { 9124 var $megaMenuContainer = $(this); 9125 var visible = $(this).is(':visible'); 9126 if (visible) { 9127 if ($megaMenuContainer.hasClass('optionOpen') && !$('.cpPopOver.common').is(':visible')) { 9128 $megaMenuContainer.removeClass('optionOpen'); 9129 } 9130 if (!$megaMenuContainer.hasClass('handleHover') && !$megaMenuContainer.hasClass('optionOpen') && !$megaMenuContainer.find('.pageContent.cpGrid').hasClass('dragging') && !$megaMenuContainer.find('.pageContent.cpGrid').hasClass('pinned')) { 9131 $megaMenuContainer.hide().removeClass('hover'); 9132 //$('#megaMenu').hide(); 9133 $('.megaMenu').hide(); 9134 9135 //While mousing out of mega menu, if it contains any flyout widgets, hide them. 9136 $('.flyOut.moved.forMegaMenu').hide(); 9137 9138 self.resetMouseOvers(); 9139 } 9140 } 9141 }); 9142 9143 $('.megaMenuContainer .handle.remove, .megaMenuContainer .handle.move, .megaMenuContainer .handle.inheritance').unbind('mouseenter').mouseenter(function (e) { 9144 e.stopPropagation(); 9145 $(this).parents('.megaMenuContainer').addClass('handleHover'); 9146 }); 9147 9148 $('.megaMenuContainer .handle.remove, .megaMenuContainer .handle.move, .megaMenuContainer .handle.inheritance').unbind('mouseleave').mouseleave(function (e) { 9149 $(this).parents('.megaMenuContainer').removeClass('handleHover'); 9150 }); 9151 9152 $('.megaMenuContainer .handle.pin').unbind('click').click(function (e) { 9153 $(this).toggleClass('pinned'); 9154 $(this).parent().toggleClass('pinned'); 9155 if (typeof PageEditLocalization != 'undefined') { 9156 $(this).attr('title', $(this).hasClass('pinned') ? pageEditLocalization.UnpinMegaMenu : pageEditLocalization.PinMegaMenu); 9157 } 9158 }); 9159 } 9160}; 9161 9162MenuManager.prototype.attachDragAndDropHandlers = function () { 9163 //Make mega menu items draggable 9164 var $currentDraggables = $('.megaMenuContainer').find('li.level1.ui-draggable, li.level2.ui-draggable'); 9165 if ($currentDraggables.length) { 9166 $currentDraggables.draggable('destroy'); 9167 } 9168 9169 $('.megaMenuContainer').find('li.level1, li.level2').draggable({ 9170 helper: function (event) { 9171 var html = '<ol class="semeanticList" style="white-space: nowrap">'; 9172 html += $('<div>').append($(this).clone()).html() + '</ol>'; 9173 return $(html); 9174 }, 9175 start: function (event, ui) { 9176 $('.megaMenuContainer .pageContent').addClass('megaMenudragging'); 9177 }, 9178 stop: function (event, ui) { 9179 $('.megaMenuContainer .pageContent').removeClass('megaMenudragging'); 9180 }, 9181 cursorAt: { top: 5, right: 5 }, 9182 cursor: 'move', 9183 handle: '.grippy' 9184 }); 9185 9186 //Attach drop target handlers 9187 var $currentDroppables = $('.megaMenuTarget.ui-droppable', '.megaMenuContainer.ui-droppable'); 9188 if ($currentDroppables.length) { 9189 $currentDroppables.droppable('destroy'); 9190 } 9191 $('.megaMenuTarget', '.megaMenuContainer').droppable({ 9192 over: function (event, ui) { 9193 $(this).parent().addClass('hover'); 9194 }, 9195 out: function (event, ui) { 9196 $(this).parent().removeClass('hover'); 9197 }, 9198 drop: function (event, ui) { 9199 var $target = $(this), 9200 targetPageID = $target.data('pageid'), 9201 targetPosition = $target.data('position'), 9202 parentID = $target.data('parentid'), 9203 pageID = $(ui.helper).children('li').data('pageid'); 9204 9205 $target.parent().removeClass('hover'); 9206 9207 var url = "/Pages/PageStatus/Move/" + pageID; 9208 url += "?parentID=" + parentID; 9209 url += "&refPageID={0}&position={1}".replace("{0}", targetPageID).replace("{1}", targetPosition); 9210 9211 $.ajax({
9212 url: url, 9213 type: 'POST', 9214 success: function (response) { 9215 if (response.ErrorMessage) { 9216 alert(response.ErrorMessage); 9217 ajaxPostBackEnd(); 9218 } else { 9219 location.href = response.RedirectURL; 9220 } 9221 }, 9222 beforeSend: function () { 9223 ajaxPostBackStart('Loading'); 9224 }, 9225 error: function (xhr, textStatus, exception) { 9226 alert("Error: " + xhr.statusText + "\nStatus: " + xhr.status); 9227 ajaxPostBackEnd(); 9228 } 9229 }); 9230 }, 9231 tolerance: 'pointer' 9232 }); 9233}; 9234 9235/***** End - Mega Menu methods ********/ 9236 9237/***** Start - Class/functions to handle custom links ********/ 9238function MenuCustomLinksManager(confirmCustomLinksDeletion, pageID, moduleID) { 9239 this.pageID = pageID; 9240 this.moduleID = moduleID; 9241 this.checkOrphanFeatureLinks = function () { 9242 if (confirmCustomLinksDeletion && confirmCustomLinksDeletion.length > 0) { 9243 return confirm(confirmCustomLinksDeletion); 9244 } 9245 return true; 9246 }; 9247 9248 this.updateSideMenu = function (actionUrl) { 9249 $.ajax({ 9250 url: actionUrl, 9251 type: 'post', 9252 cache: false, 9253 success: function (response) { 9254 if (response.ErrorMessage) { 9255 alert(response.ErrorMessage); 9256 ajaxPostBackEnd(); 9257 } else if (response.RedirectURL) 9258 window.location.href = response.RedirectURL; 9259 else { 9260 //update side menu UI. 9261 window.location.reload(true); 9262 } 9263 }, 9264 beforeSend: function () { 9265 ajaxPostBackStart('Loading'); 9266 }, 9267 error: function (xhr, textStatus, exception) { 9268 ajaxPostBackEnd(); 9269 alert("Error choosing default side menu: " + xhr.statusText + "\nStatus: " + xhr.status); 9270 } 9271 }); 9272 }; 9273} 9274 9275/// open modal to chose page to associate with current page/module as custom link 9276MenuCustomLinksManager.prototype.chosePage = function () { 9277 var self = this; // Reference to current object 9278 if (self.checkOrphanFeatureLinks()) { 9279 openCpModal({ 9280 title: 'Choose Page', 9281 className: 'notContent choosePageForLinks', 9282 isFrontEnd: false, 9283 url: '/Pages/CustomLinks/ChoosePage/?pageID=' + self.pageID + '&moduleID=' + self.moduleID 9284 }); 9285 } 9286}; 9287 9288/// Call back to execute after choosing a page on modal. 9289MenuCustomLinksManager.prototype.chosePageExecute = function (chosenPageID) { 9290 var self = this; // Reference to current object 9291 closeCpModal(); 9292 //Update side nav. 9293 self.updateSideMenu('/Pages/CustomLinks/ChangeSideMenu/?pageID=' + self.pageID + '&moduleID=' + self.moduleID + '&chosenPageID=' + chosenPageID); 9294}; 9295 9296/// Creates a new empty root feature link for specific page/module 9297MenuCustomLinksManager.prototype.createNewCustomLink = function () { 9298 var self = this; // Reference to current object 9299 if (self.checkOrphanFeatureLinks()) { 9300 self.updateSideMenu('/Pages/CustomLinks/CreateCustomFeatureLinks/?pageID=' + self.pageID + '&moduleID=' + self.moduleID); 9301 } 9302}; 9303 9304/// Make default side menu for current page/module (remove custom link previously assigned). 9305MenuCustomLinksManager.prototype.choseDefaultSideMenu = function () { 9306 var self = this; // Reference to current object 9307 if (self.checkOrphanFeatureLinks()) { 9308 self.updateSideMenu('/Pages/CustomLinks/ChoseDefaultSideMenu/?pageID=' + self.pageID + '&moduleID=' + self.moduleID); 9309 } 9310}; 9311 9312/***** End - Class/functions to handle feature links on Secondary menus ********/ 9313 9314/***** Start - Class/functions to handle Main Menu Options ********/ 9315function MainMenuOptions(pageID, mainMenuRootID) { 9316 var wasCheckBoxChanged = function ($checkbox) { 9317 if ($checkbox.is(":checked")) 9318 return $checkbox.data('original') != 'True'; 9319 else 9320 return $checkbox.data('original') == 'True'; 9321 }; 9322 9323 var closeMainMenuPopover = function ($handler, doNotResetCheckboxes) { 9324 $handler.data("cpPopover").hide(); 9325 if (doNotResetCheckboxes) 9326 return; 9327 9328 //reset checkbox selections 9329 $('div.menuOptions input[type=checkbox]').each(function () { 9330 if ($(this).data("original") == "True") 9331 $(this).prop("checked", true); 9332 else 9333 $(this).prop("checked", false); 9334 }); 9335 }; 9336 9337 var initializeMainMenuPopup = function ($handler) { 9338 $('#cancelMainNavOptions', "#modalMainNavOptions") 9339 .unbind('click.mainMenuOptions').bind("click.mainMenuOptions", function (e) { 9340 e.preventDefault(); 9341 closeMainMenuPopover($handler, false); 9342 }); 9343 9344 $('#saveMainNavOptions', "#modalMainNavOptions") 9345 .unbind('click.mainMenuOptions').bind("click.mainMenuOptions", function (e) { 9346 e.preventDefault(); 9347 9348 var useThisPageAsMainMenu = null; 9349 var displayMegaMenu = []; 9350 9351 $('div.menuOptions input.DisplayMegaMenu').each(function () { 9352 if (wasCheckBoxChanged($(this))) 9353 displayMegaMenu.push({ PageID: $(this).data('pageid'), DisplayMegaMenu: $(this).is(':checked') }); 9354 }); 9355 9356 if ($('#ysnUseThisPagesSubpages', 'div.menuOptions').length == 1 && wasCheckBoxChanged($('#ysnUseThisPagesSubpages'), 'div.menuOptions')) 9357 useThisPageAsMainMenu = $('#ysnUseThisPagesSubpages', 'div.menuOptions').is(':checked'); 9358 9359 var data = JSON.stringify({ pageID: pageID, versionID: $('#hdnVersionID').val(), useThisPageAsMainMenu: useThisPageAsMainMenu, displayMegaMenu: displayMegaMenu, structureID: $('#hdnStru
9359ctureID').val() }); 9360 9361 AJAX("/Pages/Menu/MainMenuOptionsSave", 'POST', data, function (response) { 9362 window.location.reload(true); 9363 }, true, 'application/json'); 9364 9365 closeMainMenuPopover($handler, true); 9366 }); 9367 }; 9368 9369 var $handlerMainMenu = $('#mainNavMenuHandleOptions'); 9370 if ($('#hdnIsLayoutPage').val() === "True" || $('#hdnVersionID').length === 0 || $('#hdnVersionID').val() == "0") { 9371 $handlerMainMenu.remove(); 9372 } else { 9373 $handlerMainMenu.cpPopover({ 9374 url: '/Pages/Menu/MainMenuOptions', 9375 type: 'POST', 9376 contentType: 'application/json', 9377 data: JSON.stringify({ pageID: pageID, mainMenuRootID: mainMenuRootID }), 9378 className: 'options adminWrap admin menuOptions', 9379 onInit: function () { 9380 initializeMainMenuPopup($handlerMainMenu); 9381 }, 9382 onClose: function (e) { 9383 e.preventDefault(); 9384 closeMainMenuPopover($handlerMainMenu, false); 9385 } 9386 }); 9387 } 9388} 9389 9390/***** End - Class/functions to handle Main Menu Options ********/ 9391 9392function showHideAccordionMenuForSecondaryNav($elem) { 9393 var secondaryMenu = 1; 9394 var hasAccordionSubmenu = $elem.next('a.openAccordionNav').length > 0; 9395 if (hasAccordionSubmenu) 9396 $elem = $elem.next('a.openAccordionNav'); 9397 var $container = $elem.parent().siblings('.accordionNavContainer'); 9398 var $secondaryNavHiddenElement = $('#secondaryNav').children('[class*="hiddenAnimations"]'); 9399 var animations = null; 9400 //Apply initial animation state before the sliding happens to open the accordion submenu 9401 if (!$elem.hasClass('accordionNavOpened')) { 9402 if (typeof (Animations) === 'function') { 9403 animations = new Animations(); 9404 animations.applyInitial($container, secondaryMenu); 9405 } 9406 } else {//reset the container by removing animation classes. 9407 if ($secondaryNavHiddenElement.length > 0 && $secondaryNavHiddenElement.data('animationClass') !== undefined) 9408 $container.removeClass($secondaryNavHiddenElement.data('animationclass')); 9409 $container.removeClass('animation-triggered'); 9410 } 9411 9412 $elem.toggleClass('accordionNavOpened'); 9413 $elem.attr('aria-expanded', $elem.attr('aria-expanded') === 'true' ? 'false' : 'true'); 9414 $container.css('overflow', 'hidden'); 9415 $container.slideToggle("333ms"); 9416 9417 if ($container.attr('aria-hidden') === 'true') { 9418 $container.attr('aria-hidden', 'false'); 9419 } else { 9420 $container.attr('aria-hidden', 'true'); 9421 } 9422 9423 setTimeout(function () { 9424 $container.css('overflow', ''); 9425 if ($elem.hasClass('accordionNavOpened')) { 9426 //If Animation manager toggled on, implement the menu animations 9427 if (animations != null) 9428 animations.applyAnimationClassToNavContainers($container, 1); 9429 } 9430 9431 }, 400); 9432 9433 if (typeof dynamicStretchContainers === 'function') { 9434 setTimeout(dynamicStretchContainers, 400); 9435 } 9436} 9437 9438$(document).ready(function () { 9439 //Mega menus handlers 9440 $('.megaMenuContainer') 9441 .hide() 9442 .removeClass('hidden') 9443 .find('.handle.inheritance').remove(); 9444 menuManager.initializeMegaMenus(); 9445}); 9446; 9447/*Strategy pattern 9448AccessibleMenu: Abstract class with default implementation for bindHandlers, initialize 9449MainAccessibleMenu: Concrete implementation of Accessible menu 9450SecondaryAccessibleMenu: Concrete implementation of Accessible menu 9451Note: AccordionAccessibleMenu has been moved to AccessibleAccordionMenu.js*/ 9452var stack = []; 9453var AccessibleMenu = function () { 9454 this.menuItem = ""; 9455}; 9456var accessibleMenuToggleEnabled = window.FeatureToggles.isActive("CMS.Pages.AccessibleMainMenuWithIndicators"); 9457 9458AccessibleMenu.prototype = { 9459 initialize: function (mainMenuItem, accordionMenu) { 9460 if (mainMenuItem) 9461 this.setStrategy(new MainAccessibleMenu()); 9462 else { 9463 this.setStrategy(new SecondaryAccessibleMenu()); 9464 } 9465 }, 9466 setStrategy: function (menuItem) { 9467 this.menuItem = menuItem; 9468 }, 9469 bindHandlers: function ($elem) { 9470 var self = this; 9471 9472 $elem.off('keydown.Menu').on('keydown.Menu', function (e) { 9473 if (e.which == 37) {//left 9474 self.left($elem); 9475 e.preventDefault(); 9476 } 9477 if (e.which == 38) {//up 9478 self.up($elem); 9479 e.preventDefault(); 9480 } 9481 if (e.which == 39) {//right 9482 self.right($elem); 9483 e.preventDefault(); 9484 } 9485 if (e.which == 40) {//down 9486 self.down($elem); 9487 e.preventDefault(); 9488 } 9489 if (e.which === 13 || e.which === 32) {//enter or space 9490 if (self.enter($elem)) { 9491 e.preventDefault(); 9492 } 9493 } 9494 if (e.which === 9) {//tab 9495 if (self.tab($elem)) { 9496 e.preventDefault(); 9497 } 9498 } 9499 }); 9500 }, 9501 left: function ($elem) { 9502 this.menuItem.left($elem); 9503 }, 9504 up: function ($elem) { 9505 this.menuItem.up($elem); 9506 }, 9507 right: function ($elem) { 9508 this.menuItem.right($elem); 9509 }, 9510 down: function ($elem) { 9511 this.menuItem.down($elem); 9512 }, 9513 enter: function ($elem) { 9514 return this.menuItem.enter($elem); 9515 }, 9516 tab: function ($elem) { 9517 return this.menuItem.tab($elem); 9518 } 9519}; 9520 9521//MainAccessibleMenu concrete class 9522var MainAccessibleMenu = function () { 9523 9524 // Get parent menu item from submenu 9525 var getParentMenuItem = function ($elem) { 9526 var parentOlId = $elem.parents('ol').attr('id'); 9527 var parentMenuItemId = parentOlId.slice('Parent'.length); 9528 return $('#' + parentMenuItemId).find('a:first'); 9529 }; 9530 9531 // Get first anchor in child submenu 9532 var getFirstChildSubmenuAnchor = function ($elem) { 9533 var $parentLi = $elem.parent('li'); 9534 var $parentId = "Parent" + $parentLi.attr('id'); 9535 return $('ol[id=' + $parentId + '] a:first'); 9536 }; 9537 9538 this.left = function ($elem) { 9539 if (menuManager.isTopLevelMenuItem($elem)) { 9540 menuManager.handleLeftKeyOnAnyTopLevelItem($elem); 9541 return; 9542 } 9543 9544 // Submenu item handling 9545 if (!accessibleMenuToggleEnabled) { 9546 getParentMenuItem($elem).focus(); 9547 return; 9548 } 9549 9550 var shouldOpenSubmenu = menuManager.shouldOpenSubmenuOnNavigation($elem); 9551 menuManager.handleLeftKeyInSubmenu($elem, shouldOpenSubmenu); 9552 }; 9553 9554 this.up = function ($elem) { 9555 if (menuManager.isTopLevelMenuItem($elem)) { 9556 if (menuManager.isMegaMenuItem($elem)) { 9557 return; 9558 } 9559 menuManager.handleUpKeyOnTopLevelItem($elem); 9560 return; 9561 } 9562 9563 // Submenu item handling - use MenuManager handler 9564 menuManager.handleUpKeyInSubmenu($elem, { 9565 onFirstItem: function ($elem) { 9566 getParentMenuItem($elem).focus(); 9567 } 9568 }); 9569 }; 9570 9571 this.right = function ($elem) { 9572 if (menuManager.isTopLevelMenuItem($elem)) { 9573 menuManager.handleRightKeyOnAnyTopLevelItem($elem); 9574 return; 9575 } 9576 9577 // Submenu item handling 9578 if (!accessibleMenuToggleEnabled) { 9579 getFirstChildSubmenuAnchor($elem).focus(); 9580 return; 9581 } 9582 9583 var shouldOpenSubmenu = menuManager.shouldOpenSubmenuOnNavigation($elem); 9584 menuManager.handleRightKeyInSubmenu($elem, shouldOpenSubmenu); 9585 }; 9586 9587 this.down = function ($elem) { 9588 if (menuManager.isTopLevelMenuItem($elem)) { 9589 if (menuManager.isMegaMenuItem($elem)) { 9590 return; 9591 } 9592 9593 if (!menuManager.handleDownKeyOnTopLevelItem($elem)) { 9594 getFirstChildSubmenuAnchor($elem).focus(); 9595 } 9596 return; 9597 } 9598 9599 // Submenu item handling - use MenuManager handler 9600 menuManager.handleDownKeyInSubmenu($elem); 9601 }; 9602 9603 this.enter = function ($elem) {
9604 if (!menuManager.isSubMenuTrigger($elem)) { 9605 $elem[0].click(); 9606 return true; 9607 } 9608 9609 if (accessibleMenuToggleEnabled) { 9610 menuManager.toggleSubMenu($elem); 9611 menuManager.toggleIndicator($elem); 9612 setTimeout(function () { 9613 menuManager.setFocusToFirstSubmenuitem($elem); 9614 }, 300); 9615 return true; 9616 } else if ($elem.hasClass("mainNavItem")) { 9617 menuManager.toggleSubMenu($elem); 9618 return true; 9619 } 9620 9621 return false; 9622 }; 9623 9624 this.tab = function ($elem) { 9625 menuManager.setFocusToLastTopLevelItem(); 9626 9627 // Return false to allow default tab behavior (focus moves to next focusable element outside menu) 9628 return false; 9629 }; 9630}; 9631 9632//SecondaryAccessibleMenu concrete class 9633var SecondaryAccessibleMenu = function () { 9634 this.left = function ($elem) { 9635 var parentOlId = $elem.parents('ol').attr('id'); 9636 var parentMenuItemId = parentOlId.slice('Parent'.length); 9637 $('#' + parentMenuItemId).find('a:first').focus(); 9638 }; 9639 9640 this.up = function ($elem) { 9641 var $prev = $elem.parent('li').prev('li').find('a:first'); 9642 if ($prev != null) 9643 $prev.focus(); 9644 }; 9645 9646 this.right = function ($elem) { 9647 var $parentLi = $elem.parent('li'); 9648 var $parentId = "Parent" + $parentLi.attr('id'); 9649 var $firstAnchorOfSubmenu = $('ol[id=' + $parentId + '] a:first'); 9650 $firstAnchorOfSubmenu.focus(); 9651 }; 9652 9653 this.down = function ($elem) { 9654 var $next = $elem.parent('li').next('li').find('a:first'); 9655 if ($next != null) 9656 $next.focus(); 9657 }; 9658 9659 this.enter = function ($elem) { 9660 return false; 9661 }; 9662 9663 this.tab = function ($elem) { 9664 return false; 9665 }; 9666}; 9667 9668//Self invoked function 9669(function () { 9670 var isClick = false; 9671 $("a.navMainItem, a.navMenuItem").on("mousedown", function () { 9672 //Set isClick true if clicked on secondary nav menu item. 9673 isClick = true; 9674 }); 9675 9676 function menuHandler(e) { 9677 var $this = $(this); 9678 9679 var focusSource = $this.data('focus-source'); 9680 if (focusSource) { 9681 $this.removeData('focus-source'); 9682 if (accessibleMenuToggleEnabled) { 9683 menuManager.hideSubMenu($this.parent('li')); 9684 } 9685 } 9686 9687 var isAccordionToggle = $this.hasClass('openAccordionNav'); 9688 var isAccordionNavItem = $this.parent('div').hasClass('accordionNavItem'); 9689 var isInAccordionNav = $this.closest('.accordionNav').length > 0; 9690 9691 if (isAccordionToggle || isAccordionNavItem || isInAccordionNav) { 9692 return; 9693 } 9694 9695 var accessibleMenu = new AccessibleMenu(); 9696 var mainMenuItem = $this.parents('nav').hasClass('mainNav') | $this.parents('ol').hasClass('mainSubMenu'); 9697 9698 accessibleMenu.initialize(mainMenuItem, false); 9699 9700 if (!mainMenuItem) { 9701 if (!accessibleMenuToggleEnabled) 9702 menuManager.menuMouseOver($this.parent('li')); 9703 } else { 9704 if (accessibleMenuToggleEnabled) 9705 menuManager.setActiveTopLevelItem($this); 9706 if (!accessibleMenuToggleEnabled || !mainMenuItem) 9707 menuManager.menuMouseOver($this.parent('li')); 9708 9709 window.lastMegaMenuOpen = $this.parent('li'); 9710 } 9711 accessibleMenu.bindHandlers($this); 9712 } 9713 9714 $(document).on("focusin", "a.navMainItem, a.navMenuItem", menuHandler); 9715 9716 //hide last main menu item on tabbing through the menu item. 9717 $(".siteWrap").on("focusin", function (e) { 9718 menuManager.hideAllSubMenus(MAIN_MENU); 9719 }); 9720}()); 9721; 9722/*Strategy pattern 9723AccessibleMegaMenu: Abstract class with default implementation for bindHandlers, initialize 9724FormattedMegaMenu: Concrete implementation of Accessible mega menu*/ 9725var AccessibleMegaMenu = function () { 9726 this.megaMenuItem = ""; 9727 this.depth = 1; 9728 this.cols = 1; 9729}; 9730 9731AccessibleMegaMenu.prototype = { 9732 initialize: function (format) { 9733 this.setStrategy(new FormatedMegaMenu()); 9734 }, 9735 setStrategy: function (megaMenuItem) { 9736 this.megaMenuItem = megaMenuItem; 9737 }, 9738 bindHandlers: function ($elem) { 9739 var self = this; 9740 var LEFT = 37; 9741 var UP = 38; 9742 var RIGHT = 39; 9743 var DOWN = 40; 9744 var SPACE = 32; 9745 var TAB = 9; 9746 $elem.off('keydown.MegaMenu').on('keydown.MegaMenu', function (e) { 9747 if (e.which == LEFT) { 9748 self.left($elem); 9749 e.preventDefault(); 9750 } 9751 if (e.which == UP) { 9752 self.up($elem); 9753 e.preventDefault(); 9754 } 9755 if (e.which == RIGHT) { 9756 self.right($elem); 9757 e.preventDefault(); 9758 } 9759 if (e.which == DOWN) { 9760 self.down($elem); 9761 e.preventDefault(); 9762 } 9763 if (e.which == SPACE) { 9764 self.space($elem) 9765 e.preventDefault(); 9766 } 9767 if (e.which == TAB) { 9768 if (self.tab($elem)) { 9769 e.preventDefault(); 9770 } 9771 } 9772 }); 9773 }, 9774 exitMegaMenu: function ($elem) { 9775 this.megaMenuItem.exitMegaMenu($elem); 9776 }, 9777 left: function ($elem) { 9778 this.megaMenuItem.left($elem); 9779 }, 9780 up: function ($elem) { 9781 this.megaMenuItem.up($elem); 9782 }, 9783 right: function ($elem) { 9784 this.megaMenuItem.right($elem); 9785 }, 9786 down: function ($elem) { 9787 this.megaMenuItem.down($elem); 9788 }, 9789 space: function ($elem) { 9790 return this.megaMenuItem.space($elem); 9791 }, 9792 tab: function ($elem) { 9793 return this.megaMenuItem.tab($elem); 9794 } 9795}; 9796 9797//Format 1,2,3,4 concrete implementation 9798var FormatedMegaMenu = function () { 9799 // Navigate to root mega menu item 9800 var focusRootMegaMenuItem = function ($elem) { 9801 var closestMenu = $elem.closest('.mainNavMegaMenu'); 9802 if (closestMenu.length > 0) { 9803 var rootItem = closestMenu.attr('id'); 9804 if (rootItem && rootItem.startsWith('mainNavMegaMenu')) { 9805 rootItem = rootItem.slice('mainNavMegaMenu'.length); 9806 if (!isNaN(parseInt(rootItem))) { 9807 var $rootAnchor = $('#MainItem' + rootItem + ' a'); 9808 if ($rootAnchor.length > 0) { 9809 $rootAnchor.focus(); 9810 return true; 9811 } 9812 } 9813 } 9814 } 9815 return false; 9816 }; 9817 9818 // Check if element is in mega menu header 9819 var isMegaMenuHeader = function ($elem) { 9820 return $elem.closest("header").length > 0; 9821 }; 9822 9823 var getWidgetRoot = function ($elem) { 9824 return accessibleMenuToggleEnabled ? $elem.closest('.widgetPages') : $elem.closest('section'); 9825 }; 9826 9827 // Focus element if it exists 9828 var focusIfExists = function ($target) { 9829 if ($target && $target.length > 0) {
9830 $target.focus(); 9831 return true; 9832 } 9833 return false; 9834 }; 9835 9836 // Find previous widget item for up navigation 9837 var findPreviousWidgetItem = function ($elem) { 9838 var $prevLi = $elem.closest('li').prev('li'); 9839 if (!$prevLi.hasClass('widgetItem')) { 9840 return $prevLi.find('a:first'); 9841 } 9842 9843 // If previous has children, go to last child, otherwise go to previous item 9844 if ($prevLi.children('ol').length > 0) { 9845 return $prevLi.children('ol').children('li:last').find('a:first'); 9846 } 9847 return $prevLi.find('a:first'); 9848 }; 9849 9850 // Find next widget item for down navigation 9851 var findNextWidgetItem = function ($elem, isWidgetItemElement) { 9852 if (isWidgetItemElement) { 9853 // If has children, go to first child, otherwise go to next sibling 9854 var $children = $elem.closest('li').children('ol'); 9855 if ($children.length > 0) { 9856 return $children.children('li:first').children('a'); 9857 } 9858 return $elem.closest('li').next('li').find('a:first'); 9859 } 9860 9861 // Try next sibling first 9862 var $target = $elem.closest('li').next('li').find('a:first'); 9863 // If no sibling, try next widget item 9864 if ($target.length === 0) { 9865 $target = $elem.parents('li.widgetItem').next('li').find('a:first'); 9866 } 9867 return $target; 9868 }; 9869 9870 // Check if element is at a specific position in the mega menu 9871 var isItemAtPosition = function ($elem, position) { 9872 var $megaMenuContainer = $elem.closest('.mainNavMegaMenu'); 9873 if ($megaMenuContainer.length === 0) 9874 return false; 9875 9876 // Find the link at the specified position (first or last) 9877 var $targetLink = $megaMenuContainer.find('a[role="menuitem"]')[position](); 9878 return $targetLink.length > 0 && $targetLink[0] === $elem[0]; 9879 }; 9880 9881 var isFirstItemInFirstColumn = function ($elem) { 9882 return isItemAtPosition($elem, 'first'); 9883 }; 9884 9885 var isLastItemInLastColumn = function ($elem) { 9886 return isItemAtPosition($elem, 'last'); 9887 }; 9888 9889 // Navigate to adjacent top-level menu item (mega menu or normal menu) 9890 var navigateToAdjacentMegaMenu = function ($elem, direction) { 9891 var topLevelParentId = menuManager.findTopLevelParentId($elem); 9892 if (!topLevelParentId) return false; 9893 9894 var $currentTopLevelItem = $('#' + topLevelParentId); 9895 if ($currentTopLevelItem.length === 0) return false; 9896 9897 var menuDirection = direction === 'left' ? 'prev' : 'next'; 9898 var $targetTopLevelItem = menuManager.getAdjacentTopLevelItem($currentTopLevelItem, menuDirection); 9899 if ($targetTopLevelItem.length === 0) return false; 9900 9901 var $targetAnchor = $targetTopLevelItem.find('a:first'); 9902 if ($targetAnchor.length === 0) return false; 9903 9904 // Close current mega menu 9905 var $currentMegaMenu = $elem.closest('.mainNavMegaMenu'); 9906 if ($currentMegaMenu.length > 0) { 9907 $currentMegaMenu.removeClass('hover'); 9908 menuManager.menuMouseOut($currentTopLevelItem); 9909 } 9910 9911 var isMegaMenu = $targetTopLevelItem.attr('data-displaymegamenu') === 'True'; 9912 menuManager.menuMouseOver($targetTopLevelItem); 9913 9914 setTimeout(function () { 9915 if (isMegaMenu || menuManager.isSubMenuTrigger($targetAnchor)) { 9916 menuManager.setFocusToFirstSubmenuitem($targetAnchor); 9917 } 9918 }, 300); 9919 9920 return true; 9921 }; 9922 9923 this.left = function ($elem) { 9924 if (menuManager.isTopLevelMenuItem($elem)) { 9925 menuManager.handleLeftKeyOnAnyTopLevelItem($elem); 9926 return; 9927 } 9928 9929 // Check if we're at the first item in the first column 9930 if (accessibleMenuToggleEnabled && isFirstItemInFirstColumn($elem)) { 9931 navigateToAdjacentMegaMenu($elem, 'left'); 9932 return; 9933 } 9934 9935 // Navigate within mega menu columns 9936 var $prev = $elem.closest('div.col').prev().find('li.widgetItem:first').find('a:first'); 9937 if ($prev.length > 0) { 9938 $prev.focus(); 9939 } else { 9940 focusRootMegaMenuItem($elem); 9941 } 9942 }; 9943 9944 this.up = function ($elem) { 9945 if (menuManager.isTopLevelMenuItem($elem)) { 9946 if (!menuManager.handleUpKeyOnTopLevelItem($elem)) { 9947 var id = $elem.closest('li').attr('id'); 9948 $('#mainNavMegaMenu' + id).removeClass('hover'); 9949 menuManager.menuMouseOut($elem.closest('li')); 9950 } 9951 return; 9952 } 9953 9954 // Check if this is the first item in a widget list 9955 var isWidgetItemElement = $elem.closest('li').hasClass('widgetItem'); 9956 var isFirstInWidgetList = isWidgetItemElement && 9957 $elem[0] == $elem.closest('li').parent('ol').children('li:first').find('a:first')[0]; 9958 9959 if (isFirstInWidgetList) { 9960 if (accessibleMenuToggleEnabled) { 9961 focusRootMegaMenuItem($elem); 9962 } else { 9963 var $headerLink = getWidgetRoot($elem).find("header a"); 9964 focusIfExists($headerLink); 9965 } 9966 return; 9967 } 9968 9969 // Check if first item in parent list 9970 var $parentOl = $elem.closest('li').parent('ol'); 9971 if ($parentOl.length > 0 && $parentOl.children('li:first').children('a')[0] == $elem[0]) { 9972 var $parentLink = $parentOl.parent('li').find('a:first'); 9973 focusIfExists($parentLink); 9974 return; 9975 } 9976 9977 // Navigate to previous widget item 9978 var $target = findPreviousWidgetItem($elem); 9979 focusIfExists($target); 9980 }; 9981 9982 this.right = function ($elem) { 9983 if (menuManager.isTopLevelMenuItem($elem)) { 9984 menuManager.handleRightKeyOnAnyTopLevelItem($elem); 9985 return; 9986 } 9987 9988 // Check if we're at the last item in the last column 9989 if (accessibleMenuToggleEnabled && isLastItemInLastColumn($elem)) { 9990 navigateToAdjacentMegaMenu($elem, 'right'); 9991 return; 9992 } 9993 9994 // In mega menu content - navigate to next column 9995 var $next = $elem.closest('div.col').next().find('li.widgetItem:first').find('a:first'); 9996 if ($next.length > 0) { 9997 $next.focus(); 9998 } 9999 }; 10000 10001 this.down = function ($elem) { 10002 // Handle top-level menu items 10003 if ($elem.hasClass('navMainItem')) { 10004 if (!menuManager.handleDownKeyOnTopLevelItem($elem)) { 10005 // Legacy behavior - find first link in mega menu 10006 var $parentLi = $elem.parent('li'); 10007 var $parentId = "mainNavMegaMenu" + $parentLi.attr('data-pageid'); 10008 var $firstLink = accessibleMenuToggleEnabled 10009 ? $('aside[id=' + $parentId + '] a[role="menuitem"]').first() 10010 : $('aside[id=' + $parentId + '] header a[role="menuitem"]').first(); 10011 focusIfExists($firstLink); 10012 } 10013 return; 10014 } 10015 10016 // Navigate down in mega menu content 10017 var isWidgetItemElement = $elem.closest('li').hasClass('widgetItem'); 10018 var $target = findNextWidgetItem($elem, isWidgetItemElement); 10019 focusIfExists($target); 10020 }; 10021 10022 this.exitMegaMenu = function ($elem) { 10023 var asideContainerId = $elem.parents('.megaMenuContainer.megaMenu').attr('id').slice('mainNavMegaMenu'.length); 10024 var $li = $('#MainItem' + asideContainerId); 10025 $elem.parents('.megaMenuContainer.megaMenu').removeClass('hover'); 10026 menuManager.menuMouseOut($li); 10027 $elem.focus(); 10028 }; 10029 this.space = function ($elem) {
10030 if (accessibleMenuToggleEnabled && !menuManager.isSubMenuTrigger($elem)) { 10031 $elem[0].click(); 10032 return true; 10033 } 10034 }; 10035 this.tab = function ($elem) { 10036 menuManager.setFocusToLastTopLevelItem(); 10037 10038 // Return false to allow default tab behavior (focus moves to next focusable element outside menu) 10039 return false; 10040 }; 10041}; 10042 10043//Self invloked function 10044(function () { 10045 $(document).on('focusin', '.megaMenuContainer div.widgetTitle, .megaMenuContainer header a, #mainNav a.navMainItem , li.megaMenuItem a[role]', function (e) { 10046 var $this = $(this); 10047 var execute = true; 10048 var topMenuItem = $this.hasClass('navMainItem'); 10049 if (topMenuItem) { 10050 var $parent = $this.parent('li'); 10051 if ($parent != null) { 10052 //Logic for flyout menu is in AccessibleMenu.js, so do not execute the logic below for the same 10053 if ($parent.data('displaymegamenu') == 'False') 10054 execute = false; 10055 } 10056 } 10057 if (execute) { 10058 var depth = $this.parents('.widgetPages').find('.depth').html(); 10059 var cols = $this.parents('.widgetPages').find('.cols').html(); 10060 var accessibleMegaMenu = new AccessibleMegaMenu(); 10061 var mainMenuItem = true; 10062 //If top menu item(and has megamenu which is already checked above), replicate the logic for "mouse near" to load the mega menus 10063 if (topMenuItem) { 10064 var megaMenuContentContainers = $('[data-displaymegamenu="True"]') 10065 .map(function () { 10066 $('#mainNavMegaMenu' + $(this).data('pageid') + ' div.pageContent').html('Loading...'); 10067 return $('#mainNavMegaMenu' + $(this).data('pageid') + ' div.pageContent').data('containerid'); 10068 }).toArray(); 10069 reloadSharedContentContainers(megaMenuContentContainers); 10070 } 10071 accessibleMegaMenu.initialize(depth, cols); 10072 accessibleMegaMenu.bindHandlers($this); 10073 } 10074 }); 10075}()); 10076; 10077/*Strategy pattern 10078AccessibleAccordionMenu: Self-contained module for handling accordion menu keyboard navigation 10079Moved from AccessibleMenu.js for better maintainability 10080*/ 10081 10082var AccessibleAccordionMenu = function () { 10083 this.accordionMenuItem = ""; 10084}; 10085 10086//Static field for accordion menu navigation stack 10087AccessibleAccordionMenu.accordionMenuStack = []; 10088 10089AccessibleAccordionMenu.prototype = { 10090 initialize: function () { 10091 this.setStrategy(new AccordionMenu()); 10092 }, 10093 setStrategy: function (accordionMenuItem) { 10094 this.accordionMenuItem = accordionMenuItem; 10095 }, 10096 bindHandlers: function ($elem) { 10097 var self = this; 10098 var LEFT = 37; 10099 var UP = 38; 10100 var RIGHT = 39; 10101 var DOWN = 40; 10102 var ENTER = 13; 10103 var SPACE = 32; 10104 var TAB = 9; 10105 10106 $elem.off('keydown.AccordionMenu').on('keydown.AccordionMenu', function (e) { 10107 if (e.which === LEFT) { 10108 self.left($elem); 10109 e.preventDefault(); 10110 } 10111 if (e.which === UP) { 10112 self.up($elem); 10113 e.preventDefault(); 10114 } 10115 if (e.which === RIGHT) { 10116 self.right($elem); 10117 e.preventDefault(); 10118 } 10119 if (e.which === DOWN) { 10120 self.down($elem); 10121 e.preventDefault(); 10122 } 10123 if (e.which === ENTER || e.which === SPACE) { 10124 if (self.enter($elem)) { 10125 e.preventDefault(); 10126 } 10127 } 10128 if (e.which === TAB) { 10129 if (self.tab($elem)) { 10130 e.preventDefault(); 10131 } 10132 } 10133 }); 10134 }, 10135 left: function ($elem) { 10136 this.accordionMenuItem.left($elem); 10137 }, 10138 up: function ($elem) { 10139 this.accordionMenuItem.up($elem); 10140 }, 10141 right: function ($elem) { 10142 this.accordionMenuItem.right($elem); 10143 }, 10144 down: function ($elem) { 10145 this.accordionMenuItem.down($elem); 10146 }, 10147 enter: function ($elem) { 10148 return this.accordionMenuItem.enter($elem); 10149 }, 10150 tab: function ($elem) { 10151 return this.accordionMenuItem.tab($elem); 10152 } 10153}; 10154 10155//AccordionMenu concrete implementation 10156var AccordionMenu = function () { 10157 10158 var getAdjacentAccordionTopLevelItem = function ($currentLi, direction) { 10159 var $targetLi = direction === 'prev' ? $currentLi.prev('.topMenuItem') : $currentLi.next('.topMenuItem'); 10160 10161 // If no adjacent sibling found, wrap around 10162 if ($targetLi.length === 0) { 10163 var $siblings = $currentLi.parent().children('.topMenuItem'); 10164 $targetLi = direction === 'prev' ? $siblings.last() : $siblings.first(); 10165 } 10166 10167 return $targetLi; 10168 }; 10169 10170 var isMainLevelAccordionItem = function ($elem) { 10171 return $elem.hasClass('navMainItem') && $elem.hasClass('secondaryNavItem'); 10172 }; 10173 10174 var isTopLevelToggle = function ($elem) { 10175 return $elem.hasClass('accordionSecondaryNavItem'); 10176 }; 10177 10178 var isNestedToggle = function ($elem) { 10179 return $elem.hasClass('accordionNavMenuItem'); 10180 }; 10181 10182 var isSubmenuLink = function ($elem) { 10183 return $elem.hasClass('navMenuItem'); 10184 }; 10185 10186 var focusElement = function ($elem) { 10187 if ($elem && $elem.length > 0) { 10188 $elem.focus(); 10189 return true; 10190 } 10191 return false;
10192 }; 10193 10194 var hasOpenedSubmenuInCurrentContext = function ($elem) { 10195 // Check if the currently focused main-level item has an opened submenu directly under it 10196 if (!isMainLevelAccordionItem($elem)) { 10197 return false; 10198 } 10199 10200 var $parentTopMenuItem = $elem.closest('.topMenuItem'); 10201 if ($parentTopMenuItem.length > 0) { 10202 var $openedSubmenu = $parentTopMenuItem.children('.accordionNavContainer:visible'); 10203 return $openedSubmenu.length > 0; 10204 } 10205 return false; 10206 }; 10207 10208 var getParentToggleButton = function ($parentSubmenu) { 10209 var $parentNavItemDiv = $parentSubmenu.siblings('.accordionNavItem'); 10210 return $parentNavItemDiv.find('a.openAccordionNav'); 10211 }; 10212 10213 var navigateToAdjacentSibling = function ($currentMenuItem, direction, shouldPushToStack, $currentElem) { 10214 var $siblingLi = direction === 'next' 10215 ? $currentMenuItem.next('li[role=menuitem]') 10216 : $currentMenuItem.prev('li[role=menuitem]'); 10217 10218 if ($siblingLi.length > 0) { 10219 if (shouldPushToStack && $currentElem) { 10220 AccessibleAccordionMenu.accordionMenuStack.push($currentElem); 10221 } 10222 focusElement($siblingLi.find('a:first')); 10223 return true; 10224 } 10225 return false; 10226 }; 10227 10228 // Helper: Navigate to parent level when no sibling exists 10229 var navigateToParentLevel = function ($currentMenuItem, direction, shouldPushToStack, $currentElem) { 10230 var $parentSubmenu = $currentMenuItem.parent('.accordionNavContainer'); 10231 if ($parentSubmenu.length === 0) { 10232 return false; 10233 } 10234 10235 var $grandParentMenuItem = $parentSubmenu.parent('[role=menuitem]'); 10236 if ($grandParentMenuItem.length === 0) { 10237 return false; 10238 } 10239 10240 if (direction === 'next') { 10241 // Moving down - go to parent's next sibling 10242 var $parentNextSibling = $grandParentMenuItem.next('li[role=menuitem]'); 10243 if ($parentNextSibling.length > 0) { 10244 if (shouldPushToStack && $currentElem) { 10245 AccessibleAccordionMenu.accordionMenuStack.push($currentElem); 10246 } 10247 focusElement($parentNextSibling.find('a:first')); 10248 return true; 10249 } 10250 10251 // No parent sibling - move to top-level's next item 10252 var $topMenuItem = $grandParentMenuItem.closest('.topMenuItem'); 10253 if ($topMenuItem.length > 0) { 10254 var $nextTopMenuItem = getAdjacentAccordionTopLevelItem($topMenuItem, 'next'); 10255 if (shouldPushToStack && $currentElem) { 10256 AccessibleAccordionMenu.accordionMenuStack.push($currentElem); 10257 } 10258 focusElement($nextTopMenuItem.find('a.navMainItem:first')); 10259 return true; 10260 } 10261 } else { 10262 // Moving up - go to parent's toggle button 10263 var $parentToggleButton = getParentToggleButton($parentSubmenu); 10264 if ($parentToggleButton.length > 0 && $parentToggleButton.hasClass('accordionNavOpened')) { 10265 focusElement($parentToggleButton); 10266 return true; 10267 } 10268 } 10269 10270 return false; 10271 }; 10272 10273 var closeSiblingSubmenus = function ($currentMenuItem) { 10274 var $siblings = $currentMenuItem.siblings('li[role=menuitem]'); 10275 10276 $siblings.each(function() { 10277 var $siblingToggle = $(this).find('> .accordionNavItem > a.openAccordionNav'); 10278 if ($siblingToggle.length > 0 && $siblingToggle.hasClass('accordionNavOpened')) { 10279 $siblingToggle[0].click(); 10280 } 10281 }); 10282 }; 10283 10284 // Top-level toggle (accordionSecondaryNavItem) arrow handling 10285 var handleTopLevelToggleUp = function ($elem) { 10286 var $currentTopMenuItem = $elem.closest('.topMenuItem'); 10287 10288 // If submenu is open, close it first 10289 if ($elem.hasClass('accordionNavOpened')) { 10290 $elem[0].click(); 10291 } 10292 10293 var $prevTopMenuItem = getAdjacentAccordionTopLevelItem($currentTopMenuItem, 'prev'); 10294 focusElement($prevTopMenuItem.find('a.navMainItem:first')); 10295 }; 10296 10297 var handleTopLevelToggleDown = function ($elem) { 10298 var $parentMenuItem = $elem.closest('[role=menuitem]'); 10299
10300 // If submenu is open, move INTO the submenu (don't close) 10301 if ($elem.hasClass('accordionNavOpened')) { 10302 var $submenu = $parentMenuItem.children('.accordionNavContainer'); 10303 if ($submenu.length > 0 && $submenu.is(':visible')) { 10304 var $firstSubmenuItem = $submenu.children('[role=menuitem]:first').find('a:first'); 10305 if ($firstSubmenuItem.length > 0) { 10306 AccessibleAccordionMenu.accordionMenuStack.push($elem); 10307 focusElement($firstSubmenuItem); 10308 return; 10309 } 10310 } 10311 } 10312 10313 // Submenu not open or no children: go to next top-level 10314 var $nextTopMenuItem = getAdjacentAccordionTopLevelItem($parentMenuItem, 'next'); 10315 focusElement($nextTopMenuItem.find('a.navMainItem:first')); 10316 }; 10317 10318 // Nested toggle (accordionNavMenuItem) arrow handling 10319 var handleNestedToggleUp = function ($elem) { 10320 var $parentMenuItem = $elem.closest('[role=menuitem]'); 10321 10322 // If submenu is open, close it first 10323 if ($elem.hasClass('accordionNavOpened')) { 10324 $elem[0].click(); 10325 } 10326 10327 // Try previous sibling first; if none, go to parent level 10328 if (navigateToAdjacentSibling($parentMenuItem, 'prev', false, null)) { 10329 return; 10330 } 10331 navigateToParentLevel($parentMenuItem, 'prev', false, null); 10332 }; 10333 10334 var handleNestedToggleDown = function ($elem) { 10335 var $parentMenuItem = $elem.closest('[role=menuitem]'); 10336 10337 // If submenu is open, move INTO the submenu (don't close) 10338 if ($elem.hasClass('accordionNavOpened')) { 10339 var $submenu = $parentMenuItem.children('.accordionNavContainer'); 10340 if ($submenu.length > 0 && $submenu.is(':visible')) { 10341 var $firstSubmenuItem = $submenu.children('[role=menuitem]:first').find('a:first'); 10342 if ($firstSubmenuItem.length > 0) { 10343 AccessibleAccordionMenu.accordionMenuStack.push($elem); 10344 focusElement($firstSubmenuItem); 10345 return; 10346 } 10347 } 10348 } 10349 10350 // Submenu not open - try next sibling; else parent level 10351 if (navigateToAdjacentSibling($parentMenuItem, 'next', false, null)) { 10352 return; 10353 } 10354 navigateToParentLevel($parentMenuItem, 'next', false, null); 10355 }; 10356 10357 // Submenu link (navMenuItem) arrow handling 10358 var handleSubmenuItemUp = function ($elem) { 10359 var $currentMenuItem = $elem.closest('[role=menuitem]'); 10360 var $parentSubmenu = $currentMenuItem.parent('.accordionNavContainer'); 10361 10362 if ($parentSubmenu.length === 0) return; 10363 10364 // If this is first item, go to its toggle 10365 var $firstItem = $parentSubmenu.children('[role=menuitem]:first'); 10366 if ($firstItem.length > 0 && $currentMenuItem[0] === $firstItem[0]) { 10367 var $parentToggleButton = getParentToggleButton($parentSubmenu); 10368 if ($parentToggleButton.length > 0 && $parentToggleButton.hasClass('accordionNavOpened')) { 10369 focusElement($parentToggleButton); 10370 return; 10371 } 10372 } 10373 10374 // Otherwise go to previous sibling 10375 navigateToAdjacentSibling($currentMenuItem, 'prev', false, null); 10376 }; 10377 10378 var handleSubmenuItemDown = function ($elem) { 10379 var $currentMenuItem = $elem.closest('[role=menuitem]'); 10380 10381 // Try next sibling first 10382 if (navigateToAdjacentSibling($currentMenuItem, 'next', true, $elem)) { 10383 return; 10384 } 10385 10386 // No sibling - go to parent level 10387 navigateToParentLevel($currentMenuItem, 'next', true, $elem); 10388 }; 10389 10390 this.left = function ($elem) { 10391 //do nothing 10392 }; 10393 10394 this.up = function ($elem) { 10395 // Top-level toggle 10396 if (isTopLevelToggle($elem)) { 10397 handleTopLevelToggleUp($elem); 10398 return; 10399 } 10400 10401 // Nested toggle 10402 if (isNestedToggle($elem)) { 10403 handleNestedToggleUp($elem); 10404 return; 10405 } 10406 10407 // Submenu link 10408 if (isSubmenuLink($elem)) { 10409 handleSubmenuItemUp($elem); 10410 return; 10411 } 10412 10413 // Main-level text links (navMainItem) 10414 if (isMainLevelAccordionItem($elem)) { 10415 if (AccessibleAccordionMenu.accordionMenuStack.length > 0) { 10416 var $popped = AccessibleAccordionMenu.accordionMenuStack.pop(); 10417 if ($popped) { 10418 $popped.focus(); 10419 } 10420 return; 10421 } 10422 var $currentTopMenuItem = $elem.parents('.topMenuItem:first'); 10423 var $prevTopMenuItem = getAdjacentAccordionTopLevelItem($currentTopMenuItem, 'prev'); 10424 focusElement($prevTopMenuItem.find('a.navMainItem:first')); 10425 return; 10426 } 10427 10428 // Fallback to stack for any other element 10429 var $poppedFallback = AccessibleAccordionMenu.accordionMenuStack.pop(); 10430 if ($poppedFallback) { 10431 $poppedFallback.focus(); 10432 } 10433 }; 10434 10435 this.right = function ($elem) { 10436 //do nothing 10437 }; 10438 10439 this.down = function ($elem) { 10440 // Top-level toggle 10441 if (isTopLevelToggle($elem)) { 10442 handleTopLevelToggleDown($elem); 10443 return; 10444 } 10445 10446 // Nested toggle 10447 if (isNestedToggle($elem)) { 10448 handleNestedToggleDown($elem); 10449 return; 10450 } 10451 10452 // Submenu link 10453 if (isSubmenuLink($elem)) { 10454 handleSubmenuItemDown($elem); 10455 return; 10456 } 10457 10458 // Main-level text links (navMainItem) when no submenu is open 10459 if (isMainLevelAccordionItem($elem) && !hasOpenedSubmenuInCurrentContext($elem)) { 10460 var $currentTopMenuItem = $elem.parents('.topMenuItem:first'); 10461 var $nextTopMenuItem = getAdjacentAccordionTopLevelItem($currentTopMenuItem, 'next'); 10462 focusElement($nextTopMenuItem.find('a.navMainItem:first')); 10463 return; 10464 } 10465 10466 // Original behavior for nested/other items 10467 AccessibleAccordionMenu.accordionMenuStack.push($elem); 10468 var hasAccordionSubmenu = $elem.next('a.openAccordionNav').length > 0; 10469 var accordionSubmenuAlreadyOpen = $elem.next('a.openAccordionNav').hasClass('accordionNavOpened'); 10470 var $nextElementToFocus = ''; 10471 10472 if (hasAccordionSubmenu && !accordionSubmenuAlreadyOpen) { 10473 $nextElementToFocus = $elem.parents('.topMenuItem').next('li').find('a:first'); 10474 if ($nextElementToFocus.length > 0) { 10475 $nextElementToFocus.focus(); 10476 } 10477 return; 10478 } 10479 10480 if (hasAccordionSubmenu) { 10481 $nextElementToFocus = $elem.parents('[role=menuitem]:first').children('ol.accordionNavContainer').find('a:first'); 10482 if ($nextElementToFocus.length > 0) { 10483 $nextElementToFocus.focus(); 10484 } 10485 } else { 10486 var $nextSiblingLi = $elem.parents('[role=menuitem]').next('li:first'); 10487 if ($nextSiblingLi && $nextSiblingLi.length > 0) { 10488 $nextElementToFocus = $nextSiblingLi.find('a:first'); 10489 if ($nextElementToFocus.length > 0) { 10490 $nextElementToFocus.focus(); 10491 } 10492 } else { 10493 $nextElementToFocus = $elem.parents('.topMenuItem').next('li').find('a:first'); 10494 if ($nextElementToFocus.length > 0) { 10495 $nextElementToFocus.focus(); 10496 } 10497 } 10498 } 10499 }; 10500 10501 this.enter = function ($elem) { 10502 // Focus is on accordion toggle button (+/- or arrow) 10503 if ($elem.hasClass('openAccordionNav')) { 10504 var $parentMenuItem = $elem.closest('[role=menuitem]'); 10505 10506 // If toggle is currently closed (will be opened), close sibling submenus first 10507 if (!$elem.hasClass('accordionNavOpened')) { 10508 closeSiblingSubmenus($parentMenuItem); 10509 } 10510 10511 $elem[0].click(); 10512 return true; 10513 } 10514 10515 if (isMainLevelAccordionItem($elem)) { 10516 $elem[0].click(); 10517 return true; 10518 } 10519 10520 if (isSubmenuLink($elem)) { 10521 $elem[0].click(); 10522 return true; 10523 } 10524 10525 return false;
10526 }; 10527 10528 this.tab = function ($elem) { 10529 return false; 10530 }; 10531}; 10532 10533//Self invoked function 10534(function () { 10535 function accordionMenuHandler(e) { 10536 var $this = $(this); 10537 10538 var accessibleAccordionMenu = new AccessibleAccordionMenu(); 10539 var $topmostAccordionMenuItem = $this.parents('nav').find('a:first'); 10540 10541 if ($this[0] === $topmostAccordionMenuItem[0]) { 10542 AccessibleAccordionMenu.accordionMenuStack = []; 10543 } 10544 10545 accessibleAccordionMenu.initialize(); 10546 accessibleAccordionMenu.bindHandlers($this); 10547 } 10548 10549 $(document).on("focusin", ".accordionNav a.navMainItem, .accordionNav a.navMenuItem, .accordionNav a.openAccordionNav", accordionMenuHandler); 10550}()); 10551var AccessibleAnchors = function () { 10552 10553}; 10554 10555AccessibleAnchors.prototype = 10556{ 10557 configure: function (config) { 10558 var self = this; 10559 self.OPEN_IN_NEW_WINDOW_TEXT = ' Opens in new window'; 10560 if (config.type === 'popup') { 10561 this.bindPopupHandlers(self); 10562 } 10563 if (config.type === 'extend') { 10564 this.bindExtendHandlers(self); 10565 } 10566 if (config.type === 'both') { 10567 this.bindPopupHandlers(self); 10568 this.bindExtendHandlers(self); 10569 } 10570 $(document).ready(function () { 10571 var anchors_TargetBlank = $('a[target=_blank]'); 10572 $.each(anchors_TargetBlank, function () { 10573 var $this = $(this); 10574 self.setAriaLabelAndAlt($this); 10575 }); 10576 }); 10577 }, 10578 bindExtendHandlers: function (self) { 10579 $('a[target=_blank]').on("focusin mouseenter", function (e) { 10580 var $this = $(this); 10581 self.setAriaLabelAndAlt($this); 10582 }); 10583 }, 10584 setAriaLabelAndAlt: function ($this) { 10585 //If anchor has an image inside it 10586 if (this.hasImage($this)) { 10587 var $img = $this.children('img'); 10588 if ($img.length == 0) 10589 $img = $this.children('span').children('img'); 10590 var alt = $img.attr('alt'); 10591 if (alt) { 10592 if (alt.indexOf(this.OPEN_IN_NEW_WINDOW_TEXT) === -1) 10593 $img.attr('alt', alt + this.OPEN_IN_NEW_WINDOW_TEXT); 10594 } 10595 else { 10596 $img.attr('alt', $img.attr('title') + this.OPEN_IN_NEW_WINDOW_TEXT); 10597 } 10598 this.setAriaLabel($this, $img.attr('alt')); 10599 } 10600 else { 10601 this.setAriaLabel($this, $this.text() + this.OPEN_IN_NEW_WINDOW_TEXT); 10602 } 10603 }, 10604 bindPopupHandlers: function (self) { 10605 $('a[target=_blank]').on("focusin mouseenter", function (e) { 10606 var $this = $(this); 10607 $this.trigger('focusout'); 10608 $this.append($('<span aria-hidden="false" aria-label="opens in new window" title="opens in new window" class="newWindowIndicator"></span>')); 10609 }); 10610 10611 $('a[target=_blank]').on("focusout mouseleave", function (e) { 10612 $('.newWindowIndicator').remove(); 10613 }); 10614 }, 10615 setAriaLabel: function($anchor, ariaLabelText){ 10616 var ariaLabel = $anchor.attr('aria-label'); 10617 if (ariaLabel) { 10618 if (ariaLabel.indexOf(this.OPEN_IN_NEW_WINDOW_TEXT) == -1) 10619 $anchor.attr('aria-label', ariaLabelText); 10620 } 10621 else { 10622 $anchor.attr('aria-label', ariaLabelText); 10623 } 10624 }, 10625 hasImage: function ($anchor) { 10626 var hasImage = false; 10627 if ($anchor.children('img') != null && $anchor.children('img').length > 0) 10628 return true; 10629 else if ($anchor.children('span') != null && $anchor.children('span').length > 0) { 10630 return $anchor.children('span').children('img') != null && $anchor.children('span').children('img').length > 0; 10631 } 10632 } 10633 10634}; 10635 10636//Self invloked function 10637(function () { 10638 //Add a warning span to body for anchors that open in new window 10639 $( 10640 new AccessibleAnchors().configure({ type: 'extend' }) 10641 ); 10642}()); 10643 10644 10645 10646; 10647/* File Created: February 11, 2013 by Vishal Bhatia*/ 10648 10649function rearrangeFlyouts(clearDOM) { 10650 if (clearDOM) { 10651 //Remove any old .pop elements from the DOM to reload the new one. 10652 $('.flyOut.moved').remove(); 10653 } 10654 //Grab all the flyouts that are not moved yet and are not tooltips and not in WidgetManager 10655 var $flyOutDivs = $('.flyOut').not('.moved').not('.helpTip').not('.widgetManager'); 10656 var parentID; 10657 var marginLeft, marginTop; 10658 $flyOutDivs.each(function (e) { 10659 parentID = $(this).parent('.flyOutParent').attr('id'); 10660 10661 //If the element does not have a flyOutParent, display it on the center of the screen. 10662 if (parentID == undefined) { 10663 marginLeft = '-' + $(this).outerWidth() / 2 + 'px'; 10664 marginTop = '-' + $(this).outerHeight() / 2 + 'px'; 10665 10666 $(this).css('left', '50%'); 10667 $(this).css('margin-left', marginLeft); 10668 $(this).css('top', '50%'); 10669 $(this).css('margin-top', marginTop); 10670 10671 $(this).appendTo('body'); 10672 $(this).addClass('moved'); 10673 //TODO: Confirm from Kyle and remove 2 lines below since they are being done through css. 10674 $(this).css('position', 'absolute'); 10675 $(this).css('z-index', '100'); 10676 } 10677 else { 10678 //Remove any pre existing copies of this element from the DOM. 10679 $('[data-parentID=' + parentID + ']').remove(); 10680 //Remove margin styles if the element has a flyOutParent. 10681 $(this).css({ 'margin-left': '', 'margin-top': '' }); 10682 $(this).appendTo('body'); 10683 $(this).addClass('moved'); 10684 //TODO: Confirm from Kyle and remove 2 lines below since they are being done through css. 10685 $(this).css('position', 'absolute'); 10686 $(this).css('z-index', '100'); 10687 $(this).attr('data-parentID', parentID); 10688 adjustFlyoutPosition($('#' + parentID), $(this)); 10689 } 10690 });
10691} 10692 10693///Executes when the browser is being resized or the screen orientation changes(portrait/landscape). 10694function rearrangeFlyoutsOnResizeEvents() { 10695 //Grab all the flyouts that are not moved yet and are not tooltips and not in WidgetManager 10696 var $flyOutDivs = $('.flyOut').not('.helpTip').not('.widgetManager').not('.mainNavMegaMenu.megaMenuContainer');; 10697 var parentID; 10698 var marginLeft, marginTop; 10699 $flyOutDivs.each(function (e) { 10700 parentID = $(this).data('parentid'); 10701 //If the element does not have a flyOutParent, display it on the center of the screen. 10702 if (parentID == undefined) { 10703 marginLeft = '-' + $(this).outerWidth() / 2 + 'px'; 10704 marginTop = '-' + $(this).outerHeight() / 2 + 'px'; 10705 $(this).css('margin-left', marginLeft); 10706 $(this).css('margin-top', marginTop); 10707 } 10708 else { 10709 adjustFlyoutPosition($('#' + parentID), $(this)); 10710 } 10711 }); 10712} 10713 10714///Checks if any ancestor of a flyout element is fixed positioned. 10715function anyAncestorFixedPositioned($parent) { 10716 var anyAncestorFixedPosition = false; 10717 if ($parent.css('position') === 'fixed') 10718 anyAncestorFixedPosition = true; 10719 if (!anyAncestorFixedPosition) { 10720 $parent.parents().each(function () { 10721 if (!anyAncestorFixedPosition) { 10722 if ($(this).css('position') === 'fixed') 10723 anyAncestorFixedPosition = true; 10724 } 10725 }); 10726 } 10727 return anyAncestorFixedPosition; 10728} 10729 10730function adjustFlyoutPosition($parent, $this) { 10731 var $parentElem = $parent; 10732 if ($parentElem != null) { 10733 var parentWidth = $parent.outerWidth(false); 10734 var parentHeight = $parent.outerHeight(false); 10735 var offset = $parent.offset(); 10736 if (offset != null) { 10737 var offsetLeft = offset.left; 10738 //Take into account scroll height if the document has been scrolled, to compute the top distance from viewport. VB 10739 var offsetTop = $this.css('position') === 'fixed' ? offset.top - $(document).scrollTop() : offset.top; // Take into account if the item is fixed or absolutely positioned. 10740 10741 if (anyAncestorFixedPositioned($parent)) 10742 $this.css('position', 'fixed'); 10743 10744 var offsetRight; 10745 var offsetBottom; 10746 10747 if ($this.hasClass('left') || $this.hasClass('leftCorner')) { 10748 offsetLeft = offsetLeft - $this.outerWidth(false); 10749 $this.css('left', offsetLeft); 10750 } 10751 10752 if ($this.hasClass('right') || $this.hasClass('rightCorner')) { 10753 offsetLeft = offsetLeft + parentWidth; 10754 $this.css('left', offsetLeft); 10755 } 10756 10757 if ($this.hasClass('top') || $this.hasClass('topCorner')) { 10758 offsetBottom = offsetTop - $this.outerHeight(false); 10759 $this.css('top', offsetBottom); 10760 } 10761 10762 if ($this.hasClass('bottom') || $this.hasClass('bottomCorner')) { 10763 offsetTop = offsetTop + parentHeight; 10764 $this.css('top', offsetTop); 10765 } 10766 10767 if ($this.hasClass('leftEdge')) { 10768 $this.css('left', offsetLeft); 10769 10770 if ($this.hasClass('rightEdge')) { 10771 $this.css('width', parentWidth); 10772 } 10773 } 10774 10775 if ($this.hasClass('rightEdge')) { 10776 offsetLeft = offsetLeft + parentWidth - $this.outerWidth(false); 10777 $this.css('left', offsetLeft); 10778 } 10779 10780 if ($this.hasClass('topEdge')) { 10781 $this.css('top', offsetTop); 10782 10783 if ($this.hasClass('bottomEdge')) { 10784 $this.css('height', parentHeight); 10785 } 10786 } 10787 10788 if ($this.hasClass('bottomEdge')) { 10789 offsetTop = offsetTop + parentHeight - $this.outerHeight(false); 10790 $this.css('top', offsetTop); 10791 } 10792 10793 if ($this.hasClass('center') && ($this.hasClass('top') || $this.hasClass('bottom'))) { 10794 offsetLeft = offsetLeft + (parentWidth / 2) - ($this.outerWidth(false) / 2); 10795 $this.css('left', offsetLeft); 10796 } 10797 10798 if ($this.hasClass('center') && ($this.hasClass('left') || $this.hasClass('right'))) { 10799 offsetTop = offsetTop + (parentHeight / 2) - ($this.outerHeight(false) / 2); 10800 $this.css('top', offsetTop); 10801 } 10802 } 10803 } 10804}; 10805// Note some of this functionality is in Menu.js as well 10806 10807// Deferred Loading for mega menus 10808$(function () { 10809 "use strict"; 10810 10811 var thisRef = {}; 10812 10813 thisRef.initialized = false; 10814 10815 var LOAD_TRIGGER_DISTANCE = 200; // in px 10816 var $megaMenus = $('[data-displaymegamenu="True"]'); 10817 function isNear(element, distance, event) { 10818 var left = element.offset().left - distance, 10819 top = element.offset().top - distance, 10820 right = left + element.width() + 2 * distance, 10821 bottom = top + element.height() + 2 * distance, 10822 x = event.pageX, 10823 y = event.pageY; 10824 10825 return (x > left && x < right && y > top && y < bottom); 10826 }; 10827 10828 $('body:not(.mobile)').bind('mousemove.megaMenuLazyLoad', function (e) { 10829 $megaMenus.each(function (index) { 10830 var mouseIsNear = isNear($(this), LOAD_TRIGGER_DISTANCE, e); 10831 if (mouseIsNear) { 10832 if (!thisRef.initialized) { 10833 $('body').unbind('.megaMenuLazyLoad'); 10834 thisRef.initialized = true; 10835 var megaMenuContentContainers = $('[data-displaymegamenu="True"]') 10836 .map(function () { 10837 $('#mainNavMegaMenu' + $(this).data('pageid') + ' div.pageContent').html('Loading...'); 10838 return $('#mainNavMegaMenu' + $(this).data('pageid') + ' div.pageContent').data('containerid'); 10839 }).toArray(); 10840 10841 window.Pages.megaMenuLoaded.resolve();
10842 reloadSharedContentContainers(megaMenuContentContainers); 10843 } 10844 } 10845 }); 10846 }); 10847}); 10848 10849var reloadSharedContentContainers = function (containerIDs) { 10850 if (containerIDs.length > 0) { 10851 // Reload all mega menus? 10852 var url = getAbsoluteUrl('/Content/Load?contentCollectionID=' + $('#hdnContentCollectionID').val() + "&StructureID=" + $('#hdnStructureID').val() + "&themeID=" + $('#hdnThemeID').val()); 10853 if ($('body').hasClass('preview')) 10854 url += "&preview=true"; 10855 $.ajax({ 10856 url: url, 10857 type: 'POST', 10858 data: JSON.stringify({ "contentContainerIDs": containerIDs }), 10859 contentType: 'application/json', 10860 cache: false, 10861 async: true, 10862 ignoreEditor: true, //prevent for executing global editor event 10863 error: function (xhr, textStatus, exception) { 10864 if (xhr.status != 0) { 10865 alert("Error: " + xhr.statusText + "\nStatus: " + xhr.status); 10866 } 10867 }, 10868 success: function (response) { 10869 if (response.PageModified !== undefined && response.PageModified === true && response.PageModifiedMessage) { 10870 if (confirm(response.PageModifiedMessage)) { 10871 document.cookie = "refresh=true; max-age=5"; 10872 location.reload(); 10873 } 10874 } 10875 else if (response.ErrorMessage) 10876 alert(response.ErrorMessage); 10877 else { 10878 //Replace content containers HTML 10879 var root = document.createElement("div"); 10880 root.innerHTML = response; 10881 $(root).find('#fb-root').remove(); 10882 $('head').append($(root).find('.bundledStyles')); 10883 var allChilds = root.childNodes; 10884 for (var i = 0; i < containerIDs.length; i++) { 10885 var contentContainerID = containerIDs[i]; 10886 //Grab Content Container HTML from response 10887 var contentContainerHtml = null; 10888 for (var j = 0; j < allChilds.length; j++) { 10889 if (allChilds[j].id && allChilds[j].id == 'cc' + contentContainerID) { 10890 contentContainerHtml = allChilds[j].outerHTML; 10891 break; 10892 } 10893 } 10894 if (contentContainerHtml != null) { 10895 var $contentContainer = $('#cc' + contentContainerID); 10896 $contentContainer.empty().replaceWith(contentContainerHtml); 10897 } else { 10898 //ContentContainer Html was not found. This might happen when we have a html version and switch (Refresh containers) to a linked version on the same page. 10899 } 10900 } 10901 10902 if (window.cpMedia) { 10903 $('.mainNavMegaMenu.megaMenuContainer').each(function () { 10904 applyElementQueryToChildren($(this)); 10905 }); 10906 } 10907 10908 //TODO: unbind/destroy events/drag/drop on elements before initialize containers 10909 if (typeof InitializeContainers == 'function' && getCookieValue("enableLiveEdit") === "true") { 10910 InitializeContainers({ hidePopover: false }); 10911 $('.mainNavMegaMenu.megaMenuContainer').find('.pinned').removeClass('pinned'); 10912 setTimeout(function () { // It is unfortunate to use timeout here, but there is a very difficult to reproduce race condition in FF where it is still getting unpinned by something 10913 $('.mainNavMegaMenu.megaMenuContainer').find('.pinned').removeClass('pinned'); 10914 },300); 10915 } 10916 if (menuManager && typeof menuManager.attachDragAndDropHandlers == 'function') { 10917 menuManager.attachDragAndDropHandlers(); 10918 } 10919 10920 //Execute this function or else the click event wont be registered for tabbed widgets inside megamenus. 10921 Core.Layout.attachTabbedWidgetTabHandlers(); 10922 } 10923 } 10924 }); 10925 } 10926}; 10927 10928// Handle touchstart event for touch devices. First click will load the megamenus if they haven't been loaded and show the mega menu. Second click will navigate to the menu link itself. 10929$('[data-displaymegamenu="True"]').bind('touchstart', function (e) { 10930 e.stopPropagation(); // prevent this event from bubbling up and triggering the handler on document below! 10931 if (($(this).closest('.mainNavHolderMobile')[0] !== undefined) || ($('body:not(.mobile)').length === 0)) { // Return if mobile menu is being shown 10932 return; 10933 } 10934 if (window.lastMegaMenuOpen === this) { // Used to do the second click navigation if the same menu is clicked twice. 10935 return; 10936 } 10937 e.preventDefault(); 10938 if (!window.megaMenuInitializedForTouch) { 10939 $('body').unbind('.megaMenuLazyLoad'); 10940 window.megaMenuInitializedForTouch = true; 10941 var megaMenuContentContainers = $('[data-displaymegamenu="True"]') 10942 .map(function () { 10943 $('#mainNavMegaMenu' + $(this).data('pageid') + ' div.pageContent').html('Loading...'); 10944 return $('#mainNavMegaMenu' + $(this).data('pageid') + ' div.pageContent').data('containerid'); 10945 }).toArray(); 10946 10947 window.Pages.megaMenuLoaded.resolve();
10948 reloadSharedContentContainers(megaMenuContentContainers); 10949 } 10950 10951 menuManager.menuMouseOver($(this)); 10952 window.lastMegaMenuOpen = this; 10953}); 10954 10955$(document).bind('touchstart click', function (e) { 10956 if (window.lastMegaMenuOpen === undefined || window.lastMegaMenuOpen === this || !isResolvedOrState(window.Pages.megaMenuLoaded)) { 10957 return; 10958 } 10959 //Skip menumouseout method if user slide up the expanded mega menu to scroll 10960 if (!e.target.id.startsWith("mainNavMegaMenu")) { 10961 if (!$(e.target).parents("aside[id^='mainNavMegaMenu']").length) { 10962 menuManager.menuMouseOut($(window.lastMegaMenuOpen)); 10963 } 10964 } 10965}); 10966(function () { 10967 const focusableSelector = 'a:not([disabled]):not([aria-hidden="true"]),input:not([disabled]):not([type="hidden"])'; 10968 const toggleEl = (target, toggleable) => { 10969 const display = target.getAttribute("aria-expanded") === "false"; 10970 toggleable.style.display = display ? "block" : "none"; 10971 target.setAttribute("aria-expanded", display); 10972 10973 if (display) { 10974 target.classList.add("active"); 10975 } else { 10976 target.classList.remove("active"); 10977 } 10978 }; 10979 10980 const repositionPopover = (target) => { 10981 const elId = target.getAttribute("aria-controls"); 10982 if (!elId) { 10983 return; 10984 } 10985 10986 const popover = document.getElementById(elId); 10987 if (!popover) { 10988 return; 10989 } 10990 10991 const popoverWidth = popover.offsetWidth; 10992 const rect = target.getBoundingClientRect(); 10993 const targetHeight = target.offsetHeight; 10994 const distanceFromRight = window.innerWidth - rect.left; 10995 const parent = target.parentElement; 10996 const parentWidth = parent.offsetWidth; 10997 10998 if (distanceFromRight < popoverWidth && parentWidth < popoverWidth) { 10999 popover.classList.add("flip"); 11000 const shift = parentWidth - popoverWidth; 11001 popover.style.left = `${shift}px`; 11002 } else { 11003 popover.classList.remove("flip"); 11004 popover.style.left = `0px`; 11005 } 11006 11007 const parentRect = parent.getBoundingClientRect(); 11008 const distanceFromParentBottom = parentRect.bottom - rect.bottom; 11009 popover.style.bottom = `${distanceFromParentBottom + targetHeight}px`; 11010 popover.style.zIndex = 1; 11011 popover.scrollIntoView({ behavior: "smooth", block: "center", inline: "nearest"}); 11012 }; 11013 11014 const handleCpNavKeydown = (event, focusables) => { 11015 if (focusables.length < 1) { 11016 return; 11017 } 11018 11019 const currentFocusedIndex = focusables.findIndex(element => element === document.activeElement); 11020 let nextFocusIndex = -1; 11021 switch (event.key) { 11022 case 'ArrowLeft': 11023 case 'ArrowUp': 11024 event.preventDefault(); 11025 if (currentFocusedIndex > 0) { 11026 nextFocusIndex = currentFocusedIndex - 1; 11027 } else { 11028 nextFocusIndex = focusables.length - 1; 11029 } 11030 break; 11031 case 'ArrowRight': 11032 case 'ArrowDown': 11033 event.preventDefault(); 11034 if (currentFocusedIndex < focusables.length - 1) { 11035 nextFocusIndex = currentFocusedIndex + 1; 11036 } else { 11037 nextFocusIndex = 0; 11038 } 11039 break; 11040 case 'Home': 11041 event.preventDefault(); 11042 nextFocusIndex = 0; 11043 break; 11044 case 'End': 11045 event.preventDefault(); 11046 nextFocusIndex = focusables.length - 1; 11047 break; 11048 default: 11049 break; 11050 } 11051 11052 if (nextFocusIndex > -1) { 11053 focusables[currentFocusedIndex].setAttribute('tabindex', '-1'); 11054 focusables[nextFocusIndex].setAttribute('tabindex', '0'); 11055 focusables[nextFocusIndex].focus(); 11056 } 11057 }; 11058 11059 const handleCpNav2DKeydown = (e, focusables) => { 11060 const map = { 11061 "ArrowLeft": { pos: "left", sign: 1, finder: "findLast", ctrl: false }, 11062 "ArrowRight": { pos: "left", sign: -1, finder: "find", ctrl: false }, 11063 "ArrowUp": { pos: "top", sign: 1, finder: "findLast", ctrl: false }, 11064 "ArrowDown": { pos: "top", sign: -1, finder: "find", ctrl: false }, 11065 "Home": { pos: "left", sign: 1, finder: "find", ctrl: e.ctrlKey }, 11066 "End": { pos: "left", sign: -1, finder: "findLast", ctrl: e.ctrlKey } 11067 }; 11068 11069 const settings = map[e.key]; 11070 11071 if (!settings) { 11072 return; 11073 } 11074 11075 const current = e.target.closest(focusableSelector); 11076 11077 if (!current) { 11078 return; 11079 } 11080 11081 e.preventDefault(); 11082 11083 const pos = settings.pos; 11084 const offsetConst = pos === "top" ? "left" : "top"; 11085 const sign = settings.sign; 11086 const ctrlKey = settings.ctrl; 11087 const rectCurrent = current.getBoundingClientRect(); 11088 const tolerance = pos === "top" ? current.offsetHeight / 3 : current.offsetWidth / 3; 11089 11090 const finder = settings.finder; 11091
11092 const elFound = focusables[finder](el => { 11093 const rect = el.getBoundingClientRect(); 11094 const currentDistance = sign * (rectCurrent[pos] - rect[pos]); 11095 const offset = Math.abs(rectCurrent[offsetConst] - rect[offsetConst]); 11096 return (offset < tolerance && currentDistance > 0) || ctrlKey; 11097 }); 11098 11099 if (!elFound) { 11100 return; 11101 } 11102 11103 current.setAttribute("tabindex", "-1"); 11104 elFound.setAttribute("tabindex", "0"); 11105 elFound.focus(); 11106 return elFound; 11107 } 11108 11109 const handleEl = (target) => { 11110 const elId = target.getAttribute("aria-controls"); 11111 if (!elId) { 11112 return; 11113 } 11114 11115 const toggleable = document.getElementById(elId); 11116 if (!toggleable) { 11117 return; 11118 } 11119 11120 toggleEl(target, toggleable); 11121 11122 const handleFocusout = (e) => { 11123 if (toggleable.contains(e.relatedTarget) || target.getAttribute("aria-expanded") !== "true") { 11124 return; 11125 } 11126 11127 if (toggleable.contains(e.currentTarget) && target.contains(e.relatedTarget)) { 11128 // Exclude the case where the focus is moving from popup back to button (e.g. when closing the currently focused popup with a left-mouse click on the button) 11129 // The popup will be closed within the keydown handleEl(); failure to exclude this case will cause a bug where toggleEl() is called twice, making it difficult to close the popup. 11130 // https://civicplus.tpondemand.com/entity/182413-211-calendar-month-view-remove-menu 11131 return; 11132 } 11133 11134 toggleEl(target, toggleable); 11135 }; 11136 11137 if (!target["data-cp-toggle"]) { 11138 target["data-cp-toggle"] = true; 11139 toggleable.addEventListener("focusout", handleFocusout); 11140 target.addEventListener("focusout", handleFocusout); 11141 } 11142 11143 const closeActionEl = toggleable.querySelector(".close"); 11144 11145 if (!closeActionEl) { 11146 return toggleable; 11147 } 11148 11149 const handleClose = (e) => { 11150 if (e.type === "click" || (e.type === "keydown" && (e.key === "Enter" || e.key === " "))) { 11151 e.preventDefault(); 11152 toggleEl(target, toggleable); 11153 target.focus(); 11154 } 11155 }; 11156 11157 if (!closeActionEl["data-cp-toggle"]) { 11158 closeActionEl["data-cp-toggle"] = true; 11159 closeActionEl.addEventListener("click", handleClose); 11160 closeActionEl.addEventListener("keydown", handleClose); 11161 } 11162 11163 return toggleable; 11164 }; 11165 11166 const handleDropdown = (target, func) => { 11167 const toggleable = handleEl(target); 11168 if (!toggleable) { 11169 return; 11170 } 11171 const focusables = Array.from(toggleable.querySelectorAll(focusableSelector)); 11172 if (focusables.length === 0) { 11173 return; 11174 }
11175 focusables.forEach( (item, index) => { 11176 item.setAttribute("tabindex", -!!index|0); 11177 }); 11178 if (!target["data-cp-toggle-navkeys"]) { 11179 target["data-cp-toggle-navkeys"] = true; 11180 target.addEventListener("keydown", e => { 11181 if (e.key === "ArrowDown" && target.getAttribute("aria-expanded") === "true") { 11182 focusables[0].focus(); 11183 } 11184 }); 11185 toggleable.addEventListener("keydown", e => { 11186 func(e, focusables); 11187 }); 11188 } 11189 } 11190 11191 const handleDropdown1D = (target) => { 11192 return handleDropdown(target, handleCpNavKeydown); 11193 } 11194 11195 const handleDropdown2D = (target) => { 11196 return handleDropdown(target, handleCpNav2DKeydown); 11197 } 11198 11199 const handlePopover = (target) => { 11200 handleEl(target); 11201 repositionPopover(target); 11202 }; 11203 11204 /** 11205 * From the given toggle button's aria-controls elements returns active and total panel count 11206 * @target {Element} foo [description] 11207 */ 11208 const getPanels = (target) => { 11209 const elIds = target.getAttribute("aria-controls"); 11210 const panelIds = elIds.split(' '); 11211 let activePanels = 0; 11212 let totalPanels = 0; 11213 for (const panelId of panelIds) { 11214 const panel = document.getElementById(panelId); 11215 if (!panel) { 11216 continue 11217 } 11218 totalPanels += 1 11219 activePanels += Number(!!( panel.offsetWidth || panel.offsetHeight || panel.getClientRects().length )) 11220 } 11221 11222 return [activePanels, totalPanels]; 11223 } 11224 11225 /** 11226 * Get total height of the given element's children 11227 * @collapsable {Element} foo [description] 11228 */ 11229 const collapsableHeight = (collapsable) => { 11230 const totalHeight = Array.from(collapsable.children).reduce((acc, child) => acc + child.offsetHeight, 0); 11231 return `calc(${totalHeight}px + 2px)` 11232 } 11233 11234 const handleCollapsar = (target) => { 11235 const elIds = target.getAttribute("aria-controls"); 11236 if (!elIds) { 11237 return; 11238 } 11239 11240 const collapsables = elIds.split(' ').filter(x => document.getElementById(x)); 11241 11242 const expand = target.getAttribute("aria-expanded") === "false"; 11243 11244 for (const collapsableId of collapsables) { 11245 11246 const collapsable = document.getElementById(collapsableId); 11247 collapsable.style.overflow = "hidden"; 11248 collapsable.style.transition = "all 300ms ease-in"; 11249 11250 // get all the buttons those are responsible for the given panel 11251 const controllers = document.querySelectorAll(`[aria-controls^="${collapsableId}"],[aria-controls*=" ${collapsableId} "],[aria-controls$="${collapsableId}"]`); 11252 11253 if (expand) { 11254 collapsable.style.height = "0"; 11255 collapsable.style.display = "block"; 11256 collapsable.style.height = collapsableHeight(collapsable); 11257 let nextFocus = null; 11258 for (const controller of controllers) { 11259 const [activePanels, totalPanels] = getPanels(controller); 11260 if (activePanels !== totalPanels) { 11261 continue; 11262 } 11263 nextFocus = document.getElementById(controller.dataset.cpToggleFocus); 11264 controller.setAttribute("aria-expanded", "true"); 11265 controller.classList.add("active"); 11266 if (controller.dataset.cpToggleActiveTitle) { 11267 controller.innerHTML = controller.dataset.cpToggleActiveTitle; 11268 } 11269 } 11270 11271 window.setTimeout(() => { 11272 collapsable.style.removeProperty("height"); 11273 collapsable.style.removeProperty("overflow"); 11274 nextFocus && nextFocus.focus(); 11275 }, 300); 11276 continue; 11277 } 11278 11279 collapsable.style.height = collapsableHeight(collapsable); 11280 collapsable.style.overflow = "hidden"; 11281 window.setTimeout(() => { 11282 collapsable.style.height = "0"; 11283 }, 0); 11284 11285 window.setTimeout(function () { 11286 collapsable.style.display = "none"; 11287 for (const controller of controllers) { 11288 const [activePanels, _] = getPanels(controller); 11289 if (activePanels !== 0) { 11290 continue; 11291 } 11292 controller.setAttribute("aria-expanded", "false"); 11293 controller.classList.remove("active"); 11294 if (controller.dataset.cpToggleInactiveTitle) { 11295 controller.innerHTML = controller.dataset.cpToggleInactiveTitle; 11296 } 11297 } 11298 }, 300); 11299 } 11300 }; 11301 11302 const handleCpToggles = (e) => { 11303 if (e.type === "click" || (e.type === "keydown" && (e.key === "Enter" || e.key === " "))) { 11304 const target = e.target.closest("[data-cp-toggle]"); 11305 if (!target) { 11306 return; 11307 } 11308 e.preventDefault();
11309 // target.focus(); // focus element so that focusout is fired to close other open menus. 11310 11311 const actionDescriptor = target.dataset.cpToggle; 11312 switch (actionDescriptor) { 11313 case "popover": 11314 handlePopover(target); 11315 break; 11316 case "collapse": 11317 handleCollapsar(target); 11318 break; 11319 case "dropdown": 11320 handleDropdown1D(target); 11321 break 11322 case "dropdown-2d": 11323 handleDropdown2D(target); 11324 break 11325 default: 11326 handleEl(target); 11327 } 11328 } 11329 11330 const escTargets = new Set(["dropdown", "dropdown-2d"]); 11331 11332 if (e.type === "keydown" && e.key === "Escape") { 11333 const toggles = document.querySelectorAll('[data-cp-toggle][aria-expanded="true"]'); 11334 for (const target of toggles) { 11335 const toggleType = target.dataset.cpToggle; 11336 if (escTargets.has(toggleType)) { 11337 const elId = target.getAttribute("aria-controls"); 11338 if (!elId) { 11339 continue; 11340 } 11341 11342 const toggleable = document.getElementById(elId); 11343 if (!toggleable) { 11344 continue; 11345 } 11346 11347 const refocus = toggleable.contains(document.activeElement); 11348 11349 toggleEl(target, toggleable); 11350 11351 if (refocus) { 11352 target.focus(); 11353 } 11354 } 11355 } 11356 } 11357 }; 11358 11359 document.addEventListener("click", handleCpToggles); 11360 document.addEventListener("keydown", handleCpToggles); 11361})(); 11362; 11363/* Responsive Menu Font Sizing 11364 * Joshua Enfield 11365 * ------------- 11366 * This resizes menus responsively. It takes into account the original font size. 11367 * If auto widths are on font sizes are adjusted based on the size left in menu items. 11368 * If auto widths are off font sizes are adjusted based on the size left in the main nav. 11369 * --------------- 11370 * Common Usage: $('menuOLSelector').responsiveMenuText(); 11371 * jQuery Usage expects markup in the form of ol > li > a 11372 */ 11373(function ($, window, undefined) { 11374 11375 'use strict'; 11376 11377 var DEBUG = false; 11378 var diag = function (msg) { 11379 if (DEBUG) { 11380 window.console.log('[ Responsive Menus ] ' + msg); 11381 } 11382 }; 11383 11384 $.MenuTextResizer = function (options, element) { 11385 this.$mainNavMenu = $(element); 11386 this.$topLevelMenuItems = this.$mainNavMenu.find('a'); 11387 this._init(options); 11388 }; 11389 11390 // the options 11391 $.MenuTextResizer.defaults = { 11392 ratio: 0.5, 11393 timeout: 120, 11394 numberOfFontSizes: 20, 11395 tolerance: 0.00 11396 }; 11397 11398 $.MenuTextResizer.prototype = { 11399 _init: function (options) { 11400 // options 11401 this.options = $.extend(true, {}, $.MenuTextResizer.defaults, options); 11402 11403 // local variables 11404 var self = this; 11405 this.timer = null; 11406 this.autoCreatedWrapper = false; 11407 createInnerWrappersIfWrappersDoNotExist(); 11408 var desktopFontSize = parseFloat(this.$topLevelMenuItems.css('font-size')); // Initial Font Size. When at maximum size font-size should be this. 11409 var numberOfFontSizes = this.options.numberOfFontSizes; 11410 var fontSizes = getFontSizes(); 11411 var currentFontIndex = fontSizes.length - 1; 11412 var tolerance = this.options.tolerance; 11413 var autoWidths = this.$mainNavMenu.data('autowidth') == true; 11414 11415 var ratioToTriggerResize = autoWidths ? { menuRatio: 1.00, itemRatio: self.options.ratio } : { menuRatio: self.options.ratio, itemRatio: 1.00 }; 11416 //var ratioToTriggerResize = { menuRatio: 0.68, itemRatio: 1.00 }; 11417 //var ratioToTriggerResize = { menuRatio: 1.00, itemRatio: 0.70 }; 11418 11419 if (autoWidths) 11420 diag('Auto Widths Detected.'); 11421 else { 11422 diag('Auto Widths Turned Off.'); 11423 } 11424 11425 diag('Font Sizes: ' + fontSizes); 11426 11427 // Gets list of font sizes to resize amongst 11428 11429 function getFontSizes () { 11430 var fontSizes = []; 11431 11432 // Linear Scale 11433 for (var i = 0; i < numberOfFontSizes; i++) { 11434 fontSizes[i] = Math.floor(desktopFontSize / numberOfFontSizes * (i + 1)); 11435 } 11436 11437 // Exponential Decay 11438 /* 11439 fontSizes[numberOfFontSizes - 1] = desktopFontSize; 11440 for (var i = (numberOfFontSizes-2); i > 0; i--) { 11441 fontSizes[i] = Math.floor(0.95 * fontSizes[i+1]); 11442 }*/ 11443 11444 return fontSizes; 11445 } 11446 11447 // Increases font size. 11448 var increaseFontSize = function () { 11449 var wasFontSizeIncreased = false; 11450 11451 if (currentFontIndex < (fontSizes.length - 1)) { 11452 currentFontIndex++; 11453 wasFontSizeIncreased = true; 11454 // ratioToTriggerResize.itemRatio -= 0.1; 11455 } 11456 11457 self.$topLevelMenuItems.css('font-size', fontSizes[currentFontIndex]); 11458 diag('INCREASE IN SIZE TRIGGERED (sizeIndex: ' + currentFontIndex + (currentFontIndex == (numberOfFontSizes - 1) ? '(MAX)' : '') + ' ,' + fontSizes[currentFontIndex] + ')'); 11459 return wasFontSizeIncreased; 11460 }; 11461 11462 // Decreases font size. 11463 var decreaseFontSize = function () { 11464 var wasFontSizeDecreased = false; 11465 11466 if (currentFontIndex > 0) { 11467 currentFontIndex--; 11468 wasFontSizeDecreased = true; 11469 // ratioToTriggerResize.itemRatio += 0.1; 11470 } 11471 11472 self.$topLevelMenuItems.css('font-size', fontSizes[currentFontIndex]); 11473 11474 diag('DECREASE IN SIZE TRIGGERED (sizeIndex: ' + currentFontIndex + ',' + fontSizes[currentFontIndex] + ')'); 11475 return wasFontSizeDecreased; 11476 }; 11477 11478 // Wraps menu Items with a span if spans are not already wrapping them. 11479 function createInnerWrappersIfWrappersDoNotExist () { 11480 if (self.$topLevelMenuItems.find('span').length === 0) { 11481 self.$topLevelMenuItems.removeAttr('style').wrapInner('<span/>').find('span').css('display', 'inline'); 11482 self.autoCreatedWrapper = true; 11483 } 11484 } 11485
11486 // Get the ratios of space taken to space available for menu items and the menu itself 11487 function getRatio () { 11488 var getItemRatio = function ($item) { return $item.find('span').width() / $item.width(); }; 11489 var itemRatio = getItemRatio(self.$topLevelMenuItems.first()); 11490 11491 var widthConsumedByMenuItems = 0; 11492 self.$topLevelMenuItems.each(function () { 11493 widthConsumedByMenuItems += $(this).outerWidth(true); 11494 11495 var currentItemRatio = getItemRatio($(this)); 11496 if (currentItemRatio > itemRatio) { 11497 itemRatio = currentItemRatio; 11498 } 11499 11500 }); 11501 11502 var menuRatio = widthConsumedByMenuItems / self.$mainNavMenu.width(); 11503 var result = { 11504 menuRatio: menuRatio.toFixed(2), 11505 itemRatio: itemRatio.toFixed(2) 11506 }; 11507 11508 return result; 11509 } 11510 11511 // Conditions 11512 var predicates = (function () { 11513 // Should return true when an increase in size should occur. 11514 var shouldIncreaseInSize = function () { 11515 var currentRatio = getRatio(); 11516 diag(JSON.stringify(currentRatio)); 11517 if (autoWidths) { 11518 return currentRatio.itemRatio < (ratioToTriggerResize.itemRatio - tolerance); 11519 } else { 11520 return currentRatio.menuRatio < (ratioToTriggerResize.menuRatio - tolerance); 11521 } 11522 }; 11523 11524 // Should return true when a decrease in size should occur. 11525 var shouldDescreaseInSize = function () { 11526 var currentRatio = getRatio(); 11527 diag(JSON.stringify(currentRatio)); 11528 if (autoWidths) { 11529 return currentRatio.itemRatio > (ratioToTriggerResize.itemRatio - tolerance); 11530 } else { 11531 return currentRatio.menuRatio > (ratioToTriggerResize.menuRatio - tolerance); 11532 } 11533 }; 11534 11535 return { 11536 shouldIncreaseInSize: shouldIncreaseInSize, 11537 shouldDescreaseInSize: shouldDescreaseInSize 11538 }; 11539 11540 }()); 11541 11542 // Function that actually adjusts menu font sizes. 11543 this.adjustMenuFontSize = function () { 11544 while (predicates.shouldIncreaseInSize() && increaseFontSize()) ; 11545 while (predicates.shouldDescreaseInSize() && decreaseFontSize()) ; 11546 }; 11547 11548 this._initDefault(); 11549 }, 11550 _initDefault : function () { 11551 // Setup and bind menu resizing logic 11552 var self = this; 11553 var timeout = self.options.timeout || 100; //debouncing 11554 $(window).bind('resize.responsiveMenuText', function () { 11555 self.timer && clearTimeout(self.timer); 11556 11557 self.timer = setTimeout(function () { 11558 self.adjustMenuFontSize(); 11559 }, timeout); 11560 }); 11561 self.adjustMenuFontSize(); 11562 }, 11563 dispose: function () { 11564 var self = this; 11565 clearTimeout(self.timer); 11566 $(window).unbind('.responsiveMenuText'); 11567 if (self.autoCreatedWrapper) { 11568 self.$topLevelMenuItems.find('span').contents().unwrap(); 11569 setTimeout(function () { self.$topLevelMenuItems.removeAttr('style'); }, 200); 11570 } 11571 } 11572 }; 11573 11574 /* jQuery Plugin Support 11575 Expected Markup structure: ol > li > a 11576 Menu Text is dynamically wrapped by a span if it isn't already. 11577 */ 11578 $.fn.responsiveMenuText = function (options) { 11579 if (typeof options === 'string') { 11580 var args = Array.prototype.slice.call(arguments, 1); 11581 this.each(function () { 11582 var instance = $.data(this, 'responsiveMenuText'); 11583 if (!instance) { 11584 diag("cannot call methods on responsiveMenuText prior to initialization; " + 11585 "attempted to call method '" + options + "'"); 11586 return; 11587 } 11588 if (!$.isFunction(instance[options]) || options.charAt(0) === "_") { 11589 diag("no such method '" + options + "' for responsiveMenuText instance"); 11590 return; 11591 } 11592 instance[options].apply(instance, args); 11593 }); 11594 } 11595 else { 11596 this.each(function () { 11597 var instance = $.data(this, 'responsiveMenuText'); 11598 if (instance) { 11599 instance._init(options); 11600 } 11601 else { 11602 instance = $.data(this, 'responsiveMenuText', new $.MenuTextResizer(options, this)); 11603 } 11604 }); 11605 } 11606 11607 return this; 11608 }; 11609 11610})(jQuery, window); 11611/** 11612 * Based on jquery.rwdmenu.js v1.0.1 11613 * http://www.codrops.com 11614 * 11615 */ 11616; (function ($, window, undefined) { 11617 11618 'use strict'; 11619 11620 // global 11621 var Modernizr = window.Modernizr, $body = $('body'); 11622 11623 $.RWDMenu = function (options, element) { 11624 this.$el = $(element); 11625 this._init(options); 11626 }; 11627 11628 // the options 11629 $.RWDMenu.defaults = { 11630 // classes for the animation effects 11631 animationClasses: { classin: 'rwd-animate-in', classout: 'rwd-animate-out' }, 11632 // callback: click a link that has a sub menu 11633 // el is the link element (li); name is the level name 11634 onLevelClick: function (el, name) { return false; }, 11635 // callback: click a link that does not have a sub menu 11636 // el is the link element (li); ev is the event obj 11637 onLinkClick: function (el, ev) { return false; } 11638 }; 11639 11640 $.RWDMenu.prototype = { 11641 _init: function (options) { 11642 11643 // options 11644 this.options = $.extend(true, {}, $.RWDMenu.defaults, options); 11645 // cache some elements and initialize some variables 11646 this._config(); 11647 11648 var animEndEventNames = { 11649 'WebkitAnimation': 'webkitAnimationEnd', 11650 'OAnimation': 'oAnimationEnd', 11651 'msAnimation': 'MSAnimationEnd', 11652 'animation': 'animationend' 11653 }, 11654 transEndEventNames = { 11655 'WebkitTransition': 'webkitTransitionEnd', 11656 'MozTransition': 'transitionend', 11657 'OTransition': 'oTransitionEnd', 11658 'msTransition': 'MSTransitionEnd', 11659 'transition': 'transitionend' 11660 }; 11661 // animation end event name 11662 this.animEndEventName = animEndEventNames[Modernizr.prefixed('animation')] + '.rwdmenu'; 11663 // transition end event name 11664 this.transEndEventName = transEndEventNames[Modernizr.prefixed('transition')] + '.rwdmenu', 11665 // support for css animations and css transitions 11666 this.supportAnimations = Modernizr.cssanimations, 11667 this.supportTransitions = Modernizr.csstransitions; 11668 11669 var self = this; 11670 this.clickMenuItem = function (event) { 11671 //if (!menuManager.mobileMainNav) return true; 11672 11673 event.stopPropagation(); 11674 11675 var $li = $(this), 11676 $submenu = $li.children('ol.rwd-submenu'); 11677 11678 if ($submenu.length == 0) { 11679 var id = $li.attr('id'); //.replace(/item|leftItem/i, ''); 11680 var $olSubMenu = menuManager.$divListSubMenus.find('#Parent' + id); 11681 if ($olSubMenu.length > 1) { 11682 //remove duplicates. they might have been added by different menu (main/side) 11683 $olSubMenu.slice(1).remove(); 11684 $olSubMenu = menuManager.$divListSubMenus.find('#Parent' + id); 11685 } 11686 if ($olSubMenu.length == 1) { 11687 var $back = $('<li class="rwd-back"><a href="#" style="z-index:2;" class="navMenuItem backMenuLink" aria-haspopup="true" role="menuitem">Back</a></li>'); 11688 $back.bind('click.rwdmenu', self.clickBack); 11689 $olSubMenu.prepend($back); 11690 $olSubMenu.addClass('rwd-submenu'); 11691 $olSubMenu.find('li:not(.rwd-back)').bind('click.rwdmenu', self.clickMenuItem); 11692 $li.append($olSubMenu); 11693 $submenu = $olSubMenu; 11694 } 11695 } 11696 11697 if ($submenu.length > 0) { 11698 11699 var $flyin = $submenu.clone().css('opacity', 0).insertAfter(self.$menu), 11700 onAnimationEndFn = function () { 11701 self.$menu.unbind(self.animEndEventName).removeClass(self.options.animationClasses.classout).addClass('rwd-subview'); 11702 $('.rwd-subviewopen').children('ol').attr('aria-hidden', 'true'); 11703 $li.addClass('rwd-subviewopen').parents('.rwd-subviewopen:first').removeClass('rwd-subviewopen').addClass('rwd-subview'); 11704 $li.children('ol').attr('aria-hidden', 'false'); 11705 $flyin.remove(); 11706 $li.find('.openThePageLink').focus(); 11707 }; 11708 11709 setTimeout(function () { 11710 $flyin.addClass(self.options.animationClasses.classin); 11711 self.$menu.addClass(self.options.animationClasses.classout); 11712 if (self.supportAnimations) { 11713 self.$menu.bind(self.animEndEventName, onAnimationEndFn); 11714 } else { 11715 onAnimationEndFn.call(); 11716 } 11717 11718 self.options.onLevelClick($li, $li.children('a:first').text()); 11719 });
11720 11721 return false; 11722 11723 } else { 11724 self.options.onLinkClick($li, event); 11725 } 11726 11727 }; 11728 11729 this.clickBack = function (event) { 11730 11731 var $this = $(this), 11732 $submenu = $this.parents('ol.rwd-submenu:first'), 11733 $item = $submenu.parent(), 11734 $flyin = $submenu.clone().insertAfter(self.$menu); 11735 11736 var onAnimationEndFn = function () { 11737 self.$menu.unbind(self.animEndEventName).removeClass(self.options.animationClasses.classin); 11738 $flyin.remove(); 11739 }; 11740 11741 setTimeout(function () { 11742 $flyin.addClass(self.options.animationClasses.classout); 11743 self.$menu.addClass(self.options.animationClasses.classin); 11744 if (self.supportAnimations) { 11745 self.$menu.bind(self.animEndEventName, onAnimationEndFn); 11746 } else { 11747 onAnimationEndFn.call(); 11748 } 11749 11750 $item.removeClass('rwd-subviewopen').children('ol').attr('aria-hidden', 'true'); 11751 11752 var $subview = $this.parents('.rwd-subview:first'); 11753 if ($subview.is('li')) { 11754 $subview.addClass('rwd-subviewopen').children('ol').attr('aria-hidden', 'false'); 11755 } 11756 $subview.removeClass('rwd-subview'); 11757 $('ol#mainNavMenu').find('li > a').first().focus(); 11758 }); 11759 11760 return false; 11761 }; 11762 11763 this._initEvents(); 11764 11765 }, 11766 _config: function () { 11767 this.$menu = this.$el;// this.$el.children('ol.rwd-menu'); 11768 this.$menuitems = this.$menu.find('li.topMenuItem'); 11769 this.$menu.addClass('rwd-menu'); 11770 }, 11771 _initEvents: function () { 11772 11773 var self = this; 11774 11775 this.$menuitems.bind('click.rwdmenu', self.clickMenuItem); 11776 }, 11777 destroy: function () { 11778 //Remove classes, other events, not needed lis (back, to parent) and place back into hidden div. 11779 this.$menu.removeClass('rwd-menu rwd-subview'); 11780 this.$menu.find('li').removeClass('rwd-subviewopen rwd-subview').unbind('.rwdmenu'); 11781 this.$menu.find('li.rwd-back').remove(); 11782 this.$menu.find('li.toParent').remove(); 11783 this.$menu.find('ol').removeClass('rwd-submenu').each(function () { 11784 menuManager.$divListSubMenus.append($(this)); 11785 }); 11786 } 11787 }; 11788 11789 var logError = function (message) { 11790 if (window.console) { 11791 window.console.error(message); 11792 } 11793 }; 11794 11795 $.fn.rwdmenu = function (options) { 11796 if (typeof options === 'string') { 11797 var args = Array.prototype.slice.call(arguments, 1); 11798 this.each(function () { 11799 var instance = $.data(this, 'rwdmenu'); 11800 if (!instance) { 11801 logError("cannot call methods on rwdmenu prior to initialization; " + 11802 "attempted to call method '" + options + "'"); 11803 return; 11804 } 11805 if (!$.isFunction(instance[options]) || options.charAt(0) === "_") { 11806 logError("no such method '" + options + "' for rwdmenu instance"); 11807 return; 11808 } 11809 instance[options].apply(instance, args); 11810 }); 11811 } 11812 else { 11813 this.each(function () { 11814 var instance = $.data(this, 'rwdmenu'); 11815 if (instance) { 11816 instance._init(); 11817 } 11818 else { 11819 instance = $.data(this, 'rwdmenu', new $.RWDMenu(options, this)); 11820 } 11821 }); 11822 } 11823 return this; 11824 }; 11825 11826})(jQuery, window); 11827/*global jQuery:false, alert:false */ 11828 11829/* 11830 * Default text - jQuery plugin for html5 dragging files from desktop to browser 11831 * 11832 * Author: Weixi Yen 11833 * 11834 * Email: [Firstname][Lastname]@gmail.com 11835 * 11836 * Copyright (c) 2010 Resopollution 11837 * 11838 * Licensed under the MIT license: 11839 * http://www.opensource.org/licenses/mit-license.php 11840 * 11841 * Project home: 11842 * http://www.github.com/weixiyen/jquery-filedrop 11843 * 11844 * Version: 0.1.0 11845 * 11846 * Features: 11847 * Allows sending of extra parameters with file. 11848 * Works with Firefox 3.6+ 11849 * Future-compliant with HTML5 spec (will work with Webkit browsers and IE9) 11850 * Usage: 11851 * See README at project homepage 11852 * 11853 */ 11854;(function($) { 11855 11856 var default_opts = { 11857 fallback_id: '', 11858 fallback_dropzoneClick : true, 11859 url: '', 11860 refresh: 1000, 11861 paramname: 'userfile', 11862 requestType: 'POST', // just in case you want to use another HTTP verb 11863 allowedfileextensions:[], 11864 allowedfiletypes:[], 11865 maxfiles: 25, // Ignored if queuefiles is set > 0
11866 maxfilesize: 1, // MB file size limit 11867 queuefiles: 0, // Max files before queueing (for large volume uploads) 11868 queuewait: 200, // Queue wait time if full 11869 data: {}, 11870 headers: {}, 11871 drop: empty, 11872 dragStart: empty, 11873 dragEnter: empty, 11874 dragOver: empty, 11875 dragLeave: empty, 11876 docEnter: empty, 11877 docOver: empty, 11878 docLeave: empty, 11879 beforeEach: empty, 11880 afterAll: empty, 11881 rename: empty, 11882 error: function(err, file, i, status) { 11883 alert(err); 11884 }, 11885 uploadStarted: empty, 11886 uploadFinished: empty, 11887 progressUpdated: empty, 11888 globalProgressUpdated: empty, 11889 speedUpdated: empty 11890 }, 11891 errors = ["BrowserNotSupported", "TooManyFiles", "FileTooLarge", "FileTypeNotAllowed", "NotFound", "NotReadable", "AbortError", "ReadError", "FileExtensionNotAllowed"]; 11892 11893 $.fn.filedrop = function(options) { 11894 var opts = $.extend({}, default_opts, options), 11895 global_progress = [], 11896 doc_leave_timer, stop_loop = false, 11897 files_count = 0, 11898 files; 11899 11900 if ( opts.fallback_id ) 11901 { 11902 if ( opts.fallback_dropzoneClick === true ) 11903 { 11904 $('#' + opts.fallback_id).css({ 11905 display: 'none', 11906 width: 0, 11907 height: 0 11908 }); 11909 } 11910 11911 11912 11913 11914 if ( opts.fallback_dropzoneClick === true ) 11915 { 11916 if ( this.find('#' + opts.fallback_id).length > 0 ) 11917 { 11918 throw "Fallback element ["+opts.fallback_id+"] cannot be inside dropzone, unless option fallback_dropzoneClick is false"; 11919 } 11920 else 11921 { 11922 this.on('click', function(e){ 11923 $('#' + opts.fallback_id).trigger(e); 11924 }); 11925 } 11926 } 11927 11928 $('#' + opts.fallback_id).change(function(e) { 11929 opts.drop(e); 11930 files = e.target.files; 11931 files_count = files.length; 11932 upload(); 11933 }); 11934 } 11935 11936 this.on('drop', drop).on('dragstart', opts.dragStart).on('dragenter', dragEnter).on('dragover', dragOver).on('dragleave', dragLeave); 11937 $(document).on('drop', docDrop).on('dragenter', docEnter).on('dragover', docOver).on('dragleave', docLeave); 11938 11939 function drop(e) { 11940 if( opts.drop.call(this, e) === false ) return false; 11941 if(!e.originalEvent.dataTransfer) 11942 return; 11943 files = e.originalEvent.dataTransfer.files; 11944 if (files === null || files === undefined || files.length === 0) { 11945 opts.error(errors[0]); 11946 return false; 11947 } 11948 files_count = files.length; 11949 upload(); 11950 e.preventDefault(); 11951 return false; 11952 } 11953 11954 function getBuilder(filename, filedata, mime, boundary) { 11955 var dashdash = '--', 11956 crlf = '\r\n', 11957 builder = '', 11958 paramname = opts.paramname; 11959 11960 if (opts.data) { 11961 var params = $.param(opts.data).replace(/\+/g, '%20').split(/&/); 11962 11963 $.each(params, function() { 11964 var pair = this.split("=", 2), 11965 name = decodeURIComponent(pair[0]), 11966 val = decodeURIComponent(pair[1]); 11967 11968 if (pair.length !== 2) { 11969 return; 11970 } 11971 11972 builder += dashdash; 11973 builder += boundary; 11974 builder += crlf; 11975 builder += 'Content-Disposition: form-data; name="' + name + '"'; 11976 builder += crlf; 11977 builder += crlf; 11978 builder += val; 11979 builder += crlf; 11980 }); 11981 } 11982 11983 if (jQuery.isFunction(paramname)){ 11984 paramname = paramname(filename); 11985 } 11986 11987 builder += dashdash; 11988 builder += boundary; 11989 builder += crlf; 11990 builder += 'Content-Disposition: form-data; name="' + (paramname||"") + '"'; 11991 builder += '; filename="' + encodeURIComponent(filename) + '"'; 11992 builder += crlf; 11993 11994 builder += 'Content-Type: ' + mime; 11995 builder += crlf; 11996 builder += crlf; 11997 11998 builder += filedata; 11999 builder += crlf; 12000 12001 builder += dashdash; 12002 builder += boundary; 12003 builder += dashdash; 12004 builder += crlf; 12005 return builder; 12006 } 12007 12008 function progress(e) { 12009 if (e.lengthComputable) { 12010 var percentage = Math.round((e.loaded * 100) / e.total); 12011 if (this.currentProgress !== percentage) { 12012 12013 this.currentProgress = percentage; 12014 opts.progressUpdated(this.index, this.file, this.currentProgress); 12015 12016 global_progress[this.global_progress_index] = this.currentProgress; 12017 globalProgress(); 12018
12019 var elapsed = new Date().getTime(); 12020 var diffTime = elapsed - this.currentStart; 12021 if (diffTime >= opts.refresh) { 12022 var diffData = e.loaded - this.startData; 12023 var speed = diffData / diffTime; // KB per second 12024 opts.speedUpdated(this.index, this.file, speed); 12025 this.startData = e.loaded; 12026 this.currentStart = elapsed; 12027 } 12028 } 12029 } 12030 } 12031 12032 function globalProgress() { 12033 if (global_progress.length === 0) { 12034 return; 12035 } 12036 12037 var total = 0, index; 12038 for (index in global_progress) { 12039 if(global_progress.hasOwnProperty(index)) { 12040 total = total + global_progress[index]; 12041 } 12042 } 12043 12044 opts.globalProgressUpdated(Math.round(total / global_progress.length)); 12045 } 12046 12047 // Respond to an upload 12048 function upload() { 12049 stop_loop = false; 12050 12051 if (!files) { 12052 opts.error(errors[0]); 12053 return false; 12054 } 12055 12056 if (opts.allowedfiletypes.push && opts.allowedfiletypes.length) { 12057 for(var fileIndex = files.length;fileIndex--;) { 12058 if(!files[fileIndex].type || $.inArray(files[fileIndex].type, opts.allowedfiletypes) < 0) { 12059 opts.error(errors[3], files[fileIndex]); 12060 return false; 12061 } 12062 } 12063 } 12064 12065 if (opts.allowedfileextensions.push && opts.allowedfileextensions.length) { 12066 for(var fileIndex = files.length;fileIndex--;) { 12067 var allowedextension = false; 12068 for (i=0;i<opts.allowedfileextensions.length;i++){ 12069 if (files[fileIndex].name.substr(files[fileIndex].name.length-opts.allowedfileextensions[i].length).toLowerCase() 12070 == opts.allowedfileextensions[i].toLowerCase() 12071 ) { 12072 allowedextension = true; 12073 } 12074 } 12075 if (!allowedextension){ 12076 opts.error(errors[8], files[fileIndex]); 12077 return false; 12078 } 12079 } 12080 } 12081 12082 var filesDone = 0, 12083 filesRejected = 0; 12084 12085 if (files_count > opts.maxfiles && opts.queuefiles === 0) { 12086 opts.error(errors[1]); 12087 return false; 12088 } 12089 12090 // Define queues to manage upload process 12091 var workQueue = []; 12092 var processingQueue = []; 12093 var doneQueue = []; 12094 12095 // Add everything to the workQueue 12096 for (var i = 0; i < files_count; i++) { 12097 workQueue.push(i); 12098 } 12099 12100 // Helper function to enable pause of processing to wait 12101 // for in process queue to complete 12102 var pause = function(timeout) { 12103 setTimeout(process, timeout); 12104 return; 12105 }; 12106 12107 // Process an upload, recursive 12108 var process = function() { 12109 12110 var fileIndex; 12111 12112 if (stop_loop) { 12113 return false; 12114 } 12115 12116 // Check to see if are in queue mode 12117 if (opts.queuefiles > 0 && processingQueue.length >= opts.queuefiles) { 12118 return pause(opts.queuewait); 12119 } else { 12120 // Take first thing off work queue 12121 fileIndex = workQueue[0]; 12122 workQueue.splice(0, 1); 12123 12124 // Add to processing queue 12125 processingQueue.push(fileIndex); 12126 } 12127 12128 try { 12129 if (beforeEach(files[fileIndex]) !== false) { 12130 if (fileIndex === files_count) { 12131 return; 12132 } 12133 var reader = new FileReader(), 12134 max_file_size = 1048576 * opts.maxfilesize; 12135 12136 reader.index = fileIndex; 12137 if (files[fileIndex].size > max_file_size) { 12138 opts.error(errors[2], files[fileIndex], fileIndex); 12139 // Remove from queue 12140 processingQueue.forEach(function(value, key) { 12141 if (value === fileIndex) { 12142 processingQueue.splice(key, 1); 12143 } 12144 }); 12145 filesRejected++; 12146 return true; 12147 } 12148 12149 reader.onerror = function(e) { 12150 switch(e.target.error.code) { 12151 case e.target.error.NOT_FOUND_ERR: 12152 opts.error(errors[4]); 12153 return false; 12154 case e.target.error.NOT_READABLE_ERR: 12155 opts.error(errors[5]); 12156 return false; 12157 case e.target.error.ABORT_ERR: 12158 opts.error(errors[6]); 12159 return false; 12160 default: 12161 opts.error(errors[7]); 12162 return false; 12163 }; 12164 }; 12165 12166 reader.onloadend = !opts.beforeSend ? send : function (e) { 12167 opts.beforeSend(files[fileIndex], fileIndex, function () { send(e); }); 12168 }; 12169
12170 reader.readAsDataURL(files[fileIndex]); 12171 12172 } else { 12173 filesRejected++; 12174 } 12175 } catch (err) { 12176 // Remove from queue 12177 processingQueue.forEach(function(value, key) { 12178 if (value === fileIndex) { 12179 processingQueue.splice(key, 1); 12180 } 12181 }); 12182 opts.error(errors[0]); 12183 return false; 12184 } 12185 12186 // If we still have work to do, 12187 if (workQueue.length > 0) { 12188 process(); 12189 } 12190 }; 12191 12192 var send = function(e) { 12193 12194 var fileIndex = (e.srcElement || e.target).index; 12195 12196 // Sometimes the index is not attached to the 12197 // event object. Find it by size. Hack for sure. 12198 if (e.target.index === undefined) { 12199 e.target.index = getIndexBySize(e.total); 12200 } 12201 12202 var xhr = new XMLHttpRequest(), 12203 upload = xhr.upload, 12204 file = files[e.target.index], 12205 index = e.target.index, 12206 start_time = new Date().getTime(), 12207 boundary = '------multipartformboundary' + (new Date()).getTime(), 12208 global_progress_index = global_progress.length, 12209 builder, 12210 newName = rename(file.name), 12211 mime = file.type; 12212 12213 if (opts.withCredentials) { 12214 xhr.withCredentials = opts.withCredentials; 12215 } 12216 12217 var encodedString = e.target.result.split(',')[1]; 12218 var data = encodedString === undefined ? '' : atob(encodedString); 12219 if (typeof newName === "string") { 12220 builder = getBuilder(newName, data, mime, boundary); 12221 } else { 12222 builder = getBuilder(file.name, data, mime, boundary); 12223 } 12224 12225 upload.index = index; 12226 upload.file = file; 12227 upload.downloadStartTime = start_time; 12228 upload.currentStart = start_time; 12229 upload.currentProgress = 0; 12230 upload.global_progress_index = global_progress_index; 12231 upload.startData = 0; 12232 upload.addEventListener("progress", progress, false); 12233 12234 // Allow url to be a method 12235 if (jQuery.isFunction(opts.url)) { 12236 xhr.open(opts.requestType, opts.url(upload), true); 12237 } else { 12238 xhr.open(opts.requestType, opts.url, true); 12239 } 12240 12241 xhr.setRequestHeader('content-type', 'multipart/form-data; boundary=' + boundary); 12242 xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest"); 12243 12244 // Add headers 12245 $.each(opts.headers, function(k, v) { 12246 xhr.setRequestHeader(k, v); 12247 }); 12248 12249 if(!xhr.sendAsBinary){ 12250 xhr.sendAsBinary = function(datastr) { 12251 function byteValue(x) { 12252 return x.charCodeAt(0) & 0xff; 12253 } 12254 var ords = Array.prototype.map.call(datastr, byteValue); 12255 var ui8a = new Uint8Array(ords); 12256 this.send(ui8a.buffer); 12257 } 12258 } 12259 12260 xhr.sendAsBinary(builder); 12261 12262 global_progress[global_progress_index] = 0; 12263 globalProgress(); 12264 12265 opts.uploadStarted(index, file, files_count); 12266 12267 xhr.onload = function() { 12268 var serverResponse = null; 12269 12270 if (xhr.responseText) { 12271 try { 12272 serverResponse = jQuery.parseJSON(xhr.responseText); 12273 } 12274 catch (e) { 12275 serverResponse = xhr.responseText; 12276 } 12277 } 12278 12279 var now = new Date().getTime(), 12280 timeDiff = now - start_time, 12281 result = opts.uploadFinished(index, file, serverResponse, timeDiff, xhr); 12282 filesDone++; 12283 12284 // Remove from processing queue 12285 processingQueue.forEach(function(value, key) { 12286 if (value === fileIndex) { 12287 processingQueue.splice(key, 1); 12288 } 12289 }); 12290 12291 // Add to donequeue 12292 doneQueue.push(fileIndex); 12293 12294 // Make sure the global progress is updated 12295 global_progress[global_progress_index] = 100; 12296 globalProgress(); 12297 12298 if (filesDone === (files_count - filesRejected)) { 12299 afterAll(); 12300 } 12301 if (result === false) { 12302 stop_loop = true; 12303 } 12304 12305 12306 // Pass any errors to the error option 12307 if (xhr.status < 200 || xhr.status > 299) { 12308 opts.error(xhr.statusText, file, fileIndex, xhr.status); 12309 } 12310 }; 12311 }; 12312 12313 // Initiate the processing loop 12314 process(); 12315 } 12316 12317 function getIndexBySize(size) { 12318 for (var i = 0; i < files_count; i++) { 12319 if (files[i].size === size) { 12320 return i; 12321 } 12322 } 12323 12324 return undefined; 12325 } 12326 12327 function rename(name) { 12328 return opts.rename(name); 12329 } 12330 12331 function beforeEach(file) { 12332 return opts.beforeEach(file); 12333 } 12334 12335 function afterAll() { 12336 return opts.afterAll(); 12337 } 12338 12339 function dragEnter(e) { 12340 clearTimeout(doc_leave_timer); 12341 e.preventDefault(); 12342 opts.dragEnter.call(this, e); 12343 } 12344 12345 function dragOver(e) { 12346 clearTimeout(doc_leave_timer); 12347 e.preventDefault(); 12348 opts.docOver.call(this, e); 12349 opts.dragOver.call(this, e); 12350 } 12351 12352 function dragLeave(e) { 12353 clearTimeout(doc_leave_timer); 12354 opts.dragLeave.call(this, e); 12355 e.stopPropagation(); 12356 } 12357 12358 function docDrop(e) { 12359 e.preventDefault(); 12360 opts.docLeave.call(this, e); 12361 return false; 12362 } 12363 12364 function docEnter(e) { 12365 clearTimeout(doc_leave_timer); 12366 e.preventDefault(); 12367 opts.docEnter.call(this, e); 12368 return false; 12369 } 12370 12371 function docOver(e) { 12372 clearTimeout(doc_leave_timer); 12373 e.preventDefault(); 12374 opts.docOver.call(this, e); 12375 return false; 12376 } 12377 12378 function docLeave(e) { 12379 doc_leave_timer = setTimeout((function(_this) { 12380 return function() { 12381 opts.docLeave.call(_this, e); 12382 }; 12383 })(this), 200); 12384 } 12385 12386 return this; 12387 }; 12388 12389 function empty() {} 12390 12391 try { 12392 if (XMLHttpRequest.prototype.sendAsBinary) { 12393 return; 12394 } 12395 XMLHttpRequest.prototype.sendAsBinary = function(datastr) {
12396 function byteValue(x) { 12397 return x.charCodeAt(0) & 0xff; 12398 } 12399 var ords = Array.prototype.map.call(datastr, byteValue); 12400 var ui8a = new Uint8Array(ords); 12401 12402 // Not pretty: Chrome 22 deprecated sending ArrayBuffer, moving instead 12403 // to sending ArrayBufferView. Sadly, no proper way to detect this 12404 // functionality has been discovered. Happily, Chrome 22 also introduced 12405 // the base ArrayBufferView class, not present in Chrome 21. 12406 if ('ArrayBufferView' in window) 12407 this.send(ui8a); 12408 else 12409 this.send(ui8a.buffer); 12410 }; 12411 } catch (e) {} 12412 12413})(jQuery); 12414; 12415/*! 12416 * Javascript Cookie v1.5.1 12417 * https://github.com/js-cookie/js-cookie 12418 * 12419 * Copyright 2006, 2014 Klaus Hartl 12420 * Released under the MIT license 12421 */ 12422(function(n){var i,r,t;if(typeof define=="function"&&define.amd)define(["jquery"],n);else if(typeof exports=="object"){try{i=require("jquery")}catch(u){}module.exports=n(i)}else r=window.Cookies,t=window.Cookies=n(window.jQuery),t.noConflict=function(){return window.Cookies=r,t}})(function(n){function i(n){return t.raw?n:encodeURIComponent(n)}function o(n){return t.raw?n:decodeURIComponent(n)}function s(n){return i(t.json?JSON.stringify(n):String(n))}function h(n){n.indexOf('"')===0&&(n=n.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return n=decodeURIComponent(n.replace(e," ")),t.json?JSON.parse(n):n}catch(i){}}function r(n,i){var r=t.raw?n:h(n);return f(i)?i(r):r}function u(){for(var n,t,i=0,r={};i<arguments.length;i++){t=arguments[i];for(n in t)r[n]=t[n]}return r}function f(n){return Object.prototype.toString.call(n)==="[object Function]"}var e=/\+/g,t=function(n,e,h){var y,l;if(arguments.length>1&&!f(e))return h=u(t.defaults,h),typeof h.expires=="number"&&(y=h.expires,l=h.expires=new Date,l.setMilliseconds(l.getMilliseconds()+y*864e5)),document.cookie=[i(n),"=",s(e),h.expires?"; expires="+h.expires.toUTCString():"",h.path?"; path="+h.path:"",h.domain?"; domain="+h.domain:"",h.secure?"; secure":""].join("");for(var a=n?undefined:{},p=document.cookie?document.cookie.split("; "):[],v=0,k=p.length;v<k;v++){var w=p[v].split("="),b=o(w.shift()),c=w.join("=");if(n===b){a=r(c,e);break}n||(c=r(c))===undefined||(a[b]=c)}return a};return t.get=t.set=t,t.defaults={},t.remove=function(n,i){return t(n,"",u(i,{expires:-1})),!t(n)},n&&(n.cookie=t,n.removeCookie=t.remove),t}); 12423/*! jQuery UI - v1.14.2 - 2026-01-29
vendor: 32,915 bytes, lines 12423-12428
12423 12424* https://jqueryui.com 12425* 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 12426* Copyright OpenJS Foundation and other contributors; Licensed MIT */ 12427 12428!function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)}(function(t){"use strict";t.ui=t.ui||{},t.ui.version="1.14.2";var e,i,s,n,o,a=0,r=Array.prototype.hasOwnProperty,l=Array.prototype.slice;h=t.cleanData,t.cleanData=function(e){var i,s,n;for(n=0;null!=(s=e[n]);n++)(i=t._data(s,"events"))&&i.remove&&t(s).triggerHandler("remove");h(e)},t.widget=function(e,i,s){var n,o,a,r={},l=e.split(".")[0];if("__proto__"===(e=e.split(".")[1])||"constructor"===e)return t.error("Invalid widget name: "+e);var h=l+"-"+e;return s||(s=i,i=t.Widget),Array.isArray(s)&&(s=t.extend.apply(null,[{}].concat(s))),t.expr.pseudos[h.toLowerCase()]=function(e){return!!t.data(e,h)},t[l]=t[l]||{},n=t[l][e],o=t[l][e]=function(t,e){if(!this||!this._createWidget)return new o(t,e);arguments.length&&this._createWidget(t,e)},t.extend(o,n,{version:s.version,_proto:t.extend({},s),_childConstructors:[]}),(a=new i).options=t.widget.extend({},a.options),t.each(s,function(t,e){if("function"!=typeof e){r[t]=e;return}r[t]=function(){function s(){return i.prototype[t].apply(this,arguments)}function n(e){return i.prototype[t].apply(this,e)}return function(){var t,i=this._super,o=this._superApply;return this._super=s,this._superApply=n,t=e.apply(this,arguments),this._super=i,this._superApply=o,t}}()}),o.prototype=t.widget.extend(a,{widgetEventPrefix:n&&a.widgetEventPrefix||e},r,{constructor:o,namespace:l,widgetName:e,widgetFullName:h}),n?(t.each(n._childConstructors,function(e,i){var s=i.prototype;t.widget(s.namespace+"."+s.widgetName,o,i._proto)}),delete n._childConstructors):i._childConstructors.push(o),t.widget.bridge(e,o),o},t.widget.extend=function(e){for(var i,s,n=l.call(arguments,1),o=0,a=n.length;o<a;o++)for(i in n[o])s=n[o][i],r.call(n[o],i)&&void 0!==s&&(t.isPlainObject(s)?e[i]=t.isPlainObject(e[i])?t.widget.extend({},e[i],s):t.widget.extend({},s):e[i]=s);return e},t.widget.bridge=function(e,i){var s=i.prototype.widgetFullName||e;t.fn[e]=function(n){var o="string"==typeof n,a=l.call(arguments,1),r=this;return o?this.length||"instance"!==n?this.each(function(){var i,o=t.data(this,s);return"instance"===n?(r=o,!1):o?"function"!=typeof o[n]||"_"===n.charAt(0)?t.error("no such method '"+n+"' for "+e+" widget instance"):(i=o[n].apply(o,a))!==o&&void 0!==i?(r=i&&i.jquery?r.pushStack(i.get()):i,!1):void 0:t.error("cannot call methods on "+e+" prior to initialization; attempted to call method '"+n+"'")}):r=void 0:(a.length&&(n=t.widget.extend.apply(null,[n].concat(a))),this.each(function(){var e=t.data(this,s);e?(e.option(n||{}),e._init&&e._init()):t.data(this,s,new i(n,this))})),r}},t.Widget=function(){},t.Widget._childConstructors=[],t.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{classes:{},disabled:!1,create:null},_createWidget:function(e,i){i=t(i||this.defaultElement||this)[0],this.element=t(i),this.uuid=a++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=t(),this.hoverable=t(),this.focusable=t(),this.classesElementLookup={},i!==this&&(t.data(i,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===i&&this.destroy()}}),this.document=t(i.style?i.ownerDocument:i.document||i),this.window=t(this.document[0].defaultView||this.document[0].parentWindow)),this.options=t.widget.extend({},this.options,this._getCreateOptions(),e),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){var e=this;this._destroy(),t.each(this.classesElementLookup,function(t,i){e._removeClass(i,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:t.noop,widget:function(){return this.element},option:function(e,i){var s,n,o,a=e;if(0==arguments.length)return t.widget.extend({},this.options);if("string"==typeof e){if(a={},e=(s=e.split(".")).shift(),s.length){for(o=0,n=a[e]=t.widget.extend({},this.options[e]);o<s.length-1;o++)n[s[o]]=n[s[o]]||{},n=n[s[o]];if(e=s.pop(),1==arguments.length)return void 0===n[e]?null:n[e];n[e]=i}else{if(1==arguments.length)return void 0===this.options[e]?null:this.options[e];a[e]=i}}return this._setOptions(a),this},_setOptions:function(t){var e;for(e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return"classes"===t&&this._setOptionClasses(e),this.options[t]=e,"disabled"===t&&this._setOptionDisabled(e),this},_setOptionClasses:function(e){var i,s,n;for(i in e)n=this.classesElementLookup[i],e[i]!==this.options.classes[i]&&n&&n.length&&(s=t(n.get()),this._removeClass(n,i),s.addClass(this._classes({element:s,keys:i,classes:e,add:!0})))},_setOptionDisabled:function(t){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!t),t&&(this._removeClass(this.hoverable,null,"ui-state-hover"),this._removeClass(this.focusable,null,"ui-state-focus"))},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_classes:function(e){var i=[],s=this;function n(n,o){var a,r;for(r=0;r<n.length;r++)a=s.classesElementLookup[n[r]]||t(),e.add?(function(){var i=[];e.element.each(function(e,n){t.map(s.classesElementLookup,function(t){return t}).some(function(t){return t.is(n)})||i.push(n)}),s._on(t(i),{remove:"_untrackClassesElement"})}(),a=t(t.uniqueSort(a.get().concat(e.element.get())))):a=t(a.not(e.element).get()),s.classesElementLookup[n[r]]=a,i.push(n[r]),o&&e.classes[n[r]]&&i.push(e.classes[n[r]])}return(e=t.extend({element:this.element,classes:this.options.classes||{}},e)).keys&&n(e.keys.match(/\S+/g)||[],!0),e.extra&&n(e.extra.match(/\S+/g)||[]),i.join(" ")},_untrackClassesElement:function(e){var i=this;t.each(i.classesElementLookup,function(s,n){-1!==t.inArray(e.target,n)&&(i.classesElementLookup[s]=t(n.not(e.target).get()))}),this._off(t(e.target))},_removeClass:function(t,e,i){return this._toggleClass(t,e,i,!1)},_addClass:function(t,e,i){return this._toggleClass(t,e,i,!0)},_toggleClass:function(t,e,i,s){s="boolean"==typeof s?s:i;var n="string"==typeof t||null===t,o={extra:n?e:i,keys:n?t:e,element:n?this.element:t,add:s};return o.element.toggleClass(this._classes(o),s),this},_on:function(e,i,s){var n,o=this;"boolean"!=typeof e&&(s=i,i=e,e=!1),s?(i=n=t(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,n=this.widget()),t.each(s,function(s,a){function r(){if(!(!e&&(!0===o.options.disabled||t(this).hasClass("ui-state-disabled"))))return("string"==typeof a?o[a]:a).apply(o,arguments)}"string"!=typeof a&&(r.guid=a.guid=a.guid||r.guid||t.guid++);var l=s.match(/^([\w:-]*)\s*(.*)$/),h=l[1]+o.eventNamespace,c=l[2];c?n.on(h,c,r):i.on(h,r)})},_off:function(e,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.off(i),this.bindings=t(this.bindings.not(e).get()),this.focusable=t(this.focusable.not(e).get()),this.hoverable=t(this.hoverable.not(e).get())},_delay:function(t,e){var i=this;return setTimeout(function(){return("string"==typeof t?i[t]:t).apply(i,arguments)},e||0)},_hoverable:function(e){this.hoverable=this.hoverable.add(e),this._on(e,{mouseenter:function(e){this._addClass(t(e.currentTarget),null,"ui-state-hover")},mouseleave:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-hover")}})},_focusable:function(e){this.focusable=this.focusable.add(e),this._on(e,{focusin:function(e){this._addClass(t(e.currentTarget),null,"ui-state-focus")},focusout:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-focus")}})},_trigger:function(e,i,s){var n,o,a=this.options[e];if(s=s||{},(i=t.Event(i)).type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase(),i.target=this.element[0],o=i.originalEvent)for(n in o)n in i||(i[n]=o[n]);return this.element.trigger(i,s),!("function"==typeof a&&!1===a.apply(this.element[0],[i].concat(s))||i.isDefaultPrevented())}},t.each({show:"fadeIn",hide:"fadeOut"},function(e,i){t.Widget.prototype["_"+e]=function(s,n,o){"string"==typeof n&&(n={effect:n});var a,r=n?!0===n||"number"==typeof n?i:n.effect||i:e;"number"==typeof(n=n||{})?n={duration:n}:!0===n&&(n={}),a=!t.isEmptyObject(n),n.complete=o,n.delay&&s.delay(n.delay),a&&t.effects&&t.effects.effect[r]?s[e](n):r!==e&&s[r]?s[r](n.duration,n.easing,o):s.queue(function(i){t(this)[e](),o&&o.call(s[0]),i()})}}),t.widget,function(){var e,i=Math.max,s=Math.abs,n=/left|center|right/,o=/top|center|bottom/,a=/[\+\-]\d+(\.[\d]+)?%?/,r=/^\w+/,l=/%$/,h=t.fn.position;function c(t,e,i){return[parseFloat(t[0])*(l.test(t[0])?e/100:1),parseFloat(t[1])*(l.test(t[1])?i/100:1)]}function u(e,i){return parseInt(t.css(e,i),10)||0}function d(t){return null!=t&&t===t.window}t.position={scrollbarWidth:function(){if(void 0!==e)return e;var i,s,n=t("<div style='display:block;position:absolute;width:200px;height:200px;overflow:hidden;'><div style='height:300px;width:auto;'></div></div>"),o=n.children()[0];return t("body").append(n),i=o.offsetWidth,n.css("overflow","scroll"),i===(s=o.offsetWidth)&&(s=n[0].clientWidth),n.remove(),e=i-s},getScrollInfo:function(e){var i=e.isWindow||e.isDocument?"":e.element.css("overflow-x"),s=e.isWindow||e.isDocument?"":e.element.css("overflow-y"),n="scroll"===i||"auto"===i&&e.width<e.element[0].scrollWidth;return{width:"scroll"===s||"auto"===s&&e.height<e.element[0].scrollHeight?t.position.scrollbarWidth():0,height:n?t.position.scrollbarWidth():0}},getWithinInfo:function(e){var i=t(e||window),s=d(i[0]),n=!!i[0]&&9===i[0].nodeType;return{element:i,isWindow:s,isDocument:n,offset:s||n?{left:0,top:0}:t(e).offset(),scrollLeft:i.scrollLeft(),scrollTop:i.scrollTop(),width:i.outerWidth(),height:i.outerHeight()}}},t.fn.position=function(e){if(!e||!e.of)return h.apply(this,arguments);var l,p,f,g,m,_,v,b="string"==typeof(e=t.extend({},e)).of?t(document).find(e.of):t(e.of),y=t.position.getWithinInfo(e.within),w=t.position.getScrollInfo(y),x=(e.collision||"flip").split(" "),k={};return v=9===(l=b[0]).nodeType?{width:b.width(),height:b.height(),offset:{top:0,left:0}}:d(l)?{width:b.width(),height:b.height(),offset:{top:b.scrollTop(),left:b.scrollLeft()}}:l.preventDefault?{width:0,height:0,offset:{top:l.pageY,left:l.pageX}}:{width:b.outerWidth(),height:b.outerHeight(),offset:b.offset()},b[0].preventDefault&&(e.at="left top"),f=v.width,g=v.height,m=v.offset,_=t.extend({},m),t.each(["my","at"],function(){var t,i,s=(e[this]||"").split(" ");1===s.length&&(s=n.test(s[0])?s.concat(["center"]):o.test(s[0])?["center"].concat(s):["center","center"]),s[0]=n.test(s[0])?s[0]:"center",s[1]=o.test(s[1])?s[1]:"center",t=a.exec(s[0]),i=a.exec(s[1]),k[this]=[t?t[0]:0,i?i[0]:0],e[this]=[r.exec(s[0])[0],r.exec(s[1])[0]]}),1===x.length&&(x[1]=x[0]),"right"===e.at[0]?_.left+=f:"center"===e.at[0]&&(_.left+=f/2),"bottom"===e.at[1]?_.top+=g:"center"===e.at[1]&&(_.top+=g/2),p=c(k.at,f,g),_.left+=p[0],_.top+=p[1],this.each(function(){var n,o,a=t(this),r=a.outerWidth(),l=a.outerHeight(),h=u(this,"marginLeft"),d=u(this,"marginTop"),v=r+h+u(this,"marginRight")+w.width,C=l+d+u(this,"marginBottom")+w.height,D=t.extend({},_),I=c(k.my,a.outerWidth(),a.outerHeight());"right"===e.my[0]?D.left-=r:"center"===e.my[0]&&(D.left-=r/2),"bottom"===e.my[1]?D.top-=l:"center"===e.my[1]&&(D.top-=l/2),D.left+=I[0],D.top+=I[1],n={marginLeft:h,marginTop:d},t.each(["left","top"],function(i,s){t.ui.position[x[i]]&&t.ui.position[x[i]][s](D,{targetWidth:f,targetHeight:g,elemWidth:r,elemHeight:l,collisionPosition:n,collisionWidth:v,collisionHeight:C,offset:[p[0]+I[0],p[1]+I[1]],my:e.my,at:e.at,within:y,elem:a})}),e.using&&(o=function(t){var n=m.left-D.left,o=n+f-r,h=m.top-D.top,c=h+g-l,u={target:{element:b,left:m.left,top:m.top,width:f,height:g},element:{element:a,left:D.left,top:D.top,width:r,height:l},horizontal:o<0?"left":n>0?"right":"center",vertical:c<0?"top":h>0?"bottom":"middle"};f<r&&s(n+o)<f&&(u.horizontal="center"),g<l&&s(h+c)<g&&(u.vertical="middle"),i(s(n),s(o))>i(s(h),s(c))?u.important="horizontal":u.important="vertical",e.using.call(this,t,u)}),a.offset(t.extend(D,{using:o}))})},t.ui.position={fit:{left:function(t,e){var s,n=e.within,o=n.isWindow?n.scrollLeft:n.offset.left,a=n.width,r=t.left-e.collisionPosition.marginLeft,l=o-r,h=r+e.collisionWidth-a-o;e.collisionWidth>a?l>0&&h<=0?(s=t.left+l+e.collisionWidth-a-o,t.left+=l-s):h>0&&l<=0?t.left=o:l>h?t.left=o+a-e.collisionWidth:t.left=o:l>0?t.left+=l:h>0?t.left-=h:t.left=i(t.left-r,t.left)},top:function(t,e){var s,n=e.within,o=n.isWindow?n.scrollTop:n.offset.top,a=e.within.height,r=t.top-e.collisionPosition.marginTop,l=o-r,h=r+e.collisionHeight-a-o;e.collisionHeight>a?l>0&&h<=0?(s=t.top+l+e.collisionHeight-a-o,t.top+=l-s):h>0&&l<=0?t.top=o:l>h?t.top=o+a-e.collisionHeight:t.top=o:l>0?t.top+=l:h>0?t.top-=h:t.top=i(t.top-r,t.top)}},flip:{left:function(t,e){var i,n,o=e.within,a=o.offset.left+o.scrollLeft,r=o.width,l=o.isWindow?o.scrollLeft:o.offset.left,h=t.left-e.collisionPosition.marginLeft,c=h-l,u=h+e.collisionWidth-r-l,d="left"===e.my[0]?-e.elemWidth:"right"===e.my[0]?e.elemWidth:0,p="left"===e.at[0]?e.targetWidth:"right"===e.at[0]?-e.targetWidth:0,f=-2*e.offset[0];c<0?((i=t.left+d+p+f+e.collisionWidth-r-a)<0||i<s(c))&&(t.left+=d+p+f):u>0&&((n=t.left-e.collisionPosition.marginLeft+d+p+f-l)>0||s(n)<u)&&(t.left+=d+p+f)},top:function(t,e){var i,n,o=e.within,a=o.offset.top+o.scrollTop,r=o.height,l=o.isWindow?o.scrollTop:o.offset.top,h=t.top-e.collisionPosition.marginTop,c=h-l,u=h+e.collisionHeight-r-l,d="top"===e.my[1]?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,p="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,f=-2*e.offset[1];c<0?((n=t.top+d+p+f+e.collisionHeight-r-a)<0||n<s(c))&&(t.top+=d+p+f):u>0&&((i=t.top-e.collisionPosition.marginTop+d+p+f-l)>0||s(i)<u)&&(t.top+=d+p+f)}},flipfit:{left:function(){t.ui.position.flip.left.apply(this,arguments),t.ui.position.fit.left.apply(this,arguments)},top:function(){t.ui.position.flip.top.apply(this,arguments),t.ui.position.fit.top.apply(this,arguments)}}}}(),t.ui.position,t.extend(t.expr.pseudos,{data:t.expr.createPseudo(function(e){return function(i){return!!t.data(i,e)}})}),t.fn.extend({disableSelection:(c="onselectstart"in document.createElement("div")?"selectstart":"mousedown",function(){return this.on(c+".ui-disableSelection",function(t){t.preventDefault()})}),enableSelection:function(){return this.off(".ui-disableSelection")}});var h,c,u,d={},p=d.toString,f=/^([\-+])=\s*(\d+\.?\d*)/,g=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(t){return[t[1],t[2],t[3],t[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(t){return[2.55*t[1],2.55*t[2],2.55*t[3],t[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})?/,parse:function(t){return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16),t[4]?(parseInt(t[4],16)/255).toFixed(2):1]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])([a-f0-9])?/,parse:function(t){return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),t[4]?(parseInt(t[4]+t[4],16)/255).toFixed(2):1]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(t){return[t[1],t[2]/100,t[3]/100,t[4]]}}],m=t.Color=function(e,i,s,n){return new t.Color.fn.parse(e,i,s,n)},_={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},v={byte:{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},b=t.each;function y(t){return null==t?t+"":"object"==typeof t?d[p.call(t)]||"object":typeof t}function w(t,e,i){var s=v[e.type]||{};return null==t?i||!e.def?null:e.def:(t=s.floor?~~t:parseFloat(t),s.mod)?(t+s.mod)%s.mod:Math.min(s.max,Math.max(0,t))}function x(e){var i=m(),s=i._rgba=[];return(e=e.toLowerCase(),b(g,function(t,n){var o,a=n.re.exec(e),r=a&&n.parse(a),l=n.space||"rgba";if(r)return o=i[l](r),i[_[l].cache]=o[_[l].cache],s=i._rgba=o._rgba,!1}),s.length)?("0,0,0,0"===s.join()&&t.extend(s,u.transparent),i):u[e]}function k(t,e,i){return 6*(i=(i+1)%1)<1?t+(e-t)*i*6:2*i<1?e:3*i<2?t+(e-t)*(2/3-i)*6:t}b(_,function(t,e){e.cache="_"+t,e.props.alpha={idx:3,type:"percent",def:1}}),t.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(t,e){d["[object "+e+"]"]=e.toLowerCase()}),m.fn=t.extend(m.prototype,{parse:function(e,i,s,n){if(void 0===e)return this._rgba=[null,null,null,null],this;(e.jquery||e.nodeType)&&(e=t(e).css(i),i=void 0);var o=this,a=y(e),r=this._rgba=[];return(void 0!==i&&(e=[e,i,s,n],a="array"),"string"===a)?this.parse(x(e)||u._default):"array"===a?(b(_.rgba.props,function(t,i){r[i.idx]=w(e[i.idx],i)}),this):"object"===a?(e instanceof m?b(_,function(t,i){e[i.cache]&&(o[i.cache]=e[i.cache].slice())}):b(_,function(i,s){var n=s.cache;b(s.props,function(t,i){if(!o[n]&&s.to){if("alpha"===t||null==e[t])return;o[n]=s.to(o._rgba)}o[n][i.idx]=w(e[t],i,!0)}),o[n]&&0>t.inArray(null,o[n].slice(0,3))&&(null==o[n][3]&&(o[n][3]=1),s.from&&(o._rgba=s.from(o[n])))}),this):void 0},is:function(t){var e=m(t),i=!0,s=this;return b(_,function(t,n){var o,a=e[n.cache];return a&&(o=s[n.cache]||n.to&&n.to(s._rgba)||[],b(n.props,function(t,e){if(null!=a[e.idx])return i=a[e.idx]===o[e.idx]})),i}),i},_space:function(){var t=[],e=this;return b(_,function(i,s){e[s.cache]&&t.push(i)}),t.pop()},transition:function(t,e){var i=m(t),s=i._space(),n=_[s],o=0===this.alpha()?m("transparent"):this,a=o[n.cache]||n.to(o._rgba),r=a.slice();return i=i[n.cache],b(n.props,function(t,s){var n=s.idx,o=a[n],l=i[n],h=v[s.type]||{};null!==l&&(null===o?r[n]=l:(h.mod&&(l-o>h.mod/2?o+=h.mod:o-l>h.mod/2&&(o-=h.mod)),r[n]=w((l-o)*e+o,s)))}),this[s](r)},blend:function(e){if(1===this._rgba[3])return this;var i=this._rgba.slice(),s=i.pop(),n=m(e)._rgba;return m(t.map(i,function(t,e){return(1-s)*n[e]+s*t}))},toRgbaString:function(){var e="rgba(",i=t.map(this._rgba,function(t,e){return null!=t?t:+(e>2)});return 1===i[3]&&(i.pop(),e="rgb("),e+i.join(", ")+")"},toHslaString:function(){var e="hsla(",i=t.map(this.hsla(),function(t,e){return null==t&&(t=+(e>2)),e&&e<3&&(t=Math.round(100*t)+"%"),t});return 1===i[3]&&(i.pop(),e="hsl("),e+i.join(", ")+")"},toHexString:function(e){var i=this._rgba.slice(),s=i.pop();return e&&i.push(~~(255*s)),"#"+t.map(i,function(t){return("0"+(t||0).toString(16)).substr(-2)}).join("")},toString:function(){return this.toRgbaString()}}),m.fn.parse.prototype=m.fn,_.hsla.to=function(t){if(null==t[0]||null==t[1]||null==t[2])return[null,null,null,t[3]];var e,i=t[0]/255,s=t[1]/255,n=t[2]/255,o=t[3],a=Math.max(i,s,n),r=Math.min(i,s,n),l=a-r,h=a+r,c=.5*h;return[Math.round(r===a?0:i===a?60*(s-n)/l+360:s===a?60*(n-i)/l+120:60*(i-s)/l+240)%360,0===l?0:c<=.5?l/h:l/(2-h),c,null==o?1:o]},_.hsla.from=function(t){if(null==t[0]||null==t[1]||null==t[2])return[null,null,null,t[3]];var e=t[0]/360,i=t[1],s=t[2],n=t[3],o=s<=.5?s*(1+i):s+i-s*i,a=2*s-o;return[Math.round(255*k(a,o,e+1/3)),Math.round(255*k(a,o,e)),Math.round(255*k(a,o,e-1/3)),n]},b(_,function(t,e){var i=e.props,s=e.cache,n=e.to,o=e.from;m.fn[t]=function(t){if(n&&!this[s]&&(this[s]=n(this._rgba)),void 0===t)return this[s].slice();var e,a=y(t),r="array"===a||"object"===a?t:arguments,l=this[s].slice();return(b(i,function(t,e){var i=r["object"===a?t:e.idx];null==i&&(i=l[e.idx]),l[e.idx]=w(i,e)}),o)?((e=m(o(l)))[s]=l,e):m(l)},b(i,function(e,i){!m.fn[e]&&(m.fn[e]=function(s){var n,o,a,r,l=y(s);return(o=(n=this[r="alpha"===e?this._hsla?"hsla":"rgba":t]())[i.idx],"undefined"===l)?o:("function"===l&&(l=y(s=s.call(this,o))),null==s&&i.empty)?this:("string"===l&&(a=f.exec(s))&&(s=o+parseFloat(a[2])*("+"===a[1]?1:-1)),n[i.idx]=s,this[r](n))})})}),m.hook=function(e){b(e.split(" "),function(e,i){t.cssHooks[i]={set:function(t,e){var s;"transparent"!==e&&("string"!==y(e)||(s=x(e)))&&(e=(e=m(s||e)).toRgbaString()),t.style[i]=e}},t.fx.step[i]=function(e){e.colorInit||(e.start=m(e.elem,i),e.end=m(e.end),e.colorInit=!0),t.cssHooks[i].set(e.elem,e.start.transition(e.end,e.pos))}})},m.hook("backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor"),t.cssHooks.borderColor={expand:function(t){var e={};return b(["Top","Right","Bottom","Left"],function(i,s){e["border"+s+"Color"]=t}),e}},u=t.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"};var C="ui-effects-",D="ui-effects-style",I="ui-effects-animated";t.effects={effect:{}},function(){var e,i,s,n=["add","remove","toggle"],o={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};function a(t){var e,i,s=t.ownerDocument.defaultView.getComputedStyle(t),n={};i=s.length;while(i--)e=s[i],"string"==typeof s[e]&&(n[e.replace(/-([\da-z])/gi,function(t,e){return e.toUpperCase()})]=s[e]);return n}t.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(e,i){t.fx.step[i]=function(e){("none"===e.end||e.setAttr)&&(1!==e.pos||e.setAttr)||(t.style(e.elem,i,e.end),e.setAttr=!0)}}),t.effects.animateClass=function(e,i,s,r){var l=t.speed(i,s,r);return this.queue(function(){var i,s=t(this),r=s.attr("class")||"",h=l.children?s.find("*").addBack():s;h=h.map(function(){return{el:t(this),start:a(this)}}),(i=function(){t.each(n,function(t,i){e[i]&&s[i+"Class"](e[i])})})(),h=h.map(function(){return this.end=a(this.el[0]),this.diff=function(e,i){var s,n,a={};for(s in i)n=i[s],e[s]===n||o[s]||!t.fx.step[s]&&isNaN(parseFloat(n))||(a[s]=n);return a}(this.start,this.end),this}),s.attr("class",r),h=h.map(function(){var e=this,i=t.Deferred(),s=t.extend({},l,{queue:!1,complete:function(){i.resolve(e)}});return this.el.animate(this.diff,s),i.promise()}),t.when.apply(t,h.get()).done(function(){i(),t.each(arguments,function(){var e=this.el;t.each(this.diff,function(t){e.css(t,"")})}),l.complete.call(s[0])})})},t.fn.extend({addClass:(e=t.fn.addClass,function(i,s,n,o){return s?t.effects.animateClass.call(this,{add:i},s,n,o):e.apply(this,arguments)}),removeClass:(i=t.fn.removeClass,function(e,s,n,o){return arguments.length>1?t.effects.animateClass.call(this,{remove:e},s,n,o):i.apply(this,arguments)}),toggleClass:(s=t.fn.toggleClass,function(e,i,n,o,a){return"boolean"!=typeof i&&void 0!==i?t.effects.animateClass.call(this,{toggle:e},i,n,o):n?t.effects.animateClass.call(this,i?{add:e}:{remove:e},n,o,a):s.apply(this,arguments)}),switchClass:function(e,i,s,n,o){return t.effects.animateClass.call(this,{add:i,remove:e},s,n,o)}})}(),function(){var e,i,s,n;function o(e,i,s,n){return t.isPlainObject(e)&&(i=e,e=e.effect),e={effect:e},null==i&&(i={}),"function"==typeof i&&(n=i,s=null,i={}),("number"==typeof i||t.fx.speeds[i])&&(n=s,s=i,i={}),"function"==typeof s&&(n=s,s=null),i&&t.extend(e,i),s=s||i.duration,e.duration=t.fx.off?0:"number"==typeof s?s:s in t.fx.speeds?t.fx.speeds[s]:t.fx.speeds._default,e.complete=n||i.complete,e}function a(e){return!e||"number"==typeof e||!!t.fx.speeds[e]||"string"==typeof e&&!t.effects.effect[e]||"function"==typeof e||"object"==typeof e&&!e.effect}function r(t,e){var i=e.outerWidth(),s=e.outerHeight(),n=/^rect\((-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto)\)$/.exec(t)||["",0,i,s,0];return{top:parseFloat(n[1])||0,right:"auto"===n[2]?i:parseFloat(n[2]),bottom:"auto"===n[3]?s:parseFloat(n[3]),left:parseFloat(n[4])||0}}t.expr&&t.expr.pseudos&&t.expr.pseudos.animated&&(t.expr.pseudos.animated=(e=t.expr.pseudos.animated,function(i){return!!t(i).data(I)||e(i)})),!0===t.uiBackCompat&&t.extend(t.effects,{save:function(t,e){for(var i=0,s=e.length;i<s;i++)null!==e[i]&&t.data(C+e[i],t[0].style[e[i]])},restore:function(t,e){for(var i,s=0,n=e.length;s<n;s++)null!==e[s]&&(i=t.data(C+e[s]),t.css(e[s],i))},setMode:function(t,e){return"toggle"===e&&(e=t.is(":hidden")?"show":"hide"),e},createWrapper:function(e){if(e.parent().is(".ui-effects-wrapper"))return e.parent();var i={width:e.outerWidth(!0),height:e.outerHeight(!0),float:e.css("float")},s=t("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),n={width:e.width(),height:e.height()},o=document.activeElement;try{o.id}catch(t){o=document.body}return e.wrap(s),(e[0]===o||t.contains(e[0],o))&&t(o).trigger("focus"),s=e.parent(),"static"===e.css("position")?(s.css({position:"relative"}),e.css({position:"relative"})):(t.extend(i,{position:e.css("position"),zIndex:e.css("z-index")}),t.each(["top","left","bottom","right"],function(t,s){i[s]=e.css(s),isNaN(parseInt(i[s],10))&&(i[s]="auto")}),e.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),e.css(n),s.css(i).show()},removeWrapper:function(e){var i=document.activeElement;return e.parent().is(".ui-effects-wrapper")&&(e.parent().replaceWith(e),(e[0]===i||t.contains(e[0],i))&&t(i).trigger("focus")),e}}),t.extend(t.effects,{version:"1.14.2",define:function(e,i,s){return s||(s=i,i="effect"),t.effects.effect[e]=s,t.effects.effect[e].mode=i,s},scaledDimensions:function(t,e,i){if(0===e)return{height:0,width:0,outerHeight:0,outerWidth:0};var s="horizontal"!==i?(e||100)/100:1,n="vertical"!==i?(e||100)/100:1;return{height:t.height()*n,width:t.width()*s,outerHeight:t.outerHeight()*n,outerWidth:t.outerWidth()*s}},clipToBox:function(t){return{width:t.clip.right-t.clip.left,height:t.clip.bottom-t.clip.top,left:t.clip.left,top:t.clip.top}},unshift:function(t,e,i){var s=t.queue();e>1&&s.splice.apply(s,[1,0].concat(s.splice(e,i))),t.dequeue()},saveStyle:function(t){t.data(D,t[0].style.cssText)},restoreStyle:function(t){t[0].style.cssText=t.data(D)||"",t.removeData(D)},mode:function(t,e){var i=t.is(":hidden");return"toggle"===e&&(e=i?"show":"hide"),(i?"hide"===e:"show"===e)&&(e="none"),e},getBaseline:function(t,e){var i,s;switch(t[0]){case"top":i=0;break;case"middle":i=.5;break;case"bottom":i=1;break;default:i=t[0]/e.height}switch(t[1]){case"left":s=0;break;case"center":s=.5;break;case"right":s=1;break;default:s=t[1]/e.width}return{x:s,y:i}},createPlaceholder:function(e){var i,s=e.css("position"),n=e.position();return e.css({marginTop:e.css("marginTop"),marginBottom:e.css("marginBottom"),marginLeft:e.css("marginLeft"),marginRight:e.css("marginRight")}).outerWidth(e.outerWidth()).outerHeight(e.outerHeight()),/^(static|relative)/.test(s)&&(s="absolute",i=t("<"+e[0].nodeName+">").insertAfter(e).css({display:/^(inline|ruby)/.test(e.css("display"))?"inline-block":"block",visibility:"hidden",marginTop:e.css("marginTop"),marginBottom:e.css("marginBottom"),marginLeft:e.css("marginLeft"),marginRight:e.css("marginRight"),float:e.css("float")}).outerWidth(e.outerWidth()).outerHeight(e.outerHeight()).addClass("ui-effects-placeholder"),e.data(C+"placeholder",i)),e.css({position:s,left:n.left,top:n.top}),i},removePlaceholder:function(t){var e=C+"placeholder",i=t.data(e);i&&(i.remove(),t.removeData(e))},cleanUp:function(e){t.effects.restoreStyle(e),t.effects.removePlaceholder(e)},setTransition:function(e,i,s,n){return n=n||{},t.each(i,function(t,i){var o=e.cssUnit(i);o[0]>0&&(n[i]=o[0]*s+o[1])}),n}}),t.fn.extend({effect:function(){var e=o.apply(this,arguments),i=t.effects.effect[e.effect],s=i.mode,n=e.queue,a=n||"fx",r=e.complete,l=e.mode,h=[],c=function(e){var i=t(this),n=t.effects.mode(i,l)||s;i.data(I,!0),h.push(n),s&&("show"===n||n===s&&"hide"===n)&&i.show(),s&&"none"===n||t.effects.saveStyle(i),"function"==typeof e&&e()};if(t.fx.off||!i)return l?this[l](e.duration,r):this.each(function(){r&&r.call(this)});function u(n){var o=t(this);function a(){"function"==typeof r&&r.call(o[0]),"function"==typeof n&&n()}e.mode=h.shift(),!0!==t.uiBackCompat||s?"none"===e.mode?(o[l](),a()):i.call(o[0],e,function(){o.removeData(I),t.effects.cleanUp(o),"hide"===e.mode&&o.hide(),a()}):(o.is(":hidden")?"hide"===l:"show"===l)?(o[l](),a()):i.call(o[0],e,a)}return!1===n?this.each(c).each(u):this.queue(a,c).queue(a,u)},show:(i=t.fn.show,function(t){if(a(t))return i.apply(this,arguments);var e=o.apply(this,arguments);return e.mode="show",this.effect.call(this,e)}),hide:(s=t.fn.hide,function(t){if(a(t))return s.apply(this,arguments);var e=o.apply(this,arguments);return e.mode="hide",this.effect.call(this,e)}),toggle:(n=t.fn.toggle,function(t){if(a(t)||"boolean"==typeof t)return n.apply(this,arguments);var e=o.apply(this,arguments);return e.mode="toggle",this.effect.call(this,e)}),cssUnit:function(e){var i=this.css(e),s=[];return t.each(["em","px","%","pt"],function(t,e){i.indexOf(e)>0&&(s=[parseFloat(i),e])}),s},cssClip:function(t){return t?this.css("clip","rect("+t.top+"px "+t.right+"px "+t.bottom+"px "+t.left+"px)"):r(this.css("clip"),this)},transfer:function(e,i){var s=t(this),n=t(e.to),o="fixed"===n.css("position"),a=t("body"),r=o?a.scrollTop():0,l=o?a.scrollLeft():0,h=n.offset(),c={top:h.top-r,left:h.left-l,height:n.innerHeight(),width:n.innerWidth()},u=s.offset(),d=t("<div class='ui-effects-transfer'></div>");d.appendTo("body").addClass(e.className).css({top:u.top-r,left:u.left-l,height:s.innerHeight(),width:s.innerWidth(),position:o?"fixed":"absolute"}).animate(c,e.duration,e.easing,function(){d.remove(),"function"==typeof i&&i()})}}),t.fx.step.clip=function(e){e.clipInit||(e.start=t(e.elem).cssClip(),"string"==typeof e.end&&(e.end=r(e.end,e.elem)),e.clipInit=!0),t(e.elem).cssClip({top:e.pos*(e.end.top-e.start.top)+e.start.top,right:e.pos*(e.end.right-e.start.right)+e.start.right,bottom:e.pos*(e.end.bottom-e.start.bottom)+e.start.bottom,left:e.pos*(e.end.left-e.start.left)+e.start.left})}}(),e={},t.each(["Quad","Cubic","Quart","Quint","Expo"],function(t,i){e[i]=function(e){return Math.pow(e,t+2)}}),t.extend(e,{Sine:function(t){return 1-Math.cos(t*Math.PI/2)},Circ:function(t){return 1-Math.sqrt(1-t*t)},Elastic:function(t){return 0===t||1===t?t:-Math.pow(2,8*(t-1))*Math.sin(((t-1)*80-7.5)*Math.PI/15)},Back:function(t){return t*t*(3*t-2)},Bounce:function(t){var e,i=4;while(t<((e=Math.pow(2,--i))-1)/11);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*e-2)/22-t,2)}}),t.each(e,function(e,i){t.easing["easeIn"+e]=i,t.easing["easeOut"+e]=function(t){return 1-i(1-t)},t.easing["easeInOut"+e]=function(t){return t<.5?i(2*t)/2:1-i(-2*t+2)/2}});var n=t.effects;t.effects.define("blind","hide",function(e,i){var s={up:["bottom","top"],vertical:["bottom","top"],down:["top","bottom"],left:["right","left"],horizontal:["right","left"],right:["left","right"]},n=t(this),o=e.direction||"up",a=n.cssClip(),r={clip:t.extend({},a)},l=t.effects.createPlaceholder(n);r.clip[s[o][0]]=r.clip[s[o][1]],"show"===e.mode&&(n.cssClip(r.clip),l&&l.css(t.effects.clipToBox(r)),r.clip=a),l&&l.animate(t.effects.clipToBox(r),e.duration,e.easing),n.animate(r,{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("bounce",function(e,i){var s,n,o,a=t(this),r=e.mode,l="hide"===r,h="show"===r,c=e.direction||"up",u=e.distance,d=e.times||5,p=2*d+(h||l?1:0),f=e.duration/p,g=e.easing,m="up"===c||"down"===c?"top":"left",_="up"===c||"left"===c,v=0,b=a.queue().length;for(t.effects.createPlaceholder(a),o=a.css(m),u||(u=a["top"===m?"outerHeight":"outerWidth"]()/3),h&&((n={opacity:1})[m]=o,a.css("opacity",0).css(m,_?-(2*u):2*u).animate(n,f,g)),l&&(u/=Math.pow(2,d-1)),(n={})[m]=o;v<d;v++)(s={})[m]=(_?"-=":"+=")+u,a.animate(s,f,g).animate(n,f,g),u=l?2*u:u/2;l&&((s={opacity:0}
vendor: 4,374 bytes, line 12428
12428)[m]=(_?"-=":"+=")+u,a.animate(s,f,g)),a.queue(i),t.effects.unshift(a,b,p+1)}),t.effects.define("clip","hide",function(e,i){var s,n={},o=t(this),a=e.direction||"vertical",r="both"===a,l=r||"horizontal"===a,h=r||"vertical"===a;s=o.cssClip(),n.clip={top:h?(s.bottom-s.top)/2:s.top,right:l?(s.right-s.left)/2:s.right,bottom:h?(s.bottom-s.top)/2:s.bottom,left:l?(s.right-s.left)/2:s.left},t.effects.createPlaceholder(o),"show"===e.mode&&(o.cssClip(n.clip),n.clip=s),o.animate(n,{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("drop","hide",function(e,i){var s,n=t(this),o=e.mode,a=e.direction||"left",r="up"===a||"down"===a?"top":"left",l="up"===a||"left"===a?"-=":"+=",h={opacity:0};t.effects.createPlaceholder(n),s=e.distance||n["top"===r?"outerHeight":"outerWidth"](!0)/2,h[r]=l+s,"show"===o&&(n.css(h),h[r]=("+="===l?"-=":"+=")+s,h.opacity=1),n.animate(h,{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("explode","hide",function(e,i){var s,n,o,a,r,l,h=e.pieces?Math.round(Math.sqrt(e.pieces)):3,c=t(this),u="show"===e.mode,d=c.show().css("visibility","hidden").offset(),p=Math.ceil(c.outerWidth()/h),f=Math.ceil(c.outerHeight()/h),g=[];function m(){g.push(this),g.length===h*h&&(c.css({visibility:"visible"}),t(g).remove(),i())}for(s=0;s<h;s++)for(n=0,a=d.top+s*f,l=s-(h-1)/2;n<h;n++)o=d.left+n*p,r=n-(h-1)/2,c.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-n*p,top:-s*f}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:p,height:f,left:o+(u?r*p:0),top:a+(u?l*f:0),opacity:+!u}).animate({left:o+(u?0:r*p),top:a+(u?0:l*f),opacity:+!!u},e.duration||500,e.easing,m)}),t.effects.define("fade","toggle",function(e,i){var s="show"===e.mode;t(this).css("opacity",+!s).animate({opacity:+!!s},{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("fold","hide",function(e,i){var s=t(this),n=e.mode,o=e.size||15,a=/([0-9]+)%/.exec(o),r=e.horizFirst?["right","bottom"]:["bottom","right"],l=e.duration/2,h=t.effects.createPlaceholder(s),c=s.cssClip(),u={clip:t.extend({},c)},d={clip:t.extend({},c)},p=[c[r[0]],c[r[1]]],f=s.queue().length;a&&(o=parseInt(a[1],10)/100*p[+("hide"!==n)]),u.clip[r[0]]=o,d.clip[r[0]]=o,d.clip[r[1]]=0,"show"===n&&(s.cssClip(d.clip),h&&h.css(t.effects.clipToBox(d)),d.clip=c),s.queue(function(i){h&&h.animate(t.effects.clipToBox(u),l,e.easing).animate(t.effects.clipToBox(d),l,e.easing),i()}).animate(u,l,e.easing).animate(d,l,e.easing).queue(i),t.effects.unshift(s,f,4)}),t.effects.define("highlight","show",function(e,i){var s=t(this),n={backgroundColor:s.css("backgroundColor")};"hide"===e.mode&&(n.opacity=0),t.effects.saveStyle(s),s.css({backgroundImage:"none",backgroundColor:e.color||"#ffff99"}).animate(n,{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("size",function(e,i){var s,n,o,a=t(this),r=["fontSize"],l=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],h=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],c=e.mode,u="effect"!==c,d=e.scale||"both",p=e.origin||["middle","center"],f=a.css("position"),g=a.position(),m=t.effects.scaledDimensions(a),_=e.from||m,v=e.to||t.effects.scaledDimensions(a,0);t.effects.createPlaceholder(a),"show"===c&&(o=_,_=v,v=o),n={from:{y:_.height/m.height,x:_.width/m.width},to:{y:v.height/m.height,x:v.width/m.width}},("box"===d||"both"===d)&&(n.from.y!==n.to.y&&(_=t.effects.setTransition(a,l,n.from.y,_),v=t.effects.setTransition(a,l,n.to.y,v)),n.from.x!==n.to.x&&(_=t.effects.setTransition(a,h,n.from.x,_),v=t.effects.setTransition(a,h,n.to.x,v))),("content"===d||"both"===d)&&n.from.y!==n.to.y&&(_=t.effects.setTransition(a,r,n.from.y,_),v=t.effects.setTransition(a,r,n.to.y,v)),p&&(s=t.effects.getBaseline(p,m),_.top=(m.outerHeight-_.outerHeight)*s.y+g.top,_.left=(m.outerWidth-_.outerWidth)*s.x+g.left,v.top=(m.outerHeight-v.outerHeight)*s.y+g.top,v.left=(m.outerWidth-v.outerWidth)*s.x+g.left),delete _.outerHeight,delete _.outerWidth,a.css(_),("content"===d||"both"===d)&&(l=l.concat(["marginTop","marginBottom"]).concat(r),h=h.concat(["marginLeft","marginRight"]),a.find("*[width]").each(function(){var i=t(this),s=t.effects.scaledDimensions(i),o={height:s.height*n.from.y,width:s.width*n.from.x,outerHeight:s.outerHeight*n.from.y,outerWidth:s.outerWidth*n.from.x}
vendor: 10,317 bytes, line 12428
12428,a={height:s.height*n.to.y,width:s.width*n.to.x,outerHeight:s.height*n.to.y,outerWidth:s.width*n.to.x};n.from.y!==n.to.y&&(o=t.effects.setTransition(i,l,n.from.y,o),a=t.effects.setTransition(i,l,n.to.y,a)),n.from.x!==n.to.x&&(o=t.effects.setTransition(i,h,n.from.x,o),a=t.effects.setTransition(i,h,n.to.x,a)),u&&t.effects.saveStyle(i),i.css(o),i.animate(a,e.duration,e.easing,function(){u&&t.effects.restoreStyle(i)})})),a.animate(v,{queue:!1,duration:e.duration,easing:e.easing,complete:function(){var e=a.offset();0===v.opacity&&a.css("opacity",_.opacity),u||(a.css("position","static"===f?"relative":f).offset(e),t.effects.saveStyle(a)),i()}})}),t.effects.define("scale",function(e,i){var s=t(this),n=e.mode,o=parseInt(e.percent,10)||(0===parseInt(e.percent,10)?0:100*("effect"===n)),a=t.extend(!0,{from:t.effects.scaledDimensions(s),to:t.effects.scaledDimensions(s,o,e.direction||"both"),origin:e.origin||["middle","center"]},e);e.fade&&(a.from.opacity=1,a.to.opacity=0),t.effects.effect.size.call(this,a,i)}),t.effects.define("puff","hide",function(e,i){var s=t.extend(!0,{},e,{fade:!0,percent:parseInt(e.percent,10)||150});t.effects.effect.scale.call(this,s,i)}),t.effects.define("pulsate","show",function(e,i){var s=t(this),n=e.mode,o="show"===n,a=2*(e.times||5)+ +!!(o||"hide"===n),r=e.duration/a,l=0,h=1,c=s.queue().length;for((o||!s.is(":visible"))&&(s.css("opacity",0).show(),l=1);h<a;h++)s.animate({opacity:l},r,e.easing),l=1-l;s.animate({opacity:l},r,e.easing),s.queue(i),t.effects.unshift(s,c,a+1)}),t.effects.define("shake",function(e,i){var s=1,n=t(this),o=e.direction||"left",a=e.distance||20,r=e.times||3,l=2*r+1,h=Math.round(e.duration/l),c="up"===o||"down"===o?"top":"left",u="up"===o||"left"===o,d={},p={},f={},g=n.queue().length;for(t.effects.createPlaceholder(n),d[c]=(u?"-=":"+=")+a,p[c]=(u?"+=":"-=")+2*a,f[c]=(u?"-=":"+=")+2*a,n.animate(d,h,e.easing);s<r;s++)n.animate(p,h,e.easing).animate(f,h,e.easing);n.animate(p,h,e.easing).animate(d,h/2,e.easing).queue(i),t.effects.unshift(n,g,l+1)}),t.effects.define("slide","show",function(e,i){var s,n,o=t(this),a={up:["bottom","top"],down:["top","bottom"],left:["right","left"],right:["left","right"]},r=e.mode,l=e.direction||"left",h="up"===l||"down"===l?"top":"left",c=e.distance||o["top"===h?"outerHeight":"outerWidth"](!0),u={};t.effects.createPlaceholder(o),s=o.cssClip(),n=o.position()[h],u[h]=("up"===l||"left"===l?-1:1)*c+n,u.clip=o.cssClip(),u.clip[a[l][1]]=u.clip[a[l][0]],"show"===r&&(o.cssClip(u.clip),o.css(h,u[h]),u.clip=s,u[h]=n),o.animate(u,{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),!0===t.uiBackCompat&&t.effects.define("transfer",function(e,i){t(this).transfer(e,i)}),t.ui.focusable=function(e,i){var s,n,o,a,r,l=e.nodeName.toLowerCase();return"area"===l?(n=(s=e.parentNode).name,!!e.href&&!!n&&"map"===s.nodeName.toLowerCase()&&(o=t("img[usemap='#"+n+"']")).length>0&&o.is(":visible")):(/^(input|select|textarea|button|object)$/.test(l)?(a=!e.disabled)&&(r=t(e).closest("fieldset")[0])&&(a=!r.disabled):a="a"===l&&e.href||i,a&&t(e).is(":visible")&&"visible"===t(e).css("visibility"))},t.extend(t.expr.pseudos,{focusable:function(e){return t.ui.focusable(e,null!=t.attr(e,"tabindex"))}}),t.ui.focusable,t.ui.formResetMixin={_formResetHandler:function(){var e=t(this);setTimeout(function(){var i=e.data("ui-form-reset-instances");t.each(i,function(){this.refresh()})})},_bindFormResetHandler:function(){if(this.form=t(this.element.prop("form")),this.form.length){var e=this.form.data("ui-form-reset-instances")||[];e.length||this.form.on("reset.ui-form-reset",this._formResetHandler),e.push(this),this.form.data("ui-form-reset-instances",e)}},_unbindFormResetHandler:function(){if(this.form.length){var e=this.form.data("ui-form-reset-instances");e.splice(t.inArray(this,e),1),e.length?this.form.data("ui-form-reset-instances",e):this.form.removeData("ui-form-reset-instances").off("reset.ui-form-reset")}}},t.escapeSelector||(t.escapeSelector=function(t){return CSS.escape(t+"")}),t.fn.even&&t.fn.odd||t.fn.extend({even:function(){return this.filter(function(t){return t%2==0})},odd:function(){return this.filter(function(t){return t%2==1})}}),t.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38},t.fn.labels=function(){var t,e,i,s,n;return this.length?this[0].labels&&this[0].labels.length?this.pushStack(this[0].labels):(s=this.eq(0).parents("label"),(i=this.attr("id"))&&(n=(t=this.eq(0).parents().last()).add(t.length?t.siblings():this.siblings()),e="label[for='"+CSS.escape(i)+"']",s=s.add(n.find(e).addBack(e))),this.pushStack(s)):this.pushStack([])},t.fn.scrollParent=function(e){var i=this.css("position"),s="absolute"===i,n=e?/(auto|scroll|hidden)/:/(auto|scroll)/,o=this.parents().filter(function(){var e=t(this);return(!s||"static"!==e.css("position"))&&n.test(e.css("overflow")+e.css("overflow-y")+e.css("overflow-x"))}).eq(0);return"fixed"!==i&&o.length?o:t(this[0].ownerDocument||document)},t.extend(t.expr.pseudos,{tabbable:function(e){var i=t.attr(e,"tabindex"),s=null!=i;return(!s||i>=0)&&t.ui.focusable(e,s)}}),t.fn.extend({uniqueId:(i=0,function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++i)})}),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&t(this).removeAttr("id")})}}),t.widget("ui.accordion",{version:"1.14.2",options:{active:0,animate:{},classes:{"ui-accordion-header":"ui-corner-top","ui-accordion-header-collapsed":"ui-corner-all","ui-accordion-content":"ui-corner-bottom"},collapsible:!1,event:"click",header:function(t){return t.find("> li > :first-child").add(t.find("> :not(li)").filter(function(t){return t%2==0}))},heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},hideProps:{borderTopWidth:"hide",borderBottomWidth:"hide",paddingTop:"hide",paddingBottom:"hide",height:"hide"},showProps:{borderTopWidth:"show",borderBottomWidth:"show",paddingTop:"show",paddingBottom:"show",height:"show"},_create:function(){var e=this.options;this.prevShow=this.prevHide=t(),this._addClass("ui-accordion","ui-widget ui-helper-reset"),this.element.attr("role","tablist"),e.collapsible||!1!==e.active&&null!=e.active||(e.active=0),this._processPanels(),e.active<0&&(e.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():t()}},_createIcons:function(){var e,i,s=this.options.icons;s&&(e=t("<span>"),this._addClass(e,"ui-accordion-header-icon","ui-icon "+s.header),e.prependTo(this.headers),i=this.active.children(".ui-accordion-header-icon"),this._removeClass(i,s.header)._addClass(i,null,s.activeHeader)._addClass(this.headers,"ui-accordion-icons"))},_destroyIcons:function(){this._removeClass(this.headers,"ui-accordion-icons"),this.headers.children(".ui-accordion-header-icon").remove()},_destroy:function(){var t;this.element.removeAttr("role"),this.headers.removeAttr("role aria-expanded aria-selected aria-controls tabIndex").removeUniqueId(),this._destroyIcons(),t=this.headers.next().css("display","").removeAttr("role aria-hidden aria-labelledby").removeUniqueId(),"content"!==this.options.heightStyle&&t.css("height","")},_setOption:function(t,e){if("active"===t){this._activate(e);return}"event"===t&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(e)),this._super(t,e),"collapsible"!==t||e||!1!==this.options.active||this._activate(0),"icons"===t&&(this._destroyIcons(),e&&this._createIcons())},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",t),this._toggleClass(null,"ui-state-disabled",!!t)},_keydown:function(e){if(!e.altKey&&!e.ctrlKey){var i=t.ui.keyCode,s=this.headers.length,n=this.headers.index(e.target),o=!1;switch(e.keyCode){case i.RIGHT:case i.DOWN:o=this.headers[(n+1)%s];break;case i.LEFT:case i.UP:o=this.headers[(n-1+s)%s];break;case i.SPACE:case i.ENTER:this._eventHandler(e);break;case i.HOME:o=this.headers[0];break;case i.END:o=this.headers[s-1]}o&&(t(e.target).attr("tabIndex",-1),t(o).attr("tabIndex",0),t(o).trigger("focus"),e.preventDefault())}},_panelKeyDown:function(e){e.keyCode===t.ui.keyCode.UP&&e.ctrlKey&&t(e.currentTarget).prev().trigger("focus")},refresh:function(){var e=this.options;this._processPanels(),(!1!==e.active||!0!==e.collapsible)&&this.headers.length?!1===e.active?this._activate(0):this.active.length&&!t.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(e.active=!1,this.active=t()):this._activate(Math.max(0,e.active-1)):e.active=this.headers.index(this.active):(e.active=!1,this.active=t()),this._destroyIcons(),this._refresh()},_processPanels:function(){var t=this.headers,e=this.panels;"function"==typeof this.options.header?this.headers=this.options.header(this.element):this.headers=this.element.find(this.options.header),this._addClass(this.headers,"ui-accordion-header ui-accordion-header-collapsed","ui-state-default"),this.panels=this.headers.next().filter(":not(.ui-accordion-content-active)").hide(),this._addClass(this.panels,"ui-accordion-content","ui-helper-reset ui-widget-content"),e&&(this._off(t.not(this.headers)),this._off(e.not(this.panels)))},_refresh:function(){var e,i=this.options,s=i.heightStyle,n=this.element.parent();this.active=this._findActive(i.active),this._addClass(this.active,"ui-accordion-header-active","ui-state-active")._removeClass(this.active,"ui-accordion-header-collapsed"),this._addClass(this.active.next(),"ui-accordion-content-active"),this.active.next().show(),this.headers.attr("role","tab").each(function(){var e=t(this),i=e.uniqueId().attr("id"),s=e.next(),n=s.uniqueId().attr("id");e.attr("aria-controls",n),s.attr("aria-labelledby",i)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}).next().attr({"aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}).next().attr({"aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(i.event),"fill"===s?(e=n.height(),this.element.siblings(":visible").each(function(){var i=t(this),s=i.
vendor: 4,770 bytes, line 12428
12428css("position");"absolute"!==s&&"fixed"!==s&&(e-=i.outerHeight(!0))}),this.headers.each(function(){e-=t(this).outerHeight(!0)}),this.headers.next().each(function(){t(this).height(Math.max(0,e-t(this).innerHeight()+t(this).height()))}).css("overflow","auto")):"auto"===s&&(e=0,this.headers.next().each(function(){var i=t(this).is(":visible");i||t(this).show(),e=Math.max(e,t(this).css("height","").height()),i||t(this).hide()}).height(e))},_activate:function(e){var i=this._findActive(e)[0];i!==this.active[0]&&(i=i||this.active[0],this._eventHandler({target:i,currentTarget:i,preventDefault:t.noop}))},_findActive:function(e){return"number"==typeof e?this.headers.eq(e):t()},_setupEvents:function(e){var i={keydown:"_keydown"};e&&t.each(e.split(" "),function(t,e){i[e]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,i),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(e){var i,s,n=this.options,o=this.active,a=t(e.currentTarget),r=a[0]===o[0],l=r&&n.collapsible,h=l?t():a.next(),c=o.next(),u={oldHeader:o,oldPanel:c,newHeader:l?t():a,newPanel:h};e.preventDefault(),(!r||n.collapsible)&&!1!==this._trigger("beforeActivate",e,u)&&(n.active=!l&&this.headers.index(a),this.active=r?t():a,this._toggle(u),this._removeClass(o,"ui-accordion-header-active","ui-state-active"),n.icons&&(i=o.children(".ui-accordion-header-icon"),this._removeClass(i,null,n.icons.activeHeader)._addClass(i,null,n.icons.header)),r||(this._removeClass(a,"ui-accordion-header-collapsed")._addClass(a,"ui-accordion-header-active","ui-state-active"),n.icons&&(s=a.children(".ui-accordion-header-icon"),this._removeClass(s,null,n.icons.header)._addClass(s,null,n.icons.activeHeader)),this._addClass(a.next(),"ui-accordion-content-active")))},_toggle:function(e){var i=e.newPanel,s=this.prevShow.length?this.prevShow:e.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=i,this.prevHide=s,this.options.animate?this._animate(i,s,e):(s.hide(),i.show(),this._toggleComplete(e)),s.attr({"aria-hidden":"true"}),s.prev().attr({"aria-selected":"false","aria-expanded":"false"}),i.length&&s.length?s.prev().attr({tabIndex:-1,"aria-expanded":"false"}):i.length&&this.headers.filter(function(){return 0===parseInt(t(this).attr("tabIndex"),10)}).attr("tabIndex",-1),i.attr("aria-hidden","false").prev().attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_animate:function(t,e,i){var s,n,o,a=this,r=0,l=t.css("box-sizing"),h=t.length&&(!e.length||t.index()<e.index()),c=this.options.animate||{},u=h&&c.down||c,d=function(){a._toggleComplete(i)};return("number"==typeof u&&(o=u),"string"==typeof u&&(n=u),n=n||u.easing||c.easing,o=o||u.duration||c.duration,e.length)?t.length?void(s=t.show().outerHeight(),e.animate(this.hideProps,{duration:o,easing:n,step:function(t,e){e.now=Math.round(t)}}),t.hide().animate(this.showProps,{duration:o,easing:n,complete:d,step:function(t,i){i.now=Math.round(t),"height"!==i.prop?"content-box"===l&&(r+=i.now):"content"!==a.options.heightStyle&&(i.now=Math.round(s-e.outerHeight()-r),r=0)}})):e.animate(this.hideProps,o,n,d):t.animate(this.showProps,o,n,d)},_toggleComplete:function(t){var e=t.oldPanel,i=e.prev();this._removeClass(e,"ui-accordion-content-active"),this._removeClass(i,"ui-accordion-header-active")._addClass(i,"ui-accordion-header-collapsed"),this._trigger("activate",null,t)}}),t.widget("ui.menu",{version:"1.14.2",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-caret-1-e"},items:"> *",menus:"ul",position:{my:"left top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.lastMousePosition={x:null,y:null},this.element.uniqueId().attr({role:this.options.role,tabIndex:0}),this._addClass("ui-menu","ui-widget ui-widget-content"),this._on({"mousedown .ui-menu-item":function(t){t.preventDefault(),this._activateItem(t)},"click .ui-menu-item":function(e){var i=t(e.target),s=t(this.document[0].activeElement);!this.mouseHandled&&i.not(".ui-state-disabled").length&&(this.select(e),e.isPropagationStopped()||(this.mouseHandled=!0),i.has(".ui-menu").length?this.expand(e):!this.element.is(":focus")&&s.closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":"_activateItem","mousemove .ui-menu-item":"_activateItem",mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(t,e){var i=this.active||this._menuItems().first();e||this.focus(t,i)},blur:function(e){this._delay(function(){t.contains(this.element[0],this.document[0].activeElement)||this.collapseAll(e)}
vendor: 26,610 bytes, line 12428
12428)},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(t){this._closeOnDocumentClick(t)&&this.collapseAll(t,!0),this.mouseHandled=!1}})},_activateItem:function(e){if(!this.previousFilter&&(e.clientX!==this.lastMousePosition.x||e.clientY!==this.lastMousePosition.y)){this.lastMousePosition={x:e.clientX,y:e.clientY};var i=t(e.target).closest(".ui-menu-item"),s=t(e.currentTarget);!(i[0]!==s[0]||s.is(".ui-state-active"))&&(this._removeClass(s.siblings().children(".ui-state-active"),null,"ui-state-active"),this.focus(e,s))}},_destroy:function(){var e=this.element.find(".ui-menu-item").removeAttr("role aria-disabled").children(".ui-menu-item-wrapper").removeUniqueId().removeAttr("tabIndex role aria-haspopup");this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeAttr("role aria-labelledby aria-expanded aria-hidden aria-disabled tabIndex").removeUniqueId().show(),e.children().each(function(){var e=t(this);e.data("ui-menu-submenu-caret")&&e.remove()})},_keydown:function(e){var i,s,n,o,a=!0;switch(e.keyCode){case t.ui.keyCode.PAGE_UP:this.previousPage(e);break;case t.ui.keyCode.PAGE_DOWN:this.nextPage(e);break;case t.ui.keyCode.HOME:this._move("first","first",e);break;case t.ui.keyCode.END:this._move("last","last",e);break;case t.ui.keyCode.UP:this.previous(e);break;case t.ui.keyCode.DOWN:this.next(e);break;case t.ui.keyCode.LEFT:this.collapse(e);break;case t.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(e);break;case t.ui.keyCode.ENTER:case t.ui.keyCode.SPACE:this._activate(e);break;case t.ui.keyCode.ESCAPE:this.collapse(e);break;default:a=!1,s=this.previousFilter||"",o=!1,n=e.keyCode>=96&&e.keyCode<=105?(e.keyCode-96).toString():String.fromCharCode(e.keyCode),clearTimeout(this.filterTimer),n===s?o=!0:n=s+n,i=this._filterMenuItems(n),(i=o&&-1!==i.index(this.active.next())?this.active.nextAll(".ui-menu-item"):i).length||(n=String.fromCharCode(e.keyCode),i=this._filterMenuItems(n)),i.length?(this.focus(e,i),this.previousFilter=n,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter}a&&e.preventDefault()},_activate:function(t){this.active&&!this.active.is(".ui-state-disabled")&&(this.active.children("[aria-haspopup='true']").length?this.expand(t):this.select(t))},refresh:function(){var e,i,s,n,o=this,a=this.options.icons.submenu,r=this.element.find(this.options.menus);this._toggleClass("ui-menu-icons",null,!!this.element.find(".ui-icon").length),i=r.filter(":not(.ui-menu)").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var e=t(this),i=e.prev(),s=t("<span>").data("ui-menu-submenu-caret",!0);o._addClass(s,"ui-menu-icon","ui-icon "+a),i.attr("aria-haspopup","true").prepend(s),e.attr("aria-labelledby",i.attr("id"))}),this._addClass(i,"ui-menu","ui-widget ui-widget-content ui-front"),(e=r.add(this.element).find(this.options.items)).not(".ui-menu-item").each(function(){var e=t(this);o._isDivider(e)&&o._addClass(e,"ui-menu-divider","ui-widget-content")}),n=(s=e.not(".ui-menu-item, .ui-menu-divider")).children().not(".ui-menu").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),this._addClass(s,"ui-menu-item")._addClass(n,"ui-menu-item-wrapper"),e.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!t.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return({menu:"menuitem",listbox:"option"})[this.options.role]},_setOption:function(t,e){if("icons"===t){var i=this.element.find(".ui-menu-icon");this._removeClass(i,null,this.options.icons.submenu)._addClass(i,null,e.submenu)}this._super(t,e)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",String(t)),this._toggleClass(null,"ui-state-disabled",!!t)},focus:function(t,e){var i,s,n;this.blur(t,t&&"focus"===t.type),this._scrollIntoView(e),this.active=e.first(),s=this.active.children(".ui-menu-item-wrapper"),this._addClass(s,null,"ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",s.attr("id")),n=this.active.parent().closest(".ui-menu-item").children(".ui-menu-item-wrapper"),this._addClass(n,null,"ui-state-active"),t&&"keydown"===t.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),(i=e.children(".ui-menu")).length&&t&&/^mouse/.test(t.type)&&this._startOpening(i),this.activeMenu=e.parent(),this._trigger("focus",t,{item:e})},_scrollIntoView:function(e){var i,s,n,o,a,r;this._hasScroll()&&(i=parseFloat(t.css(this.activeMenu[0],"borderTopWidth"))||0,s=parseFloat(t.css(this.activeMenu[0],"paddingTop"))||0,n=e.offset().top-this.activeMenu.offset().top-i-s,o=this.activeMenu.scrollTop(),a=this.activeMenu.height(),r=e.outerHeight(),n<0?this.activeMenu.scrollTop(o+n):n+r>a&&this.activeMenu.scrollTop(o+n-a+r))},blur:function(t,e){e||clearTimeout(this.timer),this.active&&(this._removeClass(this.active.children(".ui-menu-item-wrapper"),null,"ui-state-active"),this._trigger("blur",t,{item:this.active}),this.active=null)},_startOpening:function(t){clearTimeout(this.timer),"true"===t.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close(),this._open(t)},this.delay))},_open:function(e){var i=t.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(e.parents(".ui-menu")).hide().attr("aria-hidden","true"),e.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(i)},collapseAll:function(e,i){clearTimeout(this.timer),this.timer=this._delay(function(){var s=i?this.element:t(e&&e.target).closest(this.element.find(".ui-menu"));s.length||(s=this.element),this._close(s),this.blur(e),this._removeClass(s.find(".ui-state-active"),null,"ui-state-active"),this.activeMenu=s},i?0:this.delay)},_close:function(t){t||(t=this.active?this.active.parent():this.element),t.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false")},_closeOnDocumentClick:function(e){return!t(e.target).closest(".ui-menu").length},_isDivider:function(t){return!/[^\-\u2014\u2013\s]/.test(t.text())},collapse:function(t){var e=this.active&&this.active.parent().closest(".ui-menu-item",this.element);e&&e.length&&(this._close(),this.focus(t,e))},expand:function(t){var e=this.active&&this._menuItems(this.active.children(".ui-menu")).first();e&&e.length&&(this._open(e.parent()),this._delay(function(){this.focus(t,e)}))},next:function(t){this._move("next","first",t)},previous:function(t){this._move("prev","last",t)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_menuItems:function(t){return(t||this.element).find(this.options.items).filter(".ui-menu-item")},_move:function(t,e,i){var s;this.active&&(s="first"===t||"last"===t?this.active["first"===t?"prevAll":"nextAll"](".ui-menu-item").last():this.active[t+"All"](".ui-menu-item").first()),s&&s.length&&this.active||(s=this._menuItems(this.activeMenu)[e]()),this.focus(i,s)},nextPage:function(e){var i,s,n;if(!this.active){this.next(e);return}!this.isLastItem()&&(this._hasScroll()?(s=this.active.offset().top,n=this.element.innerHeight(),0===t.fn.jquery.indexOf("3.2.")&&(n+=this.element[0].offsetHeight-this.element.outerHeight()),this.active.nextAll(".ui-menu-item").each(function(){return(i=t(this)).offset().top-s-n<0}),this.focus(e,i)):this.focus(e,this._menuItems(this.activeMenu)[this.active?"last":"first"]()))},previousPage:function(e){var i,s,n;if(!this.active){this.next(e);return}!this.isFirstItem()&&(this._hasScroll()?(s=this.active.offset().top,n=this.element.innerHeight(),0===t.fn.jquery.indexOf("3.2.")&&(n+=this.element[0].offsetHeight-this.element.outerHeight()),this.active.prevAll(".ui-menu-item").each(function(){return(i=t(this)).offset().top-s+n>0}),this.focus(e,i)):this.focus(e,this._menuItems(this.activeMenu).first()))},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight")},select:function(e){this.active=this.active||t(e.target).closest(".ui-menu-item");var i={item:this.active};this.active.has(".ui-menu").length||this.collapseAll(e,!0),this._trigger("select",e,i)},_filterMenuItems:function(e){var i=RegExp("^"+e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"),"i");return this.activeMenu.find(this.options.items).filter(".ui-menu-item").filter(function(){return i.test(String.prototype.trim.call(t(this).children(".ui-menu-item-wrapper").text()))})}}),t.widget("ui.autocomplete",{version:"1.14.2",defaultElement:"<input>",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,liveRegionTimer:null,_create:function(){var e,i,s,n=this.element[0].nodeName.toLowerCase(),o="textarea"===n,a="input"===n;this.isMultiLine=o||!a&&"true"===this.element.prop("contentEditable"),this.valueMethod=this.element[o||a?"val":"text"],this.isNewMenu=!0,this._addClass("ui-autocomplete-input"),this.element.attr("autocomplete","off"),this._on(this.element,{keydown:function(n){if(this.element.prop("readOnly")){e=!0,s=!0,i=!0;return}e=!1,s=!1,i=!1;var o=t.ui.keyCode;switch(n.keyCode){case o.PAGE_UP:e=!0,this._move("previousPage",n);break;case o.PAGE_DOWN:e=!0,this._move("nextPage",n);break;case o.UP:e=!0,this._keyEvent("previous",n);break;case o.DOWN:e=!0,this._keyEvent("next",n);break;case o.ENTER:this.menu.active&&(e=!0,n.preventDefault(),this.menu.select(n));break;case o.TAB:this.menu.active&&this.menu.select(n);break;case o.ESCAPE:this.menu.element.is(":visible")&&(this.isMultiLine||this._value(this.term),this.close(n),n.preventDefault());break;default:i=!0,this._searchTimeout(n)}},keypress:function(s){if(e){e=!1,(!this.isMultiLine||this.menu.element.is(":visible"))&&s.preventDefault();return}if(!i){var n=t.ui.keyCode;switch(s.keyCode){case n.PAGE_UP:this._move("previousPage",s);break;case n.PAGE_DOWN:this._move("nextPage",s);break;case n.UP:this._keyEvent("previous",s);break;case n.DOWN:this._keyEvent("next",s)}}},input:function(t){if(s){s=!1,t.preventDefault();return}this._searchTimeout(t)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(t){clearTimeout(this.searching),this.close(t),this._change(t)}}),this._initSource(),this.menu=t("<ul>").appendTo(this._appendTo()).menu({role:null}).hide().menu("instance"),this._addClass(this.menu.element,"ui-autocomplete","ui-front"),this._on(this.menu.element,{mousedown:function(t){t.preventDefault()},menufocus:function(e,i){var s,n;if(this.isNewMenu&&(this.isNewMenu=!1,e.originalEvent&&/^mouse/.test(e.originalEvent.type))){this.menu.blur(),this.document.one("mousemove",function(){t(e.target).trigger(e.originalEvent)});return}n=i.item.data("ui-autocomplete-item"),!1!==this._trigger("focus",e,{item:n})&&e.originalEvent&&/^key/.test(e.originalEvent.type)&&this._value(n.value),(s=i.item.attr("aria-label")||n.value)&&String.prototype.trim.call(s).length&&(clearTimeout(this.liveRegionTimer),this.liveRegionTimer=this._delay(function(){this.liveRegion.html(t("<div>").text(s))},100))},menuselect:function(t,e){var i=e.item.data("ui-autocomplete-item"),s=this.previous;this.element[0]!==this.document[0].activeElement&&(this.element.trigger("focus"),this.previous=s),!1!==this._trigger("select",t,{item:i})&&this._value(i.value),this.term=this._value(),this.close(t),this.selectedItem=i}}),this.liveRegion=t("<div>",{role:"status","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body),this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible"),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(t,e){this._super(t,e),"source"===t&&this._initSource(),"appendTo"===t&&this.menu.element.appendTo(this._appendTo()),"disabled"===t&&e&&this.xhr&&this.xhr.abort()},_isEventTargetInWidget:function(e){var i=this.menu.element[0];return e.target===this.element[0]||e.target===i||t.contains(i,e.target)},_closeOnClickOutside:function(t){this._isEventTargetInWidget(t)||this.close()},_appendTo:function(){var e=this.options.appendTo;return e&&(e=e.jquery||e.nodeType?t(e):this.document.find(e).eq(0)),e&&e[0]||(e=this.element.closest(".ui-front, dialog")),e.length||(e=this.document[0].body),e},_initSource:function(){var e,i,s=this;Array.isArray(this.options.source)?(e=this.options.source,this.source=function(i,s){s(t.ui.autocomplete.filter(e,i.term))}):"string"==typeof this.options.source?(i=this.options.source,this.source=function(e,n){s.xhr&&s.xhr.abort(),s.xhr=t.ajax({url:i,data:e,dataType:"json",success:function(t){n(t)},error:function(){n([])}})}):this.source=this.options.source},_searchTimeout:function(t){clearTimeout(this.searching),this.searching=this._delay(function(){var e=this.term===this._value(),i=this.menu.element.is(":visible"),s=t.altKey||t.ctrlKey||t.metaKey||t.shiftKey;e&&(!e||i||s)||(this.selectedItem=null,this.search(null,t))},this.options.delay)},search:function(t,e){return(t=null!=t?t:this._value(),this.term=this._value(),t.length<this.options.minLength)?this.close(e):!1!==this._trigger("search",e)?this._search(t):void 0},_search:function(t){this.pending++,this._addClass("ui-autocomplete-loading"),this.cancelSearch=!1,this.source({term:t},this._response())},_response:function(){var t=++this.requestIndex;return(function(e){t===this.requestIndex&&this.__response(e),this.pending--,this.pending||this._removeClass("ui-autocomplete-loading")}).bind(this)},__response:function(t){t&&(t=this._normalize(t)),this._trigger("response",null,{content:t}),!this.options.disabled&&t&&t.length&&!this.cancelSearch?(this._suggest(t),this._trigger("open")):this._close()},close:function(t){this.cancelSearch=!0,this._close(t)},_close:function(t){this._off(this.document,"mousedown"),this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.blur(),this.isNewMenu=!0,this._trigger("close",t))},_change:function(t){this.previous!==this._value()&&this._trigger("change",t,{item:this.selectedItem})},_normalize:function(e){return e.length&&e[0].label&&e[0].value?e:t.map(e,function(e){return"string"==typeof e?{label:e,value:e}:t.extend({},e,{label:e.label||e.value,value:e.value||e.label})})},_suggest:function(e){var i=this.menu.element.empty();this._renderMenu(i,e),this.isNewMenu=!0,this.menu.refresh(),i.show(),this._resizeMenu(),i.position(t.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next(),this._on(this.document,{mousedown:"_closeOnClickOutside"})},_resizeMenu:function(){var t=this.menu.element;t.outerWidth(Math.max(t.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(e,i){var s=this;t.each(i,function(t,i){s._renderItemData(e,i)})},_renderItemData:function(t,e){return this._renderItem(t,e).data("ui-autocomplete-item",e)},_renderItem:function(e,i){return t("<li>").append(t("<div>").text(i.label)).appendTo(e)},_move:function(t,e){if(!this.menu.element.is(":visible")){this.search(null,e);return}if(this.menu.isFirstItem()&&/^previous/.test(t)||this.menu.isLastItem()&&/^next/.test(t)){this.isMultiLine||this._value(this.term),this.menu.blur();return}this.menu[t](e)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(t,e){(!this.isMultiLine||this.menu.element.is(":visible"))&&(this._move(t,e),e.preventDefault())}}),t.extend(t.ui.autocomplete,{escapeRegex:function(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(e,i){var s=RegExp(t.ui.autocomplete.escapeRegex(i),"i");return t.grep(e,function(t){return s.test(t.label||t.value||t)})}}),t.widget("ui.autocomplete",t.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(t){return t+(t>1?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(e){var i;this._superApply(arguments),!this.options.disabled&&!this.cancelSearch&&(i=e&&e.length?this.options.messages.results(e.length):this.options.messages.noResults,clearTimeout(this.liveRegionTimer),this.liveRegionTimer=this._delay(function(){this.liveRegion.html(t("<div>").text(i))},100))}}),t.ui.autocomplete;var T=/ui-corner-([a-z]){2,6}/g;function P(){this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:"",selectMonthLabel:"Select month",selectYearLabel:"Select year"},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,onUpdateDatepicker:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},t.extend(this._defaults,this.regional[""]),this.regional.en=t.extend(!0,{},this.regional[""]),this.regional["en-US"]=t.extend(!0,{},this.regional.en),this.dpDiv=M(t("<div id='"+this._mainDivId+"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}function M(e){var i="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return e.on("mouseout",i,function(){t(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&t(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&t(this).removeClass("ui-datepicker-next-hover")}).on("mouseover",i,S)}function S(){t.datepicker._isDisabledDatepicker(o.inline?o.dpDiv.parent()[0]:o.input[0])||(t(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),t(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&t(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&t(this).addClass("ui-datepicker-next-hover"))}function H(e,i){for(var s in t.extend(e,i),i)null==i[s]&&(e[s]=i[s]);return e}t.widget("ui.controlgroup",{version:"1.14.2",defaultElement:"<div>",options:{direction:"horizontal",disabled:null,onlyVisible:!0,items:{button:"input[type=button], input[type=submit], input[type=reset], button, a",controlgroupLabel:".ui-controlgroup-label",checkboxradio:"input[type='checkbox'], input[type='radio']",selectmenu:"select",spinner:".ui-spinner-input"}},_create:function(){this._enhance()},_enhance:function(){this.element.attr("role","toolbar"),this.refresh()},_destroy:function(){this._callChildMethod("destroy"),this.childWidgets.removeData("ui-controlgroup-data"),this.element.removeAttr("role"),this.options.items.controlgroupLabel&&this.element.find(this.options.items.controlgroupLabel).find(".ui-controlgroup-label-contents").contents().unwrap()},_initWidgets:function(){var e=this,i=[];t.each(this.options.items,function(s,n){var o,a={};if(n){if("controlgroupLabel"===s){(o=e.element.find(n)).each(function(){var e=t(this);!e.children(".ui-controlgroup-label-contents").length&&e.contents().wrapAll("<span class='ui-controlgroup-label-contents'></span>")}),e._addClass(o,null,"ui-widget ui-widget-content ui-state-default"),i=i.concat(o.get());return}t.fn[s]&&(a=e["_"+s+"Options"]?e["_"+s+"Options"]("middle"):{classes:{}},e.element.find(n).each(function(){var n=t(this),o=n[s]("instance"),r=t.widget.extend({},a);if("button"!==s||!n.parent(".ui-spinner").length){o||(o=n[s]()[s]("instance")),o&&(r.classes=e._resolveClassesValues(r.classes,o)),n[s](r);var l=n[s]("widget");t.data(l[0],"ui-controlgroup-data",o||n[s]("instance")),i.push(l[0])}}))}}),this.childWidgets=t(t.uniqueSort(i)),this._addClass(this.childWidgets,"ui-controlgroup-item")},_callChildMethod:function(e){this.childWidgets.each(function(){var i=t(this).data("ui-controlgroup-data");i&&i[e]&&i[e]()})},_updateCornerClass:function(t,e){var i=this._buildSimpleOptions(e,"label").classes.label;this._removeClass(t,null,"ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all"),this._addClass(t,null,i)},_buildSimpleOptions:function(t,e){var i="vertical"===this.options.direction,s={classes:{}};return s.classes[e]=({middle:"",first:"ui-corner-"+(i?"top":"left"),last:"ui-corner-"+(i?"bottom":"right"),only:"ui-corner-all"})[t],s},_spinnerOptions:function(t){var e=this._buildSimpleOptions(t,"ui-spinner");return e.classes["ui-spinner-up"]="",e.classes["ui-spinner-down"]="",e},_buttonOptions:function(t){return this._buildSimpleOptions(t,"ui-button")},_checkboxradioOptions:function(t){return this._buildSimpleOptions(t,"ui-checkboxradio-label")},_selectmenuOptions:function(t){var e="vertical"===this.options.direction;return{width:!!e&&"auto",classes:({middle:{"ui-selectmenu-button-open":"","ui-selectmenu-button-closed":""},first:{"ui-selectmenu-button-open":"ui-corner-"+(e?"top":"tl"),"ui-selectmenu-button-closed":"ui-corner-"+(e?"top":"left")},last:{"ui-selectmenu-button-open":e?"":"ui-corner-tr","ui-selectmenu-button-closed":"ui-corner-"+(e?"bottom":"right")},only:{"ui-selectmenu-button-open":"ui-corner-top","ui-selectmenu-button-closed":"ui-corner-all"}})[t]}},_resolveClassesValues:function(e,i){var s={};return t.each(e,function(t){var n=i.options.classes[t]||"";n=String.prototype.trim.call(n.replace(T,"")),s[t]=(n+" "+e[t]).replace(/\s+/g," ")}),s},_setOption:function(t,e){if("direction"===t&&this._removeClass("ui-controlgroup-"+this.options.direction),this._super(t,e),"disabled"===t){this._callChildMethod(e?"disable":"enable");return}this.refresh()},refresh:function(){var e,i=this;this._addClass("ui-controlgroup ui-controlgroup-"+this.options.direction),"horizontal"===this.options.direction&&this._addClass(null,"ui-helper-clearfix"),this._initWidgets(),e=this.childWidgets,this.options.onlyVisible&&(e=e.filter(":visible")),e.length&&(t.each(["first","last"],function(t,s){var n=e[s]().data("ui-controlgroup-data");if(n&&i["_"+n.widgetName+"Options"]){var o=i["_"+n.widgetName+"Options"](1===e.length?"only":s);o.classes=i._resolveClassesValues(o.classes,n),n.element[n.widgetName](o)}else i._updateCornerClass(e[s](),s)}),this._callChildMethod("refresh"))}}),t.widget("ui.checkboxradio",[t.ui.formResetMixin,{version:"1.14.2",options:{disabled:null,label:null,icon:!0,classes:{"ui-checkboxradio-label":"ui-corner-all","ui-checkboxradio-icon":"ui-corner-all"}},_getCreateOptions:function(){var e,i,s,n=this._super()||{};return this._readType(),i=this.element.labels(),this.label=t(i[i.length-1]),this.label.length||t.error("No label found for checkboxradio widget"),this.originalLabel="",(s=this.label.contents().not(this.element[0])).length&&(this.originalLabel+=s.clone().wrapAll("<div></div>").parent().html()),this.originalLabel&&(n.label=this.originalLabel),null!=(e=this.element[0].disabled)&&(n.disabled=e),n},_create:function(){var t=this.element[0].checked;this._bindFormResetHandler(),null==this.options.disabled&&(this.options.disabled=this.element[0].disabled),this._setOption("disabled",this.options.disabled),this._addClass("ui-checkboxradio","ui-helper-hidden-accessible"),this._addClass(this.label,"ui-checkboxradio-label","ui-button ui-widget"),"radio"===this.type&&this._addClass(this.label,"ui-checkboxradio-radio-label"),this.options.label&&this.options.label!==this.originalLabel?this._updateLabel():this.originalLabel&&(this.options.label=this.originalLabel),this._enhance(),t&&this._addClass(this.label,"ui-checkboxradio-checked","ui-state-active"),this._on({change:"_toggleClasses",focus:function(){this._addClass(this.label,null,"ui-state-focus ui-visual-focus")},blur:function(){this._removeClass(this.label,null,"ui-state-focus ui-visual-focus")}})},_readType:function(){var e=this.element[0].nodeName.toLowerCase();this.type=this.element[0].type,"input"===e&&/radio|checkbox/.test(this.type)||t.error("Can't create checkboxradio on element.nodeName="+e+" and element.type="+this.type)},_enhance:function(){this._updateIcon(this.element[0].checked)},widget:function(){return this.label},_getRadioGroup:function(){var e,i=this.element[0].name,s="input[name='"+CSS.escape(i)+"']";return i?(this.form.length?t(this.form[0].elements).filter(s):t(s).filter(function(){return 0===t(t(this).prop("form")).length})).not(this.element):t([])},_toggleClasses:function(){var e=this.element[0].checked;this._toggleClass(this.label,"ui-checkboxradio-checked","ui-state-active",e),this.options.icon&&"checkbox"===this.type&&this._toggleClass(this.icon,null,"ui-icon-check ui-state-checked",e)._toggleClass(this.icon,null,"ui-icon-blank",!e),"radio"===this.type&&this._getRadioGroup().each(function(){var e=t(this).checkboxradio("instance");e&&e._removeClass(e.label,"ui-checkboxradio-checked","ui-state-active")})},_destroy:function(){this._unbindFormResetHandler(),this.icon&&(this.icon.remove(),this.iconSpace.remove())},_setOption:function(t,e){if("label"!==t||e){if(this._super(t,e),"disabled"===t){this._toggleClass(this.label,null,"ui-state-disabled",e),this.element[0].disabled=e;return}this.refresh()}},_updateIcon:function(e){var i="ui-icon ui-icon-background ";this.options.icon?(this.icon||(this.icon=t("<span>"),this.iconSpace=t("<span> </span>
vendor: 2,904 bytes, line 12428
12428"),this._addClass(this.iconSpace,"ui-checkboxradio-icon-space")),"checkbox"===this.type?(i+=e?"ui-icon-check ui-state-checked":"ui-icon-blank",this._removeClass(this.icon,null,e?"ui-icon-blank":"ui-icon-check")):i+="ui-icon-blank",this._addClass(this.icon,"ui-checkboxradio-icon",i),e||this._removeClass(this.icon,null,"ui-icon-check ui-state-checked"),this.icon.prependTo(this.label).after(this.iconSpace)):void 0!==this.icon&&(this.icon.remove(),this.iconSpace.remove(),delete this.icon)},_updateLabel:function(){var t=this.label.contents().not(this.element[0]);this.icon&&(t=t.not(this.icon[0])),this.iconSpace&&(t=t.not(this.iconSpace[0])),t.remove(),this.label.append(this.options.label)},refresh:function(){var t=this.element[0].checked,e=this.element[0].disabled;this._updateIcon(t),this._toggleClass(this.label,"ui-checkboxradio-checked","ui-state-active",t),null!==this.options.label&&this._updateLabel(),e!==this.options.disabled&&this._setOptions({disabled:e})}}]),t.ui.checkboxradio,t.widget("ui.button",{version:"1.14.2",defaultElement:"<button>",options:{classes:{"ui-button":"ui-corner-all"},disabled:null,icon:null,iconPosition:"beginning",label:null,showLabel:!0},_getCreateOptions:function(){var t,e=this._super()||{};return this.isInput=this.element.is("input"),null!=(t=this.element[0].disabled)&&(e.disabled=t),this.originalLabel=this.isInput?this.element.val():this.element.html(),this.originalLabel&&(e.label=this.originalLabel),e},_create:function(){!this.option.showLabel&!this.options.icon&&(this.options.showLabel=!0),null==this.options.disabled&&(this.options.disabled=this.element[0].disabled||!1),this.hasTitle=!!this.element.attr("title"),this.options.label&&this.options.label!==this.originalLabel&&(this.isInput?this.element.val(this.options.label):this.element.html(this.options.label)),this._addClass("ui-button","ui-widget"),this._setOption("disabled",this.options.disabled),this._enhance(),this.element.is("a")&&this._on({keyup:function(e){e.keyCode===t.ui.keyCode.SPACE&&(e.preventDefault(),this.element[0].click?this.element[0].click():this.element.trigger("click"))}})},_enhance:function(){this.element.is("button")||this.element.attr("role","button"),this.options.icon&&(this._updateIcon("icon",this.options.icon),this._updateTooltip())},_updateTooltip:function(){this.title=this.element.attr("title"),this.options.showLabel||this.title||this.element.attr("title",this.options.label)},_updateIcon:function(e,i){var s="iconPosition"!==e,n=s?this.options.iconPosition:i,o="top"===n||"bottom"===n;this.icon?s&&this._removeClass(this.icon,null,this.options.icon):(this.icon=t("<span>"),this._addClass(this.icon,"ui-button-icon","ui-icon"),this.options.showLabel||this._addClass("ui-button-icon-only")),s&&this._addClass(this.icon,null,i),this._attachIcon(n),o?(this._addClass(this.icon,null,"ui-widget-icon-block"),this.iconSpace&&this.iconSpace.remove()):(this.iconS
vendor: 7,045 bytes, line 12428
12428pace||(this.iconSpace=t("<span> </span>"),this._addClass(this.iconSpace,"ui-button-icon-space")),this._removeClass(this.icon,null,"ui-wiget-icon-block"),this._attachIconSpace(n))},_destroy:function(){this.element.removeAttr("role"),this.icon&&this.icon.remove(),this.iconSpace&&this.iconSpace.remove(),this.hasTitle||this.element.removeAttr("title")},_attachIconSpace:function(t){this.icon[/^(?:end|bottom)/.test(t)?"before":"after"](this.iconSpace)},_attachIcon:function(t){this.element[/^(?:end|bottom)/.test(t)?"append":"prepend"](this.icon)},_setOptions:function(t){var e=void 0===t.showLabel?this.options.showLabel:t.showLabel,i=void 0===t.icon?this.options.icon:t.icon;e||i||(t.showLabel=!0),this._super(t)},_setOption:function(t,e){"icon"===t&&(e?this._updateIcon(t,e):this.icon&&(this.icon.remove(),this.iconSpace&&this.iconSpace.remove())),"iconPosition"===t&&this._updateIcon(t,e),"showLabel"===t&&(this._toggleClass("ui-button-icon-only",null,!e),this._updateTooltip()),"label"===t&&(this.isInput?this.element.val(e):(this.element.html(e),this.icon&&(this._attachIcon(this.options.iconPosition),this._attachIconSpace(this.options.iconPosition)))),this._super(t,e),"disabled"===t&&(this._toggleClass(null,"ui-state-disabled",e),this.element[0].disabled=e,e&&this.element.trigger("blur"))},refresh:function(){var t=this.element.is("input, button")?this.element[0].disabled:this.element.hasClass("ui-button-disabled");t!==this.options.disabled&&this._setOptions({disabled:t}),this._updateTooltip()}}),!0===t.uiBackCompat&&(t.widget("ui.button",t.ui.button,{options:{text:!0,icons:{primary:null,secondary:null}},_create:function(){this.options.showLabel&&!this.options.text&&(this.options.showLabel=this.options.text),!this.options.showLabel&&this.options.text&&(this.options.text=this.options.showLabel),!this.options.icon&&(this.options.icons.primary||this.options.icons.secondary)?this.options.icons.primary?this.options.icon=this.options.icons.primary:(this.options.icon=this.options.icons.secondary,this.options.iconPosition="end"):this.options.icon&&(this.options.icons.primary=this.options.icon),this._super()},_setOption:function(t,e){if("text"===t){this._super("showLabel",e);return}"showLabel"===t&&(this.options.text=e),"icon"===t&&(this.options.icons.primary=e),"icons"===t&&(e.primary?(this._super("icon",e.primary),this._super("iconPosition","beginning")):e.secondary&&(this._super("icon",e.secondary),this._super("iconPosition","end"))),this._superApply(arguments)}}),t.fn.button=(s=t.fn.button,function(e){var i="string"==typeof e,n=Array.prototype.slice.call(arguments,1),o=this;return i?this.length||"instance"!==e?this.each(function(){var i,s=t(this).attr("type"),a=t.data(this,"ui-"+("checkbox"!==s&&"radio"!==s?"button":"checkboxradio"));return"instance"===e?(o=a,!1):a?"function"!=typeof a[e]||"_"===e.charAt(0)?t.error("no such method '"+e+"' for button widget instance"):(i=a[e].apply(a,n))!==a&&void 0!==i?(o=i&&i.jquery?o.pushStack(i.get()):i,!1):void 0:t.error("cannot call methods on button prior to initialization; attempted to call method '"+e+"'")}):o=void 0:(n.length&&(e=t.widget.extend.apply(null,[e].concat(n))),this.each(function(){var i=t(this).attr("type"),n="checkbox"!==i&&"radio"!==i?"button":"checkboxradio",o=t.data(this,"ui-"+n);if(o)o.option(e||{}),o._init&&o._init();else{if("button"===n){s.call(t(this),e);return}t(this).checkboxradio(t.extend({icon:!1},e))}})),o}),t.fn.buttonset=function(){return(t.ui.controlgroup||t.error("Controlgroup widget missing"),"option"===arguments[0]&&"items"===arguments[1]&&arguments[2])?this.controlgroup.apply(this,[arguments[0],"items.button",arguments[2]]):"option"===arguments[0]&&"items"===arguments[1]?this.controlgroup.apply(this,[arguments[0],"items.button"]):("object"==typeof arguments[0]&&arguments[0].items&&(arguments[0].items={button:arguments[0].items}),this.controlgroup.apply(this,arguments))}),t.ui.button,t.extend(t.ui,{datepicker:{version:"1.14.2"}}),t.extend(P.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(t){return H(this._defaults,t||{}),this},_attachDatepicker:function(e,i){var s,n,o;n="div"===(s=e.nodeName.toLowerCase())||"span"===s,e.id||(this.uuid+=1,e.id="dp"+this.uuid),(o=this._newInst(t(e),n)).settings=t.extend({},i||{}),"input"===s?this._connectDatepicker(e,o):n&&this._inlineDatepicker(e,o)},_newInst:function(e,i){return{id:e[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1"),input:e,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:i,dpDiv:i?M(t("<div class='"+this._inlineClass+" ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")):this.dpDiv}},_connectDatepicker:function(e,i){var s=t(e);i.append=t([]),i.trigger=t([]),!s.hasClass(this.markerClassName)&&(this._attachments(s,i),s.addClass(this.markerClassName).on("keydown",this._doKeyDown).on("keypress",this._doKeyPress).on("keyup",this._doKeyUp),this._autoSize(i),t.data(e,"datepicker",i),i.settings.disabled&&this._disableDatepicker(e))},_attachments:function(e,i){var s,n,o,a=this._get(i,"appendText"),r=this._get(i,"isRTL");i.append&&i.append.remove(),a&&(i.append=t("<span>").addClass(this._appendClass).text(a),e[r?"before":"after"](i.append)),e.off("focus",this._showDatepicker),i.trigger&&i.trigger.remove(),("focus"===(s=this._get(i,"showOn"))||"both"===s)&&e.on("focus",this._showDatepicker),("button"===s||"both"===s)&&(n=this._get(i,"buttonText"),o=this._get(i,"buttonImage"),this._get(i,"buttonImageOnly")?i.trigger=t("<img>").addClass(this._triggerClass).attr({src:o,alt:n,title:n}):(i.trigger=t("<button type='button'>").addClass(this._triggerClass),o?i.trigger.html(t("<img>").attr({src:o,alt:n,title:n})):i.trigger.text(n)),e[r?"before":"after"](i.trigger),i.trigger.on("click",function(){return t.datepicker._datepickerShowing&&t.datepicker._lastInput===e[0]?t.datepicker._hideDatepicker():(t.datepicker._datepickerShowing&&t.datepicker._lastInput!==e[0]&&t.datepicker._hideDatepicker(),t.datepicker._showDatepicker(e[0])),!1}))},_autoSize:function(t){if(this._get(t,"autoSize")&&!t.inline){var e,i,s,n,o=new Date(2009,11,20),a=this._get(t,"dateFormat");a.match(/[DM]/)&&(e=function(t){for(n=0,i=0,s=0;n<t.length;n++)t[n].length>i&&(i=t[n].length,s=n);return s},o.setMonth(e(this._get(t,a.match(/MM/)?"monthNames":"monthNamesShort"))),o.setDate(e(this._get(t,a.match(/DD/)?"dayNames":"dayNamesShort"))+20-o.getDay())),t.input.attr("size",this._formatDate(t,o).length)}},_inlineDatepicker:function(e,i){var s=t(e);!s.hasClass(this.markerClassName)&&(s.addClass(this.markerClassName).append(i.dpDiv),t.data(e,"datepicker",i),this._setDate(i,this._getDefaultDate(i),!0),this._updateDatepicker(i),this._updateAlternate(i),i.settings.disabled&&this._disableDatepicker(e),i.dpDiv.css("display","block"))},_dialogDatepicker:function(e,i,s,n,o){var a,r,l,h,c,u=this._dialogInst;return u||(this.uuid+=1,a="dp"+this.uuid,this._dialogInput=t("<input type='text' id='"+a+"' style='position: absolute; top: -100px; width: 0px;'/>
vendor: 12,691 bytes, line 12428
12428"),this._dialogInput.on("keydown",this._doKeyDown),t("body").append(this._dialogInput),(u=this._dialogInst=this._newInst(this._dialogInput,!1)).settings={},t.data(this._dialogInput[0],"datepicker",u)),H(u.settings,n||{}),i=i&&i.constructor===Date?this._formatDate(u,i):i,this._dialogInput.val(i),this._pos=o?o.length?o:[o.pageX,o.pageY]:null,this._pos||(r=document.documentElement.clientWidth,l=document.documentElement.clientHeight,h=document.documentElement.scrollLeft||document.body.scrollLeft,c=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[r/2-100+h,l/2-150+c]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),u.settings.onSelect=s,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),t.blockUI&&t.blockUI(this.dpDiv),t.data(this._dialogInput[0],"datepicker",u),this},_destroyDatepicker:function(e){var i,s=t(e),n=t.data(e,"datepicker");s.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),t.removeData(e,"datepicker"),"input"===i?(n.append.remove(),n.trigger.remove(),s.removeClass(this.markerClassName).off("focus",this._showDatepicker).off("keydown",this._doKeyDown).off("keypress",this._doKeyPress).off("keyup",this._doKeyUp)):("div"===i||"span"===i)&&s.removeClass(this.markerClassName).empty(),t.datepicker._hideDatepicker(),o===n&&(o=null,this._curInst=null))},_enableDatepicker:function(e){var i,s,n=t(e),o=t.data(e,"datepicker");n.hasClass(this.markerClassName)&&("input"===(i=e.nodeName.toLowerCase())?(e.disabled=!1,o.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""})):("div"===i||"span"===i)&&((s=n.children("."+this._inlineClass)).children().removeClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)),this._disabledInputs=t.map(this._disabledInputs,function(t){return t===e?null:t}))},_disableDatepicker:function(e){var i,s,n=t(e),o=t.data(e,"datepicker");n.hasClass(this.markerClassName)&&("input"===(i=e.nodeName.toLowerCase())?(e.disabled=!0,o.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"})):("div"===i||"span"===i)&&((s=n.children("."+this._inlineClass)).children().addClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)),this._disabledInputs=t.map(this._disabledInputs,function(t){return t===e?null:t}),this._disabledInputs[this._disabledInputs.length]=e)},_isDisabledDatepicker:function(t){if(!t)return!1;for(var e=0;e<this._disabledInputs.length;e++)if(this._disabledInputs[e]===t)return!0;return!1},_getInst:function(e){try{return t.data(e,"datepicker")}catch(t){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(e,i,s){var n,o,a,r,l=this._getInst(e);if(2==arguments.length&&"string"==typeof i)return"defaults"===i?t.extend({},t.datepicker._defaults):l?"all"===i?t.extend({},l.settings):this._get(l,i):null;n=i||{},"string"==typeof i&&((n={})[i]=s),l&&(this._curInst===l&&this._hideDatepicker(),o=this._getDateDatepicker(e,!0),a=this._getMinMaxDate(l,"min"),r=this._getMinMaxDate(l,"max"),H(l.settings,n),null!==a&&void 0!==n.dateFormat&&void 0===n.minDate&&(l.settings.minDate=this._formatDate(l,a)),null!==r&&void 0!==n.dateFormat&&void 0===n.maxDate&&(l.settings.maxDate=this._formatDate(l,r)),"disabled"in n&&(n.disabled?this._disableDatepicker(e):this._enableDatepicker(e)),this._attachments(t(e),l),this._autoSize(l),this._setDate(l,o),this._updateAlternate(l),this._updateDatepicker(l))},_changeDatepicker:function(t,e,i){this._optionDatepicker(t,e,i)},_refreshDatepicker:function(t){var e=this._getInst(t);e&&this._updateDatepicker(e)},_setDateDatepicker:function(t,e){var i=this._getInst(t);i&&(this._setDate(i,e),this._updateDatepicker(i),this._updateAlternate(i))},_getDateDatepicker:function(t,e){var i=this._getInst(t);return i&&!i.inline&&this._setDateFromField(i,e),i?this._getDate(i):null},_doKeyDown:function(e){var i,s,n,o=t.datepicker._getInst(e.target),a=!0,r=o.dpDiv.is(".ui-datepicker-rtl");if(o._keyEvent=!0,t.datepicker._datepickerShowing)switch(e.keyCode){case 9:t.datepicker._hideDatepicker(),a=!1;break;case 13:return(n=t("td."+t.datepicker._dayOverClass+":not(."+t.datepicker._currentClass+")",o.dpDiv))[0]&&t.datepicker._selectDay(e.target,o.selectedMonth,o.selectedYear,n[0]),(i=t.datepicker._get(o,"onSelect"))?(s=t.datepicker._formatDate(o),i.apply(o.input?o.input[0]:null,[s,o])):t.datepicker._hideDatepicker(),!1;case 27:t.datepicker._hideDatepicker();break;case 33:t.datepicker._adjustDate(e.target,e.ctrlKey?-t.datepicker._get(o,"stepBigMonths"):-t.datepicker._get(o,"stepMonths"),"M");break;case 34:t.datepicker._adjustDate(e.target,e.ctrlKey?+t.datepicker._get(o,"stepBigMonths"):+t.datepicker._get(o,"stepMonths"),"M");break;case 35:(e.ctrlKey||e.metaKey)&&t.datepicker._clearDate(e.target),a=e.ctrlKey||e.metaKey;break;case 36:(e.ctrlKey||e.metaKey)&&t.datepicker._gotoToday(e.target),a=e.ctrlKey||e.metaKey;break;case 37:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,r?1:-1,"D"),a=e.ctrlKey||e.metaKey,e.originalEvent.altKey&&t.datepicker._adjustDate(e.target,e.ctrlKey?-t.datepicker._get(o,"stepBigMonths"):-t.datepicker._get(o,"stepMonths"),"M");break;case 38:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,-7,"D"),a=e.ctrlKey||e.metaKey;break;case 39:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,r?-1:1,"D"),a=e.ctrlKey||e.metaKey,e.originalEvent.altKey&&t.datepicker._adjustDate(e.target,e.ctrlKey?+t.datepicker._get(o,"stepBigMonths"):+t.datepicker._get(o,"stepMonths"),"M");break;case 40:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,7,"D"),a=e.ctrlKey||e.metaKey;break;default:a=!1}else 36===e.keyCode&&e.ctrlKey?t.datepicker._showDatepicker(this):a=!1;a&&(e.preventDefault(),e.stopPropagation())},_doKeyPress:function(e){var i,s,n=t.datepicker._getInst(e.target);if(t.datepicker._get(n,"constrainInput"))return i=t.datepicker._possibleChars(t.datepicker._get(n,"dateFormat")),s=String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),e.ctrlKey||e.metaKey||s<" "||!i||i.indexOf(s)>-1},_doKeyUp:function(e){var i=t.datepicker._getInst(e.target);if(i.input.val()!==i.lastVal)try{t.datepicker.parseDate(t.datepicker._get(i,"dateFormat"),i.input?i.input.val():null,t.datepicker._getFormatConfig(i))&&(t.datepicker._setDateFromField(i),t.datepicker._updateAlternate(i),t.datepicker._updateDatepicker(i))}catch(t){}return!0},_showDatepicker:function(e){var i,s,n,o,a,r,l;if("input"!==(e=e.target||e).nodeName.toLowerCase()&&(e=t("input",e.parentNode)[0]),!t.datepicker._isDisabledDatepicker(e)&&t.datepicker._lastInput!==e)i=t.datepicker._getInst(e),t.datepicker._curInst&&t.datepicker._curInst!==i&&(t.datepicker._curInst.dpDiv.stop(!0,!0),i&&t.datepicker._datepickerShowing&&t.datepicker._hideDatepicker(t.datepicker._curInst.input[0])),!1!==(n=(s=t.datepicker._get(i,"beforeShow"))?s.apply(e,[e,i]):{})&&(H(i.settings,n),i.lastVal=null,t.datepicker._lastInput=e,t.datepicker._setDateFromField(i),t.datepicker._inDialog&&(e.value=""),t.datepicker._pos||(t.datepicker._pos=t.datepicker._findPos(e),t.datepicker._pos[1]+=e.offsetHeight),o=!1,t(e).parents().each(function(){return!(o|="fixed"===t(this).css("position"))}),a={left:t.datepicker._pos[0],top:t.datepicker._pos[1]},t.datepicker._pos=null,i.dpDiv.empty(),i.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),t.datepicker._updateDatepicker(i),a=t.datepicker._checkOffset(i,a,o),i.dpDiv.css({position:t.datepicker._inDialog&&t.blockUI?"static":o?"fixed":"absolute",display:"none",left:a.left+"px",top:a.top+"px"}),i.inline||(r=t.datepicker._get(i,"showAnim"),l=t.datepicker._get(i,"duration"),i.dpDiv.css("z-index",function(t){var e,i;while(t.length&&t[0]!==document){if(("absolute"===(e=t.css("position"))||"relative"===e||"fixed"===e)&&!isNaN(i=parseInt(t.css("zIndex"),10))&&0!==i)return i;t=t.parent()}return 0}(t(e))+1),t.datepicker._datepickerShowing=!0,t.effects&&t.effects.effect[r]?i.dpDiv.show(r,t.datepicker._get(i,"showOptions"),l):i.dpDiv[r||"show"](r?l:null),t.datepicker._shouldFocusInput(i)&&i.input.trigger("focus"),t.datepicker._curInst=i))},_updateDatepicker:function(e){this.maxRows=4,o=e,e.dpDiv.empty().append(this._generateHTML(e)),this._attachHandlers(e);var i,s=this._getNumberOfMonths(e),n=s[1],a=e.dpDiv.find("."+this._dayOverClass+" a"),r=t.datepicker._get(e,"onUpdateDatepicker");a.length>0&&S.apply(a.get(0)),e.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),n>1&&e.dpDiv.addClass("ui-datepicker-multi-"+n).css("width",17*n+"em"),e.dpDiv[(1!==s[0]||1!==s[1]?"add":"remove")+"Class"]("ui-datepicker-multi"),e.dpDiv[(this._get(e,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),e===t.datepicker._curInst&&t.datepicker._datepickerShowing&&t.datepicker._shouldFocusInput(e)&&e.input.trigger("focus"),e.yearshtml&&(i=e.yearshtml,setTimeout(function(){i===e.yearshtml&&e.yearshtml&&e.dpDiv.find("select.ui-datepicker-year").first().replaceWith(e.yearshtml),i=e.yearshtml=null},0)),r&&r.apply(e.input?e.input[0]:null,[e])},_shouldFocusInput:function(t){return t.input&&t.input.is(":visible")&&!t.input.is(":disabled")},_checkOffset:function(e,i,s){var n=e.dpDiv.outerWidth(),o=e.dpDiv.outerHeight(),a=e.input?e.input.outerWidth():0,r=e.input?e.input.outerHeight():0,l=document.documentElement.clientWidth+(s?0:t(document).scrollLeft()),h=document.documentElement.clientHeight+(s?0:t(document).scrollTop());return i.left-=this._get(e,"isRTL")?n-a:0,i.left-=s&&i.left===e.input.offset().left?t(document).scrollLeft():0,i.top-=s&&i.top===e.input.offset().top+r?t(document).scrollTop():0,i.left-=Math.min(i.left,i.left+n>l&&l>n?Math.abs(i.left+n-l):0),i.top-=Math.min(i.top,i.top+o>h&&h>o?Math.abs(o+r):0),i},_findPos:function(e){var i,s=this._getInst(e),n=this._get(s,"isRTL");while(e&&("hidden"===e.type||1!==e.nodeType||t.expr.pseudos.hidden(e)))e=e[n?"previousSibling":"nextSibling"];return[(i=t(e).offset()).left,i.top]},_hideDatepicker:function(e){var i,s,n,o,a=this._curInst;a&&(!e||a===t.data(e,"datepicker"))&&this._datepickerShowing&&(i=this._get(a,"showAnim"),s=this._get(a,"duration"),n=function(){t.datepicker._tidyDialog(a)},t.effects&&t.effects.effect[i]?a.dpDiv.hide(i,t.datepicker._get(a,"showOptions"),s,n):a.dpDiv["slideDown"===i?"slideUp":"fadeIn"===i?"fadeOut":"hide"](i?s:null,n),i||n(),this._datepickerShowing=!1,(o=this._get(a,"onClose"))&&o.apply(a.input?a.input[0]:null,[a.input?a.input.val():"",a]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),t.blockUI&&(t.unblockUI(),t("body").append(this.dpDiv))),this._inDialog=!1)},_tidyDialog:function(t){t.dpDiv.removeClass(this._dialogClass).off(".ui-datepicker-calendar")},_checkExternalClick:function(e){if(t.datepicker._curInst){var i=t(e.target),s=t.datepicker._getInst(i[0]);(i[0].id!==t.datepicker._mainDivId&&0===i.parents("#"+t.datepicker._mainDivId).length&&!i.hasClass(t.datepicker.markerClassName)&&!i.closest("."+t.datepicker._triggerClass).length&&t.datepicker._datepickerShowing&&!(t.datepicker._inDialog&&t.blockUI)||i.hasClass(t.datepicker.markerClassName)&&t.datepicker._curInst!==s)&&t.datepicker._hideDatepicker()}},_adjustDate:function(e,i,s){var n=t(e),o=this._getInst(n[0]);!this._isDisabledDatepicker(n[0])&&(this._adjustInstDate(o,i,s),this._updateDatepicker(o))},_gotoToday:function(e){var i,s=t(e),n=this._getInst(s[0]);this._get(n,"gotoCurrent")&&n.currentDay?(n.selectedDay=n.currentDay,n.drawMonth=n.selectedMonth=n.currentMonth,n.drawYear=n.selectedYear=n.currentYear):(n.selectedDay=(i=new Date).getDate(),n.drawMonth=n.selectedMonth=i.getMonth(),n.drawYear=n.selectedYear=i.getFullYear()),this._notifyChange(n),this._adjustDate(s)},_selectMonthYear:function(e,i,s){var n=t(e),o=this._getInst(n[0]);o["selected"+("M"===s?"Month":"Year")]=o["draw"+("M"===s?"Month":"Year")]=parseInt(i.options[i.selectedIndex].value,10),this._notifyChange(o),this._adjustDate(n)},_selectDay:function(e,i,s,n){var o,a=t(e);!(t(n).hasClass(this._unselectableClass)||this._isDisabledDatepicker(a[0]))&&((o=this._getInst(a[0])).selectedDay=o.currentDay=parseInt(t("a",n).attr("data-date")),o.selectedMonth=o.currentMonth=i,o.selectedYear=o.currentYear=s,this._selectDate(e,this._formatDate(o,o.currentDay,o.currentMonth,o.currentYear)))},_clearDate:function(e){var i=t(e);this._selectDate(i,"")},_selectDate:function(e,i){var s,n=t(e),o=this._getInst(n[0]);i=null!=i?i:this._formatDate(o),o.input&&o.input.val(i),this._updateAlternate(o),(s=this._get(o,"onSelect"))?s.apply(o.input?o.input[0]:null,[
vendor: 21,003 bytes, line 12428
12428i,o]):o.input&&o.input.trigger("change"),o.inline?this._updateDatepicker(o):(this._hideDatepicker(),this._lastInput=o.input[0],"object"!=typeof o.input[0]&&o.input.trigger("focus"),this._lastInput=null)},_updateAlternate:function(e){var i,s,n,o=this._get(e,"altField");o&&(i=this._get(e,"altFormat")||this._get(e,"dateFormat"),s=this._getDate(e),n=this.formatDate(i,s,this._getFormatConfig(e)),t(document).find(o).val(n))},noWeekends:function(t){var e=t.getDay();return[e>0&&e<6,""]},iso8601Week:function(t){var e,i=new Date(t.getTime());return i.setDate(i.getDate()+4-(i.getDay()||7)),e=i.getTime(),i.setMonth(0),i.setDate(1),Math.floor(Math.round((e-i)/864e5)/7)+1},parseDate:function(e,i,s){if(null==e||null==i)throw"Invalid arguments";if(""===(i="object"==typeof i?i.toString():i+""))return null;var n,o,a,r,l=0,h=(s?s.shortYearCutoff:null)||this._defaults.shortYearCutoff,c="string"!=typeof h?h:new Date().getFullYear()%100+parseInt(h,10),u=(s?s.dayNamesShort:null)||this._defaults.dayNamesShort,d=(s?s.dayNames:null)||this._defaults.dayNames,p=(s?s.monthNamesShort:null)||this._defaults.monthNamesShort,f=(s?s.monthNames:null)||this._defaults.monthNames,g=-1,m=-1,_=-1,v=-1,b=!1,y=function(t){var i=n+1<e.length&&e.charAt(n+1)===t;return i&&n++,i},w=function(t){var e=y(t),s="@"===t?14:"!"===t?20:"y"===t&&e?4:"o"===t?3:2,n=RegExp("^\\d{"+("y"===t?s:1)+","+s+"}"),o=i.substring(l).match(n);if(!o)throw"Missing number at position "+l;return l+=o[0].length,parseInt(o[0],10)},x=function(e,s,n){var o=-1,a=t.map(y(e)?n:s,function(t,e){return[[e,t]]}).sort(function(t,e){return-(t[1].length-e[1].length)});if(t.each(a,function(t,e){var s=e[1];if(i.substr(l,s.length).toLowerCase()===s.toLowerCase())return o=e[0],l+=s.length,!1}),-1!==o)return o+1;throw"Unknown name at position "+l},k=function(){if(i.charAt(l)!==e.charAt(n))throw"Unexpected literal at position "+l;l++};for(n=0;n<e.length;n++)if(b)"'"!==e.charAt(n)||y("'")?k():b=!1;else switch(e.charAt(n)){case"d":_=w("d");break;case"D":x("D",u,d);break;case"o":v=w("o");break;case"m":m=w("m");break;case"M":m=x("M",p,f);break;case"y":g=w("y");break;case"@":g=(r=new Date(w("@"))).getFullYear(),m=r.getMonth()+1,_=r.getDate();break;case"!":g=(r=new Date((w("!")-this._ticksTo1970)/1e4)).getFullYear(),m=r.getMonth()+1,_=r.getDate();break;case"'":y("'")?k():b=!0;break;default:k()}if(l<i.length&&(a=i.substr(l),!/^\s+/.test(a)))throw"Extra/unparsed characters found in date: "+a;if(-1===g?g=new Date().getFullYear():g<100&&(g+=new Date().getFullYear()-new Date().getFullYear()%100+(g<=c?0:-100)),v>-1){m=1,_=v;do{if(_<=(o=this._getDaysInMonth(g,m-1)))break;m++,_-=o}while(!0)}if((r=this._daylightSavingAdjust(new Date(g,m-1,_))).getFullYear()!==g||r.getMonth()+1!==m||r.getDate()!==_)throw"Invalid date";return r},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*864e9,formatDate:function(t,e,i){if(!e)return"";var s,n=(i?i.dayNamesShort:null)||this._defaults.dayNamesShort,o=(i?i.dayNames:null)||this._defaults.dayNames,a=(i?i.monthNamesShort:null)||this._defaults.monthNamesShort,r=(i?i.monthNames:null)||this._defaults.monthNames,l=function(e){var i=s+1<t.length&&t.charAt(s+1)===e;return i&&s++,i},h=function(t,e,i){var s=""+e;if(l(t))while(s.length<i)s="0"+s;return s},c=function(t,e,i,s){return l(t)?s[e]:i[e]},u="",d=!1;if(e)for(s=0;s<t.length;s++)if(d)"'"!==t.charAt(s)||l("'")?u+=t.charAt(s):d=!1;else switch(t.charAt(s)){case"d":u+=h("d",e.getDate(),2);break;case"D":u+=c("D",e.getDay(),n,o);break;case"o":u+=h("o",Math.round((new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()-new Date(e.getFullYear(),0,0).getTime())/864e5),3);break;case"m":u+=h("m",e.getMonth()+1,2);break;case"M":u+=c("M",e.getMonth(),a,r);break;case"y":u+=l("y")?e.getFullYear():(e.getFullYear()%100<10?"0":"")+e.getFullYear()%100;break;case"@":u+=e.getTime();break;case"!":u+=1e4*e.getTime()+this._ticksTo1970;break;case"'":l("'")?u+="'":d=!0;break;default:u+=t.charAt(s)}return u},_possibleChars:function(t){var e,i="",s=!1,n=function(i){var s=e+1<t.length&&t.charAt(e+1)===i;return s&&e++,s};for(e=0;e<t.length;e++)if(s)"'"!==t.charAt(e)||n("'")?i+=t.charAt(e):s=!1;else switch(t.charAt(e)){case"d":case"m":case"y":case"@":i+="0123456789";break;case"D":case"M":return null;case"'":n("'")?i+="'":s=!0;break;default:i+=t.charAt(e)}return i},_get:function(t,e){return void 0!==t.settings[e]?t.settings[e]:this._defaults[e]},_setDateFromField:function(t,e){if(t.input.val()!==t.lastVal){var i=this._get(t,"dateFormat"),s=t.lastVal=t.input?t.input.val():null,n=this._getDefaultDate(t),o=n,a=this._getFormatConfig(t);try{o=this.parseDate(i,s,a)||n}catch(t){s=e?"":s}t.selectedDay=o.getDate(),t.drawMonth=t.selectedMonth=o.getMonth(),t.drawYear=t.selectedYear=o.getFullYear(),t.currentDay=s?o.getDate():0,t.currentMonth=s?o.getMonth():0,t.currentYear=s?o.getFullYear():0,this._adjustInstDate(t)}},_getDefaultDate:function(t){return this._restrictMinMax(t,this._determineDate(t,this._get(t,"defaultDate"),new Date))},_determineDate:function(e,i,s){var n,o=null==i||""===i?s:"string"==typeof i?function(i){try{return t.datepicker.parseDate(t.datepicker._get(e,"dateFormat"),i,t.datepicker._getFormatConfig(e))}catch(t){}var s=(i.toLowerCase().match(/^c/)?t.datepicker._getDate(e):null)||new Date,n=s.getFullYear(),o=s.getMonth(),a=s.getDate(),r=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,l=r.exec(i);while(l){switch(l[2]||"d"){case"d":case"D":a+=parseInt(l[1],10);break;case"w":case"W":a+=7*parseInt(l[1],10);break;case"m":case"M":o+=parseInt(l[1],10),a=Math.min(a,t.datepicker._getDaysInMonth(n,o));break;case"y":case"Y":n+=parseInt(l[1],10),a=Math.min(a,t.datepicker._getDaysInMonth(n,o))}l=r.exec(i)}return new Date(n,o,a)}(i):"number"==typeof i?isNaN(i)?s:((n=new Date).setDate(n.getDate()+i),n):new Date(i.getTime());return(o=o&&"Invalid Date"===o.toString()?s:o)&&(o.setHours(0),o.setMinutes(0),o.setSeconds(0),o.setMilliseconds(0)),this._daylightSavingAdjust(o)},_daylightSavingAdjust:function(t){return t?(t.setHours(t.getHours()>12?t.getHours()+2:0),t):null},_setDate:function(t,e,i){var s=!e,n=t.selectedMonth,o=t.selectedYear,a=this._restrictMinMax(t,this._determineDate(t,e,new Date));t.selectedDay=t.currentDay=a.getDate(),t.drawMonth=t.selectedMonth=t.currentMonth=a.getMonth(),t.drawYear=t.selectedYear=t.currentYear=a.getFullYear(),n===t.selectedMonth&&o===t.selectedYear||i||this._notifyChange(t),this._adjustInstDate(t),t.input&&t.input.val(s?"":this._formatDate(t))},_getDate:function(t){return!t.currentYear||t.input&&""===t.input.val()?null:this._daylightSavingAdjust(new Date(t.currentYear,t.currentMonth,t.currentDay))},_attachHandlers:function(e){var i=this._get(e,"stepMonths"),s="#"+e.id.replace(/\\\\/g,"\\");e.dpDiv.find("[data-handler]").map(function(){t(this).on(this.getAttribute("data-event"),{prev:function(){t.datepicker._adjustDate(s,-i,"M")},next:function(){t.datepicker._adjustDate(s,+i,"M")},hide:function(){t.datepicker._hideDatepicker()},today:function(){t.datepicker._gotoToday(s)},selectDay:function(){return t.datepicker._selectDay(s,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return t.datepicker._selectMonthYear(s,this,"M"),!1},selectYear:function(){return t.datepicker._selectMonthYear(s,this,"Y"),!1}}[this.getAttribute("data-handler")])})},_generateHTML:function(e){var i,s,n,o,a,r,l,h,c,u,d,p,f,g,m,_,v,b,y,w,x,k,C,D,I,T,P,M,S,H,z,O,A,E,N,W,F,L,R,Y=new Date,B=this._daylightSavingAdjust(new Date(Y.getFullYear(),Y.getMonth(),Y.getDate())),j=this._get(e,"isRTL"),q=this._get(e,"showButtonPanel"),K=this._get(e,"hideIfNoPrevNext"),U=this._get(e,"navigationAsDateFormat"),V=this._getNumberOfMonths(e),X=this._get(e,"showCurrentAtPos"),$=this._get(e,"stepMonths"),G=1!==V[0]||1!==V[1],Q=this._daylightSavingAdjust(e.currentDay?new Date(e.currentYear,e.currentMonth,e.currentDay):new Date(9999,9,9)),J=this._getMinMaxDate(e,"min"),Z=this._getMinMaxDate(e,"max"),tt=e.drawMonth-X,te=e.drawYear;if(tt<0&&(tt+=12,te--),Z){i=this._daylightSavingAdjust(new Date(Z.getFullYear(),Z.getMonth()-V[0]*V[1]+1,Z.getDate())),i=J&&i<J?J:i;while(this._daylightSavingAdjust(new Date(te,tt,1))>i)--tt<0&&(tt=11,te--)}for(e.drawMonth=tt,e.drawYear=te,s=this._get(e,"prevText"),s=U?this.formatDate(s,this._daylightSavingAdjust(new Date(te,tt-$,1)),this._getFormatConfig(e)):s,n=this._canAdjustMonth(e,-1,te,tt)?t("<a>").attr({class:"ui-datepicker-prev ui-corner-all","data-handler":"prev","data-event":"click",title:s}).append(t("<span>").addClass("ui-icon ui-icon-circle-triangle-"+(j?"e":"w")).text(s))[0].outerHTML:K?"":t("<a>").attr({class:"ui-datepicker-prev ui-corner-all ui-state-disabled",title:s}).append(t("<span>").addClass("ui-icon ui-icon-circle-triangle-"+(j?"e":"w")).text(s))[0].outerHTML,o=this._get(e,"nextText"),o=U?this.formatDate(o,this._daylightSavingAdjust(new Date(te,tt+$,1)),this._getFormatConfig(e)):o,a=this._canAdjustMonth(e,1,te,tt)?t("<a>").attr({class:"ui-datepicker-next ui-corner-all","data-handler":"next","data-event":"click",title:o}).append(t("<span>").addClass("ui-icon ui-icon-circle-triangle-"+(j?"w":"e")).text(o))[0].outerHTML:K?"":t("<a>").attr({class:"ui-datepicker-next ui-corner-all ui-state-disabled",title:o}).append(t("<span>").attr("class","ui-icon ui-icon-circle-triangle-"+(j?"w":"e")).text(o))[0].outerHTML,r=this._get(e,"currentText"),l=this._get(e,"gotoCurrent")&&e.currentDay?Q:B,r=U?this.formatDate(r,l,this._getFormatConfig(e)):r,h="",e.inline||(h=t("<button>").attr({type:"button",class:"ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all","data-handler":"hide","data-event":"click"}).text(this._get(e,"closeText"))[0].outerHTML),c="",q&&(c=t("<div class='ui-datepicker-buttonpane ui-widget-content'>").append(j?h:"").append(this._isInRange(e,l)?t("<button>").attr({type:"button",class:"ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all","data-handler":"today","data-event":"click"}).text(r):"").append(j?"":h)[0].outerHTML),u=isNaN(u=parseInt(this._get(e,"firstDay"),10))?0:u,d=this._get(e,"showWeek"),p=this._get(e,"dayNames"),f=this._get(e,"dayNamesMin"),g=this._get(e,"monthNames"),m=this._get(e,"monthNamesShort"),_=this._get(e,"beforeShowDay"),v=this._get(e,"showOtherMonths"),b=this._get(e,"selectOtherMonths"),y=this._getDefaultDate(e),w="",k=0;k<V[0];k++){for(D=0,C="",this.maxRows=4;D<V[1];D++){if(I=this._daylightSavingAdjust(new Date(te,tt,e.selectedDay)),T=" ui-corner-all",P="",G){if(P+="<div class='ui-datepicker-group",V[1]>1)switch(D){case 0:P+=" ui-datepicker-group-first",T=" ui-corner-"+(j?"right":"left");break;case V[1]-1:P+=" ui-datepicker-group-last",T=" ui-corner-"+(j?"left":"right");break;default:P+=" ui-datepicker-group-middle",T=""}P+="'>"}for(P+="<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix"+T+"'>"+(/all|left/.test(T)&&0===k?j?a:n:"")+(/all|right/.test(T)&&0===k?j?n:a:"")+this._generateMonthYearHeader(e,tt,te,J,Z,k>0||D>0,g,m)+"</div><table class='ui-datepicker-calendar'><thead><tr>",M=d?"<th class='ui-datepicker-week-col'>"+this._get(e,"weekHeader")+"</th>":"",x=0;x<7;x++)S=(x+u)%7,M+="<th scope='col'"+((x+u+6)%7>=5?" class='ui-datepicker-week-end'":"")+"><span title='"+p[S]+"'>"+f[S]+"</span></th>";for(P+=M+"</tr></thead><tbody>",H=this._getDaysInMonth(te,tt),te===e.selectedYear&&tt===e.selectedMonth&&(e.selectedDay=Math.min(e.selectedDay,H)),O=Math.ceil(((z=(this._getFirstDayOfMonth(te,tt)-u+7)%7)+H)/7),A=G&&this.maxRows>O?this.maxRows:O,this.maxRows=A,E=this._daylightSavingAdjust(new Date(te,tt,1-z)),N=0;N<A;N++){for(P+="<tr>",W=d?"<td class='ui-datepicker-week-col'>"+this._get(e,"calculateWeek")(E)+"</td>":"",x=0;x<7;x++)F=_?_.apply(e.input?e.input[0]:null,[E]):[!0,""],R=(L=E.getMonth()!==tt)&&!b||!F[0]||J&&E<J||Z&&E>Z,W+="<td class='"+((x+u+6)%7>=5?" ui-datepicker-week-end":"")+(L?" ui-datepicker-other-month":"")+(E.getTime()===I.getTime()&&tt===e.selectedMonth&&e._keyEvent||y.getTime()===E.getTime()&&y.getTime()===I.getTime()?" "+this._dayOverClass:"")+(R?" "+this._unselectableClass+" ui-state-disabled":"")+(L&&!v?"":" "+F[1]+(E.getTime()===Q.getTime()?" "+this._currentClass:"")+(E.getTime()===B.getTime()?" ui-datepicker-today":""))+"'"+((!L||v)&&F[2]?" title='"+F[2].replace(/'/g,"'")+"'":"")+(R?"":" data-handler='selectDay' data-event='click' data-month='"+E.getMonth()+"' data-year='"+E.getFullYear()+"'")+">"+(L&&!v?" ":R?"<span class='ui-state-default'>"+E.getDate()+"</span>":"<a class='ui-state-default"+(E.getTime()===B.getTime()?" ui-state-highlight":"")+(E.getTime()===Q.getTime()?" ui-state-active":"")+(L?" ui-priority-secondary":"")+"' href='#' aria-current='"+(E.getTime()===Q.getTime()?"true":"false")+"' data-date='"+E.getDate()+"'>"+E.getDate()+"</a>")+"</td>",E.setDate(E.getDate()+1),E=this._daylightSavingAdjust(E);P+=W+"</tr>"}++tt>11&&(tt=0,te++),P+="</tbody></table>"+(G?"</div>"+(V[0]>0&&D===V[1]-1?"<div class='ui-datepicker-row-break'></div>":""):""),C+=P}w+=C}return w+=c,e._keyEvent=!1,w},_generateMonthYearHeader:function(t,e,i,s,n,o,a,r){var l,h,c,u,d,p,f,g,m=this._get(t,"changeMonth"),_=this._get(t,"changeYear"),v=this._get(t,"showMonthAfterYear"),b=this._get(t,"selectMonthLabel"),y=this._get(t,"selectYearLabel"),w="<div class='ui-datepicker-title'>",x="";if(o||!m)x+="<span class='ui-datepicker-month'>"+a[e]+"</span>";else{for(l=s&&s.getFullYear()===i,h=n&&n.getFullYear()===i,x+="<select class='ui-datepicker-month' aria-label='"+b+"' data-handler='selectMonth' data-event='change'>",c=0;c<12;c++)(!l||c>=s.getMonth())&&(!h||c<=n.getMonth())&&(x+="<option value='"+c+"'"+(c===e?" selected='selected'":"")+">"+r[c]+"</option>");x+="</select>"}if(v||(w+=x+(o||!(m&&_)?" ":"")),!t.yearshtml){if(t.yearshtml="",o||!_)w+="<span class='ui-datepicker-year'>"+i+"</span>";else{for(u=this._get(t,"yearRange").split(":"),d=new Date().getFullYear(),g=Math.max(f=(p=function(t){var e=t.match(/c[+\-].*/)?i+parseInt(t.substring(1),10):t.match(/[+\-].*/)?d+parseInt(t,10):parseInt(t,10);return isNaN(e)?d:e})(u[0]),p(u[1]||"")),f=s?Math.max(f,s.getFullYear()):f,g=n?Math.min(g,n.getFullYear()):g,t.yearshtml+="<select class='ui-datepicker-year' aria-label='"+y+"' data-handler='selectYear' data-event='change'>";f<=g;f++)t.yearshtml+="<option value='"+f+"'"+(f===i?" selected='selected'":"")+">"+f+"</option>";t.yearshtml+="</select>",w+=t.yearshtml,t.yearshtml=null}}return w+=this._get(t,"yearSuffix"),v&&(w+=(o||!(m&&_)?" ":"")+x),w+="</div>"},_adjustInstDate:function(t,e,i){var s=t.selectedYear+("Y"===i?e:0),n=t.selectedMonth+("M"===i?e:0),o=Math.min(t.selectedDay,this._getDaysInMonth(s,n))+("D"===i?e:0),a=this._restrictMinMax(t,this._daylightSavingAdjust(new Date(s,n,o)));t.selectedDay=a.getDate(),t.drawMonth=t.selectedMonth=a.getMonth(),t.drawYear=t.selectedYear=a.getFullYear(),("M"===i||"Y"===i)&&this._notifyChange(t)},_restrictMinMax:function(t,e){var i=this._getMinMaxDate(t,"min"),s=this._getMinMaxDate(t,"max"),n=i&&e<i?i:e;return s&&n>s?s:n},_notifyChange:function(t){var e=this._get(t,"onChangeMonthYear");e&&e.apply(t.input?t.input[0]:null,[t.selectedYear,t.selectedMonth+1,t])},_getNumberOfMonths:function(t){var e=this._get(t,"numberOfMonths");return null==e?[1,1]:"number"==typeof e?[1,e]:e},_getMinMaxDate:function(t,e){return this._determineDate(t,this._get(t,e+"Date"),null)},_getDaysInMonth:function(t,e){return 32-this._daylightSavingAdjust(new Date(t,e,32)).getDate()},_getFirstDayOfMonth:function(t,e){return new Date(t,e,1).getDay()},_canAdjustMonth:function(t,e,i,s){var n=this._getNumberOfMonths(t),o=this._daylightSavingAdjust(new Date(i,s+(e<0?e:n[0]*n[1]),1));return e<0&&o.setDate(this._getDaysInMonth(o.getFullYear(),o.getMonth())),this._isInRange(t,o)},_isInRange:function(t,e){var i,s,n=this._getMinMaxDate(t,"min"),o=this._getMinMaxDate(t,"max"),a=null,r=null,l=this._get(t,"yearRange");return l&&(i=l.split(":"),s=new Date().getFullYear(),a=parseInt(i[0],10),r=parseInt(i[1],10),i[0].match(/[+\-].*/)&&(a+=s),i[1].match(/[+\-].*/)&&(r+=s)),(!n||e.getTime()>=n.getTime())&&(!o||e.getTime()<=o.getTime())&&(!a||e.getFullYear()>=a)&&(!r||e.getFullYear()<=r)},_getFormatConfig:function(t){var e=this._get(t,"shortYearCutoff");return{shortYearCutoff:e="string"!=typeof e?e:new Date().getFullYear()%100+parseInt(e,10),dayNamesShort:this._get(t,"dayNamesShort"),dayNames:this._get(t,"dayNames"),monthNamesShort:this._get(t,"monthNamesShort"),monthNames:this._get(t,"monthNames")}},_formatDate:function(t,e,i,s){e||(t.currentDay=t.selectedDay,t.currentMonth=t.selectedMonth,t.currentYear=t.selectedYear);var n=e?"object"==typeof e?e:this._daylightSavingAdjust(new Date(s,i,e)):this._daylightSavingAdjust(new Date(t.currentYear,t.currentMonth,t.currentDay));return this.formatDate(this._get(t,"dateFormat"),n,this._getFormatConfig(t))}}),t.fn.datepicker=function(e){if(!this.length)return this;t.datepicker.initialized||(t(document).on("mousedown",t.datepicker._checkExternalClick),t.datepicker.initialized=!0),0===t("#"+t.datepicker._mainDivId).length&&t("body").append(t.datepicker.dpDiv);var i=Array.prototype.slice.call(arguments,1);return"string"==typeof e&&("isDisabled"===e||"getDate"===e||"widget"===e)||"option"===e&&2==arguments.length&&"string"==typeof arguments[1]?t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this[0]].concat(i)):this.each(function(){"string"==typeof e?t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this].concat(i)):t.datepicker._attachDatepicker(this,e)})},t.datepicker=new P,t.datepicker.initialized=!1,t.datepicker.uuid=new Date().getTime(),t.datepicker.version="1.14.2",t.datepicker;var z=!1;function O(t){return function(){var e=this.element.val();t.apply(this,arguments),this._refresh(),e!==this.element.val()&&this._trigger("change")}}t(document).on("mouseup",function(){z=!1}),t.widget("ui.mouse",{version:"1.14.2",options:{cancel:"input, textarea, button, select, option",distance:1,delay:0},_mouseInit:function(){var e=this;this.element.on("mousedown."+this.widgetName,function(t){return e._mouseDown(t)}).on("click."+this.widgetName,function(i){if(!0===t.data(i.target,e.widgetName+".preventClickEvent"))return t.removeData(i.target,e.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1}),this.started=!1},_mouseDestroy:function(){this.element.off("."+this.widgetName),this._mouseMoveDelegate&&this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(e){if(!z){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(e),this._mouseDownEvent=e;var i=this,s=1===e.which,n="string"==typeof this.options.cancel&&t(e.target).closest(this.options.cancel).length;return!(s&&!n&&this._mouseCapture(e))||((this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){i.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=!1!==this._mouseStart(e),!this._mouseStarted))?e.preventDefault():(!0===t.data(e.target,this.widgetName+".preventClickEvent")&&t.removeData(e.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(t){return i._mouseMove(t)},this._mouseUpDelegate=function(t){return i._mouseUp(t)},this.document.on("mousemove."+this.widgetName,this._mouseMoveDelegate).on("mouseup."+this.widgetName,this._mouseUpDelegate),e.preventDefault(),z=!0),!0)}},_mouseMove:function(t){if(this._mouseMoved&&!t.which){if(t.originalEvent.altKey||t.originalEvent.ctrlKey||t.originalEvent.metaKey||t.originalEvent.shiftKey)this.ignoreMissingWhich=!0;else if(!this.ignoreMissingWhich)return this._mouseUp(t)}return((t.which||t.button)&&(this._mouseMoved=!0),this._mouseStarted)?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=!1!==this._mouseStart(this._mouseDownEvent,t),this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted)},_mouseUp:function(e){this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,e.target===this._mouseDownEvent.target&&t.data(e.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(e)),this._mouseDelayTimer&&(clearTimeout(this._mouseDelayTimer),delete this._mouseDelayTimer),this.ignoreMissingWhich=!1,z=!1,e.preventDefault()},_mouseDistanceMet:function(t){return Math.max(Math.abs(this._mouseDownEvent.pageX-t.pageX),Math.abs(this._mouseDownEvent.pageY-t.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),t.ui.plugin={add:function(e,i,s){var n,o=t.ui[e].prototype;for(n in s)o.plugins[n]=o.plugins[n]||[],o.plugins[n].push([i,s[n]])}
vendor: 14,241 bytes, line 12428
12428,call:function(t,e,i,s){var n,o=t.plugins[e];if(o&&(s||t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType))for(n=0;n<o.length;n++)t.options[o[n][0]]&&o[n][1].apply(t.element,i)}},t.widget("ui.draggable",t.ui.mouse,{version:"1.14.2",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"===this.options.helper&&this._setPositionRelative(),this.options.addClasses&&this._addClass("ui-draggable"),this._setHandleClassName(),this._mouseInit()},_setOption:function(t,e){this._super(t,e),"handle"===t&&(this._removeHandleClassName(),this._setHandleClassName())},_destroy:function(){if((this.helper||this.element).is(".ui-draggable-dragging")){this.destroyOnClear=!0;return}this._removeHandleClassName(),this._mouseDestroy()},_mouseCapture:function(e){var i=this.options;return!this.helper&&!i.disabled&&!(t(e.target).closest(".ui-resizable-handle").length>0)&&(this.handle=this._getHandle(e),!!this.handle&&(this._blurActiveElement(e),this._blockFrames(!0===i.iframeFix?"iframe":i.iframeFix),!0))},_blockFrames:function(e){this.iframeBlocks=this.document.find(e).map(function(){var e=t(this);return t("<div>").css("position","absolute").appendTo(e.parent()).outerWidth(e.outerWidth()).outerHeight(e.outerHeight()).offset(e.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_blurActiveElement:function(e){var i=this.document[0].activeElement;!t(e.target).closest(i).length&&t(i).trigger("blur")},_mouseStart:function(e){var i=this.options;return(this.helper=this._createHelper(e),this._addClass(this.helper,"ui-draggable-dragging"),this._cacheHelperProportions(),t.ui.ddmanager&&(t.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(!0),this.offsetParent=this.helper.offsetParent(),this.hasFixedAncestor=this.helper.parents().filter(function(){return"fixed"===t(this).css("position")}).length>0,this.positionAbs=this.element.offset(),this._refreshOffsets(e),this.originalPosition=this.position=this._generatePosition(e,!1),this.originalPageX=e.pageX,this.originalPageY=e.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),this._setContainment(),!1===this._trigger("start",e))?(this._clear(),!1):(this._cacheHelperProportions(),t.ui.ddmanager&&!i.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this._mouseDrag(e,!0),t.ui.ddmanager&&t.ui.ddmanager.dragStart(this,e),!0)},_refreshOffsets:function(t){this.offset={top:this.positionAbs.top-this.margins.top,left:this.positionAbs.left-this.margins.left,scroll:!1,parent:this._getParentOffset(),relative:this._getRelativeOffset()},this.offset.click={left:t.pageX-this.offset.left,top:t.pageY-this.offset.top}},_mouseDrag:function(e,i){if(this.hasFixedAncestor&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(e,!0),this.positionAbs=this._convertPositionTo("absolute"),!i){var s=this._uiHash();if(!1===this._trigger("drag",e,s))return this._mouseUp(new t.Event("mouseup",e)),!1;this.position=s.position}return this.helper[0].style.left=this.position.left+"px",this.helper[0].style.top=this.position.top+"px",t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),!1},_mouseStop:function(e){var i=this,s=!1;return t.ui.ddmanager&&!this.options.dropBehaviour&&(s=t.ui.ddmanager.drop(this,e)),this.dropped&&(s=this.dropped,this.dropped=!1),"invalid"===this.options.revert&&!s||"valid"===this.options.revert&&s||!0===this.options.revert||"function"==typeof this.options.revert&&this.options.revert.call(this.element,s)?t(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){!1!==i._trigger("stop",e)&&i._clear()}):!1!==this._trigger("stop",e)&&this._clear(),!1},_mouseUp:function(e){return this._unblockFrames(),t.ui.ddmanager&&t.ui.ddmanager.dragStop(this,e),this.handleElement.is(e.target)&&this.element.trigger("focus"),t.ui.mouse.prototype._mouseUp.call(this,e)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp(new t.Event("mouseup",{target:this.element[0]})):this._clear(),this},_getHandle:function(e){return!this.options.handle||!!t(e.target).closest(this.element.find(this.options.handle)).length},_setHandleClassName:function(){this.handleElement=this.options.handle?this.element.find(this.options.handle):this.element,this._addClass(this.handleElement,"ui-draggable-handle")},_removeHandleClassName:function(){this._removeClass(this.handleElement,"ui-draggable-handle")},_createHelper:function(e){var i=this.options,s="function"==typeof i.helper,n=s?t(i.helper.apply(this.element[0],[e])):"clone"===i.helper?this.element.clone().removeAttr("id"):this.element;return n.parents("body").length||n.appendTo("parent"===i.appendTo?this.element[0].parentNode:i.appendTo),s&&n[0]===this.element[0]&&this._setPositionRelative(),n[0]===this.element[0]||/(fixed|absolute)/.test(n.css("position"))||n.css("position","absolute"),n},_setPositionRelative:function(){/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative")},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),Array.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_isRootNode:function(t){return/(html|body)/i.test(t.tagName)||t===this.document[0]},_getParentOffset:function(){var e=this.offsetParent.offset(),i=this.document[0];return"absolute"===this.cssPosition&&this.scrollParent[0]!==i&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),this._isRootNode(this.offsetParent[0])&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"!==this.cssPosition)return{top:0,left:0};var t=this.element.position(),e=this._isRootNode(this.scrollParent[0]);return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+(e?0:this.scrollParent.scrollTop()),left:t.left-(parseInt(this.helper.css("left"),10)||0)+(e?0:this.scrollParent.scrollLeft())}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e,i,s,n=this.options,o=this.document[0];if(this.relativeContainer=null,!n.containment){this.containment=null;return}if("window"===n.containment){this.containment=[t(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,t(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,t(window).scrollLeft()+t(window).width()-this.helperProportions.width-this.margins.left,t(window).scrollTop()+(t(window).height()||o.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];return}if("document"===n.containment){this.containment=[0,0,t(o).width()-this.helperProportions.width-this.margins.left,(t(o).height()||o.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];return}if(n.containment.constructor===Array){this.containment=n.containment;return}"parent"===n.containment&&(n.containment=this.helper[0].parentNode),(s=(i=t(n.containment))[0])&&(e=/(scroll|auto)/.test(i.css("overflow")),this.containment=[(parseInt(i.css("borderLeftWidth"),10)||0)+(parseInt(i.css("paddingLeft"),10)||0),(parseInt(i.css("borderTopWidth"),10)||0)+(parseInt(i.css("paddingTop"),10)||0),(e?Math.max(s.scrollWidth,s.offsetWidth):s.offsetWidth)-(parseInt(i.css("borderRightWidth"),10)||0)-(parseInt(i.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(e?Math.max(s.scrollHeight,s.offsetHeight):s.offsetHeight)-(parseInt(i.css("borderBottomWidth"),10)||0)-(parseInt(i.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relativeContainer=i)},_convertPositionTo:function(t,e){e||(e=this.position);var i="absolute"===t?1:-1,s=this._isRootNode(this.scrollParent[0]);return{top:e.top+this.offset.relative.top*i+this.offset.parent.top*i-("fixed"===this.cssPosition?-this.offset.scroll.top:s?0:this.offset.scroll.top)*i,left:e.left+this.offset.relative.left*i+this.offset.parent.left*i-("fixed"===this.cssPosition?-this.offset.scroll.left:s?0:this.offset.scroll.left)*i}},_generatePosition:function(t,e){var i,s,n,o,a=this.options,r=this._isRootNode(this.scrollParent[0]),l=t.pageX,h=t.pageY;return r&&this.offset.scroll||(this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}),e&&(this.containment&&(this.relativeContainer?(s=this.relativeContainer.offset(),i=[this.containment[0]+s.left,this.containment[1]+s.top,this.containment[2]+s.left,this.containment[3]+s.top]):i=this.containment,t.pageX-this.offset.click.left<i[0]&&(l=i[0]+this.offset.click.left),t.pageY-this.offset.click.top<i[1]&&(h=i[1]+this.offset.click.top),t.pageX-this.offset.click.left>i[2]&&(l=i[2]+this.offset.click.left),t.pageY-this.offset.click.top>i[3]&&(h=i[3]+this.offset.click.top)),a.grid&&(n=a.grid[1]?this.originalPageY+Math.round((h-this.originalPageY)/a.grid[1])*a.grid[1]:this.originalPageY,h=i?n-this.offset.click.top>=i[1]||n-this.offset.click.top>i[3]?n:n-this.offset.click.top>=i[1]?n-a.grid[1]:n+a.grid[1]:n,o=a.grid[0]?this.originalPageX+Math.round((l-this.originalPageX)/a.grid[0])*a.grid[0]:this.originalPageX,l=i?o-this.offset.click.left>=i[0]||o-this.offset.click.left>i[2]?o:o-this.offset.click.left>=i[0]?o-a.grid[0]:o+a.grid[0]:o),"y"===a.axis&&(l=this.originalPageX),"x"===a.axis&&(h=this.originalPageY)),{top:h-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.offset.scroll.top:r?0:this.offset.scroll.top),left:l-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.offset.scroll.left:r?0:this.offset.scroll.left)}},_clear:function(){this._removeClass(this.helper,"ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},_trigger:function(e,i,s){return s=s||this._uiHash(),t.ui.plugin.call(this,e,[i,s,this],!0),/^(drag|start|stop)/.test(e)&&(this.positionAbs=this._convertPositionTo("absolute"),s.offset=this.positionAbs),t.Widget.prototype._trigger.call(this,e,i,s)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),t.ui.plugin.add("draggable","connectToSortable",{start:function(e,i,s){var n=t.extend({},i,{item:s.element});s.sortables=[],t(s.options.connectToSortable).each(function(){var i=t(this).sortable("instance");i&&!i.options.disabled&&(s.sortables.push(i),i.refreshPositions(),i._trigger("activate",e,n))})},stop:function(e,i,s){var n=t.extend({},i,{item:s.element});s.cancelHelperRemoval=!1,t.each(s.sortables,function(){this.isOver?(this.isOver=0,s.cancelHelperRemoval=!0,this.cancelHelperRemoval=!1,this._storedCSS={position:this.placeholder.css("position"),top:this.placeholder.css("top"),left:this.placeholder.css("left")},this._mouseStop(e),this.options.helper=this.options._helper):(this.cancelHelperRemoval=!0,this._trigger("deactivate",e,n))})},drag:function(e,i,s){t.each(s.sortables,function(){var n=!1,o=this;o.positionAbs=s.positionAbs,o.helperProportions=s.helperProportions,o.offset.click=s.offset.click,o._intersectsWith(o.containerCache)&&(n=!0,t.each(s.sortables,function(){return this.positionAbs=s.positionAbs,this.helperProportions=s.helperProportions,this.offset.click=s.offset.click,this!==o&&this._intersectsWith(this.containerCache)&&t.contains(o.element[0],this.element[0])&&(n=!1),n})),n?(o.isOver||(o.isOver=1,s._parent=i.helper.parent(),o.currentItem=i.helper.appendTo(o.element).data("ui-sortable-item",!0),o.options._helper=o.options.helper,o.options.helper=function(){return i.helper[0]},e.target=o.currentItem[0],o._mouseCapture(e,!0),o._mouseStart(e,!0,!0),o.offset.click.top=s.offset.click.top,o.offset.click.left=s.offset.click.left,o.offset.parent.left-=s.offset.parent.left-o.offset.parent.left,o.offset.parent.top-=s.offset.parent.top-o.offset.parent.top,s._trigger("toSortable",e),s.dropped=o.element,t.each(s.sortables,function(){this.refreshPositions()}),s.currentItem=s.element,o.fromOutside=s),o.currentItem&&(o._mouseDrag(e),i.position=o.position)):o.isOver&&(o.isOver=0,o.cancelHelperRemoval=!0,o.options._revert=o.options.revert,o.options.revert=!1,o._trigger("out",e,o._uiHash(o)),o._mouseStop(e,!0),o.options.revert=o.options._revert,o.options.helper=o.options._helper,o.placeholder&&o.placeholder.remove(),i.helper.appendTo(s._parent),s._refreshOffsets(e),i.position=s._generatePosition(e,!0),s._trigger("fromSortable",e),s.dropped=!1,t.each(s.sortables,function(){this.refreshPositions()}))})}}),t.ui.plugin.add("draggable","cursor",{start:function(e,i,s){var n=t("body"),o=s.options;n.css("cursor")&&(o._cursor=n.css("cursor")),n.css("cursor",o.cursor)},stop:function(e,i,s){var n=s.options;n._cursor&&t("body").css("cursor",n._cursor)}}),t.ui.plugin.add("draggable","opacity",{start:function(e,i,s){var n=t(i.helper),o=s.options;n.css("opacity")&&(o._opacity=n.css("opacity")),n.css("opacity",o.opacity)},stop:function(e,i,s){var n=s.options;n._opacity&&t(i.helper).css("opacity",n._opacity)}}
vendor: 7,485 bytes, line 12428
12428),t.ui.plugin.add("draggable","scroll",{start:function(t,e,i){i.scrollParentNotHidden||(i.scrollParentNotHidden=i.helper.scrollParent(!1)),i.scrollParentNotHidden[0]!==i.document[0]&&"HTML"!==i.scrollParentNotHidden[0].tagName&&(i.overflowOffset=i.scrollParentNotHidden.offset())},drag:function(e,i,s){var n=s.options,o=!1,a=s.scrollParentNotHidden[0],r=s.document[0];a!==r&&"HTML"!==a.tagName?((!n.axis||"x"!==n.axis)&&(s.overflowOffset.top+a.offsetHeight-e.pageY<n.scrollSensitivity?a.scrollTop=o=a.scrollTop+n.scrollSpeed:e.pageY-s.overflowOffset.top<n.scrollSensitivity&&(a.scrollTop=o=a.scrollTop-n.scrollSpeed)),(!n.axis||"y"!==n.axis)&&(s.overflowOffset.left+a.offsetWidth-e.pageX<n.scrollSensitivity?a.scrollLeft=o=a.scrollLeft+n.scrollSpeed:e.pageX-s.overflowOffset.left<n.scrollSensitivity&&(a.scrollLeft=o=a.scrollLeft-n.scrollSpeed))):((!n.axis||"x"!==n.axis)&&(e.pageY-t(r).scrollTop()<n.scrollSensitivity?o=t(r).scrollTop(t(r).scrollTop()-n.scrollSpeed):t(window).height()-(e.pageY-t(r).scrollTop())<n.scrollSensitivity&&(o=t(r).scrollTop(t(r).scrollTop()+n.scrollSpeed))),(!n.axis||"y"!==n.axis)&&(e.pageX-t(r).scrollLeft()<n.scrollSensitivity?o=t(r).scrollLeft(t(r).scrollLeft()-n.scrollSpeed):t(window).width()-(e.pageX-t(r).scrollLeft())<n.scrollSensitivity&&(o=t(r).scrollLeft(t(r).scrollLeft()+n.scrollSpeed)))),!1!==o&&t.ui.ddmanager&&!n.dropBehaviour&&t.ui.ddmanager.prepareOffsets(s,e)}}),t.ui.plugin.add("draggable","snap",{start:function(e,i,s){var n=s.options;s.snapElements=[],t(n.snap.constructor!==String?n.snap.items||":data(ui-draggable)":n.snap).each(function(){var e=t(this),i=e.offset();this!==s.element[0]&&s.snapElements.push({item:this,width:e.outerWidth(),height:e.outerHeight(),top:i.top,left:i.left})})},drag:function(e,i,s){var n,o,a,r,l,h,c,u,d,p,f=s.options,g=f.snapTolerance,m=i.offset.left,_=m+s.helperProportions.width,v=i.offset.top,b=v+s.helperProportions.height;for(d=s.snapElements.length-1;d>=0;d--){if(h=(l=s.snapElements[d].left-s.margins.left)+s.snapElements[d].width,u=(c=s.snapElements[d].top-s.margins.top)+s.snapElements[d].height,_<l-g||m>h+g||b<c-g||v>u+g||!t.contains(s.snapElements[d].item.ownerDocument,s.snapElements[d].item)){s.snapElements[d].snapping&&s.options.snap.release&&s.options.snap.release.call(s.element,e,t.extend(s._uiHash(),{snapItem:s.snapElements[d].item})),s.snapElements[d].snapping=!1;continue}"inner"!==f.snapMode&&(n=Math.abs(c-b)<=g,o=Math.abs(u-v)<=g,a=Math.abs(l-_)<=g,r=Math.abs(h-m)<=g,n&&(i.position.top=s._convertPositionTo("relative",{top:c-s.helperProportions.height,left:0}).top),o&&(i.position.top=s._convertPositionTo("relative",{top:u,left:0}).top),a&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l-s.helperProportions.width}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h}).left)),p=n||o||a||r,"outer"!==f.snapMode&&(n=Math.abs(c-v)<=g,o=Math.abs(u-b)<=g,a=Math.abs(l-m)<=g,r=Math.abs(h-_)<=g,n&&(i.position.top=s._convertPositionTo("relative",{top:c,left:0}).top),o&&(i.position.top=s._convertPositionTo("relative",{top:u-s.helperProportions.height,left:0}).top),a&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h-s.helperProportions.width}).left)),!s.snapElements[d].snapping&&(n||o||a||r||p)&&s.options.snap.snap&&s.options.snap.snap.call(s.element,e,t.extend(s._uiHash(),{snapItem:s.snapElements[d].item})),s.snapElements[d].snapping=n||o||a||r||p}}}),t.ui.plugin.add("draggable","stack",{start:function(e,i,s){var n,o=s.options,a=t.makeArray(t(o.stack)).sort(function(e,i){return(parseInt(t(e).css("zIndex"),10)||0)-(parseInt(t(i).css("zIndex"),10)||0)});a.length&&(n=parseInt(t(a[0]).css("zIndex"),10)||0,t(a).each(function(e){t(this).css("zIndex",n+e)}),this.css("zIndex",n+a.length))}}),t.ui.plugin.add("draggable","zIndex",{start:function(e,i,s){var n=t(i.helper),o=s.options;n.css("zIndex")&&(o._zIndex=n.css("zIndex")),n.css("zIndex",o.zIndex)},stop:function(e,i,s){var n=s.options;n._zIndex&&t(i.helper).css("zIndex",n._zIndex)}}),t.ui.draggable,t.widget("ui.resizable",t.ui.mouse,{version:"1.14.2",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,classes:{"ui-resizable-se":"ui-icon ui-icon-gripsmall-diagonal-se"},containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_num:function(t){return parseFloat(t)||0},_isNumber:function(t){return!isNaN(parseFloat(t))},_hasScroll:function(e,i){var s,n=!1,o=t(e).css("overflow");if("hidden"===o)return!1;if("scroll"===o||e[s=i&&"left"===i?"scrollLeft":"scrollTop"]>0)return!0;try{e[s]=1,n=e[s]>0,e[s]=0}catch(t){}return n},_create:function(){var e,i=this.options,s=this;this._addClass("ui-resizable"),t.extend(this,{_aspectRatio:!!i.aspectRatio,aspectRatio:i.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:i.helper||i.ghost||i.animate?i.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)&&(this.element.wrap(t("<div class='ui-wrapper'></div>").css({overflow:"hidden",position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.resizable("instance")),this.elementIsWrapper=!0,e={marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom"),marginLeft:this.originalElement.css("marginLeft")},this.element.css(e),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this._proportionallyResize()),this._setupHandles(),i.autoHide&&t(this.element).on("mouseenter",function(){!i.disabled&&(s._removeClass("ui-resizable-autohide"),s._handles.show())}).on("mouseleave",function(){!i.disabled&&(s.resizing||(s._addClass("ui-resizable-autohide"),s._handles.hide()))}),this._mouseInit()},_destroy:function(){this._mouseDestroy(),this._addedHandles.remove();var e,i=function(e){t(e).removeData("resizable").removeData("ui-resizable").off(".resizable")};return this.elementIsWrapper&&(i(this.element),e=this.element,this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")}).insertAfter(e),e.remove()),this.originalElement.css("resize",this.originalResizeStyle),i(this.originalElement),this},_setOption:function(t,e){switch(this._super(t,e),t){case"handles":this._removeHandles(),this._setupHandles();break;case"aspectRatio":this._aspectRatio=!!e}},_setupHandles:function(){var e,i,s,n,o,a=this.options,r=this;if(this.handles=a.handles||(t(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this._handles=t(),this._addedHandles=t(),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),s=this.handles.split(","),this.handles={},i=0;i<s.length;i++)n="ui-resizable-"+(e=String.prototype.trim.call(s[i])),o=t("<
vendor: 13,711 bytes, line 12428
12428div>"),this._addClass(o,"ui-resizable-handle "+n),o.css({zIndex:a.zIndex}),this.handles[e]=".ui-resizable-"+e,this.element.children(this.handles[e]).length||(this.element.append(o),this._addedHandles=this._addedHandles.add(o));this._renderAxis=function(e){var i,s,n,o;for(i in e=e||this.element,this.handles)this.handles[i].constructor===String?this.handles[i]=this.element.children(this.handles[i]).first().show():(this.handles[i].jquery||this.handles[i].nodeType)&&(this.handles[i]=t(this.handles[i]),this._on(this.handles[i],{mousedown:r._mouseDown})),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)&&(s=t(this.handles[i],this.element),o=/sw|ne|nw|se|n|s/.test(i)?s.outerHeight():s.outerWidth(),n=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join(""),e.css(n,o),this._proportionallyResize()),this._handles=this._handles.add(this.handles[i])},this._renderAxis(this.element),this._handles=this._handles.add(this.element.find(".ui-resizable-handle")),this._handles.disableSelection(),this._handles.on("mouseover",function(){r.resizing||(this.className&&(o=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),r.axis=o&&o[1]?o[1]:"se")}),a.autoHide&&(this._handles.hide(),this._addClass("ui-resizable-autohide"))},_removeHandles:function(){this._addedHandles.remove()},_mouseCapture:function(e){var i,s,n=!1;for(i in this.handles)((s=t(this.handles[i])[0])===e.target||t.contains(s,e.target))&&(n=!0);return!this.options.disabled&&n},_mouseStart:function(e){var i,s,n,o,a=this.options,r=this.element;return this.resizing=!0,this._renderProxy(),i=this._num(this.helper.css("left")),s=this._num(this.helper.css("top")),a.containment&&(i+=t(a.containment).scrollLeft()||0,s+=t(a.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:i,top:s},this._helper||(o=this._calculateAdjustedElementDimensions(r)),this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:o.width,height:o.height},this.originalSize=this._helper?{width:r.outerWidth(),height:r.outerHeight()}:{width:o.width,height:o.height},this.sizeDiff={width:r.outerWidth()-r.width(),height:r.outerHeight()-r.height()},this.originalPosition={left:i,top:s},this.originalMousePosition={left:e.pageX,top:e.pageY},this.aspectRatio="number"==typeof a.aspectRatio?a.aspectRatio:this.originalSize.width/this.originalSize.height||1,n=t(".ui-resizable-"+this.axis).css("cursor"),t("body").css("cursor","auto"===n?this.axis+"-resize":n),this._addClass("ui-resizable-resizing"),this._propagate("start",e),!0},_mouseDrag:function(e){var i,s,n=this.originalMousePosition,o=this.axis,a=e.pageX-n.left||0,r=e.pageY-n.top||0,l=this._change[o];return this._updatePrevProperties(),!!l&&(i=l.apply(this,[e,a,r]),this._updateVirtualBoundaries(e.shiftKey),(this._aspectRatio||e.shiftKey)&&(i=this._updateRatio(i,e)),i=this._respectSize(i,e),this._updateCache(i),this._propagate("resize",e),s=this._applyChanges(),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),t.isEmptyObject(s)||(this._updatePrevProperties(),this._trigger("resize",e,this.ui()),this._applyChanges()),!1)},_mouseStop:function(e){this.resizing=!1;var i,s,n,o,a,r,l,h=this.options;return this._helper&&(n=(s=(i=this._proportionallyResizeElements).length&&/textarea/i.test(i[0].nodeName))&&this._hasScroll(i[0],"left")?0:this.sizeDiff.height,o=s?0:this.sizeDiff.width,a={width:this.helper.width()-o,height:this.helper.height()-n},r=parseFloat(this.element.css("left"))+(this.position.left-this.originalPosition.left)||null,l=parseFloat(this.element.css("top"))+(this.position.top-this.originalPosition.top)||null,h.animate||this.element.css(t.extend(a,{top:l,left:r})),this.helper.height(this.size.height),this.helper.width(this.size.width),this._helper&&!h.animate&&this._proportionallyResize()),t("body").css("cursor","auto"),this._removeClass("ui-resizable-resizing"),this._propagate("stop",e),this._helper&&this.helper.remove(),!1},_updatePrevProperties:function(){this.prevPosition={top:this.position.top,left:this.position.left},this.prevSize={width:this.size.width,height:this.size.height}},_applyChanges:function(){var t={};return this.position.top!==this.prevPosition.top&&(t.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(t.left=this.position.left+"px"),this.helper.css(t),this.size.width!==this.prevSize.width&&(t.width=this.size.width+"px",this.helper.width(t.width)),this.size.height!==this.prevSize.height&&(t.height=this.size.height+"px",this.helper.height(t.height)),t},_updateVirtualBoundaries:function(t){var e,i,s,n,o,a=this.options;o={minWidth:this._isNumber(a.minWidth)?a.minWidth:0,maxWidth:this._isNumber(a.maxWidth)?a.maxWidth:1/0,minHeight:this._isNumber(a.minHeight)?a.minHeight:0,maxHeight:this._isNumber(a.maxHeight)?a.maxHeight:1/0},(this._aspectRatio||t)&&(e=o.minHeight*this.aspectRatio,s=o.minWidth/this.aspectRatio,i=o.maxHeight*this.aspectRatio,n=o.maxWidth/this.aspectRatio,e>o.minWidth&&(o.minWidth=e),s>o.minHeight&&(o.minHeight=s),i<o.maxWidth&&(o.maxWidth=i),n<o.maxHeight&&(o.maxHeight=n)),this._vBoundaries=o},_updateCache:function(t){this.offset=this.helper.offset(),this._isNumber(t.left)&&(this.position.left=t.left),this._isNumber(t.top)&&(this.position.top=t.top),this._isNumber(t.height)&&(this.size.height=t.height),this._isNumber(t.width)&&(this.size.width=t.width)},_updateRatio:function(t){var e=this.position,i=this.size,s=this.axis;return this._isNumber(t.height)?t.width=t.height*this.aspectRatio:this._isNumber(t.width)&&(t.height=t.width/this.aspectRatio),"sw"===s&&(t.left=e.left+(i.width-t.width),t.top=null),"nw"===s&&(t.top=e.top+(i.height-t.height),t.left=e.left+(i.width-t.width)),t},_respectSize:function(t){var e=this._vBoundaries,i=this.axis,s=this._isNumber(t.width)&&e.maxWidth&&e.maxWidth<t.width,n=this._isNumber(t.height)&&e.maxHeight&&e.maxHeight<t.height,o=this._isNumber(t.width)&&e.minWidth&&e.minWidth>t.width,a=this._isNumber(t.height)&&e.minHeight&&e.minHeight>t.height,r=this.originalPosition.left+this.originalSize.width,l=this.originalPosition.top+this.originalSize.height,h=/sw|nw|w/.test(i),c=/nw|ne|n/.test(i);return o&&(t.width=e.minWidth),a&&(t.height=e.minHeight),s&&(t.width=e.maxWidth),n&&(t.height=e.maxHeight),o&&h&&(t.left=r-e.minWidth),s&&h&&(t.left=r-e.maxWidth),a&&c&&(t.top=l-e.minHeight),n&&c&&(t.top=l-e.maxHeight),t.width||t.height||t.left||!t.top?t.width||t.height||t.top||!t.left||(t.left=null):t.top=null,t},_getPaddingPlusBorderDimensions:function(t){for(var e=0,i=[],s=[t.css("borderTopWidth"),t.css("borderRightWidth"),t.css("borderBottomWidth"),t.css("borderLeftWidth")],n=[t.css("paddingTop"),t.css("paddingRight"),t.css("paddingBottom"),t.css("paddingLeft")];e<4;e++)i[e]=parseFloat(s[e])||0,i[e]+=parseFloat(n[e])||0;return{height:i[0]+i[2],width:i[1]+i[3]}},_calculateAdjustedElementDimensions:function(t){var e,i,s,n=t.get(0);return"content-box"===t.css("box-sizing")&&(this._hasScroll(n)||this._hasScroll(n,"left"))?(e=parseFloat(n.style.width),i=parseFloat(n.style.height),s=this._getPaddingPlusBorderDimensions(t),e=isNaN(e)?this._getElementTheoreticalSize(t,s,"width"):e,{height:i=isNaN(i)?this._getElementTheoreticalSize(t,s,"height"):i,width:e}):{height:parseFloat(t.css("height")),width:parseFloat(t.css("width"))}},_getElementTheoreticalSize:function(t,e,i){return Math.max(0,Math.ceil(t.get(0)["offset"+i[0].toUpperCase()+i.slice(1)]-e[i]-.5))||0},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var t,e=0,i=this.helper||this.element;e<this._proportionallyResizeElements.length;e++)t=this._proportionallyResizeElements[e],this.outerDimensions||(this.outerDimensions=this._getPaddingPlusBorderDimensions(t)),t.css({height:i.height()-this.outerDimensions.height||0,width:i.width()-this.outerDimensions.width||0})},_renderProxy:function(){var e=this.element,i=this.options;this.elementOffset=e.offset(),this._helper?(this.helper=this.helper||t("<div></div>").css({overflow:"hidden"}),this._addClass(this.helper,this._helper),this.helper.css({width:this.element.outerWidth(),height:this.element.outerHeight(),position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++i.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(t,e){return{width:this.originalSize.width+e}},w:function(t,e){var i=this.originalSize;return{left:this.originalPosition.left+e,width:i.width-e}},n:function(t,e,i){var s=this.originalSize;return{top:this.originalPosition.top+i,height:s.height-i}},s:function(t,e,i){return{height:this.originalSize.height+i}},se:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},sw:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[e,i,s]))},ne:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},nw:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[e,i,s]))}},_propagate:function(e,i){t.ui.plugin.call(this,e,[i,this.ui()]),"resize"!==e&&this._trigger(e,i,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),t.ui.plugin.add("resizable","animate",{stop:function(e){var i=t(this).resizable("instance"),s=i.options,n=i._proportionallyResizeElements,o=n.length&&/textarea/i.test(n[0].nodeName),a=o&&i._hasScroll(n[0],"left")?0:i.sizeDiff.height,r=o?0:i.sizeDiff.width,l={width:i.size.width-r,height:i.size.height-a},h=parseFloat(i.element.css("left"))+(i.position.left-i.originalPosition.left)||null,c=parseFloat(i.element.css("top"))+(i.position.top-i.originalPosition.top)||null;i.element.animate(t.extend(l,c&&h?{top:c,left:h}:{}),{duration:s.animateDuration,easing:s.animateEasing,step:function(){var s={width:parseFloat(i.element.css("width")),height:parseFloat(i.element.css("height")),top:parseFloat(i.element.css("top")),left:parseFloat(i.element.css("left"))};n&&n.length&&t(n[0]).css({width:s.width,height:s.height}),i._updateCache(s),i._propagate("resize",e)}})}}),t.ui.plugin.add("resizable","containment",{start:function(){var e,i,s,n,o,a,r,l=t(this).resizable("instance"),h=l.options,c=l.element,u=h.containment,d=u instanceof t?u.get(0):/parent/.test(u)?c.parent().get(0):u;d&&(l.containerElement=t(d),/document/.test(u)||u===document?(l.containerOffset={left:0,top:0},l.containerPosition={left:0,top:0},l.parentData={element:t(document),left:0,top:0,width:t(document).width(),height:t(document).height()||document.body.parentNode.scrollHeight}):(e=t(d),i=[],t(["Top","Right","Left","Bottom"]).each(function(t,s){i[t]=l._num(e.css("padding"+s))}),l.containerOffset=e.offset(),l.containerPosition=e.position(),l.containerSize={height:e.innerHeight()-i[3],width:e.innerWidth()-i[1]},s=l.containerOffset,n=l.containerSize.height,o=l.containerSize.width,a=l._hasScroll(d,"left")?d.scrollWidth:o,r=l._hasScroll(d)?d.scrollHeight:n,l.parentData={element:d,left:s.left,top:s.top,width:a,height:r}))},resize:function(e){var i,s,n,o,a=t(this).resizable("instance"),r=a.options,l=a.containerOffset,h=a.position,c=a._aspectRatio||e.shiftKey,u={top:0,left:0},d=a.containerElement,p=!0;d[0]!==document&&/static/.test(d.css("position"))&&(u=l),h.left<(a._helper?l.left:0)&&(a.size.width=a.size.width+(a._helper?a.position.left-l.left:a.position.left-u.left),c&&(a.size.height=a.size.width/a.aspectRatio,p=!1),a.position.left=r.helper?l.left:0),h.top<(a._helper?l.top:0)&&(a.size.height=a.size.height+(a._helper?a.position.top-l.top:a.position.top),c&&(a.size.width=a.size.height*a.aspectRatio,p=!1),a.position.top=a._helper?l.top:0),n=a.containerElement.get(0)===a.element.parent().get(0),o=/relative|absolute/.test(a.containerElement.css("position")),n&&o?(a.offset.left=a.parentData.left+a.position.left,a.offset.top=a.parentData.top+a.position.top):(a.offset.left=a.element.offset().left,a.offset.top=a.element.offset().top),i=Math.abs(a.sizeDiff.width+(a._helper?a.offset.left-u.left:a.offset.left-l.left)),s=Math.abs(a.sizeDiff.height+(a._helper?a.offset.top-u.top:a.offset.top-l.top)),i+a.size.width>=a.parentData.width&&(a.size.width=a.parentData.width-i,c&&(a.size.height=a.size.width/a.aspectRatio,p=!1)),s+a.size.height>=a.parentData.height&&(a.size.height=a.parentData.height-s,c&&(a.size.width=a.size.height*a.aspectRatio,p=!1)),p||(a.position.left=a.prevPosition.left,a.position.top=a.prevPosition.top,a.size.width=a.prevSize.width,a.size.height=a.prevSize.height)},stop:function(){var e=t(this).resizable("instance"),i=e.options,s=e.containerOffset,n=e.containerPosition,o=e.containerElement,a=t(e.helper),r=a.offset(),l=a.outerWidth()-e.sizeDiff.width,h=a.outerHeight()-e.sizeDiff.height;e._helper&&!i.animate&&/relative/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:l,height:h}),e._helper&&!i.animate&&/static/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:l,height:h})}}),t.ui.plugin.add("resizable","alsoResize",{start:function(){var e=t(this).resizable("instance");t(e.options.alsoResize).each(function(){var i=t(this),s=e._calculateAdjustedElementDimensions(i);i.data("ui-resizable-alsoresize",{width:s.width,height:s.height,left:parseFloat(i.css("left")),top:parseFloat(i.css("top"))})})},resize:function(e,i){var s=t(this).resizable("instance"),n=s.options,o=s.originalSize,a=s.originalPosition,r={height:s.size.height-o.height||0,width:s.size.width-o.width||0,top:s.position.top-a.top||0,left
vendor: 8,009 bytes, line 12428
12428:s.position.left-a.left||0};t(n.alsoResize).each(function(){var e=t(this),s=t(this).data("ui-resizable-alsoresize"),n={},o=e.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];t.each(o,function(t,e){var i=(s[e]||0)+(r[e]||0);i&&i>=0&&(n[e]=i||null)}),e.css(n)})},stop:function(){t(this).removeData("ui-resizable-alsoresize")}}),t.ui.plugin.add("resizable","ghost",{start:function(){var e=t(this).resizable("instance"),i=e.size;e.ghost=e.originalElement.clone(),e.ghost.css({opacity:.25,display:"block",position:"relative",height:i.height,width:i.width,margin:0,left:0,top:0}),e._addClass(e.ghost,"ui-resizable-ghost"),!0===t.uiBackCompat&&"string"==typeof e.options.ghost&&e.ghost.addClass(this.options.ghost),e.ghost.appendTo(e.helper)},resize:function(){var e=t(this).resizable("instance");e.ghost&&e.ghost.css({position:"relative",height:e.size.height,width:e.size.width})},stop:function(){var e=t(this).resizable("instance");e.ghost&&e.helper&&e.helper.get(0).removeChild(e.ghost.get(0))}}),t.ui.plugin.add("resizable","grid",{resize:function(){var e,i=t(this).resizable("instance"),s=i.options,n=i.size,o=i.originalSize,a=i.originalPosition,r=i.axis,l="number"==typeof s.grid?[s.grid,s.grid]:s.grid,h=l[0]||1,c=l[1]||1,u=Math.round((n.width-o.width)/h)*h,d=Math.round((n.height-o.height)/c)*c,p=o.width+u,f=o.height+d,g=s.maxWidth&&s.maxWidth<p,m=s.maxHeight&&s.maxHeight<f,_=s.minWidth&&s.minWidth>p,v=s.minHeight&&s.minHeight>f;s.grid=l,_&&(p+=h),v&&(f+=c),g&&(p-=h),m&&(f-=c),/^(se|s|e)$/.test(r)?(i.size.width=p,i.size.height=f):/^(ne)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.top=a.top-d):/^(sw)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.left=a.left-u):((f-c<=0||p-h<=0)&&(e=i._getPaddingPlusBorderDimensions(this)),f-c>0?(i.size.height=f,i.position.top=a.top-d):(f=c-e.height,i.size.height=f,i.position.top=a.top+o.height-f),p-h>0?(i.size.width=p,i.position.left=a.left-u):(p=h-e.width,i.size.width=p,i.position.left=a.left+o.width-p))}}),t.ui.resizable,t.widget("ui.dialog",{version:"1.14.2",options:{appendTo:"body",autoOpen:!0,buttons:[],classes:{"ui-dialog":"ui-corner-all","ui-dialog-titlebar":"ui-corner-all"},closeOnEscape:!0,closeText:"Close",draggable:!0,hide:null,height:"auto",maxHeight:null,maxWidth:null,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",of:window,collision:"fit",using:function(e){var i=t(this).css(e).offset().top;i<0&&t(this).css("top",e.top-i)}},resizable:!0,show:null,title:null,uiDialogTitleHeadingLevel:0,width:300,beforeClose:null,close:null,drag:null,dragStart:null,dragStop:null,focus:null,open:null,resize:null,resizeStart:null,resizeStop:null},sizeRelatedOptions:{buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},resizableRelatedOptions:{maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0},_create:function(){this.originalCss={display:this.element[0].style.display,width:this.element[0].style.width,minHeight:this.element[0].style.minHeight,maxHeight:this.element[0].style.maxHeight,height:this.element[0].style.height},this.originalPosition={parent:this.element.parent(),index:this.element.parent().children().index(this.element)},this.originalTitle=this.element.attr("title"),null==this.options.title&&null!=this.originalTitle&&(this.options.title=this.originalTitle),this.options.disabled&&(this.options.disabled=!1),this._createWrapper(),this.element.show().removeAttr("title").appendTo(this.uiDialog),this._addClass("ui-dialog-content","ui-widget-content"),this._createTitlebar(),this._createButtonPane(),this.options.draggable&&t.fn.draggable&&this._makeDraggable(),this.options.resizable&&t.fn.resizable&&this._makeResizable(),this._isOpen=!1,this._trackFocus()},_init:function(){this.options.autoOpen&&this.open()},_appendTo:function(){var e=this.options.appendTo;return e&&(e.jquery||e.nodeType)?t(e):this.document.find(e||"body").eq(0)},_destroy:function(){var t,e=this.originalPosition;this._untrackInstance(),this._destroyOverlay(),this.element.removeUniqueId().css(this.originalCss).detach(),this.uiDialog.remove(),this.originalTitle&&this.element.attr("title",this.originalTitle),(t=e.parent.children().eq(e.index)).length&&t[0]!==this.element[0]?t.before(this.element):e.parent.append(this.element)},widget:function(){return this.uiDialog},disable:t.noop,enable:t.noop,close:function(e){var i=this;this._isOpen&&!1!==this._trigger("beforeClose",e)&&(this._isOpen=!1,this._focusedElement=null,this._destroyOverlay(),this._untrackInstance(),this.opener.filter(":focusable").trigger("focus").length||t(this.document[0].activeElement).trigger("blur"),this._hide(this.uiDialog,this.options.hide,function(){i._trigger("close",e)}))},isOpen:function(){return this._isOpen},moveToTop:function(){this._moveToTop()},_moveToTop:function(e,i){var s=!1,n=this.uiDialog.siblings(".ui-front:visible").map(function(){return+t(this).css("z-index")}).get(),o=Math.max.apply(null,n);return o>=+this.uiDialog.css("z-index")&&(this.uiDialog.css("z-index",o+1),s=!0),s&&!i&&this._trigger("focus",e),s},open:function(){var e=this;if(this._isOpen){this._moveToTop()&&this._focusTabbable();return}this._isOpen=!0,this.opener=t(this.document[0].activeElement),this._size(),this._position(),this._createOverlay(),this._moveToTop(null,!0),this.overlay&&this.overlay.css("z-index",this.uiDialog.css("z-index")-1),this._show(this.uiDialog,this.options.show,function(){e._focusTabbable(),e._trigger("focus")}),this._makeFocusTarget(),this._trigger("open")},_focusTabbable:function(){var t=this._focusedElement;t||(t=this.element.find("[autofocus]")),t.length||(t=this.element.find(":tabbable")),t.length||(t=this.uiDialogButtonPane.find(":tabbable")),t.length||(t=this.uiDialogTitlebarClose.filter(":tabbable")),t.length||(t=this.uiDialog),t.eq(0).trigger("focus")},_restoreTabbableFocus:function(){var e=this.document[0].activeElement;this.uiDialog[0]===e||t.contains(this.uiDialog[0],e)||this._focusTabbable()},_keepFocus:function(t){t.preventDefault(),this._restoreTabbableFocus()},_createWrapper:function(){this.uiDialog=t("<div>").hide().attr({tabIndex:-1,role:"dialog","aria-modal":this.options.modal?"true":null}).appendTo(this._appendTo()),this._addClass(this.uiDialog,"ui-dialog","ui-widget ui-widget-content ui-front"),this._on(this.uiDialog,{keydown:function(e){if(this.options.closeOnEscape&&!e.isDefaultPrevented()&&e.keyCode&&e.keyCode===t.ui.keyCode.ESCAPE){e.preventDefault(),this.close(e);return}if(!(e.keyCode!==t.ui.keyCode.TAB||e.isDefaultPrevented())){var i=this.uiDialog.find(":tabbable"),s=i.first(),n=i.last();e.target!==n[0]&&e.target!==this.uiDialog[0]||e.shiftKey?(e.target===s[0]||e.target===this.uiDialog[0])&&e.shiftKey&&(this._delay(function(){n.trigger("focus")}),e.preventDefault()):(this._delay(function(){s.trigger("focus")}),e.preventDefault())}},mousedown:function(t){this._moveToTop(t)&&this._focusTabbable()}}),this.element.find("[aria-describedby]").length||this.uiDialog.attr({"aria-describedby":this.element.uniqueId().attr("id")})},_createTitlebar:function(){var e;this.uiDialogTitlebar=t("<div>"),this._addClass(this.uiDialogTitlebar,"ui-dialog-titlebar","ui-widget-header ui-helper-clearfix"),this._on(this.uiDialogTitlebar,{mousedown:function(e){t(e.target).closest(".ui-dialog-titlebar-close")||this.uiDialog.trigger("focus")}}),this.uiDialogTitlebarClose=t("<button type='button'></button>").button({label:t("<a>").text(this.options.closeText).html(),icon:"ui-icon-closethick",showLabel:!1}).appendTo(this.uiDialogTitlebar),this._addClass(this.uiDialogTitlebarClose,"ui-dialog-titlebar-close"),this._on(this.uiDialogTitlebarClose,{click:function(t){t.preventDefault(),this.close(t)}}),e=t("<"+(Number.isInteger(this.options.uiDialogTitleHeadingLevel)&&this.options.uiDialogTitleHeadingLevel>0&&this.options.uiDialogTitleHeadingLevel<=6?"h"+this.options.uiDialogTitleHeadingLevel:"span")+">").uniqueId().prependTo(this.uiDialogTitlebar),this._addClass(e,"ui-dialog-title"),this._title(e),this.uiDialogTitlebar.prepe
vendor: 28,777 bytes, line 12428
12428ndTo(this.uiDialog),this.uiDialog.attr({"aria-labelledby":e.attr("id")})},_title:function(t){this.options.title?t.text(this.options.title):t.html(" ")},_createButtonPane:function(){this.uiDialogButtonPane=t("<div>"),this._addClass(this.uiDialogButtonPane,"ui-dialog-buttonpane","ui-widget-content ui-helper-clearfix"),this.uiButtonSet=t("<div>").appendTo(this.uiDialogButtonPane),this._addClass(this.uiButtonSet,"ui-dialog-buttonset"),this._createButtons()},_createButtons:function(){var e=this,i=this.options.buttons;if(this.uiDialogButtonPane.remove(),this.uiButtonSet.empty(),t.isEmptyObject(i)||Array.isArray(i)&&!i.length){this._removeClass(this.uiDialog,"ui-dialog-buttons");return}t.each(i,function(i,s){var n,o;s="function"==typeof s?{click:s,text:i}:s,n=(s=t.extend({type:"button"},s)).click,o={icon:s.icon,iconPosition:s.iconPosition,showLabel:s.showLabel,icons:s.icons,text:s.text},delete s.click,delete s.icon,delete s.iconPosition,delete s.showLabel,delete s.icons,"boolean"==typeof s.text&&delete s.text,t("<button></button>",s).button(o).appendTo(e.uiButtonSet).on("click",function(){n.apply(e.element[0],arguments)})}),this._addClass(this.uiDialog,"ui-dialog-buttons"),this.uiDialogButtonPane.appendTo(this.uiDialog)},_makeDraggable:function(){var e=this,i=this.options;function s(t){return{position:t.position,offset:t.offset}}this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(i,n){e._addClass(t(this),"ui-dialog-dragging"),e._blockFrames(),e._trigger("dragStart",i,s(n))},drag:function(t,i){e._trigger("drag",t,s(i))},stop:function(n,o){var a=o.offset.left-e.document.scrollLeft(),r=o.offset.top-e.document.scrollTop();i.position={my:"left top",at:"left"+(a>=0?"+":"")+a+" top"+(r>=0?"+":"")+r,of:e.window},e._removeClass(t(this),"ui-dialog-dragging"),e._unblockFrames(),e._trigger("dragStop",n,s(o))}})},_makeResizable:function(){var e=this,i=this.options,s=i.resizable,n=this.uiDialog.css("position");function o(t){return{originalPosition:t.originalPosition,originalSize:t.originalSize,position:t.position,size:t.size}}this.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:this.element,maxWidth:i.maxWidth,maxHeight:i.maxHeight,minWidth:i.minWidth,minHeight:this._minHeight(),handles:"string"==typeof s?s:"n,e,s,w,se,sw,ne,nw",start:function(i,s){e._addClass(t(this),"ui-dialog-resizing"),e._blockFrames(),e._trigger("resizeStart",i,o(s))},resize:function(t,i){e._trigger("resize",t,o(i))},stop:function(s,n){var a=e.uiDialog.offset(),r=a.left-e.document.scrollLeft(),l=a.top-e.document.scrollTop();i.height=e.uiDialog.height(),i.width=e.uiDialog.width(),i.position={my:"left top",at:"left"+(r>=0?"+":"")+r+" top"+(l>=0?"+":"")+l,of:e.window},e._removeClass(t(this),"ui-dialog-resizing"),e._unblockFrames(),e._trigger("resizeStop",s,o(n))}}).css("position",n)},_trackFocus:function(){this._on(this.widget(),{focusin:function(e){this._makeFocusTarget(),this._focusedElement=t(e.target)}})},_makeFocusTarget:function(){this._untrackInstance(),this._trackingInstances().unshift(this)},_untrackInstance:function(){var e=this._trackingInstances(),i=t.inArray(this,e);-1!==i&&e.splice(i,1)},_trackingInstances:function(){var t=this.document.data("ui-dialog-instances");return t||(t=[],this.document.data("ui-dialog-instances",t)),t},_minHeight:function(){var t=this.options;return"auto"===t.height?t.minHeight:Math.min(t.minHeight,t.height)},_position:function(){var t=this.uiDialog.is(":visible");t||this.uiDialog.show(),this.uiDialog.position(this.options.position),t||this.uiDialog.hide()},_setOptions:function(e){var i=this,s=!1,n={};t.each(e,function(t,e){i._setOption(t,e),t in i.sizeRelatedOptions&&(s=!0),t in i.resizableRelatedOptions&&(n[t]=e)}),s&&(this._size(),this._position()),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option",n)},_setOption:function(e,i){var s,n,o=this.uiDialog;"disabled"!==e&&(this._super(e,i),"appendTo"===e&&this.uiDialog.appendTo(this._appendTo()),"buttons"===e&&this._createButtons(),"closeText"===e&&this.uiDialogTitlebarClose.button({label:t("<a>").text(""+this.options.closeText).html()}),"draggable"===e&&((s=o.is(":data(ui-draggable)"))&&!i&&o.draggable("destroy"),!s&&i&&this._makeDraggable()),"position"===e&&this._position(),"resizable"!==e||((n=o.is(":data(ui-resizable)"))&&!i&&o.resizable("destroy"),n&&"string"==typeof i&&o.resizable("option","handles",i),n||!1===i||this._makeResizable()),"title"===e&&this._title(this.uiDialogTitlebar.find(".ui-dialog-title")),"modal"===e&&o.attr("aria-modal",i?"true":null))},_size:function(){var t,e,i,s=this.options;this.element.show().css({width:"auto",minHeight:0,maxHeight:"none",height:0}),s.minWidth>s.width&&(s.width=s.minWidth),t=this.uiDialog.css({height:"auto",width:s.width}).outerHeight(),e=Math.max(0,s.minHeight-t),i="number"==typeof s.maxHeight?Math.max(0,s.maxHeight-t):"none","auto"===s.height?this.element.css({minHeight:e,maxHeight:i,height:"auto"}):this.element.height(Math.max(0,s.height-t)),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())},_blockFrames:function(){this.iframeBlocks=this.document.find("iframe").map(function(){var e=t(this);return t("<div>").css({position:"absolute",width:e.outerWidth(),height:e.outerHeight()}).appendTo(e.parent()).offset(e.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_allowInteraction:function(e){return!!t(e.target).closest(".ui-dialog").length||!!t(e.target).closest(".ui-datepicker").length},_createOverlay:function(){if(this.options.modal){var e=!0;this._delay(function(){e=!1}),this.document.data("ui-dialog-overlays")||this.document.on("focusin.ui-dialog",(function(t){if(!e){var i=this._trackingInstances()[0];i._allowInteraction(t)||(t.preventDefault(),i._focusTabbable())}}).bind(this)),this.overlay=t("<div>").appendTo(this._appendTo()),this._addClass(this.overlay,null,"ui-widget-overlay ui-front"),this._on(this.overlay,{mousedown:"_keepFocus"}),this.document.data("ui-dialog-overlays",(this.document.data("ui-dialog-overlays")||0)+1)}},_destroyOverlay:function(){if(this.options.modal&&this.overlay){var t=this.document.data("ui-dialog-overlays")-1;t?this.document.data("ui-dialog-overlays",t):(this.document.off("focusin.ui-dialog"),this.document.removeData("ui-dialog-overlays")),this.overlay.remove(),this.overlay=null}}}),!0===t.uiBackCompat&&t.widget("ui.dialog",t.ui.dialog,{options:{dialogClass:""},_createWrapper:function(){this._super(),this.uiDialog.addClass(this.options.dialogClass)},_setOption:function(t,e){"dialogClass"===t&&this.uiDialog.removeClass(this.options.dialogClass).addClass(e),this._superApply(arguments)}}),t.ui.dialog,t.widget("ui.droppable",{version:"1.14.2",widgetEventPrefix:"drop",options:{accept:"*",addClasses:!0,greedy:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var t,e=this.options,i=e.accept;this.isover=!1,this.isout=!0,this.accept="function"==typeof i?i:function(t){return t.is(i)},this.proportions=function(){if(!arguments.length)return t||(t={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight});t=arguments[0]},this._addToManager(e.scope),e.addClasses&&this._addClass("ui-droppable")},_addToManager:function(e){t.ui.ddmanager.droppables[e]=t.ui.ddmanager.droppables[e]||[],t.ui.ddmanager.droppables[e].push(this)},_splice:function(t){for(var e=0;e<t.length;e++)t[e]===this&&t.splice(e,1)},_destroy:function(){var e=t.ui.ddmanager.droppables[this.options.scope];this._splice(e)},_setOption:function(e,i){if("accept"===e)this.accept="function"==typeof i?i:function(t){return t.is(i)};else if("scope"===e){var s=t.ui.ddmanager.droppables[this.options.scope];this._splice(s),this._addToManager(i)}this._super(e,i)},_activate:function(e){var i=t.ui.ddmanager.current;this._addActiveClass(),i&&this._trigger("activate",e,this.ui(i))},_deactivate:function(e){var i=t.ui.ddmanager.current;this._removeActiveClass(),i&&this._trigger("deactivate",e,this.ui(i))},_over:function(e){var i=t.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this._addHoverClass(),this._trigger("over",e,this.ui(i)))},_out:function(e){var i=t.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this._removeHoverClass(),this._trigger("out",e,this.ui(i)))},_drop:function(e,i){var s=i||t.ui.ddmanager.current,n=!1;return!!s&&(s.currentItem||s.element)[0]!==this.element[0]&&(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var i=t(this).droppable("instance");if(i.options.greedy&&!i.options.disabled&&i.options.scope===s.options.scope&&i.accept.call(i.element[0],s.currentItem||s.element)&&t.ui.intersect(s,t.extend(i,{offset:i.element.offset()}),i.options.tolerance,e))return n=!0,!1}),!n&&!!this.accept.call(this.element[0],s.currentItem||s.element)&&(this._removeActiveClass(),this._removeHoverClass(),this._trigger("drop",e,this.ui(s)),this.element))},ui:function(t){return{draggable:t.currentItem||t.element,helper:t.helper,position:t.position,offset:t.positionAbs}},_addHoverClass:function(){this._addClass("ui-droppable-hover")},_removeHoverClass:function(){this._removeClass("ui-droppable-hover")},_addActiveClass:function(){this._addClass("ui-droppable-active")},_removeActiveClass:function(){this._removeClass("ui-droppable-active")}}),t.ui.intersect=function(t,e,i,s){if(!e.offset)return!1;var n,o,a,r,l=(t.positionAbs||t.position.absolute).left+t.margins.left,h=(t.positionAbs||t.position.absolute).top+t.margins.top,c=l+t.helperProportions.width,u=h+t.helperProportions.height,d=e.offset.left,p=e.offset.top,f=d+e.proportions().width,g=p+e.proportions().height;switch(i){case"fit":return d<=l&&c<=f&&p<=h&&u<=g;case"intersect":return d<l+t.helperProportions.width/2&&c-t.helperProportions.width/2<f&&p<h+t.helperProportions.height/2&&u-t.helperProportions.height/2<g;case"pointer":return n=s.pageY,o=e.proportions().height,n>=p&&n<p+o&&(a=s.pageX,r=e.proportions().width,a>=d&&a<d+r);case"touch":return(h>=p&&h<=g||u>=p&&u<=g||h<p&&u>g)&&(l>=d&&l<=f||c>=d&&c<=f||l<d&&c>f);default:return!1}},t.ui.ddmanager={current:null,droppables:{default:[]},prepareOffsets:function(e,i){var s,n,o=t.ui.ddmanager.droppables[e.options.scope]||[],a=i?i.type:null,r=(e.currentItem||e.element).find(":data(ui-droppable)").addBack();t:for(s=0;s<o.length;s++){if(!o[s].options.disabled&&(!e||o[s].accept.call(o[s].element[0],e.currentItem||e.element))){for(n=0;n<r.length;n++)if(r[n]===o[s].element[0]){o[s].proportions().height=0;continue t}o[s].visible="none"!==o[s].element.css("display"),o[s].visible&&("mousedown"===a&&o[s]._activate.call(o[s],i),o[s].offset=o[s].element.offset(),o[s].proportions({width:o[s].element[0].offsetWidth,height:o[s].element[0].offsetHeight}))}}},drop:function(e,i){var s=!1;return t.each((t.ui.ddmanager.droppables[e.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&t.ui.intersect(e,this,this.options.tolerance,i)&&(s=this._drop.call(this,i)||s),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],e.currentItem||e.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,i)))}),s},dragStart:function(e,i){e.element.parentsUntil("body").on("scroll.droppable",function(){e.options.refreshPositions||t.ui.ddmanager.prepareOffsets(e,i)})},drag:function(e,i){e.options.refreshPositions&&t.ui.ddmanager.prepareOffsets(e,i),t.each(t.ui.ddmanager.droppables[e.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var s,n,o,a=t.ui.intersect(e,this,this.options.tolerance,i),r=!a&&this.isover?"isout":a&&!this.isover?"isover":null;r&&(this.options.greedy&&(n=this.options.scope,(o=this.element.parents(":data(ui-droppable)").filter(function(){return t(this).droppable("instance").options.scope===n})).length&&((s=t(o[0]).droppable("instance")).greedyChild="isover"===r)),s&&"isover"===r&&(s.isover=!1,s.isout=!0,s._out.call(s,i)),this[r]=!0,this["isout"===r?"isover":"isout"]=!1,this["isover"===r?"_over":"_out"].call(this,i),s&&"isout"===r&&(s.isout=!1,s.isover=!0,s._over.call(s,i)))}})},dragStop:function(e,i){e.element.parentsUntil("body").off("scroll.droppable"),e.options.refreshPositions||t.ui.ddmanager.prepareOffsets(e,i)}},!0===t.uiBackCompat&&t.widget("ui.droppable",t.ui.droppable,{options:{hoverClass:!1,activeClass:!1},_addActiveClass:function(){this._super(),this.options.activeClass&&this.element.addClass(this.options.activeClass)},_removeActiveClass:function(){this._super(),this.options.activeClass&&this.element.removeClass(this.options.activeClass)},_addHoverClass:function(){this._super(),this.options.hoverClass&&this.element.addClass(this.options.hoverClass)},_removeHoverClass:function(){this._super(),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass)}}),t.ui.droppable,t.widget("ui.progressbar",{version:"1.14.2",options:{classes:{"ui-progressbar":"ui-corner-all","ui-progressbar-value":"ui-corner-left","ui-progressbar-complete":"ui-corner-right"},max:100,value:0,change:null,complete:null},min:0,_create:function(){this.oldValue=this.options.value=this._constrainedValue(),this.element.attr({role:"progressbar","aria-valuemin":this.min}),this._addClass("ui-progressbar","ui-widget ui-widget-content"),this.valueDiv=t("<div>").appendTo(this.element),this._addClass(this.valueDiv,"ui-progressbar-value","ui-widget-header"),this._refreshValue()},_destroy:function(){this.element.removeAttr("role aria-valuemin aria-valuemax aria-valuenow"),this.valueDiv.remove()},value:function(t){if(void 0===t)return this.options.value;this.options.value=this._constrainedValue(t),this._refreshValue()},_constrainedValue:function(t){return void 0===t&&(t=this.options.value),this.indeterminate=!1===t,"number"!=typeof t&&(t=0),!this.indeterminate&&Math.min(this.options.max,Math.max(this.min,t))},_setOptions:function(t){var e=t.value;delete t.value,this._super(t),this.options.value=this._constrainedValue(e),this._refreshValue()},_setOption:function(t,e){"max"===t&&(e=Math.max(this.min,e)),this._super(t,e)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",t),this._toggleClass(null,"ui-state-disabled",!!t)},_percentage:function(){return this.indeterminate?100:100*(this.options.value-this.min)/(this.options.max-this.min)},_refreshValue:function(){var e=this.options.value,i=this._percentage();this.valueDiv.toggle(this.indeterminate||e>this.min).width(i.toFixed(0)+"%"),this._toggleClass(this.valueDiv,"ui-progressbar-complete",null,e===this.options.max)._toggleClass("ui-progressbar-indeterminate",null,this.indeterminate),this.indeterminate?(this.element.removeAttr("aria-valuenow"),this.overlayDiv||(this.overlayDiv=t("<div>").appendTo(this.valueDiv),this._addClass(this.overlayDiv,"ui-progressbar-overlay"))):(this.element.attr({"aria-valuemax":this.options.max,"aria-valuenow":e}),this.overlayDiv&&(this.overlayDiv.remove(),this.overlayDiv=null)),this.oldValue!==e&&(this.oldValue=e,this._trigger("change")),e===this.options.max&&this._trigger("complete")}}),t.widget("ui.selectable",t.ui.mouse,{version:"1.14.2",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var e=this;this._addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){e.elementPos=t(e.element[0]).offset(),e.selectees=t(e.options.filter,e.element[0]),e._addClass(e.selectees,"ui-selectee"),e.selectees.each(function(){var i=t(this),s=i.offset(),n={left:s.left-e.elementPos.left,top:s.top-e.elementPos.top};t.data(this,"selectable-item",{element:this,$element:i,left:n.left,top:n.top,right:n.left+i.outerWidth(),bottom:n.top+i.outerHeight(),startselected:!1,selected:i.hasClass("ui-selected"),selecting:i.hasClass("ui-selecting"),unselecting:i.hasClass("ui-unselecting")})})},this.refresh(),this._mouseInit(),this.helper=t("<div>"),this._addClass(this.helper,"ui-selectable-helper")},_destroy:function(){this.selectees.removeData("selectable-item"),this._mouseDestroy()},_mouseStart:function(e){var i=this,s=this.options;this.opos=[e.pageX,e.pageY],this.elementPos=t(this.element[0]).offset(),!this.options.disabled&&(this.selectees=t(s.filter,this.element[0]),this._trigger("start",e),t(s.appendTo).append(this.helper),this.helper.css({left:e.pageX,top:e.pageY,width:0,height:0}),s.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var s=t.data(this,"selectable-item");s.startselected=!0,e.metaKey||e.ctrlKey||(i._removeClass(s.$element,"ui-selected"),s.selected=!1,i._addClass(s.$element,"ui-unselecting"),s.unselecting=!0,i._trigger("unselecting",e,{unselecting:s.element}))}),t(e.target).parents().addBack().each(function(){var s,n=t.data(this,"selectable-item");if(n)return s=!e.metaKey&&!e.ctrlKey||!n.$element.hasClass("ui-selected"),i._removeClass(n.$element,s?"ui-unselecting":"ui-selected")._addClass(n.$element,s?"ui-selecting":"ui-unselecting"),n.unselecting=!s,n.selecting=s,n.selected=s,s?i._trigger("selecting",e,{selecting:n.element}):i._trigger("unselecting",e,{unselecting:n.element}),!1}))},_mouseDrag:function(e){if(this.dragged=!0,!this.options.disabled){var i,s=this,n=this.options,o=this.opos[0],a=this.opos[1],r=e.pageX,l=e.pageY;return o>r&&(i=r,r=o,o=i),a>l&&(i=l,l=a,a=i),this.helper.css({left:o,top:a,width:r-o,height:l-a}),this.selectees.each(function(){var i=t.data(this,"selectable-item"),h=!1,c={};i&&i.element!==s.element[0]&&(c.left=i.left+s.elementPos.left,c.right=i.right+s.elementPos.left,c.top=i.top+s.elementPos.top,c.bottom=i.bottom+s.elementPos.top,"touch"===n.tolerance?h=!(c.left>r||c.right<o||c.top>l||c.bottom<a):"fit"===n.tolerance&&(h=c.left>o&&c.right<r&&c.top>a&&c.bottom<l),h?(i.selected&&(s._removeClass(i.$element,"ui-selected"),i.selected=!1),i.unselecting&&(s._removeClass(i.$element,"ui-unselecting"),i.unselecting=!1),i.selecting||(s._addClass(i.$element,"ui-selecting"),i.selecting=!0,s._trigger("selecting",e,{selecting:i.element}))):(i.selecting&&((e.metaKey||e.ctrlKey)&&i.startselected?(s._removeClass(i.$element,"ui-selecting"),i.selecting=!1,s._addClass(i.$element,"ui-selected"),i.selected=!0):(s._removeClass(i.$element,"ui-selecting"),i.selecting=!1,i.startselected&&(s._addClass(i.$element,"ui-unselecting"),i.unselecting=!0),s._trigger("unselecting",e,{unselecting:i.element}))),!i.selected||e.metaKey||e.ctrlKey||i.startselected||(s._removeClass(i.$element,"ui-selected"),i.selected=!1,s._addClass(i.$element,"ui-unselecting"),i.unselecting=!0,s._trigger("unselecting",e,{unselecting:i.element}))))}),!1}},_mouseStop:function(e){var i=this;return this.dragged=!1,t(".ui-unselecting",this.element[0]).each(function(){var s=t.data(this,"selectable-item");i._removeClass(s.$element,"ui-unselecting"),s.unselecting=!1,s.startselected=!1,i._trigger("unselected",e,{unselected:s.element})}),t(".ui-selecting",this.element[0]).each(function(){var s=t.data(this,"selectable-item");i._removeClass(s.$element,"ui-selecting")._addClass(s.$element,"ui-selected"),s.selecting=!1,s.selected=!0,s.startselected=!0,i._trigger("selected",e,{selected:s.element})}),this._trigger("stop",e),this.helper.remove(),!1}}),t.widget("ui.selectmenu",[t.ui.formResetMixin,{version:"1.14.2",defaultElement:"<select>",options:{appendTo:null,classes:{"ui-selectmenu-button-open":"ui-corner-top","ui-selectmenu-button-closed":"ui-corner-all"},disabled:null,icons:{button:"ui-icon-triangle-1-s"},position:{my:"left top",at:"left bottom",collision:"none"},width:!1,change:null,close:null,focus:null,open:null,select:null},_create:function(){var e=this.element.uniqueId().attr("id");this.ids={element:e,button:e+"-button",menu:e+"-menu"},this._drawButton(),this._drawMenu(),this._bindFormResetHandler(),this._rendered=!1,this.menuItems=t()},_drawButton:function(){var e,i=this,s=this._parseOption(this.element.find("option:selected"),this.element[0].selectedIndex);this.labels=this.element.labels().attr("for",this.ids.button),this._on(this.labels,{click:function(t){this.button.trigger("focus"),t.preventDefault()}}),this.element.hide(),this.button=t("<span>",{tabindex:this.options.disabled?-1:0,id:this.ids.button,role:"combobox","aria-expanded":"false","aria-autocomplete":"list","aria-owns":this.ids.menu,"aria-haspopup":"true",title:this.element.attr("title")}).insertAfter(this.element),this._addClass(this.button,"ui-selectmenu-button ui-selectmenu-button-closed","ui-button ui-widget"),e=t("<span>").appendTo(this.button),this._addClass(e,"ui-selectmenu-icon","ui-icon "+this.options.icons.button),this.buttonItem=this._renderButtonItem(s).appendTo(this.button),!1!==this.options.width&&this._resizeButton(),this._on(this.button,this._buttonEvents),this.button.one("focusin",function(){i._rendered||i._refreshMenu()})},_drawMenu:function(){var e=this;this.menu=t("<ul>",{"aria-hidden":"true","aria-labelledby":this.ids.button,id:this.ids.menu}),this.menuWrap=t("<div>").append(this.menu),this._addClass(this.menuWrap,"ui-selectmenu-menu","ui-front"),this.menuWrap.appendTo(this._appendTo()),this.menuInstance=this.menu.menu({classes:{"ui-menu":"ui-corner-bottom"},role:"listbox",select:function(t,i){t.preventDefault(),e._select(i.item.data("ui-selectmenu-item"),t)},focus:function(t,i){var s=i.item.data("ui-selectmenu-item");null==e.focusIndex||s.index===e.focusIndex||(e._trigger("focus",t,{item:s}),e.isOpen||e._select(s,t)),e.focusIndex=s.index,e.button.attr("aria-activedescendant",e.menuItems.eq(s.index).attr("id"))}}).menu("instance"),this.menuInstance._off(this.menu,"mouseleave"),this.menuInstance._closeOnDocumentClick=function(){return!1},this.menuInstance._isDivider=function(){return!1}},refresh:function(){this._refreshMenu(),this.buttonItem.replaceWith(this.buttonItem=this._renderButtonItem(this._getSelectedItem().data("ui-selectmenu-item")||{})),null===this.options.width&&this._resizeButton()},_refreshMenu:function(){var t,e=this.element.find("option");this.menu.empty(),this._parseOptions(e),this._renderMenu(this.menu,this.items),this.menuInstance.refresh(),this.menuItems=this.menu.find("li").not(".ui-selectmenu-optgroup").find(".ui-menu-item-wrapper"),this._rendered=!0,e.length&&(t=this._getSelectedItem(),this.menuInstance.focus(null,t),this._setAria(t.data("ui-selectmenu-item")),this._setOption("disabled",this.element.prop("disabled")))},open:function(t){if(!this.options.disabled)this._rendered?(this._removeClass(this.menu.find(".ui-state-active"),null,"ui-state-active"),this.menuInstance.focus(null,this._getSelectedItem())):this._refreshMenu(),this.menuItems.length&&(this.isOpen=!0,this._toggleAttr(),this._resizeMenu(),this._position(),this._on(this.document,this._documentClick),this._trigger("open",t))},_position:function(){this.menuWrap.position(t.extend({of:this.button},this.options.position))},close:function(t){this.isOpen&&(this.isOpen=!1,this._toggleAttr(),this.range=null,this._off(this.document),this._trigger("close",t))},widget:function(){return this.button},menuWidget:function(){return this.menu},_renderButtonItem:function(e){var i=t("<span>");return this._setText(i,e.label),this._addClass(i,"ui-selectmenu-text"),i},_renderMenu:function(e,i){var s=this,n="";t.each(i,function(i,o){var a;o.optgroup!==n&&(a=t("<li>",{text:o.optgroup}),s._addClass(a,"ui-selectmenu-optgroup","ui-menu-divider"+(o.element.parent("optgroup").prop("disabled")?" ui-state-disabled":"")),a.appendTo(e),n=o.optgroup),s._renderItemData(e,o)})},_renderItemData:function(t,e){return this._renderItem(t,e).data("ui-selectmenu-item",e)},_renderItem:function(e,i){var s=t("<li>"),n=t("<div>",{title:i.element.attr("title")});return i.disabled&&this._addClass(s,null,"ui-state-disabled"),i.hidden?s.prop("hidden",!0):this._setText(n,i.label),s.append(n).appendTo(e)},_setText:function(t,e){e?t.text(e):t.html(" ")},_move:function(t,e){var i,s,n=".ui-menu-item";this.isOpen?i=this.menuItems.eq(this.focusIndex).parent("li"):(i=this.menuItems.eq(this.element[0].selectedIndex).parent("li"),n+=":not(.ui-state-disabled)"),(s="first"===t||"last"===t?i["first"===t?"prevAll":"nextAll"](n).eq(-1):i[t+"All"](n).eq(0)).length&&this.menuInstance.focus(e,s)},_getSelectedItem:function(){return this.menuItems.eq(this.element[0].selectedIndex).parent("li")},_toggle:function(t){this[this.isOpen?"close":"open"](t)},_setSelection:function(){var t;this.range&&((t=window.getSelection()).removeAllRanges(),t.addRange(this.range))},_documentClick:{mousedown:function(e){this.isOpen&&(t(e.target).closest(".ui-selectmenu-menu, #"+CSS.escape(this.ids.button)).length||this.close(e))}},_buttonEvents:{mousedown:function(){var t=window.getSelection();t.rangeCount&&(this.range=t.getRangeAt(0))},click:function(t){this._setSelection(),this._toggle(t)},keydown:function(e){var i=!0;switch(e.keyCode){case t.ui.keyCode.TAB:case t.ui.keyCode.ESCAPE:this.close(e),i=!1;break;case t.ui.keyCode.ENTER:this.isOpen&&this._selectFocusedItem(e);break;case t.ui.keyCode.UP:e.altKey?this._toggle(e):this._move("prev",e);break;case t.ui.keyCode.DOWN:e.altKey?this._toggle(e):this._move("next",e);break;case t.ui.keyCode.SPACE:this.isOpen?this._selectFocusedItem(e):this._toggle(e);break;case t.ui.keyCode.LEFT:this._move("prev",e);break;case t.ui.keyCode.RIGHT:this._move("next",e);break;case t.ui.keyCode.HOME:case t.ui.keyCode.PAGE_UP:this._move("first",e);break;case t.ui.keyCode.END:case t.ui.keyCode.PAGE_DOWN:this._move("last",e);break;default:this.menu.trigger(e),i=!1}i&&e.preventDefault()}},_selectFocusedItem:function(t){var e=this.menuItems.eq(this.focusIndex).parent("li");e.hasClass("ui-state-disabled")||this._select(e.data("ui-selectmenu-item"),t)},_select:function(t,e){var i=this.element[0].selectedIndex;this.element[0].selectedIndex=t.index,this.buttonItem.replaceWith(this.buttonItem=this._renderButtonItem(t)),this._setAria(t),this._trigger("select",e,{item:t}),t.index!==i&&this._trigger("change",e,{item:t}),this.close(e)},_setAria:function(t){var e=this.menuItems.eq(t.index).attr("id");this.button.attr({"aria-labelledby":e,"aria-activedescendant":e}),this.menu.attr("aria-activedescendant",e)},_setOption:function(t,e){if("icons"===t){var i=this.button.find("span.ui-icon");this._removeClass(i,null,this.options.icons.button)._addClass(i,null,e.button)}this._super(t,e),"appendTo"===t&&this.menuWrap.appendTo(this._appendTo()),"width"===t&&this._resizeButton()},_setOptionDisabled:function(t){this._super(t),this.menuInstance.option("disabled",t),this.button.attr("aria-disabled",t),this._toggleClass(this.button,null,"ui-state-disabled",t),this.element.prop("disabled",t),t?(this.button.attr("tabindex",-1),this.close()):this.button.attr("tabindex",0)},_appendTo:function(){var e=this.options.appendTo;return e&&(e=e.jquery||e.nodeType?t(e):this.document.find(e).eq(0)),e&&e[0]||(e=this.element.closest(".ui-front, dialog")),e.length||(e=this.document[0].body),e},_toggleAttr:function(){this.button.attr("aria-expanded",this.isOpen),this._removeClass(this.button,"ui-selectmenu-button-"+(this.isOpen?"closed":"open"))._addClass(this.button,"ui-selectmenu-button-"+(this.isOpen?"open":"closed"))._toggleClass(this.menuWrap,"ui-selectmenu-open",null,this.isOpen),this.menu.attr("aria-hidden",!this.isOpen)},_resizeButton:function(){var t=this.options.width;if(!1===t){this.button.css("width","");return}null===t&&(t=this.element.show().outerWidth(),this.element.hide()),this.button.outerWidth(t)},_resizeMenu:function(){this.menu.outerWidth(Math.max(this.button.outerWidth(),this.menu.width("").outerWidth()))},_getCreateOptions:function(){var t=this._super();return t.disabled=this.element.prop("disabled"),t},_parseOptions:function(e){var i=this,s=[];e.each(function(e,n){s.push(i._parseOption(t(n),e))}),this.items=s},_parseOption:function(t,e){var i=t.parent("optgroup");return{element:t,index:e,value:t.val(),label:t.text(),hidden:i.prop("hidden")||t.prop("hidden"),optgroup:i.attr("label")||"",disabled:i.prop("disabled")||t.prop("disabled")}},_destroy:function(){this._unbindFormResetHandler(),this.menuWrap.remove(),this.button.remove(),this.element.show(),this.element.removeUniqueId(),this.labels.attr("for",this.ids.element)}}]),t.widget("ui.slider",t.ui.mouse,{version:"1.14.2",widgetEventPrefix:"slide",options:{animate:!1,classes:{"ui-slider":"ui-corner-all","ui-slider-handle":"ui-corner-all","ui-slider-range":"ui-corner-all ui-widget-header"},distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null}
vendor: 4,695 bytes, line 12428
12428,numPages:5,_create:function(){this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this._calculateNewMax(),this._addClass("ui-slider ui-slider-"+this.orientation,"ui-widget ui-widget-content"),this._refresh(),this._animateOff=!1},_refresh:function(){this._createRange(),this._createHandles(),this._setupEvents(),this._refreshValue()},_createHandles:function(){var e,i,s=this.options,n=this.element.find(".ui-slider-handle"),o=[];for(i=s.values&&s.values.length||1,n.length>i&&(n.slice(i).remove(),n=n.slice(0,i)),e=n.length;e<i;e++)o.push("<span tabindex='0'></span>");this.handles=n.add(t(o.join("")).appendTo(this.element)),this._addClass(this.handles,"ui-slider-handle","ui-state-default"),this.handle=this.handles.eq(0),this.handles.each(function(e){t(this).data("ui-slider-handle-index",e).attr("tabIndex",0)})},_createRange:function(){var e=this.options;e.range?(!0===e.range&&(e.values?e.values.length&&2!==e.values.length?e.values=[e.values[0],e.values[0]]:Array.isArray(e.values)&&(e.values=e.values.slice(0)):e.values=[this._valueMin(),this._valueMin()]),this.range&&this.range.length?(this._removeClass(this.range,"ui-slider-range-min ui-slider-range-max"),this.range.css({left:"",bottom:""})):(this.range=t("<div>").appendTo(this.element),this._addClass(this.range,"ui-slider-range")),("min"===e.range||"max"===e.range)&&this._addClass(this.range,"ui-slider-range-"+e.range)):(this.range&&this.range.remove(),this.range=null)},_setupEvents:function(){this._off(this.handles),this._on(this.handles,this._handleEvents),this._hoverable(this.handles),this._focusable(this.handles)},_destroy:function(){this.handles.remove(),this.range&&this.range.remove(),this._mouseDestroy()},_mouseCapture:function(e){var i,s,n,o,a,r,l,h=this,c=this.options;return!c.disabled&&(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),i={x:e.pageX,y:e.pageY},s=this._normValueFromMouse(i),n=this._valueMax()-this._valueMin()+1,this.handles.each(function(e){var i=Math.abs(s-h.values(e));(n>i||n===i&&(e===h._lastChangedValue||h.values(e)===c.min))&&(n=i,o=t(this),a=e)}),!1!==this._start(e,a)&&(this._mouseSliding=!0,this._handleIndex=a,this._addClass(o,null,"ui-state-active"),o.trigger("focus"),r=o.offset(),l=!t(e.target).parents().addBack().is(".ui-slider-handle"),this._clickOffset=l?{left:0,top:0}:{left:e.pageX-r.left-o.width()/2,top:e.pageY-r.top-o.height()/2-(parseInt(o.css("borderTopWidth"),10)||0)-(parseInt(o.css("borderBottomWidth"),10)||0)+(parseInt(o.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(e,a,s),this._animateOff=!0,!0))},_mouseStart:function(){return!0},_mouseDrag:function(t){var e={x:t.pageX,y:t.pageY},i=this._normValueFromMouse(e);return this._slide(t,this._handleIndex,i),!1},_mouseStop:function(t){return this._removeClass(this.handles,null,"ui-state-active"),this._mouseSliding=!1,this._stop(t,this._handleIndex),this._change(t,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(t){var e,i,s,n,o;return"horizontal"===this.orientation?(e=this.elementSize.width,i=t.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(e=this.elementSize.height,i=t.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),(s=i/e)>1&&(s=1),s<0&&(s=0),"vertical"===this.orientation&&(s=1-s),n=this._valueMax()-this._valueMin(),o=this._valueMin()+s*n,this._trimAlignValue(o)},_uiHash:function(t,e,i){var s={handle:this.handles[t],handleIndex:t,value:void 0!==e?e:this.value()};return this._hasMultipleValues()&&(s.value=void 0!==e?e:this.values(t),s.values=i||this.values()),s},_hasMultipleValues:function(){return this.options.values&&this.options.values.length},_start:function(t,e){return this._trigger("start",t,this._uiHash(e))},_slide:function(t,e,i){var s,n=this.value(),o=this.values();this._hasMultipleValues()&&(s=this.values(+!e),n=this.values(e),2===this.options.values.length&&!0===this.options.range&&(i=0===e?Math.min(s,i):Math.max(s,i)),o[e]=i),i!==n&&!1!==this._trigger("slide",t,this._uiHash(e,i,o))&&(this._hasMultipleValues()?this.values(e,i):this.value(i))},_stop:function(t,e){this._trigger("stop",t,this._uiHash(e))},_change:function(t,e){this._keySliding||this._mouseSliding||(this._lastChangedValue=e,this._trigger("change",t,this._uiHash(e)))},value:function(t){if(arguments.length){this.options.value=this._trimAlignValue(t),this._refreshValue(),this._change(null,0);return}
vendor: 5,983 bytes, line 12428
12428return this._value()},values:function(t,e){var i,s,n;if(arguments.length>1){this.options.values[t]=this._trimAlignValue(e),this._refreshValue(),this._change(null,t);return}if(!arguments.length)return this._values();if(!Array.isArray(arguments[0]))return this._hasMultipleValues()?this._values(t):this.value();for(n=0,i=this.options.values,s=arguments[0];n<i.length;n+=1)i[n]=this._trimAlignValue(s[n]),this._change(null,n);this._refreshValue()},_setOption:function(t,e){var i,s=0;switch("range"===t&&!0===this.options.range&&("min"===e?(this.options.value=this._values(0),this.options.values=null):"max"===e&&(this.options.value=this._values(this.options.values.length-1),this.options.values=null)),Array.isArray(this.options.values)&&(s=this.options.values.length),this._super(t,e),t){case"orientation":this._detectOrientation(),this._removeClass("ui-slider-horizontal ui-slider-vertical")._addClass("ui-slider-"+this.orientation),this._refreshValue(),this.options.range&&this._refreshRange(e),this.handles.css("horizontal"===e?"bottom":"left","");break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":for(this._animateOff=!0,this._refreshValue(),i=s-1;i>=0;i--)this._change(null,i);this._animateOff=!1;break;case"step":case"min":case"max":this._animateOff=!0,this._calculateNewMax(),this._refreshValue(),this._animateOff=!1;break;case"range":this._animateOff=!0,this._refresh(),this._animateOff=!1}},_setOptionDisabled:function(t){this._super(t),this._toggleClass(null,"ui-state-disabled",!!t)},_value:function(){var t=this.options.value;return this._trimAlignValue(t)},_values:function(t){var e,i,s;if(arguments.length)return e=this.options.values[t],e=this._trimAlignValue(e);if(!this._hasMultipleValues())return[];for(s=0,i=this.options.values.slice();s<i.length;s+=1)i[s]=this._trimAlignValue(i[s]);return i},_trimAlignValue:function(t){if(t<=this._valueMin())return this._valueMin();if(t>=this._valueMax())return this._valueMax();var e=this.options.step>0?this.options.step:1,i=(t-this._valueMin())%e,s=t-i;return 2*Math.abs(i)>=e&&(s+=i>0?e:-e),parseFloat(s.toFixed(5))},_calculateNewMax:function(){var t=this.options.max,e=this._valueMin(),i=this.options.step;(t=Math.round((t-e)/i)*i+e)>this.options.max&&(t-=i),this.max=parseFloat(t.toFixed(this._precision()))},_precision:function(){var t=this._precisionOf(this.options.step);return null!==this.options.min&&(t=Math.max(t,this._precisionOf(this.options.min))),t},_precisionOf:function(t){var e=t.toString(),i=e.indexOf(".");return -1===i?0:e.length-i-1},_valueMin:function(){return this.options.min},_valueMax:function(){return this.max},_refreshRange:function(t){"vertical"===t&&this.range.css({width:"",left:""}),"horizontal"===t&&this.range.css({height:"",bottom:""})},_refreshValue:function(){var e,i,s,n,o,a=this.options.range,r=this.options,l=this,h=!this._animateOff&&r.animate,c={};this._hasMultipleValues()?this.handles.each(function(s){i=(l.values(s)-l._valueMin())/(l._valueMax()-l._valueMin())*100,c["horizontal"===l.orientation?"left":"bottom"]=i+"%",t(this).stop(1,1)[h?"animate":"css"](c,r.animate),!0===l.options.range&&("horizontal"===l.orientation?(0===s&&l.range.stop(1,1)[h?"animate":"css"]({left:i+"%"},r.animate),1===s&&l.range[h?"animate":"css"]({width:i-e+"%"},{queue:!1,duration:r.animate})):(0===s&&l.range.stop(1,1)[h?"animate":"css"]({bottom:i+"%"},r.animate),1===s&&l.range[h?"animate":"css"]({height:i-e+"%"},{queue:!1,duration:r.animate}))),e=i}):(s=this.value(),n=this._valueMin(),i=(o=this._valueMax())!==n?(s-n)/(o-n)*100:0,c["horizontal"===this.orientation?"left":"bottom"]=i+"%",this.handle.stop(1,1)[h?"animate":"css"](c,r.animate),"min"===a&&"horizontal"===this.orientation&&this.range.stop(1,1)[h?"animate":"css"]({width:i+"%"},r.animate),"max"===a&&"horizontal"===this.orientation&&this.range.stop(1,1)[h?"animate":"css"]({width:100-i+"%"},r.animate),"min"===a&&"vertical"===this.orientation&&this.range.stop(1,1)[h?"animate":"css"]({height:i+"%"},r.animate),"max"===a&&"vertical"===this.orientation&&this.range.stop(1,1)[h?"animate":"css"]({height:100-i+"%"},r.animate))},_handleEvents:{keydown:function(e){var i,s,n,o=t(e.target).data("ui-slider-handle-index");switch(e.keyCode){case t.ui.keyCode.HOME:case t.ui.keyCode.END:case t.ui.keyCode.PAGE_UP:case t.ui.keyCode.PAGE_DOWN:case t.ui.keyCode.UP:case t.ui.keyCode.RIGHT:case t.ui.keyCode.DOWN:case t.ui.keyCode.LEFT:if(e.preventDefault(),!this._keySliding&&(this._keySliding=!0,this._addClass(t(e.target),null,"ui-state-active"),!1===this._start(e,o)))return}switch(n=this.options.step,i=s=this._hasMultipleValues()?this.values(o):this.value(),e.keyCode){case t.ui.keyCode.HOME:s=this._valueMin();break;case t.ui.keyCode.END:s=this._valueMax();break;case t.ui.keyCode.PAGE_UP:s=this._trimAlignValue(i+(this._valueMax()-this._valueMin())/this.numPages);break;case t.ui.keyCode.PAGE_DOWN:s=this._trimAlignValue(i-(this._valueMax()-this._valueMin())/this.numPages);break;case t.ui.keyCode.UP:case t.ui.keyCode.RIGHT:if(i===this._valueMax())return;s=this._trimAlignValue(i+n);break;case t.ui.keyCode.DOWN:case t.ui.keyCode.LEFT:if(i===this._valueMin())return;s=this._trimAlignValue(i-n)}this._slide(e,o,s)},keyup:function(e){var i=t(e.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(e,i),this._change(e,i),this._removeClass(t(e.target),null,"ui-state-active"))}}}),t.widget("ui.sortable",t.ui.mouse,{version:"1.14.2",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null}
vendor: 9,954 bytes, line 12428
12428,_isOverAxis:function(t,e,i){return t>=e&&t<e+i},_isFloating:function(t){return/left|right/.test(t.css("float"))||/inline|table-cell/.test(t.css("display"))},_create:function(){this.containerCache={},this._addClass("ui-sortable"),this.refresh(),this.offset=this.element.offset(),this._mouseInit(),this._setHandleClassName(),this.ready=!0},_setOption:function(t,e){this._super(t,e),"handle"===t&&this._setHandleClassName()},_setHandleClassName:function(){var e=this;this._removeClass(this.element.find(".ui-sortable-handle"),"ui-sortable-handle"),t.each(this.items,function(){e._addClass(this.instance.options.handle?this.item.find(this.instance.options.handle):this.item,"ui-sortable-handle")})},_destroy:function(){this._mouseDestroy();for(var t=this.items.length-1;t>=0;t--)this.items[t].item.removeData(this.widgetName+"-item");return this},_mouseCapture:function(e,i){var s=null,n=!1,o=this;return!this.reverting&&!this.options.disabled&&"static"!==this.options.type&&(this._refreshItems(e),t(e.target).parents().each(function(){if(t.data(this,o.widgetName+"-item")===o)return s=t(this),!1}),t.data(e.target,o.widgetName+"-item")===o&&(s=t(e.target)),!!s&&(!this.options.handle||!!i||(t(this.options.handle,s).find("*").addBack().each(function(){this===e.target&&(n=!0)}),!!n))&&(this.currentItem=s,this._removeCurrentsFromItems(),!0))},_mouseStart:function(e,i,s){var n,o,a=this.options;if(this.currentContainer=this,this.refreshPositions(),this.appendTo=t("parent"!==a.appendTo?a.appendTo:this.currentItem.parent()),this.helper=this._createHelper(e),this._cacheHelperProportions(),this._cacheMargins(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},t.extend(this.offset,{click:{left:e.pageX-this.offset.left,top:e.pageY-this.offset.top},relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),a.cursorAt&&this._adjustOffsetFromHelper(a.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),this.scrollParent=this.placeholder.scrollParent(),t.extend(this.offset,{parent:this._getParentOffset()}),a.containment&&this._setContainment(),a.cursor&&"auto"!==a.cursor&&(o=this.document.find("body"),this._storedStylesheet=t("<style>*{ cursor: "+a.cursor+" !important; }</style>").appendTo(o)),a.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",a.zIndex)),a.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",a.opacity)),this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",e,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!s)for(n=this.containers.length-1;n>=0;n--)this.containers[n]._trigger("activate",e,this._uiHash(this));return t.ui.ddmanager&&(t.ui.ddmanager.current=this),t.ui.ddmanager&&!a.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this.dragging=!0,this._addClass(this.helper,"ui-sortable-helper"),this.helper.parent().is(this.appendTo)||(this.helper.detach().appendTo(this.appendTo),this.offset.parent=this._getParentOffset()),this.position=this.originalPosition=this._generatePosition(e),this.originalPageX=e.pageX,this.originalPageY=e.pageY,this.lastPositionAbs=this.positionAbs=this._convertPositionTo("absolute"),this._mouseDrag(e),!0},_scroll:function(t){var e=this.options,i=!1;return this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-t.pageY<e.scrollSensitivity?this.scrollParent[0].scrollTop=i=this.scrollParent[0].scrollTop+e.scrollSpeed:t.pageY-this.overflowOffset.top<e.scrollSensitivity&&(this.scrollParent[0].scrollTop=i=this.scrollParent[0].scrollTop-e.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-t.pageX<e.scrollSensitivity?this.scrollParent[0].scrollLeft=i=this.scrollParent[0].scrollLeft+e.scrollSpeed:t.pageX-this.overflowOffset.left<e.scrollSensitivity&&(this.scrollParent[0].scrollLeft=i=this.scrollParent[0].scrollLeft-e.scrollSpeed)):(t.pageY-this.document.scrollTop()<e.scrollSensitivity?i=this.document.scrollTop(this.document.scrollTop()-e.scrollSpeed):this.window.height()-(t.pageY-this.document.scrollTop())<e.scrollSensitivity&&(i=this.document.scrollTop(this.document.scrollTop()+e.scrollSpeed)),t.pageX-this.document.scrollLeft()<e.scrollSensitivity?i=this.document.scrollLeft(this.document.scrollLeft()-e.scrollSpeed):this.window.width()-(t.pageX-this.document.scrollLeft())<e.scrollSensitivity&&(i=this.document.scrollLeft(this.document.scrollLeft()+e.scrollSpeed))),i},_mouseDrag:function(e){var i,s,n,o,a=this.options;for(this.position=this._generatePosition(e),this.positionAbs=this._convertPositionTo("absolute"),this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),a.scroll&&!1!==this._scroll(e)&&(this._refreshItemPositions(!0),t.ui.ddmanager&&!a.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e)),this.dragDirection={vertical:this._getDragVerticalDirection(),horizontal:this._getDragHorizontalDirection()},i=this.items.length-1;i>=0;i--)if(n=(s=this.items[i]).item[0],(o=this._intersectsWithPointer(s))&&s.instance===this.currentContainer&&n!==this.currentItem[0]&&this.placeholder[1===o?"next":"prev"]()[0]!==n&&!t.contains(this.placeholder[0],n)&&("semi-dynamic"!==this.options.type||!t.contains(this.element[0],n))){if(this.direction=1===o?"down":"up","pointer"===this.options.tolerance||this._intersectsWithSides(s))this._rearrange(e,s);else break;this._trigger("change",e,this._uiHash());break}return this._contactContainers(e),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),this._trigger("sort",e,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(e,i){if(e){if(t.ui.ddmanager&&!this.options.dropBehaviour&&t.ui.ddmanager.drop(this,e),this.options.revert){var s=this,n=this.placeholder.offset(),o=this.options.axis,a={};o&&"x"!==o||(a.left=n.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollLeft)),o&&"y"!==o||(a.top=n.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,t(this.helper).animate(a,parseInt(this.options.revert,10)||500,function(){s._clear(e)})}else this._clear(e,i);return!1}},cancel:function(){if(this.dragging){this._mouseUp(new t.Event("mouseup",{target:null})),"original"===this.options.helper?(this.currentItem.css(this._storedCSS),this._removeClass(this.currentItem,"ui-sortable-helper")):this.currentItem.show();for(var e=this.containers.length-1;e>=0;e--)this.containers[e]._trigger("deactivate",null,this._uiHash(this)),this.containers[e].containerCache.over&&(this.containers[e]._trigger("out",null,this._uiHash(this)),this.containers[e].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),t.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?t(this.domPosition.prev).after(this.currentItem):t(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(e){var i=this._getItemsAsjQuery(e&&e.connected),s=[];return e=e||{},t(i).each(function(){var i=(t(e.item||this).attr(e.attribute||"id")||"").match(e.expression||/(.+)[\-=_](.+)/);i&&s.push((e.key||i[1]+"[]")+"="+(e.key&&e.expression?i[1]:i[2]))}),!s.length&&e.key&&s.push(e.key+"="),s.join("&")},toArray:function(e){var i=this._getItemsAsjQuery(e&&e.connected),s=[];return e=e||{},i.each(function(){s.push(t(e.item||this).attr(e.attribute||"id")||"")}),s},_intersectsWith:function(t){var e=this.positionAbs.left,i=e+this.helperProportions.width,s=this.positionAbs.top,n=s+this.helperProportions.height,o=t.left,a=o+t.width,r=t.top,l=r+t.height,h=this.offset.click.top,c=this.offset.click.left,u="x"===this.options.axis||s+h>r&&s+h<l,d="y"===this.options.axis||e+c>o&&e+c<a;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>t[this.floating?"width":"height"]?u&&d:o<e+this.helperProportions.width/2&&i-this.helperProportions.width/2<a&&r<s+this.helperProportions.height/2&&n-this.helperProportions.height/2<l},_intersectsWithPointer:function(t){var e,i,s="x"===this.options.axis||this._isOverAxis(this.positionAbs.top+this.offset.click.top,t.top,t.height),n="y"===this.options.axis||this._isOverAxis(this.positionAbs.left+this.offset.click.left,t.left,t.width);return!!s&&!!n&&(e=this.dragDirection.vertical,i=this.dragDirection.horizontal,this.floating?"right"===i||"down"===e?2:1:e&&("down"===e?2:1))},_intersectsWithSides:function(t){var e=this._isOverAxis(this.positionAbs.top+this.offset.click.top,t.top+t.height/2,t.height),i=this._isOverAxis(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),s=this.dragDirection.vertical,n=this.dragDirection.horizontal;return this.floating&&n?"right"===n&&i||"left"===n&&!i:s&&("down"===s&&e||"up"===s&&!e)},_getDragVerticalDirection:function(){var t=this.positionAbs.top-this.lastPositionAbs.top;return 0!==t&&(t>0?"down":"up")},_getDragHorizontalDirection:function(){var t=this.positionAbs.left-this.lastPositionAbs.left;return 0!==t&&(t>0?"right":"left")},refresh:function(t){return this._refreshItems(t),this._setHandleClassName(),this.refreshPositions(),this},_connectWith:function(){var t=this.options;
vendor: 27,623 bytes, line 12428
12428return t.connectWith.constructor===String?[t.connectWith]:t.connectWith},_getItemsAsjQuery:function(e){var i,s,n,o,a=[],r=[],l=this._connectWith();if(l&&e)for(i=l.length-1;i>=0;i--)for(s=(n=t(l[i],this.document[0])).length-1;s>=0;s--)(o=t.data(n[s],this.widgetFullName))&&o!==this&&!o.options.disabled&&r.push(["function"==typeof o.options.items?o.options.items.call(o.element):t(o.options.items,o.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),o]);function h(){a.push(this)}for(r.push(["function"==typeof this.options.items?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):t(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),i=r.length-1;i>=0;i--)r[i][0].each(h);return t(a)},_removeCurrentsFromItems:function(){var e=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=t.grep(this.items,function(t){for(var i=0;i<e.length;i++)if(e[i]===t.item[0])return!1;return!0})},_refreshItems:function(e){this.items=[],this.containers=[this];var i,s,n,o,a,r,l,h,c=this.items,u=[["function"==typeof this.options.items?this.options.items.call(this.element[0],e,{item:this.currentItem}):t(this.options.items,this.element),this]],d=this._connectWith();if(d&&this.ready)for(i=d.length-1;i>=0;i--)for(s=(n=t(d[i],this.document[0])).length-1;s>=0;s--)(o=t.data(n[s],this.widgetFullName))&&o!==this&&!o.options.disabled&&(u.push(["function"==typeof o.options.items?o.options.items.call(o.element[0],e,{item:this.currentItem}):t(o.options.items,o.element),o]),this.containers.push(o));for(i=u.length-1;i>=0;i--)for(s=0,a=u[i][1],h=(r=u[i][0]).length;s<h;s++)(l=t(r[s])).data(this.widgetName+"-item",a),c.push({item:l,instance:a,width:0,height:0,left:0,top:0})},_refreshItemPositions:function(e){var i,s,n,o;for(i=this.items.length-1;i>=0;i--)s=this.items[i],(!this.currentContainer||s.instance===this.currentContainer||s.item[0]===this.currentItem[0])&&(n=this.options.toleranceElement?t(this.options.toleranceElement,s.item):s.item,e||(s.width=n.outerWidth(),s.height=n.outerHeight()),s.left=(o=n.offset()).left,s.top=o.top)},refreshPositions:function(t){var e,i;if(this.floating=!!this.items.length&&("x"===this.options.axis||this._isFloating(this.items[0].item)),this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset()),this._refreshItemPositions(t),this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(e=this.containers.length-1;e>=0;e--)i=this.containers[e].element.offset(),this.containers[e].containerCache.left=i.left,this.containers[e].containerCache.top=i.top,this.containers[e].containerCache.width=this.containers[e].element.outerWidth(),this.containers[e].containerCache.height=this.containers[e].element.outerHeight();return this},_createPlaceholder:function(e){var i,s,n=(e=e||this).options;n.placeholder&&n.placeholder.constructor!==String||(i=n.placeholder,s=e.currentItem[0].nodeName.toLowerCase(),n.placeholder={element:function(){var n=t("<"+s+">",e.document[0]);return e._addClass(n,"ui-sortable-placeholder",i||e.currentItem[0].className)._removeClass(n,"ui-sortable-helper"),"tbody"===s?e._createTrPlaceholder(e.currentItem.find("tr").eq(0),t("<tr>",e.document[0]).appendTo(n)):"tr"===s?e._createTrPlaceholder(e.currentItem,n):"img"===s&&n.attr("src",e.currentItem.attr("src")),i||n.css("visibility","hidden"),n},update:function(t,o){(!i||n.forcePlaceholderSize)&&((!o.height()||n.forcePlaceholderSize&&("tbody"===s||"tr"===s))&&o.height(e.currentItem.innerHeight()-parseInt(e.currentItem.css("paddingTop")||0,10)-parseInt(e.currentItem.css("paddingBottom")||0,10)),o.width()||o.width(e.currentItem.innerWidth()-parseInt(e.currentItem.css("paddingLeft")||0,10)-parseInt(e.currentItem.css("paddingRight")||0,10)))}}),e.placeholder=t(n.placeholder.element.call(e.element,e.currentItem)),e.currentItem.after(e.placeholder),n.placeholder.update(e,e.placeholder)},_createTrPlaceholder:function(e,i){var s=this;e.children().each(function(){t("<td> </td>",s.document[0]).attr("colspan",t(this).attr("colspan")||1).appendTo(i)})},_contactContainers:function(e){var i,s,n,o,a,r,l,h,c,u,d=null,p=null;for(i=this.containers.length-1;i>=0;i--)if(!t.contains(this.currentItem[0],this.containers[i].element[0])){if(this._intersectsWith(this.containers[i].containerCache)){if(d&&t.contains(this.containers[i].element[0],d.element[0]))continue;d=this.containers[i],p=i}else this.containers[i].containerCache.over&&(this.containers[i]._trigger("out",e,this._uiHash(this)),this.containers[i].containerCache.over=0)}if(d){if(1===this.containers.length)this.containers[p].containerCache.over||(this.containers[p]._trigger("over",e,this._uiHash(this)),this.containers[p].containerCache.over=1);else{for(n=1e4,o=null,a=(c=d.floating||this._isFloating(this.currentItem))?"left":"top",r=c?"width":"height",u=c?"pageX":"pageY",s=this.items.length-1;s>=0;s--)t.contains(this.containers[p].element[0],this.items[s].item[0])&&this.items[s].item[0]!==this.currentItem[0]&&(l=this.items[s].item.offset()[a],h=!1,e[u]-l>this.items[s][r]/2&&(h=!0),Math.abs(e[u]-l)<n&&(n=Math.abs(e[u]-l),o=this.items[s],this.direction=h?"up":"down"));if(!o&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[p]){this.currentContainer.containerCache.over||(this.containers[p]._trigger("over",e,this._uiHash()),this.currentContainer.containerCache.over=1);return}o?this._rearrange(e,o,null,!0):this._rearrange(e,null,this.containers[p].element,!0),this._trigger("change",e,this._uiHash()),this.containers[p]._trigger("change",e,this._uiHash(this)),this.currentContainer=this.containers[p],this.options.placeholder.update(this.currentContainer,this.placeholder),this.scrollParent=this.placeholder.scrollParent(),this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this.containers[p]._trigger("over",e,this._uiHash(this)),this.containers[p].containerCache.over=1}}},_createHelper:function(e){var i=this.options,s="function"==typeof i.helper?t(i.helper.apply(this.element[0],[e,this.currentItem])):"clone"===i.helper?this.currentItem.clone():this.currentItem;return s.parents("body").length||this.appendTo[0].appendChild(s[0]),s[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(!s[0].style.width||i.forceHelperSize)&&s.width(this.currentItem.width()),(!s[0].style.height||i.forceHelperSize)&&s.height(this.currentItem.height()),s},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),Array.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var e=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),this.offsetParent[0]===this.document[0].body&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"!==this.cssPosition)return{top:0,left:0};var t=this.currentItem.position();return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:t.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e,i,s,n=this.options;"parent"===n.containment&&(n.containment=this.helper[0].parentNode),("document"===n.containment||"window"===n.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,"document"===n.containment?this.document.width():this.window.width()-this.helperProportions.width-this.margins.left,("document"===n.containment?this.document.height()||document.body.parentNode.scrollHeight:this.window.height()||this.document[0].body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(n.containment)||(e=t(n.containment)[0],i=t(n.containment).offset(),s="hidden"!==t(e).css("overflow"),this.containment=[i.left+(parseInt(t(e).css("borderLeftWidth"),10)||0)+(parseInt(t(e).css("paddingLeft"),10)||0)-this.margins.left,i.top+(parseInt(t(e).css("borderTopWidth"),10)||0)+(parseInt(t(e).css("paddingTop"),10)||0)-this.margins.top,i.left+(s?Math.max(e.scrollWidth,e.offsetWidth):e.offsetWidth)-(parseInt(t(e).css("borderLeftWidth"),10)||0)-(parseInt(t(e).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,i.top+(s?Math.max(e.scrollHeight,e.offsetHeight):e.offsetHeight)-(parseInt(t(e).css("borderTopWidth"),10)||0)-(parseInt(t(e).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(e,i){i||(i=this.position);var s="absolute"===e?1:-1,n="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,o=/(html|body)/i.test(n[0].tagName);return{top:i.top+this.offset.relative.top*s+this.offset.parent.top*s-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():o?0:n.scrollTop())*s,left:i.left+this.offset.relative.left*s+this.offset.parent.left*s-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():o?0:n.scrollLeft())*s}},_generatePosition:function(e){var i,s,n=this.options,o=e.pageX,a=e.pageY,r="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,l=/(html|body)/i.test(r[0].tagName);return"relative"===this.cssPosition&&(this.scrollParent[0]===this.document[0]||this.scrollParent[0]===this.offsetParent[0])&&(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(e.pageX-this.offset.click.left<this.containment[0]&&(o=this.containment[0]+this.offset.click.left),e.pageY-this.offset.click.top<this.containment[1]&&(a=this.containment[1]+this.offset.click.top),e.pageX-this.offset.click.left>this.containment[2]&&(o=this.containment[2]+this.offset.click.left),e.pageY-this.offset.click.top>this.containment[3]&&(a=this.containment[3]+this.offset.click.top)),n.grid&&(i=this.originalPageY+Math.round((a-this.originalPageY)/n.grid[1])*n.grid[1],a=this.containment?i-this.offset.click.top>=this.containment[1]&&i-this.offset.click.top<=this.containment[3]?i:i-this.offset.click.top>=this.containment[1]?i-n.grid[1]:i+n.grid[1]:i,s=this.originalPageX+Math.round((o-this.originalPageX)/n.grid[0])*n.grid[0],o=this.containment?s-this.offset.click.left>=this.containment[0]&&s-this.offset.click.left<=this.containment[2]?s:s-this.offset.click.left>=this.containment[0]?s-n.grid[0]:s+n.grid[0]:s)),{top:a-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():l?0:r.scrollTop()),left:o-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():l?0:r.scrollLeft())}},_rearrange:function(t,e,i,s){i?i[0].appendChild(this.placeholder[0]):e.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?e.item[0]:e.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var n=this.counter;this._delay(function(){n===this.counter&&this.refreshPositions(!s)})},_clear:function(t,e){this.reverting=!1;var i,s=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(i in this._storedCSS)("auto"===this._storedCSS[i]||"static"===this._storedCSS[i])&&(this._storedCSS[i]="");this.currentItem.css(this._storedCSS),this._removeClass(this.currentItem,"ui-sortable-helper")}else this.currentItem.show();function n(t,e,i){return function(s){i._trigger(t,s,e._uiHash(e))}}for(this.fromOutside&&!e&&s.push(function(t){this._trigger("receive",t,this._uiHash(this.fromOutside))}),(this.fromOutside||this.domPosition.prev!==this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!==this.currentItem.parent()[0])&&!e&&s.push(function(t){this._trigger("update",t,this._uiHash())}),this===this.currentContainer||e||(s.push(function(t){this._trigger("remove",t,this._uiHash())}),s.push((function(t){return function(e){t._trigger("receive",e,this._uiHash(this))}}).call(this,this.currentContainer)),s.push((function(t){return function(e){t._trigger("update",e,this._uiHash(this))}}).call(this,this.currentContainer))),i=this.containers.length-1;i>=0;i--)e||s.push(n("deactivate",this,this.containers[i])),this.containers[i].containerCache.over&&(s.push(n("out",this,this.containers[i])),this.containers[i].containerCache.over=0);if(this._storedStylesheet&&(this._storedStylesheet.remove(),this._storedStylesheet=null),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,e||this._trigger("beforeStop",t,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.cancelHelperRemoval||(this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null),!e){for(i=0;i<s.length;i++)s[i].call(this,t);this._trigger("stop",t,this._uiHash())}return this.fromOutside=!1,!this.cancelHelperRemoval},_trigger:function(){!1===t.Widget.prototype._trigger.apply(this,arguments)&&this.cancel()},_uiHash:function(e){var i=e||this;return{helper:i.helper,placeholder:i.placeholder||t([]),position:i.position,originalPosition:i.originalPosition,offset:i.positionAbs,item:i.currentItem,sender:e?e.element:null}}}),t.widget("ui.spinner",{version:"1.14.2",defaultElement:"<input>",widgetEventPrefix:"spin",options:{classes:{"ui-spinner":"ui-corner-all","ui-spinner-down":"ui-corner-br","ui-spinner-up":"ui-corner-tr"},culture:null,icons:{down:"ui-icon-triangle-1-s",up:"ui-icon-triangle-1-n"},incremental:!0,max:null,min:null,numberFormat:null,page:10,step:1,change:null,spin:null,start:null,stop:null},_create:function(){this._setOption("max",this.options.max),this._setOption("min",this.options.min),this._setOption("step",this.options.step),""!==this.value()&&this._value(this.element.val(),!0),this._draw(),this._on(this._events),this._refresh(),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_getCreateOptions:function(){var e=this._super(),i=this.element;return t.each(["min","max","step"],function(t,s){var n=i.attr(s);null!=n&&n.length&&(e[s]=n)}),e},_events:{keydown:function(t){this._start(t)&&this._keydown(t)&&t.preventDefault()},keyup:"_stop",focus:function(){this.previous=this.element.val()},blur:function(t){this._stop(),this._refresh(),this.previous!==this.element.val()&&this._trigger("change",t)},wheel:function(t){var e=this.document[0].activeElement,i=this.element[0]===e,s=t.deltaY||t.originalEvent&&t.originalEvent.deltaY;if(i&&s){if(!this.spinning&&!this._start(t))return!1;this._spin((s>0?-1:1)*this.options.step,t),clearTimeout(this.mousewheelTimer),this.mousewheelTimer=this._delay(function(){this.spinning&&this._stop(t)},100),t.preventDefault()}},mousewheel:function(e,i){if(e.isTrigger){var s=t.Event(e);return s.type="wheel",i&&(s.deltaY=-i),this._events.wheel.call(this,s)}},"mousedown .ui-spinner-button":function(e){var i;i=this.element[0]===this.document[0].activeElement?this.previous:this.element.val(),e.preventDefault(),(function(){this.element[0]!==this.document[0].activeElement&&(this.element.trigger("focus"),this.previous=i)}).call(this),!1!==this._start(e)&&this._repeat(null,t(e.currentTarget).hasClass("ui-spinner-up")?1:-1,e)},"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":function(e){if(t(e.currentTarget).hasClass("ui-state-active")){if(!1===this._start(e))return!1;this._repeat(null,t(e.currentTarget).hasClass("ui-spinner-up")?1:-1,e)}},"mouseleave .ui-spinner-button":"_stop"},_enhance:function(){this.uiSpinner=this.element.attr("autocomplete","off").wrap("<span>").parent().append("<a></a><a></a>")},_draw:function(){this._enhance(),this._addClass(this.uiSpinner,"ui-spinner","ui-widget ui-widget-content"),this._addClass("ui-spinner-input"),this.element.attr("role","spinbutton"),this.buttons=this.uiSpinner.children("a").attr("tabIndex",-1).attr("aria-hidden",!0).button({classes:{"ui-button":""}}),this._removeClass(this.buttons,"ui-corner-all"),this._addClass(this.buttons.first(),"ui-spinner-button ui-spinner-up"),this._addClass(this.buttons.last(),"ui-spinner-button ui-spinner-down"),this.buttons.first().button({icon:this.options.icons.up,showLabel:!1}),this.buttons.last().button({icon:this.options.icons.down,showLabel:!1}),this.buttons.height()>Math.ceil(.5*this.uiSpinner.height())&&this.uiSpinner.height()>0&&this.uiSpinner.height(this.uiSpinner.height())},_keydown:function(e){var i=this.options,s=t.ui.keyCode;switch(e.keyCode){case s.UP:return this._repeat(null,1,e),!0;case s.DOWN:return this._repeat(null,-1,e),!0;case s.PAGE_UP:return this._repeat(null,i.page,e),!0;case s.PAGE_DOWN:return this._repeat(null,-i.page,e),!0}return!1},_start:function(t){return(!!this.spinning||!1!==this._trigger("start",t))&&(this.counter||(this.counter=1),this.spinning=!0,!0)},_repeat:function(t,e,i){t=t||500,clearTimeout(this.timer),this.timer=this._delay(function(){this._repeat(40,e,i)},t),this._spin(e*this.options.step,i)},_spin:function(t,e){var i=this.value()||0;this.counter||(this.counter=1),i=this._adjustValue(i+t*this._increment(this.counter)),(!this.spinning||!1!==this._trigger("spin",e,{value:i}))&&(this._value(i),this.counter++)},_increment:function(t){var e=this.options.incremental;return e?"function"==typeof e?e(t):Math.floor(t*t*t/5e4-t*t/500+17*t/200+1):1},_precision:function(){var t=this._precisionOf(this.options.step);return null!==this.options.min&&(t=Math.max(t,this._precisionOf(this.options.min))),t},_precisionOf:function(t){var e=t.toString(),i=e.indexOf(".");return -1===i?0:e.length-i-1},_adjustValue:function(t){var e,i,s=this.options;return(i=Math.round((i=t-(e=null!==s.min?s.min:0))/s.step)*s.step,t=parseFloat((t=e+i).toFixed(this._precision())),null!==s.max&&t>s.max)?s.max:null!==s.min&&t<s.min?s.min:t},_stop:function(t){this.spinning&&(clearTimeout(this.timer),clearTimeout(this.mousewheelTimer),this.counter=0,this.spinning=!1,this._trigger("stop",t))},_setOption:function(t,e){var i,s,n;if("culture"===t||"numberFormat"===t){i=this._parse(this.element.val()),this.options[t]=e,this.element.val(this._format(i));return}("max"===t||"min"===t||"step"===t)&&"string"==typeof e&&(e=this._parse(e)),"icons"===t&&(s=this.buttons.first().find(".ui-icon"),this._removeClass(s,null,this.options.icons.up),this._addClass(s,null,e.up),n=this.buttons.last().find(".ui-icon"),this._removeClass(n,null,this.options.icons.down),this._addClass(n,null,e.down)),this._super(t,e)},_setOptionDisabled:function(t){this._super(t),this._toggleClass(this.uiSpinner,null,"ui-state-disabled",!!t),this.element.prop("disabled",!!t),this.buttons.button(t?"disable":"enable")},_setOptions:O(function(t){this._super(t)}),_parse:function(t){return"string"==typeof t&&""!==t&&(t=window.Globalize&&this.options.numberFormat?Globalize.parseFloat(t,10,this.options.culture):+t),""===t||isNaN(t)?null:t},_format:function(t){return""===t?"":window.Globalize&&this.options.numberFormat?Globalize.format(t,this.options.numberFormat,this.options.culture):t},_refresh:function(){this.element.attr({"aria-valuemin":this.options.min,"aria-valuemax":this.options.max,"aria-valuenow":this._parse(this.element.val())})},isValid:function(){var t=this.value();return null!==t&&t===this._adjustValue(t)},_value:function(t,e){var i;""!==t&&null!==(i=this._parse(t))&&(e||(i=this._adjustValue(i)),t=this._format(i)),this.element.val(t),this._refresh()},_destroy:function(){this.element.prop("disabled",!1).removeAttr("autocomplete role aria-valuemin aria-valuemax aria-valuenow"),this.uiSpinner.replaceWith(this.element)},stepUp:O(function(t){this._stepUp(t)}),_stepUp:function(t){this._start()&&(this._spin((t||1)*this.options.step),this._stop())},stepDown:O(function(t){this._stepDown(t)}),_stepDown:function(t){this._start()&&(this._spin(-((t||1)*this.options.step)),this._stop())},pageUp:O(function(t){this._stepUp((t||1)*this.options.page)}),pageDown:O(function(t){this._stepDown((t||1)*this.options.page)}),value:function(t){if(!arguments.length)return this._parse(this.element.val());O(this._value).call(this,t)},widget:function(){return this.uiSpinner}}),!0===t.uiBackCompat&&t.widget("ui.spinner",t.ui.spinner,{_enhance:function(){this.uiSpinner=this.element.attr("autocomplete","off").wrap(this._uiSpinnerHtml()).parent().append(this._buttonHtml())},_uiSpinnerHtml:function(){return"<span>"},_buttonHtml:function(){return"<a></a><a></a>"}}),t.ui.spinner,t.widget("ui.tabs",{version:"1.14.2",delay:300,options:{active:null,classes:{"ui-tabs":"ui-corner-all","ui-tabs-nav":"ui-corner-all","ui-tabs-panel":"ui-corner-bottom","ui-tabs-tab":"ui-corner-top"},collapsible:!1,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_isLocal:function(t){var e=new URL(t.href),i=new URL(location.href);return t.hash.length>1&&e.origin===i.origin&&e.pathname===i.pathname&&e.search===i.search},_create:function(){var e=this,i=this.options;this.running=!1,this._addClass("ui-tabs","ui-widget ui-widget-content"),this._toggleClass("ui-tabs-collapsible",null,i.collapsible),this._processTabs(),i.active=this._initialActive(),Array.isArray(i.disabled)&&(i.disabled=t.uniqueSort(i.disabled.concat(t.map(this.tabs.filter(".ui-state-disabled"),function(t){return e.tabs.index(t)}))).sort()),!1!==this.options.active&&this.anchors.length?this.active=this._findActive(i.active):this.active=t(),this._refresh(),this.active.length&&this.load(i.active)},_initialActive:function(){var e=this.options.active,i=this.options.collapsible,s=location.hash.substring(1),n=decodeURIComponent(s);return null===e&&(s&&(this.tabs.each(function(i,n){if(t(n).attr("aria-controls")===s)return e=i,!1}),null===e&&this.tabs.each(function(i,s){if(t(s).attr("aria-controls")===n)return e=i,!1})),null===e&&(e=this.tabs.index(this.tabs.filter(".ui-tabs-active"))),(null===e||-1===e)&&(e=!!this.tabs.length&&0)),!1!==e&&-1===(e=this.tabs.index(this.tabs.eq(e)))&&(e=!i&&0),!i&&!1===e&&this.anchors.length&&(e=0),e},_getCreateEventData:function(){return{tab:this.active,panel:this.active.length?this._getPanelForTab(this.active):t()}},_tabKeydown:function(e){var i=t(this.document[0].activeElement).closest("li"),s=this.tabs.index(i),n=!0;if(!this._handlePageNav(e)){switch(e.keyCode){case t.ui.keyCode.RIGHT:case t.ui.keyCode.DOWN:s++;break;case t.ui.keyCode.UP:case t.ui.keyCode.LEFT:n=!1,s--;break;case t.ui.keyCode.END:s=this.anchors.length-1;break;case t.ui.keyCode.HOME:s=0;break;case t.ui.keyCode.SPACE:e.preventDefault(),clearTimeout(this.activating),this._activate(s);return;case t.ui.keyCode.ENTER:e.preventDefault(),clearTimeout(this.activating),this._activate(s!==this.options.active&&s);return;default:return}e.preventDefault(),clearTimeout(this.activating),s=this._focusNextTab(s,n),e.ctrlKey||e.metaKey||(i.attr("aria-selected","false"),this.tabs.eq(s).attr("aria-selected","true"),this.activating=this._delay(function(){this.option("active",s)},this.delay))}},_panelKeydown:function(e){!this._handlePageNav(e)&&e.ctrlKey&&e.keyCode===t.ui.keyCode.UP&&(e.preventDefault(),this.active.trigger("focus"))},_handlePageNav:function(e){return e.altKey&&e.keyCode===t.ui.keyCode.PAGE_UP?(this._activate(this._focusNextTab(this.options.active-1,!1)),!0):e.altKey&&e.keyCode===t.ui.keyCode.PAGE_DOWN?(this._activate(this._focusNextTab(this.options.active+1,!0)),!0):void 0},_findNextTab:function(e,i){var s=this.tabs.length-1;while(-1!==t.inArray((e>s&&(e=0),e<0&&(e=s),e),this.options.disabled))e=i?e+1:e-1;return e},_focusNextTab:function(t,e){return t=this._findNextTab(t,e),this.tabs.eq(t).trigger("focus"),t},_setOption:function(t,e){if("active"===t){this._activate(e);return}this._super(t,e),"collapsible"!==t||(this._toggleClass("ui-tabs-collapsible",null,e),e||!1!==this.options.active||this._activate(0)),"event"===t&&this._setupEvents(e),"heightStyle"===t&&this._setupHeightStyle(e)},refresh:function(){var e=this.options,i=this.tablist.children(":has(a[href])");e.disabled=t.map(i.filter(".ui-state-disabled"),function(t){return i.index(t)}),this._processTabs(),!1!==e.active&&this.anchors.length?this.active.length&&!t.contains(this.tablist[0],this.active[0])?this.tabs.length===e.disabled.length?(e.active=!1,this.active=t()):this._activate(this._findNextTab(Math.max(0,e.active-1),!1)):e.active=this.tabs.index(this.active):(e.active=!1,this.active=t()),this._refresh()},_refresh:function(){this._setOptionDisabled(this.options.disabled),this._setupEvents(this.options.event),this._setupHeightStyle(this.options.heightStyle),this.tabs.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}),this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-hidden":"true"}),this.active.length?(this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}),this._addClass(this.active,"ui-tabs-active","ui-state-active"),this._getPanelForTab(this.active).show().attr({"aria-hidden":"false"})):this.tabs.eq(0).attr("tabIndex",0)},_processTabs:function(){var e=this,i=this.tabs,s=this.anchors,n=this.panels;this.tablist=this._getList().attr("role","tablist"),this._addClass(this.tablist,"ui-tabs-nav","ui-helper-reset ui-helper-clearfix ui-widget-header"),this.tablist.on("mousedown"+this.eventNamespace,"> li",function(e){t(this).is(".ui-state-disabled")&&e.preventDefault()}),this.tabs=this.tablist.find("> li:has(a[href])").attr({role:"tab",tabIndex:-1}),this._addClass(this.tabs,"ui-tabs-tab","ui-state-default"),this.anchors=this.tabs.map(function(){return t("a",this)[0]}).attr({tabIndex:-1}),this._addClass(this.anchors,"ui-tabs-anchor"),this.panels=t(),this.anchors.each(function(i,s){var n,o,a,r=t(s).uniqueId().attr("id"),l=t(s).closest("li"),h=l.attr("aria-controls");e._isLocal(s)?(a=(n=s.hash).substring(1),(o=e.element.find("#"+CSS.escape(a))).length||(a=decodeURIComponent(a),o=e.element.find("#"+CSS.escape(a)))):(n="#"+(a=l.attr("aria-controls")||t({}).uniqueId()[0].id),(o=e.element.find(n)).length||(o=e._createPanel(a)).insertAfter(e.panels[i-1]||e.tablist),o.attr("aria-live","polite")),o.length&&(e.panels=e.panels.add(o)),h&&l.data("ui-tabs-aria-controls",h),l.attr({"aria-controls":a,"aria-labelledby":r}),o.attr("aria-labelledby",r)}),this.panels.attr("role","tabpanel"),this._addClass(this.panels,"ui-tabs-panel","ui-widget-content"),i&&(this._off(i.not(this.tabs)
vendor: 11,437 bytes, line 12428
12428),this._off(s.not(this.anchors)),this._off(n.not(this.panels)))},_getList:function(){return this.tablist||this.element.find("ol, ul").eq(0)},_createPanel:function(e){return t("<div>").attr("id",e).data("ui-tabs-destroy",!0)},_setOptionDisabled:function(e){var i,s,n;for(Array.isArray(e)&&(e.length?e.length===this.anchors.length&&(e=!0):e=!1),n=0;s=this.tabs[n];n++)i=t(s),!0===e||-1!==t.inArray(n,e)?(i.attr("aria-disabled","true"),this._addClass(i,null,"ui-state-disabled")):(i.removeAttr("aria-disabled"),this._removeClass(i,null,"ui-state-disabled"));this.options.disabled=e,this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!0===e)},_setupEvents:function(e){var i={};e&&t.each(e.split(" "),function(t,e){i[e]="_eventHandler"}),this._off(this.anchors.add(this.tabs).add(this.panels)),this._on(!0,this.anchors,{click:function(t){t.preventDefault()}}),this._on(this.anchors,i),this._on(this.tabs,{keydown:"_tabKeydown"}),this._on(this.panels,{keydown:"_panelKeydown"}),this._focusable(this.tabs),this._hoverable(this.tabs)},_setupHeightStyle:function(e){var i,s=this.element.parent();"fill"===e?(i=s.height()-(this.element.outerHeight()-this.element.height()),this.element.siblings(":visible").each(function(){var e=t(this),s=e.css("position");"absolute"!==s&&"fixed"!==s&&(i-=e.outerHeight(!0))}),this.element.children().not(this.panels).each(function(){i-=t(this).outerHeight(!0)}),this.panels.each(function(){t(this).height(Math.max(0,i-t(this).innerHeight()+t(this).height()))}).css("overflow","auto")):"auto"===e&&(i=0,this.panels.each(function(){i=Math.max(i,t(this).height("").height())}).height(i))},_eventHandler:function(e){var i=this.options,s=this.active,n=t(e.currentTarget).closest("li"),o=n[0]===s[0],a=o&&i.collapsible,r=a?t():this._getPanelForTab(n),l=s.length?this._getPanelForTab(s):t(),h={oldTab:s,oldPanel:l,newTab:a?t():n,newPanel:r};e.preventDefault(),!(n.hasClass("ui-state-disabled")||n.hasClass("ui-tabs-loading"))&&!this.running&&(!o||i.collapsible)&&!1!==this._trigger("beforeActivate",e,h)&&(i.active=!a&&this.tabs.index(n),this.active=o?t():n,this.xhr&&this.xhr.abort(),l.length||r.length||t.error("jQuery UI Tabs: Mismatching fragment identifier."),r.length&&this.load(this.tabs.index(n),e),this._toggle(e,h))},_toggle:function(e,i){var s=this,n=i.newPanel,o=i.oldPanel;function a(){s.running=!1,s._trigger("activate",e,i)}function r(){s._addClass(i.newTab.closest("li"),"ui-tabs-active","ui-state-active"),n.length&&s.options.show?s._show(n,s.options.show,a):(n.show(),a())}this.running=!0,o.length&&this.options.hide?this._hide(o,this.options.hide,function(){s._removeClass(i.oldTab.closest("li"),"ui-tabs-active","ui-state-active"),r()}):(this._removeClass(i.oldTab.closest("li"),"ui-tabs-active","ui-state-active"),o.hide(),r()),o.attr("aria-hidden","true"),i.oldTab.attr({"aria-selected":"false","aria-expanded":"false"}),n.length&&o.length?i.oldTab.attr("tabIndex",-1):n.length&&this.tabs.filter(function(){return 0===t(this).attr("tabIndex")}).attr("tabIndex",-1),n.attr("aria-hidden","false"),i.newTab.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_activate:function(e){var i,s=this._findActive(e);s[0]!==this.active[0]&&(s.length||(s=this.active),i=s.find(".ui-tabs-anchor")[0],this._eventHandler({target:i,currentTarget:i,preventDefault:t.noop}))},_findActive:function(e){return!1===e?t():this.tabs.eq(e)},_getIndex:function(t){return"string"==typeof t&&(t=this.anchors.index(this.anchors.filter("[href$='"+CSS.escape(t)+"']"))),t},_destroy:function(){this.xhr&&this.xhr.abort(),this.tablist.removeAttr("role").off(this.eventNamespace),this.anchors.removeAttr("role tabIndex").removeUniqueId(),this.tabs.add(this.panels).each(function(){t.data(this,"ui-tabs-destroy")?t(this).remove():t(this).removeAttr("role tabIndex aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded")}),this.tabs.each(function(){var e=t(this),i=e.data("ui-tabs-aria-controls");i?e.attr("aria-controls",i).removeData("ui-tabs-aria-controls"):e.removeAttr("aria-controls")}),this.panels.show(),"content"!==this.options.heightStyle&&this.panels.css("height","")},enable:function(e){var i=this.options.disabled;!1!==i&&(void 0===e?i=!1:(e=this._getIndex(e),i=Array.isArray(i)?t.map(i,function(t){return t!==e?t:null}):t.map(this.tabs,function(t,i){return i!==e?i:null})),this._setOptionDisabled(i))},disable:function(e){var i=this.options.disabled;if(!0!==i){if(void 0===e)i=!0;else{if(e=this._getIndex(e),-1!==t.inArray(e,i))return;i=Array.isArray(i)?t.merge([e],i).sort():[e]}this._setOptionDisabled(i)}},load:function(e,i){e=this._getIndex(e);var s=this,n=this.tabs.eq(e),o=n.find(".ui-tabs-anchor"),a=this._getPanelForTab(n),r={tab:n,panel:a},l=function(t,e){"abort"===e&&s.panels.stop(!1,!0),s._removeClass(n,"ui-tabs-loading"),a.removeAttr("aria-busy"),t===s.xhr&&delete s.xhr};!this._isLocal(o[0])&&(this.xhr=t.ajax(this._ajaxSettings(o,i,r)),"canceled"!==this.xhr.statusText&&(this._addClass(n,"ui-tabs-loading"),a.attr("aria-busy","true"),this.xhr.done(function(t,e,n){a.html(t),s._trigger("load",i,r),l(n,e)}).fail(function(t,e){l(t,e)})))},_ajaxSettings:function(e,i,s){var n=this;return{url:e.attr("href"),beforeSend:function(e,o){return n._trigger("beforeLoad",i,t.extend({jqXHR:e,ajaxSettings:o},s))}}},_getPanelForTab:function(e){var i=t(e).attr("aria-controls");return this.element.find("#"+CSS.escape(i))}}),!0===t.uiBackCompat&&t.widget("ui.tabs",t.ui.tabs,{_processTabs:function(){this._superApply(arguments),this._addClass(this.tabs,"ui-tab")}}),t.ui.tabs,t.widget("ui.tooltip",{version:"1.14.2",options:{classes:{"ui-tooltip":"ui-corner-all ui-widget-shadow"},content:function(){var e=t(this).attr("title");return t("<a>").text(e).html()},hide:!0,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,track:!1,close:null,open:null},_addDescribedBy:function(t,e){var i=(t.attr("aria-describedby")||"").split(/\s+/);i.push(e),t.data("ui-tooltip-id",e).attr("aria-describedby",String.prototype.trim.call(i.join(" ")))},_removeDescribedBy:function(e){var i=e.data("ui-tooltip-id"),s=(e.attr("aria-describedby")||"").split(/\s+/),n=t.inArray(i,s);-1!==n&&s.splice(n,1),e.removeData("ui-tooltip-id"),(s=String.prototype.trim.call(s.join(" ")))?e.attr("aria-describedby",s):e.removeAttr("aria-describedby")},_create:function(){this._on({mouseover:"open",focusin:"open"}),this.tooltips={},this.parents={},this.liveRegion=t("<div>").attr({role:"log","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body),this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible"),this.disabledTitles=t([])},_setOption:function(e,i){var s=this;this._super(e,i),"content"===e&&t.each(this.tooltips,function(t,e){s._updateContent(e.element)})},_setOptionDisabled:function(t){this[t?"_disable":"_enable"]()},_disable:function(){var e=this;t.each(this.tooltips,function(i,s){var n=t.Event("blur");n.target=n.currentTarget=s.element[0],e.close(n,!0)}),this.disabledTitles=this.disabledTitles.add(this.element.find(this.options.items).addBack().filter(function(){var e=t(this);if(e.is("[title]"))return e.data("ui-tooltip-title",e.attr("title")).removeAttr("title")}))},_enable:function(){this.disabledTitles.each(function(){var e=t(this);e.data("ui-tooltip-title")&&e.attr("title",e.data("ui-tooltip-title"))}),this.disabledTitles=t([])},open:function(e){var i=this,s=t(e?e.target:this.element).closest(this.options.items);!(!s.length||s.data("ui-tooltip-id"))&&(s.attr("title")&&s.data("ui-tooltip-title",s.attr("title")),s.data("ui-tooltip-open",!0),e&&"mouseover"===e.type&&s.parents().each(function(){var e,s=t(this);s.data("ui-tooltip-open")&&((e=t.Event("blur")).target=e.currentTarget=this,i.close(e,!0)),s.attr("title")&&(s.uniqueId(),i.parents[this.id]={element:this,title:s.attr("title")},s.attr("title",""))}),this._registerCloseHandlers(e,s),this._updateContent(s,e))},_updateContent:function(t,e){var i,s=this.options.content,n=this,o=e?e.type:null;if("string"==typeof s||s.nodeType||s.jquery)return this._open(e,t,s);(i=s.call(t[0],function(i){t.data("ui-tooltip-open")&&(e&&(e.type=o),n._open(e,t,i))}))&&this._open(e,t,i)},_open:function(e,i,s){var n,o,a,r,l=t.extend({},this.options.position);if(s){if(n=this._find(i)){n.tooltip.find(".ui-tooltip-content").html(s);return}i.is("[title]")&&(e&&"mouseover"===e.type?i.attr("title",""):i.removeAttr("title")),o=(n=this._tooltip(i)).tooltip,this._addDescribedBy(i,o.attr("id")),o.find(".ui-tooltip-content").html(s),this.liveRegion.children().hide(),(r=t("<div>").html(o.find(".ui-tooltip-content").html())).removeAttr("name").find("[name]").removeAttr("name"),r.removeAttr("id").find("[id]").removeAttr("id"),r.appendTo(this.liveRegion),this.options.track&&e&&/^mouse/.test(e.type)?(this._on(this.document,{mousemove:h}),h(e)):o.position(t.extend({of:i},this.options.position)),o.hide(),this._show(o,this.options.show),this.options.track&&this.options.show&&this.options.show.delay&&(a=this.delayedShow=setInterval(function(){o.is(":visible")&&(h(l.of),clearInterval(a))},13)),this._trigger("open",e,{tooltip:o})}function h(t){l.of=t,!o.is(":hidden")&&o.position(l)}},_registerCloseHandlers:function(e,i){var s={keyup:function(e){if(e.keyCode===t.ui.keyCode.ESCAPE){var s=t.Event(e);s.currentTarget=i[0],this.close(s,!0)}}};i[0]!==this.element[0]&&(s.remove=function(){var t=this._find(i);t&&this._removeTooltip(t.tooltip)}),e&&"mouseover"!==e.type||(s.mouseleave="close"),e&&"focusin"!==e.type||(s.focusout="close"),this._on(!0,i,s)},close:function(e){var i,s=this,n=t(e?e.currentTarget:this.element),o=this._find(n);if(!o){n.removeData("ui-tooltip-open");return}i=o.tooltip,!o.closing&&(clearInterval(this.delayedShow),n.data("ui-tooltip-title")&&!n.attr("title")&&n.attr("title",n.data("ui-tooltip-title")),this._removeDescribedBy(n),o.hiding=!0,i.stop(!0),this._hide(i,this.options.hide,function(){s._removeTooltip(t(this))}),n.removeData("ui-tooltip-open"),this._off(n,"mouseleave focusout keyup"),n[0]!==this.element[0]&&this._off(n,"remove"),this._off(this.document,"mousemove"),e&&"mouseleave"===e.type&&t.each(this.parents,function(e,i){t(i.element).attr("title",i.title),delete s.parents[e]}),o.closing=!0,this._trigger("close",e,{tooltip:i}),o.hiding||(o.closing=!1))},_tooltip:function(e){var i=t("<div>").attr("role","tooltip"),s=t("<div>").appendTo(i),n=i.uniqueId().attr("id");return this._addClass(s,"ui-tooltip-content"),this._addClass(i,"ui-tooltip","ui-widget ui-widget-content"),i.appendTo(this._appendTo(e)),this.tooltips[n]={element:e,tooltip:i}},_find:function(t){var e=t.data("ui-tooltip-id");return e?this.tooltips[e]:null},_removeTooltip:function(t){clearInterval(this.delayedShow),t.remove(),delete this.tooltips[t.attr("id")]},_appendTo:function(t){var e=t.closest(".ui-front, dialog");return e.length||(e=this.document[0].body),e},_destroy:function(){var e=this;t.each(this.tooltips,function(i,s){var n=t.Event("blur"),o=s.element;n.target=n.currentTarget=o[0],e.close(n,!0),t("#"+i).remove(),o.data("ui-tooltip-title")&&(o.attr("title")||o.attr("title",o.data("ui-tooltip-title")),o.removeData("ui-tooltip-title"))}),this.liveRegion.remove()}}),!0===t.uiBackCompat&&t.widget("ui.tooltip",t.ui.tooltip,{options:{tooltipClass:null},_tooltip:function(){var t=this._superApply(arguments);return this.options.tooltipClass&&t.tooltip.addClass(this.options.tooltipClass),t}}),t.ui.tooltip});
12428 12429$(document).ready(function () { 12430 var $body = $('body'); 12431 var expiryDate = new Date('12/31/2999'); 12432 var size = Math.floor($('body').css('font-size').replace('px', '')); 12433 12434 //Append a class of cpTextResizeOn on body to get right styles for text resizer. 12435 $body.addClass('cpTextResizeOn'); 12436 12437 var factor = 1; 12438 if ($.cookie('sizeFactor') == null || $.cookie('sizeFactor') == '0') { 12439 //Do nothing. 12440 } 12441 else { 12442 factor = parseFloat($.cookie('sizeFactor')); 12443 size = size + factor; 12444 $body.css('font-size', '' + size + 'px'); 12445} 12446 12447 $('.cpTextResizer').find('a').click(function (e) { 12448 e.preventDefault(); 12449 resizePageText(size, $(this)); 12450 }); 12451}); 12452 12453//Resize the text based on cookie value set. 12454function resizePageText(originalFontSize, $anchor) { 12455 var $body = $('body'); 12456 var expiryDate = new Date('12/31/2999'); 12457 var currentFontSize = $body.css('font-size'); 12458 var bigOrSmall = $anchor.attr('id'); 12459 var multiplier = 1; 12460 var fontSize; 12461 if (bigOrSmall == "makeTextSmaller") { 12462 $.cookie('sizeFactor', parseInt($.cookie('sizeFactor') == null ? 0 : $.cookie('sizeFactor')) - 1, { path: '/', expires: expiryDate }); 12463 fontSize = parseInt(currentFontSize.replace('px', '')) - 1; 12464 } else if (bigOrSmall == "makeTextBigger") { 12465 $.cookie('sizeFactor', parseInt($.cookie('sizeFactor') == null ? 0 : $.cookie('sizeFactor')) + 1, { path: '/', expires: expiryDate }); 12466 fontSize = parseInt(currentFontSize.replace('px', '')) +1; 12467 } 12468 $body.css('font-size', '' + fontSize + 'px'); 12469 12470 if (!window.isRemoveSetHeights) 12471 SetHeights();//Adjust heights of the containers. 12472}; 12473var PopupBasedAuthentication = function () { 12474 var self = this; 12475 var popupWindow; 12476 var url; 12477 var paramSet; 12478 var jsCallback; 12479 var popupOrigin; 12480 12481 self.requireLoggedIn = function (redirectUri, parameterSet) { 12482 if (redirectUri == null || redirectUri == '') { 12483 redirectUri = (window.location.pathname + window.location.search).split('#')[0]; 12484 } 12485 self.setupParameters(redirectUri, parameterSet); 12486 self.checkLoggedIn(); 12487 }; 12488 12489 self.setupParameters = function (redirectUri, parameterSet) { 12490 url = redirectUri; 12491 paramSet = parameterSet; 12492 }; 12493 12494 self.setupJsCallback = function (callback) { 12495 jsCallback = callback; 12496 }; 12497 12498 self.checkLoggedIn = function () { 12499 $.ajax({
12500 url: '/Authentication/IsLoggedIn', 12501 type: 'GET', 12502 success: self.processCheckLoggedInResponse, 12503 async: false 12504 }) 12505 }; 12506 12507 self.processCheckLoggedInResponse = function (loggedInResponse) { 12508 if (loggedInResponse.loggedIn == true) { 12509 if (jsCallback == null) { 12510 window.location.href = url; 12511 } 12512 else { 12513 jsCallback(); 12514 } 12515 } 12516 else if (loggedInResponse.UseIdentityServer) { 12517 window.location.href = '/MyAccount?from=url&url=' + encodeURIComponent(url); 12518 } else { 12519 self.authenticate(loggedInResponse.domain); 12520 } 12521 }; 12522 12523 self.authenticate = function (domain) { 12524 var popupUrl = document.createElement('a'); 12525 popupUrl.href = 'https://' + domain; 12526 popupOrigin = popupUrl.protocol + '//' + popupUrl.host; 12527 if (internetExplorerVersion == undefined) { 12528 self.setupEventToListenFromChildWindow(); 12529 } 12530 12531 self.disableScreen(); 12532 12533 var width = 500; 12534 var height = 420; 12535 12536 var left = (screen.width / 2) - (width / 2); 12537 var top = (screen.height / 2) - (height / 2); 12538 12539 if (navigator.appName == 'Microsoft Internet Explorer' || !!(navigator.userAgent.match(/Trident/) || navigator.userAgent.match(/rv:11/)) || (typeof $.browser !== "undefined" && $.browser.msie == 1)) { 12540 window.location = "/MyAccount?from=url&url=" + window.location.pathname + window.location.search; 12541 return; 12542 } 12543 12544 popupWindow = window.open( 12545 popupOrigin + '/Authentication/Popup?' 12546 + 'redirectUri=' + encodeURIComponent(url) 12547 + '¶meterSet=' + paramSet 12548 + self.getUsernameFromCookie() 12549 + '&callingHost=' + window.location.protocol + '//' + window.location.hostname, 12550 'SignIn', 12551 'height=420,width=500,toolbar=no,menubar=no,left=' + left + ',top=' + top); 12552 12553 self.checkBlockedPopup(popupWindow); 12554 self.attachOnCloseEvent(popupWindow); 12555 }; 12556 12557 self.getUsernameFromCookie = function () { 12558 var usernameCookieValue = cookieGet("CP"); 12559 if (usernameCookieValue != null && usernameCookieValue.indexOf('uname=') == 0) { 12560 return '&prePopulatedUsername=' + usernameCookieValue.substring(6); 12561 } else { 12562 return ''; 12563 } 12564 }; 12565 12566 self.attachOnCloseEvent = function (win) { 12567 var intervalId; 12568 function checkWindow() { 12569 if (win && win.closed) { 12570 window.clearInterval(intervalId); 12571 self.enableScreen(); 12572 } 12573 } 12574 intervalId = window.setInterval(checkWindow, 500); 12575 }; 12576 12577 self.disableScreen = function () { 12578 $('#editItemBehavior_backgroundElement').show(); 12579 }; 12580 12581 self.enableScreen = function () { 12582 $('#editItemBehavior_backgroundElement').hide(); 12583 }; 12584 12585 self.checkBlockedPopup = function (popup) { 12586 setTimeout(function () { 12587 if (!popup || popup.closed || popup.closed == 'undefined' || (popup.outerHeight && popup.outerHeight === 0)) { 12588 alert('Popup blocked'); 12589 self.enableScreen(); 12590 } 12591 }, 25); 12592 }; 12593 12594 self.setupEventToListenFromChildWindow = function () { 12595 window.addEventListener('message', function (msg) { 12596 if (msg.source === popupWindow && msg.origin === popupOrigin && msg.data.Type == 'Redirect') { 12597 self.handleResponseFromChild(msg.data); 12598 } 12599 }, true); 12600 }; 12601 12602 self.internetExplorerMessageHandling = function (data) { 12603 self.handleResponseFromChild(data); 12604 }; 12605 12606 self.handleResponseFromChild = function (data) { 12607 if (data.Type == 'Redirect') { 12608 var redirectUrl = document.createElement('a'); 12609 redirectUrl.href = data.Url.replace(/&/g, '&'); 12610 if (redirectUrl.protocol === window.location.protocol && redirectUrl.host === window.location.host) { 12611 window.location.href = redirectUrl.href; 12612 } 12613 } 12614 }; 12615};
12616; 12617/** 12618 * http://www.openjs.com/scripts/events/keyboard_shortcuts/ 12619 * Version : 2.01.B 12620 * By Binny V A 12621 * License : BSD 12622 */ 12623 12624var pressCount = 0; //this is used to track button presses for a specific table widget IE hack 12625 12626shortcut = { 12627 'all_shortcuts':{},//All the shortcuts are stored in this array 12628 'add': function(shortcut_combination,callback,opt) { 12629 //Provide a set of default options 12630 var default_options = { 12631 'type':'keydown', 12632 'propagate':false, 12633 'disable_in_input':false, 12634 'target':document, 12635 'keycode':false 12636 } 12637 if(!opt) opt = default_options; 12638 else { 12639 for(var dfo in default_options) { 12640 if(typeof opt[dfo] == 'undefined') opt[dfo] = default_options[dfo]; 12641 } 12642 } 12643 12644 var ele = opt.target; 12645 if(typeof opt.target == 'string') ele = document.getElementById(opt.target); 12646 var ths = this; 12647 shortcut_combination = shortcut_combination.toLowerCase(); 12648 12649 //The function to be called at keypress 12650 var func = function(e) { 12651 e = e || window.event; 12652 var character = null; 12653 12654 //this is an IE only hack that will fix double (<p>) vs single line (<br>) breaks in the table widget (<div contenteditable=true) 12655 if (detectIE() && e.keyCode == 13 && e.target.tagName == 'DIV' && e.target.contentEditable == "true") { 12656 if ((pressCount) % 4 == 0) { 12657 var node = document.createElement('br') 12658 var positionNode = document.createTextNode('\u200B'); //used as a fake node to advance the cursor 12659 node.appendChild(positionNode); 12660 var selection = window.getSelection(); 12661 var range = selection.getRangeAt(0); 12662 range.insertNode(node); 12663 range.setStartAfter(node); 12664 range.setEndAfter(node); 12665 selection.removeAllRanges(); 12666 selection.addRange(range); 12667 } 12668 else { 12669 e.preventDefault(); 12670 } 12671 12672 pressCount++; 12673 return false; 12674 } 12675 12676 if(opt['disable_in_input']) { //Don't enable shortcut keys in Input, Textarea fields 12677 var element; 12678 if(e.target) element=e.target; 12679 else if(e.srcElement) element=e.srcElement; 12680 if(element.nodeType==3) element=element.parentNode; 12681 12682 if(element.tagName == 'INPUT' || element.tagName == 'TEXTAREA') return; 12683 } 12684 12685 //Find Which key is pressed 12686 if (e.keyCode) code = e.keyCode; 12687 else if (e.which) code = e.which; 12688 if (typeof (code) !== "undefined") 12689 { 12690 character = String.fromCharCode(code).toLowerCase(); 12691 if (code == 188) character = ","; //If the user presses , when the type is onkeydown 12692 if (code == 190) character = "."; //If the user presses , when the type is onkeydown 12693 } 12694 12695 var keys = shortcut_combination.split("+"); 12696 //Key Pressed - counts the number of valid keypresses - if it is same as the number of keys, the shortcut function is invoked 12697 var kp = 0; 12698 12699 //Work around for stupid Shift key bug created by using lowercase - as a result the shift+num combination was broken 12700 var shift_nums = { 12701 "`":"~", 12702 "1":"!", 12703 "2":"@", 12704 "3":"#", 12705 "4":"$", 12706 "5":"%", 12707 "6":"^", 12708 "7":"&", 12709 "8":"*", 12710 "9":"(", 12711 "0":")", 12712 "-":"_", 12713 "=":"+", 12714 ";":":", 12715 "'":"\"", 12716 ",":"<", 12717 ".":">", 12718 "/":"?", 12719 "\\":"|" 12720 } 12721 //Special Keys - and their codes 12722 var special_keys = { 12723 'esc':27, 12724 'escape':27, 12725 'tab':9, 12726 'space':32, 12727 'return':13, 12728 'enter':13, 12729 'backspace':8, 12730 12731 'scrolllock':145, 12732 'scroll_lock':145, 12733 'scroll':145, 12734 'capslock':20, 12735 'caps_lock':20, 12736 'caps':20, 12737 'numlock':144, 12738 'num_lock':144, 12739 'num':144, 12740 12741 'pause':19, 12742 'break':19, 12743 12744 'insert':45, 12745 'home':36, 12746 'delete':46, 12747 'end':35, 12748 12749 'pageup':33, 12750 'page_up':33, 12751 'pu':33, 12752 12753 'pagedown':34, 12754 'page_down':34, 12755 'pd':34, 12756 12757 'left':37, 12758 'up':38, 12759 'right':39, 12760 'down':40, 12761 12762 'f1':112, 12763 'f2':113, 12764 'f3':114, 12765 'f4':115, 12766 'f5':116, 12767 'f6':117, 12768 'f7':118, 12769 'f8':119, 12770 'f9':120, 12771 'f10':121, 12772 'f11':122, 12773 'f12':123 12774 } 12775 12776 var modifiers = { 12777 shift: { wanted:false, pressed:false}, 12778 ctrl : { wanted:false, pressed:false}, 12779 alt : { wanted:false, pressed:false}, 12780 meta : { wanted:false, pressed:false} //Meta is Mac specific 12781 }; 12782 12783 if(e.ctrlKey) modifiers.ctrl.pressed = true; 12784 if(e.shiftKey) modifiers.shift.pressed = true; 12785 if(e.altKey) modifiers.alt.pressed = true; 12786 if(e.metaKey) modifiers.meta.pressed = true; 12787 12788 for(var i=0; k=keys[i],i<keys.length; i++) { 12789 //Modifiers 12790 if(k == 'ctrl' || k == 'control') { 12791 kp++; 12792 modifiers.ctrl.wanted = true; 12793 12794 } else if(k == 'shift') { 12795 kp++; 12796 modifiers.shift.wanted = true; 12797 12798 } else if(k == 'alt') { 12799 kp++; 12800 modifiers.alt.wanted = true; 12801 } else if(k == 'meta') { 12802 kp++; 12803 modifiers.meta.wanted = true; 12804 } else if(k.length > 1) { //If it is a special key 12805 if(special_keys[k] == code) kp++; 12806 12807 } else if(opt['keycode']) { 12808 if(opt['keycode'] == code) kp++; 12809 12810 } else { //The special keys did not match 12811 if(character == k) kp++; 12812 else { 12813 if(shift_nums[character] && e.shiftKey) { //Stupid Shift key bug created by using lowercase 12814 character = shift_nums[character]; 12815 if(character == k) kp++; 12816 } 12817 } 12818 } 12819 } 12820 12821 if(kp == keys.length && 12822 modifiers.ctrl.pressed == modifiers.ctrl.wanted && 12823 modifiers.shift.pressed == modifiers.shift.wanted && 12824 modifiers.alt.pressed == modifiers.alt.wanted && 12825 modifiers.meta.pressed == modifiers.meta.wanted) { 12826 callback(e); 12827 12828 if(!opt['propagate']) { //Stop the event 12829 //e.cancelBubble is supported by IE - this will kill the bubbling process. 12830 e.cancelBubble = true; 12831 e.returnValue = false;
12832 12833 //e.stopPropagation works in Firefox. 12834 if (e.stopPropagation) { 12835 e.stopPropagation(); 12836 e.preventDefault(); 12837 } 12838 return false; 12839 } 12840 } 12841 } 12842 this.all_shortcuts[shortcut_combination] = { 12843 'callback':func, 12844 'target':ele, 12845 'event': opt['type'] 12846 }; 12847 //Attach the function with the event 12848 if(ele.addEventListener) ele.addEventListener(opt['type'], func, false); 12849 else if(ele.attachEvent) ele.attachEvent('on'+opt['type'], func); 12850 else ele['on'+opt['type']] = func; 12851 }, 12852 12853 //Remove the shortcut - just specify the shortcut and I will remove the binding 12854 'remove':function(shortcut_combination) { 12855 shortcut_combination = shortcut_combination.toLowerCase(); 12856 var binding = this.all_shortcuts[shortcut_combination]; 12857 delete(this.all_shortcuts[shortcut_combination]) 12858 if(!binding) return; 12859 var type = binding['event']; 12860 var ele = binding['target']; 12861 var callback = binding['callback']; 12862 12863 if(ele.detachEvent) ele.detachEvent('on'+type, callback); 12864 else if(ele.removeEventListener) ele.removeEventListener(type, callback, false); 12865 else ele['on'+type] = false; 12866 } 12867} 12868 12869/** 12870 * detect IE 12871 * returns version of IE or false, if browser is not Internet Explorer 12872 */ 12873function detectIE() { 12874 var ua = window.navigator.userAgent; 12875 12876 var msie = ua.indexOf('MSIE '); 12877 if (msie > 0) { 12878 // IE 10 or older => return version number 12879 return parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)), 10); 12880 } 12881 12882 var trident = ua.indexOf('Trident/'); 12883 if (trident > 0) { 12884 // IE 11 => return version number 12885 var rv = ua.indexOf('rv:'); 12886 return parseInt(ua.substring(rv + 3, ua.indexOf('.', rv)), 10); 12887 } 12888 12889 var edge = ua.indexOf('Edge/'); 12890 if (edge > 0) { 12891 // Edge (IE 12+) => return version number 12892 return parseInt(ua.substring(edge + 5, ua.indexOf('.', edge)), 10); 12893 } 12894 12895 // other browser 12896 return false; 12897} 12898; 12899// http://www.codinghorror.com/blog/2006/02/standard-browser-keyboard-shortcuts.html 12900// NOTE: Ctrl+Shift+T is used by browsers to reopen the last closed tab 12901// NOTE: Ctrl+Shift+B is used by several browsers for various functions 12902 12903//Toggle live edit 12904shortcut.add("Ctrl+Shift+L", function () { 12905 enableLiveEdit($.cookie("enableLiveEdit") === "false"); 12906}); 12907 12908//Toggle set heights 12909shortcut.add("Ctrl+Shift+S", function () { 12910 window.Core.performSetHeights = !window.Core.performSetHeights; 12911}); 12912 12913//Toggle bundling 12914shortcut.add("Ctrl+Shift+A", function () { 12915 if (window.location.href.indexOf('bundle=on') > -1) { 12916 window.location.href = window.location.href.replace('bundle=on', 'bundle=off'); 12917 } else if (window.location.href.indexOf('bundle=off') > -1) { 12918 window.location.href = window.location.href.replace('bundle=off', 'bundle=on'); 12919 } else { 12920 var value = $('script[src="/Assets/Scripts/Shared.js"]').length == 0 ? 'off' : 'on'; 12921 var connector = window.location.href.indexOf('?') > -1 ? '&' : '?'; 12922 window.location.href = window.location.href + connector + 'bundle=' + value; 12923 } 12924}); 12925 12926//Toggle mobile 12927shortcut.add("Ctrl+Shift+M", function () { 12928 if (window.location.href.indexOf('mobile=on') > -1) { 12929 window.location.href = window.location.href.replace('mobile=on', 'mobile=off'); 12930 } else if (window.location.href.indexOf('mobile=off') > -1) { 12931 window.location.href = window.location.href.replace('mobile=off', 'mobile=on'); 12932 } else { 12933 var value = $('body').hasClass('mobile') ? 'off' : 'on'; 12934 var connector = window.location.href.indexOf('?') > -1 ? '&' : '?'; 12935 window.location.href = window.location.href + connector + 'mobile=' + value; 12936 } 12937}); 12938; 12939var needRegisterH5Exts = true; 12940var isAlreadyInitialized = false; 12941 12942// Only register the placeholder attachment code once, regardless of include count. 12943// File shouldn't be included more than once, but it could happen. 12944if (needRegisterH5Exts) { 12945 $(document).ready(function () { 12946 // Register placeholder shims, if needed. 12947 if (needPlaceHoldersShim() && !isAlreadyInitialized) { 12948 isAlreadyInitialized = true; 12949 12950 // Not all INPUTs/TEXTAREAs are automatically hooked into this, 12951 // since we have older implementations of placeholders and 12952 // overridding them would cause wierd behavior. Plus, it 12953 // would not make sense to hook to image/checkbox/radio/etc. 12954 12955 // The attribute cp5ph (CivicPlus HTML5 PlaceHolder) is automatically placed on inputs 12956 // with placeholders through the CPHtml5TextInput() HTML extension. 12957 registerPlaceHoldersShim($('input[cp5ph]')); 12958 registerPlaceHoldersShim($('textarea[cp5ph]')); 12959 } 12960 }); 12961 12962 needRegisterH5Exts = false; 12963} 12964 12965// Registers placeholders on fields inside a specific context. 12966function registerPlaceHoldersShimOnContainer($container) { 12967 registerPlaceHoldersShim($('input[cp5ph]', $container));
12968 registerPlaceHoldersShim($('textarea[cp5ph]', $container)); 12969} 12970 12971// Unregisters placeholders on fields inside a specific context. 12972function unregisterPlaceHoldersShimOnContainer($container) { 12973 unregisterPlaceHolderShim($('input[cp5ph]', $container)); 12974 unregisterPlaceHolderShim($('textarea[cp5ph]', $container)); 12975} 12976 12977// Determines if placeholder shim is necessary. 12978function needPlaceHoldersShim() { 12979 var tmpElem = document.createElement('input'); 12980 return !('placeholder' in tmpElem); 12981} 12982 12983// Added due to a bug with IE 10's IE 7 document standards mode. The elem.getAttribute('placeholder') 12984// always returns NULL if IE 10 in IE 7 document standards mode, but elem.attributes['placeholder'] 12985// works. 12986function getPlaceholder(elem) { 12987 var placeholder = elem.getAttribute('placeholder') 12988 if (placeholder == null) { 12989 placeholder = elem.attributes['placeholder']; 12990 if (placeholder == null) 12991 return ''; 12992 else 12993 return placeholder.value; 12994 } 12995 return placeholder; 12996} 12997 12998// Unregisters placeholder shim hooks. Destroys event hooks and spawned placeholder element. 12999function unregisterPlaceHolderShim($elemsToHack) { 13000 // Get hooks. 13001 var hookData = $elemsToHack.data('cp5ph_hooks'); 13002 13003 if (hookData) { 13004 // Destroy all the hooks present. 13005 var attachedMSIE = hookData.ie == null ? [] : hookData.ie; 13006 var attachedSTD = hookData.std == null ? [] : hookData.std; 13007 var attachedJQR = hookData.jqr == null ? [] : hookData.jqr; 13008 var spawnedPHs = hookData.spawns == null ? [] : hookData.spawns; 13009 13010 // Remove MSIE style events. 13011 for (var i = 0, len = attachedMSIE.length; i < len; i++) { 13012 if (attachedMSIE[i].element) 13013 attachedMSIE[i].element.detachEvent(attachedMSIE[i].event, attachedMSIE[i].method); 13014 } 13015 13016 // Remove DOM standard (STD) events. 13017 for (var i = 0, len = attachedSTD.length; i < len; i++) { 13018 if (attachedSTD[i].element) 13019 attachedSTD[i].element.removeEventListener(attachedSTD[i].event, attachedSTD[i].method, false); 13020 } 13021 13022 // Remove jQuery bindings. 13023 for (var i = 0, len = attachedJQR.length; i < len; i++) { 13024 if (attachedJQR[i].instance) 13025 attachedJQR[i].instance.unbind(attachedJQR[i].event, attachedJQR[i].method); 13026 } 13027 13028 // Destroy placeholder spawned elements. 13029 for (var i = 0, len = spawnedPHs.length; i < len; i++) { 13030 if (spawnedPHs[i]) { 13031 spawnedPHs[i].innerHTML = ""; 13032 spawnedPHs[i].style.display = "none"; 13033 13034 if (spawnedPHs[i].parentNode) 13035 spawnedPHs[i].parentNode.removeChild(spawnedPHs[i]); 13036 } 13037 } 13038 13039 // Destroy hook data now that hooks have been cleaned. 13040 $elemsToHack.removeData('cp5ph_hooks'); 13041 } 13042} 13043 13044// Registers placeholder shims for jQuery element group specified. 13045// The shim is by no means perfect (won't catch things like attribute selectors causing changes). 13046 13047function registerPlaceHoldersShim($elemsToHack) { 13048 // Track standard, MSIE, and jQuery event assignments so they can be cancelled/destroyed. 13049 // Also track any spawned placeholder elements since they too need to be cleaned up. 13050 var attachedMSIE = []; 13051 var attachedSTD = []; 13052 var attachedJQR = []; 13053 var spawnedPHs = []; 13054 13055 // Hooks programmatic changes to the value property for browsers without 13056 // placeholder support. jQuery did not seem to have a way to do this. 13057 var hookProgrammaticValueChange = function(elem, callback) { 13058 // Note: Browsers are buggy at this time with DOMControlValueChanged. 13059 13060 // Handle Firefox Prior to 4 (which has built-in placeholder support). 13061 if (elem.__defineSetter__) { 13062 var oldSetter = elem.__lookupSetter__('value'); 13063 13064 if (oldSetter) { 13065 elem.__defineSetter__('value', function(v) { 13066 oldSetter.call(elem, v); 13067 callback(); 13068 }); 13069 } 13070 } 13071 13072 // Handle IE, even up to IE 9. 13073 if (elem.attachEvent) { 13074 attachedMSIE.push({ element: elem, event: 'onpropertychange', method: callback }); 13075 elem.attachEvent('onpropertychange', callback); 13076 } 13077 }; 13078 13079 var displayAttrMatch = new RegExp('^(class|value|className|placeholder|id|style|style\\..*)$'); 13080 13081 // Hooks display changes for an element (placeholder may need to update itself).
13082 var hookDisplayUpdates = function(elem, callback) { 13083 if (elem.addEventListener) { 13084 var domAttrModifiedHook = function(event) { 13085 // Prevents an infinite loop due to bubbling. 13086 event.stopPropagation(); 13087 13088 // Another necessary escape hatch. 13089 if (event.target.className == '_ph_shim') 13090 return; 13091 13092 if (displayAttrMatch.test(event.attrName)) 13093 callback(event.attrName); 13094 }; 13095 13096 attachedSTD.push({ element: elem, event: 'DOMAttrModified', method: domAttrModifiedHook }); 13097 elem.addEventListener('DOMAttrModified', domAttrModifiedHook, false); 13098 } else if (elem.attachEvent) { 13099 var propertyChangeHook = function(event) { 13100 if (displayAttrMatch.test(event.propertyName)) 13101 callback(event.propertyName); 13102 }; 13103 13104 attachedMSIE.push({ element: elem, event: 'onpropertychange', method: propertyChangeHook }); 13105 elem.attachEvent('onpropertychange', propertyChangeHook); 13106 } 13107 }; 13108 13109 // Hooks display changes for an element or its parents. 13110 var hookDisplayUpdatesAndParents = function(elem, callback) { 13111 var node = elem; 13112 13113 while (node && node != document.body) { 13114 hookDisplayUpdates(node, callback); 13115 13116 node = node.parentNode; 13117 } 13118 }; 13119 13120 // Debouncer used to prevent the same placeholder updates from ocuring over and over again within a short time (30 ms). 13121 var debouncer = []; 13122 var isBouncy = function(element) { 13123 var now = function() { 13124 return new Date().getTime(); 13125 }; 13126 var getIndexOf = function(elem) { 13127 for (var i = 0; i < debouncer.length; i++) { 13128 if (debouncer[i].object === element) { 13129 return i; 13130 } 13131 } 13132 return -1; 13133 }; 13134 var index = getIndexOf(element); 13135 if (index === -1) { 13136 var obj = { object: element, recentlyOccured: true }; 13137 debouncer.push(obj); 13138 setTimeout(function () { 13139 obj.recentlyOccured = false; 13140 } 13141 ,30); 13142 return false; 13143 } else if (debouncer[index].recentlyOccured) { 13144 return true; 13145 } else { 13146 debouncer[index].recentlyOccured = true; 13147 setTimeout(function () { 13148 debouncer[index].recentlyOccured = false; 13149 } 13150 , 30); 13151 return false; 13152 } 13153 }; 13154 13155 // Updates position/style of pseudo-element that acts as placeholder message. 13156 // Called when necessary to ensure placeholder looks right (e.g. styles changed). 13157 var updatePlaceHolderMessageElement = function (phElem, elem) { 13158 var $elem = $(elem); 13159 if (isBouncy(elem)) { 13160 return; 13161 } 13162 13163 // TODO: Does $elem.is() not work if the element is not in the document? 13164 if (elem.parentNode != null && !elem._focus && $elem.is(':visible')) 13165 phElem.style.display = (elem.value == '' || elem.value == null ? 'block' : 'none'); 13166 else { 13167 phElem.style.display = 'none'; 13168 return; 13169 } 13170 13171 // Determine where placeholder element should go. 13172 var shouldParent = $elem.offsetParent().get(0); 13173 13174 // Placeholder element cannot go inside table rows, use cell instead. 13175 if (shouldParent.tagName == 'TR') { 13176 shouldParent = elem; 13177 13178 while (shouldParent.tagName != 'TD') 13179 shouldParent = shouldParent.parentNode; 13180 } 13181 13182 var phChanged = (phElem.getAttribute('_ph_val') != getPlaceholder(elem)); 13183 13184 if ((shouldParent != phElem.parentNode) || phChanged) { 13185 // Remove from old parent (or existing, if phChanged). 13186 // Necessary for phChanged since element may be inside a table, 13187 // and trying to set innerHTML in a table with IE causes trouble. 13188 phElem.parentNode.removeChild(phElem); 13189 13190 // If placeholder changed, update innerHTML. 13191 if (phChanged) 13192 $(phElem).text(getPlaceholder(elem)); 13193 13194 // Ensure pseudo-placeholder is placed in same offsetParent 13195 // that element resides within (positioning), and add it to 13196 // the end (resolves some possible z-index issues). 13197 shouldParent.appendChild(phElem); 13198 } 13199 13200 phElem.style.width = elem.clientWidth + 'px'; 13201 phElem.style.height = elem.clientHeight + 'px'; 13202 phElem.style.verticalAlign = elem.style.verticalAlign; 13203 phElem.style.lineHeight = elem.style.lineHeight; 13204 phElem.style.textAlign = elem.style.textAlign; 13205 phElem.style.fontSize = elem.style.fontSize; 13206 phElem.style.fontFamily = elem.style.fontFamily; 13207 13208 var compStyle = (window.getComputedStyle ? window.getComputedStyle(elem, null) : elem.currentStyle); 13209 var elemPaddingLeft = parseInt(compStyle.paddingLeft.replace(/px$/g, ''), 10); 13210 var elemPaddingTop = parseInt(compStyle.paddingTop.replace(/px$/g, ''), 10); 13211 var pos = $elem.position(); 13212 13213 phElem.style.top = (pos.top + elem.clientTop + elemPaddingTop
13213- 2) + 'px'; 13214 phElem.style.left = (pos.left + elem.clientLeft + elemPaddingLeft) + 'px'; 13215 } 13216 13217 // Creates pseudo-element that acts as placeholder message. 13218 var createPlaceHolderMessageElement = function(elem) { 13219 // Create pseudo-placeholder that will appear over the top of the control. 13220 var phElem = document.createElement('div'); 13221 13222 // Attach to element for reference. 13223 elem._ph_shim = phElem; 13224 13225 // Ensure pseudo-placeholder is placed in same offsetParent 13226 // that element resides within (positioning), and add it to 13227 // the end (resolves some possible z-index issues). 13228 var phValue = getPlaceholder(elem); 13229 $(phElem).text(phValue == null ? '' : phValue); 13230 phElem.setAttribute('_ph_val', 'phValue'); 13231 13232 phElem.setAttribute('id', 'ph_' + elem.id); 13233 phElem.setAttribute('name', 'ph_' + elem.id); 13234 13235 var shouldParent = $(elem).offsetParent().get(0); 13236 shouldParent.appendChild(phElem); 13237 13238 // Configure the pseudo-placeholder. 13239 phElem.className = '_ph_shim'; 13240 phElem.style.position = 'absolute'; 13241 phElem.style.color = '#aaa'; // Placeholder Text Color. 13242 phElem.style.backgroundColor = 'transparent'; 13243 phElem.style.cssFloat = 'none'; 13244 13245 // Update appearance. 13246 updatePlaceHolderMessageElement(phElem, elem); 13247 13248 // Set up events for pseudo-placeholder and element. 13249 var $phElem = $(phElem); 13250 13251 var mouseDownHook = function(event) { 13252 phElem.style.display = 'none'; 13253 13254 // Mouse down is passed to the input control 13255 // the placeholder is shown on top of. 13256 $(elem).trigger('mousedown', event); 13257 13258 // Hack: IE needs setTimeout to actually do this properly for TEXTAREA. 13259 setTimeout(function() { 13260 try { 13261 elem.focus() 13262 } catch(err) { 13263 //When the text box is readonly then the above focus code would throw error 13264 //so that error is only handled only for Center, if u happen to get this error please do ur implemntation below 13265 //NOTE: here we have checked only for /formcenter and so if there is any other place which uses readonly textbox and trys to focus also will get the same alert - This is known bug 13266 //for DEtails talk to Akila or Robin - AK 13267 13268 //**Please note the use of lowercase here** 13269 var url = (location.href).toLowerCase(); 13270 13271 if (url.indexOf("/admin/formcenter") > -1) { 13272 alert('You have selected the field input. Please select the field label or instructions.'); 13273 } 13274 } 13275 }, 15); 13276 }; 13277 13278 $phElem.mousedown(mouseDownHook); 13279 13280 attachedJQR.push({ instance: $phElem, event: 'mousedown', method: mouseDownHook }); 13281 13282 return phElem; 13283 }; 13284 13285 // Registers a shim placeholder for an element (private helper method). 13286 var registerPlaceHolder = function (elem) { 13287 // Create jQuery wrapper. 13288 var $elem = $(elem); 13289 13290 // Create placeholder. 13291 var phElem = createPlaceHolderMessageElement(elem); 13292 13293 // Track creation. 13294 spawnedPHs.push(phElem); 13295 13296 var focusHook = function () { 13297 // Older firefox does not support document.activeElement. 13298 elem._focus = true; 13299 13300 phElem.style.display = 'none'; 13301 }; 13302 13303 var blurHook = function () { 13304 // Older firefox does not support document.activeElement. 13305 elem._focus = false; 13306 13307 if ((elem.value == '' || elem.value == null) && $(elem).is(':visible')) 13308 phElem.style.display = 'block'; 13309 }; 13310 13311 $elem.focus(focusHook); 13312 $elem.blur(blurHook); 13313 13314 attachedJQR.push({ instance: $elem, event: 'focus', method: focusHook }); 13315 attachedJQR.push({ instance: $elem, event: 'blur', method: blurHook }); 13316 13317 // Ensure placeholder state is updated when the value 13318 // is changed programmatically. 13319 hookProgrammaticValueChange(elem, function () { 13320 if (elem._focus) 13321 phElem.style.display = 'none'; 13322 else { 13323 if ((elem.value == '' || elem.value == null) && $(elem).is(':visible')) 13324 phElem.style.display = 'block'; 13325 else 13326 phElem.style.display = 'none'; 13327 } 13328 }); 13329 13330 // Ensure placeholder UI updates correctly when display changes are made. 13331 hookDisplayUpdatesAndParents(elem, function () { 13332 updatePlaceHolderMessageElement(phElem, elem); 13333 }); 13334 }; 13335 13336 // Attach shim to each wrapped element passed to the method. 13337 $elemsToHack.each(function () { 13338 registerPlaceHolder(this); 13339 }); 13340 13341 // Keep track of hooks so they can be destroyed. 13342 $elemsToHack.data('cp5ph_hooks', { 13343 ie: attachedMSIE, 13344 std: attachedSTD, 13345 jqr: attachedJQR, 13346 spawns: spawnedPHs 13347 }); 13348} 13349 13350 13351// Unregisters placeholder shim hooks. Destroys event hooks and spawned placeholder element. 13352function unregisterPlaceHoldersShimForEach($elemsToHack) { 13353 // Get hooks. 13354 $elemsToHack.each(function () { 13355 var hookData = $(this).data('cp5ph_hooks'); 13356 13357 if (hookData) { 13358 // Destroy all the hooks present. 13359 var attachedMSIE = hookData.ie == null ? [] : hookData.ie; 13360 var attachedSTD = hookData.std == null ? [] : hookData.std; 13361 var attachedJQR = hookData.jqr == null ? [] : hookData.jqr; 13362 var spawnedPHs = hookData.spawns == null ? [] : hookData.spawns; 13363 13364 // Remove MSIE style events. 13365 for (var i = 0, len = attachedMSIE.length; i < len; i++) { 13366 if (attachedMSIE[i].element) 13367 attachedMSIE[i].element.detachEvent(attachedMSIE[i].event, attachedMSIE[i].method); 13368 } 13369 13370 // Remove DOM standard (STD) events. 13371 for (var i = 0, len = attachedSTD.length; i < len; i++) { 13372 if (attachedSTD[i].element) 13373 attachedSTD[i].element.removeEventListener(attachedSTD[i].event, attachedSTD[i].method, false); 13374 } 13375 13376 // Remove jQuery bindings. 13377 for (var i = 0, len = attachedJQR.length; i < len; i++) { 13378 if (attachedJQR[i].instance) 13379 attachedJQR[i].instance.unbind(attachedJQR[i].event, attachedJQR[i].method); 13380 } 13381 13382 // Destroy placeholder spawned elements. 13383 for (var i = 0, len = spawnedPHs.length; i < len; i++) { 13384 if (spawnedPHs[i]) { 13385 spawnedPHs[i].innerHTML = ""; 13386 spawnedPHs[i].style.display = "none"; 13387 13388 if (spawnedPHs[i].parentNode) 13389 spawnedPHs[i].parentNode.removeChild(spawnedPHs[i]); 13390 } 13391 } 13392 13393 // Destroy hook data now that hooks have been cleaned. 13394 $(this).removeData('cp5ph_hooks'); 13395 } 13396 }); 13397} 13398 13399// Registers placeholder shims for jQuery element group specified. 13400// The shim is by no means perfect (won't catch things like attribute selectors causing changes). 13401function registerPlaceHoldersShimForEach($elemsToHack) { 13402 // Track standard, MSIE, and jQuery event assignments so they can be cancelled/destroyed. 13403 // Also track any spawned placeholder elements since they too need to be cleaned up. 13404 var attachedMSIE = []; 13405 var attachedSTD = []; 13406 var attachedJQR = []; 13407 var spawnedPHs = []; 13408 13409 // Hooks programmatic changes to the value property for browsers without 13410 // placeholder support. jQuery did not seem to have a way to do this. 13411 var hookProgrammaticValueChange = function (elem, callback) { 13412 // Note: Browsers are buggy at this time with DOMControlValueChanged. 13413 13414 // Handle Firefox Prior to 4 (which has built-in placeholder support). 13415 if (elem.__defineSetter__) { 13416 var oldSetter = elem.__lookupSetter__('value'); 13417 13418 if (oldSetter) { 13419 elem.__defineSetter__('value', function (v) { 13420 oldSetter.call(elem, v); 13421 callback(); 13422 }); 13423 } 13424 } 13425 13426 // Handle IE, even up to IE 9. 13427 if (elem.attachEvent) { 13428 attachedMSIE.push({ element: elem, event: 'onpropertychange', method: callback }); 13429 elem.attachEvent('onpropertychange', callback); 13430 } 13431 }; 13432 13433 var displayAttrMatch = new RegExp('^(class|value|className|placeholder|id|style|style\\..*)$'); 13434 13435 // Hooks display changes for an element (placeholder may need to update itself).
13436 var hookDisplayUpdates = function (elem, callback) { 13437 if (elem.addEventListener) { 13438 var domAttrModifiedHook = function (event) { 13439 // Prevents an infinite loop due to bubbling. 13440 event.stopPropagation(); 13441 13442 // Another necessary escape hatch. 13443 if (event.target.className == '_ph_shim') 13444 return; 13445 13446 if (displayAttrMatch.test(event.attrName)) 13447 callback(event.attrName); 13448 }; 13449 13450 attachedSTD.push({ element: elem, event: 'DOMAttrModified', method: domAttrModifiedHook }); 13451 elem.addEventListener('DOMAttrModified', domAttrModifiedHook, false); 13452 } 13453 else if (elem.attachEvent) { 13454 var propertyChangeHook = function (event) { 13455 if (displayAttrMatch.test(event.propertyName)) 13456 callback(event.propertyName); 13457 }; 13458 13459 attachedMSIE.push({ element: elem, event: 'onpropertychange', method: propertyChangeHook }); 13460 elem.attachEvent('onpropertychange', propertyChangeHook); 13461 } 13462 }; 13463 13464 // Hooks display changes for an element or its parents. 13465 var hookDisplayUpdatesAndParents = function (elem, callback) { 13466 var node = elem; 13467 13468 while (node && node != document.body) { 13469 hookDisplayUpdates(node, callback); 13470 13471 node = node.parentNode; 13472 } 13473 }; 13474 13475 // Updates position/style of pseudo-element that acts as placeholder message. 13476 // Called when necessary to ensure placeholder looks right (e.g. styles changed). 13477 var updatePlaceHolderMessageElement = function (phElem, elem) { 13478 var $elem = $(elem); 13479 13480 // TODO: Does $elem.is() not work if the element is not in the document? 13481 if (elem.parentNode != null && !elem._focus && $elem.is(':visible')) 13482 phElem.style.display = (elem.value == '' || elem.value == null ? 'block' : 'none'); 13483 else { 13484 phElem.style.display = 'none'; 13485 return; 13486 } 13487 13488 // Determine where placeholder element should go. 13489 var shouldParent = $elem.offsetParent().get(0); 13490 13491 // Placeholder element cannot go inside table rows, use cell instead. 13492 if (shouldParent.tagName == 'TR') { 13493 shouldParent = elem; 13494 13495 while (shouldParent.tagName != 'TD') 13496 shouldParent = shouldParent.parentNode; 13497 } 13498 13499 var phChanged = (phElem.getAttribute('_ph_val') != getPlaceholder(elem)); 13500 13501 if ((shouldParent != phElem.parentNode) || phChanged) { 13502 // Remove from old parent (or existing, if phChanged). 13503 // Necessary for phChanged since element may be inside a table, 13504 // and trying to set innerHTML in a table with IE causes trouble. 13505 phElem.parentNode.removeChild(phElem); 13506 13507 // If placeholder changed, update innerHTML. 13508 if (phChanged) 13509 $(phElem).text(getPlaceholder(elem)); 13510 13511 // Ensure pseudo-placeholder is placed in same offsetParent 13512 // that element resides within (positioning), and add it to 13513 // the end (resolves some possible z-index issues). 13514 shouldParent.appendChild(phElem); 13515 } 13516 13517 phElem.style.width = elem.clientWidth + 'px'; 13518 phElem.style.height = elem.clientHeight + 'px'; 13519 phElem.style.verticalAlign = elem.style.verticalAlign; 13520 phElem.style.lineHeight = elem.style.lineHeight; 13521 phElem.style.textAlign = elem.style.textAlign; 13522 phElem.style.fontSize = elem.style.fontSize; 13523 phElem.style.fontFamily = elem.style.fontFamily; 13524 13525 var compStyle = (window.getComputedStyle ? window.getComputedStyle(elem, null) : elem.currentStyle); 13526 var elemPaddingLeft = parseInt(compStyle.paddingLeft.replace(/px$/g, ''), 10); 13527 var elemPaddingTop = parseInt(compStyle.paddingTop.replace(/px$/g, ''), 10); 13528 var pos = $elem.position(); 13529 13530 phElem.style.top = (pos.top + elem.clientTop + elemPaddingTop - 2) + 'px'; 13531 phElem.style.left = (pos.left + elem.clientLeft + elemPaddingLeft) + 'px'; 13532 } 13533 13534 // Creates pseudo-element that acts as placeholder message. 13535 var createPlaceHolderMessageElement = function (elem) { 13536 // Create pseudo-placeholder that will appear over the top of the control. 13537 var phElem = document.createElement('div'); 13538 13539 // Attach to element for reference. 13540 elem._ph_shim = phElem; 13541 13542 // Ensure pseudo-placeholder is placed in same offsetParent 13543 // that element resides within (positioning), and add it to 13544 // the end (resolves some possible z-index issues). 13545 var phValue = getPlaceholder(elem); 13546 $(phElem).text(phValue == null ? '' : phValue); 13547 phElem.setAttribute('_ph_val', 'phValue'); 13548 13549 phElem.setAttribute('id', 'ph_' + elem.id); 13550 phElem.setAttribute('name', 'ph_' + elem.id); 13551 13552 var shouldParent = $(elem).offsetParent().get(0); 13553 shouldParent.appendChild(phElem); 13554 13555 // Configure the pseudo-placeholder. 13556 phElem.className = '_ph_shim'; 13557 phElem.style.position = 'absolute'; 13558 phElem.style.color = '#aaa'; // Placeholder Text Color. 13559 phElem.style.backgroundColor = 'transparent'; 13560 phElem.style.cssFloat = 'none'; 13561 13562 // Update appearance. 13563 updatePlaceHolderMessageElement(phElem, elem); 13564 13565 // Set up events for pseudo-placeholder and element. 13566 var $phElem = $(phElem); 13567 13568 var mouseDownHook = function (event) { 13569 phElem.style.display = 'none'; 13570 13571 // Mouse down is passed to the input control 13572 // the placeholder is shown on top of. 13573 $(elem).trigger('mousedown', event); 13574 13575 // Hack: IE needs setTimeout to actually do this properly for TEXTAREA. 13576 setTimeout(function () { 13577 try { elem.focus() } catch (err) { 13578 //When the text box is readonly then the above focus code would throw error 13579 //so that error is only handled only for Center, if u happen to get this error please do ur implemntation below 13580 //NOTE: here we have checked only for /formcenter and so if there is any other place which uses readonly textbox and trys to focus also will get the same alert - This is known bug 13581 //for DEtails talk to Akila or Robin - AK 13582 13583 //**Please note the use of lowercase here** 13584 var url = (location.href).toLowerCase(); 13585 13586 if (url.indexOf("/admin/formcenter") > -1) { 13587 alert('You have selected the field input. Please select the field label or instructions.'); 13588 } 13589 } 13590 }, 15); 13591 }; 13592 13593 $phElem.mousedown(mouseDownHook); 13594 13595 attachedJQR.push({ instance: $phElem, event: 'mousedown', method: mouseDownHook }); 13596 13597 return phElem; 13598 } 13599 13600 // Registers a shim placeholder for an element (private helper method). 13601 var registerPlaceHolder = function (elem) { 13602 // Create jQuery wrapper. 13603 var $elem = $(elem); 13604 13605 // Create placeholder. 13606 var phElem = createPlaceHolderMessageElement(elem); 13607 13608 // Track creation. 13609 spawnedPHs.push(phElem); 13610 13611 var focusHook = function () { 13612 // Older firefox does not support document.activeElement. 13613 elem._focus = true; 13614 13615 phElem.style.display = 'none'; 13616 }; 13617 13618 var blurHook = function () { 13619 // Older firefox does not support document.activeElement. 13620 elem._focus = false; 13621 13622 if ((elem.value == '' || elem.value == null) && $(elem).is(':visible')) 13623 phElem.style.display = 'block'; 13624 }; 13625 13626 $elem.focus(focusHook); 13627 $elem.blur(blurHook);
13628 13629 attachedJQR.push({ instance: $elem, event: 'focus', method: focusHook }); 13630 attachedJQR.push({ instance: $elem, event: 'blur', method: blurHook }); 13631 13632 // Ensure placeholder state is updated when the value 13633 // is changed programmatically. 13634 hookProgrammaticValueChange(elem, function () { 13635 if (elem._focus) 13636 phElem.style.display = 'none'; 13637 else { 13638 if ((elem.value == '' || elem.value == null) && $(elem).is(':visible')) 13639 phElem.style.display = 'block'; 13640 else 13641 phElem.style.display = 'none'; 13642 } 13643 }); 13644 13645 // Ensure placeholder UI updates correctly when display changes are made. 13646 hookDisplayUpdatesAndParents(elem, function () { 13647 updatePlaceHolderMessageElement(phElem, elem); 13648 }); 13649 }; 13650 13651 // Attach shim to each wrapped element passed to the method. 13652 $elemsToHack.each(function () { 13653 registerPlaceHolder(this); 13654 }); 13655 13656 // Keep track of hooks so they can be destroyed. 13657 $elemsToHack.each(function() { 13658 $(this).data('cp5ph_hooks', { 13659 ie: attachedMSIE, 13660 std: attachedSTD, 13661 jqr: attachedJQR, 13662 spawns: spawnedPHs 13663 }); 13664 }); 13665} 13666; 13667
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.