freifunkmanager/js/main.js

35 lines
914 B
JavaScript
Raw Normal View History

2016-07-01 11:16:39 +02:00
define(["helper/router","helper/storage","menu","controller/nodes","controller/map","controller/frame"],
function (Router, storage, menu, controllerNodes, controllerMap, controllerFrame) {
2016-07-01 08:25:32 +02:00
return function(config){
2016-07-01 16:01:28 +02:00
var store = storage(config);
store.refresh();
store.autorefresh(config.reload);
2016-07-01 08:25:32 +02:00
2016-07-01 16:01:28 +02:00
document.title = "eventmanager";
2016-07-01 08:25:32 +02:00
2016-07-01 16:01:28 +02:00
menu(document.body,store);
el = document.createElement("div");
el.classList.add("content");
document.body.appendChild(el);
2016-07-01 08:25:32 +02:00
2016-07-01 16:01:28 +02:00
var map = controllerMap(el,config);
store.addNotify(map);
2016-07-01 08:25:32 +02:00
2016-07-01 16:01:28 +02:00
var nodes = controllerNodes(el,config);
store.addNotify(nodes);
2016-07-01 08:25:32 +02:00
Router.config({
mode: 'hash'
})
2016-07-01 16:01:28 +02:00
.add(/grafana/, controllerFrame(el,config.grafana.all))
2016-07-01 11:16:39 +02:00
.add(/meshviewer/, controllerFrame(el,config.meshviewer))
2016-07-01 08:25:32 +02:00
.add(/list/, nodes.controller)
.add(/map\/(.*)/, map.controller)
.add(/map/, map.controller)
.add(nodes.controller)
2016-07-01 16:01:28 +02:00
.check().listen();
};
});