Last active
February 20, 2025 22:46
-
-
Save olijf/187b5480e12b4afa245dc60ed7d5bd0d 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 Fosdem Chromecastplayer | |
// @version 1.0 | |
// @description Adds link to cast to Chromecast using Chromecast.link | |
// @match *://live.fosdem.org/watch* | |
// @copyright 2021, Olaf | |
// ==/UserScript== | |
function _x(STR_XPATH) { | |
var xresult = document.evaluate(STR_XPATH, document, null, XPathResult.ANY_TYPE, null); | |
var xnodes = []; | |
var xres; | |
while (xres = xresult.iterateNext()) { | |
xnodes.push(xres); | |
} | |
return xnodes; | |
} | |
(function() { | |
'use strict'; | |
var child = _x('/html/body/div[3]/p[2]/a[1]') | |
var blah = document.createElement('a') | |
blah.setAttribute('href', 'https://chromecast.link/#content=' + encodeURI(child[0].href)) | |
blah.innerHTML = '<br/>Cast!' | |
child[0].append(blah) | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment