1/** 2 * Theme functions file 3 * 4 * Contains handlers for navigation, accessibility, header sizing 5 * footer widgets and Featured Content slider 6 * 7 */ 8( function( $ ) { 9 var body = $( 'body' ), 10 _window = $( window ); 11 12 13 $(".contact_stat").on("click",function(e){ 14 e.preventDefault(); 15 var id = $(this).attr("id"); 16 var url = $(this).attr("href"); 17 $.get( "/stats.php?id="+id, function( data ) {}).done(function() { 18 window.location.href = url; 19 }); 20 21 }); 22 23 $(".month-nav a").on("click",function(e){ 24 e.preventDefault(); 25 if(!$(this).hasClass("disabled")) { 26 if($(this).hasClass("next-month")) { 27 $(".calendar_month.active").removeClass("active").next(".calendar_month").addClass("active"); 28 } 29 if($(this).hasClass("prev-month")) { 30 $(".calendar_month.active").removeClass("active").prev(".calendar_month").addClass("active"); 31 } 32 33 $(".month-nav a").removeClass("disabled"); 34 35 var listItem = $(".calendar_month.active"); 36 37 if($(".calendar_month").index(listItem) == 0) { 38 $(".prev-month").addClass("disabled"); 39 } 40 41 if($(".calendar_month").index(listItem) == $(".calendar_month").length-1) { 42 $(".next-month").addClass("disabled"); 43 } 44 } 45 }); 46 47 $(".cal-event-box div").on("click",function(e){ 48 e.preventDefault(); 49 var scrollto = $(this).attr("attr-link"); 50 $(".active-h3").click().removeClass("active-h3").removeClass("marron").removeClass("bleu").removeClass("jaune").removeClass("vert"); 51 $(scrollto).click().addClass("active-h3").addClass($(this).attr("class")); 52 53 var top = $(scrollto).offset().top - $("#masthead").height(); 54 if($("#wpadminbar").length) { 55 top -= $("#wpadminbar").height(); 56 } 57 $('html, body').animate({ 58 scrollTop: top 59 }, 500); 60 61 }); 62 63 $(".day.cal-monday .cal-event-box, .day.cal-tuesday .cal-event-box, .day.cal-wednesday .cal-event-box, .day.cal-thursday .cal-event-box, .day.cal-friday .cal-event-box, .day.cal-saturday .cal-event-box").each(function(){ 64 var nb = $(this).children().length; 65 if(nb > 0) { 66 var minheight = nb * 25; 67 $(this).css("minHeight",minheight); 68 } 69 }); 70 71 $(".close-dialog").on("click",function(e){ 72 jQuery( "#dialog-form" ).dialog("close"); 73 }); 74 75 $(".next-step").on("click",function(e){ 76 e.preventDefault(); 77 $("#first-step").hide(); 78 $("#second-step").show(); 79 }); 80 81 82 jQuery( "#accordion" ).accordion({ 83 active: false, 84 collapsible: true, 85 heightStyle: "content", 86 header: "h3" 87 }); 88 jQuery( "#dialog-form" ).dialog({ 89 autoOpen: false, 90 modal: true, 91 draggable: false , 92 resizable: false , 93 dialogClass: "no-close", 94 minWidth: 750, 95 buttons : [{ 96 text : "Continuer", 97 disabled : true, 98 id : "formVal", 99 click : function () { 100 jQuery("#formVal").attr("disabled", true); 101 jQuery( this ).dialog( "close" ); 102 var idStage = jQuery( this ).data("idStage"); 103 104 jQuery(".reserv").replaceWith('<div class="info">Vous allez être redirigé dans quelques instants <div class="loaderCont" ><div class="loader"><svg xml:space="preserve" enable-background="new 0 0 20 20" viewBox="0 0 20 20" height="20px" width="20px" y="0px" x="0px" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" id="Calque_1" version="1.1"><circle r="1.5" cy="11.5" cx="3" fill="#FFFFFF"/><circle r="1.5" cy="16.5" cx="5" enable-background="new" fill="#FFFFFF" opacity="0.85"/><circle r="1.5" cy="18.5" cx="10" enable-background="new" fill="#FFFFFF" opacity="0.75"/><circle r="1.5" cy="16.5" cx="15" enable-background="new" fill="#FFFFFF" opacity="0.58"/><circle r="1.5" cy="11.5" cx="17" enable-background="new" fill="#FFFFFF" opacity="0.48"/><circle r="1.5" cy="6.5" cx="15" enable-background="new" fill="#FFFFFF" opacity="0.38"/><circle r="1.5" cy="4.5" cx="10" enable-background="new" fill="#FFFFFF" opacity="0.22"/></svg></div>'); 105 var cpt = 3; 106 var timer = setInterval(function(){if(cpt>0){--cpt;}else{clearInterval(timer); window.location.href = '/mon-compte/?idstage='+idStage+'&addReservation';}}, 1000); 107 } 108 }, { 109 text : "Annuler", 110 id : "formAnn", 111 click : function () { 112 jQuery( this ).dialog( "close" ); 113 } 114 } 115 ], 116 close: function( event, ui ) { 117 jQuery(".ui-dialog #formVal").attr("disabled", true); 118 jQuery(".ui-dialog #formVal").addClass("ui-state-disabled"); 119 jQuery(".ui-dialog .check-control").prop( "checked", false ); 120 }, 121 open: function( event, ui ) { 122 jQuery(".ui-dialog #formVal").attr("disabled", true); 123 jQuery(".ui-dialog #formVal").addClass("ui-state-disabled"); 124 jQuery(".ui-dialog .check-control").prop( "checked", false ); 125 } 126 }); 127 128 jQuery(".ui-dialog .check-control").change(function() { 129 var allChecked = true; 130 jQuery(".ui-dialog .check-control").each(function () { 131 if(!this.checked) { 132 allChecked = false;
133 } 134 }).promise().done( function() { 135 if(allChecked){ 136 jQuery(".ui-dialog #formVal").attr("disabled", false); 137 jQuery(".ui-dialog #formVal").removeClass("ui-state-disabled"); 138 }else{ 139 jQuery(".ui-dialog #formVal").attr("disabled", true); 140 jQuery(".ui-dialog #formVal").addClass("ui-state-disabled"); 141 } 142 }); 143 }); 144 var att = 0; 145 jQuery(".reserv").on("click", function () { 146 if(!att) { 147 var idStage = jQuery(this).attr("id"); 148 jQuery( "#dialog-form" ).data("idStage", idStage).dialog( "open" ); 149 att = 1; 150 } 151 }); 152 153 154 // Enable menu toggle for small screens. 155 ( function() { 156 var nav = $( '#primary-navigation' ), button, menu; 157 if ( ! nav ) { 158 return; 159 } 160 161 button = nav.find( '.menu-toggle' ); 162 if ( ! button ) { 163 return; 164 } 165 166 // Hide button if menu is missing or empty. 167 menu = nav.find( '.nav-menu' ); 168 if ( ! menu || ! menu.children().length ) { 169 button.hide(); 170 return; 171 } 172 173 $( '.menu-toggle' ).on( 'click.twentyfourteen', function() { 174 nav.toggleClass( 'toggled-on' ); 175 } ); 176 } )(); 177 178 /* 179 * Makes "skip to content" link work correctly in IE9 and Chrome for better 180 * accessibility. 181 * 182 * @link http://www.nczonline.net/blog/2013/01/15/fixing-skip-to-content-links/ 183 */ 184 _window.on( 'hashchange.twentyfourteen', function() { 185 var hash = location.hash.substring( 1 ), element; 186 187 if ( ! hash ) { 188 return; 189 } 190 191 element = document.getElementById( hash ); 192 193 if ( element ) { 194 if ( ! /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) { 195 element.tabIndex = -1; 196 } 197 198 element.focus(); 199 200 // Repositions the window on jump-to-anchor to account for header height. 201 window.scrollBy( 0, -80 ); 202 } 203 } ); 204 205 $( function() { 206 // Search toggle. 207 $( '.search-toggle' ).on( 'click.twentyfourteen', function( event ) { 208 var that = $( this ), 209 wrapper = $( '.search-box-wrapper' ); 210 211 that.toggleClass( 'active' ); 212 wrapper.toggleClass( 'hide' ); 213 214 if ( that.is( '.active' ) || $( '.search-toggle .screen-reader-text' )[0] === event.target ) { 215 wrapper.find( '.search-field' ).focus(); 216 } 217 } ); 218 219 /* 220 * Fixed header for large screen. 221 * If the header becomes more than 48px tall, unfix the header. 222 * 223 * The callback on the scroll event is only added if there is a header 224 * image and we are not on mobile. 225 */ 226 if ( _window.width() > 781 ) { 227 var mastheadHeight = $( '#masthead' ).height(), 228 toolbarOffset, mastheadOffset; 229 230 if ( mastheadHeight > 48 ) { 231 body.removeClass( 'masthead-fixed' ); 232 } 233 234 if ( body.is( '.header-image' ) ) { 235 toolbarOffset = body.is( '.admin-bar' ) ? $( '#wpadminbar' ).height() : 0; 236 mastheadOffset = $( '#masthead' ).offset().top - toolbarOffset; 237 238 _window.on( 'scroll.twentyfourteen', function() { 239 if ( _window.scrollTop() > mastheadOffset && mastheadHeight < 49 ) { 240 body.addClass( 'masthead-fixed' ); 241 } else { 242 body.removeClass( 'masthead-fixed' ); 243 } 244 } ); 245 } 246 } 247 248 // Focus styles for menus. 249 $( '.primary-navigation, .secondary-navigation' ).find( 'a' ).on( 'focus.twentyfourteen blur.twentyfourteen', function() { 250 $( this ).parents().toggleClass( 'focus' ); 251 } ); 252 } ); 253 254 _window.load( function() { 255 // Arrange footer widgets vertically. 256 257 258 // Initialize Featured Content slider. 259 if ( body.is( '.slider' ) ) { 260 $( '.featured-content' ).featuredslider( { 261 selector: '.featured-content-inner > article', 262 controlsContainer: '.featured-content' 263 } ); 264 } 265 } ); 266} )( jQuery );
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.