Prettier on popup.js
This commit is contained in:
parent
50e8161b89
commit
a4dbb69545
1 changed files with 42 additions and 8 deletions
|
@ -271,7 +271,11 @@ L.U.PopupTemplate.OSM = L.U.PopupTemplate.Default.extend({
|
||||||
title.style.backgroundColor = color
|
title.style.backgroundColor = color
|
||||||
const iconUrl = this.feature.getDynamicOption('iconUrl')
|
const iconUrl = this.feature.getDynamicOption('iconUrl')
|
||||||
let icon
|
let icon
|
||||||
if (L.Util.isPath(iconUrl) || L.Util.isRemoteUrl(iconUrl) || L.Util.isDataImage(iconUrl)) {
|
if (
|
||||||
|
L.Util.isPath(iconUrl) ||
|
||||||
|
L.Util.isRemoteUrl(iconUrl) ||
|
||||||
|
L.Util.isDataImage(iconUrl)
|
||||||
|
) {
|
||||||
icon = L.DomUtil.add('img', 'popup-icon', title)
|
icon = L.DomUtil.add('img', 'popup-icon', title)
|
||||||
icon.src = iconUrl
|
icon.src = iconUrl
|
||||||
} else {
|
} else {
|
||||||
|
@ -291,29 +295,59 @@ L.U.PopupTemplate.OSM = L.U.PopupTemplate.Default.extend({
|
||||||
const number = props['addr:housenumber']
|
const number = props['addr:housenumber']
|
||||||
if (number) {
|
if (number) {
|
||||||
// Poor way to deal with international forms of writting addresses
|
// Poor way to deal with international forms of writting addresses
|
||||||
L.DomUtil.add('span', '', row, `${L._("No.")}: ${number}`)
|
L.DomUtil.add('span', '', row, `${L._('No.')}: ${number}`)
|
||||||
L.DomUtil.add('span', '', row, `${L._("Street")}: ${street}`)
|
L.DomUtil.add('span', '', row, `${L._('Street')}: ${street}`)
|
||||||
} else {
|
} else {
|
||||||
L.DomUtil.add('span', '', row, street)
|
L.DomUtil.add('span', '', row, street)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (props.website) {
|
if (props.website) {
|
||||||
L.DomUtil.element('a', {href: props.website, textContent: props.website}, container)
|
L.DomUtil.element(
|
||||||
|
'a',
|
||||||
|
{ href: props.website, textContent: props.website },
|
||||||
|
container
|
||||||
|
)
|
||||||
}
|
}
|
||||||
const phone = props.phone || props['contact:phone']
|
const phone = props.phone || props['contact:phone']
|
||||||
if (phone) {
|
if (phone) {
|
||||||
L.DomUtil.add('div', '', container, L.DomUtil.element('a', {href: `tel:${phone}`, textContent: phone}))
|
L.DomUtil.add(
|
||||||
|
'div',
|
||||||
|
'',
|
||||||
|
container,
|
||||||
|
L.DomUtil.element('a', { href: `tel:${phone}`, textContent: phone })
|
||||||
|
)
|
||||||
}
|
}
|
||||||
if (props.mobile) {
|
if (props.mobile) {
|
||||||
L.DomUtil.add('div', '', container, L.DomUtil.element('a', {href: `tel:${props.mobile}`, textContent: props.mobile}))
|
L.DomUtil.add(
|
||||||
|
'div',
|
||||||
|
'',
|
||||||
|
container,
|
||||||
|
L.DomUtil.element('a', {
|
||||||
|
href: `tel:${props.mobile}`,
|
||||||
|
textContent: props.mobile,
|
||||||
|
})
|
||||||
|
)
|
||||||
}
|
}
|
||||||
const email = props.email || props['contact:email']
|
const email = props.email || props['contact:email']
|
||||||
if (email) {
|
if (email) {
|
||||||
L.DomUtil.add('div', '', container, L.DomUtil.element('a', {href: `mailto:${email}`, textContent: email}))
|
L.DomUtil.add(
|
||||||
|
'div',
|
||||||
|
'',
|
||||||
|
container,
|
||||||
|
L.DomUtil.element('a', { href: `mailto:${email}`, textContent: email })
|
||||||
|
)
|
||||||
}
|
}
|
||||||
const id = props['@id']
|
const id = props['@id']
|
||||||
if (id) {
|
if (id) {
|
||||||
L.DomUtil.add('div', 'osm-link', container, L.DomUtil.element('a', {href: `https://www.openstreetmap.org/${id}`, textContent: L._('See on OpenStreetMap')}))
|
L.DomUtil.add(
|
||||||
|
'div',
|
||||||
|
'osm-link',
|
||||||
|
container,
|
||||||
|
L.DomUtil.element('a', {
|
||||||
|
href: `https://www.openstreetmap.org/${id}`,
|
||||||
|
textContent: L._('See on OpenStreetMap'),
|
||||||
|
})
|
||||||
|
)
|
||||||
}
|
}
|
||||||
return container
|
return container
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue