📄 windowconsoleappender.js
字号:
jsx.logging.WindowConsoleAppender = function(){this.initialize.apply(this, arguments);}jsx.logging.WindowConsoleAppender.prototype = new jsx.logging.DefaultAppender();jsx.logging.WindowConsoleAppender.prototype.constructor = jsx.logging.WindowConsoleAppender;jsx.logging.WindowConsoleAppender.superclass = jsx.logging.DefaultAppender.prototype; /** @ignore */ jsx.logging.WindowConsoleAppender.prototype.initialize = function(_name) { try { width = "800"; height = "400"; parms = "resizable=yes"; // get dimensions to center the popup var screenWidth = screen.availWidth; var screenHeight = screen.availHeight; var leftPos = (screenWidth - width) / 2; var topPos = (screenHeight - height) /2; var newWindow = window.open("about:blank", "_blank","width=" + width + ",height=" + height + ",top=" + topPos + ",left=" + leftPos + "," + parms); var newWindowDoc = newWindow.document; newWindowDoc.open(); newWindowDoc.write("<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN'"); newWindowDoc.write(" 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>\n"); newWindowDoc.write("<html><head><title>JavaScript SDK Logging</title>"); newWindowDoc.write("</head><body></body></html>"); newWindowDoc.close(); newWindow.focus(); } catch(exception){} if(!_name) { var _name = "Default"; } jsx.logging.WindowConsoleAppender.superclass.initialize.apply(this, [_name]); var me = this; this.name = _name; this.suffix = "logging_console"; this.consoleWindow = newWindowDoc; this.container = this.consoleWindow.createElement("div"); this.container.id = this.name +"."+ this.suffix; var containerStyle = this.container.style; containerStyle.width = "100%"; containerStyle.height = "100%";//********************************************// Controls//******************************************** var controls = this.consoleWindow.createElement("div"); var controlsStyle = controls.style; controlsStyle.backgroundColor = "#b5c9c6"; controlsStyle.width = "100%"; controlsStyle.height = "20px";//********************************************// Appender Name//******************************************** var title = this.consoleWindow.createElement("div"); var titleStyle = title.style; titleStyle.display = "inline"; titleStyle.color = "#000000"; titleStyle.fontWeight = "bold"; titleStyle.paddingLeft = "5px"; titleStyle.paddingRight = "5px"; title.appendChild(this.consoleWindow.createTextNode(this.name + " Console Appender"));//********************************************//********************************************//********************************************// level filters//******************************************** var filters = this.consoleWindow.createElement("div"); var filtersStyle = filters.style; filtersStyle.display = "inline"; filtersStyle.paddingLeft = "5px"; filtersStyle.paddingRight = "5px"; var filterTitle = this.consoleWindow.createElement("span"); filterTitleStyle = filterTitle.style; filterTitleStyle.color = "#000000"; filterTitleStyle.fontWeight = "bold"; filterTitle.appendChild(this.consoleWindow.createTextNode("Filters:")); var trace = this.consoleWindow.createElement("input"); var debug = this.consoleWindow.createElement("input"); var info = this.consoleWindow.createElement("input"); var warn = this.consoleWindow.createElement("input"); var error = this.consoleWindow.createElement("input"); var fatal = this.consoleWindow.createElement("input"); trace.type = "checkbox"; debug.type = "checkbox"; info.type = "checkbox"; warn.type = "checkbox"; error.type = "checkbox"; fatal.type = "checkbox"; trace.id = this.container.id + ".trace_chk"; debug.id = this.container.id + ".debug_chk"; info.id = this.container.id + ".info_chk"; warn.id = this.container.id + ".warn_chk"; error.id = this.container.id + ".error_chk"; fatal.id = this.container.id + ".fatal_chk"; var traceSpan = this.consoleWindow.createElement("span"); var debugSpan = this.consoleWindow.createElement("span"); var infoSpan = this.consoleWindow.createElement("span"); var warnSpan = this.consoleWindow.createElement("span"); var errorSpan = this.consoleWindow.createElement("span"); var fatalSpan = this.consoleWindow.createElement("span"); var traceSpanStyle = traceSpan.style; var debugSpanStyle = debugSpan.style; var infoSpanStyle = infoSpan.style; var warnSpanStyle = warnSpan.style; var errorSpanStyle = errorSpan.style; var fatalSpanStyle = fatalSpan.style; traceSpanStyle.color = jsx.logging.WindowConsoleAppender.TRACE_COLOR; debugSpanStyle.color = jsx.logging.WindowConsoleAppender.DEBUG_COLOR; infoSpanStyle.color = jsx.logging.WindowConsoleAppender.INFO_COLOR; warnSpanStyle.color = jsx.logging.WindowConsoleAppender.WARN_COLOR; errorSpanStyle.color = jsx.logging.WindowConsoleAppender.ERROR_COLOR; fatalSpanStyle.color = jsx.logging.WindowConsoleAppender.FATAL_COLOR; traceSpanStyle.fontWeight = "bold"; debugSpanStyle.fontWeight = "bold"; infoSpanStyle.fontWeight = "bold"; warnSpanStyle.fontWeight = "bold"; errorSpanStyle.fontWeight = "bold"; fatalSpanStyle.fontWeight = "bold"; traceSpan.appendChild(this.consoleWindow.createTextNode("trace ")); debugSpan.appendChild(this.consoleWindow.createTextNode("debug ")); infoSpan.appendChild(this.consoleWindow.createTextNode("info ")); warnSpan.appendChild(this.consoleWindow.createTextNode("warn ")); errorSpan.appendChild(this.consoleWindow.createTextNode("error ")); fatalSpan.appendChild(this.consoleWindow.createTextNode("fatal")); filters.appendChild(filterTitle); filters.appendChild(trace); filters.appendChild(traceSpan); filters.appendChild(debug); filters.appendChild(debugSpan); filters.appendChild(info); filters.appendChild(infoSpan); filters.appendChild(warn); filters.appendChild(warnSpan); filters.appendChild(error); filters.appendChild(errorSpan); filters.appendChild(fatal); filters.appendChild(fatalSpan);//********************************************//********************************************//********************************************// Display//******************************************** var display = this.consoleWindow.createElement("div"); var displayStyle = display.style; displayStyle.display = "inline"; displayStyle.paddingLeft = "5px"; displayStyle.paddingRight = "5px"; var scrollLockChk = this.consoleWindow.createElement("input"); scrollLockChk.type = "checkbox"; scrollLockChk.id = this.container.id + ".scroll_lock_chk"; var scrollLockSpan = this.consoleWindow.createElement("span"); var scrollLockSpanStyle = scrollLockSpan.style; scrollLockSpanStyle.color = "#000000"; scrollLockSpanStyle.fontWeight = "bold"; scrollLockSpan.appendChild(this.consoleWindow.createTextNode("Scroll Lock ")); var clearLogsBtn = this.consoleWindow.createElement("input"); clearLogsBtn.type = "button"; clearLogsBtn.id = this.container.id + ".clear_btn"; clearLogsBtn.value = "Clear"; display.appendChild(scrollLockChk); display.appendChild(scrollLockSpan); display.appendChild(clearLogsBtn);//********************************************//******************************************** // add all containers controls.appendChild(title); controls.appendChild(filters); controls.appendChild(display); this.container.appendChild(controls);//********************************************// div console//******************************************** var consoleContainer = this.consoleWindow.createElement("div"); consoleContainer.id = this.container.id + ".div_console"; var consoleContainerStyle = consoleContainer.style; consoleContainerStyle.width = "100%"; consoleContainerStyle.height = "100%"; consoleContainerStyle.overflow = "auto"; this.loggingConsole = consoleContainer; this.container.appendChild(consoleContainer);//********************************************//******************************************** this.consoleWindow.getElementsByTagName("body")[0].appendChild(this.container); // these statements need to be below appending to the body trace.checked = "checked"; debug.checked = "checked"; info.checked = "checked";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -