statically add owm script
authorgregor herrmann <gregor@toastfreeware.priv.at>
Thu, 4 Oct 2018 17:30:51 +0000 (19:30 +0200)
committergregor herrmann <gregor@toastfreeware.priv.at>
Thu, 4 Oct 2018 17:30:51 +0000 (19:30 +0200)
instead of letting a function insert it dynamically into the DOM

web/templates/seepark_web.html

index 09f17dc..59d32e2 100644 (file)
@@ -20,7 +20,8 @@
                <script src="{{url_for('static', filename='c3.min.js')}}"></script>
                <script src="{{url_for('static', filename='strftime-min.js')}}"></script>
 
-               <!-- here the owm script will be appended -->
+               <!-- Load owm script -->
+               <script async="true" charset="utf-8" src="//openweathermap.org/themes/openweathermap/assets/vendor/owm/js/weather-widget-generator.js"></script>
 
                <title>Seepark Obsteig</title>
        </head>
                        containerid: 'openweathermap-widget-15',
                        lang: 'de',
                });
-               (function() {
-                       var script = document.createElement('script');
-                       script.async = true;
-                       script.charset = "utf-8";
-                       script.src = "//openweathermap.org/themes/openweathermap/assets/vendor/owm/js/weather-widget-generator.js";
-                       var s = document.getElementsByTagName('title')[0];
-                       s.parentNode.insertBefore(script, s);
-               })();
                </script>
 
                <!-- windy widget -->