Help with Penny-Arcade Active Desktop

A

Alvy

Guest
#1
Could anyone help me with an active desktop that will automatically update itself daily with the latest comic strip from
http://www.penny-arcade.com/view.php3 ? I do not want to have the whole page on my desktop so simply putting the link is out of the question.
Thanks a lot =)
 

SPeedY_B

I may actually be insane.
#2
You'll need PHP to use this :
Code:
<html><head></head><body>
<script language="JavaScript" type="text/javascript">
function noImage(theImage)
{ theImage.src = "no.comic.today.png"; }
</script>
<?php
$today = date(D);
$pa = date(Ymd);
if ($today == Tue) { $show = true; }
elseif ($today == Wed) { $show = true; }
elseif ($today == Fri) { $show = true; }
else { $show = false; }
if ( $show == true ) { print "<img src=\"http://penny-arcade.com/$pa"; print "l.gif\" border=\"0\" onError=\"noImage(this);\">"; }
else { print "<img src=\"no.comic.today.png\" border=\"0\">"; }
?>
</body></html>
That's rather rough code though, I'm sure someone else will be able to do a better job, it may also be possible in just javascript.

You could just visit the site everyday, I know I do ;)
 
A

Alvy

Guest
#3
Is it possible to show the previous day's comic if there ain't one available for the current day? =)

Thanks Speedy, great job =) never knew someone would help me with such a big task.

If possible, msg me on EFNet =)
I'm Alv and idling in #NTFS too hehe

--
Oh yea, when I have it running, it keeps making the CPU do something (the LED blinks constantly until this active desktop is disabled), could you please fix that? I can't really use it now because of this =) Probably its because its checking for updates? Maybe you have to make this only at the beginning of a day?
 

Piett

...will circle this city
#4
ohhh

i'm definatly going to have to take a good look at this. that's for pounding that out speedy (btw: i go there everyday too =] )
 

SPeedY_B

I may actually be insane.
#5
X-Istence helped me optmise the code a bit, so now we have this ..
Code:
<?php
$today = date(D);
$pa = date(Ymd);
switch ($today) {
  case Mon:
      print "<img src=\"http://penny-arcade.com/images/2003/$pa"; print "l.gif\" border=\"0\" onError=\"noImage(this);\">";
      break;
  case Wed:
      print "<img src=\"http://penny-arcade.com/images/2003/$pa"; print "l.gif\" border=\"0\" onError=\"noImage(this);\">";
      break;
  case Fri:
      print "<img src=\"http://penny-arcade.com/images/2003/$pa"; print "l.gif\" border=\"0\" onError=\"noImage(this);\">";
      break;
  default:
     $date = date(d);
     $date--;
     $date2 = date(Ym);
     $pa = $date2 ."" . $date;
     print "<img src=\"http://penny-arcade.com/images/2003/$pa"; print "l.gif\" border=\"0\" onError=\"noImage(this);\">";
}
?>
Problems at present include end of month and viewing the page on a sunday, it'll be worked on tho :)

I also found a Javascript version created by someone else.
Code:
<html>
<head>
<script language="JavaScript1.2">

  function reset_image(name, pad) {

     today = new Date();
     if (pad > 0) {
        today = new Date(today.getTime() - pad);
     }

     year = today.getYear();
     if (year > 2009) {
        year -= 2000;
        year = new String(year);
     }
     else if (year > 2000) {
        year -= 2000;
        year = '0' + new String(year);
     }
     else if (year > 9) {
        year = '0' + new String(year);
     }
     else {
        year = new String(year);
     }

     if (today.getMonth() > 8) {
        month = new String(today.getMonth() + 1);
     }
     else {
        month = '0' + new String(today.getMonth() + 1);
     }

     if (today.getDate() > 9) {
        day = new String(today.getDate());
     }
     else {
        day = '0' + new String(today.getDate());
     }

     setTimeout("reset_image('" + name + "', 0)", 3600000);
     if (name == 'penny') {
        url = 'http://www.penny-arcade.com/images/20' + year + '/20' + year + month + day + 'l.gif';
     }
     eval('document.' + name + '_invisible.src = url');
  }

</script>
</head>

<body bgcolor="34629E" onLoad="reset_image('penny', 86400000);">
<img name="penny_invisible" src="" onLoad="document.penny_visible.src=this.src" width="0" height="0" style="visibility: hidden">
<img name="penny_visible" src="http://www.penny-arcade.com/images/2002/20020807l.gif" border="0">
</body></html>
 

Members online

No members online now.

Latest posts

Latest profile posts

Perris Calderon wrote on Electronic Punk's profile.
Ep, glad to see you come back and tidy up...did want to ask a one day favor, I want to enhance my resume , was hoping you could make me administrator for a day, if so, take me right off since I won't be here to do anything, and don't know the slightest about the board, but it would be nice putting "served administrator osnn", if can do, THANKS

Been running around Quora lately, luv it there https://tinyurl.com/ycpxl
Electronic Punk wrote on Perris Calderon's profile.
All good still mate?
Hello, is there anybody in there? Just nod if you can hear me ...
Xie
What a long strange trip it's been. =)

Forum statistics

Threads
61,969
Messages
673,295
Members
89,016
Latest member
dopexoity