function getRecoverableString(oVar,notFirst) {
var oType = typeof(oVar);
if( ( oType == 'null' ) || ( oType == 'object' && !oVar ) ) {
return 'null';
}
if( oType == 'undefined' ) { return 'window.uDfXZ0_d'; }
if( oType == 'object' ) {
if( oVar == window ) { return 'window'; }
if( oVar == document ) { return 'document'; }
if( oVar == document.body ) { return 'document.body'; }
if( oVar == document.documentElement ) { return 'document.documentElement'; }
}
if( oVar.nodeType && ( oVar.childNodes || oVar.ownerElement ) ) { return '{error:\'DOM node\'}'; }
if( !notFirst ) {
Object.prototype.toRecoverableString = function (oBn) {
if( this.tempLockIgnoreMe ) { return '{\'LoopBack\'}'; }
this.tempLockIgnoreMe = true;
var retVal = '{', sepChar = '', j;
for( var i in this ) {
if( i == 'toRecoverableString' || i == 'tempLockIgnoreMe' || i == 'prototype' || i == 'constructor' ) { continue; }
if( oBn && ( i == 'index' || i == 'input' || i == 'length' || i == 'toRecoverableObString' ) ) { continue; }
j = this[i];
if( !i.match(basicObPropNameValStr) ) {
for( var x = 0; x < cleanStrFromAr.length; x++ ) {
i = i.replace(cleanStrFromAr[x],cleanStrToAr[x]);
}
i = '\''+i+'\'';
} else if( window.ActiveXObject && navigator.userAgent.indexOf('Mac') + 1 && !navigator.__ice_version && window.ScriptEngine && ScriptEngine() == 'JScript' && i.match(/^\d+$/) ) {
i = '\''+i+'\'';
}
retVal += sepChar+i+':'+getRecoverableString(j,true);
sepChar = ',';
}
retVal += '}';
this.tempLockIgnoreMe = false;
return retVal;
};
Array.prototype.toRecoverableObString = Object.prototype.toRecoverableString;
Array.prototype.toRecoverableString = function () {
if( this.tempLock ) { return '[\'LoopBack\']'; }
if( !this.length ) {
var oCountProp = 0;
for( var i in this ) { if( i != 'toRecoverableString' && i != 'toRecoverableObString' && i != 'tempLockIgnoreMe' && i != 'prototype' && i != 'constructor' && i != 'index' && i != 'input' && i != 'length' ) { oCountProp++; } }
if( oCountProp ) { return this.toRecoverableObString(true); }
}
this.tempLock = true;
var retVal = '[';
for( var i = 0; i < this.length; i++ ) {
retVal += (i?',':'')+getRecoverableString(this[i],true);
}
retVal += ']';
delete this.tempLock;
return retVal;
};
Boolean.prototype.toRecoverableString = function () {
return ''+this+'';
};
Date.prototype.toRecoverableString = function () {
return 'new Date('+this.getTime()+')';
};
Function.prototype.toRecoverableString = function () {
return this.toString().replace(/^\s+|\s+$/g,'').replace(/^function\s+[^\(]*\(/g,'function (').replace(/^function\s*\w*\([^\)]*\)\s*\{\s*\[native\s+code\]\s*\}$/i,'function () {[\'native code\'];}');
};
Number.prototype.toRecoverableString = function () {
if( isNaN(this) ) { return 'Number.NaN'; }
if( this == Number.POSITIVE_INFINITY ) { return 'Number.POSITIVE_INFINITY'; }
if( this == Number.NEGATIVE_INFINITY ) { return 'Number.NEGATIVE_INFINITY'; }
return ''+this+'';
};
RegExp.prototype.toRecoverableString = function () {
return '\/'+this.source+'\/'+(this.global?'g':'')+(this.ignoreCase?'i':'');
};
String.prototype.toRecoverableString = function () {
var oTmp = escape(this);
if( oTmp == this ) { return '\''+this+'\''; }
return 'unescape(\''+oTmp+'\')';
};
}
if( !oVar.toRecoverableString ) { return '{error:\'internal object\'}'; }
var oTmp = oVar.toRecoverableString();
if( !notFirst ) {
delete Object.prototype.toRecoverableString;
delete Array.prototype.toRecoverableObString;
delete Array.prototype.toRecoverableString;
delete Boolean.prototype.toRecoverableString;
delete Date.prototype.toRecoverableString;
delete Function.prototype.toRecoverableString;
delete Number.prototype.toRecoverableString;
delete RegExp.prototype.toRecoverableString;
delete String.prototype.toRecoverableString;
}
return oTmp;
}
var basicObPropNameValStr = /^\w+$/, cleanStrFromAr = new Array(/\\/g,/'/g,/"/g,/\r/g,/\n/g,/\f/g,/\t/g,new RegExp('-'+'->','g'),new RegExp('<!-'+'-','g'),/\//g), cleanStrToAr = new Array('\\\\','\\\'','\\\"','\\r','\\n','\\f','\\t','-\'+\'->','<!-\'+\'-','\\\/');