From 0653f535d9387252a72f9518b6a102f45ce1efef Mon Sep 17 00:00:00 2001 From: Romain d'Alverny Date: Wed, 13 Jun 2012 15:28:25 +0000 Subject: redirect directly, without checking on/offline status --- HTML/index.html | 58 +++++++++------------------------------------------------ HTML/script.js | 54 +++++++---------------------------------------------- 2 files changed, 16 insertions(+), 96 deletions(-) diff --git a/HTML/index.html b/HTML/index.html index 6f8fa42..91099ed 100644 --- a/HTML/index.html +++ b/HTML/index.html @@ -1,63 +1,23 @@ - - - - - - + + + + + Mageia - + - - Offline -

Mageia

- - + +

Mageia

\ No newline at end of file diff --git a/HTML/script.js b/HTML/script.js index 0a22b30..90e8da7 100644 --- a/HTML/script.js +++ b/HTML/script.js @@ -1,48 +1,21 @@ /** - * @copyright Copyright (c) 2011 Romain d'Alverny + * @copyright Copyright (c) 2011-2012 Romain d'Alverny * @license http://www.gnu.org/licenses/gpl-3.0.html GNU GPL v3 and later * - * Redirect browser online IF it is in online mode. - * Or stay on offline page and listen to online event. + * Redirect browser to URL with GET parameters: + * - l = html[lang] + * - p = meta[product:id] * - * Browser targets: Mozilla Firefox 3.6+, Konqueror. */ -function StartPage(url, image) { +function StartPage(url) { this.location = url; - this.onlinePx = image; } StartPage.prototype.run = function () { - if (navigator.onLine !== null) { - if (navigator.onLine) { - this.actOnline(); - } else { - this.actOffline(); - } - } else { // for khtml-based browsers - try { - var sp = this, - i = document.createElement('img'); - - window.alert = function() {}; - - i.id = 'i'; - i.onload = function () { console.log(sp); sp.actOnline(); }; - i.onerror = function () { sp.actOffline(); }; - i.src = this.onlinePx + '?' + new Date().getTime(); - document.getElementsByTagName('body').item(0).appendChild(i); - } - catch (e) { return false; } - } - - return true; -}; - -StartPage.prototype.actOnline = function () { var product_id = '', - lang = '', - args = []; + lang = '', + args = []; document.getElementsByTagName("body").item(0).setAttribute("class", ""); @@ -62,19 +35,6 @@ StartPage.prototype.actOnline = function () { return true; }; -StartPage.prototype.actOffline = function () { - var p = this, - i = document.getElementById("i"); - - if (null !== i) { - i.parentNode.removeChild(i); - } - document.getElementsByTagName("body").item(0).setAttribute("class", "offline"); - document.body.addEventListener("online", function () { p.actOnline(); }, false); - - return true; -}; - StartPage.prototype.getLocale = function () { var ret = null; -- cgit v1.2.1