jenkins-bot has submitted this change and it was merged.

Change subject: Dev Change: Allow nearby page to run on a different api
......................................................................


Dev Change: Allow nearby page to run on a different api

Setting
$wgNearbyHost to 'http://en.m.wikipedia.org/' allows nearby to run
on a local dev instance. \o/

Change-Id: Ia5254f650da61b9faccdd38cc221b9c8c2552f3e
---
M MobileFrontend.php
M includes/MobileFrontend.hooks.php
M javascripts/specials/nearby.js
3 files changed, 14 insertions(+), 5 deletions(-)

Approvals:
  awjrichards: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/MobileFrontend.php b/MobileFrontend.php
index a0091b8..6424075 100644
--- a/MobileFrontend.php
+++ b/MobileFrontend.php
@@ -656,6 +656,15 @@
 $wgMFPhotoUploadEndpoint = '';
 
 /**
+ * An optional alternative api to query for nearby pages
+ * e.g. http://en.m.wikipedia.org/w/api.php
+ *
+ * If set forces nearby to operate in JSONP mode
+ * @var String
+ */
+$wgMFNearbyEndpoint = '';
+
+/**
  * The wiki id/dbname for where photos are uploaded, if photos are uploaded to
  * a wiki other than the local wiki (eg commonswiki).
  * @var string
@@ -881,7 +890,6 @@
  * @var bool
  */
 $wgMFEnableXAnalyticsLogging = false;
-
 
 /**
  * If set to true, mobile skin's resources are varied by X-Device.
diff --git a/includes/MobileFrontend.hooks.php 
b/includes/MobileFrontend.hooks.php
index 5a50fe3..4e37355 100644
--- a/includes/MobileFrontend.hooks.php
+++ b/includes/MobileFrontend.hooks.php
@@ -279,10 +279,11 @@
         * @return boolean
         */
        public static function onResourceLoaderGetConfigVars( &$vars ) {
-               global $wgCookiePath, $wgMFEnablePhotoUploadCTA;
+               global $wgCookiePath, $wgMFEnablePhotoUploadCTA, 
$wgMFNearbyEndpoint;
                $vars['wgCookiePath'] = $wgCookiePath;
                $vars['wgMFStopRedirectCookieHost'] = 
MobileContext::singleton()->getStopMobileRedirectCookieDomain();
                $vars['wgMFEnablePhotoUploadCTA'] = $wgMFEnablePhotoUploadCTA;
+               $vars['wgMFNearbyEndpoint'] = $wgMFNearbyEndpoint;
                return true;
        }
 
diff --git a/javascripts/specials/nearby.js b/javascripts/specials/nearby.js
index fa416a8..fc975b6 100644
--- a/javascripts/specials/nearby.js
+++ b/javascripts/specials/nearby.js
@@ -25,10 +25,10 @@
        }
 
        function findResults( lat, lng ) {
-               var $content = $( '#mw-mf-nearby' ), range = 10000;
+               var $content = $( '#mw-mf-nearby' ), range = 10000, endpoint = 
mw.config.get( 'wgMFNearbyEndpoint' );
                $.ajax( {
-                       dataType: 'json',
-                       url: M.getApiUrl(),
+                       dataType: endpoint ? 'jsonp' : 'json',
+                       url: endpoint || M.getApiUrl(),
                        data: {
                                action: 'query',
                                list: 'geosearch',

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia5254f650da61b9faccdd38cc221b9c8c2552f3e
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: awjrichards <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to