mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-12 04:31:04 +00:00
fix
This commit is contained in:
parent
50c29aec32
commit
1dd049f015
11
app.js
11
app.js
|
@ -42,8 +42,17 @@ var exit = function(status) {
|
|||
|
||||
var console = {
|
||||
_messages: [],
|
||||
_join: function(args, sep) {
|
||||
args = args || [];
|
||||
sep = sep || ' ';
|
||||
var res = '';
|
||||
for (var i = args.length - 1; i > -1; i--) {
|
||||
res = (i ? sep : '') + args[i] + res;
|
||||
}
|
||||
return res;
|
||||
},
|
||||
_echo: function(args, type) {
|
||||
msg = (typeof(type) !== "undefined" ? type + ": " : "") + args[0];
|
||||
msg = (typeof(type) !== "undefined" ? type + ": " : "") + this._join(args);
|
||||
if (typeof(WScript) !== "undefined") {
|
||||
WScript.echo(" * " + msg);
|
||||
}
|
||||
|
|
20
lib/file.js
20
lib/file.js
|
@ -40,7 +40,7 @@ var readFile = function(FN, charset) {
|
|||
fsT = null;
|
||||
return T;
|
||||
} catch (e) {
|
||||
console.error("readFile -> " + e.message);
|
||||
console.error("readFile -> ", e.message);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -136,7 +136,7 @@ var FileObject = function() {
|
|||
this.isDirectory = true;
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("FileObject.exists() -> " + e.message);
|
||||
console.error("FileObject.exists() -> ", e.message);
|
||||
}
|
||||
return this.isExists;
|
||||
};
|
||||
|
@ -150,10 +150,14 @@ var FileObject = function() {
|
|||
};
|
||||
|
||||
this.getDetails = function() {
|
||||
if (this.isFile) {
|
||||
return this.interface.GetFile(this.filename);
|
||||
} else if (this.isDirectory) {
|
||||
return this.interface.GetFolder(this.filename);
|
||||
try {
|
||||
if (this.isFile) {
|
||||
return this.interface.GetFile(this.filename);
|
||||
} else if (this.isDirectory) {
|
||||
return this.interface.GetFolder(this.filename);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("FileObject.getDetails() -> ", e.message);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -211,7 +215,9 @@ var FileObject = function() {
|
|||
};
|
||||
|
||||
this.mkdir = function() {
|
||||
return this.interface.CreateFolder(this.filename);
|
||||
if (this.isDirectory) {
|
||||
return this.interface.CreateFolder(this.filename);
|
||||
}
|
||||
};
|
||||
|
||||
this.close = function() {
|
||||
|
|
27
webloader.js
27
webloader.js
|
@ -8,8 +8,8 @@ var OldBrowser = require("lib/oldbrowser");
|
|||
////////////////////////////////////////////////////////////////////////
|
||||
// Override global.console._echo()
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
global.console._echo = function(msg, type) {
|
||||
var heading, icon;
|
||||
global.console._echo = function(args, type) {
|
||||
var heading, icon, msg = this._join(args);
|
||||
|
||||
switch(type) {
|
||||
case "error":
|
||||
|
@ -29,19 +29,24 @@ global.console._echo = function(msg, type) {
|
|||
default:
|
||||
heading = "Success";
|
||||
icon = "success";
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof(window.jQuery) !== "undefined") {
|
||||
window.jQuery.toast({
|
||||
heading: heading,
|
||||
text: msg,
|
||||
icon: icon
|
||||
});
|
||||
} else {
|
||||
window.alert(msg);
|
||||
try {
|
||||
if (typeof(window.jQuery.toast) !== "undefined") {
|
||||
window.jQuery.toast({
|
||||
heading: heading,
|
||||
text: msg,
|
||||
icon: icon
|
||||
});
|
||||
} else {
|
||||
window.alert(msg);
|
||||
}
|
||||
} catch (e) {
|
||||
window.alert(e.message);
|
||||
}
|
||||
|
||||
global.console._messages.push(msg);
|
||||
this._messages.push(msg);
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Reference in New Issue
Block a user