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

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

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


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

Revision: 155
          
http://svn.sv.gnu.org/viewvc/?view=rev&root=linterna-magica&revision=155
Author:   valkov
Date:     2011-07-25 14:31:12 +0000 (Mon, 25 Jul 2011)
Log Message:
-----------
Changes for tasks #11216. Added rule for custom code for insertion of the 
replacement object after XHR.

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

Modified Paths:
--------------
    branches/task-11216/src/lm_site_vimeo.js
    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_vimeo.js
===================================================================
--- branches/task-11216/src/lm_site_vimeo.js    2011-07-25 14:13:42 UTC (rev 
154)
+++ branches/task-11216/src/lm_site_vimeo.js    2011-07-25 14:31:12 UTC (rev 
155)
@@ -225,3 +225,28 @@
 
     return object_data;
 }
+
+LinternaMagica.prototype.sites["vimeo.com"].insert_object_after_xhr =
+function(object_data)
+{
+
+    // Just return true and let the default code do its job. A special
+    // attention is needed when no plugin is installed.
+    if (this.plugin_is_installed)
+    {
+       return true;
+    }
+    
+    if (!this.vimeo_browser_upgrade_timeout)
+    {
+       this.vimeo_browser_upgrade_counter = 0;
+       var data = object_data;
+       var self = this;
+       this.vimeo_browser_upgrade_timeout = setInterval(
+           function() {
+               self.detect_vimeo_browser_upgrade.apply(self,[data]);
+           }, 500);
+    }
+
+    return false;
+}

Modified: branches/task-11216/src/lm_site_youtube.js
===================================================================
--- branches/task-11216/src/lm_site_youtube.js  2011-07-25 14:13:42 UTC (rev 
154)
+++ branches/task-11216/src/lm_site_youtube.js  2011-07-25 14:31:12 UTC (rev 
155)
@@ -414,3 +414,28 @@
 
     return false;
 }
+
+LinternaMagica.prototype.sites["youtube.com"].insert_object_after_xhr =
+function(object_data)
+{
+    // Just return true and let the default code do its job. A special
+    // attention is needed when no plugin is installed.
+    if (this.plugin_is_installed)
+    {
+       return true;
+    }
+
+    if (!this.youtube_flash_upgrade_timeout)
+    {
+       this.youtube_flash_upgrade_counter = 0;
+       var data = object_data;
+       var self = this;
+
+       this.youtube_flash_upgrade_timeout = setInterval(
+           function() {
+               self.detect_youtube_flash_upgrade.apply(self,[data]);
+           }, 500);
+    }
+    
+    return false;
+}

Modified: branches/task-11216/src/lm_sites.js
===================================================================
--- branches/task-11216/src/lm_sites.js 2011-07-25 14:13:42 UTC (rev 154)
+++ branches/task-11216/src/lm_sites.js 2011-07-25 14:31:12 UTC (rev 155)
@@ -264,7 +264,12 @@
     return true;
 }
 
-// LinternaMagica.prototype.sites.__insert_object_after_xhr
+// Add the replacement object overriding the default code i freturn
+// value is false.
+LinternaMagica.prototype.sites.__insert_object_after_xhr = 
function(object_data)
+{
+    return true;
+}
 
 // Check if site specific config and function exists and call it. If
 // it doesn't, call the general/default function.  A function returns

Modified: branches/task-11216/src/lm_xhr.js
===================================================================
--- branches/task-11216/src/lm_xhr.js   2011-07-25 14:13:42 UTC (rev 154)
+++ branches/task-11216/src/lm_xhr.js   2011-07-25 14:31:12 UTC (rev 155)
@@ -100,7 +100,9 @@
     client.open(method,address ,true);
 
     if (content)
+    {
        client.setRequestHeader("Content-Type", content);
+    }
 
     client.send(data);
 }
@@ -140,15 +142,12 @@
            object_data.mime = mime;
        }
 
-       // FIXME HTML5 in WebKit switch like for flash plugin ?
-       // In the next release 0.0.10 ?!
-       if (!/youtube\.com/i.test(window.location.host) &&
-           !/youtube-nocookie\.com/i.test(window.location.host) &&
-           !/vimeo\.com/i.test(window.location.host) ||
-           ((/youtube\.com/i.test(window.location.host) ||
-             /youtube-nocookie\.com/i.test(window.location.host) ||
-             /vimeo\.com/i.test(window.location.host)) &&
-            this.plugin_is_installed))
+       var self = this;
+       var val = this.call_site_function_at_position.apply(self,[
+           "insert_object_after_xhr",
+           host, object_data]);
+
+       if (val)
        {
            this.log("LinternaMagica.request_video_link_parse_response:\n"+
                     "Removing plugin install warning.",2);
@@ -157,36 +156,5 @@
                     "Creating video object with url: "+object_data.link,1);
            this.create_video_object(object_data)
        }
-       else if ((/youtube\.com/i.test(window.location.host) ||
-                 /youtube-nocookie\.com/i.test(window.location.host))  &&
-                ! this.plugin_is_installed)
-       {
-           if (!this.youtube_flash_upgrade_timeout)
-           {
-               this.youtube_flash_upgrade_counter = 0;
-               var data = object_data;
-               var self = this;
-               this.youtube_flash_upgrade_timeout =
-                   setInterval(function() {
-                       self.detect_youtube_flash_upgrade.
-                           apply(self,[data]);
-                   }, 500);
-           }
-       }
-       else if (/vimeo\.com/i.test(window.location.host) &&
-                ! this.plugin_is_installed)
-       {
-           if (!this.vimeo_browser_upgrade_timeout)
-           {
-               this.vimeo_browser_upgrade_counter = 0;
-               var data = object_data;
-               var self = this;
-               this.vimeo_browser_upgrade_timeout =
-                   setInterval(function() {
-                       self.detect_vimeo_browser_upgrade.
-                           apply(self,[data]);
-                   }, 500);
-           }
-       }
     }
 }




reply via email to

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