Use the initCommand hook on Rai.tv
authorAntonio Ospite <ospite@studenti.unina.it>
Fri, 23 Dec 2011 22:15:39 +0000 (23:15 +0100)
committerAntonio Ospite <ospite@studenti.unina.it>
Fri, 23 Dec 2011 22:15:39 +0000 (23:15 +0100)
In order to enable the rendering of the <object/> element containing the
mediaURI we need, we spoof a SilverLight installation.

Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>
direct_download_links.user.js

index fdf6ece..7da37b1 100644 (file)
@@ -30,8 +30,6 @@
 // @include        http://www.rai.tv/*
 // ==/UserScript==
 //
-// NOTE, for rai.tv to work you need to install a script like:
-// http://git.ao2.it/smooth-dl.git/blob_plain/HEAD:/scripts/SilverSpoof.user.js
 
 /*
  * TODO:
@@ -101,6 +99,11 @@ var supported_sites = [
   },
   {
     locationRegexp: /^http:\/\/www\.rai\.tv\/.*$/,
+      initCommand: function(site) {
+        unsafeWindow.Silverlight.isInstalled = function(version) {
+          return true;
+        };
+    },
     urlContainer: 'Player',
     urlRegexp: /mediaUri=(http:\/\/[^,]*)/,
     onEvent: { evt: 'DOMNodeInserted', targetElement: 'object' },