Youtube++

Very small CSS tweaks to youtube

目前為 2017-09-21 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Youtube++
// @description  Very small CSS tweaks to youtube
// @include 	 *://*.youtube.com*
// @grant        GM_addStyle
// @grant       GM_getValue
// @grant       GM_setValue
// @run-at document-load
// @version 1.1
// @namespace https://greasyfork.org/users/3167
// ==/UserScript==

var defaultcolor = "hsla(3, 60%, 47%, 1)";

var customcolor = GM_getValue("yt-custom-color", defaultcolor);
GM_setValue('yt-custom-color', customcolor);

GM_addStyle ( "body {\
    /* --yt-custom-color: " + customcolor + "; */\
}");

GM_addStyle ( "#player-ads { display: none; }\
body, ytd-app {\
    --yt-brand-paper-button-color: var(--yt-custom-color) !important;\
    --yt-brand-color: var(--yt-custom-color) !important;\
}\
paper-button.ytd-subscribe-button-renderer {\
    background: var(--yt-custom-color);\
}\
a.yt-simple-endpoint.yt-formatted-string {\
    color: var(--yt-custom-color);\
}\
#progress.ytd-thumbnail-overlay-resume-playback-renderer, .ytp-red2 .ytp-swatch-background-color, .ytp-red2 .ytp-swatch-background-color-secondary, .ytp-play-progress.ytp-swatch-background-color, .ytp-swatch-background-color-secondary {\
    background-color: var(--yt-custom-color);\
}\
path#lozenge-path, #logo path.style-scope.yt-icon {\
    fill: var(--yt-custom-color);\
}\
div#top div#player {\
    max-height: calc(100vh - var(--ytd-masthead-height, 56px));\
}");


unsafeWindow.setcustomcolor = function (colorinput) {
  customcolor = colorinput;
  document.body.style = "--yt-custom-color: " + customcolor + ";";
  GM_setValue('yt-custom-color', customcolor);

  console.log("Changed color theme to : " + customcolor);
}

var customcolorpicker = document.createElement('input');
customcolorpicker.type = "color";
customcolorpicker.onchange = "setcustomcolor(this.value);";
customcolorpicker.style = "display: none;";
customcolorpicker.addEventListener("change", function() {
    unsafeWindow.setcustomcolor(this.value);
});

unsafeWindow.pickcustomcolor = function () {
    customcolorpicker.click();
}

unsafeWindow.resetcustomcolor = function () {
    unsafeWindow.setcustomcolor(defaultcolor);
}

unsafeWindow.setcustomcolor(customcolor);

console.log("Youtube++ loaded!");