]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - themes/default/ajax-min.js
Convert to UTF-8
[SourceForge/phpwiki.git] / themes / default / ajax-min.js
1 function showHide(a){this.init(a)}showHide.prototype.onXmlHttpLoad=function(){if(this.hXMLHttp.readyState==4){var d=this.hXMLHttp.parseError;var c=document.getElementById(this.id+"-img");if(d&&d.errorCode!=0){alert(d.reason)}else{var a=document.getElementById(this.id+"-body");var b=this.hXMLHttp.responseXML;if(b!=null){if(b.firstChild&&b.firstChild.nodeName=="xml"){b=b.firstChild.nextSibling.nextSibling}if(b.firstChild&&b.firstChild.nodeName=="html"){b=b.childNodes[1]}if(b==null){alert("showHideDone "+this.id+"\nno xml children from "+this.hXMLHttp.responseText)}var e=CreateHtmlFromXml(b);e.className="wikitext";a.appendChild(e);a.style.display="block"}else{alert("showHideDone "+this.id+"\nerror no xml from "+this.hXMLHttp.responseText)}}if(c){if(!folderArrowPath){folderArrowPath=stylepath+"images/"}c.src=folderArrowPath+"/folderArrowOpen.png"}}};showHide.prototype.init=function(b){this.id=b;this.hXMLHttp=XmlHttp.create();var a=this;this.hXMLHttp.onreadystatechange=function(){a.onXmlHttpLoad()}};var cShowHide;function CreateHtmlFromXml(a){if(a==null){return document.createElement("xml")}var d=a.nodeName;var c;if(d=="#text"){c=document.createTextNode(a.nodeValue);c.nodeValue=a.nodeValue;if(a.attributes&&(a.attributes!=null)){for(var b=0;b<a.attributes.length;b++){c.setAttribute(a.attributes[b].name,a.attributes[b].value)}}}else{c=document.createElement(d);if(a.nodeValue){c.nodeValue=a.nodeValue}if(a.attributes&&(a.attributes!=null)){for(var b=0;b<a.attributes.length;b++){c.setAttribute(a.attributes[b].name,a.attributes[b].value)}}if(a.hasChildNodes()){for(var b=0;b<a.childNodes.length;b++){c.appendChild(CreateHtmlFromXml(a.childNodes[b]))}}}return c}function showHideAsync(c,d){var a=document.getElementById(d+"-body");if(!a){alert("Error: id="+d+"-body missing.");return}if(a.hasChildNodes()){showHideFolder(d)}else{if(!folderArrowPath){folderArrowPath=stylepath+"images/"}var b=document.getElementById(d+"-img");if(b){b.src=folderArrowPath+"/folderArrowLoading.gif"}cShowHide=new showHide(d);cShowHide.hXMLHttp.open("GET",c,true);cShowHide.hXMLHttp.send(null)}}function showHideDone(b){var a=document.getElementById(b+"-body");a.parentNode.replaceChild(cShowHide.hXMLHttp.responseText,a);alert("showHideDone "+b+"\ngot "+cShowHide.hXMLHttp.responseText);showHideFolder(b)}function showHideDelayed(a){window.setTimeout("doshowHide("+a+")",400)}function doshowHide(b){document.getElementById(b).style.display="none";var a=document.getElementById("LSHighlight");if(a){a.removeAttribute("id")}};