Dotclear

Changeset 387:023783060913


Ignore:
Timestamp:
06/18/11 14:24:58 (14 years ago)
Author:
Franck <carnet.franck.paul@…>
Branch:
themes
Message:

Configuration des titres - step 1 : graisse, taille et couleur

Location:
themes/ductile
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • themes/ductile/_config.php

    r378 r387  
    2828); 
    2929 
     30function adjustFontSize($s) 
     31{ 
     32     if (preg_match('/^([0-9.]+)\s*(%|pt|px|em|ex)?$/',$s,$m)) { 
     33          if (empty($m[2])) { 
     34               $m[2] = 'em'; 
     35          } 
     36          return $m[1].$m[2]; 
     37     } 
     38 
     39     return null; 
     40} 
     41 
    3042function adjustColor($c) 
    3143{ 
     
    5264 
    5365$ductile_base = array( 
    54      'body_link_w' => null, 
    55      'body_link_v_c' => null, 
    56      'body_link_f_c' => null, 
    5766     'body_font' => null, 
    58      'alternate_font' => null 
     67     'alternate_font' => null, 
     68     'blog_title_w' => null, 
     69     'blog_title_s' => null, 
     70     'blog_title_c' => null, 
     71     'post_title_w' => null, 
     72     'post_title_s' => null, 
     73     'post_title_c' => null, 
     74     'post_link_w' => null, 
     75     'post_link_v_c' => null, 
     76     'post_link_f_c' => null, 
     77     'blog_title_w_m' => null, 
     78     'blog_title_s_m' => null, 
     79     'blog_title_c_m' => null, 
     80     'post_title_w_m' => null, 
     81     'post_title_s_m' => null, 
     82     'post_title_c_m' => null 
    5983); 
    6084 
     
    7195     try 
    7296     { 
    73           $ductile_user['body_link_w'] = (integer) !empty($_POST['body_link_w']); 
    74  
    75           $ductile_user['body_link_v_c'] = adjustColor($_POST['body_link_v_c']); 
    76           $ductile_user['body_link_f_c'] = adjustColor($_POST['body_link_f_c']); 
    77            
    7897          $ductile_user['body_font'] = $_POST['body_font']; 
    7998          $ductile_user['alternate_font'] = $_POST['alternate_font']; 
     99 
     100          $ductile_user['blog_title_w'] = (integer) !empty($_POST['blog_title_w']); 
     101          $ductile_user['blog_title_s'] = adjustFontSize($_POST['blog_title_s']); 
     102          $ductile_user['blog_title_c'] = adjustColor($_POST['blog_title_c']); 
     103           
     104          $ductile_user['post_title_w'] = (integer) !empty($_POST['post_title_w']); 
     105          $ductile_user['post_title_s'] = adjustFontSize($_POST['post_title_s']); 
     106          $ductile_user['post_title_c'] = adjustColor($_POST['post_title_c']); 
     107           
     108          $ductile_user['post_link_w'] = (integer) !empty($_POST['post_link_w']); 
     109          $ductile_user['post_link_v_c'] = adjustColor($_POST['post_link_v_c']); 
     110          $ductile_user['post_link_f_c'] = adjustColor($_POST['post_link_f_c']); 
     111           
     112          $ductile_user['blog_title_w_m'] = (integer) !empty($_POST['blog_title_w_m']); 
     113          $ductile_user['blog_title_s_m'] = adjustFontSize($_POST['blog_title_s_m']); 
     114          $ductile_user['blog_title_c_m'] = adjustColor($_POST['blog_title_c_m']); 
     115           
     116          $ductile_user['post_title_w_m'] = (integer) !empty($_POST['post_title_w_m']); 
     117          $ductile_user['post_title_s_m'] = adjustFontSize($_POST['post_title_s_m']); 
     118          $ductile_user['post_title_c_m'] = adjustColor($_POST['post_title_c_m']); 
    80119           
    81120          $core->blog->settings->addNamespace('themes'); 
     
    94133} 
    95134 
     135echo '<h3>'.__('General settings').'</h3>'; 
     136 
    96137echo '<fieldset><legend>'.__('Fonts').'</legend>'. 
    97138'<p class="field"><label for="body_font">'.__('Main font:').' '. 
     
    102143'</fieldset>'; 
    103144 
     145echo '<div class="two-cols">'; 
     146echo '<div class="col">'; 
     147 
     148echo '<fieldset><legend>'.__('Blog title').'</legend>'. 
     149'<p class="field"><label for="blog_title_w">'.__('Blog title in bold:').' '. 
     150form::checkbox('blog_title_w',1,$ductile_user['blog_title_w']).'</label>'.'</p>'. 
     151 
     152'<p class="field"><label for="blog_title_s">'.__('Blog title font size:').'</label> '. 
     153form::field('blog_title_s',7,7,$ductile_user['blog_title_s']).' '.__('(in em by default)').'</p>'. 
     154 
     155'<p class="field"><label for="blog_title_c">'.__('Blog title color:').'</label> '. 
     156form::field('blog_title_c',7,7,$ductile_user['blog_title_c'],'colorpicker').'</p>'. 
     157'</fieldset>'; 
     158 
     159echo '</div>'; 
     160echo '<div class="col">'; 
     161 
     162echo '<fieldset><legend>'.__('Post title').'</legend>'. 
     163'<p class="field"><label for="post_title_w">'.__('Post title in bold:').' '. 
     164form::checkbox('post_title_w',1,$ductile_user['post_title_w']).'</label>'.'</p>'. 
     165 
     166'<p class="field"><label for="post_title_s">'.__('Post title font size:').'</label> '. 
     167form::field('post_title_s',7,7,$ductile_user['post_title_s']).' '.__('(in em by default)').'</p>'. 
     168 
     169'<p class="field"><label for="post_title_c">'.__('Post title color:').'</label> '. 
     170form::field('post_title_c',7,7,$ductile_user['post_title_c'],'colorpicker').'</p>'. 
     171'</fieldset>'; 
     172 
     173echo '</div>'; 
     174echo '</div>'; 
     175 
    104176echo '<fieldset><legend>'.__('Inside posts links').'</legend>'. 
    105 '<p class="field"><label for="body_link_w">'.__('Links in bold:').' '. 
    106 form::checkbox('body_link_w',1,$ductile_user['body_link_w']).'</label>'.'</p>'. 
    107  
    108 '<p class="field"><label for="body_link_v_c">'.__('Normal and visited links color:').'</label> '. 
    109 form::field('body_link_v_c',7,7,$ductile_user['body_link_v_c'],'colorpicker').'</p>'. 
     177'<p class="field"><label for="post_link_w">'.__('Links in bold:').' '. 
     178form::checkbox('post_link_w',1,$ductile_user['post_link_w']).'</label>'.'</p>'. 
     179 
     180'<p class="field"><label for="post_link_v_c">'.__('Normal and visited links color:').'</label> '. 
     181form::field('post_link_v_c',7,7,$ductile_user['post_link_v_c'],'colorpicker').'</p>'. 
    110182 
    111183'<p class="field"><label for="body_link_f_c">'.__('Active, hover and focus links color:').'</label> '. 
    112 form::field('body_link_f_c',7,7,$ductile_user['body_link_f_c'],'colorpicker').'</p>'. 
    113 '</fieldset>'; 
     184form::field('post_link_f_c',7,7,$ductile_user['post_link_f_c'],'colorpicker').'</p>'. 
     185'</fieldset>'; 
     186 
     187echo '<h3>'.__('Mobile specific settings').'</h3>'; 
     188 
     189echo '<div class="two-cols">'; 
     190echo '<div class="col">'; 
     191 
     192echo '<fieldset><legend>'.__('Blog title').'</legend>'. 
     193'<p class="field"><label for="blog_title_w_m">'.__('Blog title in bold:').' '. 
     194form::checkbox('blog_title_w_m',1,$ductile_user['blog_title_w_m']).'</label>'.'</p>'. 
     195 
     196'<p class="field"><label for="blog_title_s_m">'.__('Blog title font size:').'</label> '. 
     197form::field('blog_title_s_m',7,7,$ductile_user['blog_title_s_m']).' '.__('(in em by default)').'</p>'. 
     198 
     199'<p class="field"><label for="blog_title_c_m">'.__('Blog title color:').'</label> '. 
     200form::field('blog_title_c_m',7,7,$ductile_user['blog_title_c_m'],'colorpicker').'</p>'. 
     201'</fieldset>'; 
     202 
     203echo '</div>'; 
     204echo '<div class="col">'; 
     205 
     206echo '<fieldset><legend>'.__('Post title').'</legend>'. 
     207'<p class="field"><label for="post_title_w_m">'.__('Post title in bold:').' '. 
     208form::checkbox('post_title_w_m',1,$ductile_user['post_title_w_m']).'</label>'.'</p>'. 
     209 
     210'<p class="field"><label for="post_title_s_m">'.__('Post title font size:').'</label> '. 
     211form::field('post_title_s_m',7,7,$ductile_user['post_title_s_m']).' '.__('(in em by default)').'</p>'. 
     212 
     213'<p class="field"><label for="post_title_c_m">'.__('Post title color:').'</label> '. 
     214form::field('post_title_c_m',7,7,$ductile_user['post_title_c_m'],'colorpicker').'</p>'. 
     215'</fieldset>'; 
     216 
     217echo '</div>'; 
     218echo '</div>'; 
    114219 
    115220?> 
  • themes/ductile/_public.php

    r378 r387  
    4444 
    4545          # Main font 
    46           $main_font_selectors = 'body, #supranav li a span, #comments.me, a.comment-number'; 
    47           if (isset($s['body_font'])) self::prop($css,$main_font_selectors,'font-family',self::fontDef($s['body_font'])); 
     46          $selectors = 'body, #supranav li a span, #comments.me, a.comment-number'; 
     47          if (isset($s['body_font'])) self::prop($css,$selectors,'font-family',self::fontDef($s['body_font'])); 
    4848 
    4949          # Secondary font 
    50           $alternate_font_selectors = '#blogdesc, #supranav, #content-info, #subcategories, #comments-feed, #sidebar h2, #sidebar h3, #footer p'; 
    51           if (isset($s['alternate_font'])) self::prop($css,$alternate_font_selectors,'font-family',self::fontDef($s['alternate_font'])); 
     50          $selectors = '#blogdesc, #supranav, #content-info, #subcategories, #comments-feed, #sidebar h2, #sidebar h3, #footer p'; 
     51          if (isset($s['alternate_font'])) self::prop($css,$selectors,'font-family',self::fontDef($s['alternate_font'])); 
    5252           
    5353          # Inside posts links font weight 
    54           $links = '.post-excerpt a, .post-content a'; 
    55           if (isset($s['body_link_w'])) self::prop($css,$links,'font-weight',($s['body_link_w'] ? 'bold' : 'normal')); 
     54          $selectors = '.post-excerpt a, .post-content a'; 
     55          if (isset($s['post_link_w'])) self::prop($css,$selectors,'font-weight',($s['post_link_w'] ? 'bold' : 'normal')); 
    5656 
    5757          # Inside posts links colors (normal, visited) 
    58           $links_selectors = '.post-excerpt a:link, .post-excerpt a:visited, .post-content a:link, .post-content a:visited'; 
    59           if (isset($s['body_link_v_c'])) self::prop($css,$links_selectors,'color',$s['body_link_v_c']); 
     58          $selectors = '.post-excerpt a:link, .post-excerpt a:visited, .post-content a:link, .post-content a:visited'; 
     59          if (isset($s['post_link_v_c'])) self::prop($css,$selectors,'color',$s['post_link_v_c']); 
    6060 
    6161          # Inside posts links colors (hover, active, focus) 
    62           $links_alternate_selectors = '.post-excerpt a:hover, .post-excerpt a:active, .post-excerpt a:focus, .post-content a:hover, .post-content a:active, .post-content a:focus'; 
    63           if (isset($s['body_link_f_c'])) self::prop($css,$links_alternate_selectors,'color',$s['body_link_f_c']); 
     62          $selectors = '.post-excerpt a:hover, .post-excerpt a:active, .post-excerpt a:focus, .post-content a:hover, .post-content a:active, .post-content a:focus'; 
     63          if (isset($s['post_link_f_c'])) self::prop($css,$selectors,'color',$s['post_link_f_c']); 
    6464 
    6565          # Style directives 
     
    7373          } 
    7474 
     75          # Large screens 
     76          $css_large = array(); 
     77 
     78          # Blog title font weight 
     79          $selectors = 'h1, h1 a:link, h1 a:visited, h1 a:hover, h1 a:visited, h1 a:focus'; 
     80          if (isset($s['blog_title_w'])) self::prop($css_large,$selectors,'font-weight',($s['blog_title_w'] ? 'bold' : 'normal')); 
     81           
     82          # Blog title font size 
     83          $selectors = 'h1'; 
     84          if (isset($s['blog_title_s'])) self::prop($css_large,$selectors,'font-size',$s['blog_title_s']); 
     85           
     86          # Blog title color 
     87          $selectors = 'h1 a:link, h1 a:visited, h1 a:hover, h1 a:visited, h1 a:focus'; 
     88          if (isset($s['blog_title_c'])) self::prop($css_large,$selectors,'color',$s['blog_title_c']); 
     89 
     90          # Post title font weight 
     91          $selectors = 'h2.post-title, h2.post-title a:link, h2.post-title a:visited, h2.post-title a:hover, h2.post-title a:visited, h2.post-title a:focus'; 
     92          if (isset($s['post_title_w'])) self::prop($css_large,$selectors,'font-weight',($s['post_title_w'] ? 'bold' : 'normal')); 
     93           
     94          # Post title font size 
     95          $selectors = 'h2.post-title'; 
     96          if (isset($s['post_title_s'])) self::prop($css_large,$selectors,'font-size',$s['post_title_s']); 
     97           
     98          # Post title color 
     99          $selectors = 'h2.post-title a:link, h2.post-title a:visited, h2.post-title a:hover, h2.post-title a:visited, h2.post-title a:focus'; 
     100          if (isset($s['post_title_c'])) self::prop($css_large,$selectors,'color',$s['post_title_c']); 
     101 
     102          # Style directives for large screens 
     103          if (count($css_large)) { 
     104               $res .= '@media only screen and (min-width: 481px) {'."\n"; 
     105               foreach ($css_large as $selector => $values) { 
     106                    $res .= $selector." {\n"; 
     107                    foreach ($values as $k => $v) { 
     108                         $res .= $k.':'.$v.";\n"; 
     109                    } 
     110                    $res .= "}\n"; 
     111               } 
     112               $res .= "}\n"; 
     113          } 
     114 
     115          # Small screens 
     116          $css_small = array(); 
     117 
     118          # Blog title font weight 
     119          $selectors = 'h1, h1 a:link, h1 a:visited, h1 a:hover, h1 a:visited, h1 a:focus'; 
     120          if (isset($s['blog_title_w_m'])) self::prop($css_small,$selectors,'font-weight',($s['blog_title_w_m'] ? 'bold' : 'normal')); 
     121           
     122          # Blog title font size 
     123          $selectors = 'h1'; 
     124          if (isset($s['blog_title_s_m'])) self::prop($css_small,$selectors,'font-size',$s['blog_title_s_m']); 
     125           
     126          # Blog title color 
     127          $selectors = 'h1 a:link, h1 a:visited, h1 a:hover, h1 a:visited, h1 a:focus'; 
     128          if (isset($s['blog_title_c_m'])) self::prop($css_small,$selectors,'color',$s['blog_title_c_m']); 
     129 
     130          # Post title font weight 
     131          $selectors = 'h2.post-title, h2.post-title a:link, h2.post-title a:visited, h2.post-title a:hover, h2.post-title a:visited, h2.post-title a:focus'; 
     132          if (isset($s['post_title_w_m'])) self::prop($css_small,$selectors,'font-weight',($s['post_title_w_m'] ? 'bold' : 'normal')); 
     133           
     134          # Post title font size 
     135          $selectors = 'h2.post-title'; 
     136          if (isset($s['post_title_s_m'])) self::prop($css_small,$selectors,'font-size',$s['post_title_s_m']); 
     137           
     138          # Post title color 
     139          $selectors = 'h2.post-title a:link, h2.post-title a:visited, h2.post-title a:hover, h2.post-title a:visited, h2.post-title a:focus'; 
     140          if (isset($s['post_title_c_m'])) self::prop($css_small,$selectors,'color',$s['post_title_c_m']); 
     141 
     142          # Style directives for small screens 
     143          if (count($css_small)) { 
     144               $res .= '@media only screen and (max-width: 480px) {'."\n"; 
     145               foreach ($css_small as $selector => $values) { 
     146                    $res .= $selector." {\n"; 
     147                    foreach ($values as $k => $v) { 
     148                         $res .= $k.':'.$v.";\n"; 
     149                    } 
     150                    $res .= "}\n"; 
     151               } 
     152               $res .= "}\n"; 
     153          } 
     154           
    75155          return $res; 
    76156     } 
  • themes/ductile/locales/fr/main.po

    r378 r387  
    11msgid "Style sheet upgraded." 
    22msgstr "Feuille de style mise à jour." 
     3 
     4msgid "General settings" 
     5msgstr "Paramètres généraux" 
     6 
     7msgid "Mobile specific settings" 
     8msgstr "Paramètres spécifiques pour les mobiles" 
     9 
     10msgid "Blog title" 
     11msgstr "Titre du blog" 
     12 
     13msgid "Blog title in bold:" 
     14msgstr "Titre du blog en gras :" 
     15 
     16msgid "Blog title font size:" 
     17msgstr "Taille de police du titre du blog :" 
     18 
     19msgid "(in em by default)" 
     20msgstr "(en em par défaut)" 
     21 
     22msgid "Blog title color:" 
     23msgstr "Couleur du titre du blog :" 
     24 
     25msgid "Post title" 
     26msgstr "Titre des billets" 
     27 
     28msgid "Post title in bold:" 
     29msgstr "Titre des billets en gras :" 
     30 
     31msgid "Post title font size:" 
     32msgstr "Taille de police du titre des billets :" 
     33 
     34msgid "Post title color:" 
     35msgstr "Couleur du titre des billets :" 
    336 
    437msgid "Links in bold:" 
Note: See TracChangeset for help on using the changeset viewer.

Sites map