diff options
author | plegall <plg@piwigo.org> | 2013-05-17 11:07:42 +0000 |
---|---|---|
committer | plegall <plg@piwigo.org> | 2013-05-17 11:07:42 +0000 |
commit | a67544b1adbaa0eacf5820b8727060525e1407a7 (patch) | |
tree | f65f90af51254db4787af2998b3f904836b46958 | |
parent | 9920df7daae4591fe2b0cbb160fa76dfa9b3d2d2 (diff) |
feature 2885: only display Google Map on a click
git-svn-id: http://piwigo.org/svn/trunk@22715 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r-- | admin/themes/default/template/history.tpl | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/admin/themes/default/template/history.tpl b/admin/themes/default/template/history.tpl index cd2b786eb..717893c7e 100644 --- a/admin/themes/default/template/history.tpl +++ b/admin/themes/default/template/history.tpl @@ -138,7 +138,6 @@ {combine_script id='jquery.geoip' load='async' path='admin/themes/default/js/jquery.geoip.js'} {footer_script}{literal} -jQuery(document).ready( function(){ jQuery(".IP").one( "mouseenter", function(){ var that = $(this); that @@ -148,19 +147,34 @@ jQuery(".IP").one( "mouseenter", function(){ }); GeoIp.get( that.text(), function(data) { if (!data.fullName) return; - var content = data.fullName; - if (data.latitude && data.region_name) { - content += "<br><img width=300 height=220 src=\"http://maps.googleapis.com/maps/api/staticmap?sensor=false&size=300x220&zoom=6" - + "&markers=size:tiny%7C" + data.latitude + "," + data.longitude - + "\">"; - } + + var content = data.fullName; + if (data.latitude && data.region_name) { + content += '<br><a class="ipGeoOpen" data-lat="'+data.latitude+'" data-lon="'+data.longitude+'"'; + content += ' href="#">show on a Google Map</a>'; + } + that.tipTip( { content: content, - maxWidth: 320 + keepAlive: true, + defaultPosition: "right", + maxWidth: 320, } ); if (that.data("isOver")) that.trigger("mouseenter"); }); } ); + +jQuery(document).on('click', '.ipGeoOpen', function() { + var lat = jQuery(this).data("lat"); + var lon = jQuery(this).data("lon"); + var parent = jQuery(this).parent(); + jQuery(this).remove(); + + var append = '<br><img width=300 height=220 src="http://maps.googleapis.com/maps/api/staticmap'; + append += '?sensor=false&size=300x220&zoom=6&markers=size:tiny%7C' + lat + ',' + lon + '">'; + + jQuery(parent).append(append); + return false; }); {/literal}{/footer_script}
\ No newline at end of file |