2018-04-02 08:29:19 +02:00
|
|
|
/**
|
2021-02-17 13:51:12 +01:00
|
|
|
* This file is part of Zwii.
|
2018-04-02 08:29:19 +02:00
|
|
|
* 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
|
2021-02-17 13:49:58 +01:00
|
|
|
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
2023-01-09 10:23:32 +01:00
|
|
|
* @copyright Copyright (C) 2018-2023, Frédéric Tempez
|
2022-12-29 17:02:20 +01:00
|
|
|
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
|
2020-09-01 20:48:40 +02:00
|
|
|
* @link http://zwiicms.fr/
|
2018-04-02 08:29:19 +02:00
|
|
|
*/
|
|
|
|
|
2021-11-09 13:29:53 +01:00
|
|
|
/**
|
|
|
|
* Aperçu en direct
|
2020-03-16 10:20:25 +01:00
|
|
|
*/
|
2021-11-09 13:29:20 +01:00
|
|
|
$("input, select").on("change",function() {
|
2020-05-21 08:01:28 +02:00
|
|
|
|
2020-05-08 21:14:29 +02:00
|
|
|
/**
|
|
|
|
* Option de marge si la taille n'est pas fluide
|
|
|
|
*/
|
|
|
|
if ($('#themeSiteWidth').val() === '100%') {
|
2021-11-09 13:29:53 +01:00
|
|
|
$("#themeSiteMarginWrapper").prop("checked", true);
|
|
|
|
$("#themeSiteMarginWrapper").hide();
|
2020-05-08 21:14:29 +02:00
|
|
|
} else {
|
2021-11-09 13:29:53 +01:00
|
|
|
$("#themeSiteMarginWrapper").show();
|
2020-05-08 21:14:29 +02:00
|
|
|
}
|
2020-05-21 08:01:28 +02:00
|
|
|
|
2022-04-21 18:38:19 +02:00
|
|
|
|
2020-05-18 10:50:43 +02:00
|
|
|
/**
|
|
|
|
* Aperçu dans la boîte
|
|
|
|
*/
|
2020-03-21 18:08:04 +01:00
|
|
|
|
2022-04-21 18:38:19 +02:00
|
|
|
// Import des polices de caractères pour l'aperçu en temps réel
|
2022-02-04 16:26:39 +01:00
|
|
|
var titleFont = $("#themeTitleFont :selected").val();
|
|
|
|
var titleFontText = $("#themeTitleFont :selected").text();
|
|
|
|
var textFont = $("#themeTextFont :selected").val();
|
|
|
|
var textFontText = $("#themeTextFont :selected").text();
|
2021-02-09 11:45:10 +01:00
|
|
|
// Couleurs des boutons
|
|
|
|
var colors = core.colorVariants($("#themeButtonBackgroundColor").val());
|
2022-04-21 18:38:19 +02:00
|
|
|
var css = ".button.buttonSubmitPreview{background-color:" + colors.normal + ";}";
|
2020-05-18 10:50:43 +02:00
|
|
|
css += ".button.buttonSubmitPreview:hover{background-color:" + colors.darken + "}";
|
|
|
|
css += ".button.buttonSubmitPreview{color:" + colors.text + ";}";
|
2020-03-21 18:08:04 +01:00
|
|
|
|
2020-05-18 10:50:43 +02:00
|
|
|
// Couleurs des liens
|
|
|
|
var colors = core.colorVariants($("#themeTextLinkColor").val());
|
|
|
|
css += "a.urlPreview{color:" + colors.normal + "}";
|
|
|
|
css += "a.urlPreview:hover{color:" + colors.darken + "}";
|
|
|
|
// Couleur, polices, épaisseur et capitalisation de caractères des titres
|
2022-02-04 16:26:39 +01:00
|
|
|
css += ".headerPreview,.headerPreview{color:" + $("#themeTitleTextColor").val() + ";font-family:'" + titleFontText + "',sans-serif;font-weight:" + $("#themeTitleFontWeight").val() + ";text-transform:" + $("#themeTitleTextTransform").val() + "}";
|
2020-05-18 10:50:43 +02:00
|
|
|
// Police de caractères
|
|
|
|
// Police + couleur
|
2022-02-04 16:26:39 +01:00
|
|
|
css += ".textPreview,.urlPreview{color:" + $("#themeTextTextColor").val() + ";font-family:'" + textFontText + "',sans-serif; font-size:" + $("#themeTextFontSize").val() + ";}";
|
2020-05-18 10:50:43 +02:00
|
|
|
// Couleur des liens
|
|
|
|
//css += "a.preview,.buttonSubmitPreview{font-family:'" + textFont.replace(/\+/g, " ") + "',sans-serif}";
|
2020-03-22 15:44:29 +01:00
|
|
|
|
2020-05-18 10:50:43 +02:00
|
|
|
// Taille du texte
|
|
|
|
// Couleur du texte
|
|
|
|
css += "p.preview{color:" + $("#themeTextTextColor").val() + "}";
|
2020-03-21 18:08:04 +01:00
|
|
|
|
2020-05-18 10:50:43 +02:00
|
|
|
/**
|
|
|
|
* Aperçu réel
|
|
|
|
*/
|
2020-03-21 18:08:04 +01:00
|
|
|
|
2020-05-18 10:50:43 +02:00
|
|
|
// Taille du site
|
|
|
|
if ($("#themeSiteWidth").val() === "750px") {
|
|
|
|
css += ".button, button{font-size:0.8em;}";
|
|
|
|
} else {
|
|
|
|
css += ".button, button{font-size:1em;}";
|
|
|
|
}
|
2023-03-08 09:48:19 +01:00
|
|
|
// Largeur
|
2020-05-18 10:50:43 +02:00
|
|
|
var margin = $("#themeSiteMargin").is(":checked") ? 0 : '20px' ;
|
|
|
|
css += ".container{max-width:" + $("#themeSiteWidth").val() + "}";
|
|
|
|
if ($("#themeSiteWidth").val() === "100%") {
|
|
|
|
css += "#site{margin: 0px auto;} body{margin:0 auto;} #bar{margin:0 auto;} body > header{margin:0 auto;} body > nav {margin: 0 auto;} body > footer {margin:0 auto;}";
|
|
|
|
} else {
|
|
|
|
css += "#site{margin: " + margin + " auto !important;} body{margin:0px 10px;} #bar{margin: 0 -10px;} body > header{margin: 0 -10px;} body > nav {margin: 0 -10px;} body > footer {margin: 0 -10px;} ";
|
|
|
|
}
|
|
|
|
// Couleur du site, arrondi sur les coins du site et ombre sur les bords du site
|
|
|
|
//css += "#site{background-color:" + $("#themeSiteBackgroundColor").val() + ";border-radius:" + $("#themeSiteRadius").val() + ";box-shadow:" + $("#themeSiteShadow").val() + " #212223}";
|
2021-02-09 11:45:10 +01:00
|
|
|
|
|
|
|
css += "#site{border-radius:" + $("#themeSiteRadius").val() + ";box-shadow:" + $("#themeSiteShadow").val() + " #212223}";
|
|
|
|
|
|
|
|
// Couleur ou image de fond
|
2022-02-07 13:50:40 +01:00
|
|
|
var backgroundImage = <?php echo json_encode($this->getData(['theme','body','image'])); ?>;
|
2021-02-09 11:45:10 +01:00
|
|
|
var backgroundcolor = <?php echo json_encode($this->getdata(['theme','body','backgroundColor'])); ?>;
|
2022-02-02 18:27:42 +01:00
|
|
|
if(backgroundImage ) {
|
2022-02-07 13:50:40 +01:00
|
|
|
css += "div.bodybackground{background-image:url(" + window.location.origin + window.location.pathname + '/site/file/source/' + backgroundImage + ");background-repeat:" + $("#themeBodyImageRepeat").val() + ";background-position:" + $("#themeBodyImagePosition").val() + ";background-attachment:" + $("#themeBodyImageAttachment").val() + ";background-size:" + $("#themeBodyImageSize").val() + "}";
|
2021-02-09 11:45:10 +01:00
|
|
|
css += "div.bodybackground{background-color:rgba(0,0,0,0);}";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
css += "div.bodybackground{background-image:none}";
|
|
|
|
}
|
2022-02-02 18:27:42 +01:00
|
|
|
css += 'div.bodybackground {background-color:' + backgroundcolor + ';color:' + $("#themeBodyToTopColor").val() + ';}';
|
2021-02-09 11:45:10 +01:00
|
|
|
|
2020-05-18 10:50:43 +02:00
|
|
|
css += "div.bgPreview{padding: 5px;background-color:" + $("#themeSiteBackgroundColor").val() + ";}";
|
2021-02-09 11:45:10 +01:00
|
|
|
|
2020-05-18 10:50:43 +02:00
|
|
|
// Les blocs
|
2020-03-21 18:08:04 +01:00
|
|
|
|
2021-02-09 11:45:10 +01:00
|
|
|
var colors = core.colorVariants($("#themeBlockBackgroundColor").val());
|
2020-05-18 10:50:43 +02:00
|
|
|
css += ".block.preview {padding: 20px 20px 10px;margin: 20px 0; word-wrap: break-word;border-radius: 2px;border: 1px solid " + $("#themeBlockBorderColor").val() + ";}.block.preview h4.preview {background: " + colors.normal + ";color:" + colors.text + ";margin: -20px -20px 10px -20px; padding: 10px;}";
|
2020-03-21 18:08:04 +01:00
|
|
|
|
2020-05-18 10:50:43 +02:00
|
|
|
/**
|
|
|
|
* Injection dans le DOM
|
|
|
|
*/
|
|
|
|
// Ajout du css au DOM
|
|
|
|
$("#themePreview").remove();
|
|
|
|
$("<style>")
|
|
|
|
.attr("type", "text/css")
|
|
|
|
.attr("id", "themePreview")
|
|
|
|
.text(css)
|
|
|
|
.appendTo("head");
|
2021-11-09 13:29:20 +01:00
|
|
|
}).trigger("change");
|