[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[linterna-magica-commit] [133] Changes for tasks #11216.
From: |
Ivaylo Valkov |
Subject: |
[linterna-magica-commit] [133] Changes for tasks #11216. |
Date: |
Fri, 15 Jul 2011 11:41:39 +0000 |
Revision: 133
http://svn.sv.gnu.org/viewvc/?view=rev&root=linterna-magica&revision=133
Author: valkov
Date: 2011-07-15 11:41:38 +0000 (Fri, 15 Jul 2011)
Log Message:
-----------
Changes for tasks #11216. Added rule to replace the extracted swf object.
Overrides the default replacement code. The sites that need this change use it.
Ticket Links:
------------
http://savannah.gnu.org/task/?11216
Modified Paths:
--------------
branches/task-11216/src/lm_extract_js_scripts.js
branches/task-11216/src/lm_site_facebook.js
branches/task-11216/src/lm_site_youtube.js
branches/task-11216/src/lm_sites.js
Property Changed:
----------------
branches/task-11216/
Property changes on: branches/task-11216
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/0.0.9:94
/trunk:103,106-107,113,115,123,126
+ /branches/0.0.9:94
/trunk:103,106-107,113,115,123,126,131
Modified: branches/task-11216/src/lm_extract_js_scripts.js
===================================================================
--- branches/task-11216/src/lm_extract_js_scripts.js 2011-07-15 10:42:31 UTC
(rev 132)
+++ branches/task-11216/src/lm_extract_js_scripts.js 2011-07-15 11:41:38 UTC
(rev 133)
@@ -78,7 +78,6 @@
"extract_object_from_script",
window.location.hostname]);
-
if (this.sites[window.location.hostname] && !val)
{
// Site specific code is used but no results were
@@ -125,30 +124,21 @@
if (object_data && object_data.link)
{
- if(!/youtube\.com/i.test(window.location.hostname) &&
- !/.*facebook\.com/i.test(window.location.hostname))
- {
+ var self = this;
+ var val = this.call_site_function_at_position.apply(self,[
+ "replace_extracted_object_from_script",
+ window.location.hostname,object_data]);
+ // Default
+ if (val && typeof(val) == "boolean")
+ {
this.log("LinternaMagica.extract_objects_from_scripts:\n"+
- "Removing plugin install warning.",2);
+ "Removing plugin install warning.",2);
- this.remove_plugin_install_warning(object_data.parent);
+ this.remove_plugin_install_warning(object_data.parent);
- this.create_video_object(object_data);
+ this.create_video_object(object_data);
}
-
- if (/.*facebook\.com/i.test(window.location.hostname) &&
- !this.facebook_flash_upgrade_timeout)
- {
- this.facebook_flash_upgrade_counter = 0;
- var data = object_data;
- var self = this;
- this.facebook_flash_upgrade_timeout =
- setInterval(function() {
- self.detect_facebook_flash_upgrade.
- apply(self,[data]);
- }, 500);
- }
}
if (object_data && (object_data.video_id || object_data.link))
Modified: branches/task-11216/src/lm_site_facebook.js
===================================================================
--- branches/task-11216/src/lm_site_facebook.js 2011-07-15 10:42:31 UTC (rev
132)
+++ branches/task-11216/src/lm_site_facebook.js 2011-07-15 11:41:38 UTC (rev
133)
@@ -58,3 +58,30 @@
this.create_video_object(object_data);
}
}
+
+LinternaMagica.prototype.sites["facebook.com"] = new Object();
+
+// Reference
+LinternaMagica.prototype.sites["www.facebook.com"] = "facebook.com";
+
+LinternaMagica.prototype.sites["facebook.com"].
+ replace_extracted_object_from_script =
+function(object_data)
+{
+ if (!this.facebook_flash_upgrade_timeout)
+ {
+ this.log("LinternaMagica.sites.replace_extracted_"+
+ "object_from_script:\n"+
+ "Delaying video object creation in Facebook.",3);
+ this.facebook_flash_upgrade_counter = 0;
+ var data = object_data;
+ var self = this;
+ this.facebook_flash_upgrade_timeout =
+ setInterval(function() {
+ self.detect_facebook_flash_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-15 10:42:31 UTC (rev
132)
+++ branches/task-11216/src/lm_site_youtube.js 2011-07-15 11:41:38 UTC (rev
133)
@@ -339,3 +339,14 @@
"Found one object in YouTube. Stopping script processing",3);
return false;
}
+
+// Just return true or false. The function must be defined, so the
+// default code will not be executed. YouTube's object is created
+// after XHR.
+LinternaMagica.prototype.sites["youtube.com"].
+ replace_extracted_object_from_script =
+function()
+{
+ return false;
+}
+
Modified: branches/task-11216/src/lm_sites.js
===================================================================
--- branches/task-11216/src/lm_sites.js 2011-07-15 10:42:31 UTC (rev 132)
+++ branches/task-11216/src/lm_sites.js 2011-07-15 11:41:38 UTC (rev 133)
@@ -156,12 +156,17 @@
return true;
}
+// Create the replacement object. See
+// lm_site_facebook.js:replace_extracted_object_from_script
+LinternaMagica.prototype.sites.__replace_extracted_object_from_script =
+function()
+{
+ return true;
+}
+
// LinternaMagica.prototype.sites.__extract_scripts_extract_when // Condition
? DM /ted?
-
-// LinternaMagica.prototype.sites.__extract_scripts_wait_insert // FB
// LinternaMagica.prototype.sites.__wait_before_inserting_object_from-script
// FB
// LinternaMagica.prototype.sites.__extract_swfobject_regex
-
// LinternaMagica.prototype.sites.__extract_video_link_regex
// LinternaMagica.prototype.sites.__extract_video_link_match
// LinternaMagica.prototype.sites.__match_for_video_link
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [linterna-magica-commit] [133] Changes for tasks #11216.,
Ivaylo Valkov <=