Very small CSS tweaks to youtube
目前為
// ==UserScript==
// @name Youtube plus plus
// @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
// @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!");