mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-14 06:31:27 +00:00
Merge branch 'master' of git@github.com:280north/cappuccino
This commit is contained in:
@@ -1,72 +0,0 @@
|
||||
body {
|
||||
font: 10px Monaco, Courier, "Courier New", monospace, mono;
|
||||
padding-top: 15px;
|
||||
}
|
||||
|
||||
div > .fatal, div > .error, div > .warn, div > .info, div > .debug, div > .trace {
|
||||
display: none;
|
||||
overflow: hidden;
|
||||
white-space: pre;
|
||||
padding: 0px 5px 0px 5px;
|
||||
margin-top: 2px;
|
||||
-moz-border-radius: 5px;
|
||||
-webkit-border-radius: 5px;
|
||||
}
|
||||
|
||||
div[wrap="yes"] > div {
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.fatal { background-color: #ffb2b3; }
|
||||
.error { background-color: #ffe2b2; }
|
||||
.warn { background-color: #fdffb2; }
|
||||
.info { background-color: #e4ffb2; }
|
||||
.debug { background-color: #a0e5a0; }
|
||||
.trace { background-color: #99b9ff; }
|
||||
|
||||
.enfatal .fatal, .enerror .error, .enwarn .warn, .eninfo .info, .endebug .debug, .entrace .trace { display: block; }
|
||||
|
||||
div#header {
|
||||
background-color: rgba(240,240,240,0.82);
|
||||
position: fixed;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
width: 100%;
|
||||
border-bottom: 1px solid rgba(0,0,0,0.33);
|
||||
text-align: center;
|
||||
/*opacity: 0.2;*/
|
||||
}
|
||||
/*
|
||||
div#header:hover {
|
||||
opacity: 1.0;
|
||||
}
|
||||
*/
|
||||
ul#enablers {
|
||||
display: inline-block;
|
||||
margin: 1px 15px 0 15px;
|
||||
padding: 2px 0 2px 0;
|
||||
}
|
||||
|
||||
ul#enablers li {
|
||||
display: inline;
|
||||
padding: 0px 5px 0px 5px;
|
||||
margin-left: 4px;
|
||||
-moz-border-radius: 5px;
|
||||
-webkit-border-radius: 5px;
|
||||
}
|
||||
|
||||
[enabled="no"] {
|
||||
opacity: 0.25;
|
||||
}
|
||||
|
||||
ul#options {
|
||||
display: inline-block;
|
||||
margin: 0 15px 0px 15px;
|
||||
padding: 0 0px;
|
||||
}
|
||||
|
||||
ul#options li {
|
||||
margin: 0 0 0 0;
|
||||
padding: 0 0 0 0;
|
||||
display: inline;
|
||||
}
|
||||
+55
-90
@@ -114,81 +114,6 @@ var _CPFormatLogMessage = function(aString, aLevel, aTitle)
|
||||
|
||||
// Loggers:
|
||||
|
||||
var ANSI_ESC = String.fromCharCode(0x1B);
|
||||
var ANSI_CSI = ANSI_ESC + '[';
|
||||
var ANSI_TEXT_PROP = 'm';
|
||||
var ANSI_RESET = '0';
|
||||
var ANSI_BOLD = '1';
|
||||
var ANSI_FAINT = '2'; // unsupported?
|
||||
var ANSI_NORMAL = '22';
|
||||
var ANSI_ITALIC = '3'; // unsupported?
|
||||
var ANSI_UNDER = '4';
|
||||
var ANSI_UNDER_DBL = '21'; // unsupported?
|
||||
var ANSI_UNDER_OFF = '24';
|
||||
var ANSI_BLINK = '5';
|
||||
var ANSI_BLINK_FAST = '6'; // unsupported?
|
||||
var ANSI_BLINK_OFF = '25';
|
||||
var ANSI_REVERSE = '7';
|
||||
var ANSI_POSITIVE = '27';
|
||||
var ANSI_CONCEAL = '8';
|
||||
var ANSI_REVEAL = '28';
|
||||
var ANSI_FG = '3';
|
||||
var ANSI_BG = '4';
|
||||
var ANSI_FG_INTENSE = '9';
|
||||
var ANSI_BG_INTENSE = '10';
|
||||
var ANSI_BLACK = '0';
|
||||
var ANSI_RED = '1';
|
||||
var ANSI_GREEN = '2';
|
||||
var ANSI_YELLOW = '3';
|
||||
var ANSI_BLUE = '4';
|
||||
var ANSI_MAGENTA = '5';
|
||||
var ANSI_CYAN = '6';
|
||||
var ANSI_WHITE = '7';
|
||||
|
||||
var colorCodeMap = {
|
||||
"black" : ANSI_BLACK,
|
||||
"red" : ANSI_RED,
|
||||
"green" : ANSI_GREEN,
|
||||
"yellow" : ANSI_YELLOW,
|
||||
"blue" : ANSI_BLUE,
|
||||
"magenta" : ANSI_MAGENTA,
|
||||
"cyan" : ANSI_CYAN,
|
||||
"white" : ANSI_WHITE
|
||||
}
|
||||
|
||||
function ANSIControlCode(code, parameters)
|
||||
{
|
||||
if (parameters == undefined)
|
||||
parameters = "";
|
||||
else if (typeof(parameters) == 'object' && (parameters instanceof Array))
|
||||
parameters = parameters.join(';');
|
||||
return ANSI_CSI + String(parameters) + String(code);
|
||||
}
|
||||
|
||||
// simple text helpers:
|
||||
|
||||
function ANSITextApplyProperties(string, properties)
|
||||
{
|
||||
return ANSIControlCode(ANSI_TEXT_PROP, properties) + String(string) + ANSIControlCode(ANSI_TEXT_PROP);
|
||||
}
|
||||
|
||||
GLOBAL(ANSITextColorize) = function(string, color)
|
||||
{
|
||||
if (colorCodeMap[color] == undefined)
|
||||
return string;
|
||||
return ANSITextApplyProperties(string, ANSI_FG + colorCodeMap[color]);
|
||||
}
|
||||
|
||||
// CPLogPrint uses the print() functions present in many non-browser command line JavaScript interpreters
|
||||
var levelColorMap = {
|
||||
"fatal": "red",
|
||||
"error": "red",
|
||||
"warn" : "yellow",
|
||||
"info" : "green",
|
||||
"debug": "cyan",
|
||||
"trace": "blue"
|
||||
}
|
||||
|
||||
// CPLogConsole uses the built in "console" object
|
||||
GLOBAL(CPLogConsole) = function(aString, aLevel, aTitle)
|
||||
{
|
||||
@@ -213,18 +138,46 @@ GLOBAL(CPLogConsole) = function(aString, aLevel, aTitle)
|
||||
}
|
||||
|
||||
#if COMMONJS
|
||||
|
||||
var levelColorMap = {
|
||||
"fatal": "red",
|
||||
"error": "red",
|
||||
"warn" : "yellow",
|
||||
"info" : "green",
|
||||
"debug": "cyan",
|
||||
"trace": "blue"
|
||||
}
|
||||
|
||||
try {
|
||||
var SYSTEM = require("system");
|
||||
var FILE = require("file");
|
||||
if (SYSTEM.args[0])
|
||||
CPLogDefaultTitle = FILE.basename(SYSTEM.args[0]);
|
||||
} catch (e) {
|
||||
}
|
||||
|
||||
var stream;
|
||||
|
||||
GLOBAL(CPLogPrint) = function(aString, aLevel, aTitle)
|
||||
{
|
||||
if (typeof print != "undefined")
|
||||
{
|
||||
if (aLevel == "fatal" || aLevel == "error" || aLevel == "warn")
|
||||
var message = ANSITextColorize(_CPFormatLogMessage(aString, aLevel, aTitle), levelColorMap[aLevel]);
|
||||
else
|
||||
var message = _CPFormatLogMessage(aString, ANSITextColorize(aLevel, levelColorMap[aLevel]), aTitle);
|
||||
if (stream === undefined) {
|
||||
try {
|
||||
stream = require("term").stream;
|
||||
} catch (e) {
|
||||
stream = null;
|
||||
}
|
||||
}
|
||||
|
||||
require("system").stderr.print(message);
|
||||
if (stream) {
|
||||
if (aLevel == "fatal" || aLevel == "error" || aLevel == "warn")
|
||||
stream.print("\0"+levelColorMap[aLevel]+"(" + _CPFormatLogMessage(aString, aLevel, aTitle) + "\0)");
|
||||
else
|
||||
stream.print(_CPFormatLogMessage(aString, "\0"+levelColorMap[aLevel]+"(" + aLevel + "\0)", aTitle));
|
||||
} else if (typeof print != "undefined") {
|
||||
print(_CPFormatLogMessage(aString, aLevel, aTitle))
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
// CPLogAlert uses basic browser alert() functions
|
||||
@@ -276,12 +229,31 @@ GLOBAL(CPLogPopup) = function(aString, aLevel, aTitle)
|
||||
}
|
||||
}
|
||||
|
||||
var CPLogPopupStyle ='<style type="text/css" media="screen"> \
|
||||
body{font:10px Monaco,Courier,"Courier New",monospace,mono;padding-top:15px;} \
|
||||
div > .fatal,div > .error,div > .warn,div > .info,div > .debug,div > .trace{display:none;overflow:hidden;white-space:pre;padding:0px 5px 0px 5px;margin-top:2px;-moz-border-radius:5px;-webkit-border-radius:5px;} \
|
||||
div[wrap="yes"] > div{white-space:normal;} \
|
||||
.fatal{background-color:#ffb2b3;} \
|
||||
.error{background-color:#ffe2b2;} \
|
||||
.warn{background-color:#fdffb2;} \
|
||||
.info{background-color:#e4ffb2;} \
|
||||
.debug{background-color:#a0e5a0;} \
|
||||
.trace{background-color:#99b9ff;} \
|
||||
.enfatal .fatal,.enerror .error,.enwarn .warn,.eninfo .info,.endebug .debug,.entrace .trace{display:block;} \
|
||||
div#header{background-color:rgba(240,240,240,0.82);position:fixed;top:0px;left:0px;width:100%;border-bottom:1px solid rgba(0,0,0,0.33);text-align:center;} \
|
||||
ul#enablers{display:inline-block;margin:1px 15px 0 15px;padding:2px 0 2px 0;} \
|
||||
ul#enablers li{display:inline;padding:0px 5px 0px 5px;margin-left:4px;-moz-border-radius:5px;-webkit-border-radius:5px;} \
|
||||
[enabled="no"]{opacity:0.25;} \
|
||||
ul#options{display:inline-block;margin:0 15px 0px 15px;padding:0 0px;} \
|
||||
ul#options li{margin:0 0 0 0;padding:0 0 0 0;display:inline;} \
|
||||
</style>';
|
||||
|
||||
function _CPLogInitPopup(logWindow)
|
||||
{
|
||||
var doc = logWindow.document;
|
||||
|
||||
// HACK so that head is available below:
|
||||
doc.writeln("<html><head><title></title></head><body></body></html>");
|
||||
doc.writeln("<html><head><title></title>"+CPLogPopupStyle+"</head><body></body></html>");
|
||||
|
||||
doc.title = CPLogDefaultTitle + " Run Log";
|
||||
|
||||
@@ -291,13 +263,6 @@ function _CPLogInitPopup(logWindow)
|
||||
var base = window.location.protocol + "//" + window.location.host + window.location.pathname;
|
||||
base = base.substring(0,base.lastIndexOf("/")+1);
|
||||
|
||||
var link = doc.createElement("link");
|
||||
link.setAttribute("type", "text/css");
|
||||
link.setAttribute("rel", "stylesheet");
|
||||
link.setAttribute("href", base+"Frameworks/Foundation/Resources/log.css");
|
||||
link.setAttribute("media", "screen");
|
||||
head.appendChild(link);
|
||||
|
||||
var div = doc.createElement("div");
|
||||
div.setAttribute("id", "header");
|
||||
body.appendChild(div);
|
||||
|
||||
Reference in New Issue
Block a user