Changeset 25922


Ignore:
Timestamp:
12/10/13 22:17:07 (6 years ago)
Author:
rvelices
Message:

rv_gmaps improvements on mobile/tablets + fix initial bounds on empty galeries

Location:
extensions/rv_gmaps/trunk
Files:
4 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • extensions/rv_gmaps/trunk/map.php

    r23083 r25922  
    5454  rvm_build_section_items($img_fields, null, RVM_BUILD_AGGREGATE); 
    5555  //var_export( $page['items'] ); 
    56   if ( count($page['items']) ) 
     56  if ( isset($page['items'][0]['s']) ) 
    5757    $template->assign('initial_bounds', $page['items'][0] ); 
    5858  unset( $page['items'] ); 
  • extensions/rv_gmaps/trunk/template/map.tpl

    r25834 r25922  
    2525<![endif]--> 
    2626 
    27 <script type="text/javascript">{literal} 
     27<script type="text/javascript"> 
    2828//<![CDATA[ 
    2929var map; 
    3030 
    3131document.is_debug = false; 
    32 if ( document.location.search.match(/[\?&]debug/) ) { 
     32if ( document.location.search.match(/[\?&]debug/) ) 
    3333        document.is_debug = true; 
    34 } 
    3534 
    3635function glog(msg) { 
    37         if (console) 
    38         { 
     36        if (console) { 
    3937                var b = map.getBounds(); 
    4038                if (b) 
     
    5250{ 
    5351        var mapOptions = { 
    54                 mapTypeId: google.maps.MapTypeId.{/literal}{$MAP_TYPE}{literal}, 
     52                mapTypeId: google.maps.MapTypeId.{$MAP_TYPE}, 
    5553                overviewMapControl: true, 
    56                 overviewMapControlOptions: {opened: document.documentElement.offsetWidth>640} 
     54                overviewMapControlOptions: { opened: document.documentElement.offsetWidth>640} 
    5755        } 
    5856 
    5957        if (!PageLinker.url2Map(mapOptions)) 
    6058        { 
    61 {/literal} 
    6259{if isset($initial_bounds)} 
    6360                mapOptions.iniBounds = new google.maps.LatLngBounds( new google.maps.LatLng({$initial_bounds.s},{$initial_bounds.w}), new google.maps.LatLng({$initial_bounds.n},{$initial_bounds.e}) ); 
     
    6764                mapOptions.zoom = 2; 
    6865{/if} 
    69 {literal} 
    7066        } 
    7167 
     
    7571                map.fitBounds(mapOptions.iniBounds); 
    7672 
    77         if (document.is_debug) 
    78         { 
    79                 google.maps.event.addListener(map, "idle", function() { glog("idle"); }); 
    80                 google.maps.event.addListener(map, "bounds_changed", function() { glog("bounds_changed");} ); 
    81                 google.maps.event.addListener(map, "center_changed", function() { glog("center_changed");} ); 
    82                 google.maps.event.addListener(map, "maptypeid_changed", function() { glog("maptypeid_changed");} ); 
    83                 google.maps.event.addListener(map, "zoom_changed", function() { glog("zoom_changed");} ); 
    84                 google.maps.event.addListener(map, "drag", function() { glog("drag");} ); 
    85         } 
    86  
     73{if isset($smarty.get.debug)} 
     74        google.maps.event.addListener(map, "idle", function() { glog("idle"); }); 
     75        google.maps.event.addListener(map, "bounds_changed", function() { glog("bounds_changed");} ); 
     76        google.maps.event.addListener(map, "center_changed", function() { glog("center_changed");} ); 
     77        google.maps.event.addListener(map, "maptypeid_changed", function() { glog("maptypeid_changed");} ); 
     78        google.maps.event.addListener(map, "zoom_changed", function() { glog("zoom_changed");} ); 
     79        google.maps.event.addListener(map, "drag", function() { glog("drag");} ); 
     80{/if} 
    8781        pwgPageLinker = new PageLinker(map, "aLinkToThisPage" ); 
    8882 
    89         var pwgStyler = {/literal}{$MAP_MARKER_ICON_JS}{literal}; 
     83        var pwgStyler = {$MAP_MARKER_ICON_JS}; 
    9084 
    91         map.pwgDataLoader = new PwgDataLoader(map, {rectangle_of_confusion: pwgStyler.roc} ); 
     85        map.pwgDataLoader = new PwgDataLoader(map, { rectangle_of_confusion: pwgStyler.roc} ); 
    9286        google.maps.event.addListener(map.pwgDataLoader, "dataloading", function() { 
    93                 var pre = '<img src="{/literal}{$PLUGIN_ROOT_URL}{literal}/icons/progress_s.gif" width="16" height="16" alt="~"> '; 
     87                var pre = '<img src="{$PLUGIN_ROOT_URL}/icons/progress_s.gif" width="16" height="16" alt="~"> '; 
    9488                document.getElementById("dataLoadStatus").innerHTML = pre + Localization.get("Loading"); 
    9589                } 
     
    10195                ); 
    10296 
    103         map.pwgDataHandler = new PwgDataHandler(map, {styler: pwgStyler, show_all_img_src: "{/literal}{$PLUGIN_ROOT_URL}{literal}/icons/pic_s.gif" } ); 
     97        map.pwgDataHandler = new PwgDataHandler(map, { styler: pwgStyler, show_all_img_src: "{$PLUGIN_ROOT_URL}/icons/pic_s.gif" } ); 
    10498        google.maps.event.addListener(map.pwgDataLoader, "dataloaded", pwgBind(map.pwgDataHandler, map.pwgDataHandler.handle) ); 
    10599 
    106         map.pwgDataLoader.start( "{/literal}{$U_MAP_DATA}{literal}" ); 
     100        map.pwgDataLoader.start( "{$U_MAP_DATA}" ); 
    107101 
    108102        positionMap(); 
     
    134128{ 
    135129  _strings: { 
    136 {/literal} 
    137130"go to %s": "{'go to %s'|@translate|@escape:javascript}", 
    138131"Next": "{'Next'|@translate|@escape:javascript}", 
     
    146139"opens %s in Google Earth" : "{'opens %s in Google Earth'|@translate|@escape:javascript}", 
    147140"%d photos" : "{'%d photos'|@translate|@escape:javascript}", 
    148 {literal} 
    149141dontMindTheComma: "" 
    150142    }, 
     
    172164        } 
    173165} 
    174 {/literal} 
    175166//]]> 
    176167</script> 
     
    188179                <a id="aLinkToThisPage" href="" class="gmnoprint"><img src="//maps.google.com/mapfiles/bar_icon_link.gif" alt="&lt;-&gt;" width="16" height="16"><span class="hideable"> {'Link to this page'|@translate}</span></a> 
    189180    <a id="aBlowup" href="" onclick="return PwgDataHandler.blowupUrl(this.href);" class="gmnoprint" title="{'show all photos around this location'|@translate}"> 
    190                         <img src="{$PLUGIN_ROOT_URL}/icons/pic_s.gif" alt="" title="{'show all photos around this location'|@translate}"> 
     181                        <img src="{$PLUGIN_ROOT_URL}/icons/pic_s.gif" width="16" height="16" alt="" title="{'show all photos around this location'|@translate}"> 
    191182                        <span>{'Show all'|@translate}</span> 
    192183                </a> 
Note: See TracChangeset for help on using the changeset viewer.