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

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

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


From: Ivaylo Valkov
Subject: [linterna-magica-commit] [154] Changes for tasks #11216.
Date: Mon, 25 Jul 2011 14:13:43 +0000

Revision: 154
          
http://svn.sv.gnu.org/viewvc/?view=rev&root=linterna-magica&revision=154
Author:   valkov
Date:     2011-07-25 14:13:42 +0000 (Mon, 25 Jul 2011)
Log Message:
-----------
Changes for tasks #11216. Added rule to process duplicate objects (already 
processed) before XHR.

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

Modified Paths:
--------------
    branches/task-11216/src/lm_site_youtube.js
    branches/task-11216/src/lm_sites.js
    branches/task-11216/src/lm_xhr.js

Modified: branches/task-11216/src/lm_site_youtube.js
===================================================================
--- branches/task-11216/src/lm_site_youtube.js  2011-07-25 13:49:17 UTC (rev 
153)
+++ branches/task-11216/src/lm_site_youtube.js  2011-07-25 14:13:42 UTC (rev 
154)
@@ -401,3 +401,16 @@
 
     return object_data;
 }
+
+LinternaMagica.prototype.sites["youtube.com"].
+    process_duplicate_object_before_xhr =
+function(object_data)
+{
+    this.log("LinternaMagica.sites.process_duplicate_object_before_xhr:\n"+
+            "Removing/hiding duplicate object ",1);
+
+    this.hide_flash_video_object(object_data.linterna_magica_id,
+                                object_data.parent);
+
+    return false;
+}

Modified: branches/task-11216/src/lm_sites.js
===================================================================
--- branches/task-11216/src/lm_sites.js 2011-07-25 13:49:17 UTC (rev 153)
+++ branches/task-11216/src/lm_sites.js 2011-07-25 14:13:42 UTC (rev 154)
@@ -255,6 +255,15 @@
     return true;
 }
 
+// Run a function when duplicate object is found (being already processed)
+// before XHR.  The return value does not really matter. The caller
+// function returns null after executing this code.
+LinternaMagica.prototype.sites.__process_duplicate_object_before_xhr =
+function(object_data)
+{
+    return true;
+}
+
 // LinternaMagica.prototype.sites.__insert_object_after_xhr
 
 // Check if site specific config and function exists and call it. If

Modified: branches/task-11216/src/lm_xhr.js
===================================================================
--- branches/task-11216/src/lm_xhr.js   2011-07-25 13:49:17 UTC (rev 153)
+++ branches/task-11216/src/lm_xhr.js   2011-07-25 14:13:42 UTC (rev 154)
@@ -56,15 +56,11 @@
        this.log("LinternaMagica.request_video_link:\n"+
                 "Video with id  "+video_id+
                 " is being processed. Skipping this request."+host,1);
-       if (/youtube\.com/i.test(window.location.hostname) ||
-           /youtube-nocookie\.com/i.test(window.location.hostname))
-       {
-           this.log("LinternaMagica.request_video_link:\n"+
-                    "Removing/hiding duplicate object ",1);
 
-           this.hide_flash_video_object(object_data.linterna_magica_id,
-                                        object_data.parent);
-       }
+       var self = this;
+       var val = this.call_site_function_at_position.apply(self,[
+           "process_duplicate_object_before_xhr",
+           host, object_data]);
 
        return null;
     }




reply via email to

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