diff options
author | Romain d'Alverny <rda@mageia.org> | 2012-06-13 15:28:25 +0000 |
---|---|---|
committer | Romain d'Alverny <rda@mageia.org> | 2012-06-13 15:28:25 +0000 |
commit | 0653f535d9387252a72f9518b6a102f45ce1efef (patch) | |
tree | e62d3959986b1a43f026b925eae45e8d2cfcb51e /HTML/script.js | |
parent | 554c99c774570cad9c00f5129b4d3baa8470ae2f (diff) | |
download | indexhtml-0653f535d9387252a72f9518b6a102f45ce1efef.tar indexhtml-0653f535d9387252a72f9518b6a102f45ce1efef.tar.gz indexhtml-0653f535d9387252a72f9518b6a102f45ce1efef.tar.bz2 indexhtml-0653f535d9387252a72f9518b6a102f45ce1efef.tar.xz indexhtml-0653f535d9387252a72f9518b6a102f45ce1efef.zip |
redirect directly, without checking on/offline status
Diffstat (limited to 'HTML/script.js')
-rw-r--r-- | HTML/script.js | 54 |
1 files changed, 7 insertions, 47 deletions
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; |