summaryrefslogtreecommitdiffstats
path: root/HTML
diff options
context:
space:
mode:
authorMageia SVN-Git Migration <svn-git-migration@mageia.org>2011-02-07 23:18:17 +0000
committerMageia SVN-Git Migration <svn-git-migration@mageia.org>2011-02-07 23:18:17 +0000
commit841b56cd2b970466d68fbc4165f86760759c0169 (patch)
treea548c9131c2e1abedcbfc4b4e2ccf592a41d70ad /HTML
parent911afa843897cd330622a2e222cff6080a64e590 (diff)
downloadindexhtml-841b56cd2b970466d68fbc4165f86760759c0169.tar
indexhtml-841b56cd2b970466d68fbc4165f86760759c0169.tar.gz
indexhtml-841b56cd2b970466d68fbc4165f86760759c0169.tar.bz2
indexhtml-841b56cd2b970466d68fbc4165f86760759c0169.tar.xz
indexhtml-841b56cd2b970466d68fbc4165f86760759c0169.zip
Synthesized commit during git-svn import combining previous Mandriva history with Mageia.
This commit consitsts of the following subversion commits: ------------------------------------------------------------------------ r485 | dmorgan | 2011-02-07 23:18:17 +0000 (Mon, 07 Feb 2011) | 1 line Import cleaned indexhtml ------------------------------------------------------------------------ In addition to the above commits, the following cleaning work has been recorded: o mails - replacement was done in headers except for Subject in header-ur which does not contain Mandriva... - dropped most mail bodys, except for French & English, rewritten to a minimal version - a good mail should be designed and translated o about - command is about-mandriva, have to look at what uses it - removed MDV graphics from style/css o HTML - a simple page should be placed there, until web team provides something o po - all translations should be dropped, strings updated when the real page is ready o COPYING - added COPYING file (GNU GPL v3). indexhtml.spec file stated "GPL" (should be changed to GPL3+)
Diffstat (limited to 'HTML')
-rw-r--r--HTML/images/bgnew.pngbin190135 -> 0 bytes
-rw-r--r--HTML/images/offline-bg.png0
-rw-r--r--HTML/index.html54
-rw-r--r--HTML/screen.css46
-rw-r--r--HTML/script.js148
5 files changed, 113 insertions, 135 deletions
diff --git a/HTML/images/bgnew.png b/HTML/images/bgnew.png
deleted file mode 100644
index 258f7ae..0000000
--- a/HTML/images/bgnew.png
+++ /dev/null
Binary files differ
diff --git a/HTML/images/offline-bg.png b/HTML/images/offline-bg.png
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/HTML/images/offline-bg.png
diff --git a/HTML/index.html b/HTML/index.html
index 0db5139..98a7e5e 100644
--- a/HTML/index.html
+++ b/HTML/index.html
@@ -1,30 +1,26 @@
<?xml version="1.0" encoding="utf-8" ?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" lang="#LANG" xml:lang="#LANG">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
- <meta http-equiv="Content-Style-Type" content="text/css" />
- <meta http-equiv="Pragma" content="no-cache" />
- <meta http-equiv="Expires" content="0" />
- <meta http-equiv="Cache-Control" content="no-cache" />
- <meta name="mdv:release" content="#MDV_RELEASE" />
- <meta name="mdv:product" content="#MDV_PRODUCT" />
- <meta name="mdv:pack" content="#MDV_PACK" />
- <title>Mandriva Linux</title>
- <link rel="stylesheet" type="text/css" media="screen, projection" href="file:///usr/share/mdk/indexhtml/screen.css" />
- <link rel="stylesheet" type="text/css" media="print, handheld" href="file:///usr/share/mdk/indexhtml/print.css" />
- <script type="text/javascript" src="file:///usr/share/mdk/indexhtml/script.js"></script>
- </head>
- <body onload="try{run();}catch(e){}">
- <div id="page">
- <h1><a href="http://www.mandriva.com/"><span>Mandriva</span></a></h1>
- <ul>
- <li id="mandriva_com"><a href="http://www.mandriva.com/"><span>Mandriva</span></a></li>
- <li id="store"><a href="http://store.mandriva.com/"><span>store.mandriva.com</span></a></li>
- <li id="support"><a href="http://support.mandriva.com/"><span>support.mandriva.com</span></a></li>
- </ul>
- </div>
- </body>
-</html>
+<!DOCTYPE html>
+<html lang="#LANG">
+<head>
+ <meta charset="utf-8" />
+ <meta http-equiv="Pragma" content="no-cache" />
+ <meta http-equiv="Expires" content="0" />
+ <meta http-equiv="Cache-Control" content="no-cache" />
+ <meta name="product:id" content="#PRODUCT_ID" />
+ <title>Mageia</title>
+ <style>
+ html { background-color: #eee; margin: 0; }
+ body { margin: 0 auto; width: 800px; height: 600px; }
+ body.offline { background: url(images/offline-bg.png) no-repeat; }
+ body.offline h1 span { display: none; }
+ body.offline h1 a { display: block; width: 800px; height: 600px; }
+ h1 { margin: 0; }
+ </style>
+ <script type="text/javascript" src="script.js"></script>
+</head>
+<body onload="try{new StartPage('http://start.mageia.org/',
+'http://static.mageia.org/g/images/indexhtml_online_pixel.png').run();
+}catch(e){}">
+ <h1><a href="http://www.mageia.org/"><span>Mageia</span></a></h1>
+</body>
+</html> \ No newline at end of file
diff --git a/HTML/screen.css b/HTML/screen.css
deleted file mode 100644
index 5d2a94d..0000000
--- a/HTML/screen.css
+++ /dev/null
@@ -1,46 +0,0 @@
-/* $Id$
-*/
-
-html {
- background-color: #fff;
- text-align: center;
-}
-
-body {
- text-align: left;
- margin: auto;
- width: 800px;
- height: 600px;
- background-image: url(./images/bgnew.png);
- background-repeat: no-repeat;
- color: #21449C;
- font-family: sans-serif;
-
-}
-
-div#page {
- position: relative;
-}
-
-h1 a {
- display: block;
- position: relative;
- left: 10px;
- top: 25px;
- background-repeat: no-repeat;
- width: 146px;
- height: 34px;
-}
-h1 { margin: 0px; padding: 0px; }
-h1 span { display: none; }
-
-ul { list-style-type: none; padding: 0px; margin: 0px; }
-ul li { display: block; position: absolute; }
-ul li a { width: 100%; height: 100%; display: block;}
-ul li a span { display: none; }
-
-li#support { top: 450px; left: 30px; width: 310px; height: 60px; }
-li#store { top: 450px; left: 430px; width: 310px; height: 60px; }
-li#mandriva_com { top: 510px; left: 270px; width: 280px; height: 50px; }
-
-#i { visibility: hidden; }
diff --git a/HTML/script.js b/HTML/script.js
index 71e40e6..fff1fb8 100644
--- a/HTML/script.js
+++ b/HTML/script.js
@@ -1,67 +1,95 @@
-/* $Id$
+/**
+ * @copyright Copyright (c) 2011 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.
+ *
+ * Browser targets: Mozilla Firefox 3.6+, Konqueror.
*/
-var remoteweb = 'http://start.mandriva.com/';
-
-String.prototype.rtrim = function() { return this.replace(/\s*$/, ""); };
-String.prototype.ltrim = function() { return this.replace(/^\s*/, ""); };
-String.prototype.trim = function() { return this.rtrim().ltrim(); };
-String.prototype.encodeURI = function() { return this.replace(/\+/g,"%2B"); };
-
-function actOnline() {
- // #1
- var release = '';
- var pack = '';
- var product = '';
- var lang = '';
- try {
- var t = document.getElementsByTagName('meta');
- for( var i=0; i<t.length; i+=1 ) {
- if( t.item(i).getAttribute('name') == 'mdv:release' ) {
- release = t.item(i).getAttribute('content');
- } else if( t.item(i).getAttribute('name') == 'mdv:pack' ) {
- pack = t.item(i).getAttribute('content');
- } else if( t.item(i).getAttribute('name') == 'mdv:product' ) {
- product = t.item(i).getAttribute('content');
- }
- }
- lang = parent.window.document.documentElement.attributes.getNamedItem('lang').value;
- }
- catch( e ) {}
- finally {}
-
- // #2
- var args = '';
- if( release !== '' ) { args = 'r='+release.trim().encodeURI(); }
- if( pack !== '' ) { if( args !== '' ) { args += '&'; } args += 'p='+pack.trim().encodeURI(); }
- if( product !== '' ) { if( args !== '' ) { args += '&'; } args += 'p='+product.trim().encodeURI(); }
- if( lang !== '' ) { if( args !== '' ) { args += '&'; } args += 'l='+lang.trim(); }
- if( args !== '' ) { remoteweb += '?' + args; }
-
- // #3
- parent.location = remoteweb;
- return true;
+function StartPage(url, image) {
+ this.location = url;
+ this.onlinePx = image;
}
-function actOffline() { return true; }
-function imgLoad() { actOnline(); }
-function imgError() { var i = document.getElementById('i'); i.parentNode.removeChild(i); actOffline(); }
-
-window.alert = function() {};
-
-function run() {
- try {
- var i = document.createElement('img');
- i.id = 'i';
- i.onload = imgLoad;
- i.onerror = imgError;
- i.src = 'http://images.mandriva.com/images/donotremove.png';
- document.getElementsByTagName('body').item(0).appendChild(i);
- }
- catch(e) { return false; }
- return true;
+StartPage.prototype.run = function () {
+ if (false && navigator.onLine !== null) {
+ !navigator.onLine ? this.actOnline() : 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 productId = '',
+ lang = '',
+ args = new Array;
+
+ if (null !== (product_id = this.getProductId())) {
+ args.push('p=' + product_id);
+ }
+
+ if (null !== (lang = this.getLocale())) {
+ args.push('l=' + lang);
+ }
+
+ if (args.length > 0) {
+ this.location = [this.location, args.join('&')].join('?');
+ }
+ parent.location = this.location;
+
+ 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;
+
+ try {
+ ret = parent.window.document.documentElement.attributes.getNamedItem('lang').value.trim();
+ } 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') {
+ ret = t.item(i).getAttribute('content').trim();
+ break;
+ }
+ }
+
+ return ret;
+}