[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[linterna-magica-commit] [120] Changes for tasks #11216.
From: |
Ivaylo Valkov |
Subject: |
[linterna-magica-commit] [120] Changes for tasks #11216. |
Date: |
Fri, 08 Jul 2011 10:24:59 +0000 |
Revision: 120
http://svn.sv.gnu.org/viewvc/?view=rev&root=linterna-magica&revision=120
Author: valkov
Date: 2011-07-08 10:24:58 +0000 (Fri, 08 Jul 2011)
Log Message:
-----------
Changes for tasks #11216. Added rule to skip link extraction from DOM object
attributes. The sites that require the changes use them
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_youtube.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 13:41:41 UTC
(rev 119)
+++ branches/task-11216/src/lm_extract_dom_objects.js 2011-07-08 10:24:58 UTC
(rev 120)
@@ -408,19 +408,16 @@
break;
}
- // This bloats FF in youtube:
- // LinternaMagica.extract_link_from_param_list: Trying
- // to extract a link from param/attribute "flashvars"
- // at www.youtube.com time: ***14:58:59:999***
- // LinternaMagica.extract_link: No link found. at
- // www.youtube.com time: ***15:12:21:356***
- if (!/youtube\.com/i.test(window.location.hostname) &&
- !/youtube-nocookie\.com/i.test(window.location.hostname))
+ var self = this;
+ var val = this.call_site_function_at_position.apply(self,[
+ "skip_link_extraction",
+ window.location.hostname]);
+
+ if (val)
{
this.log("LinternaMagica.extract_link_from_param_list:\n"+
"Trying to extract a link from"+
" param/attribute \""+param.name+"\"",4);
-
if (!extracted.link)
{
this.extract_link_data = param.value;
Modified: branches/task-11216/src/lm_site_youtube.js
===================================================================
--- branches/task-11216/src/lm_site_youtube.js 2011-07-07 13:41:41 UTC (rev
119)
+++ branches/task-11216/src/lm_site_youtube.js 2011-07-08 10:24:58 UTC (rev
120)
@@ -307,9 +307,25 @@
// Reference
LinternaMagica.prototype.sites["www.youtube.com"] = "youtube.com";
+LinternaMagica.prototype.sites["www.youtube-nocookie.com"] = "youtube.com";
+LinternaMagica.prototype.sites["youtube-nocookie.com"] = "youtube.com";
LinternaMagica.prototype.sites["youtube.com"].set_cookies_domain =
function()
{
return ".youtube.com";
}
+
+LinternaMagica.prototype.sites["youtube.com"].skip_link_extraction = function()
+{
+ // Link extraction bloats FF in youtube:
+ // LinternaMagica.extract_link_from_param_list:
+ // Trying to extract a link from param/attribute "flashvars"
+ // at www.youtube.com time: ***14:58:59:999***
+ // LinternaMagica.extract_link: No link found. at
+ // www.youtube.com time: ***15:12:21:356***
+ this.log("LinternaMagica.sites.skip_link_extraction:\n"+
+ "Skipping link extraction in YouTube. Might bloat "+
+ "GNU IceCat and other forks and versions of Firefox.",4);
+ return false;
+}
Modified: branches/task-11216/src/lm_sites.js
===================================================================
--- branches/task-11216/src/lm_sites.js 2011-07-07 13:41:41 UTC (rev 119)
+++ branches/task-11216/src/lm_sites.js 2011-07-08 10:24:58 UTC (rev 120)
@@ -107,6 +107,16 @@
return true;
}
+// Do not extract video link. The true return value for this default
+// function does not stop link extraction. See comments after
+// LinternaMagica.prototype.sites. See
+// lm_site_youtube.js:skip_link_extraction
+LinternaMagica.prototype.sites.__skip_link_extraction = function()
+{
+ return true;
+}
+
+
// LinternaMagica.prototype.sites.__extract_scripts_extract_when // Condition
? DM /ted?
// LinternaMagica.prototype.sites.__extract_scripts_once // YT ?
// LinternaMagica.prototype.sites.__extract_scripts_wait_insert // FB
@@ -176,17 +186,26 @@
var ref_to = this.sites[match_site];
- this.log("LinternaMagica.call_site_function_at_position:\n"+
- "Using another site config (reference) for function "+
- position_name+": "+match_site+" -> "+ref_to,debug_level);
+ // Don't make calls to a reference if it's function is not
+ // defined and the default one will be called anyway.
+ if (typeof(this.sites[ref_to][position_name]) != "undefined")
+ {
+ this.log("LinternaMagica.call_site_function_at_position:\n"+
+ "Using another site config (reference) for function "+
+ position_name+": "+match_site+" ->
"+ref_to,debug_level);
- return this.call_site_function_at_position.apply(self, [
- position_name, ref_to, data]);
+ return this.call_site_function_at_position.apply(self, [
+ position_name, ref_to, data]);
+ }
}
}
- else if ((this.sites[match_site] &&
- !this.sites[match_site][position_name]) ||
- !this.sites[match_site])
+
+ // MUST be in separate if block. Don't merge with previous
+ // one. The first if (this.sites[match_site]) will be accessed
+ // before this one.
+ if ((this.sites[match_site] &&
+ !this.sites[match_site][position_name]) ||
+ !this.sites[match_site])
{
// General-purpose / default function.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [linterna-magica-commit] [120] Changes for tasks #11216.,
Ivaylo Valkov <=