Supprimer l'aperçu du thème du site

This commit is contained in:
Fred Tempez 2023-09-02 21:17:52 +02:00
parent 21113f8ffd
commit 7654446466
2 changed files with 27 additions and 135 deletions

View File

@ -26,88 +26,4 @@ $("input, select").on("change",function() {
$("#themeSiteMarginWrapper").show();
}
/**
* Aperçu dans la boîte
*/
// Import des polices de caractères pour l'aperçu en temps réel
var titleFont = $("#themeTitleFont :selected").val();
var titleFontText = $("#themeTitleFont :selected").text();
var textFont = $("#themeTextFont :selected").val();
var textFontText = $("#themeTextFont :selected").text();
// Couleurs des boutons
var colors = core.colorVariants($("#themeButtonBackgroundColor").val());
var css = ".button.buttonSubmitPreview{background-color:" + colors.normal + ";}";
css += ".button.buttonSubmitPreview:hover{background-color:" + colors.darken + "}";
css += ".button.buttonSubmitPreview{color:" + colors.text + ";}";
// 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
css += ".headerPreview,.headerPreview{color:" + $("#themeTitleTextColor").val() + ";font-family:'" + titleFontText + "',sans-serif;font-weight:" + $("#themeTitleFontWeight").val() + ";text-transform:" + $("#themeTitleTextTransform").val() + "}";
// Police de caractères
// Police + couleur
css += ".textPreview,.urlPreview{color:" + $("#themeTextTextColor").val() + ";font-family:'" + textFontText + "',sans-serif; font-size:" + $("#themeTextFontSize").val() + ";}";
// Couleur des liens
//css += "a.preview,.buttonSubmitPreview{font-family:'" + textFont.replace(/\+/g, " ") + "',sans-serif}";
// Taille du texte
// Couleur du texte
css += "p.preview{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;}";
}
// Largeur
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}";
css += "#site{border-radius:" + $("#themeSiteRadius").val() + ";box-shadow:" + $("#themeSiteShadow").val() + " #212223}";
// Couleur ou image de fond
var backgroundImage = "<?php echo json_encode($this->getData(['theme','body','image'])); ?>";
var backgroundcolor = "<?php echo json_encode($this->getdata(['theme','body','backgroundColor'])); ?>";
if(backgroundImage ) {
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() + "}";
css += "div.bodybackground{background-color:rgba(0,0,0,0);}";
}
else {
css += "div.bodybackground{background-image:none}";
}
css += 'div.bodybackground {background-color:' + backgroundcolor + ';color:' + $("#themeBodyToTopColor").val() + ';}';
css += "div.bgPreview{padding: 5px;background-color:" + $("#themeSiteBackgroundColor").val() + ";}";
// Les blocs
var colors = core.colorVariants($("#themeBlockBackgroundColor").val());
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;}";
/**
* Injection dans le DOM
*/
// Ajout du css au DOM
$("#themePreview").remove();
$("<style>")
.attr("type", "text/css")
.attr("id", "themePreview")
.text(css)
.appendTo("head");
}).trigger("change");
});

View File

@ -22,7 +22,8 @@
<div class="row">
<div class="col12">
<div class="block">
<h4><?php echo helper::translate('Paramètres'); ?>
<h4>
<?php echo helper::translate('Paramètres'); ?>
</h4>
<div class="row">
<div class="col4">
@ -57,12 +58,13 @@
<div class="row">
<div class="col12">
<div class="block">
<h4><?php echo helper::translate('Couleurs'); ?>
<h4>
<?php echo helper::translate('Couleurs'); ?>
</h4>
<div class="row">
<div class="col8">
<div class="col12">
<div class="row">
<div class="col6">
<div class="col4">
<?php echo template::text('themeSiteBackgroundColor', [
'class' => 'colorPicker',
'help' => 'Le curseur horizontal règle le niveau de transparence.',
@ -70,7 +72,7 @@
'value' => $this->getData(['theme', 'site', 'backgroundColor'])
]); ?>
</div>
<div class="col6">
<div class="col4">
<?php echo template::text('themeTextTextColor', [
'class' => 'colorPicker',
'help' => 'Le curseur horizontal règle le niveau de transparence.',
@ -78,9 +80,8 @@
'value' => $this->getData(['theme', 'text', 'textColor'])
]); ?>
</div>
</div>
<div class="row">
<div class="col6">
<div class="col4">
<?php echo template::text('themeTitleTextColor', [
'class' => 'colorPicker',
'help' => 'Le curseur horizontal règle le niveau de transparence.',
@ -88,7 +89,9 @@
'value' => $this->getData(['theme', 'title', 'textColor'])
]); ?>
</div>
<div class="col6">
</div>
<div class="row">
<div class="col3">
<?php echo template::text('themeTextLinkColor', [
'class' => 'colorPicker',
'help' => 'Le curseur horizontal règle le niveau de transparence.',
@ -96,9 +99,7 @@
'value' => $this->getData(['theme', 'text', 'linkColor'])
]); ?>
</div>
</div>
<div class="row">
<div class="col6">
<div class="col3">
<?php echo template::text('themeBlockBackgroundColor', [
'class' => 'colorPicker',
'help' => 'Couleur visible en l\'absence d\'une image.<br />Le curseur horizontal règle le niveau de transparence.',
@ -106,7 +107,7 @@
'value' => $this->getData(['theme', 'block', 'backgroundColor'])
]); ?>
</div>
<div class="col6">
<div class="col3">
<?php echo template::text('themeBlockBorderColor', [
'class' => 'colorPicker',
'help' => 'Couleur visible en l\'absence d\'une image.<br />Le curseur horizontal règle le niveau de transparence.',
@ -114,9 +115,7 @@
'value' => $this->getData(['theme', 'block', 'borderColor'])
]); ?>
</div>
</div>
<div class="row">
<div class="col6 offset3">
<div class="col3">
<?php echo template::text('themeButtonBackgroundColor', [
'class' => 'colorPicker',
'help' => 'Le curseur horizontal règle le niveau de transparence.',
@ -126,31 +125,6 @@
</div>
</div>
</div>
<div class="col4 bodybackground">
<div class="bgPreview">
<div class="row">
<div class="col6">
<h1 class="headerPreview">Titre</h1>
<h2 class="headerPreview">Sous-titre </h2>
</div>
<div class="col6">
<?php echo template::button('themeSiteSubmitButtonPreview', [
'class' => 'buttonSubmitPreview',
'value' => 'Bouton'
]); ?>
</div>
</div>
<div class="row">
<div class="col12">
<div class="block preview">
<h4 class="preview">Bloc</h4>
<p class="textPreview">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
<p><a href="#" class="urlPreview">Lorem ipsum dolor sit amet.</a></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@ -158,7 +132,8 @@
<div class="row">
<div class="col6">
<div class="block">
<h4><?php echo helper::translate('Mise en forme du texte'); ?>
<h4>
<?php echo helper::translate('Mise en forme du texte'); ?>
</h4>
<div class="row">
<div class="col6">
@ -181,7 +156,8 @@
</div>
<div class="col6">
<div class="block">
<h4><?php echo helper::translate('Mise en forme des titres'); ?>
<h4>
<?php echo helper::translate('Mise en forme des titres'); ?>
</h4>
<div class="row">
<div class="col4">