Twokinds ARCHIVE Forums

This forum is for the preservation of old threads from before the forum pruning.
It is currently Tue Jul 08, 2025 5:13 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: a javascript bucket full
PostPosted: Thu Feb 28, 2008 7:29 am 
Offline
Master
User avatar

Joined: Thu Nov 22, 2007 9:07 pm
Posts: 262
Location: Gatineau, QC, CA
it would be great if the site was based on javascript. Eg, javascript:back. then tom wouldnt need to edit so many things. I found this code a while ago:
Code:
<script LANGUAGE="JavaScript" FOR="window" EVENT="onload">
Load();
</script><script>
var i=0;
var nTips=75;
function Load() {
   var d = new Date();
   i =  ((d.getMonth() * 31) + d.getDate()) %nTips;
   if (i==null) i=0;
      eval("document.all.Tip"+i+".style.display=''");
}
function goNext()
{
   eval("document.all.Tip"+i+".style.display='none'");
   i=(((i%nTips)+1)%nTips);
   eval("document.all.Tip"+i+".style.display=''");
}
function showName() {
   window.status = event.srcElement.innerText;
   return true;
}
</script>


This symbolizes "Tip#" as a DIV class to load from.

Anyways, I've created my own little site that loads FROM twokinds on my desktop without typing in 2kinds.com all the time.

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=windows-1250">
<!-- Title and Refresh Data -->
  <title>Twokinds Deskload</title>
  <meta http-equiv="refresh" content="60">
  <style type="text/css">
  BODY { background-color: black; }
  </style>
<!-- RSS data -->
  <link rel="alternate" type="application/rss+xml" title="RSS" href=" http://2kinds.com/tk_rss.php">
  </head>
  <body>
  <table align="Center">
    <td rowspan="3" colspan="2"><iframe src="http://2kinds.com/todayscomic.htm" height="830" width="638" marginheight="0" marginwidth="0" scrolling="auto" name="mainframe" frameborder="2" style="border: #000000 2px solid"></iframe>
    </td>
    </table>
  </body>

See the problem is, i'm trying to fit it with a First Comic button and a Previous Comic button. I'd have to constantly change them. Well, except for the first comic button. What do you think tom, could twokinds base on javascript? It would be easier, for you and for me.
</html>[/code][/code]


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 31, 2008 7:11 pm 
Offline
Apprentice
User avatar

Joined: Fri Mar 28, 2008 1:23 am
Posts: 108
Location: In your closet
Will this program be available to the public?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 01, 2008 12:53 am 
Offline
Grand Templar
User avatar

Joined: Wed Aug 29, 2007 3:24 pm
Posts: 1545
Location: Carmina Gadelica
Shouldn't this be in the Tech board? What does it have to do with the book?
O.o


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 01, 2008 12:55 am 
Offline
He Who Makes Catgirls
User avatar

Joined: Fri Dec 17, 2004 6:02 pm
Posts: 2574
Location: Virginia
Tuna wrote:
Shouldn't this be in the Tech board? What does it have to do with the book?
O.o

I was moving it when you said that Tuna XD --

Also- it sounds like a horrible idea.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 01, 2008 2:44 am 
Offline
Templar Inner Circle
User avatar

Joined: Wed Jan 17, 2007 12:33 pm
Posts: 2879
Location: Nebraska, USA
I'm still trying to figure out what he's getting at. His mention of Javascript's back() function leaves me very confused -- to quote Inigo, "I do not think it means what you think it means."

Man, and the desktop refreshes every sixty seconds? *shudder*

-- Because I'm a little bit bored and unwilling to go to sleep --
I'm going to look at how to accomplish what I think he wants to do here. To implement first, previous, next, and latest buttons, I think our best option is AJAX. (Well, sort of...AJAX, or most specifically it's basis, the XMLHttpRequest object, gives us some extra control that I think would be useful here, but it's not absolutely necessary.) Effectively, you have it request the appropriate comic, based on some stored "current" value. First is easy -- it never changes. Everything else is more complicated.

Latest can be easy -- use the regular comic page. Heck, if you're playing smart with it, you can scrape out the date from that to make your calculations from. Now's the hard part: because Tom uses YYYYMMDD* for the comic title format, and we haven't always and forever stuck to the schedule, it's hard to predict which numbers are behind or before us.

Personally, I'd cheat and use Robbie's archive, which can give me the images in a numerical order and implement hiding the next button when I press it and the XMLHttpRequest gets a 404 status code back. If you don't want to do that, you'd have to walk through the dates, one by one. After constructing the appropriate date, you make the request and check the response status code. On a 200, display the comic. On a 404, keep working backward or forward as appropriate until you get a 200 response code. You'd want to throw in a limiting function so you don't walk off into oblivion (say, limit the dates to within today's date, inclusive, and 2003-10-22, inclusive (the date of the first comic).

I'm not sure what the ideal way to check for a new comic would be (it's late and I'm starting to get tired), but refreshing every sixty seconds would not be it. At the very least, something more on the lines of an hour would be preferable.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 02, 2008 7:26 am 
Offline
Citizen
User avatar

Joined: Thu Jul 20, 2006 11:10 pm
Posts: 87
Location: INEBRIATION
I personally hate teh scriptz(java, vb, etc...etc...) and make it a point not to allow client side scripting on mah intarwebz. I like things in simple static html, not in mah cpu stealin' moar of mah cycles. I find it particularly irksome when sites require JS, it's supposed to be used to augment a page not create it(IMO). I wish ads were served using html... Then I might actually see one (thank you adblock+ and noscript).


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 04, 2008 10:07 pm 
Offline
Master
User avatar

Joined: Thu Nov 22, 2007 9:07 pm
Posts: 262
Location: Gatineau, QC, CA
say what about an ad block? I would really like that for my site- i pay 40 dollars every three years for it and it still doesn't remove the ads. Of course it's a cheap price but the options are completely limited! only 15 megs allowed on it! INSANE!
It would make it easier because of the common fact we all know: Manual links. Its sad but true. Every single time, you would have to connect to an FTP server and find out what your last comic was and manually typing it up. ugh, it kills me man, it kills me!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group