1 2// Used by dynamic javascript to set the dom events. 3 4/*----------------------------------------------------DOM Event Handlers-------------------------------------------------------------*/ 5 6var DOMEventArray = null; 7 8(function (window, document, $) { 9 10 11 $(document).ready(function () { 12 if ($('#invokeClearJwtMemory').length) { 13 try { 14 window.localStorage.removeItem('[auth-storage].jwt'); 15 window.localStorage.removeItem('[auth-storage].user'); 16 window.localStorage.removeItem('[auth-storage].keepMeLoggedIn'); 17 } catch (e) { 18 } 19 } 20 }); 21 22 23 window.rsBaseScripts = window.rsBaseScripts || {}; 24 25 var $document = $(document); 26 27 var rsBaseScripts = window.rsBaseScripts; 28 29 var fadeInJq = rsBaseScripts.fadeInJq = function (jQ, time) { 30 $(jQ).attr('aria-hidden', false).fadeIn(time); 31 }; 32 var fadeOutJq = rsBaseScripts.fadeOutJq = function (jQ, time) { 33 $(jQ).attr('aria-hidden', true).fadeOut(time); 34 }; 35 var hideJq = rsBaseScripts.hideJq = rsBaseScripts.hide = function (jQ) { 36 $(jQ).attr('aria-hidden', true).hide(); 37 } 38 var showJq = rsBaseScripts.showJq = rsBaseScripts.show = function (jQ) { 39 $(jQ).attr('aria-hidden', false).show(); 40 } 41 42 43 44 45 var trappedFocusSelector = null; 46 var trappedFocus = null; 47 var trappedFocusTarget = null 48 49 var trappedFocusHandler = { 50 handleEvent: function (ev) { 51 var closestTarget = $(ev.target).closest(trappedFocus) 52 53 if (!closestTarget.length) { 54 ev.stopPropagation(); 55 trappedFocusTarget.focus(); 56 } 57 } 58 }; 59 60 /** 61 * Trap the focus on a given target. If the user attempts to focus on 62 * @param jQ The JQuery selector which will hold the trapped focus 63 * @param eventFocusTarget A selector for the element which will recieve focus when the focus leaves the trapped focus element. 64 */ 65 rsBaseScripts.trapFocusOn = function trapFocusOn(jQ, eventFocusTarget) { 66 trappedFocusSelector = jQ; 67 trappedFocus = $(jQ)[0]; 68 if (!eventFocusTarget) { eventFocusTarget = jQ }; 69 trappedFocusTarget = $(eventFocusTarget); 70 document.body.addEventListener('focusin', trappedFocusHandler) 71 }; 72 rsBaseScripts.stopTrappingFocus = function stopTrappingFocus(jQ) { 73 if (!jQ) { 74 jQ = trappedFocusSelector; 75 } 76 if (trappedFocusSelector === jQ) { 77 trappedFocusSelector = null; 78 trappedFocus = null; 79 trappedFocusTarget = null; 80 document.body.removeEventListener('focusin', trappedFocusHandler); 81 } 82 }; 83 84 85 86 87 88 89 var popupOverlay = rsBaseScripts.popupOverlay = {}; 90 var popupContainer = rsBaseScripts.popupContainer = {}; 91 var popupBox = rsBaseScripts.popupBox = {}; 92 var popupBoxCs = rsBaseScripts.popupBoxCs = {}; 93 94 /** 95 * The "PopUpOverlay" is an abstraction for the "#PopUpOverlay" element. 96 */ 97 popupOverlay.fadeIn = function (time) { 98 fadeInJq("#PopUpOverlay", time); 99 var $PopupOverlay = $(); 100 $PopupOverlay.fadeIn(time, function () { 101 $PopupOverlay.attr('aria-hidden', false); 102 }); 103 } 104 popupOverlay.fadeOut = function (time) { 105 fadeOutJq("#PopUpOverlay", time); 106 } 107 popupOverlay.hide = function () { 108 hideJq("#PopUpOverlay"); 109 } 110 popupOverlay.show = function () { 111 showJq("#PopUpOverlay"); 112 } 113 114 115 popupContainer.fadeIn = function (time) { 116 fadeInJq("#PopUpContainer", time); 117 popupOverlay.fadeIn(time); 118 } 119 popupContainer.fadeOut = function (time) { 120 fadeOutJq("#PopUpContainer", time); 121 popupOverlay.fadeOut(time); 122 } 123 popupContainer.hide = function () { 124 hideJq("#PopUpContainer"); 125 popupOverlay.hide(); 126 } 127 popupContainer.show = function () { 128 showJq("#PopUpContainer"); 129 popupOverlay.show(); 130 } 131 132 popupBox.verticallyCenter = function () { 133 var height = $(window).height(); 134 var div = $("#PopUpBox"); 135 var divHeight = div.outerHeight(); 136 var halfDiv; 137 var margin; 138 var setMargin; 139 140 halfDiv = (divHeight / 2); 141 margin = (height / 2) - 100 - halfDiv; 142 $(div).css('marginTop', margin + "px"); 143 // Set Title to Vertical Dimension (for debugging only): $("#PopUpTitle").html(halfDiv + " " + margin); 144 } 145 popupBox.fadeIn = function (time) { 146 popupBox.verticallyCenter(); 147 fadeInJq("#PopUpBox", time); 148 popupContainer.fadeIn(time); 149 $("#PopUpBox").draggable({ handle: '#PopUpIcon' }); 150 } 151 popupBox.fadeOut = function (time) { 152 fadeOutJq("#PopUpBox", time); 153 popupContainer.fadeOut(time); 154 } 155 popupBox.hide = function () { 156 hideJq("#PopUpBox"); 157 popupContainer.hide(); 158 } 159 popupBox.show = function () { 160 showJq("#PopUpBox"); 161 popupContainer.show(); 162 } 163 164 165 popupBoxCs.fadeIn = function (time) { 166 fadeInJq("#PopUpBoxCS", time); 167 popupContainer.fadeIn(time); 168 $("#PopUpBoxCS").draggable({ handle: '#PopUpIconCS' });
169 } 170 popupBoxCs.fadeOut = function (time) { 171 fadeOutJq("#PopUpBoxCS", time); 172 popupContainer.fadeOut(time); 173 } 174 popupBoxCs.hide = function () { 175 hideJq("#PopUpBoxCS"); 176 popupContainer.hide(); 177 } 178 popupBoxCs.show = function () { 179 showJq("#PopUpBoxCS"); 180 popupContainer.show(); 181 } 182})(window, document, jQuery); 183 184 185// ===================================================================================================================================== 186 187// The commented out function was written by Bryan and pasted here by Cole. It simly throws an error stating that "PaperEmphasisHelper" 188// hasn't been initialized. The two functions beneath seem to work properly but may not be set up the way you want. 189 190//(function (PaperEmphasisHelper) { 191 192// /** 193// * Add an emphasis to the element 194// */ 195// PaperEmphasisHelper.addEmphasis = function ($element) { 196 197// $element.addClass('paper-emphasis-relative'); 198// $element.append('<div class = "paper-emphasis-linearProgress"></div>'); 199 200// }; 201// /** 202// * Remove an emphasis from the element 203// */ 204// PaperEmphasisHelper.PaperEmphasisHelper.removeEmphasis = function ($element) { 205// $element.removeClass('paper-emphasis-relative'); 206// $element.find('paper-emphasis-linearProgress').remove(); 207// }; 208 209//})(PaperEmphasisHelper || (PaperEmphasisHelper = {})); 210 211function addEmphasis($element) { 212 $element.addClass('paper-emphasis-relative'); 213 $element.append('<div class = "paper-emphasis-linearProgress"></div>'); 214} 215 216function removeEmphasis($element) { 217 $element.removeClass('paper-emphasis-relative'); 218 $(document).removeClass('paper-emphasis-linearProgress'); 219} 220 221function emphasizeActivate($element) { 222 $element.addClass("is-active"); 223} 224 225function emphasizeDeactivate() { 226 $("div").removeClass("is-active"); 227} 228 229// ===================================================================================================================================== 230 231 232 233function setDOMEvent(objectToBindEvent, eventNameAsString, handlerAsFunction, bubbleAsOptionalBoolean) { 234 try { 235 bubbleAsOptionalBoolean = (bubbleAsOptionalBoolean) ? bubbleAsOptionalBoolean : false; 236 237 if (window.attachEvent) {//IE 238 objectToBindEvent.attachEvent('on' + eventNameAsString, handlerAsFunction); 239 } 240 else {//-moz-webkit-etc.. 241 objectToBindEvent.addEventListener(eventNameAsString, handlerAsFunction, bubbleAsOptionalBoolean); 242 } 243 } 244 catch (e) { 245 alert('you have encountered error from setDOMEvent: ' + e.Description); 246 } 247} 248 249 250function removeDOMEvent(objectToUnbindEvent, eventNameAsString, handlerAsFunction, bubbleAsOptionalBoolean) { 251 try { 252 bubbleAsOptionalBoolean = (bubbleAsOptionalBoolean) ? bubbleAsOptionalBoolean : false; 253 254 if (window.attachEvent) {//IE 255 objectToUnbindEvent.detachEvent('on' + eventNameAsString, handlerAsFunction); 256 } 257 else {//-moz-webkit-etc.. 258 objectToUnbindEvent.removeEventListener(eventNameAsString, handlerAsFunction, bubbleAsOptionalBoolean); 259 } 260 } 261 catch (e) { 262 alert('you have encountered error: ' + e.Description); 263 } 264} 265 266/*----------------------------------------------------------------------------------------------------------------------------------*/ 267 268/* Add a format function to Date */ 269Date.prototype.format = function (format) //author: meizz 270{ 271 var o = { 272 "M+": this.getMonth() + 1, //month 273 "d+": this.getDate(), //day 274 "h+": this.getHours(), //hour 275 "m+": this.getMinutes(), //minute 276 "s+": this.getSeconds(), //second 277 "q+": Math.floor((this.getMonth() + 3) / 3), //quarter 278 "S": this.getMilliseconds() //millisecond 279 }; 280 281 if (/(y+)/.test(format)) { 282 format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length)); 283 } 284 for (var k in o) { 285 if (new RegExp("(" + k + ")").test(format)) { 286 format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length)); 287 } 288 } 289 return format; 290} 291 292 293/*** Handle jQuery plugin naming conflict between jQuery UI and Bootstrap ***/ 294if ($.widget) { 295 $.widget.bridge('uibutton', $.ui.button); 296 $.widget.bridge('uitooltip', $.ui.tooltip); 297} 298 299var translator = false; 300 301 302 303function translate(string, vars) { 304 305 306 vars = vars || false; 307 308 if (!translator) { 309 try { 310 var selectorId = $('#translationTableJsonClientIdData').html(); 311 312 if (selectorId) { 313 var fullSelector = '#' + selectorId; 314 if (document.querySelector(fullSelector)) { 315 translator = new Translator(fullSelector); 316 } 317 } 318 } catch (e) { 319 320 } 321 } 322 if (translator) {
323 string = translator.translate(string); 324 } 325 326 if (vars) { 327 $.each(vars, function (key, value) { 328 string = string.replace(key, value); 329 }); 330 } 331 return string; 332} 333 334// Keep this in here. It's very important as the CDN fallback expression relies on it. 335(function (window) { 336 window['rideSharkBaseScriptsLoaded'] = true; 337})(window); 338 339if (!(window.console && console.log && console.time && console.timeEnd)) { 340 console = { 341 log: function () { }, 342 debug: function () { }, 343 info: function () { }, 344 warn: function () { }, 345 error: function () { }, 346 time: function () { } 347 }; 348} 349 350 351// implement JSON.stringify serialization 352JSON.stringify = JSON.stringify || function (obj) { 353 var t = typeof (obj); 354 if (t != "object" || obj === null) { 355 // simple data type 356 if (t == "string") obj = '"' + obj + '"'; 357 return String(obj); 358 } 359 else { 360 // recurse array or object 361 var n, v, json = [], arr = (obj && obj.constructor == Array); 362 for (n in obj) { 363 v = obj[n]; t = typeof (v); 364 if (t == "string") v = '"' + v + '"'; 365 else if (t == "object" && v !== null) v = JSON.stringify(v); 366 json.push((arr ? "" : '"' + n + '":') + String(v)); 367 } 368 return (arr ? "[" : "{") + String(json) + (arr ? "]" : "}"); 369 } 370}; 371 372var regexs = {}; 373 374regexs.HTMLEntities = { 375 nbsp: / /gi, 376 amp: /&/gi 377}; 378 379var regexsReplacements = {}; 380 381regexsReplacements.HTMLEntities = { 382 nbsp: ' ', 383 amp: '&' 384}; 385 386function correctUnicode(text) { 387 388 text = text.replace(/\\u[\dABCDEFabcdef][\dABCDEFabcdef][\dABCDEFabcdef][\dABCDEFabcdef]/g, function (match) { 389 return String.fromCharCode(parseInt(match.replace(/\\u/g, ''), 16)); 390 }); 391 try { 392 return decodeURI(text); 393 } catch (e) { 394 return text; 395 } 396} 397 398function correctHTMLEntities(text) { 399 var i; 400 for (i in regexs.HTMLEntities) { 401 text = text.replace(regexs.HTMLEntities[i], regexsReplacements.HTMLEntities[i]); 402 } 403 return text; 404}; 405 406function correntHTMLInput(text) { 407 return correctHTMLEntities(correctUnicode(text)); 408} 409 410// **** Start - Brian's Edit - Sept-9-13 411function toggleSpinnerOverlay(state) { 412 if (state) { 413 var overlay = $('<div id="updateProgressOverlay"></div>'); 414 if ($("#updateProgressOverlay").length <= 0) { 415 overlay.prependTo($("body")); 416 } 417 } else { 418 $("#updateProgressOverlay").remove(); 419 } 420} 421 422 423 424//Get variables from URL returned as an object. 425function mapWindowURL() { 426 var pairs = window.location.search.slice(1).split('&'); 427 428 var result = {}; 429 $.each(pairs, function (index, pair) { 430 pair = pair.split('='); 431 result[pair[0]] = decodeURIComponent(pair[1] || ''); 432 }); 433 434 return result; 435} 436// **** End - Brian's Edit - Sept-9-13 437 438 439function addLoadEvent(func) { 440 var oldonload = window.onload; 441 if (typeof window.onload != 'function') { 442 window.onload = func; 443 } else { 444 window.onload = function () { 445 oldonload(); 446 func(); 447 } 448 } 449} 450 451 452function DismissIeWarningNotificationDiv() { 453 454 function ajaxGood(a, b, c) { 455 toggleSpinnerOverlay(false); 456 $(".IeWarningNotificationDiv").css({ 'display': 'none' }); 457 } 458 459 function ajaxBad(a, b, c) { 460 toggleSpinnerOverlay(false); 461 var myPopUpMessageTitle = translate("Unable to close notification"); 462 var myPopUpMessage = translate("Unable to close notification"); 463 DisplayAlertStylePopUpMessage(myPopUpMessageTitle, myPopUpMessage, 'error.png', translate('OK')); 464 } 465 466 toggleSpinnerOverlay(true); 467 $.ajax({
468 url: "../PublicAjax/GeneralAjax.aspx", 469 type: "POST", 470 dataType: 'html', 471 data: { "action": "CloseIeWarningNotificationDiv" }, 472 success: ajaxGood, 473 error: ajaxBad 474 }); 475} 476 477 478 479function hideDiv(myControlID) { 480 if (document.getElementById) { 481 482 // Check that what was passed was actually the object ID rather than the actual object. This will handle the ability to pass both the object, as well as the ID, which avoid issues 483 if (typeof (myControlID) == "string") { 484 myDiv = document.getElementById(myControlID) 485 } else if (typeof (myControlID) == "object") { 486 myDiv = myControlID 487 } 488 489 if (myDiv) { 490 myDiv.style.display = "none"; 491 var myDivDisplay = document.getElementById(myDiv + "_Display") 492 if (myDivDisplay) { 493 myDivDisplay.value = "none" 494 } 495 } 496 } 497} 498 499function showDiv(myControlID) { 500 if (document.getElementById) { 501 502 // Check that what was passed was actually the object ID rather than the actual object. This will handle the ability to pass both the object, as well as the ID, which avoid issues 503 if (typeof (myControlID) == "string") { 504 myDiv = document.getElementById(myControlID) 505 } else if (typeof (myControlID) == "object") { 506 myDiv = myControlID 507 } 508 509 if (myDiv) { 510 if (myDiv.id.toLowerCase().indexOf("row") > -1) { 511 try { 512 myDiv.style.display = "table-row"; 513 } catch (e) { 514 myDiv.style.display = "block"; 515 }; 516 } else if (myDiv.id.toLowerCase().indexOf("cell") > -1) { 517 try { 518 myDiv.style.display = "table-cell"; 519 } catch (e) { 520 myDiv.style.display = "block"; 521 }; 522 } else { 523 myDiv.style.display = "block"; 524 var myDivDisplay = document.getElementById(myDiv + "_Display") 525 if (myDivDisplay) { 526 myDivDisplay.value = "block" 527 } 528 } 529 } 530 } 531} 532 533 534 535 536 537 538//Use the hide and show functions when you want to hide object (ie labels, dropdowns, etc) which are inside of a TableCell 539function hide(myControlID) { 540 541 if (document.getElementById) { 542 var myDiv = document.getElementById(myControlID) 543 if (!myDiv) { 544 myDiv = document.getElementById(myControlID.id) 545 } 546 547 if (myDiv) { 548 myDiv.style.visibility = "hidden"; 549 } 550 } 551} 552 553 554function show(myControlID) { 555 556 if (document.getElementById) { 557 var myDiv = document.getElementById(myControlID) 558 if (!myDiv) { 559 myDiv = document.getElementById(myControlID.id) 560 } 561 562 if (myDiv) { 563 myDiv.style.visibility = "visible"; 564 } 565 } 566} 567 568 569 570function showCell(myControlID) { 571 572 if (document.getElementById) { 573 var myDiv = document.getElementById(myControlID) 574 if (!myDiv) { 575 myDiv = document.getElementById(myControlID.id) 576 } 577 578 if (myDiv) { 579 if (myControlID.toLowerCase().indexOf("cell")) { 580 try { 581 myDiv.style.display = "table-cell"; 582 } catch (e) { 583 myDiv.style.display = "block"; 584 }; 585 } 586 } 587 } 588} 589 590 591function hideCell(myControlID) { 592 hideDiv(myControlID) 593} 594 595 596 597/// append string object with new escape special chars function 598String.prototype.escapeSpecialChars = function () { 599 return this.replace(/[\\]/g, '\\\\') 600 .replace(/[\"]/g, '\\\"') 601 .replace(/[\/]/g, '\\/') 602 .replace(/[\b]/g, '\\b') 603 .replace(/[\f]/g, '\\f') 604 .replace(/[\n]/g, '\\n') 605 .replace(/[\r]/g, '\\r') 606 .replace(/[\t]/g, '\\t'); 607}; 608 609function secondsToTime(secs) { 610 var hours = Math.floor(secs / (60 * 60)); 611 612 var divisor_for_minutes = secs % (60 * 60); 613 var minutes = Math.floor(divisor_for_minutes / 60); 614 615 var divisor_for_seconds = divisor_for_minutes % 60; 616 var seconds = Math.ceil(divisor_for_seconds); 617 618 var obj = { 619 h: hours, 620 m: minutes, 621 s: seconds, 622 toString: function () { return hours + ":" + minutes + ":" + seconds } 623 }; 624 return obj;
625} 626 627 628//********* Start - Admin Select CSS Dropdown 629 630function OnAdminCSSSelectionChange() { 631 var myTarget = "ChangeAdminCustomSubSite" 632 var myArgVal = $("#AdminCSSSelectionChange").val() 633 634 console.log(myTarget); 635 console.log(myArgVal); 636 637 __doPostBack(myTarget, myArgVal) 638} 639 640//********* End - Admin Select CSS Dropdown 641 642 643//////////////////////// Replaced Select Boxes ///////////////////////// 644 645// Initialize Replaced Select Boxes 646function initReplacedSelectBoxes(scope) { 647 var $document = $(document); 648 var scope = scope || $('body'); 649 650 // gets all replaceableSelectElements that havent already been wrapped 651 // within the specified scope element and then wraps them 652 var replaceableSelectElements = scope.find(".ReplaceableSelectElement:not(.isWrapped)") 653 replaceableSelectElements.wrap($('<div class="ReplacedSelectElement" />')); 654 replaceableSelectElements.addClass("isWrapped"); 655 656 // gets the now wrapped elements so we can loop through them... and then loops through them 657 var c = replaceableSelectElements.closest(".ReplacedSelectElement"); 658 c.each(function (i, el) { 659 660 var $el = $(el);
661 var valueContainer = $('<div class="SelectedOptionValue" ></div>'); 662 var optContainer = $('<div class="ReplacedOptions top" />'); 663 664 $el.append(valueContainer); 665 $el.append(optContainer); 666 667 // loops through the options found to create their div counterparts 668 $el.find("option").each(function (i, el) { 669 // console.log(el,i); 670 var replacedOpt = $('<div class="ReplacedOption ' + el.className + '" value="' + el.value + '">' + el.innerHTML + '</div>') 671 $(optContainer).append(replacedOpt); 672 replacedOpt.on("click", function () { 673 ReplacedSelectBoxSetValue($el, el.value); 674 }); 675 if (el.selected) { 676 valueContainer.html($(el).html()).attr("value", el.value); 677 } 678 }); 679 // end option loop 680 681 // adds a click event listener to this replaced select elements for user interaction 682 $el.on("click", function (ev) { 683 var p = $(this); 684 if (p.hasClass("SelectBoxOPEN")) { 685 p.removeClass("SelectBoxOPEN"); 686 optContainer.slideUp(250); 687 } else { 688 //if element position in window is greater than half vertical height of window 689 if (p.offset().top - $(window).scrollTop() > ($(window).height() / 2)) { 690 optContainer.removeClass("bottom"); 691 optContainer.addClass("top"); 692 } else { 693 optContainer.removeClass("top"); 694 optContainer.addClass("bottom"); 695 } 696 p.addClass("SelectBoxOPEN"); 697 optContainer.slideDown(250); 698 return false; 699 } 700 }); 701 // end replaced element click event 702 703 }); 704 // end loop of wrapped elements 705 706 707 // removes any previously added document listeners for this 708 $document.off("click.closeReplaceSelectElement") 709 710 // adds a document click listener with a namespace - used to close open select boxes that are open by clicking outside of them 711 $document.on("click.closeReplaceSelectElement", function (ev) { 712 $(".ReplacedSelectElement").removeClass("SelectBoxOPEN"); 713 $(".ReplacedOptions").slideUp(250); 714 }); 715 716} // end initReplacedSelectBoxes 717 718 719 720 721 722// c = container, value is the value passed 723function ReplacedSelectBoxSetValue(c, value) { 724 $(c).find("option").removeAttr("selected"); 725 var opt = $(c).find("option[value='" + value + "']"); 726 var d = $(c).find(".SelectedOptionValue"); 727 opt.attr("selected", true); 728 d.html($(opt).html()); 729 d.attr("value", $(opt).attr("value")); 730 731 return opt.length > 0; 732} //end ReplacedSelectBoxSetValue function 733 734 735
736//////////////////////// Pop Up Messages ///////////////////////// 737 738//MessageType (error.png(red), warning.png(yellow), check.png(green), info.png(blue) 739//MessageText "Custom Message Text" 740//ConfirmButtonText (Confirm/Cancel) or OK) 741//ConfirmButtonLink (Confirm has POstback, Cancel and OK are "#" 742//CancelButtonText (Confirm/Cancel or OK) 743 744 745//////////// CLIENT SIDE POP UP MESSAGES //////////////////////////// 746 747//function letsSeeIfThisWorks(r) { 748// alert(r); 749//} 750 751//$(document).ready(function () { 752// $(".ContentViewerContainer").click(function (ev) { 753// CustomTextPrompt("Test", "Testing message.", letsSeeIfThisWorks); 754// }); 755//}); 756 757// scrolls the page to allow user to see the full pop-up if it is cut off. 758function scrollPageTo(caller) { 759 var t = caller.offset().top; //top 760 var h = caller.height(); //height 761 var b = t + h; //bottom 762 var pT = $(window).scrollTop(); //page top 763 var pH = $(window).height(); //page height 764 var pB = pT + pH; //page bottom 765 ////////console.log(t+" "+h+" "+b); 766 ////////console.log(pT+" "+pH+" "+pB); 767 if ((b > pB) || (t < pT)) { 768 $('body,html').animate({ scrollTop: t - 10 }, 500); 769 } 770} 771 772/// icon can be: check, error, info, warning 773function alertUser(title, msg, icon) { 774 // icon can be: check, error, info, warning 775 if (icon == null | icon == "") { icon = "info" } 776 777 $("#PopUpMessageTitleCS").html(title); 778 $("#PopUpMessageCS").html(msg); 779 $("#PopUpIconCS").css({ "background": "url(../Images/lightbox/" + icon + ".png) no-repeat" }); 780 781 $("#PopUpOKCS").show(); 782 $("#PopUpConfirmCS").hide(); 783 $("#PopUpCancelCS").hide(); 784 785 $("#PopUpOKCS").on("click", function (ev) { 786 ev.preventDefault(); 787 // callback(true); 788 closePopUp(); 789 }); 790 791 rsBaseScripts.popupBoxCs.fadeIn(100); 792} 793 794function confirmAction(title, msg, callback) { 795 796 $("#PopUpMessageTitleCS").html(title); 797 $("#PopUpMessageCS").html(msg); 798 $("#PopUpIconCS").css({ "background": "url(../Images/lightbox/warning.png) no-repeat" }); 799 800 $("#PopUpOKCS").hide(); 801 $("#PopUpConfirmCS").show(); 802 $("#PopUpCancelCS").show(); 803 804 $("#PopUpConfirmCS").on("click", function (ev) { 805 ev.preventDefault(); 806 closePopUp(); 807 callback(true); 808 }); 809 810 $("#PopUpCancelCS").on("click", function (ev) { 811 ev.preventDefault(); 812 closePopUp(); 813 callback(false); 814 }); 815 816 rsBaseScripts.popupBoxCs.fadeIn(100); 817} 818 819function textPrompt(title, msg, callback) { 820 821 var responseField = $('<input name="name" id="PopUpResponseText" />'); 822 823 $("#PopUpMessageTitleCS").html(title); 824 $("#PopUpMessageCS").html(msg).append(responseField); 825 $("#PopUpIconCS").css({ "background": "url(../Images/lightbox/warning.png) no-repeat" }); 826 827 $("#PopUpOKCS").hide(); 828 $("#PopUpConfirmCS").show(); 829 $("#PopUpCancelCS").show(); 830 831 $("#PopUpConfirmCS").on("click", function (ev) { 832 ev.preventDefault(); 833 closePopUp(); 834 callback($(responseField).attr("value")); 835 }); 836 837 $("#PopUpCancelCS").on("click", function (ev) { 838 ev.preventDefault(); 839 closePopUp(); 840 callback(null); 841 }); 842 843 rsBaseScripts.popupBoxCs.fadeIn(100); 844} 845 846function closePopUp() {
847 $("#PopUpOKCS").off("click"); 848 $("#PopUpConfirmCS").off("click"); 849 $("#PopUpCancelCS").off("click"); 850 rsBaseScripts.popupBoxCs.fadeOut(100); 851} 852 853//////////// SERVER SIDE POP UP MESSAGES //////////////////////////// 854 855var myCtl = 'ctl01_'; 856var myStartingTagStringForAllClientIDsDOMEL = document.getElementById('StartingTagStringForAllClientIDs'); 857if (myStartingTagStringForAllClientIDsDOMEL) { 858 myCtl = myStartingTagStringForAllClientIDsDOMEL.value; 859} 860 861function DisplayConfirmStylePopUpMessage(myClickedControlClientID, myPopUpMsgTitle, myPopUpMsg, myClientSideConfirmButtonClickedTest, myPopUpIconType, myPopUpConfirmButtonText, myPopUpCancelButtonText) { 862 863 var myPopUpMessageTitle = $('#PopUpMessageTitle')[0]; 864 var myPopUpMessage = $('#PopUpMessage')[0] 865 var myPopUpIcon = $('#PopUpIcon')[0] 866 var myPopUpOK = $('#PopUpOK')[0] 867 var myPopUpOKWithRedirect = $('#PopUpOKWithRedirect')[0] 868 var myPopUpConfirm = $('#PopUpConfirm')[0] 869 var myPopUpCancel = $('#PopUpCancel')[0] 870 871 myPopUpOK.style.display = "none"; 872 myPopUpOKWithRedirect.style.display = "none"; 873 myPopUpConfirm.style.display = "inline"; 874 myPopUpCancel.style.display = "inline"; 875 876 document.getElementById('ClientSideConfirmButtonClickedTest').value = myClientSideConfirmButtonClickedTest 877 document.getElementById('ClickedControlClientID').value = myClickedControlClientID 878 879 myPopUpIcon.style.background = "url(../Images/lightbox/" + myPopUpIconType + ") no-repeat" 880 881 if (myPopUpConfirmButtonText != "") { 882 myPopUpConfirm.innerHTML = myPopUpConfirmButtonText 883 } else { 884 myPopUpConfirm.innerHTML = translate("Confirm") 885 } 886 887 if (myPopUpCancelButtonText != "") { 888 myPopUpCancel.innerHTML = myPopUpCancelButtonText 889 } else { 890 myPopUpCancel.innerHTML = translate("Cancel") 891 } 892 893 if (myPopUpMsgTitle != "") { 894 myPopUpMessageTitle.innerHTML = myPopUpMsgTitle 895 } else { 896 myPopUpMessageTitle.innerHTML = "" 897 } 898 899 if (myPopUpMsg != "") { 900 myPopUpMessage.innerHTML = myPopUpMsg 901 } else { 902 myPopUpMessage.innerHTML = translate("Warning") 903 } 904 905 906 907 rsBaseScripts.popupBox.fadeIn(100); 908 909} 910 911 912function SetConfirmButtonValues() { 913 var myClientSideConfirmButtonClickedTest = document.getElementById('ClientSideConfirmButtonClickedTest') 914 var myClickedControlClientID = document.getElementById('ClickedControlClientID') 915 var myClientButtonClickedTest = document.getElementById(myCtl + 'ClientButtonClickedTest') 916 if (!myClientButtonClickedTest) { 917 try { 918 var myPageNamePrefix = document.getElementById('StartingTagStringForAllClientIDsInControl').value; 919 var ctl2 = myPageNamePrefix.slice(0, 6); 920 myClientButtonClickedTest = document.getElementById(ctl2 + 'ClientButtonClickedTest'); 921 } catch (ex) { 922 923 } 924 } 925 926 927 if (myClickedControlClientID.value != "") { 928 var myClickedButton = document.getElementById(myClickedControlClientID.value) 929 if (myClickedButton) { 930 myClientSideConfirmButtonClickedTest.value = "True" 931 myClientButtonClickedTest.value = "True" 932 myClickedButton.click() 933 934 } else if (myClientSideConfirmButtonClickedTest.value.indexOf("ReDirectAtClientWithoutPostback:") > -1) { 935 window.location = myClientSideConfirmButtonClickedTest.value.replace("ReDirectAtClientWithoutPostback:", "") 936 } else { 937 __doPostBack(myClickedControlClientID.value, myClientSideConfirmButtonClickedTest.value); 938 } 939 } 940} 941 942 943function DisplayAlertStylePopUpMessage(myPopUpMsgTitle, myPopUpMsg, myPopUpIconType, myPopUpButtonText) { 944 945 var myPopUpMessageTitle = $('#PopUpMessageTitle')[0]; 946 var myPopUpMessage = $('#PopUpMessage')[0] 947 var myPopUpIcon = $('#PopUpIcon')[0] 948 var myPopUpOK = $('#PopUpOK')[0] 949 var myPopUpOKWithRedirect = $('#PopUpOKWithRedirect')[0] 950 var myPopUpConfirm = $('#PopUpConfirm')[0] 951 var myPopUpCancel = $('#PopUpCancel')[0] 952 953 myPopUpOKWithRedirect.style.display = "none"; 954 myPopUpConfirm.style.display = "none";
955 myPopUpCancel.style.display = "none"; 956 957 myPopUpIcon.style.background = "url(../Images/lightbox/" + myPopUpIconType + ") no-repeat" 958 959 if (myPopUpButtonText == "" || myPopUpButtonText == "<span></span>") { 960 myPopUpOK.innerHTML = "" 961 myPopUpOK.style.display = "none" 962 myPopUpOK.classList.remove("NewMasterButtonStyle"); 963 } else { 964 myPopUpOK.innerHTML = "OK" 965 myPopUpOK.style.display = "inline"; 966 } 967 968 if (myPopUpMsgTitle != "") { 969 myPopUpMessageTitle.innerHTML = myPopUpMsgTitle 970 } else { 971 myPopUpMessageTitle.innerHTML = "" 972 } 973 974 if (myPopUpMsg != "") { 975 myPopUpMessage.innerHTML = myPopUpMsg 976 } else { 977 myPopUpMessage.innerHTML = translate("Warning") 978 } 979 980 981 982 983 rsBaseScripts.popupBox.fadeIn(100); 984} 985 986 987 988function DisplayAlertStylePopUpMessageWithRedirectURL(myPopUpMsgTitle, myPopUpMsg, myPopUpIconType, myPopUpButtonText, myPopUpButtonRedirectURL) { 989 990 var myPopUpMessageTitle = $('#PopUpMessageTitle')[0]; 991 var myPopUpMessage = $('#PopUpMessage')[0] 992 var myPopUpIcon = $('#PopUpIcon')[0] 993 var myPopUpOK = $('#PopUpOK')[0] 994 var myPopUpOKWithRedirect = $('#PopUpOKWithRedirect')[0] 995 var myPopUpConfirm = $('#PopUpConfirm')[0] 996 var myPopUpCancel = $('#PopUpCancel')[0] 997 998 999 myPopUpConfirm.style.display = "none"; 1000 myPopUpCancel.style.display = "none"; 1001 1002 myPopUpIcon.style.background = "url(../Images/lightbox/" + myPopUpIconType + ") no-repeat" 1003 1004 if (myPopUpButtonText != "" && myPopUpButtonRedirectURL != "") { 1005 myPopUpOKWithRedirect.style.display = "inline"; 1006 myPopUpOK.style.display = "none"; 1007 1008 myPopUpOKWithRedirect.innerHTML = myPopUpButtonText 1009 myPopUpOKWithRedirect.href = myPopUpButtonRedirectURL 1010 } else { 1011 myPopUpOKWithRedirect.style.display = "none"; 1012 myPopUpOK.style.display = "inline"; 1013 1014 myPopUpOK.innerHTML = myPopUpButtonText 1015 } 1016 1017 if (myPopUpMsgTitle != "") { 1018 myPopUpMessageTitle.innerHTML = myPopUpMsgTitle 1019 } else { 1020 myPopUpMessageTitle.innerHTML = "" 1021 } 1022 1023 if (myPopUpMsg != "") { 1024 myPopUpMessage.innerHTML = myPopUpMsg 1025 } else { 1026 myPopUpMessage.innerHTML = translate("Warning") 1027 } 1028 1029 1030 1031 1032 rsBaseScripts.popupBox.fadeIn(100); 1033} 1034 1035 1036 1037 1038 1039function ShowHideSiteMapEditor() { 1040 var myShowSiteMapEditor = document.getElementById('ShowSiteMapEditor'); 1041 1042 myEditSiteMapQuestionDiv = document.getElementById(myCtl + 'PageSiteMap_EditSiteMapQuestionDiv') 1043 1044 if (myShowSiteMapEditor) { 1045 if (myShowSiteMapEditor.checked) { 1046 $(".SiteMapEditorButtons").fadeIn(100); 1047 } else { 1048 $(".SiteMapEditorButtons").fadeOut(300); 1049 $("#" + myEditSiteMapQuestionDiv.id).fadeOut(300); 1050 } 1051 } 1052} 1053 1054 1055 1056$(document).ready(function () { 1057 1058 //When admin logs in, remove focus from userid field 1059 $('.userid').blur(); 1060 1061 //SET French translation for date and timepickers 1062 if ($.datepicker) { 1063 $.datepicker.regional['fr'] = { 1064 closeText: 'Fermer', 1065 prevText: 'Précédent', 1066 nextText: 'Suivant', 1067 currentText: 'Aujourd\'hui', 1068 monthNames: ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 1069 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'], 1070 monthNamesShort: ['Janv.', 'Févr.', 'Mars', 'Avril', 'Mai', 'Juin', 1071 'Juil.', 'Août', 'Sept.', 'Oct.', 'Nov.', 'Déc.'], 1072 dayNames: ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'], 1073 dayNamesShort: ['Dim.', 'Lun.', 'Mar.', 'Mer.', 'Jeu.', 'Ven.', 'Sam.'], 1074 dayNamesMin: ['Di', 'Lu', 'Ma', 'Me', 'Je', 'Ve', 'Sa'], 1075 weekHeader: 'Sem.' 1076 }; 1077 1078 //SET Spanish translation for date and timepickers 1079 $.datepicker.regional['sp'] = { 1080 closeText: 'Cerrar', 1081 prevText: 'Anterior', 1082 nextText: 'Siguiente', 1083 currentText: 'Hoy', 1084 monthNames: ["enero", "febrero", "marzo", "abril", "mayo", "junioââ", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre"], 1085 monthNamesShort: ["ene", "feb", "mar", "abr", "may", "jun", "jul", "ago", "sep", "oct", "nov", "dic"], 1086 dayNames: ["domingo", "lunes", "martes", "miércoles", "jueves", "viernes", "sábado"], 1087 dayNamesShort: ["dom", "lun", "mar", "mié", "jue", "vie", "sáb"], 1088 dayNamesMin: ["do", "lu", "ma", "mi", "ju", "vi", "sá"], 1089 weekHeader: 'Sem.' 1090 }; 1091 } 1092 1093 if ($.timepicker) { 1094 $.timepicker.regional['sp'] = { 1095 closeText: 'Cerrar', 1096 prevText: 'Anterior', 1097 nextText: 'Siguiente', 1098 currentText: 'Hoy', 1099 hourText: 'Hora', 1100 timeText: 'Hora', 1101 minuteText: 'Minuto' 1102 }; 1103 1104 $.timepicker.regional['fr'] = { 1105 closeText: 'Fermer', 1106 prevText: 'Précédent', 1107 nextText: 'Suivant', 1108 currentText: 'Aujourd\'hui', 1109 hourText: 'Heure', 1110 timeText: "L'heure", 1111 minuteText: 'Minute' 1112 }; 1113 } 1114 //SET Translation mode for date and timepickers 1115 1116 var setDefaults = function (langId) { 1117 $.datepicker.setDefaults($.datepicker.regional[langId]); 1118 $.timepicker.setDefaults($.timepicker.regional[langId]); 1119 }; 1120 1121 var CurrentLanguage = $('#CurrentLanguageInput').val(); 1122 if ($.datepicker && $.timepicker) { 1123 1124 if (CurrentLanguage == "French") { 1125 setDefaults('fr'); 1126 } else if (CurrentLanguage == "Spanish") { 1127 setDefaults('sp'); 1128 } else { 1129 setDefaults(''); 1130 } 1131 } 1132 1133 if ($('.goToAdminPortal-submit').length && CurrentLanguage == "French") { 1134 $(".sign-in-holder").css({ 'width': '520px' }); 1135 } else { 1136 $(".sign-in-holder").css({ 'width': '430px' }); 1137 } 1138 1139 1140 $('.SiteMapActionButton').click(function (ev) { 1141 1142 ev.preventDefault(); 1143 1144 });
1145 1146 1147 1148 initReplacedSelectBoxes(); 1149 1150 $("#PopUpCloseCS").click(function () { 1151 closePopUp(); 1152 }); 1153 1154 var myPopUpMessage = $('#PopUpMessage')[0]; 1155 var myDefaultPopUpMessageTitle = $('#' + myCtl + 'DefaultPopUpMessageTitle')[0]; 1156 var myDefaultPopUpMessage = $('#' + myCtl + 'DefaultPopUpMessage')[0]; 1157 1158 1159 if (!myDefaultPopUpMessageTitle) { 1160 myDefaultPopUpMessageTitle = ""; 1161 } 1162 1163 1164 if (!myDefaultPopUpMessage) { 1165 myDefaultPopUpMessage = ""; 1166 } 1167 1168 1169 1170 $(".disabled").children("a").click( 1171 function (event) { 1172 event.preventDefault(); 1173 GenerateAlertPopUp(this) 1174 } 1175 ) 1176 1177 $(".disabled").children("input").click( 1178 function (event) { 1179 event.preventDefault(); 1180 GenerateAlertPopUp(this) 1181 } 1182 ) 1183 1184 function GenerateAlertPopUp(myClickedControl) { 1185 if (myDefaultPopUpMessage.innerHTML != "") { 1186 myPopUpMsgTitle = myDefaultPopUpMessageTitle.innerHTML 1187 myPopUpMsg = myDefaultPopUpMessage.innerHTML 1188 DisplayAlertStylePopUpMessage(myPopUpMsgTitle, myPopUpMsg, "info.png", translate("OK")) 1189 } 1190 1191 1192 } 1193 1194 var $disabledConfirmationPopUp = $(".disabled_ConfirmationPopUp"); 1195 1196 $disabledConfirmationPopUp.children("a").click( 1197 function (event) { 1198 event.preventDefault(); 1199 GenerateConfirmationPopUp(this) 1200 } 1201 ) 1202 1203 $disabledConfirmationPopUp.children("input").click( 1204 function (event) { 1205 event.preventDefault(); 1206 GenerateConfirmationPopUp(this) 1207 } 1208 ) 1209 1210 1211 function GenerateConfirmationPopUp(myClickedControl) { 1212 1213 var myPopUpMsgTitle = myDefaultPopUpMessageTitle.innerHTML 1214 var myPopUpMsg = myDefaultPopUpMessage.innerHTML 1215 var myPopUpConfirmButtonText = translate("OK") 1216 var myPopUpCancelButtonText = translate("Cancel") 1217 var myPopUpIconType = "icon.png" 1218 var myPopUpPostbackEventCaptureName = "" 1219 var myPopUpPostbackRedirectURLOrArgument = "" 1220 var myReDirectAtClientWithoutPostback = "" 1221 1222 var myClickedControlAttributesGetNamedItem = function (item) { 1223 return myClickedControl.attributes.getNamedItem(item); 1224 }; 1225 1226 if (myClickedControlAttributesGetNamedItem("PopUpMsgTitle")) { 1227 if (myClickedControlAttributesGetNamedItem("PopUpMsgTitle").value != "") { 1228 myPopUpMsgTitle = myClickedControlAttributesGetNamedItem("PopUpMsgTitle").value 1229 } 1230 } 1231 if (myClickedControlAttributesGetNamedItem("PopUpMsg")) { 1232 if (myClickedControlAttributesGetNamedItem("PopUpMsg").value != "") { 1233 myPopUpMsg = myClickedControlAttributesGetNamedItem("PopUpMsg").value 1234 } 1235 } 1236 if (myClickedControlAttributesGetNamedItem("PopUpConfirmButtonText")) { 1237 if (myClickedControlAttributesGetNamedItem("PopUpConfirmButtonText").value != "") { 1238 myPopUpConfirmButtonText = myClickedControlAttributesGetNamedItem("PopUpConfirmButtonText").value 1239 } 1240 } 1241 if (myClickedControlAttributesGetNamedItem("PopUpCancelButtonText")) { 1242 if (myClickedControlAttributesGetNamedItem("PopUpCancelButtonText").value != "") { 1243 myPopUpCancelButtonText = myClickedControlAttributesGetNamedItem("PopUpCancelButtonText").value 1244 } 1245 } 1246 if (myClickedControlAttributesGetNamedItem("PopUpIconType")) { 1247 if (myClickedControlAttributesGetNamedItem("PopUpIconType").value != "") { 1248 myPopUpIconType = myClickedControlAttributesGetNamedItem("PopUpIconType").value 1249 } 1250 } 1251 if (myClickedControlAttributesGetNamedItem("PopUpPostbackEventCaptureName")) { 1252 if (myClickedControlAttributesGetNamedItem("PopUpPostbackEventCaptureName").value != "") { 1253 myPopUpPostbackEventCaptureName = myClickedControlAttributesGetNamedItem("PopUpPostbackEventCaptureName").value 1254 } 1255 } 1256 if (myClickedControlAttributesGetNamedItem("PopUpPostbackRedirectURLOrArgument")) { 1257 if (myClickedControlAttributesGetNamedItem("PopUpPostbackRedirectURLOrArgument").value != "") { 1258 myPopUpPostbackRedirectURLOrArgument = myClickedControlAttributesGetNamedItem("PopUpPostbackRedirectURLOrArgument").value 1259 } 1260 } 1261 if (myClickedControlAttributesGetNamedItem("ReDirectAtClientWithoutPostback")) { 1262 if (myClickedControlAttributesGetNamedItem("ReDirectAtClientWithoutPostback").value != "") { 1263 myReDirectAtClientWithoutPostback = myClickedControlAttributesGetNamedItem("ReDirectAtClientWithoutPostback").value 1264 } 1265 } 1266 1267 if (myReDirectAtClientWithoutPostback.toLowerCase() == "true") { 1268 myPopUpPostbackRedirectURLOrArgument = "ReDirectAtClientWithoutPostback:" + myPopUpPostbackRedirectURLOrArgument 1269 } 1270 1271 if (myPopUpPostbackEventCaptureName == "") { 1272 if (myReDirectAtClientWithoutPostback.toLowerCase() == "true") { 1273 myPopUpPostbackEventCaptureName = "ReDirectAtClientWithoutPostback" 1274 } else { 1275 alert(this.innerHTML + " button is not configured correctly. ReDirectAtClientWithoutPostback Must = True") 1276 } 1277 } 1278 DisplayConfirmStylePopUpMessage(myPopUpPostbackEventCaptureName, myPopUpMsgTitle, myPopUpMsg, myPopUpPostbackRedirectURLOrArgument, myPopUpIconType, myPopUpConfirmButtonText, myPopUpCancelButtonText) 1279 } 1280 1281 1282 $(".PopUpClose").click( 1283 function (event) { 1284 PopUpFadeOut(event) 1285 } 1286 ); 1287 1288 $("#PopUpClose").click( 1289 function (event) { 1290 PopUpFadeOut(event) 1291 } 1292 ); 1293
1294 $("#PopUpConfirm").click( 1295 function (event) { 1296 PopUpFadeOut(event) 1297 } 1298 ); 1299 1300 $("#PopUpOK").click( 1301 function (event) { 1302 PopUpFadeOut(event) 1303 } 1304 ); 1305 1306 $("#PopUpCancel").click( 1307 function (event) { 1308 PopUpFadeOut(event) 1309 } 1310 ); 1311 1312 function PopUpFadeOut(event) { 1313 event.preventDefault(); 1314 rsBaseScripts.popupBox.fadeOut(300); 1315 myPopUpMessage.innerHTML = "" 1316 } 1317 1318 $(window).resize( 1319 function (e) { 1320 rsBaseScripts.popupBox.verticallyCenter(); 1321 } 1322 ) 1323 1324 ///////////////////// Page Content Tabs //////////////////////////// 1325 if ($(".openPageContentTab a:first-child")) { 1326 openPageContentTabNEW($(".openPageContentTab a:first-child")); 1327 } 1328 1329 $(".pageContentTabNEW a").click(function (ev) { 1330 ev.preventDefault(); 1331 openPageContentTabNEW(this); 1332 }); 1333 1334 function openPageContentTabNEW(tab) { 1335 var current = $(".openPageContentTab a:first-child").attr("href"); 1336 $(".pageContentTabNEW").removeClass("openPageContentTab"); 1337 $(tab).closest("li").addClass("openPageContentTab"); 1338 var id = $(tab).attr("href"); 1339 $(current).slideUp(250, function (ev) { 1340 $(id).slideDown(250); 1341 }); 1342 } 1343 1344 if ($(".openPageContentTab a:first-child")) { 1345 openPageContentTab($(".openPageContentTab a:first-child")); 1346 } 1347 1348 $(".pageContentTab a").click(function (ev) { 1349 ev.preventDefault(); 1350 openPageContentTab(this); 1351 }); 1352 1353 function openPageContentTab(tab) { 1354 var current = $(".openPageContentTab a:first-child").attr("href"); 1355 $(".pageContentTab").removeClass("openPageContentTab"); 1356 $(tab).closest("li").addClass("openPageContentTab"); 1357 var id = $(tab).attr("href"); 1358 $(current).slideUp(250, function (ev) { 1359 $(id).slideDown(250); 1360 }); 1361 } 1362 1363}); 1364 1365 1366 1367 1368 1369$(document).ready(function () { 1370 //initialize tooltips 1371 var $document = $(document), 1372 rsBaseScripts = window.rsBaseScripts; 1373 1374 function hide(jq) { 1375 rsBaseScripts.hide(jq); 1376 } 1377 function show(jq) { 1378 rsBaseScripts.hide(jq); 1379 } 1380 1381 $(".login-input.password").keypress(function (e) { 1382 if (e.which == 13) { 1383 hide(".login-card"); 1384 runLoadingProgressTimer() 1385 } 1386 }); 1387 $(".login-submit").click(function () { 1388 runLoadingProgressTimer() 1389 }); 1390 1391 1392 1393 function runLoadingProgressTimer() { 1394 1395 $(".HomePageCustomText").empty(); 1396 $(".retrieveAccountInfoHolder").show(); 1397 1398 $.fn.progressTimer = function (options) { 1399 var settings = $.extend({}, $.fn.progressTimer.defaults, options); 1400 1401 this.each(function () { 1402 $(this).empty(); 1403 var barContainer = $("<div>").addClass("progress active"); 1404 var bar = $("<div>").addClass("progress-bar") 1405 .attr("role", "progressbar") 1406 .attr("aria-valuenow", "0") 1407 .attr("aria-valuemin", "0") 1408 .attr("aria-valuemax", settings.timeLimit); 1409 1410 bar.appendTo(barContainer); 1411 barContainer.appendTo($(this)); 1412 1413 var start = new Date(); 1414 var limit = settings.timeLimit * 1000; 1415 var interval = window.setInterval(function () { 1416 var elapsed = new Date() - start; 1417 var currentBarWidth = bar.width(); 1418 1419 var applyDampening = true, newWidth, divisor = 1; 1420 1421 if (elapsed < 12000) { 1422 newWidth = ((elapsed / limit) * 200) + "%"; 1423 applyDampening = false; 1424 } 1425 else if (elapsed < 16000) { 1426 divisor = 2; 1427 } 1428 else if (elapsed < 21000) { 1429 divisor = 7; 1430 } 1431 else if (elapsed < 28000) { 1432 divisor = 15; 1433 } 1434 else if (elapsed < 43000) { 1435 divisor = 25; 1436 } 1437 1438 else if (elapsed >= limit) { 1439 window.clearInterval(interval); 1440 settings.onFinish.call(this); 1441 newWidth = 690; 1442 } 1443
1444 if (applyDampening) { 1445 newWidth = currentBarWidth + (elapsed / (divisor * 1000)); 1446 } 1447 bar.width(newWidth); 1448 1449 }, 100); 1450 }); 1451 return this; 1452 }; 1453 1454 1455 $.fn.progressTimer.defaults = { 1456 timeLimit: 43 1457 }; 1458 1459 1460 $("#progressTimer").progressTimer({ 1461 timeLimit: 43, 1462 baseStyle: 'progress-bar-warning', 1463 onFinish: function () { } //invoked once the timer expires 1464 }); 1465 1466 1467 }; 1468 1469 //This is the script for the toggle switch (radio buttons) 1470 $('.ToggleSwitchItem').click(function () { 1471 $(this).addClass('checked'); 1472 $(this).siblings().removeClass('checked'); 1473 }); 1474 1475 $('.ToggleSwitchVerticalItem').click(function () { 1476 1477 $(this).parent().siblings().children('.ToggleSwitchVerticalItem').removeClass('checked'); 1478 $(this).addClass('checked'); 1479 1480 }); 1481 1482 1483 //This script controls the PageTabSections 1484 1485 if ($(".openPageSectionTab a:first-child")) { 1486 openPageSectionTab($(".openPageSectionTab a:first-child")); 1487 } 1488 1489 $(".PageSectionTab a").click(function (ev) { 1490 ev.preventDefault(); 1491 openPageSectionTab(this); 1492 }); 1493 1494 function openPageSectionTab(tab) { 1495 var current = $(".openPageSectionTab a:first-child").attr("href"); 1496 $(".PageSectionTab").removeClass("openPageSectionTab"); 1497 $(tab).closest("li").addClass("openPageSectionTab"); 1498 1499 1500 1501 var id = $(tab).attr("href"); 1502 $(current).fadeOut(150, function (ev) { 1503 $(id).fadeIn(150); 1504 }); 1505 } 1506 1507 1508 1509 // Place Other jQuery functions that require "$(document).ready(function () {" ... HERE. 1510 1511 $("#video_tutorial_Btn").mouseover(function () { 1512 $(".info_message_label_video_container").fadeIn("fast"); 1513 }); 1514 1515 $("#video_tutorial_Btn").mouseleave(function () { 1516 $(".info_message_label_video_container").fadeOut("fast"); 1517 }); 1518 1519 $(".video_arrow_holder").click(function () { 1520 $(".video_link_list").slideToggle("fast"); 1521 $(".video_icon_holder").toggleClass("expanded"); 1522 $(".video_arrow_holder").toggleClass("expanded"); 1523 $(".video_arrow_btn").toggleClass("open"); 1524 }); 1525 1526 $(".video_icon_holder").click(function () { 1527 $(".video_link_list").slideToggle("fast"); 1528 $(".video_icon_holder").toggleClass("expanded"); 1529 $(".video_arrow_holder").toggleClass("expanded"); 1530 $(".video_arrow_btn").toggleClass("open"); 1531 }); 1532 1533 function hideVideoOnClick () { 1534 $(".video_link_list").slideUp("fast"); 1535 $(".video_icon_holder").removeClass("expanded"); 1536 $(".video_arrow_holder").removeClass("expanded"); 1537 $(".video_arrow_btn").removeClass("open"); 1538 } 1539 1540 function stopPropagation(event) { 1541 event.stopPropagation(); 1542 } 1543 1544 function onClickCollapseExpandButton (event) { 1545 1546 $(this).parent().parent().children(".CollapseExpandTarget").slideToggle("fast"); 1547 $(this).toggleClass('Collapsed'); 1548 $(this).parent(".ContentHeader").toggleClass('Collapsed'); 1549 $(this).parent(".ModuleContentHeader").toggleClass('Collapsed'); 1550 1551 var showText = translate("Show"); 1552 var hideText = translate("Hide"); 1553 1554 if ($(this).hasClass("Collapsed")) { 1555 $(this).children(".ContentShowOrHide").text(showText); 1556 1557 } else { 1558 $(this).children(".ContentShowOrHide").text(hideText); 1559 } 1560 1561 } 1562 1563 window['rsOnlyNgPagesRemoveVideoClick'] = function () { 1564 1565 // These event listeners eat up cpu cycles. On the SPA page, we want to remove them. 1566 1567 $(document) 1568 .off('click', 'html', hideVideoOnClick) 1569 .off('click', '.video_link_list', stopPropagation) 1570 .off('click', '.video_icon_holder', stopPropagation) 1571 .off('click', '.video_arrow_holder', stopPropagation) 1572 .off('click', '.video_arrow_btn', stopPropagation) 1573 .off('click', '.CollapseExpandButton', onClickCollapseExpandButton) 1574 ; 1575 }; 1576 1577 $(document).on("click", "html", hideVideoOnClick) 1578 1579 .on("click", ".video_link_list", stopPropagation) 1580 1581 .on("click", ".video_icon_holder", stopPropagation) 1582 1583 .on("click", ".video_arrow_holder", stopPropagation) 1584 1585 .on("click", ".video_arrow_btn", stopPropagation) 1586 1587// This script controls the collapse and expand button on moduled content 1588 1589.on("click", ".CollapseExpandButton", function (event) { 1590 1591 $(this).parent().parent().children(".CollapseExpandTarget").slideToggle("fast"); 1592 $(this).toggleClass('Collapsed'); 1593 $(this).parent(".ContentHeader").toggleClass('Collapsed'); 1594 $(this).parent(".ModuleContentHeader").toggleClass('Collapsed'); 1595 1596 var showText = translate("Show"); 1597 var hideText = translate("Hide"); 1598 1599 if ($(this).hasClass("Collapsed")) { 1600 $(this).children(".ContentShowOrHide").text(showText); 1601 1602 } else { 1603 $(this).children(".ContentShowOrHide").text(hideText); 1604 } 1605}) 1606 1607.on("click", ".performance-stats-footer-table-toggle", function (event) { 1608 1609 $(".performance-stats-footer-holder").slideToggle("fast"); 1610 $("html, body").animate({ scrollTop: $(document).height() }, 1000); 1611 1612 var text = $('.performance-stats-footer-table-toggle').text(); 1613 $('.performance-stats-footer-table-toggle').text( 1614 text == "+" ? "-" : "+"); 1615}); 1616 1617 1618}); 1619 1620 1621 1622 1623 1624/////////////////////////////////////////////////////////////////////////////////
1625//////////////////// Control Input Scripts //////////////// 1626/////////////////////////////////////////////////////////////////////////////// 1627 1628 1629///////////////////////////////// RADIO BUTTONS /////////////////////////////// 1630 1631 1632$(document).ready(function () { 1633 1634 //This is the script for the toggle switch (radio buttons) 1635 $('.toggleSwitch').click(function () { 1636 $(this).addClass('checked'); 1637 $(this).siblings().removeClass('checked'); 1638 }); 1639 1640 $('.toggleSwitch').click(function () { 1641 $(this).parent().siblings().children('.ToggleSwitchVerticalItem').removeClass('checked'); 1642 $(this).addClass('checked'); 1643 1644 }); 1645 1646 1647 1648 1649 1650 if ($(document).draggable) { 1651 $(".popUpWindow").draggable({ handle: '.popUpTitle' }); 1652 } 1653 1654 1655 1656 1657 1658}); 1659///////////////////////////////// NEW POP UP CONTROLS /////////////////////////////// 1660 1661$(document).on("click", ".displayPopUpWindowButton", function () { 1662 1663 var buttonPosition = $(this).offset().top - 400; 1664 1665 rsBaseScripts.popupOverlay.show(); 1666 $("#PopUpWindowContainer").show(); 1667 $(".PopUpWindowContainerCenter").show(); 1668 $(".PopUpWindowContainerCenter").css({ "top": buttonPosition }); 1669 1670 1671 $('html, body').animate({ 1672 scrollTop: $(".PopUpWindowContainerCenter").offset().top - 50 1673 }, 100); 1674 1675 1676}); 1677 1678$(document).on("click", ".closePopUpWindowButton", function () { 1679 1680 rsBaseScripts.popupOverlay.hide(); 1681 $("#IncentiveOverlay").hide(); 1682 $("#PopUpWindowContainer").hide(); 1683 $(".PopUpWindowContainerCenter").hide(); 1684 1685 //if the pop up has a video - clear out the video so it stops playing 1686 if ($('.popUpContent iframe').length) { 1687 $(".popUpContent iframe").attr("src", ""); 1688 } 1689}); 1690 1691$(document).on("click", ".closePopUpReportWindowButton", function () { 1692 1693 rsBaseScripts.popupOverlay.hide(); 1694 $("#PopUpReportOverlay").hide(); 1695 $("#PopUpWindowContainer").hide(); 1696 $(".PopUpWindowContainerReportCenter").hide(); 1697 1698 //if the pop up has a video - clear out the video so it stops playing 1699 if ($('.popUpUserContent iframe').length) { 1700 $(".popUpUserContent iframe").attr("src", ""); 1701 } 1702}); 1703 1704 1705 1706///////////////////////////////////////////////////////////////////////////////// 1707//////////////////// Page Validation //////
1707////////// 1708/////////////////////////////////////////////////////////////////////////////// 1709 1710 1711// TO USE: Any input that requires validation to check if blank put the class 'required' in the input. The use the following function on the validation button: 1712 1713//$(".ValidationButtonClassORId").click(function () { 1714 1715// if (PageValidation()) { 1716 1717// // VALIDATION CAME BACK OK. DO WHAT YOU NEED IN HERE. 1718 1719// } 1720 1721 1722//}); 1723 1724function PageValidation() { 1725 1726 1727 var isPageValidated = true, 1728 showNotification = function (dynamicThis, message) { 1729 $(dynamicThis).addClass("highlight"); 1730 isPageValidated = false; 1731 $(".requiredNotification").show().html(translate(message)); 1732 }, 1733 defaultMessage = "Please fill out the required information marked with a red border"; 1734 1735 $(".required:visible").each(function () { 1736 1737 if ($.trim($(this).val()).length == 0) { 1738 showNotification(this, defaultMessage); 1739 } 1740 else { 1741 $(this).removeClass("highlight"); 1742 1743 } 1744 1745 1746 }); 1747 1748 $(".emailrequired:visible").each(function () { 1749 1750 var regex = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; 1751 var goodOrBadEmail = regex.test($(this).val()); 1752 if (goodOrBadEmail == false) { 1753 showNotification(this, defaultMessage); 1754 } else { 1755 $(this).removeClass("highlight"); 1756 1757 } 1758 1759 }); 1760 1761 $(".numberrequired:visible").each(function () { 1762 1763 1764 if ($(this).val() != "") { 1765 var regex = /^\d+$/; 1766 var goodOrBadCost = regex.test($(this).val()); 1767 if (goodOrBadCost == false) { 1768 showNotification(this, "Please fill out a correct value for available seats (only numbers permitted)"); 1769 } else { 1770 $(this).removeClass("highlight"); 1771 1772 } 1773 } 1774 }); 1775 1776 1777 $(".moneyrequired:visible").each(function () { 1778 1779 1780 if ($(this).val() != "") { 1781 var regex = /^(\d{1,3})?(,?\d{3})*(\.\d{2})?$/; 1782 var goodOrBadCost = regex.test($(this).val()); 1783 if (goodOrBadCost == false) { 1784 showNotification(this, "Please fill out a correct value for cost (only numbers and decimals permitted)"); 1785 } else { 1786 $(this).removeClass("highlight"); 1787 1788 } 1789 } 1790 }); 1791 1792 if (isPageValidated) { 1793 $(".requiredNotification").hide(); 1794 return true 1795 } 1796} 1797 1798 1799///////////////////////////////// CHECK BOX /////////////////////////////// 1800 1801 1802///Edit - Bryan, Dec 2. Required to make check boxes on FindCommuteOptions work. 1803(function (document) { 1804 1805$(document).on("click", ".InputCheckBox", function () { 1806 1807 var checkboxID = $(this).attr("id") || $(this).attr("attachName"); 1808 1809 if ($("." + checkboxID + "").is(":checked")) { 1810 $("." + checkboxID + "").prop('checked', false).trigger("change"); 1811 1812 $(this).css({ 'background': '#fff', 'background-image': 'none' }); 1813 } else { 1814 $("." + checkboxID + "").prop('checked', true).trigger("change"); 1815 $(this).css({ 'background': '#fff', 'background-image': 'url("../Images/ProfileImages/checkboxCheckedSM.png")', 'background-repeat': 'no-repeat', 'background-position': '4px 4px' }); 1816 } 1817 1818 1819}); 1820 1821})(document); 1822 1823///////////////////////////////// RADIO BUTTONS /////////////////////////////// 1824 1825(function (document) { 1826 1827 1828 1829//This is the script for the toggle switch (radio buttons) 1830 1831$(document).on("click", ".ToggleSwitchItem", function () { 1832 1833 $(this).addClass('checked'); 1834 $(this).siblings().removeClass('checked'); 1835 1836}); 1837 1838$(document).on("click", ".ToggleSwitchVerticalItem", function () { 1839 1840 $(this).parent().siblings().children('.ToggleSwitchVerticalItem').removeClass('checked'); 1841 $(this).addClass('checked'); 1842 1843}); 1844 1845$(document).on("click", ".toggleSwitch", function () { 1846 1847 $(this).addClass('checked'); 1848 $(this).siblings().removeClass('checked'); 1849 1850 $(this).parent().siblings().children('.ToggleSwitchVerticalItem').removeClass('checked'); 1851 $(this).addClass('checked'); 1852 1853}); 1854})(document); 1855
1856///////////////////////////////// CONTACT US POP UP CONTROLS AND FUNCTIONS /////////////////////////////// 1857 1858(function (window, document, $) { 1859 1860 var rsBaseScripts = window.rsBaseScripts; 1861 1862 function hide(jq) { 1863 rsBaseScripts.hideJq(jq); 1864 } 1865 function show(jq) { 1866 rsBaseScripts.hideJq(jq); 1867 } 1868 1869 function hideMany(selectors) { 1870 _.each(selectors, function (s) { 1871 hide(s); 1872 }); 1873 } 1874 1875 var $document = $(document); 1876 1877 1878$document.on("click", ".displayContactUsPopUpWindowButton", function (ev) { 1879 1880 ev.preventDefault(); 1881 1882 var buttonPosition = $(this).offset().top - 400; 1883 1884 function removeHighlight(selectors) { 1885 _.each(selectors, function (selector) { 1886 $(selector).removeClass('highlight'); 1887 }); 1888 } 1889 removeHighlight([ 1890 "#FeedbackForm_TopicDropdownlist", 1891 "#FeedbackForm_NameTextBox", 1892 "#FeedbackForm_PhoneTextBox", 1893 "#FeedbackForm_EmailTextBox", 1894 "#FeedbackForm_FeedbackComments" 1895 ]); 1896 1897 hideMany([ 1898 ".requiredEmailNotification, .requiredNotification", 1899 ".submittedNotification", 1900 ".closeContactUs" 1901 ]); 1902 1903 1904 rsBaseScripts.popupOverlay.show(); 1905 $("#PopUpWindowContainerContactUs").show(); 1906 $(".PopUpWindowContainerCenterContactUs").show(); 1907 $(".PopUpWindowContainerCenterContactUs").css({ "top": buttonPosition }); 1908 1909 1910 $("#ContactUsFormHolder").appendTo(".popUpContentContactUs"); 1911 $("#ContactUsFormHolder").show(); 1912 1913 $(".cancelContactUs, .submitContactUsButton").show(); 1914 1915 1916 $('html, body').animate({ 1917 scrollTop: $(".PopUpWindowContainerCenterContactUs").offset().top - 50 1918 }, 100); 1919 1920 1921}) 1922 1923.on("click", ".closeContactUsPopUpWindowButton", function (ev) { 1924 ev.preventDefault(); 1925 1926 rsBaseScripts.popupOverlay.hide(); 1927 $("#PopUpWindowContainerContactUs").hide(); 1928 $(".PopUpWindowContainerCenterContactUs").hide(); 1929 1930}) 1931 1932 1933.on("blur", ".emailrequired", function (ev) { 1934 var $this = $(this); 1935 1936 if ($this.is(':visible')) { 1937 1938 1939 1940 var regex = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; 1941 var goodOrBadEmail = regex.test($this.val()); 1942 if (goodOrBadEmail == false) { 1943 1944 $this.addClass("highlight"); 1945 $(".requiredEmailNotification").css({ 'display': 'inline-block', '*display': 'inline', '*zoom': '1' }).html(translate("please enter a valid email address. ex: [email protected]")); 1946 1947 } else { 1948 $this.removeClass("highlight"); 1949 $(".requiredEmailNotification").hide(); 1950 1951 } 1952 } 1953}) 1954 1955.on("click", ".submitContactUsButton", function (ev) { 1956 1957 1958 var contactUsObj = {} 1959 1960 if (PageValidation()) { 1961 1962 contactUsObj.Type = $("#FeedbackForm_TopicDropdownlist").val(); 1963 contactUsObj.Name = $("#FeedbackForm_NameTextBox").val(); 1964 contactUsObj.Phone = $("#FeedbackForm_PhoneTextBox").val(); 1965 contactUsObj.Email = $("#FeedbackForm_EmailTextBox").val(); 1966 contactUsObj.Message = $("#FeedbackForm_FeedbackComments").val(); 1967 1968 function ajaxGood(a, b, c) { 1969 toggleSpinnerOverlay(false); 1970 1971 try { 1972 myError = a.result.Error 1973 } catch (e) { 1974 myError = "" 1975 } 1976 1977 if (myError != "") { 1978 toggleSpinnerOverlay(false); 1979 1980 1981 var myPopUpMessage = a.result.Error 1982 $(".cancelContactUs, .submitContactUsButton").hide(); 1983 $(".closeContactUs").show(); 1984 $("#ContactUsFormHolder").hide(); 1985 $("submittedNotification").show().addClass('redNotificationBox').html(myPopUpMessage); 1986 1987 } else { 1988 1989 1990 toggleSpinnerOverlay(false); 1991 1992 $(".cancelContactUs, .submitContactUsButton").hide(); 1993 $(".closeContactUs").show(); 1994 $("#ContactUsFormHolder").hide(); 1995 $(".submittedNotification").show().addClass('greenNotificationBox').html(translate('Thank y
1995ou, your feedback has been successfully submitted.')); 1996 1997 } 1998 } 1999 2000 //fail 2001 function ajaxBad(a, b, c) { 2002 toggleSpinnerOverlay(false); 2003 } 2004 2005 toggleSpinnerOverlay(true); 2006 //Call to AJAX page 2007 $.ajax({ 2008 url: "../PublicAjax/ContactUsAjax.aspx?action=SubmitContactInfo", 2009 type: "POST", 2010 dataType: 'json', 2011 data: contactUsObj, 2012 success: ajaxGood, 2013 error: ajaxBad 2014 }); 2015 2016 //toggleSpinnerOverlay(true); 2017 ////Call to AJAX page 2018 //$.ajax({ 2019 // url: "../PublicAjax/ContactUsAjax.aspx?action=SubmitContactInfo", 2020 // type: "POST", 2021 // dataType: 'json', 2022 // data: contactUsObj, 2023 // success: ajaxGood, 2024 // error: ajaxBad 2025 //}); 2026 2027 } 2028 2029 2030}); 2031 2032})(window, document, jQuery); 2033//// VIDEO LINKS 2034 2035$(document).on("click", ".video_link_tabs", function () { 2036 2037 var videoSource = $(this).attr('source'); 2038 2039 $(".popUpContent #instructionVideoPlayer").attr("src", videoSource); 2040 2041}); 2042 2043/// Master 3 Login Card Script 2044 2045 2046(function (window, document, $) { 2047 2048 var $document = $(document); 2049 2050 var rsBaseScripts = window.rsBaseScripts; 2051 var show = rsBaseScripts.show, 2052 hide = rsBaseScripts.hide; 2053 2054 var LOGIN_CARD = '.login-card', 2055 LOGIN_CARD_USER_ID_FIELD = '.login-card .userid'; 2056 2057 2058 var loginCardIsOpen = false; 2059 2060 window.openOldLoginCard = function () { 2061 openLoginCard(); 2062 }; 2063 2064 2065function getNewRegistrationConfig () { 2066 var config = document.querySelector('#master3LoginRegistrationConfig'); 2067 if (config) { 2068 var configHtml = config.innerHTML; 2069 var configHtmlObj = JSON.parse(configHtml); 2070 return configHtmlObj; 2071 } 2072 return null; 2073} 2074 2075 2076function isUsingNewLogin() { 2077try { 2078var config = getNewRegistrationConfig(); 2079if (config) { 2080 if (config.LoginRegistrationDesktopVersion === 'V5' || config.LoginRegistrationDesktopVersion === 'V6') { 2081 return true; 2082 } 2083} 2084} catch(e) { 2085 return false; 2086} 2087return false; 2088} 2089 2090function isUsingNewRegistration() { 2091 try { 2092 var config = getNewRegistrationConfig(); 2093 if (config) { 2094 if (config.LoginRegistrationDesktopVersion === 'V5' || config.LoginRegistrationDesktopVersion === 'V6') { 2095 return true; 2096 } 2097 } 2098 } catch(e) { 2099 return false; 2100 } 2101 return false; 2102} 2103 2104 function ie_ver() { 2105 var iev = 0; 2106 try { 2107 var ieold = (/MSIE (\d+\.\d+);/.test(navigator.userAgent)); 2108 var trident = !!navigator.userAgent.match(/Trident\/7.0/); 2109 var rv = navigator.userAgent.indexOf("rv:11.0"); 2110 2111 if (ieold) iev = new Number(RegExp.$1); 2112 if (navigator.appVersion.indexOf("MSIE 10") != -1) iev = 10; 2113 if (trident && rv != -1) iev = 11; 2114 } catch (e) { 2115 return 0; 2116 } 2117 return iev; 2118 } 2119 2120 function openLoginCard() { 2121 2122 //if (isUsingNewLogin()) { 2123 2124 window.setTimeout(function () { 2125 //toggleSpinnerOverlay(true); 2126 window.rsLoginAttempted = true; 2127 //var vars = getUrlVars(); 2128 //console.log(vars, ie_ver() ) 2129 //if ((vars && vars.length === 0 && ie_ver() === 0) || !vars) { 2130 // console.log("Refresh the window") 2131 // console.log(window.location) 2132 // window.location.href = '../../Public/Home.aspx?try=1'; 2133 //} 2134 2135 function getUrlVars2() { 2136 var vars = [], hash; 2137 var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); 2138 for (var i = 0; i < hashes.length; i++) { 2139 hash = hashes[i].split('='); 2140 vars.push(hash[0]); 2141 vars[hash[0]] = hash[1]; 2142 } 2143 return vars; 2144 } 2145 2146 var vers = getUrlVars2(); 2147 var isIe = ie_ver(); 2148 //console.log(vers, isIe) 2149 2150 if ((vers && vers.length === 1 && ie_ver() !== 0) || (!vers && isIe !== 0)) { 2151 window.location.reload(); 2152 } 2153 }, 16); 2154 2155 // return; 2156 //} 2157 //loginCardIsOpen = true; 2158 //show(LOGIN_CARD); 2159 //rsBaseScripts.trapFocusOn(LOGIN_CARD); 2160 //window.setTimeout(function () { 2161 // $(LOGIN_CARD_USER_ID_FIELD).focus(); 2162 //}, 16); 2163 //$(LOGIN_CARD).find('[name=remember-me-checkbox] input').attr('aria-label', translate('Remember Me')); 2164 } 2165 2166 function closeLoginCard(focusOnOpenButton) { 2167 if (loginCardIsOpen) { 2168 loginCardIsOpen = false; 2169 if (focusOnOpenButton === void 0) { 2170 focusOnOpenButton = false; 2171 } 2172 hide(LOGIN_CARD); 2173 rsBaseScripts.stopTrappingFocus(LOGIN_CARD); 2174 if (focusOnOpenButton) { 2175 window.setTimeout(function () { 2176 $('.open-login-card').focus(); 2177 }, 16); 2178 } 2179 } 2180 } 2181 2182 2183 function showRegisterCard() { 2184 if (isUsingNewRegistration()) { 2185 2186 function getUrlVars3() { 2187 var vars = [], hash; 2188 var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); 2189 for (var i = 0; i < hashes.length; i++) { 2190 hash = hashes[i].split('='); 2191 vars.push(hash[0]); 2192 vars[hash[0]] = hash[1]; 2193 } 2194 return vars; 2195 } 2196 // toggleSpinnerOverlay(true); 2197 window.rsRegisterAttempted = true; 2198 var vers = getUrlVars3(); 2199 var isIe = ie_ver(); 2200 //console.log(vers, isIe) 2201 if ((vers && vers.length === 1 && ie_ver() !== 0) || (!vers && isIe !== 0)) { 2202 window.location.reload(); 2203 } 2204 //if ((vers && vers.length === 1 && ie_ver() !== 0) || (!vers && isIe !== 0)) { 2205 // window.location.href = vars[1] + '?try=1'; 2206 //} 2207 return; 2208 } 2209 closeLoginCard(false); 2210 $(".register").addClass('register_is-visible').attr('aria-hidden', false); 2211 $('.FirstName').focus(); 2212 rsBaseScripts.trapFocusOn('.register--panel'); 2213 } 2214 function hideRegisterCard(focusOnOpenButton) { 2215 $(".register").removeClass('register_is-visible'); 2216 rsBaseScripts.stopTrappingFocus('.register--panel'); 2217 if (focusOnOpenButton) { 2218 window.setTimeout(function () { 2219 $('#UserBarRegister').focus(); 2220 }, 16); 2221 } 2222 } 2223 2224 2225 var userSettingsMenuIsOpen = false, 2226 PERSONAL_DETAILS_MENU_DROPDOWN_MASTER3 = '#personal-details-dropdown-menu'; 2227 2228 function showPersonalDetailsMenuDropdownMaster3() { 2229 show(PERSONAL_DETAILS_MENU_DROPDOWN_MASTER3); 2230 rsBaseScripts.trapFocusOn(PERSONAL_DETAILS_MENU_DROPDOWN_MASTER3, '.user-settings-icon > span > a.glyphicon-cog'); 2231 window.setTimeout(function () { 2232 $(PERSONAL_DETAILS_MENU_DROPDOWN_MASTER3).focus(); 2233 }, 16); 2234 userSettingsMenuIsOpen = true; 2235 } 2236 2237 function hidePersonalDetailsMenuDropdownMaster3() { 2238 hide(PERSONAL_DETAILS_MENU_DROPDOWN_MASTER3); 2239 rsBaseScripts.stopTrappingFocus(PERSONAL_DETAILS_MENU_DROPDOWN_MASTER3); 2240 userSettingsMenuIsOpen = false; 2241 } 2242 2243 function toggleUserSettingsMenu() { 2244 if (userSettingsMenuIsOpen) { 2245 hidePersonalDetailsMenuDropdownMaster3(); 2246 } else { 2247 showPersonalDetailsMenuDropdownMaster3(); 2248 } 2249 } 2250 2251 $document.ready(function () { 2252 2253 function getUrlVars2() { 2254 var vars = [], hash; 2255 var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); 2256 for (var i = 0; i < hashes.length; i++) { 2257 hash = hashes[i].split('='); 2258 vars.push(hash[0]); 2259 vars[hash[0]] = hash[1]; 2260 } 2261 return vars; 2262 } 2263 //if (isUsingNewLogin()( 2264 //var vers = getUrlVars2(); 2265 //var isIe = ie_ver(); 2266 //console.log(vers, isIe) 2267 2268 //if ((vers && vers.length === 1 && ie_ver() !== 0) || (!vers && isIe !== 0) { 2269 // window.location.href = '?try=1'; 2270 //} 2271 2272 2273 2274 2275 if ($('.register').hasClass('.register_is-visible')) { 2276 showRegisterCard(); 2277 } 2278 2279 }) 2280 2281 .on('click', '.login-card .close-button', function (e) { 2282 e.preventDefault(); 2283 e.stopPropagation(); 2284 closeLoginCard(true); 2285 }) 2286 2287 .on("click", ".open-login-card", function (ev) { 2288 ev.preventDefault(); 2289 ev.stopPropagation(); 2290 openLoginCard(); 2291 2292 2293 }) 2294 2295 .on("click", "#UserBarRegister.UseControl", function (ev) { 2296 2297 if ($('.register .register--panel').length > 0) { 2298 ev.preventDefault(); 2299 2300 showRegisterCard(); 2301 } 2302 2303 }) 2304 2305 .on("click", ".registerButton a", function (ev) { 2306 2307 if ($('#UserBarRegister').hasClass('UseControl')) { 2308 if ($('.register .register--panel').length > 0) { 2309 ev.preventDefault(); 2310 2311 showRegisterCard(); 2312 } 2313 } 2314 2315 2316}); 2317 2318// Register the event on the button as well as the document to try and get around Angular's click stealing. 2319$('.btn.open-login-card').on('click', function (ev) { 2320 ev.preventDefault(); 2321 openLoginCard(); 2322}); 2323 2324// Register the event on the button as well as the document to try and get around Angular's click stealing. 2325$('#UserBarRegister.UseControl').on('click', function (ev) { 2326 ev.preventDefault(); 2327 showRegisterCard(); 2328}); 2329 2330$document.on("click", "html", function (e) { 2331 var eventParents = $(e.target).parents('.login-card'); 2332 if (!eventParents.length) { 2333 closeLoginCard(); 2334 } 2335 2336 //$(".register").hide(); 2337}) 2338 2339 .on("click", ".register--close-btn", function () { 2340 hideRegisterCard(true); 2341 2342 }) 2343 2344 .on("click", ".login-submit", function () { 2345 closeLoginCard(); 2346 }) 2347 2348 .on("click", ".register--panel", function (event) { 2349 event.stopPropagation(); 2350 }) 2351 2352 .on("click", "#UserBarRegister", function (event) { 2353 event.stopPropagation(); 2354 }) 2355 2356 .on("click", ".language-selector-link", function (ev) { 2357 ev.preventDefault(); 2358 var dropdown = $(".language-selector div") 2359 dropdown.toggle(); 2360 2361 }) 2362 2363 .on("click", ".user-settings-icon", function (ev) { 2364 toggleUserSettingsMenu(); 2365 ev.stopPropagation(); 2366 $(".InternalMessaging").removeClass("open"); 2367 }) 2368 2369 .on("click", "html", function () { 2370 var dropdown = $(".language-selector div"); 2371 hide(dropdown); 2372 2373 hidePersonalDetailsMenuDropdownMaster3(); 2374 }) 2375 2376 .on("click", ".language-selector-link", function (event) { 2377 event.stopPropagation(); 2378}); 2379 2380})(window, document, jQuery); 2381 2382// ============================= Cole's Stuff ============================= 2383 2384(function (window, document, $) { 2385 2386 var $document = $(document); 2387 var rsBaseScripts = window.rsBaseScripts; 2388 2389 var ARIA_HIDDEN = 'aria-hidden', 2390 FORGOT_PASSWORD_CARD = '.forgot-password-card', 2391 FORGOT_PASSWORD_SUBMIT_SUCCESS_CARD = '.forgot-password-submit-success-card', 2392 FORGOT_PASSWORD_SUBMIT_ERROR_CARD = '.forgot-password-submit-error-card', 2393 LOGIN_CARD = '.login-card', 2394 USER_ID_MESSAGE = '.userID-message'; 2395 2396 var hide = rsBaseScripts.hide, 2397 show = rsBaseScripts.show; 2398 2399 /** 2400 * Call preventDefault on the event 2401 */ 2402 function preventDefault(event) { 2403 event.preventDefault(); 2404 } 2405 2406 var forgotPasswordCardIsOpen = false; 2407 2408 var canCloseCard = true; 2409 2410 function allowCloseCard() { 2411 canCloseCard = true; 2412 } 2413 2414 function preventCloseCard() { 2415 canCloseCard = false; 2416 window.setTimeout(allowCloseCard, 100); 2417 } 2418 2419 function showForgotPasswordCard() { 2420 forgotPasswordCardIsOpen = true; 2421 hide(LOGIN_CARD); 2422 show(FORGOT_PASSWORD_CARD); 2423 $('.userID input').attr('aria-invalid', false); 2424 window.setTimeout(function () { 2425 $('.userID').focus(); 2426 }, 15); 2427 addEmphasis($(".forgot-password-card")); 2428 rsBaseScripts.trapFocusOn(FORGOT_PASSWORD_CARD); 2429 } 2430 function hideForgotPasswordCard() {
2431 if (forgotPasswordCardIsOpen && canCloseCard) { 2432 forgotPasswordCardIsOpen = false; 2433 hide(FORGOT_PASSWORD_CARD); 2434 hide(FORGOT_PASSWORD_SUBMIT_SUCCESS_CARD); 2435 hide(FORGOT_PASSWORD_SUBMIT_ERROR_CARD); 2436 rsBaseScripts.stopTrappingFocus(FORGOT_PASSWORD_CARD); 2437 rsBaseScripts.stopTrappingFocus(FORGOT_PASSWORD_SUBMIT_SUCCESS_CARD); 2438 rsBaseScripts.stopTrappingFocus(FORGOT_PASSWORD_SUBMIT_ERROR_CARD); 2439 } 2440 } 2441 2442 function showForgotPasswordSuccessCard() { 2443 show(FORGOT_PASSWORD_SUBMIT_SUCCESS_CARD); 2444 $(FORGOT_PASSWORD_SUBMIT_SUCCESS_CARD).focus(); 2445 rsBaseScripts.trapFocusOn(FORGOT_PASSWORD_SUBMIT_SUCCESS_CARD); 2446 } 2447 function hideForgotPasswordSuccessCard() { 2448 hide(FORGOT_PASSWORD_SUBMIT_SUCCESS_CARD); 2449 rsBaseScripts.stopTrappingFocus(FORGOT_PASSWORD_SUBMIT_SUCCESS_CARD); 2450 } 2451 function showForgotPasswordErrorCard() { 2452 show(FORGOT_PASSWORD_SUBMIT_ERROR_CARD); 2453 $(FORGOT_PASSWORD_SUBMIT_ERROR_CARD).focus(); 2454 rsBaseScripts.trapFocusOn(FORGOT_PASSWORD_SUBMIT_ERROR_CARD); 2455 } 2456 function hideForgotPasswordErrorCard() { 2457 hide(FORGOT_PASSWORD_SUBMIT_ERROR_CARD); 2458 rsBaseScripts.stopTrappingFocus(FORGOT_PASSWORD_SUBMIT_ERROR_CARD); 2459 } 2460 2461 2462 //-- Event for when the "FORGOT PASSWORD" button is clicked 2463 $document.on("click", ".open-forgot-password-card", function (event) { 2464 preventDefault(event); 2465 event.stopPropagation(); 2466 showForgotPasswordCard(); 2467 preventCloseCard(); 2468 }) 2469 2470 //-- Event for when any html is clicked 2471 .on("click", "html", function (ev) { 2472 if (ev) { 2473 var parents = $(ev.target).parents(FORGOT_PASSWORD_CARD); 2474 if (!parents.length) { 2475 hideForgotPasswordCard(); 2476 } 2477 } 2478 }) 2479 .on('click', 'html :not(.forgot-password-submit-success-card)', function () { 2480 hideForgotPasswordSuccessCard(); 2481 }) 2482 .on('click', 'html :not(.forgot-password-submit-error-card)', function () { 2483 hideForgotPasswordErrorCard(); 2484 }) 2485 2486//-- Event for when the cancel button is clicked 2487 .on("click", ".cancel-button", function (event) { 2488 event.preventDefault(); 2489 clearAllInputs(); 2490 hide(USER_ID_MESSAGE); 2491 hideForgotPasswordCard(); 2492 }) 2493 2494//-- Event for when the "OK" button on the success card is clicked 2495 .on("click", ".forgot-password-submit-success-ok-button", function (event) { 2496 event.stopPropagation(); 2497 hideForgotPasswordSuccessCard(); 2498 }) 2499 2500//-- Event for when the "OK" button on the error card is clicked 2501 .on("click", ".forgot-password-submit-error-ok-button", function (event) { 2502 event.stopPropagation(); 2503 clearAllInputs(); 2504 hideForgotPasswordErrorCard(); 2505 showForgotPasswordCard(); 2506 }) 2507 2508//-- Everything that happens once the user clicks the "SEND REQUEST" button 2509 .on("click", ".send-reset-password-request", function (event) { 2510 2511 var href = "../api/accounts/ResetPassword"; 2512 2513 //-- Function to be called on a successfull ajax call 2514 function ajaxSuccess(a, b, c) { 2515 emphasizeDeactivate(); 2516 clearAllInputs(); 2517 hideForgotPasswordCard(); 2518 window.setTimeout(function () { 2519 showForgotPasswordSuccessCard(); 2520 }, 100); 2521 2522 $(".forgot-password-submit-success-message-main").text(translate("Your request has been sent successfully to ") + forgotPasswordFormData.UserID + "!"); 2523 } 2524 2525 //-- Function to be called on a bad ajax call 2526 function ajaxError(a, b, c) { 2527 emphasizeDeactivate(); 2528 hideForgotPasswordCard(); 2529 window.setTimeout(function () { 2530 showForgotPasswordErrorCard(); 2531 }, 100); 2532 $(".forgot-password-submit-error-message-sub").text(a.responseJSON.ErrorMessage + "."); 2533 } 2534 2535 //-- JSON object of the data given 2536 var forgotPasswordFormData = { 2537 "UserID": $(".userID").find("input").val() 2538 }; 2539 2540 if (checkInputs(forgotPasswordFormData)) { 2541 2542 // Actual ajax call 2543 emphasizeActivate($(".paper-emphasis-linearProgress")); 2544 var test = $.ajax({
2545 url: href, 2546 type: "POST", 2547 data: JSON.stringify(forgotPasswordFormData), 2548 dataType: "json", 2549 contentType: "application/json; charset=utf-8", 2550 success: ajaxSuccess, 2551 error: ajaxError 2552 }); 2553 } 2554 2555 }) 2556 2557//-- Listeners for the error messages, this allows the error messages to dissapear when the user starts typing in the feild 2558 .on('keyup', '.userID-change-listener', function () { 2559 hide(USER_ID_MESSAGE); 2560 $('.userID input').attr('aria-invalid', false); 2561}); 2562 2563//-- Clears all of the input feilds 2564function clearAllInputs() { 2565 $(".userID").find("input").val(""); 2566} 2567 2568//-- checkInputs that all inputs have something written 2569function checkInputs(dataToCheck) { 2570 var check = true; 2571 if (dataToCheck.UserID == "") { 2572 check = false; 2573 show(USER_ID_MESSAGE); 2574 $('.userID input').attr('aria-invalid', true); 2575 window.setTimeout(function () { 2576 $('.userID input').focus(); 2577 }, 100); 2578 } else { 2579 $('.userID input').attr('aria-invalid', false); 2580 } 2581 return check; 2582} 2583 2584})(window, document, jQuery); 2585 2586 2587// ============================= End of Cole's Stuff ============================= 2588 2589 2590 2591$(document).ready(function () { 2592 2593 var updateDirtyState = function () { 2594 if ($(this).val() != '') { 2595 $(this).addClass('dirty'); 2596 } else { 2597 $(this).removeClass('dirty'); 2598 } 2599 }; 2600 2601 $(".login-input").each(updateDirtyState).on('focus', updateDirtyState).on('blur', updateDirtyState).on('change', updateDirtyState); 2602 2603 //This code is to make the label float up in IE10 and IE9 when clicked on 2604 $(".login-card .input-container label").click(function () { 2605 2606 $('.login-card').find('input').blur(); 2607 $(this).parent().find('input').focus(); 2608 2609 }); 2610 2611 $('.login-card .close-button').on('click', function () { 2612 2613}); 2614 2615}); 2616 2617// Sticky Footer 2618(function () { 2619 var footerIsOpen = false; 2620 2621 2622 function openFooter() { 2623 $("#MasterFooterContent").addClass("is-open"); 2624 $(".footer-slide-out-content").css({ top: -$(".footer-slide-out-content").outerHeight() }); 2625 rsBaseScripts.popupOverlay.fadeIn(100); 2626 footerIsOpen = true; 2627 } 2628 2629 2630 function closeFooter() { 2631 $("#MasterFooterContent").removeClass("is-open"); 2632 $(".footer-slide-out-content").css({ top: 0 }); 2633 rsBaseScripts.popupOverlay.fadeOut(100); 2634 footerIsOpen = false; 2635 } 2636 2637 function toggleFooter(event) { 2638 event.stopPropagation(); 2639 2640 if (!footerIsOpen) { 2641 openFooter(); 2642 } else { 2643 closeFooter(); 2644 } 2645 } 2646 2647 $(document).on("click", ".footer-slide-out-content .footer-tab", toggleFooter); 2648 $(document).on("click", "#PopUpOverlay", closeFooter); 2649 2650 $(document).ready(function () { 2651 2652 $('.spa-sticky-header-footer #spaRemoveContentTarget #MasterMainContent').css({ 2653 top: $('.spa-sticky-header-footer #MasterHeaderContent .main-header').height() 2654 }) 2655 }); 2656}()); 2657 2658// Mailing address form 2659(function () { 2660 var userAddress1 = ""; 2661 var userAddress2 = ""; 2662 var userCity = ""; 2663 var userProv = ""; 2664 var userPC = ""; 2665 var mailingAddressIsOpen = false; 2666 2667 //Opening and showing form data 2668 function openMailingAddressPopup() { 2669 var result = $.get('../api/accounts/addresses/mailing') 2670 .done(function (data) { 2671 console.log(data); 2672 2673 //Setting the form values to be the data values 2674 if (data.Address1) { 2675 $(".mailing-address-container--address-one").val(data.Address1); 2676 } 2677 2678 if (data.Address2) { 2679 $(".mailing-address-container--address-two").val(data.Address2); 2680 } 2681 2682 if (data.City) { 2683 $(".mailing-address-container--city").val(data.City); 2684 } 2685 2686 if (data.Prov) { 2687 $(".mailing-address-container--province").val(data.Prov); 2688 } 2689 2690 if (data.PC) {
2691 $(".mailing-address-container--postal-code").val(data.PC); 2692 } 2693 2694 2695 $(".mailing-address-container").addClass("is-open"); 2696 $(".mailing-address-container").css({ 'display': 'flex'}); 2697 $(".PopUpOverlay").fadeIn(100); 2698 mailingAddressIsOpen = true; 2699 2700 $('.mailing-address-container').draggable({ handle: '.mailing-address-container--header' }); 2701 2702 }) 2703 .fail(function (data) { 2704 console.log(data); 2705 }); 2706 } 2707 2708 //Closing (hiding) the form 2709 function closeMailingAddressPopup() { 2710 $(".mailing-address-container").removeClass("is-open"); 2711 $(".mailing-address-container").css({ 'display': 'none' }); 2712 $(".PopUpOverlay").fadeOut(100); 2713 mailingAddressIsOpen = false; 2714 } 2715 2716 function toggleMailingAddress() { 2717 event.stopPropagation(); 2718 2719 if (!mailingAddressIsOpen) { 2720 openMailingAddressPopup(); 2721 } else { 2722 closeMailingAddressPopup(); 2723 } 2724 } 2725 2726 //Saving the form data 2727 function saveMailingAddressData() { 2728 var requestFormInputs = new Array(5); 2729 var formValid = true; 2730 2731 //Data Validation 2732 for (var i = 0; i < requestFormInputs.length; i++) { 2733 requestFormInputs[i] = true; 2734 } 2735 2736 //Address 1 2737 if (!$(".mailing-address-container--address-one").val()) { 2738 requestFormInputs[0] = false; 2739 $(".mailing-address-container--address-one").addClass('add-red-border'); 2740 $(".mailing-address-container--error-message-container").empty().append("Required field"); 2741 } else { 2742 requestFormInputs[0] = true; 2743 $(".mailing-address-container--address-one").removeClass('add-red-border'); 2744 } 2745 2746 //Address 2 accepts unit number (an optional property), so it's okay if it remains empty 2747 2748 //City 2749 if (!$(".mailing-address-container--city").val()) { 2750 requestFormInputs[2] = false; 2751 $(".mailing-address-container--city").addClass('add-red-border'); 2752 $(".mailing-address-container--error-message-container").empty().append("Required field"); 2753 } else { 2754 requestFormInputs[2] = true; 2755 $(".mailing-address-container--city").removeClass('add-red-border'); 2756 } 2757 2758 //Province/State 2759 if (!$(".mailing-address-container--province").val()) { 2760 requestFormInputs[3] = false; 2761 $(".mailing-address-container--province").addClass('add-red-border'); 2762 $(".mailing-address-container--error-message-container").empty().append("Required field"); 2763 } else { 2764 requestFormInputs[3] = true; 2765 $(".mailing-address-container--province").removeClass('add-red-border'); 2766 } 2767 //Postal Code 2768 if (!$(".mailing-address-container--postal-code").val()) { 2769 requestFormInputs[4] = false; 2770 $(".mailing-address-container--postal-code").addClass('add-red-border'); 2771 $(".mailing-address-container--error-message-container").empty().append("Required field"); 2772 } else { 2773 requestFormInputs[4] = true; 2774 $(".mailing-address-container--postal-code").removeClass('add-red-border'); 2775 } 2776 2777 //Check if all true 2778 if (requestFormInputs[0] && 2779 requestFormInputs[2] && 2780 requestFormInputs[3] && 2781 requestFormInputs[4]) { 2782 formValid == true; 2783 } 2784 2785 //Check if all false 2786 for (var j = 0; j < requestFormInputs.length; j++) { 2787 if (requestFormInputs[j] == false) { 2788 console.log("Error! Form Input ", j, " is empty."); 2789 formValid = false; 2790 } 2791 } 2792 2793 if (formValid == true) { 2794 userAddress1 = $(".mailing-address-container--address-one").val(); 2795 userAddress2 = $(".mailing-address-container--address-two").val(); 2796 userCity = $(".mailing-address-container--city").val(); 2797 userProv = $(".mailing-address-container--province").val();
2798 userPC = $(".mailing-address-container--postal-code").val(); 2799 2800 var result = $.post('../api/accounts/addresses/mailing', { 2801 Address1: userAddress1, 2802 Address2: userAddress2, 2803 City: userCity, 2804 Prov: userProv, 2805 PC: userPC 2806 }) 2807 .done(function (data) { 2808 console.log(data); 2809 }) 2810 .fail(function (data) { 2811 console.log(data); 2812 }); 2813 2814 closeMailingAddressPopup(); 2815 } 2816 } 2817 2818 $(document).on("click", ".main-header .user-bar-icon-holder .editMailingAddress", toggleMailingAddress); 2819 $(document).on("click", ".profile-mailing-address .editMailingAddress", toggleMailingAddress); 2820 $(document).on("click", ".PopUpOverlay", toggleMailingAddress); 2821 $(document).on("click", ".mailing-address-container--exit-button", toggleMailingAddress); 2822 $(document).on("click", ".mailing-address-container--save-button", saveMailingAddressData); 2823 2824 2825})(); 2826 2827 2828 2829$(document).ready(function () { 2830 var mainLinks = $('.main-nav-bar a.main-nav-link'), 2831 links = $('.main-nav-bar .nav-bar-drop-down ul li a'); 2832 2833 mainLinks.on('focus', function (event) { 2834 event.preventDefault(); 2835 closeDropDowns(); 2836 $(event.target).siblings('.nav-bar-drop-down').addClass('is-open'); 2837 }); 2838 2839 mainLinks.on('blur', closeDropDowns); 2840 2841 links.on('focus', function (event) { 2842 event.preventDefault(); 2843 closeDropDowns(); 2844 $(event.target).parents('.nav-bar-drop-down').addClass('is-open'); 2845 }); 2846 2847 $(document).keyup(function (e) { 2848 if (e.keyCode == 27) { // escape key maps to keycode `27` 2849 closeDropDowns(); 2850 } 2851 }); 2852 2853 $(document).click(closeDropDowns); 2854 2855 function closeDropDowns() { 2856 //mainLinks.removeClass('has-focus'); 2857 $('.nav-bar-drop-down').removeClass('is-open'); 2858 } 2859 2860}); 2861 2862 2863 2864///////////////////////////////////////////////////////////////////////////////// 2865//////////////////// Internal Communications //////
2865////////// 2866/////////////////////////////////////////////////////////////////////////////// 2867 2868$(document).ready(function () { 2869 2870 if ($(".InternalMessagingControlWrapper.InternalMessaging").length) { 2871 // Defer this method using setTimeout to allow other requests to get first in line. 2872 window.setTimeout(function () { 2873 2874 //var messagesAndNotificationsRequest = $.get('../api/HTMLInternalMessaging/'); 2875 2876 //messagesAndNotificationsRequest.success(function (result) { 2877 // $(".InternalMessagingControl_DropDownContent_Notifications").html(result.Notifications); 2878 // $(".InternalMessagingControl_DropDownContent_Messages").html(result.Messages); 2879 2880 // updateUnReadMessageCount(); 2881 // updateUnReadNotificationCount(); 2882 //}); 2883 2884 updateUnReadMessageCount(); 2885 updateUnReadNotificationCount(); 2886 2887 }, 50); 2888 } 2889 2890 var InternalMessagingDefaultTextAreaText; 2891 2892 var NotificationsPages = $(".NotificationsTablePage"); 2893 2894 function showPage(page) { 2895 NotificationsPages.hide(); 2896 $(".NotificationsTablePage[page=" + page + "]").show(); 2897 $("#NotificationsCurrentPage").html(page); 2898 $("#NotificationsTotalPages").html(NotificationsPages.length); 2899 if (page >= NotificationsPages.length) { 2900 next.hide(); 2901 } else if (page <= 1) { 2902 prev.hide(); 2903 } else { 2904 prev.show(); 2905 next.show(); 2906 } 2907 } 2908 2909 function updateUnReadMessageCount() { 2910 var unReadCount = $(".InternalMessagingControlWrapper .InternalMessaging_UnRead_Message").length; 2911 2912 if (unReadCount > 0) { 2913 $(".InternalMessagingControl_NewMessageCount").html(unReadCount); 2914 $(".InternalMessagingControl_NewMessageCount").show().addClass('is-with-notifications'); 2915 } else { 2916 $(".InternalMessagingControl_NewMessageCount").hide().removeClass('is-with-notifications'); 2917 } 2918 //$(".InternalMessagingControl_NewMessageCount").html(unReadCount != 0 ? unreadCount : ""); 2919 2920 } 2921 2922 function updateUnReadNotificationCount() { 2923 var unReadCount = $(".InternalMessagingControlWrapper .InternalMessaging_UnRead_Notification").length; 2924 2925 if (unReadCount > 0) { 2926 $(".InternalMessagingControl_NewNotificationCount").html(unReadCount); 2927 $(".InternalMessagingControl_NewNotificationCount").show().addClass('is-with-notifications'); 2928 } else { 2929 $(".InternalMessagingControl_NewNotificationCount").hide().removeClass('is-with-notifications'); 2930 } 2931 //$(".InternalMessagingControl_NewMessageCount").html(unReadCount != 0 ? unreadCount : ""); 2932 } 2933 2934 if (NotificationsPages.length > 0) { 2935 var page = 1; 2936 $("#NotificationsPagination").show(); 2937 var prev = $("#NotificationsPrevPage"); 2938 var next = $("#NotificationsNextPage"); 2939 prev.hide(); 2940 2941 showPage(page); 2942 2943 next.click(function () { 2944 page += 1 2945 showPage(page); 2946 }); 2947 2948 prev.click(function () { 2949 page -= 1 2950 showPage(page); 2951 }); 2952 } 2953 2954 $(document).on("click", ".InternalMessagingShowAllMessagesInThread", function (event) { 2955 event.preventDefault(); 2956 $(".InternalMessaging_ConversationSection").show(); 2957 $(this).hide(); 2958 }) 2959 2960 // CLOSE MESSAGE THREAD 2961 .on("click", ".InternalMessaging_MessageViewCloseBtn", function (ev) { 2962 2963 ev.preventDefault(); 2964 2965 rsBaseScripts.popupOverlay.hide(); 2966 $("#InternalMessaging_MessageView").hide().html(""); 2967 }) 2968 2969 // REPLY TO MESSAGE 2970 .on("click", ".InternalMessaging_MessageViewReplyBtn", function (event) { 2971 event.preventDefault(); 2972 2973 var href = $(this).attr("action"); 2974 2975 var validForm = true; 2976 var data = { 2977 msg: $(".InternalMessaging_ReplyTextArea")[0].value 2978 } 2979 2980 if (data.msg.length < 1 || data.msg == InternalMessagingDefaultTextAreaText) { 2981 validForm = false; 2982 } 2983 2984 function ajaxGood(a, b, c) { 2985 toggleSpinnerOverlay(false); 2986 2987 var alertIcon = "check"; 2988 var alertHeader = "Success"; 2989 var alertMessage = "Your message has been sent"; 2990 2991 if (typeof a === 'string' || a instanceof String) { 2992 if (a.split('~')[0] === 'Error') { 2993 alertIcon = 'error'; 2994 alertHeader = a.split('~')[1]; 2995 alertMessage = a.split('~')[2]; 2996 } 2997 } 2998 2999
3000 var fullConvoList = $($(a)[0]); 3001 var compactConvoList = $($(a)[1]); 3002 3003 var convoListOnPage = $("span[id$=InternalMessagingInboxDirectMessages]"); 3004 if (convoListOnPage.length > 0) { 3005 convoListOnPage.html(fullConvoList); 3006 } 3007 3008 var convoListControl = $(".InternalMessagingControl_DropDownContent_Messages"); 3009 if (convoListControl.length > 0) { 3010 convoListControl.html(compactConvoList); 3011 } 3012 3013 alertUser(translate(alertHeader), translate(alertMessage), alertIcon); 3014 rsBaseScripts.popupOverlay.hide(); 3015 $("#InternalMessaging_MessageView").hide().html(a); 3016 3017 // Defer this method using setTimeout to allow other requests to get first in line. 3018 window.setTimeout(function () { 3019 var messagesAndNotificationsRequest = $.get('../api/HTMLInternalMessaging/'); 3020 3021 messagesAndNotificationsRequest.success(function (result) { 3022 3023 $(".InternalMessagingControl_DropDownContent_Notifications").html(result.Notifications); 3024 $(".InternalMessagingControl_DropDownContent_Messages").html(result.Messages); 3025 3026 }); 3027 }, 50); 3028 3029 updateUnReadMessageCount(); 3030 updateUnReadNotificationCount(); 3031 } 3032 3033 function ajaxBad(a, b, c) { 3034 toggleSpinnerOverlay(false); 3035 alertUser("Error", "ajax call failed: " + b, "warning"); 3036 } 3037 3038 if (validForm) { 3039 toggleSpinnerOverlay(true); 3040 $.ajax({
3041 url: href, 3042 type: "POST", 3043 data: data, 3044 dataType: 'html', 3045 success: ajaxGood, 3046 error: ajaxBad 3047 }); 3048 } else { 3049 alertUser("Error", "Please enter a response.", "warning"); 3050 } 3051 3052 }) 3053 3054 // OPEN MESSAGE THREAD 3055 .on("click", ".InternalConversationOpenLink", function (event) { 3056 event.preventDefault(); 3057 $(window).scrollTop(0); 3058 3059 var href = $(this).attr("action"); 3060 3061 var clicked = $(this); 3062 function ajaxGood(a, b, c) { 3063 toggleSpinnerOverlay(false); 3064 //console.log(a); 3065 rsBaseScripts.popupOverlay.show(); 3066 a = $(a); 3067 $("#InternalMessaging_MessageView").show().html(a).removeClass("BigPanel"); 3068 InternalMessagingDefaultTextAreaText = $(".InternalMessaging_ReplyTextArea")[0].value; 3069 if (clicked.hasClass("InternalMessaging_UnRead_Message")) { 3070 clicked.removeClass("InternalMessaging_UnRead_Message"); 3071 clicked.addClass("InternalMessaging_Read_Message"); 3072 updateUnReadMessageCount(); 3073 } 3074 a.draggable(); 3075 } 3076 3077 function ajaxBad(a, b, c) { 3078 toggleSpinnerOverlay(false); 3079 alertUser(translate("Error"), translate("ajax call failed: ") + b, translate("warning")); 3080 } 3081 3082 toggleSpinnerOverlay(true); 3083 $.ajax({
3084 url: href, 3085 type: "POST", 3086 dataType: 'html', 3087 success: ajaxGood, 3088 error: ajaxBad 3089 }); 3090 }) 3091 3092 3093 // CHECK SEND MESSAGES TO EMAIL 3094 .on("click", ".InternalMessagingControl_SendCommunicationsToEmailCheckbox", function () { 3095 3096 var href = "../PublicAjax/InternalMessagesAjax.aspx?action=ChangeSendInternalCommunicationsPreference&SendInternalCommunications=" + $('.InternalMessagingControl_SendCommunicationsToEmailCheckbox').is(':checked');; 3097 3098 function ajaxGood(a, b, c) { } 3099 3100 function ajaxBad(a, b, c) { } 3101 3102 $.ajax({ 3103 url: href, 3104 type: "POST", 3105 dataType: 'html', 3106 success: ajaxGood, 3107 error: ajaxBad 3108 }); 3109 3110 3111 }) 3112 3113 3114 3115 // OPEN NOTIFICATION THREAD 3116 .on("click", ".InternalEmailItemOpenLink", function () { 3117 $(window).scrollTop(0); 3118 3119 var href = $(this).attr("action"); 3120 3121 var clicked = $(this); 3122 3123 function ajaxGood(a, b, c) { 3124 toggleSpinnerOverlay(false); 3125 //console.log(a); 3126 rsBaseScripts.popupOverlay.show(); 3127 3128 a = $(a); 3129 3130 $("#InternalMessaging_MessageView").show().html(a).addClass("BigPanel"); 3131 //InternalMessagingDefaultTextAreaText = $(".InternalMessaging_ReplyTextArea")[0].value; 3132 if (clicked.hasClass("InternalMessaging_UnRead_Notification")) { 3133 clicked.removeClass("InternalMessaging_UnRead_Notification"); 3134 clicked.addClass("InternalMessaging_Read_Notification"); 3135 updateUnReadNotificationCount(); 3136 } 3137 3138 a.draggable(); 3139 3140 } 3141 3142 function ajaxBad(a, b, c) { 3143 toggleSpinnerOverlay(false); 3144 alertUser(translate("Error"), translate("ajax call failed: ") + b, translate("warning")); 3145 } 3146 3147 toggleSpinnerOverlay(true); 3148 $.ajax({
3149 url: href, 3150 type: "POST", 3151 dataType: 'html', 3152 success: ajaxGood, 3153 error: ajaxBad 3154 }); 3155 3156 }) 3157 3158 .on("click", "#InternalMessagingControl_CloseBtn", function (ev) { 3159 ev.preventDefault(); 3160 3161 $(".InternalMessagingControl_MessagesTab").removeClass("open"); 3162 $(".InternalMessagingControl_NotificationsTab").removeClass("open"); 3163 $(".InternalMessagingControlWrapper").removeClass("open"); 3164 }) 3165 3166 3167 .on('click', function (ev) { 3168 var target = ev.target.selector; 3169 3170 if ($(ev.target).hasClass("InternalMessagingControl_MessagesTab") || $(ev.target).hasClass("InternalMessagingControl_NotificationsTab") || $(ev.target).hasClass("InternalMessagingControl_SendCommunicationsToEmailCheckboxArea") || $(ev.target).hasClass("InternalMessagingControl_SendCommunicationsToEmailCheckboxHolder")) { 3171 3172 } else { 3173 3174 $(".InternalMessagingControl_MessagesTab").removeClass("open"); 3175 $(".InternalMessagingControl_NotificationsTab").removeClass("open"); 3176 $(".InternalMessagingControlWrapper").removeClass("open"); 3177 } 3178 3179 }); 3180 3181 3182 function getUrlVars() { 3183 var vars = [], hash; 3184 var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); 3185 for (var i = 0; i < hashes.length; i++) { 3186 hash = hashes[i].split('='); 3187 vars.push(hash[0]); 3188 vars[hash[0]] = hash[1]; 3189 } 3190 return vars; 3191 } 3192 3193 3194 // this runs once the page is loaded 3195 $(document).on("ready", function () { 3196 3197 // get a deserialized object of the query params. 3198 // if our query string was ?ConvoUserIDNum=1234 3199 // our queryObj = { ConvoUserIDNum: '1234' } 3200 var queryObj = getUrlVars(); 3201 3202 //convo and convoajax are the exact same thing. Check both in case backend isn't consistent. Same thing for notif and notifajax 3203 if (queryObj.convoajax) { 3204 //if query param for covo id 3205 openConversation(queryObj.convoajax); 3206 } else if (queryObj.notifajax) { 3207 //if query param for email id 3208 openNotification(queryObj.notifajax); 3209 3210 } else if (queryObj.convo) { 3211 //if query param for covo id 3212 openConversation(queryObj.convo); 3213 } else if (queryObj.notif) { 3214 //if query param for email id 3215 openNotification(queryObj.notif); 3216 } 3217 3218 }); 3219 3220 3221 function openConversation(EncryptedQuery) { 3222 $(window).scrollTop(0); 3223 3224 var href = '../PublicAjax/InternalMessagesAjax.aspx?action=OpenConversation&convoajax=' + EncryptedQuery; 3225 3226 function ajaxGood(a, b, c) { 3227 toggleSpinnerOverlay(false); 3228 //console.log(a); 3229 rsBaseScripts.popupOverlay.show(); 3230 a = $(a); 3231 $("#InternalMessaging_MessageView").show().html(a).removeClass("BigPanel"); 3232 InternalMessagingDefaultTextAreaText = $(".InternalMessaging_ReplyTextArea")[0].value; 3233 a.draggable(); 3234 } 3235 3236 function ajaxBad(a, b, c) { 3237 toggleSpinnerOverlay(false); 3238 alertUser(translate("Error"), translate("ajax call failed: ") + b, translate("warning")); 3239 } 3240 3241 toggleSpinnerOverlay(true); 3242 $.ajax({
3243 url: href, 3244 type: "POST", 3245 dataType: 'html', 3246 success: ajaxGood, 3247 error: ajaxBad 3248 }); 3249 3250 } 3251 3252 function openNotification(EncryptedQuery) { 3253 $(window).scrollTop(0); 3254 3255 var href = '../PublicAjax/InternalMessagesAjax.aspx?action=OpenNotification¬ifajax=' + EncryptedQuery; 3256 3257 function ajaxGood(a, b, c) { 3258 toggleSpinnerOverlay(false); 3259 //console.log(a); 3260 rsBaseScripts.popupOverlay.show(); 3261 3262 a = $(a); 3263 3264 $("#InternalMessaging_MessageView").show().html(a).addClass("BigPanel"); 3265 //InternalMessagingDefaultTextAreaText = $(".InternalMessaging_ReplyTextArea")[0].value; 3266 a.draggable(); 3267 3268 } 3269 3270 function ajaxBad(a, b, c) { 3271 toggleSpinnerOverlay(false); 3272 alertUser(translate("Error"), translate("ajax call failed: ") + b, translate("warning")); 3273 } 3274 3275 toggleSpinnerOverlay(true); 3276 $.ajax({ 3277 url: href, 3278 type: "POST", 3279 dataType: 'html', 3280 success: ajaxGood, 3281 error: ajaxBad 3282 }); 3283 3284 } 3285 3286 function hideDropdownContentOnNextClick() { 3287 3288 function hideDropdownContent(event) { 3289 var $offsetParent = $(event.target.offsetParent); 3290 if ($offsetParent.hasClass('InternalMessagingControl_DropDownContent')) { 3291 // This click originated inside the dropdown. Don't do anything. 3292 return; 3293 } 3294 event.preventDefault(); 3295 $(".InternalMessagingControl_DropDownContent").hide(); 3296 $(document).off('click', ':not(.InternalMessagingControl_DropDownContent)', hideDropdownContent); 3297 } 3298 3299 $(document).on('click', ':not(.InternalMessagingControl_DropDownContent)', hideDropdownContent); 3300 } 3301 3302 $(".InternalMessagingControl_MessagesTab").click(function (ev) { 3303 ev.preventDefault(); 3304 3305 var wrapper = $(".InternalMessagingControlWrapper"); 3306 3307 $(".InternalMessagingControl_SendCommunicationsToEmailCheckboxHolder").show(); 3308 3309 if ($(this).hasClass("open")) { 3310 $(this).removeClass("open"); 3311 $(".InternalMessagingControl_NotificationsTab").removeClass("open"); 3312 $(".InternalMessagingControl_DropDownContent").hide(); 3313 wrapper.removeClass("open"); 3314 } else { 3315 $(".InternalMessagingControl_NotificationsTab").removeClass("open"); 3316 $(this).addClass("open"); 3317 wrapper.addClass("open"); 3318 setTimeout(function () { 3319 $(".InternalMessagingControl_DropDownContent_Notifications").hide(); 3320 $(".InternalMessagingControl_DropDownContent_Messages").show(); 3321 $(".InternalMessagingControl_DropDownContent").show(); 3322 hideDropdownContentOnNextClick(); 3323 }); 3324 } 3325 3326 }); 3327 3328 3329 3330 3331 $(".InternalMessagingControl_NotificationsTab").click(function (ev) { 3332 ev.preventDefault(); 3333 var wrapper = $(".InternalMessagingControlWrapper"); 3334 3335 var main = this; 3336 3337 var href = '../PublicAjax/InternalMessagesAjax.aspx?action=ClearNotifications'; 3338 3339 $(".InternalMessagingControl_SendCommunicationsToEmailCheckboxHolder").hide(); 3340 3341 if ($(this).hasClass("open")) { 3342 $(this).removeClass("open"); 3343 $(".InternalMessagingControl_MessagesTab").removeClass("open"); 3344 $(".InternalMessagingControl_DropDownContent").hide(); 3345 wrapper.removeClass("open"); 3346 } else { 3347 $(".InternalMessagingControl_MessagesTab").removeClass("open"); 3348 $(this).addClass("open"); 3349 wrapper.addClass("open"); 3350 setTimeout(function () { 3351 $(".InternalMessagingControl_DropDownContent_Messages").hide(); 3352 $(".InternalMessagingControl_DropDownContent_Notifications").show(); 3353 $(".InternalMessagingControl_DropDownContent").show(); 3354 3355 hideDropdownContentOnNextClick(); 3356 });
3357 //ajax to set all messages to read. 3358 3359 function ajaxGood(a, b, c) { 3360 $(".InternalMessagingControl_NewNotificationCount").hide(); 3361 3362 } 3363 3364 function ajaxBad(a, b, c) { 3365 3366 } 3367 3368 $.ajax({ 3369 url: href, 3370 type: "POST", 3371 dataType: 'html', 3372 success: ajaxGood, 3373 error: ajaxBad 3374 }); 3375 3376 } 3377 3378 }); 3379 3380 3381}); 3382///////////////////////////////////////////////////////////////////////////////// 3383//////////////////// END Internal Communications //////////////// 3384/////////////////////////////////////////////////////////////////////////////// 3385 3386 3387
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.