[Coffee] [PATCH mt-apps v5] Added list of scripts
Tomas Prochazka
tomas.prochazka at cvut.cz
Thu Sep 6 10:35:30 CEST 2018
This scripts are needed to create Dialog window with calendar
---
html/index.html | 28 +++++++++++++++++++++-------
1 file changed, 21 insertions(+), 7 deletions(-)
diff --git a/html/index.html b/html/index.html
index 06f8fbf..8bd131f 100644
--- a/html/index.html
+++ b/html/index.html
@@ -5,13 +5,27 @@
<title>IID Coffee Terminal</title>
<script>
function loadServerScript() {
- let script = document.createElement('script');
- script.src = "http://localhost:5000/js";
- document.head.append(script);
- script.onerror = function() {
- this.parentElement.removeChild(this);
- setTimeout(loadServerScript, 10000);
- };
+ <!--name of script, which I need -->
+ var scriptName= ["js",
+ "bower_components/moment/min/moment.min.js",
+ "bower_components/jquery/dist/jquery.min.js",
+ "bower_components/bootstrap/dist/js/bootstrap.min.js",
+ "bower_components/bootstrap3-dialog/dist/js/bootstrap-dialog.min.js",
+ "bower_components/fullcalendar/dist/fullcalendar.min.js"];
+ for(var i=0;i<scriptName.length;i++){
+ const scriptPromise = new Promise((resolve, reject) => {
+ const script = document.createElement('script');
+ script.src = "http://localhost:5000/"+scriptName[i];
+ script.onload = resolve;
+ script.onerror = function() {
+- document.head.removeChild(script);
+ setTimeout(loadServerScript, 10000);
+ reject;
+ };
+ script.async = false;
+ document.head.appendChild(script);
+ });
+ }
}
loadServerScript();
--
2.11.0
More information about the Coffee
mailing list