Skip to content

Commit

Permalink
Add '✏️ in JOSM' button
Browse files Browse the repository at this point in the history
  • Loading branch information
Binnette committed Aug 25, 2024
1 parent 910726d commit fae694e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
3 changes: 2 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ <h2>Error while sending change to server</h2>
<button class="action type" value="garage_boxes">garage_boxes</button>
<hr />
<div class="vertical-flex">
<button id="ideditor" class="action button">edit in iD editor</button>
<button id="ideditor" class="action button">✏️ in iD</button>
<button id="josmeditor" class="action button">✏️ in JOSM</button>
<button class="action next">next ▶</button>
</div>
</div>
Expand Down
18 changes: 16 additions & 2 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ function initUi() {
$('#more').on('click', () => toggleModal(true, 'modal-more'));
$('.next').on('click', onClickNext);
$('#ideditor').on('click', onClickIdEditor);
$('#josmeditor').on('click', onClickJosmEditor);

$('#back').on('click', () => showPanel('#welcome'));
$('.continue').on('click', () => showPanel('#welcome'));
Expand All @@ -141,8 +142,7 @@ function toggleModal(toggle, id) {

function onClickIdEditor() {
if (currentElement) {
var url = 'https://www.openstreetmap.org/edit?' +
currentElement._type + "=" + currentElement._id;
const url = `https://www.openstreetmap.org/edit?${currentElement._type}=${currentElement._id}`;
window.open(url);
} else {
$.toast({
Expand All @@ -154,6 +154,20 @@ function onClickIdEditor() {
}
}

function onClickJosmEditor() {
if (currentElement) {
const url = `http://localhost:8111/load_object?objects=${currentElement._type}${currentElement._id}`;
window.open(url);
} else {
$.toast({
icon: 'error',
heading: 'No current element',
text: 'Can not open JOSM.',
position: 'bottom-center'
});
}
}

// authenticate user
function authenticate() {
if (auth.authenticated()) {
Expand Down

0 comments on commit fae694e

Please sign in to comment.