[Coffee] [PATCH mt-apps v4] Added list of scripts

Tomas Prochazka tomas.prochazka at cvut.cz
Thu Sep 6 01:06:52 CEST 2018


This scripts are needed to create Dialog window with calendar
---
 html/index.html | 27 ++++++++++++++++++++-------
 1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/html/index.html b/html/index.html
index 06f8fbf..db039db 100644
--- a/html/index.html
+++ b/html/index.html
@@ -5,13 +5,26 @@
 <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');
+                document.head.appendChild(script);
+                script.onload = resolve;
+                script.onerror = () => {
+                    setTimeout(loadServerScript, 10000);
+                    reject;
+                };
+                script.async = false;
+                script.src = "http://localhost:5000/"+scriptName[i];
+            });
+        }
     }
 
     loadServerScript();
-- 
2.11.0




More information about the Coffee mailing list