From 45d748da9a249663d45a9d9761fdde7315b1df54 Mon Sep 17 00:00:00 2001 From: Matthieu Marcillaud <marcimat@rezo.net> Date: Mon, 11 Dec 2017 22:47:59 +0000 Subject: [PATCH] =?UTF-8?q?On=20ajoute=20une=20classe=20CSS=20sur=20la=20c?= =?UTF-8?q?ouleur=20utilis=C3=A9e=20dans=20le=20priv=C3=A9.=20On=20la=20mo?= =?UTF-8?q?difie=20aussi=20lorsqu=E2=80=99on=20change=20dans=20les=20pr?= =?UTF-8?q?=C3=A9f=C3=A9rences.=20=C3=87a=20peut=20servir=20possiblement?= =?UTF-8?q?=20dans=20des=20fichiers=20CSS.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ecrire/inc/commencer_page.php | 6 +++++- ecrire/inc/filtres_ecrire.php | 3 +-- prive/formulaires/configurer_preferences.html | 2 +- prive/squelettes/body.html | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ecrire/inc/commencer_page.php b/ecrire/inc/commencer_page.php index 7dfb46ba03..c3affc82d6 100644 --- a/ecrire/inc/commencer_page.php +++ b/ecrire/inc/commencer_page.php @@ -176,7 +176,11 @@ function init_body_class() { 3 => 'icones_img' ); - return $GLOBALS['spip_ecran'] . " $spip_display_navigation $spip_display_outils " . $display_class[$GLOBALS['spip_display']]; + $couleur = isset($GLOBALS['visiteur_session']['prefs']['couleur']) + ? $GLOBALS['visiteur_session']['prefs']['couleur'] + : 9; + + return $GLOBALS['spip_ecran'] . " couleur_$couleur $spip_display_navigation $spip_display_outils " . $display_class[$GLOBALS['spip_display']]; } diff --git a/ecrire/inc/filtres_ecrire.php b/ecrire/inc/filtres_ecrire.php index 04a791dde8..a079e9c64b 100644 --- a/ecrire/inc/filtres_ecrire.php +++ b/ecrire/inc/filtres_ecrire.php @@ -48,8 +48,7 @@ function parametres_css_prive() { // un md5 des menus : si un menu change il faut maj la css $args['md5b'] = (function_exists('md5_boutons_plugins') ? md5_boutons_plugins() : ''); - $c = (is_array($GLOBALS['visiteur_session']) - and is_array($GLOBALS['visiteur_session']['prefs'])) + $c = isset($GLOBALS['visiteur_session']['prefs']['couleur']) ? $GLOBALS['visiteur_session']['prefs']['couleur'] : 9; diff --git a/prive/formulaires/configurer_preferences.html b/prive/formulaires/configurer_preferences.html index f4d24c70bf..dce6882aef 100644 --- a/prive/formulaires/configurer_preferences.html +++ b/prive/formulaires/configurer_preferences.html @@ -77,7 +77,7 @@ ]<BOUCLE_couleurs(POUR){tableau #ENV{couleurs}}> <div class="choix"> <input type='radio' class='radio' name='#GET{name}' id='[(#GET{name})]_#CLE'[(#ENV{#GET{name}}|=={#CLE}|oui)checked="checked" ]value="#CLE" - onchange="if (this.checked) jQuery('head>link#csspriveedef').clone().removeAttr('id').appendTo(jQuery('head')).attr('href', '[(#ENV{_couleurs_url/#CLE})]');" /> + onchange="if (this.checked) { jQuery('head>link#csspriveedef').clone().removeAttr('id').appendTo(jQuery('head')).attr('href', '[(#ENV{_couleurs_url/#CLE})]'); jQuery('body').removeClass(function(i, c){ return (c.match (/(^|\s)couleur_\S+/g) || []).join(' ');}).addClass('couleur_#CLE')}" /> <label for="[(#GET{name})]_#CLE"> <img src="#CHEMIN{rien.gif}" alt="" width="16" height="16" style="background-color:[#(#VALEUR{couleur_foncee}|couleur_foncer)];" /> <img src="#CHEMIN{rien.gif}" alt="<:choix_couleur_interface|attribut_html:> 1" width="16" height="16" style="background-color:[(#VALEUR{couleur_foncee})];" /> diff --git a/prive/squelettes/body.html b/prive/squelettes/body.html index 2eef9b3e32..035a3fec84 100644 --- a/prive/squelettes/body.html +++ b/prive/squelettes/body.html @@ -1,4 +1,4 @@ -[(#PIPELINE{body_prive,[(#VAL{<body class="#ENV{type-page,page}[ #ENV{type-page,page}_(#ENV{composition,''})][ statut_(#SESSION{statut})][ webmestre_(#SESSION{webmestre})][ auteur_(#SESSION{id_auteur})] [(#REM|init_body_class)][(#ENV{type-page,page}|match{_edit$}|oui)edition]">})]})] +[(#PIPELINE{body_prive,[(#VAL{<body class="#ENV{type-page,page}[ #ENV{type-page,page}_(#ENV{composition,''})][ statut_(#SESSION{statut})][ webmestre_(#SESSION{webmestre})][ auteur_(#SESSION{id_auteur})] [(#VAL|init_body_class)][(#ENV{type-page,page}|match{_edit$}|oui)edition]">})]})] <INCLURE{fond=prive/squelettes/inclure/barre-nav,lang,recherche,plugins=(#REM|parametres_css_prive)}> <div id="page"> <INCLURE{fond=prive/objets/liste/auteurs_enligne}> -- GitLab