Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to change thumbnail appearance #3890

Merged
merged 15 commits into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/renderer/assets/img/thumbnail_placeholder.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default defineComponent({
'ft-settings-section': FtSettingsSection,
'ft-toggle-switch': FtToggleSwitch,
'ft-input-tags': FtInputTags,
'ft-flex-box': FtFlexBox
'ft-flex-box': FtFlexBox,
},
computed: {
hideVideoViews: function () {
Expand Down Expand Up @@ -92,6 +92,12 @@ export default defineComponent({
showDistractionFreeTitles: function () {
return this.$store.getters.getShowDistractionFreeTitles
},
thumbnailPreference: function () {
return this.$store.getters.getThumbnailPreference
},
blurThumbnails: function () {
return this.$store.getters.getBlurThumbnails
},
channelsHidden: function () {
return JSON.parse(this.$store.getters.getChannelsHidden)
},
Expand Down Expand Up @@ -144,7 +150,8 @@ export default defineComponent({
'updateHideChannelReleases',
'updateHideSubscriptionsVideos',
'updateHideSubscriptionsShorts',
'updateHideSubscriptionsLive'
'updateHideSubscriptionsLive',
'updateBlurThumbnails'
])
}
})
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,13 @@
:default-value="hideSharingActions"
@change="updateHideSharingActions"
/>
<ft-toggle-switch
:label="$t('Settings.Distraction Free Settings.Blur Thumbnails')"
:compact="true"
:default-value="blurThumbnails && thumbnailPreference !== 'hidden'"
:disabled="thumbnailPreference === 'hidden'"
v-on="thumbnailPreference === 'hidden' ? { change: updateBlurThumbnails(false) } : { change: updateBlurThumbnails}"
/>
</div>
<div class="switchColumn">
<ft-toggle-switch
Expand Down
24 changes: 22 additions & 2 deletions src/renderer/components/ft-list-playlist/ft-list-playlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,18 @@ export default defineComponent({

defaultPlayback: function () {
return this.$store.getters.getDefaultPlayback
},

blurThumbnails: function () {
return this.$store.getters.getBlurThumbnails
},

blurThumbnailsStyle: function () {
return this.blurThumbnails ? 'blur(20px)' : null
},

thumbnailPreference: function () {
return this.$store.getters.getThumbnailPreference
}
},
created: function () {
Expand All @@ -67,7 +79,11 @@ export default defineComponent({

parseInvidiousData: function () {
this.title = this.data.title
this.thumbnail = this.data.playlistThumbnail.replace('https://i.ytimg.com', this.currentInvidiousInstance).replace('hqdefault', 'mqdefault')
if (this.thumbnailPreference === 'hidden') {
this.thumbnail = require('../../assets/img/thumbnail_placeholder.svg')
} else {
this.thumbnail = this.data.playlistThumbnail.replace('https://i.ytimg.com', this.currentInvidiousInstance).replace('hqdefault', 'mqdefault')
}
this.channelName = this.data.author
this.channelId = this.data.authorId
this.playlistId = this.data.playlistId
Expand All @@ -80,7 +96,11 @@ export default defineComponent({

parseLocalData: function () {
this.title = this.data.title
this.thumbnail = this.data.thumbnail
if (this.thumbnailPreference === 'hidden') {
this.thumbnail = require('../../assets/img/thumbnail_placeholder.svg')
} else {
this.thumbnail = this.data.thumbnail
}
this.channelName = this.data.channelName
this.channelId = this.data.channelId
this.playlistId = this.data.playlistId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
alt=""
:src="thumbnail"
class="thumbnailImage"
:style="{filter: blurThumbnailsStyle}"
>
</router-link>
<div
Expand Down
10 changes: 10 additions & 0 deletions src/renderer/components/ft-list-video/ft-list-video.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@ export default defineComponent({
return this.$store.getters.getThumbnailPreference
},

blurThumbnails: function () {
return this.$store.getters.getBlurThumbnails
},

blurThumbnailsStyle: function () {
return this.blurThumbnails ? 'blur(20px)' : null
},

backendPreference: function () {
return this.$store.getters.getBackendPreference
},
Expand Down Expand Up @@ -239,6 +247,8 @@ export default defineComponent({
return `${baseUrl}/vi/${this.id}/mq2.jpg`
case 'end':
return `${baseUrl}/vi/${this.id}/mq3.jpg`
case 'hidden':
return require('../../assets/img/thumbnail_placeholder.svg')
default:
return `${baseUrl}/vi/${this.id}/mqdefault.jpg`
}
Expand Down
1 change: 1 addition & 0 deletions src/renderer/components/ft-list-video/ft-list-video.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
:src="thumbnail"
class="thumbnailImage"
alt=""
:style="{filter: blurThumbnailsStyle}"
>
</router-link>
<div
Expand Down
6 changes: 4 additions & 2 deletions src/renderer/components/general-settings/general-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ export default defineComponent({
'',
'start',
'middle',
'end'
'end',
'hidden'
],
externalLinkHandlingValues: [
'',
Expand Down Expand Up @@ -137,7 +138,8 @@ export default defineComponent({
this.$t('Settings.General Settings.Thumbnail Preference.Default'),
this.$t('Settings.General Settings.Thumbnail Preference.Beginning'),
this.$t('Settings.General Settings.Thumbnail Preference.Middle'),
this.$t('Settings.General Settings.Thumbnail Preference.End')
this.$t('Settings.General Settings.Thumbnail Preference.End'),
this.$t('Settings.General Settings.Thumbnail Preference.Hidden')
]
},

Expand Down
11 changes: 11 additions & 0 deletions src/renderer/components/playlist-info/playlist-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ export default defineComponent({
return this.$store.getters.getThumbnailPreference
},

blurThumbnails: function () {
return this.$store.getters.getBlurThumbnails
},

blurThumbnailsStyle: function () {
return this.blurThumbnails ? 'blur(20px)' : null
},

backendPreference: function () {
return this.$store.getters.getBackendPreference
},
Expand All @@ -51,6 +59,9 @@ export default defineComponent({
},

thumbnail: function () {
if (this.thumbnailPreference === 'hidden') {
return require('../../assets/img/thumbnail_placeholder.svg')
}
da-batt marked this conversation as resolved.
Show resolved Hide resolved
let baseUrl
if (this.backendPreference === 'invidious') {
baseUrl = this.currentInvidiousInstance
Expand Down
1 change: 1 addition & 0 deletions src/renderer/components/playlist-info/playlist-info.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<img
:src="thumbnail"
alt=""
:style="{filter: blurThumbnailsStyle}"
>
</router-link>
</div>
Expand Down
1 change: 1 addition & 0 deletions src/renderer/scss-partials/_ft-list-item.scss
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ $watched-transition-duration: 0.5s;

.thumbnailLink {
display: flex;
overflow: hidden;
}

.thumbnailImage {
Expand Down
1 change: 1 addition & 0 deletions src/renderer/store/modules/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ const state = {
skip: 'doNothing'
},
thumbnailPreference: '',
blurThumbnails: false,
useProxy: false,
useRssFeeds: false,
useSponsorBlock: false,
Expand Down
2 changes: 2 additions & 0 deletions static/locales/en-US.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ Settings:
Beginning: Beginning
Middle: Middle
End: End
Hidden: Hidden
Current Invidious Instance: Current Invidious Instance
The currently set default instance is {instance}: The currently set default instance is {instance}
No default instance has been set: No default instance has been set
Expand Down Expand Up @@ -332,6 +333,7 @@ Settings:
Channel Page: Channel Page
Watch Page: Watch Page
General: General
Blur Thumbnails: Blur Thumbnails
Hide Video Views: Hide Video Views
Hide Video Likes And Dislikes: Hide Video Likes And Dislikes
Hide Channel Subscribers: Hide Channel Subscribers
Expand Down