Revision aee236a3
Von Moritz Bunkus vor mehr als 10 Jahren hinzugefügt
js/common.js | ||
---|---|---|
150 | 150 |
} |
151 | 151 |
|
152 | 152 |
$(document).ready(function () { |
153 |
// initialize all jQuery UI tab elements: |
|
154 |
$(".tabwidget").each(function(idx, element) { |
|
155 |
var $element = $(element); |
|
156 |
var tabsParams = {}; |
|
157 |
|
|
158 |
var elementId = $element.attr('id'); |
|
159 |
if( elementId ) { |
|
160 |
var cookieName = 'jquery_ui_tab_'+ elementId; |
|
161 |
|
|
162 |
tabsParams.active = $.cookie(cookieName); |
|
163 |
tabsParams.activate = function(event, ui) { |
|
164 |
var i = ui.newTab.parent().children().index(ui.newTab); |
|
165 |
$.cookie(cookieName, i); |
|
166 |
}; |
|
167 |
} |
|
168 |
|
|
169 |
$element.tabs(tabsParams); |
|
170 |
}); |
|
171 |
|
|
172 | 153 |
$('input').focus(function(){ |
173 | 154 |
if (focussable(this)) window.focused_element = this; |
174 | 155 |
}); |
js/kivi.js | ||
---|---|---|
27 | 27 |
ns._locale = locale; |
28 | 28 |
}; |
29 | 29 |
|
30 |
ns.init_tabwidget = function(element) { |
|
31 |
var $element = $(element); |
|
32 |
var tabsParams = {}; |
|
33 |
var elementId = $element.attr('id'); |
|
34 |
|
|
35 |
if (elementId) { |
|
36 |
var cookieName = 'jquery_ui_tab_'+ elementId; |
|
37 |
tabsParams.active = $.cookie(cookieName); |
|
38 |
tabsParams.activate = function(event, ui) { |
|
39 |
var i = ui.newTab.parent().children().index(ui.newTab); |
|
40 |
$.cookie(cookieName, i); |
|
41 |
}; |
|
42 |
} |
|
43 |
|
|
44 |
$element.tabs(tabsParams); |
|
45 |
}; |
|
46 |
|
|
30 | 47 |
ns.reinit_widgets = function() { |
31 | 48 |
ns.run_once_for('.datepicker', 'datepicker', function(elt) { |
32 | 49 |
$(elt).datepicker(); |
... | ... | |
44 | 61 |
ns.run_once_for('.tooltip', 'tooltip', function(elt) { |
45 | 62 |
$(elt).tooltip(); |
46 | 63 |
}); |
64 |
|
|
65 |
ns.run_once_for('.tabwidget', 'tabwidget', kivi.init_tabwidget); |
|
47 | 66 |
}; |
48 | 67 |
|
49 | 68 |
ns.submit_ajax_form = function(url, form_selector, additional_data) { |
Auch abrufbar als: Unified diff
Refactor: init_tabwidgets() in kivi-Namespace verschoben