2 * Description: SensLab display of 3D-geolocated data
3 * Copyright (c) 2012 UPMC Sorbonne Universite - INRIA
7 // xxx TODO -- this plugin has never been tested
8 // update_map looks suspiciously empty...
9 // in addition it could use a bit of cleaning like what was done for the first plugins
10 // especially wrt using 'instance' and 'data' in such a confusing way
14 $.fn.SensLabMap = function( method ) {
15 /* Method calling logic */
16 if ( methods[method] ) {
17 return methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 ));
18 } else if ( typeof method === 'object' || ! method ) {
19 return methods.init.apply( this, arguments );
21 $.error( 'Method ' + method + ' does not exist on $.SensLabMap' );
26 init : function( options ) {
27 return this.each(function(){
29 data = $this.data('SensLabMap'), SensLabMap = $('<div />', { text : $this.attr('title') });
30 // If the plugin hasn't been initialized yet
32 /* Plugin initialization */
33 //google.load('maps', '3', { other_params: 'sensor=false' });
34 //google.setOnLoadCallback(initialize);
36 /* End of plugin initialization */
37 $(this).data('SensLabMap', {
38 plugin_uuid: options.plugin_uuid,
39 query_uuid: options.query_uuid,
41 SensLabMap : SensLabMap
43 /* Subscribe to query updates */
44 $.subscribe('/results/' + options.query_uuid + '/changed', {instance: $this}, update_map);
48 destroy : function( ) {
49 return this.each(function(){
50 var $this = $(this), data = $this.data('SensLabMap');
51 $(window).unbind('SensLabMap');
52 data.SensLabMap.remove();
53 $this.removeData('SensLabMap');
57 reposition : function( ) { // ... },
58 show : function( ) { // ... },
59 hide : function( ) { // ... },
61 update : function( content ) {
62 // should be made a private function
68 function update_map(e, rows) {
69 var $plugindiv = e.data.instance;
70 $plugindiv.closest('.need-spin').spin(false);