1 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 * function used in or for navigation frame
9 var today = new Date();
10 var expires = new Date(today.getTime() + (56 * 86400000));
12 var pma_saveframesize_timeout = null;
15 * opens/closes (hides/shows) tree elements
17 * @param string id id of the element in the DOM
18 * @param boolean only_open do not close/hide element
20 function toggle(id, only_open) {
21 var el = document.getElementById('subel' + id);
26 var img = document.getElementById('el' + id + 'Img');
28 if (el.style.display == 'none' || only_open) {
29 el.style.display = '';
31 img.src = image_minus;
35 el.style.display = 'none';
44 function PMA_callFunctionDelayed(myfunction, delay)
46 if (typeof pma_saveframesize_timeout == "number") {
47 window.clearTimeout(pma_saveframesize_timeout);
48 pma_saveframesize_timeout = null;
53 * saves current navigation frame width in a cookie
54 * usally called on resize of the navigation frame
56 function PMA_saveFrameSizeReal()
58 if (parent.text_dir == 'ltr') {
59 pma_navi_width = parseInt(parent.document.getElementById('mainFrameset').cols)
61 pma_navi_width = parent.document.getElementById('mainFrameset').cols.match(/\d+$/)
63 if ((pma_navi_width > 0) && (pma_navi_width != PMA_getCookie('pma_navi_width'))) {
64 PMA_setCookie('pma_navi_width', pma_navi_width, expires);
69 * calls PMA_saveFrameSizeReal with delay
71 function PMA_saveFrameSize()
73 //alert(typeof(pma_saveframesize_timeout) + ' : ' + pma_saveframesize_timeout);
75 if (typeof pma_saveframesize_timeout == "number") {
76 window.clearTimeout(pma_saveframesize_timeout);
77 pma_saveframesize_timeout = null;
80 pma_saveframesize_timeout = window.setTimeout(PMA_saveFrameSizeReal, 2000);
84 * sets navigation frame width to the value stored in the cookie
85 * usally called on document load
87 function PMA_setFrameSize()
89 pma_navi_width = PMA_getCookie('pma_navi_width');
90 //alert('from cookie: ' + typeof(pma_navi_width) + ' : ' + pma_navi_width);
91 if (pma_navi_width != null) {
92 if (parent.text_dir == 'ltr') {
93 parent.document.getElementById('mainFrameset').cols = pma_navi_width + ',*';
95 parent.document.getElementById('mainFrameset').cols = '*,' + pma_navi_width;
97 //alert('framesize set');
102 * retrieves a named value from cookie
104 * @param string name name of the value to retrieve
105 * @return string value value for the given name from cookie
107 function PMA_getCookie(name) {
108 var start = document.cookie.indexOf(name + "=");
109 var len = start + name.length + 1;
110 if ((!start) && (name != document.cookie.substring(0, name.length))) {
116 var end = document.cookie.indexOf(";", len);
118 end = document.cookie.length;
120 return unescape(document.cookie.substring(len,end));
124 * stores a named value into cookie
126 * @param string name name of value
127 * @param string value value to be stored
128 * @param Date expires expire time
130 * @param string domain
131 * @param boolean secure
133 function PMA_setCookie(name, value, expires, path, domain, secure) {
134 document.cookie = name + "=" + escape(value) +
135 ( (expires) ? ";expires=" + expires.toGMTString() : "") +
136 ( (path) ? ";path=" + path : "") +
137 ( (domain) ? ";domain=" + domain : "") +
138 ( (secure) ? ";secure" : "");
142 * hide all LI elements with second A tag which doesn`t contain requested value
144 * @param string value requested value
147 function fast_filter(value){
148 var oTarget = document.getElementById("subel0");
149 if(!oTarget || !document.getElementById('fast_filter')) return false;
150 if(value!=document.getElementById('fast_filter').value) return false;
151 document.getElementById('fast_filter').disabled=true;
152 for(var iCh in oTarget.childNodes){
153 var oCh = oTarget.childNodes.item(iCh);
155 if(oCh.nodeName=="LI"){
156 if(value=="") oCh.style.display="";
159 for(var iA in oCh.childNodes){
160 var oA = oCh.childNodes.item(iA);
162 if(oA.nodeName=="A"){
165 if(oA.innerHTML.indexOf(value)==-1) oCh.style.display="none";
166 else oCh.style.display="";
173 document.getElementById('fast_filter').disabled=false;