Add config option to control the map provider link
This commit is contained in:
+12
-10
@@ -298,16 +298,18 @@ function renderLocation (exif: GalleryExif): HTMLElement {
|
||||
coords.textContent = exif.latitude.toFixed(5) + ', ' + exif.longitude.toFixed(5)
|
||||
body.appendChild(coords)
|
||||
|
||||
const link = document.createElement('a')
|
||||
link.className = 'ipp-sidebar-osm'
|
||||
link.href = 'https://www.openstreetmap.org/?mlat=' + exif.latitude +
|
||||
'&mlon=' + exif.longitude +
|
||||
'#map=15/' + exif.latitude + '/' + exif.longitude
|
||||
link.target = '_blank'
|
||||
// noreferrer suppresses the Referer header so the share URL doesn't end up in OSM's webserver logs
|
||||
link.rel = 'noopener noreferrer'
|
||||
link.textContent = 'Open in OpenStreetMap'
|
||||
body.appendChild(link)
|
||||
if (state.metadataConfig.locationWebLink) {
|
||||
const link = document.createElement('a')
|
||||
link.className = 'ipp-sidebar-osm'
|
||||
link.href = 'https://www.openstreetmap.org/?mlat=' + exif.latitude +
|
||||
'&mlon=' + exif.longitude +
|
||||
'#map=15/' + exif.latitude + '/' + exif.longitude
|
||||
link.target = '_blank'
|
||||
// noreferrer suppresses the Referer header so the share URL doesn't end up in the map provider's webserver logs
|
||||
link.rel = 'noopener noreferrer'
|
||||
link.textContent = 'Open in OpenStreetMap'
|
||||
body.appendChild(link)
|
||||
}
|
||||
}
|
||||
|
||||
wrap.appendChild(body)
|
||||
|
||||
@@ -82,7 +82,8 @@ export const state = {
|
||||
metadataConfig: {
|
||||
descriptionInCaption: false,
|
||||
descriptionInSidebar: false,
|
||||
sidebarHasContent: false
|
||||
sidebarHasContent: false,
|
||||
locationWebLink: false
|
||||
} as MetadataConfig,
|
||||
// True while our pushed history entry is live
|
||||
lightboxPushedHistory: false,
|
||||
|
||||
@@ -41,6 +41,7 @@ export async function gallery (res: Response, share: SharedLink, openItem?: numb
|
||||
const descriptionInSidebar = !!getConfigOption('ipp.showMetadata.description.sidebar', false)
|
||||
const exifGroupEnabled = !!getConfigOption('ipp.showMetadata.exif.enabled', false)
|
||||
const locationGroupEnabled = !!getConfigOption('ipp.showMetadata.location.enabled', false)
|
||||
const locationWebLink = locationGroupEnabled && !!getConfigOption('ipp.showMetadata.location.webLink', true)
|
||||
const sidebarHasContent = descriptionInSidebar || exifGroupEnabled || locationGroupEnabled
|
||||
|
||||
// Build structured items in parallel
|
||||
@@ -134,7 +135,8 @@ export async function gallery (res: Response, share: SharedLink, openItem?: numb
|
||||
metadataConfig: {
|
||||
descriptionInCaption,
|
||||
descriptionInSidebar,
|
||||
sidebarHasContent
|
||||
sidebarHasContent,
|
||||
locationWebLink
|
||||
},
|
||||
groupByDate
|
||||
}
|
||||
|
||||
@@ -73,6 +73,7 @@ export interface MetadataConfig {
|
||||
descriptionInCaption: boolean
|
||||
descriptionInSidebar: boolean
|
||||
sidebarHasContent: boolean
|
||||
locationWebLink: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user