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

Change subject: Use Wikimedia tile server only for query.wikidata.org and 
localhost
......................................................................


Use Wikimedia tile server only for query.wikidata.org and localhost

The Wikimedia tile server blocks requests from other domains, so we
should use OSM tile servers in order to enable others to use our code.

Change-Id: Ifca5a88bac12feaef55e3150798210479367e214
---
M wikibase/queryService/ui/resultBrowser/CoordinateResultBrowser.js
1 file changed, 20 insertions(+), 8 deletions(-)

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



diff --git a/wikibase/queryService/ui/resultBrowser/CoordinateResultBrowser.js 
b/wikibase/queryService/ui/resultBrowser/CoordinateResultBrowser.js
index b06832f..2a8ec8c 100644
--- a/wikibase/queryService/ui/resultBrowser/CoordinateResultBrowser.js
+++ b/wikibase/queryService/ui/resultBrowser/CoordinateResultBrowser.js
@@ -3,12 +3,21 @@
 wikibase.queryService.ui = wikibase.queryService.ui || {};
 wikibase.queryService.ui.resultBrowser = 
wikibase.queryService.ui.resultBrowser || {};
 
-wikibase.queryService.ui.resultBrowser.CoordinateResultBrowser = ( function( 
$, L ) {
+wikibase.queryService.ui.resultBrowser.CoordinateResultBrowser = ( function( 
$, L, window ) {
        "use strict";
 
        var MAP_DATATYPE = 'http://www.opengis.net/ont/geosparql#wktLiteral';
-       var MAP_SERVER = 'https://maps.wikimedia.org/';
-    var MAP_STYLE = 'osm-intl';
+
+    var TILE_LAYER = {
+       wikimedia: {
+                       url: 
'https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png',
+                       options: {
+                                       id: 'wikipedia-map-01',
+                                       attribution: 'Wikimedia maps | Map data 
&copy; <a href="http://openstreetmap.org/copyright";>OpenStreetMap 
contributors</a>'
+                               }
+                       },
+               osm: { url: 'http://{s}.tile.osm.org/{z}/{x}/{y}.png', options: 
{ attribution: '&copy; <a href="http://osm.org/copyright";>OpenStreetMap</a> 
contributors' } }
+    };
 
 
     var ScrollToTopButton = null;
@@ -128,10 +137,13 @@
         * @private
         */
        SELF.prototype._setTileLayer = function( map ) {
-               L.tileLayer( MAP_SERVER + MAP_STYLE + '/{z}/{x}/{y}.png', {
-               id: 'wikipedia-map-01',
-               attribution: 'Wikimedia maps beta | Map data &copy; <a 
href="http://openstreetmap.org/copyright";>OpenStreetMap contributors</a>'
-           }).addTo( map );
+               var layer = TILE_LAYER.osm;
+               if ( window.location.host === 'query.wikidata.org' ||
+                               window.location.host === 'localhost' ) {
+                       layer = TILE_LAYER.wikimedia;
+               }
+
+               L.tileLayer( layer.url , layer.options ).addTo( map );
        };
 
 
@@ -174,4 +186,4 @@
        };
 
        return SELF;
-}( jQuery, L ) );
+}( jQuery, L, window ) );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ifca5a88bac12feaef55e3150798210479367e214
Gerrit-PatchSet: 1
Gerrit-Project: wikidata/query/gui
Gerrit-Branch: master
Gerrit-Owner: Jonas Kress (WMDE) <jonas.kr...@wikimedia.de>
Gerrit-Reviewer: Aude <aude.w...@gmail.com>
Gerrit-Reviewer: Smalyshev <smalys...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to