2018-04-02 08:29:19 +02:00
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
* @license GNU General Public License, version 3
|
|
|
|
* @link http://zwiicms.com/
|
|
|
|
*/
|
|
|
|
|
2020-03-16 10:20:25 +01:00
|
|
|
/*
|
|
|
|
* Chargement de l'aperçu
|
|
|
|
*/
|
2020-03-20 15:59:52 +01:00
|
|
|
$( document).ready(function() {
|
|
|
|
updateDOM();
|
2020-03-16 10:20:25 +01:00
|
|
|
});
|
|
|
|
|
2018-04-02 08:29:19 +02:00
|
|
|
/**
|
|
|
|
* Aperçu en direct
|
|
|
|
*/
|
2020-03-20 15:59:52 +01:00
|
|
|
$("input, select").on("change",function() {
|
|
|
|
updateDOM();
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
function updateDOM() {
|
2020-03-21 18:08:04 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Aperçu dans la boîte
|
|
|
|
*/
|
|
|
|
|
2020-03-20 15:59:52 +01:00
|
|
|
// Import des polices de caractères
|
|
|
|
var titleFont = $("#themeTitleFont").val();
|
|
|
|
var textFont = $("#themeTextFont").val();
|
|
|
|
var css = "@import url('https://fonts.googleapis.com/css?family=" + titleFont + "|" + textFont + "');";
|
2020-03-21 18:08:04 +01:00
|
|
|
// Couleurs des boutons
|
2020-03-20 15:59:52 +01:00
|
|
|
var colors = core.colorVariants($("#themeButtonBackgroundColor").val());
|
2020-03-21 18:08:04 +01:00
|
|
|
css += ".button.buttonSubmitPreview{background-color:" + colors.normal + ";}";
|
|
|
|
css += ".button.buttonSubmitPreview:hover{background-color:" + colors.darken + "}";
|
2020-03-20 15:59:52 +01:00
|
|
|
// Couleurs des liens
|
|
|
|
colors = core.colorVariants($("#themeLinkTextColor").val());
|
2020-03-21 18:08:04 +01:00
|
|
|
css += "a.urlPreview{color:" + colors.normal + "}";
|
|
|
|
css += "a.urlPreview:hover{color:" + colors.darken + "}";
|
2020-03-20 15:59:52 +01:00
|
|
|
// Couleur, polices, épaisseur et capitalisation de caractères des titres
|
2020-03-21 18:08:04 +01:00
|
|
|
css += ".headerPreview,.headerPreview{color:" + $("#themeTitleTextColor").val() + ";font-family:'" + titleFont.replace(/\+/g, " ") + "',sans-serif;font-weight:" + $("#themeTitleFontWeight").val() + ";text-transform:" + $("#themeTitleTextTransform").val() + "}";
|
2020-03-20 15:59:52 +01:00
|
|
|
// Police de caractères
|
|
|
|
// Police + couleur
|
2020-03-21 18:08:04 +01:00
|
|
|
css += ".textPreview,.urlPreview{color:" + $("#themeTextTextColor").val() + ";font-family:'" + textFont.replace(/\+/g, " ") + "',sans-serif; font-size:" + $("#themeTextFontSize").val() + ";}";
|
|
|
|
// Couleur des liens
|
|
|
|
//css += "a.preview,.buttonSubmitPreview{font-family:'" + textFont.replace(/\+/g, " ") + "',sans-serif}";
|
|
|
|
|
2020-03-20 15:59:52 +01:00
|
|
|
// Taille du texte
|
|
|
|
// Couleur du texte
|
2020-03-21 18:08:04 +01:00
|
|
|
css += "p.preview,.buttonSubmitPreview{color:" + $("#themeTextTextColor").val() + "}";
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Aperçu réel
|
|
|
|
*/
|
|
|
|
|
|
|
|
// Taille du site
|
|
|
|
if ($("#themeSiteWidth").val() === "750px") {
|
|
|
|
css += ".button, button{font-size:0.8em;}";
|
|
|
|
} else {
|
|
|
|
css += ".button, button{font-size:1em;}";
|
|
|
|
}
|
2020-03-20 15:59:52 +01:00
|
|
|
// Largeur du site
|
|
|
|
css += ".container{max-width:" + $("#themeSiteWidth").val() + "}";
|
|
|
|
if ($("#themeSiteWidth").val() === "100%") {
|
|
|
|
css += "#site{margin:0 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:20px 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}";
|
|
|
|
css += "#site{border-radius:" + $("#themeSiteRadius").val() + ";box-shadow:" + $("#themeSiteShadow").val() + " #212223}";
|
2020-03-21 18:08:04 +01:00
|
|
|
css += "div.bgPreview{background-color:" + $("#themeSiteBackgroundColor").val() + ";}";
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Injection dans le DOM
|
|
|
|
*/
|
2020-03-20 15:59:52 +01:00
|
|
|
// Ajout du css au DOM
|
|
|
|
$("#themePreview").remove();
|
|
|
|
$("<style>")
|
|
|
|
.attr("type", "text/css")
|
|
|
|
.attr("id", "themePreview")
|
|
|
|
.text(css)
|
|
|
|
.appendTo("head");
|
|
|
|
|
|
|
|
}
|