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 // in addition it could use a bit of cleaning like what was done for the first plugins
12 // especially wrt using 'instance' and 'data' in such a confusing way
17 init : function( options ) {
19 return this.each(function(){
21 var $this = jQuery(this),
22 data = $this.data('SensLabMap'), SensLabMap = jQuery('<div />', { text : $this.attr('title') });
24 // If the plugin hasn't been initialized yet
27 /* Plugin initialization */
29 //google.load('maps', '3', { other_params: 'sensor=false' });
30 //google.setOnLoadCallback(initialize);
33 /* End of plugin initialization */
35 jQuery(this).data('SensLabMap', {
36 plugin_uuid: options.plugin_uuid,
37 query_uuid: options.query_uuid,
39 SensLabMap : SensLabMap
42 /* Subscribe to query updates */
43 jQuery.subscribe('/results/' + options.query_uuid + '/changed', {instance: $this}, update_map);
49 destroy : function( ) {
51 return this.each(function(){
52 var $this = jQuery(this), data = $this.data('SensLabMap');
53 jQuery(window).unbind('SensLabMap');
54 data.SensLabMap.remove();
55 $this.removeData('SensLabMap');
60 reposition : function( ) { // ... },
61 show : function( ) { // ... },
62 hide : function( ) { // ... },
64 update : function( content ) {
65 // should be made a private function
70 jQuery.fn.SensLabMap = function( method ) {
71 /* Method calling logic */
72 if ( methods[method] ) {
73 return methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 ));
74 } else if ( typeof method === 'object' || ! method ) {
75 return methods.init.apply( this, arguments );
77 jQuery.error( 'Method ' + method + ' does not exist on jQuery.SensLabMap' );
84 function update_map(e, rows) {
85 var $plugindiv = e.data.instance;
86 $plugindiv.closest('.need-spin').spin(false);