Revision 1a3569b9
Von Sven Schöling vor etwa 12 Jahren hinzugefügt
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 { |
Auch abrufbar als: Unified diff
img -> css scaling, muss aber noch gefixt werden