summaryrefslogtreecommitdiffstats
path: root/HTML/script.js
diff options
context:
space:
mode:
authorRomain d'Alverny <rda@mageia.org>2011-05-06 14:30:12 +0000
committerRomain d'Alverny <rda@mageia.org>2011-05-06 14:30:12 +0000
commita1a99fc9360e0b879cab6b2669fe98d3e8045345 (patch)
treec2f7206960e710736c2b8bfa563c36ca60064fb2 /HTML/script.js
parentf6958aaaee8fa42c7374d7fb31ed5770a0e88733 (diff)
downloadindexhtml-a1a99fc9360e0b879cab6b2669fe98d3e8045345.tar
indexhtml-a1a99fc9360e0b879cab6b2669fe98d3e8045345.tar.gz
indexhtml-a1a99fc9360e0b879cab6b2669fe98d3e8045345.tar.bz2
indexhtml-a1a99fc9360e0b879cab6b2669fe98d3e8045345.tar.xz
indexhtml-a1a99fc9360e0b879cab6b2669fe98d3e8045345.zip
Fix native on/offline detection code; offline mode animation
Diffstat (limited to 'HTML/script.js')
-rw-r--r--HTML/script.js27
1 files changed, 16 insertions, 11 deletions
diff --git a/HTML/script.js b/HTML/script.js
index fff1fb8..0a22b30 100644
--- a/HTML/script.js
+++ b/HTML/script.js
@@ -14,9 +14,12 @@ function StartPage(url, image) {
}
StartPage.prototype.run = function () {
- if (false && navigator.onLine !== null) {
- !navigator.onLine ? this.actOnline() : this.actOffline();
-
+ if (navigator.onLine !== null) {
+ if (navigator.onLine) {
+ this.actOnline();
+ } else {
+ this.actOffline();
+ }
} else { // for khtml-based browsers
try {
var sp = this,
@@ -34,12 +37,14 @@ StartPage.prototype.run = function () {
}
return true;
-}
+};
StartPage.prototype.actOnline = function () {
- var productId = '',
+ var product_id = '',
lang = '',
- args = new Array;
+ args = [];
+
+ document.getElementsByTagName("body").item(0).setAttribute("class", "");
if (null !== (product_id = this.getProductId())) {
args.push('p=' + product_id);
@@ -55,7 +60,7 @@ StartPage.prototype.actOnline = function () {
parent.location = this.location;
return true;
-}
+};
StartPage.prototype.actOffline = function () {
var p = this,
@@ -68,7 +73,7 @@ StartPage.prototype.actOffline = function () {
document.body.addEventListener("online", function () { p.actOnline(); }, false);
return true;
-}
+};
StartPage.prototype.getLocale = function () {
var ret = null;
@@ -78,18 +83,18 @@ StartPage.prototype.getLocale = function () {
} catch (e) {}
return ret;
-}
+};
StartPage.prototype.getProductId = function () {
var ret = null,
t = document.getElementsByTagName('meta');
for (var i = 0; i < t.length; i += 1) {
- if (t.item(i).getAttribute('name') == 'product:id') {
+ if (t.item(i).getAttribute('name') === 'product:id') {
ret = t.item(i).getAttribute('content').trim();
break;
}
}
return ret;
-}
+};