Skip to content

Instantly share code, notes, and snippets.

@Mido22
Created October 15, 2016 15:28
Show Gist options
  • Save Mido22/6ac21ef273fc6a7ea340895d127e7b31 to your computer and use it in GitHub Desktop.
Save Mido22/6ac21ef273fc6a7ea340895d127e7b31 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name only video
// @match http://10livestreams.com/*
// @version 1.0.3
// @grant none
// @namespace https://gist.github.com/Mido22
// ==/UserScript==
(function(w, d){
'use strict'
w.addEventListener('load', () => {
addButton('only video', keepOnlyVideo)
})
function keepOnlyVideo() {
let v = d.getElementsByTagName('video')[0], p = d.body, cs = p.childNodes
if(!v) return;
p.appendChild(v)
cs.forEach(e => p.removeChild(e))
v.style.height='100%'
v.style.width='auto'
}
function addButton(text, onclick, cssObj) {
cssObj = cssObj || {}
let dflt = {position: 'fixed', bottom: '7%', left:'13%', 'z-index': 3}
Object.keys(dflt).filter(k => !cssObj[k]).forEach(k => cssObj[k]=dflt[k])
let button = d.createElement('button'), btnStyle = button.style
d.body.appendChild(button)
button.innerHTML = text
button.onclick = onclick
btnStyle.position = 'absolute'
Object.keys(cssObj).forEach(key => btnStyle[key] = cssObj[key])
return button
}
}(window, document))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment