linterna-magica-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linterna-magica-commit] [74] Merging the fix for bugs #33324 from trunk


From: Ivaylo Valkov
Subject: [linterna-magica-commit] [74] Merging the fix for bugs #33324 from trunk to branch 0.0.9
Date: Thu, 19 May 2011 10:54:27 +0000

Revision: 74
          
http://svn.sv.gnu.org/viewvc/?view=rev&root=linterna-magica&revision=74
Author:   valkov
Date:     2011-05-19 10:54:27 +0000 (Thu, 19 May 2011)
Log Message:
-----------
Merging the fix for bugs #33324 from trunk to branch 0.0.9

Ticket Links:
------------
    http://savannah.gnu.org/bugs/?33324

Modified Paths:
--------------
    branches/0.0.9/src/lm_constructors.js
    branches/0.0.9/src/lm_xhr.js

Property Changed:
----------------
    branches/0.0.9/


Property changes on: branches/0.0.9
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk:6,9,11,13,19,21,52,55,57,67
   + /trunk:6,9,11,13,19,21,52,55,57,67,73

Modified: branches/0.0.9/src/lm_constructors.js
===================================================================
--- branches/0.0.9/src/lm_constructors.js       2011-05-19 10:41:44 UTC (rev 73)
+++ branches/0.0.9/src/lm_constructors.js       2011-05-19 10:54:27 UTC (rev 74)
@@ -121,10 +121,15 @@
        this.player_timers = new Array();
     }
 
+    if (!this.plugin_is_installed &&
+       /dailymotion\.com/i.test(window.location.hostname))
+    {
+       this.request_video_link({video_id: window.location.pathname});
+    }
     // If there is a plugin installed do not search in scripts.
     // Exception for blip.tv. This is the easiesy way to
     // support it with installed plugin.
-    if (!this.plugin_is_installed ||
+    else if (!this.plugin_is_installed ||
        /blip\.tv/i.test(window.location.hostname) ||
        /myvideo\.de/i.test(window.location.hostname))
     {

Modified: branches/0.0.9/src/lm_xhr.js
===================================================================
--- branches/0.0.9/src/lm_xhr.js        2011-05-19 10:41:44 UTC (rev 73)
+++ branches/0.0.9/src/lm_xhr.js        2011-05-19 10:54:27 UTC (rev 74)
@@ -336,6 +336,52 @@
 
        if (/dailymotion\.com/i.test(host))
        {
+           if (!this.plugin_is_installed &&
+               !object_data.linterna_magica_id && 
+               !object_data.parent)
+           {
+               // In Dailymotion the script that creates the flash
+               // object replaces itself. The work around here is to
+               // request the page and process it. 
+
+               // Dailymotion uses pseudo-random ids for some DOM
+               // elements of interest. We replace the body HTML with
+               // the one returned by the XHR. Then scripts are
+               // processed. The script extraction code matches the
+               // correct ID for the parentNode in DOM, that will
+               // hold the video object. The original body is
+               // restored, because some data is missing in the body
+               // data from XHR. After all data is collected, the
+               // parentNode (object_data.parent), where the video
+               // object will be inserted is replaced with the one in
+               // the original body.  Custom function to match the
+               // parent by CSS class is used, because getElementById
+               // does not support regular expressions.
+
+               var body_data = 
+                   client.responseText.split("<body")[1].
+                   replace(/>{1}/,"__SPLIT__").
+                   split("__SPLIT__")[1];
+
+               var body = document.getElementsByTagName("body")[0];
+               var original_body_data = body.innerHTML;
+
+               body.innerHTML = body_data;
+
+               this.script_data = client.responseText;
+               object_data = this.extract_object_from_script_swfobject();
+
+               body.innerHTML = original_body_data;
+
+               object_data.parent = 
+                   this.getElementByClass("dmpi_video_playerv[0-9]+");
+
+               if (!object_data.parent)
+               {
+                   return null;
+               }
+           }
+
            hd_links = this.extract_dailymotion_links(client.responseText);
            url = hd_links ? hd_links[hd_links.length-1].url : null;
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]