Sfoglia il codice sorgente

load config using requirejs

Nils Schneider 9 anni fa
parent
commit
3b77d1230b
2 ha cambiato i file con 5 aggiunte e 5 eliminazioni
  1. 2 2
      lib/config.js
  2. 3 3
      lib/main.js

+ 2 - 2
config.json → lib/config.js

@@ -1,4 +1,4 @@
-{
+define({
   "dataPath": "https://map.luebeck.freifunk.net/data/",
   "showContact": true
-}
+})

+ 3 - 3
lib/main.js

@@ -1,11 +1,11 @@
-require(["router", "map", "sidebar", "tabs", "container", "meshstats", "linklist", "nodelist", "simplenodelist", "infobox/main"],
-function (Router, Map, Sidebar, Tabs, Container, Meshstats, Linklist, Nodelist, SimpleNodelist, Infobox) {
+require(["config", "router", "map", "sidebar", "tabs", "container", "meshstats", "linklist", "nodelist", "simplenodelist", "infobox/main"],
+function (Config, Router, Map, Sidebar, Tabs, Container, Meshstats, Linklist, Nodelist, SimpleNodelist, Infobox) {
 
   /* Required for Intl shim */
   if ("__addLocaleData" in Intl)
     getJSON("vendor/de-DE.json").then(Intl.__addLocaleData)
 
-  getJSON("config.json").then(main)
+  main(Config)
 
   function main(config) {
     var linklist, lostnodeslist, map, meshstats, newnodeslist, nodelist, router