From: Antonio Ospite <ospite@studenti.unina.it>
Date: Fri, 23 Dec 2011 22:15:39 +0000 (+0100)
Subject: Use the initCommand hook on Rai.tv
X-Git-Tag: 0.3~3
X-Git-Url: https://git.ao2.it/GM_direct_download_links.git/commitdiff_plain/b44c3136e2f6c694ba0cad07e08a40db0c894f29

Use the initCommand hook on Rai.tv

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>
---

diff --git a/direct_download_links.user.js b/direct_download_links.user.js
index fdf6ece..7da37b1 100644
--- a/direct_download_links.user.js
+++ b/direct_download_links.user.js
@@ -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' },