Greasy Fork is available in English.
Fixes watch action buttons to be like how they used to be! (it also includes the classic 'Subscribed' notification icon prior to December 2022)
当前为
// ==UserScript==
// @name Action Buttons Fix (modified)
// @version 1.0.3
// @description Fixes watch action buttons to be like how they used to be! (it also includes the classic 'Subscribed' notification icon prior to December 2022)
// @author xX_LegendCraftd_Xx
// @icon https://www.youtube.com/favicon.ico
// @namespace http://greasyfork.icu/en/users/933798
// @license MIT
// @match https://*.youtube.com/*
// @grant none
// @run-at document-start
// ==/UserScript==
const abtnconfig = {
unsegmentLikeButton: false,
noFlexibleItems: true
};
function updateBtns() {
var watchFlexy = document.querySelector("ytd-watch-flexy");
var results = watchFlexy.data.contents.twoColumnWatchNextResults.results.results.contents;
for (var i = 0; i < results.length; i++) {
if (results[i].videoPrimaryInfoRenderer) {
var actions = results[i].videoPrimaryInfoRenderer.videoActions.menuRenderer;
if (abtnconfig.unsegmentLikeButton) {
if (actions.topLevelButtons[0].segmentedLikeDislikeButtonRenderer) {
var segmented = actions.topLevelButtons[0].segmentedLikeDislikeButtonRenderer;
actions.topLevelButtons.splice(0, 1);
actions.topLevelButtons.unshift(segmented.dislikeButton);
actions.topLevelButtons.unshift(segmented.likeButton);
}
}
if (abtnconfig.noFlexibleItems) {
for (var i = 0; i < actions.flexibleItems.length; i++) {
actions.topLevelButtons.push(actions.flexibleItems[i].menuFlexibleItemRenderer.topLevelButton);
}
delete actions.flexibleItems
}
}
}
var temp = watchFlexy.data;
watchFlexy.data = {};
watchFlexy.data = temp;
}
document.addEventListener("yt-page-data-updated", (e) => {
if (e.detail.pageType == "watch") {
updateBtns();
}
});
(function() {
ApplyCSS();
function ApplyCSS() {
var styles = document.createElement("style");
styles.innerHTML=`
/* Fix the position of watchaction buttons */
#actions.ytd-watch-metadata {
min-width: auto !important;
}
/* Revert classic 'Subscribed' notifcation icon */
yt-button-shape.style-scope.ytd-subscribe-button-renderer {
display: flex !important;
}
yt-smartimation.ytd-subscribe-button-renderer, .smartimation__content > __slot-el {
display: flex !important;
}
#notification-preference-toggle-button:not([hidden]) + yt-animated-action #notification-preference-button.ytd-subscribe-button-renderer[invisible], #subscribe-button-shape.ytd-subscribe-button-renderer[invisible] {
pointer-events: auto;
visibility: visible;
position: static;
}
div#notification-preference-button.style-scope.ytd-subscribe-button-renderer > ytd-subscription-notification-toggle-button-renderer-next.style-scope.ytd-subscribe-button-renderer > yt-button-shape > .yt-spec-button-shape-next--size-m {
background-color: transparent !important;
border-radius: 16px !important;
padding-left: 14px !important;
padding-right: 2px !important;
margin-left: 4px !important;
}
div#notification-preference-button.style-scope.ytd-subscribe-button-renderer > ytd-subscription-notification-toggle-button-renderer-next.style-scope.ytd-subscribe-button-renderer > yt-button-shape > .yt-spec-button-shape-next--size-m > div.cbox.yt-spec-button-shape-next--button-text-content, div#notification-preference-button.style-scope.ytd-subscribe-button-renderer > ytd-subscription-notification-toggle-button-renderer-next.style-scope.ytd-subscribe-button-renderer > yt-button-shape > .yt-spec-button-shape-next--size-m > div.yt-spec-button-shape-next__secondary-icon, button.yt-spec-button-shape-next.yt-spec-button-shape-next--tonal.yt-spec-button-shape-next--mono.yt-spec-button-shape-next--size-m.yt-spec-button-shape-next--icon-leading-trailing > div.yt-spec-button-shape-next__button-text-content {
display: none !important;
}
#buttons.ytd-c4-tabbed-header-renderer {
flex-direction: row-reverse !important;
}`
document.head.appendChild(styles);
}
})();