2 * MySlice GoogleMap plugin
3 * URL: http://trac.myslice.info
4 * Description: SensLab display of 3D-geolocated data
5 * Author: The MySlice Team
6 * Copyright (c) 2012 UPMC Sorbonne Universite - INRIA
10 // xxx TODO -- this plugin has never been tested
11 // update_map looks suspiciously empty...
12 // in addition it could use a bit of cleaning like what was done for the first plugins
13 // especially wrt using 'instance' and 'data' in such a confusing way
17 $.fn.SensLabMap = function( method ) {
18 /* Method calling logic */
19 if ( methods[method] ) {
20 return methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 ));
21 } else if ( typeof method === 'object' || ! method ) {
22 return methods.init.apply( this, arguments );
24 $.error( 'Method ' + method + ' does not exist on $.SensLabMap' );
29 init : function( options ) {
30 return this.each(function(){
32 data = $this.data('SensLabMap'), SensLabMap = $('<div />', { text : $this.attr('title') });
33 // If the plugin hasn't been initialized yet
35 /* Plugin initialization */
36 //google.load('maps', '3', { other_params: 'sensor=false' });
37 //google.setOnLoadCallback(initialize);
39 /* End of plugin initialization */
40 $(this).data('SensLabMap', {
41 plugin_uuid: options.plugin_uuid,
42 query_uuid: options.query_uuid,
44 SensLabMap : SensLabMap
46 /* Subscribe to query updates */
47 $.subscribe('/results/' + options.query_uuid + '/changed', {instance: $this}, update_map);
51 destroy : function( ) {
52 return this.each(function(){
53 var $this = $(this), data = $this.data('SensLabMap');
54 $(window).unbind('SensLabMap');
55 data.SensLabMap.remove();
56 $this.removeData('SensLabMap');
60 reposition : function( ) { // ... },
61 show : function( ) { // ... },
62 hide : function( ) { // ... },
64 update : function( content ) {
65 // should be made a private function
71 function update_map(e, rows) {
72 var $plugindiv = e.data.instance;
73 $plugindiv.closest('.need-spin').spin(false);