Revision 5d73281e
Von Sven Schöling vor etwa 12 Jahren hinzugefügt
templates/webpages/menu/menu.html | ||
---|---|---|
2 | 2 |
<body class="menu"> |
3 | 3 |
|
4 | 4 |
<div id='html-menu'> |
5 |
[% PROCESS sections %] |
|
5 |
[%- FOREACH item IN sections %] |
|
6 |
<div id='mi[% item.item_id %]' class='mi [% item.spacer %] [% item.class %]'>[%- IF item.href %] |
|
7 |
<a href="[% item.href | html %]" class='ml' target='[% item.target %]'><span class="mii ms">[% L.img_tag(item.img) %]</span><span class='mic'>[% item.label %]</span></a>[%- ELSE %] |
|
8 |
<span class="mii ms">[% L.img_tag(item.img) %]</span><span class='mic'>[% item.label %]</span>[%- END %] |
|
9 |
</div> |
|
10 |
[%- END %] |
|
6 | 11 |
</div> |
7 | 12 |
<script type='text/javascript'> |
8 | 13 |
$(function(){ |
9 |
$('#html-menu div.item, #html-menu div.submenu').hide();
|
|
10 |
$('#html-menu div.menu').each(function() {
|
|
14 |
$('#html-menu div.i, #html-menu div.sm').hide();
|
|
15 |
$('#html-menu div.m').each(function() { |
|
11 | 16 |
$(this).click(function(){ |
12 |
$('#html-menu div.mi').not('div.menu').not('[id^=' + $(this).attr('id') + '_]').hide();
|
|
17 |
$('#html-menu div.mi').not('div.m').not('[id^=' + $(this).attr('id') + '_]').hide(); |
|
13 | 18 |
$('#html-menu div.mi[id^=' + $(this).attr('id') + '_]').toggle(); |
14 | 19 |
}); |
15 | 20 |
}); |
... | ... | |
17 | 22 |
</script> |
18 | 23 |
</body> |
19 | 24 |
</html> |
20 |
[%- BLOCK sections %] |
|
21 |
[%- FOREACH item IN sections %] |
|
22 |
<div id='mi[% menulevel %]_[% loop.count %]' class='mi [% item.spacer %] [% item.class %]'> |
|
23 |
[%- IF item.href %] |
|
24 |
<a href="[% item.href | html %]" class='ml' target='[% item.target %]'><span class="mii ms">[% L.img_tag(item.img) %]</span><span class='mic'>[% item.label %]</span></a> |
|
25 |
[%- ELSE %] |
|
26 |
<span class="mii ms">[% L.img_tag(item.img) %]</span><span class='mic'>[% item.label %]</span> |
|
27 |
[%- END %] |
|
28 |
</div> |
|
29 |
[%- IF item.subitems.size %] |
|
30 |
[% INCLUDE sections sections=item.subitems, menulevel= menulevel _ '_' _ loop.count %] |
|
31 |
[%- END %] |
|
32 |
[%- END %] |
|
33 |
[%- END %] |
Auch abrufbar als: Unified diff
menu.pl aufgeräumt
request ist jetzt auf netto 20ms zum herstellen des menüs und nochmal ein 30ms
zum rendern. bei letzterem hoffe ich dass das beim einbinden in ein template
beschleunigt wird.