summaryrefslogtreecommitdiffstats
path: root/HTML
diff options
context:
space:
mode:
authorRomain d'Alverny <rdalverny@mandriva.org>2005-09-01 16:06:02 +0000
committerRomain d'Alverny <rdalverny@mandriva.org>2005-09-01 16:06:02 +0000
commitf06b0b7971c67a5c0dc956f0cc2a432fe67713f4 (patch)
tree1042c0fa9cb49bc1986609cd2e1ba5f6a135654b /HTML
parentedeaa2faeef597565d1cd3efac40b18f925be588 (diff)
downloadindexhtml-f06b0b7971c67a5c0dc956f0cc2a432fe67713f4.tar
indexhtml-f06b0b7971c67a5c0dc956f0cc2a432fe67713f4.tar.gz
indexhtml-f06b0b7971c67a5c0dc956f0cc2a432fe67713f4.tar.bz2
indexhtml-f06b0b7971c67a5c0dc956f0cc2a432fe67713f4.tar.xz
indexhtml-f06b0b7971c67a5c0dc956f0cc2a432fe67713f4.zip
meta headers should prevent file to be locally cached; rewritten js for nicer remote detection
Diffstat (limited to 'HTML')
-rw-r--r--HTML/index.html8
-rw-r--r--HTML/script.js28
2 files changed, 25 insertions, 11 deletions
diff --git a/HTML/index.html b/HTML/index.html
index c717cd8..9b590b8 100644
--- a/HTML/index.html
+++ b/HTML/index.html
@@ -5,15 +5,18 @@
<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="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 onload="bodyLoad();">
+ <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.com</span></a></li>
<li id="club"><a href="http://club.mandriva.com/"><span>club.mandriva.com</span></a></li>
@@ -22,6 +25,5 @@
<li id="support"><a href="http://support.mandriva.com/"><span>support.mandriva.com</span></a></li>
</ul>
</div>
- <img id="i" src="http://images.mandriva.com/images/donotremove.png" onload="imgLoad();" onerror="imgError();" />
</body>
</html>
diff --git a/HTML/script.js b/HTML/script.js
index 24ed239..27c4730 100644
--- a/HTML/script.js
+++ b/HTML/script.js
@@ -7,21 +7,21 @@ 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 escape( this ).replace(/\+/g,"%2B"); };
+String.prototype.encodeURI = function() { return this.replace(/\+/g,"%2B"); };
function actOnline() {
var release = '';
try {
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' ) {
+ if( t.item(i).getAttribute('name') == 'mdv:release' ) {
release = t.item(i).getAttribute('content');
break;
}
}
}
- catch( e ) { return false; }
- finally { }
+ catch( e ) {}
+ finally {}
if( release !== '' ) {
remoteweb += '?r='+release.trim().encodeURI();
@@ -30,10 +30,22 @@ function actOnline() {
return true;
}
function actOffline() { return true; }
-function bodyLoad() { if( isRemoteAvail ) { actOnline(); } else { actOffline(); } }
-function imgLoad() { isRemoteAvail = true; }
-function imgError() { isRemoteAvail = false; var i = document.getElementById('i'); i.parentNode.removeChild(i); }
-window.alert = function() {}
+function imgLoad() { isRemoteAvail = true; actOnline(); }
+function imgError() { isRemoteAvail = false; 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;
+}
/*
*/