1 2 3$(document).ready(function () { 4 new AOS.init(); 5 6 var lastScrollTop = 0; 7 function ToggleMenu() { 8 var st = $(this).scrollTop(); 9 if (st > lastScrollTop && st > 120){ 10 // downscroll code 11 $(".dm-menu").addClass("masque"); 12 } else { 13 // upscroll code 14 $(".dm-menu").removeClass("masque"); 15 } 16 lastScrollTop = st; 17 } 18 19 function MasqueLogoMobile() { 20 var deg = Math.round(Math.random()*50) - 25; 21 $(".dm-logo-mobile").attr("style","transform: translateY(-75px) rotate("+deg+"deg);"); 22 $(window).off("scroll.main"); 23 } 24 25 function CheckScrollLogoMobile() { 26 var st = $(this).scrollTop(); 27 if (st > lastScrollTop && st > 100){ 28 MasqueLogoMobile(); 29 } 30 lastScrollTop = st; 31 } 32 33 $(window).off("scroll.main"); 34 $(window).on("scroll.main", function(e) { 35 //ToggleMenu(); 36 CheckScrollLogoMobile(); 37 }); 38 $(".navbar-toggler").on("click.main", function(e) { 39 MasqueLogoMobile(); 40 }); 41 42 $('#main-nav').on('hide.bs.collapse', function () { 43 $(".dm-menu").addClass("dm-menu-collapsed"); 44 45 //console.log("Papillon part"); 46 $(".dm-menu-mobile-brand img").attr("style","transform: translate(70vw, -250px) rotate(40deg);"); 47 setTimeout(() => { 48 $(".dm-menu-mobile-brand img").addClass("reset").removeAttr("style"); 49 setTimeout(() => { 50 $(".dm-menu-mobile-brand img").removeClass("reset"); 51 }, 350); 52 }, 350); 53 }); 54 55 $('#main-nav').on('show.bs.collapse', function () { 56 // console.log("Papillon arrive"); 57 $(".dm-menu").removeClass("dm-menu-collapsed"); 58 var deg = Math.round(Math.random()*50) - 25; 59 $(".dm-menu-mobile-brand img").removeClass("reset").attr("style","transform: translate(0vw, -125px) rotate("+deg+"deg);"); 60 }); 61 62 function ChangeMenuMobile() { 63 //$('.navbar .dropdown').off('mouseenter.main mouseleave.main'); 64 $('.navbar .dropdown-toggle').off("click.main touchend.main"); 65 $(window).off("touchstart.main"); 66 $(window).on("touchstart.main", function(e) { 67 $('.navbar .dropdown').removeClass("hover"); 68 }); 69 $('.navbar .dropdown-toggle').on('click.main touchend.main',function(e){ 70 if(e.type=='click' || $(window).width() < 768) { 71 //location.href = this.href;//on laisse le comportement normalx 72 73 //console.log("click"); 74 } else { 75 e.preventDefault(); 76 $(this).parent().toggleClass('hover'); 77 //console.log("touch"); 78 } 79 }); 80 /*if ($(window).width() > 769) { 81 $('.navbar .dropdown > a').on("click.main", function(e) { 82 location.href = this.href; 83 }); 84 }*/ 85 } 86 87 ChangeMenuMobile(); 88 $(window).on("resize.main", function(e) { 89 ChangeMenuMobile(); 90 }); 91 92 // Transformer les img SVG en SVG inline pour pouvoir les manipuler 93 $("img.dm-picto").on("load", function() { 94 SVGInject($(this)); 95 }); 96 97 98 //Gestion des HASHtags dans le menu 99 100 var hash_url = window.location.hash; 101 if ( hash_url == '' || hash_url == '#' || hash_url == undefined ) { 102 103 } else { 104 if($(hash_url).length > 0) { 105 $("body").scrollTo($(hash_url), { 106 duration: 500, 107 offset: -50, 108 easing: 'swing', 109 onAfter: function() { 110 $(".dm-menu").removeClass("masque"); 111 } 112 }); 113 } 114 } 115 116 $( ".nav-item.active .dropdown-menu > a" ).off("click.main"); 117 $( ".nav-item.active .dropdown-menu > a" ).on("click.main", function(e) { 118 e.preventDefault(); 119 var hash = this.hash; 120 121 $("body").scrollTo($(hash), { 122 duration: 500, 123 offset: -50, 124 easing: 'swing', 125 onAfter: function() { 126 $(".dm-menu").removeClass("masque"); 127 setTimeout(function() { 128 $(".dm-menu").removeClass("masque"); 129 }, 200); 130 history.pushState(null, null, hash); 131 } 132 }); 133 }); 134 InitMagnificPopup(); 135}); 136 137 138 // popup images et ajax 139 function InitMagnificPopup() { 140 $('.magnific_ajax').magnificPopup({ 141 type: 'ajax', 142 mainClass: 'dm-mfp-fade', 143 callbacks: { 144 open: function() { 145 $.scrollLock(true); 146 }, 147 close: function() { 148 $.scrollLock(false); 149 } 150 // e.t.c. 151 } 152 }); 153 154 //$(".dm-post-single .entry-content a[href$='.jpg']:has(img):not(.magnific_image)").magnificPopup({ 155 $("article .entry-content a[href$='.jpg']:has(img)").magnificPopup({ 156 type: 'image', 157 mainClass: 'dm-mfp-fade', 158 gallery:{ 159 enabled:true 160 } 161 }); 162 } 163 164 165 function registerEqualHeightRow(el) { 166 for (var i = 0; i < el.children.length; i++) { 167 new ResizeSensor(el.children[i].children[0], function () { 168 var finalHeight = 0; 169 for (var j = 0; j < el.children.length; j++) { 170 finalHeight = Math.max(finalHeight, el.children[j].children[0].clientHeight); 171 } 172 for (var j = 0; j < el.children.length; j++) { 173 $(el.children[j]).height(finalHeight); 174 } 175 176 }) 177 } 178 } 179 function equalHeights(elems) { 180 for (var i = 0; i < elems.length; i++) { 181 registerEqualHeightRow(elems[i]); 182 } 183 } 184 185/* 186 document.addEventListener('DOMContentLoaded', function() { 187 // inject all img elements with class name `injectable` 188 SVGInject(document.querySelectorAll('img.dm-picto'), { 189 onAllFinish: function() { 190 // the SVG injection has finished for all three images 191 192 } 193 }); 194 }); 195 */ 196 197 198// Add it after jquery.magnific-popup.js and before first initialization code 199$.extend(true, $.magnificPopup.defaults, { 200 tClose: 'Fermer (Esc)', // Alt text on close button 201 tLoading: 'Chargement...', // Text that is displayed during loading. Can contain %curr% and %total% keys 202 gallery: { 203 tPrev: 'Précédent (flèche gauche)', // Alt text on left arrow 204 tNext: 'Suivant (flèche droite)', // Alt text on right arrow 205 tCounter: '%curr% of %total%' // Markup for "1 of 7" counter 206 }, 207 image: { 208 tError: '<a href="%url%">Lâimage</a> nâa pu être chargée.' // Error message when image could not be loaded 209 }, 210 ajax: { 211 tError: '<a href="%url%">Le contenu</a> nâa pu être chargé.' // Error message when ajax request failed 212 } 213 }); 214 215 216 217/* 218const test_editor = new EditorJS({ 219 //Id of Element that should contain Editor instance 220 holder: 'editor_test' 221}); 222*/ 223 224 225/** 226 * Determine the mobile operating system. 227 * This function returns one of 'iOS', 'Android', 'Windows Phone', or 'unknown'. 228 * 229 * @returns {String} 230 */ 231function getMobileOperatingSystem() { 232 var userAgent = navigator.userAgent || navigator.vendor || window.opera; 233 234 // Windows Phone must come first because its UA also contains "Android" 235 if (/windows phone/i.test(userAgent)) { 236 return "Windows Phone"; 237 } 238 239 if (/android/i.test(userAgent)) { 240 return "Android"; 241 } 242 243 // iOS detection from: http://stackoverflow.com/a/9039885/177710 244 if (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) { 245 return "iOS"; 246 } 247 248 return "unknown"; 249} 250 251 252 253 254// Scrolllock 255//https://gist.github.com/barneycarroll/6550066 256$.scrollLock = (function scrollLockClosure() { 257 'use strict'; 258 259 var $html = $('html'), 260 // State: unlocked by default 261 locked = false, 262 // State: scroll to revert to 263 prevScroll = { 264 scrollLeft: $(window).scrollLeft(), 265 scrollTop: $(window).scrollTop() 266 }, 267 // State: styles to revert to 268 prevStyles = {}, 269 lockStyles = { 270 'overflow-y': 'scroll', 271 'position': 'fixed', 272 'width': '100%' 273 }; 274 275 // Instantiate cache in case someone tries to unlock before locking 276 saveStyles(); 277 278 // Save context's inline styles in cache 279 function saveStyles() { 280 var styleAttr = $html.attr('style'), 281 styleStrs = [], 282 styleHash = {}; 283 284 if (!styleAttr) { 285 return; 286 } 287 288 styleStrs = styleAttr.split(/;\s/); 289 290 $.each(styleStrs, function serializeStyleProp(styleString) { 291 if (!styleString) { 292 return; 293 } 294
295 var keyValue = styleString.split(/\s:\s/); 296 297 if (keyValue.length < 2) { 298 return; 299 } 300 301 styleHash[keyValue[0]] = keyValue[1]; 302 }); 303 304 $.extend(prevStyles, styleHash); 305 } 306 307 function lock() { 308 var appliedLock = {}; 309 310 // Duplicate execution will break DOM statefulness 311 if (locked) { 312 return; 313 } 314 315 // Save scroll state... 316 prevScroll = { 317 scrollLeft: $(window).scrollLeft(), 318 scrollTop: $(window).scrollTop() 319 }; 320 321 // ...and styles 322 saveStyles(); 323 324 // Compose our applied CSS 325 $.extend(appliedLock, lockStyles, { 326 // And apply scroll state as styles 327 'left': -prevScroll.scrollLeft + 'px', 328 'top': -prevScroll.scrollTop + 'px' 329 }); 330 331 // Then lock styles... 332 $html.css(appliedLock); 333 334 // ...and scroll state 335 $(window) 336 .scrollLeft(0) 337 .scrollTop(0); 338 339 locked = true; 340 } 341 342 function unlock() { 343 // Duplicate execution will break DOM statefulness 344 if (!locked) { 345 return; 346 } 347 348 // Revert styles 349 $html.attr('style', $('<x>').css(prevStyles).attr('style') || ''); 350 351 // Revert scroll values 352 $(window) 353 .scrollLeft(prevScroll.scrollLeft) 354 .scrollTop(prevScroll.scrollTop); 355 356 locked = false; 357 } 358 359 return function scrollLock(on) { 360 // If an argument is passed, lock or unlock depending on truthiness 361 if (arguments.length) { 362 if (on) { 363 lock(); 364 } else { 365 unlock(); 366 } 367 } 368 // Otherwise, toggle 369 else { 370 if (locked) { 371 unlock(); 372 } else { 373 lock(); 374 } 375 } 376 }; 377}()); 378 379 380 381 /** scrollTo 382 * Copyright (c) 2007 Ariel Flesler - aflesler â gmail ⢠com | https://github.com/flesler 383 * Licensed under MIT 384 * @author Ariel Flesler 385 * @version 2.1.2 386 */ 387;(function(f){"use strict";"function"===typeof define&&define.amd?define(["jquery"],f):"undefined"!==typeof module&&module.exports?module.exports=f(require("jquery")):f(jQuery)})(function($){"use strict";function n(a){return!a.nodeName||-1!==$.inArray(a.nodeName.toLowerCase(),["iframe","#document","html","body"])}function h(a){return $.isFunction(a)||$.isPlainObject(a)?a:{top:a,left:a}}var p=$.scrollTo=function(a,d,b){return $(window).scrollTo(a,d,b)};p.defaults={axis:"xy",duration:0,limit:!0};$.fn.scrollTo=function(a,d,b){"object"=== typeof d&&(b=d,d=0);"function"===typeof b&&(b={onAfter:b});"max"===a&&(a=9E9);b=$.extend({},p.defaults,b);d=d||b.duration;var u=b.queue&&1<b.axis.length;u&&(d/=2);b.offset=h(b.offset);b.over=h(b.over);return this.each(function(){function k(a){var k=$.extend({},b,{queue:!0,duration:d,complete:a&&function(){a.call(q,e,b)}});r.animate(f,k)}if(null!==a){var l=n(this),q=l?this.contentWindow||window:this,r=$(q),e=a,f={},t;switch(typeof e){case "number":case "string":if(/^([+-]=?)?\d+(\.\d+)?(px|%)?$/.test(e)){e= h(e);break}e=l?$(e):$(e,q);case "object":if(e.length===0)return;if(e.is||e.style)t=(e=$(e)).offset()}var v=$.isFunction(b.offset)&&b.offset(q,e)||b.offset;$.each(b.axis.split(""),function(a,c){var d="x"===c?"Left":"Top",m=d.toLowerCase(),g="scroll"+d,h=r[g](),n=p.max(q,c);t?(f[g]=t[m]+(l?0:h-r.offset()[m]),b.margin&&(f[g]-=parseInt(e.css("margin"+d),10)||0,f[g]-=parseInt(e.css("border"+d+"Width"),10)||0),f[g]+=v[m]||0,b.over[m]&&(f[g]+=e["x"===c?"width":"height"]()*b.over[m])):(d=e[m],f[g]=d.slice&& "%"===d.slice(-1)?parseFloat(d)/100*n:d);b.limit&&/^\d+$/.test(f[g])&&(f[g]=0>=f[g]?0:Math.min(f[g],n));!a&&1<b.axis.length&&(h===f[g]?f={}:u&&(k(b.onAfterFirst),f={}))});k(b.onAfter)}})};p.max=function(a,d){var b="x"===d?"Width":"Height",h="scroll"+b;if(!n(a))return a[h]-$(a)[b.toLowerCase()]();var b="client"+b,k=a.ownerDocument||a.document,l=k.documentElement,k=k.body;return Math.max(l[h],k[h])-Math.min(l[b],k[b])};$.Tween.propHooks.scrollLeft=$.Tween.propHooks.scrollTop={get:function(a){return $(a.elem)[a.prop]()}, set:function(a){var d=this.get(a);if(a.options.interrupt&&a._last&&a._last!==d)return $(a.elem).stop();var b=Math.round(a.now);d!==b&&($(a.elem)[a.prop](b),a._last=this.get(a))}};return p});
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.