includes/clientside/static/misc.js
changeset 74 68469a95658d
parent 60 71b50f8c8f85
child 85 7c68a18a27be
equal deleted inserted replaced
73:0a74676a2f2f 74:68469a95658d
    16   return { 'w' : w, 'h' : h };
    16   return { 'w' : w, 'h' : h };
    17 }
    17 }
    18 
    18 
    19 function findParentForm(o)
    19 function findParentForm(o)
    20 {
    20 {
    21   // Not implemented - someone please let me know how to do this, what I need to do is
    21   if ( o.tagName == 'FORM' )
    22   // find the first parent <form> tag above param 'o', not sure how to do it with DOM
    22     return o;
       
    23   while(true)
       
    24   {
       
    25     o = o.parentNode;
       
    26     if ( !o )
       
    27       return false;
       
    28     if ( o.tagName == 'FORM' )
       
    29       return o;
       
    30   }
       
    31   return false;
    23 }
    32 }
    24 
    33 
    25 function ajaxReverseDNS(o, text)
    34 function ajaxReverseDNS(o, text)
    26 {
    35 {
    27   if(text) var ipaddr = text;
    36   if(text) var ipaddr = text;
   563   div.style.margin = '1px 0 0 2px';
   572   div.style.margin = '1px 0 0 2px';
   564   var vtmp = 'input_' + Math.floor(Math.random() * 1000000);
   573   var vtmp = 'input_' + Math.floor(Math.random() * 1000000);
   565   div.innerHTML = 'Go to page:<br /><input type="text" size="2" style="padding: 1px; font-size: 8pt;" value="'+(parseInt(this_page)+1)+'" id="'+vtmp+'" />&emsp;<a href="#" onclick="paginator_submit(this, '+num_pages+', '+perpage+', unescape(\'' + escape(url_string) + '\')); return false;" style="font-size: 14pt; text-decoration: none;">&raquo;</a>&emsp;<a href="#" onclick="fly_out_top(this.parentNode, false, true); return false;" style="font-size: 14pt; text-decoration: none;">&times;</a>';
   574   div.innerHTML = 'Go to page:<br /><input type="text" size="2" style="padding: 1px; font-size: 8pt;" value="'+(parseInt(this_page)+1)+'" id="'+vtmp+'" />&emsp;<a href="#" onclick="paginator_submit(this, '+num_pages+', '+perpage+', unescape(\'' + escape(url_string) + '\')); return false;" style="font-size: 14pt; text-decoration: none;">&raquo;</a>&emsp;<a href="#" onclick="fly_out_top(this.parentNode, false, true); return false;" style="font-size: 14pt; text-decoration: none;">&times;</a>';
   566   
   575   
   567   var body = document.getElementsByTagName('body')[0];
   576   var body = document.getElementsByTagName('body')[0];
       
   577   domObjChangeOpac(0, div);
       
   578   
   568   body.appendChild(div);
   579   body.appendChild(div);
   569   
   580   
   570   document.getElementById(vtmp).onkeypress = function(e){if(e.keyCode==13)this.nextSibling.nextSibling.onclick();};
   581   document.getElementById(vtmp).onkeypress = function(e){if(e.keyCode==13)this.nextSibling.nextSibling.onclick();};
   571   document.getElementById(vtmp).focus();
   582   document.getElementById(vtmp).focus();
   572   
   583   
   574   /*
   585   /*
   575   if(!div.id) div.id = 'autofade_'+Math.floor(Math.random() * 100000);
   586   if(!div.id) div.id = 'autofade_'+Math.floor(Math.random() * 100000);
   576   var from = '#33FF33';
   587   var from = '#33FF33';
   577   Fat.fade_element(div.id,30,2000,from,Fat.get_bgcolor(div.id));
   588   Fat.fade_element(div.id,30,2000,from,Fat.get_bgcolor(div.id));
   578   */
   589   */
       
   590   
   579   fly_in_bottom(div, false, true);
   591   fly_in_bottom(div, false, true);
   580   
   592   
   581   var divh = $(div).Width();
   593   var divh = $(div).Width();
   582   left_pos = left_pos - divh;
   594   left_pos = left_pos - divh;
   583   div.style.left = left_pos + 'px';
   595   div.style.left = left_pos + 'px';
   596   var url = sprintf(formatstring, String(offset));
   608   var url = sprintf(formatstring, String(offset));
   597   fly_out_top(obj.parentNode, false, true);
   609   fly_out_top(obj.parentNode, false, true);
   598   window.location = url;
   610   window.location = url;
   599 }
   611 }
   600 
   612 
       
   613 /**
       
   614  * Insert a DOM object _after_ the specified child.
       
   615  * @param object Parent node
       
   616  * @param object Node to insert
       
   617  * @param object Node to insert after
       
   618  */
       
   619 
       
   620 function insertAfter(parent, baby, bigsister)
       
   621 {
       
   622   try
       
   623   {
       
   624     if ( parent.childNodes[parent.childNodes.length-1] == bigsister )
       
   625       parent.appendChild(baby);
       
   626     else
       
   627       parent.insertBefore(baby, bigsister.nextSibling);
       
   628   }
       
   629   catch(e)
       
   630   {
       
   631     alert(e.toString());
       
   632     if ( window.console )
       
   633     {
       
   634       // Firebug support
       
   635       window.console.warn(e);
       
   636     }
       
   637   }
       
   638 }
       
   639