Skip to content

Instantly share code, notes, and snippets.

@DerTyp7214
Last active March 5, 2020 18:51
Show Gist options
  • Save DerTyp7214/af2f93004b5eed5034385b381cc54752 to your computer and use it in GitHub Desktop.
Save DerTyp7214/af2f93004b5eed5034385b381cc54752 to your computer and use it in GitHub Desktop.
BetterBetterTwitchTv
// ==UserScript==
// @name uTwitch Userscript
// @namespace http://tampermonkey.net/
// @version 1.8.7
// @description BetterBetterTwitchTv
// @author DerTyp7214 & Mottekmalocher
// @match https://www.twitch.tv/*
// @require https://cdn.utwitch.net/utwitch/scripts/modules/jquery.min.js
// @inject-into content
// @grant GM.addStyle
// @grant GM_addStyle
// @downloadURL https://gist.github.com/DerTyp7214/af2f93004b5eed5034385b381cc54752/raw/uTwitch.user.js
// @updateURL https://gist.github.com/DerTyp7214/af2f93004b5eed5034385b381cc54752/raw/uTwitch.user.js
// ==/UserScript==
/* global GM, jscolor */
/* jshint esnext:true, unused:true */
(function () {
'use strict';
injector()
function injector() {
injectScript('https://cdn.utwitch.net/utwitch/utwitch.min.js')
injectCss('https://cdn.utwitch.net/utwitch/utwitch.min.css')
}
/**
* injects script into site
* @param {string} url to the script
*/
async function injectScript(url, onload, onerror) {
var head = document.getElementsByTagName('head')[0]
var script = document.createElement('script')
script.type = 'text/javascript'
script.id = 'uTwitchScript'
script.onload = function () {
console.info(`${url} loaded!`)
onload(url)
}
script.onerror = () => {
console.log(`${url} error!`)
onerror(url)
}
script.src = `${url}?v=${Date.now()}`
head.appendChild(script);
}
/**
* injects css into site
* @param {string} url to the css
*/
async function injectCss(url) {
var head = document.getElementsByTagName('head')[0]
var css = document.createElement('link')
css.rel = "stylesheet"
css.type = 'text/css'
css.id = 'uTwitchStyle'
css.onload = function () {
console.info(`${url} loaded!`)
}
css.onerror = () => {
console.log(`${url} error!`)
}
css.href = `${url}?v=${Date.now()}`
head.appendChild(css);
}
})();
@DerTyp7214
Copy link
Author

uTwitch Userscript

Install uTwitch Script which supports automatic updates and customization.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment