Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cartoon



Not sure how much of a fopas this is but you can always peek at
another widget that does just that:

http://www.apple.com/downloads/dashboard/games/foxtrotcomicwidget.html

The very first widget I wrote did just what you want to do, its old
code but it may give you an idea of where to start:

	var req;
	var today, month, day, year, filename;
	if (window.widget) {
		widget.onshow = onshow;
   	//widget.onhide = onhide;
	}
	function onshow () {
		today = new Date();
		year  = today.getFullYear();
		month = today.getMonth() + 1;
		if(month < 10) {
			month = "0" + month;
		}
		day   = today.getDate();
		if(day < 10) {
			day = "0" + day;
		}
		m = today.getTime();
		filename = 'pvp' + year + month + day + '.gif';
		document.getElementById('content').innerHTML = '<img id="comic"
src="http://www.pvponline.com/archive/' + year + '/' + filename + '"
onerror="imageFailed()" alt="' + filename + '" />';
		document.getElementById('thedate').innerHTML = month + '/' + day + '/' + year;
		//window.resizeTo(document.getElementById('comic').width,
document.getElementById('comic').height);
	}
	function imageFailed() {
		today = new Date();
		var yesterday = new Date(today-86400000);
		year  = yesterday.getFullYear();
		month = yesterday.getMonth() + 1;
		if(month < 10) {
			month = "0" + month;
		}
		day   = yesterday.getDate();
		if(day < 10) {
			day = "0" + day;
		}
		filename = 'pvp' + year + month + day + '.gif';
		document.getElementById('content').innerHTML = '<img id="comic"
src="http://www.pvponline.com/archive/' + year + '/' + filename + '"
onerror="imageFailed()" alt="' + filename + '" />';
		document.getElementById('thedate').innerHTML = month + '/' + day + '/' + year;
	}


On 1/14/07, Pedro Miguel César de Carvalho <email@hidden> wrote:
Hi,

I am not a developer, but I am starting to learn Javascript to start
creating some dashboard widgets!
I am trying to make a widget that extracts a daily cartoon that is published
daily in this page:
http://www.publico.clix.pt/bartoon/index.asp

Does anyone knows how to do a javascript that can do that job?

Cheers

Pedro da Vila


_______________________________________________ Do not post admin requests to the list. They will be ignored. Dashboard-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/dashboard-dev/email@hidden

This email sent to email@hidden


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Dashboard-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/dashboard-dev/email@hidden

This email sent to email@hidden
References: 
 >Cartoon (From: Pedro Miguel César de Carvalho <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.