diff options
Diffstat (limited to 'HTML')
-rw-r--r-- | HTML/script.js | 30 |
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; } |