[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[linterna-magica-commit] [404] Fixes the issues with history navigation.
From: |
Ivaylo Valkov |
Subject: |
[linterna-magica-commit] [404] Fixes the issues with history navigation. |
Date: |
Sun, 02 Jun 2013 14:20:12 +0000 |
Revision: 404
http://svn.sv.gnu.org/viewvc/?view=rev&root=linterna-magica&revision=404
Author: valkov
Date: 2013-06-02 14:20:11 +0000 (Sun, 02 Jun 2013)
Log Message:
-----------
Fixes the issues with history navigation. Bugs #38861. Pages now send referrer
header to the savnnah servers where updates.js file is.
Ticket Links:
------------
http://savannah.gnu.org/bugs/?38861
Modified Paths:
--------------
trunk/src/lm_check_for_updates.js
trunk/src/lm_inject_script_in_page.js
Modified: trunk/src/lm_check_for_updates.js
===================================================================
--- trunk/src/lm_check_for_updates.js 2013-05-29 12:06:15 UTC (rev 403)
+++ trunk/src/lm_check_for_updates.js 2013-06-02 14:20:11 UTC (rev 404)
@@ -101,25 +101,42 @@
{
return null;
}
+
+ var script = document.createElement("script");
+ script.setAttribute("defer", "defer");
+ script.setAttribute("async", "async");
+ script.setAttribute("src", this.updates_page);
- var jsonp_request_data = new Object();
+ document.getElementsByTagName("head")[0].appendChild(script);
+ script.parentNode.removeChild(script);
- jsonp_request_data.frame_id = "linterna-magica-updates-checker";
- jsonp_request_data.parser_timeout = this.updates_timeout;
- jsonp_request_data.parser_timeout_counter =
- this.updates_timeout_counter;
- jsonp_request_data.jsonp_script_link = this.updates_page;
- jsonp_request_data.jsonp_function = "linterna_magica_latest_version";
- jsonp_request_data.parser_function = this.parse_updated_version_data;
+ var self = this;
- this.create_checker_frame(jsonp_request_data);
+ this.updates_counter = 0;
+ this.updates_timer_id = setInterval(
+ function()
+ {
+ // 250 mS * 80 = 20 sec
+ if (self.updates_counter > 80)
+ {
+ clearInterval(self.updates_timer_id);
+ }
+
+ if (window.LinternaMagica)
+ {
+ var updates = window.LinternaMagica.updates;
+ delete window.LinternaMagica;
+ clearInterval(self.updates_timer_id);
+ self.parse_updated_version_data.apply(self,[updates]);
+ }
+ self.updates_counter ++;
+ }, 250);
}
// Get the new version data at window.location#<data> set by the child
// "frame" (object)
LinternaMagica.prototype.parse_updated_version_data = function(data)
{
-
var new_release_date = new Date(data.date * 1000);
var current_release_date = new Date(this.release_date*1000);
Modified: trunk/src/lm_inject_script_in_page.js
===================================================================
--- trunk/src/lm_inject_script_in_page.js 2013-05-29 12:06:15 UTC (rev
403)
+++ trunk/src/lm_inject_script_in_page.js 2013-06-02 14:20:11 UTC (rev
404)
@@ -31,6 +31,14 @@
// Epiphany and Midori it is already running in the page scope.
// See https://savannah.nongnu.org/bugs/?33120
+
+window.linterna_magica_latest_version = function(data)
+{
+ window.LinternaMagica = new Object();
+ window.LinternaMagica.updates = data;
+ delete window.linterna_magica_latest_version;
+}
+
// We are running in Greasemonkey and the userscript is not inject in
// the page yet.
if (typeof(unsafeWindow) == "object")
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [linterna-magica-commit] [404] Fixes the issues with history navigation.,
Ivaylo Valkov <=