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>
|
2021-12-18 10:25:33 +01:00
|
|
|
* @copyright Copyright (C) 2018-2022, Frédéric Tempez
|
2018-04-02 08:29:19 +02:00
|
|
|
* @license GNU General Public License, version 3
|
2020-09-01 20:48:40 +02:00
|
|
|
* @link http://zwiicms.fr/
|
2018-04-02 08:29:19 +02:00
|
|
|
*/
|
|
|
|
|
2020-05-21 08:00:52 +02:00
|
|
|
/**
|
|
|
|
* Affichage de l'icone de remontée et permettre l'aperçu.
|
|
|
|
*/
|
2022-09-29 08:45:59 +02:00
|
|
|
$(document).ready(function () {
|
|
|
|
$("#backToTop").css("display", "show");
|
2020-05-21 08:00:52 +02:00
|
|
|
});
|
|
|
|
|
2018-04-02 08:29:19 +02:00
|
|
|
/**
|
|
|
|
* Aperçu en direct
|
|
|
|
*/
|
2022-09-29 08:45:59 +02:00
|
|
|
$("input, select").on("change", function () {
|
2021-02-05 10:07:58 +01:00
|
|
|
|
|
|
|
// Option fixe pour contain et cover
|
|
|
|
var themeBodyImageSize = $("#themeBodyImageSize").val();
|
2022-09-29 08:45:59 +02:00
|
|
|
|
|
|
|
if (themeBodyImageSize === "cover" ||
|
|
|
|
themeBodyImageSize === "contain") {
|
2021-02-05 10:07:58 +01:00
|
|
|
$("#themeBodyImageAttachment").val("fixed");
|
|
|
|
}
|
|
|
|
|
2018-04-02 08:29:19 +02:00
|
|
|
// Couleur du fond
|
2021-02-04 16:41:54 +01:00
|
|
|
var css = "html{background-color:" + $("#themeBodyBackgroundColor").val() + "}";
|
2018-04-02 08:29:19 +02:00
|
|
|
// Image du fond
|
|
|
|
var themeBodyImage = $("#themeBodyImage").val();
|
2022-09-29 08:45:59 +02:00
|
|
|
if (themeBodyImage) {
|
2021-02-04 16:41:54 +01:00
|
|
|
css += "html{background-image:url('<?php echo helper::baseUrl(false); ?>site/file/source/" + themeBodyImage + "');background-repeat:" + $("#themeBodyImageRepeat").val() + ";background-position:" + $("#themeBodyImagePosition").val() + ";background-attachment:" + $("#themeBodyImageAttachment").val() + ";background-size:" + $("#themeBodyImageSize").val() + "}";
|
|
|
|
css += "html{background-color:rgba(0,0,0,0);}";
|
2018-04-02 08:29:19 +02:00
|
|
|
}
|
|
|
|
else {
|
2021-02-04 16:41:54 +01:00
|
|
|
css += "html{background-image:none}";
|
2018-04-02 08:29:19 +02:00
|
|
|
}
|
2022-09-29 08:45:59 +02:00
|
|
|
css += '#backToTop {background-color:' + $("#themeBodyToTopBackground").val() + ';color:' + $("#themeBodyToTopColor").val() + ';}';
|
2020-05-21 08:00:52 +02:00
|
|
|
|
2018-04-02 08:29:19 +02:00
|
|
|
// Ajout du css au DOM
|
|
|
|
$("#themePreview").remove();
|
|
|
|
$("<style>")
|
|
|
|
.attr("type", "text/css")
|
|
|
|
.attr("id", "themePreview")
|
|
|
|
.text(css)
|
|
|
|
.appendTo("head");
|
|
|
|
});
|
|
|
|
// Affiche / Cache les options de l'image du fond
|
2022-09-29 08:45:59 +02:00
|
|
|
$("#themeBodyImage").on("change", function () {
|
|
|
|
if ($(this).val()) {
|
2018-04-02 08:29:19 +02:00
|
|
|
$("#themeBodyImageOptions").slideDown();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$("#themeBodyImageOptions").slideUp();
|
|
|
|
}
|
2020-05-21 08:00:52 +02:00
|
|
|
}).trigger("change");
|
|
|
|
|