Skip to content

Commit

Permalink
Merge pull request #2124 from raszpl/patch-8
Browse files Browse the repository at this point in the history
settings.js adding Disabled Language option
  • Loading branch information
ImprovedTube authored Mar 26, 2024
2 parents f935ebf + 3ab875a commit 03403e8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
9 changes: 6 additions & 3 deletions js&css/web-accessible/www.youtube.com/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,13 @@ ImprovedTube.youtubeLanguage = function () {
let value = this.storage.youtube_language;

if (value) {
if (value !== 'default') {
this.setPrefCookieValueByName('hl', value);
} else {
if (value == 'disabled') {
// do nothing
} else if (value == 'default') {
// Delete 'hl' PREF cookie, let YT pick default Browser language
this.setPrefCookieValueByName('hl', null);
} else {
this.setPrefCookieValueByName('hl', value);
}
}
};
9 changes: 8 additions & 1 deletion menu/skeleton-parts/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,14 @@ extension.skeleton.header.sectionEnd.menu.on.click.settings.on.click.secondSecti
text: 'youtubeLanguage',
storage: 'youtube_language',
options: function () {
return extension.skeleton.header.sectionEnd.menu.on.click.settings.on.click.secondSection.language.on.click.section.languages;
return [{value: 'disabled', text: "Disabled"}].concat(extension.skeleton.header.sectionEnd.menu.on.click.settings.on.click.secondSection.language.on.click.section.languages);
},
on: {
change: function (event) {
if (event.target.value === 'disabled') {
satus.storage.remove('youtube_language');
}
}
}
}
}
Expand Down

0 comments on commit 03403e8

Please sign in to comment.