您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Fixes watch action buttons to be like how they used to be! (it also includes the old subscribed notification button before late 2022)
当前为
- // ==UserScript==
- // @name Action Buttons Fix (modified)
- // @version 1.0.1
- // @description Fixes watch action buttons to be like how they used to be! (it also includes the old subscribed notification button before late 2022)
- // @author xX_LegendCraftd_Xx
- // @icon https://www.youtube.com/favicon.ico
- // @namespace https://greasyfork.org/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 action buttons */
- ytd-watch-metadata[modern-metapanel-order] #actions.ytd-watch-metadata {
- min-width: auto !important;
- }
- /* Revert classic 'Subscribed' notifcation button */
- yt-button-shape.style-scope.ytd-subscribe-button-renderer {
- display: flex !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 {
- 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 {
- display: none !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.yt-spec-button-shape-next__secondary-icon {
- display: none !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 {
- border-radius: 100px !important;
- width: 37px !important;
- }
- yt-smartimation.ytd-subscribe-button-renderer {
- display: flex !important;
- }
- /* Make the subscribe button next to the 'Join' button */
- #buttons.ytd-c4-tabbed-header-renderer {
- flex-direction: row-reverse !important;
- }`
- document.head.appendChild(styles);
- }
- })();