$(document).ready(function(){var e=$(".g-nav");if($("#menu-toggle").on("click",function(a){e.slideToggle(200),$(document).on("click",function(){e.slideUp(200)}),a.stopPropagation()}),e.on("click",function(e){e.stopPropagation()}),$(window).width()>695){var a=$(".g-header"),t=a.outerHeight(),o=$(".g-logo"),n=e.find("a"),s=$(".g-banner").attr("data-theme"),r=$(document).scrollTop(),i=$(window).width(),c=$(".catalog-container");i>1200&&c.show(),$(document).scroll(function(){var l=$(this).scrollTop(),u="nav-"+s;l>t?(l>3*t&&a.addClass("headerUp"),a.css({"background-color":"rgba(255, 255, 255, .98)","box-shadow":"0 1px 12px rgba(0, 0, 0, .08)"}),o.css({background:"url(/assets/icons/logo_"+s+".svg) no-repeat center","background-size":"100% 100%"}),n.css("color","#666"),e.addClass(u)):(a.removeClass("headerUp"),a.css({"background-color":"transparent","box-shadow":"none"}),o.css({background:"url(/assets/icons/logo.svg) no-repeat center","background-size":"100% 100%"}),n.css("color","#fff"),e.removeClass(u)),r>l?a.addClass("headerDown"):a.removeClass("headerDown"),r=l,i>1100&&(l>500?c.addClass("fixed"):c.removeClass("fixed"))})}function l(){var e,a,t,o=$("#search_input"),n=$(".search_result");o.focus(function(){$(".icon-search").css("color","#3199DB"),n.show()}),o.keyup((e=this.autoComplete,a=a||120,function(){var o=this,n=arguments;clearTimeout(t),t=setTimeout(function(){e.apply(o,n)},a)})),$(document).click(function(e){"search_input"!==e.target.id&&"search_result"!==e.target.className&&"search_item"!==e.target.className&&($(".icon-search").css("color","#CAD3DC"),n.hide())})}$(".read-next-item section").each(function(){var e=$(this).height(),a=$(".read-next-item").height();$(this).css("margin-top",(a-e)/2+"px"),$(this).fadeIn()}),$(".read-next-item img").each(function(){!function(e,a){e.width(),a.width();var t=e.height(),o=a.height();if(t<o){e.css({width:"auto",height:"100%"});var n=(e.width()-a.width())/2;e.css("margin-left","-"+n+"px")}else{var s=(o-t)/2;e.css("margin-top",s+"px")}e.fadeIn()}($(this),$(".read-next-item"))}),function(){for(var e=parseInt($("#total_pages").val()),a=parseInt($("#current_pages").val()),t=$("#base_url").val(),o="",n=a-3;n<a;n++)n>0&&1!==n?o+='<a href="'+t+"page"+n+'" class="page-link page-num">'+n+"</a>":1===n&&(o+='<a href="'+t+'" class="page-link page-num">'+n+"</a>");o+='<span class="page-link page-num active">'+a+"</span>";for(var s=a+1;s<=a+3;s++)s<=e&&(o+='<a href="'+t+"page"+s+'" class="page-link page-num">'+s+"</a>");$("#page-link-container").html(o)}(),l.prototype.autoComplete=function(){var e=this.value.toLowerCase();e.length?$(".icon-search").css("color","#3199DB"):$(".icon-search").css("color","#CAD3DC"),$.getJSON("../../search.json").done(function(a){var t="";for(var o in a){var n=a[o],s=n.title,r=n.tags;n.url;""!==e&&(s+r).toLowerCase().indexOf(e)>=0&&(t+='<a class="search_item" href="'+n.url+'">'+n.title+"</a>")}$(".search_result").html(t)})},new l,$(".post-content").on("mouseup",function(e){var a,t,o=window.getSelection();o.toString().length>=30&&(a=o,t=new Date,a+="\n\nCopyright "+t.getFullYear()+" l’article appartient à son auteur.\nPour toute reproduction à titre commerciale, veuillez contacter l'auteur pour obtenir son autorisation.\nDans le cas d’une utilisation sans but mercantile veuillez indiquer la source de l’article.\nOriginal: "+location.href,$(".post-content").on("copy",function(e){(window.clipboardData||e.originalEvent.clipboardData).setData("text/plain",a),e.preventDefault()}))})});
