-
-
Notifications
You must be signed in to change notification settings - Fork 981
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
50 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,33 @@ | ||
PluginsAPI.Map.addActionButton([ | ||
'osm-quickedit/main.css' | ||
], function(options){ | ||
|
||
console.log("PLUGIN INIT!"); | ||
return React.createElement("div", null, "HELLO"); | ||
PluginsAPI.Map.addActionButton(function(options){ | ||
if (options.tiles.length > 0){ | ||
// TODO: pick the topmost layer instead | ||
// of the first on the list, to support | ||
// maps that display multiple tasks. | ||
|
||
var tile = options.tiles[0]; | ||
var url = window.location.protocol + "//" + | ||
window.location.host + | ||
tile.url.replace(/tiles\.json$/, "tiles/{zoom}/{x}/{ty}.png"); | ||
|
||
return React.createElement("button", { | ||
type: "button", | ||
className: "btn btn-sm btn-secondary", | ||
onClick: function(){ | ||
var mapLocation = options.map.getZoom() + "/" + | ||
options.map.getCenter().lat + "/" + | ||
options.map.getCenter().lng; | ||
|
||
if (window.prompt("To start digitizing this map on OpenStreetMap:\n\n" + | ||
"1. Copy the URL below.\n" + | ||
"2.When the editor loads, open the Background Settings (press B) and select \"Custom\".\n" + | ||
"3. Press \"Edit Custom Background\".\n" + | ||
"4. Paste the URL you copied below.\n\n" + | ||
"Press OK to go to OpenStreetMap", url)){ | ||
window.location.href = "https://www.openstreetmap.org/edit?editor=id#map=" + mapLocation; | ||
} | ||
} | ||
}, React.createElement("i", {className: "fa fa-map"}, ""), | ||
" OSM Digitize"); | ||
} | ||
|
||
}); |