1$(document).ready(function () { 2 3 4 5 // run test on initial page load 6 checkSize(); 7 8 // run test on resize of the window 9 $(window).resize(checkSize); 10}); 11 12 13 14 15$(function () { 16 btnSkew(); 17 formCustom(); 18 footerLinks(); 19 editMode(); 20 dropMid(); 21 toggleSignin(); 22 setCurrentPage(); 23 // only run text shadow if class is present 24 if ($('.text-shadow').length > 0) { 25 shadowText(); 26 }; 27 // only run faq if faq page 28 if (($('.faqbanner').length > 0) || ($('.faqAccordion').length > 0)) { 29 faqSetup(); 30 }; 31 navQuote(); 32 setYear(); 33 hookupNavClick(); 34 hideActionBarItemsOnStartPage(); 35}); 36 37// set nav links to active for current page 38function setCurrentPage() { 39 var thisLocation = window.location.pathname.toLowerCase(); 40 // blog categories 41 var catLinks = $('.catlinks > li'); 42 for (i = 0; i < catLinks.length; i++) { 43 // $(catLinks[i]).removeClass('active'); 44 var catPath = $(catLinks[i]).find('a').attr('href').toLowerCase(); 45 var altCatPath1 = catPath.split('/')[1]; 46 var altCatPath2 = catPath.split('/')[2] || 'all-posts'; 47 var altCatPathNew = '/' + altCatPath1 + '/pages/' + altCatPath2 + '.aspx'; 48 49 //console.log(thisLocation + ' | ' + altCatPathNew) 50 if (catPath == thisLocation || altCatPathNew == thisLocation) { 51 $('.catlinks > li').removeClass('active') 52 $(catLinks[i]).addClass('active'); 53 } 54 } 55 // select-and-go dropdown (assumes only one per page) 56 var sagDropdown = $('.select-and-go li'); 57 for (i = 0; i < sagDropdown.length; i++) { 58 var sagLink = $(sagDropdown[i]).find('a'); 59 var sagPath = $(sagLink).attr('href').toLowerCase(); 60 var altSagPath1 = sagPath.split('/')[1]; 61 var altSagPath2 = sagPath.split('/')[2] || 'all-posts'; 62 var altSagPathNew = '/' + altSagPath1 + '/pages/' + altSagPath2 + '.aspx'; 63 var sagLabel = $(sagLink).html(); 64 if ($(sagDropdown[i]).closest('.pemcoform').hasClass('sag-tabs')) { 65 $('.select-and-go li a').on('click', function () { 66 $('.select-and-go li').removeClass('active'); 67 }) 68 thisLocation = $('.tab-pane.active').attr('id'); 69 sagPath = sagPath.split('#')[1]; 70 } 71 if (sagPath == thisLocation || altSagPathNew == thisLocation) { 72 $('.select-and-go li').removeClass('active'); 73 $(sagDropdown[i]).addClass('active'); 74 $(sagDropdown[i]).closest('.select-and-go').find('.dropdown-label').html(sagLabel); 75 } 76 } 77 // set backup to general at /faqs/ 78 if (thisLocation == '/faqs/' || thisLocation == '/faqs' || thisLocation == '/faq-test') { 79 $('.dropdown-label').html('General'); 80 } 81} 82 83// set default screen size (updated inside checkSize) 84var screenSM = true; 85 86// on load actions 87var minDate; 88$(window).on('load', function () { 89 // only run datepicker if datepicker is present 90 if ($('.datepick').length > 0) { 91 setDatepicker(minDate); 92 } 93 94 95}) 96 97// resize actions 98$(window).on('resize', function () { 99 // close datepicker on window resize cause positioning gets crazy 100 if ($('.datepick').length > 0) { 101 $('.pemcodatepicker').find('input').datepicker('hide'); 102 } 103 104}) 105 106 107 108// datepicker 109function setDatepicker(minDate) { 110 $.each($(".datepick"), function () { 111 var mindate = $(this).attr('data-mindate') ?? minDate; 112 var maxdate = $(this).attr('data-maxdate'); 113 $(this).datepicker({ 114 dayNamesMin: ["S", "M", "T", "W", "T", "F", "S"], 115 constrainInput: true, 116 dateFormat: "mm/dd/yy", 117 showOn: 'button', 118 minDate: mindate, 119 maxDate: maxdate, 120 onClose: function () { 121 setTimeout(function () { 122 $('#ui-datepicker-div').unwrap(); 123 }, 500); 124 }, 125 beforeShow: function () { 126 calStyle(); 127 } 128 }); 129 });
130 // open datepicker when icon is clicked 131 $('.calendar').on('click', function () { 132 $(this).closest('.pemcodatepicker').find('input').datepicker('show'); 133 }); 134 135 // mess with elements inside popup 136 function calStyle() { 137 var inputWidth = $('.datepick').width(); 138 setTimeout(function () { 139 $('#ui-datepicker-div').wrap('<div class="pemcoform datewrapper"></div>'); 140 $('#ui-datepicker-div').css('width', inputWidth + 25 + 'px'); 141 var shortMonth = $('.ui-datepicker-month').html().slice(0, 3); 142 $('.ui-datepicker-month').html(shortMonth); 143 144 // addition from Jennifer 145 // if( $('.disallowPreviousDates').length >0){ 146 //disallowPreviousDates(); 147 //} 148 149 150 var allDays = $('a.ui-state-default'); 151 for (i = 0; i < allDays.length; i++) { 152 $(allDays[i]).after('<span class="daySelect"></span>'); 153 } 154 155 // run calStyle again on new month select 156 $('a.ui-corner-all').on('click', function () { 157 $('#ui-datepicker-div').hide(); 158 calStyle(); 159 }); 160 // set input to filled in initial date selection 161 $('.pemcodatepicker').find('input').on('change', function () { 162 $(this).closest('.pemcodatepicker').addClass('filled'); 163 }); 164 // run date validate on input blur 165 $('.pemcodatepicker').find('input').on('blur', function () { 166 var inputDate = $(this).val(); 167 var newInputDate = moment(inputDate, "MM/DD/YYYY"); 168 newInputDate = moment(newInputDate).format("MM/DD/YYYY"); 169 $(this).val(newInputDate); 170 }); 171 }, 1); 172 $('#ui-datepicker-div').fadeIn('fast'); 173 174 } 175 176} 177 178function editMode() { 179 setTimeout(function () { 180 var inDesignMode = typeof MSOWebPartPageFormName != "undefined" 181 && document.forms[MSOWebPartPageFormName] != "undefined" 182 && !!document.forms[MSOWebPartPageFormName].MSOLayout_InDesignMode 183 && document.forms[MSOWebPartPageFormName].MSOLayout_InDesignMode.value; 184 185 if (inDesignMode == "1") { 186 $('#navBarPlaceholder').hide(); 187 } else { 188 // page is in browse mode 189 } 190 }, 500) 191} 192 193function btnSkew() { 194 // wrap all button text in span (for slant effect) 195 var btnAll = $('.btn'); 196 for (i = 0; i < btnAll.length; i++) { 197 var btnText = '<span>' + $(btnAll[i]).html() + '</span>'; 198 $(btnAll[i]).html(btnText); 199 } 200} 201 202function toggleSignin() { 203 var loggedIn = !!(pep.isLoggedIn | $('body').hasClass('isLoggedIn')); 204 $('.signedin').toggle(loggedIn); 205 $('.signedout').toggle(!loggedIn); 206} 207 208function formCustom() { 209 // control input field active state 210 $('.pemcoform .form-group').find('input').on('focus', function () { 211 $(this).closest('.pemcoform .form-group').addClass('active'); 212 }); 213 $('.pemcoform .form-group').find('input').on('focusout', function () { 214 $(this).closest('.pemcoform .form-group').removeClass('active'); 215 if ($(this).filter(function () { 216 return $(this).val(); 217 }).length > 0) { 218 $(this).closest('.pemcoform .form-group').addClass('filled'); 219 } else { 220 $(this).closest('.pemcoform .form-group').removeClass('filled'); 221 } 222 }); 223 // repeat for textarea 224 $('.pemcoform .form-group').find('textarea').on('focus', function () { 225 $(this).closest('.pemcoform .form-group').addClass('active'); 226 }); 227 $('.pemcoform .form-group').find('textarea').on('focusout', function () { 228 $(this).closest('.pemcoform .form-group').removeClass('active'); 229 if ($(this).filter(function () { 230 return $(this).val(); 231 }).length > 0) { 232 $(this).closest('.pemcoform .form-group').addClass('filled'); 233 } else { 234 $(this).closest('.pemcoform .form-group').removeClass('filled'); 235 } 236 });
237 // custom drop-down select 238 $('.pemcoform .form-group .dropdown a').on('click', function (e) { 239 e.preventDefault(); 240 var groupID = $(this).closest('.pemcoform .form-group').attr('id'); 241 $(this).closest('.pemcoform .form-group').addClass('filled'); 242 var dropDownVal = $(this).text(); 243 $(this).closest('.dropdown').find('.value').html(dropDownVal).show(); 244 $(this).closest('.dropdown').find('.dropdown-label').hide(); 245 }); 246 $('.pemcoform .form-group .dropdown-toggle').on('click', function () { 247 $(this).closest('.pemcoform .form-group').removeClass('filled'); 248 $(this).closest('.dropdown').find('.value').html('').hide(); 249 $(this).closest('.dropdown').find('.dropdown-label').show(); 250 }); 251 $('.pemcoform .form-group .dropdown + .btn.submit').on('click', function (e) { 252 e.preventDefault(); 253 var submitGroupID = $(this).closest('.pemcoform .form-group').attr('id'); 254 var submitVal = $(this).closest('.pemcoform .form-group').find('.value').text(); 255 }) 256 257 // select-and-go dropdown 258 $('.pemcoform.select-and-go a.golink').on('click', function () { 259 $(this).closest('.dropdown').removeClass('open'); 260 window.location = $(this).attr('href'); 261 }); 262} 263 264 265 266// footer mobile behavior 267function footerLinks() { 268 // item clicked 269 $('footer .btn-block').on('click', function () { 270 $(this).closest('.panel').find('.btn-block').hide(); 271 }); 272 // item about to be shown 273 $('footer .collapse').on('show.bs.collapse', function () { 274 //$(this).find('.footerlinks').fadeIn('slow'); 275 }); 276 // item about to be hidden 277 $('footer .collapse').on('hide.bs.collapse', function () { 278 // $(this).find('.footerlinks').fadeOut('slow'); 279 $(this).closest('.panel').find('.btn-block').show(); 280 281 }); 282} 283 284// select-and-go dropdown positioning 285function dropMid(thisDropdown) { 286 $(thisDropdown).find('.dropdown').addClass('open'); 287 //if (!screenSM) { 288 $(thisDropdown).on('mouseleave', function () { 289 $(this).find('.dropdown.open').removeClass('open') 290 }) 291 // } 292 var selectItems = $(thisDropdown).find('ul > li'); 293 var liHeight = $(selectItems[0]).height(); 294 var activeItem = $(thisDropdown).find('ul > li.active'); 295 var activeIndex = selectItems.index(activeItem); 296 var heightAbove = 0; 297 for (i = 0; i < activeIndex; i++) { 298 heightAbove++; 299 } 300 // $(thisDropdown).find('.dropdown-menu').css('top', 0 - (heightAbove * liHeight)); 301} 302 303 304 305 306$('select.select-tabs').on('change', function () { 307 $(':selected', this).tab('show'); 308}); 309 310// search box scripts 311$('body').on('keydown', '#search-box', function (e) { 312 if (e.which == 13) { 313 e.preventDefault(); 314 navsearchsubmitForm(); 315 } 316}); 317 318function navsearchsubmitForm() { 319 var $k = $('#search-box'); 320 var url = "/search?q=" + escape($k.val()); 321 location.href = url; 322} 323$searchBox = $("#search-box"); 324$searchBox.focusin(function () { 325 if ($searchBox.hasClass("search-box-collapsed")) { 326 $searchBox 327 .addClass("search-box-expanded") 328 .removeClass("search-box-collapsed"); 329 } 330}); 331$searchBox.focusout(function () { 332 if ($searchBox.hasClass("search-box-expanded") && $searchBox.val().length == 0) { 333 $searchBox 334 .addClass("search-box-collapsed") 335 .removeClass("search-box-expanded"); 336 } 337}); 338 339// migrated from main.master 340if (document.getElementById("welcomeMenuBox")) { 341 var element = $("nav") 342 $(element).attr("class", "navbar navbar-default") 343} 344 345// li dropdown script 346 347//Function to the css rule .navbar-toggle, styles for desktop nav 348function checkSize() { 349 if ($(".navbar-toggle").css("float") == "none") { 350 screenSM = false; 351 $('ul.navbar-nav>li.dropdown').hover( 352 function () { 353 $(this).addClass('open') 354 }, 355 function () { 356 $(this).removeClass('open') 357 } 358 ) 359 } 360 // select-and-go event 361 // desktop 362 if (!screenSM) { 363 $('.select-and-go').find('button').on('mouseover', function () { 364 var hoverDrop = $(this).closest('.select-and-go'); 365 console.log('sag ' + screenSM) 366 dropMid(hoverDrop); 367 }); 368 } 369 // mobile 370 else if (screenSM) { 371 $('.select-and-go').find('button').on('click', function (e) { 372 e.preventDefault(); 373 var clickDrop = $(this).closest('.select-and-go'); 374 console.log('sag ' + screenSM) 375 dropMid(clickDrop); 376 }); 377 }; 378} 379 380// gets the top a link in the nav to go to a main landing page 381function hookupNavClick() { 382 $('ul.navbar-nav>li.dropdown').on('click', function () { 383 var $el = $(this); 384 if ($el.hasClass('open')) { 385 var $a = $el.children('a.dropdown-toggle'); 386 if ($a.length && $a.attr('href')) { 387 location.href = $a.attr('href'); 388 } 389 } 390 });
391} 392 393// navQuote 394function navQuote() { 395 $('.navgetaquote .getAQuoteWidget .dropdown-toggle').click(function (e) { 396 $('.navgetaquote .getAQuoteWidget .dropdown-toggle').attr('aria-expanded', 'true'); 397 $('.navgetaquote .inputFieldCell.dropdown').addClass('open'); 398 $('.dropdown.navgetaquote.hidden-xs').addClass('open'); 399 e.stopPropagation(); 400 }); 401 402 $('.navQuote .form-group input').click(function (e) { 403 e.stopPropagation(); 404 }); 405 $('.navQuote .form-group input').on('mouseleave', function (e) { 406 e.stopPropagation(); 407 }); 408 $('.navQuote .dropdown-toggle').on('click', function (e) { 409 var dropHeightSub = $(this).next('ul').height() + 180; 410 $('.navgetaquote > ul').css('height', dropHeightSub); 411 e.stopPropagation(); 412 }) 413 $('.navQuote .dropdown-menu li a').click(function (e) { 414 $('.navgetaquote .getAQuoteWidget .dropdown-toggle').attr('aria-expanded', 'false'); 415 $(this).closest('.navgetaquote').find('.inputFieldCell.dropdown').removeClass('open'); 416 //$('.navgetaquote > ul').css('height', 'auto'); 417 e.stopPropagation(); 418 }); 419 $('.navgetaquote > ul').on('click', function (e) { 420 e.stopPropagation(); 421 422 }); 423} 424 425function faqSetup() { 426 // move content into panelgroup div 427 var faqAllPanels = $('.faqPanelContent'); 428 for (i = 0; i < faqAllPanels.length; i++) { 429 var dataParent = $(faqAllPanels[i]).find('a').attr('data-parent'); 430 dataParent = dataParent.replace(/\s+/g, '-'); 431 $(faqAllPanels[i]).find('a').attr('data-parent', dataParent); 432 var panelContent = $(faqAllPanels[i]).html(); 433 $('.faqAccordion').append(panelContent); 434 $(faqAllPanels[i]).remove(); 435 } 436 $('.panel-group.faqAccordion').show(); 437 // arrange faq nav 438 var faqNavElements = $('.faqNav'); 439 $('.faqbanner').after(faqNavElements); 440 $('.faqNav').show(); 441} 442 443// display current year in footer 444function setYear() { 445 var currentYear = new Date().getFullYear(); 446 $('footer .currentYear').text(currentYear); 447} 448 449function hideActionBarItemsOnStartPage() { 450 if (window.location.href.indexOf("/start?") >= 0) { 451 if ($("#actionBar>.centerContainer>div").length === 3) { 452 $("#saveForLaterAction").hide(); 453 $("#needAnAgentAction").hide(); 454 $("#chatAction").css({ "width": "100%", "left": "0%" }); 455 } 456 else { 457 $("#actionBar").hide(); 458 } 459 } 460}
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.