From 09ffea8a449bf56749ca763e016e5136731032cd Mon Sep 17 00:00:00 2001 From: UK <41271523+NeloBlivion@users.noreply.github.com> Date: Tue, 14 Nov 2023 00:49:17 +0000 Subject: [PATCH] reworked fix --- src/views/MultiView.vue | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/src/views/MultiView.vue b/src/views/MultiView.vue index 0e0d8f26c..56736e556 100644 --- a/src/views/MultiView.vue +++ b/src/views/MultiView.vue @@ -375,7 +375,9 @@ export default { // show the dialog this.overwriteDialog = true; }, - handleToolbarClick(video) { + handleToolbarClick(v) { + const video = this.checkStreamType(v); + if (!video) return; const hasEmptyCell = this.findEmptyCell(); // more cells needed, increment to next preset with space if (!hasEmptyCell) { @@ -397,21 +399,13 @@ export default { } }, handleVideoClicked(v) { - let video = v; - if (video.type === "placeholder") { - const twitchChannel = video.link.match(TWITCH_VIDEO_URL_REGEX)?.groups.id; - if (!twitchChannel) return; - video = { - ...video, - id: twitchChannel, - type: "twitch", - }; - } if (this.showSelectorForId < -1) { - this.handleToolbarClick(video); + this.handleToolbarClick(v); this.showSelectorForId = -1; return; } + const video = this.checkStreamType(v); + if (!video) return; this.addVideoWithId(video, this.showSelectorForId); this.showSelectorForId = -1; }, @@ -442,6 +436,19 @@ export default { toggleSyncBar() { this.showSyncBar = !this.showSyncBar; }, + checkStreamType(v) { + let video = v; + if (video.type === "placeholder") { + const twitchChannel = video.link.match(TWITCH_VIDEO_URL_REGEX)?.groups.id; + if (!twitchChannel) return; + video = { + ...video, + id: twitchChannel, + type: "twitch", + }; + } + return video; + } }, };