Yurik has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/325874 )
Change subject: Add GeoHack to the list of map links ...................................................................... Add GeoHack to the list of map links Bug: T152545 Change-Id: I73ae49f336079642ca107fa37a261bd398ab958e --- M externalLinks.json M i18n/en.json M i18n/qqq.json M modules/dialog-sidebar/sidebar.js 4 files changed, 21 insertions(+), 7 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Kartographer refs/changes/74/325874/1 diff --git a/externalLinks.json b/externalLinks.json index 751ddf8..6e20e0e 100644 --- a/externalLinks.json +++ b/externalLinks.json @@ -81,6 +81,16 @@ ] }, { + "id": "geohack", + "featured": true, + "links": [ + { + "type": "map", + "url": "https://tools.wmflabs.org/geohack/geohack.php?language={language}&pagename={title}¶ms={latitude}_N_{longitude}_E_scale:{{scale}}" + } + ] + }, + { "id": "geonames", "links": [ { diff --git a/i18n/en.json b/i18n/en.json index 717dd09..ba868dd 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -50,6 +50,7 @@ "kartographer-link-arctic-io": "Arctic.io", "kartographer-link-bing-maps": "Bing Maps", "kartographer-link-blue-marble-navigator": "Blue Marble Navigator", + "kartographer-link-geohack": "GeoHack", "kartographer-link-geonames": "GeoNames", "kartographer-link-google-maps": "Google Maps", "kartographer-link-here": "HERE", diff --git a/i18n/qqq.json b/i18n/qqq.json index 06a721f..54569f2 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -54,6 +54,7 @@ "kartographer-link-arctic-io": "{{optional}}Full screen map info sidebar - external service name", "kartographer-link-bing-maps": "{{optional}}Full screen map info sidebar - external service name", "kartographer-link-blue-marble-navigator": "{{optional}}Full screen map info sidebar - external service name", + "kartographer-link-geohack": "{{optional}}Full screen map info sidebar - external service name", "kartographer-link-geonames": "{{optional}}Full screen map info sidebar - external service name", "kartographer-link-google-maps": "{{optional}}Full screen map info sidebar - external service name", "kartographer-link-here": "{{optional}}Full screen map info sidebar - external service name", diff --git a/modules/dialog-sidebar/sidebar.js b/modules/dialog-sidebar/sidebar.js index 342baf5..2465111 100644 --- a/modules/dialog-sidebar/sidebar.js +++ b/modules/dialog-sidebar/sidebar.js @@ -32,13 +32,15 @@ * @return {string} */ SideBar.prototype.formatLink = function ( url ) { - var mapPosition = this.mapPosition, - link = url.replace( new RegExp( '{latitude}', 'g' ), mapPosition.center.lat ); - link = link.replace( new RegExp( '{longitude}', 'g' ), mapPosition.center.lng ); - link = link.replace( new RegExp( '{zoom}', 'g' ), mapPosition.zoom ); - link = link.replace( new RegExp( '{title}', 'g' ), mw.config.get( 'wgTitle' ) ); - link = link.replace( new RegExp( '{language}', 'g' ), mw.config.get( 'wgContentLanguage' ) || mw.config.get( 'wgUserLanguage' ) ); - return link; + var mapPosition = this.mapPosition; + url = url.replace( new RegExp( '{latitude}', 'g' ), mapPosition.center.lat ); + url = url.replace( new RegExp( '{longitude}', 'g' ), mapPosition.center.lng ); + url = url.replace( new RegExp( '{zoom}', 'g' ), mapPosition.zoom ); + url = url.replace( new RegExp( '{title}', 'g' ), mw.config.get( 'wgTitle' ) ); + url = url.replace( new RegExp( '{language}', 'g' ), mw.config.get( 'wgContentLanguage' ) || mw.config.get( 'wgUserLanguage' ) ); + url = url.replace( new RegExp( '{scale}', 'g' ), Math.round( Math.pow( 2, 15 - mapPosition.zoom ) * 10000 ) ); + + return url; }; // eslint-disable-next-line valid-jsdoc -- To view, visit https://gerrit.wikimedia.org/r/325874 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I73ae49f336079642ca107fa37a261bd398ab958e Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Kartographer Gerrit-Branch: master Gerrit-Owner: Yurik <yu...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits