bei diesem von mir angepassten Opera Widget gibts irgendwo ein Memory-Leak, das ich einfach nicht aufspüre... d.H.: wenn man das Widget am Laufen hat, verbraucht Opera kontinuierlich mehr RAM bis es schließlich bei 100% RAM- und auch CPU-Auslastung angekommen ist.
Bin übers Wochenende in Italien klettern, kann also erst am Montag wieder antworten
Sourcecode:
config.xml:
Code:
<?xml version="1.0" encoding="utf-8"?>
<widget>
<widgetname>ISC Infocon</widgetname>
<description>
The intent of the 'Infocon' is to reflect changes in malicious traffic and the possibility of disrupted connectivity.
</description>
<width>180</width>
<height>30</height>
<author>
<name>Hans-Petter "Atluxity" Fjeld</name>
<link>http://www.atluxity.no</link>
<organization>Fjeld Data</organization>
</author>
<id>
<host>atluxity.no</host>
<name>ISC InfoCon</name>
<revised>2006-04</revised>
</id>
<security>
<access>
<host>isc.sans.org</host>
<port>80</port>
</access>
</security>
</widget>
index.html:
Code:
<!DOCTYPE html>
<html>
<head onload=init(); >
<title>ISC Infocon</title>
<link rel="stylesheet" type="text/css" href="iscinfocon.css">
<script type="text/javascript" src="iscinfocon.js"></script>
</head>
<body>
<div id="icon">
</div>
</body>
</html>
iscinfocon.css:
Code:
body {
width: 180px;
height: 30px;
margin: 0;
padding: 0;
}
#icon{
width: 180px;
height: 30px;
background: url(images/status_unknown.gif);
opacity: 1.0;
}
iscinfocon.js:
Code:
window.addEventListener('load',function(ev){
//opera.postError("Loaded");
get_infocon();
},false);
function get_infocon() {
//opera.postError("get infocon");
setTimeout("get_infocon()",300000);
var url = "http://isc.sans.org/infocon.txt";
var request = new XMLHttpRequest();
request.onreadystatechange = function() {
if( request.readyState == 4) {
var condition = request.responseText;
//opera.postError("Got " + condition +" from server");
var con = condition.replace(/^\s+|\s+$/g,'');
set_infocon(con);
} // else opera.postError("Readystate is: " + request.readyState);
}
request.open("GET", url);
request.send();
}
function set_infocon(color) {
setTimeout(get_infocon,60000)
// opera.postError("set_infocon("+color+")");
switch (color) {
case "green":
// opera.postError("case green");
document.getElementById("icon").style.background = "url(images/status_green.gif)";
document.getElementById("icon").style.opacity = "1.0";
break;
case "yellow":
// opera.postError("case yellow");
document.getElementById("icon").style.background = "url(images/status_yellow.gif)";
document.getElementById("icon").style.opacity = "1.0";
break;
case "orange":
// opera.postError("case orange");
document.getElementById("icon").style.background = "url(images/status_orange.gif)";
document.getElementById("icon").style.opacity = "1.0";
break;
case "red":
// opera.postError("case red");
document.getElementById("icon").style.background = "url(images/status_red.gif)";
document.getElementById("icon").style.opacity = "1.0";
break;
default:
// opera.postError("case default");
document.getElementById("icon").style.opacity = "1.0";
break;
}
}
vielen Dank im Voraus für eure Mühen.
