]> git.openstreetmap.org Git - rails.git/commitdiff
Use jQuery
authorJohn Firebaugh <john.firebaugh@gmail.com>
Fri, 5 Oct 2012 17:29:20 +0000 (10:29 -0700)
committerTom Hughes <tom@compton.nu>
Fri, 5 Oct 2012 21:31:17 +0000 (22:31 +0100)
app/assets/javascripts/user.js

index 97827fb8d3474b230c2fa7c6828cc4c4211ef913..7d8c2f33410532e395f55ad1ca1909f0e9228e2a 100644 (file)
@@ -1,4 +1,4 @@
-function init(){
+$(document).ready(function () {
   var params = $("#map").data();
   var map = createMap("map");
 
@@ -14,12 +14,12 @@ function init(){
     map.events.register("click", map, function (e) {
       closeMapPopup();
 
-      if (document.getElementById('updatehome').checked) {
+      if ($('#updatehome').is(':checked')) {
         var lonlat = getEventPosition(e);
 
-        document.getElementById('homerow').className = '';
-        document.getElementById('home_lat').value = lonlat.lat;
-        document.getElementById('home_lon').value = lonlat.lon;
+        $('#homerow').removeClass();
+        $('#home_lat').val(lonlat.lat);
+        $('#home_lon').val(lonlat.lon);
 
         if (marker) {
           removeMarkerFromMap(marker);
@@ -40,6 +40,4 @@ function init(){
       }
     });
   }
-}
-
-window.onload = init;
+});