Jdlrobson has uploaded a new change for review. https://gerrit.wikimedia.org/r/58647
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, 13 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend refs/changes/47/58647/1 diff --git a/MobileFrontend.php b/MobileFrontend.php index 2866b82..cb984ba 100644 --- a/MobileFrontend.php +++ b/MobileFrontend.php @@ -883,6 +883,14 @@ */ $wgMFEnableXAnalyticsLogging = false; +/** + * An optional alternative api to use nearby on + * e.g. http://en.m.wikipedia.org/ + * + * If set forces nearby to operate in JSONP mode + * @var String + */ +$wgNearbyHost = ''; /** * 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..73f83f3 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, $wgNearbyHost; $vars['wgCookiePath'] = $wgCookiePath; $vars['wgMFStopRedirectCookieHost'] = MobileContext::singleton()->getStopMobileRedirectCookieDomain(); $vars['wgMFEnablePhotoUploadCTA'] = $wgMFEnablePhotoUploadCTA; + $vars['wgNearbyHost'] = $wgNearbyHost; return true; } diff --git a/javascripts/specials/nearby.js b/javascripts/specials/nearby.js index fa416a8..be8ede4 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, host = mw.config.get( 'wgNearbyHost' ); $.ajax( { - dataType: 'json', - url: M.getApiUrl(), + dataType: host ? 'jsonp' : 'json', + url: host + 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: newchange Gerrit-Change-Id: Ia5254f650da61b9faccdd38cc221b9c8c2552f3e 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
