r83896 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r83895‎ | r83896 | r83897 >
Date:14:07, 14 March 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
follow up to r83895
Modified paths:
  • /branches/SemanticMaps0.8/includes/forminputs/SM_FormInputs.php (modified) (history)
  • /branches/SemanticMaps0.8/includes/forminputs/ext.sm.forminputs.js (modified) (history)

Diff [purge]

Index: branches/SemanticMaps0.8/includes/forminputs/SM_FormInputs.php
@@ -14,7 +14,7 @@
1515 }
1616
1717 $wgResourceModules['ext.sm.forminputs'] = array(
18 - 'dependencies' => array(),
 18+ 'dependencies' => array( 'ext.maps.coord' ),
1919 'localBasePath' => dirname( __FILE__ ),
2020 'remoteBasePath' => $smgScriptPath . '/includes/forminputs',
2121 'group' => 'ext.semanticmaps',
Index: branches/SemanticMaps0.8/includes/forminputs/ext.sm.forminputs.js
@@ -9,102 +9,6 @@
1010 * @author Jeroen De Dauw <jeroendedauw at gmail dot com>
1111 */
1212
13 -window.coord = new ( function( $ ) {
14 -
15 - /**
16 - * The separator used between latitude and longitude in a coordinate set.
17 - * @const
18 - * @type {string}
19 - */
20 - this.SEPARATOR = ',';
21 -
22 - /**
23 - * The delimiter used between coordinate sets.
24 - * @const
25 - * @type {string}
26 - */
27 - this.DELIMITER = ';';
28 -
29 - /**
30 - * Returns a list with coordinates obtained by splitting the provided string.
31 - * @param {string} coords The coordinates to split.
32 - * @return {Array} The split coordinates.
33 - */
34 - this.split = function( coords ) {
35 - coords = coords.split( this.DELIMITER );
36 - for ( i in coords ) coords[i] = coords[i].trim();
37 - return coords;
38 - }
39 -
40 - /**
41 - * Returns the provided coordinates joined in a string.
42 - * @param {Array} coords The coordinates to join.
43 - * @return {string} The joined coordinates.
44 - */
45 - this.join = function( coords ) {
46 - return coords.join( this.DELIMITER + ' ' );
47 - }
48 -
49 - /**
50 - * Returns a string with the directional DMS representatation of the provided latitude and longitude.
51 - * @param {float} lat The latitude.
52 - * @param {float} lon The longitude.
53 - * @return {string} The string with DMS coordinates.
54 - */
55 - this.dms = function( lat, lon ) { // TODO: i18n
56 - return
57 - Math.abs( lat ).toString() + '° ' + ( lat < 0 ? 'S' : 'N' )
58 - + this.SEPARATOR + ' '
59 - + Math.abs( lon ).toString() + '° ' + ( lon < 0 ? 'W' : 'E' );
60 - };
61 -
62 - /**
63 - * Returns a string with the non-directional float representatation of the provided latitude and longitude.
64 - * @param {float} lat The latitude.
65 - * @param {float} lon The longitude.
66 - * @return {string} The string with float coordinates.
67 - */
68 - this.float = function( lat, lon ) {
69 - return lat.toString() + this.SEPARATOR + ' ' + lon.toString();
70 - }
71 -
72 - this.parse = function( coord ) {
73 - coord = coord.split( this.SEPARATOR );
74 - if ( coord.length != 2 ) return false;
75 -
76 - var lat = coord[0].trim();
77 - var lon = coord[1].trim();
78 - var parsed;
79 -
80 - parsed = this.parseFloat( lat, lon );
81 - if ( parsed !== false ) return parsed;
82 -
83 - parsed = this.parseDMS( lat, lon );
84 - if ( parsed !== false ) return parsed;
85 -
86 - return false;
87 - }
88 -
89 - this.parseDMS = function( lat, lon ) {
90 - if ( true ) {
91 - // TODO
92 - }
93 - else {
94 - return false;
95 - }
96 - }
97 -
98 - this.parseFloat = function( lat, lon ) {
99 - if ( true ) {
100 - // TODO
101 - }
102 - else {
103 - return false;
104 - }
105 - }
106 -
107 -} )( jQuery );
108 -
10913 window.semanticMaps = new ( function( $ ) {
11014
11115 this.buildInputValue = function( locations ) {

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r83895moved over js from smjeroendedauw14:07, 14 March 2011

Status & tagging log