Add toggle for search suggestions
This commit is contained in:
parent
6a81f662bb
commit
6e5a1a1085
|
@ -552,6 +552,9 @@ export default Vue.extend({
|
||||||
invidiousInstance: function () {
|
invidiousInstance: function () {
|
||||||
return this.$store.getters.getInvidiousInstance
|
return this.$store.getters.getInvidiousInstance
|
||||||
},
|
},
|
||||||
|
enableSearchSuggestions: function () {
|
||||||
|
return this.$store.getters.getEnableSearchSuggestions
|
||||||
|
},
|
||||||
backendFallback: function () {
|
backendFallback: function () {
|
||||||
return this.$store.getters.getBackendFallback
|
return this.$store.getters.getBackendFallback
|
||||||
},
|
},
|
||||||
|
@ -616,6 +619,7 @@ export default Vue.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
...mapActions([
|
...mapActions([
|
||||||
|
'updateEnableSearchSuggestions',
|
||||||
'updateBackendFallback',
|
'updateBackendFallback',
|
||||||
'updateCheckForUpdates',
|
'updateCheckForUpdates',
|
||||||
'updateBarColor',
|
'updateBarColor',
|
||||||
|
|
|
@ -12,6 +12,11 @@
|
||||||
:default-value="backendFallback"
|
:default-value="backendFallback"
|
||||||
@change="updateBackendFallback"
|
@change="updateBackendFallback"
|
||||||
/>
|
/>
|
||||||
|
<ft-toggle-switch
|
||||||
|
label="Enable Search Suggestions"
|
||||||
|
:default-value="enableSearchSuggestions"
|
||||||
|
@change="updateEnableSearchSuggestions"
|
||||||
|
/>
|
||||||
<ft-toggle-switch
|
<ft-toggle-switch
|
||||||
v-if="false"
|
v-if="false"
|
||||||
label="Check for Updates"
|
label="Check for Updates"
|
||||||
|
|
|
@ -22,6 +22,10 @@ export default Vue.extend({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
enableSearchSuggestions: function () {
|
||||||
|
return this.$store.getters.getEnableSearchSuggestions
|
||||||
|
},
|
||||||
|
|
||||||
searchSettings: function () {
|
searchSettings: function () {
|
||||||
return this.$store.getters.getSearchSettings
|
return this.$store.getters.getSearchSettings
|
||||||
},
|
},
|
||||||
|
@ -103,7 +107,9 @@ export default Vue.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
getSearchSuggestionsDebounce: function (query) {
|
getSearchSuggestionsDebounce: function (query) {
|
||||||
this.debounceSearchResults(query)
|
if (this.enableSearchSuggestions) {
|
||||||
|
this.debounceSearchResults(query)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
getSearchSuggestions: function (query) {
|
getSearchSuggestions: function (query) {
|
||||||
|
|
|
@ -37,6 +37,7 @@ const state = {
|
||||||
thumbnailPreference: '',
|
thumbnailPreference: '',
|
||||||
invidiousInstance: 'https://invidio.us',
|
invidiousInstance: 'https://invidio.us',
|
||||||
barColor: false,
|
barColor: false,
|
||||||
|
enableSearchSuggestions: true,
|
||||||
rememberHistory: true,
|
rememberHistory: true,
|
||||||
autoplayVideos: true,
|
autoplayVideos: true,
|
||||||
autoplayPlaylists: true,
|
autoplayPlaylists: true,
|
||||||
|
@ -72,6 +73,10 @@ const getters = {
|
||||||
return state.barColor
|
return state.barColor
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getEnableSearchSuggestions: () => {
|
||||||
|
return state.enableSearchSuggestions
|
||||||
|
},
|
||||||
|
|
||||||
getBackendPreference: () => {
|
getBackendPreference: () => {
|
||||||
return state.backendPreference
|
return state.backendPreference
|
||||||
},
|
},
|
||||||
|
@ -169,6 +174,9 @@ const actions = {
|
||||||
case 'checkForUpdates':
|
case 'checkForUpdates':
|
||||||
commit('setCheckForUpdates', result.value)
|
commit('setCheckForUpdates', result.value)
|
||||||
break
|
break
|
||||||
|
case 'enableSearchSuggestions':
|
||||||
|
commit('setEnableSearchSuggestions', result.value)
|
||||||
|
break
|
||||||
case 'backendPreference':
|
case 'backendPreference':
|
||||||
commit('setBackendPreference', result.value)
|
commit('setBackendPreference', result.value)
|
||||||
break
|
break
|
||||||
|
@ -255,6 +263,14 @@ const actions = {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
updateEnableSearchSuggestions ({ commit }, enableSearchSuggestions) {
|
||||||
|
settingsDb.update({ _id: 'enableSearchSuggestions' }, { _id: 'enableSearchSuggestions', value: enableSearchSuggestions }, { upsert: true }, (err, numReplaced) => {
|
||||||
|
if (!err) {
|
||||||
|
commit('setEnableSearchSuggestions', enableSearchSuggestions)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
updateBackendPreference ({ commit }, backendPreference) {
|
updateBackendPreference ({ commit }, backendPreference) {
|
||||||
settingsDb.update({ _id: 'backendPreference' }, { _id: 'backendPreference', value: backendPreference }, { upsert: true }, (err, numReplaced) => {
|
settingsDb.update({ _id: 'backendPreference' }, { _id: 'backendPreference', value: backendPreference }, { upsert: true }, (err, numReplaced) => {
|
||||||
if (!err) {
|
if (!err) {
|
||||||
|
@ -440,6 +456,9 @@ const mutations = {
|
||||||
setBarColor (state, barColor) {
|
setBarColor (state, barColor) {
|
||||||
state.barColor = barColor
|
state.barColor = barColor
|
||||||
},
|
},
|
||||||
|
setEnableSearchSuggestions (state, enableSearchSuggestions) {
|
||||||
|
state.enableSearchSuggestions = enableSearchSuggestions
|
||||||
|
},
|
||||||
setRememberHistory (state, rememberHistory) {
|
setRememberHistory (state, rememberHistory) {
|
||||||
state.rememberHistory = rememberHistory
|
state.rememberHistory = rememberHistory
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue