1 2var $ = jQuery.noConflict(); 3if ( typeof isEnglish === 'undefined' ){ 4 isEnglish = $('html').is(':lang(en-US)'); 5} 6 7$(document).ready(function() { 8 $(".calculatetravel").click(function() { 9 $('html, body').animate({ 10 scrollTop: $("#toDate").offset().top 11 }, 1000); 12 }); 13}); 14 15 16$(document).ready(function() { 17 //Change form with pipes class text & values 18 $('.wpcf7 .wpcf7-form .wpcf7-select option').each(function(index, element) { 19 // split element text by "/" divider 20 if (!element.text.includes("/")) { 21 return; 22 } 23 var data = element.text.split('/'); 24 25 //replace text and value of option 26 $(this).val(data[1]); 27 $(this).text(data[0]); 28 }); 29}); 30 31$(document).ready(function() { 32 // force language to be arabic in arabic case because it is english in that class with no reason //travel insurance bug 33 if ($('html').is(':lang(ar)')) { 34 $('#wpcf7-f1146-p567-o3').removeAttr('lang'); 35 $('#wpcf7-f1146-p567-o3').removeAttr('lang'); 36 37 //same for gig travel insurance 38 $('#wpcf7-f2784-p2780-o1').removeAttr('lang'); 39 $('#wpcf7-f2784-p2780-o3').removeAttr('lang'); 40 41 //same for personal accedints 42 $('#wpcf7-f7153-p7149-o1').removeAttr('lang'); 43 $('#wpcf7-f7153-p7149-o3').removeAttr('lang'); 44 45 // for every thing 46 $('.wpcf7').removeAttr('lang'); 47 } 48 49}); 50 51//function to change the tag of the element selection //used below to change the tag of h1 to be span for seo purposes 52// this is because the theme has default spans for every page 53function renameElement($element,newElement){ 54 55 $element.wrap("<"+newElement+">"); 56 $newElement = $element.parent(); 57 58 //Copying Attributes 59 $.each($element.prop('attributes'), function() { 60 $newElement.attr(this.name,this.value); 61 }); 62 63 $element.contents().unwrap(); 64 65 return $newElement; 66} 67 68$(document).ready(function() { 69 //change the default of h1 to span for SEO 70 renameElement($('h1#site-title'),'span'); 71 renameElement($('h1.header-post-title-class'),'span'); 72 renameElement($('p#site-description'),'span'); 73 74 75}); 76 77$(document).ready(function() { 78//handle talk to human button 79$('.talk-to-human-button').on('click', e => { 80 let id = e.target.id; 81 e.preventDefault(); 82 $(e.target) 83 .next() 84 .toggleClass('active'); 85 $([document.documentElement, document.body]).animate( 86 { 87 scrollTop: $(`.${id}`).offset().top - 30 88 }, 89 1000 90 ); 91}); 92}); 93 94//remove scroll up element 95// document.addEventListener("DOMContentLoaded", function(event) { 96// let scrollUpElement = document.getElementById('scroll-up'); 97// scrollUpElement.remove(); 98// }); 99 100// add arrow ( > ) after each header menu item that has sub menu 101$(document).ready(function() { 102 $('#menu-primary-menu > .menu-item-has-children > a , #menu-primary-menu-english > .menu-item-has-children > a') 103 .append('<i class="header-menu-arrow "></i>') ; 104}); 105 106//save parameters through the user journey 107$(document).ready(function() { 108 const longLiveParams = ['utm_source', 109 'utm_domain', 110 'utm_medium', 111 'utm_campaign', 112 'utm_content', 113 'utm_term', 114 'promocode', 115 'showpromocode']; 116 const allParams = new URLSearchParams(window.location.search); 117 118 for ( const longLiveParam of longLiveParams ){ 119 if(allParams.has(longLiveParam)){ 120 121 let longLiveParamVal = allParams.get(longLiveParam); 122 123 if(longLiveParam == "promocode") 124 setCookie("promocode", longLiveParamVal, 1); 125 126 else if(longLiveParam == "showpromocode") 127 setCookie("showpromocode", longLiveParamVal, 1); 128 129 else 130 sessionStorage.setItem(longLiveParam, longLiveParamVal); 131 } 132 133 } 134 135 function setCookie(name, value, days) { 136 var expires = ""; 137 if (days) { 138 var date = new Date(); 139 date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); 140 expires = "; expires=" + date.toUTCString(); 141 } 142 document.cookie = name + "=" + (value || "") + expires + "; path=/"; 143 } 144 145}); 146 147// $(document).ready(function() { 148// sendVisits(visitorData) ; 149// }); 150 151// function sendVisits(data) { 152// const domainUrl = loalizedVar['url']; 153// let request = domainUrl + '/wp-json/wp/v2/count_visits'; 154// return fetch(request, { 155// method: 'post', 156// headers: { 157// 'Accept': 'application/json', 158// 'Content-Type': 'application/json' 159// }, 160// body: JSON.stringify(data), 161 162// }) ; 163// } 164 165 166 167// $(document).ready(function() { 168 169// TimeMe.initialize({ 170// currentPageName: visitorData['page_id'], // current page 171// idleTimeoutInSeconds: 20 // seconds 172// }); 173// var state = 'active' ; 174// var interval = setInterval(function(){ 175// if(state=='active')sendSpentTime({'spent_time' :1 , 'page_id' : visitorData['page_id'] , 'ip_address' : visitorData['ip_address']}) ; 176// },1000); 177 178// TimeMe.callWhenUserReturns(function(){ 179// state = 'active' ; 180// }); 181// TimeMe.callWhenUserLeaves(function(){ 182// state = 'inactive' ; 183// }); 184// }); 185 186 187 188// function sendSpentTime(data) { 189// const domainUrl = loalizedVar['url']; 190// let request = domainUrl + '/wp-json/wp/v2/spent_time';
191// return fetch(request, { 192// method: 'post', 193// headers: { 194// 'Accept': 'application/json', 195// 'Content-Type': 'application/json' 196// }, 197// body: JSON.stringify(data), 198 199// }) ; 200// } 201// $(document).ready(function() { 202 203// Tawk_API.onChatMaximized = function(){ 204// chatOpened({'ip_address' : visitorData['ip_address']}) ; 205// }; 206 207 208// $(window).unload(function(){ 209// console.log('unload'); 210// }); 211 212// }); 213 214 215// $(document).ready(function() { 216// function updateZohoId(data){ 217// const domainUrl = loalizedVar['url']; 218// let request = domainUrl + '/wp-json/wl/v2/updateZohoId'; 219// return fetch(request, { 220// method: 'put', 221// headers: { 222// 'Accept': 'application/json', 223// 'Content-Type': 'application/json' 224// }, 225// body: JSON.stringify(data), 226// }).then(response => response.json()).then(res=>{ 227// console.log(res) ; 228// // sessionStorage.setItem('suitecrmIndividualLeadId', res['lead_id']); 229// }); 230// } 231// updateZohoId({ 232// 'lead_id' : sessionStorage.getItem('suitecrmCarLeadId') , 233// 'zoho_id' : sessionStorage.getItem('userID') , 234// 'type' : 'car' 235// }) ; 236// updateZohoId({ 237// 'lead_id' : sessionStorage.getItem('suitecrmIndividualLeadId') , 238// 'zoho_id' : sessionStorage.getItem('userID') , 239// 'type' : 'individual' 240// }) ; 241// }); 242 243function chatOpened(data) { 244 const domainUrl = loalizedVar['url']; 245 let request = domainUrl + '/wp-json/wp/v2/chat_opened'; 246 return fetch(request, { 247 method: 'post', 248 headers: { 249 'Accept': 'application/json', 250 'Content-Type': 'application/json' 251 }, 252 body: JSON.stringify(data), 253 254 }) ; 255} 256 257$('document').ready(function(){ 258 console.log('Logo Showcase Widget JavaScript is running'); 259 260 // Add button click event listener 261 $('body').on('click', '.button-add', function(e) { 262 e.preventDefault(); 263 console.log('Add button clicked'); 264 var custom_uploader = wp.media({ 265 title: 'Select or Upload Logo', 266 button: { 267 text: 'Use this Logo' 268 }, 269 multiple: true 270 }) 271 .on('select', function() { 272 var attachments = custom_uploader.state().get('selection').toJSON(); 273 var container = $('.logo-upload-container'); 274 var input = container.find('input').first(); 275 var logoCount = container.children().length 276 for (var i = 0; i < attachments.length; i++) { 277 var attachment = attachments[i]; 278 var newName; 279 if (input.length > 0) { 280 newName = input.attr('name').replace('[logos]', '[logos][' + logoCount + ']'); 281 } else { 282 newName = `[logos][${logoCount}]` 283 } 284 var newLogo = '<div class="logo-upload">' + 285 '<img src="' + attachment.url + '" width="100" height="100">' + 286 '<input type="hidden" name="' + newName + '[id]" value="' + attachment.id + '">' + 287 '<input type="button" class="button button-upload" value="Change Logo">' + 288 '<input type="button" class="button button-remove" value="Remove Logo">' + 289 '</div>'; 290 container.append(newLogo); 291 logoCount++; 292 } 293 }) 294 .open(); 295 }); 296 297 // Remove button click event listener 298 $('body').on('click', '.button-remove', function(e) { 299 e.preventDefault(); 300 console.log('Remove button clicked'); 301 $(this).closest('.logo-upload').remove(); 302 }); 303 }); 304 305 306 async function updateRequest(requestId, data , type = 'individual'){ 307 308 data['insuranceType'] = type; 309 310 if (!data['basicData']) { 311 data['basicData'] = {}; 312 } 313 314 data['basicData']['insurance_type_c'] = type; 315 316 var requestOptions = { 317 method: 'PUT', 318 body: JSON.stringify(data), 319 redirect: 'follow' 320 }; 321 322 try { 323 updateRequestUrl = urls['update_request_url'] 324 const response = await fetch(updateRequestUrl + '/' + requestId, requestOptions); 325 const result = await response.json(); 326 327 return result; 328 } catch (error) { 329 console.log('error', error); 330 throw error; 331 } 332}
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.