Bug lang select with theme open
This commit is contained in:
parent
32f70918b7
commit
2f88ac9a7e
152
core/core.js.php
152
core/core.js.php
@ -16,8 +16,8 @@ var core = {};
|
||||
/**
|
||||
* Crée un message d'alerte
|
||||
*/
|
||||
core.alert = function(text) {
|
||||
var lightbox = lity(function($) {
|
||||
core.alert = function (text) {
|
||||
var lightbox = lity(function ($) {
|
||||
return $("<div>")
|
||||
.addClass("lightbox")
|
||||
.append(
|
||||
@ -28,14 +28,14 @@ core.alert = function(text) {
|
||||
$("<a>")
|
||||
.addClass("button")
|
||||
.text("Ok")
|
||||
.on("click", function() {
|
||||
.on("click", function () {
|
||||
lightbox.close();
|
||||
})
|
||||
)
|
||||
)
|
||||
}(jQuery));
|
||||
// Validation de la lightbox avec le bouton entrée
|
||||
$(document).on("keyup", function(event) {
|
||||
$(document).on("keyup", function (event) {
|
||||
if (event.keyCode === 13) {
|
||||
lightbox.close();
|
||||
}
|
||||
@ -46,7 +46,7 @@ core.alert = function(text) {
|
||||
/**
|
||||
* Génère des variations d'une couleur
|
||||
*/
|
||||
core.colorVariants = function(rgba) {
|
||||
core.colorVariants = function (rgba) {
|
||||
rgba = rgba.match(/\(+(.*)\)/);
|
||||
rgba = rgba[1].split(", ");
|
||||
return {
|
||||
@ -60,8 +60,8 @@ core.colorVariants = function(rgba) {
|
||||
/**
|
||||
* Crée un message de confirmation
|
||||
*/
|
||||
core.confirm = function(text, yesCallback, noCallback) {
|
||||
var lightbox = lity(function($) {
|
||||
core.confirm = function (text, yesCallback, noCallback) {
|
||||
var lightbox = lity(function ($) {
|
||||
return $("<div>")
|
||||
.addClass("lightbox")
|
||||
.append(
|
||||
@ -72,7 +72,7 @@ core.confirm = function(text, yesCallback, noCallback) {
|
||||
$("<a>")
|
||||
.addClass("button grey")
|
||||
.text("<?php echo helper::translate('Non');?>")
|
||||
.on("click", function() {
|
||||
.on("click", function () {
|
||||
lightbox.options('button', true);
|
||||
lightbox.close();
|
||||
if (typeof noCallback !== "undefined") {
|
||||
@ -82,7 +82,7 @@ core.confirm = function(text, yesCallback, noCallback) {
|
||||
$("<a>")
|
||||
.addClass("button")
|
||||
.text("<?php echo helper::translate('Oui');?>")
|
||||
.on("click", function() {
|
||||
.on("click", function () {
|
||||
lightbox.options('button', true);
|
||||
lightbox.close();
|
||||
if (typeof yesCallback !== "undefined") {
|
||||
@ -94,7 +94,7 @@ core.confirm = function(text, yesCallback, noCallback) {
|
||||
}(jQuery));
|
||||
// Callback lors d'un clic sur le fond et sur la croix de fermeture
|
||||
lightbox.options('button', false);
|
||||
$(document).on('lity:close', function(event, instance) {
|
||||
$(document).on('lity:close', function (event, instance) {
|
||||
if (
|
||||
instance.options('button') === false &&
|
||||
typeof noCallback !== "undefined"
|
||||
@ -103,7 +103,7 @@ core.confirm = function(text, yesCallback, noCallback) {
|
||||
}
|
||||
});
|
||||
// Validation de la lightbox avec le bouton entrée
|
||||
$(document).on("keyup", function(event) {
|
||||
$(document).on("keyup", function (event) {
|
||||
if (event.keyCode === 13) {
|
||||
lightbox.close();
|
||||
if (typeof yesCallback !== "undefined") {
|
||||
@ -117,7 +117,7 @@ core.confirm = function(text, yesCallback, noCallback) {
|
||||
/**
|
||||
* Scripts à exécuter en dernier
|
||||
*/
|
||||
core.end = function() {
|
||||
core.end = function () {
|
||||
/**
|
||||
* Modifications non enregistrées du formulaire
|
||||
*/
|
||||
@ -127,24 +127,24 @@ core.end = function() {
|
||||
// - Les champs avec data-no-dirty
|
||||
var inputsDOM = formDOM.find("input:not([data-no-dirty]), select:not([data-no-dirty]), textarea:not(.editorWysiwyg):not([data-no-dirty])");
|
||||
var inputSerialize = inputsDOM.serialize();
|
||||
$(window).on("beforeunload", function() {
|
||||
$(window).on("beforeunload", function () {
|
||||
if (inputsDOM.serialize() !== inputSerialize) {
|
||||
message = "<?php echo helper::translate('Les modifications que vous avez apportées ne seront peut-être pas enregistrées.');?>";
|
||||
return message;
|
||||
}
|
||||
});
|
||||
formDOM.submit(function() {
|
||||
formDOM.submit(function () {
|
||||
$(window).off("beforeunload");
|
||||
});
|
||||
};
|
||||
$(function() {
|
||||
$(function () {
|
||||
core.end();
|
||||
});
|
||||
|
||||
/**
|
||||
* Ajoute une notice
|
||||
*/
|
||||
core.noticeAdd = function(id, notice) {
|
||||
core.noticeAdd = function (id, notice) {
|
||||
$("#" + id + "Notice").text(notice).removeClass("displayNone");
|
||||
$("#" + id).addClass("notice");
|
||||
};
|
||||
@ -152,7 +152,7 @@ core.noticeAdd = function(id, notice) {
|
||||
/**
|
||||
* Supprime une notice
|
||||
*/
|
||||
core.noticeRemove = function(id) {
|
||||
core.noticeRemove = function (id) {
|
||||
$("#" + id + "Notice").text("").addClass("displayNone");
|
||||
$("#" + id).removeClass("notice");
|
||||
};
|
||||
@ -160,18 +160,20 @@ core.noticeRemove = function(id) {
|
||||
/**
|
||||
* Scripts à exécuter en premier
|
||||
*/
|
||||
core.start = function() {
|
||||
core.start = function () {
|
||||
/**
|
||||
* Remonter en haut au clic sur le bouton
|
||||
*/
|
||||
var backToTopDOM = $("#backToTop");
|
||||
backToTopDOM.on("click", function() {
|
||||
$("body, html").animate({ scrollTop: 0 }, "400");
|
||||
backToTopDOM.on("click", function () {
|
||||
$("body, html").animate({
|
||||
scrollTop: 0
|
||||
}, "400");
|
||||
});
|
||||
/**
|
||||
* Affiche / Cache le bouton pour remonter en haut
|
||||
*/
|
||||
$(window).on("scroll", function() {
|
||||
$(window).on("scroll", function () {
|
||||
if ($(this).scrollTop() > 200) {
|
||||
backToTopDOM.fadeIn();
|
||||
} else {
|
||||
@ -183,15 +185,15 @@ core.start = function() {
|
||||
*/
|
||||
var notificationTimer;
|
||||
$("#notification")
|
||||
.on("mouseenter", function() {
|
||||
.on("mouseenter", function () {
|
||||
clearTimeout(notificationTimer);
|
||||
$("#notificationProgress")
|
||||
.stop()
|
||||
.width("100%");
|
||||
})
|
||||
.on("mouseleave", function() {
|
||||
.on("mouseleave", function () {
|
||||
// Disparition de la notification
|
||||
notificationTimer = setTimeout(function() {
|
||||
notificationTimer = setTimeout(function () {
|
||||
$("#notification").fadeOut();
|
||||
}, 3000);
|
||||
// Barre de progression
|
||||
@ -200,7 +202,7 @@ core.start = function() {
|
||||
}, 3000, "linear");
|
||||
})
|
||||
.trigger("mouseleave");
|
||||
$("#notificationClose").on("click", function() {
|
||||
$("#notificationClose").on("click", function () {
|
||||
clearTimeout(notificationTimer);
|
||||
$("#notification").fadeOut();
|
||||
$("#notificationProgress").stop();
|
||||
@ -209,7 +211,7 @@ core.start = function() {
|
||||
/**
|
||||
* Traitement du formulaire cookies
|
||||
*/
|
||||
$("#cookieForm").submit(function(event) {
|
||||
$("#cookieForm").submit(function (event) {
|
||||
|
||||
// Variables des cookies
|
||||
var getUrl = window.location;
|
||||
@ -226,7 +228,7 @@ core.start = function() {
|
||||
/**
|
||||
* Fermeture de la popup des cookies
|
||||
*/
|
||||
$("#cookieConsent .cookieClose").on("click", function() {
|
||||
$("#cookieConsent .cookieClose").on("click", function () {
|
||||
$('#cookieConsent').addClass("displayNone");
|
||||
});
|
||||
|
||||
@ -234,7 +236,7 @@ core.start = function() {
|
||||
* Commande de gestion des cookies dans le footer
|
||||
*/
|
||||
|
||||
$("#footerLinkCookie").on("click", function() {
|
||||
$("#footerLinkCookie").on("click", function () {
|
||||
$("#cookieConsent").removeClass("displayNone");
|
||||
});
|
||||
|
||||
@ -242,10 +244,10 @@ core.start = function() {
|
||||
* Affiche / Cache le menu en mode responsive
|
||||
*/
|
||||
var menuDOM = $("#menu");
|
||||
$("#toggle").on("click", function() {
|
||||
$("#toggle").on("click", function () {
|
||||
menuDOM.slideToggle();
|
||||
});
|
||||
$(window).on("resize", function() {
|
||||
$(window).on("resize", function () {
|
||||
if ($(window).width() > 768) {
|
||||
menuDOM.css("display", "");
|
||||
}
|
||||
@ -254,22 +256,34 @@ core.start = function() {
|
||||
/**
|
||||
* Sélection d'une langue du site
|
||||
*/
|
||||
$("select#barSelectLanguage").on("change", function() {
|
||||
var langUrl = $(this).val();
|
||||
// Récupère la langue sélectionnée dans l'élément 6 d'un tableau
|
||||
var lang = langUrl.split("/");
|
||||
$("select#barSelectLanguage").on("change", function () {
|
||||
// La langue courante ne déclenche pas de chargement
|
||||
var langSelected = $(this).val();
|
||||
var langSelected = langSelected.split("/");
|
||||
// Lit le cookie de langue
|
||||
var langCookie = getCookie('ZWII_CONTENT');
|
||||
// Découpe l'URL pour exclure le changement de page avec le thème
|
||||
var url = window.location;
|
||||
var currentUrl = url.href.split("/");
|
||||
// Change si différent, corrige le problème avec le thème et le rechargement de la langue.
|
||||
if (lang[6] !== langCookie) {
|
||||
$(location).attr("href", langUrl);
|
||||
if (( currentUrl !== "?theme" ||
|
||||
currentUrl !== "theme") &&
|
||||
langSelected[6] !== langCookie
|
||||
) {
|
||||
//$(location).attr("href", langUrl);
|
||||
var select = document.getElementById("barSelectLanguage");
|
||||
var selectedOption = select.options[select.selectedIndex];
|
||||
if (selectedOption.value !== "") {
|
||||
window.location = selectedOption.value;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Choix de page dans la barre de membre
|
||||
*/
|
||||
$("#barSelectPage").on("change", function() {
|
||||
$("#barSelectPage").on("change", function () {
|
||||
var pageUrl = $(this).val();
|
||||
if (pageUrl) {
|
||||
$(location).attr("href", pageUrl);
|
||||
@ -280,7 +294,7 @@ core.start = function() {
|
||||
* Champs d'upload de fichiers
|
||||
*/
|
||||
// Mise à jour de l'affichage des champs d'upload
|
||||
$(".inputFileHidden").on("change", function() {
|
||||
$(".inputFileHidden").on("change", function () {
|
||||
var inputFileHiddenDOM = $(this);
|
||||
var fileName = inputFileHiddenDOM.val();
|
||||
if (fileName === "") {
|
||||
@ -293,31 +307,31 @@ core.start = function() {
|
||||
inputFileHiddenDOM.parent().find(".inputFileLabel").text(fileName);
|
||||
}).trigger("change");
|
||||
// Suppression du fichier contenu dans le champ
|
||||
$(".inputFileDelete").on("click", function() {
|
||||
$(".inputFileDelete").on("click", function () {
|
||||
$(this).parents(".inputWrapper").find(".inputFileHidden").val("").trigger("change");
|
||||
});
|
||||
// Suppression de la date contenu dans le champ
|
||||
$(".inputDateDelete").on("click", function() {
|
||||
$(".inputDateDelete").on("click", function () {
|
||||
$(this).parents(".inputWrapper").find(".datepicker").val("").trigger("change");
|
||||
});
|
||||
// Confirmation de mise à jour
|
||||
$("#barUpdate").on("click", function() {
|
||||
$("#barUpdate").on("click", function () {
|
||||
message = "<?php echo helper::translate('Mettre à jour') . ' ?';?>";
|
||||
return core.confirm(message, function() {
|
||||
return core.confirm(message, function () {
|
||||
$(location).attr("href", $("#barUpdate").attr("href"));
|
||||
});
|
||||
});
|
||||
// Confirmation de déconnexion
|
||||
$("#barLogout").on("click", function() {
|
||||
$("#barLogout").on("click", function () {
|
||||
message = "<?php echo helper::translate('Se déconnecter') . '?';?>";
|
||||
return core.confirm(message, function() {
|
||||
return core.confirm(message, function () {
|
||||
$(location).attr("href", $("#barLogout").attr("href"));
|
||||
});
|
||||
});
|
||||
/**
|
||||
* Bloque la multi-soumission des boutons
|
||||
*/
|
||||
$("form").on("submit", function() {
|
||||
$("form").on("submit", function () {
|
||||
$(this).find(".uniqueSubmission")
|
||||
.addClass("disabled")
|
||||
.prop("disabled", true)
|
||||
@ -329,7 +343,7 @@ core.start = function() {
|
||||
/**
|
||||
* Check adresse email
|
||||
*/
|
||||
$("[type=email]").on("change", function() {
|
||||
$("[type=email]").on("change", function () {
|
||||
var _this = $(this);
|
||||
var 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;
|
||||
if (pattern.test(_this.val())) {
|
||||
@ -345,7 +359,7 @@ core.start = function() {
|
||||
*/
|
||||
var elementDOM = $("iframe, video, embed, object");
|
||||
// Calcul du ratio et suppression de la hauteur / largeur des iframes
|
||||
elementDOM.each(function() {
|
||||
elementDOM.each(function () {
|
||||
var _this = $(this);
|
||||
_this
|
||||
.data("ratio", _this.height() / _this.width())
|
||||
@ -353,11 +367,13 @@ core.start = function() {
|
||||
.removeAttr("width height");
|
||||
});
|
||||
// Prend la largeur du parent et détermine la hauteur à l'aide du ratio lors du resize de la fenêtre
|
||||
$(window).on("resize", function() {
|
||||
elementDOM.each(function() {
|
||||
$(window).on("resize", function () {
|
||||
elementDOM.each(function () {
|
||||
var _this = $(this);
|
||||
var width = _this.parent().first().width();
|
||||
if (width > _this.data("maxwidth")) { width = _this.data("maxwidth"); }
|
||||
if (width > _this.data("maxwidth")) {
|
||||
width = _this.data("maxwidth");
|
||||
}
|
||||
_this
|
||||
.width(width)
|
||||
.height(width * _this.data("ratio"));
|
||||
@ -367,7 +383,7 @@ core.start = function() {
|
||||
/*
|
||||
* Header responsive
|
||||
*/
|
||||
$(window).on("resize", function() {
|
||||
$(window).on("resize", function () {
|
||||
var responsive = "<?php echo $this->getdata(['theme','header','imageContainer']);?>";
|
||||
if (responsive === "cover" || responsive === "contain") {
|
||||
var widthpx = "<?php echo $this->getdata(['theme','site','width']);?>";
|
||||
@ -391,10 +407,10 @@ core.start();
|
||||
/**
|
||||
* Confirmation de suppression
|
||||
*/
|
||||
$("#pageDelete").on("click", function() {
|
||||
$("#pageDelete").on("click", function () {
|
||||
var _this = $(this);
|
||||
message = "<?php echo helper::translate('Confirmez-vous la suppression de cette page ?');?>";
|
||||
return core.confirm(message, function() {
|
||||
return core.confirm(message, function () {
|
||||
$(location).attr("href", _this.attr("href"));
|
||||
});
|
||||
});
|
||||
@ -403,7 +419,7 @@ $("#pageDelete").on("click", function() {
|
||||
/**
|
||||
* Calcul de la luminance relative d'une couleur
|
||||
*/
|
||||
core.relativeLuminanceW3C = function(rgba) {
|
||||
core.relativeLuminanceW3C = function (rgba) {
|
||||
// Conversion en sRGB
|
||||
var RsRGB = rgba[0] / 255;
|
||||
var GsRGB = rgba[1] / 255;
|
||||
@ -447,17 +463,25 @@ function capitalizeFirstLetter(string) {
|
||||
}
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
$(document).ready(function () {
|
||||
/**
|
||||
* Affiche le sous-menu quand il est sticky
|
||||
*/
|
||||
$("nav").mouseenter(function() {
|
||||
$("#navfixedlogout .navSub").css({ 'pointer-events': 'auto' });
|
||||
$("#navfixedconnected .navSub").css({ 'pointer-events': 'auto' });
|
||||
$("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' });
|
||||
$("nav").mouseleave(function () {
|
||||
$("#navfixedlogout .navSub").css({
|
||||
'pointer-events': 'none'
|
||||
});
|
||||
$("#navfixedconnected .navSub").css({
|
||||
'pointer-events': 'none'
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
@ -468,7 +492,7 @@ $(document).ready(function() {
|
||||
/**
|
||||
* Effet accordéon
|
||||
*/
|
||||
$('.accordion').each(function(e) {
|
||||
$('.accordion').each(function (e) {
|
||||
// on stocke l'accordéon dans une variable locale
|
||||
var accordion = $(this);
|
||||
// on récupère la valeur data-speed si elle existe
|
||||
@ -493,7 +517,7 @@ $(document).ready(function() {
|
||||
open(accordion.find('.active:first'), 0);
|
||||
|
||||
// au clic sur un titre...
|
||||
accordion.on('click', '.accordion-title', function(ev) {
|
||||
accordion.on('click', '.accordion-title', function (ev) {
|
||||
ev.preventDefault();
|
||||
// Masquer l'élément déjà actif
|
||||
if ($(this).closest('.accordion-item').hasClass('active')) {
|
||||
@ -508,7 +532,7 @@ $(document).ready(function() {
|
||||
/**
|
||||
* Icône du Menu Burger
|
||||
*/
|
||||
$("#toggle").click(function() {
|
||||
$("#toggle").click(function () {
|
||||
var changeIcon = $('#toggle').children("span");
|
||||
if ($(changeIcon).hasClass('zwiico-menu')) {
|
||||
$(changeIcon).removeClass('zwiico-menu').addClass('zwiico-cancel');
|
||||
|
@ -2118,7 +2118,7 @@ class common
|
||||
}
|
||||
}
|
||||
if ($c > 1) {
|
||||
$leftItems .= '<li><select id="barSelectLanguage">';
|
||||
$leftItems .= '<li><select id="barSelectLanguage" >';
|
||||
$leftItems .= $leftItem;
|
||||
$leftItems .= '</select></li>';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user