From 38bdf4083a6e0d90afb35ded0d67cab8a518b2ea Mon Sep 17 00:00:00 2001 From: Robin Date: Mon, 19 Apr 2010 19:46:42 +0200 Subject: same fixes, this time hopefully without merge conflict --- js/lib_ajax.js | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 84 insertions(+), 7 deletions(-) (limited to 'js/lib_ajax.js') diff --git a/js/lib_ajax.js b/js/lib_ajax.js index 319875d40e7..6a2ae53ee32 100644 --- a/js/lib_ajax.js +++ b/js/lib_ajax.js @@ -75,7 +75,7 @@ OC_onload.run=function(){ //implement Node.prototype under IE if(typeof Node=='undefined'){ - Node=new Object(); + Node=function(){}; Node.prototype=new Object(); tmpObj=new Object(); @@ -86,8 +86,9 @@ if(typeof Node=='undefined'){ document.createElement=function(tagName){ // alert(tagName); node=document.createElementNative(tagName); - for(name in Node.prototype){ - node[name]=Node.prototype[name]; + var proto=new Node() + for(name in proto){ + node[name]=proto[name]; } return node; } @@ -98,10 +99,10 @@ if(typeof Node=='undefined'){ node=node.item(0) } if(node.nodeType==1){ - for(name in Node.prototype){ -// node[name]=Node.prototype[name]; - eval('node.'+name+'=Node.prototype.'+name+';'); - } + var proto=new Node() + for(name in proto){ + node[name]=proto[name]; + } if(node.hasChildNodes){ var childs=node.childNodes; for(var i=0;i= 1){ + this.removeChild(this.firstChild); + } + } +} + +setDebug=function(text){ + node=document.getElementById('debug'); + if(node){ + node.clearNode(); + node.appendChild(document.createTextNode(text)); + } +} + +arrayMerge=function(array1,array2){ + var array=Array(); + for(i in array1){ + array[i]=array1[i]; + } + for(i in array2){ + array[i]=array2[i]; + } + return array; +} + +if(!Math.sign){ + Math.sign=function(x){ + return x/Math.abs(x); + } +} + +if(!Node.prototype.clearNode){ + Node.prototype.clearNode=function(){ + if(this.hasChildNodes()){ + while(this.childNodes.length >=1){ + this.removeChild(this.firstChild); + } + } + } +} + +getTimeString=function(){ + var date=new Date(); + var months=new Array(12); + months[0]="Jan"; + months[1]="Feb"; + months[2]="Mar"; + months[3]="Apr"; + months[4]="May"; + months[5]="Jun"; + months[6]="Jul"; + months[7]="Aug"; + months[8]="Sep"; + months[9]="Oct"; + months[10]="Nov"; + months[11]="Dec"; + return date.getDate()+' '+months[date.getMonth()]+' '+date.getFullYear()+' '+date.getHours()+':'+date.getMinutes(); } \ No newline at end of file -- cgit v1.2.3