mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-02-06 15:04:58 +00:00
updated
This commit is contained in:
parent
8edc8ea856
commit
d7bdf7bb89
4
app.hta
4
app.hta
|
@ -46,11 +46,11 @@
|
|||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<p><a id="click1" href="#click1">Hello world!</a></p>
|
||||
<div id="app"></div>
|
||||
<script type="text/javascript" src="app.js"></script>
|
||||
<script type="text/javascript">
|
||||
window.resizeTo(400, 300);
|
||||
init_window("app/index");
|
||||
init_window("webloader");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
1
app/app.html
Normal file
1
app/app.html
Normal file
|
@ -0,0 +1 @@
|
|||
<h1>It works!</h1>
|
28
lib/file.js
28
lib/file.js
|
@ -3,7 +3,7 @@
|
|||
// file-lib.js
|
||||
//
|
||||
// Common routines. Defines LIB object which contains the API, as well as
|
||||
// a global DBG function.
|
||||
// a global console.log function.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -21,7 +21,7 @@ module.VERSIONINFO = "File Lib (file-libs.js) version 0.1";
|
|||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
module.fileExists = function(FN) {
|
||||
var FSO = module.CreateObject("Scripting.FileSystemObject");
|
||||
var FSO = CreateObject("Scripting.FileSystemObject");
|
||||
var exists = FSO.FileExists(FN);
|
||||
FSO = null;
|
||||
return exists;
|
||||
|
@ -32,7 +32,7 @@ module.fileExists = function(FN) {
|
|||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
module.folderExists = function(FN) {
|
||||
var FSO = module.CreateObject("Scripting.FileSystemObject");
|
||||
var FSO = CreateObject("Scripting.FileSystemObject");
|
||||
var exists = FSO.FolderExists(FN);
|
||||
FSO = null;
|
||||
return exists;
|
||||
|
@ -43,7 +43,7 @@ module.folderExists = function(FN) {
|
|||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
module.fileGet = function(FN) {
|
||||
var FSO = module.CreateObject("Scripting.FileSystemObject");
|
||||
var FSO = CreateObject("Scripting.FileSystemObject");
|
||||
var file = FSO.GetFile(FN);
|
||||
FSO = null;
|
||||
return file;
|
||||
|
@ -55,7 +55,7 @@ module.fileGet = function(FN) {
|
|||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
module.readFile = function(FN) {
|
||||
var FSO = module.CreateObject("Scripting.FileSystemObject");
|
||||
var FSO = CreateObject("Scripting.FileSystemObject");
|
||||
var T = null;
|
||||
try {
|
||||
var TS = FSO.OpenTextFile(FN,1);
|
||||
|
@ -64,7 +64,7 @@ module.readFile = function(FN) {
|
|||
TS.Close();
|
||||
TS = null;
|
||||
} catch(e) {
|
||||
DBG("ERROR! " + e.number + ", " + e.description + ", FN=" + FN);
|
||||
console.log("ERROR! " + e.number + ", " + e.description + ", FN=" + FN);
|
||||
}
|
||||
FSO = null;
|
||||
return T;
|
||||
|
@ -78,9 +78,9 @@ module.readFile = function(FN) {
|
|||
module.writeFile = function(FN, content, charset) {
|
||||
var ok;
|
||||
if (charset) {
|
||||
DBG("WRITE TO DISK USING ADODB.Stream CHARSET " + charset);
|
||||
console.log("WRITE TO DISK USING ADODB.Stream CHARSET " + charset);
|
||||
try {
|
||||
var fsT = module.CreateObject("ADODB.Stream");
|
||||
var fsT = CreateObject("ADODB.Stream");
|
||||
fsT.Type = 2; // save as text/string data.
|
||||
fsT.Charset = charset; // Specify charset For the source text data.
|
||||
fsT.Open();
|
||||
|
@ -88,11 +88,11 @@ module.writeFile = function(FN, content, charset) {
|
|||
fsT.SaveToFile(FN, 2); // save as binary to disk
|
||||
ok = true;
|
||||
} catch(e) {
|
||||
DBG("ADODB.Stream: ERROR! " + e.number + ", " + e.description + ", FN=" + FN);
|
||||
console.log("ADODB.Stream: ERROR! " + e.number + ", " + e.description + ", FN=" + FN);
|
||||
}
|
||||
} else {
|
||||
DBG("WRITE TO DISK USING OpenTextFile CHARSET ascii");
|
||||
var FSO = module.CreateObject("Scripting.FileSystemObject");
|
||||
console.log("WRITE TO DISK USING OpenTextFile CHARSET ascii");
|
||||
var FSO = CreateObject("Scripting.FileSystemObject");
|
||||
try {
|
||||
var TS = FSO.OpenTextFile(FN,2,true,0); // ascii
|
||||
TS.Write(content);
|
||||
|
@ -100,7 +100,7 @@ module.writeFile = function(FN, content, charset) {
|
|||
TS = null;
|
||||
ok = true;
|
||||
} catch(e) {
|
||||
DBG("OpenTextFile: ERROR! " + e.number + ", " + e.description + ", FN=" + FN);
|
||||
console.log("OpenTextFile: ERROR! " + e.number + ", " + e.description + ", FN=" + FN);
|
||||
}
|
||||
FSO = null;
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ module.writeFile = function(FN, content, charset) {
|
|||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
module.moveFile = function(FROM, TO) {
|
||||
var FSO = module.CreateObject("Scripting.FileSystemObject");
|
||||
var FSO = CreateObject("Scripting.FileSystemObject");
|
||||
var res = FSO.MoveFile(FROM, TO);
|
||||
FSO = null;
|
||||
return res;
|
||||
|
@ -123,7 +123,7 @@ module.moveFile = function(FROM, TO) {
|
|||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
module.createFolder = function(FN) {
|
||||
var FSO = module.CreateObject("Scripting.FileSystemObject");
|
||||
var FSO = CreateObject("Scripting.FileSystemObject");
|
||||
var res = FSO.CreateFolder(FN);
|
||||
FSO = null;
|
||||
return res;
|
||||
|
|
13
webloader.js
Normal file
13
webloader.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
/*
|
||||
* webloader.js
|
||||
*/
|
||||
|
||||
var FILE = require('lib/file');
|
||||
|
||||
return {
|
||||
main: function() {
|
||||
var contents = FILE.readFile("app\\app.html");
|
||||
document.getElementById("app").innerHTML = contents;
|
||||
return 0;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user