/** * 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 * @copyright Copyright (C) 2008-2018, Rémi Jean * @license GNU General Public License, version 3 * @link http://zwiicms.com/ */ $(document).ready(function(){ // Menu fixe à afficher if($("#themeMenuPosition").val() === 'top') { $("#themeMenuPositionFixed").slideDown(); } else { $("#themeMenuPositionFixed").slideUp(function() { $("#themeMenuFixed").prop("checked", false).trigger("change"); }); } // Option de menu à afficher if($("#themeMenuPosition").val() === 'site-first' || $(this).val() === 'site-second') { $("#themeMenuPositionOptions").slideDown(); } else { $("#themeMenuPositionOptions").slideUp(function() { $("#themeMenuMargin").prop("checked", false).trigger("change"); }); } }); /** * Aperçu en direct */ $("input, select").on("change", function() { // Import des polices de caractères var menuFont = $("#themeMenuFont").val(); var css = "@import url('https://fonts.googleapis.com/css?family=" + menuFont + "');"; var colors = core.colorVariants($("#themeMenuBackgroundColor").val()); // Couleurs du menu css += "nav,nav a{background-color:" + colors.normal + "}"; css += "nav a,#toggle span,nav a:hover{color:" + $("#themeMenuTextColor").val() + "}"; css += "nav a:hover{background-color:" + colors.darken + "}"; if ($("#themeMenuActiveColorAuto").is(':checked')) { css += "nav a:hover{background-color:" + colors.veryDarken + ";color:" + $('#themeMenuActiveTextColor').val() + ";}"; } else { css += "nav a:hover{background-color:" + $("#themeMenuActiveColor").val() + ";color:" + $('#themeMenuActiveTextColor').val() + ";}"; } // Taille, hauteur, épaisseur et capitalisation de caractères du menu css += "#toggle span,#menu a{padding:" + $("#themeMenuHeight").val() + ";font-family:'" + menuFont.replace(/\+/g, " ") + "',sans-serif;font-weight:" + $("#themeMenuFontWeight").val() + ";font-size:" + $("#themeMenuFontSize").val() + ";text-transform:" + $("#themeMenuTextTransform").val() + "}"; // Alignement du menu css += "#menu{text-align:" + $("#themeMenuTextAlign").val() + "}"; // Marge if($("#themeMenuMargin").is(":checked")) { if( getData(['theme', 'menu', 'position']) === 'site-first'); ?> || getData(['theme', 'menu', 'position']) === 'site-second'); ?> ) { css += 'nav{padding: 10px 10px 0 10px}'; } else { css += 'nav{padding:0 10px;}'; } } else { css += 'nav{margin:0;}'; } if( getData(['theme', 'menu', 'position']) === 'top'); ?> ) { css += 'nav{padding:0 10px;}'; } // Ajout du css au DOM $("#themePreview").remove(); $("