[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[linterna-magica-commit] [233] Fixes bugs #34960.
From: |
Ivaylo Valkov |
Subject: |
[linterna-magica-commit] [233] Fixes bugs #34960. |
Date: |
Mon, 05 Dec 2011 18:24:07 +0000 |
Revision: 233
http://svn.sv.gnu.org/viewvc/?view=rev&root=linterna-magica&revision=233
Author: valkov
Date: 2011-12-05 18:24:06 +0000 (Mon, 05 Dec 2011)
Log Message:
-----------
Fixes bugs #34960. Dailymotion should load and work in all browsers.
Ticket Links:
------------
http://savannah.gnu.org/bugs/?34960
Modified Paths:
--------------
trunk/src/lm_extract_video_link.js
trunk/src/lm_site_dailymotion.js
trunk/src/lm_sites.js
trunk/src/lm_video_and_flash_objects_helper_functions.js
Modified: trunk/src/lm_extract_video_link.js
===================================================================
--- trunk/src/lm_extract_video_link.js 2011-12-01 11:51:15 UTC (rev 232)
+++ trunk/src/lm_extract_video_link.js 2011-12-05 18:24:06 UTC (rev 233)
@@ -123,10 +123,18 @@
// "i");
- // Some links used with flowplayer are relative
- if (data.match(/.*flowplayer.*/))
+ self = this;
+ val = this.call_site_function_at_position.apply(self,[
+ "skip_flowplayer_links_fix",
+ window.location.hostname]);
+
+ if (val)
{
- link = this.fix_flowplayer_links(link);
+ // Some links used with flowplayer are relative
+ if (data.match(/.*flowplayer.*/))
+ {
+ link = this.fix_flowplayer_links(link);
+ }
}
this.log("LinternaMagica.extract_link:\n"+
Modified: trunk/src/lm_site_dailymotion.js
===================================================================
--- trunk/src/lm_site_dailymotion.js 2011-12-01 11:51:15 UTC (rev 232)
+++ trunk/src/lm_site_dailymotion.js 2011-12-05 18:24:06 UTC (rev 233)
@@ -351,3 +351,29 @@
return null;
}
+
+LinternaMagica.prototype.sites["dailymotion.com"].skip_flowplayer_links_fix =
+function(object_data)
+{
+ // Must return false to skip the fix.
+ return false;
+}
+
+LinternaMagica.prototype.sites["dailymotion.com"].custom_html5_player_finder =
+function(parent)
+{
+ var html5_player_element = null;
+
+ if (parent.hasAttribute("id"))
+ {
+ var token = parent.getAttribute("id").split("_");
+
+ if (token && token[1])
+ {
+ html5_player_element =
+ document.getElementById("container_player_"+token[1]);
+ }
+ }
+
+ return html5_player_element;
+}
Modified: trunk/src/lm_sites.js
===================================================================
--- trunk/src/lm_sites.js 2011-12-01 11:51:15 UTC (rev 232)
+++ trunk/src/lm_sites.js 2011-12-05 18:24:06 UTC (rev 233)
@@ -278,6 +278,23 @@
return true;
}
+// Skip matching for flowplayer and fixing links. See
+// lm_site_dailymotion.js:skip_flowplayer_links_fix()
+LinternaMagica.prototype.sites.__skip_flowplayer_links_fix =
+function(object_data)
+{
+ return true;
+}
+
+// Site specific code (rule) used to find the site HTML5 player
+// element in the parent element. See
+// lm_site_dailymotion.js:custom_html5_player_finder()
+LinternaMagica.prototype.sites.__custom_html5_player_finder =
+function(parent)
+{
+ 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
// false/null, if the calling function should exit/return after this
Modified: trunk/src/lm_video_and_flash_objects_helper_functions.js
===================================================================
--- trunk/src/lm_video_and_flash_objects_helper_functions.js 2011-12-01
11:51:15 UTC (rev 232)
+++ trunk/src/lm_video_and_flash_objects_helper_functions.js 2011-12-05
18:24:06 UTC (rev 233)
@@ -215,25 +215,41 @@
return null;
}
+ var self = this;
var html5_player_holder = null;
var t = null;
- var video_or_canvas = parent.getElementsByTagName("video");
+ var html5_player_element = null;
- if (!video_or_canvas || !video_or_canvas.length)
+ var val = this.call_site_function_at_position.apply(self,[
+ "custom_html5_player_finder",
+ window.location.hostname, parent]);
+
+ if (val && typeof(val) != "boolean")
{
- // Some pages (Vimeo, Dailymotion might use a canvas tag
- // before inserting the video tag).
- video_or_canvas = parent.getElementsByTagName("canvas");
+ html5_player_element = val;
+ }
+ else
+ {
+ html5_player_element = parent.getElementsByTagName("video");
- // No more guesses
- if (!video_or_canvas || !video_or_canvas.length)
+ if (!html5_player_element || !html5_player_element.length)
{
- return null;
+ // Some pages (Vimeo, Dailymotion (now uses iframe) might
+ // use a canvas tag before inserting the video tag).
+ html5_player_element = parent.getElementsByTagName("canvas");
+
+ // No more guesses
+ if (!html5_player_element || !html5_player_element.length)
+ {
+ return null;
+ }
}
+
+ html5_player_element = html5_player_element[0];
}
- html5_player_holder = video_or_canvas[0].parentNode;
+ html5_player_holder = html5_player_element.parentNode;
// Searching for the holder element that is placed in the
// parent element (parent) that holds Linterna Magica.
@@ -248,6 +264,13 @@
html5_player_holder = t;
}
+ // We don't want to hide the LM player as well. The wrapper should
+ // be the HTML5 player itself.
+ if (html5_player_holder == parent)
+ {
+ html5_player_holder = html5_player_element;
+ }
+
return html5_player_holder;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [linterna-magica-commit] [233] Fixes bugs #34960.,
Ivaylo Valkov <=