1 2// CACHED HIT START (RAM) at 09/24/2026 09:26:36 3function load_loction_autocomplete(){ 4 const center = { lat: 53.483959, lng: -2.244644 };//Manchester 5 6 const defaultBounds = { 7 north: center.lat + 0.1, 8 south: center.lat - 0.1, 9 east: center.lng + 0.1, 10 west: center.lng - 0.1, 11 }; 12 13 if($("#locationDataList").length > 0){ 14 const input = document.getElementById("locationDataList"); 15 16 if(!input) 17 { 18 console.log('Location field not found. "locationDataList"'); 19 return; 20 } 21 22 if(!google || !google.maps || !google.maps.places) 23 { 24 console.log('Google Places API not loaded.'); 25 return; 26 } 27 28 const options = { 29 bounds: defaultBounds, 30 fields: ["address_components", "geometry", "icon", "name"], 31 strictBounds: false, 32 }; 33 34 const autocomplete = new google.maps.places.Autocomplete(input, options); 35 } 36 37 if($("#locationDataListFilter").length > 0){ 38 const input = document.getElementById("locationDataListFilter"); 39 40 if(!input) 41 { 42 console.log('Location field not found. "locationDataListFilter"'); 43 return; 44 } 45 46 if(!google || !google.maps || !google.maps.places) 47 { 48 console.log('Google Places API not loaded.'); 49 return; 50 } 51 52 const options = { 53 bounds: defaultBounds, 54 fields: ["address_components", "geometry", "icon", "name"], 55 strictBounds: false, 56 }; 57 58 const autocomplete = new google.maps.places.Autocomplete(input, options); 59 } 60} 61 62function navigationInserts(){ 63 if($('.removableInserts').length > 0){ 64 var insertHTML = $('.removableInserts').html(); 65 $('.insertsHere').each(function(){ 66 $(this).html(insertHTML); 67 }) 68 $('.removableInserts').remove(); 69 } 70} 71navigationInserts(); 72 73var DATADOWNLOADFORMSESSION = "DownloadFormSession"; 74var UTMSOURCESESSION = "UTMSOURCESESSION"; 75var UTMCAMPAIGNSESSION = "UTMCAMPAIGNSESSION"; 76var UTMMEDIUMSESSION = "UTMMEDIUMSESSION"; 77var UTMCONTENTSESSION = "UTMCONTENTSESSION"; 78var GOOGLECLICKIDSESSION = "GOOGLECLICKIDSESSION"; 79var ORIGINALUTMSOURCE = "ORIGINALUTMSOURCE"; 80var PAGESOURCESUBMISSION = "PAGESOURCESUBMISSION"; 81var GBRAID = "BGRAID"; 82var WBRAID = "WBRAID"; 83 84function validateVennForms(){ 85 $(document).on('click', '.apteveForm [type="submit"]', function(e){ 86 e.preventDefault(); 87 88 var id = $(this).closest('form').attr('id'); 89 90 if(!id) 91 return; 92 93 var closestform = '#'+ id; 94 95 hideSubmitBtn($(this), closestform); 96 97 if($(closestform).find('input[type="text"]').length > 0){ 98 validateTextInput(closestform); 99 } 100 if($(closestform).find('textarea').length > 0){ 101 validateTextAreaInput(closestform); 102 } 103 if($(closestform).find('input[type="email"]').length > 0){ 104 validateEmailInput(closestform); 105 } 106 if($(closestform).find('input[type="checkbox"]').length > 0){ 107 validateCheckboxInput(closestform); 108 } 109 if($(closestform).find('select').length > 0){ 110 validateSelectInput(closestform); 111 } 112 if($(closestform).find('input[type="file"]').length > 0){ 113 validateFileInput(closestform); 114 } 115 if($(closestform).find('input[name="ApteveDestinationEmails"]').length > 0){ 116 setAptevteveDestinationEmails(closestform); 117 } 118 if($(closestform).closest('.form-holder').find('[data-download]').length > 0){ 119 setFormDataDownload(closestform); 120 } 121 if($(closestform).find('select[name="guideoptions"]').length > 0){ 122 setGuideOptions(closestform); 123 } 124 if(window.location.search != ""){ 125 setUTMCodeTracking(closestform, window.location.search); 126 } else{ 127 injectUTMCodeTracking(closestform); 128 } 129 130 if($('.error:visible', closestform).length > 0){ 131 showSubmitBtn($(this)) 132 return false; 133 } else{ 134 135 submitVennForm(closestform); 136 137 } 138 }); 139} 140validateVennForms();
141 142function hideSubmitBtn(this_btn, closestform){ 143 this_btn.hide(); 144 $('.element.submit', closestform).append('<button type="submit" class="btn spinnerbtn" disabled="disabled">\ 145 <i class="fas fa-spinner fa-spin"></i>\ 146 </button>'); 147} 148 149function showSubmitBtn(this_btn){ 150 $('.spinnerbtn').remove(); 151 this_btn.show(); 152} 153 154function validateTextInput(closestform){ 155 var this_form = closestform; 156 $('input[type=text]', this_form).each(function(){ 157 if($(this).is(':visible')){ 158 var this_val = $(this).val().trim(); 159 if($(this).attr('name') === "url"){ 160 if(this_val === "" && $(this).attr('data-req') === "Required"){ 161 $(this).closest('.form-group').find('.required-text').show() 162 $(this).closest('.form-group').find('.required-url').hide() 163 } else if($(this).val().indexOf("https://") < 0){ 164 $(this).closest('.form-group').find('.required-text').hide() 165 $(this).closest('.form-group').find('.required-url').show() 166 } else{ 167 $(this).closest('.form-group').find('.required-text').hide() 168 $(this).closest('.form-group').find('.required-url').hide() 169 } 170 } else{ 171 if(this_val === "" && $(this).attr('data-req') === "Required"){ 172 $(this).closest('.form-group').find('.required-text').show() 173 } else{ 174 $(this).closest('.form-group').find('.required-text').hide() 175 } 176 } 177 } 178 }) 179} 180 181function validateTextAreaInput(closestform){ 182 var this_form = closestform; 183 $('textarea', this_form).each(function(){ 184 if($(this).is(':visible')){ 185 if($(this).val() === "" && $(this).attr('data-req') === "Required"){ 186 $(this).closest('.form-group').find('.required-text').show() 187 } else{ 188 $(this).closest('.form-group').find('.required-text').hide() 189 } 190 } 191 }) 192} 193 194function validateEmailInput(closestform){ 195 var this_form = closestform; 196 $('input[type=email]', this_form).each(function(){ 197 if($(this).is(':visible')){ 198 if($(this).val() === "" && $(this).attr('data-req') === "Required"){ 199 $(this).closest('.form-group').find('.required-text').show(); 200 $(this).closest('.form-group').find('.required-email').hide() 201 } else if(isValidEmailAddress($(this).val()) === false){ 202 $(this).closest('.form-group').find('.required-text').hide(); 203 $(this).closest('.form-group').find('.required-email').show() 204 } else{ 205 $(this).closest('.form-group').find('.required-text').hide() 206 $(this).closest('.form-group').find('.required-email').hide() 207 } 208 } 209 }) 210} 211 212function validateCheckboxInput(closestform){ 213 var this_form = closestform; 214 $('input[type="checkbox"]', this_form).each(function(){ 215 if($(this).attr('data-req') === "Required" && $(this).prop('checked') === false){ 216 $(this).closest('.form-group').find('.required-text').show() 217 } else{ 218 $(this).closest('.form-group').find('.required-text').hide() 219 } 220 }) 221} 222 223function validateSelectInput(closestform){ 224 var this_form = closestform; 225 $('select', this_form).each(function(){ 226 if($(this).attr('data-req') === "Required"){ 227 if($(this).attr('data-isSelected') === 'false'){ 228 $(this).closest('.form-group').find('.required-text').show() 229 } else{ 230 $(this).closest('.form-group').find('.required-text').hide() 231 } 232 } 233 }) 234} 235 236function validateFileInput(closestform){ 237 var this_form = closestform; 238 $('input[type="file"]', this_form).each(function(){ 239 if($(this).is(':visible')){ 240 var error_displayed = $(this).closest('.element').find('.error').is(':visible'); 241 var error_displayed_class = $(this).closest('.element').find('.error:visible'); 242 if(error_displayed_class.length > 0){ 243 error_displayed_class = error_displayed_class.attr('class').split(' ')[1]; 244 } 245 if($(this).attr('data-req') === "Required"){
246 if($(this).attr('data-isFileValid') === "false" && error_displayed == false){ 247 $(this).closest('.element').find('.required-text').show() 248 } else if($(this).attr('data-isFileValid') === "false" && error_displayed == true){ 249 $(this).closest('.element').find('.error').each(function(){ 250 if($(this).attr('class').indexOf(''+ error_displayed_class + '') >= 0){ 251 $(this).show() 252 } else{ 253 $(this).hide() 254 } 255 }) 256 } else{ 257 $(this).closest('.element').find('.error').each(function(){ 258 $(this).hide() 259 }) 260 } 261 } 262 } 263 }) 264} 265 266function setAptevteveDestinationEmails(closestform){ 267 var this_form = closestform; 268 $('#media-hub-download-form').closest('.form-holder').find('[data-consultantemailcc]').attr('data-consultantemailcc'); 269 var ccEmail = $(this_form).closest('.form-holder').find('[data-consultantemailcc]').attr('data-consultantemailcc'); 270 var apteveDestEmail = $("[name='ApteveDestinationEmails']", closestform).length; 271 272 if(apteveDestEmail > 0){ 273 if(ccEmail != undefined){ 274 $("[name='ApteveDestinationEmails']", this_form).val(ccEmail) 275 } 276 } 277} 278 279function setFormDataDownload(closestform){ 280 var this_form = closestform; 281 var data_capture_download = ""; 282 if($(this_form).closest('.form-holder').find('[data-download]').length > 0){ 283 data_capture_download = $(this_form).closest('.form-holder').find('[data-download]').attr('data-download'); 284 if(data_capture_download.indexOf('.') < 0){ 285 data_capture_download = atob(data_capture_download); 286 } 287 } 288 289 if(data_capture_download != ""){ 290 sessionStorage.setItem(DATADOWNLOADFORMSESSION, data_capture_download) 291 } 292} 293 294function setGuideOptions(closestform){ 295 var this_form = closestform; 296 if($('select[name="guideoptions"]', this_form).length > 0){ 297 if($('select[name="guideoptions"]', this_form).val() === ""){ 298 $('select[name="guideoptions"]', this_form).closest('.form-group').find('.required-text').show() 299 } else{ 300 isValid = true; 301 } 302 } 303} 304 305function submitVennForm(closestform){ 306 var this_form = closestform; 307 updateForm(this_form.replace('#',''), "https://cms.wearevennture.co.uk", $('input[name="formlink"]', $(this_form)).val()); 308 if(typeof grecaptcha !== 'undefined') { 309 var captchaUrl = 'https://www.google.com/recaptcha/enterprise.js?render=', 310 $captchaScript = $("script[src*='" + captchaUrl +"']"); 311 if($captchaScript.length > 0) { 312 var captchaKey = $captchaScript.attr("src").substr(captchaUrl.length); 313 if(captchaKey) { 314 try { 315 grecaptcha.enterprise.execute(captchaKey, {action: 'submit'}).then(function(token) { 316 if($(this_form).find("input[name='g-recaptcha-response']").length === 0) { 317 $(this_form).append("<input type='hidden' name='g-recaptcha-response' value='" + token+ "'>"); 318 } 319 else { 320 $(this_form).find("input[name='g-recaptcha-response']").val(token); 321 } 322 $(this_form).submit(); 323 }); 324 return; 325 } catch (error){ 326 console.error(error); 327 $(this_form).submit(); 328 } 329 } 330 } else{ 331 $(this_form).submit(); 332 } 333 } else{ 334 $(this_form).submit(); 335 } 336} 337 338function setUTMCodeTracking(closestform, searchCatalouge){ 339 var this_form = closestform; 340 var urlSearch = searchCatalouge.split('&') 341 for(var i = 0; i < urlSearch.length; i++){ 342 var urlSearchUTMValue = urlSearch[i].split('=')[0]; 343 var urlSearchSplit = urlSearch[i].split('=')[1]; 344 345 if(urlSearchUTMValue.indexOf('utm_source') >= 0){ 346 if(sessionStorage.getItem('UTMSOURCESESSION') !== null){ 347 $('input[name="utm_source"]', this_form).val(sessionStorage.getItem('UTMSOURCESESSION')); 348 } else{ 349 sessionStorage.setItem('UTMSOURCESESSION', urlSearchSplit); 350 $('input[name="utm_source"]', this_form).val(sessionStorage.getItem('UTMSOURCESESSION')); 351 } 352 } else if(urlSearchUTMValue.indexOf('utm_medium') >= 0){ 353 if(sessionStorage.getItem('UTMMEDIUMSESSION') !== null){ 354 $('input[name="utm_medium"]', this_form).val(sessionStorage.getItem('UTMMEDIUMSESSION')); 355 } else{ 356 sessionStorage.setItem('UTMMEDIUMSESSION', urlSearchSplit); 357 $('input[name="utm_medium"]', this_form).val(sessionStorage.getItem('UTMMEDIUMSESSION')); 358 } 359 } else if(urlSearchUTMValue.indexOf('utm_content') >= 0){ 360 if(sessionStorage.getItem('UTMCONTENTSESSION') !== null){ 361 $('input[name="utm_content"]', this_form).val(sessionStorage.getItem('UTMCONTENTSESSION')); 362 } else{ 363 sessionStorage.setItem('UTMCONTENTSESSION', urlSearchSplit); 364 $('input[name="utm_content"]', this_form).val(sessionStorage.getItem('UTMCONTENTSESSION')); 365 } 366 } else if(urlSearchUTMValue.indexOf('utm_campaign') >= 0){ 367 if(sessionStorage.getItem('UTMCAMPAIGNSESSION') !== null){ 368 $('input[name="utm_campaign"]', this_form).val(sessionStorage.getItem('UTMCAMPAIGNSESSION')); 369 } else{ 370 sessionStorage.setItem('UTMCAMPAIGNSESSION', urlSearchSplit); 371 $('input[name="utm_campaign"]', this_form).val(sessionStorage.getItem('UTMCAMPAIGNSESSION')); 372 } 373 } else if(urlSearchUTMValue.indexOf('gclid') >= 0){ 374 if(sessionStorage.getItem('GOOGLECLICKIDSESSION') !== null){ 375 $('input[name="gclid"]', this_form).val(sessionStorage.getItem('GOOGLECLICKIDSESSION')); 376 } else{ 377 sessionStorage.setItem('GOOGLECLICKIDSESSION', urlSearchSplit); 378 $('input[name="gclid"]', this_form).val(sessionStorage.getItem('GOOGLECLICKIDSESSION')); 379 } 380 } else if(urlSearchUTMValue.indexOf('gbraid') >= 0){ 381 if(sessionStorage.getItem('GBRAID') !== null){ 382 $('input[name="gbraid"]', this_form).val(sessionStorage.getItem('GBRAID')); 383 } else{ 384 sessionStorage.setItem('GBRAID', urlSearchSplit); 385 $('input[name="gbraid"]', this_form).val(sessionStorage.getItem('GBRAID')); 386 } 387 } else if(urlSearchUTMValue.indexOf('wbraid') >= 0){ 388 if(sessionStorage.getItem('WBRAID') !== null){ 389 $('input[name="wbraid"]', this_form).val(sessionStorage.getItem('WBRAID')); 390 } else{ 391 sessionStorage.setItem('WBRAID', urlSearchSplit); 392 $('input[name="wbraid"]', this_form).val(sessionStorage.getItem('WBRAID')); 393 } 394 } 395 } 396 if(sessionStorage.getItem('ORIGINALUTMSOURCE') !== null){ 397 $('input[name="pagesource"]', this_form).val(sessionStorage.getItem('ORIGINALUTMSOURCE')); 398 } else{ 399 sessionStorage.setItem('ORIGINALUTMSOURCE', window.location.href); 400 $('input[name="pagesource"]', this_form).val(sessionStorage.getItem('ORIGINALUTMSOURCE')); 401 } 402 403 $('input[name="submissionpagesource"]', this_form).val(window.location.href); 404} 405 406function injectUTMCodeTracking(closestform){ 407 var this_form = closestform; 408 if(sessionStorage.getItem('UTMSOURCESESSION') !== null){ 409 $('input[name="utm_source"]', this_form).val(sessionStorage.getItem('UTMSOURCESESSION')); 410 } 411 412 if(sessionStorage.getItem('UTMCAMPAIGNSESSION') !== null){ 413 $('input[name="utm_campaign"]', this_form).val(sessionStorage.getItem('UTMCAMPAIGNSESSION')); 414 } 415 416 if(sessionStorage.getItem('UTMMEDIUMSESSION') !== null){ 417 $('input[name="utm_medium"]', this_form).val(sessionStorage.getItem('UTMMEDIUMSESSION')); 418 } 419 420 if(sessionStorage.getItem('UTMCONTENTSESSION') !== null){ 421 $('input[name="utm_content"]', this_form).val(sessionStorage.getItem('UTMCONTENTSESSION')); 422 } 423 424 if(sessionStorage.getItem('GOOGLECLICKIDSESSION') !== null){ 425 $('input[name="gclid"]', this_form).val(sessionStorage.getItem('GOOGLECLICKIDSESSION')); 426 } 427 428 if(sessionStorage.getItem('GBRAID') !== null){ 429 $('input[name="gbraid"]', this_form).val(sessionStorage.getItem('GBRAID')); 430 } 431 432 if(sessionStorage.getItem('WBRAID') !== null){ 433 $('input[name="wbraid"]', this_form).val(sessionStorage.getItem('WBRAID')); 434 } 435 436 if(sessionStorage.getItem('ORIGINALUTMSOURCE') !== null){ 437 $('input[name="pagesource"]', this_form).val(sessionStorage.getItem('ORIGINALUTMSOURCE')); 438 } 439 440 $('input[name="submissionpagesource"]', this_form).val(window.location.href); 441} 442 443function isValidEmailAddress(emailAddress) { 444 var pattern = new RegExp(/^[+a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,15}$/i);
445 return pattern.test(emailAddress); 446} 447 448 449const isValidUrl = urlString=> { 450 var urlPattern = new RegExp('^(https?:\\/\\/)?'+ // validate protocol 451 '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|'+ // validate domain name 452 '((\\d{1,3}\\.){3}\\d{1,3}))'+ // validate OR ip (v4) address 453 '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*'+ // validate port and path 454 '(\\?[;&a-z\\d%_.~+=-]*)?'+ // validate query string 455 '(\\#[-a-z\\d_]*)?$','i'); // validate fragment locator 456 return !!urlPattern.test(urlString); 457} 458 459function formFileUpload(){ 460 $('input[type="file"]').each(function(){ 461 $(this).change(function(e){ 462 var files = e.originalEvent.target.files; 463 for (var i = 0, len = files.length; i < len; i++) { 464 var file = files[i].name; 465 if (file != null) { 466 var extension = file.substr((file.lastIndexOf('.') + 1)); 467 switch (extension) { 468 case 'doc': 469 case 'pdf': 470 case 'docx': 471 case 'DOCX': 472 case 'DOC': 473 case 'PDF': 474 flag = true; 475 break; 476 default: 477 flag = false; 478 } 479 } 480 else { 481 return false; 482 } 483 var id = e.originalEvent.target.id; 484 if (flag == false) { 485 $(this).attr('data-isFileValid', "false"); 486 if($(this).closest('.file').find('.required-filetype').length > 0){ 487 $(this).closest('.file').find('.required-filesize').hide(); 488 $(this).closest('.file').find('.required-text').hide(); 489 $(this).closest('.file').find('.required-filetype').show(); 490 } else{ 491 $(this).closest('.file').find('.required-text').text('You can only upload doc, docx or pdf files').show(); 492 } 493 return false; 494 } 495 else { 496 var size = GetFileSize(files[i]); 497 if (size > 10) { 498 $(this).attr('data-isFileValid', "false"); 499 if($(this).closest('.file').find('.required-filesize').length > 0){ 500 $(this).closest('.file').find('.required-filesize').show(); 501 $(this).closest('.file').find('.required-text').hide(); 502 $(this).closest('.file').find('.required-filetype').hide(); 503 } else{ 504 $(this).closest('.file').find('.required-text').text('You can only upload files up to 10 MB in size').show(); 505 } 506 return false; 507 } 508 else { 509 $(this).closest('.file').find('.required-filesize').hide(); 510 $(this).closest('.file').find('.required-text').hide(); 511 $(this).closest('.file').find('.required-filetype').hide(); 512 $(this).attr('data-isFileValid', "true"); 513 return true; 514 } 515 } 516 } 517 }) 518 }) 519} 520formFileUpload(); 521 522function GetFileSize(file) { 523 try { 524 var fileSize = 0; 525 fileSize = file.size //size in kb 526 fileSize = fileSize / 1048576; //size in mb 527 return fileSize; 528 } 529 catch (e) { 530 alert("Error is :" + e); 531 } 532} 533 534function selectChange(){ 535 $('form select').each(function(){ 536 $(this).on('change', function(){ 537 var select_val = $(this).val(); 538 if(select_val === ""){ 539 $(this).attr('data-isSelected', "false"); 540 $(this).closest('.form-group').find('.required-text').show() 541 } else{ 542 $(this).attr('data-isSelected', "true"); 543 $(this).closest('.form-group').find('.required-text').hide() 544 } 545 }) 546 }) 547} 548selectChange(); 549 550function downloadRedirect(){ 551 var url = window.location.pathname; 552 var has_session_set = false; 553 if(sessionStorage.DownloadFormSession === undefined || sessionStorage.DownloadFormSession === "undefined"){ 554 has_session_set = true; 555 } else if(sessionStorage.DownloadFormSession === ''){
556 has_session_set = true; 557 } 558 559 if(has_session_set === false){ 560 if(url.indexOf('thank-you') >= 0 || url.indexOf('thankyou') >= 0){ 561 let temp_url = sessionStorage.getItem(DATADOWNLOADFORMSESSION); 562 sessionStorage.setItem(DATADOWNLOADFORMSESSION, ''); 563 window.open(temp_url, '_self'); 564 } 565 } 566} 567 568setTimeout(downloadRedirect, 5000); 569 570function inputChangeApteveForms(){ 571 $('form input[type="text"]').each(function(){ 572 $(this).on('input', function(){ 573 if($(this).val() === "" && $(this).attr('data-req') === "Required"){ 574 $(this).closest('.form-group').find('.required-text').show() 575 } else{ 576 $(this).closest('.form-group').find('.required-text').hide() 577 } 578 }) 579 }) 580 581 $('form input[type="email"]').each(function(){ 582 $(this).on('input', function(){ 583 if($(this).val() === "" && $(this).attr('data-req') === "Required"){ 584 $(this).closest('.form-group').find('.required-text').show(); 585 $(this).closest('.form-group').find('.required-email').hide() 586 } else if(isValidEmailAddress($(this).val()) === false){ 587 $(this).closest('.form-group').find('.required-text').hide(); 588 $(this).closest('.form-group').find('.required-email').show() 589 } else{ 590 $(this).closest('.form-group').find('.required-text').hide() 591 $(this).closest('.form-group').find('.required-email').hide() 592 } 593 }) 594 }) 595 596 $('form input[type="checkbox"]').each(function(){ 597 $(this).on('change', function(){ 598 if($(this).attr('data-req') === "Required" && $(this).prop('checked') === false){ 599 $(this).closest('.form-group').find('.required-text').show() 600 } else{ 601 $(this).closest('.form-group').find('.required-text').hide() 602 } 603 }) 604 }) 605 606 $('form select').each(function(){ 607 $(this).on('change', function(){ 608 if($(this).attr('data-req') === "Required"){ 609 var select_val = $(this).val(); 610 if(select_val === ""){ 611 $(this).attr('data-isSelected', "false"); 612 $(this).closest('.form-group').find('.required-text').show() 613 } else{ 614 $(this).attr('data-isSelected', "true"); 615 $(this).closest('.form-group').find('.required-text').hide() 616 } 617 } 618 }) 619 }) 620 621 $('form textarea').each(function(){ 622 $(this).on('input', function(){ 623 if($(this).attr('data-req') === "Required" && $(this).val() === ""){ 624 $(this).closest('.form-group').find('.required-text').show() 625 } else{ 626 $(this).closest('.form-group').find('.required-text').hide() 627 } 628 }) 629 }) 630} 631 632 633$(document).ready(function(){ 634 inputChangeApteveForms(); 635 636 if($('.legalterms').length > 0){ 637 $('form .legalterms').each(function(){ 638 var formLegalTermsCount = $('a', $(this)).length; 639 var legaltermsloopCount = 0; 640 $('a', $(this)).each(function(){ 641 legaltermsloopCount++; 642 if(formLegalTermsCount === 2 && legaltermsloopCount < 2 || formLegalTermsCount === 3 && legaltermsloopCount === 2){ 643 $(this).after(' & ') 644 } else if(formLegalTermsCount === 3 && legaltermsloopCount === 1){ 645 $(this).after(', ') 646 } 647 }) 648 }) 649 } 650}) 651 652function checkCachedUrlData(url) 653{ 654 if(window.location.host.indexOf('staging.') > 0) 655 { 656 return null; 657 } 658 659 let expiryKey = "EXPIRY:"+url; 660 let expiry = localStorage.getItem(expiryKey) 661 if(expiry) 662 { 663 var expiryTime = new Date(expiry).getTime(); 664 if( isNaN(expiryTime) || expiryTime > new Date().getTime()) 665 { 666 localStorage.removeItem(url); 667 localStorage.removeItem(expiryKey); 668 } 669 } 670
671 let cachedData = localStorage.getItem(url); 672 if(cachedData) {return JSON.parse(cachedData); } 673 return null; 674} 675 676function setCachedUrlData(url, data) 677{ 678 const expiryMinutes = 20; 679 let expiryDate = new Date(new Date().getTime() + expiryMinutes*60000).getTime(); 680 localStorage.setItem("EXPIRY:"+url, expiryDate); 681 localStorage.setItem(url, JSON.stringify(data)); 682} 683 684function liquidNews(){ 685 686 const latestMediaUri = "/api/media/latest"; 687 688 $('.vsm-media-liquid').each(function(){ 689 var $this = $(this); 690 var filter_tag = encodeURIComponent($(this).data('tag')); 691 var filter_category = encodeURIComponent($(this).data('category')); 692 693 if(filter_category === "undefined"){ 694 filter_category = ""; 695 } 696 697 if(filter_tag === "undefined"){ 698 filter_tag = ""; 699 } 700 701 var url = latestMediaUri+"/?tag=" + filter_tag + "&category=" + filter_category; 702 const engine = new liquidjs.Liquid(); 703 704 let cachedData = checkCachedUrlData(url); 705 if(cachedData) 706 { 707 engine.parseAndRender($this.html(), cachedData).then(function(html) { 708 $this.replaceWith(html); 709 }); 710 return; 711 } 712 713 $.ajax({
714 url: url, 715 method: "get", 716 }).then(function(data) { 717 if(data) { 718 if(data.items.length > 0){ 719 setCachedUrlData(url, data); 720 engine.parseAndRender($this.html(), data).then(function(html) { 721 $this.replaceWith(html); 722 }); 723 } else{ 724 $.ajax({ 725 url: latestMediaUri, 726 method: "get" 727 }).then(function(rollbackdata){ 728 if(rollbackdata){ 729 engine.parseAndRender($this.html(), rollbackdata).then(function(html) { 730 $this.replaceWith(html); 731 }); 732 } 733 }).catch(function(){ 734 $this.replaceWith("<p class='error'>Latest media could not be loaded!</p>") 735 }) 736 } 737 } 738 }).catch(function() { 739 $this.replaceWith("<p class='error'>Latest media could not be loaded!</p>") 740 }); 741 }) 742 743 744 $('.vsm-media-liquid-new').each(function(){ 745 var $this = $(this); 746 var filter_tag = encodeURIComponent($(this).data('tag')); 747 var filter_category = encodeURIComponent($(this).data('category')); 748 var filter_type = encodeURIComponent($(this).data('mediatype')); 749 var searchArr = []; 750 var formatted_url = ""; 751 752 753 if(filter_type != "undefined"){ 754 searchArr.push("type=" + filter_type); 755 } 756 757 if(filter_category != "undefined"){ 758 searchArr.push("category=" + filter_category) 759 } 760 761 if(filter_tag != "undefined"){ 762 763 searchArr.push("tag=" + filter_tag) 764 } 765 766 for(var i = 0; i < searchArr.length; i++){ 767 if(i > 0){ 768 formatted_url += "&"+searchArr[i] 769 } else{ 770 formatted_url += searchArr[i]; 771 } 772 } 773 774 console.log(formatted_url); 775 var url = latestMediaUri+"/?" + formatted_url; 776 const engine = new liquidjs.Liquid(); 777 let cachedData = checkCachedUrlData(url); 778 if(cachedData) 779 { 780 engine.parseAndRender($this.html(), cachedData).then(function(html) { 781 $this.replaceWith(html); 782 site.customSwipers(); 783 site.cm_multiple_col_cta(); 784 }); 785 return; 786 } 787 788 $.ajax({
789 url: url, 790 method: "get", 791 }).then(function(data) { 792 if(data) { 793 if(data.items.length > 0){ 794 setCachedUrlData(url, data); 795 engine.parseAndRender($this.html(), data).then(function(html) { 796 $this.replaceWith(html); 797 site.customSwipers(); 798 site.cm_multiple_col_cta(); 799 }); 800 } else{ 801 $.ajax({ 802 url: latestMediaUri+"/?type=" + filter_type, 803 method: "get" 804 }).then(function(rollbackdata){ 805 if(rollbackdata){ 806 engine.parseAndRender($this.html(), rollbackdata).then(function(html) { 807 $this.replaceWith(html); 808 site.customSwipers(); 809 site.cm_multiple_col_cta(); 810 }); 811 } 812 }).catch(function(){ 813 $this.replaceWith("<p class='error'>Latest media could not be loaded!</p>") 814 }) 815 } 816 } 817 }).catch(function() { 818 $this.replaceWith("<p class='error'>Latest media could not be loaded!</p>") 819 }); 820 }) 821 822 $('.vsm-media-liquid-nav').each(function(){ 823 var $this = $(this); 824 var url = latestMediaUri+"/?custom-nav-item=true"; 825 const engine = new liquidjs.Liquid(); 826 let cachedData = checkCachedUrlData(url); 827 if(cachedData) 828 { 829 engine.parseAndRender($this.html(), cachedData).then(function(html) { 830 $this.replaceWith(html); 831 site.customSwipers(); 832 site.cm_multiple_col_cta(); 833 }); 834 return; 835 } 836 837 $.ajax({
838 url: url, 839 method: "get", 840 }).then(function(data) { 841 if(data) { 842 if(data.items.length > 0){ 843 setCachedUrlData(url, data); 844 engine.parseAndRender($this.html(), data).then(function(html) { 845 $this.replaceWith(html); 846 site.customSwipers(); 847 site.cm_multiple_col_cta(); 848 }); 849 } else{ 850 $.ajax({ 851 url: latestMediaUri+"/?type=" + filter_type, 852 method: "get" 853 }).then(function(rollbackdata){ 854 if(rollbackdata){ 855 engine.parseAndRender($this.html(), rollbackdata).then(function(html) { 856 $this.replaceWith(html); 857 site.customSwipers(); 858 site.cm_multiple_col_cta(); 859 }); 860 } 861 }).catch(function(){ 862 $this.replaceWith("<p class='error'>Latest media could not be loaded!</p>") 863 }) 864 } 865 } 866 }).catch(function() { 867 $this.replaceWith("<p class='error'>Latest media could not be loaded!</p>") 868 }); 869 }) 870 871 $('.vsm-media-liquid-carousel').each(function(){ 872 var $this = $(this); 873 var filter_tag = encodeURIComponent($(this).data('tag')) 874 875 if(filter_tag === "undefined"){ 876 filter_tag = ""; 877 } 878 879 filter_tag = filter_tag.replace('%20', ''); 880 var url = latestMediaUri+"/?category=" + filter_tag; 881 const engine = new liquidjs.Liquid(); 882 $.ajax({
883 url: url, 884 method: "get", 885 }).then(function(data) { 886 if(data) { 887 if(data.items.length > 0){ 888 engine.parseAndRender($this.html(), data).then(function(html) { 889 $this.replaceWith(html); 890 }); 891 } else{ 892 $.ajax({ 893 url: latestMediaUri, 894 method: "get" 895 }).then(function(rollbackdata){ 896 if(rollbackdata){ 897 engine.parseAndRender($this.html(), rollbackdata).then(function(html) { 898 $this.replaceWith(html); 899 }); 900 } 901 }).catch(function(){ 902 $this.replaceWith("<p class='error'>Latest media could not be loaded!</p>") 903 }) 904 } 905 } 906 }).catch(function() { 907 $this.replaceWith("<p class='error'>Latest media could not be loaded!</p>") 908 }); 909 }) 910} 911liquidNews(); 912 913function liquidConsultants(){ 914 $('.vsm-consultant-liquid').each(function(){ 915 var $this = $(this); 916 var filter_type = $(this).data('filter-type'); 917 var filter_text = $(this).data('filter-text'); 918 var url = "/api/recruitment/consultant/data/?"+filter_type+"="+filter_text; 919 920 const engine = new liquidjs.Liquid(); 921 $.ajax({
922 url: url, 923 method: "get", 924 }).then(function(data) { 925 let consultantData = JSON.parse(data); 926 if(data) { 927 if(consultantData.items.length > 0){ 928 engine.parseAndRender($this.html(), consultantData).then(function(html) { 929 $this.replaceWith(html); 930 vsmsite.vsmswiper(); 931 }); 932 } else{ 933 $.ajax({ 934 url: "/api/recruitment/consultant/data", 935 method: "get" 936 }).then(function(rollbackdata){ 937 let rollbackConsultantData = JSON.parse(rollbackdata); 938 if(rollbackdata){ 939 engine.parseAndRender($this.html(), rollbackConsultantData).then(function(html) { 940 $this.replaceWith(html); 941 vsmsite.vsmswiper(); 942 }); 943 } 944 vsmsite.vsmswiper(); 945 }).catch(function(){ 946 $this.replaceWith("<p class='error'>Consultants could not be loaded!</p>") 947 }) 948 } 949 } 950 }).catch(function() { 951 $this.replaceWith("<p class='error'>Consultants could not be loaded!</p>") 952 }); 953 }) 954} 955liquidConsultants(); 956 957function liquidJobs(){ 958 $('.vsm-jobs-liquid').each(function(){ 959 var $this = $(this); 960 var filter_type = $(this).data('filter-type'); 961 var filter_text = $(this).data('filter-text').replace(/ /g, '+').replace(/&/g, '%26'); 962 var has_rollback = $(this).data('hasrollback'); 963 var url = "/api/recruitment/job/data/?"+filter_type+"="+filter_text; 964 var radius = $(this).data("radius"); 965 if(has_rollback === undefined){ 966 has_rollback = "true"; 967 } 968 969 if(filter_type === "location"){ 970 if(radius == ""){ 971 url += "&distance=500" 972 } else{
973 url += "&distance=" + radius 974 } 975 976 } 977 978 const engine = new liquidjs.Liquid(); 979 $.ajax({ 980 url: url, 981 method: "get", 982 }).then(function(data) { 983 let consultantData = JSON.parse(data); 984 if(data) { 985 if(consultantData.items.length > 0){ 986 engine.parseAndRender($this.html(), consultantData).then(function(html) { 987 $this.replaceWith(html); 988 vsmsite.vsmswiper(); 989 }); 990 991 } else{ 992 if(has_rollback === "true"){ 993 $.ajax({ 994 url: "/api/recruitment/job/data", 995 method: "get" 996 }).then(function(rollbackdata){ 997 let rollbackConsultantData = JSON.parse(rollbackdata); 998 if(rollbackConsultantData.items.length > 0){ 999 if(rollbackdata){ 1000 engine.parseAndRender($this.html(), rollbackConsultantData).then(function(html) { 1001 $this.replaceWith(html); 1002 vsmsite.vsmswiper(); 1003 }); 1004 } 1005 } else{ 1006 $this.closest('.isliquidmodule').remove(); 1007 } 1008 }).catch(function(){ 1009 $this.replaceWith("<p class='error'>Consultants could not be loaded!</p>") 1010 }) 1011 } else{ 1012 $this.closest('.isliquidmodule').remove(); 1013 } 1014 1015 } 1016 } 1017 }).catch(function() { 1018 $this.replaceWith("<p class='error'>Consultants could not be loaded!</p>") 1019 }); 1020 }) 1021} 1022liquidJobs(); 1023 1024$(document).ready(function(){ 1025 if($('.vsm-profile-details').length > 0){ 1026 if($('#venntureRecruitCVUpload input[name="consultantemailaddress"]').length > 0){ 1027 var consultantEmail = $('.vsm-profile-details').find('.showmodal a').data('consultant-email'); 1028 $('#venntureRecruitCVUpload input[name="consultantemailaddress"]').val(consultantEmail); 1029 } 1030 } 1031}) 1032// CACHED HIT END (RAM)
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.