1$(document).ready(function() { 2 3 4 /****COOKIES SYSTEM****/ 5 6 const cookies = getCookie('cookie-consent'); 7 8 //if undefined cookie cookie-consent or not accepted, create 9 if(typeof cookies === 'undefined' || cookies==='enabled'){ 10 11 clearCookies(); //if not accepted yet clear cookies analytics 12 13 /*IF NOT ACCEPTED SHOW BAR */ 14 $('#cookie-bar-fixed').show(); 15 16 //Sets expiration date for cookie 17 var expireDate = new Date(); 18 var date = 3600 * 1000 * 24 * 365; 19 expireDate.setTime(expireDate.getTime()+(date)); 20 expireDate = expireDate.toGMTString(); 21 var cookieEntry = 'cookie-consent={value}; expires='+expireDate+'; path=/'; 22 23 //Retrieves current cookie preference 24 var i,cookieValue='',aCookie,aCookies=document.cookie.split('; '); 25 for (i=0;i<aCookies.length;i++){ 26 aCookie = aCookies[i].split('='); 27 if(aCookie[0]==='cookie-consent'){ 28 cookieValue = aCookie[1]; 29 } 30 } 31 32 cookieValue = 'enabled'; 33 document.cookie = cookieEntry.replace('{value}','enabled'); 34 35 //Sets up default cookie preference if not already set 36 if(cookieValue==='' && doReturn!=='cookies' && options.autoEnable){ 37 document.cookie = cookieEntry.replace('{value}','enabled'); 38 }else if((cookieValue==='accepted' || cookieValue==='declined') && doReturn!=='cookies' && options.renewOnVisit){ 39 document.cookie = cookieEntry.replace('{value}',cookieValue); 40 } 41 } 42 43 //save cookies -> calls CookieController(function saveCookies) 44 $('.accept-cookies').on('click',function(event) { 45 event.preventDefault(); 46 47 var analytics = $('#checkbox-analytics').is(":checked") ? 1 : 0; 48 49 if($(this).hasClass('all-cookies')) { 50 analytics = true; 51 } 52 var url = $(this).data('url').replace(/^http:/, 'https:'); 53 if('canalfarmaciaonline.farmaoffice.test' === window.location.host){ 54 url = $(this).data('url'); 55 } 56 57 $.ajax({ 58 type: "POST", 59 url: url, 60 data: {analytics: analytics}, 61 dataType: 'json', 62 cache: false, 63 global: false, //disable ajaxStart animation 64 beforeSend: function() { 65 $('#cookie-bar-fixed').hide(); 66 }, 67 success: function (data) { 68 if (data.status === 0) { 69 //set cookie cookie-consent accepted with analytics(value all) for 1 year, with that we will not show cookie consent bar until cookie ends. 70 document.cookie = cookieEntry.replace('{value}','all'); 71 $('.analytics-cookies').html(data.html); 72 }else if(data.status === 1){ 73 //set cookie cookie-consent accepted for 1 year(no analytics, but we will not show cookie consent bar until cookie ends) 74 document.cookie = cookieEntry.replace('{value}','accepted'); 75 }else{ 76 console.log("error"); 77 } 78 }, 79 error: function (message) { 80 console.log('Error: ' + message); 81 response('Error: ' + message); 82 } 83 }); 84 85 }); 86 87 /****END COOKIES SYSTEM****/ 88 89 // fix position fixed-header 90 if ($('#fixed-header-on').length) { 91 $('body').addClass('has-fixed-header'); 92 } 93 94 $('#bday').myDatePicker(); 95 $('#birthdate-default').myDatePicker(); 96 97 $('.setDatePicker').each( function (index) { 98 99 var params = {}; 100 101 var mindate = $(this).attr('data-mindate'); 102 if (typeof mindate !== typeof undefined && mindate !== false) { 103 console.log(mindate); 104 params.minDate = mindate; 105 } 106 107 $(this).myDatePicker(params); 108 }); 109 110 $('.FO_toggleElement').on('click',function(event) { 111 event.preventDefault(); 112 var target = $($(this).data('target')); 113 114 target.slideToggle(); 115 }); 116 117 $('#validate_code').on('click', function (event) { 118 119 event.preventDefault(); 120 121 $('#validate_code_message').html(''); 122 $('#discount_container').html(''); 123 124 var $button = $(this);
125 var validate_code_url = $button.data("urlvalidate"); 126 var total = $('#price').val(); 127 var promo_code = $('#promo_code').val(); 128 var content_id = $('#content_id').val(); 129 130 $.ajax({ 131 type: "POST", 132 url: validate_code_url, 133 cache: false, 134 data: {'content_id': content_id, 'total': total, 'promo_code': promo_code }, 135 dataType: 'json', 136 beforeSend: function() { 137 $button.hide(); 138 }, 139 success: function (data) { 140 if (data.status == 0) { 141 console.log('validate ok'); 142 $('#discount_container').html(data.discount + data.new_total ); 143 } else { 144 145 } 146 $('#validate_code_message').html(data.message); 147 148 }, 149 complete: function() { 150 $button.show(); 151 } 152 }); 153 154 return false; 155 156 }); 157 158 /*$('body').on('click', '#validate_code_cart', function (event) { 159 160 event.preventDefault(); 161 162 var $this = $(this); 163 var validate_code_url = $this.data("urlvalidate"); 164 var promo_code = $('#promo_code').val(); 165 166 $(this).find('.fop-error-container').each(function () { 167 $(this).removeClass('fop-error-container'); 168 $(this).find('.fop-error-right').remove(); 169 }); 170 var $button = $(this).find('[type=submit]').last(); 171 $.ajax({ 172 type: "POST", 173 url: validate_code_url, 174 cache: false, 175 data: {'promo_code': promo_code}, 176 dataType: 'json', 177 success: function (data) { 178 if (data.success) { 179 180 $('#summary-container').html(data.html); 181 $('#summary-container').removeClass('hide'); 182 $('#summary-container').show(); 183 184 $('#promoCodeOk').show(); 185 $('#promoCodeOk').removeClass('hide'); 186 187 $('#promoCodeError').hide(); 188 $('#promoCodeError').addClass('hide'); 189 190 $('#box-promo-code').hide(); 191 $('#box-promo-code').addClass('hide'); 192 193 } else { 194 $('#promoCodeError').show(); 195 $('#promoCodeError').removeClass('hide'); 196 $('#promoCodeOk').hide(); 197 $('#promoCodeOk').addClass('hide'); 198 199 if(data.error == 'codeko') { 200 $('#messageCodeKo').show(); 201 $('#messageCodeKo').removeClass('hide'); 202 } else if(data.error == 'codeko_applyold'){ 203 $('#messageCodeOld').show(); 204 $('#messageCodeOld').removeClass('hide'); 205 } 206 } 207 }, 208 complete: function() { 209 $button.show(); 210 } 211 }); 212 });*/ 213 214 $('body').on('click', '.add-family-member', function(event) { 215 event.preventDefault(); 216 217 var findClass = ''; 218 if ($('#is-client').hasClass('active')) { 219 findClass = '#is-client'; 220 } else { 221 findClass = '#new-client'; 222 } 223 224 var dates = {}; 225 if($('#babies').length) { 226 dates = {'maxDate': 0} 227 } 228 229 if($('#pregnancy').length) { 230 dates = {'minDate':0} 231 } 232 233 $('.family-original').first().clone().removeClass('family-original').removeClass('dnone').appendTo(findClass + ' .family-container').find('.birthdate').myDatePicker(dates); 234 235 $(findClass+' .family-container .family-inputs [name="familyname[]"]').attr('required',"required"); 236 $(findClass+' .family-container .family-inputs [name="birthdate[]"]').attr('required',"required"); 237 }); 238 239 $('body').on('click', '[href="#is-client"]', function(event) { 240 event.preventDefault(); 241 $('#new-client .family-container .family-inputs [name="familyname[]"]').prop('required',false); 242 $('#new-client .family-container .family-inputs [name="birthdate[]"]').prop('required',false);
243 $('#is-client .family-container .family-inputs [name="familyname[]"]').attr('required',"required"); 244 $('#is-client .family-container .family-inputs [name="birthdate[]"]').attr('required',"required"); 245 }); 246 247 $('body').on('click', '[href="#new-client"]', function(event) { 248 event.preventDefault(); 249 $('#is-client .family-container .family-inputs [name="familyname[]"]').prop('required',false); 250 $('#is-client .family-container .family-inputs [name="birthdate[]"]').prop('required',false); 251 $('#new-client .family-container .family-inputs [name="familyname[]"]').attr('required',"required"); 252 $('#new-client .family-container .family-inputs [name="birthdate[]"]').attr('required',"required"); 253 }); 254 255 $('body').on('click', '.remove-family-member', function(event) { 256 event.preventDefault(); 257 $(this).parents('.family-inputs').remove(); 258 }); 259 260$('body').on('submit', '.fop-ajax-form', function (event) { 261 event.preventDefault(); 262 let $this = $(this); 263 264 grecaptcha.ready(function() { 265 grecaptcha.execute(recaptchaSiteKey, {action: 'homepage'}).then(function(recaptchaResponseToken) { 266 // START logic to submit to backend here. 267 268 $this.find('.fop-error-container').each(function () { 269 $this.removeClass('fop-error-container'); 270 $this.find('.fop-error-right').remove(); 271 }); 272 273 $('#success').remove(); 274 $('#warning').remove(); 275 $('#danger').remove(); 276 277 let $button = $this.find('[type=submit]').last(); 278 279 $.ajax({ 280 type: "POST", 281 url: $this.attr('action'), 282 cache: false, 283 data: $this.serialize() + '&g-recaptcha-response=' + recaptchaResponseToken, // Form serialized data + reCAPTCHA token 284 dataType: 'json', 285 beforeSend: function() { 286 $button.hide(); // Hide button to prevent multiple clicks 287 //TODO: check if code in the line below it's still being used or it should. It not used remove it. 288 $button.after('<div class="cssload-square"> <div class="cssload-square-part cssload-square-green"></div> <div class="cssload-square-part cssload-square-pink"></div> <div class="cssload-square-blend"></div> </div>'); 289 }, 290 success: function (data) { 291 292 if (data.status === 0) { 293 if (typeof(data.do_not_hide_form) == 'undefined') { 294 $this.fadeOut().slideUp(1000, function () { 295 if (data.action === "message") { 296 $("#success-msg").remove(); 297 $this.before("<div class='alert alert-success success animated bounceInLeft' id='success'><i class='fa fa-check'></i> " + data.message + "</div>"); 298 //$("<div class="alert alert-success success" id="success"><i class="fa fa-check"></i> Tu mensaje ha sido enviado correctamente.</div>").appendTo($this).addClass('animated bounceInRight'); 299 } else if (data.action === "redirect") { 300 document.location.href = data.redirect; 301 } 302 }); 303 } else { 304 $button.before("<div class='alert alert-success success animated bounceInLeft' id='success'><i class='fa fa-check'></i> " + data.message + "</div>"); 305 } 306 } else { 307 if(data.status === 2) { 308 //$('.recaptcha').before("<span class='fop-error-right'>" + data.message + "</span>").parent().addClass('fop-error-container'); 309 } else { 310 if (typeof(data.generic_error) != 'undefined') { 311 $("#success-msg").remove(); 312 $this.before("<p id='success-msg' class='alert alert-danger'>" + data.generic_error + "</p>"); 313/* $([document.documentElement, document.body]).animate({ 314 scrollTop: $('.alert-danger').first().offset().top - 100 315 }, 1000); */ 316 } else { 317 // Check if form has class to show errors below fields 318 var showErrorsBelow = $this.hasClass('fop-errors-below'); 319 320 for (let i = 0, len = data.errors.length; i < len; i++) { 321 let currentErrorField = $('[name=' + data.errors[i].field + ']'); 322 323 if (currentErrorField.attr('name') === 'location_id' || currentErrorField.attr('name') === 'state_id') { 324 if (showErrorsBelow) { 325 currentErrorField.parent().after("<span class='fop-error-right' style='font-size: 12px;'>" + data.errors[i].message + "</span>"); 326 } else { 327 currentErrorField.parent().before("<span class='fop-error-right' style='font-size: 12px;'>" + data.errors[i].message + "</span>"); 328 } 329 currentErrorField.parent().parent().addClass('fop-error-container'); 330 } else { 331 if (showErrorsBelow) { 332 currentErrorField.after("<span class='fop-error-right' style='font-size: 12px;'>" + data.errors[i].message + "</span>"); 333 } else { 334 currentErrorField.before("<span class='fop-error-right' style='font-size: 12px;'>" + data.errors[i].message + "</span>"); 335 } 336 currentErrorField.parent().addClass('fop-error-container'); 337 } 338 } 339 340 var elementOffset = $('.fop-error-container').first().offset().top; 341 var scrollPosition = showErrorsBelow ? elementOffset - (window.innerHeight / 2) : elementOffset - 100; 342 $([document.documentElement, document.body]).animate({ 343 scrollTop: scrollPosition 344 }, 1000); 345 if (typeof(data.form_failed_msg) != 'undefined') { 346 $button.before("<div class='alert alert-danger danger animated bounceInLeft' id='danger'><i class='fa fa-times'></i> " + data.form_failed_msg + "</div>"); 347 } 348 } 349 } 350 } 351 352 }, 353 complete: function() { 354 $('.cssload-square').remove(); //TODO: check if this code still being used or it should. If not used, remove it. 355 $button.show(); 356 } 357 }); 358 359 return false; // Submit finished 360 361 // END logic to submit to backend here. 362 }); 363 }); 364 }); 365 366 367 async function postForm(url, formData) { 368 try { 369 const response = await fetch(url, { 370 method: 'POST', 371 headers: { 372 'X-Requested-With': 'XMLHttpRequest', 373 'X-CSRF-TOKEN': document.querySelector('input[name="_token"]').value 374 }, 375 body: formData 376 }); 377 378 const data = await response.json(); 379 return { status: response.status, data }; 380 } catch (error) { 381 return { status: 500, data: { error: 'Error de conexión.' } }; 382 } 383 } 384 385 $('body').on('submit', '#cart-payment-form', function (event) { 386 event.preventDefault(); 387 var $this = $(this); 388 var terms = $('#terms').is(":checked") ? 1 : 0; 389 var newsletterSubscribe = $('#commercial').is(":checked") ? 1 : 0; 390 var classRequired = $(".required-payment") 391 // disable submit button to avoid multiple clicks 392 $('#payment_button').prop('disabled', true); 393 394 classRequired.each(function(){ 395 if($(this).hasClass('fop-error-container')){ 396 $(this).removeClass("fop-error-container") 397 } 398 }); 399 400 if (!terms) { 401 classRequired.each(function(){ 402 if(!$(this).hasClass('fop-error-container')){ 403 $(this).addClass("fop-error-container") 404 } 405 }); 406 $([document.documentElement, document.body]).animate({ 407 scrollTop: $('.fop-error-container').first().offset().top - 350 408 }, 1000); 409 410 // enable button 411 $('#payment_button').prop('disabled', false); 412 413 } else { 414 if(newsletterSubscribe){ 415 const form = event.target; 416 const formData = new FormData(form); 417 const newsletterUrl = window.NEWSLETTER_SUBSCRIBE_URL; 418 postForm(newsletterUrl, formData) 419 /* .then(response => { 420 console.log(response); 421 }) */ 422 .catch(error => { 423 console.warn(error); 424 }); 425 } 426 grecaptcha.ready(function() { 427 grecaptcha.execute(recaptchaSiteKey, {action: 'homepage'}).then(function(recaptchaResponseToken) { 428 429 $($this).find("input[name='g-recaptcha-response']").remove(); 430 $this.prepend("<input name='g-recaptcha-response' type='hidden' value='"+recaptchaResponseToken+"' />"); 431 $($this).removeAttr('id'); 432 $this.submit(); 433 }); 434 }); 435 } 436 437 }); 438 439 $('body').on('change', '#pharmacyOpenFilter', function(event) { 440 if ($(this).val() == 0) 441 { 442 var url = $('#frmPharmacyOpenFilter').attr('action') + '/' + $('input[name=month]').val() + '/' + $('input[name=year]').val(); 443 } else { 444 var url = $('#frmPharmacyOpenFilter').attr('action') + '/' + $(this).val() + '/' + $('input[name=month]').val() + '/' + $('input[name=year]').val(); 445 } 446 document.location.href = url; 447 }); 448 449 $('body').on('click', '.iframe-maps-wrapper', function(event) { 450 $('.iframe-maps-wrapper iframe').removeClass('scrolloff'); 451 }); 452 453 $('body').on('mouseenter', '.fop-tooltip', function () { 454 var title = $(this).attr('title'); 455 $(this).data('tipText', title).removeAttr('title'); 456 $('<p class="fop-tooltip-content"></p>') 457 .text(title) 458 .appendTo('body') 459 .fadeIn(200); 460 }); 461 $('body').on('mouseleave', '.fop-tooltip', function () { 462 $(this).attr('title', $(this).data('tipText')); 463 $('.fop-tooltip-content').remove(); 464 }); 465 $('body').on('mousemove', '.fop-tooltip', function (event) { 466 var mousex = event.pageX + 20; //Get X coordinates 467 var mousey = event.pageY + 10; //Get Y coordinates 468 $('.fop-tooltip-content').css({top: mousey, left: mousex}); 469 }); 470 $('body').on('click', '.fop-tooltip', function (event) { 471 $('.fop-tooltip-content').remove(); 472 }); 473 $('body').on('closed', '.fop-modal-maps', function () { 474 $('div.fop-modal-maps').remodal().destroy(); 475 $('.fop-modal-maps').remove(); 476 }); 477 $('body').on('click', '.tooltip-maps td.color, .tooltip-maps td span', function (event) { 478 event.preventDefault(); 479 $.ajax({ 480 url: $(this).data('url'), 481 dataType: 'json', 482 success: function(data) { 483 //$('<p class="fop-modal-maps remodal"></p>').html(data.html).appendTo('body'); 484 $('<div class="fop-modal-maps"></div>').appendTo('body').html(data.html); 485 $('div.fop-modal-maps').remodal().open(); 486 var latlng = new google.maps.LatLng(data.latitude, data.longitude); 487 console.log("Latitude: " + data.latitude + " - L
487ongitude: " + data.longitude); 488 var myOptions = { 489 zoom: 15, 490 center:latlng, 491 draggable: true 492 }; 493 var map = new google.maps.Map(document.getElementById("pharmacy-map"),myOptions); 494 var marker = new google.maps.Marker({ 495 position: latlng, 496 map: map 497 }); 498 map.setCenter(latlng); 499 console.log(map); 500 }, 501 complete: function() { 502 503 } 504 }); 505 506 }); 507 508 //new open modal maps for new_pharmacy_open blade 509 $('body').on('click', '.tooltip-maps-li, .tooltip-maps span', function (event) { 510 event.preventDefault(); 511 $.ajax({ 512 url: $(this).data('url'), 513 dataType: 'json', 514 success: function(data) { 515 //$('<p class="fop-modal-maps remodal"></p>').html(data.html).appendTo('body'); 516 $('<div class="fop-modal-maps"></div>').appendTo('body').html(data.html); 517 $('div.fop-modal-maps').remodal().open(); 518 var latlng = new google.maps.LatLng(data.latitude, data.longitude); 519 var myOptions = { 520 zoom: 15, 521 center:latlng, 522 draggable: true 523 }; 524 var map = new google.maps.Map(document.getElementById("pharmacy-map"),myOptions); 525 var marker = new google.maps.Marker({ 526 position: latlng, 527 map: map 528 }); 529 map.setCenter(latlng); 530 }, 531 complete: function() { 532 } 533 }); 534 }); 535 536 $('body').on("click", ".goto-href", function (e) { 537 e.stopPropagation(); 538 document.location.href = $(this).data('href'); 539 }); 540 541 $('body').on('submit', '#reset-password-form', function (event) { 542 event.preventDefault(); 543 $.ajax({ 544 url: $(this).attr('action'), 545 type: 'post', 546 dataType: 'json', 547 cache: false, 548 data: $(this).serialize(), 549 success: function (data) { 550 if(data.status == 0) { 551 $('#content-result').html("<div class='alert alert-success'>" + data.message + "</div>"); 552 } else if(data.status == 1) { 553 alert("session"); 554 $('#content-result').html("<div class='alert alert-warning'>" + data.message + "</div>"); 555 } else if(data.status == 2) { 556 $('#content-result').prepend("<div class='alert alert-warning'>" + data.message + "</div>"); 557 } 558 } 559 }); 560 return false; 561 }); 562 563 $('body').on('submit', '#reset-form', function (event) { 564 event.preventDefault(); 565 $.ajax({ 566 url: $(this).attr('action'), 567 type: 'post', 568 data: $(this).serialize(), 569 dataType: 'json', 570 success: function (data) { 571 if(data.status=='0') { 572 $('#content-result').html("<div class='alert alert-success'><p>" + data.message + "</p></div>"); 573 } else if(data.status=='1') { 574 $('#content-result').prepend("<div class='alert alert-warning'><p>" + data.message + "</p></div>"); 575 } 576 } 577 }); 578 return false; 579 }); 580 581 $('body').on('change', '.extrainfo-select', function(event) { 582 var id = $(this).data('id'); 583 var placeholder = $(this).find('option:selected').data('placeholder'); 584 if($(this).find('option:selected').data('openfield')) { 585 $('#extrainfo-open-field-' + id).find('input').attr('placeholder', placeholder); 586 $('#extrainfo-open-field-' + id).removeClass('dnone').addClass('animated bounceInLeft'); 587 } else if($('#extrainfo-open-field-' + id).hasClass('bounceInLeft')) { 588 $('#extrainfo-open-field-' + id).removeClass('animated bounceInLeft').addClass('animated bounceOutLeft').one('webkitAnimationEnd oanimationend msAnimationEnd animationend', function() { 589 $('#extrainfo-open-field-' + id).addClass('dnone'); 590 }); 591 592 593 } 594 }); 595 596 $('body').on('submit', '#form-extrainfo', function(event) { 597 var $button = $(this).find('[type=submit]').last(); 598 var $form = $(this); 599 $.ajax({ 600 url: $form.attr('action'), 601 data: $form.serialize(), 602 type: 'post', 603 beforeSend: function() { 604 $button.hide(); 605 $button.after('<div class="cssload-square"> <div class="cssload-square-part cssload-square-green"></div> <div class="cssload-square-part cssload-square-pink"></div> <div class="cssload-square-blend"></div> </div>'); 606 }, 607 success: function(data) { 608 $form.hide(); 609 $form.before("<div class='alert alert-success success animated bounceInLeft' id='success'><i class='fa fa-check'></i> " + data + "</div>"); 610 } 611 }); 612 return false;
613 }); 614 615 $('body').on('mouseenter', '.fo-tooltip', function () { 616 var title = $(this).attr('title'); 617 $(this).data('tipText', title).removeAttr('title'); 618 $('<p class="fo-tooltip-content"></p>') 619 .text(title) 620 .appendTo('body') 621 .fadeIn(200); 622 }); 623 $('body').on('mouseleave', '.fo-tooltip', function () { 624 $(this).attr('title', $(this).data('tipText')); 625 $('.fo-tooltip-content').remove(); 626 }); 627 $('body').on('mousemove', '.fo-tooltip', function (event) { 628 if($(this).hasClass('fo-tooltip-right')) { 629 var mousex = event.pageX - 115; //Get X coordinates 630 } else { 631 var mousex = event.pageX + 20; //Get X coordinates 632 } 633 var mousey = event.pageY + 10; //Get Y coordinates 634 $('.fo-tooltip-content').css({top: mousey, left: mousex}); 635 }); 636 $('body').on('click', '.fo-tooltip', function (event) { 637 $('.fo-tooltip-content').remove(); 638 }); 639 640 $('body').on('click', '#fop-calendar .pharmacy', function(event) { 641 $('#fop-calendar-legend td[data-id=' + $(this).data('id') + ']').trigger('click'); 642 }); 643 644 $('body').on('click', '.img-layette', function () { 645 $(this).parent().find('.layette-content h3 a').trigger('click'); 646 }); 647 648 $('body').on('click', '.layette-content p', function () { 649 $(this).parent().find('h3 a').trigger('click'); 650 }); 651 652 $('body').on('click', '.cfo-modal-login', function(event) { 653 event.preventDefault(); 654 $("#cfoLoginModal").modal("show"); 655 }); 656 657 $(document).ajaxStart(function(){ 658 659 $('.overlap-ajax').fadeIn(300); 660 661 }); 662 663 664 $(document).ajaxStop(function(){ 665 666 $('.overlap-ajax').fadeOut(300); 667 $('.overlap.ajax .sk-text').text(''); 668 669 }); 670 671 //get client data if user_import->nif exists on keyUp 672 $(".client_form .NifgetClientInfo").keyup(function (e) { 673 674 //get nif value entered on "soc client tab" 675 var nif = $(".client_form .NifgetClientInfo").val(); 676 677 //get parent form 678 var form = $(".NifgetClientInfo").closest('.client_form'); 679 680 if(nif.length>=9){ 681 $.ajax({ 682 type: "POST", 683 url: $(".NifgetClientInfo").data('url'), 684 dataType: "json", 685 data: form.serialize(), 686 success: function (data) { 687 if (data.status == 0) { 688 if (data.action == "message") { 689 690 $("#success-msg").remove(); 691 692 form.before("<div class='alert alert-success success animated bounceInLeft' id='success-msg'><i class='fa fa-check'></i> " + data.message + "</div>"); 693 694 //esborrar dades previes del form 695 $('.fop-ajax-form').find("input[type=text], input[type=email], input[type=tel], textarea").val(""); 696 //esborrar checkbox marcats 697 $('.fop-ajax-form').closest('.client_form').find("input[type=checkbox]").prop('checked', false); 698 699 700 //get options field(checkbox interessos) 701 for (var i = 0; i < data.options.length; i++) { 702 //marcar interessos rebuts per options 703 form.find('#' + +data.options[i]).prop('checked', true); 704 } 705 706 //per cada key rebuda del json que conte les dades del client, omplim 707 Object.keys(data.user_import).forEach(function(k){ 708 if ($('input[name="'+k+'"]').length > 0) { 709 form.find(('input[name="'+k+'"]')).val(data.user_import[k]); //omplir els inputs que tenen el mateix nom que la key rebuda 710 } 711 //cas select option value es tracta diferent 712 if(k=='gender') { 713 form.find(('select[name="'+k+'"]')).val(data.user_import[k]); 714 } 715 }); 716 717 //get family 718 /*for (var i = 0; i < data.family.length; i++) { 719 console.log(data.family[i]); 720 721 var findClass = ''; 722 if ($('#is-client').hasClass('active')) { 723 findClass = '#is-client'; 724 } else { 725 findClass = '#new-client'; 726 } 727 728 var dates = {}; 729 if($('#babies').length) { 730 dates = {'maxDate': 0} 731 } 732 733 if($('#pregnancy').length) { 734 dates = {'minDate':0} 735 } 736 737 if(i==0) { 738 $('.family-original').first().clone().removeClass('family-original').removeClass('dnone').appendTo(findClass + ' .family-container').find('.birthdate').myDatePicker(dates); 739 } 740 741 $(findClass+' .family-container .family-inputs [name="familyname[]"]').attr('required',"required"); 742 $(findClass+' .family-container .family-inputs [name="birthdate[]"]').attr('required',"required"); 743 744 }*/ 745 746 } 747 }else{ 748 if (typeof(data.generic_error) != 'undefined') { 749 //esborrar dades previes del form 750 $('.NifgetClientInfo').closest('form').find("input[type=text], input[type=email], input[type=tel], textarea, select").val(""); 751 //esborrar checkbox marcats 752 $(".NifgetClientInfo").closest('.client_form').find("input[type=checkbox]").prop('checked', false); 753 754 $("#success-msg").remove(); 755 form.before("<p id='success-msg' class='alert alert-danger'>" + data.generic_error + "</p>"); 756 } else { 757 //esborrar dades previes del form 758 $('.NifgetClientInfo').closest('form').find("input[type=text], textarea, select").val(""); 759 //esborrar checkbox marcats 760 $(".NifgetClientInfo").closest('.client_form').find("input[type=checkbox]").prop('checked', false); 761 762 for (var i = 0, len = data.errors.length; i < len; i++) { 763 if ($('[name=' + data.errors[i].field + ']').attr('type') == 'radio') { 764 $('input:radio').parent().parent().before("<span class='fop-error-right' style='font-size: 12px;'>" + data.errors[i].message + "</span>"); 765 $('input:radio').parent().parent().parent().addClass('fop-error-container'); 766 } else { 767 $('[name=' + data.errors[i].field + ']').before("<span class='fop-error-right' style='font-size: 12px;'>" + data.errors[i].message + "</span>"); 768 $('[name=' + data.errors[i].field + ']').parent().addClass('fop-error-container'); 769 } 770 771 } 772 } 773 } 774 }, 775 error: function (message) { 776 console.log('Error: ' + message); 777 response('Error: ' + message); 778 } 779 }); 780 781 }else{ 782 783 //esborrar dades previes del form excepte la del nifnie 784 $('.fop-ajax-form').find("input[type=text][name!=nifnie], input[type=email], input[type=tel], textarea, select").val(""); 785 //esborrar checkbox marcats 786 $('.fop-ajax-form').closest('.client_form').find("input[type=checkbox]").prop('checked', false); 787 788 } 789 }); 790
791 /** Ecommerce aside sticky start height fix **/ 792 $(window).on("resize scroll", function() { 793 var initialHeight = 0; 794 795 if ($("header.fixed").length) { 796 initialHeight = $("header").first().outerHeight(); 797 } 798 799 $(".ecommerce-aside").css("top", initialHeight + "px"); 800 $(".ecommerce-aside").css("height", "calc(100vh - " + initialHeight + "px)"); 801 }); 802 803 $(window).trigger("resize"); 804 805 /** Popup functions **/ 806 const popup_cookie = getCookie('popup'); 807 808 $(document).on("click", ".popup-dismiss", function() { 809 $(".popup-overlay").fadeOut(); 810 811 setPopupCookie(); 812 813 return false; 814 }); 815 816 $(document).on("click", "#popup-container a", function() { 817 $(".popup-overlay").fadeOut(); 818 819 setPopupCookie(); 820 }); 821 822 //if undefined cookie cookie-consent or not accepted, create 823 if(typeof popup_cookie === 'undefined' || popup_cookie != $('#popup-container').data("id")){ 824 $(".popup-overlay").fadeIn(); 825 } 826}); 827 828function setPopupCookie() { 829 // Sets expiration date for cookie 830 var expireDate = new Date(); 831 var date = 3600 * 1000 * 24 * 365; 832 expireDate.setTime(expireDate.getTime()+(date)); 833 expireDate = expireDate.toGMTString(); 834 var cookieEntry = 'popup={value}; expires='+expireDate+'; path=/'; 835 836 // Set the cookie itself 837 document.cookie = cookieEntry.replace('{value}',$('#popup-container').data("id")); 838} 839 840$.fn.myDatePicker = function(extraParams){ 841 842 843 $.datepicker.regional['es'] = { 844 closeText: 'Cerrar', 845 prevText: '<Ant', 846 nextText: 'Sig>', 847 currentText: 'Hoy', 848 monthNames: ['Enero','Febrero','Marzo','Abril','Mayo','Junio', 849 'Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'], 850 monthNamesShort: ['Ene','Feb','Mar','Abr','May','Jun', 851 'Jul','Ago','Sep','Oct','Nov','Dic'], 852 dayNames: ['Domingo','Lunes','Martes','Miércoles','Jueves','Viernes','Sábado'], 853 dayNamesShort: ['Dom','Lun','Mar','Mié','Juv','Vie','Sáb'], 854 dayNamesMin: ['Do','Lu','Ma','Mi','Ju','Vi','Sa'], 855 weekHeader: 'Sm', 856 dateFormat: 'dd/mm/yy', 857 firstDay: 1, 858 isRTL: false, 859 showMonthAfterYear: false, 860 yearSuffix: ''}; 861 862 $.datepicker.setDefaults($.datepicker.regional['es']); 863 $.datepicker.setDefaults(extraParams); 864 865 var mydate = this; 866 867 mydate.datepicker({ 868 dateFormat: 'dd/mm/yy', 869 changeMonth: true, 870 changeYear: true, 871 yearRange: "-80:+10", 872 }).mask("00/00/0000",{ 873 // placeholder:"MM/DD/YYYY", 874 // clearIfNotMatch: true, 875 onComplete:function(){ 876 if( !checkDate(mydate.val()) ){ 877 mydate.val(''); 878 } 879 } 880 }); 881 882 mydate.focusout(function() { 883 if( !checkDate(mydate.val()) ){ 884 mydate.val(''); 885 } 886 }); 887 888 return this; 889}; 890 891function checkDate(val){ 892 var er = /^(((0[1-9]|[12][0-9]|3[01])([-.\/])(0[13578]|10|12)([-.\/])(\d{4}))|(([0][1-9]|[12][0-9]|30)([-.\/])(0[469]|11)([-.\/])(\d{4}))|((0[1-9]|1[0-9]|2[0-8])([-.\/])(02)([-.\/])(\d{4}))|((29)(\.|-|\/)(02)([-.\/])([02468][048]00))|((29)([-.\/])(02)([-.\/])([13579][26]00))|((29)([-.\/])(02)([-.\/])([0-9][0-9][0][48]))|((29)([-.\/])(02)([-.\/])([0-9][0-9][2468][048]))|((29)([-.\/])(02)([-.\/])([0-9][0-9][13579][26])))$/; 893 894 if (!er.test(val)) 895 return false; 896 else 897 return true; 898} 899 900 901function PopupCenter(url, title, w, h) { 902 // Fixes dual-screen position Most browsers Firefox 903 var dualScreenLeft = window.screenLeft != undefined ? window.screenLeft : screen.left; 904 var dualScreenTop = window.screenTop != undefined ? window.screenTop : screen.top; 905 906 var width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width; 907 var height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height; 908 909 var left = ((width / 2) - (w / 2)) + dualScreenLeft; 910 var top = ((height / 2) - (h / 2)) + dualScreenTop; 911 var newWindow = window.open(url, title, 'scrollbars=yes, width=' + w + ', height=' + h + ', top='
911+ top + ', left=' + left); 912 913 // Puts focus on the newWindow 914 if (window.focus) { 915 newWindow.focus(); 916 } 917} 918 919function getCookie(c_name) { 920 var i, x, y, ARRcookies = document.cookie.split(";"); 921 for (i = 0; i < ARRcookies.length; i++) { 922 x = ARRcookies[i].substr(0, ARRcookies[i].indexOf("=")); 923 y = ARRcookies[i].substr(ARRcookies[i].indexOf("=") + 1); 924 x = x.replace(/^\s+|\s+$/g, ""); 925 if (x === c_name) { 926 return unescape(y); 927 } 928 } 929} 930 931function deleteCookie(c_name) { 932 933 //domini check 934 var domain = window.location.hostname; 935 936 if(domain.includes('canalfarmaciaonline')){ //subdomini 937 //mirem si tenim cookies a alguns dels dominis(cfo/go i borrem) 938 document.cookie = c_name + '=; Path=/; Domain=.farmaoffice.test; Expires=Thu, 01 Jan 1970 00:00:01 GMT;'; 939 document.cookie = c_name + '=; Path=/; Domain=.canalfarmaciaonline.com; Expires=Thu, 01 Jan 1970 00:00:01 GMT;'; 940 document.cookie = c_name + '=; Path=/; Domain=.farmaofficego.com; Expires=Thu, 01 Jan 1970 00:00:01 GMT;'; 941 942 }else{ //domini propi 943 document.cookie = c_name + '=; Path=/; Domain=.'+domain+'; Expires=Thu, 01 Jan 1970 00:00:01 GMT;'; 944 } 945 946} 947 948function clearCookies() { 949 950 var cookies = document.cookie.split(";"); 951 952 for(var i=0; i < cookies.length; i++) { 953 var equals = cookies[i].indexOf("="); 954 var name = equals > -1 ? cookies[i].substr(0, equals) : cookies[i]; 955 956 if (name !== "laravel_session" && name !== "cookie-consent") { //until not accepted cookie consent, delete all cookies except this 957 deleteCookie(name); 958 } 959 960 } 961} 962 963function htmlEntities(str) { 964 return String(str).replace('ñ', 'ñ') 965 .replace('Ñ', 'Ã') 966 .replace('&', '&') 967 .replace('Ñ', 'Ã') 968 .replace('ñ', 'ñ') 969 .replace('Ñ', 'Ã') 970 .replace('À', 'Ã') 971 .replace('Á', 'Ã') 972 .replace('Â','Ã') 973 .replace('Ã','Ã') 974 .replace('Ä','Ã') 975 .replace('Å','à ') 976 .replace('Æ','Ã') 977 .replace('Ç','Ã') 978 .replace('È','Ã') 979 .replace('É','Ã') 980 .replace('Ê', 'Ã') 981 .replace('Ë','Ã') 982 .replace( 'Ì', 'Ã') 983 .replace('Í', 'Ã' ) 984 .replace('Î', 'Ã' ) 985 .replace( 'Ï', 'Ã') 986 .replace( 'Ð', 'Ã') 987 .replace( 'Ñ', 'Ã') 988 .replace( 'Ò', 'Ã') 989 .replace( 'Ó', 'Ã') 990 .replace('Ô', 'Ã' ) 991 .replace( 'Õ', 'Ã') 992 .replace('Ö', 'Ã' ) 993 .replace('Ø', 'Ã' ) 994 .replace( 'Ù' ,'Ã') 995 .replace( 'Ú', 'Ã') 996 .replace( 'Û', 'Ã') 997 .replace( 'Ü', 'Ã') 998 .replace( 'Ý', 'Ã') 999 .replace('Þ', 'Ã' ) 1000 .replace( 'ß', 'Ã') 1001 .replace( 'à', 'à ') 1002 .replace( 'á', 'á') 1003 .replace( 'â', 'â') 1004 .replace( 'ã', 'ã') 1005 .replace('ä', 'ä' ) 1006 .replace( 'å', 'Ã¥') 1007 .replace( 'æ', 'æ') 1008 .replace( 'ç', 'ç') 1009 .replace('è', 'è' ) 1010 .replace('é', 'é' ) 1011 .replace('ê', 'ê' ) 1012 .replace('ë', 'ë' ) 1013 .replace( 'ì', 'ì') 1014 .replace('í', 'Ã' ) 1015 .replace('î', 'î' ) 1016 .replace('ï', 'ï' ) 1017 .replace('ð', 'ð' ) 1018 .replace( 'ñ', 'ñ') 1019 .replace('ò','ò') 1020 .replace('ó','ó') 1021 .replace('ô','ô') 1022 .replace('õ','õ') 1023 .replace('ö','ö') 1024 .replace('ø','ø') 1025 .replace('ù','ù') 1026 .replace('ú','ú') 1027 .replace('û','û') 1028 .replace('ü' , 'ü') 1029 .replace('ý', 'ý') 1030 .replace('þ', 'þ') 1031 .replace('ÿ', 'ÿ'); 1032} 1033 1034//When html finished loading 1035$(document).ready(function () { 1036 var headerFixed = $("header.header.fixed"); 1037 var headerTopHeight = $(".web-header").height(); 1038 var headerHeight = $("header.header.fixed").outerHeight(); 1039 var variableHeight = 70; 1040 1041 if (headerFixed.length) { 1042 //On window scroll 1043 $(window).on("scroll", function () { 1044 var headerScrollPosition = headerTopHeight - $(window).scrollTop(); 1045 stickyLogo(headerScrollPosition); 1046 }); 1047 } 1048 1049 $(window).trigger("scroll"); 1050 1051 //Main slider 1052 //----------------------------------------------- 1053 1054 //Revolution Slider 1055 if ($(".slider-banner-container").length > 0) { 1056 $(".slider-banner-container .slider-banner-new-fede").show().revolution({ 1057 delay: 10000, 1058 startwidth: 1500, 1059 startheight: 500, 1060 lazyLoad: "on", 1061 /* Lazy Load options are "all", "smart", "single" and "none" */ 1062 lazyType: "single", 1063 1064 navigationArrows: "solo", 1065 1066 navigationStyle: "round", 1067 navigationHAlign: "center", 1068 navigationVAlign: "bottom", 1069 navigationHOffset: 0, 1070 navigationVOffset: 20, 1071 1072 soloArrowLeftHalign: "left", 1073 soloArrowLeftValign: "center", 1074 soloArrowLeftHOffset: 20, 1075 soloArrowLeftVOffset: 0, 1076 1077 soloArrowRightHalign: "right", 1078 soloArrowRightValign: "center", 1079 soloArrowRightHOffset: 20, 1080 soloArrowRightVOffset: 0, 1081 1082 fullWidth: "on", 1083 1084 spinner: "spinner0", 1085 1086 stopLoop: "off", 1087 stopAfterLoops: -1, 1088 stopAtSlide: -1, 1089 onHoverStop: "off", 1090 1091 shuffle: "off", 1092 1093 autoHeight: "off", 1094 forceFullWidth: "off", 1095 1096 hideThumbsOnMobile: "off", 1097 hideNavDelayOnMobile: 1500, 1098 hideBulletsOnMobile: "off", 1099 hideArrowsOnMobile: "off", 1100 hideThumbsUnderResolution: 0, 1101 1102 hideSliderAtLimit: 0, 1103 hideCaptionAtLimit: 0, 1104 hideAllCaptionAtLilmit: 0, 1105 startWithSlide: 0, 1106 }); 1107 } 1108 1109 // Ecommerce menu functionalities 1110 function hideEcommerceMenu(idOpenMenu, menu, overlay) { 1111 menu.fadeOut(150); 1112 overlay.fadeOut(150); 1113 idOpenMenu.find("i").removeClass("fa-caret-up").addClass("fa-caret-down"); 1114 } 1115 1116 function showEcommerceMenu(idOpenMenu, menu, overlay) { 1117 menu.fadeIn(150); 1118 overlay.fadeIn(150); 1119 // todo change 1120 idOpenMenu.find("i").removeClass("fa-caret-down").addClass("fa-caret-up"); 1121 } 1122 1123 $(document).on("click", "#ecommerce-menu", function (e) { 1124 e.preventDefault(); 1125
1126 var idOpenMenu = $("#ecommerce-menu"); 1127 var menu = $(".ecommerce-products-menu"); 1128 var overlay = $(".ecommerce-products-menu-overlay"); 1129 var is_visible = menu.is(":visible"); 1130 1131 var idOtherMenu = $("#pharmacy-menu"); 1132 var otherMenu = $(".pharmacy-menu"); 1133 var overlayOtherMenu = $(".pharmacy-menu-overlay"); 1134 var other_is_visible = otherMenu.is(":visible"); 1135 if (other_is_visible) { 1136 hideEcommerceMenu(idOtherMenu, otherMenu, overlayOtherMenu); 1137 } 1138 1139 if (is_visible) { 1140 hideEcommerceMenu(idOpenMenu, menu, overlay); 1141 } else { 1142 showEcommerceMenu(idOpenMenu, menu, overlay); 1143 } 1144 1145 return false; 1146 }); 1147 1148 $(document).on("click", "#pharmacy-menu", function (e) { 1149 e.preventDefault(); 1150 1151 var idOpenMenu = $("#pharmacy-menu"); 1152 var menu = $(".pharmacy-menu"); 1153 var overlay = $(".pharmacy-menu-overlay"); 1154 var is_visible = menu.is(":visible"); 1155 1156 var idOtherMenu = $("#ecommerce-menu"); 1157 var otherMenu = $(".ecommerce-products-menu"); 1158 var overlayOtherMenu = $(".ecommerce-products-menu-overlay"); 1159 var other_is_visible = otherMenu.is(":visible"); 1160 if (other_is_visible) { 1161 hideEcommerceMenu(idOtherMenu, otherMenu, overlayOtherMenu); 1162 } 1163 1164 if (is_visible) { 1165 hideEcommerceMenu(idOpenMenu, menu, overlay); 1166 } else { 1167 showEcommerceMenu(idOpenMenu, menu, overlay); 1168 } 1169 1170 return false; 1171 }); 1172 1173 var ec_menu_hover = false; 1174 1175 $(document).on("mouseover", ".main-categories li", function () { 1176 var category_id = $(this).data("category-id"); 1177 1178 //delete all with children open 1179 $(".main-categories li").each(function () { 1180 if ($(this).hasClass("with-children-open")) { 1181 $(this).removeClass("with-children-open").addClass("with-children"); 1182 } 1183 }); 1184 1185 // change class for selected menu option icon 1186 var hasChildren = $(this).hasClass("with-children"); 1187 1188 if (hasChildren) { 1189 $(this).removeClass("with-children").addClass("with-children-open"); 1190 } 1191 1192 if ( 1193 $(".secondary-categories ul[data-category-id='" + category_id + "']") 1194 .length != 0 1195 ) { 1196 $(".secondary-categories p").hide(); 1197 1198 $(".secondary-categories ul").each(function () { 1199 if ($(this).data("category-id") == category_id) { 1200 if ($(".secondary-categories").is(":hidden")) { 1201 $( 1202 ".secondary-categories p[data-parent-category-id='" + 1203 category_id + 1204 "']" 1205 ).show(); 1206 $(".secondary-categories").fadeIn(150); 1207 } 1208 1209 if ($(this).is(":hidden")) { 1210 $(this).fadeIn(150); 1211 } 1212 } else { 1213 $(this).hide(); 1214 } 1215 }); 1216 } else { 1217 $(".secondary-categories").fadeOut(150); 1218 $(".secondary-categories p").hide(); 1219 $(".secondary-categories ul").hide(); 1220 } 1221 }); 1222 1223 $(document).on("mouseover", ".ecommerce-products-menu", function () { 1224 ec_menu_hover = true; 1225 }); 1226 1227 $(document).on("mouseout", ".ecommerce-products-menu", function () { 1228 ec_menu_hover = false; 1229 }); 1230 1231 $("body").mouseup(function () { 1232 if (!ec_menu_hover) { 1233 var menu = $(".ecommerce-products-menu"); 1234 var overlay = $(".ecommerce-products-menu-overlay"); 1235 var idOpenMenu = $("#ecommerce-menu"); 1236 1237 hideEcommerceMenu(idOpenMenu, menu, overlay); 1238 } 1239 }); 1240 1241 var pharmacy_menu_hover = false; 1242 1243 $(document).on("mouseover", ".pharmacy-menu", function () { 1244 pharmacy_menu_hover = true; 1245 }); 1246 1247 $(document).on("mouseout", ".pharmacy-menu", function () { 1248 pharmacy_menu_hover = false; 1249 }); 1250 1251 $("body").mouseup(function () { 1252 if (!pharmacy_menu_hover) { 1253 var menu = $(".pharmacy-menu"); 1254 var overlay = $(".pharmacy-menu-overlay"); 1255 var idOpenMenu = $("#pharmacy-menu"); 1256 1257 hideEcommerceMenu(idOpenMenu, menu, overlay); 1258 } 1259 }); 1260 1261 // Fixed header 1262 //----------------------------------------------- 1263 $(window).scroll(function () { 1264 if ($(".header.fixed").length > 0) { 1265 if (!$(".header.hidden-lg").is(":visible")) { 1266 if ( 1267 $(this).scrollTop() > 1268 headerTopHeight + headerHeight - variableHeight && 1269 $(window).width() > 767 1270 ) { 1271 $("body").addClass("fixed-header-on"); 1272 $(".header.fixed").addClass("animated object-visible fadeInDown"); 1273 if (!($(".header.transparent").length > 0)) { 1274 if ($(".banner:not(.header-top)").length > 0) { 1275 $(".banner").css("marginTop", headerHeight + "px"); 1276 } else if ($(".page-intro").length > 0) { 1277 $(".page-intro").css("marginTop", headerHeight + "px"); 1278 } else if ($(".page-top").length > 0) { 1279 $(".page-top").css("marginTop", headerHeight + "px"); 1280 } else { 1281 //$("section.main-container").css("marginTop", (headerHeight) + "px"); 1282 } 1283 } 1284 $(".box-brands-anchor").addClass("scrolled"); 1285 //$('.box-brands-anchor').css("margin-top", "-150px"); 1286 } else { 1287 $("body").removeClass("fixed-header-on"); 1288 //$("section.main-container").css("marginTop", (0) + "px"); 1289 $(".banner").css("marginTop", 0 + "px"); 1290 $(".page-intro").css("marginTop", 0 + "px"); 1291 $(".page-top").css("marginTop", 0 + "px"); 1292 $(".header.fixed").removeClass("animated object-visible fadeInDown"); 1293 $(".box-brands-anchor").removeClass("scrolled"); 1294 //$('.box-brands-anchor').css("margin-top", "-280px"); 1295 } 1296 } else { 1297 if ($("#scroll-hide").is(":visible")) { 1298 $(".box-brands-anchor").removeClass("scrolled"); 1299 } else { 1300 $(".box-brands-anchor").addClass("scrolled"); 1301 } 1302 } 1303 } 1304 }); 1305 1306 //Scroll stickyCartButton 1307 //----------------------------------------------- 1308 $(window).scroll(function () { 1309 if ($(this).scrollTop() > 130) { 1310 if ($("#sticky-Cart-Count").html() != 0) { 1311 $(".stickyCartButton").fadeOut(); 1312 $(".hideStickyCartButton").show(); 1313 } 1314 } else { 1315 $(".stickyCartButton").fadeOut(); 1316 $(".hideStickyCartButton").show(); 1317 } 1318 }); 1319 1320 //Scroll to top click function 1321 //----------------------------------------------- 1322 $(".scrollToTop").click(function () { 1323 $("#open-search-mobile").hide(); 1324 $("#scroll-hide").show(); 1325 }); 1326}); 1327 1328function stickyLogo(headerScrollPosition) { 1329 if (headerScrollPosition > 0) { 1330 $(".logo-menu-desktop .logo-info .logo-pharmacy-mobile").css( 1331 "display", 1332 "none" 1333 ); 1334 $(window).resize(function () { 1335 if ($(window).width() >= 1200) { 1336 $(".go-navbar-nav").css("justify-content", "flex-end"); 1337 } 1338 }); 1339 //$('.logo-menu-desktop .logo-info .logo-pharmacy').css("display", "inline"); 1340 $(".header-left span").removeClass("sticky-span-logo"); 1341 $(".header-left div.header-title").removeClass("sticky-span-logo"); 1342 $(".sticky-navbar-logo").removeClass("visible-sticky"); 1343 /*$('.logo-menu-desktop').removeClass('sticky-new-logo') 1344 $('.logo-left-zone').css("display", "inline-block");*/ 1345 //$('header').removeClass("header-thin"); 1346 } else { 1347 //$('header').addClass("header-thin"); 1348 1349 $(window).resize(function () { 1350 if ($(window).width() >= 1200) { 1351 $(".go-navbar-nav").css("justify-content", "flex-start"); 1352 } 1353 }); 1354 1355 if ($(".logo-menu-desktop").length > 0) { 1356 $(".header-left span").addClass("sticky-span-logo"); 1357 $(".header-left div.header-title").addClass("sticky-span-logo"); 1358 $(".logo-menu-desktop").addClass("sticky-new-logo"); 1359 /*$('.logo-menu-desktop .logo-info .logo-pharmacy').css("display", "none"); 1360 $('.logo-menu-desktop .logo-info .logo-pharmacy-mobile').css("display", "flex"); 1361 $('.logo-left-zone').css("display", "inline-block");*/ 1362 } else { 1363 /*$('.logo-left-zone').css("display", "none"); 1364 $('.sticky-navbar-logo').addClass('visible-sticky');*/ 1365 } 1366 } 1367} 1368 1369//# sourceMappingURL=main.js.map
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.