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

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

[linterna-magica-commit] [365] Fixes Dailymotion.


From: Ivaylo Valkov
Subject: [linterna-magica-commit] [365] Fixes Dailymotion.
Date: Fri, 28 Dec 2012 07:03:19 +0000

Revision: 365
          
http://svn.sv.gnu.org/viewvc/?view=rev&root=linterna-magica&revision=365
Author:   valkov
Date:     2012-12-28 07:03:01 +0000 (Fri, 28 Dec 2012)
Log Message:
-----------
Fixes Dailymotion. #future_release_0.0.13

Modified Paths:
--------------
    trunk/src/lm_site_dailymotion.js

Modified: trunk/src/lm_site_dailymotion.js
===================================================================
--- trunk/src/lm_site_dailymotion.js    2012-12-26 07:23:24 UTC (rev 364)
+++ trunk/src/lm_site_dailymotion.js    2012-12-28 07:03:01 UTC (rev 365)
@@ -191,40 +191,11 @@
        // 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.
+       // Dailymotion uses pseudo-random ids for some DOM elements of
+       // interest. 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;
-
-       if (!object_data)
-       {
-           return null;
-       }
-
        object_data.parent = 
            this.get_first_element_by_class("dmpi_video_playerv[0-9]+");
 
@@ -232,6 +203,14 @@
        {
            return null;
        }
+
+       object_data.width = object_data.parent.clientWidth ? 
+           object_data.parent.clientWidth : object_data.offsetWidht ?
+           object_data.offsetWidht : null ;
+
+       object_data.height = object_data.parent.clientHeight ? 
+           object_data.parent.clientHeight : object_data.offsetWidht ?
+           object_data.offsetWidht : null ;
     }
 
     var hd_links = this.extract_dailymotion_links(client.responseText);
@@ -255,6 +234,12 @@
     }
 
 
+       if (!object_data.width || !object_data.height || !object_data.link)
+       {
+           return null;
+       }
+
+
     return object_data;
 }
 




reply via email to

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