1function clear_active() { 2 jQuery('.filter-container a').each(function( index ) { 3 jQuery(this).removeClass('active'); 4 }); 5 jQuery('.all').removeClass('active'); 6} 7 8 9/* jQuery( "*", document.body ).click(function( event ) { 10 event.preventDefault(); 11 console.log($(this)); 12 var offset = jQuery( this ).offset(); 13 event.stopPropagation(); 14 console.log(" coords ( " + offset.left + ", " + offset.top + " )" ); 15 }); */ 16 17 18// sticky navigation 19 20 21function fixedNav() { 22 const nav = document.getElementById('nsp-main-menu'); 23 let navTop = nav.offsetTop+300; 24 if (window.scrollY >= navTop) { 25 nav.classList.add('fixed'); 26 } else { 27 nav.classList.remove('fixed'); 28 } 29 } 30 31window.addEventListener('scroll', fixedNav); 32 33jQuery( function( $ ){ 34 35 $('li.dropdown > a').on("touchstart click", function(e) { 36 // Si le parent est déjà ouvert, laisse passer le clic (redirige) 37 if ($(this).parent().hasClass('open')) { 38 return true; 39 } 40 // Sinon, bloque le clic et ouvre le menu 41 e.preventDefault(); 42 43 // Ferme les autres menus ouverts 44 $('li.dropdown').not($(this).parent()).removeClass('open').find('ul').removeClass('display'); 45 46 // Ouvre le menu courant 47 $(this).parent().addClass('open'); 48 $(this).siblings('ul').addClass('display'); 49 }); 50 51 52 $('.grid').masonry({ 53 // options 54 itemSelector: '.grid-item', 55 gutter: 10 56 }); 57 58 $('.show-menu').click(function() { 59 $('.filter-container .navbar-collapse').toggle('show'); 60 $(this).find('span').toggle('hide'); 61 }) 62 $('.archive-page-template.depeches .article, .archive-page-template.campagnes .article, .category .article').each(function( index ) { 63 64 65 $(this).click(function() { 66 console.log('link'); 67 link = $(this).data('link'); 68 window.location. href= link; 69 }); 70 }); 71 72 73 $('.archive-page-template.publications:not(.campagnes) .article').each(function( index ) { 74 75 /* $(this).hover(function() { 76 console.log('ok'); 77 id = $(this).data('id'); 78 console.log(id); 79 if(id != 478 && id != 613) id='606'; 80 $(this).toggleClass('background-color'+id); 81 }); */ 82 $(this).click(function() { 83 link = $(this).data('link'); 84 window.location. href= '/download/'+link; 85 }); 86 }); 87 88 $('.archive-page-template.billets .filter-container a').click(function(e) { 89 e.preventDefault(); 90 let current = $(this); 91 let direction = $(this).data('direction'); 92 $.ajax({
93 type: "POST", 94 dataType: "json", 95 data: { 96 'direction': direction, 97 'action': 'sort_billets', 98 'nonce' : ajax_var.check_nonce, 99 }, 100 url: ajax_var.url, 101 beforeSend: function(xhr){ 102 $('.grid-container').fadeOut(); 103 }, 104 success: function(data){ 105 106 if(data) { 107 clear_active(); 108 $('.grid-container').html(data['html']); 109 current.addClass('active'); 110 $('.grid-container').fadeIn(); 111 $('.loadmore').removeData('direction'); 112 $('.loadmore').attr("data-direction" , direction); 113 $('.loadmore').data('direction' , direction); 114 $('.navbar-collapse').collapse('hide'); 115 } else{ 116 117 } 118 }, 119 error : function(jqXHR, textStatus, errorThrown) { 120 console.log('error') 121 } 122 }); 123 }) 124 125 $('.archive-page-template.depeches .filter-container a').click(function(e) { 126 e.preventDefault(); 127 let id = $(this).data('id'); 128 129 if(id == 'all') { 130 window.location.href = "/category/depeches-adherents/"; 131 } 132 else { 133 let current = $(this); 134 $.ajax({
135 type: "POST", 136 dataType: "json", 137 data: { 138 'id': id, 139 'action': 'get_depeches', 140 'nonce' : ajax_var.check_nonce, 141 }, 142 url: ajax_var.url, 143 beforeSend: function(xhr){ 144 $('.grid-container').fadeOut(); 145 }, 146 success: function(data){ 147 148 if(data) { 149 clear_active(); 150 $('.grid-container').html(data['html']); 151 current.addClass('active'); 152 $('.grid-container').fadeIn(); 153 $('.loadmore').removeData('id'); 154 $('.loadmore').attr("data-id" , id); 155 $('.loadmore').data('id' , id); 156 $('.loadmore').removeData('max'); 157 $('.loadmore').data('max' , data['num_pages']); 158 $('.loadmore').attr("data-max" , data['num_pages']); 159 $('.navbar-collapse').collapse('hide'); 160 $('.loadmore').attr("data-current" , 1); 161 $('.loadmore').data('current' , 1); 162 163 if(data['num_pages'] <= 1) { 164 $('.loadmore').hide(); 165 } 166 else { 167 $('.loadmore').show(); 168 } 169 } else{ 170 171 } 172 }, 173 error : function(jqXHR, textStatus, errorThrown) { 174 console.log('error') 175 } 176 }); 177 } 178 }) 179 180 $('.archive-page-template.publications .filter-container a').click(function(e) { 181 e.preventDefault(); 182 let id = $(this).data('id'); 183 184 if(id == 'all') { 185 window.location.href = "/mediatheque/publications/"; 186 } 187 else { 188 let current = $(this); 189 $.ajax({
190 type: "POST", 191 dataType: "json", 192 data: { 193 'id': id, 194 'action': 'get_publications', 195 'nonce' : ajax_var.check_nonce, 196 }, 197 url: ajax_var.url, 198 beforeSend: function(xhr){ 199 $('.grid-container').fadeOut(); 200 }, 201 success: function(data){ 202 203 if(data) { 204 clear_active(); 205 $('.grid-container').html(data['html']); 206 current.addClass('active'); 207 $('.grid-container').fadeIn(); 208 $('.loadmorepublications').removeData('id'); 209 $('.loadmorepublications').attr("data-id" , id); 210 $('.loadmorepublications').data('id' , id); 211 $('.loadmorepublications').removeData('max'); 212 $('.loadmorepublications').data('max' , data['num_pages']); 213 $('.loadmorepublications').attr("data-max" , data['num_pages']); 214 $('.navbar-collapse').collapse('hide'); 215 $('.loadmorepublications').attr("data-current" , 1); 216 $('.loadmorepublications').data('current' , 1); 217 218 if(data['num_pages'] <= 1) { 219 $('.loadmore').hide(); 220 } 221 else { 222 $('.loadmore').show(); 223 } 224 } else{ 225 226 } 227 }, 228 error : function(jqXHR, textStatus, errorThrown) { 229 console.log('error') 230 } 231 }); 232 } 233 }) 234 235 jQuery("#ff-stream-1").css("min-height" , 0); 236 237 $('.nav-search a').click(function(event) { 238 event.preventDefault(); 239 $("#search-form").css("display" , "flex"); 240 $("#search").addclass('flexgrow'); 241 }) 242 243 $("#search-form .nsp-close").click(function() { 244 $(this).parent().css("display" , "none"); 245 }) 246 247 248 249 $( '#event-slider .home-slider' ).slick({ 250 autoplay: false, 251 infinite: true, 252 slidesToShow: 1, 253 autoplaySpeed: 9000, 254 slidesToScroll: 1, 255 dots: true, 256 fade: false, 257 appendDots: $('#event-slider'), 258 appendArrows: $('#event-slider'), 259 responsive: [ 260 { 261 breakpoint: 480, 262 settings: { 263 arrows: false, 264 autoplay: true 265 } 266 } 267 ] 268 }); 269 270 $( '#focus-slider .home-slider' ).slick({ 271 infinite: true, 272 slidesToShow: 1, 273 slidesToScroll: 1, 274 dots: true, 275 autoplay: true, 276 autoplaySpeed: 6000, 277 fade: false, 278 appendDots: $('#focus-slider'), 279 appendArrows: $('#focus-slider'), 280 responsive: [ 281 { 282 breakpoint: 480, 283 settings: { 284 arrows: false, 285 autoplay: true 286 } 287 } 288 ] 289 }); 290 291 /* $( '.anepasmanquer .slides' ).slick({ 292 infinite: true, 293 slidesToShow: 1, 294 slidesToScroll: 1, 295 dots: true, 296 autoplay: false, 297 fade: true 298 }); 299 300 $( '.fhpmcoimages .slides' ).slick({ 301 infinite: true, 302 slidesToShow: 1, 303 slidesToScroll: 1, 304 dots: true, 305 autoplay: false, 306 fade: true 307 });*/ 308 309 /* $(".menu-toggle").click(function() { 310 $('#menu-container').prepend("<div class='nsp-close'></div"); 311 $('#menu-container .nsp-close').click(function() { 312 $(this).remove(); 313 $('#site-navigation').removeClass('toggled-on'); 314 }) 315 }) 316 */ 317 318 319 320 321/* $('.anepasmanquer .slides').on('beforeChange', function(event, slick, direction){ 322 var colors = [ "#1f5579", "#ee8025", "#5b98ce" ]; 323$( '.anepasmanquer' ).css("background-color", colors[slick.currentSlide]); 324$( '.nsp-date-event .date').css("color", colors[slick.currentSlide]); 325$( '.anepasmanquer' ).animate({backgroundColor:colors[slick.currentSlide]}, 300); 326 $('.fhpmcoimages .illu svg polygon').animate({'stroke-dashoffset': 0}, 300).css({'fill': colors[slick.currentSlide], 'transition': 'fill 0.3s'}); 327 328});*/ 329 330 $(".fancybox").fancybox({ 331 maxWidth : 800, 332 maxHeight : 600, 333 fitToView : false, 334 width : '70%', 335 height : '70%', 336 autoSize : false, 337 closeClick : false, 338 openEffect : 'none', 339 closeEffect : 'none', 340 padding:0 341 }); 342 343 344 /********** ANIMATION ************/ 345 $( '.push_categories #first' ).animate( { opacity:0.9 }, 400, function(){ 346 $( '.push_categories #second' ).animate( { opacity:0.9 }, 400 ) 347 } ); 348 349 if( $( '.home' ).length > 0 ) 350 { 351 $( window ).scroll( function() { 352 /* if( $( '.fhpmcoimages .mytheme-content h2' ).visible() && $( '.fhpmcoimages' ).hasClass( 'hover' ) == false ) 353 { 354 355 $( '.fhpmcoimages' ).addClass( 'hover' ); 356 $( '.fhpmcovideo1' ).animate( { opacity:0.9 }, 200, function(){ 357 $( '.fhpmcovideo2' ).animate( { opacity:0.9 }, 200 ) 358 } ); 359 } 360*/ 361 } ); 362 } 363 364 /*$( window ).scroll( function() { 365 if( $( '.partners' ).visible() && $( '.partners' ).hasClass( 'hover' ) == false ) 366 { 367 $( '.partners' ).addClass( 'hover' ); 368 $( '.partners' ).animate( { opacity:1 }, 500 ); 369 } 370 } );*/ 371 /********** ANIMATION ************/ 372 373 374 375/********** SURLIGNEMENT RECHERCHE ************/ 376$.fn.extend({ 377 highlight: function(search, insensitive, hls_class){ 378 var regex = new RegExp("(<[^>]*>)|(\\b"+ search.replace(/([-.*+?^${}()|[\]\/\\])/g,"\\$1") +")", insensitive ? "ig" : "g"); 379 return this.html(this.html().replace(regex, function(a, b, c){ 380 return (a.charAt(0) == "<") ? a : "<strong class=\""+ hls_class +"\">" + c + "</strong>"; 381 })); 382 } 383}); 384 385if( $( 'body' ).hasClass( 'search' ) ) 386{ 387 if(typeof(hls_query) != 'undefined'){ 388 var articles = $( 'article' ); 389 $.each( articles, function(key, value) 390 { 391 $(value).highlight(hls_query, 1, "searchedword"); 392 } ); 393 } 394} 395/***********************************************/ 396 397 398if( $( '.not-singular' ).length == 1 ) 399{ 400 var siteUrl = "http://www.fhpmco.fr/"; 401 var msgText = ""; 402 var msgFinished = "Aucun contenu à charger."; 403 var nextSelector = '.nav-previous a'; 404 var navSelector = '.nav-previous'; 405 406 var $container = $('#grid-container'); 407 $container.infinitescroll({ 408 navSelector: navSelector, 409 nextSelector: nextSelector, 410 itemSelector: '.post', 411 loading: { 412 msgText: msgText, 413 finishedMsg: msgFinished, 414 }, 415 debug: true 416 }, function (newElements) { 417 var $newElems = $(newElements).css({ 418 opacity: 1 419 }); 420 if( $( 'body' ).hasClass( 'search' ) ) $.each( $(newElements), function(key, value){ $(value).highlight(hls_query, 1, "searchedword"); } ); // SURLIGNEMENT RECHERCHE APRES LOADING AJAX 421 422 });
423 $(window).unbind('.infscr'); 424 jQuery("#page-nav a").click(function () { 425 jQuery('#grid-container').infinitescroll('retrieve'); 426 return false; 427 }); 428} 429 430if( $( '.widget_archive' ).length > 0 ) 431{ 432 $( this ).find( 'option:first' ).html( 'Archives' ); 433} 434 435 436if( $( '#addressInput' ).length > 0 ) 437{ 438 439$( '#addressInput' ).val( getUrlParameter('search') ) 440} 441 442 443 444$( '.page_children_style2 td' ).bind( 'click', function(){ 445 446 var link = $( this ).find( 'a' ).attr( 'href' ); 447 window.location.replace( link ); 448 449} ); 450 451 452 453$( '.widget_custom_archive select' ).change( function(){ 454 455 var url = 'http://www.fhpmco.fr/'; 456 var cat = $( this ).attr( 'data-cat' ); 457 var date = $( this ).find( 'option:selected' ).attr( 'value' ); 458 459 if( cat != 0 ) 460 { 461 window.location.replace( url + date + '/?cat=' + cat ); 462 } 463 464} ); 465 466 467 468 469} ); // FIN 470 471 472 473var getUrlParameter = function getUrlParameter(sParam) { 474 var sPageURL = decodeURIComponent(window.location.search.substring(1)), 475 sURLVariables = sPageURL.split('&'), 476 sParameterName, 477 i; 478 479 for (i = 0; i < sURLVariables.length; i++) { 480 sParameterName = sURLVariables[i].split('='); 481 482 if (sParameterName[0] === sParam) { 483 return sParameterName[1] === undefined ? true : sParameterName[1]; 484 } 485 } 486}; 487 488// ACTUALITES 489/* 490window.onscroll = function(){ 491 scrollFunction() 492} 493function scrollFunction(){ 494 var sn = jQuery("#masthead"); 495 var header = jQuery(".header"); 496 var navHeight = sn.height(); 497 498 if(document.body.scrollTop > 200 || document.documentElement.scrollTop > 200){ 499 sn.addClass("sticky-nav"); 500 sn.css("top" , -(navHeight)+"px").css("top", 0 ); 501 } 502 else{ 503 sn.removeClass("sticky-nav"); 504 } 505} 506 507*/
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.