Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 1a3569b9

Von Sven Schöling vor etwa 12 Jahren hinzugefügt

  • ID 1a3569b9a81d6b9ca88941793926327051506122
  • Vorgänger fdd40c9d
  • Nachfolger 7adc5519

img -> css scaling, muss aber noch gefixt werden

Unterschiede anzeigen:

bin/mozilla/menu.pl
40 40
use strict;
41 41

  
42 42
use SL::Menu;
43
use Data::Dumper;
44 43
use URI;
45 44

  
46 45
use List::MoreUtils qw(apply);
47 46

  
48
my $menufile = "menu.ini";
49 47
my $nbsp     = ' ';
50 48
my $mainlevel;
51 49

  
......
140 138
    } elsif ($menuitem->{submenu}) {
141 139
      my $image = make_image(submenu => 1);
142 140
      if ($mainlevel && $item =~ /^\Q$mainlevel\E/) {
143
        push @items, make_item(target => $menuitem->{target}, spacer => $spacer, bold => 1, img => $image, label => $label, class => 'submenu') if $show;
141
        push @items, make_item(target => $menuitem->{target}, spacer => $spacer, img => $image, label => $label, class => 'submenu') if $show;
144 142
        push @items, section_menu($menu, $item);
145 143
      } else {
146 144
        push @items, make_item(spacer => $spacer, href => $anchor, img => $image, label => $label . ' ...', class => 'submenu') if $show;
......
190 188
sub make_image {
191 189
  my (%params) = @_;
192 190

  
193
  my $label  = $params{label};
194 191
  my $icon   = $params{icon};
195 192
  my $size   = $params{size}   || 16;
196 193

  
197 194
  return unless _show_images();
198 195

  
199 196
  my $icon_found = $icon && -f _icon_path($icon, $size);
200

  
201
  my $image_url = $icon_found ? _icon_path($icon, $size) : "image/unterpunkt.png";
202
  my $width     = $icon_found ? $size : 24;
203

  
204
  my $padding   = $size == 16 && $icon_found ? $nbsp x 2
205
                : $size == 24                ? $nbsp
206
                :                            '';
207

  
208
  return "<img src='$image_url' alt='$label' width='$width' height='$size'>$padding";
197
  my $padding    = $size == 16 && $icon_found ? $nbsp x 2
198
                 : $size == 24                ? $nbsp
199
                 :                            '';
200

  
201
  return  {
202
    src     => $icon_found ? _icon_path($icon, $size) : "image/unterpunkt.png",
203
    alt     => $params{label},
204
    width   => $icon_found ? $size : 24,
205
    height  => $size,
206
    padding => $padding,
207
  }
209 208
}
210 209

  
211 210
sub _calc_framesize {
templates/webpages/menu/menu.html
2 2
<style type='text/css'>
3 3
  #html-menu { float:left; white-space: nowrap; }
4 4
  #html-menu tr { vertical-align: top; }
5
  #html-menu img { vertical-align: middle; }
6 5
  #html-menu div.menuitem { padding: 2px 4px 1px 4px; }
7 6
  #html-menu div.submenu { font-weight: bold }
8
  #html-menu img { visibility:hidden; border: 0 }
7
  #html-menu img { vertical-align: middle; visibility:hidden; border: 0; }
9 8
  #html-menu div.menuitem:first-child img { visibility:visible }
10 9
  #html-menu a { vertical-align: top }
11 10
</style>
......
18 17
 [%- FOREACH chunk IN item.chunks %]
19 18
     <div class='menuitem [% item.class %] hover'>[% item.spacer %]
20 19
     [%- IF item.href %]
21
       [% L.link(item.href, item.img _ chunk, target=item.target) %]
20
       [% L.link(item.href, L.html_tag('img', undef, item.img) _ chunk, target=item.target) %]
22 21
     [%- ELSE %]
23
       [% item.img _ chunk %]
22
       [% L.html_tag('img', undef, item.img) _ chunk %]
24 23
     [%- END %]
25 24
     </div>
26 25
 [%- END %]

Auch abrufbar als: Unified diff