1/************Document Ready Functions************/ 2 3jQuery(document).ready(function () { 4 5 $('.owl-customers').owlCarousel({ 6 loop:true, 7 autoplay:true, 8 autoplayTimeout:5000, 9 autoHeight:true, 10 autoplayHoverPause:true, 11 margin:17, 12 smartSpeed: 1000, 13 nav:true, 14 navText: ['<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 512"><path fill="#001069" d="M166.5 424.5l-143.1-152c-4.375-4.625-6.562-10.56-6.562-16.5c0-5.938 2.188-11.88 6.562-16.5l143.1-152c9.125-9.625 24.31-10.03 33.93-.9375c9.688 9.125 10.03 24.38 .9375 33.94l-128.4 135.5l128.4 135.5c9.094 9.562 8.75 24.75-.9375 33.94C190.9 434.5 175.7 434.1 166.5 424.5z"/></svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 512"><path fill="#001069" d="M89.45 87.5l143.1 152c4.375 4.625 6.562 10.56 6.562 16.5c0 5.937-2.188 11.87-6.562 16.5l-143.1 152C80.33 434.1 65.14 434.5 55.52 425.4c-9.688-9.125-10.03-24.38-.9375-33.94l128.4-135.5l-128.4-135.5C45.49 110.9 45.83 95.75 55.52 86.56C65.14 77.47 80.33 77.87 89.45 87.5z"/></svg>'], 15 dots: false, 16 responsive:{ 17 0:{ 18 items:1 19 }, 20 992:{ 21 items:2 22 } 23 } 24 }); 25 26 $('.owl-heroslider').owlCarousel({ 27 loop:true, 28 margin:0, 29 nav:true, 30 animateOut: 'fadeOut', 31 animateIn: 'fadeIn', 32 dots: false, 33 mouseDrag: false, 34 autoplay: false, 35 smartSpeed: 1000, 36 autoHeight:true, 37 items:1, 38 navText: [ "<span class='owl-prev-icon'><img src='../wp-content/themes/AmplifyHearing/assets/images/arrow-left.svg'></span>" , "<span class='owl-next-icon'><img src='../wp-content/themes/AmplifyHearing/assets/images/arrow-right.svg'></span>" ], 39 }); 40 41 $('.owl-Amplify-logo').owlCarousel({ 42 loop:true, 43 margin:10, 44 nav:false, 45 dots: true, 46 autoplay: true, 47 autoPlaySpeed: 1000, 48 //autoPlayTimeout: 1000, 49 autoplayHoverPause: true, 50 responsive:{ 51 0:{ 52 items:1 53 }, 54 600:{ 55 items:3 56 }, 57 1000:{ 58 items:6 59 } 60 } 61 }); 62 63 $('.owl-product').owlCarousel({ 64 loop:true, 65 margin:20, 66 nav:true, 67 navText: ["<svg aria-hidden='true' focusable='false' role='img' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 512' class='svg-inline--fa'><path fill='currentColor' d='M231.293 473.899l19.799-19.799c4.686-4.686 4.686-12.284 0-16.971L70.393 256 251.092 74.87c4.686-4.686 4.686-12.284 0-16.971L231.293 38.1c-4.686-4.686-12.284-4.686-16.971 0L4.908 247.515c-4.686 4.686-4.686 12.284 0 16.971L214.322 473.9c4.687 4.686 12.285 4.686 16.971-.001z'></path></svg>", "<svg aria-hidden='true' focusable='false' role='img' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 512' class='svg-inline--fa'><path fill='currentColor' d='M24.707 38.101L4.908 57.899c-4.686 4.686-4.686 12.284 0 16.971L185.607 256 4.908 437.13c-4.686 4.686-4.686 12.284 0 16.971L24.707 473.9c4.686 4.686 12.284 4.686 16.971 0l209.414-209.414c4.686-4.686 4.686-12.284 0-16.971L41.678 38.101c-4.687-4.687-12.285-4.687-16.971 0z'></path></svg>"], 68 responsive:{ 69 0:{ 70 items:1 71 }, 72 600:{ 73 items:3 74 }, 75 1000:{ 76 items:4 77 } 78 } 79 }); 80 81 $('.help-patient-video-box').click(function(e){ 82 e.preventDefault(); 83 e.stopPropagation(); 84 e.stopImmediatePropagation(); 85 86 let success_video = $(this).children('#help_patient_video').get(0); console.log(success_video); 87 88 if (success_video.paused) { 89 success_video.play(); 90 $(this).children('.help-patient-video-icon').hide(); 91 } else { 92 success_video.pause(); 93 $(this).children('.help-patient-video-icon').show(); 94 } 95 96 }); 97 98 var menu = $('.menu-toggle'); 99 var header = $('.mobileMenu'); 100 101 menu.click( function(e) { 102 e.preventDefault(); 103 e.stopPropagation(); 104 e.stopImmediatePropagation(); 105 var status = header.hasClass('active'); 106 if(status){ 107 header.removeClass('active'); 108 //header.slideUp(700); 109 menu.removeClass('active'); 110 }else{ 111 header.addClass('active'); 112 //header.slideDown(700); 113 menu.addClass('active'); 114 } 115 }); 116 117 $('.header--momenu li.menu-item-has-children').each(function() { 118 $(this).append('<a class="open-children" href="#"><svg aria-hidden="true" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" class="svg-inline--fa"><path fill="currentColor" d="M441.9 167.3l-19.8-19.8c-4.7-4.7-12.3-4.7-17 0L224 328.2 42.9 147.5c-4.7-4.7-12.3-4.7-17 0L6.1 167.3c-4.7 4.7-4.7 12.3 0 17l209.4 209.4c4.7 4.7 12.3 4.7 17 0l209.4-209.4c4.7-4.7 4.7-12.3 0-17z" class=""></path></svg></a>'); 119 }); 120 121 $('.open-children').click( function(e) { 122 e.preventDefault(); 123 e.stopPropagation(); 124 e.stopImmediatePropagation(); 125 var link = $(this).parent(); 126 var status = link.hasClass('active'); 127 if(status){ 128 link.find('.sub-menu').slideUp(); 129 link.removeClass('active'); 130 }else{ 131 link.find('.sub-menu').slideDown(); 132 link.addClass('active'); 133 } 134 }); 135 136 if( $("#woo-pdf-list").length || $(".cust-noti-box").length ) { 137 const max_page = parseInt( $('.woo-pdf-pagination').data('max-page') ); 138 if( max_page > 1 ) { 139 let current_page = 1; 140 const par_page = parseInt( $('.woo-pdf-pagination').data('per-page') ); 141 const prev_page = $(".woo-pdf-pagination ul li").first(); 142 const last_page = $(".woo-pdf-pagination ul li").last(); 143 144 const pdf_list = $("#woo-pdf-list .has_pdf"); 145 const pdf_pagination = $('.woo-pdf-pagination li a'); 146 prev_page.hide(); 147 148 function __pagination( get_index ) { 149 const _start = par_page * ( parseInt(get_index) - 1 ) - 1; 150 const _end = par_page * ( parseInt(get_index) ) - 1; 151 for (let i = 0; i < pdf_list.length; i++) { 152 if( i > _start && i <= _end ) { 153 $( pdf_list[i] ).show(); 154 } else { 155 $( pdf_list[i] ).hide(); 156 } 157 } 158 } 159 160 pdf_pagination.on('click', function(e) { 161 e.preventDefault(), e.stopPropagation(), e.stopImmediatePropagation(); 162 const current = $( this ); 163 const get_index = current.data('index'); 164 pdf_pagination.removeClass('active'); 165 166 console.log('test'); 167 168 if( get_index == "prev" ) { 169 current_page = current_page - 1 170 __pagination( current_page ); 171 } else if( get_index == "next" ) { 172 current_page = current_page + 1 173 __pagination( current_page ); 174 } else { 175 current_page = get_index; 176 __pagination( current_page ); 177 } 178 179 current_page >= max_page ? last_page.hide() : last_page.show(); 180 current_page <= 1 ? prev_page.hide() : prev_page.show(); 181 182 $( $(".woo-pdf-pagination ul li")[current_page] ).find('a').addClass('active'); 183 }); 184 } 185 186 } 187 188 if( $('.woo-custom-account').length ) { 189 $('.owl-patient-journey').owlCarousel({ 190 //loop:true, 191 dots: false, 192 margin:10, 193 nav:true, 194 navText: ["<svg aria-hidden='true' focusable='false' role='img' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 512' class='svg-inline--fa'><path fill='currentColor' d='M231.293 473.899l19.799-19.799c4.686-4.686 4.686-12.284 0-16.971L70.393 256 251.092 74.87c4.686-4.686 4.686-12.284 0-16.971L231.293 38.1c-4.686-4.686-12.284-4.686-16.971 0L4.908 247.515c-4.686 4.686-4.686 12.284 0 16.971L214.322 473.9c4.687 4.686 12.285 4.686 16.971-.001z'></path></svg>", "<svg aria-hidden='true' focusable='false' role='img' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 512' class='svg-inline--fa'>
194<path fill='currentColor' d='M24.707 38.101L4.908 57.899c-4.686 4.686-4.686 12.284 0 16.971L185.607 256 4.908 437.13c-4.686 4.686-4.686 12.284 0 16.971L24.707 473.9c4.686 4.686 12.284 4.686 16.971 0l209.414-209.414c4.686-4.686 4.686-12.284 0-16.971L41.678 38.101c-4.687-4.687-12.285-4.687-16.971 0z'></path></svg>"], 195 center: true, 196 mouseDrag: false, 197 responsive:{ 198 0:{ 199 items:1 200 }, 201 991:{ 202 items:3 203 } 204 } 205 }); 206 207 const firstActive = $('.owl-patient-journey .items-due').first().parent().index(); 208 if( firstActive != 0 ){ 209 $('.owl-patient-journey').trigger('to.owl.carousel', [firstActive, 0, true]); 210 } 211 } 212 213 // Show Notification for paient 214 215 const seeNotofication = $('.see-notification'); 216 const patienmodal = new bootstrap.Modal(document.getElementById('patienNotificationpop'), { 217 keyboard: false, 218 }); 219 220 const modalDataApp = $('.patienNotificationpop'); 221 seeNotofication.on('click',function(e){ 222 e.preventDefault(), e.stopPropagation(), e.stopImmediatePropagation(); 223 const clicked = $(this); 224 patienmodal.show(); 225 modalDataApp.empty(); 226 const id = $(this).data('id'); 227 const final_para = JSON.stringify({ id: id }); 228 jQuery.ajax({ 229 type: 'post', 230 dataType: 'json', 231 url: ajax_url, 232 data: { 233 action: 'show_notofication_popup_patient', 234 final_para, 235 security: ajax_api_option.nonce, 236 }, 237 beforeSend: function () { 238 clicked.text('Loadding..'); 239 }, 240 success: function (response) { 241 clicked.text('Read'); 242 if (response.data.found) { 243 clicked.parent().parent().find('.not-icon').addClass('seen'); 244 modalDataApp.html(response.data.data); 245 } else { 246 modalDataApp.html(`<h3>Notification not found, Please try again!</h3>`); 247 } 248 }, 249 error: function (responce) { 250 clicked.text('Read'); 251 }, 252 }); 253 }); 254 255 function isEmail(email) { 256 var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/; 257 return regex.test(email); 258 } 259 function isPhone(phone) { 260 var regex = /((\+*)(0*|(0 )*|(0-)*|(91 )*)(\d{12}|\d{10}))|\d{5}([- ]*)\d{6}/gm; 261 return regex.test(phone); 262 } 263 264 $( '.contact_f_submit' ).click( function( e ) { 265 e.preventDefault(); 266 267 const btn = $(this); 268 var parent_form = $( this ).parents( '.f__form' ); 269 var form = $( this ).parents( 'form' ); 270 var errorMsg = parent_form.find('.test-error-msg'); 271 var successMsg = parent_form.find('.test-success-msg'); 272// const grecaptcha_id = btn.data("recaptcha_id"); 273 var message = new Array(); 274 275 errorMsg.hide().empty(); 276 successMsg.hide().empty(); 277 278 const c_First_Name = parent_form.find( '.c_First_Name' ).val(); 279 const c_Last_Name = parent_form.find( '.c_Last_Name' ).val(); 280 const c_your_email = parent_form.find( '.c_your_email' ).val(); 281 const c_Phone_Number = parent_form.find( '.c_Phone_Number' ).val(); 282 const c_Postcode = parent_form.find( '.f_postcode' ).val(); 283 const c_address = parent_form.find( '.f_address' ).val(); 284 const grecaptcha_id = parent_form.find('.contact-btn').data("recaptcha_id"); 285// const grecaptcha_response = grecaptcha.getResponse( grecaptcha_id ); 286 287 var interested_in = parent_form.find( `input[name=interested_in]:checked` ).val(); 288 var before_test = parent_form.find( `input[name=before_hearing_test]:checked` ).val(); 289 var wear = parent_form.find( `input[name=wear_hearing_aids]:checked` ).val(); 290 var private_nhs = parent_form.find( `input[name=hearing_aids_private_nhs]:checked` ).val(); 291 292 const grecaptcha_response = grecaptcha.getResponse( grecaptcha_id ); 293 294 if( ! c_First_Name ) { 295 message.push( "Please enter First Name." ); 296 } 297 if( ! c_Last_Name ) { 298 message.push( "Please enter Last Name." ); 299 } 300 if( c_your_email ) { 301 if( !isEmail( c_your_email ) ) { 302 message.push( "Please enter valid Email Address." ); 303 } 304 } else { 305 message.push( "Please enter Email Address." ); 306 } 307 if( c_Phone_Number ) { 308 if( !isPhone(c_Phone_Number) ) { 309 message.push( "Please enter valid Phone Number." ); 310 } 311 } else { 312 message.push( "Please enter Phone Number." ); 313 } 314 if( ! c_Postcode ) { 315 message.push( "Please enter Postcode." ); 316 } 317 if( ! grecaptcha_response ) { 318 message.push("Please fill recaptcha."); 319 } 320 321 if( message.length == 0 ) { 322 if( ! grecaptcha_response ) { 323 message.push( "Please fill recaptcha" ); 324 } 325 } 326 327 if( message.length === 0 ) { 328 329 $.ajax({ 330 url: ajax_url, 331 type: "POST", 332 data: { action : "Amplify_test_data_submit_request", 333 c_First_Name,c_Last_Name,c_your_email,c_Phone_Number,c_Postcode,c_address,before_test,wear,private_nhs,grecaptcha_response,interested_in, 334 security 335 }, 336 beforeSend:function() { 337 btn.addClass('disabled').prop('disabled', true); 338 }, 339 success: function (response) { 340 if (response.success === true) { 341 successMsg.html( response.data ).show(); 342 form[0].reset(); 343 } else { 344 errorMsg.html( response.data ).show(); 345 btn.removeClass('disabled').prop('disabled', false); 346 } 347 }, 348 error: function (errorThrown) { 349 errorMsg.html( errorThrown ).show(); 350 btn.removeClass('disabled').prop('disabled', false); 351 } 352 }).done(() => { 353 btn.removeClass('disabled').prop('disabled', false); 354 }); 355 } else { 356 errorMsg.html( message.join('<br>') ).show(); 357 } 358 359 }); 360 361 $('.date-withicon').datepicker({ 362 format: 'mm-dd-yyyy' 363 }); 364 365 366 // Find my Address 367 368 $( '.lookups-btn' ).click( function( e ) { 369 e.preventDefault(); 370 var btn = $(this); 371 var parent_form = $( this ).parents( '.f__form' ); 372 var form_id = parent_form.find( '.f_submit_button' ).data( 'id' ); 373 var e_msg = parent_form.find( '.test-error-msg' ); 374 var postcode_field = parent_form.find( '.f_postcode' ); 375 var postcode_val = $( postcode_field ) .val(); 376 var address_field = parent_form.find( '.f_address' ); 377 $( e_msg ).hide().empty(); 378 379 function isPostcode(postcode) { 380 var regex = /[A-Z]{1,2}[0-9]{1,2} ?[0-9][A-Z]{2}/i; 381 return regex.test(postcode); 382 } 383 384 const requestOptions = { 385 method: 'GET', 386 redirect: 'follow' 387 }; 388 389 $( address_field ).html( `<option value="no-address" selected disabled>Select Address</option>` ); 390 391 if( isPostcode( postcode_val ) ) { 392 var url = `https://api.ideal-postcodes.co.uk/v1/postcodes/${postcode_val}?api_key=ak_lmiye662q6bYecO2v4DWa9702f78J`; 393 fetch(url, requestOptions) 394 .then( response => response.json() ) 395 .then( result => { 396 if( result.code == 2000 ) { 397 for( var address in result.result ) { 398 var full_address = result.result[address].line_1; 399 if( result.result[address].line_2 ) { 400 full_address += `, ${result.result[address].line_2}`; 401 } 402 if( result.result[address].line_3 ) { 403 full_address += `, ${result.result[address].line_3}`; 404 } 405 full_address += `, ${result.result[address].post_town}, ${result.result[address].postcode}`; 406 407 $( address_field ).append( `<option value="${full_address}" >${full_address}</option>` ); 408 409 } 410 411 $( address_field ).prop( 'disabled', false ); 412 413 } else { 414 415 $( e_msg ).html( result.message ).show(); 416 $( address_field ).prop( 'disabled', true ); 417 } 418 } ) 419 .catch( error => { 420 $( e_msg ).html( error ).show(); 421 $( address_field ).prop( 'disabled', true ); 422 } ); 423 424 } else { 425 $( e_msg ).html( "Please enter valid postcode." ).show(); 426 $( address_field ).prop( 'disabled', true ); 427 } 428 }); 429 430 $( '.hearing-test-modal' ).click( function( e ) { 431 $('#hearingTest--modal').modal('show'); 432 }); 433 434 $('.leave-feedback-btn').click(function (e) { 435 e.preventDefault(); 436 $(".error-msg").hide().empty(); 437 438 var fb_first_name = $.trim( $(".feedback_first_name").val() ); 439 var fb_last_name = $.trim( $(".feedback_last_name").val() ); 440 var fb_email = $.trim( $(".feedback_email").val() ); 441 var fb_phone = $.trim( $(".feedback_phone").val() ); 442 var fb_message = $.trim( $(".feedback_message").val() ); 443 const phone_regex = /((\+*)(0*|(0 )*|(0-)*|(91 )*)(\d{12}|\d{10}))|\d{5}
443([- ]*)\d{6}/gm; 444 445 var message = new Array(); 446 447 if( fb_phone ) { 448 if( !phone_regex.test(fb_phone) ) { 449 message.push( "Please enter valid phone." ); 450 } 451 } else { 452 message.push( "Please enter phone." ); 453 } 454 if( !fb_message ) { 455 message.push( "Please enter Feedback." ); 456 } 457 458 if( message.length === 0 ) { 459 460 $.ajax({ 461 type:"POST", 462 dataType: "json", 463 url:ajax_url, 464 data: { 465 action : "feedback_submit_request", 466 fb_first_name : fb_first_name, 467 fb_last_name : fb_last_name, 468 fb_email : fb_email, 469 fb_phone : fb_phone, 470 fb_message :fb_message 471 }, 472 success: function( response ) { 473 if( response.type == "success" ) { 474 $(".success-msg").html(response.message).show(); 475 $('.leave-feedback-btn').prop('disabled', true); 476 } else { 477 $(".error-msg").html(response.message).show(); 478 } 479 }, 480 error: function(qXHR, textStatus, errorThrown) { 481 $( ".error-msg" ).html( errorThrown ).show(); 482 } 483 }); 484 } else { 485 $( ".error-msg" ).html( message.join('<br>') ).show(); 486 } 487 }); 488 489 $('.faq__title').click( function(e) { 490 e.preventDefault(); 491 e.stopPropagation(); 492 e.stopImmediatePropagation(); 493 const clicked = $(this); 494 const clicked_parent = clicked.parent(); 495 clicked_parent.toggleClass('active'); 496 clicked_parent.find('.faq__cont').slideToggle('slow'); 497 498 $('.faq__box').not(clicked_parent).each(function(){ 499 $(this).removeClass('active'); 500 $(this).find('.faq__cont').slideUp('slow'); 501 }); 502 }); 503});
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.