OSDN Git Service

minor cleanup geolocation handler
authorishikawa <ishikawa@180c8125-5b33-4295-ad04-72a68a15b4cc>
Fri, 16 Apr 2010 13:08:36 +0000 (13:08 +0000)
committerishikawa <ishikawa@180c8125-5b33-4295-ad04-72a68a15b4cc>
Fri, 16 Apr 2010 13:08:36 +0000 (13:08 +0000)
lib/public/geopost-keitairc.js

index 988bf11..8eff7be 100644 (file)
@@ -1,6 +1,6 @@
 /*
  -*- mode: javascript; coding: utf-8 -*-
- $Id: geopost-keitairc.js,v 1.7 2010-01-26 12:25:29 ishikawa Exp $
+ $Id: geopost-keitairc.js,v 1.8 2010-04-16 13:08:36 ishikawa Exp $
 
  Copyright (c) 2009 ISHIKAWA Mutsumi <ishikawa@hanzubon.jp>
  This program is covered by the GNU General Public License 2
@@ -20,7 +20,7 @@ google map api 使ってるので <head> とかで
 var keitairc_location = '';
 var keitairc_map_url = '';
 
-addEventListener("load", function(event) {
+function append_location(event) {
        navigator.geolocation.getCurrentPosition(function (position) {
                var latLng = new google.maps.LatLng(position.coords.latitude,
                                                    position.coords.longitude);
@@ -60,7 +60,7 @@ addEventListener("load", function(event) {
                        }
                });
        });
-}, true)
+}
 
 function location_submit(form, type) {
        if (type == 'location') {
@@ -75,3 +75,5 @@ function location_submit(form, type) {
                return false ;
        }
 }
+
+addEventListener("load", append_location, true);