Skip to content

Commit

Permalink
Update appearance.js
Browse files Browse the repository at this point in the history
  • Loading branch information
ImprovedTube committed Aug 9, 2024
1 parent 3c9e007 commit 8dc5207
Showing 1 changed file with 24 additions and 26 deletions.
50 changes: 24 additions & 26 deletions js&css/web-accessible/www.youtube.com/appearance.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,30 @@
APPEARANCE
------------------------------------------------------------------------------*/
ImprovedTube.YouTubeExperiments = function () {
if ((this.storage.undo_the_new_sidebar === "true" || this.storage.description === "sidebar")
&& document.documentElement.dataset.pageType === 'video') {
if (window.yt?.config_?.EXPERIMENT_FLAGS) {
const newSidebarFlags = [
'kevlar_watch_grid',
'small_avatars_for_comments',
'small_avatars_for_comments_ep',
'web_watch_rounded_player_large'
];

if (this.storage.undo_the_new_sidebar === "true") {
if (window.yt.config_.EXPERIMENT_FLAGS.kevlar_watch_grid !== false) {
try {
newSidebarFlags.forEach(F => {
Object.defineProperty(window.yt.config_.EXPERIMENT_FLAGS, F, { get: () => false });
});
} catch (error) { console.error("can't undo description on the side", error); }
}
} else if (this.storage.description === "sidebar" && window.yt.config_.EXPERIMENT_FLAGS.kevlar_watch_grid !== true) {
try {
newSidebarFlags.forEach(F => {
Object.defineProperty(window.yt.config_.EXPERIMENT_FLAGS, F, { get: () => true });
});
} catch (error) { console.error("tried to move description to the sidebar", error); }
}
} else { console.log ("yt.config_.EXPERIMENT_FLAGS is not yet defined") }
if ((this.storage.undo_the_new_sidebar === "true" || this.storage.description === "sidebar")

Check warning on line 5 in js&css/web-accessible/www.youtube.com/appearance.js

View workflow job for this annotation

GitHub Actions / lint-and-test

Trailing spaces not allowed
&& document.documentElement.dataset.pageType === 'video') {
if (window.yt?.config_?.EXPERIMENT_FLAGS) {

Check warning on line 7 in js&css/web-accessible/www.youtube.com/appearance.js

View workflow job for this annotation

GitHub Actions / lint-and-test

Trailing spaces not allowed
const newSidebarFlags = [
'kevlar_watch_grid',
'small_avatars_for_comments',
'small_avatars_for_comments_ep',
'web_watch_rounded_player_large'
];
if (this.storage.undo_the_new_sidebar === "true") {

Check warning on line 14 in js&css/web-accessible/www.youtube.com/appearance.js

View workflow job for this annotation

GitHub Actions / lint-and-test

Trailing spaces not allowed
if (window.yt.config_.EXPERIMENT_FLAGS.kevlar_watch_grid !== false) {
try {
newSidebarFlags.forEach(F => {
Object.defineProperty(window.yt.config_.EXPERIMENT_FLAGS, F, { get: () => false });
});
} catch (error) { console.error("can't undo description on the side", error); }
}} else if (this.storage.description === "sidebar" && window.yt.config_.EXPERIMENT_FLAGS.kevlar_watch_grid !== true) {
try {
newSidebarFlags.forEach(F => {
Object.defineProperty(window.yt.config_.EXPERIMENT_FLAGS, F, { get: () => true });
});
} catch (error) { console.error("tried to move description to the sidebar", error); }
}
} else { console.log ("yt.config_.EXPERIMENT_FLAGS is not yet defined") }

Check warning on line 28 in js&css/web-accessible/www.youtube.com/appearance.js

View workflow job for this annotation

GitHub Actions / lint-and-test

Trailing spaces not allowed
}
}
/*try {
Expand Down

0 comments on commit 8dc5207

Please sign in to comment.