This commit is contained in:
Namhyeon Go 2020-06-28 23:38:30 +09:00
parent 8edc8ea856
commit d7bdf7bb89
4 changed files with 30 additions and 16 deletions

View File

@ -46,11 +46,11 @@
</style> </style>
</head> </head>
<body> <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" src="app.js"></script>
<script type="text/javascript"> <script type="text/javascript">
window.resizeTo(400, 300); window.resizeTo(400, 300);
init_window("app/index"); init_window("webloader");
</script> </script>
</body> </body>
</html> </html>

1
app/app.html Normal file
View File

@ -0,0 +1 @@
<h1>It works!</h1>

View File

@ -3,7 +3,7 @@
// file-lib.js // file-lib.js
// //
// Common routines. Defines LIB object which contains the API, as well as // 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) { module.fileExists = function(FN) {
var FSO = module.CreateObject("Scripting.FileSystemObject"); var FSO = CreateObject("Scripting.FileSystemObject");
var exists = FSO.FileExists(FN); var exists = FSO.FileExists(FN);
FSO = null; FSO = null;
return exists; return exists;
@ -32,7 +32,7 @@ module.fileExists = function(FN) {
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
module.folderExists = function(FN) { module.folderExists = function(FN) {
var FSO = module.CreateObject("Scripting.FileSystemObject"); var FSO = CreateObject("Scripting.FileSystemObject");
var exists = FSO.FolderExists(FN); var exists = FSO.FolderExists(FN);
FSO = null; FSO = null;
return exists; return exists;
@ -43,7 +43,7 @@ module.folderExists = function(FN) {
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
module.fileGet = function(FN) { module.fileGet = function(FN) {
var FSO = module.CreateObject("Scripting.FileSystemObject"); var FSO = CreateObject("Scripting.FileSystemObject");
var file = FSO.GetFile(FN); var file = FSO.GetFile(FN);
FSO = null; FSO = null;
return file; return file;
@ -55,7 +55,7 @@ module.fileGet = function(FN) {
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
module.readFile = function(FN) { module.readFile = function(FN) {
var FSO = module.CreateObject("Scripting.FileSystemObject"); var FSO = CreateObject("Scripting.FileSystemObject");
var T = null; var T = null;
try { try {
var TS = FSO.OpenTextFile(FN,1); var TS = FSO.OpenTextFile(FN,1);
@ -64,7 +64,7 @@ module.readFile = function(FN) {
TS.Close(); TS.Close();
TS = null; TS = null;
} catch(e) { } catch(e) {
DBG("ERROR! " + e.number + ", " + e.description + ", FN=" + FN); console.log("ERROR! " + e.number + ", " + e.description + ", FN=" + FN);
} }
FSO = null; FSO = null;
return T; return T;
@ -78,9 +78,9 @@ module.readFile = function(FN) {
module.writeFile = function(FN, content, charset) { module.writeFile = function(FN, content, charset) {
var ok; var ok;
if (charset) { if (charset) {
DBG("WRITE TO DISK USING ADODB.Stream CHARSET " + charset); console.log("WRITE TO DISK USING ADODB.Stream CHARSET " + charset);
try { try {
var fsT = module.CreateObject("ADODB.Stream"); var fsT = CreateObject("ADODB.Stream");
fsT.Type = 2; // save as text/string data. fsT.Type = 2; // save as text/string data.
fsT.Charset = charset; // Specify charset For the source text data. fsT.Charset = charset; // Specify charset For the source text data.
fsT.Open(); fsT.Open();
@ -88,11 +88,11 @@ module.writeFile = function(FN, content, charset) {
fsT.SaveToFile(FN, 2); // save as binary to disk fsT.SaveToFile(FN, 2); // save as binary to disk
ok = true; ok = true;
} catch(e) { } catch(e) {
DBG("ADODB.Stream: ERROR! " + e.number + ", " + e.description + ", FN=" + FN); console.log("ADODB.Stream: ERROR! " + e.number + ", " + e.description + ", FN=" + FN);
} }
} else { } else {
DBG("WRITE TO DISK USING OpenTextFile CHARSET ascii"); console.log("WRITE TO DISK USING OpenTextFile CHARSET ascii");
var FSO = module.CreateObject("Scripting.FileSystemObject"); var FSO = CreateObject("Scripting.FileSystemObject");
try { try {
var TS = FSO.OpenTextFile(FN,2,true,0); // ascii var TS = FSO.OpenTextFile(FN,2,true,0); // ascii
TS.Write(content); TS.Write(content);
@ -100,7 +100,7 @@ module.writeFile = function(FN, content, charset) {
TS = null; TS = null;
ok = true; ok = true;
} catch(e) { } catch(e) {
DBG("OpenTextFile: ERROR! " + e.number + ", " + e.description + ", FN=" + FN); console.log("OpenTextFile: ERROR! " + e.number + ", " + e.description + ", FN=" + FN);
} }
FSO = null; FSO = null;
} }
@ -112,7 +112,7 @@ module.writeFile = function(FN, content, charset) {
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
module.moveFile = function(FROM, TO) { module.moveFile = function(FROM, TO) {
var FSO = module.CreateObject("Scripting.FileSystemObject"); var FSO = CreateObject("Scripting.FileSystemObject");
var res = FSO.MoveFile(FROM, TO); var res = FSO.MoveFile(FROM, TO);
FSO = null; FSO = null;
return res; return res;
@ -123,7 +123,7 @@ module.moveFile = function(FROM, TO) {
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
module.createFolder = function(FN) { module.createFolder = function(FN) {
var FSO = module.CreateObject("Scripting.FileSystemObject"); var FSO = CreateObject("Scripting.FileSystemObject");
var res = FSO.CreateFolder(FN); var res = FSO.CreateFolder(FN);
FSO = null; FSO = null;
return res; return res;

13
webloader.js Normal file
View 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;
}
}