您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
Moves the video description to the right of the video (like it used to be 2009 and earlier) and makes a few 2009ish style tweaks to the video page.
当前为
// ==UserScript== // @id 5a3ebe9b-d73f-4397-a5c3-7a382723c39e // @name [BETA VERSION] Youtube - Right Side Description // @namespace Takato // @author Takato // @copyright 2010+, Takato (http://greasyfork.icu/users/1158/) // @licence Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International - Additional conditions apply; http://greasyfork.icu/scripts/976/ // @description Moves the video description to the right of the video (like it used to be 2009 and earlier) and makes a few 2009ish style tweaks to the video page. // @icon https://i.imgur.com/RAHw2kQ.png https://i.imgur.com/qlQhuaa.png // @icon64 https://i.imgur.com/qlQhuaa.png // @resource icon https://i.imgur.com/RAHw2kQ.png // @resource icon64 https://i.imgur.com/RAHw2kQ.png // @version 2020.07.21 // @require https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js // @require https://greasemonkey.github.io/gm4-polyfill/gm4-polyfill.js // @website http://greasyfork.icu/scripts/32695/ // @noframes // @grant GM_getValue // @grant GM_setValue // @grant GM_deleteValue // @grant GM_addStyle // @grant GM_getResourceURL // @grant GM.getValue // @grant GM.setValue // @grant GM.deleteValue // @grant GM.addStyle // @grant GM.getResourceUrl // @run-at document-start // @include https://www.youtube.com/* // ==/UserScript== // This script is licenced under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-nc-sa/4.0/) with additional conditions. // See http://greasyfork.icu/scripts/976/ for full details of the licence and conditions. (async function() { var script = {}; script.version = "2020.07.21"; // SETTINGS ----------------------------- // Main settings: Available by clicking "More" below the video. // - Toggle 'retro style' // -------------------------------------- // Everything below this line shouldn't be edited unless you are a coder. All settings are listed above. // Defining static script properties script.name = "Right Side Description [BETA]"; // Previously known as Better Watch Page script.shortname = "RSD Beta"; script.website = "http://greasyfork.icu/scripts/32695/"; script.discussion = "http://greasyfork.icu/scripts/32695/feedback"; script.icon = await GM.getResourceUrl("icon"); script.icon64 = await GM.getResourceUrl("icon64"); script.mainCSS = "ytd-masthead:not(:hover) #bwp-retrostyle-toggle:not(.open) {display:none;} /* Top Title Enabled */ .rsdTitle ytd-watch-flexy:not([theater]) #rsd-title {margin-bottom:4px;} .rsdTitle ytd-watch-flexy[theater] #rsd-title, .rsdTitle ytd-watch-flexy:not([theater]) ytd-video-primary-info-renderer h1.title {display:none;} .rsdTitle ytd-watch-flexy:not([theater]):not([fullscreen]) #primary.ytd-watch-flexy {padding-top:5px;} html:not(.rsdTitle) #rsd-title {display:none;} /* Side description (always) enabled */ #meta.rsd-description {width:auto; padding-right:0; order:0; margin-bottom:16px;} .rsdTitle ytd-watch-flexy:not([theater]) #meta.rsd-description {margin-top:9px;} ytd-video-secondary-info-renderer {max-height:390px; overflow:auto; width:auto; padding-top:0; padding-bottom:0; margin-right: 0 !important; background-color:var(--yt-playlist-background-item); padding:8px; border-bottom-width:0px;} @media screen and (min-width: 1000px) { ytd-video-secondary-info-renderer {margin-left:-14px;} } ytd-video-secondary-info-renderer #top-row.ytd-video-secondary-info-renderer {padding-top:0;} ytd-video-secondary-info-renderer #subscribe-button.ytd-video-secondary-info-renderer {justify-content: start; } ytd-video-secondary-info-renderer #subscribe-button.ytd-video-secondary-info-renderer ytd-subscribe-button-renderer {justify-content: start;} ytd-video-secondary-info-renderer #subscribe-button.ytd-video-secondary-info-renderer paper-button {padding:4px 10px;} ytd-video-secondary-info-renderer #subscribe-button.ytd-video-secondary-info-renderer ytd-subscription-notification-toggle-button-renderer {--yt-button-icon-size:24px; --yt-button-icon-padding:0px;} ytd-video-secondary-info-renderer #owner-sub-count {text-align:right;} ytd-video-secondary-info-renderer #date.ytd-video-primary-info-renderer #dot {display:none;} ytd-video-secondary-info-renderer ytd-expander.ytd-video-secondary-info-renderer {margin-left:0; max-width:100%; font-size:1.3rem; line-height:normal;} ytd-video-secondary-info-renderer #less {display:none;} ytd-video-secondary-info-renderer #title.ytd-metadata-row-renderer {width:auto; font-size:1.1rem; line-height:normal;} ytd-video-secondary-info-renderer .content.ytd-metadata-row-renderer {width:auto; font-size:1.1rem; line-height:normal; white-space:normal;} #playlist.ytd-watch-flexy {margin-bottom:16px;} /* Below Video */ /*Retro CSS*/ html:not([dark]).rsdRetro ytd-app[is-watch-page] {background-color: white !important;} .rsdRetro body, .rsdRetro input, .rsdRetro textarea, .rsdRetro select {font-family:arial,sans-serif;} .rsdRetro #masthead-container.ytd-app::after {display:none;} .rsdRetro #masthead:not([dark]) {border-bottom: 1px solid #CCCCCC;} .rsdRetro #container.ytd-masthead {height:49px;} .rsdRetro #masthead:not([dark]) #logo-icon-container.ytd-topbar-logo-renderer {background:url(https://s.ytimg.com/yt/img/master.png) 0px -641px; } .rsdRetro #masthead:not([dark]) #logo-icon-container.ytd-topbar-logo-renderer svg {visibility:hidden;} .rsdRetro #masthead:not([dark]) #logo-icon-container.ytd-topbar-logo-renderer {width:99px; height:42px;} .rsdRetro ytd-topbar-logo-renderer #country-code {display:none;} .rsdRetro #page-manager.ytd-app {margin-top: 49px;} .rsdRetro #rsd-title {font-size:19px; font-weight:bold;} .rsdRetro ytd-video-secondary-info-renderer {background:#EEEEEE; border:1px solid #CCCCCC; font-size:12px; padding:6px; margin-bottom:8px;} html[dark].rsdRetro ytd-video-secondary-info-renderer {background:var(--yt-playlist-background-item); border-color:var(--yt-border-color);} .rsdRetro ytd-video-secondary-info-renderer a.yt-simple-endpoint:not(.ytd-button-renderer):not(.ytd-subscription-notification-toggle-button-renderer), .rsdRetro ytd-video-secondary-info-renderer a.yt-simple-endpoint:not(.ytd-button-renderer):not(.ytd-subscription-notification-toggle-button-renderer):hover {color:#0033CC;} html[dark].rsdRetro ytd-video-secondary-info-renderer a.yt-simple-endpoint:not(.ytd-button-renderer), html[dark].rsdRetro ytd-video-secondary-info-renderer a.yt-simple-endpoint:not(.ytd-button-renderer):hover {color:var(--yt-spec-call-to-action);} .rsdRetro ytd-video-secondary-info-renderer #top-row.ytd-video-secondary-info-renderer {margin-bottom:2px; } .rsdRetro ytd-video-secondary-info-renderer #avatar.ytd-video-owner-renderer {border-radius:0; border:1px solid white; outline:1px solid #999999; margin:1px; margin-right:7px;} html[dark].rsdRetro ytd-video-secondary-info-renderer #avatar.ytd-video-owner-renderer {outline-color:#1b1b1b; border-color:var(--yt-border-color);} .rsdRetro ytd-video-secondary-info-renderer #upload-info.ytd-video-owner-renderer {justify-content:flex-start;} .rsdRetro ytd-video-secondary-info-renderer #upload-info.ytd-video-owner-renderer > * {font-size:1em; color:black;} html[dark].rsdRetro ytd-video-secondary-info-renderer #upload-info.ytd-video-owner-renderer > * {color:white;} .rsdRetro ytd-video-secondary-info-renderer #owner-name.ytd-video-owner-renderer, .rsdRetro ytd-video-secondary-info-renderer #channel-name.ytd-video-owner-renderer {font-weight:bold; font-size:1em;} html:not([dark]).rsdRetro ytd-video-secondary-info-renderer yt-formatted-string[has-link-only_]:not([force-default-style]) a.yt-simple-endpoint.yt-formatted-string {color:#0033CC;} .rsdRetro ytd-video-secondary-info-renderer #upload-info.ytd-video-owner-renderer .date.ytd-video-secondary-info-renderer { font-size:1em; color:var(--yt-primary-text-color); } .rsdRetro ytd-video-secondary-info-renderer ytd-expander.ytd-video-secondary-info-renderer {font-size:1em; line-height:15px;} html:not([dark]).rsdRetro ytd-video-secondary-info-renderer .content.ytd-video-secondary-info-renderer {color:#333;} .rsdRetro ytd-video-secondary-info-renderer ytd-metadata-row-container-renderer {border-top:1px solid #CCCCCC; padding-top:2px; margin-top:8px;} html[dark].rsdRetro ytd-video-secondary-info-renderer ytd-metadata-row-container-renderer {border-color:var(--yt-border-color);} .rsdRetro ytd-video-secondary-info-renderer ytd-metadata-row-renderer {margin:0; margin-top:2px; } .rsdRetro ytd-video-secondary-info-renderer #title.ytd-metadata-row-renderer {width:auto; font-size:0.9em; line-height:normal;} .rsdRetro ytd-video-secondary-info-renderer .content.ytd-metadata-row-renderer {width:auto; font-size:0.9em; line-height:normal; white-space:normal;} .rsdPlayer #player.ytd-watch-flexy {margin-bottom:30px;} .rsdPlayer ytd-watch-flexy[theater] #player-theater-container {margin-bottom:30px;} .rsdPlayer #movie_player:not(.ytp-fullscreen) {overflow:visible; contain: layout style size;} .rsdPlayer #movie_player:not(.ytp-fullscreen) .ytp-player-content, #movie_player:not(.ytp-fullscreen) .ytp-settings-menu {bottom:8px;} .rsdPlayer #movie_player:not(.ytp-fullscreen) .ytp-player-content.html5-endscreen {bottom:39px; top:28px;} .rsdPlayer #movie_player:not(.ytp-fullscreen) .ytp-bottom:not(.ytp-preview), .rsdPlayer #movie_player:not(.ytp-fullscreen) .ytp-paid-content-overlay {bottom:14px; top:auto !important;} .rsdPlayer #movie_player:not(.ytp-fullscreen) .ytp-preview {bottom:46px; top:auto !important;} .rsdPlayer #movie_player:not(.ytp-fullscreen) .caption-window.ytp-caption-window-bottom {margin-bottom:0;} .rsdPlayer #movie_player:not(.ytp-fullscreen) .ytp-gradient-bottom {display:none;} .rsdPlayer #movie_player:not(.ytp-fullscreen) .ytp-chrome-bottom { background-color:#ccc; color:#000; text-shadow:none; border:0px solid #ccc; border-width: 0px 12px 0 12px; left:0 !important; opacity:1; bottom:-30px; height:27px;} .rsdPlayer #movie_player:not(.ytp-fullscreen) .ytp-progress-bar-container {bottom:27px;} .rsdPlayer #movie_player:not(.ytp-fullscreen) .ytp-progress-list {transform-origin:center bottom !important; background-color:#444;} .rsdPlayer #movie_player:not(.ytp-fullscreen) .ytp-progress-bar-container:not(:hover) .ytp-progress-list {margin-left:-12px; width:calc(100% + 24px) !important; } .rsdPlayer #movie_player:not(.ytp-fullscreen) .ytp-chrome-controls {padding-left:0; padding-right:0; margin-left:-12px; margin-right:-12px; height:27px; line-height:27px;} .rsdPlayer #movie_player:not(.ytp-fullscreen) .ytp-time-display {height:34px; margin-top:-3px; font-size:95%; line-height:34px;} .rsdPlayer #movie_player:not(.ytp-fullscreen) .ytp-chapter-container {font-size:100%; line-height:27px; color:#4d4d4d; transition: opacity 0.05s} .rsdPlayer #movie_player:not(.ytp-fullscreen):not(.paused-mode):not(:hover) .ytp-chrome-bottom .ytp-chapter-container {opacity:0; transition: opacity 0.2s 2s} .rsdPlayer #movie_player:not(.ytp-fullscreen) .ytp-time-separator, .rsdPlayer #movie_player:not(.ytp-fullscreen) .ytp-time-duration {color:#666;} .rsdPlayer #movie_player:not(.ytp-fullscreen) .ytp-chrome-controls .ytp-button, .rsdPlayer #movie_player:not(.ytp-fullscreen) .ytp-chrome-controls .ytp-volume-panel {color:#4d4d4d; opacity:1; height:34px; margin-top:-3px;} .rsdPlayer #movie_player:not(.ytp-fullscreen) .ytp-chrome-controls .ytp-volume-panel .ytp-volume-slider-handle:before, .rsdPlayer #movie_player:not(.ytp-fullscreen) .ytp-chrome-controls .ytp-volume-panel .ytp-volume-slider-handle, .rsdPlayer #movie_player:not(.ytp-fullscreen) .ytp-chrome-controls .ytp-volume-panel .ytp-volume-slider-handle:after {background-color:#4d4d4d;} .rsdPlayer #movie_player:not(.ytp-fullscreen) .ytp-chrome-controls .ytp-volume-panel .ytp-volume-slider-handle:after {opacity:0.35;} .rsdPlayer #movie_player:not(.ytp-fullscreen) .ytp-chrome-controls .ytp-button:hover {color:#3d3d3d;} .rsdPlayer #movie_player:not(.ytp-fullscreen) .ytp-chrome-controls .ytp-button .ytp-svg-fill, .rsdPlayer #movie_player:not(.ytp-fullscreen) .ytp-chrome-controls .ytp-button path[fill='#fff'] {fill:currentColor;} .rsdPlayer #movie_player:not(.ytp-fullscreen) .ytp-chrome-controls .ytp-button .ytp-svg-shadow {stroke:none;} html[dark].rsdPlayer #movie_player:not(.ytp-fullscreen) .ytp-chrome-bottom {background-color:#1b1b1b; color:#fff; border-color:#1b1b1b;} html[dark].rsdPlayer #movie_player:not(.ytp-fullscreen) .ytp-chapter-container {color:#8E8E8E; } html[dark].rsdPlayer #movie_player:not(.ytp-fullscreen) .ytp-time-separator, html[dark].rsdPlayer #movie_player:not(.ytp-fullscreen) .ytp-time-duration {color:#999;} html[dark].rsdPlayer #movie_player:not(.ytp-fullscreen) .ytp-chrome-controls .ytp-button, html[dark].rsdPlayer #movie_player:not(.ytp-fullscreen) .ytp-chrome-controls .ytp-volume-panel {color:#8E8E8E; } html[dark].rsdPlayer #movie_player:not(.ytp-fullscreen) .ytp-chrome-controls .ytp-volume-panel .ytp-volume-slider-handle:before, html[dark].rsdPlayer #movie_player:not(.ytp-fullscreen) .ytp-chrome-controls .ytp-volume-panel .ytp-volume-slider-handle, html[dark].rsdPlayer #movie_player:not(.ytp-fullscreen) .ytp-chrome-controls .ytp-volume-panel .ytp-volume-slider-handle:after {background-color:#8E8E8E;} html[dark].rsdPlayer #movie_player:not(.ytp-fullscreen) .ytp-chrome-controls .ytp-button:hover {color:#EBEBEB;}"; // Defining dynamic script properties script.cssMainLoaded = null; //script.cssRetroLoaded = null; script.forceControlsTimer = null; script.forceControlsListener = null; script.watchSetupDone = false; function pageSetup() { // Runs: Once, after the first page has loaded // Purpose: Set up settings handling, and event hooks console.log("pageFirstRun"); $(document.createElement("div")) .attr("id", "rsd-menu") .attr("hidden","hidden") .attr("style", "position:absolute; top:50px; right:0; width:400px; height:auto; max-height:calc(100vh - 60px); background:white; color:black; border:1px black solid; z-index:5000; padding:20px; box-sizing: border-box; font-size:16px") .html("<h2>'"+script.name+"' Script Settings</h2><br><input type='checkbox' disabled checked> Description on right [Always Enabled]<br><label><input type='checkbox' id='rsd-menu-retrotheme' autocomplete='off'> Retro theme</label><br><label><input type='checkbox' id='rsd-menu-retroplayer' autocomplete='off'> Retro player</label><br><label><input type='checkbox' id='rsd-menu-titletop' autocomplete='off'> Title on top</label><br/><br/><small>Dark Mode is supported (toggle in Youtube Settings)</small>") .appendTo("body"); PrepSettings(); async function PrepSettings() { if (await GM.getValue("retrotheme", true)) { $("#rsd-menu-retrotheme").prop("checked", true); } if (await GM.getValue("retroplayer", true)) { $("#rsd-menu-retroplayer").prop("checked", true); } if (await GM.getValue("titletop", true)) { $("#rsd-menu-titletop").prop("checked", true); } } $("#rsd-menu input").click(async function() { var state = ($(this).prop("checked")?true:false); if (this.id=="rsd-menu-retrotheme") { await GM.setValue("retrotheme", state); } else if (this.id=="rsd-menu-retroplayer") { await GM.setValue("retroplayer", state); } else if (this.id=="rsd-menu-titletop") { await GM.setValue("titletop", state); } watchApply(); // apply changed settings }); $(document.createElement("div")) .attr("id", "bwp-retrostyle-toggle") .attr("class", "style-scope ytd-menu-renderer style-default") .attr("is-icon-button", "") .attr("button-renderer","") .attr("hidden","hidden") .html("<a is='yt-endpoint' tabindex='-1' class='style-scope ytd-button-renderer'><paper-icon-button src='"+script.icon+"'\" alt='RSD Menu' title='\"Right Side Description\" Script Menu'></paper-icon-button><paper-tooltip>\"Right Side Description\" Script Menu</paper-tooltip></a>") .click( function() { if ($("#rsd-menu").attr("hidden") ) { $("#rsd-menu").removeAttr("hidden"); $("#bwp-retrostyle-toggle").addClass("open"); } else { $("#rsd-menu").attr("hidden","hidden"); $("#bwp-retrostyle-toggle").removeClass("open"); } }) .prependTo("ytd-masthead #end"); typeChange(); $("ytd-app").on("yt-page-type-changed", typeChange); } function typeChange() { // Runs: Every time the page type changes console.log("typeChange"); if ($("#page-manager ytd-watch-flexy:not([hidden]), #page-manager ytd-watch-flexy.loading").length > 0) { if (!script.watchSetupDone) { watchSetup(); } watchApply(); } else { if (script.watchSetupDone) { watchCleanup(); } } } function watchSetup() { // Runs: First time a watch page has loaded // Purpose: Single-time watch page modification and event hooks console.log("watchSetup"); script.watchSetupDone = true; $('<h1 id="rsd-title" class="title style-scope ytd-video-primary-info-renderer"></h1>').prependTo( $("ytd-watch-flexy #primary-inner") ); $('<div id="rsd-description-entry"></div>').prependTo("ytd-watch-flexy #related"); dataRun(); $("ytd-app").on("yt-update-title", dataRun); //yt-page-data-updated ? } async function watchApply() { // Changed TO a watch page console.log("watchApply"); loadCSS(); $("#bwp-retrostyle-toggle").removeAttr("hidden"); applyRetroPlayer(await GM.getValue("retroplayer", true)); } function watchCleanup() { // Changed FROM a watch page (undo watchApply) console.log("watchCleanup"); unloadCSS(); $("#bwp-retrostyle-toggle").attr("hidden","hidden"); applyRetroPlayer(false); } function dataRun() { // Runs: Navigating from one video to another // Purpose: Modify the page in ways that need to happen after every video change console.log("dataRun"); setTimeout(function() { // These don't generate until after yt-update-title, need to find another event to listen to console.log("dataRun - delayed section"); // Title above video var title = $("ytd-video-primary-info-renderer > #container > h1 > yt-formatted-string").html(); $("#rsd-title").html(title); // Description panel var meta = $("ytd-watch-flexy #primary-inner > #meta").addClass("rsd-description"); $(meta).prependTo( $("#rsd-description-entry") ); // Expand description $("#meta.rsd-description ytd-expander #more").click(); // Upload date $("ytd-video-primary-info-renderer #info #date").insertAfter("ytd-video-owner-renderer #channel-name"); // Sub count $("#owner-sub-count").appendTo("#meta.rsd-description #subscribe-button"); }, 1); } $(document).one("yt-navigate-finish", pageSetup); // possible script points [old test notes] // yt-update-title on ytd-app - seems to run when data changes? // yt-page-type-changed on ytd-app - for detecting if they've move away from video or back // yt-page-data-updated on body - may run after all data changed? // yt-navigate-finish on document - same as above? async function loadCSS() { if (!script.cssMainLoaded) { script.cssMainLoaded = GM_addStyle(script.mainCSS); } $("html").addClass("rsdLoaded"); if (await GM.getValue("retrotheme", true)) { $("html").addClass("rsdRetro"); } else { $("html").removeClass("rsdRetro"); } if (await GM.getValue("retroplayer", true)) { $("html").addClass("rsdPlayer"); applyRetroPlayer(true); } else { $("html").removeClass("rsdPlayer"); applyRetroPlayer(false); } if (await GM.getValue("titletop", true)) { $("html").addClass("rsdTitle"); } else { $("html").removeClass("rsdTitle"); } } function unloadCSS() { if (script.cssMainLoaded) { $(script.cssMainLoaded).remove(); script.cssMainLoaded = null; } applyRetroPlayer(false); $("html").removeClass("rsdLoaded"); $("html").removeClass("rsdRetro"); $("html").removeClass("rsdPlayer"); $("html").removeClass("rsdTitle"); } function applyRetroPlayer(activate) { if (activate) { if (!script.forceControlsTimer) { var mouseMoveEvent = new Event('mousemove'); script.forceControlsTimer = setInterval(function() { if (!document.hidden) { $("#movie_player.playing-mode:not(.ytp-fullscreen)")[0].dispatchEvent(mouseMoveEvent); } }, 1000); } if (!script.forceControlsListener) { script.forceControlsListener = function() { if (!document.hidden) { var mouseMoveEvent = new Event('mousemove'); $("#movie_player.playing-mode:not(.ytp-fullscreen)")[0].dispatchEvent(mouseMoveEvent); } }; $(document).on("visibilitychange", script.forceControlsListener); } } else { if (script.forceControlsTimer) { clearInterval(script.forceControlsTimer); script.forceControlsTimer = null; } if (script.forceControlsListener) { $(document).off("visibilitychange", script.forceControlsListener); script.forceControlsListener = null; } } } })();