diff --git a/src/routes/Channel.vue b/src/routes/Channel.vue index f838c1e..8363ca1 100644 --- a/src/routes/Channel.vue +++ b/src/routes/Channel.vue @@ -138,15 +138,19 @@ export default { tab.originalName = tab.name switch (tab.name) { case 'Livestreams': + case 'livestreams': tab.name = this.$t('channel_tabs.livestreams') break case 'Playlists': + case 'playlists': tab.name = this.$t('channel_tabs.playlists') break case 'Channels': + case 'channels': tab.name = this.$t('channel_tabs.channels') break case 'Shorts': + case 'shorts': tab.name = this.$t('channel_tabs.shorts') break } diff --git a/src/routes/FeedPage.vue b/src/routes/FeedPage.vue index ffefb39..f19fc05 100644 --- a/src/routes/FeedPage.vue +++ b/src/routes/FeedPage.vue @@ -159,7 +159,14 @@ export default { computed: { currentVideos () { const start = (this.currentPage - 1) * PAGE_SIZE - return this.videos.slice(start, start + PAGE_SIZE) + let out = this.videos.slice(start, start + PAGE_SIZE) + + const isShortsFilterEnabled = this.$store.getters['prefs/getPreferenceBoolean']('filterOutShortsInFeedPage', false) + if (isShortsFilterEnabled) { + out = out.filter(v => v.isShort === false) + } + + return out } }, components: { diff --git a/src/routes/Preferences.vue b/src/routes/Preferences.vue index 33e5a69..3ae1cea 100644 --- a/src/routes/Preferences.vue +++ b/src/routes/Preferences.vue @@ -190,6 +190,16 @@ export default { type: 'bool', default: false }, + { + id: 'filterOutShortsInFeedPage', + type: 'bool', + default: false + }, + { + id: 'filterOutShortsInSearchResults', + type: 'bool', + default: false + }, { id: 'showRelatedVideos', type: 'bool', diff --git a/src/routes/SearchResults.vue b/src/routes/SearchResults.vue index eb4aa8e..618456d 100644 --- a/src/routes/SearchResults.vue +++ b/src/routes/SearchResults.vue @@ -12,9 +12,9 @@ /> -
+
- + @@ -51,7 +51,7 @@ export default { }, mounted () { - this.updateResults() + this.fetchResults() }, computed: { @@ -73,31 +73,41 @@ export default { text: this.$t('search_results.result_types.' + name), value: name })) + }, + + filteredResults () { + let out = this.results?.items + if (out == null) { + return [] + } + + const isShortsFilterEnabled = this.$store.getters['prefs/getPreferenceBoolean']('filterOutShortsInSearchResults', false) + if (isShortsFilterEnabled) { + out = out.filter(v => v.isShort === false) + } + + return out.map(sr => ({ + title: sr.name, + uploaderName: sr.uploader, + uploadedDate: sr.uploadDate, + ...sr + })) } }, watch: { // For history navigation '$route.query.search_query' () { - this.updateResults() + this.fetchResults() }, '$route.query.filter' () { - this.updateResults() + this.fetchResults() } }, methods: { - rationalizeSearchResult (sr) { - return { - title: sr.name, - uploaderName: sr.uploader, - uploadedDate: sr.uploadDate, - ...sr - } - }, - async fetchResults () { - return this.$store.dispatch('auth/makeRequest', { + this.results = await this.$store.dispatch('auth/makeRequest', { path: 'search', params: { q: this.$route.query.search_query, @@ -106,12 +116,6 @@ export default { }) }, - async updateResults () { - this.results = this.fetchResults().then(json => { - json.items = json.items.map(this.rationalizeSearchResult) - this.results = json - }) - }, onSearchResultsEndIntersect (entries) { if (entries[0].isIntersecting) { this.fetchMoreResults() @@ -129,7 +133,7 @@ export default { }).then(json => { this.results.nextpage = json.nextpage this.results.id = json.id - this.results.items = this.results.items.concat(json.items.map(this.rationalizeSearchResult)) + this.results.items = this.results.items.concat(json.items) }) } } diff --git a/src/store/prefs-store.js b/src/store/prefs-store.js index ff138c1..c0225f4 100644 --- a/src/store/prefs-store.js +++ b/src/store/prefs-store.js @@ -22,6 +22,8 @@ const PrefsStore = { clickbaitThumbnailAvoidance: false, disableDuplicateHistoryEntries: false, + filterOutShortsInFeedPage: false, + filterOutShortsInSearchResults: false, disableCommentsByDefault: false, showRelatedVideos: true, showMarkers: true, diff --git a/src/translations/bn-IN.json b/src/translations/bn-IN.json index 068d2a3..8bcd49b 100644 --- a/src/translations/bn-IN.json +++ b/src/translations/bn-IN.json @@ -6,7 +6,7 @@ "feed": "আপনার feed", "preferences": "পছন্দ অনুযায়ী মানিয়ে নিন", "history": "দেখার ইতিহাস", - "playlists": "videoএর তালিকা" + "playlists": "videoর তালিকা" }, "visibilities": { "unlisted": "অপ্রচারিত" @@ -119,12 +119,14 @@ "homepage": "website খোলার পর গতানুগতিক কী দেখবেন", "homepageButton": "আপনি কী গোড়াতে ফিরে যাওয়ার জন্য আরেকটি বোতাম চান?", "instance": "আমাদের প্রতিনিধি যে YouTube এর সঙ্গে সব যোগাযোগ এর নিয়ন্ত্রণ আর দেখাশোনা করবে", - "clickbaitThumbnailAvoidance": "videoএর যে thumbnail আছে সেটি কি একতা স্বয়ংক্রিয়ভাবে বানানো thumbnail দিয়ে প্রতিস্থাপন করে দেব?", + "clickbaitThumbnailAvoidance": "videoর যে thumbnail আছে সেটি কি একতা স্বয়ংক্রিয়ভাবে বানানো thumbnail দিয়ে প্রতিস্থাপন করে দেব?", "showRelatedVideos": "আপনি কি videoর সঙ্গে অন্য সম্পর্কিত বা প্রস্তাবিত video দেখতে চান?", "showMarkers": "আপনি কি বিজ্ঞাপনের (ও অন্য বিভ্রান্তিকর জিনিসের) চিহ্নিতকারী দেখতে চান?", "bufferGoal": "কত সেকেণ্ডের data এনে রাখব যাতে আপানাকে অপেক্ষা না করতে হয়?", "disableCommentsByDefault": "মন্তব্য দেখানোর জন্য আপনার অনুমতি কি চাওয়া হবে?", "disableDuplicateHistoryEntries": "আপনি যদি একটি video অতীতে দেখে থাকেন তাহলে কি আর ইতিহাস এ অনুলিপি যোগ করব না, শুধু মাত্র কতটা আর কখন দেখেছেন সেটা নবীকরণ করব?", + "filterOutShortsInFeedPage": "আপনি কি সব YouTube Shorts (ছোট video) গুলো কে আপনার feed (সদস্যিত channelদের videoর তালিকা) থেকে পরিস্রুত করাতে চান?", + "filterOutShortsInSearchResults": "আপনি কি সব YouTube Shorts (ছোট video) গুলো কে আপনার search results (খোঁজ করা videoর ফলাফল) থেকে পরিস্রুত করাতে চান?", "quality_opts": { "auto": "আপনার অন্তর্জালের গতি অনুযায়ী", "144p": "১৪৪ বিন্দু আরোহ", @@ -155,7 +157,7 @@ "all": "সব ধরণের ফলাফল", "videos": "সাধারণ video", "channels": "সুধু channel", - "playlists": "সুধু videoএর তালিকা", + "playlists": "সুধু videoর তালিকা", "music_songs": "সুধু গান (YouTube Music থেকে)", "music_videos": "সুধু গানের video (YouTube Music)", "music_albums": "সুধু গানের পঞ্জি (album) (YouTube Music থেকে)", @@ -163,7 +165,7 @@ } }, "channel_tabs": { - "playlists": "videoএর তালিকা", + "playlists": "videoর তালিকা", "shorts": "ছোট video", "videos": "সাধারণ video", "livestreams": "সরাসরি সম্প্রচারিত video", diff --git a/src/translations/en.json b/src/translations/en.json index 617ec5a..6a36936 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -148,6 +148,8 @@ "showRelatedVideos": "Show Related Videos", "showMarkers": "Show SponsorBlock Markers", "disableDuplicateHistoryEntries": "Disable creation of duplicate watch history entries", + "filterOutShortsInFeedPage": "Filter out YT shorts in the feed pages (trending, feed, etc.)", + "filterOutShortsInSearchResults": "Filter out YT shorts in the search result pages", "quality_opts": { "auto": "Automatically determined", "144p": "144p",