Plugin Directory

Changeset 896897


Ignore:
Timestamp:
04/18/2014 12:54:11 AM (12 years ago)
Author:
tk01k
Message:

Version 1.1 : Added 'Get Current Position' button.

Location:
embed-osm/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • embed-osm/trunk/embed-osm.php

    r886612 r896897  
    44    Plugin URI: http://midoriit.com/works/embed-osm.html
    55    Description: Embed OpenStreetMap on the page/post.
    6     Version: 1.0
     6    Version: 1.1
    77    Author: Midori IT Office, LLC
    88    Author URI: http://midoriit.com/
     
    121121            }
    122122        }
    123         echo '</select><br /><br />';
     123        echo '</select> ';
     124        echo '<a class="button" onClick="embed_osm_get_cur_pos();">'.__( 'Get Current Position', 'embed-osm' ).'</a><br /><br />';
    124125        echo '<div id="embmapdiv" style="width:'.$width.'px;height:'.$height.'px;">';
    125126        echo '</div><br />';
     
    192193                    " lat=\"" + Math.round( lonLat.lat * 100000 ) / 100000 + "\"" +
    193194                    " lon=\"" + Math.round( lonLat.lon * 100000 ) / 100000 + "\"" +
    194                     " zoom=\"" + map.getZoom() + "\"" +
     195                    " zoom=\"" + zoom + "\"" +
    195196                    layer + "]";
    196197                embed_osm_shortcode.select();
     
    198199
    199200            function embed_osm_moveend() {
     201                zoom = map.getZoom();
    200202                embed_osm_genshortcode();
     203            }
     204
     205            function embed_osm_get_cur_pos() {
     206                if( navigator.geolocation ) {
     207                    navigator.geolocation.getCurrentPosition(
     208                        function(pos) {
     209                            lonLat = new OpenLayers.LonLat( pos.coords.longitude, pos.coords.latitude ).transform(
     210                                new OpenLayers.Projection( "EPSG:4326" ),
     211                                map.getProjectionObject() );
     212                            map.setCenter( lonLat, zoom );
     213                        } );
     214                }
    201215            }
    202216
     
    382396            ' : <input type="text" id="embed_osm_zoom" name="embed_osm_zoom" value="'.
    383397            $zoom.'" size="5" readonly><br /><br />';
     398        echo '<a class="button" onClick="embed_osm_get_cur_pos();">'.__( 'Get Current Position', 'embed-osm' ).'</a><br /><br />';
    384399        echo '<div id="defmapdiv" style="width:'.$width.'px;height:'.$height.
    385400            'px;"></div></td></tr>';
     
    482497                embed_osm_lat.value = Math.round( lonLat.lat * 100000 ) / 100000;
    483498                embed_osm_lon.value = Math.round( lonLat.lon * 100000 ) / 100000;
    484                 embed_osm_zoom.value = map.getZoom();
     499                embed_osm_zoom.value = zoom;
    485500            }
    486501
    487502            function embed_osm_moveend2() {
     503                zoom = map.getZoom();
    488504                embed_osm_getvalue();
     505            }
     506
     507            function embed_osm_get_cur_pos() {
     508                if( navigator.geolocation ) {
     509                    navigator.geolocation.getCurrentPosition(
     510                        function(pos) {
     511                            lonLat = new OpenLayers.LonLat( pos.coords.longitude, pos.coords.latitude ).transform(
     512                                new OpenLayers.Projection( "EPSG:4326" ),
     513                                map.getProjectionObject() );
     514                            map.setCenter( lonLat, zoom );
     515                        } );
     516                }
    489517            }
    490518
  • embed-osm/trunk/languages/embed-osm-ja.po

    r886617 r896897  
    3333msgid "View Larger Map"
    3434msgstr "大きな地図を表示"
     35msgid "Get Current Position"
     36msgstr "現在位置を取得"
  • embed-osm/trunk/readme.txt

    r895318 r896897  
    4242== Changelog ==
    4343
     44= 1.1 =
     45
     46* Added 'Get Current Position' button. See screenshots.
     47
    4448= 1.0 =
    4549
    46 * Initial release
     50* Initial release.
Note: See TracChangeset for help on using the changeset viewer.