Change some logic.

This commit is contained in:
FireMaskterK 2021-10-07 23:39:38 +01:00
parent 38938656dc
commit 0a8768194b
No known key found for this signature in database
GPG key ID: 49451E4482CC5BCD

View file

@ -55,8 +55,8 @@
</a> </a>
<router-link <router-link
:to="toggleListenUrl" :to="toggleListenUrl"
:aria-label="(isListening ? 'watch ' : 'listen to ') + video.title" :aria-label="(isListening ? 'Watch ' : 'Listen to ') + video.title"
:title="(isListening ? 'watch ' : 'listen to ') + video.title" :title="(isListening ? 'Watch ' : 'Listen to ') + video.title"
class="uk-margin-small-left uk-button uk-button-small" class="uk-margin-small-left uk-button uk-button-small"
> >
<font-awesome-icon icon="headphones"></font-awesome-icon> <font-awesome-icon icon="headphones"></font-awesome-icon>
@ -318,15 +318,10 @@ export default {
}, },
}, },
computed: { computed: {
isListening(_this) {
const listenQueryParam = _this.$route.query.listen;
return listenQueryParam === "1";
},
toggleListenUrl(_this) { toggleListenUrl(_this) {
const newUrl = _this.isListening const url = new URL(window.location.href);
? _this.$route.fullPath.replace(/(listen=1&?)|(&?listen=1)/, "") url.searchParams.set("listen", _this.getPreferenceBoolean("listen", false) ? "0" : "1");
: `${_this.$route.fullPath}&listen=1`; return url.href;
return newUrl;
}, },
isEmbed(_this) { isEmbed(_this) {
return String(_this.$route.path).indexOf("/embed/") == 0; return String(_this.$route.path).indexOf("/embed/") == 0;