summaryrefslogtreecommitdiffstats
path: root/HTML
diff options
context:
space:
mode:
authorRomain d'Alverny <rdalverny@mandriva.org>2005-10-21 10:25:20 +0000
committerRomain d'Alverny <rdalverny@mandriva.org>2005-10-21 10:25:20 +0000
commit3dd0febe7a237d68bc7691b8a56e5faf6068fd82 (patch)
treeadcb552508383145ccd5f146f70826085b72575b /HTML
parentbf98a4a3c1623d505fc232e33ce53efdf9707f17 (diff)
downloadindexhtml-3dd0febe7a237d68bc7691b8a56e5faf6068fd82.tar
indexhtml-3dd0febe7a237d68bc7691b8a56e5faf6068fd82.tar.gz
indexhtml-3dd0febe7a237d68bc7691b8a56e5faf6068fd82.tar.bz2
indexhtml-3dd0febe7a237d68bc7691b8a56e5faf6068fd82.tar.xz
indexhtml-3dd0febe7a237d68bc7691b8a56e5faf6068fd82.zip
fixed code. added language code to redirection url
Diffstat (limited to 'HTML')
-rw-r--r--HTML/script.js30
1 files changed, 21 insertions, 9 deletions
diff --git a/HTML/script.js b/HTML/script.js
index 27c4730..2247169 100644
--- a/HTML/script.js
+++ b/HTML/script.js
@@ -1,8 +1,8 @@
/* $Id$
+ *
*/
-var isRemoteAvail = false;
-var remoteweb = 'http://start.mandriva.com/';
+var remoteweb = 'http://start.mandriva.com/';
String.prototype.rtrim = function() { return this.replace(/\s*$/, ""); };
String.prototype.ltrim = function() { return this.replace(/^\s*/, ""); };
@@ -10,28 +10,40 @@ 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 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');
- break;
+ } else if( t.item(i).getAttribute('name') == 'mdv:pack' ) {
+ pack = t.item(i).getAttribute('content');
}
}
+ lang = parent.window.document.documentElement.attributes.getNamedItem('lang').value;
}
catch( e ) {}
finally {}
- if( release !== '' ) {
- remoteweb += '?r='+release.trim().encodeURI();
- }
+ // #2
+ var args = '';
+ if( release !== '' ) { args = 'r='+release.trim().encodeURI(); }
+ if( pack !== '' ) { if( args !== '' ) { args += '&'; } args += 'p='+pack.trim().encodeURI(); }
+ if( lang !== '' ) { if( args !== '' ) { args += '&'; } args += 'l='+lang.trim(); }
+ if( args !== '' ) { remoteweb += '?' + args; }
+
+ // #3
parent.location = remoteweb;
return true;
}
+
function actOffline() { return true; }
-function imgLoad() { isRemoteAvail = true; actOnline(); }
-function imgError() { isRemoteAvail = false; var i = document.getElementById('i'); i.parentNode.removeChild(i); actOffline(); }
+function imgLoad() { actOnline(); }
+function imgError() { var i = document.getElementById('i'); i.parentNode.removeChild(i); actOffline(); }
+
window.alert = function() {};
function run() {
@@ -43,7 +55,7 @@ function run() {
i.src = 'http://images.mandriva.com/images/donotremove.png';
document.getElementsByTagName('body').item(0).appendChild(i);
}
- catch(e) {return false;}
+ catch(e) { return false; }
return true;
}