From 2c2f0e0f0d4d8e80bb7088d88494b238b3ac37cc Mon Sep 17 00:00:00 2001 From: tomasz t Date: Sat, 18 Dec 2021 14:01:37 +0100 Subject: [PATCH 01/24] reformatted file --- index.html | 61 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 26 deletions(-) diff --git a/index.html b/index.html index 3754d1d..cd042ef 100644 --- a/index.html +++ b/index.html @@ -1,10 +1,10 @@ - AED - mapa defibrylatorów - - - + AED - mapa defibrylatorów + + + @@ -25,14 +25,15 @@ + + - - + + @@ -91,6 +97,9 @@
- - + + + + From edb578df161f5944c5d78eba49e2cd2af55a2ce3 Mon Sep 17 00:00:00 2001 From: tomasz t Date: Sun, 19 Dec 2021 22:20:43 +0100 Subject: [PATCH 02/24] added poc of functionality for adding nodes within map using ouath to authorize at osm api --- index.html | 11 +++- land.html | 9 ++++ src/osm-integration.js | 112 +++++++++++++++++++++++++++++++++++++++++ src/osmauth.min.js | 1 + 4 files changed, 132 insertions(+), 1 deletion(-) create mode 100644 land.html create mode 100644 src/osm-integration.js create mode 100644 src/osmauth.min.js diff --git a/index.html b/index.html index cd042ef..068cbcd 100644 --- a/index.html +++ b/index.html @@ -25,7 +25,7 @@ - + @@ -46,6 +46,14 @@ rel="noopener" style="color:#effaf5;">OpenStreetMap Polska + + + +
+

+

+ Changesets: +
- - - + + +

@@ -103,6 +103,9 @@
+
+ +
diff --git a/src/osm-integration.js b/src/osm-integration.js index ac2594d..4e635ba 100644 --- a/src/osm-integration.js +++ b/src/osm-integration.js @@ -13,18 +13,22 @@ function getOpenChangesetId() { if (openChangesetId !== null) { resolve(openChangesetId); } else { - let data = ''; + let data = ''; auth.xhr({ method: 'PUT', path: '/api/0.6/changeset/create', content: data, - options: {header: {"Content-Type": "text/xml"}}, + options: { + header: { + "Content-Type": "text/xml" + } + }, }, (err, res) => { if (err) { reject(err); } else { openChangesetId = res; - console.log('api returned changeset id: ' + res); + console.log('Api returned changeset id: ' + res); resolve(res); } }) @@ -51,9 +55,9 @@ function done(err, res) { document.getElementById('user').style.display = 'block'; } -document.getElementById('authenticate').onclick = function() { +document.getElementById('authenticate').onclick = function () { if (!auth.bringPopupWindowToFront()) { - auth.authenticate(function() { + auth.authenticate(function () { update(); }); } @@ -73,26 +77,32 @@ function log_xhr(err, res) { function addDefibrillatorToOSM(changesetId) { console.log('sending request to create node in changeset: ' + changesetId); - let data = ``; -// console.log(data); + let data = ` + + `; + // console.log(data); auth.xhr({ method: 'PUT', path: '/api/0.6/node/create', content: data, - options: {header: {"Content-Type": "text/xml"}}, + options: { + header: { + "Content-Type": "text/xml" + } + }, }, log_xhr); } -document.getElementById('addNode').onclick = function() { +document.getElementById('addNode').onclick = function () { getOpenChangesetId() - .then(changesetId => addDefibrillatorToOSM(changesetId)); + .then(changesetId => addDefibrillatorToOSM(changesetId)); }; function hideDetails() { document.getElementById('user').style.display = 'none'; } -document.getElementById('logout').onclick = function() { +document.getElementById('logout').onclick = function () { auth.logout(); update(); }; @@ -109,4 +119,4 @@ function update() { } } -update(); +update(); \ No newline at end of file From 64ae742b85864d127d0cf44f0a6342c827bac6a0 Mon Sep 17 00:00:00 2001 From: tomasz t Date: Mon, 27 Dec 2021 01:31:32 +0100 Subject: [PATCH 04/24] refactored some code preparing for implementation of new functionality --- index.html | 41 ++++--- src/map.js | 191 +++--------------------------- src/osm-integration.js | 38 ++++-- src/other-ui-stuff.js | 262 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 329 insertions(+), 203 deletions(-) create mode 100644 src/other-ui-stuff.js diff --git a/index.html b/index.html index 068cbcd..b118f0d 100644 --- a/index.html +++ b/index.html @@ -76,33 +76,42 @@ - + +
diff --git a/src/osm-integration.js b/src/osm-integration.js index c9d04fe..fea21be 100644 --- a/src/osm-integration.js +++ b/src/osm-integration.js @@ -14,7 +14,12 @@ function getOpenChangesetId() { if (openChangesetId !== null) { resolve(openChangesetId); } else { - let data = ''; + let data = '' + + '' + + '' + + '' + + '' + + ''; auth.xhr({ method: 'PUT', path: '/api/0.6/changeset/create', @@ -67,13 +72,40 @@ function showDetails() { }, done); } -function log_xhr(err, res) { - if (err) console.log(err); - console.log(res); +function getNodeUrl(nodeId) { + return `${auth.options().url}/node/${nodeId}` } -function getNodeUrl(id) { - return `${auth.options().url}/node/${id}` +function renderModalMessage(newNodeUrl) { + return `

Dodano element: ${newNodeUrl}

` +} + +function renderModalErrorMessage(message) { + return `

Wystąpił błąd: ${message}

` +} + +function showSuccessModal(newNodeId) { + let modalContent = document.getElementById('modal-content'); + modalContent.innerHTML = renderModalMessage(getNodeUrl(newNodeId)); + openModal() +} + +function showFailureModal(message) { + let modalContent = document.getElementById('modal-content'); + modalContent.innerHTML = renderModalErrorMessage(message); + openModal() +} + +function openModal() { + let modal = document.getElementById('modal-div'); + modal.classList.add('is-clipped'); + modal.classList.add('is-active'); +} + +function closeModal() { + let modal = document.getElementById('modal-div'); + modal.classList.remove('is-clipped'); + modal.classList.remove('is-active'); } function addDefibrillatorToOSM(changesetId, data) { @@ -84,34 +116,45 @@ function addDefibrillatorToOSM(changesetId, data) { xml += Object.entries(data.tags).map(arr => ``).join(''); xml += ``; console.log('payload: ' + xml); - // auth.xhr({ - // method: 'PUT', - // path: '/api/0.6/node/create', - // content: data, - // options: {header: {"Content-Type": "text/xml"}}, - // }, log_xhr); - // maybe instead of log_xhr create some function to show modal/popup or something informing of added node? - // getNodeUrl(id) to get url + auth.xhr({ + method: 'PUT', + path: '/api/0.6/node/create', + content: xml, + options: {header: {"Content-Type": "text/xml"}}, + }, (err, res) => { + if (err) reject(err); + else {resolve(res); console.log(`response: ${res}`)} + }); }) } -// for testing -function sleep(ms) { - return new Promise(resolve => setTimeout(resolve, ms)); -} - -function saveNode(data) { - // maybe add some animation to button while sending xhr request is going on? +function startSaveButtonAnimation() { let saveButton = document.getElementById('sidebar-save-button'); saveButton.classList.add('is-loading'); saveButton.disabled = true; - addDefibrillatorToOSM(-1, data); - sleep(5000).then(() => { - saveButton.classList.remove('is-loading'); - saveButton.disabled = false; - }); +} -// getOpenChangesetId().then(changesetId => addDefibrillatorToOSM(changesetId, data)); +function stopSaveButtonAnimation() { + let saveButton = document.getElementById('sidebar-save-button'); + saveButton.classList.remove('is-loading'); + saveButton.disabled = false; +} + +function saveNode(data) { + startSaveButtonAnimation(); + getOpenChangesetId() + .then(changesetId => { + return addDefibrillatorToOSM(changesetId, data) + }) + .then(newNodeId => { + stopSaveButtonAnimation(); + showSuccessModal(newNodeId); + }) + .catch(err => { + stopSaveButtonAnimation(); + console.log(err); + showFailureModal(err); + }); } document.getElementById('addNode').onclick = function() { From be96beced16d161c47f134a8bd149d7393732ed1 Mon Sep 17 00:00:00 2001 From: tomasz t Date: Tue, 28 Dec 2021 21:52:39 +0100 Subject: [PATCH 08/24] changed closeModal function to remove marker and sidebar too to decrease chance of adding the same node twice --- src/osm-integration.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/osm-integration.js b/src/osm-integration.js index fea21be..395c96f 100644 --- a/src/osm-integration.js +++ b/src/osm-integration.js @@ -103,9 +103,21 @@ function openModal() { } function closeModal() { + // close modal let modal = document.getElementById('modal-div'); modal.classList.remove('is-clipped'); modal.classList.remove('is-active'); + // remove marker and close sidebar too + let sidebar = document.getElementById('sidebar-div'); + if (sidebar) { + sidebar.classList.add('is-invisible'); + if (marker !== null) { + marker.remove(); + marker = null; + } + } else { + console.log('Sidebar not found.'); + } } function addDefibrillatorToOSM(changesetId, data) { From 0f85baa98b9458caeeb34d9f0566efc0a9baf4d5 Mon Sep 17 00:00:00 2001 From: Maciej Date: Tue, 28 Dec 2021 22:01:00 +0100 Subject: [PATCH 09/24] Minor changes and refactoring --- src/osm-integration.js | 52 ++++++++++++++++----------- src/other-ui-stuff.js | 81 +++++++++++++++++++++--------------------- 2 files changed, 71 insertions(+), 62 deletions(-) diff --git a/src/osm-integration.js b/src/osm-integration.js index 9fd6342..c9f87ec 100644 --- a/src/osm-integration.js +++ b/src/osm-integration.js @@ -77,15 +77,18 @@ function showDetails() { } function getNodeUrl(nodeId) { - return `${auth.options().url}/node/${nodeId}` + return `${auth.options().url}/node/${nodeId}`; } function renderModalMessage(newNodeUrl) { - return `

Dodano element: ${newNodeUrl}

` + return ` +

AED dodany z powodzeniem: + ${newNodeUrl} +

`; } function renderModalErrorMessage(message) { - return `

Wystąpił błąd: ${message}

` + return `

Wystąpił błąd: ${message}

`; } function showSuccessModal(newNodeId) { @@ -124,10 +127,17 @@ function addDefibrillatorToOSM(changesetId, data) { method: 'PUT', path: '/api/0.6/node/create', content: xml, - options: {header: {"Content-Type": "text/xml"}}, + options: { + header: { + "Content-Type": "text/xml" + } + }, }, (err, res) => { if (err) reject(err); - else {resolve(res); console.log(`response: ${res}`)} + else { + resolve(res); + console.log(`response: ${res}`); + } }); }) } @@ -147,29 +157,29 @@ function stopSaveButtonAnimation() { function saveNode(data) { startSaveButtonAnimation(); getOpenChangesetId() - .then(changesetId => { - return addDefibrillatorToOSM(changesetId, data) - }) - .then(newNodeId => { - stopSaveButtonAnimation(); - showSuccessModal(newNodeId); - }) - .catch(err => { - stopSaveButtonAnimation(); - console.log(err); - showFailureModal(err); - }); + .then(changesetId => { + return addDefibrillatorToOSM(changesetId, data); + }) + .then(newNodeId => { + stopSaveButtonAnimation(); + showSuccessModal(newNodeId); + }) + .catch(err => { + stopSaveButtonAnimation(); + console.log(err); + showFailureModal(err); + }); } -document.getElementById('addNode').onclick = function() { +document.getElementById('addNode').onclick = function () { // add marker const mapCenter = map.getCenter(); const initialCoordinates = [mapCenter.lng, mapCenter.lat]; if (marker !== null) marker.remove(); marker = new maplibregl.Marker({ - draggable: true - }) - .setLngLat(initialCoordinates); + draggable: true + }) + .setLngLat(initialCoordinates); marker.addTo(map); // show sidebar let properties = { diff --git a/src/other-ui-stuff.js b/src/other-ui-stuff.js index 2b67186..9e6fc53 100644 --- a/src/other-ui-stuff.js +++ b/src/other-ui-stuff.js @@ -37,19 +37,19 @@ const indoorMapping = { // -------------------------------------------------------------------------------------- function defineColor(access) { - return accessToColourMapping[access] || accessToColourMapping['default'] + return accessToColourMapping[access] || accessToColourMapping['default']; } function defineAccessDescription(access) { - return accessToDescriptionMapping[access] || accessToDescriptionMapping['default'] + return accessToDescriptionMapping[access] || accessToDescriptionMapping['default']; } function defineIndoor(indoor) { - return indoorMapping[indoor] || indoorMapping['default'] + return indoorMapping[indoor] || indoorMapping['default']; } function getOsmEditLink(id) { - return `https://www.openstreetmap.org/edit?editor=id&node=${id}` + return `https://www.openstreetmap.org/edit?editor=id&node=${id}`; } function parseOpeningHours(openingHours) { @@ -107,14 +107,14 @@ function renderIfIndoor(indoor) { let beginning = '

Wewnątrz budynku?: '; let middle = defineIndoor(indoor) || 'brak informacji'; let end = '

'; - return beginning + middle + end + return beginning + middle + end; } function renderLocation(properties) { let beginning = '

Dokładna lokalizacja: '; let middle = properties['defibrillator:location:pl'] || properties['defibrillator:location'] || 'brak informacji'; let end = '

'; - return beginning + middle + end + return beginning + middle + end; } function renderDescription(properties) { @@ -128,17 +128,17 @@ function renderContactNumber(phone) { let beginning = '

Numer kontaktowy: '; let middle = phone || 'brak informacji'; let end = '

'; - return beginning + middle + end + return beginning + middle + end; } function renderAccessibleTime(openingHours) { if (openingHours) { let beginning = '

Dostępny w godzinach: '; let middle = parseOpeningHours(openingHours) || 'brak informacji '; - let end = (renderCurrentlyOpenStatus(openingHours) || '') + '

'; - return beginning + middle + end + let end = (renderCurrentlyOpenStatus(openingHours) || '') + '

'; + return beginning + middle + end; } else { - return '' + return ''; } } @@ -147,7 +147,7 @@ function renderNotes(properties) { let beginning = '

Uwagi: '; let middle = properties['note:pl'] || properties.note || 'brak uwag'; let end = '

'; - return beginning + middle + end + return beginning + middle + end; } else { return '' } @@ -167,49 +167,48 @@ function renderSidebarContent(properties) { function renderSidebarForm() { let content = ` -
- +
- -
-

Jeżeli znany

-
- -
- -
-
+
- +
- +
+
+ +
+ +
+

Pole opcjonalne

+
+ `; - return content + return content; } function renderEditButton(osm_id) { return `Dodaje brakujące informacje w OSM` + >Dodaje brakujące informacje w OSM`; } function renderSaveButton() { - return `` + return ``; } // -------------------------------------------------------------- @@ -241,9 +240,9 @@ function showSidebar(properties) { } else if (properties.action === "addNode") { prepareSidebarAddingNode(properties.data); } else - console.log(`Unknown action: ${properties.action}.`) + console.log(`Unknown action: ${properties.action}.`); } else - console.log('Sidebar not found.') + console.log('Sidebar not found.'); } function hideSidebar() { @@ -289,23 +288,23 @@ document.addEventListener('DOMContentLoaded', () => { // Check if there are any navbar burgers if ($navbarBurgers.length > 0) { - // Add a click event on each of them - $navbarBurgers.forEach( el => { - el.addEventListener('click', () => { + // Add a click event on each of them + $navbarBurgers.forEach(el => { + el.addEventListener('click', () => { - // Get the target from the "data-target" attribute - const target = el.dataset.target; - const $target = document.getElementById(target); + // Get the target from the "data-target" attribute + const target = el.dataset.target; + const $target = document.getElementById(target); - // Toggle the "is-active" class on both the "navbar-burger" and the "navbar-menu" - el.classList.toggle('is-active'); - $target.classList.toggle('is-active'); + // Toggle the "is-active" class on both the "navbar-burger" and the "navbar-menu" + el.classList.toggle('is-active'); + $target.classList.toggle('is-active'); + }); }); - }); } }); // button listeners sidebarButtonCloseIds.forEach(id => { document.getElementById(id).addEventListener('click', hideSidebar); -}); +}); \ No newline at end of file From e0e4b64a8867c4e3e6bdfaec8501b142d6a4a756 Mon Sep 17 00:00:00 2001 From: tomasz t Date: Tue, 28 Dec 2021 22:07:04 +0100 Subject: [PATCH 10/24] added check to remove marker when opening sidebar with info about existing object --- src/other-ui-stuff.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/other-ui-stuff.js b/src/other-ui-stuff.js index 9e6fc53..b089187 100644 --- a/src/other-ui-stuff.js +++ b/src/other-ui-stuff.js @@ -231,12 +231,20 @@ function prepareNodeData() { return data } +function removeMarkerIfExists() { + if (marker !== null) { + marker.remove(); + marker = null; + } +} + function showSidebar(properties) { - let sidebar = document.getElementsByClassName('sidebar')[0]; + let sidebar = document.getElementById(sidebarDivId); if (sidebar) { sidebar.classList.remove('is-invisible'); if (properties.action === "showDetails") { prepareSidebarShowingObjectInfo(properties.data); + removeMarkerIfExists(); } else if (properties.action === "addNode") { prepareSidebarAddingNode(properties.data); } else @@ -249,10 +257,7 @@ function hideSidebar() { let sidebar = document.getElementById(sidebarDivId); if (sidebar) { sidebar.classList.add('is-invisible'); - if (marker !== null) { - marker.remove(); - marker = null; - } + removeMarkerIfExists(); } else { console.log('Sidebar not found.'); } From d9ac52391b5869a789d30f511297f91e79cf8958 Mon Sep 17 00:00:00 2001 From: tomasz t Date: Tue, 28 Dec 2021 22:37:27 +0100 Subject: [PATCH 11/24] improved login and add node buttons --- index.html | 18 ++++--- src/osm-integration.js | 109 +++++++++++++++++++++-------------------- 2 files changed, 67 insertions(+), 60 deletions(-) diff --git a/index.html b/index.html index a330a9c..2a67271 100644 --- a/index.html +++ b/index.html @@ -39,6 +39,7 @@ Mapa AED + |tworzona z ❤️ przez  OpenStreetMap Polska - - - -
-

-

- Changesets: -
+
+
@@ -189,12 +203,29 @@ function renderSidebarForm() {
- -
- + +
+ +
+

Pole opcjonalne

+
+ +
+ +
+ +
+

Pole opcjonalne. Wypełnij tylko jak inny niż 112/999.

+
+ +
+ +
+ +
-

Pole opcjonalne

-
`; @@ -222,9 +253,15 @@ function prepareNodeData() { data.tags = {}; let formPhoneField = document.getElementById(formPhoneFieldId); let formLocationField = document.getElementById(formLocationFieldId); + let formEmergencyPhoneField = document.getElementById(formEmergencyPhoneFieldId); + let formLocationEnField = document.getElementById(formLocationEnFieldId); let formAccessField = document.getElementById(formAccessFieldId); - if (formPhoneFieldId.value) data.tags[formPhoneField.getAttribute('tag')] = formPhoneFieldId.value; +// let formIndoorField = document.getElementById(formIndoorFieldId); +// if (formIndoorField.value) data.tags[formIndoorField.getAttribute('tag')] = formIndoorField.getAttribute('val'); + if (formPhoneField.value) data.tags[formPhoneField.getAttribute('tag')] = formPhoneField.value; if (formLocationField.value) data.tags[formLocationField.getAttribute('tag')] = formLocationField.value; + if (formEmergencyPhoneField.value) data.tags[formEmergencyPhoneField.getAttribute('tag')] = formEmergencyPhoneField.value; + if (formLocationEnField.value) data.tags[formLocationEnField.getAttribute('tag')] = formLocationEnField.value; if (formAccessField.selectedOptions[0].getAttribute('val')) data.tags[formAccessField.getAttribute('tag')] = formAccessField.selectedOptions[0].getAttribute('val'); From 5be1f13a4fad7889e5e66e30f22196ebd9d5eb1a Mon Sep 17 00:00:00 2001 From: tomasz t Date: Wed, 29 Dec 2021 00:25:01 +0100 Subject: [PATCH 15/24] added right-click/long-touch action to add new node --- src/osm-integration.js | 34 ++++++++++++++++++++++++++++++++++ src/other-ui-stuff.js | 11 ----------- 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/src/osm-integration.js b/src/osm-integration.js index d75a2f4..f2b5a35 100644 --- a/src/osm-integration.js +++ b/src/osm-integration.js @@ -57,6 +57,16 @@ function renderModalErrorMessage(message) { return `

Wystąpił błąd: ${message}

`; } +function renderModalNeedLoginMessage() { + return `

Żeby dodawać obiekty za pomocą długiego dotknięcia/prawego przycisku myszy musisz się zalogować.

`; +} + +function renderModalNeedLogin() { + let modalContent = document.getElementById('modal-content'); + modalContent.innerHTML = renderModalNeedLoginMessage(); + openModal() +} + function showSuccessModal(newNodeId) { let modalContent = document.getElementById('modal-content'); modalContent.innerHTML = renderModalMessage(getNodeUrl(newNodeId)); @@ -167,6 +177,30 @@ document.getElementById('addNode').onclick = function () { showSidebar(properties); }; +map.on('contextmenu', function(e) { + // only trigger when logged in + if (auth.authenticated()) { + // add marker + const clickLocation = e.lngLat; + const initialCoordinates = [clickLocation.lng, clickLocation.lat]; + if (marker !== null) marker.remove(); + marker = new maplibregl.Marker({ + draggable: true + }) + .setLngLat(initialCoordinates); + marker.addTo(map); + // show sidebar + let properties = { + action: "addNode", + data: {}, + }; + showSidebar(properties); + } else { + console.log('You need to be logged in to add new nodes.'); + renderModalNeedLogin(); + } +}); + function authenticateAction() { if (!auth.bringPopupWindowToFront()) { auth.authenticate(function() { diff --git a/src/other-ui-stuff.js b/src/other-ui-stuff.js index 62e0e7b..5015975 100644 --- a/src/other-ui-stuff.js +++ b/src/other-ui-stuff.js @@ -184,17 +184,6 @@ function renderSidebarForm() {
-
From 91615c0f2375fd4815377271e7b09553c2fc4011 Mon Sep 17 00:00:00 2001 From: Maciej Date: Wed, 29 Dec 2021 16:44:37 +0100 Subject: [PATCH 16/24] UI changes, added logout --- index.html | 29 ++++++++++++++-------- src/nasz.css | 55 +++++++++++++++++++++++++++++++++++++++--- src/osm-integration.js | 47 ++++++++++++++++++++++++++---------- src/other-ui-stuff.js | 5 ++-- 4 files changed, 106 insertions(+), 30 deletions(-) diff --git a/index.html b/index.html index 58b5414..6ef5c51 100644 --- a/index.html +++ b/index.html @@ -34,7 +34,7 @@ -
+
@@ -213,6 +214,7 @@ function renderSidebarForm() {
+

Pole opcjonalne

From 3eefe0e2aaa7e564d2c1f211ad3be5dc6c2bf072 Mon Sep 17 00:00:00 2001 From: tomasz t Date: Wed, 29 Dec 2021 23:41:09 +0100 Subject: [PATCH 22/24] added indoor form field --- src/other-ui-stuff.js | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/other-ui-stuff.js b/src/other-ui-stuff.js index 5fd6598..3cd71f8 100644 --- a/src/other-ui-stuff.js +++ b/src/other-ui-stuff.js @@ -8,7 +8,7 @@ const formPhoneFieldId = 'form-phone'; const formAccessFieldId = 'form-access'; const formLocationFieldId = 'form-location'; const formLocationEnFieldId = 'form-location-en'; -//const formIndoorFieldId = 'form-indoor'; +const formIndoorFieldId = 'form-indoor'; const formEmergencyPhoneFieldId = 'form-emergency-phone'; let sidebarHeader = document.getElementById(sidebarHeaderId); @@ -184,10 +184,24 @@ function renderSidebarForm() {
+
+ +
+
+ +
+
+
+
- +
@@ -212,7 +226,8 @@ function renderSidebarForm() {
- +

Pole opcjonalne

@@ -246,8 +261,9 @@ function prepareNodeData() { let formEmergencyPhoneField = document.getElementById(formEmergencyPhoneFieldId); let formLocationEnField = document.getElementById(formLocationEnFieldId); let formAccessField = document.getElementById(formAccessFieldId); -// let formIndoorField = document.getElementById(formIndoorFieldId); -// if (formIndoorField.value) data.tags[formIndoorField.getAttribute('tag')] = formIndoorField.getAttribute('val'); + let formIndoorField = document.getElementById(formIndoorFieldId); + if (formIndoorField.selectedOptions[0].getAttribute('val')) + data.tags[formIndoorField.getAttribute('tag')] = formIndoorField.selectedOptions[0].getAttribute('val'); if (formPhoneField.value) data.tags[formPhoneField.getAttribute('tag')] = formPhoneField.value; if (formLocationField.value) data.tags[formLocationField.getAttribute('tag')] = formLocationField.value; if (formEmergencyPhoneField.value) data.tags[formEmergencyPhoneField.getAttribute('tag')] = formEmergencyPhoneField.value; From f67c2d0022283ac7a5252af6919f8b95c5863605 Mon Sep 17 00:00:00 2001 From: tomasz t Date: Wed, 29 Dec 2021 23:42:45 +0100 Subject: [PATCH 23/24] fixed dropdown colour --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 1f9e5e2..e03ba4e 100644 --- a/index.html +++ b/index.html @@ -71,7 +71,7 @@ -