1jQuery(document).ready(function($){ 2 if(document.getElementById('profile-modal')){ 3 var profileModal = new bootstrap.Modal(document.getElementById('profile-modal'), {backdrop: false}); 4 5 jQuery('.share-profile').click(function(){ 6 profileModal.toggle(); 7 }); 8 } 9 if(document.getElementById('calc-modal')){ 10 var calcModal = new bootstrap.Modal(document.getElementById('calc-modal',), {backdrop: false}); 11 12 jQuery('#calc-modal-toggle').click(function(){ 13 calcModal.toggle(); 14 }); 15 } 16 17 jQuery('.scholarship-modal-toggle, #scholarship-modal-toggle').click(function(){ 18 myModal.toggle(); 19 }); 20 jQuery('#tsac-modal-toggle, .tsac-modal-toggle').click(function(e){ 21 e.preventDefault(); 22 tsacModal.toggle(); 23 }); 24 jQuery('#news-modal-toggle').click(function(){ 25 newsModal.toggle(); 26 }); 27 28 $('.makeselect2dropdown').select2(); 29 30 $('.makeselect2dropdown').on('select2:select', function(e) { 31 // Remove empty value option from the select element 32 $(this).find('option').filter(function() { 33 return !$(this).val(); 34 }).remove(); 35 36 // Remove empty value from the selected values array 37 var values = $(this).val() || []; 38 var filtered = values.filter(function(v) { return v !== ""; }); 39 if (filtered.length !== values.length) { 40 $(this).val(filtered).trigger('change.select2'); 41 } 42 43 // Remove the default option from the Select2 UI if still present 44 var $container = $(this).next('.select2').find('.select2-selection__rendered'); 45 $container.children('.select2-selection__choice').each(function() { 46 if ($(this).text().trim() === 'Select Field of Interest') { 47 $(this).remove(); 48 } 49 }); 50 }); 51 52 //Filter variables 53 var sports = []; 54 var housing = []; 55 var schools = []; 56 var sizes = []; 57 58 //Lifestyle Calculator variables 59 var lsrole = ""; 60 var lscountry = ""; 61 var lsgrade = ""; 62 var lsinterest = ""; 63 var lshousing = []; 64 var lsutilities = []; 65 var lsfood = []; 66 var lstransportation = []; 67 var lshealthcare = []; 68 var lsleisure = []; 69 var lsclothing = []; 70 var lspersonal = []; 71 var lsmiscellaneous = []; 72 var lsdebt = []; 73 var lsfamily = []; 74 var lssavings = []; 75 var lsmonthlyexpenses = 0; 76 var lsannualexpenses = 0; 77 var lsincometax = 0; 78 var lssalaryneeded = 0; 79 80 //College Step Guide variables 81 var cscollegeTypes = []; 82 var cszip = ""; 83 var csdistance = ""; 84 var csfinaid = ""; 85 var cstuition = ""; 86 var cssize = ""; 87 var csimportance = ""; 88 var fields = []; 89 var cshousing = []; 90 var cssports = []; 91 var sportsGender = ""; 92 93 94 $('.filter-button.sports').on('click', function(){ 95 var sport = $(this).val(); 96 $(this).toggleClass('active'); 97 let index = sports.indexOf(sport); 98 if (index >= 0) { 99 sports.splice(index, 1); 100 } else { 101 sports.push(sport); 102 } 103 }); 104 105 $('.filter-button.housing').on('click', function(){ 106 var house = $(this).val(); 107 $(this).toggleClass('active'); 108 let index = sports.indexOf(house); 109 if (index >= 0) { 110 housing.splice(index, 1); 111 } else { 112 housing.push(house); 113 } 114 }); 115 116 $('.filter-button.schooltype').on('click', function(){ 117 var school = $(this).val(); 118 119 let index = schools.indexOf(school); 120 $(this).toggleClass('active'); 121 if (index >= 0) { 122 schools.splice(index, 1); 123 } else { 124 schools.push(school); 125 } 126 }); 127 128 $('.filter-button.sizes').on('click', function(){ 129 var size = $(this).val(); 130 $(this).toggleClass('active'); 131 let index = schools.indexOf(size); 132 if (index >= 0) { 133 sizes.splice(index, 1); 134 } else { 135 sizes.push(size); 136 } 137 }); 138 139 $(".accordion_tab").click(function(){ 140 $(this).parent().toggleClass("active"); 141 $(this).toggleClass("active"); 142 var expanded = $(this).hasClass("active"); 143 $(this).attr("aria-expanded", expanded); 144 }); 145 146 $(".accordion_tab").on("keydown", function(e){ 147 if (e.key === "Enter" || e.key === " ") { 148 e.preventDefault(); 149 $(this).click(); 150 } 151 }); 152 153 $(".filter-button").on("click", function(){ 154 var pressed = $(this).hasClass("active"); 155 $(this).attr("aria-pressed", pressed); 156 }); 157 158 $("#slider-range").slider({ 159 range: true, 160 min: 0, 161 max: 150, 162 step: 1, 163 slide: function( event, ui ) { 164 $( "#min-price").html(ui.values[ 0 ]); 165 166 suffix = ''; 167 if (ui.values[ 1 ] == $( "#max-price").data('max') ){ 168 suffix = ' +'; 169 } 170 $( "#max-price").html(ui.values[ 1 ] + suffix); 171 $( "#max-price").attr('data-value', ui.values[ 1 ] ); 172 $( "#min-price").attr('data-value', ui.values[ 0 ] ); 173 $( "#high").attr('value', ui.values[ 1 ] ); 174 $( "#low").attr('value', ui.values[ 0 ] ); 175 176 }, 177 create: function(event, ui){ 178 jQuery(this).slider('values', 0, 20); 179 jQuery(this).slider('values', 1, 150); 180 } 181 182 }); 183 184 $('.next-step').on('click', function(e){ 185 e.preventDefault(); 186 var nextstep = $(this).data('step'); 187 var currentstep = $(this).closest('.calculator-step').data('step'); 188 189 $('.calculator-step').addClass('d-none'); 190 $('.calculator-step[data-step="' + nextstep + '"]').removeClass('d-none'); 191 192 $(".progressbar li[data-step='" + currentstep + "']").removeClass('active').addClass('complete').removeAttr('aria-current'); 193 $(".progressbar li[data-step='" + nextstep + "']").addClass('active').attr('aria-current', 'step'); 194 var totalSteps = $(".progressbar li").length; 195 $(".progressbar").attr('aria-label', $(".progressbar").attr('aria-label').replace(/step \d+ of/, 'step ' + nextstep + ' of')); 196 197 $('html, body').animate({ 198 scrollTop: parseInt($(".progressbar").offset().top) 199 }, 100); 200 if(nextstep >= 2){ 201 $('.calculator-footer').removeClass('d-none'); 202 } 203 $('.back-step').data('goto', nextstep-1); 204 }); 205 206 $('.back-step').on('click', function(e){ 207 e.preventDefault(); 208 var backstep = $(this).data('goto'); 209 var currstep = parseInt(backstep) + 1; 210 211 $('.calculator-step').addClass('d-none'); 212 $('.calculator-step[data-step="' + backstep + '"]').removeClass('d-none'); 213 $(".progressbar li[data-step='" + currstep + "']").removeClass('active').removeAttr('aria-current'); 214 $(".progressbar li[data-step='" + backstep + "']").removeClass('complete').addClass('active').attr('aria-current', 'step'); 215 $(".progressbar").attr('aria-label', $(".progressbar").attr('aria-label').replace(/step \d+ of/, 'step ' + backstep + ' of')); 216 $('.back-step').data('goto', parseInt(backstep) -1); 217 if(backstep <= 1){ 218 $('.calculator-footer').addClass('d-none'); 219 } 220 }); 221 222 $('.lifestyle-change-answers, .lifestyle-calculator-results .back-step').on('click', function(e) { 223 e.preventDefault(); 224 var backstep = $(this).data('goto'); 225 226 $('.calculator-step').addClass('d-none'); 227 $('.calculator-step[data-step="' + backstep + '"]').removeClass('d-none'); 228 $(".progressbar li").removeClass('complete').removeAttr('aria-current'); 229 $(".progressbar li[data-step='" + backstep + "']").removeClass('active').attr('aria-current', 'step'); 230 $(".progressbar").attr('aria-label', $(".progressbar").attr('aria-label').replace(/step \d+ of/, 'step ' + backstep + ' of')); 231 232 233 $('.lifestyle-calculator').removeClass('d-none'); 234 $('.lifestyle-calculator-results').addClass('d-none'); 235 236 }) 237 238 $('.calculator-step').on('click', '.calculator-option' , function(){ 239 var single = false;
240 if($(this).hasClass('single-option')){ 241 $(this).closest('.calculator-step').find('.calculator-option.single-option').removeClass('active'); 242 $(this).addClass('active'); 243 } 244 else{ 245 $(this).toggleClass('active'); 246 } 247 calculateLifestyle(); 248 collegeResults(); 249 }); 250 251 $(document).on('change', '.role-check, .lifestyle-country, .lifestyle-grade, .lifestyle-interest', function(){ 252 calculateLifestyle(); 253 }); 254 255 $(document).on('change', '.step-field#zip, .step-field#distance, .step-field#finaid, .step-field#tuition' , function(){ 256 collegeResults(); 257 }) 258 259 $('.lifestyle-calculator .get-results').on('click', function(e){ 260 e.preventDefault(); 261 262 //Populate expenses table 263 var expensesTable = $('.expenses-table tr').toArray(); 264 265 $(expensesTable[1]).children('.selection').text(lshousing[0]); 266 $(expensesTable[1]).children('.amount').text('$' + lshousing[1].toLocaleString()); 267 268 let amount = 0; 269 $.each(lsutilities, function(index){ 270 $(expensesTable[2]).children('.selection').append(lsutilities[index][0] + ', ') 271 amount += lsutilities[index][1]; 272 $(expensesTable[2]).children('.amount').text('$' + amount); 273 }); 274 let selectionString = $(expensesTable[2][1]).text(); 275 selectionString = selectionString.replace(/,\s*$/, ""); 276 $(expensesTable[2][1]).text(selectionString); 277 278 $(expensesTable[3]).children('.selection').text(lsfood[0]); 279 $(expensesTable[3]).children('.amount').text('$' + lsfood[1]); 280 281 $(expensesTable[4]).children('.selection').text(lstransportation[0]); 282 $(expensesTable[4]).children('.amount').text('$' + lstransportation[1]); 283 284 amount = 0; 285 $.each(lshealthcare, function(index){ 286 $(expensesTable[5]).children('.selection').append(lshealthcare[index][0] + ', ') 287 amount += lshealthcare[index][1]; 288 $(expensesTable[5]).children('.amount').text('$' + amount); 289 }); 290 selectionString = $(expensesTable[5][1]).text(); 291 selectionString = selectionString.replace(/,\s*$/, ""); 292 $(expensesTable[5][1]).text(selectionString); 293 294 amount = 0; 295 $.each(lsleisure, function(index){ 296 $(expensesTable[6]).children('.selection').append(lsleisure[index][0] + ', ') 297 amount += lsleisure[index][1]; 298 $(expensesTable[6]).children('.amount').text('$' + amount); 299 }); 300 selectionString = $(expensesTable[6][1]).text(); 301 selectionString = selectionString.replace(/,\s*$/, ""); 302 $(expensesTable[6][1]).text(selectionString); 303 304 $(expensesTable[7]).children('.selection').text(lsclothing[0]); 305 $(expensesTable[7]).children('.amount').text('$' + lsclothing[1]); 306 307 $(expensesTable[8]).children('.selection').text(lspersonal[0]); 308 $(expensesTable[8]).children('.amount').text('$' + lspersonal[1]); 309 310 amount = 0; 311 $.each(lsmiscellaneous, function(index){ 312 $(expensesTable[9]).children('.selection').append(lsmiscellaneous[index][0] + ', ') 313 amount += lsmiscellaneous[index][1]; 314 $(expensesTable[9]).children('.amount').text('$' + amount); 315 }); 316 selectionString = $(expensesTable[9][1]).text(); 317 selectionString = selectionString.replace(/,\s*$/, ""); 318 $(expensesTable[9][1]).text(selectionString); 319 320 $(expensesTable[10]).children('.selection').text(lsdebt[0]); 321 $(expensesTable[10]).children('.amount').text('$' + lsdebt[1]); 322 323 $(expensesTable[11]).children('.selection').text(lsfamily[0]); 324 $(expensesTable[11]).children('.amount').text('$' + lsfamily[1]); 325 326 $(expensesTable[12]).children('.selection').text(lssavings[0]); 327 $(expensesTable[12]).children('.amount').text('$' + lssavings[1]); 328 329 $('.monthlyexpenses').text('$' + lsmonthlyexpenses.toLocaleString()); 330 $('.annualexpenses').text('$' + lsannualexpenses.toLocaleString());
331 $('.incometax').text('$' + lsincometax.toLocaleString()); 332 $('.annualsalary').text('$' + lssalaryneeded.toLocaleString()); 333 334 $('.lifestyle-calculator').addClass('d-none'); 335 $('.lifestyle-calculator-results').removeClass('d-none'); 336 337 var nqs = lssalaryneeded/1000; 338 console.log(nqs); 339 $('.ansalquery').each(function() { 340 var href = $(this).attr('href'); 341 if (href) { 342 var url = new URL(href); 343 url.searchParams.set("low", nqs); 344 $(this).attr('href', url.href); 345 } 346 }); 347 }); 348 349 $('input[type=radio][name=importance]').change(function() { 350 collegeResults(); 351 }); 352 353 function calculateLifestyle(){ 354 let role = ""; 355 let country = ""; 356 let grade = ""; 357 let interest = ""; 358 let housing = []; 359 let utilities = []; 360 let food = []; 361 let transportation = []; 362 let healthcare = []; 363 let leisure = []; 364 let clothing = []; 365 let personal = []; 366 let miscellaneous = []; 367 let debt = []; 368 let family = []; 369 let savings = []; 370 let monthlyexpenses = 0; 371 let annualexpenses = 0; 372 let incometax = 0; 373 let neededSalary = 0; 374 375 role = $('.role-check').val(); 376 country = $('.lifestyle-country').val(); 377 grade = $('.lifestyle-grade').val(); 378 interest = $('.lifestyle-interest').val(); 379 380 housing = [$('.housing .calculator-option.active .option-name').text(), $('.housing .calculator-option.active').data('housing')]; 381 if($('.housing .calculator-option.active').data('housing')){ 382 monthlyexpenses += $('.housing .calculator-option.active').data('housing'); 383 } 384 385 386 $('.utilities .calculator-option.active').each(function(){ 387 let u = [$(this).children('.option-name').text(), $(this).data('utilities')]; 388 utilities.push(u); 389 if($(this).data('utilities')){ 390 monthlyexpenses += $(this).data('utilities'); 391 } 392 393 }); 394 395 food = [$('.food .calculator-option.active .option-name').text(), $('.food .calculator-option.active').data('food')]; 396 if($('.food .calculator-option.active').data('food')){ 397 monthlyexpenses += $('.food .calculator-option.active').data('food'); 398 } 399 400 401 transportation = [$('.transportation .calculator-option.active .option-name').text(), $('.transportation .calculator-option.active').data('transportation')]; 402 if($('.transportation .calculator-option.active').data('transportation')){ 403 monthlyexpenses += $('.transportation .calculator-option.active').data('transportation'); 404 } 405 406 407 $('.healthcare .calculator-option.active').each(function(){ 408 let u = [$(this).children('.option-name').text(), $(this).data('healthcare')]; 409 healthcare.push(u); 410 if($(this).data('healthcare')){ 411 monthlyexpenses += $(this).data('healthcare'); 412 } 413 }); 414 415 $('.leisure .calculator-option.active').each(function(){ 416 let u = [$(this).children('.option-name').text(), $(this).data('leisure')]; 417 leisure.push(u); 418 if($(this).data('leisure')) { 419 monthlyexpenses += $(this).data('leisure'); 420 } 421 }); 422 423 clothing = [$('.clothing .calculator-option.active .option-name').text(), $('.clothing .calculator-option.active').data('clothing')]; 424 if($('.clothing .calculator-option.active').data('clothing')){ 425 monthlyexpenses += $('.clothing .calculator-option.active').data('clothing'); 426 } 427 428 429 personal = [$('.personal-care .calculator-option.active .option-name').text(), $('.personal-care .calculator-option.active').data('personal')]; 430 if($('.personal-care .calculator-option.active').data('personal')) { 431 monthlyexpenses += $('.personal-care .calculator-option.active').data('personal'); 432 } 433 $('.miscellaneous .calculator-option.active').each(function(){ 434 let u = [$(this).children('.option-name').text(), $(this).data('miscellaneous')]; 435 miscellaneous.push(u); 436 if($(this).data('miscellaneous')){ 437 monthlyexpenses += $(this).data('miscellaneous'); 438 } 439 440 }); 441 442 debt = [$('.student-loan-debt .calculator-option.active .option-name').text(), $('.student-loan-debt .calculator-option.active').data('debt')]; 443 if($('.student-loan-debt .calculator-option.active').data('debt')) { 444 monthlyexpenses += $('.student-loan-debt .calculator-option.active').data('debt'); 445 } 446 family = [$('.family .calculator-option.active .option-name').text(), $('.family .calculator-option.active').data('family')]; 447 if($('.family .calculator-option.active').data('family')) { 448 monthlyexpenses += $('.family .calculator-option.active').data('family'); 449 } 450 savings = [$('.savings .calculator-option.active .option-name').text(), $('.savings .calculator-option.active').data('savings')]; 451 if($('.savings .calculator-option.active').data('savings')){ 452 monthlyexpenses += $('.savings .calculator-option.active').data('savings'); 453 } 454 455 annualexpenses = monthlyexpenses * 12; 456 incometax = annualexpenses * .25; 457 neededSalary = incometax + annualexpenses; 458 459 460 //set global variables from temp ones 461 lsrole = role; 462 lscountry = country; 463 lsgrade = grade; 464 lsinterest = interest; 465 lshousing = housing; 466 lsutilities = utilities; 467 lsfood = food; 468 lstransportation = transportation; 469 lshealthcare = healthcare; 470 lsleisure = leisure; 471 lsclothing = clothing; 472 lspersonal = personal; 473 lsmiscellaneous = miscellaneous; 474 lsdebt = debt; 475 lsfamily = family; 476 lssavings = savings; 477 lsmonthlyexpenses = monthlyexpenses; 478 lsannualexpenses = annualexpenses; 479 lsincometax = incometax; 480 lssalaryneeded = neededSalary; 481 482 $('.expenses-so-far').text('$' + monthlyexpenses.toLocaleStr
482ing()); 483 } 484 485 486 function collegeResults(){ 487 let collegetype = ""; 488 let ownership = ""; 489 let zip = 0; 490 let distance = 0; 491 let financialaid = 0; 492 let tuition = 0; 493 let size = ""; 494 let importance = ""; 495 let interest = ""; 496 let housing = ""; 497 let sports = ""; 498 let gender = 0; // 0 = mens, 1 = womens 499 500 $('.college-type .calculator-option.active').each(function(){ 501 let u = $(this).data('value'); 502 collegetype+= u + ','; 503 }); 504 505 collegetype = collegetype.replace(/,\s*$/, ""); 506 507 $('.institution .calculator-option.active').each(function(){ 508 let u = $(this).data('value'); 509 ownership += u + ','; 510 }); 511 ownership = ownership.replace(/,\s*$/, ""); 512 513 $('.size .calculator-option.active').each(function(){ 514 let u = $(this).data('value'); 515 size += u + ','; 516 }); 517 518 size = size.replace(/,\s*$/, ""); 519 520 zip = $('.step-field#zip').val(); 521 distance = $('.step-field#distance').val(); 522 financialaid = $('.step-field#finaid').val(); 523 tuition = $('.step-field#tuition').val(); 524 525 interest = $('select[name="interest"]').val(); 526 527 importance = $(".interest input[name='importance']:checked").val(); 528 529 if($('#sport_gender').is('checked')){ 530 gender = 1; 531 } 532 533 $('.campus .calculator-option.active').each(function(){ 534 let u = $(this).data('value'); 535 housing += u + ','; 536 }); 537 housing = housing.replace(/,\s*$/, ""); 538 539 $('.sports .calculator-option.active').each(function(){ 540 let u = [$(this).children('.option-name').text(), $(this).data('value')]; 541 sports.push(u); 542 }); 543 544 cscollegeTypes = collegetype; 545 cszip = zip; 546 csdistance = distance; 547 csfinaid = financialaid; 548 cstuition = tuition; 549 cssize = size; 550 csimportance = importance; 551 fields = interest; 552 cshousing = housing; 553 cssports = sports; 554 sportsGender = gender; 555 556 var collegeResults = { 557 collegeTypes: cscollegeTypes, 558 ownership: ownership, 559 zip: cszip, 560 distance: csdistance, 561 financialAid: csfinaid, 562 tuition: cstuition, 563 size: cssize, 564 importance: csimportance, 565 fieldsOfStudy: fields, 566 housing: cshousing, 567 }; 568 collegeResults = window.btoa(JSON.stringify(collegeResults)); 569 $('.college-step-guide .goto-results, .college-step-guide .get-results').attr('href', '/college-finder?guideResults=' + collegeResults); 570 } 571 572 const allRanges = document.querySelectorAll(".range-wrap");
573 allRanges.forEach(wrap => { 574 const range = wrap.querySelector(".range"); 575 const bubble = wrap.querySelector(".bubble"); 576 577 range.addEventListener("input", () => { 578 setBubble(range, bubble); 579 }); 580 setBubble(range, bubble); 581 }); 582 583 function setBubble(range, bubble) { 584 const val = range.value; 585 const min = range.min ? range.min : 0; 586 const max = range.max ? range.max : 100; 587 const newVal = Number(((val - min) * 100) / (max - min)); 588 bubble.innerHTML = val; 589 590 // Sorta magic numbers based on size of the native UI thumb 591 bubble.style.left = `calc(${newVal}% + (${8 - newVal * 0.15}px))`; 592 } 593 594 $('.act-number-graph').each(function(){ 595 var score = $(this).children('.act-handle'); 596 var scorelow = $(this).children('.act-handle').data('low'); 597 var scorehigh = $(this).children('.act-handle').data('high'); 598 var leftPos = 100 * ( parseInt(scorelow) / 36) - 12; 599 var handleWidth = 100 * ((parseInt(scorehigh) - parseInt(scorelow)) / 36); 600 score.css('left', leftPos + '%'); 601 }); 602 603 $('.sat-number-graph').each(function(){ 604 var score = $(this).children('.sat-handle'); 605 var scorelow = $(this).children('.sat-handle').data('low'); 606 var scorehigh = $(this).children('.sat-handle').data('high'); 607 var handleWidth = 100 * ((parseInt(scorehigh) - parseInt(scorelow)) / 800); 608 var leftPos = 100 * (( parseInt(score.text()) - 90) / 800) - 2; 609 score.css('left', leftPos + '%'); 610 }); 611 612 $('.sat-total-graph').each(function(){ 613 var score = $(this).children('.sat-handle'); 614 var leftPos = 100 * (( parseInt(score.text()) - 90) / 1600) - 12; 615 score.css('left', leftPos + '%'); 616 }); 617 618 619 620 const visitedCookie = document.cookie.split(';').find(row => row.startsWith('notificationClosed')); 621 622 if (document.cookie.split(';').some(function(item) { 623 return item.trim().indexOf('notificationClosed=') == 0 624 })) { 625 $('.top-notification').remove(); 626 } 627 628 $('.top-notification .iclose').click(function(){ 629 document.cookie = "notificationClosed=true;max-age=" + 60*60*24*7; 630 $('.top-notification').remove(); 631 }); 632 633 $('#main-nav .parent').hover(function () { 634 $(this).addClass('open'); 635 }, function () { 636 $(this).removeClass('open'); 637 }); 638 639 640 //Sticky Header Logic 641 $(document).scroll(function() { 642 var scrollDistance = $(document).scrollTop(); 643 if(scrollDistance > 280){ 644 if($('.sticky-header').length > 0){ 645 $('.sticky-header').addClass('stuck'); 646 $('#overview').parent().css('padding-top', 320); 647 } 648 649 } 650 else{ 651 if($('.sticky-header').length > 0) { 652 $('#overview').parent().css('padding-top', 0); 653 $('.sticky-header').removeClass('stuck'); 654 } 655 } 656 }) 657 658 $('.submit-results-wrapper').fixedElemScroll(); 659 660 $('#activate-filters').click(function(){ 661 if($(this).hasClass('open-search-filters')){ 662 $('.mobile-off-canvas-filter').show(); 663 $('.off-canvas-filter-wrapper .filter-title, .off-canvas-filter-wrapper .filter-main-options, .off-canvas-filter-wrapper .accordion, .off-canvas-filter-wrapper .submit-results-wrapper').hide(); 664 $('#collegeFinder').css('padding-bottom', 0); 665 $('.college-finder').show(); 666 $('.open-search-filters').removeClass('open-search-filters'); 667 } 668 else{ 669 $('.mobile-off-canvas-filter').hide(); 670 $('.off-canvas-filter-wrapper .filter-title, .off-canvas-filter-wrapper .filter-main-options, .off-canvas-filter-wrapper .accordion, .off-canvas-filter-wrapper .submit-results-wrapper').show(); 671 $('#collegeFinder').css('padding-bottom', 150); 672 $('.college-finder').hide(); 673 $(this).addClass('open-search-filters'); 674 } 675 }); 676 677 $('.close-filters').click(function () { 678 $('.mobile-off-canvas-filter').show(); 679 $('.off-canvas-filter-wrapper .filter-title, .off-canvas-filter-wrapper .filter-main-options, .off-canvas-filter-wrapper .accordion, .off-canvas-filter-wrapper .submit-results-wrapper').hide(); 680 $('#collegeFinder').css('padding-bottom', 0); 681 $('.college-finder').show(); 682 $('.open-search-filters').removeClass('open-search-filters'); 683 }); 684 685 $(window).on('load resize', function(){ 686 var windowWidth = $(window).width(); 687 if(windowWidth < 992){ 688 $('#collegeFinder').css('padding-bottom', 0); 689 $('.submit-college-filters').on('click', function(){ 690 $('.mobile-off-canvas-filter').show(); 691 $('off-canvas-filter-wrapper .filter-title, .off-canvas-filter-wrapper .filter-main-options, .off-canvas-filter-wrapper .accordion, .off-canvas-filter-wrapper .submit-results-wrapper').hide(); 692 $('#collegeFinder').css('padding-bottom', 0); 693 $('.college-finder').show(); 694 }); 695 } 696 else{ 697 $('.mobile-off-canvas-filter').hide(); 698 $('.off-canvas-filter-wrapper .filter-title, .off-canvas-filter-wrapper .filter-main-options, .off-canvas-filter-wrapper .accordion, .off-canvas-filter-wrapper .submit-results-wrapper').show(); 699 $('#collegeFinder').css('padding-bottom', 150); 700 $('.college-finder').show(); 701 } 702 }); 703 704 //Step one fields for Calculators 705 $('div[data-role="educator"]').hide(); 706 $('select[data-role="educator"]').hide(); 707 $('select[data-role="student"]').hide(); 708 $('select[data-role="adult"]').hide(); 709 $('div[data-role="parent"]').hide(); 710 711 $('#kingster_top_search').on('click', function(){ 712 $('.kingster-top-search-wrap').fadeIn(200, function(){ 713 $('kingster-top-search-wrap').addClass('kingster-active'); 714 }) 715 }); 716 717 $('.nav-mobile').on('click', function(){ 718 $(this).toggleClass('nav-active'); 719 $('.nav-mobile .open, .nav-mobile .close').toggleClass('open').toggleClass('close'); 720 $('.nav-main').toggleClass('mobile-active'); 721 $('body').toggleClass('hidden'); 722 }); 723 724 $('#mobile-nav .top-link').on('click', function(){ 725 $(this).parent().siblings().removeClass('open'); 726 $(this).parent().toggleClass('open'); 727 }); 728 729 $('#mobile-keyword-search').on('keyup paste', function(){ 730 let searchText = $(this).val(); 731 $('#nameSearch').val(searchText); 732 }); 733 734 $('#nameSearch').on('keyup paste', function(){ 735 let searchText = $(this).val(); 736 $('#mobile-keyword-search').val(searchText); 737 }); 738 739
740 /* Move College Planning links over */ 741 var secondLink = $('.submenu.College.Planning li:nth-child(2)').html(); 742 var thirdLink = $('.submenu.College.Planning li:nth-child(3)').html(); 743 $('.submenu.College.Planning > li:first-child').append(secondLink).append(thirdLink); 744 $('.submenu.College.Planning > li:nth-child(2)').remove(); 745 $('.submenu.College.Planning > li:nth-child(2)').remove(); 746 747 $('.clear-college-filters').on('click', function(){ 748 $('input').each(function(){ 749 $(this).val(''); 750 }); 751 $('select').each(function(){ 752 $(this).val(''); 753 }); 754 }); 755 756 //Removing empty p tags 757 $('p:empty').not('[role="status"]').remove(); 758 759 function showStartButton(){ 760 if(role && role === 'student'){ 761 if(email !== "" && grad !== "" && county !== ""){ 762 $('.btn-disable-outline').hide(); 763 $('.submit-mc').removeClass('d-none'); 764 } 765 } 766 else if(role && role === 'adult'){ 767 if(email !== "" && county !== "" && educationLvl !== "" && interestLvl !== ""){ 768 $('.btn-disable-outline').hide(); 769 $('.submit-mc').removeClass('d-none'); 770 } 771 } 772 else if(role && role === 'educator'){ 773 if(email !== "" && county !== "" && age.length > 0 && job !== ""){ 774 $('.btn-disable-outline').hide(); 775 $('.submit-mc').removeClass('d-none'); 776 } 777 } 778 else if(role && role === 'parent'){ 779 if(email !== "" && county !== "" && gradYear !== ""){ 780 $('.btn-disable-outline').hide(); 781 $('.submit-mc').removeClass('d-none'); 782 } 783 } 784 else{ 785 $('.btn-disable-outline').show(); 786 $('.submit-mc').addClass('d-none'); 787 } 788 } 789 790 var formaction = ""; 791 var role = ""; 792 var email = ""; 793 var county = ""; 794 var grad = ""; 795 var age = []; 796 var gradYear = []; 797 var job = ""; 798 var interestLvl = ""; 799 var educationLvl = ""; 800 var phone = ""; 801 var formD = {}; 802 803 $('input[name="role"]').on('change', function(e){ 804 role = $(this).val(); 805 if(role == 'student'){ 806 $('div[data-role="educator"]').hide(); 807 $('div[data-role="adult"]').hide(); 808 $('div[data-role="parent"]').hide(); 809 $('div[data-role="student"]').show(); 810 $('select[data-role="student"]').show(); 811 $('select[data-role="parent"]').hide(); 812 $('select[data-role="adult"]').hide(); 813 $('select[data-role="educator"]').hide(); 814 } 815 else if(role == 'educator'){ 816 $('div[data-role="student"]').hide(); 817 $('div[data-role="adult"]').hide(); 818 $('div[data-role="parent"]').hide(); 819 $('div[data-role="educator"]').show(); 820 $('select[data-role="educator"]').show(); 821 $('select[data-role="student"]').hide(); 822 $('select[data-role="adult"]').hide(); 823 $('select[data-role="parent"]').show(); 824 } 825 else if(role == 'adult'){ 826 $('div[data-role="student"]').hide(); 827 $('div[data-role="adult"]').show(); 828 $('div[data-role="educator"]').hide(); 829 $('div[data-role="parent"]').hide(); 830 $('select[data-role="educator"]').hide(); 831 $('select[data-role="student"]').hide(); 832 $('select[data-role="adult"]').show(); 833 $('select[data-role="parent"]').show(); 834 } 835 else if(role == 'parent'){ 836 $('div[data-role="student"]').hide(); 837 $('div[data-role="adult"]').hide(); 838 $('div[data-role="educator"]').hide(); 839 $('div[data-role="parent"]').show(); 840 $('select[data-role="parent"]').show(); 841 $('select[data-role="educator"]').hide(); 842 $('select[data-role="student"]').hide(); 843 $('select[data-role="adult"]').hide(); 844 } 845 }); 846 847 $("input[name='studentsServed[]']").on('change click', function(){ 848 age = []; 849 $("input[name='studentsServed[]']:checked").each(function() { 850 console.log($(this).val()); 851 age.push($(this).val()); 852 }); 853 showStartButton(); 854 }); 855 856 $('select[name="graduationYear"]').on('change click', function(){ 857 grad = $(this).val(); 858 showStartButton(); 859 }); 860 861 $('select[name="educationLevel"]').on('change click', function(){ 862 educationLvl = $(this).val(); 863 showStartButton(); 864 }); 865 866 $('select[name="degreeInterest"]').on('change click', function(){ 867 interestLvl = $(this).val(); 868 showStartButton(); 869 }); 870 871 $('select[name="county"]').on('change click', function(){ 872 county = $(this).val(); 873 showStartButton(); 874 }); 875 876 $('select[name="jobType"]').on('change click', function(){ 877 job = $(this).val(); 878 showStartButton(); 879 }); 880 881 $('input[name="emailAddress"]').on('keyup', function(){ 882 email = $(this).val(); 883 showStartButton(); 884 }); 885 886 $('input[name="phone"]').on('keyup', function(){ 887 phone = $(this).val(); 888 showStartButton(); 889 }); 890 891 $('input[name="role"]').on('change click', function(){ 892 role = $(this).val(); 893 showStartButton(); 894 }); 895 $('input[name="ageVerification"]').on('change click', function(){ 896 ageVerification = $(this).prop('checked'); 897 showStartButton(); 898 }) 899 900 $('.submit-mc').on('click', function(e){ 901 e.preventDefault(); 902 let data = $('form[name="capture-fields"]').serialize(); 903 $.post({ 904 type: 'POST', 905 url: '/wp-json/send/v1/step1submit', 906 data: data, 907 }) 908 .done(function (data) { 909 console.log(data); 910 $('error-message').remove(); 911 $('form[name="capture-fields"]').html('<h4 class="text-lg text-finaidblue text-center mb-6">Thank you for your submission. Please click next to continue.</h4>'); 912 $('.step-1').text('Next'); 913 $('.step-1').click(); 914 }) 915 .error(function (data){ 916 console.log(data); 917 $('input[name="emailAddress"]').addClass('border-red-500'); 918 $('input[name="emailAddress"]').after('<span class="text-red-500 text-sm mb-4 error-message">Please enter a valid email address</span>'); 919 alert('There were some problems with the submission. Please check the error messages in the form and try again.'); 920 }) 921 }); 922 923 $('.send-interest-results').on('click', function(e){ 924 e.preventDefault(); 925 $(this).attr('disabled', true); 926 var email = $('input[name="send-email"]').val(); 927 var sendUrl = window.location.href; 928 var data = { 929 email: email, 930 body: sendUrl, 931 subject: 'Your Interest Profile Results', 932 } 933 $.post({ 934 type: 'POST', 935 url: '/wp-json/send/v1/email', 936 data : data, 937 }) 938 .done(function (data) { 939 $('#profile-modal .modal-body').html('<h4>Email Sent Successfully.</h4>'); 940 }) 941 .error(function (data){ 942 alert('There was a problem sending the email. Please try again later.'); 943 }) 944 }); 945 946 947 $('.send-profile').on('click', function(e){ 948 e.preventDefault(); 949 $(this).attr('disabled', true); 950 var email = $('input[name="send-email"]').val(); 951 var data = { 952 email: email, 953 housing: lshousing, 954 utilities: lsutilities, 955 food: lsfood, 956 transportation: lstransportation, 957 healthcare: lshealthcare, 958 leisure: lsleisure, 959 clothing: lsclothing, 960 personal: lspersonal, 961 misc: lsmiscellaneous, 962 debt: lsdebt, 963 family: lsfamily, 964 savings: lssavings, 965 monthly: lsmonthlyexpenses, 966 annual: lsannualexpenses, 967 incomeTax: lsincometax, 968 salaryNeeded: lssalaryneeded 969 } 970 $.post({ 971 type: 'POST', 972 url: '/wp-json/send/v1/results', 973 data: data, 974 }) 975 .done(function (data) { 976 $('#profile-modal .modal-body').html('<h4>Email Sent Successfully.</h4>'); 977 }) 978 .error(function (data){ 979 alert('There was a problem sending the email. Please try again later.'); 980 }) 981 }); 982 983 $('.submit-newsletter').on('click', function(e){ 984 e.preventDefault(); 985 986 if(role === ""){ 987 alert('You must pick a role.'); 988 return; 989 } 990 if(email === ""){ 991 alert('Please enter your email.') 992 return; 993 } 994 if(county === ""){ 995 alert('Please select your county.') 996 return; 997 } 998 999 if(role === 'student' && grad === ""){ 1000 alert('Please select your graduation year.') 1001 return; 1002 } 1003 1004 if(role === 'adult' && educationLvl === ""){ 1005 alert('Please select your level of education.') 1006 return; 1007 } 1008 if(role === 'adult' && interestLvl === ""){ 1009 alert('Please select your interest level.') 1010 return; 1011 } 1012 1013 if(role === 'educator' && age.length === 0){ 1014 alert('Please select your interest level.') 1015 return; 1016 } 1017 if(role === 'educator' && job === ""){ 1018 alert('Please select your job.') 1019 return; 1020 } 1021 if(role === 'parent' && gradYear.length === ""){ 1022 alert('Please select your child\'s graduation year(s).') 1023 return; 1024 } 1025 1026 let data = $('form[name="newsletter-info"]').serialize(); 1027 $.post({ 1028 type: 'POST', 1029 url: '/wp-json/send/v1/newsletterSubmit', 1030 data: data, 1031 }) 1032 .done(function (data) { 1033 $('form[name="newsletter-info"]').trigger("reset"); 1034 newsModal.hide(); 1035 $('#news-modal-toggle').remove(); 1036 $('#news-thankyou-message').css('display', 'block'); 1037 }) 1038 .error(function (data){ 1039 alert('There were some problems with the submission. Please check the error messages in the form and try again.'); 1040 }) 1041 }); 1042});
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.