[rel] Website Checker

Website Checker

For AveScripter

Screenshot

websitechecker.png

Description

This desklet checks for updates on a website on a specific interval. When there are changes on the user-configurable site, it'll display a small change-notification.

Graphics by KoL, as usual :)

Shows the usage of asynchronious XMLHTTPRequests to gather and check website without blocking the whole desklet.

Download

http://avedesk.philc.ca/modules/PDdownload...hp?cid=9&lid=38

#336726

What took you so long? I waited all night for this! :P

#336737

cool, thanks

#336758

Ditto, This blows the socks off of konfabulator.

#336761

This is a little off topic, but where can i get the flip animations and stuff, i have the newest avedesk but i want the flip/suck thingy.

#336823

Just wondering, how'd you do this technically? The code was a bit confusing...

Thanks ;)

-NC

P.S: I know some about Ajax and Web 2.0, so proceed accordingly :P.

#336903

Um could you add a feature so that when you click on it after the page has changed it takes you to the link....also can you add the 30 second option and also allow font change please?

#336904

It's pretty easy:

When the widget is created, an XmlHttpRequest object is created.

function init()

{

http = new ActiveXObject('Microsoft.XMLHTTP');

checkSite();

}

The checkSite() function checks the site:

If we are not checking yet, we change the checking indicator to the appropriate image and open a HTTP get operation with the url. Then we 'send' nothing, which means get the contents of the site.

When the status of the requests changes, the onReqDone() function will be called, asynchroniously. That means, this function will not wait for the request to end.

function checkSite()

{

var url = this.parameters("URL").value;

var l = this.layers("status");

if(!isChecking)

{

isChecking = true;

if(l != null)

l.src = "images/checking.png";



http.onreadystatechange = onReqDone;

http.open("GET",url,true);

http.send("");

}

}

When the status of the request changes, this function will be executed. readyState holds the status of the request (hardwired to some values). 4 means, totally done

Next, we get the responseText (the url contents) and hash it to compare it the hash of the previous call. If they differ, we assume the site has changed and update the image accordingly.

function onReqDone()

{

if(4 == http.readyState)

{

//var ok = (200 == http.status);

var oldHash = this.parameters("HASH").value;

var newHash = hash(http.responseText);

var changes = newHash != oldHash;

this.parameters("HASH").value = newHash;



var l = this.layers("status");

if(l != null)

{

if(!changes)

l.src = "images/nochanges.png";

else

l.src="../../unavailable.html";

}



http = new ActiveXObject('Microsoft.XMLHTTP');

isChecking = false;

}

}

A timer then calls the checkSite() function on a regular basis.

What's Web 2.0????? :confused:

#336910

I tried using this with the site www.betanews.com but it always says there are changes. Is it because of all the advertising on the page?? I just wanted to use it so I knew when something new was posted on there. Thanks for any info.

BTW I used kapsules for a while, and it would use like 60mb of mem, and using avedesk with 6 desklets, it only uses around 3mb. LOL. Great work on this app.

#337165

I tried using this with the site www.betanews.com but it always says there are changes. Is it because of all the advertising on the page?? I just wanted to use it so I knew when something new was posted on there. Thanks for any info.

Yeah, because of the advertising. I also tried checking the headers of the webpages, but most of them return a wrong date anyways.

#337169