Jdlrobson has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/67877


Change subject: Allow configuration of range in Special:Nearby
......................................................................

Allow configuration of range in Special:Nearby

Allows projects like Wikivoyage to redefine what close means

Change-Id: I4c0a5f894f6394dc2d1f853ee9eba75fce8c6bf6
---
M MobileFrontend.php
M includes/specials/SpecialNearby.php
M javascripts/specials/nearby.js
3 files changed, 12 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/77/67877/1

diff --git a/MobileFrontend.php b/MobileFrontend.php
index 18db9c4..2859cd4 100644
--- a/MobileFrontend.php
+++ b/MobileFrontend.php
@@ -299,6 +299,11 @@
 $wgMFNearby = false;
 
 /**
+ * The range in meters that should be searched to find nearby pages on 
Special:Nearby (defaults to 10km)
+ */
+$wgMFNearbyRange = 10000;
+
+/**
  * Whether the login form should redirect to another URL on the first login 
attempt.
  *
  * Defaults to false.
diff --git a/includes/specials/SpecialNearby.php 
b/includes/specials/SpecialNearby.php
index b13e740..61fcecc 100644
--- a/includes/specials/SpecialNearby.php
+++ b/includes/specials/SpecialNearby.php
@@ -6,9 +6,15 @@
        }
 
        public function execute( $par = '' ) {
+               global $wgMFNearbyRange;
+
                $this->setHeaders();
 
                $output = $this->getOutput();
+
+               // set config
+               $output->addJsConfigVars( 'wgMFNearbyRange', $wgMFNearbyRange );
+
                // add previews to mobile only
                $ctx = MobileContext::singleton();
                if ( $ctx->shouldDisplayMobileView() && 
$ctx->isBetaGroupMember() ) {
diff --git a/javascripts/specials/nearby.js b/javascripts/specials/nearby.js
index a6cd810..ba32295 100644
--- a/javascripts/specials/nearby.js
+++ b/javascripts/specials/nearby.js
@@ -151,7 +151,7 @@
        }
 
        function findResults( lat, lng ) {
-               var $content = $( '#mw-mf-nearby' ), range = 10000,
+               var $content = $( '#mw-mf-nearby' ), range = mw.config.get( 
'wgMFNearbyRange' ),
                        limit = 50;
 
                $.ajax( {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4c0a5f894f6394dc2d1f853ee9eba75fce8c6bf6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to