kosmtik-map-compare
Advanced tools
Comparing version 0.0.5 to 0.0.6
39
front.js
@@ -0,1 +1,23 @@ | ||
var TILELAYERS = [ | ||
['http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', 'OpenStreetMap'], | ||
['http://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png', 'Humanitarian'], | ||
['http://{s}.tile.thunderforest.com/outdoors/{z}/{x}/{y}.png', 'Outdoors'], | ||
['http://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png', 'OSM-Fr'], | ||
['http://openmapsurfer.uni-hd.de/tiles/roads/x={x}&y={y}&z={z}', 'OSM Roads'], | ||
['http://{s}.tile3.opencyclemap.org/landscape/{z}/{x}/{y}.png', 'Landscape'], | ||
['http://{s}.tile.stamen.com/toner-lite/{z}/{x}/{y}.png', 'Toner'], | ||
['http://{s}.tile2.opencyclemap.org/transport/{z}/{x}/{y}.png', 'Transport'], | ||
['http://otile1.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.png', 'MapQuest Open'], | ||
['http://{s}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png', 'OpenCycleMap'], | ||
['http://{s}.tile.stamen.com/watercolor/{z}/{x}/{y}.jpg', 'Watercolor'], | ||
['http://toolserver.org/tiles/hikebike/{z}/{x}/{y}.png', 'hikebikemap'], | ||
['http://tiles.lyrk.org/ls/{z}/{x}/{y}?apikey=982c82cc765f42cf950a57de0d891076', 'Lyrk'], | ||
['http://www.toolserver.org/tiles/bw-mapnik/{z}/{x}/{y}.png', 'OSM monochrome'], | ||
['http://{s}.tile.openstreetmap.se/hydda/full/{z}/{x}/{y}.png', 'Hydda'], | ||
['http://{s}.tile.opentopomap.org/{z}/{x}/{y}.png', 'OpenTopoMap'], | ||
['http://{s}.tile.openstreetmap.fr/openriverboatmap/{z}/{x}/{y}.png', 'OpenRiverboatMap'], | ||
['http://{s}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png', 'OSM - Deutschland'], | ||
]; | ||
L.K.Map.addInitHook(function () { | ||
@@ -7,3 +29,4 @@ this.whenReady(function () { | ||
tms: false, | ||
url: L.K.Config.project.compareUrl, | ||
url: '', | ||
suggestedUrl: '', | ||
active: false, | ||
@@ -19,3 +42,3 @@ minZoom: this.options.minZoom, | ||
otherMap = L.map(container.id, {attributionControl: false}); | ||
tilelayer = L.tileLayer(params.url, params).addTo(otherMap); | ||
tilelayer = L.tileLayer(L.K.Config.project.compareUrl, params).addTo(otherMap); | ||
new L.Hash(otherMap); | ||
@@ -26,3 +49,4 @@ }; | ||
['tms', {handler: L.K.Switch, label: 'TMS format.'}], | ||
['url', {handler: 'BlurInput', helpText: 'URL template.'}] | ||
['suggestedUrl', {handler: 'Select', helpText: 'Choose a map in the list…', selectOptions: TILELAYERS}], | ||
['url', {handler: 'BlurInput', helpText: '… or set a custom URL template.'}] | ||
], {id: 'compare-form'}); | ||
@@ -40,8 +64,11 @@ // TODO vertical / horizontal view | ||
} | ||
} | ||
}; | ||
var setUrl = function () { | ||
tilelayer.setUrl(params.url || params.suggestedUrl); | ||
}; | ||
builder.on('synced', function (e) { | ||
if (e.field === 'active') { | ||
L.bind(toggle, this)(); | ||
} else if (e.field === 'url' && tilelayer) { | ||
tilelayer.setUrl(params.url); | ||
} else if (e.field === 'url' || e.field === 'suggestedUrl') { | ||
setUrl(); | ||
} | ||
@@ -48,0 +75,0 @@ }, this); |
{ | ||
"name": "kosmtik-map-compare", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "Add a map to compare side-by-side with your work", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
80928
116