Ignore:
Timestamp:
May 17, 2013, 1:07:42 PM (11 years ago)
Author:
plg
Message:

feature 2885: only display Google Map on a click

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/themes/default/template/history.tpl

    r22703 r22715  
    139139
    140140{footer_script}{literal}
    141 jQuery(document).ready( function(){
    142141jQuery(".IP").one( "mouseenter", function(){
    143142        var that = $(this);
     
    149148        GeoIp.get( that.text(), function(data) {
    150149                if (!data.fullName) return;
    151                 var content = data.fullName;
    152                 if (data.latitude && data.region_name) {
    153                         content += "<br><img width=300 height=220 src=\"http://maps.googleapis.com/maps/api/staticmap?sensor=false&size=300x220&zoom=6"
    154                                 + "&markers=size:tiny%7C" + data.latitude + "," + data.longitude
    155                                 + "\">";
    156                 }
     150
     151    var content = data.fullName;
     152    if (data.latitude && data.region_name) {
     153      content += '<br><a class="ipGeoOpen" data-lat="'+data.latitude+'" data-lon="'+data.longitude+'"';
     154      content += ' href="#">show on a Google Map</a>';
     155    }
     156
    157157                that.tipTip( {
    158158                        content: content,
    159                         maxWidth: 320
     159      keepAlive: true,
     160      defaultPosition: "right",
     161      maxWidth: 320,
    160162                        }       );
    161163                if (that.data("isOver"))
     
    163165        });
    164166} );
     167
     168jQuery(document).on('click', '.ipGeoOpen',  function() {
     169  var lat = jQuery(this).data("lat");
     170  var lon = jQuery(this).data("lon");
     171  var parent = jQuery(this).parent();
     172  jQuery(this).remove();
     173
     174  var append = '<br><img width=300 height=220 src="http://maps.googleapis.com/maps/api/staticmap';
     175  append += '?sensor=false&size=300x220&zoom=6&markers=size:tiny%7C' + lat + ',' + lon + '">';
     176
     177  jQuery(parent).append(append);
     178  return false;
    165179});
    166180{/literal}{/footer_script}
Note: See TracChangeset for help on using the changeset viewer.