ZwiiCMS/core/module/theme/view/admin/admin.js.php

60 lines
3.8 KiB
PHP
Raw Normal View History

2020-05-17 07:41:44 +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 Fred Tempez <frederic.tempez@outlook.com>
* @copyright Copyright (C) 2008-2018, Rémi Jean
* @license GNU General Public License, version 3
* @link http://zwiicms.fr/
2020-05-17 07:41:44 +02:00
*/
/**
* Aperçu en direct
*/
$("input, select").on("change", function() {
2020-05-26 00:03:58 +02:00
2020-05-17 07:41:44 +02:00
var titleFont = $("#adminFontTitle").val();
var textFont = $("#adminFontText").val();
2022-02-17 15:23:18 +01:00
var css = "@import url('https://fonts.cdnfonts.com/css/" + titleFont + "');";
var css = "@import url('https://fonts.cdnfonts.com/css/" + textFont + "');";
var colors = core.colorVariants($("#adminBackgroundColor").val());
var css = "#site{background-color:" + colors.normal + ";}";
2020-05-26 09:25:08 +02:00
css += "body, .row > div {font:" + $("#adminFontTextSize").val() + " '" + textFont + "', sans-serif;}";
2020-05-17 07:41:44 +02:00
css += "body h1, h2, h3, h4, h5, h6 {font-family:'" + titleFont + "', sans-serif; color:" + $("#adminColorTitle").val() + ";}";
2020-05-26 00:03:58 +02:00
css += "body:not(.editorWysiwyg),span .zwiico-help {color:" + $("#adminColorText").val() + ";}";
2020-05-17 07:41:44 +02:00
var colors = core.colorVariants($("#adminColorButton").val());
2020-05-26 00:03:58 +02:00
css += "input[type='checkbox']:checked + label::before,.speechBubble{ background-color:" + colors.normal + "; color:" + $("#adminColorButtonText").val() + ";}";
css += ".speechBubble::before {border-color:" + colors.normal + " transparent transparent transparent;}";
css += ".button {background-color:" + colors.normal + ";color:" + colors.text + ";}.button:hover {background-color:" + colors.darken + ";color:" + colors.text + ";}.button:active {background-color:" + colors.veryDarken + ";color:" + colors.text + ";}";
2020-05-26 00:03:58 +02:00
var colors = core.colorVariants($("#adminColorGrey").val());
css += ".button.buttonGrey {background-color: " + colors.normal + ";color:" + colors.text + ";}.button.buttonGrey:hover {background-color:" + colors.darken + ";color:" + colors.text + "}.button.buttonGrey:active {background-color:" + colors.veryDarken + ";color:" + colors.text + ";}";
2020-05-26 00:03:58 +02:00
var colors = core.colorVariants($("#adminColorRed").val());
css += ".button.buttonRed {background-color: " + colors.normal + ";color:" + colors.text + ";}.button.buttonRed:hover {background-color:" + colors.darken + ";color:" + colors.text + "}.button.buttonRed:active {background-color:" + colors.veryDarken + ";color:" + colors.text + "}";
2020-05-26 00:03:58 +02:00
var colors = core.colorVariants($("#adminColorGreen").val());
2020-10-20 19:19:21 +02:00
css += ".button.buttonGreen, button[type=submit] {background-color: " + colors.normal + ";color: " + ";color:" + colors.text + "}.button.buttonGreen:hover, button[type=submit]:hover {background-color: " + colors.darken + ";color:" + colors.text + ";}.button.buttonGreen:active, button[type=submit]:active {background-color:" + colors.veryDarken + ";color:" + colors.text + "}";
2020-05-26 00:03:58 +02:00
var colors = core.colorVariants($("#adminBackGroundBlockColor").val());
css += ".block {border: 1px solid " + $("#adminBorderBlockColor").val() + ";}.block h4 {background-color: " + colors.normal + ";color:" + colors.text + ";}";
2020-05-27 08:42:32 +02:00
css += "input[type=email],input[type=text],input[type=password],select:not(#barSelectPage),textarea:not(.editorWysiwyg),.inputFile{background-color: " + colors.normal + ";color:" + colors.text + ";border: 1px solid " + $("#adminBorderBlockColor").val() + ";}";
2020-05-17 07:41:44 +02:00
// Ajout du css au DOM
$("#themePreview").remove();
$("<style>")
.attr("type", "text/css")
.attr("id", "themePreview")
.text(css)
.appendTo("head");
});
2020-11-07 17:48:10 +01:00
/**
* Confirmation de réinitialisation
*/
$("#configAdminReset").on("click", function() {
var _this = $(this);
return core.confirm("Êtes-vous sûr de vouloir réinitialiser à son état d'origine le thème de l\'administration ?", function() {
$(location).attr("href", _this.attr("href"));
});
});