1/* 2 * jQuery throttle / debounce - v1.1 - 3/7/2010 3 * http://benalman.com/projects/jquery-throttle-debounce-plugin/ 4 * 5 * Copyright (c) 2010 "Cowboy" Ben Alman 6 * Dual licensed under the MIT and GPL licenses. 7 * http://benalman.com/about/license/ 8 */ 9(function(b,c){var $=b.jQuery||b.Cowboy||(b.Cowboy={}),a;$.throttle=a=function(e,f,j,i){var h,d=0;if(typeof f!=="boolean"){i=j;j=f;f=c}function g(){var o=this,m=+new Date()-d,n=arguments;function l(){d=+new Date();j.apply(o,n)}function k(){h=c}if(i&&!h){l()}h&&clearTimeout(h);if(i===c&&m>e){l()}else{if(f!==true){h=setTimeout(i?k:l,i===c?e-m:e)}}}if($.guid){g.guid=j.guid=j.guid||$.guid++}return g};$.debounce=function(d,e,f){return f===c?a(d,e,false):a(d,f,e!==false)}})(this); 10 11var job_search_slug = '/job-search/'; 12 13(function( $ ) { 14 15 function ce_apply() { 16 console.log("Applying..."); 17 $('#job_section_wrapper').addClass('dimmed'); 18 var valid; 19 var applyform; 20 var applydata; 21 var applyredirect; 22 $('#ce_apply_loader').show(); 23 $('#ce_apply_loader2').show(); 24 $('#ce_apply_status').show(); 25 $('#ce_apply_loader_status1').show(); 26 $('.apply_messages').show(); 27 28 $('.ce_apply_submit_wrapper').hide(); 29 valid = $('#ce_apply_form').valid(); 30 // Phone validation 31 if ( $('#ce_apply_phone').hasClass('phone_us') ) { 32 var phoneval = $('#ce_apply_phone').val(); 33 phoneval = phoneval.match(/\d/g); 34 if ( null !== phoneval && 10 !== phoneval.length && $('#ce_apply_phone').hasClass('required') ) { 35 valid = false; 36 $('#ce_apply_phone').addClass('error'); 37 $('#phone_error').show().html('Please enter a valid phone number.'); 38 } 39 else { 40 $('#phone_error').hide().html(''); 41 } 42 } 43 44 // Checkbox Validation 45 if ( $('#ce_apply_skills\\[\\]-error' ).text().length > 0 ) { 46 $( '#ce_apply_skills\\[\\]-error' ).hide(); 47 $( '.ce_apply_skills').css('color', 'red'); 48 } 49 else { 50 $( '.ce_apply_skills').css('color', 'black'); 51 } 52 53 if ( ! valid ) { 54 $('#ce_apply_loader_status1').hide(); 55 $('#ce_apply_dialog_invalid').show(); 56 $('#ce_apply_dialog_invalid_lower').show(); 57 $('#ce_apply_loader').hide(); 58 $('#ce_apply_loader2').hide(); 59 $('#ce_apply_status').html('Please check the fields above and correct any issues.'); 60 $('#ce_apply_name').focus(); 61 $('.ce_apply_submit_wrapper').show(); 62 $('#ce_apply_submit').removeClass('hidden'); 63 console.log("Form invalid state"); 64 return false; 65 } 66 67 if ( $('#ce_resume').hasClass('required') ) { 68 // Resume validation 69 var fileInput = document.getElementById('ce_resume'); 70 var filePath = fileInput.value; 71 // Allowing file type 72 var allowedExtensions = 73 /(\.doc|\.pdf|\.docx)$/i; 74 75 if (!allowedExtensions.exec(filePath)) { 76 fileInput.value = ''; 77 $('#ce_apply_dialog_invalid').text("Please check your resume for allowed file formats."); 78 $('#ce_apply_dialog_invalid_lower').text("Please check your resume for allowed file formats."); 79 valid = false; 80 } 81 else { 82 if (typeof (fileInput.files) != "undefined") { 83 var size = parseFloat(fileInput.files[0].size / 1024).toFixed(2); 84 if ( size > 10000 ) { 85 $('#ce_apply_dialog_invalid').text("Your resume is too large for the system. Please upload a resume under 10MB in file size."); 86 $('#ce_apply_dialog_invalid_lower').text("Your resume is too large for the system. Please upload a resume under 10MB in file size."); 87 valid = false; 88 } 89 90 // Resume validation 91 var fileInput = document.getElementById('ce_resume'); 92 if ( '' !== fileInput.value ) { 93 var filePath = fileInput.value; 94 // Allowing file type 95 var allowedExtensions = 96 /(\.doc|\.pdf|\.rtf|\.txt|\.docx)$/i; 97 98 if (!allowedExtensions.exec(filePath)) { 99 fileInput.value = ''; 100 $('#ce_apply_dialog_invalid').text("Please check your resume for allowed file formats.").show(); 101 $('#ce_apply_dialog_invalid_lower').text("Please check your resume for allowed file formats.").show(); 102 $('#ce_apply_submit').focus(); 103 valid = false; 104 } 105 else { 106 if (typeof (fileInput.files) != "undefined") { 107 var size = parseFloat(fileInput.files[0].size / 1024).toFixed(2); 108 if ( size > 10000 ) { 109 $('#ce_apply_dialog_invalid').text("Your resume is too large for the system. Please upload a resume under 10MB in file size."); 110 $('#ce_apply_dialog_invalid_lower').text("Your resume is too large for the system. Please upload a resume under 10MB in file size."); 111 valid = false; 112 } 113 } 114 } 115 } 116 } 117 } 118 } 119 120 if (valid) { 121 setTimeout( function() { 122 $('#ce_apply_loader_status1').hide(); 123 $('#ce_apply_loader_status2').show(); 124 }, 1000); 125 126 console.log( "Form Valid - submitting..." ); 127 $('#ce_apply_submit').addClass('hidden'); 128 $('#ce_apply_status').html('').hide(); 129 applyform = $('#ce_apply_form')[0]; 130 applydata = new FormData(applyform); 131 applydata.append('action', 'ce_apply'); 132 applydata.append('ce_action', 'apply'); 133 applyredirect = $('#ce_redirect').val(); 134 135 // Create XHR instance 136 const xhr = new XMLHttpRequest(); 137 const dynamicTimeout = calculateTimeout(applydata); 138 139 // Add progress handler 140 xhr.upload.addEventListener('progress', function(e) { 141 if (e.lengthComputable) { 142 const percentComplete = (e.loaded / e.total) * 100; 143 144 // Update existing status message 145 $('#ce_apply_loader_status2').hide(); 146 $('#ce_apply_loader_status3').show().html(`Uploading: ${Math.round(percentComplete)}%`); 147 148 // Add progress bar inside existing loader 149 if (!$('#ce_upload_progress').length) { 150 $('#ce_apply_loader').append(` 151 <div id="ce_upload_progress" style="width: 100%; margin: 10px 0;"> 152 <div style="width: 100%; background: #f0f0f0; border-radius: 3px;"> 153 <div class="progress-bar" style="width: 0%; height: 20px; background: #4CAF50; border-radius: 3px; transition: width 0.3s;"></div> 154 </div> 155 </div> 156 `); 157 }
158 $('#ce_upload_progress .progress-bar').css('width', `${percentComplete}%`); 159 } 160 }); 161 162 xhr.open('POST', ce_connect_object.ajax_url, true); 163 xhr.timeout = dynamicTimeout; 164 165 xhr.onreadystatechange = function() { 166 if (xhr.readyState === 4) { 167 cleanupProgress(); 168 if (xhr.status === 200) { 169 // Your existing success handling 170 const response = xhr.responseText; 171 if (response.startsWith('success')) { 172 console.log( "Form Processed - redirecting..." + response ); 173 $('.ce_message').hide(); 174 $('#ce_apply_loader').hide(); 175 $('#ce_apply_loader2').hide(); 176 $('.apply_messages').hide(); 177 // Split the response and parse the integers 178 const parts = response.split('|'); 179 if (parts.length === 3) { 180 const talent_id = parseInt(parts[1], 10); 181 const job_id = parseInt(parts[2], 10); 182 183 $('.ce_apply').hide(); 184 $('#ce_apply_dialog_success').show().focus(); 185 if ('' !== applyredirect) { 186 $('#ce_apply_dialog_error').show().html("Redirecting - please click <a href=" + applyredirect + ">here</a> if not the page does not load."); 187 $('#ce_apply_loader_status3').html("Redirecting...<br/> <a href=" + applyredirect + ">Click here if the page does not reload</a>"); 188 window.location.href = applyredirect + '?jid=' + job_id + '&tid=' + talent_id; 189 } 190 setTimeout(function () { 191 $('#ce_apply_loader_status3').hide(); 192 }, 1000); 193 return false; 194 } 195 else { 196 $('.ce_apply').hide(); 197 $('#ce_apply_dialog_success').show().focus(); 198 if ('' !== applyredirect) { 199 $('#ce_apply_dialog_error').show().html("Redirecting - please click <a href=" + applyredirect + ">here</a> if not the page does not load."); 200 $('#ce_apply_loader_status3').html("Redirecting...<br/> <a href=" + applyredirect + ">Click here if the page does not reload</a>"); 201 window.location.href = applyredirect; 202 } 203 setTimeout(function () { 204 $('#ce_apply_loader_status3').hide(); 205 }, 1000); 206 return false; 207 } 208 } 209 else if (response === 'resume' ) { 210 $('#ce_apply_dialog_error').show().html("We received your application, but could not read your resume.<br>Please try another format if possible. [EC03]"); 211 setTimeout(function() { $('#ce_apply_action').fadeIn();}, 200); 212 $('#ce_apply_submit').removeClass('hidden'); 213 $('.ce_apply_submit_wrapper').show(); 214 setTimeout( function() { 215 $('#ce_apply_loader_status3').hide(); 216 $('#ce_apply_loader').hide(); 217 }, 1000); 218 } 219 else if (response === 'international' ) { 220 $('#ce_apply_dialog_error').show().html("Sorry, we cannot accept international applications."); 221 setTimeout(function() { $('#ce_apply_action').fadeIn();}, 200); 222 $('#ce_apply_submit').removeClass('hidden'); 223 $('.ce_apply_submit_wrapper').show(); 224 setTimeout( function() { 225 $('#ce_apply_loader_status3').hide(); 226 }, 1000); 227 } 228 else { 229 $('#ce_apply_dialog_error').show().html("We may have had an issue connecting to our systems. Please try again. [EC04]"); 230 $('#ce_apply_loader_status3').html("We may have had an issue connecting to our systems. Please try again. [EC04]"); 231 setTimeout(function() { $('#ce_apply_action').fadeIn();}, 200); 232 $('#ce_apply_submit').removeClass('hidden'); 233 $('.ce_apply_submit_wrapper').show(); 234 setTimeout( function() { 235 $('#ce_apply_loader_status3').hide(); 236 $('#ce_apply_loader').hide(); 237 }, 1000); 238 } 239 } 240 } 241 }; 242 243 xhr.onerror = function() { 244 $('#ce_apply_dialog_error').show().html("An unknown issue has occurred. Please try again. [EC02]"); 245 $('#ce_apply_loader_status3').html("We may have had an issue connecting to our systems. Please try again. [EC02]"); 246 $('#ce_apply_action').fadeIn(); 247 $('#ce_apply_submit').removeClass('hidden'); 248 $('.ce_apply_submit_wrapper').show(); 249 $('#ce_apply_loader').hide(); 250 }; 251 252 xhr.ontimeout = function() { 253 $('#ce_apply_dialog_error').show().html("We may have had an issue connecting to our systems. Please try again. [EC01]"); 254 $('#ce_apply_loader_status3').html("We may have had an issue connecting to our systems. Please try again. [EC01]"); 255 $('#ce_apply_action').fadeIn(); 256 $('#ce_apply_submit').removeClass('hidden'); 257 $('.ce_apply_submit_wrapper').show(); 258 $('#ce_apply_loader').hide(); 259 }; 260 261 xhr.send(applydata); 262 } 263 else { 264 console.log("Form invalid state"); 265 $('#ce_apply_loader_status1').hide(); 266 $('#ce_apply_dialog_invalid').show(); 267 $('#ce_apply_dialog_invalid_lower').show(); 268 $('#ce_apply_loader').hide(); 269 $('#ce_apply_loader2').hide(); 270 $('#ce_apply_status').html('Please check the fields above and correct any issues. [EC05]'); 271 $('#ce_apply_name').focus(); 272 $('.ce_apply_submit_wrapper').show(); 273 $('#ce_apply_submit').removeClass('hidden'); 274 } 275 276 } 277 278 function calculateTimeout(formData) { 279 let totalSize = 0; 280 const resumeFile = document.getElementById('ce_resume').files[0]; 281 if (resumeFile) { 282 totalSize += resumeFile.size; 283 } 284 285 // More generous timeouts for slow connections 286 const baseTimeout = 45000; // 45 seconds base 287 const timeoutPerMB = 5000; // 5 seconds per MB 288 const maxTimeout = 180000; // 3 minutes max 289 290 const timeout = baseTimeout + (totalSize / (1024 * 1024) * timeoutPerMB); 291 return Math.min(timeout, maxTimeout); 292 } 293 294 function cleanupProgress() { 295 $('#ce_upload_progress').remove(); 296 $('#ce_apply_loader_status3').hide(); 297 } 298 299 // catch dialog if opened within a viewport smaller than the dialog width 300 $(document).on("dialogopen", ".ui-dialog", function (event, ui) { 301 fluidDialog(); 302 });
303 304 function fluidDialog() { 305 var $visible = $(".ui-dialog:visible"); 306 // each open dialog 307 $visible.each(function () { 308 var $this = $(this); 309 var dialog = $this.find(".ui-dialog-content").data("ui-dialog"); 310 // if fluid option == true 311 if (dialog.options.fluid) { 312 var wWidth = $(window).width(); 313 // check window width against dialog width 314 if (wWidth < (parseInt(dialog.options.maxWidth) + 50)) { 315 // keep dialog from filling entire screen 316 $this.css("max-width", "90%"); 317 } else { 318 // fix maxWidth bug 319 $this.css("max-width", dialog.options.maxWidth + "px"); 320 } 321 //reposition dialog 322 dialog.option("position", dialog.options.position); 323 } 324 }); 325 326 } 327 328 // .ready() is now deprecated - this runs when the dom is ready. 329 $(function () { 330 331 var job_referrer = document.referrer 332 $('#cem_job_ref').val(job_referrer); 333 334 var url_string = window.location.href; 335 var url = new URL(url_string); 336 var ref = url.searchParams.get("ref"); 337 338 if ( ref !== null && ref !== '' ) { 339 $('#cem_job_ref').val(ref); 340 } 341 342 var current_url = window.location.href; 343 $('#cem_form_url').val(current_url); 344 345 $('#ce_subscribe_modal').dialog({ 346 autoOpen: false, 347 title: 'Apply Now', 348 width: 'auto', // overcomes width:'auto' and maxWidth bug 349 maxWidth: 800, 350 height: 'auto', 351 modal: true, 352 fluid: true, //new option 353 resizable: false, 354 open: ce_close_apply 355 }); 356 357 $('#ce_refer_modal_open').on('click', function (e) { 358 e.preventDefault(); 359 $('#ce_refer_modal').dialog("open"); 360 }); 361 362 $('#ce_refer_modal').dialog({ 363 autoOpen: false, 364 title: 'Refer a Friend', 365 width: 'auto', // overcomes width:'auto' and maxWidth bug 366 maxWidth: 800, 367 height: 'auto', 368 modal: true, 369 fluid: true, //new option 370 resizable: false, 371 open: ce_close_apply 372 }); 373 374 $('#ce_subscribe_modal_open').click(function (e) { 375 e.preventDefault(); 376 $('#ce_subscribe_modal').dialog("open"); 377 }); 378 379 $('#ce_subscribe_modal_open2').click(function (e) { 380 e.preventDefault(); 381 $('#ce_subscribe_modal').dialog("open"); 382 }); 383 384 $('#ce_apply_modal').dialog({ 385 autoOpen: false, 386 title: 'Apply Now', 387 width: 'auto', // overcomes width:'auto' and maxWidth bug 388 maxWidth: 800, 389 height: 'auto', 390 modal: true, 391 fluid: true, //new option 392 resizable: false, 393 open: ce_close_apply 394 }); 395 396 $('#ce_apply_modal_open').click(function (e) { 397 e.preventDefault(); 398 $('#ce_apply_modal').dialog("open"); 399 }); 400 401 $('.job_apply_go').click(function (e) { 402 e.preventDefault(); 403 var job_id = $(this).attr('rel'); 404 console.log("Loading apply..." + job_id); 405 $('#ce_apply_modal').dialog("open"); 406 407 $('html, body').animate({ scrollTop: $('#ce_apply_modal').offset().top }, 'fast'); 408 409 $('#ce_job_id').val(job_id); 410 }); 411 412 $('#ce_apply_modal_open_footer').click(function (e) { 413 e.preventDefault(); 414 $('#ce_apply_modal').dialog("open"); 415 }); 416 417 $('#ce_apply_form_go').click(function (e) { 418 e.preventDefault(); 419 $('#ce_apply_name').focus(); 420 }); 421 422 $('#ce_apply_form_go_footer').click(function (e) { 423 e.preventDefault(); 424 $('#ce_apply_name').focus(); 425 }); 426 427 var utm_source = getUrlParameter('utm_source'); 428 var utm_medium = getUrlParameter('utm_medium'); 429 var utm_campaign = getUrlParameter('utm_campaign'); 430 var utm_content = getUrlParameter('utm_content'); 431 var utm_term = getUrlParameter('utm_term'); 432 433 var job_ref = getUrlParameter('ref'); 434 var job_ref2 = getUrlParameter('jsrc'); 435 var job_referrer = document.referrer 436 437 if (undefined !== utm_source && utm_source !== null && utm_source !== '') { 438 var utm_source_week = $.cookie('cem_utm_source'); 439 console.log("Found UTM - creating cookie"); 440 if (utm_source_week == null || utm_source_week == '') { 441 $.cookie('cem_utm_source', utm_source, {path: '/'}); 442 } 443 $('#cem_utm_source').val(utm_source); 444 } else { 445 var utm_source_week = $.cookie('cem_utm_source'); 446 if (utm_source_week != null && utm_source_week != '') { 447 $('#cem_utm_source').val(utm_source_week); 448 } 449 450 } 451 452 if (undefined !== utm_medium && utm_medium !== null && utm_medium !== '') { 453 var utm_medium_week = $.cookie('cem_utm_medium'); 454 if (utm_medium_week == null || utm_medium_week == '') { 455 $.cookie('cem_utm_medium', utm_medium, {path: '/'}); 456 } 457 $('#cem_utm_medium').val(utm_medium); 458 } else { 459 var utm_medium_week = $.cookie('cem_utm_medium'); 460 if (utm_medium_week != null && utm_medium_week != '') { 461 $('#cem_utm_medium').val(utm_medium_week); 462 } 463 } 464 465 if (undefined !== utm_campaign && utm_campaign !== null && utm_campaign !== '') { 466 var utm_campaign_week = $.cookie('cem_utm_campaign'); 467 if (utm_campaign_week == null || utm_campaign_week == '') { 468 $.cookie('cem_utm_campaign', utm_campaign, {path: '/'}); 469 } 470 $('#cem_utm_campaign').val(utm_campaign); 471 } else { 472 var utm_campaign_week = $.cookie('cem_utm_campaign'); 473 if (utm_campaign_week != null && utm_campaign_week != '') { 474 $('#cem_utm_campaign').val(utm_campaign_week); 475 } 476 } 477
478 if (undefined !== utm_content && utm_content !== null && utm_content !== '') { 479 var utm_content_week = $.cookie('cem_utm_content'); 480 if (utm_content_week == null || utm_content_week == '') { 481 $.cookie('cem_utm_content', utm_content, {path: '/'}); 482 } 483 $('#cem_utm_content').val(utm_content); 484 } else { 485 var utm_content_week = $.cookie('cem_utm_content'); 486 if (utm_content_week != null && utm_content_week != '') { 487 $('#cem_utm_content').val(utm_content_week); 488 } 489 } 490 491 if (undefined !== utm_term && utm_term !== null && utm_term !== '') { 492 var utm_term_week = $.cookie('cem_utm_term'); 493 if (utm_term_week == null || utm_term_week == '') { 494 $.cookie('cem_utm_term', utm_term, {path: '/'}); 495 } 496 $('#cem_utm_term').val(utm_term); 497 } else { 498 var utm_term_week = $.cookie('cem_utm_term'); 499 if (utm_term_week != null && utm_term_week != '') { 500 $('#cem_utm_term').val(utm_term_week); 501 } 502 } 503 504 if (undefined !== job_ref && job_ref !== null && job_ref !== '') { 505 var job_ref_week = $.cookie('cem_job_ref'); 506 if (job_ref_week == null || job_ref_week == '') { 507 $.cookie('cem_job_ref', job_ref, {path: '/'}); 508 } 509 $('#cem_job_ref').val(job_ref); 510 } else if (undefined !== job_ref2 && job_ref2 !== null && job_ref2 !== '') { 511 var job_ref_week = $.cookie('cem_job_ref'); 512 if (job_ref_week == null || job_ref_week == '') { 513 $.cookie('cem_job_ref', job_ref2, {path: '/'}); 514 } 515 $('#cem_job_ref').val(job_ref2); 516 } else { 517 var job_ref_week = $.cookie('cem_job_ref'); 518 if (job_ref_week != null && job_ref_week != '') { 519 $('#cem_job_ref').val(job_ref_week); 520 } 521 } 522 523 if (undefined !== job_referrer && job_referrer !== null && job_referrer !== '') { 524 $('#cem_form_ref').val(job_referrer); 525 } 526 527 // Job select using sidebar categories - should auto submit on click. 528 $('.job_category_selector').on('click', function(e) { 529 e.preventDefault(); 530 var job_category_clicked = $(this).attr('id'); 531 job_category_clicked = job_category_clicked.replace( 'jcr_', '', job_category_clicked ); 532 job_category_clicked = job_category_clicked.replace( 'jc_', '', job_category_clicked ); 533 console.log( job_category_clicked ); 534 $(this).addClass('selected'); 535 var searchform = $('#ce_search_form')[0]; 536 var searchdata = new FormData( searchform ); 537 searchdata.append( 'action', 'ce_search_parameter' ); 538 searchdata.append( 'parameter_type', 'job_tax_job-category' ); 539 searchdata.append( 'job_tax_job-category', job_category_clicked ); 540 if ( $(this).hasClass('cat_selected') ) { 541 console.log( 'remove category' ); 542 searchdata.append( 'remove', 'true' ); 543 } 544 jQuery.ajax({ 545 url: ce_connect_object.ajax_url, 546 type: 'post', 547 processData: false, 548 contentType: false, 549 cache: false, 550 data: searchdata, 551 success: function (response) { 552 if (response === 'success') { 553 var url = buildURL(); 554 console.log( "Parameter Processed - redirecting..." + url ); 555 window.location.href = url + ''; 556 } 557 } 558 }); 559 }); 560 561 // Job select using sidebar categories - should auto submit on click. 562 $('.job_taxonomy_selector').on('click', function(e) { 563 e.preventDefault(); 564 var job_taxonomy_clicked = $(this).attr('id'); 565 job_taxonomy_clicked = job_taxonomy_clicked.replace( 'jcr_', '', job_taxonomy_clicked ); 566 job_taxonomy_clicked = job_taxonomy_clicked.replace( 'jc_', '', job_taxonomy_clicked ); 567 var job_taxonomy_type_clicked = $(this).attr('data-tax'); 568 console.log( job_taxonomy_type_clicked + ':' + job_taxonomy_clicked ); 569 $(this).addClass('selected'); 570 var searchform = $('#ce_search_form')[0]; 571 var searchdata = new FormData( searchform ); 572 searchdata.append( 'action', 'ce_search_parameter' ); 573 searchdata.append( 'parameter_type', 'job_tax_' + job_taxonomy_type_clicked ); 574 searchdata.append( 'job_tax_' + job_taxonomy_type_clicked, job_taxonomy_clicked ); 575 if ( $(this).hasClass('cat_selected') ) { 576 console.log( 'remove category' ); 577 searchdata.append( 'remove', 'true' ); 578 } 579 jQuery.ajax({ 580 url: ce_connect_object.ajax_url, 581 type: 'post', 582 processData: false, 583 contentType: false, 584 cache: false, 585 data: searchdata, 586 success: function (response) { 587 if (response === 'success') { 588 var url = buildURL(); 589 console.log( "Parameter Processed - redirecting..." + url ); 590 window.location.href = url + ''; 591 } 592 } 593 });
594 }); 595 596 //Job checkboxes with auto refresh 597 $('.job-cat').on('click', function (e) { 598 var job_cats = $('job-cat.cat-selected>input').attr('value'); 599 e.preventDefault(); 600 $(this).toggleClass('cat_selected'); 601 var job_category_clicked = $(this).find('input').attr('value'); 602 // job_category_clicked = job_category_clicked.replace( 'jcr_', '', job_category_clicked ); 603 // job_category_clicked = job_category_clicked.replace( 'jc_', '', job_category_clicked ); 604 console.log(job_category_clicked); 605 var searchform = $('#ce_search_form')[0]; 606 var searchdata = new FormData(searchform); 607 searchdata.append('action', 'ce_search_parameter'); 608 searchdata.append('parameter_type', 'job_tax_job-category'); 609 searchdata.append('job_tax_job-category', job_category_clicked); 610 if ($(this).hasClass('cat_selected')) { 611 console.log('remove category'); 612 searchdata.append('remove', 'true'); 613 } 614 console.log(searchdata); 615 jQuery.ajax({ 616 url: ce_connect_object.ajax_url, 617 type: 'post', 618 processData: false, 619 contentType: false, 620 cache: false, 621 data: searchdata, 622 success: function (response) { 623 if (response === 'success') { 624 var url = buildURL(); 625 console.log( "Parameter Processed - redirecting..." + url ); 626 window.location.href = url; 627 return false; 628 } else { 629 console.log('Unsucessful update'); 630 } 631 } 632 }); 633 }); 634 635 $('.job-checkbox').on('click', function (e) { 636 e.preventDefault(); 637 $(this).toggleClass('checkbox_selected'); 638 $(this).toggleClass('cat_selected'); 639 }); 640 641 function buildURL() { 642 console.log( "Bulding URL..." ); 643 var searchParams = job_search_slug + '?'; 644 var cat_string = ''; 645 var cats = []; 646 var spes = []; 647 var emps = []; 648 var taxonomy = ''; 649 650 $(".job_category_selector.selected").each(function (index) { 651 var job_category_clicked = $(this).attr('id'); 652 taxonomy = $(this).attr('data-tax'); 653 job_category_clicked = job_category_clicked.replace( 'jcr_', '', job_category_clicked ); 654 job_category_clicked = job_category_clicked.replace( 'jc_', '', job_category_clicked ); 655 if ( "specialty" === taxonomy ) { 656 spes.push( encodeURIComponent(job_category_clicked) ); 657 } 658 else if ( 'job-category' === taxonomy ) { 659 cats.push( encodeURIComponent(job_category_clicked) ); 660 } 661 else if ( 'employment-type' === taxonomy ) { 662 emps.push( encodeURIComponent(job_category_clicked) ); 663 } 664 }); 665 666 $(".job_taxonomy_selector.cat_selected").each(function (index) { 667 var job_category_clicked = $(this).attr('id'); 668 taxonomy = $(this).attr('data-tax'); 669 job_category_clicked = job_category_clicked.replace( 'jcr_', '', job_category_clicked ); 670 job_category_clicked = job_category_clicked.replace( 'jc_', '', job_category_clicked ); 671 if ( "specialty" === taxonomy ) { 672 spes.push( encodeURIComponent(job_category_clicked) ); 673 } 674 else if ( 'job-category' === taxonomy ) { 675 cats.push( encodeURIComponent(job_category_clicked) ); 676 } 677 else if ( 'employment-type' === taxonomy ) { 678 emps.push( encodeURIComponent(job_category_clicked) ); 679 } 680 }); 681 682 $(".job_taxonomy_selector.selected").each(function (index) { 683 var job_category_clicked = $(this).attr('id'); 684 taxonomy = $(this).attr('data-tax'); 685 job_category_clicked = job_category_clicked.replace( 'jcr_', '', job_category_clicked ); 686 job_category_clicked = job_category_clicked.replace( 'jc_', '', job_category_clicked ); 687 if ( "specialty" === taxonomy ) { 688 spes.push( encodeURIComponent(job_category_clicked) ); 689 } 690 else if ( 'job-category' === taxonomy ) { 691 cats.push( encodeURIComponent(job_category_clicked) ); 692 } 693 else if ( 'employment-type' === taxonomy ) { 694 emps.push( encodeURIComponent(job_category_clicked) ); 695 } 696 }); 697 698 $(".job-checkbox.cat_selected").each(function (index) { 699 var job_category_clicked = $(this).attr('id'); 700 taxonomy = $(this).attr('data-tax_name'); 701 job_category_clicked = job_category_clicked.replace( 'jcr_', '', job_category_clicked ); 702 job_category_clicked = job_category_clicked.replace( 'jc_', '', job_category_clicked ); 703 if ( "specialty" === taxonomy ) { 704 spes.push( encodeURIComponent(job_category_clicked) ); 705 } 706 else if ( 'job-category' === taxonomy ) { 707 cats.push( encodeURIComponent(job_category_clicked) ); 708 } 709 else if ( 'employment-type' === taxonomy ) { 710 emps.push( encodeURIComponent(job_category_clicked) ); 711 } 712 }); 713 714 $("#job_tax_job-category :selected").each( function(index) { 715 var job_category_clicked = $(this).val(); 716 cats.push( encodeURIComponent(job_category_clicked) ); 717 }); 718 719 if (cats.length > 0) { 720 let unique = [...new Set(cats)]; 721 console.log('Job Cat SEL: ' + unique); 722 cat_string = unique.join(';'); 723 if ('' !== cat_string) { 724 searchParams += 'job_tax_job-category=' + cat_string; 725 } else { 726 var job_cats = [] 727 $('job-cat.cat-selected>input').each(function (index) { 728 job_cats.push($(this).find('input').attr('value')); 729 }); 730 for (var i = 0; i <= job_cats.length - 1; i++) { 731 cat_string += job_cats[i].text + ';'; 732 } 733
734 if ( '' !== cat_string ) { 735 cat_string = $('#job_tax_job-category').val(); 736 if ( Array.isArray( cat_string ) && cat_string.length ) { 737 try { 738 var cat_string_s = ''; 739 for (var i = 0; i <= cat_string.length - 1; i++) { 740 cat_string_s += cat_string[i] + ';'; 741 } 742 cat_string = cat_string_s; 743 } 744 catch (exstr) { 745 746 console.error( exstr ); 747 } 748 } 749 else { 750 try { 751 cat_string = cat_string.replace(/,/g, ";"); 752 } 753 catch( exstr2 ) { 754 755 } 756 } 757 } 758 759 searchParams += 'job_tax_job-category=' + cat_string; 760 } 761 } 762 763 if (spes.length > 0) { 764 let spes_unique = [...new Set(spes)]; 765 console.log('Job Specialty SEL: ' + spes_unique); 766 spes_string = spes_unique.join(';'); 767 if ('' !== spes_string) { 768 searchParams += '&job_tax_specialty=' + spes_string; 769 } 770 else { 771 var job_spes = [] 772 $('job-cat.cat-selected>input').each(function (index) { 773 job_spes.push($(this).find('input').attr('value')); 774 }); 775 for (var i = 0; i <= job_spes.length - 1; i++) { 776 spes_string += job_spes[i].text + ';'; 777 } 778 779 if ( '' !== spes_string ) { 780 spes_string = $('#job_tax_specialty').val(); 781 if ( Array.isArray( spes_string ) && spes_string.length ) { 782 try { 783 var spes_string_s = ''; 784 for (var i = 0; i <= spes_string.length - 1; i++) { 785 spes_string_s += spes_string[i] + ';'; 786 } 787 spes_string = spes_string_s; 788 } 789 catch (exstr) { 790 791 console.error( exstr ); 792 } 793 } 794 else { 795 try { 796 spes_string = spes_string.replace(/,/g, ";"); 797 } 798 catch( exstr2 ) { 799 800 } 801 } 802 } 803 804 searchParams += '&job_tax_specialty=' + spes_string; 805 } 806 } 807 808 if (emps.length > 0) { 809 let emps_unique = [...new Set(emps)]; 810 console.log('Job Type SEL: ' + emps_unique); 811 emps_unique = emps_unique.join(';'); 812 if ('' !== emps_unique) { 813 searchParams += '&job_tax_employment-type=' + emps_unique; 814 } 815 else { 816 var job_emps = [] 817 $('job-cat.cat-selected>input').each(function (index) { 818 job_emps.push($(this).find('input').attr('value')); 819 }); 820 for (var i = 0; i <= job_emps.length - 1; i++) { 821 emps_string += job_emps[i].text + ';'; 822 } 823 824 if ( '' !== spes_string ) { 825 emps_string = $('#job_tax_employment-type').val(); 826 if ( Array.isArray( emps_string ) && emps_string.length ) { 827 try { 828 var spes_string_s = ''; 829 for (var i = 0; i <= emps_string.length - 1; i++) { 830 emps_string_s += emps_string[i] + ';'; 831 } 832 emps_string = emps_string_s; 833 } 834 catch (exstr) { 835 console.error( exstr ); 836 } 837 } 838 else { 839 try { 840 emps_string = emps_string.replace(/,/g, ";"); 841 } 842 catch( exstr2 ) { 843 844 } 845 } 846 } 847 848 searchParams += '&job_tax_employment-type=' + emps_string; 849 } 850 } 851 852 if ($('#filter_location').val() && '' !== $('#filter_location').val()) { 853 searchParams += '&filter_location=' + $('#filter_location').val(); 854 } 855 if ($('#filter_citystate').val() && '' !== $('#filter_citystate').val()) { 856 searchParams += '&job_city=' + $('#filter_citystate').val(); 857 } 858 if ($('#job_state').val() && '' !== $('#job_state').val()) { 859 searchParams += '&job_state=' + $('#job_state').val(); 860 } 861 if ($('#job_zip').val() && '' !== $('#job_zip').val()) { 862 searchParams += '&job_zip=' + $('#job_zip').val(); 863 } 864 if ($('#job_distance').val() && '' !== $('#job_distance').val()) { 865 searchParams += '&job_distance=' + $('#job_distance').val(); 866 } 867 if ($('#job_tax_employment-type').val() && $('#job_tax_employment-type').val().length) { 868 var type_string = $('#job_tax_employment-type').val();
869 if ( '' !== type_string ) { 870 if ( type_string.length && Array.isArray( type_string ) ) { 871 try { 872 var type_string_s = ''; 873 for (var i = 0; i <= type_string.length - 1; i++) { 874 type_string_s += type_string[i] + ';'; 875 } 876 type_string = type_string_s; 877 } 878 catch (exstr) { 879 } 880 } 881 else { 882 try { 883 type_string = type_string.replace(/,/g, ";"); 884 } 885 catch( exstr2 ) { 886 } 887 } 888 } 889 890 searchParams += '&job_tax_employment-type=' + type_string; 891 } 892 if ($('#job_tax_job-location').val() && $('#job_tax_job-location').val().length) { 893 searchParams += '&job_tax_job-location=' + $('#job_tax_job-location').val(); 894 } 895 if ($('#job_keywords').val()) { 896 searchParams += '&job_keywords=' + $('#job_keywords').val(); 897 } 898 console.log('Current URL: ' + searchParams); 899 return searchParams; 900 } 901 902 $('.remove_filter').on('click', function(e) { 903 e.preventDefault(); 904 var job_filter_clicked = $(this).attr('id'); 905 var filter_type = $(this).attr('rel'); 906 job_filter_clicked = job_filter_clicked.replace( 'jcr_', '', job_filter_clicked ); 907 if ( 'job_tax_specialties' === filter_type ) { 908 $('.jobs_side_categories .cat_selected').removeClass('cat_selected'); 909 } 910 else if ( 'job_tax_categories' === filter_type ) { 911 $('.jobs_side_categories .cat_selected').removeClass('cat_selected'); 912 } 913 else if ( 'zipcode' === filter_type ) { 914 $('#job_zip').val(''); 915 $('#job_distance').val(''); 916 } 917 else if ( 'radius' === filter_type ) { 918 $('#job_zip').val(''); 919 $('#job_distance').val(''); 920 } 921 else if ( 'job_tax_employment-type' === filter_type ) { 922 $('#job_tax_employment-type').val(''); 923 } 924 else if ( 'keywords' === filter_type ) { 925 $('#job_keywords').val(''); 926 } 927 else if ( 'job_tax_job-location' === filter_type ) { 928 $('#job_tax_job-location').val(''); 929 } 930 console.log( job_filter_clicked ); 931 var searchform = $('#ce_search_form')[0]; 932 var searchdata = new FormData( searchform ); 933 searchdata.append( 'action', 'ce_search_parameter' ); 934 searchdata.append( filter_type, job_filter_clicked ); 935 searchdata.append( 'parameter_type', filter_type ); 936 searchdata.append( 'parameter_value', job_filter_clicked ); 937 console.log( 'remove filter' ); 938 searchdata.append( 'remove', 'true' ); 939 jQuery.ajax({ 940 url: ce_connect_object.ajax_url, 941 type: 'post', 942 processData: false, 943 contentType: false, 944 cache: false, 945 data: searchdata, 946 success: function (response) { 947 if (response === 'success') { 948 var url = buildURL(); 949 console.log( "Parameter Processed - redirecting..." + url ); 950 window.location.href = url + ''; 951 } 952 } 953 }); 954 }); 955 956 957 // $('.jobs_filter_header').css('visibility', 'visible'); 958 if ($('#filter_zip').length) { 959 if ($('#filter_zip_status').val() === 'empty') { 960 $('#filter_zip').hide(); 961 } else { 962 setTimeout(function () { 963 var left_set = $('#location_wrapper').position(); 964 $('#filter_citystate').hide(); 965 $('#filter_zip').css('left', (left_set.left + 2) + 'px'); 966 $('#filter_zip').slideDown('slow'); 967 }, 800); 968 } 969 if ($('#filter_citystate_status').val() === 'empty') { 970 $('#filter_citystate').hide(); 971 } else { 972 setTimeout(function () { 973 var left_set = $('#location_wrapper').position(); 974 $('#filter_zip').hide(); 975 $('#filter_citystate').css('left', (left_set.left + 2) + 'px'); 976 $('#filter_citystate').slideDown('slow'); 977 }, 800); 978 } 979 } 980 // $( "input.select2-search__field" ).attr( 'autocomplete', 'new-password' ); 981 $('#filter_location').on('change', function (e) { 982 var location_filter = $(this).val(); 983 var left_set = $('#location_wrapper').position(); 984 if ('zip' === location_filter) { 985 $('#filter_citystate').hide(); 986 $('#filter_zip').css('left', (left_set.left + 2) + 'px'); 987 $('#filter_zip').slideDown('slow'); 988 } else if ('citystate' === location_filter) { 989 $('#filter_zip').hide(); 990 $('#filter_citystate').css('left', (left_set.left + 2) + 'px'); 991 $('#filter_citystate').slideDown('slow'); 992 } else { 993 $('#filter_zip').hide(); 994 $('#filter_citystate').hide(); 995 } 996 997 }); 998 999 $('#clear_job_filters').on('click', function (e) { 1000 e.preventDefault(); 1001 document.getElementById('ce_search_form').reset(); 1002 $('#job_tax_sector').val(''); 1003 $('#job_tax_employment-type').val(''); 1004 $('#job_tax_job-category').val(''); 1005 $('#job_tax_industry').val(''); 1006 $('#job_distance').val(''); 1007 $('#job_keywords').val(''); 1008 $('#job_zip').val(''); 1009 $('#job_tax_job-board').val(''); 1010 $('#job_city').val(''); 1011 $('#job_state').val(''); 1012 $('#filter_location').val(''); 1013 $('#job_tax_job-location').val(''); 1014 // $('.js-select2').val(null).trigger('change'); 1015 $(".cat_selected").removeClass('cat-selected') 1016 $('#job_tax_job-category').val('new'); 1017 var searchform; 1018 var searchdata; 1019 searchform = $('#ce_search_form')[0]; 1020 searchdata = new FormData(searchform); 1021 searchdata.append('action', 'ce_search'); 1022 searchdata.append('ce_action', 'search'); 1023 jQuery.ajax({ 1024 url: ce_connect_object.ajax_url, 1025 type: 'post', 1026 processData: false, 1027 contentType: false, 1028 cache: false, 1029 data: searchdata, 1030 success: function (response) { 1031 if (response === 'success') { 1032 var url = buildURL(); 1033 console.log("Form Processed - redirecting..." + url); 1034 location.href = job_search_slug + ''; 1035 } 1036 } 1037 }); 1038 }); 1039 1040 $(document).on('keypress',function(e) { 1041 if(e.which == 13) { 1042 e.preventDefault(); 1043 $('#job_section_wrapper').addClass('dimmed'); 1044 // Validate location searches 1045 var zipcode = $('#job_zip').val(); 1046 var distance = $('#job_distance').val(); 1047 if ( zipcode != '' && distance == '' ) { 1048 console.log( "Missing distance" ); 1049 $('#job_distance').css('border', '1px solid red'); 1050 $('#job_section_wrapper').removeClass('dimmed'); 1051 return false; 1052 } 1053 var city = $('#job_city').val(); 1054 var state = $('#job_state').val(); 1055 if ( city != '' && state == '' ) { 1056 console.log( "Missing state" ); 1057 $('#job_state').css('border', '1px solid red'); 1058 $('#job_section_wrapper').removeClass('dimmed'); 1059 return false; 1060 } 1061 var searchform; 1062 var searchdata; 1063 searchform = $('#ce_search_form')[0]; 1064 searchdata = new FormData(searchform); 1065 searchdata.append('action', 'ce_search'); 1066 searchdata.append('ce_action', 'search'); 1067 jQuery.ajax({ 1068 url: ce_connect_object.ajax_url, 1069 type: 'post', 1070 processData: false, 1071 contentType: false, 1072 cache: false, 1073 data: searchdata, 1074 success: function (response) { 1075 if (response === 'success') { 1076 var url = buildURL(); 1077 console.log( "Form Processed - redirecting..." + url ); 1078 location.href = url + ''; 1079 } 1080 } 1081 });
1082 } 1083 }); 1084 1085 $('#ce_search_form_go').on('click', function (e) { 1086 e.preventDefault(); 1087 $('#job_section_wrapper').addClass('dimmed'); 1088 1089 // Validate location searches 1090 var zipcode = $('#job_zip').val(); 1091 var distance = $('#job_distance').val(); 1092 if (zipcode != '' && distance == '') { 1093 console.log("Missing distance"); 1094 $('#job_distance').css('border', '1px solid red'); 1095 $('#job_section_wrapper').removeClass('dimmed'); 1096 return false; 1097 } 1098 var city = $('#job_city').val(); 1099 var state = $('#job_state').val(); 1100 if (city != '' && state == '') { 1101 console.log("Missing state"); 1102 $('#job_state').css('border', '1px solid red'); 1103 $('#job_section_wrapper').removeClass('dimmed'); 1104 return false; 1105 } 1106 1107 var cats = []; 1108 var spes = []; 1109 var emps = []; 1110 $(".job_taxonomy_selector.cat_selected").each(function (index) { 1111 var job_category_clicked = $(this).attr('id'); 1112 taxonomy = $(this).attr('data-tax'); 1113 job_category_clicked = job_category_clicked.replace( 'jcr_', '', job_category_clicked ); 1114 job_category_clicked = job_category_clicked.replace( 'jc_', '', job_category_clicked ); 1115 if ( "specialty" === taxonomy ) { 1116 spes.push( encodeURIComponent(job_category_clicked) ); 1117 } 1118 else if ( 'job-category' === taxonomy ) { 1119 cats.push( encodeURIComponent(job_category_clicked) ); 1120 } 1121 else if ( 'employment-type' === taxonomy ) { 1122 emps.push( encodeURIComponent(job_category_clicked) ); 1123 } 1124 }); 1125 1126 $(".job-checkbox.cat_selected").each(function (index) { 1127 var job_category_clicked = $(this).attr('id'); 1128 taxonomy = $(this).attr('data-tax_name'); 1129 job_category_clicked = job_category_clicked.replace( 'jcr_', '', job_category_clicked ); 1130 job_category_clicked = job_category_clicked.replace( 'jc_', '', job_category_clicked ); 1131 if ( "specialty" === taxonomy ) { 1132 spes.push( encodeURIComponent(job_category_clicked) ); 1133 } 1134 else if ( 'job-category' === taxonomy ) { 1135 cats.push( encodeURIComponent(job_category_clicked) ); 1136 } 1137 else if ( 'employment-type' === taxonomy ) { 1138 emps.push( encodeURIComponent(job_category_clicked) ); 1139 } 1140 }); 1141 1142 var searchform; 1143 var searchdata; 1144 searchform = $('#ce_search_form')[0]; 1145 searchdata = new FormData(searchform); 1146 1147 var checked_boxes = $(".checkbox_selected"); 1148 console.log( checked_boxes ); 1149 1150 var checkbox_array = $.map($('.checkbox_selected'), function(el) { 1151 return {taxonomy: $(el).data('tax_name'), value: $(el).data('tax_value')} 1152 }); 1153 1154 searchdata.append('action', 'ce_search'); 1155 searchdata.append('ce_action', 'search'); 1156 if (spes.length > 0) { 1157 searchdata.append('job_tax_specialty', JSON.stringify(spes)); 1158 } 1159 1160 if (cats.length > 0) { 1161 searchdata.append('job_tax_job-category', JSON.stringify(cats)); 1162 } 1163 1164 if (emps.length > 0) { 1165 searchdata.append('job_tax_employment-type', JSON.stringify(emps)); 1166 } 1167 1168 var url = buildURL(); 1169 searchdata.append( 'searchURL', url ); 1170 jQuery.ajax({ 1171 url: ce_connect_object.ajax_url, 1172 type: 'post', 1173 processData: false, 1174 contentType: false, 1175 cache: false, 1176 data: searchdata, 1177 success: function (response) { 1178 if (response === 'success') { 1179 1180 console.log("Form Processed - now redirecting..." + url); 1181 window.location.href = url + ''; 1182 } 1183 } 1184 }); 1185 }); 1186 1187 $('#ce_subscribe_submit').click($.debounce(250, function (e) { 1188 e.preventDefault(); 1189 $('.ce_apply_inner').addClass('dimmed');
1190 var valid; 1191 valid = $('#ce_subscribe_form').valid(); 1192 1193 if (valid) { 1194 console.log("Form Valid - submitting..."); 1195 var subscribeform = $('#ce_subscribe_form')[0]; 1196 var subscribedata = new FormData(subscribeform); 1197 subscribedata.append('action', 'ce_apply'); 1198 subscribedata.append('ce_action', 'subscribe'); 1199 jQuery.ajax({ 1200 url: ce_connect_object.ajax_url, 1201 type: 'post', 1202 enctype: 'multipart/form-data', 1203 processData: false, 1204 contentType: false, 1205 cache: false, 1206 data: subscribedata, 1207 success: function (response) { 1208 $('.ce_apply_inner').removeClass('dimmed'); 1209 console.log("Form Processed - redirecting..." + response); 1210 $('.ce_message').hide(); 1211 $('#ce_apply_loader').hide(); 1212 $('#ce_apply_loader_status1').hide(); 1213 $('#ce_apply_loader_status2').hide(); 1214 $('#ce_apply_loader_status3').hide(); 1215 if (response === 'success') { 1216 $('.ce_apply').hide(); 1217 $('#ce_subscribe_form').hide(); 1218 $('#ce_subscribe_dialog_success').show().focus(); 1219 return false; 1220 } else { 1221 $('#ce_apply_dialog_error').show(); 1222 setTimeout(function () { 1223 $('#ce_apply_action').fadeIn(); 1224 }, 200); 1225 } 1226 } 1227 }); 1228 } else { 1229 $('.ce_apply_inner').removeClass('dimmed'); 1230 $('#ce_apply_status').show(); 1231 $('#ce_apply_dialog_invalid_lower').show(); 1232 $('#ce_apply_loader').hide(); 1233 $('#ce_apply_loader_status1').hide(); 1234 $('#ce_apply_loader_status2').hide(); 1235 $('#ce_apply_loader_status3').hide(); 1236 $('#ce_apply_status').html('Please check the fields above and correct any issues.'); 1237 } 1238 return false; 1239 })); 1240 1241 $('#ce_apply_header').on('click', function (e) { 1242 e.preventDefault(); 1243 $('#ce_apply_modal').dialog("open"); 1244 return false; 1245 }); 1246 1247 $('#ce_apply_submit').on('click', $.debounce(250, function (e) { 1248 e.preventDefault(); 1249 console.log('Firing application...'); 1250 $('#ce_first_name').focus(); 1251 ce_apply(); 1252 return false; 1253 })); 1254 1255 $('#ce_refer_submit').on('click', $.debounce(250, function (e) { 1256 e.preventDefault(); 1257 $('#job_section_wrapper').addClass('dimmed'); 1258 var valid; 1259 var referform; 1260 var referdata; 1261 1262 valid = $('#ce_refer_form').valid(); 1263 1264 if (valid) { 1265 console.log("Form Valid - submitting..."); 1266 $('#ce_refer_loader').show(); 1267 $('#ce_refer_status').show(); 1268 $('.ce_apply_submit_wrapper').hide(); 1269 $('#ce_refer_submit').addClass('hidden'); 1270 $('#ce_apply_status').html('').hide(); 1271 referform = $('#ce_refer_form')[0]; 1272 referdata = new FormData(referform); 1273 referdata.append('action', 'ce_refer'); 1274 referdata.append('ce_action', 'refer'); 1275 jQuery.ajax({ 1276 url: ce_connect_object.ajax_url, 1277 type: 'post', 1278 enctype: 'multipart/form-data', 1279 processData: false, 1280 contentType: false, 1281 cache: false, 1282 data: referdata, 1283 success: function (response) { 1284 console.log("Form Processed" + response); 1285 $('.ce_message').hide(); 1286 $('#ce_refer_loader').hide(); 1287 $('.apply_messages').hide(); 1288 if (response === 'success') { 1289 $('.ce_refer').hide(); 1290 $('#ce_refer_dialog_success').show(); 1291 $([document.documentElement, document.body]).animate({ 1292 scrollTop: ($("#ce_refer_dialog_success").offset().top - 100) 1293 }, 200); 1294 return false; 1295 } else { 1296 $('#ce_refer_dialog_error').show(); 1297 setTimeout(function () { 1298 $('#ce_apply_action').fadeIn(); 1299 }, 200); 1300 $('#ce_refer_submit').removeClass('hidden'); 1301 $('.ce_refer_submit_wrapper').show(); 1302 } 1303 } 1304 }); 1305 } else { 1306 $('#ce_refer_dialog_invalid').show(); 1307 $('#ce_refer_dialog_invalid_lower').show(); 1308 $('#ce_refer_loader').hide(); 1309 $('#ce_refer_status').html('Please check the fields above and correct any issues.'); 1310 $('.ce_refer_submit_wrapper').show(); 1311 $('#ce_refer_submit').removeClass('hidden'); 1312 } 1313 return false; 1314 })); 1315 1316 $('.job_attributes').fadeIn(100, function() { 1317 $(this).css('display', 'flex'); 1318 }); 1319 });
vendor: 4,178 bytes, lines 1320-1451
1320 1321})(jQuery); 1322 1323 1324// Parse the URL to get the required field values 1325var getUrlParameter = function getUrlParameter(sParam) { 1326 var sPageURL = window.location.search.substring(1), 1327 sURLVariables = sPageURL.split('&'), 1328 sParameterName, 1329 i; 1330 1331 for (i = 0; i < sURLVariables.length; i++) { 1332 sParameterName = sURLVariables[i].split('='); 1333 1334 if (sParameterName[0] === sParam) { 1335 return sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]); 1336 } 1337 } 1338}; 1339 1340/*! 1341 * jQuery Cookie Plugin v1.4.1 1342 * https://github.com/carhartl/jquery-cookie 1343 * 1344 * Copyright 2013 Klaus Hartl 1345 * Released under the MIT license 1346 */ 1347(function (factory) { 1348 if (typeof define === 'function' && define.amd) { 1349 // AMD 1350 define(['jquery'], factory); 1351 } else if (typeof exports === 'object') { 1352 // CommonJS 1353 factory(require('jquery')); 1354 } else { 1355 // Browser globals 1356 factory(jQuery); 1357 } 1358}(function ($) { 1359 1360 var pluses = /\+/g; 1361 1362 function encode(s) { 1363 return config.raw ? s : encodeURIComponent(s); 1364 } 1365 1366 function decode(s) { 1367 return config.raw ? s : decodeURIComponent(s); 1368 } 1369 1370 function stringifyCookieValue(value) { 1371 return encode(config.json ? JSON.stringify(value) : String(value)); 1372 } 1373 1374 function parseCookieValue(s) { 1375 if (s.indexOf('"') === 0) { 1376 // This is a quoted cookie as according to RFC2068, unescape... 1377 s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\'); 1378 } 1379 1380 try { 1381 // Replace server-side written pluses with spaces. 1382 // If we can't decode the cookie, ignore it, it's unusable. 1383 // If we can't parse the cookie, ignore it, it's unusable. 1384 s = decodeURIComponent(s.replace(pluses, ' ')); 1385 return config.json ? JSON.parse(s) : s; 1386 } catch (e) { 1387 } 1388 } 1389 1390 function read(s, converter) { 1391 var value = config.raw ? s : parseCookieValue(s); 1392 return $.isFunction(converter) ? converter(value) : value; 1393 } 1394 1395 var config = $.cookie = function (key, value, options) { 1396 1397 // Write 1398 1399 if (value !== undefined && !$.isFunction(value)) { 1400 options = $.extend({}, config.defaults, options); 1401 1402 if (typeof options.expires === 'number') { 1403 var days = options.expires, t = options.expires = new Date(); 1404 t.setTime(+t + days * 864e+5); 1405 } 1406 1407 return (document.cookie = [ 1408 encode(key), '=', stringifyCookieValue(value), 1409 options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE 1410 options.path ? '; path=' + options.path : '', 1411 options.domain ? '; domain=' + options.domain : '', 1412 options.secure ? '; secure' : '' 1413 ].join('')); 1414 } 1415 1416 // Read 1417 1418 var result = key ? undefined : {}; 1419 1420 // To prevent the for loop in the first place assign an empty array 1421 // in case there are no cookies at all. Also prevents odd result when 1422 // calling $.cookie(). 1423 var cookies = document.cookie ? document.cookie.split('; ') : []; 1424 1425 for (var i = 0, l = cookies.length; i < l; i++) { 1426 var parts = cookies[i].split('='); 1427 var name = decode(parts.shift()); 1428 var cookie = parts.join('='); 1429 1430 if (key && key === name) { 1431 // If second argument (value) is a function it's a converter... 1432 result = read(cookie, value); 1433 break; 1434 } 1435 1436 // Prevent storing a cookie that we couldn't decode. 1437 if (!key && (cookie = read(cookie)) !== undefined) { 1438 result[name] = cookie; 1439 } 1440 } 1441 1442 return result; 1443 }; 1444 1445 config.defaults = {}; 1446 1447 $.removeCookie = function (key, options) { 1448 if ($.cookie(key) === undefined) { 1449 return false; 1450 } 1451
1452 // Must not alter options, thus extending a fresh object... 1453 $.cookie(key, '', $.extend({}, options, {expires: -1})); 1454 return !$.cookie(key); 1455 }; 1456 1457})); 1458 1459var ce_close_apply = function () { 1460 jQuery('.ce_message').hide(); 1461 jQuery('.ce_loader').hide(); 1462 jQuery('#job_section_wrapper').removeClass('dimmed'); 1463 setTimeout(function () { 1464 jQuery('.ce_subscribe').show(); 1465 jQuery('#ce_subscribe_action').fadeIn(); 1466 }, 200); 1467}; 1468
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.