barnhouse (barnhouse) wrote in changelog,
barnhouse
barnhouse
changelog

[livejournal] r15136: LJSUP-3977: Geo-location identification ...

Committer: sebua
LJSUP-3977: Geo-location identification - at the edit profile page

U   trunk/htdocs/js/countryregions.js
U   trunk/htdocs/manage/profile/index.bml
Modified: trunk/htdocs/js/countryregions.js
===================================================================
--- trunk/htdocs/js/countryregions.js	2009-04-22 18:36:09 UTC (rev 15135)
+++ trunk/htdocs/js/countryregions.js	2009-04-23 03:55:46 UTC (rev 15136)
@@ -7,30 +7,6 @@
     this.cityBox = document.getElementById(cityBoxId);
     
     var that=this;
-    $('detect').onclick=function(){
-        HTTPReq.getJSON({url:'/tools/endpoints/geo_location.bml',
-			onData:function(data){
-				if(data.data){
-					for(var i=0;i<that.countrySelect.options.length;i++){
-						if(that.countrySelect.options[i].value==data.data.country_short){
-							that.countrySelect.options[i].selected='true';
-						}
-					}
-					that.countryChanged(data);
-					if(data.data.city_rus_name!=null){
-						that.cityBox.value=data.data.city_rus_name;
-					}
-					else{
-						if(data.data.city_name!=null){
-							that.cityBox.value=data.data.city_name;
-						}
-					}
-				}		
-			},
-			onError:LiveJournal.ajaxError
-			});
-    }	    
-
     this.descColor = "#999";
     this.regionDesc = regionDesc;
     this.cityDesc = cityDesc;
@@ -189,3 +165,29 @@
         }
     }
 }
+
+CountryRegions.prototype.autoDetect=function(){
+	that=this;
+	HTTPReq.getJSON({url:'/tools/endpoints/geo_location.bml',
+			onData:function(data){
+				if(data.data){
+					for(var i=0;i<that.countrySelect.options.length;i++){
+						if(that.countrySelect.options[i].value==data.data.country_short){
+							that.countrySelect.options[i].selected='true';
+						}
+					}
+					that.countryChanged(data);
+					if(data.data.city_rus_name!=null){
+						that.cityBox.value=data.data.city_rus_name;
+					}
+					else{
+						if(data.data.city_name!=null){
+							that.cityBox.value=data.data.city_name;
+						}
+					}
+				}		
+			},
+			onError:LiveJournal.ajaxError
+			});
+
+}

Modified: trunk/htdocs/manage/profile/index.bml
===================================================================
--- trunk/htdocs/manage/profile/index.bml	2009-04-22 18:36:09 UTC (rev 15135)
+++ trunk/htdocs/manage/profile/index.bml	2009-04-23 03:55:46 UTC (rev 15136)
@@ -298,7 +298,7 @@
 		if ($IpMap::VERSION ge "1.1.0" and not $LJ::DISABLED{'geo_location'}) {
 		
 			$ret .= "<div class='lc_detect'><span>$ML{'.section.location.detect'}</span>";
-			$ret .= "<input type='button' name='detect' value='$ML{'.location.detect.btn'}' id='detect'>";
+			$ret .= "<input type='button' name='detect' value='$ML{'.location.detect.btn'}' id='detect' onClick='countryregions.autoDetect()'> ";
 			## $ret .= " " . LJ::help_icon('upic_keywords');
 			$ret .= "</div>";
 		}

Subscribe

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments