Revision cca93952
Von Sven Schöling vor etwa 12 Jahren hinzugefügt
SL/Form.pm | ||
---|---|---|
509 | 509 |
push @header, "<style type='text/css'>\@page { size:landscape; }</style>" if $self->{landscape}; |
510 | 510 |
push @header, "<link rel='shortcut icon' href='$self->{favicon}' type='image/x-icon'>" if -f $self->{favicon}; |
511 | 511 |
push @header, map { qq|<script type="text/javascript" src="js/$_.js"></script>| } |
512 |
qw(jquery common jscalendar/calendar jscalendar/lang/calendar-de jscalendar/calendar-setup part_selection jquery-ui jqModal switchmenuframe); |
|
512 |
qw(jquery common jscalendar/calendar jscalendar/lang/calendar-de jscalendar/calendar-setup part_selection jquery-ui jquery.cookie jqModal switchmenuframe);
|
|
513 | 513 |
push @header, $self->{javascript} if $self->{javascript}; |
514 | 514 |
push @header, map { qq|<link rel="stylesheet" type="text/css" href="$css_path/$_.css">| } |
515 | 515 |
qw(main menu tabcontent list_accounts jquery.autocomplete jquery.multiselect2side frame_header/header ui-lightness/jquery-ui-1.8.12.custom); |
js/jquery.cookie.js | ||
---|---|---|
1 |
/*jshint eqnull:true */ |
|
2 |
/*! |
|
3 |
* jQuery Cookie Plugin v1.2 |
|
4 |
* https://github.com/carhartl/jquery-cookie |
|
5 |
* |
|
6 |
* Copyright 2011, Klaus Hartl |
|
7 |
* Dual licensed under the MIT or GPL Version 2 licenses. |
|
8 |
* http://www.opensource.org/licenses/mit-license.php |
|
9 |
* http://www.opensource.org/licenses/GPL-2.0 |
|
10 |
*/ |
|
11 |
(function ($, document, undefined) { |
|
12 |
|
|
13 |
var pluses = /\+/g; |
|
14 |
|
|
15 |
function raw(s) { |
|
16 |
return s; |
|
17 |
} |
|
18 |
|
|
19 |
function decoded(s) { |
|
20 |
return decodeURIComponent(s.replace(pluses, ' ')); |
|
21 |
} |
|
22 |
|
|
23 |
var config = $.cookie = function (key, value, options) { |
|
24 |
// write |
|
25 |
if (value !== undefined) { |
|
26 |
options = $.extend({}, config.defaults, options); |
|
27 |
|
|
28 |
if (value === null) { |
|
29 |
options.expires = -1; |
|
30 |
} |
|
31 |
|
|
32 |
if (typeof options.expires === 'number') { |
|
33 |
var days = options.expires, t = options.expires = new Date(); |
|
34 |
t.setDate(t.getDate() + days); |
|
35 |
} |
|
36 |
|
|
37 |
value = config.json ? JSON.stringify(value) : String(value); |
|
38 |
|
|
39 |
return (document.cookie = [ |
|
40 |
encodeURIComponent(key), '=', config.raw ? value : encodeURIComponent(value), |
|
41 |
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE |
|
42 |
options.path ? '; path=' + options.path : '', |
|
43 |
options.domain ? '; domain=' + options.domain : '', |
|
44 |
options.secure ? '; secure' : '' |
|
45 |
].join('')); |
|
46 |
} |
|
47 |
|
|
48 |
// read |
|
49 |
var decode = config.raw ? raw : decoded; |
|
50 |
var cookies = document.cookie.split('; '); |
|
51 |
for (var i = 0, parts; (parts = cookies[i] && cookies[i].split('=')); i++) { |
|
52 |
if (decode(parts.shift()) === key) { |
|
53 |
var cookie = decode(parts.join('=')); |
|
54 |
return config.json ? JSON.parse(cookie) : cookie; |
|
55 |
} |
|
56 |
} |
|
57 |
|
|
58 |
return null; |
|
59 |
}; |
|
60 |
|
|
61 |
config.defaults = {}; |
|
62 |
|
|
63 |
$.removeCookie = function (key, options) { |
|
64 |
if ($.cookie(key) !== null) { |
|
65 |
$.cookie(key, null, options); |
|
66 |
return true; |
|
67 |
} |
|
68 |
return false; |
|
69 |
}; |
|
70 |
|
|
71 |
})(jQuery, document); |
templates/webpages/menu/menu.html | ||
---|---|---|
1 | 1 |
[%- USE JSON %] |
2 | 2 |
<div id='html-menu'></div> |
3 |
<script type='text/javascript'>$(function(){$([% JSON.json(sections) %]).each(function(i,b){var a=$('<a class="ml">').append($('<span class="mii ms">').append($('<div>').addClass(b.i)),$('<span class="mic">').append(b.l));if(b.h)a.attr('href', b.h);if(b.t)a.attr('target', b.t);$('#html-menu').append($('<div class="mi">').addClass(b.c).addClass(b.s).attr('id','mi'+b.id).append(a));});$('#html-menu div.i, #html-menu div.sm').hide();$('#html-menu div.m').each(function(){$(this).click(function(){$('#html-menu div.mi').not('div.m').not('[id^='+$(this).attr('id')+'_]').hide();$('#html-menu div.mi[id^='+$(this).attr('id')+'_]').toggle()})})})</script> |
|
3 |
<script type='text/javascript'>$(function(){$([% JSON.json(sections) %]).each(function(i,b){var a=$('<a class="ml">').append($('<span class="mii ms">').append($('<div>').addClass(b.i)),$('<span class="mic">').append(b.l));if(b.h)a.attr('href', b.h);if(b.t)a.attr('target', b.t);$('#html-menu').append($('<div class="mi">').addClass(b.c).addClass(b.s).attr('id','mi'+b.id).append(a))});$('#html-menu div.i, #html-menu div.sm').not('[id^='+$.cookie('html-menu-selection')+'_]').hide();$('#html-menu div.m').each(function(){$(this).click(function(){$.cookie('html-menu-selection',$(this).attr('id'));$('#html-menu div.mi').not('div.m').not('[id^='+$(this).attr('id')+'_]').hide();$('#html-menu div.mi[id^='+$(this).attr('id')+'_]').toggle()})})})</script> |
Auch abrufbar als: Unified diff
HTML Menü merkt sich jetzt über cookie den letzten Zustand