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

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

[linterna-magica-commit] [117] Changes for tasks #11216.


From: Ivaylo Valkov
Subject: [linterna-magica-commit] [117] Changes for tasks #11216.
Date: Thu, 07 Jul 2011 10:09:56 +0000

Revision: 117
          
http://svn.sv.gnu.org/viewvc/?view=rev&root=linterna-magica&revision=117
Author:   valkov
Date:     2011-07-07 10:09:56 +0000 (Thu, 07 Jul 2011)
Log Message:
-----------
Changes for tasks #11216. Added rule to skip video_id extraction. The changes 
are in use.

Ticket Links:
------------
    http://savannah.gnu.org/task/?11216

Modified Paths:
--------------
    branches/task-11216/src/lm_extract_dom_objects.js
    branches/task-11216/src/lm_site_dailymotion.js
    branches/task-11216/src/lm_sites.js

Modified: branches/task-11216/src/lm_extract_dom_objects.js
===================================================================
--- branches/task-11216/src/lm_extract_dom_objects.js   2011-07-07 08:54:01 UTC 
(rev 116)
+++ branches/task-11216/src/lm_extract_dom_objects.js   2011-07-07 10:09:56 UTC 
(rev 117)
@@ -77,16 +77,26 @@
            || (this.is_swf_object(object)
                && !this.is_swf_object(object.parentNode)))
        {
-           if (/dailymotion\.com/i.test(window.location.hostname))
+           var extracted_data = new Object();
+
+           var self = this;
+           var val = this.call_site_function_at_position.apply(self,[
+               "skip_video_id_extraction",
+               window.location.hostname]);
+
+           if (!val)
            {
-               var extracted_data = new Object();
-               extracted_data.video_id = window.location.pathname;
+               return null;
            }
-           else
+           else if (typeof(val) == "boolean")
            {
                this.create_param_list(object);
-               var extracted_data = this.extract_link_from_param_list();
+               extracted_data = this.extract_link_from_param_list();
            }
+           else
+           {
+               extracted_data = val;
+           }
 
            object_data.remote_site_link = extracted_data.remote_site_link;
            object_data.link = extracted_data.link;

Modified: branches/task-11216/src/lm_site_dailymotion.js
===================================================================
--- branches/task-11216/src/lm_site_dailymotion.js      2011-07-07 08:54:01 UTC 
(rev 116)
+++ branches/task-11216/src/lm_site_dailymotion.js      2011-07-07 10:09:56 UTC 
(rev 117)
@@ -100,3 +100,13 @@
     // lm_detect_flash.js not detect the iframe as swf.
     return false;
 }
+
+LinternaMagica.prototype.sites["dailymotion.com"].skip_video_id_extraction =
+function ()
+{
+    // Can't extract video_id from script when flash is not
+    // isntalled. The video id is always the pathname.
+    var extracted_data = new Object();
+    extracted_data.video_id = window.location.pathname;
+    return  extracted_data;
+}

Modified: branches/task-11216/src/lm_sites.js
===================================================================
--- branches/task-11216/src/lm_sites.js 2011-07-07 08:54:01 UTC (rev 116)
+++ branches/task-11216/src/lm_sites.js 2011-07-07 10:09:56 UTC (rev 117)
@@ -32,6 +32,7 @@
 // A function returns false/null, if the calling function should
 // exit/return after this function is executed.  Otherwise it should
 // return true.
+
 // Take an action before options initialisation. This is the
 // earliest position where site-specific action could be
 // taken. The default config is to keep processing.
@@ -87,7 +88,16 @@
     return true;
 }
 
-// LinternaMagica.prototype.sites.__skip_video_id_extract // DM force?
+// Set the video_id to the returned value and skip extraction from DOM
+// object attributes. The true return value for this default function
+// does not stop extraction. See comments after
+// LinternaMagica.prototype.sites. See
+// lm_site_dailymotion.js:skip_video_id_extraction
+LinternaMagica.prototype.sites.__skip_video_id_extraction = function()
+{
+    return true;
+}
+
 // LinternaMagica.prototype.sites.__skip_xhr_if_video_id
 // LinternaMagica.prototype.sites.__wait_before_xhr
 // LinternaMagica.prototype.sites.__extract_scripts_extract_when // Condition 
? DM /ted? 




reply via email to

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