1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
|
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* function used in or for navigation frame
*/
/**
* init
*/
var today = new Date();
var expires = new Date(today.getTime() + (56 * 86400000));
var pma_navi_width;
var pma_saveframesize_timeout = null;
/**
* opens/closes (hides/shows) tree elements
*
* @param string id id of the element in the DOM
* @param boolean only_open do not close/hide element
*/
function toggle(id, only_open) {
var el = document.getElementById('subel' + id);
if (! el) {
return false;
}
var img = document.getElementById('el' + id + 'Img');
if (el.style.display == 'none' || only_open) {
el.style.display = '';
if (img) {
img.src = image_minus;
img.alt = '-';
}
} else {
el.style.display = 'none';
if (img) {
img.src = image_plus;
img.alt = '+';
}
}
return true;
}
function PMA_callFunctionDelayed(myfunction, delay)
{
if (typeof pma_saveframesize_timeout == "number") {
window.clearTimeout(pma_saveframesize_timeout);
pma_saveframesize_timeout = null;
}
}
/**
* saves current navigation frame width in a cookie
* usally called on resize of the navigation frame
*/
function PMA_saveFrameSizeReal()
{
if (parent.text_dir == 'ltr') {
pma_navi_width = parseInt(parent.document.getElementById('mainFrameset').cols)
} else {
pma_navi_width = parent.document.getElementById('mainFrameset').cols.match(/\d+$/)
}
if ((pma_navi_width > 0) && (pma_navi_width != PMA_getCookie('pma_navi_width'))) {
PMA_setCookie('pma_navi_width', pma_navi_width, expires);
}
}
/**
* calls PMA_saveFrameSizeReal with delay
*/
function PMA_saveFrameSize()
{
//alert(typeof(pma_saveframesize_timeout) + ' : ' + pma_saveframesize_timeout);
if (typeof pma_saveframesize_timeout == "number") {
window.clearTimeout(pma_saveframesize_timeout);
pma_saveframesize_timeout = null;
}
pma_saveframesize_timeout = window.setTimeout(PMA_saveFrameSizeReal, 2000);
}
/**
* sets navigation frame width to the value stored in the cookie
* usally called on document load
*/
function PMA_setFrameSize()
{
pma_navi_width = PMA_getCookie('pma_navi_width');
//alert('from cookie: ' + typeof(pma_navi_width) + ' : ' + pma_navi_width);
if (pma_navi_width != null && parent.document != document) {
if (parent.text_dir == 'ltr') {
parent.document.getElementById('mainFrameset').cols = pma_navi_width + ',*';
} else {
parent.document.getElementById('mainFrameset').cols = '*,' + pma_navi_width;
}
//alert('framesize set');
}
}
/**
* retrieves a named value from cookie
*
* @param string name name of the value to retrieve
* @return string value value for the given name from cookie
*/
function PMA_getCookie(name) {
var start = document.cookie.indexOf(name + "=");
var len = start + name.length + 1;
if ((!start) && (name != document.cookie.substring(0, name.length))) {
return null;
}
if (start == -1) {
return null;
}
var end = document.cookie.indexOf(";", len);
if (end == -1) {
end = document.cookie.length;
}
return unescape(document.cookie.substring(len,end));
}
/**
* stores a named value into cookie
*
* @param string name name of value
* @param string value value to be stored
* @param Date expires expire time
* @param string path
* @param string domain
* @param boolean secure
*/
function PMA_setCookie(name, value, expires, path, domain, secure) {
document.cookie = name + "=" + escape(value) +
( (expires) ? ";expires=" + expires.toGMTString() : "") +
( (path) ? ";path=" + path : "") +
( (domain) ? ";domain=" + domain : "") +
( (secure) ? ";secure" : "");
}
/**
* hide all LI elements with second A tag which doesn`t contain requested value
*
* @param string value requested value
*
*/
function fast_filter(value){
var oTarget = document.getElementById("subel0");
if(!oTarget || !document.getElementById('fast_filter')) return false;
if(value!=document.getElementById('fast_filter').value) return false;
document.getElementById('fast_filter').disabled=true;
for(var iCh in oTarget.childNodes){
var oCh = oTarget.childNodes.item(iCh);
if(!oCh) continue;
if(oCh.nodeName=="LI"){
if(value=="") oCh.style.display="";
else{
var i=0;
for(var iA in oCh.childNodes){
var oA = oCh.childNodes.item(iA);
if(!oA) continue;
if(oA.nodeName=="A"){
if(i==0) i = 1;
else{
if(oA.innerHTML.indexOf(value)==-1) oCh.style.display="none";
else oCh.style.display="";
}
}
}
}
}
}
document.getElementById('fast_filter').disabled=false;
}
/**
* Clears fast filter.
*/
function clear_fast_filter() {
var elm = $('#NavFilter input');
elm.val('');
fast_filter('');
elm.focus();
}
/* Performed on load */
$(document).ready(function(){
/* Display filter */
$('#NavFilter').css('display', 'inline');
$('#clear_fast_filter').click(clear_fast_filter);
$('#fast_filter').focus(function (evt) {evt.target.select();});
$('#fast_filter').keyup(function (evt) {fast_filter(evt.target.value);});
});
|