2020-07-27 02:31:52 +00:00
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
// Webloader
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
2020-07-23 08:10:52 +00:00
|
|
|
var FILE = require("lib/file");
|
2023-12-22 20:13:25 +00:00
|
|
|
var Browser = require("lib/browser");
|
2020-06-28 14:38:30 +00:00
|
|
|
|
2020-07-27 02:31:52 +00:00
|
|
|
////////////////////////////////////////////////////////////////////////
|
2020-11-04 07:41:56 +00:00
|
|
|
// Override global.console._echo()
|
2020-07-27 02:31:52 +00:00
|
|
|
////////////////////////////////////////////////////////////////////////
|
2020-11-25 03:16:42 +00:00
|
|
|
global.console._echo = function(args, type) {
|
2022-11-28 17:49:58 +00:00
|
|
|
var heading, icon, message = this._join(args);
|
|
|
|
var params = {
|
|
|
|
type: type,
|
|
|
|
channel: 'default',
|
|
|
|
message: '',
|
|
|
|
datetime: new Date().toISOString()
|
|
|
|
};
|
2020-11-04 09:32:25 +00:00
|
|
|
|
|
|
|
switch(type) {
|
|
|
|
case "error":
|
|
|
|
heading = "Error";
|
|
|
|
icon = "error";
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "warning":
|
|
|
|
heading = "Warning";
|
|
|
|
icon = "warning";
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "info":
|
|
|
|
heading = "Information";
|
|
|
|
icon = "info";
|
2020-11-25 03:32:04 +00:00
|
|
|
break;
|
2020-11-04 09:32:25 +00:00
|
|
|
|
|
|
|
default:
|
2020-11-12 06:39:50 +00:00
|
|
|
heading = "Success";
|
2020-11-04 09:32:25 +00:00
|
|
|
icon = "success";
|
|
|
|
}
|
|
|
|
|
2020-11-25 03:16:42 +00:00
|
|
|
try {
|
2024-03-20 02:13:58 +00:00
|
|
|
if (typeof window.jQuery.toast !== "undefined") {
|
2020-11-25 03:16:42 +00:00
|
|
|
window.jQuery.toast({
|
|
|
|
heading: heading,
|
2022-11-28 17:49:58 +00:00
|
|
|
text: message,
|
2020-11-25 03:16:42 +00:00
|
|
|
icon: icon
|
|
|
|
});
|
|
|
|
} else {
|
2022-11-28 17:49:58 +00:00
|
|
|
window.alert(message);
|
2020-11-25 03:16:42 +00:00
|
|
|
}
|
|
|
|
} catch (e) {
|
|
|
|
window.alert(e.message);
|
2020-07-23 02:41:33 +00:00
|
|
|
}
|
|
|
|
|
2022-11-28 17:49:58 +00:00
|
|
|
this._messages.push(message);
|
2022-05-03 05:01:19 +00:00
|
|
|
|
|
|
|
if (params.channel != "default" && this._echoCallback != null) {
|
|
|
|
try {
|
|
|
|
this._echoCallback(params, type);
|
|
|
|
} catch (e) {
|
|
|
|
window.jQuery.toast({
|
|
|
|
heading: "Error",
|
|
|
|
text: e.message,
|
|
|
|
icon: "error"
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
2020-07-23 02:41:33 +00:00
|
|
|
};
|
|
|
|
|
2020-07-27 02:31:52 +00:00
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
// Override global.exit()
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
2020-07-23 08:18:47 +00:00
|
|
|
global.exit = function() {
|
|
|
|
if (typeof(window) !== "undefined") {
|
|
|
|
window.close();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-07-27 02:31:52 +00:00
|
|
|
////////////////////////////////////////////////////////////////////////
|
2020-08-02 22:02:55 +00:00
|
|
|
// this window makes movable
|
2020-07-27 02:31:52 +00:00
|
|
|
////////////////////////////////////////////////////////////////////////
|
2020-08-02 22:02:55 +00:00
|
|
|
(function(grip) {
|
|
|
|
var oX, oY,
|
2020-07-27 02:31:52 +00:00
|
|
|
mouseDown = function(e) {
|
|
|
|
if (e.offsetY + e.offsetX < 0) return;
|
|
|
|
oX = e.screenX;
|
|
|
|
oY = e.screenY;
|
|
|
|
window.addEventListener("mousemove", mouseMove);
|
|
|
|
window.addEventListener("mouseup", mouseUp);
|
|
|
|
},
|
|
|
|
mouseMove = function(e) {
|
|
|
|
window.moveTo(screenX + e.screenX - oX, screenY + e.screenY - oY);
|
|
|
|
oX = e.screenX;
|
|
|
|
oY = e.screenY;
|
|
|
|
},
|
|
|
|
gripMouseMove = function(e) {
|
|
|
|
this.style.cursor = (e.offsetY + e.offsetX > -1) ? "move" : "default";
|
|
|
|
},
|
|
|
|
mouseUp = function(e) {
|
|
|
|
window.removeEventListener("mousemove", mouseMove);
|
|
|
|
window.removeEventListener("mouseup", mouseUp);
|
2020-07-03 09:15:23 +00:00
|
|
|
};
|
2020-07-04 09:04:02 +00:00
|
|
|
|
2020-07-27 02:31:52 +00:00
|
|
|
grip.addEventListener("mousedown", mouseDown);
|
|
|
|
grip.addEventListener("mousemove", gripMouseMove);
|
2020-11-04 09:16:36 +00:00
|
|
|
})(document.getElementById("app"));
|
2020-08-02 22:02:55 +00:00
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
// exports.IEVersion
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
2023-12-22 20:13:25 +00:00
|
|
|
exports.IEVersion = Browser.getIEVersion();
|
2020-07-04 12:40:42 +00:00
|
|
|
|
2020-07-27 02:31:52 +00:00
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
// exports.main()
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
exports.main = function(args) {
|
2020-07-27 02:38:26 +00:00
|
|
|
// make will display contents
|
2023-12-22 20:13:25 +00:00
|
|
|
Browser.setContent(FILE.readFile("app\\index.html", FILE.CdoCharset.CdoUTF_8));
|
2020-11-05 05:09:20 +00:00
|
|
|
|
|
|
|
// add stylesheets
|
2023-12-22 20:13:25 +00:00
|
|
|
Browser.addStylesheet("app/assets/css/jquery-ui-1.21.1.min.css");
|
|
|
|
Browser.addStylesheet("app/assets/css/jquery.toast-1.3.2.min.css");
|
|
|
|
Browser.addStylesheet("app/assets/css/cascade/production/build-full.min.css");
|
|
|
|
Browser.addStylesheet("app/assets/css/style.css");
|
2020-11-05 05:09:20 +00:00
|
|
|
|
|
|
|
// start
|
2023-12-22 20:13:25 +00:00
|
|
|
Browser.start(function(el) {
|
2020-07-27 02:31:52 +00:00
|
|
|
jQuery.support.cors = true;
|
|
|
|
|
2024-03-20 02:13:58 +00:00
|
|
|
Browser.waitUntil(function(test, ttl) {
|
|
|
|
Browser.addScript("app/assets/js/jquery.toast-1.3.2.min.js", function(el) {
|
|
|
|
var messages = global.console._messages;
|
|
|
|
if (messages.length > 0) {
|
|
|
|
// print messages
|
|
|
|
for (var i in messages) {
|
|
|
|
console.log(messages[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
// start the app
|
|
|
|
Browser.addScript("app/assets/js/jquery.form-4.3.0.min.js");
|
|
|
|
Browser.addScript("app/index.js");
|
|
|
|
|
|
|
|
// hide loading image
|
|
|
|
document.getElementById("loading").style.display = "none";
|
2020-07-27 02:31:52 +00:00
|
|
|
}
|
2024-03-20 02:13:58 +00:00
|
|
|
}, test, ttl);
|
2020-07-27 02:31:52 +00:00
|
|
|
}, function(el) {
|
|
|
|
return window.jQuery.toast;
|
2024-03-20 02:13:58 +00:00
|
|
|
}, 30000);
|
2020-07-27 02:31:52 +00:00
|
|
|
});
|
|
|
|
|
2020-11-04 07:41:56 +00:00
|
|
|
// hook drag event
|
2020-07-27 02:31:52 +00:00
|
|
|
document.body.ondragstart = function() {
|
|
|
|
return false;
|
|
|
|
};
|
2020-11-04 07:41:56 +00:00
|
|
|
|
|
|
|
// hook drop event
|
2020-07-27 02:31:52 +00:00
|
|
|
document.body.ondrop = function() {
|
|
|
|
return false;
|
|
|
|
};
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
};
|