Thiemo Mättig (WMDE) has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/371209 )

Change subject: Remove unused dependency on DataValues JavaScript's coordinate 
formatter
......................................................................

Remove unused dependency on DataValues JavaScript's coordinate formatter

Note that the only thing used from the formatter is the static
PRECISIONTEXT() method. Everything else was already removed long ago.
This patch will allow us to remove the client-side coordinate formatter
entirely.

I did run the QUnit tests and they pass.

A manual test of the expert should be done.

Bug: T172916
Change-Id: I84e17646449d06e8f0035416f1ebbc63b4b26801
---
M src/experts/GlobeCoordinateInput.js
M src/experts/resources.php
2 files changed, 27 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/data-values/value-view 
refs/changes/09/371209/1

diff --git a/src/experts/GlobeCoordinateInput.js 
b/src/experts/GlobeCoordinateInput.js
index 3576d4f..bcdc535 100644
--- a/src/experts/GlobeCoordinateInput.js
+++ b/src/experts/GlobeCoordinateInput.js
@@ -1,4 +1,4 @@
-module.exports = ( function( $, vv, Formatter ) {
+module.exports = ( function( $, vv ) {
        'use strict';
 
        var PARENT = vv.experts.StringValue;
@@ -31,6 +31,29 @@
        }
 
        /**
+        * @param {number} precision
+        * @return {string}
+        */
+       function getPrecisionLabel( precision ) {
+               var presets = [
+                       { precision: 1 / 60, text: 'to an arcminute' },
+                       { precision: 1 / 3600, text: 'to an arcsecond' },
+                       { precision: 1 / 36000, text: 'to 1/10 of an arcsecond' 
},
+                       { precision: 1 / 360000, text: 'to 1/100 of an 
arcsecond' },
+                       { precision: 1 / 3600000, text: 'to 1/1000 of an 
arcsecond' },
+                       { precision: 1 / 36000000, text: '1/10000\'' }
+               ];
+
+               for ( var i in presets ) {
+                       if ( Math.abs( precision - presets[i].precision ) < 
0.000000000001 ) {
+                               return presets[i].text;
+                       }
+               }
+
+               return '±' + roundPrecision( precision ) + '°';
+       }
+
+       /**
         * Returns the original precision level for an unrounded precision.
         * @ignore
         *
@@ -59,10 +82,9 @@
        function getPrecisionValues() {
                var precisionValues = [];
                $.each( PRECISIONS, function( i, precision ) {
-                       var label = Formatter.PRECISIONTEXT( precision );
                        precisionValues.unshift( {
                                value: roundPrecision( precision ),
-                               label: label
+                               label: getPrecisionLabel( precision )
                        } );
                } );
                return precisionValues;
@@ -124,7 +146,7 @@
                                        value: precision,
                                        label: self._messageProvider.getMessage(
                                                
'valueview-expert-globecoordinateinput-customprecision',
-                                               [ Formatter.PRECISIONTEXT( 
precision ) ]
+                                               [ getPrecisionLabel( precision 
) ]
                                        )
                                };
                        }
@@ -190,4 +212,4 @@
 
        return vv.experts.GlobeCoordinateInput;
 
-}( jQuery, jQuery.valueview, globeCoordinate.Formatter ) );
+}( jQuery, jQuery.valueview ) );
diff --git a/src/experts/resources.php b/src/experts/resources.php
index 0018029..6d35007 100644
--- a/src/experts/resources.php
+++ b/src/experts/resources.php
@@ -81,7 +81,6 @@
                                'GlobeCoordinateInput.css',
                        ),
                        'dependencies' => array(
-                               'globeCoordinate.js',
                                'jquery.valueview.ExpertExtender',
                                'jquery.valueview.ExpertExtender.Container',
                                'jquery.valueview.ExpertExtender.Listrotator',

-- 
To view, visit https://gerrit.wikimedia.org/r/371209
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I84e17646449d06e8f0035416f1ebbc63b4b26801
Gerrit-PatchSet: 1
Gerrit-Project: data-values/value-view
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <thiemo.maet...@wikimedia.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to