3 // @description Turn La7 embedded flash video into HTML5
4 // @namespace http://oblomov.myopenid.com
5 // @include http://www.la7.it/*
6 // @include http://la7.it/*
7 // @include http://live.la7.it/*
8 // @author Giuseppe "Oblomov" Bilotta
14 var flashdiv = document.getElementById("FlashObject");
15 var sCH = document.getElementById("silverlightControlHost");
21 flashvars.contentURL = urlVideoPlay;
22 flashvars.title = liveTitle;
23 console.log(flashvars);
24 } else if (flashdiv) {
25 embed = flashdiv.getElementsByTagName("embed");
27 if (!embed || !embed[0]) {
33 var flashvarsAR = embed.getAttribute('flashvars').split('&');
35 for (var i = 0; i < flashvarsAR.length; ++i) {
36 var kv = flashvarsAR[i].split('=');
37 flashvars[kv[0]] = kv[1];
44 var video = document.createElement('video');
45 video.controls = true;
46 video.autoplay = true;
47 video.width = embed.width || embed.clientWidth;
48 video.height = embed.height || embed.clientHeight;
49 video.id = 'html5' + embed.id;
50 video.src = flashvars.contentURL;
51 video.title = flashvars.title;
54 sCH.parentNode.insertBefore(video, embed);
55 } else if (flashdiv) {
56 flashdiv.insertBefore(video, embed);
58 video.appendChild(embed);
60 var url_host = document.getElementById("fb-root");
62 url_host = document.getElementById("___plusone_0");
65 url_host = url_host.parentNode;
66 var a = document.createElement('a');
67 a.href = flashvars.contentURL;
68 a.innerHTML = "Direct link";
69 a.setAttribute('style', 'font-weight:bold;margin-left:1em;padding:1ex;color:blue;display:inline-box;border:1px solid blue;border-radius:.5ex');
70 url_host.appendChild(a);