X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=plugins%2Fgooglemap%2Fstatic%2Fjs%2Fgooglemap.js;h=a3d9ba2761d4eef4cd33927c89cba3ed9184ff58;hb=754158ae8e3a6b8e1d5cfeed23de32e4ad941a29;hp=c9d392322bfef8fd7a9f766b1266522865db6382;hpb=d1e5d12b2b9519801f7b981a2177b3f36115714a;p=unfold.git diff --git a/plugins/googlemap/static/js/googlemap.js b/plugins/googlemap/static/js/googlemap.js index c9d39232..a3d9ba27 100644 --- a/plugins/googlemap/static/js/googlemap.js +++ b/plugins/googlemap/static/js/googlemap.js @@ -1,341 +1,429 @@ /** - * Description: display a query result in a googlemap - * Copyright (c) 2012 UPMC Sorbonne Universite - INRIA + * Description: display a query result in a Google map + * Copyright (c) 2012-2013 UPMC Sorbonne Universite - INRIA * License: GPLv3 */ -/* - * It's a best practice to pass jQuery to an IIFE (Immediately Invoked Function - * Expression) that maps it to the dollar sign so it can't be overwritten by - * another library in the scope of its execution. +/* BUGS: + * - infowindow is not properly reopened when the maps does not have the focus */ +GOOGLEMAP_BGCOLOR_RESET = 0; +GOOGLEMAP_BGCOLOR_ADDED = 1; +GOOGLEMAP_BGCOLOR_REMOVED = 2; + (function($){ - var PLUGIN_NAME = 'GoogleMap'; + // events that happen in the once-per-view range + var debug=false; + debug=true; - // routing calls - jQuery.fn.GoogleMap = function( method ) { - if ( methods[method] ) { - return methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 )); - } else if ( typeof method === 'object' || ! method ) { - return methods.init.apply( this, arguments ); - } else { - jQuery.error( 'Method ' + method + ' does not exist on jQuery.' + PLUGIN_NAME ); - } - }; + // this now should be obsolete, rather use plugin_debug in plugin.js + // more on a on-per-record basis + var debug_deep=false; + // debug_deep=true; - /*************************************************************************** - * Public methods - ***************************************************************************/ + var GoogleMap = Plugin.extend({ - var methods = { + /************************************************************************** + * CONSTRUCTOR + **************************************************************************/ - /** - * @brief Plugin initialization - * @param options : an associative array of setting values - * @return : a jQuery collection of objects on which the plugin is - * applied, which allows to maintain chainability of calls - */ - init : function( options ) { - - return this.each(function(){ - - var $this = $(this); + init: function(options, element) + { + this._super(options, element); + + /* Member variables */ + + /* we keep a couple of global hashes + * lat_lon --> { marker,