2 var SensLabMap = Plugin.extend({
3 init: function(options, element) {
4 this._super(options, element);
6 this.elmt().on('show', this, this.on_show);
8 this.method = query.object;
10 /* Setup query and record handlers */
11 this.listen_query(options.query_uuid);
12 this.listen_query(options.query_all_uuid, 'all');
18 on_show: function(e) {
22 on_all_new_record: function(node) {
23 Senslab.normalize(node);
24 if (node.normalized) {
26 if ($.inArray(site, this.sites) == -1) {
27 this.sites.push(site);
28 this.nodes[site] = [];
30 this.nodes[site].push(node);
32 console.warn("node has no site:");
37 on_all_query_done: function() {
41 $container = $('#maps-container');
43 $.each(this.sites, function(i, site) {
44 var $div = $("<div />").appendTo($container);
45 maps[site] = new Senslab.Map($div);
46 maps[site].addNodes(self.nodes[site]);
50 $.plugin('SensLabMap', SensLabMap);