Découvrez Kaizen 11

'; openMedia(event, $title, $html); return false; }); $('[data-sound]').click(function (event){ var $a = $(this); var cb = function (){ $('a.the_modal-close:visible').trigger('click');$a.trigger('click'); }; if($(this).data('for-subscriber') == true && !allowSubscriber(cb)) return false; var $code = $(this).data('sound'); var $title = $(this).data('title'); var $html = ''; openMedia(event, $title, $html); return false; }); $('a.add_to_board, a.add_to_board_header').click(function (){ var $a = $(this); if(!isConnected){ callbackAfterLogin = function (){ $a.trigger('click'); $('a.the_modal-close:visible').trigger('click'); }; $('.connexion').trigger('click'); return false; } query_post_id_add_2_board = $a.data('post-id'); var modal = '#the_modal_add_to_board'; $.post(document.location.href, {ajax: true, method: 'get_modal_add_2_board', post_id: query_post_id_add_2_board}, function (html){ $(modal).find('.the_modal-content').html(html); $(modal).addClass("is-visible"); $("body").addClass("modal-is-visible"); query_post_id_add_2_board = false; }); return false; }); $('a.like_action, a.like_action_header').click(function (){ var $a = $(this); if($a.hasClass('liked')) return false; if(!isConnected){ callbackAfterLogin = function (){ $a.trigger('click'); $('a.the_modal-close:visible').trigger('click'); }; $('.connexion').trigger('click'); return false; } var $reportCallback = $(this).hasClass('report-callback'); var post_id = $(this).data('post-id'); $.post(document.location.href, {ajax: true, post_id: post_id, method: 'like'}, function (res){ if(!isNaN(parseInt(res))){ if($reportCallback){ $a = $($a.attr('href')); } $a.find('span').text(res); } $a.addClass('liked'); }); return false; }); } var messagePopin = function(message, callback){ $('#the_modal_message_popin h2').html(message); $('#the_modal_message_popin .btn').unbind('click').click(function (){ $('a.the_modal-close:visible').trigger('click'); callback(); }); $('#the_modal_message_popin').addClass("is-visible"); $("body").addClass("modal-is-visible"); } var htmlPopin = function(title, html){ $('#the_modal_html_popin h2').html(title); $('#the_modal_html_popin #htmlContent').html(html); $('#the_modal_html_popin').addClass("is-visible"); $("body").addClass("modal-is-visible"); } $(document).ready(function() { applyOnContentLoading(); if(document.location.hash != ''){ var $element = $(document.location.hash); if($element.length){ var top = $element.offset().top - $('#the_sticky_header').outerHeight() - 10; $("html, body").animate({ scrollTop: top }, 600); } } var options; options = { tokenSeparators: [',', ' '], // permet de valider l'édition d'un tag au clique sur , ou espace ou entrée width: '100%', language: "fr" }; $('.select2').select2(options); $('.carousel').carousel({interval: 5000}); $.ajaxSetup({ crossDomain: true, xhrFields: { withCredentials: true } }); $('.log_out').click(function (){ var logout_url = $(this).attr('href'); $.post('https://kaizen-magazine.com/?setLoggedInCredentials', {id_cart: null, id_customer: null}, function(){ $.post(logout_url, {ajax: true, logout: true}, function (){ document.location.href = 'https://kaizen-magazine.com'; }); }); return false; }); $('#the_modal_connect form').submit(function(){ var $form = $(this); var $data = {'email': $(this).find('#login_email').val(), 'passwd': $(this).find('#login_password').val(), 'SubmitLogin': true, 'ajax': true}; $.post($(this).attr('action'), $data, function(res){ res = $.parseJSON(res); if(res.hasError){ $form.find('.form-group').addClass('has-error'); $form.find('.error').html(res.errors.join('
')); } else{ $form.find('.form-group').removeClass('has-error'); $.post('https://kaizen-magazine.com/?setLoggedInCredentials', {id_cart: res.id_cart, id_customer: res.id_customer}, function(){ isConnected = true; isSubscriber = res.isSubscriber; $('.showDisplayName').text(res.displayName); $('.showLoggedMenu').removeClass('hidden'); $('.hideLoggedMenu').addClass('hidden'); drawCart(false); callbackAfterLogin($form, res); }); } }); return false; }); $('#the_modal_newsletter').ajaxForm({ beforeSubmit: function (){ if ($('#the_modal_newsletter .recaptcha').val() == "") { grecaptcha.execute('6Leq3r0UAAAAANK9gDsLOR0_phxQNS4pOy_JDFPe', { action: 'newsletter' }).then(function (token) { $('.recaptcha').val(token); $('#the_modal_newsletter form').submit(); }); return false; } var $email = $('#the_modal_newsletter').find('#newsletter_email'); if(!validateEmail($email.val())){ $email.closest('div').addClass('has-error'); return false; } else{ $email.closest('div').removeClass('has-error'); } return true; }, complete: function (responseText, statusText, xhr, form){ $('#the_modal_newsletter h2').text("Votre inscription a bien été prise en compte."); var $close = $('#the_modal_newsletter .close_link').clone(); $close.removeClass('hidden'); $div = $('
').addClass('grid'); $close = $close.appendTo($div); $close.addClass('grid'); $('#the_modal_newsletter .content_modal form').html($div); $('.recaptcha').val(''); } }); $('.footer_newsletter').ajaxForm({ beforeSubmit: function (){ if ($('.footer_newsletter .recaptcha').val() == "") { grecaptcha.execute('6Leq3r0UAAAAANK9gDsLOR0_phxQNS4pOy_JDFPe', { action: 'newsletter' }).then(function (token) { $('.recaptcha').val(token); $('.footer_newsletter form').submit(); }); return false; } var $email = $('.footer_newsletter').find('#newsletter_email'); if(!validateEmail($email.val())){ $email.closest('div').addClass('has-error'); return false; } else{ $email.closest('div').removeClass('has-error'); } return true; }, complete: function (responseText, statusText, xhr, form){ var $email = $('.footer_newsletter').find('#newsletter_email'); $email.closest('div').addClass('has-success'); //$('.footer_newsletter h2').text("Votre inscription a bien été prise en compte."); /*var $close = $('#the_modal_newsletter .close_link').clone(); $close.removeClass('hidden'); $div = $('
').addClass('grid'); $close = $close.appendTo($div); $close.addClass('grid'); $('#the_modal_newsletter .content_modal form').html($div);*/ $('.recaptcha').val(''); } }); $('#the_modal_connect_newsletter_subscribe').ajaxForm({ beforeSubmit: function (){ if ($('#the_modal_connect_newsletter_subscribe .recaptcha').val() == "") { grecaptcha.execute('6Leq3r0UAAAAANK9gDsLOR0_phxQNS4pOy_JDFPe', { action: 'newsletter' }).then(function (token) { $('.recaptcha').val(token); $('#the_modal_connect_newsletter_subscribe form').submit(); }); return false; } var $email = $('#the_modal_connect_newsletter_subscribe').find('#newsletter_email2'); if(!validateEmail($email.val())){ $email.closest('div').addClass('has-error'); return false; } else{ $email.closest('div').removeClass('has-error'); } if(!$('#gridCheckNewsletter2').is(':checked')){ $('#gridCheckNewsletter2').closest('div').addClass('has-error'); return false; } return true; }, complete: function (responseText, statusText, xhr, form){ $('#the_modal_connect_newsletter_subscribe h2').text("Votre inscription a bien été prise en compte."); $.get("https://boutique.kaizen-magazine.com/?set_popup_newsletter_done"); $('#the_modal_connect_newsletter_subscribe .content_modal').remove(); $('.recaptcha').val(''); } }); $('form.add2cart').each(function (){ var $form = $(this); $form.ajaxForm({ beforeSubmit: add2cartBeforeSubmit, complete: function (res){ res = $.parseJSON(res.responseText); displayAdd2CartModal(res, $form.find('.id_product').val()); if(!res.hasError) drawCart(res); } }); }); }); $(window).on('scroll', function() { var scrollTop = $(window).scrollTop(); var docHeight = $(document).height(); var winHeight = $(window).height(); var scrollPercent = (scrollTop) / (docHeight - winHeight); var scrollPercentRounded = Math.round(scrollPercent*100); $('.time-bar .bar .progress-bar').width(scrollPercentRounded +'%'); });