⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 windowconsoleappender.js

📁 Browser independent JavaScript SDK. ClassLoader to lazy load JavaScript classes, extensions to core
💻 JS
📖 第 1 页 / 共 2 页
字号:
/* * JavaScript Software Development Kit - what JavaScript should be and can be - js-sdk.sourceforge.net * Copyright (C) 2006-2007 Mathew Sheets * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL") *    http://www.gnu.org/licenses/lgpl.html * * == END LICENSE == */package jsx.logging;import jsx.lang.StringBuffer;import jsx.logging.DefaultAppender;import jsx.logging.DefaultLayout;import jsx.logging.Level;import jsx.event.*;import jsx.dom.Element;class WindowConsoleAppender extends DefaultAppender{	WindowConsoleAppender(_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";		}		super(_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 = WindowConsoleAppender.TRACE_COLOR;		debugSpanStyle.color = WindowConsoleAppender.DEBUG_COLOR;		infoSpanStyle.color = WindowConsoleAppender.INFO_COLOR;		warnSpanStyle.color = WindowConsoleAppender.WARN_COLOR;		errorSpanStyle.color = WindowConsoleAppender.ERROR_COLOR;		fatalSpanStyle.color = 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";

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -