1$(function() { 2 3 window.onerror = function(msg, url, linenumber) { 4 $("body").attr("jserror", msg); 5 }; 6 7 //JavaScript for disabling form submissions if there are invalid fields 8 'use strict'; 9 window.addEventListener('load', function() { 10 // Fetch all the forms we want to apply custom Bootstrap validation styles to 11 var forms = document.getElementsByClassName('needs-validation'); 12 // Loop over them and prevent submission 13 var validation = Array.prototype.filter.call(forms, function(form) { 14 form.addEventListener('submit', function(event) { 15 if (form.checkValidity() === false) { 16 event.preventDefault(); 17 event.stopPropagation(); 18 } 19 20 form.classList.add('was-validated'); 21 }, false); 22 }); 23 }, false); 24 25 $(document).on('click', 'a', function (e) { 26 var $target = $(this).attr('target'); 27 var $href = $(this).attr('href'); 28 29 if (!$(this).hasClass('no-show-loading') && $target !== '_blank' && $href !== '' && $href != undefined && $href !== '#' && $href !== '#!' && $href.indexOf('tel:') == -1) { 30 try { 31 if (!$.isFunction(Vue.$loading)) { 32 Vue.use(VueLoading); 33 } 34 35 var loader = Vue.$loading.show(); 36 37 setTimeout(function() { 38 if (loader != null) { 39 loader.hide(); 40 } 41 }, 15000); 42 } catch(error) { 43 var loader = VueLoading.useLoading().show(); 44 45 setTimeout(function() { 46 if (loader != null) { 47 loader.hide(); 48 } 49 }, 15000); 50 } 51 } 52 }).on('change', 'select', function (e) { 53 var $val = $(this).find('option:selected').val(); 54 55 if ($(this).hasClass('show-loading') && $val !== '') { 56 try { 57 if (!$.isFunction(Vue.$loading)) { 58 Vue.use(VueLoading); 59 } 60 61 var loader = Vue.$loading.show(); 62 63 setTimeout(function() { 64 if (loader != null) { 65 loader.hide(); 66 } 67 }, 15000); 68 } catch(error) { 69 var loader = VueLoading.useLoading().show(); 70 71 setTimeout(function() { 72 if (loader != null) { 73 loader.hide(); 74 } 75 }, 15000); 76 } 77 } 78 }); 79 80 81 //Enable Tootltips 82 //$('[data-toggle="tooltip"]').tooltip(); 83 const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]') 84 const tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl)) 85 86 //Naigation Sliding 87 $("#navbar-slide-button").click(function() { 88 $("#navbar-slide, .nav-submenu").css('top', $(document).scrollTop()); 89 90 $(".icon-open").toggle(); 91 $(".icon-close").toggle(); 92 93 if ( $("#navbar-slide-button").hasClass('expanded') ) { 94 $("#navbar-slide").removeClass('expanded'); 95 $("#navbar-overlay").removeClass('expanded'); 96 $("#navbar-slide-button").removeClass('expanded'); 97 $(".nav-submenu").removeClass('expanded'); 98 //$('body').removeClass("position-fixed"); 99 $("body").css("overflow", "visible"); 100 } else { 101 $("#navbar-slide").addClass('expanded'); 102 $("#navbar-overlay").addClass('expanded'); 103 $("#navbar-slide-button").addClass('expanded'); 104 //$('body').addClass("position-fixed"); 105 $("body").css("overflow", "hidden"); 106 } 107 108 }); 109 110 //Navigation Overlay Close on Click 111 $("#navbar-overlay").click(function() { 112 $("#navbar-slide").removeClass('expanded'); 113 $("#navbar-overlay").removeClass('expanded'); 114 $("#navbar-slide-button").removeClass('expanded'); 115 $(".nav-submenu").removeClass('expanded'); 116 //$('body').removeClass("position-fixed"); 117 $("body").css("overflow", "visible"); 118 $(".icon-open").show(); 119 $(".icon-close").hide(); 120 }); 121 122 123 //Navigation Sub-menus 124 $(".nav-link.parent").click(function() { 125 var submenu = $(this).data('submenu'); 126 127 $('.nav-submenu').removeClass('expanded'); 128 129 $(submenu).addClass('expanded'); 130 131 $("#navbar-slide").removeClass('expanded'); 132 133 return false; 134 }); 135 136 //Navigation Back Button 137 $(".nav-back").click(function() { 138 var backmenu = $(this).data('backmenu'); 139 140 $('.nav-submenu').removeClass('expanded'); 141 142 $(backmenu).addClass('expanded'); 143 }); 144 145 $('.accordion').on('shown.bs.collapse hidden.bs.collapse', function() { 146 $(this).find('*[aria-expanded="true"]').find("i.expandable").removeClass("fa-angle-down").addClass("fa-angle-up"); 147 $(this).find('*[aria-expanded="false"]').find("i.expandable").removeClass("fa-angle-up").addClass("fa-angle-down"); 148 }); 149 150 //----- BILLING ACCOUNT SWITCHER ------// 151 $('.switcher-acct-list').each(function(){ 152 var max = 2 153 if ($(this).find("li").length > max+1) { 154 $(this) 155 .find('li:gt('+max+')') 156 .hide() 157 .end() 158 .append( 159 $('<button id="acct-show" class="btn btn-text btn-sm text-htc-blue-light">Show all accounts <i class="fas fa-caret-down"></i></button>').click( function(){ 160 $(this).siblings(':hidden').show('fast').end().remove(); 161 }) 162 ); 163 } 164 }); 165 166 167 //Switch Accounts 168 $("#service-account-switcher button").click(function() { 169 170 var chosen_service = $(this).data('service'); 171 //console.log(chosen_service); 172
173 $('.sub-menu-item').removeClass('selected'); 174 $('#services-overview').children('li').addClass('selected'); 175 176 $('.service-wrap').hide(); 177 178 $(chosen_service).removeClass('d-none'); 179 $(chosen_service).show(); 180 181 }); 182 183 $('#more-details').click( function() { 184 $(this).addClass('d-none'); 185 $('#switcher-details').show(); 186 $('#less-details').removeClass('d-none'); 187 }); 188 189 $('#less-details').click( function() { 190 $(this).addClass('d-none'); 191 $('#switcher-details').hide(); 192 $('#more-details').removeClass('d-none'); 193 }); 194 195 196 //Show Hide Password on Wi-Fi Page 197 $("div.input-group.show_hide_password i").on('click', function(e) { 198 e.preventDefault(); 199 200 var parentDiv = $(this).parents('div.input-group.show_hide_password'); 201 202 if ($(parentDiv).find('input').attr("type") == "text") { 203 $(parentDiv).find('input').attr('type', 'password'); 204 $(parentDiv).find('i').addClass( "fa-eye-slash" ); 205 $(parentDiv).find('i').removeClass( "fa-eye" ); 206 } else if ($(parentDiv).find('input').attr("type") == "password") { 207 $(parentDiv).find('input').attr('type', 'text'); 208 $(parentDiv).find('i').removeClass( "fa-eye-slash" ); 209 $(parentDiv).find('i').addClass( "fa-eye" ); 210 } 211 212 return false; 213 }); 214 215 //Show Alert on Provision Set-Top Boxes Form Submit 216 $("#provision-form").submit(function(e){ 217 218 $('#provision-alert').show(); 219 e.preventDefault(); // dont submit multiple times 220 221 }); 222 223 224 225 //Add a Line of Service - Create New Service Account 226 227 //Contact Page Reasons For Contacting Us Dropdown 228 $('#new-service-address select').on( 'change', function() { 229 230 var acct_val = $(this).find(':selected').val(); 231 232 233 if ( acct_val == 'new' ) { 234 235 $('#new').show(); 236 237 } else { 238 239 $('#new').hide(); 240 241 } 242 243 }); 244 245 //Stops Checkbox being unchecked when Modal Launches 246 $('#manage-services input:checked[data-toggle="modal"]').on("click", function(e) { 247 248 e.preventDefault(); 249 $('#myModal').modal('show'); 250 251 }); 252 253 //Shows Summary Box once a service is added 254 $('#manage-services input').on("click", function() { 255 256 $('#manage-summary').show(); 257 258 }); 259 260 //Moves Steps Content at Medium Breakpoint 261 function summ_mobile_shift() { 262 263 264 if ($(window).width() <= 992){ 265 266 //console.log('content shifted to mobile'); 267 268 $("#manage-summary").appendTo("#summary-mobile"); 269 270 } else { 271 272 //console.log('content shifted to desktop'); 273 274 $("#manage-summary").appendTo("#summary-main"); 275 276 } 277 278 } //steps_mobile_shift 279 280 $(document).ready(function() { 281 // run on initial page load 282 summ_mobile_shift(); 283 284 // run on resize of the window 285 $(window).resize(summ_mobile_shift()); 286 }); 287 288 289 290 291 //----- REQUEST NEW SERVICE -----// 292 293 294 $('#serviceInquiryForm2').on('click', '.service-icons a', function() { 295 //Step 2 - Show & Hide Options for Service Selector when Icons Clicked 296 $(this).parents('.col').toggleClass('active'); 297 298 var service_type = $(this).data('service'); 299 300 if (service_type == 'phone') { 301 $('#phone-options').toggleClass('d-none'); 302 303 if ($(this).parents('.col').hasClass('active')) { 304 $('#previousService').val('Voice'); 305 } else { 306 $('#previousService').val(''); 307 } 308 } else if (service_type == 'cable') { 309 $('#cable-options').toggleClass('d-none'); 310 311 if ($(this).parents('.col').hasClass('active')) { 312 $('#basicCable').val('Basic Cable,Cable Plus'); 313 if ($('#input[name="dvrBox"]').filter(':selected').length == 0) { 314 $('#tv-max-package-basic').prop('checked', 'checked'); 315 } 316 317 if (!$('#serviceInquiryForm .service-icons a[data-service="internet"]').parents('.col').hasClass('active')) { 318 $('#serviceInquiryForm .service-icons a[data-service="internet"]').trigger('click'); 319 } 320 321 $('html, body').animate({ scrollTop: $('#cable-options').offset().top - 75 }, 400); 322 } else { 323 $('#basicCable').val(''); 324 $('input.requires-settop').prop('checked', false); 325 $('select[name="digitalBox"] option:eq(0)').prop('selected', 'selected'); 326 $('select[name="dvrBox"] option:eq(0)').prop('selected', 'selected'); 327 } 328 } else if (service_type == 'internet') { 329 $('#internet-options').toggleClass('d-none'); 330 331 if ($(this).parents('.col').hasClass('active')) { 332 $('input[name="internetPlans"]:eq(0)').prop('checked', true); 333 334 $('html, body').animate({ scrollTop: $('#internet-options').offset().top - 75 }, 400); 335 $('#wirelessRouter').val('Y'); 336 } else { 337 $('input[name="internetPlans"]').prop('checked', false); 338 $('#wirelessRouter').val(''); 339 340 if ($('#serviceInquiryForm .service-icons a[data-service="cable"]').parents('.col').hasClass('active')) { 341 $('#serviceInquiryForm .service-icons a[data-service="cable"]').trigger('click'); 342 } 343 } 344 } else if (service_type == 'security') { 345 $('.service-icons a[data-service="connected"]').parents('.col').removeClass('active'); 346 $('#connected-options').addClass('d-none'); 347 $('#security-options').toggleClass('d-none'); 348 349 if ($(this).parents('.col').hasClass('active')) { 350 $('#hism').val('Y'); 351 352 if ($(this).prop('notified') != 'true') { 353 $('#securityRequiresPhoneModal').modal('show'); 354 $(this).prop('notified', 'true'); 355 } 356 } else { 357 $('#hism').val(''); 358 } 359 } else if (service_type == 'connected') { 360 $('.service-icons a[data-service="security"]').parents('.col').removeClass('active'); 361 $('#security-options').addClass('d-none'); 362 $('#connected-options').toggleClass('d-none'); 363 364 if ($(this).parents('.col').hasClass('active')) { 365 $('#hism').val('C'); 366 } else { 367 $('#hism').val(''); 368 } 369 } 370 371 $('#submit-button').removeClass('d-none'); 372 373 calculateNewServiceRequestTotal(); 374 375 return false; 376 }).on('click', '.form-check-input', function() { 377 calculateNewServiceRequestTotal(); 378 }).on('change', 'select.settop', function() { 379 calculateNewServiceRequestTotal(); 380 }).on('click', 'input.requires-settop', function() { 381 if (!$('select[name="digitalBox"] option.requires-base-cable').is(':selected') && !$('select[name="dvrBox"] option.requires-base-cable').is(':selected')) { 382 $('select[name="digitalBox"] option.requires-base-cable[value="Digital Box(1)"]').prop('selected', 'selected'); 383 } 384 }).on('click', 'input[name="tv-max-package"]', function() { 385 if (!$('select[name="digitalBox"] option.requires-base-cable').is(':selected') && !$('select[name="dvrBox"] option.requires-base-cable').is(':selected')) { 386 $('select[name="digitalBox"] option.requires-base-cable[value="Digital Box(1)"]').prop('selected', 'selected'); 387 } 388 }).on('submit', function() { 389 if ($(this).find('div.service-icons div.col').length > 0 && $(this).find('div.service-icons div.col.active').length <= 0) { 390 $('#selectServiceModal').modal('show'); 391 392 return false; 393 } 394 }); 395 396 397 //Step 3 - Billing Info Checkboxes 398 $("#cc-checkbox").click(function() { 399 400 $('#bank-info').addClass('d-none'); 401 $('#cc-info').removeClass('d-none'); 402 $(this).prop("checked", true); 403 $('#bank-checkbox').prop("checked", false); 404 405 }); 406 407 $("#bank-checkbox").click(function() { 408 409 $('#cc-info').addClass('d-none'); 410 $('#bank-info').removeClass('d-none'); 411 $(this).prop("checked", true); 412 $('#cc-checkbox').prop("checked", false); 413 414 }); 415 416 417 //Moves Steps Content at Medium Breakpoint 418 function steps_mobile_shift() { 419 420 421 if ($(window).width() <= 992){ 422 423 //console.log('content shifted to mobile'); 424 425 $("#new-service-address").appendTo("#new-service-address-step").addClass("pl-5 py-5"); 426 $("#new-service-select").appendTo("#new-service-select-step").addClass("pl-5 py-5"); 427 $("#new-service-billing").appendTo("#new-service-billing-step").addClass("pl-5 py-5"); 428 $("#new-service-confirm").appendTo("#new-service-confirm-step").addClass("pl-5 py-5"); 429 430 } else { 431 432 //console.log('content shifted to desktop'); 433 434 $("#new-service-address").appendTo("#new-service-wrapper").removeClass("pl-5 py-5"); 435 $("#new-service-select").appendTo("#new-service-wrapper").removeClass("pl-5 py-5"); 436 $("#new-service-billing").appendTo("#new-service-wrapper").removeClass("pl-5 py-5"); 437 $("#new-service-confirm").appendTo("#new-service-wrapper").removeClass("pl-5 py-5"); 438 439 } 440 441 } //steps_mobile_shift 442 443 $(document).ready(function() { 444 // run on initial page load 445 steps_mobile_shift(); 446 447 // run on resize of the window 448 $(window).resize(steps_mobile_shift); 449 });
450 451 452 453 454 //----- SUPPORT ------// 455 456 //Contact Page Reasons For Contacting Us Dropdown 457 $('#contact-type').on( 'change', function() { 458 459 var contact_type = $(this).find(':selected').val(); 460 461 if ( contact_type == 'account' ) { 462 $('#other').hide(); 463 $('#account').show(); 464 $('#outage').hide(); 465 $('#billing').hide(); 466 } else if ( contact_type == 'outage' ) { 467 $('#other').hide(); 468 $('#account').hide(); 469 $('#outage').show(); 470 $('#billing').hide(); 471 } else if ( contact_type == 'billing' ) { 472 $('#billing').show(); 473 } else { 474 $('#other').hide(); 475 $('#account').hide(); 476 $('#outage').hide(); 477 $('#billing').hide(); 478 } 479 480 }); 481 482 483 //Tech Contact Page Show Services on Account Select 484 $('#contact-issue #contact-acct').on( 'change', function() { 485 486 //Look for Data Values for Each Service 487 var value_phone = $(this).find(':selected').data('phone'); 488 var value_cable = $(this).find(':selected').data('cable'); 489 var value_internet = $(this).find(':selected').data('internet'); 490 var value_wireless = $(this).find(':selected').data('wireless'); 491 var value_security = $(this).find(':selected').data('security'); 492 493 //Show Service Selection Area 494 $('#contact-issue #service').show(); 495 496 //Reset Service Selector 497 $('#contact-issue #contact-service option').prop('selected', false); 498 $('#service-output').removeClass('d-block').addClass('d-none'); 499 500 501 //Conditional Show Each Option Based on Services That Acocunt Has 502 503 //Phone 504 if (value_phone) { 505 506 $('#contact-issue #service #phone').show(); 507 508 } else { 509 510 $('#contact-issue #service #phone').hide(); 511 } 512 513 //Cable 514 if (value_cable) { 515 516 $('#contact-issue #service #cable').show(); 517 518 } else { 519 520 $('#contact-issue #service #cable').hide(); 521 } 522 523 //Internet 524 if (value_internet) { 525 526 $('#contact-issue #service #internet').show(); 527 528 } else { 529 530 $('#contact-issue #service #internet').hide(); 531 } 532 533 //Wireless 534 if (value_wireless) { 535 536 $('#contact-issue #service #wireless').show(); 537 538 } else { 539 540 $('#contact-issue #service #wireless').hide(); 541 } 542 543 //Secuirty 544 if (value_security) { 545 546 $('#contact-issue #service #security').show(); 547 548 } else { 549 550 $('#contact-issue #service #security').hide(); 551 } 552 553 554 }); 555 556 //Tech Contact Page Show Services on Account Select 557 $('#contact-issue #contact-service').on( 'change', function() { 558 559 var text_value = $(this).find(':selected').text(); 560 var img_value = $(this).find(':selected').val(); 561 562 $('#img-output').attr('src', img_value); 563 $('#text-output').text(text_value); 564 565 $('#service-output').removeClass('d-none').addClass('d-block'); 566 567 }); 568 569 570 $('body').on('submit', 'form', function() { 571 $(this).find('button[type="submit"]').prop('disabled', 'disabled').addClass('disabled'); 572 573 $(this).find('button[type="submit"][data-loading-text]').each(function() { 574 $(this).find('.button-text').html($(this).attr('data-loading-text')); 575 }); 576 }).on('click', '.captchaShuffleLink', function() { 577 $("#captchaimg").attr("src", "/controller/captcha/getNewCaptcha"); 578 579 $("#captcha").val(""); 580 581 return false; 582 }); 583 584 $("#newPassword").checkPasswordStrength({usernameField: $("#userName"), passwordRating : $("#passwdRating")}); 585 586 //Spring form error messages 587 $('form .spring-bind-errors .spring-bind-error').each(function() { 588 $('#' + $(this).attr('data-id')).addClass('is-invalid').siblings('.invalid-feedback').html($(this).attr('data-invalid-feeback')); 589 }); 590}); 591 592var xhr = null; 593 594function calculateNewServiceRequestTotal() { 595 if (xhr != null) { 596 xhr.abort(); 597 } 598 599 $('#new-service-request-total').html('<i class="fa fa-spinner fa-spin" style="font-size: 44px"></i>'); 600 601 xhr = $.ajax({ 602 url: '/controller/newservice/ajax/calculate-total', 603 type: 'POST', 604 data: $('form#serviceInquiryForm').serialize(), 605 success: function (data, textStatus, jqXHR) { 606 if (data === 'Oops! It looks like there was a problem while loading your page.') { 607 $('#new-service-request-total').html('Your session has expired.'); 608 } else if (data == null || data === undefined || data.subTotal == null) { 609 $('#new-service-request-total').html('$0.00'); 610 $('#directions').val('Quoted Price: $0.00'); 611 } else { 612 $('#new-service-request-total').html('$' + data.subTotal.toFixed(2)); 613 $('#directions').val('Quoted Price: $' + data.subTotal.toFixed(2)); 614 } 615 } 616 }); 617}
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.