Youtube wadsworth

Displays a wadsworth button to activate it

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name           Youtube wadsworth
// @namespace      http://userscripts.org/users/127069
// @description    Displays a wadsworth button to activate it
// @include        http*://*.youtube.com/watch?*v=*
// @version        2.3
// @changelog      Fixed non-working button and style
// ==/UserScript==

var wadsworthSpan = document.createElement("span");
wadsworthSpan.className = "yt-uix-button-group actionable";
var wadsworth = document.createElement("button");
wadsworth.innerHTML = "Wadsworth";
wadsworth.setAttribute("id", "wadsworth");
wadsworth.setAttribute("role", "button");
wadsworth.setAttribute("data-button-toggle", "true");
wadsworth.setAttribute("type", "button");
wadsworth.className = "yt-uix-button yt-uix-button-text yt-uix-tooltip yt-uix-button-empty";

var cPage = document.URL;
if (cPage.indexOf("wadsworth") == -1) {
    wadsworth.addEventListener('click', function() { document.location = cPage + "&wadsworth=1"; }, false);
} else {
    wadsworth.className = "yt-uix-button yt-uix-button-text yt-uix-tooltip yt-uix-button-empty action-panel-trigger yt-uix-button-toggled";
    wadsworth.setAttribute("style", "color: rgb(169, 56, 46) !important;");
    var patt = /(.+)&wadsworth=1/i;
    wadsworth.addEventListener('click', function () { document.location = cPage.match(patt)[1]; }, false);
    document.getElementById('watch7-action-buttons').parentNode.addEventListener('mouseover', function () { wadsworth.style.boxShadow = 'inset 0 1px 1px rgba(0,0,0,.20)'}, false);
    document.getElementById('watch7-action-buttons').parentNode.addEventListener('mouseout', function () { wadsworth.style.boxShadow = ''}, false);
}

wadsworthSpan.appendChild(wadsworth);
document.getElementById("watch7-sentiment-actions").appendChild(wadsworthSpan);

GM_addStyle("#wadsworth {\
        border: 0px none;} \
        .yt-uix-button-panel:hover \
        #wadsworth {\
        border: 1px solid;\
        border-color: #C6C6C6;}");