1 /* Start of definition of the adobe analytics variable, "digitalData" .*/
2 var wcaUser = "false",menuClicked;
3 var digitalData=digitalData||{};
38 /* End of definition of the adobe analytics variable, "digitalData" .*/
40 /* Self-Invoking Anonymous Function to run on every load of the header content. */
43 /* Variables to hold the header data retrieved from the database. */
44 var headerData, secMenuData, megaMenuData ;
48 var checkSessionIntervalMins = 29;
49 var bdSessionTimeout = 60;
51 loadJSWithCallBack = function(src, callback) {
52 if ($('script[src*="'+src+'"]').length === 0) {
54 .done(function( script, textStatus ) {
57 .fail(function( jqxhr, settings, exception ) {
58 //console.log("file not loaded " + src);
61 /* Script loaded already*/
66 var headerFunction = function() {
67 this.getHeaderData = function() {
72 url: window.dashboardContext + "/mnm/map/common/dashboardNavigation.jsp",
73 success: function(data) {
77 /* Generating the html for the primary menu using handlebars. */
78 /* var primaryMenuTmpl = Handlebars.compile($("#primaryMenu_tmpl").html()),
79 primaryMenuHtml = primaryMenuTmpl(data);
80 $(".primaryMenuOptionsContainer").removeClass('primaryMenuOption');
81 $('.primaryMenuOption').replaceWith('');
82 $(".primaryMenuOptionsContainer").append(primaryMenuHtml);
83 var dataForNavigation = {};
84 if (window.location.hash) {
85 dataForNavigation.pageUrl = window.location.pathname + "?" + window.location.hash;
87 dataForNavigation.pageUrl = window.location.pathname;
90 /* Ajax call to get the name of the home page from the DB based on the current url. */
94 data: dataForNavigation,
95 url: window.dashboardContext + "/mnm/map/common/navigationParent.jsp",
96 headers: {"X-CSRF-Token":window.softToken},
97 success: function(data) {
99 homePageNameInfo = data;
100 $(".pageNameContainer .pageName").html(data.name);
102 $.each(headerData.childNavigation, function(dataIndex, primaryMenuData) {
104 $.each(primaryMenuData.childNavigation, function(dataIndex, secondaryMenuData) {
106 if (secondaryMenuData.name == homePageNameInfo.name) {
108 $(".pageName").attr("href", secondaryMenuData.url);
116 showSecondaryMenu(homePageNameInfo);
120 //console.log("Error Response From Service");
126 //console.log("Error Response From Service");
131 primaryMenuItemClick = function(primaryMenuLinkObj) {
133 var $this = $(primaryMenuLinkObj);
135 /* $('.categoryContainerColumn').remove();*/
136 $('.megaMenuContainer').scrollTop(0);
137 $('.megaMenuContainer').hide();
138 $(".selectionDiv").hide();
139 $('.secondaryMenuOptionLink').removeClass('selectedSecondaryMenuOption');
140 $('.thirdMenuOptionLink').removeClass('selectedSecondaryMenuOption');
142 /* Arrow left position calculation. */
144 var elementLeft = $this.position().left,
145 elementWidth = $this.width(),
146 centerValue = elementLeft + 24 + (elementWidth) / 2;
147 $('.selectedOptionIndicator').css('left', centerValue);
148 $('.selectedOptionIndicator').show(); //Added By Robert 6/9/15
149 // when clicked on Support link
150 if ($this.text() === 'Support') {
151 return populateSecondaryMenu(primaryMenuLinkObj, getSupportLinkData());
158 contentType :'application/json',
159 //url: window.dashboardContext + "/navigation/gadgets/megaMenuNavigation.jsp?megaMenu="+escape($this.text()).toUpperCase(),
160 url: window.ebizDashboardContext + "/navigation/"+escape($this.text()),
161 //headers: {"X-CSRF-Token":window.softToken},
162 success: function(data) {
163 populateSecondaryMenu(primaryMenuLinkObj, data);
165 complete : function() {
168 if (typeof console == 'object') {
169 console.log("Error Response From Service");
175 populateSecondaryMenu = function(primaryMenuLinkObj, data) {
176 //primary menu link object
177 var $this = $(primaryMenuLinkObj);
182 if (data.childNavigation.length != 0) {
183 $.each(data.childNavigation, function(dataIndex, childNavigation) {
184 if(childNavigation == null){
185 childNavigation = {};
186 secondaryMenuTmpl = Handlebars.compile($("#secondaryMenu_tmpl").html()),
187 secondaryMenuHtml = secondaryMenuTmpl(childNavigation);
188 $('.secondaryMenuOption').remove();
189 $(".secondaryMenuContentContainer").append(secondaryMenuHtml);
191 secMenuData = childNavigation.childNavigation;
193 var noOfCols = childNavigation.childNavigation.length,
194 secondaryMenuTmpl = Handlebars.compile($("#secondaryMenu_tmpl").html()),
195 secondaryMenuHtml = secondaryMenuTmpl(childNavigation);
197 $('.secondaryMenuOption').remove();
198 $(".secondaryMenuContentContainer").append(secondaryMenuHtml);
201 $('.secondaryMenuOption').css('margin-left', 40);
202 } else if (noOfCols == 6) {
203 $('.secondaryMenuOption').css('margin-left', 30);
204 } else if (noOfCols > 6 && noOfCols < 9) {
205 $('.secondaryMenuOption').css('margin-left', 20);
208 $('.selectedOptionIndicator').show();
210 if (window.location.pathname == window.ebizDashboardContext + "/index.jsp") {
211 $('.secondaryMenuContainerForDashboard').show();
212 } else if (window.location.pathname.indexOf('login') > 0) {
213 $('.secondaryMenuContainerForApplication').show();
215 $(".secondaryMenuContainerForApplication").show();
216 /*if(!($('.switch-message-div').is(':visible'))){
217 $('.secondaryMenuContainer').css("margin-top", 50);
220 $('.primaryMenuOptionLink').removeClass('selectedPrimaryMenuOption');
221 $this.addClass("selectedPrimaryMenuOption");
222 var currentUrl = window.location.href;
223 if(currentUrl != null){
224 var emaintenanceMatch = currentUrl.search('emaintenance');
225 if(emaintenanceMatch >= 0){
226 $(".pageNameContainer .pageName").html("Network");
231 $('.selectedOptionIndicator').hide();
232 $('.secondaryMenuContainer').hide();
233 $('.secondaryMenuOption').remove();
234 $('.primaryMenuOptionLink').removeClass('selectedPrimaryMenuOption');
240 if($(".switch-message-div").is(':visible')){
241 $(".dashboardHeadTitle").css("margin-top","60px");
242 $(".dashboardHeadIcons").css("top","127px");
243 $("#openWalkThrough").css("margin-top","40px");
244 $(".dashboardHeadWhiteOverlay").css("margin-top", "36px");
245 $("#dashBoardContainer").css("margin-top", "43px");
248 if(!($('.switch-message-div').is(':visible'))){
249 $(".dashboardHeadWhiteOverlay").css("margin-top", 0);
250 $(".dashboardHeadTitle").css("margin-top","30px");
251 $(".dashboardHeadIcons").css("top","90px");
252 $("#openWalkThrough").css("margin-top","0px");
253 $("#dashBoardContainer").css("margin-top", "4px");
256 getSupportLinkData = function() {
258 "name": "ESTRATEGY_NAVIGATION",
267 "name": "User Information",
268 "url": "/ebiz/ebcsupport/eBCSupport.jsp?module_id=profileInfo",
269 "childNavigation": []
272 "name": "Registration and Login",
273 "url": "/ebiz/ebcsupport/eBCSupport.jsp?module_id=registration",
274 "childNavigation": []
278 "url": "/ebiz/ebcsupport/eBCSupport.jsp?module_id=order",
279 "childNavigation": []
283 "url": "/ebiz/ebcsupport/eBCSupport.jsp?module_id=billing",
284 "childNavigation": []
288 "url": "/ebiz/ebcsupport/eBCSupport.jsp?module_id=networkInfo",
289 "childNavigation": []
293 "url": "/ebiz/ebcsupport/eBCSupport.jsp?module_id=reporting",
294 "childNavigation": []
297 "urlWithTitle": null,
301 "urlWithTitle": null,
307 highlightHomePageNameInSecMenu = function(secondaryMenuItemObj) {
309 var $this = $(secondaryMenuItemObj);
311 $this.parents(".secondaryMenuOption").find(".selectionDiv").show();
312 $this.addClass('homePageNameHighlight');
315 showSecondaryMenu = function(homePageNameInfo) {
318 if (headerData && headerData.childNavigation) {
319 $.each(headerData.childNavigation, function(dataIndex, primaryMenuData) {
321 primaryMenuItemToClick = primaryMenuData.name;
322 $.each(primaryMenuData.childNavigation, function(dataIndex, secondaryMenuData) {
324 if (secondaryMenuData.name == homePageNameInfo.name) {
326 $.each($('.primaryMenuOptionLink'), function(i, val) {
330 if ($this.html() == primaryMenuItemToClick) {
332 primaryMenuItemClick($this);
336 $.each($('.secondaryMenuOptionLink'), function(i, val) {
340 if ($.trim($this.html().split("<")[0]) == secondaryMenuData.name) {
342 highlightHomePageNameInSecMenu($this);
345 $.each($('.thirdMenuOptionLink'), function(i, val) {
349 if ($.trim($this.html().split("<")[0]) == secondaryMenuData.name) {
351 highlightHomePageNameInSecMenu($this);
364 secondaryMenuItemHover = function(secondaryMenuItemObj) {
366 var $this = $(secondaryMenuItemObj);
368 $(".selectionDiv").hide();
369 $('.secondaryMenuOptionLink').removeClass('selectedSecondaryMenuOption');
370 $('.thirdMenuOptionLink').removeClass('selectedSecondaryMenuOption');
372 if ($this.hasClass("pageName")) {
373 $.each(headerData.childNavigation, function(dataIndex, childNavigation) {
374 var child1 = childNavigation.childNavigation;
375 $.each(child1, function(dataIndex, childNavigation) {
376 if (childNavigation.name === $.trim($this.html())) {
377 if (childNavigation.childNavigation.length != 0) {
378 secMenuData = child1;
383 $(".megaMenuContainer").addClass("addMargin");
385 $(".megaMenuContainer").removeClass("addMargin");
388 $('.categoryContainerColumn').remove();
389 $.each(secMenuData, function(dataIndex, childNavigation) {
391 if (childNavigation.name == $.trim($this.html().split("<")[0])) {
392 Generating the html for the secondary menu.
394 if (childNavigation.childNavigation.length != 0) {
396 megaMenuData = childNavigation.childNavigation;
397 var megaMenuFirstRowData = {},
398 megaMenuSecondRowData = {},
399 firstRowDataIndex = 0,
400 secondRowDataIndex = 0;
402 megaMenuFirstRowData.childNavigation = {};
403 megaMenuSecondRowData.childNavigation = {};
405 $.each(childNavigation.childNavigation, function(dataIndex, columnInfo) {
408 megaMenuFirstRowData.childNavigation[firstRowDataIndex++] = columnInfo;
409 } else if (dataIndex > 5 && dataIndex < 12) {
410 megaMenuSecondRowData.childNavigation[secondRowDataIndex++] = columnInfo;
415 var megaMenuTmpl = Handlebars.compile($("#megaMenu_tmpl").html()),
416 megaMenuFirstRowHtml = megaMenuTmpl(megaMenuFirstRowData);
418 $(".megaMenuFirstRow").append(megaMenuFirstRowHtml);
420 if (megaMenuData.length > 6) {
422 var megaMenuSecondRowHtml = megaMenuTmpl(megaMenuSecondRowData);
423 $(".megaMenuSecondRow").append(megaMenuSecondRowHtml);
424 $(".megaMenuSecondRow").show();
427 $('.megaMenuContainer').show();
428 $this.find(".selectionDiv").show();
429 $this.addClass('selectedSecondaryMenuOption');
431 /* Width and margin assignments for each column (6 columns max in a row) in the mega menu. */
432 /* switch (megaMenuData.length) {
436 $('.categoryContainer').css('margin-left', '30px');
437 $('.categoryContainer').width(300);
442 $('.categoryContainer').css('margin-left', '20px');
443 $('.categoryContainer').width(300);
448 $('.categoryContainer').css('margin-left', '20px');
449 $('.categoryContainer').width(293);
454 $('.categoryContainer').css('margin-left', '20px');
455 $('.categoryContainer').width(215);
460 $('.categoryContainer').css('margin-left', '10px');
461 $('.categoryContainer').width(175);
471 $('.categoryContainer').css('margin-left', '10px');
472 $('.categoryContainer').width(145);
476 $('.categoryContainer').css('margin-left', '10px');
477 $('.categoryContainer').width(145);
481 $('.megaMenuFirstRow .categoryContainer:first').css('margin-left', '30px');
482 $('.megaMenuSecondRow .categoryContainer:first').css('margin-left', '30px');
486 $('.megaMenuContainer').scrollTop(0);
487 $('.megaMenuContainer').hide();
488 $(".selectionDiv").hide();
489 $('.secondaryMenuOptionLink').removeClass('selectedSecondaryMenuOption');
495 /* Loading handlebars.js if it isn't already. */
496 /*if (userLoggedIn) {
497 Generating the html for the primary menu using handlebars.
498 var primaryMenuNames = {"childNavigation": [{"name" : "Manage"},{"name" : "Tools"},{"name" : "Support"}]};
500 var primaryMenuTmpl = Handlebars.compile($("#primaryMenu_tmpl").html());
501 primaryMenuHtml = primaryMenuTmpl(primaryMenuNames);
503 $(".primaryMenuOptionsContainer").removeClass('primaryMenuOption');
504 $('.primaryMenuOption').replaceWith('');
505 $(".primaryMenuOptionsContainer").append(primaryMenuHtml);
506 var dataForNavigation = {};
507 if (window.location.hash) {
508 dataForNavigation.pageUrl = window.location.pathname + "?" + window.location.hash;
510 dataForNavigation.pageUrl = window.location.pathname;
514 /* On click of any primary menu option, display the corresponding secondary menu. */
515 $(document).on('click keyup', '.primaryMenuOptionLink', function(ev) {
516 if (ev.keyCode==13 || ev.type=='click') {
517 ev.stopImmediatePropagation();
518 primaryMenuItemClick($(this));
520 if (homePageNameInfo) {
522 $.each($('.secondaryMenuOptionLink'), function() {
526 if ($.trim($this.html().split("<")[0]) == homePageNameInfo.name) {
528 highlightHomePageNameInSecMenu($this);
531 $.each($('.thirdMenuOptionLink'), function() {
535 if ($.trim($this.html().split("<")[0]) == homePageNameInfo.name) {
537 highlightHomePageNameInSecMenu($this);
546 /* Code related to the CATO compliance for navigation through key board */
547 // tab-out of a primaryLink in expanded mode
548 $(document).on('keydown', '.primaryMenuOptionLink', function(e) {
549 var keyCode = e.keyCode || e.which;
550 // when shift tab pressed retain default behaviour
551 if (e.shiftKey && e.keyCode == 9) {
556 if (keyCode == 40) { //down arrow : focus on the first secondary menu link
557 $('.secondaryMenuContentContainer a.secondaryMenuOptionLink:first').focus();
558 $('.secondaryMenuContentContainer a.thirdMenuOptionLink:first').focus();
561 if (keyCode == 9 || keyCode == 39) { //tab or right arrow
562 if ($(this).parent().next().length) { //next primary link
563 $(this).parent().next().find("a.primaryMenuOptionLink").focus();
565 $(".openpopbox").focus(); //traverse to login icon
569 if (keyCode == 37) { //left arrow
570 if ($(this).parent().prev().length) { //next primary link
571 $(this).parent().prev().find("a.primaryMenuOptionLink").focus();
577 //tab-out of a secondary in expanded mode
578 $(document).on('keydown', '.secondaryMenuOptionLink', function(e) {
579 var keyCode = e.keyCode || e.which;
582 window.location = $(this).attr('href');
586 if (keyCode == 40) { //down arrow : focus on the first mega menu link
587 $('.megaMenuContainer a.categoryOptionLink:first').focus();
590 if (keyCode == 38) {// up arrow: traverse to current primary link
591 $(getSelectedPrimaryMenuOption()).find("a.primaryMenuOptionLink").focus();
594 if (keyCode == 9 || keyCode == 39) { //tab or right arrow
595 if($(this).parent().next().length) { // traverse to next secondary link if exists
596 $(this).parent().next().find("a.secondaryMenuOptionLink").focus();
597 } else { //traverse to next primary link
598 $(getSelectedPrimaryMenuOption()).next().find("a.primaryMenuOptionLink").focus();
602 if (keyCode == 37) {// left arrow:
603 if ($(this).parent().prev().length) { // traverse to previous link if exists
604 $(this).parent().prev().find("a.secondaryMenuOptionLink").focus();
605 } else { // traverse to current primary link
606 $(getSelectedPrimaryMenuOption()).find("a.primaryMenuOptionLink").focus();
611 $(document).on('keydown', '.thirdMenuOptionLink', function(e) {
612 var keyCode = e.keyCode || e.which;
615 window.location = $(this).attr('href');
619 if (keyCode == 40) { //down arrow : focus on the first mega menu link
620 $('.megaMenuContainer a.categoryOptionLink:first').focus();
623 if (keyCode == 38) {// up arrow: traverse to current primary link
624 $(getSelectedPrimaryMenuOption()).find("a.primaryMenuOptionLink").focus();
627 if (keyCode == 9 || keyCode == 39) { //tab or right arrow
628 if($(this).parent().next().length) { // traverse to next secondary link if exists
629 $(this).parent().next().find("a.thirdMenuOptionLink").focus();
630 } else { //traverse to next primary link
631 $(getSelectedPrimaryMenuOption()).next().find("a.primaryMenuOptionLink").focus();
635 if (keyCode == 37) {// left arrow:
636 if ($(this).parent().prev().length) { // traverse to previous link if exists
637 $(this).parent().prev().find("a.thirdMenuOptionLink").focus();
638 } else { // traverse to current primary link
639 $(getSelectedPrimaryMenuOption()).find("a.primaryMenuOptionLink").focus();
643 //tab-out of a categoryOptionLink
644 $(document).on('keydown', '.categoryOptionLink', function(e) {
645 var keyCode = e.keyCode || e.which;
648 window.location = $(this).attr('href');
649 menuClicked = $(this).attr('href');
654 if (keyCode == 39) { // right arrow
655 $(this).parent().parent().parent().next().find("a.categoryOptionLink:first").focus();
656 } else if(keyCode == 37) { //left arrow
657 $(this).parent().parent().parent().prev().find("a.categoryOptionLink:first").focus();
658 } else if(keyCode == 38) { //up arrow
659 if($(this).parent().prev(".categoryOption").length) {
660 $(this).parent().prev(".categoryOption").find("a.categoryOptionLink").focus();
662 if ($(this).parent().parent().parent().prev().length) { //traverse to prev category column if exists
663 $(this).parent().parent().parent().prev().find("a.categoryOptionLink:last").focus();
664 } else { //traverse to current secondary column
665 $(getSelectedSecondaryMenuOption()).find("a.secondaryMenuOptionLink").focus();
666 $(getSelectedSecondaryMenuOption()).find("a.thirdMenuOptionLink").focus();
670 } else if(keyCode == 40) { //down arrow
671 if ($(this).parent().next(".categoryOption").length) {
672 $(this).parent().next(".categoryOption").find("a.categoryOptionLink").focus();
674 if ($(this).parent().parent().parent().next().length) { //traverse to next category column if exists
675 $(this).parent().parent().parent().next().find("a.categoryOptionLink:first").focus();
676 } else { //traverse to next secondary link
677 $(getSelectedSecondaryMenuOption()).next().find("a.secondaryMenuOptionLink").focus();
678 $(getSelectedSecondaryMenuOption()).next().find("a.thirdMenuOptionLink").focus();
686 //get selected primary menu option
687 function getSelectedPrimaryMenuOption() {
689 $.each($(".primaryMenuContainer .primaryMenuOption"), function(index, value) {
690 var primaryLink = $(this).find("a.primaryMenuOptionLink");
691 if ($(primaryLink).hasClass("selectedPrimaryMenuOption")) {
698 //get selected secondary menu option
699 function getSelectedSecondaryMenuOption() {
701 $.each($(".secondaryMenuContentContainer .secondaryMenuOption"), function(index, value) {
702 if( $(this).find("div.selectionDiv") != null && $(this).find("div.selectionDiv").is(':visible')) {
709 /* End of Code related to the CATO compliance for navigation through key board */
711 /* On click of home page name in the primary menu (available on scroll). */
712 $(document).on('click', '.pageName', function(ev) {
714 window.scrollTo(0, 0);
717 $(".headerContentContainer").on("mouseenter", function() {
719 /* $('.categoryContainerColumn').remove();*/
720 $('.megaMenuContainer').scrollTop(0);
721 $('.megaMenuContainer').hide();
722 $(".selectionDiv").hide();
723 $('.secondaryMenuOptionLink').removeClass('selectedSecondaryMenuOption');
724 $('.thirdMenuOptionLink').removeClass('selectedSecondaryMenuOption');
726 if (homePageNameInfo) {
728 $.each($('.secondaryMenuOptionLink'), function() {
732 if ($this.hasClass("homePageNameHighlight")) {
734 highlightHomePageNameInSecMenu($this);
739 if (homePageNameInfo) {
741 $.each($('.thirdMenuOptionLink'), function() {
745 if ($this.hasClass("homePageNameHighlight")) {
747 highlightHomePageNameInSecMenu($this);
754 /* On click of any secondary menu option. */
755 $(document).on('click keyup', '.secondaryMenuOptionLink', function(ev) {
756 if (ev.keyCode==13 || ev.type=='click') {
758 if (homePageNameInfo) {
759 if ($.trim($this.html().split("<")[0]) != homePageNameInfo.name) {
760 $this.parents(".secondaryMenuOption").find(".selectionDiv").hide();
761 $this.removeClass('selectedSecondaryMenuOption');
767 $(document).on('click keyup', '.thirdMenuOptionLink', function(ev) {
768 if (ev.keyCode==13 || ev.type=='click') {
770 if (homePageNameInfo) {
771 if ($.trim($this.html().split("<")[0]) != homePageNameInfo.name) {
772 $this.parents(".secondaryMenuOption").find(".selectionDiv").hide();
773 $this.removeClass('selectedSecondaryMenuOption');
781 /* On click of any bdLink create Session. */
782 $(document).on('click','.bdLink', function(ev){
784 var attr = $this.attr('href');
786 if (typeof attr !== typeof undefined && attr !== false) {
787 BdNotify.createSessionForBDLinks(ev, $this.attr("href"));
792 /* getProfileData = function(){
796 url: window.dashboardContext + "",
797 success: function (data) {
799 loginId = data.profileData.repositoryId;
800 digitalData.user[0].profile[0].profileInfo.profileID = "";
801 digitalData.user[0].profile[0].attributes.profileRole = data.profileData.userRole;
805 console.log("error");
810 // BD Tools Menu changes
813 /* getProfileData = function(){
817 url: window.dashboardContext + "",
818 success: function (data) {
820 loginId = data.profileData.repositoryId;
824 if (typeof console == 'object') {
825 console.log("error");
835 createSessionForBDLinks : function(ev, urlOpen) {
840 headers: {"authSecurityToken" : window.authSecurityToken},
841 url: window.ebizDashboardContext +'/bd/createSession',
842 contentType: "application/json; charset=utf-8",
843 Accept: "application/json",
845 success : function(response){
846 var sessionResponse = eval(response);
850 if(sessionResponse.sessionId != null && null != sessionResponse.sessionPwd && null != sessionResponse.bdProfileId){
851 tid = sessionResponse.sessionId + ":" + sessionResponse.sessionPwd+ ":"+sessionResponse.bdProfileId;
854 if(null != sessionResponse.acssipAddress && null != sessionResponse.accexpires && null != sessionResponse.acsshash && null !=sessionResponse.acssuser && null != sessionResponse.acsstime ){
855 acss = "ip&"+sessionResponse.acssipAddress+ "&expires&"+sessionResponse.acssexpires+"&hash&"+sessionResponse.acsshash+"&user&"+sessionResponse.acssuser+"&time&"+sessionResponse.acsstime;
857 if(null != sessionResponse.weigsIpAddress && null != sessionResponse.weigsExpires && null != sessionResponse.weigsHash && null != sessionResponse.weigsUser && null != sessionResponse.weigsTime){
858 weigs = "ip&"+sessionResponse.weigsIpAddress+ "&expires&"+sessionResponse.weigsExpires+"&hash&"+sessionResponse.weigsHash+"&user&"+sessionResponse.weigsUser+"&time&"+sessionResponse.weigsTime;
863 document.cookie = "ECCUser="+tid+"; path=/; domain=.att.com";
866 document.cookie = "ACSS_LOGIN="+acss+"; path=/; domain=.att.com";
869 document.cookie = "WEIGS="+weigs+"; path=/; domain=.att.com";
874 document.cookie = "BDTimeOutEnabled=Y; path=/; domain=.att.com";
876 bdSessionId=sessionResponse.sessionId;
877 bdToolsWindow = window.open(urlOpen,'BDApplication','left=0,top=0,width=900,height=300,status=0,resizable=1,scrollbars=1');
879 // TODO: fix the session timeout and the session check
880 setTimeout(BdNotify.checkBDTimeoutAndExtendSession, 1000*60*checkSessionIntervalMins);
885 checkBDTimeoutAndExtendSession : function(){
886 if(bdToolsWindow!=null && !bdToolsWindow.closed){
887 //console.log("TimeOut***************************"+ bdSessionId);
891 // url: '/rest/model/com/att/b2b/ebcare/rest/actorchain/EBizCareServiceActor/terminateSession?userId='+loginId+'&bdSessionId='+ bdSessionId,
892 url: window.ebizDashboardContext +'/bd/'+bdSessionId+'/checkSession',
894 success : function(response){
895 var sessionResponse = eval(response);
896 if(sessionResponse>=0){
898 if(sessionResponse >= bdSessionTimeout ) {
900 terminateBDSession();
902 // TODO: return timeToExpire from controller
903 // var timeToExpire = sessionResponse.BD_TIMEOUT - sessionResponse.LAST_ACCESS_BD_TIME;
904 //Set Timeout to call same function again after 25 mins
905 setTimeout(BdNotify.checkBDTimeoutAndExtendSession, 1000*60*checkSessionIntervalMins);
917 //End of BD Tools menu changes
920 /* Click event for the links provided in the mega menu. */
921 $(document).on('click','.categoryOptionLink',function(ev){
922 $('.megaMenuContainer').scrollTop(0);
923 $('.megaMenuContainer').hide();
924 window.scrollTo(0, 0);
927 $(document).on('click', '.secondaryMenuContainer', function(ev) {
929 $('.megaMenuContainer').scrollTop(0);
930 $('.megaMenuContainer').hide();
933 /* Display Mega menu on hovering over any of the secondary menu links. */
934 $(document).on('touchstart mouseenter focus', '.secondaryMenuOptionLink, .pageName', function(ev) {
935 editHeaderMenuForBilling($(this));
936 secondaryMenuItemHover($(this));
938 /* Function to handle Menu's on CFD Billing Iframe Pages */
942 $(document).on('touchstart mouseenter focus', '.thirdMenuOptionLink, .pageName', function(ev) {
943 editHeaderMenuForBilling($(this));
944 secondaryMenuItemHover($(this));
946 /* Function to handle Menu's on CFD Billing Iframe Pages */
950 function editHeaderMenuForBilling(Obj) {
951 var url = window.location.pathname;
954 //If it is CFD Billing Iframe Page
955 if (url == "/ebiz/billing/iframe.jsp" && $.trim($this.html().split("<")[0]) == "Billing") {
956 var currentHeaderData = headerData;
957 var errorPage = "/ebiz/billing/error.jsp";
958 var iframeSrc = $("#CFDIframe").attr('src');
959 if (iframeSrc != errorPage) {
960 var MenuArea = $("#CFDIframe").contents().find('.hideMenuArea');
961 if (MenuArea.length != 0) {
962 var MenuHtml = MenuArea.html();
963 var payment_array = [];
964 var report_array = [];
966 var paymentUrls = ["ImplCleanPaymentHistoryAction", "ImplOTPaymentContextSelectAction", "ImplRECPaymentContextSelectAction"];
967 var reportUrls = ["ImplPreLoadFFReportListAction", "ImplExternalWFReports", "ImplPreLoadRawDataOutputAction", "ImplDeliveryProfilesContextSelectAction"];
968 for (var i = 0; i < paymentUrls.length; i++) {
969 if (MenuHtml.indexOf(paymentUrls[i]) >= 0) {
970 payment_array.push(i + 1);
974 for (var i = 0; i < reportUrls.length; i++) {
975 if (MenuHtml.indexOf(reportUrls[i]) >= 0) {
976 report_array.push(i + 1);
980 $.each(headerData.childNavigation, function(dataIndex, childNavigation) {
981 if (childNavigation.name == "Manage") {
982 var mIndex = dataIndex;
983 var child1 = childNavigation.childNavigation;
984 $.each(child1, function(dataIndex, childNavigation) {
985 if (childNavigation.name == "Billing") {
986 var bIndex = dataIndex;
987 var child2 = childNavigation.childNavigation;
988 $.each(child2, function(dataIndex, childNavigation) {
989 if (childNavigation.name == "Payments") {
990 var pIndex = dataIndex;
991 var child3 = childNavigation.childNavigation;
992 headerData.childNavigation[mIndex].childNavigation[bIndex].childNavigation[pIndex].childNavigation = [];
994 $.each(payment_array, function(dataIndex, item) {
996 headerData.childNavigation[mIndex].childNavigation[bIndex].childNavigation[pIndex].childNavigation.push({
997 "childNavigation": [],
999 "name": "Payment History",
1000 "url": "/ebiz/billing/iframe.jsp?destUrl=ImplCleanPaymentHistoryAction.do"
1002 } else if (item == 2) {
1003 headerData.childNavigation[mIndex].childNavigation[bIndex].childNavigation[pIndex].childNavigation.push({
1004 "childNavigation": [],
1006 "name": "One Time Payment",
1007 "url": "/ebiz/billing/iframe.jsp?destUrl=ImplOTPaymentContextSelectAction.do"
1009 } else if (item == 3) {
1010 headerData.childNavigation[mIndex].childNavigation[bIndex].childNavigation[pIndex].childNavigation.push({
1011 "childNavigation": [],
1013 "name": "Recurring Payments",
1014 "url": "/ebiz/billing/iframe.jsp?destUrl=ImplRECPaymentContextSelectAction.do"
1018 } else if (childNavigation.name == "Reports") {
1019 var pIndex = dataIndex;
1020 var child3 = childNavigation.childNavigation;
1021 headerData.childNavigation[mIndex].childNavigation[bIndex].childNavigation[pIndex].childNavigation = [];
1023 $.each(report_array, function(dataIndex, item) {
1025 headerData.childNavigation[mIndex].childNavigation[bIndex].childNavigation[pIndex].childNavigation.push({
1026 "childNavigation": [],
1028 "name": "Create/View Customized Reports",
1029 "url": "/ebiz/billing/iframe.jsp?destUrl=ImplPreLoadFFReportListAction.do"
1031 } else if (item == 2) {
1032 headerData.childNavigation[mIndex].childNavigation[bIndex].childNavigation[pIndex].childNavigation.push({
1033 "childNavigation": [],
1035 "name": "Bill Analysis",
1036 "url": "/ebiz/billing/iframe.jsp?destUrl=ImplExternalWFReports.do"
1038 } else if (item == 3) {
1039 headerData.childNavigation[mIndex].childNavigation[bIndex].childNavigation[pIndex].childNavigation.push({
1040 "childNavigation": [],
1042 "name": "Raw Data Output",
1043 "url": "/ebiz/billing/iframe.jsp?destUrl=ImplPreLoadRawDataOutputAction.do"
1045 } else if (item == 4) {
1046 headerData.childNavigation[mIndex].childNavigation[bIndex].childNavigation[pIndex].childNavigation.push({
1047 "childNavigation": [],
1049 "name": "Delivery Profiles",
1050 "url": "/ebiz/billing/iframe.jsp?destUrl=ImplDeliveryProfilesContextSelectAction.do"
1065 /* For all the pages except CFD Iframe Page */
1066 function iframeHover() {
1067 var url = window.location.pathname;
1068 //If it is CFD Billing Iframe Page
1069 if (url == "/ebiz/billing/iframe.jsp") {
1070 $("a.categoryOptionLink").click(function() {
1071 var status_url = $(this).attr('href').split('destUrl=')[1].split('&')[0];
1072 if (status_url != null && status_url != undefined) {
1073 $('iframe').attr('src', cfd_handoff_url + '/businesscare-ebill/' + status_url);
1074 if (history.pushState) {
1075 history.pushState('', 'AT&T Billing', 'iframe.jsp?destUrl=' + status_url);
1078 $('.megaMenuContainer').scrollTop(0);
1079 $('.megaMenuContainer').hide();
1080 window.scrollTo(0, 0);
1093 $(document).on('mouseleave', '.secondaryMenuOptionLink', function(ev) {
1095 if ($(".megaMenuContainer").is(":hidden")) {
1097 if (homePageNameInfo) {
1099 $.each($('.secondaryMenuOptionLink'), function() {
1101 var $this = $(this);
1103 if ($this.hasClass("homePageNameHighlight")) {
1105 highlightHomePageNameInSecMenu($this);
1112 $(document).on('mouseleave', '.thirdMenuOptionLink', function(ev) {
1114 if ($(".megaMenuContainer").is(":hidden")) {
1116 if (homePageNameInfo) {
1118 $.each($('.thirdMenuOptionLink'), function() {
1120 var $this = $(this);
1122 if ($this.hasClass("homePageNameHighlight")) {
1124 highlightHomePageNameInSecMenu($this);
1132 /* Hide the Mega menu on mouseleave. */
1133 $(document).on('mouseleave', '.megaMenuContainer', function(ev) {
1134 /* $('.categoryContainerColumn').remove();*/
1135 $('.megaMenuContainer').scrollTop(0);
1136 $('.megaMenuContainer').hide();
1137 $(".selectionDiv").hide();
1138 $('.secondaryMenuOptionLink').removeClass('selectedSecondaryMenuOption');
1139 $('.thirdMenuOptionLink').removeClass('selectedSecondaryMenuOption');
1141 if (homePageNameInfo) {
1143 $.each($('.secondaryMenuOptionLink'), function() {
1145 var $this = $(this);
1147 if ($this.hasClass("homePageNameHighlight")) {
1149 highlightHomePageNameInSecMenu($this);
1152 $.each($('.thirdMenuOptionLink'), function() {
1154 var $this = $(this);
1156 if ($this.hasClass("homePageNameHighlight")) {
1158 highlightHomePageNameInSecMenu($this);
1166 /* On scroll of the page, display the name of the page in the primary menu.
1167 On scrolling back to the top, display the original primary menu. */
1168 $(window).on('scroll', function() {
1169 if($('.mapHeader').is(':visible')){
1172 $('.secondaryMenuContainer').hide();
1173 $('.primaryMenuOptionLink').removeClass("selectedPrimaryMenuOption");
1174 $('.selectedOptionIndicator').hide();
1175 $('.megaMenuContainer').scrollTop(0);
1176 $('.megaMenuContainer').hide();
1177 $('.primaryMenuOptionsContainer').hide();
1178 $(".pageNameContainer").show();
1179 if ($(window).scrollTop() === 0) {
1180 if(!($('.switch-message-div').is(':visible'))){
1181 $(".dashboardHeadIcons").css("top","90px");
1184 $(".dashboardHeadIcons").css("top","127px");
1186 $('.primaryMenuOptionsContainer').show();
1187 var currentUrl = window.location.href;
1188 if(currentUrl != null){
1189 var emaintenanceMatch = currentUrl.search('emaintenance');
1190 if(emaintenanceMatch >= 0){
1191 $(".secondaryMenuContainerForApplication").show();
1192 $('.selectedOptionIndicator').show();
1195 if (homePageNameInfo) {
1196 showSecondaryMenu(homePageNameInfo);
1198 $(".pageNameContainer").hide();
1200 if ($(".pageNameContainer .pageName").length && $(".pageNameContainer .pageName").text() !== "") {
1201 $('.primaryMenuOptionsContainer').hide();
1202 $(".pageNameContainer").show();
1204 $('.primaryMenuOptionsContainer').show();
1205 $(".pageNameContainer").hide();
1210 $(".reg-logout-btn").click(function(){
1211 if(bdToolsWindow!=null && !bdToolsWindow.closed){
1212 // console.log("log-out with Session Id" + bdSessionId);
1213 bdToolsWindow.close();
1214 terminateBDSession();
1218 // url: '/rest/model/com/att/b2b/ebcare/rest/actorchain/EBizCareServiceActor/terminateSession?byPassLastAccess=true&userId='+loginId+'&bdSessionId='+ bdSessionId,
1219 url: window.ebizDashboardContext +'/bd/'+bdSessionId+'/terminateSession',
1221 success : function(response){
1222 // console.log("BD-LOG-OUT-Sucess");
1224 error : function(e){
1225 // console.log("BD-LOG-OUT-Error");
1230 /* Commenting the logout code.As logout functionality is handled by the regular form submition.
1234 url: "/rest/model/atg/userprofiling/ProfileActor/logout",
1236 success: function (response) {
1237 // console.log("dashboard logout success");
1240 window.location.href = "/ebiz/registration/index.jsp?DPSLogout=true";
1241 // console.log("dashboard logout error");
1247 function terminateBDSession() {
1251 // url: '/rest/model/com/att/b2b/ebcare/rest/actorchain/EBizCareServiceActor/terminateSession?byPassLastAccess=true&userId='+loginId+'&bdSessionId='+ bdSessionId,
1252 url: window.ebizDashboardContext +'/bd/'+bdSessionId+'/terminateSession',
1254 success : function(response){
1255 // console.log("BD-LOG-OUT-Sucess");
1257 error : function(e){
1258 // console.log("BD-LOG-OUT-Error");
1263 * Function Definition to Get Click To Chat Data
1264 * ========================================== */
1265 function getClickToChatData() {
1269 contentType :'application/json',
1270 url: window.ebizDashboardContext + "/clicktochat",
1271 success: populateClickToChat,
1272 error: function() {},
1273 complete: clickToChatPopBox
1277 function populateClickToChat(response) {
1279 var template = Handlebars.compile($("#clickToChatMultiple_tmpl").html());
1280 var clickToChat = template(response);
1281 $(".headerIconContainer").append(clickToChat);
1285 function clickToChatPopBox() {
1286 /* var chatbox = $('.chatBox');
1289 open: function(){chatbox.css('display','block');},
1290 close: function(){chatbox.fadeOut('fast');}
1292 $(document).on('click keyup ', '.chatIcon', function(ev) {
1293 if(ev.keyCode==13 || ev.type=='click'){
1294 //$('.chatIcon').click(function()
1295 if (chatbox.css('display') == 'block'){
1297 setTimeout(function(){ $(".btn-panel-vertical,#actionsDropDown").css('z-index','999'); },200);
1298 if($(window).scrollTop() > 20){
1299 setTimeout(function(){ $(".btn-panel-vertical,#actionsDropDown").css('z-index','-999'); },200);
1302 $(".btn-panel-vertical,#actionsDropDown").css('z-index','-999');
1304 $(settings['box']).fadeOut("fast");
1308 // Close chat-box on clicking cross icon
1309 $('.circle_close_chat').click(function(){
1310 setTimeout(function(){ $(".btn-panel-vertical,#actionsDropDown").css('z-index','999'); },200);
1312 if($(window).scrollTop() > 20){
1313 setTimeout(function(){ $(".btn-panel-vertical,#actionsDropDown").css('z-index','-999'); },200);
1317 // Close chat-box on Escape key press
1318 $(document).bind('keyup', function(event){
1319 if(event.keyCode == 27){
1320 setTimeout(function(){ $(".btn-panel-vertical,#actionsDropDown").css('z-index','999'); },200);
1321 /* methods.close();*/
1322 if($(window).scrollTop() > 20){
1323 setTimeout(function(){ $(".btn-panel-vertical,#actionsDropDown").css('z-index','-999'); },200);
1329 function JSONLength(json) {
1331 for (var key in json) {
1337 function prepareData(data) {
1338 var modifiedJSON = {options: []};
1339 for (var key in data) {
1340 var temp = {linkName:key, linkValue:data[key]};
1341 modifiedJSON['options'].push(temp);
1343 return modifiedJSON;
1346 getClickToChatData();
1349 $('.emailAddress input').focus(function() {
1350 var dispVal = $(this).val();
1351 if (dispVal == "Email Address") {
1354 }).blur(function() {
1355 var dispVal1 = $(this).val();
1356 if (dispVal1 == "") {
1357 $(this).val("Email Address");
1361 $(document).bind("ajaxSend", function(elm, xhr, s){
1362 if (s.type == "POST" || s.type == "GET") {
1363 var token = window.softToken;
1364 xhr.setRequestHeader('X-CSRF-Token', token);
1367 $(document).ready(function() {
1368 onClickOfMenu = function(url){
1369 $('.megaMenuContainer').scrollTop(0);
1370 $('.megaMenuContainer').hide();
1371 window.scrollTo(0, 0);
1373 window.location.href = url;