diff options
Diffstat (limited to 'HTML/script.js')
-rw-r--r-- | HTML/script.js | 28 |
1 files changed, 20 insertions, 8 deletions
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; +} /* */ |