Skip to content

Commit

Permalink
Merge pull request #1604 from dodieboy/Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ImprovedTube authored Mar 12, 2023
2 parents 8bbe4bb + 61b0f3d commit d9524d1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 36 deletions.
2 changes: 1 addition & 1 deletion content-scripts/website-context/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ ImprovedTube.ytElementsHandler = function (node) {
}
//old
}else if (name === 'TP-YT-PAPER-BUTTON') {
if (document.documentElement.dataset.pageType === 'video' && id === 'more' && node.classList.contains('ytd-expander') || node.parentNode.parentNode.id === 'container') {
if (document.documentElement.dataset.pageType === 'video' && id === 'more' && node.classList.contains('ytd-expander') || (node.parentNode.parentNode !== null && node.parentNode.parentNode.id === 'container')) {
setTimeout(function () {
ImprovedTube.description(node);
}, 750);
Expand Down
21 changes: 4 additions & 17 deletions content-scripts/website-context/youtube-features/shortcuts.js
Original file line number Diff line number Diff line change
Expand Up @@ -612,28 +612,15 @@ ImprovedTube.shortcutSubscribe = function () {
------------------------------------------------------------------------------*/

ImprovedTube.shortcutDarkTheme = function () {
/* pref = '';
cookieValue = '400';
if (document.cookie.match(/PREF\=([^\s]*(?=\;)|[^\s]*$)/)) {
pref = document.cookie.match(/PREF\=([^\s]*(?=\;)|[^\s]*$)/)[1];
}
*/
if (document.documentElement.hasAttribute('dark')) {
// cookieValue = '80000';
document.documentElement.removeAttribute('dark');
document.documentElement.removeAttribute('it-theme');
document.querySelector('ytd-masthead').removeAttribute('dark');
document.documentElement.removeAttribute('it-themes');
} else {
document.documentElement.setAttribute('dark', '');
document.documentElement.setAttribute('it-theme', 'true');
}
/*
if (pref.match(/(f6=)[^\&]+/)){
cookieValue = pref.replace(/(f6=)[^\&]+/, cookieValue);
} else {
cookieValue = pref + "&f6=" + cookieValue;
document.querySelector('ytd-masthead').setAttribute('dark', '');
document.documentElement.setAttribute('it-themes', 'true');
}
ImprovedTube.setCookie('PREF', cookieValue);
*/
};


Expand Down
25 changes: 8 additions & 17 deletions content-scripts/website-context/youtube-features/themes.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,30 +81,21 @@ ImprovedTube.themes = function () {
if (this.elements.my_colors) {
this.elements.my_colors.remove();
}
/*
pref = '';
cookieValue = '400';
if (document.cookie.match(/PREF\=([^\s]*(?=\;)|[^\s]*$)/)) {
pref = document.cookie.match(/PREF\=([^\s]*(?=\;)|[^\s]*$)/)[1];
}
if (this.storage.theme === 'dark' || this.storage.theme === 'black') {
if (this.storage.theme === 'default' ){
if (document.documentElement.hasAttribute('it-themes') === true){
document.documentElement.setAttribute('it-themes', 'false');
location.reload();
}
} else if (this.storage.theme === 'dark' || this.storage.theme === 'black') {
if (!document.documentElement.hasAttribute('dark')) {
document.documentElement.setAttribute('dark', '');
document.documentElement.setAttribute('it-themes', 'true');
}
} else {
if (document.documentElement.hasAttribute('dark')) {
cookieValue = '80000';
document.documentElement.removeAttribute('dark');
document.documentElement.removeAttribute('it-themes');
}
}
if (pref.match(/(f6=)[^\&]+/)){
cookieValue = pref.replace(/(f6=)[^\&]+/, cookieValue);
} else {
cookieValue = pref + "&f6=" + cookieValue;
}
ImprovedTube.setCookie('PREF', cookieValue);
*/
}
};
2 changes: 1 addition & 1 deletion options-page/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ extension.attributes = function () {
title_version: true,
it_general: true,
it_appearance: true,
it_themes: true,
it_themes: false,
it_player: true,
it_playlist: true,
it_channel: true,
Expand Down

0 comments on commit d9524d1

Please sign in to comment.