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

Quick fix #1597

Merged
merged 4 commits into from
Mar 4, 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
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ html[it-hide-date='true'] ytd-watch-metadata #info>span:last-child {
HIDE LIKE BUTTON
--------------------------------------------------------------*/

html[it-likes='hidden'] #info #top-level-buttons-computed ytd-toggle-button-renderer:nth-child(1),
html[it-likes='icons_only'] #top-level-buttons-computed ytd-toggle-button-renderer:nth-child(1) div.cbox {
html[it-likes='hidden'] #top-level-buttons-computed #segmented-like-button ytd-toggle-button-renderer,
html[it-likes='icons_only'] #top-level-buttons-computed #segmented-like-button ytd-toggle-button-renderer div.cbox {
display: none;
}

html[it-likes='icons_only'] #top-level-buttons-computed ytd-toggle-button-renderer:nth-child(1) .yt-spec-button-shape-next__icon,
html[it-likes='icons_only'] #top-level-buttons-computed ytd-toggle-button-renderer:nth-child(1) button{
html[it-likes='icons_only'] #top-level-buttons-computed #segmented-like-button ytd-toggle-button-renderer .yt-spec-button-shape-next__icon,
html[it-likes='icons_only'] #top-level-buttons-computed #segmented-like-button ytd-toggle-button-renderer button{
margin: 0;
padding: 0 5px;
}
Expand All @@ -72,13 +72,13 @@ html[it-likes='icons_only'] #top-level-buttons-computed ytd-toggle-button-render
HIDE DISLIKE BUTTON
--------------------------------------------------------------*/

html[it-hide-dislike-button='hidden'] #top-level-buttons-computed ytd-toggle-button-renderer:nth-child(2),
html[it-hide-dislike-button='icons_only'] #top-level-buttons-computed ytd-toggle-button-renderer:nth-child(2) div.cbox {
html[it-hide-dislike-button='hidden'] #top-level-buttons-computed #segmented-dislike-button ytd-toggle-button-renderer,
html[it-hide-dislike-button='icons_only'] #top-level-buttons-computed #segmented-dislike-button ytd-toggle-button-renderer div.cbox {
display: none;
}

html[it-hide-dislike-button='icons_only'] #top-level-buttons-computed ytd-toggle-button-renderer:nth-child(2) .yt-spec-button-shape-next__icon,
html[it-hide-dislike-button='icons_only'] #top-level-buttons-computed ytd-toggle-button-renderer:nth-child(2) button{
html[it-hide-dislike-button='icons_only'] #top-level-buttons-computed #segmented-dislike-button ytd-toggle-button-renderer .yt-spec-button-shape-next__icon,
html[it-hide-dislike-button='icons_only'] #top-level-buttons-computed #segmented-dislike-button ytd-toggle-button-renderer button{
margin: 0;
padding: 0 5px;
}
Expand All @@ -88,13 +88,13 @@ html[it-hide-dislike-button='icons_only'] #top-level-buttons-computed ytd-toggle
# HIDE SHARE BUTTON
--------------------------------------------------------------*/

html[it-hide-share-button='hidden'] #top-level-buttons-computed ytd-button-renderer#Share-button,
html[it-hide-share-button='icons_only'] #top-level-buttons-computed ytd-button-renderer#Share-button div.cbox {
html[it-hide-share-button='hidden'] #top-level-buttons-computed ytd-button-renderer,
html[it-hide-share-button='icons_only'] #top-level-buttons-computed ytd-button-renderer div.cbox {
display: none;
}

html[it-hide-share-button='icons_only'] #top-level-buttons-computed ytd-button-renderer#Share-button .yt-spec-button-shape-next__icon,
html[it-hide-share-button='icons_only'] #top-level-buttons-computed ytd-button-renderer#Share-button button{
html[it-hide-share-button='icons_only'] #top-level-buttons-computed ytd-button-renderer .yt-spec-button-shape-next__icon,
html[it-hide-share-button='icons_only'] #top-level-buttons-computed ytd-button-renderer button{
margin: 0;
padding: 0 5px;
}
Expand All @@ -104,13 +104,13 @@ html[it-hide-share-button='icons_only'] #top-level-buttons-computed ytd-button-r
# HIDE DOWNLOAD BUTTON
--------------------------------------------------------------*/

html[it-hide-download-button='hidden'] #top-level-buttons-computed ytd-download-button-renderer,
html[it-hide-download-button='icons_only'] #top-level-buttons-computed ytd-download-button-renderer div.cbox {
html[it-hide-download-button='hidden'] #flexible-item-buttons ytd-download-button-renderer,
html[it-hide-download-button='icons_only'] #flexible-item-buttons ytd-download-button-renderer div.cbox {
display: none;
}

html[it-hide-download-button='icons_only'] #top-level-buttons-computed ytd-download-button-renderer .yt-spec-button-shape-next__icon,
html[it-hide-download-button='icons_only'] #top-level-buttons-computed ytd-download-button-renderer button{
html[it-hide-download-button='icons_only'] #flexible-item-buttons ytd-download-button-renderer .yt-spec-button-shape-next__icon,
html[it-hide-download-button='icons_only'] #flexible-item-buttons ytd-download-button-renderer button{
margin: 0;
padding: 0 5px;
}
Expand All @@ -120,13 +120,13 @@ html[it-hide-download-button='icons_only'] #top-level-buttons-computed ytd-downl
# HIDE THANKS BUTTON
--------------------------------------------------------------*/

html[it-hide-thanks-button='hidden'] #top-level-buttons-computed ytd-button-renderer#Thanks-button,
html[it-hide-thanks-button='icons_only'] #top-level-buttons-computed ytd-button-renderer#Thanks-button div.cbox {
html[it-hide-thanks-button='hidden'] #flexible-item-buttons ytd-button-renderer#Thanks-button,
html[it-hide-thanks-button='icons_only'] #flexible-item-buttons ytd-button-renderer#Thanks-button div.cbox {
display: none;
}

html[it-hide-thanks-button='icons_only'] #top-level-buttons-computed ytd-button-renderer#Thanks-button .yt-spec-button-shape-next__icon,
html[it-hide-thanks-button='icons_only'] #top-level-buttons-computed ytd-button-renderer#Thanks-button button{
html[it-hide-thanks-button='icons_only'] #flexible-item-buttons ytd-button-renderer#Thanks-button .yt-spec-button-shape-next__icon,
html[it-hide-thanks-button='icons_only'] #flexible-item-buttons ytd-button-renderer#Thanks-button button{
margin: 0;
padding: 0 5px;
}
Expand All @@ -136,13 +136,13 @@ html[it-hide-thanks-button='icons_only'] #top-level-buttons-computed ytd-button-
# HIDE CLIP BUTTON
--------------------------------------------------------------*/

html[it-hide-clip-button='hidden'] #top-level-buttons-computed ytd-button-renderer#Clip-button,
html[it-hide-clip-button='icons_only'] #top-level-buttons-computed ytd-button-renderer#Clip-button div.cbox {
html[it-hide-clip-button='hidden'] #flexible-item-buttons ytd-button-renderer#Clip-button,
html[it-hide-clip-button='icons_only'] #flexible-item-buttons ytd-button-renderer#Clip-button div.cbox {
display: none;
}

html[it-hide-clip-button='icons_only'] #top-level-buttons-computed ytd-button-renderer#Clip-button .yt-spec-button-shape-next__icon,
html[it-hide-clip-button='icons_only'] #top-level-buttons-computed ytd-button-renderer#Clip-button button{
html[it-hide-clip-button='icons_only'] #flexible-item-buttons ytd-button-renderer#Clip-button .yt-spec-button-shape-next__icon,
html[it-hide-clip-button='icons_only'] #flexible-item-buttons ytd-button-renderer#Clip-button button{
margin: 0;
padding: 0 5px;
}
Expand All @@ -152,13 +152,13 @@ html[it-hide-clip-button='icons_only'] #top-level-buttons-computed ytd-button-re
# HIDE SAVE BUTTON
--------------------------------------------------------------*/

html[it-hide-save-button='hidden'] #top-level-buttons-computed ytd-button-renderer#Save-button,
html[it-hide-save-button='icons_only'] #top-level-buttons-computed ytd-button-renderer#Save-button div.cbox {
html[it-hide-save-button='hidden'] #flexible-item-buttons ytd-button-renderer#Save-button,
html[it-hide-save-button='icons_only'] #flexible-item-buttons ytd-button-renderer#Save-button div.cbox {
display: none;
}

html[it-hide-save-button='icons_only'] #top-level-buttons-computed ytd-button-renderer#Save-button .yt-spec-button-shape-next__icon,
html[it-hide-save-button='icons_only'] #top-level-buttons-computed ytd-button-renderer#Save-button button{
html[it-hide-save-button='icons_only'] #flexible-item-buttons ytd-button-renderer#Save-button .yt-spec-button-shape-next__icon,
html[it-hide-save-button='icons_only'] #flexible-item-buttons ytd-button-renderer#Save-button button{
margin: 0;
padding: 0 5px;
}
Expand All @@ -168,7 +168,7 @@ html[it-hide-save-button='icons_only'] #top-level-buttons-computed ytd-button-re
# HIDE REPORT BUTTON
--------------------------------------------------------------*/

html[it-hide-report-button='hidden'] #top-level-buttons-computed ytd-button-renderer#Report-button {
html[it-hide-report-button='true'] #top-level-buttons-computed ytd-button-renderer#Report-button {
display: none;
}

Expand All @@ -177,7 +177,7 @@ html[it-hide-report-button='hidden'] #top-level-buttons-computed ytd-button-rend
# HIDE MORE BUTTON
--------------------------------------------------------------*/

html[it-hide-more-button='hidden'] #menu yt-button-shape#button-shape {
html[it-hide-more-button='true'] #menu yt-button-shape#button-shape {
display: none;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,17 +197,12 @@ html[it-limit-page-width='false'] ytd-watch-flexy:not([fullscreen]) #primary.ytd

html[it-limit-page-width='false'] ytd-watch-flexy:not([fullscreen]) #player-container-outer.ytd-watch-flexy {
max-width: 100% !important;
max-height: var(--ytd-watch-flexy-max-player-height) !important;
}

html[it-limit-page-width='false'] ytd-watch-flexy:not([fullscreen]) #player-container-inner.ytd-watch-flexy {
padding-top: calc(var(--ytd-watch-flexy-max-player-height) + 45px) !important;
}

html[it-limit-page-width='false'] ytd-watch-flexy:not([fullscreen]) #player {
padding-bottom: 45px !important;
}

html[it-limit-page-width='false'] ytd-watch-flexy:not([fullscreen]) .html5-video-container {
width: 100% !important;
height: 100% !important;
Expand Down
10 changes: 6 additions & 4 deletions content-scripts/website-context/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,7 @@ ImprovedTube.ytElementsHandler = function (node) {
this.improvedtubeYoutubeIcon();
this.improvedtubeYoutubeButtonsUnderPlayer();

if(document.documentElement.dataset.pageType === 'video'){
this.hideDetailButton(node.querySelector('#menu #top-level-buttons-computed').children);
}

} else if (name === 'YTD-VIDEO-SECONDARY-INFO-RENDERER') {
this.elements.yt_channel_name = node.querySelector('ytd-channel-name');
this.elements.yt_channel_link = node.querySelector('ytd-channel-name a');
Expand All @@ -80,6 +78,10 @@ ImprovedTube.ytElementsHandler = function (node) {
this.howLongAgoTheVideoWasUploaded();
this.channelVideosCount();
}
} else if (name === 'YTD-MENU-RENDERER' && node.classList.contains('ytd-video-primary-info-renderer')) {
if(document.documentElement.dataset.pageType === 'video'){
this.hideDetailButton(node.$['flexible-item-buttons'].children);
}
} else if (name === 'YTD-SUBSCRIBE-BUTTON-RENDERER') {
if (node.className.indexOf('ytd-c4-tabbed-header-renderer') !== -1) {
ImprovedTube.blacklist('channel', node);
Expand Down Expand Up @@ -204,7 +206,7 @@ ImprovedTube.ytElementsHandler = function (node) {
}
//old
}else if (name === 'TP-YT-PAPER-BUTTON') {
if (document.documentElement.dataset.pageType === 'video' && id === 'more' && node.parentNode.parentNode.id === 'container') {
if (document.documentElement.dataset.pageType === 'video' && id === 'more' && node.classList.contains('ytd-expander')) {
setTimeout(function () {
ImprovedTube.description(node);
}, 750);
Expand Down
25 changes: 9 additions & 16 deletions content-scripts/website-context/youtube-features/appearance.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,22 +295,15 @@ ImprovedTube.description = function (el) {
------------------------------------------------------------------------------*/

ImprovedTube.hideDetailButton = function (el) {
setTimeout(function () {
for (var i = 2; i < el.length; i++) {
tmp = el[i].querySelector("g.yt-icon path").attributes.d.textContent.split(" ")[0];
if (tmp === "M22,13h-4v4h-2v-4h-4v-2h4V7h2v4h4V13z") {
el[i].setAttribute("id", "Save-button");
} else if (tmp === "M8,7c0,0.55-0.45,1-1,1S6,7.55,6,7c0-0.55,0.45-1,1-1S8,6.45,8,7z") {
el[i].setAttribute("id", "Clip-button");
} else if (tmp === "M16.5,3C19.02,3,21,5.19,21,7.99c0,3.7-3.28,6.94-8.25,11.86L12,20.59l-0.74-0.73l-0.04-0.04C6.27,14.92,3,11.69,3,7.99") {
el[i].setAttribute("id", "Thanks-button");
} else if (tmp === "M13.18,4l0.24,1.2L13.58,6h0.82H19v7h-5.18l-0.24-1.2L13.42,11H12.6H6V4H13.18") {
el[i].setAttribute("id", "Report-button");
} else if (tmp === "M15,5.63L20.66,12L15,18.37V15v-1h-1c-3.96,0-7.14,1-9.75,3.09c1.84-4.07,5.11-6.4,9.89-7.1L15,9.86V9V5.63") {
el[i].setAttribute("id", "Share-button");
}
}
}, 30);
if (el.length === 4) {
el[3].setAttribute("id", "Save-button");
el[2].setAttribute("id", "Clip-button");
el[1].setAttribute("id", "Thanks-button");
}
else if (el.length === 3) {
el[2].setAttribute("id", "Save-button");
el[1].setAttribute("id", "Clip-button");
}
};

/*--------------------------------------------------------------
Expand Down
17 changes: 14 additions & 3 deletions content-scripts/website-context/youtube-features/shortcuts.js
Original file line number Diff line number Diff line change
Expand Up @@ -612,16 +612,27 @@ ImprovedTube.shortcutSubscribe = function () {
------------------------------------------------------------------------------*/

ImprovedTube.shortcutDarkTheme = function () {
//const pref = document.cookie.match(/PREF\=.*(f6=[^\&]+)/)[0];
pref = '';
cookieValue = '400';
if (document.cookie.match(/PREF\=([^\s]*(?=\;)|[^\s]*$)/)) {
pref = document.cookie.match(/PREF\=([^\s]*(?=\;)|[^\s]*$)/)[1];
}

if (document.documentElement.hasAttribute('dark')) {
//document.cookie = pref.replace(/(f6=)[^\&]+/, '$180000') + "; domain=.youtube.com";
cookieValue = '80000';
document.documentElement.removeAttribute('dark');
document.documentElement.removeAttribute('it-theme');
} else {
//document.cookie = pref.replace(/(f6=)[^\&]+/, '$1400') + "; domain=.youtube.com";
document.documentElement.setAttribute('dark', '');
document.documentElement.setAttribute('it-theme', 'true');
}

if (pref.match(/(f6=)[^\&]+/)){
cookieValue = pref.replace(/(f6=)[^\&]+/, cookieValue);
} else {
cookieValue = pref + "&f6=" + cookieValue;
}
ImprovedTube.setCookie('PREF', cookieValue);
};


Expand Down
23 changes: 16 additions & 7 deletions content-scripts/website-context/youtube-features/themes.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,20 +81,29 @@ ImprovedTube.themes = function () {
if (this.elements.my_colors) {
this.elements.my_colors.remove();
}
//const pref = document.cookie.match(/PREF\=.*(f6=[^\&]+)/)[0];

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 (!document.documentElement.hasAttribute('dark')) {
//document.cookie = pref.replace(/(f6=)[^\&]+/, '$1400') + "; domain=.youtube.com";
document.documentElement.setAttribute('dark', '');
location.reload();
}
}
else {
} else {
if (document.documentElement.hasAttribute('dark')) {
//document.cookie = pref.replace(/(f6=)[^\&]+/, '$180000') + "; domain=.youtube.com";
cookieValue = '80000';
document.documentElement.removeAttribute('dark');
location.reload();
}
}

if (pref.match(/(f6=)[^\&]+/)){
cookieValue = pref.replace(/(f6=)[^\&]+/, cookieValue);
} else {
cookieValue = pref + "&f6=" + cookieValue;
}
ImprovedTube.setCookie('PREF', cookieValue);
}
};