// ==UserScript==
// @id b77e78bb-5ab5-403b-ae45-7540077fbc64
// @name Youtube - Right Side Description
// @namespace Takato
// @author Takato
// @copyright 2010+, Takato (https://greasyfork.org/users/1158/)
// @licence Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International - Additional conditions apply; https://greasyfork.org/scripts/976/
// @description Moves the video description to the right of the video, adds options for a retro player and style
// @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.31
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js
// @require https://greasemonkey.github.io/gm4-polyfill/gm4-polyfill.js
// @website https://greasyfork.org/scripts/976/
// @homepageURL https://greasyfork.org/scripts/976/
// @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
// @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 https://greasyfork.org/scripts/976/ for full details of the licence and conditions.
(async function() {
var script = {};
script.version = "2020.07.31";
// SETTINGS -----------------------------
// New Youtube: Available by hovering over the Youtube header on a video page. The settings button will appear.
// Old Youtube: Click 'more' below the video for an option to toggle retro style.
// --------------------------------------
// Don't edit below this line. All settings are listed above.
// Defining static script properties
script.name = "Right Side Description"; // Previously known as Better Watch Page
script.shortname = "RSD";
script.website = "https://greasyfork.org/scripts/976/";
script.discussion = "https://greasyfork.org/scripts/976/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 #top-row.ytd-video-secondary-info-renderer paper-button {padding:4px 10px; min-width:20px;} 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 #subscribe-button, ytd-video-secondary-info-renderer #sponsor-button, ytd-video-secondary-info-renderer #analytics-button {align-self:start;} 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-expander-collapsed-height:auto !important;} ytd-video-secondary-info-renderer ytd-expander[collapsed]:before {content:'Some description data may be missing - Refresh page to fix.'; margin-bottom:1rem; display:block; font-weight:bold; } 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;} ytd-video-secondary-info-renderer .content.content-line-height-override.ytd-metadata-row-renderer {line-height:normal;} ytd-video-secondary-info-renderer #contents.ytd-rich-metadata-row-renderer {margin-right:0;} ytd-video-secondary-info-renderer ytd-rich-metadata-renderer {transform:scale(0.68); transform-origin:top left; margin-right:-88px !important; margin-bottom:-30px !important; margin-top:0 !important; min-width:none; max-width:none;} #playlist.ytd-watch-flexy {margin-bottom:16px;} /* Below Video */ /*html:not(.rsdTitle) ytd-watch-flexy:not([theater]) ytd-video-primary-info-renderer {padding-top:10px;} ytd-video-primary-info-renderer #count {float:right; margin-top:-14px;} html:not(.rsdTitle) ytd-video-primary-info-renderer #count, ytd-watch-flexy[theater] ytd-video-primary-info-renderer #count {margin-top:-22px;} ytd-video-primary-info-renderer #count yt-view-count-renderer {font-size:18px;} ytd-video-primary-info-renderer #sentiment.ytd-video-primary-info-renderer {width:100%;}*/ /*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 ytd-metadata-row-header-renderer[has-divider-line] {margin-top:0; border-top:0;} .rsdRetro ytd-video-secondary-info-renderer ytd-metadata-row-header-renderer {display:inline-block; padding-top:0; } .rsdRetro ytd-video-secondary-info-renderer ytd-metadata-row-header-renderer + ytd-metadata-row-header-renderer {margin-left:8px; padding-left:8px; border-left:1px solid #CCCCCC;} html[dark].rsdRetro ytd-video-secondary-info-renderer ytd-metadata-row-header-renderer + ytd-metadata-row-header-renderer {border-left-color:var(--yt-border-color);} .rsdRetro ytd-video-secondary-info-renderer ytd-metadata-row-header-renderer .content.ytd-metadata-row-header-renderer {font-size:0.9em;} .rsdRetro ytd-video-secondary-info-renderer #title.ytd-metadata-row-renderer {font-size:0.9em;} .rsdRetro ytd-video-secondary-info-renderer .content.ytd-metadata-row-renderer {font-size:0.9em;} .rsdPlayer ytd-player#ytd-player #container.ytd-player {overflow:hidden; padding-bottom:30px;} .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 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;}";
// Legacy
script.mainCSSLegacy = "/* Title */ #watch-headline-title {margin-top:5px; margin-bottom:-5px;} #watch-headline-title .watch-title-container {width:auto; display: inline-block; vertical-align: middle;} #page.watch-stage-mode #watch-headline-title {margin-top:0px; margin-bottom:0px;} #watch-headline-title .long-title {font-size:inherit !important; letter-spacing:normal !important;} #watch-headline-additional {display:inline-block; margin-bottom:0; margin-left:8px; vertical-align: middle; } #watch-headline-additional:empty {display:none;} #watch-headline-additional > * {margin:3px; display:inline-block;} #watch-headline-additional > .standalone-collection-badge-renderer-text > a {margin-right:0;} /* Sidebar */ #bwp-sidebar-container {overflow:auto; margin-top:0; max-height:390px; } #watch7-user-header {padding-top:0;} #watch7-user-header .yt-user-photo {float:left;} #watch7-user-header .yt-user-info {max-width:calc(100% - 58px); margin-left:58px; line-height:1.5em ;} #watch7-user-header .yt-user-info a {font-weight:bold;} #watch-uploader-info {margin-left:58px; line-height:1.5em;} #watch-uploader-info strong {font-weight:normal;} #watch7-subscription-container {float:right;} #action-panel-details {clear:both;} #action-panel-details button.yt-uix-button-expander.yt-uix-expander-body {display:none;} /* Below Video */ #watch-header {position:relative; min-height:auto;} #watch8-action-buttons, #watch8-ytcenter-buttons {border-top:none;} #watch-header > #watch7-views-info {height:100%; top:0 !important; bottom:0px !important; right:12px !important;} #watch7-views-info .watch-view-count {position:absolute; top:0; right:0;} #watch7-views-info .video-extras-sparkbars {position:absolute; bottom:3px; right:0; width:100%;} #watch8-sentiment-actions {z-index:5; position:relative;} /* Below Video - Youtube+ */ #advanced-options {left:0; right:initial !important; overflow:hidden;} #console-button {position:relative !important; float:left;} #player-console {right:0; top:0 !important; float:left !important; height:20px;} #player-console > div {margin-top:-4px; height:24px;} ";
script.retroCSS = "/* Retro Mode*/ body {background-color:white;} body, input, textarea, select {font-family:arial,sans-serif;} .yt-card {box-shadow:none; border:1px solid #e2e2e2;} #watch-headline-title h1 {font-size:19px; font-weight:bold;} #bwp-sidebar-container {background:#EEEEEE; border:1px solid #CCCCCC; font-size:12px; padding:6px;} #bwp-sidebar-container a, #action-panel-details:hover a {color:#0033CC;} #watch7-user-header {padding-bottom:5px;} #watch7-user-header .yt-user-photo {border:1px solid #999999;} #watch7-user-header .yt-user-photo > .video-thumb {border:1px solid white;} #watch-description-text {line-height:15px;} #watch-description-extras {border-top:1px solid #CCCCCC; padding-top:4px;} #watch-description-extras .watch-meta-item:last-child .title, #watch-description-extras .watch-meta-item:last-child .content {margin-bottom:0;} #watch7-sidebar-offer {margin-right:-1px;} #yt-masthead-container {border-bottom-color:#CCCCCC;} #yt-masthead #logo-container:not(.doodle) {margin-top:-5px; margin-bottom:-5px;} body:not(.bwpRetroDark) #yt-masthead #logo-container:not(.doodle) .logo:not(.doodle) {background:url(https://s.ytimg.com/yt/img/master.png) 0px -641px; height:40px; width:98px; } #logo-container .content-region {display:none;} .show-guide #appbar-guide-menu {box-shadow:none; border-color:#CCCCCC; border-style:solid; border-width:0px 1px 1px 0px;} #player-api {padding-bottom:30px; overflow:hidden;} #movie_player:not(.ytp-fullscreen) {overflow:visible; contain: layout style size;} #movie_player:not(.ytp-fullscreen) .ytp-player-content, #movie_player:not(.ytp-fullscreen) .ytp-settings-menu {bottom:8px;} #movie_player:not(.ytp-fullscreen) .ytp-player-content.html5-endscreen {bottom:39px; top:28px;} #movie_player:not(.ytp-fullscreen) .ytp-bottom:not(.ytp-preview), #movie_player:not(.ytp-fullscreen) .ytp-paid-content-overlay {bottom:14px; top:auto !important;} #movie_player:not(.ytp-fullscreen) .ytp-preview {bottom:46px; top:auto !important;} #movie_player:not(.ytp-fullscreen) .caption-window.ytp-caption-window-bottom {margin-bottom:0;} #movie_player:not(.ytp-fullscreen) .ytp-gradient-bottom {display:none;} #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;} html.part_cinema_mode #movie_player:not(.ytp-fullscreen):not(:hover) .ytp-chrome-bottom {opacity:0.13;} #movie_player:not(.ytp-fullscreen) .ytp-progress-bar-container {bottom:27px;} #movie_player:not(.ytp-fullscreen) .ytp-progress-list {transform-origin:center bottom !important; background-color:#444;} #movie_player:not(.ytp-fullscreen) .ytp-progress-bar-container:not(:hover) .ytp-progress-list {margin-left:-12px; width:calc(100% + 24px) !important; } #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;} #movie_player:not(.ytp-fullscreen) .ytp-time-display {height:34px; margin-top:-3px; font-size:95%; line-height:34px;} #movie_player:not(.ytp-fullscreen) .ytp-chapter-container {font-size:100%; line-height:27px; color:#4d4d4d; transition: opacity 0.05s} #movie_player:not(.ytp-fullscreen):not(.paused-mode):not(:hover) .ytp-chrome-bottom .ytp-chapter-container {opacity:0; transition: opacity 0.2s 2s} #movie_player:not(.ytp-fullscreen) .ytp-time-separator, #movie_player:not(.ytp-fullscreen) .ytp-time-duration {color:#666;} #movie_player:not(.ytp-fullscreen) .ytp-chrome-controls .ytp-button, #movie_player:not(.ytp-fullscreen) .ytp-chrome-controls .ytp-volume-panel {color:#4d4d4d; opacity:1; height:34px; margin-top:-3px;} #movie_player:not(.ytp-fullscreen) .ytp-chrome-controls .ytp-volume-panel .ytp-volume-slider-handle:before, #movie_player:not(.ytp-fullscreen) .ytp-chrome-controls .ytp-volume-panel .ytp-volume-slider-handle, #movie_player:not(.ytp-fullscreen) .ytp-chrome-controls .ytp-volume-panel .ytp-volume-slider-handle:after {background-color:#4d4d4d;} #movie_player:not(.ytp-fullscreen) .ytp-chrome-controls .ytp-volume-panel .ytp-volume-slider-handle:after {opacity:0.35;} #movie_player:not(.ytp-fullscreen) .ytp-chrome-controls .ytp-button:hover {color:#3d3d3d;} #movie_player:not(.ytp-fullscreen) .ytp-chrome-controls .ytp-button .ytp-svg-fill, #movie_player:not(.ytp-fullscreen) .ytp-chrome-controls .ytp-button path[fill='#fff'] {fill:currentColor;} #movie_player:not(.ytp-fullscreen) .ytp-chrome-controls .ytp-button .ytp-svg-shadow {stroke:none;} #page:not(.watch-wide) #watch7-content {margin-top:27px;} #page.watch-wide #watch7-container {margin-top:37px;} #page.watch-stage-mode #player-playlist .watch-playlist {margin-top:27px;}";
script.retroDarkCSS = "/* Retro Dark */ #watch7-user-header .yt-user-photo {border-color:#1b1b1b;} #watch-description-extras {border-top-color:#444444;} /*youtube umbra*/ #bwp-sidebar-container { background-color: var(--card-bg-color); color: var(--main-text-color); border-color: var(--card-border-color) } #bwp-sidebar-container a {color:var(--link-color);} #movie_player:not(.ytp-fullscreen) .ytp-chrome-bottom {background-color:#1b1b1b; color:#fff; border-color:#1b1b1b;} #movie_player:not(.ytp-fullscreen) .ytp-chapter-container {color:#8E8E8E;} #movie_player:not(.ytp-fullscreen) .ytp-time-separator, #movie_player:not(.ytp-fullscreen) .ytp-time-duration {color:#999;} #movie_player:not(.ytp-fullscreen) .ytp-chrome-controls .ytp-button, #movie_player:not(.ytp-fullscreen) .ytp-chrome-controls .ytp-volume-panel {color:#8E8E8E; } #movie_player:not(.ytp-fullscreen) .ytp-chrome-controls .ytp-volume-panel .ytp-volume-slider-handle:before, #movie_player:not(.ytp-fullscreen) .ytp-chrome-controls .ytp-volume-panel .ytp-volume-slider-handle, #movie_player:not(.ytp-fullscreen) .ytp-chrome-controls .ytp-volume-panel .ytp-volume-slider-handle:after {background-color:#8E8E8E;} #movie_player:not(.ytp-fullscreen) .ytp-chrome-controls .ytp-button:hover {color:#EBEBEB;}";
// Defining dynamic script properties
script.cssMainLoaded = null;
script.forceControlsTimer = null; // shared with legacy
script.forceControlsListener = null; // shared with legacy
script.watchSetupDone = false;
// Legacy
script.cssMainLoadedLegacy = null;
script.cssRetroLoaded = null;
script.cssRetroDarkLoaded = null;
// Newtube Script
function pageSetup() {
// Runs: Once, after the first page has loaded
// Purpose: Set up settings handling, and event hooks
console.log("pageFirstRun");
if ($("#rsd-menu").length > 0) {
console.warn(script.shortname + " - Another version of this script is already running, so this copy will not be loaded. Check your list of installed scripts.");
return;
}
$(document.createElement("div"))
.attr("id", "rsd-menu")
.attr("hidden","hidden")
.attr("style", "position:absolute; position:fixed; top:55px; right:10px; width:500px; height:auto; max-height:calc(100vh - 60px); background:white; background:var(--yt-spec-brand-background-primary); color:black; color:var(--yt-spec-text-primary); border:1px black solid; border-color:var(--yt-spec-text-primary); z-index:2200; border-radius:2px; padding:20px; box-sizing: border-box; font-size:16px")
.html("<div class='arrow' style='position:absolute; width:15px; height:15px; border:black solid 1px; border-color:border-color:var(--yt-spec-text-primary); border-width:1px 1px 0 0; background:inherit; transform:rotate(-45deg); top:-9px; pointer-events:none;'></div><img style='float:right; margin-left:4px;' src='"+script.icon+"'><small style='float:right; margin-left:3px; text-align:right;'>Version "+script.version+"<br/><a style='color:var(--yt-spec-call-to-action)' href='"+script.website+"' target='_blank'>Updates & Help</a></small><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");
$("#rsd-menu .arrow").css("right", (document.body.clientWidth - $("#bwp-retrostyle-toggle")[0].getBoundingClientRect().right) + "px");
} 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");
setTimeout(function() { // delay only seems to be needed for miniplayer closing
console.log("typeChange - delayed section");
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();
}
}
}, 1);
}
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, or a setting has changed
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").removeClass("open");
$("#rsd-menu").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();
if ($("#meta.rsd-description ytd-expander[collapsed]").length > 0) {
console.log("Expand didn't work"); // CSS message will warn user to refresh. Todo: find a way to automatically re-expand
}
// Upload date - move from below video to description panel
$("ytd-video-primary-info-renderer #info #date").insertAfter("ytd-video-owner-renderer #channel-name");
// Sub count
if ( $("#meta.rsd-description #subscribe-button").text() ) { // prevent picking up the skeleton
$("#owner-sub-count").appendTo("#meta.rsd-description ytd-video-secondary-info-renderer #subscribe-button");
}
// Below video
// Viewcount
//$("ytd-video-primary-info-renderer #info #count").prependTo("ytd-video-primary-info-renderer #info #menu-container");
// New container for shifted buttons, move them into it (all except like/dislike)
/* $("#menu-container-left-rsd").remove(); // remove old copies
$("<div id='menu-container-left-rsd'></div>").prependTo("ytd-video-primary-info-renderer #info");
$("ytd-video-primary-info-renderer #info #menu-container #top-level-buttons > *").each(function() {
if (this.nodeName != "YTD-TOGGLE-BUTTON-RENDERER") {
$(this).appendTo("#menu-container-left-rsd");
}
});
$("ytd-video-primary-info-renderer #info #menu-container #top-level-buttons + *").insertAfter("#menu-container-left-rsd");*/
}, 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;
}
}
}
// Legacy Script
async function mainScript() {
// Don't run on New Youtube
if ($("body > ytd-app").length > 0) {
console.log("RSD - Aborting legacy script. Modern script should handle this page.");
return;
}
// Don't run in Youtube+ Popups
if ($("html").hasClass("part_popout")) return;
// Abort and clean up on non-video pages.
if (!$("#page").hasClass("watch")) {
$("body").removeClass("bwpScript");
applyRetroMode(false);
$("#page > #watch7-headline").remove();
$("#bwpCrash").remove();
if (script.cssMainLoadedLegacy) {
$(script.cssMainLoadedLegacy).remove();
script.cssMainLoadedLegacy = null;
}
return;
}
$("body").addClass("bwpScript");
// Insert script crash notification
if (!($("#bwpCrash").length > 0)) {
$(document.createElement("div"))
.attr("id", "bwpCrash")
.attr("style", "font-size:12px !important; border:1px solid black !important; padding:2px !important; margin:2px !important; font-weight:bold !important; color:black !important; background:white !important;")
.html("'" + script.name + "' has crashed. Try refreshing the page or checking for a script update.")
.insertBefore("#page");
}
// Insert CSS
if (!script.cssMainLoadedLegacy) {
script.cssMainLoadedLegacy = GM_addStyle(script.mainCSSLegacy);
}
// Enable retro style (based on setting)
applyRetroMode(await GM.getValue("retrostyle", true));
// Add listen event to player state to apply retro style (based on setting) when other scripts prevent autoplay
async function postloadRetroApply() {
applyRetroMode(await GM.getValue("retrostyle", true));
$("#player-api").off("click", "#movie_player.unstarted-mode", postloadRetroApply);
}
$("#player-api").on("click", "#movie_player.unstarted-mode", postloadRetroApply);
// Add button to toggle retro style
$(document.createElement("li"))
.attr("id", "bwp-retrostyle-toggle")
.appendTo("#action-panel-overflow-menu");
$(document.createElement("button"))
.attr("class", "yt-ui-menu-item has-icon")
.html("<span class='yt-ui-menu-item-icon' style='margin-right:6px;margin-left:-14px;margin-bottom:-6px;vertical-align:top;opacity:1;'><img width='24' src='"+script.icon+"' style='margin-bottom:-8px;'/></span> <span class='yt-ui-menu-item-label'>Toggle 'Retro Style'</span>")
.click(async function() {
GM.setValue("retrostyle", !(await GM.getValue("retrostyle", true)));
applyRetroMode(await GM.getValue("retrostyle", true));
})
.appendTo("#bwp-retrostyle-toggle");
// Remove VEVO branding
$("#watch7-container")
.removeClass("watch-branded")
.removeClass("watch-branded-banner");
$("#player")
.attr("style", "")
.removeClass("watch-branded-banner");
$("#watch7-branded-banner").remove();
// Move description & channel details to the right-side column
$(document.createElement("div"))
.attr("id","bwp-sidebar-container")
.attr("class", "yt-card yt-card-has-padding")
.insertBefore("#watch7-sidebar-contents");
$("#watch7-user-header").appendTo("#bwp-sidebar-container");
$("#action-panel-details")
.removeClass("yt-uix-expander-collapsed")
.removeClass("yt-card")
.removeClass("yt-card-has-padding")
.appendTo("#bwp-sidebar-container");
// Move Upload time into user info
$("#watch-uploader-info").appendTo("#watch7-user-header");
$("#watch-uploader-info strong").text(function() { return $(this).text().replace("Published on ",""); });
// Relocate views for correct styling
$("#watch7-views-info").appendTo("#watch-header");
// Move title above video
$("#page > #watch7-headline").remove(); // Remove any existing
$("#watch-header #watch7-headline").insertBefore("#player").addClass("content-alignment");
$(document.createElement("div")) // Container for non-title content such as Youtube Red
.attr("id", "watch-headline-additional")
.attr("class", "yt-card")
.appendTo("#watch-headline-title");
$("#watch7-headline > *:not(#watch-headline-title):not(#watch-headline-additional)").prependTo("#watch-headline-additional");
// Unavailable video
/*if ($("#player-unavailable").length > 0) {
$("#unavailable-submessage").append("");
if ($("#watch7-content meta[itemprop=\"regionsAllowed\"]").length > 0) {
$("#unavailable-submessage").append("<br/><br/>Countries allowed to watch this video are '<i>"+$("#watch7-content meta[itemprop=\"regionsAllowed\"]").attr("content")+"</i>'");
}
}*/
// Remove Crash notice
$("#bwpCrash").remove();
}
mainScript();
$(document).on("spfdone", mainScript);
function applyRetroMode(activate) {
if (activate) {
if (!script.cssRetroLoaded) {
script.cssRetroLoaded = GM_addStyle(script.retroCSS);
}
$("body").addClass("bwpRetro");
if (isDark($("body").css("background-color"))) {
applyRetroDarkMode(true);
} else {
applyRetroDarkMode(false);
}
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.cssRetroLoaded) {
$(script.cssRetroLoaded).remove();
script.cssRetroLoaded = null;
}
$("body").removeClass("bwpRetro");
applyRetroDarkMode(false);
if (script.forceControlsTimer) {
clearInterval(script.forceControlsTimer);
script.forceControlsTimer = null;
}
if (script.forceControlsListener) {
$(document).off("visibilitychange", script.forceControlsListener);
script.forceControlsListener = null;
}
}
}
function applyRetroDarkMode(activate) {
if (activate) {
if (!script.cssRetroDarkLoaded) {
script.cssRetroDarkLoaded = GM_addStyle(script.retroDarkCSS);
}
$("body").addClass("bwpRetroDark");
} else {
if (script.cssRetroDarkLoaded) {
$(script.cssRetroDarkLoaded).remove();
script.cssRetroDarkLoaded = null;
}
$("body").removeClass("bwpRetroDark");
}
}
function isDark(rgb) {
var re = /rgb\([ ]*(\d+),[ ]*(\d+),[ ]*(\d+)[ ]*\)/;
var match = rgb.match(re);
if (match == null) {
return false;
}
var luma = 0.2126 * match[1] + 0.7152 * match[2] + 0.0722 * match[3];
if (luma < 40) {
return true;
}
return false;
}
})();