mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-09 13:16:05 +00:00
fix indentation
This commit is contained in:
parent
23b8eb233e
commit
736955fe35
74
app.js
74
app.js
|
@ -151,8 +151,8 @@ if (typeof(CreateObject) !== "function") {
|
||||||
* @FN {string} The name of the file.
|
* @FN {string} The name of the file.
|
||||||
*/
|
*/
|
||||||
function include(FN) {
|
function include(FN) {
|
||||||
if (FN.substr(FN.length - 3) !== '.js') FN += ".js";
|
if (FN.substr(FN.length - 3) !== '.js') FN += ".js";
|
||||||
return eval(require.__load__(FN));
|
return eval(require.__load__(FN));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -163,11 +163,11 @@ function require(FN) {
|
||||||
|
|
||||||
if (FN.substr(FN.length - 3) !== '.js') FN += ".js";
|
if (FN.substr(FN.length - 3) !== '.js') FN += ".js";
|
||||||
if (cache[FN]) return cache[FN];
|
if (cache[FN]) return cache[FN];
|
||||||
|
|
||||||
// get file and directory name
|
// get file and directory name
|
||||||
var __filename__ = require.__getCurrentScriptDirectory__() + "\\" + FN;
|
var __filename__ = require.__getCurrentScriptDirectory__() + "\\" + FN;
|
||||||
var __dirname__ = require.__getDirName__(__filename__);
|
var __dirname__ = require.__getDirName__(__filename__);
|
||||||
var T = require.__load__(FN);
|
var T = require.__load__(FN);
|
||||||
|
|
||||||
// build
|
// build
|
||||||
T = "(function(global){var module=new require.__ModuleObject__();return(function(exports,require,module,__filename,__dirname){"
|
T = "(function(global){var module=new require.__ModuleObject__();return(function(exports,require,module,__filename,__dirname){"
|
||||||
|
@ -175,14 +175,14 @@ function require(FN) {
|
||||||
+ T
|
+ T
|
||||||
+ "\n\nreturn module.exports})(module.exports,global.require,module,__filename__,__dirname__)})(require.__global__);\n\n////@ sourceURL="
|
+ "\n\nreturn module.exports})(module.exports,global.require,module,__filename__,__dirname__)})(require.__global__);\n\n////@ sourceURL="
|
||||||
+ FN
|
+ FN
|
||||||
;
|
;
|
||||||
|
|
||||||
// execute
|
// execute
|
||||||
try {
|
try {
|
||||||
cache[FN] = eval(T);
|
cache[FN] = eval(T);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("PARSE ERROR!", e.number, ",", e.description, ", FN=", FN);
|
console.error("PARSE ERROR!", e.number, ",", e.description, ", FN=", FN);
|
||||||
}
|
}
|
||||||
|
|
||||||
// print VERSIONINFO
|
// print VERSIONINFO
|
||||||
if (typeof(cache[FN]) === "object") {
|
if (typeof(cache[FN]) === "object") {
|
||||||
|
@ -196,39 +196,39 @@ require.__ModuleObject__ = function() {
|
||||||
this.exports = {};
|
this.exports = {};
|
||||||
};
|
};
|
||||||
require.__getDirName__ = function(path) {
|
require.__getDirName__ = function(path) {
|
||||||
var delimiter = "\\";
|
var delimiter = "\\";
|
||||||
var pos = path.lastIndexOf(delimiter);
|
var pos = path.lastIndexOf(delimiter);
|
||||||
return (pos > -1 ? path.substring(0, pos) : "");
|
return (pos > -1 ? path.substring(0, pos) : "");
|
||||||
};
|
};
|
||||||
require.__getCurrentScriptDirectory__ = function() {
|
require.__getCurrentScriptDirectory__ = function() {
|
||||||
if (typeof(WScript) !== "undefined") {
|
if (typeof(WScript) !== "undefined") {
|
||||||
return require.__getDirName__(WScript.ScriptFullName);
|
return require.__getDirName__(WScript.ScriptFullName);
|
||||||
} else if (typeof(document) !== "undefined") {
|
} else if (typeof(document) !== "undefined") {
|
||||||
return require.__getDirName__(document.location.pathname);
|
return require.__getDirName__(document.location.pathname);
|
||||||
} else {
|
} else {
|
||||||
return ".";
|
return ".";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
require.__load__ = function(FN) {
|
require.__load__ = function(FN) {
|
||||||
// get filename
|
// get filename
|
||||||
var __filename__ = require.__getCurrentScriptDirectory__() + "\\" + FN;
|
var __filename__ = require.__getCurrentScriptDirectory__() + "\\" + FN;
|
||||||
|
|
||||||
// load script file
|
// load script file
|
||||||
// use ADODB.Stream instead of Scripting.FileSystemObject, because of UTF-8 (unicode)
|
// use ADODB.Stream instead of Scripting.FileSystemObject, because of UTF-8 (unicode)
|
||||||
var objStream = CreateObject("ADODB.Stream");
|
var objStream = CreateObject("ADODB.Stream");
|
||||||
var T = null;
|
var T = null;
|
||||||
try {
|
try {
|
||||||
objStream.charSet = "utf-8";
|
objStream.charSet = "utf-8";
|
||||||
objStream.open();
|
objStream.open();
|
||||||
objStream.loadFromFile(__filename__);
|
objStream.loadFromFile(__filename__);
|
||||||
T = objStream.readText();
|
T = objStream.readText();
|
||||||
objStream.close();
|
objStream.close();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("LOAD ERROR! ", e.number, ", ", e.description, ", FN=", FN);
|
console.error("LOAD ERROR! ", e.number, ", ", e.description, ", FN=", FN);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
return T;
|
return T;
|
||||||
};
|
};
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
Loading…
Reference in New Issue
Block a user