1(function($){ 2 var menu_onglet = $('.main-menu ul.sf-menu > li > a'); 3 var padding_vertical = $('.main-menu ul.sf-menu > li > a').css('paddingTop'); 4 5 6 7 8 /** 9 * Permet de calculer le padding qui sépare les onglets du menu 10 * @return void 11 */ 12 var cache_menu_padding = []; 13 var container_head = 0; 14 var loop_HEAD = 5; 15 function menuPaddingSet() { 16 var containerWidth = $('.main-menu').outerWidth(); 17 18 if (containerWidth === container_head && loop_HEAD <= 0) { 19 return true; 20 } 21 container_head = containerWidth; 22 23 24 var liWidthTotal = 0, 25 extra_counter = 0, 26 paddingnew = 0, 27 counter = menu_onglet.length*2; 28 // fontsizeparam = (windowSize > 1170)? "inherit" : ''; 29 if (typeof cache_menu_padding[containerWidth] !== 'undefined' && loop_HEAD <= 0) { 30 $(cache_menu_padding[containerWidth]).each(function(index, el) { 31 menu_onglet.eq(index).css(el); 32 }); 33 return true; 34 } 35 loop_HEAD--; 36 37 cache_menu_padding[containerWidth] = []; 38 39 menu_onglet.css({"padding": 0}); 40 // menu_onglet.css({"fontSize": fontsizeparam}); 41 42 43 menu_onglet.each(function() { 44 liWidthTotal += $(this).innerWidth(); 45 }); 46 47 48 var x = containerWidth - liWidthTotal; 49 50 var padding = Math.abs(Math.floor(x / counter)); 51 52 var y = x - (padding*counter); 53 var z = Math.floor(y/2); 54 var c = y - (z*2); 55 var css = ''; 56 var compter_ecart = 0; 57 var inner_el = 0; 58 var menu_onglet_count = menu_onglet.length-1; 59 menu_onglet.each(function(index, el) { 60 if (menu_onglet_count !== index) { 61 if (extra_counter < z) { 62 paddingnew = padding + 1; 63 css = {'padding': padding_vertical +' '+ paddingnew + 'px'}; 64 cache_menu_padding[containerWidth][index] = css; 65 inner_el = $(el).innerWidth(); 66 $(el).css(css); 67 compter_ecart += inner_el + paddingnew*2; 68 } 69 else { 70 if (c > 0) { 71 paddingnew = padding + 1; 72 css = {'padding': padding_vertical +' '+ padding + "px " + padding_vertical +' '+ paddingnew + 'px'}; 73 inner_el = $(el).innerWidth(); 74 cache_menu_padding[containerWidth][index] = css; 75 $(el).css(css); 76 compter_ecart += inner_el + padding + paddingnew; 77 c=0; 78 } 79 else { 80 css = {'padding': padding_vertical +' '+ padding + 'px'}; 81 inner_el = $(el).innerWidth(); 82 cache_menu_padding[containerWidth][index] = css; 83 $(el).css(css); 84 compter_ecart += inner_el + padding*2; 85 } 86 } 87 extra_counter += 1; 88 } 89 else{ 90 inner_el = $(el).innerWidth(); 91 var padding_right_last = containerWidth - (compter_ecart + inner_el + padding) -1; 92 css = {'padding': padding_vertical + ' ' + padding_right_last + 'px' + ' ' + padding_vertical +' '+ padding + "px "}; 93 cache_menu_padding[containerWidth][index] = css; 94 $(el).css(css); 95 } 96 }); 97 98 99 $('.menu-wrapper').css("opacity", "1").css("overflow", "visible"); 100 $('.menu-wrapper-hidden').css('display', 'none'); 101 } 102 103 var mobile_is_create = false; 104 function createMobileMenu(){ 105 if (!mobile_is_create) { 106 $('.main-menu ul.sf-menu').mobileMenuWithSidebar({ 107 defaultText: 'Accéder à ...', 108 className: 'menu-mobile-wrapper', 109 subMenuDash: ' –', 110 ongletSidebarName: 'En un clic !' 111 }); 112 113 var title_site = $('.lien_header_accueil').html(), 114 //accesibility_content = $('.accesibility').html(), 115 accesibility_content = $('#upper-panel-left'); 116 117 //var accesibility = '<ul class="accesibility-mobile"><li>'+ accesibility_content +'</li></ul>'; 118 //alert(accesibility_content.children("p").children("a")); 119 var accesibility = '<ul class="accesibility-mobile">'; 120 accesibility_content.children("p").children("a").each(function(){ 121 var elt = $(this); 122 accesibility += '<li><a href="'+elt.attr("href")+'">'+elt.text()+'</a></li>'; 123 }); 124 accesibility += '</ul>'; 125 126 if (accesibility_content === 'undefined') { 127 accesibility = ''; 128 } 129 130 131 var cycle = 'day'; 132 if ($('#header-wrapper').hasClass('night')) { 133 cycle = 'night'; 134 } 135 136 $('.menu-mobile-wrapper') 137 .before('<div class="header-wrapper ' + cycle + ' header-wrapper-mobile">'+ title_site +'</div>' + accesibility); 138 mobile_is_create = true; 139 } 140 } 141 142 $(document).ready(function($) { 143 createMobileMenu(); 144 if ($(window).width() < '1170') { 145 menuPaddingSet(); 146 } 147 //Ecart de temps pour éviter le décalage du au chargement de la police 148 setTimeout(moveWindow, 50); 149 //Ecart de temps dû à la toute première venu d'un nouveau visiteur 150 setTimeout(moveWindow, 2000); 151 }); 152 153 function moveWindow(){ 154 $(window).resize(); 155 } 156 /** 157 * Adapte le menu a chaque changement de taille de fenetre 158 */ 159 $(window).on('resize', function(){ 160 if ($(this).width() > "751") { 161 menuPaddingSet(); 162 hideMobileMenu('clean'); 163 } 164 else{ 165 createMobileMenu(); 166 } 167 }); 168 169 170 // main navigation init 171 $('.main-menu ul.sf-menu').superfish({ 172 // popUpSelector: 'ul,.sf-mega', // selector within menu context to define the submenu element to be revealed 173 hoverClass: 'sfHover', // the class applied to hovered list items 174 // pathClass: 'overideThisToUse', // the class you have applied to list items that lead to the current page 175 pathLevels: 1, // the number of levels of submenus that remain open or are restored using pathClass 176 delay: 200, // the delay in milliseconds that the mouse
176can remain outside a submenu without it closing 177 animation: {}, // an object equivalent to first parameter of jQueryâs .animate() method. Used to animate the submenu open 178 animationOut: {opacity:'hide'}, // an object equivalent to first parameter of jQueryâs .animate() method Used to animate the submenu closed 179 speed: 'normal', // speed of the opening animation. Equivalent to second parameter of jQueryâs .animate() method 180 speedOut: 'fast', // speed of the closing animation. Equivalent to second parameter of jQueryâs .animate() method 181 // cssArrows: true, // set to false if you want to remove the CSS-based arrow triangles 182 // disableHI: false, // set to true to disable hoverIntent detection 183 // onInit: $.noop, // callback function fires once Superfish is initialised â 'this' is the containing ul 184 onBeforeShow: function(){ // callback function fires once reveal animation completed â 'this' is the opened ul 185 $(this).css( 186 { 187 'opacity': '1', 188 'display': 'block' 189 } 190 ); 191 }, // callback function fires just before reveal animation begins â 'this' is the ul about to open 192 onShow: function(){ // callback function fires once reveal animation completed â 'this' is the opened ul 193 /** 194 * Permet d'appliquer le lazyload aux image ayant la classe lazyload 195 * @return void 196 */ 197 $(window).scroll(); 198 $(this).find('.lazyload').lazyload({ 199 effect : "fadeIn", 200 load: function(){ 201 $(this).removeClass('lazyload'); 202 } 203 }); 204 }, 205 // onBeforeHide: $.noop, // callback function fires just before closing animation â 'this' is the ul about to close 206 // onHide: $.noop, // callback function fires after a submenu has closed â 'this' is the ul that just closed 207 // onIdle: $.noop, // callback function fires when the 'current' submenu is restored (if using pathClass functionality) 208 // onDestroy: $.noop // callback function fires after the 'destroy' method is called on the menu container 209 }); 210/** 211 * Permet de collé la barre de menu en haut de l'écran 212 */ 213 if(sticky_menu == 'yes') { 214 215 // grab the initial top offset of the navigation 216 var sticky_navigation_offset_top = $('.menu-wrapper').offset().top; 217 // our function that decides weather the navigation bar should have "fixed" css position or not. 218 var sticky_navigation = function(){ 219 220 var scroll_top = $(window).scrollTop(); // our current vertical position from the top 221 222 // if we've scrolled more than the navigation, change its position to fixed to stick to top, otherwise change it back to relative 223 if (scroll_top > sticky_navigation_offset_top) { 224 if (!$('.menu-wrapper').hasClass('sticky')) { 225 $("#header-wrapper").css('padding-bottom', $('.menu-wrapper').height() + 'px'); 226 $('.menu-wrapper').addClass('sticky'); 227 // $('#menu-menu-principal').prepend('<li id="logo-menu-fixed" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children mega-menu-columns"><img style="height:46px;"src="'+ $('#logoImage').attr('src') + '" /></li>'); 228 $('.menu-wrapper-hidden').css({ 'display': 'block' }); 229 moveWindow(); 230 } 231 } else { 232 if ($('.menu-wrapper').hasClass('sticky')) { 233 $("#header-wrapper").css('padding-bottom', '0'); 234 $('.menu-wrapper').removeClass('sticky'); 235 $('#logo-menu-fixed').remove(); 236 $('.menu-wrapper-hidden').css({ 'display': 'none' }); 237 moveWindow(); 238 } 239 } 240 241 }; 242 243 // run our function on load 244 sticky_navigation(); 245 246 // and run it again every time you scroll 247 $(window).on("scroll", function() { 248 sticky_navigation(); 249 250 }); 251 252 } 253 254 255 var menu_slide_can_action = true; 256 $('#btn_menu_mobile').on('click', showMobileMenu); 257 $('.full-out-menu-mobile').on('click', hideMobileMenu); 258 259 function hideMobileMenu(event){ 260 if ( (typeof event !== 'undefined' && $('#menu-mobile-wrapper').has(event.target).length === 0) || event == 'clean') { 261 if (event == 'clean') { 262 $('.full-out-menu-mobile').hide(); 263 $('#menu-mobile-wrapper').hide().css('left', '-90%'); 264 $('body').css('overflow', 'auto'); 265 } 266 else{ 267 $('.full-out-menu-mobile').fadeOut(); 268 $('#menu-mobile-wrapper').animate( 269 { 270 'left': '-90%' 271 }, 272 400, 273 function(){ 274 $('#menu-mobile-wrapper').hide(); 275 } 276 ); 277 278 $('body').css('overflow', 'auto'); 279 } 280 281 } 282 } 283 284 function showMobileMenu(event){ 285 event.preventDefault(); 286 $('#menu-mobile-wrapper').css('opacity', 1); 287 $('.full-out-menu-mobile').fadeIn(); 288 $('#menu-mobile-wrapper').show().animate({ 289 'left': '0px', 290 }); 291 $('body').css('overflow', 'hidden'); 292 } 293 294 295 var setting_slide_toggle = { 296 duration: 400, 297 start: function(){ 298 menu_slide_can_action = false;
299 }, 300 complete: function(){ 301 menu_slide_can_action = true; 302 } 303 }; 304 $("body").on('click', "[id^='onglet-']", function(e){ 305 e.preventDefault(); 306 var that = this; 307 if (menu_slide_can_action) { 308 var sub_id = "#sub-" + $(this).attr('id').split("-")[1]; 309 if ($(sub_id).hasClass('active')) { 310 $(sub_id).slideToggle(setting_slide_toggle); 311 $(sub_id).removeClass('active'); 312 return false; 313 } 314 $("[id^='sub-'].active").each(function(index, el) { 315 $this = $(el); 316 if ($this.hasClass('active')) { 317 $this.removeClass('active'); 318 $this.slideToggle(200); 319 } 320 }); 321 $(sub_id).slideToggle(setting_slide_toggle); 322 $(sub_id).addClass('active'); 323 return false; 324 } 325 }); 326 327 // setInterval(function(){ 328 // $('.site_logo polygon').css('fill', '#'+Math.floor(Math.random()*16777215).toString(16) ); 329 // }, 1000); 330 331})(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.