Twitchls Button

Adds a button to twitch pages to change to twitchls

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

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

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

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

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

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name        Twitchls Button
// @description Adds a button to twitch pages to change to twitchls
// @author      chibby
// @match       *://*.twitch.tv/*
// @grant       GM_addStyle
// @version     1.1
// @namespace https://greasyfork.org/users/702968
// ==/UserScript==

/*--- Button
*/
var zNode       = document.createElement ('div');
zNode.innerHTML = '<button id="myButton" type="button">'
                + 'Go to Twitchls</button>'
                ;
zNode.setAttribute ('id', 'myContainer');
document.body.appendChild (zNode);

document.getElementById ("myButton").addEventListener (
    "click", ButtonClickAction, false
);

function ButtonClickAction (zEvent) {

    var zNode       = document.createElement ('p');
    zNode.innerHTML = 'Button clicked.';
    document.getElementById ("myContainer").appendChild (zNode);

    var url = window.location.href;
    window.location = url.replace('www.twitch.tv', 'twitchls.com');
}

GM_addStyle ( `
    #myContainer {
        position:               absolute;
        top:                    0;
        left:                   700px;
        font-size:              15px;
        background:             orange;
        border:                 3px outset black;
        margin:                 5px;
        opacity:                0.9;
        z-index:                1100;
        padding:                5px 20px;
    }
    #myButton {
        cursor:                 pointer;
    }
    #myContainer p {
        color:                  red;
        background:             white;
    }
` );