ultimix

- Main Page
- Data Structures
- Files
- Examples

- File List
- Globals

Functions | Variables
sarissa.js File Reference

Go to the source code of this file.

## Functions
function | Sarissa ()
| if (!window.Node||!Node.ELEMENT_NODE)
| if (Sarissa._SARISSA_IS_SAFARI_OLD)
| if (typeof XMLDocument=="undefined"&&typeof Document!="undefined")
| if (!window.XMLSerializer &&Sarissa.getDomDocument &&Sarissa.getDomDocument("","foo", null).xml)

## Variables
Sarissa | VERSION = "0.9.9.4"
Sarissa | PARSED_OK = "Document contains no parsing errors"
Sarissa | PARSED_EMPTY = "Document is empty"
Sarissa | PARSED_UNKNOWN_ERROR = "Not well-formed or other error"
Sarissa | IS_ENABLED_TRANSFORM_NODE = false
Sarissa | REMOTE_CALL_FLAG = "gr.abiss.sarissa.REMOTE_CALL_FLAG"
Sarissa | _lastUniqueSuffix = 0
Sarissa | _getUniqueSuffix = function(){return Sarissa._lastUniqueSuffix++;}
Sarissa | _SARISSA_IEPREFIX4XSLPARAM = ""
Sarissa | _SARISSA_HAS_DOM_IMPLEMENTATION = document.implementation&&true
Sarissa | _SARISSA_HAS_DOM_CREATE_DOCUMENT = Sarissa._SARISSA_HAS_DOM_IMPLEMENTATION&&document.implementation.createDocument
Sarissa | _SARISSA_HAS_DOM_FEATURE = Sarissa._SARISSA_HAS_DOM_IMPLEMENTATION&&document.implementation.hasFeature
Sarissa | _SARISSA_IS_MOZ = Sarissa._SARISSA_HAS_DOM_CREATE_DOCUMENT&&Sarissa._SARISSA_HAS_DOM_FEATURE
Sarissa | _SARISSA_IS_SAFARI = navigator.userAgent.toLowerCase().indexOf("safari")!=-1||navigator.userAgent.toLowerCase().indexOf("konqueror")!=-1
Sarissa | _SARISSA_IS_SAFARI_OLD = Sarissa._SARISSA_IS_SAFARI&&(parseInt((navigator.userAgent.match(/AppleWebKit\/(\d+)/)||{})[1],10)<420)
Sarissa | _SARISSA_IS_IE = document.all&&window.ActiveXObject&&navigator.userAgent.toLowerCase().indexOf("msie")>-1&&navigator.userAgent.toLowerCase().indexOf("opera")==-1
Sarissa | _SARISSA_IS_OPERA = navigator.userAgent.toLowerCase().indexOf("opera")!=-1
Sarissa | stripTags = function(s){return s?s.replace(/<[^>]+>/g,""):s;}
Sarissa | clearChildNodes = function(oNode){while(oNode.firstChild){oNode.removeChild(oNode.firstChild);}}
Sarissa | copyChildNodes
Sarissa | moveChildNodes
Sarissa | xmlize
Sarissa | escape = function(sXml){return sXml.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;");};Sarissa.unescape=function(sXml){return sXml.replace(/&apos;/g,"'").replace(/&quot;/g,"\"").replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&amp;/g,"&");}
Sarissa | updateCursor = function(oTargetElement,sValue){if(oTargetElement&&oTargetElement.style&&oTargetElement.style.cursor!=undefined){oTargetElement.style.cursor=sValue;}}
Sarissa | updateContentFromURI
Sarissa | updateContentFromNode
Sarissa | formToQueryString
Sarissa | updateContentFromForm
Sarissa | FUNCTION_NAME_REGEXP = new RegExp("")
Sarissa | getFunctionName
Sarissa | setRemoteJsonCallback

## Function Documentation

if | ( | !window.Node||!Node. | ELEMENT_NODE | ) |

Definition at line 26 of file sarissa.js.

{return Sarissa._lastUniqueSuffix++;};Sarissa._SARISSA_IEPREFIX4XSLPARAM="";Sarissa._SARISSA_HAS_DOM_IMPLEMENTATION=document.implementation&&true;Sarissa._SARISSA_HAS_DOM_CREATE_DOCUMENT=Sarissa._SARISSA_HAS_DOM_IMPLEMENTATION&&document.implementation.createDocument;Sarissa._SARISSA_HAS_DOM_FEATURE=Sarissa._SARISSA_HAS_DOM_IMPLEMENTATION&&document.implementation.hasFeature;Sarissa._SARISSA_IS_MOZ=Sarissa._SARISSA_HAS_DOM_CREATE_DOCUMENT&&Sarissa._SARISSA_HAS_DOM_FEATURE;Sarissa._SARISSA_IS_SAFARI=navigator.userAgent.toLowerCase().indexOf("safari")!=-1||navigator.userAgent.toLowerCase().indexOf("konqueror")!=-1;Sarissa._SARISSA_IS_SAFARI_OLD=Sarissa._SARISSA_IS_SAFARI&&(parseInt((navigator.userAgent.match(/AppleWebKit\/(\d+)/)||{})[1],10)<420);Sarissa._SARISSA_IS_IE=document.all&&window.ActiveXObject&&navigator.userAgent.toLowerCase().indexOf("msie")>-1&&navigator.userAgent.toLowerCase().indexOf("opera")==-1;Sarissa._SARISSA_IS_OPERA=navigator.userAgent.toLowerCase().indexOf("opera")!=-1;if(!window.Node||!Node.ELEMENT_NODE){Node={ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12};}

if | ( | Sarissa. | _SARISSA_IS_SAFARI_OLD | ) |

Definition at line 27 of file sarissa.js.

{HTMLHtmlElement=document.createElement("html").constructor;Node=HTMLElement={};HTMLElement.prototype=HTMLHtmlElement.__proto__.__proto__;HTMLDocument=Document=document.constructor;var x=new DOMParser();XMLDocument=x.constructor;Element=x.parseFromString("<Single />","text/xml").documentElement.constructor;x=null;}

if | ( | typeof | XMLDocument = `="undefined"&&typeof Document!="undefined"` | ) |

Definition at line 28 of file sarissa.js.

{XMLDocument=Document;}

if | ( | !window.XMLSerializer &&Sarissa.getDomDocument &&Sarissa.getDomDocument("","foo", null). | xml | ) |

Definition at line 72 of file sarissa.js.

{XMLSerializer=function(){};XMLSerializer.prototype.serializeToString=function(oNode){return oNode.xml;};}

function Sarissa | ( |  | ) |

Definition at line 25 of file sarissa.js.

{}

## Variable Documentation

Sarissa _getUniqueSuffix = function(){return Sarissa._lastUniqueSuffix++;}

Definition at line 26 of file sarissa.js.

Sarissa _lastUniqueSuffix = 0

Definition at line 26 of file sarissa.js.

Sarissa _SARISSA_HAS_DOM_CREATE_DOCUMENT = Sarissa._SARISSA_HAS_DOM_IMPLEMENTATION&&document.implementation.createDocument

Definition at line 26 of file sarissa.js.

Sarissa _SARISSA_HAS_DOM_FEATURE = Sarissa._SARISSA_HAS_DOM_IMPLEMENTATION&&document.implementation.hasFeature

Definition at line 26 of file sarissa.js.

Sarissa _SARISSA_HAS_DOM_IMPLEMENTATION = document.implementation&&true

Definition at line 26 of file sarissa.js.

Sarissa _SARISSA_IEPREFIX4XSLPARAM = ""

Definition at line 26 of file sarissa.js.

Sarissa _SARISSA_IS_IE = document.all&&window.ActiveXObject&&navigator.userAgent.toLowerCase().indexOf("msie")>-1&&navigator.userAgent.toLowerCase().indexOf("opera")==-1

Definition at line 26 of file sarissa.js.

Sarissa _SARISSA_IS_MOZ = Sarissa._SARISSA_HAS_DOM_CREATE_DOCUMENT&&Sarissa._SARISSA_HAS_DOM_FEATURE

Definition at line 26 of file sarissa.js.

Sarissa _SARISSA_IS_OPERA = navigator.userAgent.toLowerCase().indexOf("opera")!=-1

Definition at line 26 of file sarissa.js.

Sarissa _SARISSA_IS_SAFARI = navigator.userAgent.toLowerCase().indexOf("safari")!=-1||navigator.userAgent.toLowerCase().indexOf("konqueror")!=-1

Definition at line 26 of file sarissa.js.

Sarissa _SARISSA_IS_SAFARI_OLD = Sarissa._SARISSA_IS_SAFARI&&(parseInt((navigator.userAgent.match(/AppleWebKit\/(\d+)/)||{})[1],10)<420)

Definition at line 26 of file sarissa.js.

Sarissa clearChildNodes = function(oNode){while(oNode.firstChild){oNode.removeChild(oNode.firstChild);}}

Definition at line 73 of file sarissa.js.

Sarissa copyChildNodes

Initial value:
function(nodeFrom,nodeTo,bPreserveExisting){if(Sarissa._SARISSA_IS_SAFARI&&nodeTo.nodeType==Node.DOCUMENT_NODE){nodeTo=nodeTo.documentElement;}
if((!nodeFrom)||(!nodeTo)){throw"Both source and destination nodes must be provided";}
if(!bPreserveExisting){Sarissa.clearChildNodes(nodeTo);}
var ownerDoc=nodeTo.nodeType==Node.DOCUMENT_NODE?nodeTo:nodeTo.ownerDocument;var nodes=nodeFrom.childNodes;var i;if(typeof(ownerDoc.importNode)!="undefined"){for(i=0;i<nodes.length;i++){nodeTo.appendChild(ownerDoc.importNode(nodes[i],true));}}else{for(i=0;i<nodes.length;i++){nodeTo.appendChild(nodes[i].cloneNode(true));}}}

Definition at line 73 of file sarissa.js.

Sarissa escape = function(sXml){return sXml.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;");};Sarissa.unescape=function(sXml){return sXml.replace(/&apos;/g,"'").replace(/&quot;/g,"\"").replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&amp;/g,"&");}

Definition at line 81 of file sarissa.js.

Sarissa formToQueryString

Initial value:
function(oForm){var qs="";for(var i=0;i<oForm.elements.length;i++){var oField=oForm.elements[i];var sFieldName=oField.getAttribute("name")?oField.getAttribute("name"):oField.getAttribute("id");if(sFieldName&&((!oField.disabled)||oField.type=="hidden")){switch(oField.type){case"hidden":case"text":case"textarea":case"password":qs+=sFieldName+"="+encodeURIComponent(oField.value)+"&";break;case"select-one":qs+=sFieldName+"="+encodeURIComponent(oField.options[oField.selectedIndex].value)+"&";break;case"select-multiple":for(var j=0;j<oField.length;j++){var optElem=oField.options[j];if(optElem.selected===true){qs+=sFieldName+"[]"+"="+encodeURIComponent(optElem.value)+"&";}}
break;case"checkbox":case"radio":if(oField.checked){qs+=sFieldName+"="+encodeURIComponent(oField.value)+"&";}
break;}}}
return qs.substr(0,qs.length-1);}

Definition at line 93 of file sarissa.js.

Sarissa FUNCTION_NAME_REGEXP = new RegExp("")

Definition at line 104 of file sarissa.js.

Sarissa getFunctionName

Initial value:
function(oFunc,bForce){var name;if(!name){if(bForce){name="SarissaAnonymous"+Sarissa._getUniqueSuffix();window[name]=oFunc;}
else{name=null;}}
if(name){window[name]=oFunc;}
return name;}

Definition at line 104 of file sarissa.js.

Sarissa IS_ENABLED_TRANSFORM_NODE = false

Definition at line 26 of file sarissa.js.

Sarissa moveChildNodes

Initial value:
function(nodeFrom,nodeTo,bPreserveExisting){if((!nodeFrom)||(!nodeTo)){throw"Both source and destination nodes must be provided";}
if(!bPreserveExisting){Sarissa.clearChildNodes(nodeTo);}
var nodes=nodeFrom.childNodes;if(nodeFrom.ownerDocument==nodeTo.ownerDocument){while(nodeFrom.firstChild){nodeTo.appendChild(nodeFrom.firstChild);}}else{var ownerDoc=nodeTo.nodeType==Node.DOCUMENT_NODE?nodeTo:nodeTo.ownerDocument;var i;if(typeof(ownerDoc.importNode)!="undefined"){for(i=0;i<nodes.length;i++){nodeTo.appendChild(ownerDoc.importNode(nodes[i],true));}}else{for(i=0;i<nodes.length;i++){nodeTo.appendChild(nodes[i].cloneNode(true));}}
Sarissa.clearChildNodes(nodeFrom);}}

Definition at line 76 of file sarissa.js.

Sarissa PARSED_EMPTY = "Document is empty"

Definition at line 26 of file sarissa.js.

Sarissa PARSED_OK = "Document contains no parsing errors"

Definition at line 26 of file sarissa.js.

Sarissa PARSED_UNKNOWN_ERROR = "Not well-formed or other error"

Definition at line 26 of file sarissa.js.

Sarissa REMOTE_CALL_FLAG = "gr.abiss.sarissa.REMOTE_CALL_FLAG"

Definition at line 26 of file sarissa.js.

Sarissa setRemoteJsonCallback

Initial value:
function(url,callback,callbackParam){if(!callbackParam){callbackParam="callback";}
var callbackFunctionName=Sarissa.getFunctionName(callback,true);var id="sarissa_json_script_id_"+Sarissa._getUniqueSuffix();var oHead=document.getElementsByTagName("head")[0];var scriptTag=document.createElement('script');scriptTag.type='text/javascript';scriptTag.id=id;scriptTag.onload=function(){};if(url.indexOf("?")!=-1){url+=("&"+callbackParam+"="+callbackFunctionName);}
else{url+=("?"+callbackParam+"="+callbackFunctionName);}
scriptTag.src=url;oHead.appendChild(scriptTag);return id;}

Definition at line 107 of file sarissa.js.

Sarissa stripTags = function(s){return s?s.replace(/<[^>]+>/g,""):s;}

Definition at line 73 of file sarissa.js.

Sarissa updateContentFromForm

Initial value:
function(oForm,oTargetElement,xsltproc,callback){try{Sarissa.updateCursor(oTargetElement,"wait");var params=Sarissa.formToQueryString(oForm)+"&"+Sarissa.REMOTE_CALL_FLAG+"=true";var xmlhttp=new XMLHttpRequest();var bUseGet=oForm.getAttribute("method")&&oForm.getAttribute("method").toLowerCase()=="get";if(bUseGet){xmlhttp.open("GET",oForm.getAttribute("action")+"?"+params,true);}
else{xmlhttp.open('POST',oForm.getAttribute("action"),true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.setRequestHeader("Content-length",params.length);xmlhttp.setRequestHeader("Connection","close");}
xmlhttp.onreadystatechange=function(){try{if(xmlhttp.readyState==4){var oDomDoc=xmlhttp.responseXML;if(oDomDoc&&Sarissa.getParseErrorText(oDomDoc)==Sarissa.PARSED_OK){Sarissa.updateContentFromNode(xmlhttp.responseXML,oTargetElement,xsltproc);if(callback){callback(oForm,oTargetElement);}}
else{throw Sarissa.getParseErrorText(oDomDoc);}}}
catch(e){if(callback){callback(oForm,oTargetElement,e);}
else{throw e;}}};xmlhttp.send(bUseGet?"":params);}
catch(e){Sarissa.updateCursor(oTargetElement,"auto");if(callback){callback(oForm,oTargetElement,e);}
else{throw e;}}
return false;}

Definition at line 96 of file sarissa.js.

Sarissa updateContentFromNode

Initial value:
function(oNode,oTargetElement,xsltproc){try{Sarissa.updateCursor(oTargetElement,"wait");Sarissa.clearChildNodes(oTargetElement);var ownerDoc=oNode.nodeType==Node.DOCUMENT_NODE?oNode:oNode.ownerDocument;if(ownerDoc.parseError&&ownerDoc.parseError.errorCode!=0){var pre=document.createElement("pre");pre.appendChild(document.createTextNode(Sarissa.getParseErrorText(ownerDoc)));oTargetElement.appendChild(pre);}
else{if(xsltproc){oNode=xsltproc.transformToDocument(oNode);}
if(oTargetElement.tagName.toLowerCase()=="textarea"||oTargetElement.tagName.toLowerCase()=="input"){oTargetElement.value=new XMLSerializer().serializeToString(oNode);}
else{try{oTargetElement.appendChild(oTargetElement.ownerDocument.importNode(oNode,true));}
catch(e){oTargetElement.innerHTML=new XMLSerializer().serializeToString(oNode);}}}}
catch(e){throw e;}
finally{Sarissa.updateCursor(oTargetElement,"auto");}}

Definition at line 87 of file sarissa.js.

Sarissa updateContentFromURI

Initial value:
function(sFromUrl,oTargetElement,xsltproc,callback,skipCache){try{Sarissa.updateCursor(oTargetElement,"wait");var xmlhttp=new XMLHttpRequest();xmlhttp.open("GET",sFromUrl,true);xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){try{var oDomDoc=xmlhttp.responseXML;if(oDomDoc&&Sarissa.getParseErrorText(oDomDoc)==Sarissa.PARSED_OK){Sarissa.updateContentFromNode(xmlhttp.responseXML,oTargetElement,xsltproc);if(callback){callback(sFromUrl,oTargetElement);}}
else{throw Sarissa.getParseErrorText(oDomDoc);}}
catch(e){if(callback){callback(sFromUrl,oTargetElement,e);}
else{throw e;}}}};if(skipCache){var oldage="Sat, 1 Jan 2000 00:00:00 GMT";xmlhttp.setRequestHeader("If-Modified-Since",oldage);}
xmlhttp.send("");}
catch(e){Sarissa.updateCursor(oTargetElement,"auto");if(callback){callback(sFromUrl,oTargetElement,e);}
else{throw e;}}}

Definition at line 81 of file sarissa.js.

Sarissa updateCursor = function(oTargetElement,sValue){if(oTargetElement&&oTargetElement.style&&oTargetElement.style.cursor!=undefined){oTargetElement.style.cursor=sValue;}}

Definition at line 81 of file sarissa.js.

Sarissa VERSION = "0.9.9.4"

Definition at line 26 of file sarissa.js.

Sarissa xmlize

Initial value:
function(anyObject,objectName,indentSpace){indentSpace=indentSpace?indentSpace:'';var s=indentSpace+'<'+objectName+'>';var isLeaf=false;if(!(anyObject instanceof Object)||anyObject instanceof Number||anyObject instanceof String||anyObject instanceof Boolean||anyObject instanceof Date){s+=Sarissa.escape(""+anyObject);isLeaf=true;}else{s+="\n";var isArrayItem=anyObject instanceof Array;for(var name in anyObject){s+=Sarissa.xmlize(anyObject[name],(isArrayItem?"array-item key=\""+name+"\"":name),indentSpace+" ");}
s+=indentSpace;}
return(s+=(objectName.indexOf(' ')!=-1?"</array-item>\n":"</"+objectName+">\n"));}

Definition at line 79 of file sarissa.js.