13 lines
9.0 KiB
PHP
13 lines
9.0 KiB
PHP
/**
|
|
* This file is part of Zwii.
|
|
* For full copyright and license information, please see the LICENSE
|
|
* file that was distributed with this source code.
|
|
*
|
|
* @author Rémi Jean <remi.jean@outlook.com>
|
|
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
|
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
|
* @copyright Copyright (C) 2018-2022, Frédéric Tempez
|
|
* @license GNU General Public License, version 3
|
|
* @link http://zwiicms.fr/
|
|
*/
|
|
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")):$(inputFileHiddenDOM).removeClass("disabled"),inputFileHiddenDOM.parent().find(".inputFileLabel").text(fileName)})).trigger("change"),$(".inputFileDelete").on("click",(function(){$(this).parents(".inputWrapper").find(".inputFileHidden").val("").trigger("change")})),$(".inputDateDelete").on("click",(function(){$(this).parents(".inputWrapper").find(".datepicker").val("").trigger("change")})),$("#barUpdate").on("click",(function(){return message="<?php echo helper::translate('Mettre à jour ?');?>",core.confirm(message,(function(){$(location).attr("href",$("#barUpdate").attr("href"))}))})),$("#barLogout").on("click",(function(){return message="<?php echo helper::translate('Se déconnecter ?');?>",core.confirm(message,(function(){$(location).attr("href",$("#barLogout").attr("href"))}))})),$("form").on("submit",(function(){$(this).find(".uniqueSubmission").addClass("disabled").prop("disabled",!0).empty().append($("<span>").addClass("zwiico-spin animate-spin"))})),$("[type=email]").on("change",(function(){var _this=$(this),pattern;/^([a-z\d!#$%&'*+\-\/=?^_`{|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+(\.[a-z\d!#$%&'*+\-\/=?^_`{|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+)*|"((([ \t]*\r\n)?[ \t]+)?([\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|\\[\x01-\x09\x0b\x0c\x0d-\x7f\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))*(([ \t]*\r\n)?[ \t]+)?")@(([a-z\d\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|[a-z\d\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF][a-z\d\-._~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]*[a-z\d\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])\.)+([a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|[a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF][a-z\d\-._~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]*[a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])\.?$/i.test(_this.val())?core.noticeRemove(_this.attr("id")):(message="<?php echo helper::translate('Format incorrect');?>",core.noticeAdd(_this.attr("id"),message))}));var elementDOM=$("iframe, video, embed, object");elementDOM.each((function(){var _this=$(this);_this.data("ratio",_this.height()/_this.width()).data("maxwidth",_this.width()).removeAttr("width height")})),$(window).on("resize",(function(){elementDOM.each((function(){var _this=$(this),width=_this.parent().first().width();width>_this.data("maxwidth")&&(width=_this.data("maxwidth")),_this.width(width).height(width*_this.data("ratio"))}))})).trigger("resize"),$(window).on("resize",(function(){var responsive="<?php echo $this->getdata(['theme','header','imageContainer']);?>",widthpx,width,heightpx,height,ratio})).trigger("resize")},core.start(),$("#pageDelete").on("click",(function(){var _this=$(this);return message="<?php echo helper::translate('Confirmez-vous la suppression de cette page ?');?>",core.confirm(message,(function(){$(location).attr("href",_this.attr("href"))}))})),core.relativeLuminanceW3C=function(rgba){var RsRGB=rgba[0]/255,GsRGB=rgba[1]/255,BsRGB=rgba[2]/255,RsRGBA=rgba[3]*RsRGB+(1-rgba[3]),GsRGBA=rgba[3]*GsRGB+(1-rgba[3]),BsRGBA=rgba[3]*BsRGB+(1-rgba[3]),R,G,B;return.2126*(RsRGBA<=.03928?RsRGBA/12.92:Math.pow((RsRGBA+.055)/1.055,2.4))+.7152*(GsRGBA<=.03928?GsRGBA/12.92:Math.pow((GsRGBA+.055)/1.055,2.4))+.0722*(BsRGBA<=.03928?BsRGBA/12.92:Math.pow((BsRGBA+.055)/1.055,2.4))},$(document).ready((function(){$("nav").mouseenter((function(){$("#navfixedlogout .navSub").css({"pointer-events":"auto"}),$("#navfixedconnected .navSub").css({"pointer-events":"auto"})})),$("nav").mouseleave((function(){$("#navfixedlogout .navSub").css({"pointer-events":"none"}),$("#navfixedconnected .navSub").css({"pointer-events":"none"})})),$("img,picture,iframe").attr("loading","lazy"),$(".accordion").each((function(e){var accordion=$(this),toggleSpeed=accordion.attr("data-speed")||100;function open(item,speed){accordion.find(".accordion-item").not(item).removeClass("active").find(".accordion-content").slideUp(speed),item.addClass("active").find(".accordion-content").slideDown(speed)}function close(item,speed){accordion.find(".accordion-item").removeClass("active").find(".accordion-content").slideUp(speed)}open(accordion.find(".active:first"),0),accordion.on("click",".accordion-title",(function(ev){ev.preventDefault(),$(this).closest(".accordion-item").hasClass("active")?close($(this).closest(".accordion-item"),toggleSpeed):open($(this).closest(".accordion-item"),toggleSpeed)}))})),$("#toggle").click((function(){var changeIcon=$("#toggle").children("span");$(changeIcon).hasClass("zwiico-menu")?$(changeIcon).removeClass("zwiico-menu").addClass("zwiico-cancel"):$(changeIcon).addClass("zwiico-menu")})),/^\?fbclid=/.test(location.search)&&location.replace(location.href.replace(/\?fbclid.+/,""))}));
|