diff --git a/app.js b/app.js index 5557be0..01275ce 100644 --- a/app.js +++ b/app.js @@ -36,38 +36,32 @@ var exit = function(status) { if (typeof(WScript) !== "undefined") { WScript.quit(status); } - console.warn("Exit caused by: " + status); + console.warn("Exit caused: " + status); }; var console = { _messages: [], - _echo: function(msg) { + _echo: function(msg, type) { + msg = (typeof(type) !== "undefined" ? type + ": " : "") + msg; if (typeof(WScript) !== "undefined") { WScript.echo(msg); - } else if (typeof(window) !== "undefined") { - //window.alert(msg); } - this._messages.push(msg); }, log: function(msg) { this._echo(msg); }, error: function(msg) { - var msg = "[ERROR] " + msg; - this._echo(msg); + this._echo(msg, "error"); }, info: function(msg) { - var msg = "[INFO] " + msg; - this._echo(msg); + this._echo(msg, "info"); }, warn: function(msg) { - var msg = "[WARN] " + msg; - this._echo(msg); + this._echo(msg, "warn"); }, debug: function(msg) { - var msg = "[DEBUG] " + msg; - this._echo(msg); + this._echo(msg, "debug"); } }; diff --git a/webloader.js b/webloader.js index 84c142c..c3dacfc 100644 --- a/webloader.js +++ b/webloader.js @@ -7,12 +7,34 @@ var OldBrowser = require("lib/oldbrowser"); //////////////////////////////////////////////////////////////////////// // Override global.console._echo() //////////////////////////////////////////////////////////////////////// -global.console._echo = function(msg) { +global.console._echo = function(msg, type) { + var heading, icon; + + switch(type) { + case "error": + heading = "Error"; + icon = "error"; + break; + + case "warning": + heading = "Warning"; + icon = "warning"; + break; + + case "info": + heading = "Information"; + icon = "info"; + + default: + heading = "Message"; + icon = "success"; + } + if (typeof(window.jQuery) !== "undefined") { window.jQuery.toast({ - heading: "Information", + heading: heading, text: msg, - icon: "info" + icon: icon }); } else { window.alert(msg);