Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions core/frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -797,10 +797,28 @@ export default Vue.extend({

const body = document.querySelector('body')
body?.addEventListener('click', (event) => {
if (event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return

const target = event.target as HTMLElement
if (target.offsetParent !== this.$refs.contextMenu) {
this.context_menu_visible = false
}

// Force all external links to open in a new tab
const anchor = target.closest('a')
if (!anchor || anchor.target === '_blank') return
const href = anchor.getAttribute('href')
if (!href) return
try {
const url = new URL(href, window.location.origin)
if (!['http:', 'https:'].includes(url.protocol)) return
if (url.origin !== window.location.origin) {
event.preventDefault()
window.open(href, '_blank', 'noopener,noreferrer')
}
} catch {
// Invalid URL, ignore
}
Comment thread
sourcery-ai[bot] marked this conversation as resolved.
})
this.bootstrap_version = await VCU.loadBootstrapCurrentVersion()
},
Expand Down
3 changes: 2 additions & 1 deletion core/frontend/src/components/nmea-injector/NMEAInjector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ export default Vue.extend({
this.show_creation_dialog = true
},
createLink(sentence: string): string {
return `<a href="http://aprs.gids.nl/nmea/#${sentence.toLowerCase().substring(2)}">${sentence}</a>`
const id = sentence.toLowerCase().substring(2)
return `<a href="http://aprs.gids.nl/nmea/#${id}" target="_blank" rel="noopener noreferrer">${sentence}</a>`
},
},
})
Expand Down