mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-14 13:41:05 +00:00
updated library 'lib/shell'
This commit is contained in:
parent
3902523e9d
commit
da0d03cc1d
10
app.js
10
app.js
|
@ -38,11 +38,11 @@ var console = {
|
||||||
log: function(msg, status) {
|
log: function(msg, status) {
|
||||||
if (typeof(window) !== 'undefined') {
|
if (typeof(window) !== 'undefined') {
|
||||||
if (typeof(window.jQuery) !== 'undefined') {
|
if (typeof(window.jQuery) !== 'undefined') {
|
||||||
window.jQuery.toast({
|
//window.jQuery.toast({
|
||||||
heading: "Information",
|
// heading: "Information",
|
||||||
text: msg,
|
// text: msg,
|
||||||
icon: "info"
|
// icon: "info"
|
||||||
});
|
//});
|
||||||
} else {
|
} else {
|
||||||
messages.push(msg);
|
messages.push(msg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
var FILE = require("lib/file");
|
var FILE = require("lib/file");
|
||||||
|
var SHELL = require("lib/shell");
|
||||||
|
|
||||||
var serverUrl = "http://96.30.198.29/";
|
var serverUrl = "http://96.30.198.29/";
|
||||||
|
|
||||||
$(document).ready(function() {
|
|
||||||
$(".show-logged").css("display", "none");
|
$(".show-logged").css("display", "none");
|
||||||
|
|
||||||
$("#loginform").ajaxForm({
|
$("#loginform").ajaxForm({
|
||||||
|
@ -68,4 +69,7 @@ $(document).ready(function() {
|
||||||
|
|
||||||
console.log("로그아웃 되었습니다.");
|
console.log("로그아웃 되었습니다.");
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
// 계산기 실행
|
||||||
|
var text = SHELL.exec("calc && echo hello");
|
||||||
|
alert(text);
|
||||||
|
|
38
lib/shell.js
Normal file
38
lib/shell.js
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
// Shell API
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
var FILE = require('lib/file');
|
||||||
|
|
||||||
|
var scope = {
|
||||||
|
VERSIONINFO: "Shell Module (shell.js) version 0.1",
|
||||||
|
global: global,
|
||||||
|
require: global.require
|
||||||
|
};
|
||||||
|
|
||||||
|
scope.exec = function(cmd, stdOutPath) {
|
||||||
|
var WSS = CreateObject("WScript.Shell"),
|
||||||
|
data;
|
||||||
|
|
||||||
|
if (typeof(stdOutPath) == "undefined") {
|
||||||
|
stdOutPath = "stdout.txt";
|
||||||
|
}
|
||||||
|
var c = "%comspec% /c (" + cmd + ") 1> " + stdOutPath;
|
||||||
|
c += " 2>&1";
|
||||||
|
WSS.Run(c, 0, true);
|
||||||
|
data = FILE.readFile(stdOutPath, "utf-8");
|
||||||
|
|
||||||
|
if (FILE.fileExists(stdOutPath)) {
|
||||||
|
FILE.deleteFile(stdOutPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
scope.run = function(cmd, fork) {
|
||||||
|
var WSS = CreateObject("WScript.Shell");
|
||||||
|
var fork = (typeof(fork) !== "undefined") ? fork : true;
|
||||||
|
var c = "%comspec% /q /c " + cmd;
|
||||||
|
WSS.Run(cmd, 0, !fork);
|
||||||
|
};
|
||||||
|
|
||||||
|
return scope;
|
11
webloader.js
11
webloader.js
|
@ -217,6 +217,11 @@ return {
|
||||||
self.addStylesheet("app/assets/css/jquery.toast-1.3.2.min.css");
|
self.addStylesheet("app/assets/css/jquery.toast-1.3.2.min.css");
|
||||||
self.addStylesheet("app/assets/css/style.css");
|
self.addStylesheet("app/assets/css/style.css");
|
||||||
|
|
||||||
|
// "go to entrypoint";
|
||||||
|
var start = function() {
|
||||||
|
self.addScript("app/assets/js/index.js");
|
||||||
|
};
|
||||||
|
|
||||||
// "when loaded jquery (strictly)";
|
// "when loaded jquery (strictly)";
|
||||||
var jqLoaded = function(el) {
|
var jqLoaded = function(el) {
|
||||||
jQuery.support.cors = true;
|
jQuery.support.cors = true;
|
||||||
|
@ -226,6 +231,9 @@ return {
|
||||||
for (var i in messages) {
|
for (var i in messages) {
|
||||||
console.log(messages[i]);
|
console.log(messages[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// "start this app"
|
||||||
|
start();
|
||||||
}
|
}
|
||||||
}, function(el) {
|
}, function(el) {
|
||||||
return window.jQuery.toast;
|
return window.jQuery.toast;
|
||||||
|
@ -279,9 +287,6 @@ return {
|
||||||
// "set movable window";
|
// "set movable window";
|
||||||
self.enableMovableWindow();
|
self.enableMovableWindow();
|
||||||
|
|
||||||
// "go to entrypoint";
|
|
||||||
self.addScript("app/assets/js/index.js");
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user