r83900 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r83899‎ | r83900 | r83901 >
Date:14:48, 14 March 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
follow up to r83899
Modified paths:
  • /branches/Maps0.8/includes/ext.maps.coord.js (modified) (history)

Diff [purge]

Index: branches/Maps0.8/includes/ext.maps.coord.js
@@ -65,7 +65,7 @@
6666 */
6767 this.float = function( lat, lon ) {
6868 return lat.toString() + this.SEPARATOR + ' ' + lon.toString();
69 - }
 69+ };
7070
7171 this.parse = function( coord ) {
7272 coord = coord.split( this.SEPARATOR );
@@ -82,24 +82,34 @@
8383 if ( parsed !== false ) return parsed;
8484
8585 return false;
86 - }
 86+ };
8787
8888 this.parseDMS = function( lat, lon ) {
89 - if ( true ) {
 89+ if ( this.isDMS( lat, lon ) ) {
9090 // TODO
9191 }
9292 else {
9393 return false;
9494 }
95 - }
 95+ };
9696
9797 this.parseFloat = function( lat, lon ) {
98 - if ( true ) {
99 - // TODO
 98+ if ( this.isFloat( lat, lon ) ) {
 99+ return { lat: parseFloat( lat ), lon: parseFloat( lon ) };
100100 }
101101 else {
102102 return false;
103103 }
104 - }
 104+ };
105105
 106+ this.isFloat = function( lat, lon ) {
 107+ var regex = /(-)?\d{1,3}(\.\d{1,20})?$/;
 108+ return regex.test( lat ) && regex.test( lon );
 109+ };
 110+
 111+ this.isDMS = function( lat, lon ) {
 112+ var regex = ''; // TODO
 113+ return regex.test( lat ) && regex.test( lon );
 114+ };
 115+
106116 } )( jQuery );
\ No newline at end of file

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r83899work on openlayers form inputjeroendedauw14:48, 14 March 2011

Status & tagging log