From 8d713b34e4f74fe7370fe7466c4eec2c33364eb0 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Sun, 10 Nov 2019 20:12:41 +0100 Subject: [PATCH 1/2] =?UTF-8?q?[9.2.10]=20Afficher=20les=20infos=20sur=20l?= =?UTF-8?q?'image=20et=20hauteur=20de=20la=20banni=C3=A8re=20image?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/module/theme/theme.php | 7 ++-- core/module/theme/view/header/header.js.php | 39 ++++++++++++--------- core/module/theme/view/header/header.php | 12 ++++--- 3 files changed, 33 insertions(+), 25 deletions(-) diff --git a/core/module/theme/theme.php b/core/module/theme/theme.php index 0f746f6b..34d641d2 100755 --- a/core/module/theme/theme.php +++ b/core/module/theme/theme.php @@ -118,7 +118,7 @@ class theme extends common { '2.4vmax' => 'Très grande (240%)' ]; public static $headerHeights = [ - /* 'none' => 'Hauteur de l\'image',*/ + 'none' => 'Hauteur de l\'image sélectionnée', '100px' => 'Très petite (100px) ', '150px' => 'Petite (150px)', '200px' => 'Moyenne (200px)', @@ -216,10 +216,9 @@ class theme extends common { ]; public static $headerWide = [ 'auto auto' => 'Automatique', - '100% 100%' => 'Image étirée (100% 100%)', - '100% auto' => 'Responsive (100% auto)', 'cover' => 'Responsive (cover)', - 'contain' => 'Responsive (contain)' + '100% 100%' => 'Image étirée (100% 100%)', + 'contain' => 'Responsive (contain)' ]; public static $footerTemplate = [ '1' => 'Une seule colonne', diff --git a/core/module/theme/view/header/header.js.php b/core/module/theme/view/header/header.js.php index d85728da..36a20a6f 100755 --- a/core/module/theme/view/header/header.js.php +++ b/core/module/theme/view/header/header.js.php @@ -12,19 +12,30 @@ * @link http://zwiicms.com/ */ - - /** * Aperçu en direct */ -$("input, select").on("change", function() { +$("input, select, .lity-iframe").on("change", function() { - // Récupérer la taille de l'image - /* - var tmpImg = new Image(); - var url = "" + "site/file/source/" + $("#themeHeaderImage").val(); - tmpImg.src= url; - */ + // Récupérer la taille de l'image + + var tmpImg = new Image(); + tmpImg.src= "" + "site/file/source/" + $("#themeHeaderImage").val(); + + // Informations affichées + $("#themeHeaderImageHeight").html(tmpImg.height + "px"); + $("#themeHeaderImageWidth").html(tmpImg.width + "px"); + + // Limiter la hauteur à 600 px + if (tmpImg.height > 600) { + tmpImgHeight = 600; + } else { + tmpImgHeight = tmpImg.height; + } + + //Modifier la dropdown liste + $("#themeHeaderHeight option:eq(0)").val(tmpImgHeight + "px"); + $("#themeHeaderHeight option:first-child").html("Hauteur de l\'image sélectionnée (" + tmpImgHeight + "px)"); // Import des polices de caractères var headerFont = $("#themeHeaderFont").val(); @@ -41,14 +52,10 @@ $("input, select").on("change", function() { } else { // Désactiver l'option responsive css += "background-image:none;"; - //$("header .container").show(); - } - /*if ($("#themeHeaderHeight").val() !== "none") {*/ - css += "line-height:" + $("#themeHeaderHeight").val() + ";height:" + $("#themeHeaderHeight").val() + "}"; - /*} else { - css += "line-height:" + tmpImg.height + ";height:" + tmpImg.height + "}"; - }*/ + + css += "line-height:" + $("#themeHeaderHeight").val() + ";height:" + $("#themeHeaderHeight").val() + "}"; + // Taille, couleur, épaisseur et capitalisation du titre de la bannière css += "header span{color:" + $("#themeHeaderTextColor").val() + ";font-family:'" + headerFont.replace(/\+/g, " ") + "',sans-serif;font-weight:" + $("#themeHeaderFontWeight").val() + ";font-size:" + $("#themeHeaderFontSize").val() + ";text-transform:" + $("#themeHeaderTextTransform").val() + "}"; diff --git a/core/module/theme/view/header/header.php b/core/module/theme/view/header/header.php index 990d3457..be416313 100755 --- a/core/module/theme/view/header/header.php +++ b/core/module/theme/view/header/header.php @@ -51,6 +51,7 @@ 'type' => 1, 'value' => $imageFile ]); ?> + Largeur - Hauteur
@@ -75,16 +76,16 @@
-
+
$this->getData(['theme', 'header', 'textHide']) ]); ?>
-
+
$this->getData(['theme', 'header', 'linkHomePage']) - ]); ?> -
+ ]); ?> +
@@ -104,7 +105,8 @@
'Hauteur', - 'selected' => $this->getData(['theme', 'header', 'height']) + 'selected' => $this->getData(['theme', 'header', 'height']), + 'help' => "La hauteur maximale est de 600 pixels lorsque l'option \'Hauteur de l\'image\' est sélectionnée." ]); ?>
From 16b911d4892954bef39c28b6dfcd80b0fe366f60 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Sun, 10 Nov 2019 20:55:30 +0100 Subject: [PATCH 2/2] =?UTF-8?q?[9.2.10]=20Afficher=20les=20infos=20sur=20l?= =?UTF-8?q?'image=20et=20hauteur=20de=20la=20banni=C3=A8re=20image?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/module/theme/view/header/header.js.php | 40 +++++++++++---------- core/module/theme/view/header/header.php | 8 +++-- 2 files changed, 27 insertions(+), 21 deletions(-) diff --git a/core/module/theme/view/header/header.js.php b/core/module/theme/view/header/header.js.php index 36a20a6f..13311523 100755 --- a/core/module/theme/view/header/header.js.php +++ b/core/module/theme/view/header/header.js.php @@ -12,16 +12,18 @@ * @link http://zwiicms.com/ */ + + /** * Aperçu en direct */ -$("input, select, .lity-iframe").on("change", function() { +$("input, select").on("change", function() { - // Récupérer la taille de l'image - - var tmpImg = new Image(); - tmpImg.src= "" + "site/file/source/" + $("#themeHeaderImage").val(); + // Récupérer la taille de l'image + var tmpImg = new Image(); + + tmpImg.onload = function() { // Informations affichées $("#themeHeaderImageHeight").html(tmpImg.height + "px"); $("#themeHeaderImageWidth").html(tmpImg.width + "px"); @@ -34,8 +36,21 @@ $("input, select, .lity-iframe").on("change", function() { } //Modifier la dropdown liste - $("#themeHeaderHeight option:eq(0)").val(tmpImgHeight + "px"); - $("#themeHeaderHeight option:first-child").html("Hauteur de l\'image sélectionnée (" + tmpImgHeight + "px)"); + if ($("#themeHeaderImage").val() !== "") { + // Une image est ajoutée ou changée + if ($("#themeHeaderHeight option").length === 4) { + $("#themeHeaderHeight ").prepend(''); + } + // Modifier la valeur + $("#themeHeaderHeight option:eq(0)").val(tmpImgHeight + "px"); + // Modifier l'option + $("#themeHeaderHeight option:first-child").html("Hauteur de l\'image sélectionnée (" + tmpImgHeight + "px)"); + } else { + $("#themeHeaderHeight option:first-child").html("Hauteur de l\'image sélectionnée"); + } + }; + + tmpImg.src= "" + "site/file/source/" + $("#themeHeaderImage").val(); // Import des polices de caractères var headerFont = $("#themeHeaderFont").val(); @@ -119,17 +134,6 @@ $("input, select, .lity-iframe").on("change", function() { .appendTo("head"); }).trigger("change"); -/** - -$("#themeHeaderHeight").on("change", function() { - if($(this).val() === 'none') { - $("#themeHeaderTextHide").prop("disabled", true); - $("#themeHeaderTextHide").prop("checked", true).trigger("change"); - } else { - $("#themeHeaderTextHide").prop("disabled", false); - } -}).trigger("change"); -*/ // Affiche / Cache les options de l'image du fond diff --git a/core/module/theme/view/header/header.php b/core/module/theme/view/header/header.php index be416313..a0ad4192 100755 --- a/core/module/theme/view/header/header.php +++ b/core/module/theme/view/header/header.php @@ -51,7 +51,6 @@ 'type' => 1, 'value' => $imageFile ]); ?> - Largeur - Hauteur
@@ -85,7 +84,10 @@ $this->getData(['theme', 'header', 'linkHomePage']) ]); ?> -
+ +
+ (largeur: ; hauteur:) +
@@ -106,7 +108,7 @@ 'Hauteur', 'selected' => $this->getData(['theme', 'header', 'height']), - 'help' => "La hauteur maximale est de 600 pixels lorsque l'option \'Hauteur de l\'image\' est sélectionnée." + 'help' => "Quelque soit la taille de la bannière, la hauteur maximale autorisée est de 600 pixels." ]); ?>