diff --git a/src/_locales/cmn-CN.yml b/src/_locales/cmn-CN.yml index e6a00a0a..021568e3 100644 --- a/src/_locales/cmn-CN.yml +++ b/src/_locales/cmn-CN.yml @@ -323,6 +323,9 @@ history: 你确定要开启观看历史吗? favorites: unfavorite: 取消收藏 + unfavorite_confirm: |- + 要取消收藏选中的视频吗? + 该操作无法撤销,你确定要取消收藏选中的视频吗? watch_later: title: 稍后再看 clear_all: 清空稍后再看 diff --git a/src/_locales/cmn-TW.yml b/src/_locales/cmn-TW.yml index 389e6afa..8f05bbd3 100644 --- a/src/_locales/cmn-TW.yml +++ b/src/_locales/cmn-TW.yml @@ -326,6 +326,9 @@ history: 你確定要啟用觀看記錄嗎? favorites: unfavorite: 取消收藏 + unfavorite_confirm: |- + 要取消收藏選中的影片嗎? + 此操作無法撤消,你確定要取消收藏選中的影片嗎? watch_later: title: 稍後觀看 clear_all: 清空稍後觀看 diff --git a/src/_locales/en.yml b/src/_locales/en.yml index c9f8fe3e..5200e5fe 100644 --- a/src/_locales/en.yml +++ b/src/_locales/en.yml @@ -322,6 +322,9 @@ history: turn_on_watch_history_confirm: Turn on watch history? Are you sure you want to turn on watch history? favorites: unfavorite: Unfavorite + unfavorite_confirm: |- + Remove selected video(s)? + This operation cannot be reversed. Are you sure you want to remove the selected video(s) from your favorites? watch_later: title: Watch Later clear_all: Clear all watch later diff --git a/src/_locales/jyut.yml b/src/_locales/jyut.yml index 82908795..4d2f471d 100644 --- a/src/_locales/jyut.yml +++ b/src/_locales/jyut.yml @@ -325,7 +325,10 @@ history: 係咪要開返收睇記錄呀? 你確定要開返收睇記錄? favorites: - unfavorite: 唔再愛喇 + unfavorite: 唔愛喇 + unfavorite_confirm: |- + 係咪要剷走你揀過啲片呀? + 噉做冇得返轉頭噃,你確定要剷走你揀過啲片? watch_later: title: 陣間至睇 clear_all: 剷曬陣間至睇啲片 diff --git a/src/contentScripts/views/Favorites/Favorites.vue b/src/contentScripts/views/Favorites/Favorites.vue index a12d0f24..8ce79a1b 100644 --- a/src/contentScripts/views/Favorites/Favorites.vue +++ b/src/contentScripts/views/Favorites/Favorites.vue @@ -164,14 +164,19 @@ function jumpToLoginPage() { } function handleUnfavorite(favoriteResource: FavoriteResource) { - api.favorite.patchDelFavoriteResources({ - resources: `${favoriteResource.id}:${favoriteResource.type}`, - media_id: selectedCategory.value?.id, - csrf: getCSRF(), - }).then((res) => { - if (res.code === 0) - favoriteResources.splice(favoriteResources.indexOf(favoriteResource as FavoriteItem), 1) - }) + const result = confirm( + t('favorites.unfavorite_confirm'), + ) + if (result) { + api.favorite.patchDelFavoriteResources({ + resources: `${favoriteResource.id}:${favoriteResource.type}`, + media_id: selectedCategory.value?.id, + csrf: getCSRF(), + }).then((res) => { + if (res.code === 0) + favoriteResources.splice(favoriteResources.indexOf(favoriteResource as FavoriteItem), 1) + }) + } } function isMusic(item: FavoriteResource) {