diff options
Diffstat (limited to 'HTML')
-rw-r--r-- | HTML/index.html | 9 | ||||
-rw-r--r-- | HTML/screen.css | 2 | ||||
-rw-r--r-- | HTML/script.js | 76 | ||||
-rw-r--r-- | HTML/testonline.html | 12 |
4 files changed, 28 insertions, 71 deletions
diff --git a/HTML/index.html b/HTML/index.html index bcf5546..e4f6fec 100644 --- a/HTML/index.html +++ b/HTML/index.html @@ -4,11 +4,13 @@ <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - <meta name="mdv.release" content="XXXXX" /> + <meta http-equiv="Content-Script-Type" content="text/javascript" /> + <meta name="mdv:release" content="XXXXX" /> <title>Mandriva Linux</title> <link rel="stylesheet" type="text/css" media="screen, projection" href="file:///usr/share/mdk/indexhtml/screen.css" /> + <script type="text/javascript" src="file:///usr/share/mdk/indexhtml/script.js"></script> </head> - <body> + <body onload="bodyLoad();"> <div id="page"> <h1><a href="http://www.mandriva.com/"><span>Mandriva</span></a></h1> @@ -20,7 +22,6 @@ <li id="support"><a href="http://support.mandriva.com/"><span>support.mandriva.com</span></a></li> </ul> </div> - <iframe id="f" src="file:///usr/share/mdk/indexhtml/testonline.html" style="visibility: hidden;"></iframe> - + <img id="i" src="http://images.mandriva.com/iamages/donotremove.png" onload="imgLoad();" onerror="imgError();" /> </body> </html> diff --git a/HTML/screen.css b/HTML/screen.css index a3237e0..9d061de 100644 --- a/HTML/screen.css +++ b/HTML/screen.css @@ -46,4 +46,4 @@ li#store { top: 466px; left: 527px; width: 200px; } li#online { top: 505px; left: 147px; width: 200px; } li#support { top: 263px; left: 20px; width: 200px; } -#f { visibility: hidden; } +#i { visibility: hidden; } diff --git a/HTML/script.js b/HTML/script.js index 9126143..24ed239 100644 --- a/HTML/script.js +++ b/HTML/script.js @@ -1,71 +1,39 @@ /* $Id$ */ -/* */ var isRemoteAvail = false; - -/* Remote web site */ var remoteweb = 'http://start.mandriva.com/'; - -/* Display a warning message on parent document in specific element if available. - @param text string to display - @param color text color - @param background background color - @return boolean -*/ -/* -function parentMessage( text, color, background ) { - var p = parent.window.document.getElementById('status'); - if( p == null ) - return false; - p.style.display = 'none'; - if( text == '' ) - return true; +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 escape( this ).replace(/\+/g,"%2B"); }; - p.innerHTML = text; - p.style.color = color; - p.style.background = background; - p.style.display = 'block'; - return true; -} -*/ - -/* Redirect parent document to available remote web site - with the current language code. - @return boolean -*/ function actOnline() { - var lang = null; - + var release = ''; try { - lang = parent.window.document.documentElement.attributes.getNamedItem('lang').value; - } catch( e ) { - return false; - } finally { } - - if( lang != null ) - remoteweb += '?l='+lang; + var t = document.getElementsByTagName('meta'); + for( var i=0; i<t.length; i+=1 ) { + if( t.item(i).getAttribute('name') == 'mdv.release' || t.item(i).getAttribute('name') == 'mdv:release' ) { + release = t.item(i).getAttribute('content'); + break; + } + } + } + catch( e ) { return false; } + finally { } + + if( release !== '' ) { + remoteweb += '?r='+release.trim().encodeURI(); + } parent.location = remoteweb; - //parentMessage('You are online. Go to <a href="'+remoteweb+'">'+remoteweb+'</a>','#006000','#aaff99'); - return true; -} - -/* If the remote website is not available. - @return boolean -*/ -function actOffline() { - //parentMessage('You are offline...','#a00000','#ffaa88'); - //TODO write <meta http-equiv="Refresh" content="60" /> in <head> ? return true; } - +function actOffline() { return true; } function bodyLoad() { if( isRemoteAvail ) { actOnline(); } else { actOffline(); } } function imgLoad() { isRemoteAvail = true; } -function imgError() { isRemoteAvail = false; } - +function imgError() { isRemoteAvail = false; var i = document.getElementById('i'); i.parentNode.removeChild(i); } window.alert = function() {} -//parentMessage( 'Mandriva...', '#000' ); -/* +/* */ diff --git a/HTML/testonline.html b/HTML/testonline.html deleted file mode 100644 index 36deab8..0000000 --- a/HTML/testonline.html +++ /dev/null @@ -1,12 +0,0 @@ -<?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> - <head> - <title>Mandriva</title> - <script type="text/javascript" src="./script.js"></script> - </head> - <body onload="bodyLoad();"> - <img id="i" src="http://images.mandriva.com/images/donotremove.png" onload="imgLoad();" onerror="imgError();" /> - </body> -</html> |