summaryrefslogtreecommitdiffstats
path: root/HTML/script.js
blob: 27c47309c118e1d50b2fe7e9d9f97f9ed5ba5fa1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/* $Id$
*/

var isRemoteAvail = false;
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 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' ) {
				release = t.item(i).getAttribute('content');
				break;
			}
		}
	}
	catch( e ) {} 
	finally {}

        if( release !== '' ) {
		remoteweb += '?r='+release.trim().encodeURI();
	}
	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(); }
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;
}

/*
*/