2022-01-31 09:10:49 +01:00
|
|
|
/**
|
|
|
|
* This file is part of DeltaCMS.
|
|
|
|
* For full copyright and license information, please see the LICENSE
|
|
|
|
* file that was distributed with this source code.
|
|
|
|
* @author Sylvain Lelièvre <lelievresylvain@free.fr>
|
|
|
|
* @copyright Copyright (C) 2021-2022, Sylvain Lelièvre
|
|
|
|
* @license GNU General Public License, version 3
|
|
|
|
* @link https://deltacms.fr/
|
|
|
|
*
|
|
|
|
* Delta was created from version 11.2.00.24 of ZwiiCMS
|
|
|
|
* @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-2021, Frédéric Tempez
|
|
|
|
*/
|
2022-10-10 09:10:39 +02:00
|
|
|
|
2022-01-31 09:10:49 +01:00
|
|
|
|
2022-10-10 09:10:39 +02:00
|
|
|
var tmpImg = new Image();
|
|
|
|
|
|
|
|
|
|
|
|
$(document).ready(function(){
|
2022-01-31 09:10:49 +01:00
|
|
|
$("header").css("line-height", "");
|
|
|
|
$("header").css("height", "");
|
|
|
|
});
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Aperçu en direct
|
|
|
|
*/
|
|
|
|
$("input, select").on("change", function() {
|
|
|
|
|
|
|
|
var css = "";
|
|
|
|
|
|
|
|
// Contenu perso
|
|
|
|
if ($("#themeHeaderFeature").val() == "feature") {
|
2022-10-10 09:10:39 +02:00
|
|
|
// $("#themeHeaderHeight").val() unset pour 'Hauteur du contenu', sinon valeur en px
|
|
|
|
css = "header{min-height: 20px; height:" + $("#themeHeaderHeight").val() + "; overflow:hidden; background-position:top; background-repeat: no-repeat; line-height:1.15; background-color:unset; background-image:unset; text-align:unset;}";
|
2022-01-31 09:10:49 +01:00
|
|
|
|
|
|
|
$("#featureContent").appendTo("header").show();
|
|
|
|
$("#themeHeaderTitle").hide();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Couleurs, image, alignement et hauteur de la bannière
|
|
|
|
if ($("#themeHeaderFeature").val() == "wallpaper") {
|
2022-10-10 09:10:39 +02:00
|
|
|
|
2022-01-31 09:10:49 +01:00
|
|
|
// Masque le contenu perso
|
|
|
|
$("#featureContent").hide();
|
2022-10-10 09:10:39 +02:00
|
|
|
|
|
|
|
tmpImg.src= "<?php echo helper::baseUrl(false); ?>" + "site/file/source/" + $("#themeHeaderImage").val();
|
|
|
|
// Déterminer la taille de l'image
|
2022-01-31 09:10:49 +01:00
|
|
|
tmpImg.onload = function() {
|
|
|
|
// Informations affichées
|
|
|
|
$("#themeHeaderImageHeight").html(tmpImg.height + "px");
|
|
|
|
$("#themeHeaderImageWidth").html(tmpImg.width + "px");
|
|
|
|
$("#themeHeaderImageRatio").html(tmpImg.width / tmpImg.height);
|
|
|
|
};
|
2022-10-10 09:10:39 +02:00
|
|
|
|
2022-01-31 09:10:49 +01:00
|
|
|
var headerFont = $("#themeHeaderFont").val();
|
2022-10-10 09:10:39 +02:00
|
|
|
css = "header{text-align:" + $("#themeHeaderTextAlign").val() + ";";
|
|
|
|
|
|
|
|
// Sélection d'une image réalisée
|
|
|
|
if( $("#themeHeaderImage").val() !== ""){
|
|
|
|
|
|
|
|
css += "background-image:url('<?php echo helper::baseUrl(false); ?>site/file/source/" + $("#themeHeaderImage").val() + "');background-repeat:" + $("#themeHeaderImageRepeat").val() + ";background-position:" + $("#themeHeaderImagePosition").val() + ";";
|
|
|
|
css += "background-size:" + $("#themeHeaderImageContainer").val() + ";";
|
|
|
|
if( $("#themeHeaderHeight").val() !== 'unset'){
|
|
|
|
css += "line-height:" + $("#themeHeaderHeight").val() + ";height:" + $("#themeHeaderHeight").val() + "}";
|
2022-01-31 09:10:49 +01:00
|
|
|
} else {
|
2022-10-10 09:10:39 +02:00
|
|
|
// valeur unset remplacée par la hauteur de l'image
|
|
|
|
tmpImg.src= "<?php echo helper::baseUrl(false); ?>" + "site/file/source/" + $("#themeHeaderImage").val();
|
|
|
|
css += "line-height:" + tmpImg.height + "px" + ";height:" + tmpImg.height + "px" + "}";
|
2022-01-31 09:10:49 +01:00
|
|
|
}
|
2022-10-10 09:10:39 +02:00
|
|
|
} else {
|
|
|
|
// Pas d'image sélectionnée
|
|
|
|
css += "background-image:none;";
|
|
|
|
css += "min-height: 20px;line-height:" + $("#themeHeaderHeight").val() + "; height:" + $("#themeHeaderHeight").val() + "}";
|
|
|
|
}
|
2022-01-31 09:10:49 +01:00
|
|
|
|
|
|
|
// Taille, couleur, épaisseur et capitalisation du titre de la bannière
|
|
|
|
css += "header span{font-family:'" + headerFont.replace(/\+/g, " ") + "',sans-serif;font-weight:" + $("#themeHeaderFontWeight").val() + ";font-size:" + $("#themeHeaderFontSize").val() + ";text-transform:" + $("#themeHeaderTextTransform").val() + ";color:" + $("#themeHeaderTextColor").val() + "}";
|
|
|
|
|
|
|
|
// Cache le titre de la bannière
|
|
|
|
if($("#themeHeaderTextHide").is(":checked")) {
|
|
|
|
$("#themeHeaderTitle").hide();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$("#themeHeaderTitle").show();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Couleur du fond
|
|
|
|
css += "header{background-color:" + $("#themeHeaderBackgroundColor").val() + ";}";
|
|
|
|
|
|
|
|
|
|
|
|
// Position de la bannière
|
|
|
|
var positionNav = <?php echo json_encode($this->getData(['theme', 'menu', 'position'])); ?>;
|
|
|
|
var positionHeader = $("#themeHeaderPosition").val();
|
|
|
|
|
|
|
|
switch(positionHeader) {
|
|
|
|
case 'hide':
|
|
|
|
$("nav").show().prependTo("#site");
|
2022-10-10 09:10:39 +02:00
|
|
|
$("header").hide();
|
2022-01-31 09:10:49 +01:00
|
|
|
break;
|
|
|
|
case 'site':
|
|
|
|
$("header").show().prependTo("#site");
|
|
|
|
// Position du menu
|
|
|
|
switch (positionNav) {
|
|
|
|
case "body-first":
|
|
|
|
$("nav").show().insertAfter("header");
|
|
|
|
break;
|
|
|
|
case "site-first":
|
|
|
|
$("nav").show().prependTo("#site");
|
|
|
|
// Supprime le margin en trop du menu
|
|
|
|
if(<?php echo json_encode($this->getData(['theme', 'menu', 'margin'])); ?>) {
|
|
|
|
css += 'nav{margin:0 20px}';
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case "body-second":
|
|
|
|
case "site-second":
|
|
|
|
$("nav").show().insertAfter("header");
|
|
|
|
// Supprime le margin en trop du menu
|
|
|
|
if(<?php echo json_encode($this->getData(['theme', 'menu', 'margin'])); ?>) {
|
|
|
|
css += 'nav{margin:0 20px}';
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'body':
|
|
|
|
// Position du menu
|
|
|
|
switch (positionNav) {
|
|
|
|
case "top":
|
|
|
|
$("header").show().insertAfter("nav");
|
|
|
|
break;
|
|
|
|
case "site-first":
|
|
|
|
case "body-first":
|
|
|
|
$("header").show().insertAfter("#bar");
|
|
|
|
$("nav").show().insertAfter("#bar");
|
|
|
|
break;
|
|
|
|
case "site-second":
|
|
|
|
case "body-second":
|
|
|
|
$("header").show().insertAfter("#bar");
|
|
|
|
$("nav").show().insertAfter("header");
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Marge dans le site
|
|
|
|
if( $("#themeHeaderMargin").is(":checked") &&
|
|
|
|
$("#themeHeaderPosition").val() === "site"
|
|
|
|
) {
|
|
|
|
css += 'header{margin:20px 20px 0 20px !important;}';
|
|
|
|
/*} else {
|
|
|
|
css += 'header{margin:0 !important;}';*/
|
|
|
|
}
|
|
|
|
|
|
|
|
// Largeur du header
|
|
|
|
switch ($("#themeHeaderWide").val()) {
|
|
|
|
case "container":
|
|
|
|
$("header").addClass("container");
|
|
|
|
break;
|
|
|
|
case "none":
|
|
|
|
$("header").removeClass("container");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// La bannière est cachée, déplacer le menu dans le site
|
|
|
|
if (positionHeader === "hide" &&
|
|
|
|
(positionNav === "body-first" ||
|
|
|
|
positionNav === "site-first" ||
|
|
|
|
positionNav === "body-second" ||
|
|
|
|
positionNav === "site-second"
|
|
|
|
)) {
|
|
|
|
$("nav").show().prependTo("#site");
|
|
|
|
}
|
|
|
|
|
|
|
|
// Ajout du css au DOM
|
|
|
|
$("#themePreview").remove();
|
|
|
|
$("<style>")
|
|
|
|
.attr("type", "text/css")
|
|
|
|
.attr("id", "themePreview")
|
|
|
|
.text(css)
|
|
|
|
.appendTo("head");
|
|
|
|
}).trigger("change");
|
|
|
|
|
|
|
|
// Affiche / Cache les options de l'image du fond
|
|
|
|
$("#themeHeaderImage").on("change", function() {
|
|
|
|
if($(this).val()) {
|
|
|
|
$("#themeHeaderImageOptions").slideDown();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$("#themeHeaderImageOptions").slideUp(function() {
|
2022-10-10 09:10:39 +02:00
|
|
|
// $("#themeHeaderTextHide").prop("checked", false).trigger("change");
|
2022-01-31 09:10:49 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}).trigger("change");
|
|
|
|
|
|
|
|
// Affiche / Cache les options de la position
|
|
|
|
$("#themeHeaderPosition").on("change", function() {
|
|
|
|
if($(this).val() === 'site') {
|
|
|
|
$("#themeHeaderContainerWrapper").slideUp();
|
|
|
|
$("#themeHeaderPositionOptions").slideDown();
|
|
|
|
$("#themeHeaderWideWrapper").slideUp();
|
|
|
|
$("#themeHeaderMarginWrapper").slideDown();
|
|
|
|
}
|
|
|
|
else if ($(this).val() === 'hide') {
|
|
|
|
$("#themeHeaderContainerWrapper").slideUp();
|
|
|
|
$("#themeHeaderWideWrapper").slideUp();
|
|
|
|
$("#themeHeaderMarginWrapper").slideUp();
|
|
|
|
$("#themeHeaderMargin").prop("checked", false);
|
|
|
|
$("#themeHeaderPositionOptions").slideUp(function() {
|
|
|
|
$("#themeHeaderMargin").prop("checked", false).trigger("change");
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
$("#themeHeaderWideWrapper").slideDown();
|
|
|
|
$("#themeHeaderMarginWrapper").slideUp();
|
|
|
|
$("#themeHeaderMargin").prop("checked", false);
|
|
|
|
}
|
|
|
|
}).trigger("change");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Affiche / Cache l'option bannière masquée en écran réduit
|
|
|
|
$("#themeHeaderPosition").on("change", function() {
|
|
|
|
if($(this).val() === 'hide') {
|
|
|
|
$("#themeHeaderSmallDisplay").slideUp();
|
2022-10-10 09:10:39 +02:00
|
|
|
$("#themeHeaderHomePage").slideUp();
|
2022-01-31 09:10:49 +01:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
$("#themeHeaderSmallDisplay").slideDown();
|
2022-10-10 09:10:39 +02:00
|
|
|
$("#themeHeaderHomePage").slideDown();
|
2022-01-31 09:10:49 +01:00
|
|
|
}
|
|
|
|
}).trigger("change");
|
|
|
|
|
|
|
|
// Affiche les blocs selon le type bannière
|
|
|
|
$("#themeHeaderFeature").on("change", function() {
|
|
|
|
if($(this).val() === 'wallpaper') {
|
|
|
|
$(".wallpaperContainer").show();
|
|
|
|
$(".featureContainer").hide();
|
|
|
|
$("#themeHeaderTextColorWrapper").show();
|
|
|
|
}
|
|
|
|
if($(this).val() === 'feature') {
|
|
|
|
$(".featureContainer").show();
|
|
|
|
$(".wallpaperContainer").hide();
|
|
|
|
$("#themeHeaderTextColorWrapper").hide();
|
|
|
|
}
|
|
|
|
}).trigger("change");
|