/*! * jQuery.ellipsis * https://github.com/jjenzz/jquery.ellipsis * -------------------------------------------------------------------------- * Copyright (c) 2013 J. Smith (@jjenzz) * Dual licensed under the MIT and GPL licenses: * https://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * * adds a class to the last 'allowed' line of text so you can apply * text-overflow: ellipsis; */ (function(a){if(typeof define==="function"&&define.amd){define(["jquery"],a)}else{a(jQuery)}}(function(d){var c="ellipsis",b='',e={lines:"auto",ellipClass:"ellip",responsive:false};function a(h,q){var m=this,w=0,g=[],k,p,i,f,j,n,s;m.$cont=d(h);m.opts=d.extend({},e,q);function o(){m.text=m.$cont.text();m.opts.ellipLineClass=m.opts.ellipClass+"-line";m.$el=d('');m.$el.text(m.text);m.$cont.empty().append(m.$el);t()}function t(){if(typeof m.opts.lines==="number"&&m.opts.lines<2){m.$el.addClass(m.opts.ellipLineClass);return}n=m.$cont.height();if(m.opts.lines==="auto"&&m.$el.prop("scrollHeight")<=n){return}if(!k){return}s=d.trim(m.text).split(/\s+/);m.$el.html(b+s.join(" "+b)+"");m.$el.find("span").each(k);if(p!=null){u(p)}}function u(x){s[x]=''+s[x];s.push("");m.$el.html(s.join(" "))}if(m.opts.lines==="auto"){var r=function(y,A){var x=d(A),z=x.position().top;j=j||x.height();if(z===f){g[w].push(x)}else{f=z;w+=1;g[w]=[x]}if(z+j>n){p=y-g[w-1].length;return false}};k=r}if(typeof m.opts.lines==="number"&&m.opts.lines>1){var l=function(y,A){var x=d(A),z=x.position().top;if(z!==f){f=z;w+=1}if(w===m.opts.lines){p=y;return false}};k=l}if(m.opts.responsive){var v=function(){g=[];w=0;f=null;p=null;m.$el.html(m.text);clearTimeout(i);i=setTimeout(t,100)};d(window).on("resize."+c,v)}o()}d.fn[c]=function(f){return this.each(function(){try{d(this).data(c,(new a(this,f)))}catch(g){if(window.console){console.error(c+": "+g)}}})}})); var events = (function ($, window, jQuery) { var _vars_ = {}; var guest_max; var guest_number = 0; var reserved_seats; return { "set_vars": function (options) { $.extend(_vars_, options || {}); }, "get_vars" : function(){ return _vars_; }, "filter" : function(page, filter='') { if($(window).width() > 568){ var month = $('.filter-box.desktop #filter-month').val(); var type = $('.filter-box.desktop #filter-type').val(); var city = $('.filter-box.desktop #filter-city').val(); } else { var month = $('.filter-box.mobile #filter-month').val(); var type = $('.filter-box.mobile #filter-type').val(); var city = $('.filter-box.mobile #filter-city').val(); } $.ajax({ url : app.get_vars().baseurl+"events/homepage/filter_events" + filter, // filter should be like '?event_category=1' type : "GET", cache: false, data : { month : month, type : type, city : city, page : page }, beforeSend : function () { // $("#events_list").append('
'+app.get_vars()._app.notif.loading+'
'); }, success : function(result) { if(app.isalive(result)) { // if ($(window).width() >= 992) { // if (result.mdata.result_count <= 3) $('#events-list').height(620); // else $('#events-list').height(1240); // } $("#events-list").empty(); $('#paginate').empty(); events._format._event(page, result); } } }); }, "_format" : { "_event" : function(page, result){ //start listing events var page = parseInt(page); var count = 1; var events_list = $("#events-list"); var page_link = $("#paginate"); events_list.empty(); page_link.empty(); if(typeof result.mdata != "undefined") { if ($.isEmptyObject(result.mdata.details)) { // events_list.height(200); if (result.mdata.logged_in) { events_list.append( "`+ fav +` ${item.title}
${item.description}
//'+app.get_vars()._app.notif.loading+'
'); }, success : function(result1) { if(app.isalive(result1)) { try { if (result1.res_period) { $('.remaining_res_based_on_mod').html(`${result1.remaining_res} ${result1.res_period}`); /*Set dynamic data*/ $('span.max_res').html(result1.max_res); $('span.res_period').html(result1.res_period); $('span.mod_nr_count').html(result1.mod_nr_count); $('span.res_period2').html(result1.res_period2); $('span.when_can_reserve').html(result1.when_can_reserve); if (result1.remaining_res == 0) { $('.nr_exceeded_msg').removeAttr('hidden'); } } } catch (e) {} finally {} } } }); $('#moderation-notif-user').modal('show'); } }; // Pass in jQuery. })(jQuery, this); $(function() { $(window).on("orientationchange",function(){ if(window.orientation==0){ var m = $('.filter-box.desktop #filter-month').val(); var month = $('.filter-box.mobile #filter-month').val(m); var t = $('.filter-box.desktop #filter-type').val(); var type = $('.filter-box.mobile #filter-type').val(t); var c = $('.filter-box.desktop #filter-city').val(); var city = $('.filter-box.mobile #filter-city').val(c); }else{ var m = $('.filter-box.mobile #filter-month').val(); var month = $('.filter-box.desktop #filter-month').val(m); var t = $('.filter-box.mobile #filter-type').val(); var type = $('.filter-box.desktop #filter-type').val(t); var c = $('.filter-box.mobile #filter-city').val(); var city = $('.filter-box.desktop #filter-city').val(c); } }); // Check Link Cookie events.clear_cookie(); // events.show_session(); $('.hr-style').removeProp('border'); $("#collapse").on("hide.bs.collapse", function(){ $(".btn-filter-mobile").html(''); }); $("#collapse").on("show.bs.collapse", function(){ $(".btn-filter-mobile").html(''); }); $(window).on('hashchange', function(e) { e.preventDefault(); var page = (location.hash).trim().replace("#", ""); page = (parseInt(page))?page:1; if(page) { events.filter(page); } return false; }).trigger('hashchange'); // Scroll to top $(document).on('click', '.page-link', function(){ $(".filter-view:visible")[0].scrollIntoView(true); }).on('change', '.filter-select', function(){ $(".filter-view:visible")[0].scrollIntoView(true); }); $(document).on('click', '#filter-box-mobile-toggle', function() { $('#filter-box-mobile-toggle .plus').toggle(); $('#filter-box-mobile-toggle .minus').toggle(); }); // send events on filter change $(document).on('change','#filter-month',function(){ dataLayer.push({'fo_filter': undefined}); dataLayer.push({'fo_filter': this.value}); }); $(document).on('change','#filter-type',function(){ dataLayer.push({'fo_filter': undefined}); dataLayer.push({'fo_filter': this.value}); }); $(document).on('change','#filter-city',function(){ dataLayer.push({'fo_filter': undefined}); dataLayer.push({'fo_filter': this.value}); }); if(notifyUserABoutModerationFeature == 'true') { events.moderation_notif(); $('#agree-terms').on('click', function(event) { /* Act on the event */ if (this.checked) { $('.moderation-notif-modal-btn').removeClass('disabled'); } else { $('.moderation-notif-modal-btn').addClass('disabled'); } }); $('.moderation-notif-modal-btn').on('click', function(event) { event.preventDefault(); /* Act on the event */ if ($('#agree-terms').prop('checked')) { $.ajax({ url : app.get_vars().baseurl+"events/homepage/notif_moderation_feature", data : { notif : true }, type: "POST" }); $('#moderation-notif-user').modal('hide'); } }); } /* Filter options*/ $('.filter-events-options').on('change', function(event) { event.preventDefault(); /* Act on the event */ events._change_hash(); }); if($('#workshop-ecriture').data('workshop-ecriture')===0){ $('#workshop-ecriture').attr('disabled', true) } if($('#workshop-oenologie').data('workshop-oenologie')===0){ $('#workshop-oenologie').attr('disabled', true) } /*let oenologie = false; let ecriture = false; $('#workshop-ecriture').on('click', function () { oenologie = false if(!ecriture) { const filter = '?type=1' events.filter(1, filter) ecriture = true } else { events.filter(1, '') ecriture = false } }) $('#workshop-oenologie').on('click', function () { ecriture = false if(!oenologie) { const filter = '?type=2' events.filter(1, filter) oenologie = true } else { events.filter(1, '') oenologie = false } }) */ /* Implement dynamic atelier type filter */ $('.workshop-type-btn').click(function() { if ($(this).is(':checked')) { $("#filter .workshop-type-btn").removeClass("active"); //events.filter(1, ''); $(this).removeClass("active"); } else { $("#filter .workshop-type-btn.active").removeClass("active"); $(this).addClass("active"); const filter = `?type=${$(this).attr("data-workshop-type")}`; //events.filter(1, filter) } let btnChk = []; $('.workshop-type-btn').each(function (){ if ($(this).is(':checked')) { btnChk.push($(this).attr("data-workshop-type")); // events.filter(1, ''); } }) let workshop_s = '&workshop_session='; let t_w = []; if($('.presentiel input[type="checkbox"]').is(':checked')) t_w.push("PRESENTIEL"); if($('.distance input[type="checkbox"]').is(':checked')) t_w.push("DISTANCE"); if($('.enligne input[type="checkbox"]').is(':checked')) t_w.push("ENLIGNE"); workshop_s += t_w.join(","); const filter = `?type=${btnChk.join(",")}`; event_update(); }) $( ".presentiel" ).click(function() { $('.presentiel').toggleClass('active'); let btnChk = []; $('.workshop-type-btn').each(function (){ if ($(this).is(':checked')) { btnChk.push($(this).attr("data-workshop-type")); // events.filter(1, ''); } }) if ($('.presentiel input[type="checkbox"]').is(':checked')) { $('.presentiel').addClass('w-type1'); let distance = ''; let enligne = ''; if($(".distance").hasClass('active'))distance = ',DISTANCE'; if($(".enligne").hasClass('active'))enligne = ',ENLIGNE'; event_update(); $('.presentiel input[type="checkbox"]').attr('checked', true); } else { $('.presentiel').removeClass('w-type1'); event_update(); $('.presentiel input[type="checkbox"]').attr('checked', false); } }); $( ".distance" ).click(function() { let btnChk = []; $('.workshop-type-btn').each(function (){ if ($(this).is(':checked')) { btnChk.push($(this).attr("data-workshop-type")); // events.filter(1, ''); } }) $('.distance').toggleClass('active'); if ($('.distance input[type="checkbox"]').is(':checked')) { $('.distance').addClass('w-type1'); let presentiel = ''; let enligne = ''; if($(".presentiel").hasClass('active'))presentiel = ',PRESENTIEL'; if($(".enligne").hasClass('active'))enligne = ',ENLIGNE'; event_update(); $('.distance input[type="checkbox"]').attr('checked', true); } else { $('.distance').removeClass('w-type1'); event_update(); $('.distance input[type="checkbox"]').attr('checked', false); } }); $( ".enligne" ).click(function() { let btnChk = []; $('.workshop-type-btn').each(function (){ if ($(this).is(':checked')) { btnChk.push($(this).attr("data-workshop-type")); // events.filter(1, ''); } }) $('.enligne').toggleClass('active'); if ($('.enligne input[type="checkbox"]').is(':checked')) { $('.enligne').addClass('w-type1'); let presentiel = ''; let distance = ''; if($(".presentiel").hasClass('active'))presentiel = ',PRESENTIEL'; if($(".distance").hasClass('active'))distance = ',DISTANCE'; event_update(); $('.enligne input[type="checkbox"]').attr('checked', true); } else { $('.enligne').removeClass('w-type1'); event_update(); $('.enligne input[type="checkbox"]').attr('checked', false); } }); function event_update(){ let btnChk = []; $('.workshop-type-btn').each(function (){ if ($(this).is(':checked')) { btnChk.push($(this).attr("data-workshop-type")); // events.filter(1, ''); } }) let workshop_s = '&workshop_session='; let t_w = []; if($('.presentiel input[type="checkbox"]').is(':checked')) t_w.push("PRESENTIEL"); if($('.distance input[type="checkbox"]').is(':checked')) t_w.push("DISTANCE"); if($('.enligne input[type="checkbox"]').is(':checked')) t_w.push("ENLIGNE"); workshop_s += t_w.join(","); let filter = `?type=${btnChk.join(",")}`; if(btnChk.join(",") == ''){ filter = ''; if(t_w.join(",") != '') workshop_s = workshop_s.replace("&","?") } if(t_w.join(",") == '') workshop_s = ''; events.filter(1, filter + workshop_s); } event_update(); });