Skip to content

Instantly share code, notes, and snippets.

@lewisakura
Created September 22, 2020 16:59
Show Gist options
  • Save lewisakura/6cd43ce9178d8f036ff2e888dc112f63 to your computer and use it in GitHub Desktop.
Save lewisakura/6cd43ce9178d8f036ff2e888dc112f63 to your computer and use it in GitHub Desktop.
TwistPlyr
// ==UserScript==
// @name TwistPlyr
// @version 0.1
// @description Converts twist.moe's player to Plyr, which is a lot more stable and doesn't stutter as much, as well as using partial content instead of livestreaming.
// @author LewisTehMinerz
// @match https://twist.moe/a/*
// @grant none
// ==/UserScript==
((d, script, link, style) => {
script = d.createElement('script');
script.type = 'text/javascript';
script.async = true;
script.onload = () => {
const waitInterval = setInterval(() => {
const element = document.querySelector('.AT-player div');
if (!element) return;
clearInterval(waitInterval);
element.parentNode.removeChild(element);
new Plyr('video');
});
};
script.src = 'https://cdn.plyr.io/3.6.2/plyr.js';
link = d.createElement('link');
link.rel = 'stylesheet';
link.href = 'https://cdn.plyr.io/3.6.2/plyr.css';
style = d.createElement('style');
style.type = 'text/css';
style.innerHTML = ':root { --plyr-color-main: #e53232 }';
d.getElementsByTagName('head')[0].appendChild(script);
d.getElementsByTagName('head')[0].appendChild(style);
d.getElementsByTagName('head')[0].appendChild(link);
})(document);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment