// ==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 (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
// @version 2016.04.23.1
// @require https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js
// @website https://greasyfork.org/scripts/976/
// @noframes
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_addStyle
// @include http://www.youtube.com/*
// @include http://youtube.com/*
// @include https://www.youtube.com/*
// @include https://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.
var script = {};
script.version = "2016.04.23.1";
// SETTINGS -----------------------------
// Main settings: Available by clicking "More" below the video.
// - Change style between 'default' and 'retro'.
// --------------------------------------
// 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"; // 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 = "https://i.imgur.com/RAHw2kQ.png";
script.icon64 = "https://i.imgur.com/qlQhuaa.png";
script.mainCSS = "/* Title */ #watch-headline-title {margin-top:5px; margin-bottom:-5px; } #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;} /* 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, #watch-headline-title h1.yt {font-size:19px; font-weight:bold;} #bwp-sidebar-container {background:#EEEEEE; border:1px solid #CCCCCC; font-size:12px; padding:6px;} #bwp-sidebar-container a {color:#0033CC !important;} #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;} #yt-masthead-container {border-bottom-color:#CCCCCC;} #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; margin-top:-5px; margin-bottom:-5px;} #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 {margin-bottom:30px;} #movie_player:not(.ytp-fullscreen) {overflow:visible;} #movie_player:not(.ytp-fullscreen) .ytp-player-content, #movie_player:not(.ytp-fullscreen) .ytp-settings-menu {bottom:8px;} #movie_player:not(.ytp-fullscreen) .ytp-bottom {bottom:14px; top:auto !important;} #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;} #movie_player:not(.ytp-fullscreen) .iv-promo-inactive, #movie_player:not(.ytp-fullscreen).ended-mode .html5-video-container {display:none;} #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; width:calc(100% + 24px) !important; margin-left:-12px;} #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-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;} "
// Defining dynamic script properties
script.cssMainLoaded = null;
script.cssRetroLoaded = null;
script.forceControlsTimer = null;
script.forceControlsListener = null;
function mainScript() {
// 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.cssMainLoaded) {
$(script.cssMainLoaded).remove();
script.cssMainLoaded = 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.cssMainLoaded) {
script.cssMainLoaded = GM_addStyle(script.mainCSS);
}
// Enable retro style (based on setting)
applyRetroMode(GM_getValue("retrostyle", true));
// Add listen event to player state to apply retro style (based on setting) when other scripts prevent autoplay
function postloadRetroApply() {
applyRetroMode(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;opacity:1'><img width='24' src='"+script.icon+"'/></span> <span class='yt-ui-menu-item-label'>Toggle 'Retro Style'</span>")
.click(function() {
GM_setValue("retrostyle", !GM_getValue("retrostyle", true));
applyRetroMode(GM_getValue("retrostyle", true));
})
.appendTo("#bwp-retrostyle-toggle");
// Add button for pop-out video - work in progress, not enabled
/*$(document.createElement("button"))
.attr("id", "bwp-popout-btn")
.attr("class", "ytp-popout-button ytp-button")
.attr("title", "Pop-out Video")
.attr("style", "vertical-align: top;font-size:18px; text-align:center;")
.html('❐')
.click(function() {
bwpPopupWindow = window.open("https://www.youtube.com/embed/"+$("#watch7-content meta[itemprop='videoId']").attr("content")+"?autoplay=1", "bwpPopupWindow", "width=640,height=360,menubar=0,toolbar=0,location=0,personalbar=0,status=0");
})
.insertBefore("#movie_player .ytp-right-controls .ytp-size-button");*/
// 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");
// 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 (!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");
if (script.forceControlsTimer) {
clearInterval(script.forceControlsTimer);
script.forceControlsTimer = null;
}
if (script.forceControlsListener) {
$(document).off("visibilitychange", script.forceControlsListener);
script.forceControlsListener = null;
}
}
}
// End of script