Skip to content

Commit

Permalink
Fixed hideDetailButton() error & update hide detail button CSS
Browse files Browse the repository at this point in the history
  • Loading branch information
dodieboy committed Mar 4, 2023
1 parent 7efb21f commit b33b07f
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 49 deletions.
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
8 changes: 5 additions & 3 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
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

0 comments on commit b33b07f

Please sign in to comment.