Twitch RSS Button

Add link to a channel's RSS feed

You will need to install an extension such as Tampermonkey, Greasemonkey 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 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.

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

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

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.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==UserScript==
// @name        Twitch RSS Button
// @namespace   http://domain.com/directory
// @description Add link to a channel's RSS feed
// @include     *://*.twitch.*/*
// @run-at document-start
// @version 0.0.1.20191107015349
// ==/UserScript==

setInterval(function()
{

    var cur_url = window.document.URL;

//// Get Rss Link
    var fields = cur_url.split('/');
    var junk1 = fields[0];
    var junk2 = fields[1];
    var twitchlink = fields[2];
    window.channellink = fields[3];
    var junk3 = fields[4];
    window.targetlink = "https://twitchrss.appspot.com/vod/" + window.channellink;

    var btn = document.getElementById('button')

        if (window.channellink != "")
        {
          if (window.channellink != "directory")
          {
              btn.style.visibility = "visible";
          }
          else
          {
              btn.style.visibility = "hidden";
          }
        }
        else
        {
            btn.style.visibility = "hidden";
        }
}, 500);

        //Make Button
    addButton("RSS Feed", rssFeedFn)

    function addButton(text, onclick, cssObj) {
        cssObj = cssObj || {position: 'absolute', bottom: '86%', left:'75%', 'z-index': 3}
        let button = document.createElement('button'), btnStyle = button.style
        document.body.appendChild(button)
        button.innerHTML = text
        button.onclick = onclick
        button.id = "button"
        Object.keys(cssObj).forEach(key => btnStyle[key] = cssObj[key])
        return button
    }


    //Clck Button

    function rssFeedFn()
    {
        if (window.channellink != "")
        {
          if (window.channellink != "directory")
          {
              window.open(window.targetlink);
          }
        }

    }