2022-10-01 16:44:23 +02:00
|
|
|
var core={alert:function(text){var lightbox=lity(function($){return $("<div>").addClass("lightbox").append($("<span>").text(text),$("<div>").addClass("lightboxButtons").append($("<a>").addClass("button").text("Ok").on("click",(function(){lightbox.close()}))))}(jQuery));return $(document).on("keyup",(function(event){13===event.keyCode&&lightbox.close()})),!1},colorVariants:function(rgba){return{normal:"rgba("+(rgba=(rgba=rgba.match(/\(+(.*)\)/))[1].split(", "))[0]+","+rgba[1]+","+rgba[2]+","+rgba[3]+")",darken:"rgba("+Math.max(0,rgba[0]-15)+","+Math.max(0,rgba[1]-15)+","+Math.max(0,rgba[2]-15)+","+rgba[3]+")",veryDarken:"rgba("+Math.max(0,rgba[0]-20)+","+Math.max(0,rgba[1]-20)+","+Math.max(0,rgba[2]-20)+","+rgba[3]+")",text:core.relativeLuminanceW3C(rgba)>.22?"#222":"#DDD"}},confirm:function(text,yesCallback,noCallback){var lightbox=lity(function($){return $("<div>").addClass("lightbox").append($("<span>").text(text),$("<div>").addClass("lightboxButtons").append($("<a>").addClass("button grey").text("<?php echo helper::translate('Non');?>").on("click",(function(){lightbox.options("button",!0),lightbox.close(),void 0!==noCallback&&noCallback()})),$("<a>").addClass("button").text("<?php echo helper::translate('Oui');?>").on("click",(function(){lightbox.options("button",!0),lightbox.close(),void 0!==yesCallback&&yesCallback()}))))}(jQuery));return lightbox.options("button",!1),$(document).on("lity:close",(function(event,instance){!1===instance.options("button")&&void 0!==noCallback&&noCallback()})),$(document).on("keyup",(function(event){13===event.keyCode&&(lightbox.close(),void 0!==yesCallback&&yesCallback())})),!1},end:function(){var formDOM=$("form"),inputsDOM=formDOM.find("input:not([data-no-dirty]), select:not([data-no-dirty]), textarea:not(.editorWysiwyg):not([data-no-dirty])"),inputSerialize=inputsDOM.serialize();$(window).on("beforeunload",(function(){if(inputsDOM.serialize()!==inputSerialize)return message="<?php echo helper::translate('Les modifications que vous avez apportées ne seront peut-être pas enregistrées.');?>",message})),formDOM.submit((function(){$(window).off("beforeunload")}))}};$((function(){core.end()})),core.noticeAdd=function(id,notice){$("#"+id+"Notice").text(notice).removeClass("displayNone"),$("#"+id).addClass("notice")},core.noticeRemove=function(id){$("#"+id+"Notice").text("").addClass("displayNone"),$("#"+id).removeClass("notice")},core.start=function(){var backToTopDOM=$("#backToTop"),notificationTimer;backToTopDOM.on("click",(function(){$("body, html").animate({scrollTop:0},"400")})),$(window).on("scroll",(function(){$(this).scrollTop()>200?backToTopDOM.fadeIn():backToTopDOM.fadeOut()})),$("#notification").on("mouseenter",(function(){clearTimeout(notificationTimer),$("#notificationProgress").stop().width("100%")})).on("mouseleave",(function(){notificationTimer=setTimeout((function(){$("#notification").fadeOut()}),3e3),$("#notificationProgress").animate({width:"0%"},3e3,"linear")})).trigger("mouseleave"),$("#notificationClose").on("click",(function(){clearTimeout(notificationTimer),$("#notification").fadeOut(),$("#notificationProgress").stop()})),$("#cookieForm").submit((function(event){var getUrl,domain="domain="+window.location.hostname+";",e=new Date;e.setFullYear(e.getFullYear()+1);var expires="expires="+e.toUTCString();document.cookie="ZWII_COOKIE_CONSENT=true;samesite=strict;"+domain+expires})),$("#cookieConsent .cookieClose").on("click",(function(){$("#cookieConsent").addClass("displayNone")})),$("#footerLinkCookie").on("click",(function(){$("#cookieConsent").removeClass("displayNone")}));var menuDOM=$("#menu");$("#toggle").on("click",(function(){menuDOM.slideToggle()})),$(window).on("resize",(function(){$(window).width()>768&&menuDOM.css("display","")})),$("#barSelectPage").on("change",(function(){var pageUrl=$(this).val();pageUrl&&$(location).attr("href",pageUrl)})),$(".inputFileHidden").on("change",(function(){var inputFileHiddenDOM=$(this),fileName=inputFileHiddenDOM.val();""===fileName?(fileName="Choisissez un fichier",$(inputFileHiddenDOM).addClass("disabled")):$(inputFileH
|