mirror of
https://github.com/wahyd4/cdnjs.git
synced 2026-08-10 21:35:56 +10:00
3 lines
100 KiB
JavaScript
3 lines
100 KiB
JavaScript
Array.prototype.push||(Array.prototype.push=function(){for(var e=0,t=arguments.length;t>e;e++)this[this.length]=arguments[e];return this.length}),Array.prototype.shift||(Array.prototype.shift=function(){if(this.length>0){for(var e=this[0],t=0,i=this.length-1;i>t;t++)this[t]=this[t+1];return this.length=this.length-1,e}}),Array.prototype.splice||(Array.prototype.splice=function(e,t){var i=this.slice(e+t),n=this.slice(e,e+t);this.length=e;for(var r=[],o=0,s=arguments.length;s>o;o++)r[o]=arguments[o];var a=r.length>2?i=r.slice(2).concat(i):i;for(o=0,s=a.length;s>o;o++)this.push(a[o]);return n});var log4javascript=function(){function isUndefined(e){return e===void 0}function EventSupport(){}function Log4JavaScript(){}function toStr(e){return e&&e.toString?""+e:e+""}function getExceptionMessage(e){return e.message?e.message:e.description?e.description:toStr(e)}function getUrlFileName(e){var t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return e.substr(t+1)}function getExceptionStringRep(e){if(e){var t="Exception: "+getExceptionMessage(e);try{e.lineNumber&&(t+=" on line number "+e.lineNumber),e.fileName&&(t+=" in file "+getUrlFileName(e.fileName))}catch(i){logLog.warn("Unable to obtain file and line information for error")}return showStackTraces&&e.stack&&(t+=newLine+"Stack trace:"+newLine+e.stack),t}return null}function bool(e){return Boolean(e)}function trim(e){return e.replace(/^\s+/,"").replace(/\s+$/,"")}function splitIntoLines(e){var t=e.replace(/\r\n/g,"\n").replace(/\r/g,"\n");return t.split("\n")}function array_remove(e,t){for(var i=-1,n=0,r=e.length;r>n;n++)if(e[n]===t){i=n;break}return i>=0?(e.splice(i,1),!0):!1}function array_contains(e,t){for(var i=0,n=e.length;n>i;i++)if(e[i]==t)return!0;return!1}function extractBooleanFromParam(e,t){return isUndefined(e)?t:bool(e)}function extractStringFromParam(e,t){return isUndefined(e)?t:e+""}function extractIntFromParam(e,t){if(isUndefined(e))return t;try{var i=parseInt(e,10);return isNaN(i)?t:i}catch(n){return logLog.warn("Invalid int param "+e,n),t}}function extractFunctionFromParam(e,t){return"function"==typeof e?e:t}function isError(e){return e instanceof Error}function getListenersPropertyName(e){return"__log4javascript_listeners__"+e}function addEvent(e,t,i,n,r){if(r=r?r:window,e.addEventListener)e.addEventListener(t,i,n);else if(e.attachEvent)e.attachEvent("on"+t,i);else{var o=getListenersPropertyName(t);e[o]||(e[o]=[],e["on"+t]=function(e){e=getEvent(e,r);for(var i,n=getListenersPropertyName(t),o=this[n].concat([]);i=o.shift();)i.call(this,e)}),e[o].push(i)}}function removeEvent(e,t,i,n){if(e.removeEventListener)e.removeEventListener(t,i,n);else if(e.detachEvent)e.detachEvent("on"+t,i);else{var r=getListenersPropertyName(t);e[r]&&array_remove(e[r],i)}}function getEvent(e,t){return t=t?t:window,e?e:t.event}function stopEventPropagation(e){e.stopPropagation?e.stopPropagation():e.cancelBubble!==void 0&&(e.cancelBubble=!0),e.returnValue=!1}function handleError(e,t){logLog.error(e,t),log4javascript.dispatchEvent("error",{message:e,exception:t})}function Timer(e,t){this.name=e,this.level=isUndefined(t)?Level.INFO:t,this.start=new Date}function Logger(e){this.name=e,this.parent=null,this.children=[];var t=[],i=null,n=this.name===rootLoggerName,r=this.name===nullLoggerName,o=null,s=!1;this.addChild=function(e){this.children.push(e),e.parent=this,e.invalidateAppenderCache()};var a=!0;this.getAdditivity=function(){return a},this.setAdditivity=function(e){var t=a!=e;a=e,t&&this.invalidateAppenderCache()},this.addAppender=function(e){r?handleError("Logger.addAppender: you may not add an appender to the null logger"):e instanceof log4javascript.Appender?array_contains(t,e)||(t.push(e),e.setAddedToLogger(this),this.invalidateAppenderCache()):handleError("Logger.addAppender: appender supplied ('"+toStr(e)+"') is not a subclass of Appender")},this.removeAppender=function(e){array_remove(t,e),e.setRemovedFromLogger(this),this.invalidateAppenderCache()},this.removeAllAppenders=function(){var e=t.length;if(e>0){for(var i=0;e>i;i++)t[i].setRemovedFromLogger(this);t.length=0,this.invalidateAppenderCache()}},this.getEffectiveAppenders=function(){if(null===o||s){var e=n||!this.getAdditivity()?[]:this.parent.getEffectiveAppenders();o=e.concat(t),s=!1}return o},this.invalidateAppenderCache=function(){s=!0;for(var e=0,t=this.children.length;t>e;e++)this.children[e].invalidateAppenderCache()},this.log=function(e,t){if(enabled&&e.isGreaterOrEqual(this.getEffectiveLevel())){var i,n=t.length-1,r=t[n];t.length>1&&isError(r)&&(i=r,n--);for(var o=[],s=0;n>=s;s++)o[s]=t[s];var a=new LoggingEvent(this,new Date,e,o,i);this.callAppenders(a)}},this.callAppenders=function(e){for(var t=this.getEffectiveAppenders(),i=0,n=t.length;n>i;i++)t[i].doAppend(e)},this.setLevel=function(e){n&&null===e?handleError("Logger.setLevel: you cannot set the level of the root logger to null"):e instanceof Level?i=e:handleError("Logger.setLevel: level supplied to logger "+this.name+" is not an instance of log4javascript.Level")},this.getLevel=function(){return i},this.getEffectiveLevel=function(){for(var e=this;null!==e;e=e.parent){var t=e.getLevel();if(null!==t)return t}},this.group=function(e,t){if(enabled)for(var i=this.getEffectiveAppenders(),n=0,r=i.length;r>n;n++)i[n].group(e,t)},this.groupEnd=function(){if(enabled)for(var e=this.getEffectiveAppenders(),t=0,i=e.length;i>t;t++)e[t].groupEnd()};var l={};this.time=function(e,t){enabled&&(isUndefined(e)?handleError("Logger.time: a name for the timer must be supplied"):!t||t instanceof Level?l[e]=new Timer(e,t):handleError("Logger.time: level supplied to timer "+e+" is not an instance of log4javascript.Level"))},this.timeEnd=function(e){if(enabled)if(isUndefined(e))handleError("Logger.timeEnd: a name for the timer must be supplied");else if(l[e]){var t=l[e],i=t.getElapsedTime();this.log(t.level,["Timer "+toStr(e)+" completed in "+i+"ms"]),delete l[e]}else logLog.warn("Logger.timeEnd: no timer found with name "+e)},this.assert=function(e){if(enabled&&!e){for(var t=[],i=1,n=arguments.length;n>i;i++)t.push(arguments[i]);t=t.length>0?t:["Assertion Failure"],t.push(newLine),t.push(e),this.log(Level.ERROR,t)}},this.toString=function(){return"Logger["+this.name+"]"}}function SimpleLayout(){this.customFields=[]}function NullLayout(){this.customFields=[]}function XmlLayout(e){this.combineMessages=extractBooleanFromParam(e,!0),this.customFields=[]}function escapeNewLines(e){return e.replace(/\r\n|\r|\n/g,"\\r\\n")}function JsonLayout(e,t){this.readable=extractBooleanFromParam(e,!1),this.combineMessages=extractBooleanFromParam(t,!0),this.batchHeader=this.readable?"["+newLine:"[",this.batchFooter=this.readable?"]"+newLine:"]",this.batchSeparator=this.readable?","+newLine:",",this.setKeys(),this.colon=this.readable?": ":":",this.tab=this.readable?" ":"",this.lineBreak=this.readable?newLine:"",this.customFields=[]}function HttpPostDataLayout(){this.setKeys(),this.customFields=[],this.returnsPostData=!0}function formatObjectExpansion(e,t,i){function n(e,t,i){function o(e){for(var t=splitIntoLines(e),n=1,r=t.length;r>n;n++)t[n]=i+t[n];return t.join(newLine)}var s,a,l,c,h,u,d;if(i||(i=""),null===e)return"null";if(e===void 0)return"undefined";if("string"==typeof e)return o(e);if("object"==typeof e&&array_contains(r,e)){try{u=toStr(e)}catch(p){u="Error formatting property. Details: "+getExceptionStringRep(p)}return u+" [already expanded]"}if(e instanceof Array&&t>0){for(r.push(e),u="["+newLine,l=t-1,c=i+" ",h=[],s=0,a=e.length;a>s;s++)try{d=n(e[s],l,c),h.push(c+d)}catch(p){h.push(c+"Error formatting array member. Details: "+getExceptionStringRep(p))}return u+=h.join(","+newLine)+newLine+i+"]"}if("[object Date]"==Object.prototype.toString.call(e))return""+e;if("object"==typeof e&&t>0){r.push(e),u="{"+newLine,l=t-1,c=i+" ",h=[];for(s in e)try{d=n(e[s],l,c),h.push(c+s+": "+d)}catch(p){h.push(c+s+": Error formatting property. Details: "+getExceptionStringRep(p))}return u+=h.join(","+newLine)+newLine+i+"}"}return o(toStr(e))}var r=[];return n(e,t,i)}function PatternLayout(e){this.pattern=e?e:PatternLayout.DEFAULT_CONVERSION_PATTERN,this.customFields=[]}function AlertAppender(){}function BrowserConsoleAppender(){}function isHttpRequestSuccessful(e){return isUndefined(e.status)||0===e.status||e.status>=200&&300>e.status}function AjaxAppender(e){function t(e){return k?(handleError("AjaxAppender: configuration option '"+e+"' may not be set after the appender has been initialized"),!1):!0}function i(){if(h&&enabled){w=!0;var e;if(d)_.length>0?(e=_.shift(),a(r(e),i)):(w=!1,u&&o());else{for(;e=_.shift();)a(r(e));w=!1,u&&o()}}}function n(){var e=!1;if(h&&enabled){for(var t,n=c.getLayout().allowBatching()?p:1,r=[];t=x.shift();)r.push(t),x.length>=n&&(_.push(r),r=[]);r.length>0&&_.push(r),e=_.length>0,d=!1,u=!1,i()}return e}function r(e){for(var t,i=[],n="";t=e.shift();){var r=c.getLayout().format(t);c.getLayout().ignoresThrowable()&&(r+=t.getThrowableStrRep()),i.push(r)}return n=1==e.length?i.join(""):c.getLayout().batchHeader+i.join(c.getLayout().batchSeparator)+c.getLayout().batchFooter,n=c.getLayout().returnsPostData?n:urlEncode(v)+"="+urlEncode(n),n.length>0&&(n+="&"),n+"layout="+urlEncode(""+c.getLayout())}function o(){window.setTimeout(i,f)}function s(){var e="AjaxAppender: could not create XMLHttpRequest object. AjaxAppender disabled";handleError(e),h=!1,m&&m(e)}function a(t,i){try{var n=getXmlHttp(s);if(h){n.overrideMimeType&&n.overrideMimeType(c.getLayout().getContentType()),n.onreadystatechange=function(){if(4==n.readyState){if(isHttpRequestSuccessful(n))g&&g(n),i&&i(n);else{var t="AjaxAppender.append: XMLHttpRequest request to URL "+e+" returned status code "+n.status;handleError(t),m&&m(t)}n.onreadystatechange=emptyFunction,n=null}},n.open("POST",e,!0);try{n.setRequestHeader("Content-Type","application/x-www-form-urlencoded");for(var r,o=0;r=C[o++];)n.setRequestHeader(r.name,r.value)}catch(a){var l="AjaxAppender.append: your browser's XMLHttpRequest implementation does not support setRequestHeader, therefore cannot post data. AjaxAppender disabled";return handleError(l),h=!1,m&&m(l),void 0}n.send(t)}}catch(u){var d="AjaxAppender.append: error sending log message to "+e;handleError(d,u),h=!1,m&&m(d+". Details: "+getExceptionStringRep(u))}}function l(){if(k=!0,b){var e=window.onbeforeunload;window.onbeforeunload=function(){return e&&e(),n()?"Sending log messages":void 0}}u&&o()}var c=this,h=!0;e||(handleError("AjaxAppender: URL must be specified in constructor"),h=!1);var u=this.defaults.timed,d=this.defaults.waitForResponse,p=this.defaults.batchSize,f=this.defaults.timerInterval,g=this.defaults.requestSuccessCallback,m=this.defaults.failCallback,v=this.defaults.postVarName,b=this.defaults.sendAllOnUnload,y=null,x=[],_=[],C=[],w=!1,k=!1;this.getSessionId=function(){return y},this.setSessionId=function(e){y=extractStringFromParam(e,null),this.layout.setCustomField("sessionid",y)},this.setLayout=function(e){t("layout")&&(this.layout=e,null!==y&&this.setSessionId(y))},this.isTimed=function(){return u},this.setTimed=function(e){t("timed")&&(u=bool(e))},this.getTimerInterval=function(){return f},this.setTimerInterval=function(e){t("timerInterval")&&(f=extractIntFromParam(e,f))},this.isWaitForResponse=function(){return d},this.setWaitForResponse=function(e){t("waitForResponse")&&(d=bool(e))},this.getBatchSize=function(){return p},this.setBatchSize=function(e){t("batchSize")&&(p=extractIntFromParam(e,p))},this.isSendAllOnUnload=function(){return b},this.setSendAllOnUnload=function(e){t("sendAllOnUnload")&&(b=extractBooleanFromParam(e,b))},this.setRequestSuccessCallback=function(e){g=extractFunctionFromParam(e,g)},this.setFailCallback=function(e){m=extractFunctionFromParam(e,m)},this.getPostVarName=function(){return v},this.setPostVarName=function(e){t("postVarName")&&(v=extractStringFromParam(e,v))},this.getHeaders=function(){return C},this.addHeader=function(e,t){C.push({name:e,value:t})},this.sendAll=i,this.append=function(e){if(h){k||l(),x.push(e);var t=this.getLayout().allowBatching()?p:1;if(x.length>=t){for(var n,r=[];n=x.shift();)r.push(n);_.push(r),u||d&&(!d||w)||i()}}}}function setCookie(e,t,i,n){var r;if(n=n?"; path="+n:"",i){var o=new Date;o.setTime(o.getTime()+1e3*60*60*24*i),r="; expires="+o.toGMTString()}else r="";document.cookie=escape(e)+"="+escape(t)+r+n}function getCookie(e){for(var t=escape(e)+"=",i=document.cookie.split(";"),n=0,r=i.length;r>n;n++){for(var o=i[n];" "===o.charAt(0);)o=o.substring(1,o.length);if(0===o.indexOf(t))return unescape(o.substring(t.length,o.length))}return null}function getBaseUrl(){for(var e=document.getElementsByTagName("script"),t=0,i=e.length;i>t;++t)if(-1!=e[t].src.indexOf("log4javascript")){var n=e[t].src.lastIndexOf("/");return-1==n?"":e[t].src.substr(0,n+1)}return null}function isLoaded(e){try{return bool(e.loaded)}catch(t){return!1}}function padWithSpaces(e,t){if(t>e.length){for(var i=[],n=Math.max(0,t-e.length),r=0;n>r;r++)i[r]=" ";e+=i.join("")}return e}EventSupport.prototype={eventTypes:[],eventListeners:{},setEventTypes:function(e){if(e instanceof Array){this.eventTypes=e,this.eventListeners={};for(var t=0,i=this.eventTypes.length;i>t;t++)this.eventListeners[this.eventTypes[t]]=[]}else handleError("log4javascript.EventSupport ["+this+"]: setEventTypes: eventTypes parameter must be an Array")},addEventListener:function(e,t){"function"==typeof t?(array_contains(this.eventTypes,e)||handleError("log4javascript.EventSupport ["+this+"]: addEventListener: no event called '"+e+"'"),this.eventListeners[e].push(t)):handleError("log4javascript.EventSupport ["+this+"]: addEventListener: listener must be a function")},removeEventListener:function(e,t){"function"==typeof t?(array_contains(this.eventTypes,e)||handleError("log4javascript.EventSupport ["+this+"]: removeEventListener: no event called '"+e+"'"),array_remove(this.eventListeners[e],t)):handleError("log4javascript.EventSupport ["+this+"]: removeEventListener: listener must be a function")},dispatchEvent:function(e,t){if(array_contains(this.eventTypes,e))for(var i=this.eventListeners[e],n=0,r=i.length;r>n;n++)i[n](this,e,t);else handleError("log4javascript.EventSupport ["+this+"]: dispatchEvent: no event called '"+e+"'")}};var applicationStartDate=new Date,uniqueId="log4javascript_"+applicationStartDate.getTime()+"_"+Math.floor(1e8*Math.random()),emptyFunction=function(){},newLine="\r\n",pageLoaded=!1;Log4JavaScript.prototype=new EventSupport,log4javascript=new Log4JavaScript,log4javascript.version="1.4.3",log4javascript.edition="log4javascript";var urlEncode=window.encodeURIComponent!==void 0?function(e){return encodeURIComponent(e)}:function(e){return escape(e).replace(/\+/g,"%2B").replace(/"/g,"%22").replace(/'/g,"%27").replace(/\//g,"%2F").replace(/=/g,"%3D")},urlDecode=window.decodeURIComponent!==void 0?function(e){return decodeURIComponent(e)}:function(e){return unescape(e).replace(/%2B/g,"+").replace(/%22/g,'"').replace(/%27/g,"'").replace(/%2F/g,"/").replace(/%3D/g,"=")};Function.prototype.apply||(Function.prototype.apply=function(obj,args){var methodName="__apply__";obj[methodName]!==void 0&&(methodName+=(Math.random()+"").substr(2)),obj[methodName]=this;for(var argsStrings=[],i=0,len=args.length;len>i;i++)argsStrings[i]="args["+i+"]";var script="obj."+methodName+"("+argsStrings.join(",")+")",returnValue=eval(script);return delete obj[methodName],returnValue}),Function.prototype.call||(Function.prototype.call=function(e){for(var t=[],i=1,n=arguments.length;n>i;i++)t[i-1]=arguments[i];return this.apply(e,t)});var logLog={quietMode:!1,debugMessages:[],setQuietMode:function(e){this.quietMode=bool(e)},numberOfErrors:0,alertAllErrors:!1,setAlertAllErrors:function(e){this.alertAllErrors=e},debug:function(e){this.debugMessages.push(e)},displayDebug:function(){alert(this.debugMessages.join(newLine))},warn:function(){},error:function(e,t){if((1==++this.numberOfErrors||this.alertAllErrors)&&!this.quietMode){var i="log4javascript error: "+e;t&&(i+=newLine+newLine+"Original error: "+getExceptionStringRep(t)),alert(i)}}};log4javascript.logLog=logLog,log4javascript.setEventTypes(["load","error"]),log4javascript.handleError=handleError;var enabled=!("undefined"!=typeof log4javascript_disabled&&log4javascript_disabled);log4javascript.setEnabled=function(e){enabled=bool(e)},log4javascript.isEnabled=function(){return enabled};var useTimeStampsInMilliseconds=!0;log4javascript.setTimeStampsInMilliseconds=function(e){useTimeStampsInMilliseconds=bool(e)},log4javascript.isTimeStampsInMilliseconds=function(){return useTimeStampsInMilliseconds},log4javascript.evalInScope=function(expr){return eval(expr)};var showStackTraces=!1;log4javascript.setShowStackTraces=function(e){showStackTraces=bool(e)};var Level=function(e,t){this.level=e,this.name=t};Level.prototype={toString:function(){return this.name},equals:function(e){return this.level==e.level},isGreaterOrEqual:function(e){return this.level>=e.level}},Level.ALL=new Level(Number.MIN_VALUE,"ALL"),Level.TRACE=new Level(1e4,"TRACE"),Level.DEBUG=new Level(2e4,"DEBUG"),Level.INFO=new Level(3e4,"INFO"),Level.WARN=new Level(4e4,"WARN"),Level.ERROR=new Level(5e4,"ERROR"),Level.FATAL=new Level(6e4,"FATAL"),Level.OFF=new Level(Number.MAX_VALUE,"OFF"),log4javascript.Level=Level,Timer.prototype.getElapsedTime=function(){return(new Date).getTime()-this.start.getTime()};var anonymousLoggerName="[anonymous]",defaultLoggerName="[default]",nullLoggerName="[null]",rootLoggerName="root";Logger.prototype={trace:function(){this.log(Level.TRACE,arguments)},debug:function(){this.log(Level.DEBUG,arguments)},info:function(){this.log(Level.INFO,arguments)},warn:function(){this.log(Level.WARN,arguments)},error:function(){this.log(Level.ERROR,arguments)},fatal:function(){this.log(Level.FATAL,arguments)},isEnabledFor:function(e){return e.isGreaterOrEqual(this.getEffectiveLevel())},isTraceEnabled:function(){return this.isEnabledFor(Level.TRACE)},isDebugEnabled:function(){return this.isEnabledFor(Level.DEBUG)},isInfoEnabled:function(){return this.isEnabledFor(Level.INFO)},isWarnEnabled:function(){return this.isEnabledFor(Level.WARN)},isErrorEnabled:function(){return this.isEnabledFor(Level.ERROR)},isFatalEnabled:function(){return this.isEnabledFor(Level.FATAL)}},Logger.prototype.trace.isEntryPoint=!0,Logger.prototype.debug.isEntryPoint=!0,Logger.prototype.info.isEntryPoint=!0,Logger.prototype.warn.isEntryPoint=!0,Logger.prototype.error.isEntryPoint=!0,Logger.prototype.fatal.isEntryPoint=!0;var loggers={},loggerNames=[],ROOT_LOGGER_DEFAULT_LEVEL=Level.DEBUG,rootLogger=new Logger(rootLoggerName);rootLogger.setLevel(ROOT_LOGGER_DEFAULT_LEVEL),log4javascript.getRootLogger=function(){return rootLogger},log4javascript.getLogger=function(e){if("string"!=typeof e&&(e=anonymousLoggerName,logLog.warn("log4javascript.getLogger: non-string logger name "+toStr(e)+" supplied, returning anonymous logger")),e==rootLoggerName&&handleError("log4javascript.getLogger: root logger may not be obtained by name"),!loggers[e]){var t=new Logger(e);loggers[e]=t,loggerNames.push(e);var i,n=e.lastIndexOf(".");if(n>-1){var r=e.substring(0,n);i=log4javascript.getLogger(r)}else i=rootLogger;i.addChild(t)}return loggers[e]};var defaultLogger=null;log4javascript.getDefaultLogger=function(){if(!defaultLogger){defaultLogger=log4javascript.getLogger(defaultLoggerName);var e=new log4javascript.PopUpAppender;defaultLogger.addAppender(e)}return defaultLogger};var nullLogger=null;log4javascript.getNullLogger=function(){return nullLogger||(nullLogger=new Logger(nullLoggerName),nullLogger.setLevel(Level.OFF)),nullLogger},log4javascript.resetConfiguration=function(){rootLogger.setLevel(ROOT_LOGGER_DEFAULT_LEVEL),loggers={}};var LoggingEvent=function(e,t,i,n,r){this.logger=e,this.timeStamp=t,this.timeStampInMilliseconds=t.getTime(),this.timeStampInSeconds=Math.floor(this.timeStampInMilliseconds/1e3),this.milliseconds=this.timeStamp.getMilliseconds(),this.level=i,this.messages=n,this.exception=r};LoggingEvent.prototype={getThrowableStrRep:function(){return this.exception?getExceptionStringRep(this.exception):""},getCombinedMessages:function(){return 1==this.messages.length?this.messages[0]:this.messages.join(newLine)},toString:function(){return"LoggingEvent["+this.level+"]"}},log4javascript.LoggingEvent=LoggingEvent;var Layout=function(){};Layout.prototype={defaults:{loggerKey:"logger",timeStampKey:"timestamp",millisecondsKey:"milliseconds",levelKey:"level",messageKey:"message",exceptionKey:"exception",urlKey:"url"},loggerKey:"logger",timeStampKey:"timestamp",millisecondsKey:"milliseconds",levelKey:"level",messageKey:"message",exceptionKey:"exception",urlKey:"url",batchHeader:"",batchFooter:"",batchSeparator:"",returnsPostData:!1,overrideTimeStampsSetting:!1,useTimeStampsInMilliseconds:null,format:function(){handleError("Layout.format: layout supplied has no format() method")},ignoresThrowable:function(){handleError("Layout.ignoresThrowable: layout supplied has no ignoresThrowable() method")},getContentType:function(){return"text/plain"},allowBatching:function(){return!0},setTimeStampsInMilliseconds:function(e){this.overrideTimeStampsSetting=!0,this.useTimeStampsInMilliseconds=bool(e)},isTimeStampsInMilliseconds:function(){return this.overrideTimeStampsSetting?this.useTimeStampsInMilliseconds:useTimeStampsInMilliseconds},getTimeStampValue:function(e){return this.isTimeStampsInMilliseconds()?e.timeStampInMilliseconds:e.timeStampInSeconds},getDataValues:function(e,t){var i=[[this.loggerKey,e.logger.name],[this.timeStampKey,this.getTimeStampValue(e)],[this.levelKey,e.level.name],[this.urlKey,window.location.href],[this.messageKey,t?e.getCombinedMessages():e.messages]];if(this.isTimeStampsInMilliseconds()||i.push([this.millisecondsKey,e.milliseconds]),e.exception&&i.push([this.exceptionKey,getExceptionStringRep(e.exception)]),this.hasCustomFields())for(var n=0,r=this.customFields.length;r>n;n++){var o=this.customFields[n].value;"function"==typeof o&&(o=o(this,e)),i.push([this.customFields[n].name,o])}return i},setKeys:function(e,t,i,n,r,o,s){this.loggerKey=extractStringFromParam(e,this.defaults.loggerKey),this.timeStampKey=extractStringFromParam(t,this.defaults.timeStampKey),this.levelKey=extractStringFromParam(i,this.defaults.levelKey),this.messageKey=extractStringFromParam(n,this.defaults.messageKey),this.exceptionKey=extractStringFromParam(r,this.defaults.exceptionKey),this.urlKey=extractStringFromParam(o,this.defaults.urlKey),this.millisecondsKey=extractStringFromParam(s,this.defaults.millisecondsKey)},setCustomField:function(e,t){for(var i=!1,n=0,r=this.customFields.length;r>n;n++)this.customFields[n].name===e&&(this.customFields[n].value=t,i=!0);i||this.customFields.push({name:e,value:t})},hasCustomFields:function(){return this.customFields.length>0},toString:function(){handleError("Layout.toString: all layouts must override this method")}},log4javascript.Layout=Layout;var Appender=function(){};Appender.prototype=new EventSupport,Appender.prototype.layout=new PatternLayout,Appender.prototype.threshold=Level.ALL,Appender.prototype.loggers=[],Appender.prototype.doAppend=function(e){enabled&&e.level.level>=this.threshold.level&&this.append(e)},Appender.prototype.append=function(){},Appender.prototype.setLayout=function(e){e instanceof Layout?this.layout=e:handleError("Appender.setLayout: layout supplied to "+(""+this)+" is not a subclass of Layout")},Appender.prototype.getLayout=function(){return this.layout},Appender.prototype.setThreshold=function(e){e instanceof Level?this.threshold=e:handleError("Appender.setThreshold: threshold supplied to "+(""+this)+" is not a subclass of Level")},Appender.prototype.getThreshold=function(){return this.threshold},Appender.prototype.setAddedToLogger=function(e){this.loggers.push(e)},Appender.prototype.setRemovedFromLogger=function(e){array_remove(this.loggers,e)},Appender.prototype.group=emptyFunction,Appender.prototype.groupEnd=emptyFunction,Appender.prototype.toString=function(){handleError("Appender.toString: all appenders must override this method")},log4javascript.Appender=Appender,SimpleLayout.prototype=new Layout,SimpleLayout.prototype.format=function(e){return e.level.name+" - "+e.getCombinedMessages()},SimpleLayout.prototype.ignoresThrowable=function(){return!0},SimpleLayout.prototype.toString=function(){return"SimpleLayout"},log4javascript.SimpleLayout=SimpleLayout,NullLayout.prototype=new Layout,NullLayout.prototype.format=function(e){return e.messages},NullLayout.prototype.ignoresThrowable=function(){return!0},NullLayout.prototype.toString=function(){return"NullLayout"},log4javascript.NullLayout=NullLayout,XmlLayout.prototype=new Layout,XmlLayout.prototype.isCombinedMessages=function(){return this.combineMessages},XmlLayout.prototype.getContentType=function(){return"text/xml"},XmlLayout.prototype.escapeCdata=function(e){return e.replace(/\]\]>/,"]]>]]><![CDATA[")},XmlLayout.prototype.format=function(e){function t(e){return e="string"==typeof e?e:toStr(e),"<log4javascript:message><![CDATA["+r.escapeCdata(e)+"]]></log4javascript:message>"}var i,n,r=this,o='<log4javascript:event logger="'+e.logger.name+'" timestamp="'+this.getTimeStampValue(e)+'"';if(this.isTimeStampsInMilliseconds()||(o+=' milliseconds="'+e.milliseconds+'"'),o+=' level="'+e.level.name+'">'+newLine,this.combineMessages)o+=t(e.getCombinedMessages());else{for(o+="<log4javascript:messages>"+newLine,i=0,n=e.messages.length;n>i;i++)o+=t(e.messages[i])+newLine;o+="</log4javascript:messages>"+newLine}if(this.hasCustomFields())for(i=0,n=this.customFields.length;n>i;i++)o+='<log4javascript:customfield name="'+this.customFields[i].name+'"><![CDATA['+(""+this.customFields[i].value)+"]]></log4javascript:customfield>"+newLine;return e.exception&&(o+="<log4javascript:exception><![CDATA["+getExceptionStringRep(e.exception)+"]]></log4javascript:exception>"+newLine),o+="</log4javascript:event>"+newLine+newLine},XmlLayout.prototype.ignoresThrowable=function(){return!1},XmlLayout.prototype.toString=function(){return"XmlLayout"},log4javascript.XmlLayout=XmlLayout,JsonLayout.prototype=new Layout,JsonLayout.prototype.isReadable=function(){return this.readable},JsonLayout.prototype.isCombinedMessages=function(){return this.combineMessages},JsonLayout.prototype.format=function(e){function t(e,i,n){var o,s=typeof e;if(e instanceof Date)o=e.getTime()+"";else if(n&&e instanceof Array){o="["+r.lineBreak;for(var a=0,l=e.length;l>a;a++){var c=i+r.tab;o+=c+t(e[a],c,!1),e.length-1>a&&(o+=","),o+=r.lineBreak}o+=i+"]"}else o="number"!==s&&"boolean"!==s?'"'+escapeNewLines(toStr(e).replace(/\"/g,'\\"'))+'"':e;return o}var i,n,r=this,o=this.getDataValues(e,this.combineMessages),s="{"+this.lineBreak;for(i=0,n=o.length-1;n>=i;i++)s+=this.tab+'"'+o[i][0]+'"'+this.colon+t(o[i][1],this.tab,!0),n>i&&(s+=","),s+=this.lineBreak;return s+="}"+this.lineBreak},JsonLayout.prototype.ignoresThrowable=function(){return!1},JsonLayout.prototype.toString=function(){return"JsonLayout"},JsonLayout.prototype.getContentType=function(){return"application/json"},log4javascript.JsonLayout=JsonLayout,HttpPostDataLayout.prototype=new Layout,HttpPostDataLayout.prototype.allowBatching=function(){return!1},HttpPostDataLayout.prototype.format=function(e){for(var t=this.getDataValues(e),i=[],n=0,r=t.length;r>n;n++){var o=t[n][1]instanceof Date?t[n][1].getTime()+"":t[n][1];i.push(urlEncode(t[n][0])+"="+urlEncode(o))}return i.join("&")},HttpPostDataLayout.prototype.ignoresThrowable=function(){return!1},HttpPostDataLayout.prototype.toString=function(){return"HttpPostDataLayout"},log4javascript.HttpPostDataLayout=HttpPostDataLayout;var SimpleDateFormat;(function(){var e=/('[^']*')|(G+|y+|M+|w+|W+|D+|d+|F+|E+|a+|H+|k+|K+|h+|m+|s+|S+|Z+)|([a-zA-Z]+)|([^a-zA-Z']+)/,t=["January","February","March","April","May","June","July","August","September","October","November","December"],i=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],n=0,r=1,o=2,s=3,a=4,l=5,c={G:n,y:s,M:a,w:o,W:o,D:o,d:o,F:o,E:r,a:n,H:o,k:o,K:o,h:o,m:o,s:o,S:o,Z:l},h=864e5,u=7*h,d=1,p=function(e,t,i){var n=new Date(e,t,i,0,0,0);return n.setMilliseconds(0),n};Date.prototype.getDifference=function(e){return this.getTime()-e.getTime()},Date.prototype.isBefore=function(e){return this.getTime()<e.getTime()},Date.prototype.getUTCTime=function(){return Date.UTC(this.getFullYear(),this.getMonth(),this.getDate(),this.getHours(),this.getMinutes(),this.getSeconds(),this.getMilliseconds())},Date.prototype.getTimeSince=function(e){return this.getUTCTime()-e.getUTCTime()},Date.prototype.getPreviousSunday=function(){var e=new Date(this.getFullYear(),this.getMonth(),this.getDate(),12,0,0),t=new Date(e.getTime()-this.getDay()*h);return p(t.getFullYear(),t.getMonth(),t.getDate())},Date.prototype.getWeekInYear=function(e){isUndefined(this.minimalDaysInFirstWeek)&&(e=d);var t=this.getPreviousSunday(),i=p(this.getFullYear(),0,1),n=t.isBefore(i)?0:1+Math.floor(t.getTimeSince(i)/u),r=7-i.getDay(),o=n;return e>r&&o--,o},Date.prototype.getWeekInMonth=function(e){isUndefined(this.minimalDaysInFirstWeek)&&(e=d);var t=this.getPreviousSunday(),i=p(this.getFullYear(),this.getMonth(),1),n=t.isBefore(i)?0:1+Math.floor(t.getTimeSince(i)/u),r=7-i.getDay(),o=n;return r>=e&&o++,o},Date.prototype.getDayInYear=function(){var e=p(this.getFullYear(),0,1);return 1+Math.floor(this.getTimeSince(e)/h)},SimpleDateFormat=function(e){this.formatString=e},SimpleDateFormat.prototype.setMinimalDaysInFirstWeek=function(e){this.minimalDaysInFirstWeek=e},SimpleDateFormat.prototype.getMinimalDaysInFirstWeek=function(){return isUndefined(this.minimalDaysInFirstWeek)?d:this.minimalDaysInFirstWeek};var f=function(e,t){for(;t>e.length;)e="0"+e;return e},g=function(e,t,i){return t>=4?e:e.substr(0,Math.max(i,t))},m=function(e,t){var i=""+e;return f(i,t)};SimpleDateFormat.prototype.format=function(h){for(var u,d="",p=this.formatString;u=e.exec(p);){var v=u[1],b=u[2],y=u[3],x=u[4];if(v)d+="''"==v?"'":v.substring(1,v.length-1);else if(y);else if(x)d+=x;else if(b){var _=b.charAt(0),C=b.length,w="";switch(_){case"G":w="AD";break;case"y":w=h.getFullYear();break;case"M":w=h.getMonth();break;case"w":w=h.getWeekInYear(this.getMinimalDaysInFirstWeek());break;case"W":w=h.getWeekInMonth(this.getMinimalDaysInFirstWeek());break;case"D":w=h.getDayInYear();break;case"d":w=h.getDate();break;case"F":w=1+Math.floor((h.getDate()-1)/7);break;case"E":w=i[h.getDay()];break;case"a":w=h.getHours()>=12?"PM":"AM";break;case"H":w=h.getHours();break;case"k":w=h.getHours()||24;break;case"K":w=h.getHours()%12;break;case"h":w=h.getHours()%12||12;break;case"m":w=h.getMinutes();break;case"s":w=h.getSeconds();break;case"S":w=h.getMilliseconds();break;case"Z":w=h.getTimezoneOffset()}switch(c[_]){case n:d+=g(w,C,2);break;case r:d+=g(w,C,3);break;case o:d+=m(w,C);break;case s:if(3>=C){var k=""+w;d+=k.substr(2,2)}else d+=m(w,C);break;case a:d+=C>=3?g(t[w],C,C):m(w+1,C);break;case l:var T=w>0,E=T?"-":"+",S=Math.abs(w),P=""+Math.floor(S/60);P=f(P,2);var A=""+S%60;A=f(A,2),d+=E+P+A}}p=p.substr(u.index+u[0].length)}return d}})(),log4javascript.SimpleDateFormat=SimpleDateFormat,PatternLayout.TTCC_CONVERSION_PATTERN="%r %p %c - %m%n",PatternLayout.DEFAULT_CONVERSION_PATTERN="%m%n",PatternLayout.ISO8601_DATEFORMAT="yyyy-MM-dd HH:mm:ss,SSS",PatternLayout.DATETIME_DATEFORMAT="dd MMM yyyy HH:mm:ss,SSS",PatternLayout.ABSOLUTETIME_DATEFORMAT="HH:mm:ss,SSS",PatternLayout.prototype=new Layout,PatternLayout.prototype.format=function(e){for(var t,i=/%(-?[0-9]+)?(\.?[0-9]+)?([acdfmMnpr%])(\{([^\}]+)\})?|([^%]+)/,n="",r=this.pattern;t=i.exec(r);){var o=t[0],s=t[1],a=t[2],l=t[3],c=t[5],h=t[6];if(h)n+=""+h;else{var u="";switch(l){case"a":case"m":var d=0;c&&(d=parseInt(c,10),isNaN(d)&&(handleError("PatternLayout.format: invalid specifier '"+c+"' for conversion character '"+l+"' - should be a number"),d=0));for(var p="a"===l?e.messages[0]:e.messages,f=0,g=p.length;g>f;f++)f>0&&" "!==u.charAt(u.length-1)&&(u+=" "),u+=0===d?p[f]:formatObjectExpansion(p[f],d);break;case"c":var m=e.logger.name;
|
|
if(c){var v=parseInt(c,10),b=e.logger.name.split(".");u=v>=b.length?m:b.slice(b.length-v).join(".")}else u=m;break;case"d":var y=PatternLayout.ISO8601_DATEFORMAT;c&&(y=c,"ISO8601"==y?y=PatternLayout.ISO8601_DATEFORMAT:"ABSOLUTE"==y?y=PatternLayout.ABSOLUTETIME_DATEFORMAT:"DATE"==y&&(y=PatternLayout.DATETIME_DATEFORMAT)),u=new SimpleDateFormat(y).format(e.timeStamp);break;case"f":if(this.hasCustomFields()){var x=0;c&&(x=parseInt(c,10),isNaN(x)?handleError("PatternLayout.format: invalid specifier '"+c+"' for conversion character 'f' - should be a number"):0===x?handleError("PatternLayout.format: invalid specifier '"+c+"' for conversion character 'f' - must be greater than zero"):x>this.customFields.length?handleError("PatternLayout.format: invalid specifier '"+c+"' for conversion character 'f' - there aren't that many custom fields"):x-=1);var _=this.customFields[x].value;"function"==typeof _&&(_=_(this,e)),u=_}break;case"n":u=newLine;break;case"p":u=e.level.name;break;case"r":u=""+e.timeStamp.getDifference(applicationStartDate);break;case"%":u="%";break;default:u=o}var C;if(a){C=parseInt(a.substr(1),10);var w=u.length;w>C&&(u=u.substring(w-C,w))}if(s)if("-"==s.charAt(0))for(C=parseInt(s.substr(1),10);C>u.length;)u+=" ";else for(C=parseInt(s,10);C>u.length;)u=" "+u;n+=u}r=r.substr(t.index+t[0].length)}return n},PatternLayout.prototype.ignoresThrowable=function(){return!0},PatternLayout.prototype.toString=function(){return"PatternLayout"},log4javascript.PatternLayout=PatternLayout,AlertAppender.prototype=new Appender,AlertAppender.prototype.layout=new SimpleLayout,AlertAppender.prototype.append=function(e){var t=this.getLayout().format(e);this.getLayout().ignoresThrowable()&&(t+=e.getThrowableStrRep()),alert(t)},AlertAppender.prototype.toString=function(){return"AlertAppender"},log4javascript.AlertAppender=AlertAppender,BrowserConsoleAppender.prototype=new log4javascript.Appender,BrowserConsoleAppender.prototype.layout=new NullLayout,BrowserConsoleAppender.prototype.threshold=Level.DEBUG,BrowserConsoleAppender.prototype.append=function(e){var t=this,i=function(){var i=t.getLayout(),n=i.format(e);return i.ignoresThrowable()&&e.exception&&(n+=e.getThrowableStrRep()),n};if("undefined"!=typeof opera&&opera.postError)opera.postError(i());else if(window.console&&window.console.log){var n=i();window.console.debug&&Level.DEBUG.isGreaterOrEqual(e.level)?window.console.debug(n):window.console.info&&Level.INFO.equals(e.level)?window.console.info(n):window.console.warn&&Level.WARN.equals(e.level)?window.console.warn(n):window.console.error&&e.level.isGreaterOrEqual(Level.ERROR)?window.console.error(n):window.console.log(n)}},BrowserConsoleAppender.prototype.group=function(e){window.console&&window.console.group&&window.console.group(e)},BrowserConsoleAppender.prototype.groupEnd=function(){window.console&&window.console.groupEnd&&window.console.groupEnd()},BrowserConsoleAppender.prototype.toString=function(){return"BrowserConsoleAppender"},log4javascript.BrowserConsoleAppender=BrowserConsoleAppender;var xmlHttpFactories=[function(){return new XMLHttpRequest},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")}],getXmlHttp=function(e){for(var t,i=null,n=0,r=xmlHttpFactories.length;r>n;n++){t=xmlHttpFactories[n];try{return i=t(),getXmlHttp=t,i}catch(o){}}e?e():handleError("getXmlHttp: unable to obtain XMLHttpRequest object")};AjaxAppender.prototype=new Appender,AjaxAppender.prototype.defaults={waitForResponse:!1,timed:!1,timerInterval:1e3,batchSize:1,sendAllOnUnload:!1,requestSuccessCallback:null,failCallback:null,postVarName:"data"},AjaxAppender.prototype.layout=new HttpPostDataLayout,AjaxAppender.prototype.toString=function(){return"AjaxAppender"},log4javascript.AjaxAppender=AjaxAppender;var ConsoleAppender;if(function(){function e(e,t,i,n,r){this.create(!1,null,e,t,i,n,r,this.defaults.focusPopUp)}function t(e,t,i,n,r,o){this.create(!0,e,t,i,n,r,o,!1)}var i=function(){return['<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">','<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">',"<head>","<title>log4javascript</title>",'<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />',"<!-- Make IE8 behave like IE7, having gone to all the trouble of making IE work -->",'<meta http-equiv="X-UA-Compatible" content="IE=7" />','<script type="text/javascript">var isIe = false, isIePre7 = false;</script>','<!--[if IE]><script type="text/javascript">isIe = true</script><![endif]-->','<!--[if lt IE 7]><script type="text/javascript">isIePre7 = true</script><![endif]-->','<script type="text/javascript">',"//<![CDATA[","var loggingEnabled=true;var logQueuedEventsTimer=null;var logEntries=[];var logEntriesAndSeparators=[];var logItems=[];var renderDelay=100;var unrenderedLogItemsExist=false;var rootGroup,currentGroup=null;var loaded=false;var currentLogItem=null;var logMainContainer;function copyProperties(obj,props){for(var i in props){obj[i]=props[i];}}","function LogItem(){}","LogItem.prototype={mainContainer:null,wrappedContainer:null,unwrappedContainer:null,group:null,appendToLog:function(){for(var i=0,len=this.elementContainers.length;i<len;i++){this.elementContainers[i].appendToLog();}","this.group.update();},doRemove:function(doUpdate,removeFromGroup){if(this.rendered){for(var i=0,len=this.elementContainers.length;i<len;i++){this.elementContainers[i].remove();}","this.unwrappedElementContainer=null;this.wrappedElementContainer=null;this.mainElementContainer=null;}","if(this.group&&removeFromGroup){this.group.removeChild(this,doUpdate);}","if(this===currentLogItem){currentLogItem=null;}},remove:function(doUpdate,removeFromGroup){this.doRemove(doUpdate,removeFromGroup);},render:function(){},accept:function(visitor){visitor.visit(this);},getUnwrappedDomContainer:function(){return this.group.unwrappedElementContainer.contentDiv;},getWrappedDomContainer:function(){return this.group.wrappedElementContainer.contentDiv;},getMainDomContainer:function(){return this.group.mainElementContainer.contentDiv;}};LogItem.serializedItemKeys={LOG_ENTRY:0,GROUP_START:1,GROUP_END:2};function LogItemContainerElement(){}",'LogItemContainerElement.prototype={appendToLog:function(){var insertBeforeFirst=(newestAtTop&&this.containerDomNode.hasChildNodes());if(insertBeforeFirst){this.containerDomNode.insertBefore(this.mainDiv,this.containerDomNode.firstChild);}else{this.containerDomNode.appendChild(this.mainDiv);}}};function SeparatorElementContainer(containerDomNode){this.containerDomNode=containerDomNode;this.mainDiv=document.createElement("div");this.mainDiv.className="separator";this.mainDiv.innerHTML=" ";}',"SeparatorElementContainer.prototype=new LogItemContainerElement();SeparatorElementContainer.prototype.remove=function(){this.mainDiv.parentNode.removeChild(this.mainDiv);this.mainDiv=null;};function Separator(){this.rendered=false;}","Separator.prototype=new LogItem();copyProperties(Separator.prototype,{render:function(){var containerDomNode=this.group.contentDiv;if(isIe){this.unwrappedElementContainer=new SeparatorElementContainer(this.getUnwrappedDomContainer());this.wrappedElementContainer=new SeparatorElementContainer(this.getWrappedDomContainer());this.elementContainers=[this.unwrappedElementContainer,this.wrappedElementContainer];}else{this.mainElementContainer=new SeparatorElementContainer(this.getMainDomContainer());this.elementContainers=[this.mainElementContainer];}",'this.content=this.formattedMessage;this.rendered=true;}});function GroupElementContainer(group,containerDomNode,isRoot,isWrapped){this.group=group;this.containerDomNode=containerDomNode;this.isRoot=isRoot;this.isWrapped=isWrapped;this.expandable=false;if(this.isRoot){if(isIe){this.contentDiv=logMainContainer.appendChild(document.createElement("div"));this.contentDiv.id=this.isWrapped?"log_wrapped":"log_unwrapped";}else{this.contentDiv=logMainContainer;}}else{var groupElementContainer=this;this.mainDiv=document.createElement("div");this.mainDiv.className="group";this.headingDiv=this.mainDiv.appendChild(document.createElement("div"));this.headingDiv.className="groupheading";this.expander=this.headingDiv.appendChild(document.createElement("span"));this.expander.className="expander unselectable greyedout";this.expander.unselectable=true;var expanderText=this.group.expanded?"-":"+";this.expanderTextNode=this.expander.appendChild(document.createTextNode(expanderText));this.headingDiv.appendChild(document.createTextNode(" "+this.group.name));this.contentDiv=this.mainDiv.appendChild(document.createElement("div"));var contentCssClass=this.group.expanded?"expanded":"collapsed";this.contentDiv.className="groupcontent "+contentCssClass;this.expander.onclick=function(){if(groupElementContainer.group.expandable){groupElementContainer.group.toggleExpanded();}};}}','GroupElementContainer.prototype=new LogItemContainerElement();copyProperties(GroupElementContainer.prototype,{toggleExpanded:function(){if(!this.isRoot){var oldCssClass,newCssClass,expanderText;if(this.group.expanded){newCssClass="expanded";oldCssClass="collapsed";expanderText="-";}else{newCssClass="collapsed";oldCssClass="expanded";expanderText="+";}',"replaceClass(this.contentDiv,newCssClass,oldCssClass);this.expanderTextNode.nodeValue=expanderText;}},remove:function(){if(!this.isRoot){this.headingDiv=null;this.expander.onclick=null;this.expander=null;this.expanderTextNode=null;this.contentDiv=null;this.containerDomNode=null;this.mainDiv.parentNode.removeChild(this.mainDiv);this.mainDiv=null;}},reverseChildren:function(){var node=null;var childDomNodes=[];while((node=this.contentDiv.firstChild)){this.contentDiv.removeChild(node);childDomNodes.push(node);}",'while((node=childDomNodes.pop())){this.contentDiv.appendChild(node);}},update:function(){if(!this.isRoot){if(this.group.expandable){removeClass(this.expander,"greyedout");}else{addClass(this.expander,"greyedout");}}},clear:function(){if(this.isRoot){this.contentDiv.innerHTML="";}}});function Group(name,isRoot,initiallyExpanded){this.name=name;this.group=null;this.isRoot=isRoot;this.initiallyExpanded=initiallyExpanded;this.elementContainers=[];this.children=[];this.expanded=initiallyExpanded;this.rendered=false;this.expandable=false;}',"Group.prototype=new LogItem();copyProperties(Group.prototype,{addChild:function(logItem){this.children.push(logItem);logItem.group=this;},render:function(){if(isIe){var unwrappedDomContainer,wrappedDomContainer;if(this.isRoot){unwrappedDomContainer=logMainContainer;wrappedDomContainer=logMainContainer;}else{unwrappedDomContainer=this.getUnwrappedDomContainer();wrappedDomContainer=this.getWrappedDomContainer();}","this.unwrappedElementContainer=new GroupElementContainer(this,unwrappedDomContainer,this.isRoot,false);this.wrappedElementContainer=new GroupElementContainer(this,wrappedDomContainer,this.isRoot,true);this.elementContainers=[this.unwrappedElementContainer,this.wrappedElementContainer];}else{var mainDomContainer=this.isRoot?logMainContainer:this.getMainDomContainer();this.mainElementContainer=new GroupElementContainer(this,mainDomContainer,this.isRoot,false);this.elementContainers=[this.mainElementContainer];}","this.rendered=true;},toggleExpanded:function(){this.expanded=!this.expanded;for(var i=0,len=this.elementContainers.length;i<len;i++){this.elementContainers[i].toggleExpanded();}},expand:function(){if(!this.expanded){this.toggleExpanded();}},accept:function(visitor){visitor.visitGroup(this);},reverseChildren:function(){if(this.rendered){for(var i=0,len=this.elementContainers.length;i<len;i++){this.elementContainers[i].reverseChildren();}}},update:function(){var previouslyExpandable=this.expandable;this.expandable=(this.children.length!==0);if(this.expandable!==previouslyExpandable){for(var i=0,len=this.elementContainers.length;i<len;i++){this.elementContainers[i].update();}}},flatten:function(){var visitor=new GroupFlattener();this.accept(visitor);return visitor.logEntriesAndSeparators;},removeChild:function(child,doUpdate){array_remove(this.children,child);child.group=null;if(doUpdate){this.update();}},remove:function(doUpdate,removeFromGroup){for(var i=0,len=this.children.length;i<len;i++){this.children[i].remove(false,false);}","this.children=[];this.update();if(this===currentGroup){currentGroup=this.group;}","this.doRemove(doUpdate,removeFromGroup);},serialize:function(items){items.push([LogItem.serializedItemKeys.GROUP_START,this.name]);for(var i=0,len=this.children.length;i<len;i++){this.children[i].serialize(items);}","if(this!==currentGroup){items.push([LogItem.serializedItemKeys.GROUP_END]);}},clear:function(){for(var i=0,len=this.elementContainers.length;i<len;i++){this.elementContainers[i].clear();}}});function LogEntryElementContainer(){}",'LogEntryElementContainer.prototype=new LogItemContainerElement();copyProperties(LogEntryElementContainer.prototype,{remove:function(){this.doRemove();},doRemove:function(){this.mainDiv.parentNode.removeChild(this.mainDiv);this.mainDiv=null;this.contentElement=null;this.containerDomNode=null;},setContent:function(content,wrappedContent){if(content===this.formattedMessage){this.contentElement.innerHTML="";this.contentElement.appendChild(document.createTextNode(this.formattedMessage));}else{this.contentElement.innerHTML=content;}},setSearchMatch:function(isMatch){var oldCssClass=isMatch?"searchnonmatch":"searchmatch";var newCssClass=isMatch?"searchmatch":"searchnonmatch";replaceClass(this.mainDiv,newCssClass,oldCssClass);},clearSearch:function(){removeClass(this.mainDiv,"searchmatch");removeClass(this.mainDiv,"searchnonmatch");}});function LogEntryWrappedElementContainer(logEntry,containerDomNode){this.logEntry=logEntry;this.containerDomNode=containerDomNode;this.mainDiv=document.createElement("div");this.mainDiv.appendChild(document.createTextNode(this.logEntry.formattedMessage));this.mainDiv.className="logentry wrapped "+this.logEntry.level;this.contentElement=this.mainDiv;}','LogEntryWrappedElementContainer.prototype=new LogEntryElementContainer();LogEntryWrappedElementContainer.prototype.setContent=function(content,wrappedContent){if(content===this.formattedMessage){this.contentElement.innerHTML="";this.contentElement.appendChild(document.createTextNode(this.formattedMessage));}else{this.contentElement.innerHTML=wrappedContent;}};function LogEntryUnwrappedElementContainer(logEntry,containerDomNode){this.logEntry=logEntry;this.containerDomNode=containerDomNode;this.mainDiv=document.createElement("div");this.mainDiv.className="logentry unwrapped "+this.logEntry.level;this.pre=this.mainDiv.appendChild(document.createElement("pre"));this.pre.appendChild(document.createTextNode(this.logEntry.formattedMessage));this.pre.className="unwrapped";this.contentElement=this.pre;}','LogEntryUnwrappedElementContainer.prototype=new LogEntryElementContainer();LogEntryUnwrappedElementContainer.prototype.remove=function(){this.doRemove();this.pre=null;};function LogEntryMainElementContainer(logEntry,containerDomNode){this.logEntry=logEntry;this.containerDomNode=containerDomNode;this.mainDiv=document.createElement("div");this.mainDiv.className="logentry nonielogentry "+this.logEntry.level;this.contentElement=this.mainDiv.appendChild(document.createElement("span"));this.contentElement.appendChild(document.createTextNode(this.logEntry.formattedMessage));}',"LogEntryMainElementContainer.prototype=new LogEntryElementContainer();function LogEntry(level,formattedMessage){this.level=level;this.formattedMessage=formattedMessage;this.rendered=false;}",'LogEntry.prototype=new LogItem();copyProperties(LogEntry.prototype,{render:function(){var logEntry=this;var containerDomNode=this.group.contentDiv;if(isIe){this.formattedMessage=this.formattedMessage.replace(/\\r\\n/g,"\\r");this.unwrappedElementContainer=new LogEntryUnwrappedElementContainer(this,this.getUnwrappedDomContainer());this.wrappedElementContainer=new LogEntryWrappedElementContainer(this,this.getWrappedDomContainer());this.elementContainers=[this.unwrappedElementContainer,this.wrappedElementContainer];}else{this.mainElementContainer=new LogEntryMainElementContainer(this,this.getMainDomContainer());this.elementContainers=[this.mainElementContainer];}','this.content=this.formattedMessage;this.rendered=true;},setContent:function(content,wrappedContent){if(content!=this.content){if(isIe&&(content!==this.formattedMessage)){content=content.replace(/\\r\\n/g,"\\r");}',"for(var i=0,len=this.elementContainers.length;i<len;i++){this.elementContainers[i].setContent(content,wrappedContent);}",'this.content=content;}},getSearchMatches:function(){var matches=[];var i,len;if(isIe){var unwrappedEls=getElementsByClass(this.unwrappedElementContainer.mainDiv,"searchterm","span");var wrappedEls=getElementsByClass(this.wrappedElementContainer.mainDiv,"searchterm","span");for(i=0,len=unwrappedEls.length;i<len;i++){matches[i]=new Match(this.level,null,unwrappedEls[i],wrappedEls[i]);}}else{var els=getElementsByClass(this.mainElementContainer.mainDiv,"searchterm","span");for(i=0,len=els.length;i<len;i++){matches[i]=new Match(this.level,els[i]);}}',"return matches;},setSearchMatch:function(isMatch){for(var i=0,len=this.elementContainers.length;i<len;i++){this.elementContainers[i].setSearchMatch(isMatch);}},clearSearch:function(){for(var i=0,len=this.elementContainers.length;i<len;i++){this.elementContainers[i].clearSearch();}},accept:function(visitor){visitor.visitLogEntry(this);},serialize:function(items){items.push([LogItem.serializedItemKeys.LOG_ENTRY,this.level,this.formattedMessage]);}});function LogItemVisitor(){}","LogItemVisitor.prototype={visit:function(logItem){},visitParent:function(logItem){if(logItem.group){logItem.group.accept(this);}},visitChildren:function(logItem){for(var i=0,len=logItem.children.length;i<len;i++){logItem.children[i].accept(this);}},visitLogEntry:function(logEntry){this.visit(logEntry);},visitSeparator:function(separator){this.visit(separator);},visitGroup:function(group){this.visit(group);}};function GroupFlattener(){this.logEntriesAndSeparators=[];}",'GroupFlattener.prototype=new LogItemVisitor();GroupFlattener.prototype.visitGroup=function(group){this.visitChildren(group);};GroupFlattener.prototype.visitLogEntry=function(logEntry){this.logEntriesAndSeparators.push(logEntry);};GroupFlattener.prototype.visitSeparator=function(separator){this.logEntriesAndSeparators.push(separator);};window.onload=function(){if(location.search){var queryBits=unescape(location.search).substr(1).split("&"),nameValueBits;for(var i=0,len=queryBits.length;i<len;i++){nameValueBits=queryBits[i].split("=");if(nameValueBits[0]=="log4javascript_domain"){document.domain=nameValueBits[1];break;}}}','logMainContainer=$("log");if(isIePre7){addClass(logMainContainer,"oldIe");}','rootGroup=new Group("root",true);rootGroup.render();currentGroup=rootGroup;setCommandInputWidth();setLogContainerHeight();toggleLoggingEnabled();toggleSearchEnabled();toggleSearchFilter();toggleSearchHighlight();applyFilters();checkAllLevels();toggleWrap();toggleNewestAtTop();toggleScrollToLatest();renderQueuedLogItems();loaded=true;$("command").value="";$("command").autocomplete="off";$("command").onkeydown=function(evt){evt=getEvent(evt);if(evt.keyCode==10||evt.keyCode==13){evalCommandLine();stopPropagation(evt);}else if(evt.keyCode==27){this.value="";this.focus();}else if(evt.keyCode==38&&commandHistory.length>0){currentCommandIndex=Math.max(0,currentCommandIndex-1);this.value=commandHistory[currentCommandIndex];moveCaretToEnd(this);}else if(evt.keyCode==40&&commandHistory.length>0){currentCommandIndex=Math.min(commandHistory.length-1,currentCommandIndex+1);this.value=commandHistory[currentCommandIndex];moveCaretToEnd(this);}};$("command").onkeypress=function(evt){evt=getEvent(evt);if(evt.keyCode==38&&commandHistory.length>0&&evt.preventDefault){evt.preventDefault();}};$("command").onkeyup=function(evt){evt=getEvent(evt);if(evt.keyCode==27&&evt.preventDefault){evt.preventDefault();this.focus();}};document.onkeydown=function keyEventHandler(evt){evt=getEvent(evt);switch(evt.keyCode){case 69:if(evt.shiftKey&&(evt.ctrlKey||evt.metaKey)){evalLastCommand();cancelKeyEvent(evt);return false;}',"break;case 75:if(evt.shiftKey&&(evt.ctrlKey||evt.metaKey)){focusSearch();cancelKeyEvent(evt);return false;}","break;case 40:case 76:if(evt.shiftKey&&(evt.ctrlKey||evt.metaKey)){focusCommandLine();cancelKeyEvent(evt);return false;}","break;}};setTimeout(setLogContainerHeight,20);setShowCommandLine(showCommandLine);doSearch();};window.onunload=function(){if(mainWindowExists()){appender.unload();}",'appender=null;};function toggleLoggingEnabled(){setLoggingEnabled($("enableLogging").checked);}',"function setLoggingEnabled(enable){loggingEnabled=enable;}","var appender=null;function setAppender(appenderParam){appender=appenderParam;}",'function setShowCloseButton(showCloseButton){$("closeButton").style.display=showCloseButton?"inline":"none";}','function setShowHideButton(showHideButton){$("hideButton").style.display=showHideButton?"inline":"none";}',"var newestAtTop=false;function LogItemContentReverser(){}","LogItemContentReverser.prototype=new LogItemVisitor();LogItemContentReverser.prototype.visitGroup=function(group){group.reverseChildren();this.visitChildren(group);};function setNewestAtTop(isNewestAtTop){var oldNewestAtTop=newestAtTop;var i,iLen,j,jLen;newestAtTop=Boolean(isNewestAtTop);if(oldNewestAtTop!=newestAtTop){var visitor=new LogItemContentReverser();rootGroup.accept(visitor);if(currentSearch){var currentMatch=currentSearch.matches[currentMatchIndex];var matchIndex=0;var matches=[];var actOnLogEntry=function(logEntry){var logEntryMatches=logEntry.getSearchMatches();for(j=0,jLen=logEntryMatches.length;j<jLen;j++){matches[matchIndex]=logEntryMatches[j];if(currentMatch&&logEntryMatches[j].equals(currentMatch)){currentMatchIndex=matchIndex;}","matchIndex++;}};if(newestAtTop){for(i=logEntries.length-1;i>=0;i--){actOnLogEntry(logEntries[i]);}}else{for(i=0,iLen=logEntries.length;i<iLen;i++){actOnLogEntry(logEntries[i]);}}","currentSearch.matches=matches;if(currentMatch){currentMatch.setCurrent();}}else if(scrollToLatest){doScrollToLatest();}}",'$("newestAtTop").checked=isNewestAtTop;}','function toggleNewestAtTop(){var isNewestAtTop=$("newestAtTop").checked;setNewestAtTop(isNewestAtTop);}',"var scrollToLatest=true;function setScrollToLatest(isScrollToLatest){scrollToLatest=isScrollToLatest;if(scrollToLatest){doScrollToLatest();}",'$("scrollToLatest").checked=isScrollToLatest;}','function toggleScrollToLatest(){var isScrollToLatest=$("scrollToLatest").checked;setScrollToLatest(isScrollToLatest);}','function doScrollToLatest(){var l=logMainContainer;if(typeof l.scrollTop!="undefined"){if(newestAtTop){l.scrollTop=0;}else{var latestLogEntry=l.lastChild;if(latestLogEntry){l.scrollTop=l.scrollHeight;}}}}',"var closeIfOpenerCloses=true;function setCloseIfOpenerCloses(isCloseIfOpenerCloses){closeIfOpenerCloses=isCloseIfOpenerCloses;}","var maxMessages=null;function setMaxMessages(max){maxMessages=max;pruneLogEntries();}",'var showCommandLine=false;function setShowCommandLine(isShowCommandLine){showCommandLine=isShowCommandLine;if(loaded){$("commandLine").style.display=showCommandLine?"block":"none";setCommandInputWidth();setLogContainerHeight();}}','function focusCommandLine(){if(loaded){$("command").focus();}}','function focusSearch(){if(loaded){$("searchBox").focus();}}',"function getLogItems(){var items=[];for(var i=0,len=logItems.length;i<len;i++){logItems[i].serialize(items);}","return items;}","function setLogItems(items){var loggingReallyEnabled=loggingEnabled;loggingEnabled=true;for(var i=0,len=items.length;i<len;i++){switch(items[i][0]){case LogItem.serializedItemKeys.LOG_ENTRY:log(items[i][1],items[i][2]);break;case LogItem.serializedItemKeys.GROUP_START:group(items[i][1]);break;case LogItem.serializedItemKeys.GROUP_END:groupEnd();break;}}","loggingEnabled=loggingReallyEnabled;}","function log(logLevel,formattedMessage){if(loggingEnabled){var logEntry=new LogEntry(logLevel,formattedMessage);logEntries.push(logEntry);logEntriesAndSeparators.push(logEntry);logItems.push(logEntry);currentGroup.addChild(logEntry);if(loaded){if(logQueuedEventsTimer!==null){clearTimeout(logQueuedEventsTimer);}","logQueuedEventsTimer=setTimeout(renderQueuedLogItems,renderDelay);unrenderedLogItemsExist=true;}}}","function renderQueuedLogItems(){logQueuedEventsTimer=null;var pruned=pruneLogEntries();var initiallyHasMatches=currentSearch?currentSearch.hasMatches():false;for(var i=0,len=logItems.length;i<len;i++){if(!logItems[i].rendered){logItems[i].render();logItems[i].appendToLog();if(currentSearch&&(logItems[i]instanceof LogEntry)){currentSearch.applyTo(logItems[i]);}}}","if(currentSearch){if(pruned){if(currentSearch.hasVisibleMatches()){if(currentMatchIndex===null){setCurrentMatchIndex(0);}","displayMatches();}else{displayNoMatches();}}else if(!initiallyHasMatches&¤tSearch.hasVisibleMatches()){setCurrentMatchIndex(0);displayMatches();}}","if(scrollToLatest){doScrollToLatest();}","unrenderedLogItemsExist=false;}","function pruneLogEntries(){if((maxMessages!==null)&&(logEntriesAndSeparators.length>maxMessages)){var numberToDelete=logEntriesAndSeparators.length-maxMessages;var prunedLogEntries=logEntriesAndSeparators.slice(0,numberToDelete);if(currentSearch){currentSearch.removeMatches(prunedLogEntries);}","var group;for(var i=0;i<numberToDelete;i++){group=logEntriesAndSeparators[i].group;array_remove(logItems,logEntriesAndSeparators[i]);array_remove(logEntries,logEntriesAndSeparators[i]);logEntriesAndSeparators[i].remove(true,true);if(group.children.length===0&&group!==currentGroup&&group!==rootGroup){array_remove(logItems,group);group.remove(true,true);}}","logEntriesAndSeparators=array_removeFromStart(logEntriesAndSeparators,numberToDelete);return true;}","return false;}",'function group(name,startExpanded){if(loggingEnabled){initiallyExpanded=(typeof startExpanded==="undefined")?true:Boolean(startExpanded);var newGroup=new Group(name,false,initiallyExpanded);currentGroup.addChild(newGroup);currentGroup=newGroup;logItems.push(newGroup);if(loaded){if(logQueuedEventsTimer!==null){clearTimeout(logQueuedEventsTimer);}',"logQueuedEventsTimer=setTimeout(renderQueuedLogItems,renderDelay);unrenderedLogItemsExist=true;}}}","function groupEnd(){currentGroup=(currentGroup===rootGroup)?rootGroup:currentGroup.group;}","function mainPageReloaded(){currentGroup=rootGroup;var separator=new Separator();logEntriesAndSeparators.push(separator);logItems.push(separator);currentGroup.addChild(separator);}","function closeWindow(){if(appender&&mainWindowExists()){appender.close(true);}else{window.close();}}","function hide(){if(appender&&mainWindowExists()){appender.hide();}}",'var mainWindow=window;var windowId="log4javascriptConsoleWindow_"+new Date().getTime()+"_"+(""+Math.random()).substr(2);function setMainWindow(win){mainWindow=win;mainWindow[windowId]=window;if(opener&&closeIfOpenerCloses){pollOpener();}}',"function pollOpener(){if(closeIfOpenerCloses){if(mainWindowExists()){setTimeout(pollOpener,500);}else{closeWindow();}}}","function mainWindowExists(){try{return(mainWindow&&!mainWindow.closed&&mainWindow[windowId]==window);}catch(ex){}","return false;}",'var logLevels=["TRACE","DEBUG","INFO","WARN","ERROR","FATAL"];function getCheckBox(logLevel){return $("switch_"+logLevel);}','function getIeWrappedLogContainer(){return $("log_wrapped");}','function getIeUnwrappedLogContainer(){return $("log_unwrapped");}',"function applyFilters(){for(var i=0;i<logLevels.length;i++){if(getCheckBox(logLevels[i]).checked){addClass(logMainContainer,logLevels[i]);}else{removeClass(logMainContainer,logLevels[i]);}}","updateSearchFromFilters();}",'function toggleAllLevels(){var turnOn=$("switch_ALL").checked;for(var i=0;i<logLevels.length;i++){getCheckBox(logLevels[i]).checked=turnOn;if(turnOn){addClass(logMainContainer,logLevels[i]);}else{removeClass(logMainContainer,logLevels[i]);}}}','function checkAllLevels(){for(var i=0;i<logLevels.length;i++){if(!getCheckBox(logLevels[i]).checked){getCheckBox("ALL").checked=false;return;}}','getCheckBox("ALL").checked=true;}',"function clearLog(){rootGroup.clear();currentGroup=rootGroup;logEntries=[];logItems=[];logEntriesAndSeparators=[];doSearch();}",'function toggleWrap(){var enable=$("wrap").checked;if(enable){addClass(logMainContainer,"wrap");}else{removeClass(logMainContainer,"wrap");}',"refreshCurrentMatch();}","var searchTimer=null;function scheduleSearch(){try{clearTimeout(searchTimer);}catch(ex){}","searchTimer=setTimeout(doSearch,500);}","function Search(searchTerm,isRegex,searchRegex,isCaseSensitive){this.searchTerm=searchTerm;this.isRegex=isRegex;this.searchRegex=searchRegex;this.isCaseSensitive=isCaseSensitive;this.matches=[];}","Search.prototype={hasMatches:function(){return this.matches.length>0;},hasVisibleMatches:function(){if(this.hasMatches()){for(var i=0;i<this.matches.length;i++){if(this.matches[i].isVisible()){return true;}}}","return false;},match:function(logEntry){var entryText=String(logEntry.formattedMessage);var matchesSearch=false;if(this.isRegex){matchesSearch=this.searchRegex.test(entryText);}else if(this.isCaseSensitive){matchesSearch=(entryText.indexOf(this.searchTerm)>-1);}else{matchesSearch=(entryText.toLowerCase().indexOf(this.searchTerm.toLowerCase())>-1);}","return matchesSearch;},getNextVisibleMatchIndex:function(){for(var i=currentMatchIndex+1;i<this.matches.length;i++){if(this.matches[i].isVisible()){return i;}}","for(i=0;i<=currentMatchIndex;i++){if(this.matches[i].isVisible()){return i;}}","return-1;},getPreviousVisibleMatchIndex:function(){for(var i=currentMatchIndex-1;i>=0;i--){if(this.matches[i].isVisible()){return i;}}","for(var i=this.matches.length-1;i>=currentMatchIndex;i--){if(this.matches[i].isVisible()){return i;}}",'return-1;},applyTo:function(logEntry){var doesMatch=this.match(logEntry);if(doesMatch){logEntry.group.expand();logEntry.setSearchMatch(true);var logEntryContent;var wrappedLogEntryContent;var searchTermReplacementStartTag="<span class=\\"searchterm\\">";var searchTermReplacementEndTag="<"+"/span>";var preTagName=isIe?"pre":"span";var preStartTag="<"+preTagName+" class=\\"pre\\">";var preEndTag="<"+"/"+preTagName+">";var startIndex=0;var searchIndex,matchedText,textBeforeMatch;if(this.isRegex){var flags=this.isCaseSensitive?"g":"gi";var capturingRegex=new RegExp("("+this.searchRegex.source+")",flags);var rnd=(""+Math.random()).substr(2);var startToken="%%s"+rnd+"%%";var endToken="%%e"+rnd+"%%";logEntryContent=logEntry.formattedMessage.replace(capturingRegex,startToken+"$1"+endToken);logEntryContent=escapeHtml(logEntryContent);var result;var searchString=logEntryContent;logEntryContent="";wrappedLogEntryContent="";while((searchIndex=searchString.indexOf(startToken,startIndex))>-1){var endTokenIndex=searchString.indexOf(endToken,searchIndex);matchedText=searchString.substring(searchIndex+startToken.length,endTokenIndex);textBeforeMatch=searchString.substring(startIndex,searchIndex);logEntryContent+=preStartTag+textBeforeMatch+preEndTag;logEntryContent+=searchTermReplacementStartTag+preStartTag+matchedText+',"preEndTag+searchTermReplacementEndTag;if(isIe){wrappedLogEntryContent+=textBeforeMatch+searchTermReplacementStartTag+","matchedText+searchTermReplacementEndTag;}","startIndex=endTokenIndex+endToken.length;}",'logEntryContent+=preStartTag+searchString.substr(startIndex)+preEndTag;if(isIe){wrappedLogEntryContent+=searchString.substr(startIndex);}}else{logEntryContent="";wrappedLogEntryContent="";var searchTermReplacementLength=searchTermReplacementStartTag.length+',"this.searchTerm.length+searchTermReplacementEndTag.length;var searchTermLength=this.searchTerm.length;var searchTermLowerCase=this.searchTerm.toLowerCase();var logTextLowerCase=logEntry.formattedMessage.toLowerCase();while((searchIndex=logTextLowerCase.indexOf(searchTermLowerCase,startIndex))>-1){matchedText=escapeHtml(logEntry.formattedMessage.substr(searchIndex,this.searchTerm.length));textBeforeMatch=escapeHtml(logEntry.formattedMessage.substring(startIndex,searchIndex));var searchTermReplacement=searchTermReplacementStartTag+","preStartTag+matchedText+preEndTag+searchTermReplacementEndTag;logEntryContent+=preStartTag+textBeforeMatch+preEndTag+searchTermReplacement;if(isIe){wrappedLogEntryContent+=textBeforeMatch+searchTermReplacementStartTag+","matchedText+searchTermReplacementEndTag;}","startIndex=searchIndex+searchTermLength;}","var textAfterLastMatch=escapeHtml(logEntry.formattedMessage.substr(startIndex));logEntryContent+=preStartTag+textAfterLastMatch+preEndTag;if(isIe){wrappedLogEntryContent+=textAfterLastMatch;}}","logEntry.setContent(logEntryContent,wrappedLogEntryContent);var logEntryMatches=logEntry.getSearchMatches();this.matches=this.matches.concat(logEntryMatches);}else{logEntry.setSearchMatch(false);logEntry.setContent(logEntry.formattedMessage,logEntry.formattedMessage);}","return doesMatch;},removeMatches:function(logEntries){var matchesToRemoveCount=0;var currentMatchRemoved=false;var matchesToRemove=[];var i,iLen,j,jLen;for(i=0,iLen=this.matches.length;i<iLen;i++){for(j=0,jLen=logEntries.length;j<jLen;j++){if(this.matches[i].belongsTo(logEntries[j])){matchesToRemove.push(this.matches[i]);if(i===currentMatchIndex){currentMatchRemoved=true;}}}}","var newMatch=currentMatchRemoved?null:this.matches[currentMatchIndex];if(currentMatchRemoved){for(i=currentMatchIndex,iLen=this.matches.length;i<iLen;i++){if(this.matches[i].isVisible()&&!array_contains(matchesToRemove,this.matches[i])){newMatch=this.matches[i];break;}}}","for(i=0,iLen=matchesToRemove.length;i<iLen;i++){array_remove(this.matches,matchesToRemove[i]);matchesToRemove[i].remove();}","if(this.hasVisibleMatches()){if(newMatch===null){setCurrentMatchIndex(0);}else{var newMatchIndex=0;for(i=0,iLen=this.matches.length;i<iLen;i++){if(newMatch===this.matches[i]){newMatchIndex=i;break;}}","setCurrentMatchIndex(newMatchIndex);}}else{currentMatchIndex=null;displayNoMatches();}}};function getPageOffsetTop(el,container){var currentEl=el;var y=0;while(currentEl&¤tEl!=container){y+=currentEl.offsetTop;currentEl=currentEl.offsetParent;}","return y;}",'function scrollIntoView(el){var logContainer=logMainContainer;if(!$("wrap").checked){var logContainerLeft=logContainer.scrollLeft;var logContainerRight=logContainerLeft+logContainer.offsetWidth;var elLeft=el.offsetLeft;var elRight=elLeft+el.offsetWidth;if(elLeft<logContainerLeft||elRight>logContainerRight){logContainer.scrollLeft=elLeft-(logContainer.offsetWidth-el.offsetWidth)/2;}}',"var logContainerTop=logContainer.scrollTop;var logContainerBottom=logContainerTop+logContainer.offsetHeight;var elTop=getPageOffsetTop(el)-getToolBarsHeight();var elBottom=elTop+el.offsetHeight;if(elTop<logContainerTop||elBottom>logContainerBottom){logContainer.scrollTop=elTop-(logContainer.offsetHeight-el.offsetHeight)/2;}}","function Match(logEntryLevel,spanInMainDiv,spanInUnwrappedPre,spanInWrappedDiv){this.logEntryLevel=logEntryLevel;this.spanInMainDiv=spanInMainDiv;if(isIe){this.spanInUnwrappedPre=spanInUnwrappedPre;this.spanInWrappedDiv=spanInWrappedDiv;}","this.mainSpan=isIe?spanInUnwrappedPre:spanInMainDiv;}",'Match.prototype={equals:function(match){return this.mainSpan===match.mainSpan;},setCurrent:function(){if(isIe){addClass(this.spanInUnwrappedPre,"currentmatch");addClass(this.spanInWrappedDiv,"currentmatch");var elementToScroll=$("wrap").checked?this.spanInWrappedDiv:this.spanInUnwrappedPre;scrollIntoView(elementToScroll);}else{addClass(this.spanInMainDiv,"currentmatch");scrollIntoView(this.spanInMainDiv);}},belongsTo:function(logEntry){if(isIe){return isDescendant(this.spanInUnwrappedPre,logEntry.unwrappedPre);}else{return isDescendant(this.spanInMainDiv,logEntry.mainDiv);}},setNotCurrent:function(){if(isIe){removeClass(this.spanInUnwrappedPre,"currentmatch");removeClass(this.spanInWrappedDiv,"currentmatch");}else{removeClass(this.spanInMainDiv,"currentmatch");}},isOrphan:function(){return isOrphan(this.mainSpan);},isVisible:function(){return getCheckBox(this.logEntryLevel).checked;},remove:function(){if(isIe){this.spanInUnwrappedPre=null;this.spanInWrappedDiv=null;}else{this.spanInMainDiv=null;}}};var currentSearch=null;var currentMatchIndex=null;function doSearch(){var searchBox=$("searchBox");var searchTerm=searchBox.value;var isRegex=$("searchRegex").checked;var isCaseSensitive=$("searchCaseSensitive").checked;var i;if(searchTerm===""){$("searchReset").disabled=true;$("searchNav").style.display="none";removeClass(document.body,"searching");removeClass(searchBox,"hasmatches");removeClass(searchBox,"nomatches");for(i=0;i<logEntries.length;i++){logEntries[i].clearSearch();logEntries[i].setContent(logEntries[i].formattedMessage,logEntries[i].formattedMessage);}','currentSearch=null;setLogContainerHeight();}else{$("searchReset").disabled=false;$("searchNav").style.display="block";var searchRegex;var regexValid;if(isRegex){try{searchRegex=isCaseSensitive?new RegExp(searchTerm,"g"):new RegExp(searchTerm,"gi");regexValid=true;replaceClass(searchBox,"validregex","invalidregex");searchBox.title="Valid regex";}catch(ex){regexValid=false;replaceClass(searchBox,"invalidregex","validregex");searchBox.title="Invalid regex: "+(ex.message?ex.message:(ex.description?ex.description:"unknown error"));return;}}else{searchBox.title="";removeClass(searchBox,"validregex");removeClass(searchBox,"invalidregex");}','addClass(document.body,"searching");currentSearch=new Search(searchTerm,isRegex,searchRegex,isCaseSensitive);for(i=0;i<logEntries.length;i++){currentSearch.applyTo(logEntries[i]);}',"setLogContainerHeight();if(currentSearch.hasVisibleMatches()){setCurrentMatchIndex(0);displayMatches();}else{displayNoMatches();}}}","function updateSearchFromFilters(){if(currentSearch){if(currentSearch.hasMatches()){if(currentMatchIndex===null){currentMatchIndex=0;}","var currentMatch=currentSearch.matches[currentMatchIndex];if(currentMatch.isVisible()){displayMatches();setCurrentMatchIndex(currentMatchIndex);}else{currentMatch.setNotCurrent();var nextVisibleMatchIndex=currentSearch.getNextVisibleMatchIndex();if(nextVisibleMatchIndex>-1){setCurrentMatchIndex(nextVisibleMatchIndex);displayMatches();}else{displayNoMatches();}}}else{displayNoMatches();}}}","function refreshCurrentMatch(){if(currentSearch&¤tSearch.hasVisibleMatches()){setCurrentMatchIndex(currentMatchIndex);}}",'function displayMatches(){replaceClass($("searchBox"),"hasmatches","nomatches");$("searchBox").title=""+currentSearch.matches.length+" matches found";$("searchNav").style.display="block";setLogContainerHeight();}','function displayNoMatches(){replaceClass($("searchBox"),"nomatches","hasmatches");$("searchBox").title="No matches found";$("searchNav").style.display="none";setLogContainerHeight();}','function toggleSearchEnabled(enable){enable=(typeof enable=="undefined")?!$("searchDisable").checked:enable;$("searchBox").disabled=!enable;$("searchReset").disabled=!enable;$("searchRegex").disabled=!enable;$("searchNext").disabled=!enable;$("searchPrevious").disabled=!enable;$("searchCaseSensitive").disabled=!enable;$("searchNav").style.display=(enable&&($("searchBox").value!=="")&¤tSearch&¤tSearch.hasVisibleMatches())?"block":"none";if(enable){removeClass($("search"),"greyedout");addClass(document.body,"searching");if($("searchHighlight").checked){addClass(logMainContainer,"searchhighlight");}else{removeClass(logMainContainer,"searchhighlight");}','if($("searchFilter").checked){addClass(logMainContainer,"searchfilter");}else{removeClass(logMainContainer,"searchfilter");}','$("searchDisable").checked=!enable;}else{addClass($("search"),"greyedout");removeClass(document.body,"searching");removeClass(logMainContainer,"searchhighlight");removeClass(logMainContainer,"searchfilter");}',"setLogContainerHeight();}",'function toggleSearchFilter(){var enable=$("searchFilter").checked;if(enable){addClass(logMainContainer,"searchfilter");}else{removeClass(logMainContainer,"searchfilter");}',"refreshCurrentMatch();}",'function toggleSearchHighlight(){var enable=$("searchHighlight").checked;if(enable){addClass(logMainContainer,"searchhighlight");}else{removeClass(logMainContainer,"searchhighlight");}}','function clearSearch(){$("searchBox").value="";doSearch();}','function searchNext(){if(currentSearch!==null&¤tMatchIndex!==null){currentSearch.matches[currentMatchIndex].setNotCurrent();var nextMatchIndex=currentSearch.getNextVisibleMatchIndex();if(nextMatchIndex>currentMatchIndex||confirm("Reached the end of the page. Start from the top?")){setCurrentMatchIndex(nextMatchIndex);}}}','function searchPrevious(){if(currentSearch!==null&¤tMatchIndex!==null){currentSearch.matches[currentMatchIndex].setNotCurrent();var previousMatchIndex=currentSearch.getPreviousVisibleMatchIndex();if(previousMatchIndex<currentMatchIndex||confirm("Reached the start of the page. Continue from the bottom?")){setCurrentMatchIndex(previousMatchIndex);}}}',"function setCurrentMatchIndex(index){currentMatchIndex=index;currentSearch.matches[currentMatchIndex].setCurrent();}",'function addClass(el,cssClass){if(!hasClass(el,cssClass)){if(el.className){el.className+=" "+cssClass;}else{el.className=cssClass;}}}','function hasClass(el,cssClass){if(el.className){var classNames=el.className.split(" ");return array_contains(classNames,cssClass);}',"return false;}",'function removeClass(el,cssClass){if(hasClass(el,cssClass)){var existingClasses=el.className.split(" ");var newClasses=[];for(var i=0,len=existingClasses.length;i<len;i++){if(existingClasses[i]!=cssClass){newClasses[newClasses.length]=existingClasses[i];}}','el.className=newClasses.join(" ");}}',"function replaceClass(el,newCssClass,oldCssClass){removeClass(el,oldCssClass);addClass(el,newCssClass);}","function getElementsByClass(el,cssClass,tagName){var elements=el.getElementsByTagName(tagName);var matches=[];for(var i=0,len=elements.length;i<len;i++){if(hasClass(elements[i],cssClass)){matches.push(elements[i]);}}","return matches;}","function $(id){return document.getElementById(id);}","function isDescendant(node,ancestorNode){while(node!=null){if(node===ancestorNode){return true;}","node=node.parentNode;}","return false;}","function isOrphan(node){var currentNode=node;while(currentNode){if(currentNode==document.body){return false;}","currentNode=currentNode.parentNode;}","return true;}",'function escapeHtml(str){return str.replace(/&/g,"&").replace(/[<]/g,"<").replace(/>/g,">");}',"function getWindowWidth(){if(window.innerWidth){return window.innerWidth;}else if(document.documentElement&&document.documentElement.clientWidth){return document.documentElement.clientWidth;}else if(document.body){return document.body.clientWidth;}","return 0;}","function getWindowHeight(){if(window.innerHeight){return window.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){return document.documentElement.clientHeight;}else if(document.body){return document.body.clientHeight;}","return 0;}",'function getToolBarsHeight(){return $("switches").offsetHeight;}','function getChromeHeight(){var height=getToolBarsHeight();if(showCommandLine){height+=$("commandLine").offsetHeight;}',"return height;}",'function setLogContainerHeight(){if(logMainContainer){var windowHeight=getWindowHeight();$("body").style.height=getWindowHeight()+"px";logMainContainer.style.height=""+','Math.max(0,windowHeight-getChromeHeight())+"px";}}','function setCommandInputWidth(){if(showCommandLine){$("command").style.width=""+Math.max(0,$("commandLineContainer").offsetWidth-','($("evaluateButton").offsetWidth+13))+"px";}}',"window.onresize=function(){setCommandInputWidth();setLogContainerHeight();};if(!Array.prototype.push){Array.prototype.push=function(){for(var i=0,len=arguments.length;i<len;i++){this[this.length]=arguments[i];}","return this.length;};}","if(!Array.prototype.pop){Array.prototype.pop=function(){if(this.length>0){var val=this[this.length-1];this.length=this.length-1;return val;}};}","if(!Array.prototype.shift){Array.prototype.shift=function(){if(this.length>0){var firstItem=this[0];for(var i=0,len=this.length-1;i<len;i++){this[i]=this[i+1];}","this.length=this.length-1;return firstItem;}};}","if(!Array.prototype.splice){Array.prototype.splice=function(startIndex,deleteCount){var itemsAfterDeleted=this.slice(startIndex+deleteCount);var itemsDeleted=this.slice(startIndex,startIndex+deleteCount);this.length=startIndex;var argumentsArray=[];for(var i=0,len=arguments.length;i<len;i++){argumentsArray[i]=arguments[i];}","var itemsToAppend=(argumentsArray.length>2)?itemsAfterDeleted=argumentsArray.slice(2).concat(itemsAfterDeleted):itemsAfterDeleted;for(i=0,len=itemsToAppend.length;i<len;i++){this.push(itemsToAppend[i]);}","return itemsDeleted;};}","function array_remove(arr,val){var index=-1;for(var i=0,len=arr.length;i<len;i++){if(arr[i]===val){index=i;break;}}","if(index>=0){arr.splice(index,1);return index;}else{return false;}}","function array_removeFromStart(array,numberToRemove){if(Array.prototype.splice){array.splice(0,numberToRemove);}else{for(var i=numberToRemove,len=array.length;i<len;i++){array[i-numberToRemove]=array[i];}","array.length=array.length-numberToRemove;}","return array;}","function array_contains(arr,val){for(var i=0,len=arr.length;i<len;i++){if(arr[i]==val){return true;}}","return false;}","function getErrorMessage(ex){if(ex.message){return ex.message;}else if(ex.description){return ex.description;}",'return""+ex;}',"function moveCaretToEnd(input){if(input.setSelectionRange){input.focus();var length=input.value.length;input.setSelectionRange(length,length);}else if(input.createTextRange){var range=input.createTextRange();range.collapse(false);range.select();}","input.focus();}",'function stopPropagation(evt){if(evt.stopPropagation){evt.stopPropagation();}else if(typeof evt.cancelBubble!="undefined"){evt.cancelBubble=true;}}',"function getEvent(evt){return evt?evt:event;}","function getTarget(evt){return evt.target?evt.target:evt.srcElement;}",'function getRelatedTarget(evt){if(evt.relatedTarget){return evt.relatedTarget;}else if(evt.srcElement){switch(evt.type){case"mouseover":return evt.fromElement;case"mouseout":return evt.toElement;default:return evt.srcElement;}}}',"function cancelKeyEvent(evt){evt.returnValue=false;stopPropagation(evt);}",'function evalCommandLine(){var expr=$("command").value;evalCommand(expr);$("command").value="";}',"function evalLastCommand(){if(lastCommand!=null){evalCommand(lastCommand);}}",'var lastCommand=null;var commandHistory=[];var currentCommandIndex=0;function evalCommand(expr){if(appender){appender.evalCommandAndAppend(expr);}else{var prefix=">>> "+expr+"\\r\\n";try{log("INFO",prefix+eval(expr));}catch(ex){log("ERROR",prefix+"Error: "+getErrorMessage(ex));}}',"if(expr!=commandHistory[commandHistory.length-1]){commandHistory.push(expr);if(appender){appender.storeCommandHistory(commandHistory);}}","currentCommandIndex=(expr==commandHistory[currentCommandIndex])?currentCommandIndex+1:commandHistory.length;lastCommand=expr;}","//]]>","</script>",'<style type="text/css">',"body{background-color:white;color:black;padding:0;margin:0;font-family:tahoma,verdana,arial,helvetica,sans-serif;overflow:hidden}div#switchesContainer input{margin-bottom:0}div.toolbar{border-top:solid #ffffff 1px;border-bottom:solid #aca899 1px;background-color:#f1efe7;padding:3px 5px;font-size:68.75%}div.toolbar,div#search input{font-family:tahoma,verdana,arial,helvetica,sans-serif}div.toolbar input.button{padding:0 5px;font-size:100%}div.toolbar input.hidden{display:none}div#switches input#clearButton{margin-left:20px}div#levels label{font-weight:bold}div#levels label,div#options label{margin-right:5px}div#levels label#wrapLabel{font-weight:normal}div#search label{margin-right:10px}div#search label.searchboxlabel{margin-right:0}div#search input{font-size:100%}div#search input.validregex{color:green}div#search input.invalidregex{color:red}div#search input.nomatches{color:white;background-color:#ff6666}div#search input.nomatches{color:white;background-color:#ff6666}div#searchNav{display:none}div#commandLine{display:none}div#commandLine input#command{font-size:100%;font-family:Courier New,Courier}div#commandLine input#evaluateButton{}*.greyedout{color:gray !important;border-color:gray !important}*.greyedout *.alwaysenabled{color:black}*.unselectable{-khtml-user-select:none;-moz-user-select:none;user-select:none}div#log{font-family:Courier New,Courier;font-size:75%;width:100%;overflow:auto;clear:both;position:relative}div.group{border-color:#cccccc;border-style:solid;border-width:1px 0 1px 1px;overflow:visible}div.oldIe div.group,div.oldIe div.group *,div.oldIe *.logentry{height:1%}div.group div.groupheading span.expander{border:solid black 1px;font-family:Courier New,Courier;font-size:0.833em;background-color:#eeeeee;position:relative;top:-1px;color:black;padding:0 2px;cursor:pointer;cursor:hand;height:1%}div.group div.groupcontent{margin-left:10px;padding-bottom:2px;overflow:visible}div.group div.expanded{display:block}div.group div.collapsed{display:none}*.logentry{overflow:visible;display:none;white-space:pre}span.pre{white-space:pre}pre.unwrapped{display:inline !important}pre.unwrapped pre.pre,div.wrapped pre.pre{display:inline}div.wrapped pre.pre{white-space:normal}div.wrapped{display:none}body.searching *.logentry span.currentmatch{color:white !important;background-color:green !important}body.searching div.searchhighlight *.logentry span.searchterm{color:black;background-color:yellow}div.wrap *.logentry{white-space:normal !important;border-width:0 0 1px 0;border-color:#dddddd;border-style:dotted}div.wrap #log_wrapped,#log_unwrapped{display:block}div.wrap #log_unwrapped,#log_wrapped{display:none}div.wrap *.logentry span.pre{overflow:visible;white-space:normal}div.wrap *.logentry pre.unwrapped{display:none}div.wrap *.logentry span.wrapped{display:inline}div.searchfilter *.searchnonmatch{display:none !important}div#log *.TRACE,label#label_TRACE{color:#666666}div#log *.DEBUG,label#label_DEBUG{color:green}div#log *.INFO,label#label_INFO{color:#000099}div#log *.WARN,label#label_WARN{color:#999900}div#log *.ERROR,label#label_ERROR{color:red}div#log *.FATAL,label#label_FATAL{color:#660066}div.TRACE#log *.TRACE,div.DEBUG#log *.DEBUG,div.INFO#log *.INFO,div.WARN#log *.WARN,div.ERROR#log *.ERROR,div.FATAL#log *.FATAL{display:block}div#log div.separator{background-color:#cccccc;margin:5px 0;line-height:1px}","</style>","</head>",'<body id="body">','<div id="switchesContainer">','<div id="switches">','<div id="levels" class="toolbar">',"Filters:",'<input type="checkbox" id="switch_TRACE" onclick="applyFilters(); checkAllLevels()" checked="checked" title="Show/hide trace messages" /><label for="switch_TRACE" id="label_TRACE">trace</label>','<input type="checkbox" id="switch_DEBUG" onclick="applyFilters(); checkAllLevels()" checked="checked" title="Show/hide debug messages" /><label for="switch_DEBUG" id="label_DEBUG">debug</label>','<input type="checkbox" id="switch_INFO" onclick="applyFilters(); checkAllLevels()" checked="checked" title="Show/hide info messages" /><label for="switch_INFO" id="label_INFO">info</label>','<input type="checkbox" id="switch_WARN" onclick="applyFilters(); checkAllLevels()" checked="checked" title="Show/hide warn messages" /><label for="switch_WARN" id="label_WARN">warn</label>','<input type="checkbox" id="switch_ERROR" onclick="applyFilters(); checkAllLevels()" checked="checked" title="Show/hide error messages" /><label for="switch_ERROR" id="label_ERROR">error</label>','<input type="checkbox" id="switch_FATAL" onclick="applyFilters(); checkAllLevels()" checked="checked" title="Show/hide fatal messages" /><label for="switch_FATAL" id="label_FATAL">fatal</label>','<input type="checkbox" id="switch_ALL" onclick="toggleAllLevels(); applyFilters()" checked="checked" title="Show/hide all messages" /><label for="switch_ALL" id="label_ALL">all</label>',"</div>",'<div id="search" class="toolbar">','<label for="searchBox" class="searchboxlabel">Search:</label> <input type="text" id="searchBox" onclick="toggleSearchEnabled(true)" onkeyup="scheduleSearch()" size="20" />','<input type="button" id="searchReset" disabled="disabled" value="Reset" onclick="clearSearch()" class="button" title="Reset the search" />','<input type="checkbox" id="searchRegex" onclick="doSearch()" title="If checked, search is treated as a regular expression" /><label for="searchRegex">Regex</label>','<input type="checkbox" id="searchCaseSensitive" onclick="doSearch()" title="If checked, search is case sensitive" /><label for="searchCaseSensitive">Match case</label>','<input type="checkbox" id="searchDisable" onclick="toggleSearchEnabled()" title="Enable/disable search" /><label for="searchDisable" class="alwaysenabled">Disable</label>','<div id="searchNav">','<input type="button" id="searchNext" disabled="disabled" value="Next" onclick="searchNext()" class="button" title="Go to the next matching log entry" />','<input type="button" id="searchPrevious" disabled="disabled" value="Previous" onclick="searchPrevious()" class="button" title="Go to the previous matching log entry" />','<input type="checkbox" id="searchFilter" onclick="toggleSearchFilter()" title="If checked, non-matching log entries are filtered out" /><label for="searchFilter">Filter</label>','<input type="checkbox" id="searchHighlight" onclick="toggleSearchHighlight()" title="Highlight matched search terms" /><label for="searchHighlight" class="alwaysenabled">Highlight all</label>',"</div>","</div>",'<div id="options" class="toolbar">',"Options:",'<input type="checkbox" id="enableLogging" onclick="toggleLoggingEnabled()" checked="checked" title="Enable/disable logging" /><label for="enableLogging" id="enableLoggingLabel">Log</label>','<input type="checkbox" id="wrap" onclick="toggleWrap()" title="Enable / disable word wrap" /><label for="wrap" id="wrapLabel">Wrap</label>','<input type="checkbox" id="newestAtTop" onclick="toggleNewestAtTop()" title="If checked, causes newest messages to appear at the top" /><label for="newestAtTop" id="newestAtTopLabel">Newest at the top</label>','<input type="checkbox" id="scrollToLatest" onclick="toggleScrollToLatest()" checked="checked" title="If checked, window automatically scrolls to a new message when it is added" /><label for="scrollToLatest" id="scrollToLatestLabel">Scroll to latest</label>','<input type="button" id="clearButton" value="Clear" onclick="clearLog()" class="button" title="Clear all log messages" />','<input type="button" id="hideButton" value="Hide" onclick="hide()" class="hidden button" title="Hide the console" />','<input type="button" id="closeButton" value="Close" onclick="closeWindow()" class="hidden button" title="Close the window" />',"</div>","</div>","</div>",'<div id="log" class="TRACE DEBUG INFO WARN ERROR FATAL"></div>','<div id="commandLine" class="toolbar">','<div id="commandLineContainer">','<input type="text" id="command" title="Enter a JavaScript command here and hit return or press \'Evaluate\'" />','<input type="button" id="evaluateButton" value="Evaluate" class="button" title="Evaluate the command" onclick="evalCommandLine()" />',"</div>","</div>","</body>","</html>",""]
|
|
},n=[];ConsoleAppender=function(){};var r=1;ConsoleAppender.prototype=new Appender,ConsoleAppender.prototype.create=function(e,t,o,s,a,l,c,h){function u(e,t){this.loggingEvent=e,this.levelName=e.level.name,this.formattedMessage=t}function d(e,t){this.name=e,this.initiallyExpanded=t}function p(){}var f=this,g=!1,m=!1,v=!1,b=!1,y=[],x=!0,_=r++;s=extractBooleanFromParam(s,this.defaults.initiallyMinimized),o=extractBooleanFromParam(o,this.defaults.lazyInit),a=extractBooleanFromParam(a,this.defaults.useDocumentWrite);var C=this.defaults.newestMessageAtTop,w=this.defaults.scrollToLatestMessage;l=l?l:this.defaults.width,c=c?c:this.defaults.height;var k=this.defaults.maxMessages,T=this.defaults.showCommandLine,E=this.defaults.commandLineObjectExpansionDepth,S=this.defaults.showHideButton,P=this.defaults.showCloseButton;this.defaults.showLogEntryDeleteButtons,this.setLayout(this.defaults.layout);var A,O,L,R,I,D=e?"InPageAppender":"PopUpAppender",M=function(e){return m?(handleError(D+": configuration option '"+e+"' may not be set after the appender has been initialized"),!1):!0},G=function(){return v&&x&&!b};this.isNewestMessageAtTop=function(){return C},this.setNewestMessageAtTop=function(e){C=bool(e),G()&&R().setNewestAtTop(C)},this.isScrollToLatestMessage=function(){return w},this.setScrollToLatestMessage=function(e){w=bool(e),G()&&R().setScrollToLatest(w)},this.getWidth=function(){return l},this.setWidth=function(e){M("width")&&(l=extractStringFromParam(e,l))},this.getHeight=function(){return c},this.setHeight=function(e){M("height")&&(c=extractStringFromParam(e,c))},this.getMaxMessages=function(){return k},this.setMaxMessages=function(e){k=extractIntFromParam(e,k),G()&&R().setMaxMessages(k)},this.isShowCommandLine=function(){return T},this.setShowCommandLine=function(e){T=bool(e),G()&&R().setShowCommandLine(T)},this.isShowHideButton=function(){return S},this.setShowHideButton=function(e){S=bool(e),G()&&R().setShowHideButton(S)},this.isShowCloseButton=function(){return P},this.setShowCloseButton=function(e){P=bool(e),G()&&R().setShowCloseButton(P)},this.getCommandLineObjectExpansionDepth=function(){return E},this.setCommandLineObjectExpansionDepth=function(e){E=extractIntFromParam(e,E)};var X=s;this.isInitiallyMinimized=function(){return s},this.setInitiallyMinimized=function(e){M("initiallyMinimized")&&(s=bool(e),X=s)},this.isUseDocumentWrite=function(){return a},this.setUseDocumentWrite=function(e){M("useDocumentWrite")&&(a=bool(e))},u.prototype.append=function(){R().log(this.levelName,this.formattedMessage)},d.prototype.append=function(){R().group(this.name,this.initiallyExpanded)},p.prototype.append=function(){R().groupEnd()};var N=function(){L(),g?b&&tt&&O():A(),L()&&B()};this.append=function(e){if(x){var t=f.getLayout().format(e);this.getLayout().ignoresThrowable()&&(t+=e.getThrowableStrRep()),y.push(new u(e,t)),N()}},this.group=function(e,t){x&&(y.push(new d(e,t)),N())},this.groupEnd=function(){x&&(y.push(new p),N())};var B=function(){for(;y.length>0;)y.shift().append();h&&R().focus()};this.setAddedToLogger=function(e){this.loggers.push(e),enabled&&!o&&A()},this.clear=function(){G()&&R().clearLog(),y.length=0},this.focus=function(){G()&&R().focus()},this.focusCommandLine=function(){G()&&R().focusCommandLine()},this.focusSearch=function(){G()&&R().focusSearch()};var J=window;this.getCommandWindow=function(){return J},this.setCommandWindow=function(e){J=e},this.executeLastCommand=function(){G()&&R().evalLastCommand()};var F=new PatternLayout("%m");this.getCommandLayout=function(){return F},this.setCommandLayout=function(e){F=e},this.evalCommandAndAppend=function(e){var t={appendResult:!0,isError:!1},i="";try{var n,r;!J.eval&&J.execScript&&J.execScript("null");var o={};for(r=0,len=j.length;len>r;r++)o[j[r][0]]=j[r][1];var s=[],a=function(e){s.push([e,J[e]])};a("appender"),J.appender=f,a("commandReturnValue"),J.commandReturnValue=t,a("commandLineFunctionsHash"),J.commandLineFunctionsHash=o;var l=function(e){a(e),J[e]=function(){return this.commandLineFunctionsHash[e](f,arguments,t)}};for(r=0,len=j.length;len>r;r++)l(j[r][0]);for(J===window&&J.execScript?(a("evalExpr"),a("result"),window.evalExpr=e,J.execScript("window.result=eval(window.evalExpr);"),n=window.result):n=J.eval(e),i=isUndefined(n)?n:formatObjectExpansion(n,E),r=0,len=s.length;len>r;r++)J[s[r][0]]=s[r][1]}catch(c){i="Error evaluating command: "+getExceptionStringRep(c),t.isError=!0}if(t.appendResult){var h=">>> "+e;isUndefined(i)||(h+=newLine+i);var u=t.isError?Level.ERROR:Level.INFO,d=new LoggingEvent(null,new Date,u,[h],null),p=this.getLayout();this.setLayout(F),this.append(d),this.setLayout(p)}};var j=n.concat([]);this.addCommandLineFunction=function(e,t){j.push([e,t])};var z="log4javascriptCommandHistory";this.storeCommandHistory=function(e){setCookie(z,e.join(","))};var H=function(e){var t=i();e.open();for(var n=0,r=t.length;r>n;n++)e.writeln(t[n]);e.close()};this.setEventTypes(["load","unload"]);var U=function(){var e=R();e.setAppender(f),e.setNewestAtTop(C),e.setScrollToLatest(w),e.setMaxMessages(k),e.setShowCommandLine(T),e.setShowHideButton(S),e.setShowCloseButton(P),e.setMainWindow(window);var t=getCookie(z);t&&(e.commandHistory=t.split(","),e.currentCommandIndex=e.commandHistory.length),f.dispatchEvent("load",{win:e})};this.unload=function(){logLog.debug("unload "+this+", caller: "+this.unload.caller),b||(logLog.debug("really doing unload "+this),b=!0,v=!1,m=!1,f.dispatchEvent("unload",{}))};var $=function(e,t,i,n){function r(){try{b&&clearInterval(o),e(R())&&(clearInterval(o),i())}catch(t){clearInterval(o),x=!1,handleError(n,t)}}var o=setInterval(r,t)},Y=function(){var e=document.domain!=location.hostname;return a?"":getBaseUrl()+"console.html"+(e?"?log4javascript_domain="+escape(document.domain):"")};if(e){var W=null,V=[];this.addCssProperty=function(e,t){M("cssProperties")&&V.push([e,t])};var K,q=!1,Z=uniqueId+"_InPageAppender_"+_;this.hide=function(){g&&m&&(G()&&R().$("command").blur(),K.style.display="none",X=!0)},this.show=function(){g&&(m?(K.style.display="block",this.setShowCommandLine(T),X=!1):q||O(!0))},this.isVisible=function(){return!X&&!b},this.close=function(e){b||e&&!confirm("This will permanently remove the console from the page. No more messages will be logged. Do you wish to continue?")||(K.parentNode.removeChild(K),this.unload())},I=function(){function e(){try{s||f.show(),U(),v=!0,B()}catch(e){x=!1,handleError(i,e)}}function t(){try{var t=function(e){return isLoaded(e)};a&&H(R().document),t(R())?e():$(t,100,e,i)}catch(n){x=!1,handleError(i,n)}}var i="InPageAppender.open: unable to create console iframe";X=!1,K=W.appendChild(document.createElement("div")),K.style.width=l,K.style.height=c,K.style.border="solid gray 1px";for(var n=0,r=V.length;r>n;n++)K.style[V[n][0]]=V[n][1];var o=a?"":" src='"+Y()+"'";K.innerHTML="<iframe id='"+Z+"' name='"+Z+"' width='100%' height='100%' frameborder='0'"+o+" scrolling='no'></iframe>",b=!1;var h=function(e){try{return bool(e)&&bool(e.document)}catch(t){return!1}};h(R())?t():$(h,100,t,i),m=!0},O=function(e){if(e||!s){var i=function(){if(t)try{var e=document.getElementById(t);1==e.nodeType&&(W=e),I()}catch(i){handleError("InPageAppender.init: invalid container element '"+t+"' supplied",i)}else W=document.createElement("div"),W.style.position="fixed",W.style.left="0",W.style.right="0",W.style.bottom="0",document.body.appendChild(W),f.addCssProperty("borderWidth","1px 0 0 0"),f.addCssProperty("zIndex",1e6),I()};pageLoaded&&t&&t.appendChild?(W=t,I()):pageLoaded?i():log4javascript.addEventListener("load",i),q=!0}},A=function(){O(),g=!0},R=function(){var e=window.frames[Z];return e?e:void 0},L=function(){return x&&!b?(m&&!v&&R()&&isLoaded(R())&&(v=!0),v):!1}}else{var Q=f.defaults.useOldPopUp,et=f.defaults.complainAboutPopUpBlocking,tt=this.defaults.reopenWhenClosed;this.isUseOldPopUp=function(){return Q},this.setUseOldPopUp=function(e){M("useOldPopUp")&&(Q=bool(e))},this.isComplainAboutPopUpBlocking=function(){return et},this.setComplainAboutPopUpBlocking=function(e){M("complainAboutPopUpBlocking")&&(et=bool(e))},this.isFocusPopUp=function(){return h},this.setFocusPopUp=function(e){h=bool(e)},this.isReopenWhenClosed=function(){return tt},this.setReopenWhenClosed=function(e){tt=bool(e)},this.close=function(){logLog.debug("close "+this);try{it.close(),this.unload()}catch(e){}},this.hide=function(){logLog.debug("hide "+this),G()&&this.close()},this.show=function(){logLog.debug("show "+this),m||I()},this.isVisible=function(){return L()};var it;I=function(){function e(){R().setCloseIfOpenerCloses(!Q||!a),U(),v=!0,B(),$(n,500,r,"PopUpAppender.checkPopUpClosed: error checking pop-up window")}var t="width="+l+",height="+c+",status,resizable",i="PopUp_"+location.host.replace(/[^a-z0-9]/gi,"_")+"_"+_;Q&&a||(i=i+"_"+uniqueId);var n=function(e){if(b)return!0;try{return bool(e)&&e.closed}catch(t){}return!1},r=function(){b||f.unload()};try{if(it=window.open(Y(),i,t),b=!1,m=!0,it&&it.document)if(a&&Q&&isLoaded(it))it.mainPageReloaded(),e();else{a&&H(it.document);var o=function(e){return bool(e)&&isLoaded(e)};isLoaded(it)?e():$(o,100,e,"PopUpAppender.init: unable to create console window")}else x=!1,logLog.warn("PopUpAppender.init: pop-ups blocked, please unblock to use PopUpAppender"),et&&handleError("log4javascript: pop-up windows appear to be blocked. Please unblock them to use pop-up logging.")}catch(s){handleError("PopUpAppender.init: error creating pop-up",s)}},O=function(){s||I()},A=function(){O(),g=!0},R=function(){return it},L=function(){if(x&&!isUndefined(it)&&!b){if(it.closed||v&&isUndefined(it.closed))return f.unload(),logLog.debug("PopUpAppender: pop-up closed"),!1;!v&&isLoaded(it)&&(v=!0)}return x&&v&&!b}}this.getConsoleWindow=R},ConsoleAppender.addGlobalCommandLineFunction=function(e,t){n.push([e,t])},e.prototype=new ConsoleAppender,e.prototype.defaults={layout:new PatternLayout("%d{HH:mm:ss} %-5p - %m{1}%n"),initiallyMinimized:!1,focusPopUp:!1,lazyInit:!0,useOldPopUp:!0,complainAboutPopUpBlocking:!0,newestMessageAtTop:!1,scrollToLatestMessage:!0,width:"600",height:"400",reopenWhenClosed:!1,maxMessages:null,showCommandLine:!0,commandLineObjectExpansionDepth:1,showHideButton:!1,showCloseButton:!0,showLogEntryDeleteButtons:!0,useDocumentWrite:!0},e.prototype.toString=function(){return"PopUpAppender"},log4javascript.PopUpAppender=e,t.prototype=new ConsoleAppender,t.prototype.defaults={layout:new PatternLayout("%d{HH:mm:ss} %-5p - %m{1}%n"),initiallyMinimized:!1,lazyInit:!0,newestMessageAtTop:!1,scrollToLatestMessage:!0,width:"100%",height:"220px",maxMessages:null,showCommandLine:!0,commandLineObjectExpansionDepth:1,showHideButton:!1,showCloseButton:!1,showLogEntryDeleteButtons:!0,useDocumentWrite:!0},t.prototype.toString=function(){return"InPageAppender"},log4javascript.InPageAppender=t,log4javascript.InlineAppender=t}(),function(){function e(e){var t=0;for(var i in e)t=Math.max(toStr(i).length,t);var n=[];for(i in e){var r,o=" "+padWithSpaces(toStr(i),t+2);try{r=splitIntoLines(toStr(e[i])).join(padWithSpaces(newLine,t+6))}catch(s){r="[Error obtaining property. Details: "+getExceptionMessage(s)+"]"}n.push(o+r)}return n.join(newLine)}function t(e,i,n,l,c){function h(e){return e.nodeType==r.TEXT_NODE&&/^[ \t\r\n]*$/.test(e.nodeValue)}function u(e){return(""+e).replace(/&/g,"&").replace(/</g,"<").replace(/"/g,""")}function d(e){for(var t=e.style.cssText.split(";"),i="",n=0,r=t.length;r>n;n++){var o=t[n].split(":"),s=[];/^\s*$/.test(o[0])||s.push(trim(o[0]).toLowerCase()+":"+trim(o[1])),i=s.join(";")}return i}function p(e){if(e.prefix)return e.prefix;if(e.outerHTML){var t=RegExp("<([^:]+):"+e.tagName+"[^>]*>","i");if(t.test(e.outerHTML))return RegExp.$1.toLowerCase()}return""}i=i===void 0?!0:!!i,"string"!=typeof n&&(n=""),l=!!l,c=!!c;var f,g="<",m=">";if(!i||e.nodeType==r.DOCUMENT_FRAGMENT_NODE){f="";for(var v=0,b=e.childNodes.length;b>v;v++)f+=t(e.childNodes[v],!0,n+a);return f}switch(e.nodeType){case r.ELEMENT_NODE:var y=e.tagName.toLowerCase();f=l?newLine+n:"",f+=g;var x=p(e),_=!!x;for(_&&(f+=x+":"),f+=y,v=0,b=e.attributes.length;b>v;v++){var C=e.attributes[v];C.specified&&null!==C.nodeValue&&"style"!==C.nodeName.toLowerCase()&&"string"==typeof C.nodeValue&&0!==C.nodeName.indexOf("_moz")&&(f+=" "+C.nodeName.toLowerCase()+'="',f+=u(C.nodeValue),f+='"')}if(e.style.cssText){var w=d(e);""!==w&&(f+=' style="'+d(e)+'"')}if(array_contains(s,y)||_&&!e.hasChildNodes())f+="/"+m;else{f+=m;for(var k=!(1===e.childNodes.length&&e.childNodes[0].nodeType===r.TEXT_NODE),T=array_contains(o,y),v=0,b=e.childNodes.length;b>v;v++)f+=t(e.childNodes[v],!0,n+a,k,T);var E=g+"/"+y+m;f+=k?newLine+n+E:E}return f;case r.TEXT_NODE:if(h(e))f="";else{if(c)f=e.nodeValue;else{for(var S=splitIntoLines(trim(e.nodeValue)),P=[],v=0,b=S.length;b>v;v++)P[v]=trim(S[v]);f=P.join(newLine+n)}l&&(f=newLine+n+f)}return f;case r.CDATA_SECTION_NODE:return"<![CDATA["+e.nodeValue+"]"+"]>"+newLine;case r.DOCUMENT_NODE:f="";for(var v=0,b=e.childNodes.length;b>v;v++)f+=t(e.childNodes[v],!0,n);return f;default:return""}}function i(){ConsoleAppender.addGlobalCommandLineFunction("$",function(e,t){return document.getElementById(t[0])}),ConsoleAppender.addGlobalCommandLineFunction("dir",function(t,i){for(var n=[],r=0,o=i.length;o>r;r++)n[r]=e(i[r]);return n.join(newLine+newLine)}),ConsoleAppender.addGlobalCommandLineFunction("dirxml",function(e,i){for(var n=[],r=0,o=i.length;o>r;r++)e.getCommandWindow(),n[r]=t(i[r]);return n.join(newLine+newLine)}),ConsoleAppender.addGlobalCommandLineFunction("cd",function(e,t,i){var n,r;return 0===t.length||""===t[0]?(n=window,r="Command line set to run in main window"):t[0].window==t[0]?(n=t[0],r="Command line set to run in frame '"+t[0].name+"'"):(n=window.frames[t[0]],n?r="Command line set to run in frame '"+t[0]+"'":(i.isError=!0,r="Frame '"+t[0]+"' does not exist",n=e.getCommandWindow())),e.setCommandWindow(n),r}),ConsoleAppender.addGlobalCommandLineFunction("clear",function(e,t,i){i.appendResult=!1,e.clear()}),ConsoleAppender.addGlobalCommandLineFunction("keys",function(e,t){var i=[];for(var n in t[0])i.push(n);return i}),ConsoleAppender.addGlobalCommandLineFunction("values",function(e,t){var i=[];for(var n in t[0])try{i.push(t[0][n])}catch(r){logLog.warn("values(): Unable to obtain value for key "+n+". Details: "+getExceptionMessage(r))}return i}),ConsoleAppender.addGlobalCommandLineFunction("expansionDepth",function(e,t,i){var n=parseInt(t[0],10);return isNaN(n)||0>n?(i.isError=!0,""+t[0]+" is not a valid expansion depth"):(e.setCommandLineObjectExpansionDepth(n),"Object expansion depth set to "+n)})}function n(){i()}var r={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},o=["script","pre"],s=["br","img","hr","param","link","area","input","col","base","meta"],a=" ";n()}(),log4javascript.setDocumentReady=function(){pageLoaded=!0,log4javascript.dispatchEvent("load",{})},window.addEventListener)window.addEventListener("load",log4javascript.setDocumentReady,!1);else if(window.attachEvent)window.attachEvent("onload",log4javascript.setDocumentReady);else{var oldOnload=window.onload;window.onload="function"!=typeof window.onload?log4javascript.setDocumentReady:function(e){oldOnload&&oldOnload(e),log4javascript.setDocumentReady()}}return window.log4javascript=log4javascript,log4javascript}(); |