summaryrefslogtreecommitdiff
path: root/framework/Web/Javascripts/js/base.js
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Web/Javascripts/js/base.js')
-rw-r--r--framework/Web/Javascripts/js/base.js192
1 files changed, 99 insertions, 93 deletions
diff --git a/framework/Web/Javascripts/js/base.js b/framework/Web/Javascripts/js/base.js
index 86c7ef83..8b687300 100644
--- a/framework/Web/Javascripts/js/base.js
+++ b/framework/Web/Javascripts/js/base.js
@@ -1,4 +1,4 @@
-var Prototype={Version:"1.4.0_rc1",emptyFunction:function(){
+var Prototype={Version:"1.4.0",ScriptFragment:"(?:<script.*?>)((\n|\r|.)*?)(?:</script>)",emptyFunction:function(){
},K:function(x){
return x;
}};
@@ -60,47 +60,47 @@ return "...";
throw e;
}
};
-Function.prototype.bind=function(_4){
-var _5=this;
+Function.prototype.bind=function(){
+var _4=this,args=$A(arguments),object=args.shift();
return function(){
-return _5.apply(_4,arguments);
+return _4.apply(object,args.concat($A(arguments)));
};
};
-Function.prototype.bindAsEventListener=function(_6){
-var _7=this;
-return function(_8){
-return _7.call(_6,_8||window.event);
+Function.prototype.bindAsEventListener=function(_5){
+var _6=this;
+return function(_7){
+return _6.call(_5,_7||window.event);
};
};
Object.extend(Number.prototype,{toColorPart:function(){
-var _9=this.toString(16);
+var _8=this.toString(16);
if(this<16){
-return "0"+_9;
+return "0"+_8;
}
-return _9;
+return _8;
},succ:function(){
return this+1;
-},times:function(_10){
-$R(0,this,true).each(_10);
+},times:function(_9){
+$R(0,this,true).each(_9);
return this;
}});
var Try={these:function(){
-var _11;
+var _10;
for(var i=0;i<arguments.length;i++){
-var _13=arguments[i];
+var _12=arguments[i];
try{
-_11=_13();
+_10=_12();
break;
}
catch(e){
}
}
-return _11;
+return _10;
}};
var PeriodicalExecuter=Class.create();
-PeriodicalExecuter.prototype={initialize:function(_14,_15){
-this.callback=_14;
-this.frequency=_15;
+PeriodicalExecuter.prototype={initialize:function(_13,_14){
+this.callback=_13;
+this.frequency=_14;
this.currentlyExecuting=false;
this.registerCallback();
},registerCallback:function(){
@@ -117,18 +117,18 @@ this.currentlyExecuting=false;
}
}};
function $(){
-var _16=new Array();
+var _15=new Array();
for(var i=0;i<arguments.length;i++){
-var _17=arguments[i];
-if(typeof _17=="string"){
-_17=document.getElementById(_17);
+var _16=arguments[i];
+if(typeof _16=="string"){
+_16=document.getElementById(_16);
}
if(arguments.length==1){
-return _17;
+return _16;
}
-_16.push(_17);
+_15.push(_16);
}
-return _16;
+return _15;
}
function isElement(o,_2){
@@ -221,35 +221,45 @@ return o&&isObject(o)&&(isArray(o)||o.item);
Object.extend(String.prototype,{stripTags:function(){
return this.replace(/<\/?[^>]+>/gi,"");
+},stripScripts:function(){
+return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"");
+},extractScripts:function(){
+var _1=new RegExp(Prototype.ScriptFragment,"img");
+var _2=new RegExp(Prototype.ScriptFragment,"im");
+return (this.match(_1)||[]).map(function(_3){
+return (_3.match(_2)||["",""])[1];
+});
+},evalScripts:function(){
+return this.extractScripts().map(eval);
},escapeHTML:function(){
-var _1=document.createElement("div");
-var _2=document.createTextNode(this);
-_1.appendChild(_2);
-return _1.innerHTML;
+var _4=document.createElement("div");
+var _5=document.createTextNode(this);
+_4.appendChild(_5);
+return _4.innerHTML;
},unescapeHTML:function(){
-var _3=document.createElement("div");
-_3.innerHTML=this.stripTags();
-return _3.childNodes[0]?_3.childNodes[0].nodeValue:"";
+var _6=document.createElement("div");
+_6.innerHTML=this.stripTags();
+return _6.childNodes[0]?_6.childNodes[0].nodeValue:"";
},toQueryParams:function(){
-var _4=this.match(/^\??(.*)$/)[1].split("&");
-return _4.inject({},function(_5,_6){
-var _7=_6.split("=");
-_5[_7[0]]=_7[1];
-return _5;
+var _7=this.match(/^\??(.*)$/)[1].split("&");
+return _7.inject({},function(_8,_9){
+var _10=_9.split("=");
+_8[_10[0]]=_10[1];
+return _8;
});
},toArray:function(){
return this.split("");
},camelize:function(){
-var _8=this.split("-");
-if(_8.length==1){
-return _8[0];
+var _11=this.split("-");
+if(_11.length==1){
+return _11[0];
}
-var _9=this.indexOf("-")==0?_8[0].charAt(0).toUpperCase()+_8[0].substring(1):_8[0];
-for(var i=1,len=_8.length;i<len;i++){
-var s=_8[i];
-_9+=s.charAt(0).toUpperCase()+s.substring(1);
+var _12=this.indexOf("-")==0?_11[0].charAt(0).toUpperCase()+_11[0].substring(1):_11[0];
+for(var i=1,len=_11.length;i<len;i++){
+var s=_11[i];
+_12+=s.charAt(0).toUpperCase()+s.substring(1);
}
-return _9;
+return _12;
},inspect:function(){
return "'"+this.replace("\\","\\\\").replace("'","\\'")+"'";
}});
@@ -282,6 +292,22 @@ return this.replace(/^\s+|\s+$/g,"");
return this.replace(/^\s+/,"");
},trimRight:function(){
return this.replace(/\s+$/,"");
+},toFunction:function(){
+var _12=this.split(/\./);
+var _13=window;
+_12.each(function(_14){
+if(_13[new String(_14)]){
+_13=_13[new String(_14)];
+}
+});
+if(isFunction(_13)){
+return _13;
+}else{
+if(typeof Logger!="undefined"){
+Logger.error("Missing function",this);
+}
+return Prototype.emptyFunction;
+}
}});
var $break=new Object();
@@ -308,7 +334,8 @@ throw e;
},all:function(_4){
var _5=true;
this.each(function(_6,_7){
-if(!(_5&=(_4||Prototype.K)(_6,_7))){
+_5=_5&&!!(_4||Prototype.K)(_6,_7);
+if(!_5){
throw $break;
}
});
@@ -316,7 +343,7 @@ return _5;
},any:function(_8){
var _9=true;
this.each(function(_10,_11){
-if(_9&=(_8||Prototype.K)(_10,_11)){
+if(_9=!!(_8||Prototype.K)(_10,_11)){
throw $break;
}
});
@@ -435,6 +462,9 @@ return "#<Enumerable:"+this.toArray().inspect()+">";
Object.extend(Enumerable,{map:Enumerable.collect,find:Enumerable.detect,select:Enumerable.findAll,member:Enumerable.include,entries:Enumerable.toArray});
var $A=Array.from=function(_1){
+if(!_1){
+return [];
+}
if(_1.toArray){
return _1.toArray();
}else{
@@ -446,10 +476,14 @@ return _2;
}
};
Object.extend(Array.prototype,Enumerable);
+Array.prototype._reverse=Array.prototype.reverse;
Object.extend(Array.prototype,{_each:function(_4){
for(var i=0;i<this.length;i++){
_4(this[i]);
}
+},clear:function(){
+this.length=0;
+return this;
},first:function(){
return this[0];
},last:function(){
@@ -473,13 +507,16 @@ if(this[i]==_10){
return i;
}
}
-return false;
-},reverse:function(){
-var _11=[];
-for(var i=this.length;i>0;i--){
-_11.push(this[i-1]);
-}
-return _11;
+return -1;
+},reverse:function(_11){
+return (_11!==false?this:this.toArray())._reverse();
+},shift:function(){
+var _12=this[0];
+for(var i=0;i<this.length-1;i++){
+this[i]=this[i+1];
+}
+this.length--;
+return _12;
},inspect:function(){
return "["+this.map(Object.inspect).join(", ")+"]";
}});
@@ -782,9 +819,9 @@ Object.extend(_10,Hash);
return _10;
}
-var Range=Class.create();
-Object.extend(Range.prototype,Enumerable);
-Object.extend(Range.prototype,{initialize:function(_1,_2,_3){
+ObjectRange=Class.create();
+Object.extend(ObjectRange.prototype,Enumerable);
+Object.extend(ObjectRange.prototype,{initialize:function(_1,_2,_3){
this.start=_1;
this.end=_2;
this.exclusive=_3;
@@ -804,7 +841,7 @@ return _6<this.end;
return _6<=this.end;
}});
var $R=function(_7,_8,_9){
-return new Range(_7,_8,_9);
+return new ObjectRange(_7,_8,_9);
};
function __strfn(_1,fn){
@@ -839,38 +876,7 @@ _7.push(fn(_6[i],i,_6));
return _7;
}
-Prado=Class.create();
-Prado.version="3.0a";
-Prado.Button=Class.create();
-Prado.Button.buttonFired=false;
-Prado.Button.fireButton=function(_1,_2){
-if(!Prado.Button.buttonFired&&_1.keyCode==13&&!(_1.srcElement&&(_1.srcElement.tagName.toLowerCase()=="textarea"))){
-var _3=document.getElementById?document.getElementById(_2):document.all[_2];
-if(_3&&typeof (_3.click)!="undefined"){
-Prado.Button.buttonFired=true;
-_3.click();
-_1.cancelBubble=true;
-if(_1.stopPropagation){
-_1.stopPropagation();
-}
-return false;
-}
-}
-return true;
-};
-Prado.TextBox=Class.create();
-Prado.TextBox.handleReturnKey=function(ev){
-var kc=ev.keyCode!=null?ev.keyCode:ev.charCode;
-if(kc==Event.KEY_RETURN){
-var _6=Event.element(ev);
-if(_6&&isFunction(_6.onchange)){
-_6.onchange();
-Event.stop(ev);
-return false;
-}
-}
-return true;
-};
+var Prado={Version:2};
Prado.doPostBack=function(_1,_2,_3,_4,_5,_6,_7,_8){
if(typeof (_4)=="undefined"){
@@ -883,7 +889,7 @@ var _8=true;
var _9=document.getElementById?document.getElementById(_1):document.forms[_1];
var _10=true;
if(_4){
-_10=Prado.Validation.OnSubmit();
+_10=Prado.Validation.IsValid(_9);
}
if(_10){
if(_6!=null&&(_6.length>0)){