This commit is contained in:
Namhyeon Go 2020-07-03 19:30:21 +09:00
parent 3970d191e2
commit def7cff4be
2 changed files with 48 additions and 24 deletions

View File

@ -47,7 +47,7 @@
Selection="No"
/>
<title>NextVPN</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1" />
<meta http-equiv="X-UA-Compatible" content="IE=9, chrome=1" />
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
<meta name="description" content="Welsonjs: Build a windows desktop apps fastly without installing packages" />
<meta name="keywords" content="webapp" />

View File

@ -123,43 +123,58 @@ return {
getIEVersion: function() {
return IEVersion;
},
addScript: function(url, callback) {
addScript: function(url, callback, test) {
var _callback = function(el) {
setTimeout(function() {
var result = test(el);
if(typeof(result) !== "undefined") {
callback(el);
} else {
_callback(el);
}
}, 50);
};
var el = document.createElement("script");
el.src = url;
el.type = "text/javascript";
el.charset = "utf-8";
document.head.appendChild(el);
if(typeof(callback) === "function") {
if(typeof(test) === "function") {
_callback();
} else if(typeof(callback) === "function") {
el.onload = callback(el);
}
return el;
},
addStylesheet: function(url, callback) {
addStylesheet: function(url, callback, test) {
var _callback = function(el) {
setTimeout(function() {
var result = test(el);
if(typeof(result) !== "undefined") {
callback(el);
} else {
_callback(el);
}
}, 50);
};
var el = document.createElement("link");
el.href = url;
el.rel = "stylesheet";
el.type = "text/css";
document.head.appendChild(el);
if(typeof(callback) === "function") {
if(typeof(test) === "function") {
_callback();
} else if(typeof(callback) === "function") {
el.onload = callback(el);
}
return el;
},
showMessages: function() {
setTimeout(function() {
if(typeof(window.jQuery) !== "undefined") {
if(messages.length > 0) {
for(var i in messages) {
console.log(messages[i]);
}
}
} else {
this.showMessages();
}
}, 50);
},
main: function() {
// load contents
var contents = FILE.readFile("app\\app.html", "utf-8");
@ -178,18 +193,27 @@ return {
this.addScript("app/assets/js/html5shiv-printshiv.min.js");
this.addScript("app/assets/js/jquery-1.11.3.min.js");
} else {
this.addScript("app/assets/js/jquery-3.5.1.min.js");
this.addScript("app/assets/js/jquery-3.5.1.min.js", function(el) {
jQuery.support.cors = true;
}, function(el) {
return window.jQuery;
});
}
if(this.getIEVersion() < 10) {
this.addScript("app/assets/js/jquery.html5-placeholder-shim.js");
}
this.addScript("app/assets/js/jquery.form.min.js");
this.addScript("app/assets/js/jquery.toast.min.js");
this.addScript("app/assets/js/jquery.toast.min.js", function(el) {
if(messages.length > 0) {
for(var i in messages) {
console.log(messages[i]);
}
}
}, function(el) {
return window.jQuery.toast;
});
this.addScript("app/assets/js/index.js");
// show console messages
this.showMessages();
// set window draggable
this.setWindowDraggable();