diff options
author | Romain d'Alverny <rda@mageia.org> | 2011-05-06 14:30:12 +0000 |
---|---|---|
committer | Romain d'Alverny <rda@mageia.org> | 2011-05-06 14:30:12 +0000 |
commit | a1a99fc9360e0b879cab6b2669fe98d3e8045345 (patch) | |
tree | c2f7206960e710736c2b8bfa563c36ca60064fb2 /HTML | |
parent | f6958aaaee8fa42c7374d7fb31ed5770a0e88733 (diff) | |
download | indexhtml-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')
-rw-r--r-- | HTML/index.html | 20 | ||||
-rw-r--r-- | HTML/script.js | 27 |
2 files changed, 33 insertions, 14 deletions
diff --git a/HTML/index.html b/HTML/index.html index 045b3e4..6f8fa42 100644 --- a/HTML/index.html +++ b/HTML/index.html @@ -9,16 +9,29 @@ <meta name="product:id" content="#PRODUCT_ID" /> <title>Mageia</title> <style> - html { margin: 0; background-color: #eee; } + html { margin: 0; background-color: #e6e4e0; } body { margin: 0 auto; + padding: 0 0 2em 0; width: 810px; text-align: center; font-family: Helvetica, Verdana, Arial, sans-serif; font-size: 80%; + -webkit-transition: -webkit-transform 0.5s ease-in-out; + -webkit-transform-origin: 100% 0%; + -moz-transition: -moz-transform 0.5s ease-in-out; + -moz-transform-origin: 100% 0%; + transition: transform 0.5s ease-in-out; + transform-origin: 100% 0%; + } + body.offline { + -webkit-transform: rotate(-4deg); + -moz-transform: rotate(-4deg); + transform: rotate(-4deg); } - body.offline { background: url(images/offline-bg.png) no-repeat; } body.offline h1 span { display: none; } + #offlinestatus { font-weight: bold; color: transparent; display: none; } + body.offline #offlinestatus { color: #444; display: block; } a { text-decoration: none; } h1 { margin: 0 0 2em 0; } img { border: 0; } @@ -32,6 +45,7 @@ <body onload="try{new StartPage('http://start.mageia.org/', 'http://static.mageia.org/g/images/indexhtml_online_pixel.png').run(); }catch(e){}"> + <span id="offlinestatus">Offline</span> <h1><a href="http://www.mageia.org/?ssp"><img src="images/logo_mageia.png" alt="Mageia" /></a></h1> <ul class="lx"> <li><a href="http://forums.mageia.org/?ssp">Forums</a></li> @@ -41,9 +55,9 @@ <li><a href="http://mageia.org/donate/?ssp">Donate</a></li> </ul> <ul class="lx"> + <li><a href="http://mageia.org/support/?ssp">Need help?</a></li> <li><a href="http://mageia.org/?ssp">Mageia.Org</a></li> <li><a href="http://mageia.org/about/?ssp">About</a></li> - <li><a href="http://mageia.org/support/?ssp">Need help?</a></li> </ul> </body> </html>
\ No newline at end of file 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; -} +}; |