Iplayer radio wma.user.js

// ==UserScript== // @include http://www.bbc.co.uk/* // ==/UserScript== (function{ var mkWMA = function(oldlnk,lnk){ var url = oldlnk.href; var id1=url.slice(url.lastIndexOf("/")+1); var REQ=new XMLHttpRequest; REQ.open("GET", "http://www.bbc.co.uk/iplayer/playlist/"+id1, false); REQ.send(null); var id2 = REQ.responseXML.getElementsByTagName("item")[0].getAttribute("identifier"); REQ.open("GET", "http://www.bbc.co.uk/mediaselector/4/asx/"+id2+"/iplayer_intl_stream_wma_lo_concrete", false) REQ.send(null); var targeturl = REQ.responseXML.getElementsByTagName("ref")[0].getAttribute("href"); lnk.href=targeturl; lnk.onclick=function{}; } // look for a.aod-link, its href is what we are looking for. var links = document.getElementsByTagName("a"); for(var i=0; i -1) || (links[i].className.indexOf("iplayer-cta") > -1) || (links[i].className.indexOf("broadcast-item--episode") > -1) || (links[i].className.indexOf("media-player--popout") > -1) ){// ugly   var wma= document.createElement("a");           wma.style.cssText="z-index:5;position:relative;"; wma.href="javascript:;"; wma.onclick=function(oldlink,wma){return function{mkWMA(oldlink,wma)};}(links[i],wma); wma.appendChild(document.createTextNode("WMA")); links[i].parentNode.appendChild(wma); } } });