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

View File

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