Prevent middle click from opening URLs within the app

This commit is contained in:
PrestonN 2022-01-10 21:16:50 -05:00
parent 24265613e7
commit 2be2301d92
2 changed files with 46 additions and 37 deletions

View File

@ -41,7 +41,6 @@ export default Vue.extend({
latestBlogUrl: '',
updateChangelog: '',
changeLogTitle: '',
lastExternalLinkToBeOpened: '',
showExternalLinkOpeningPrompt: false,
externalLinkOpeningPromptValues: [
@ -313,6 +312,15 @@ export default Vue.extend({
openAllLinksExternally: function () {
$(document).on('click', 'a[href^="http"]', (event) => {
this.handleLinkClick(event)
})
$(document).on('auxclick', 'a[href^="http"]', (event) => {
this.handleLinkClick(event)
})
},
handleLinkClick: function (event) {
const el = event.currentTarget
console.log(this.usingElectron)
console.log(el)
@ -338,7 +346,6 @@ export default Vue.extend({
// Open links externally
this.openExternalLink(el.href)
}
})
},
handleYoutubeLink: function (href) {
@ -445,15 +452,16 @@ export default Vue.extend({
}
},
...mapMutations([
'setInvidiousInstancesList'
]),
setWindowTitle: function() {
if (this.windowTitle !== null) {
document.title = this.windowTitle
}
},
...mapMutations([
'setInvidiousInstancesList'
]),
...mapActions([
'showToast',
'openExternalLink',

View File

@ -1620,12 +1620,6 @@ export default Vue.extend({
}
},
...mapActions([
'calculateColorLuminance',
'updateDefaultCaptionSettings',
'showToast',
'sponsorBlockSkipSegments'
]),
addPlayerStatsEvent: function() {
this.stats.videoId = this.videoId
this.player.on('volumechange', () => {
@ -1704,6 +1698,13 @@ export default Vue.extend({
break
}
}
}
},
...mapActions([
'calculateColorLuminance',
'updateDefaultCaptionSettings',
'showToast',
'sponsorBlockSkipSegments'
])
}
})