Created
October 15, 2016 16:10
-
-
Save Mido22/7e2fc285edc9a673e879bd38128ce66f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name ballfoot.goToIFrame | |
// @match http://www.p2pfree.net/view-live-video/* | |
// @version 1.0.0 | |
// @grant none | |
// @namespace https://gist.github.com/Mido22 | |
// ==/UserScript== | |
(function(w, d){ | |
'use strict' | |
w.addEventListener('load', () => { | |
addButton('go to src', onClick) | |
}) | |
function onClick() { | |
let a = d.querySelector('.player600 iframe').src | |
if(a) d.location.href = a | |
} | |
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