Now that E2 has it's own auto-refreshing chatterbox, this is no longer as useful as it used to be...


Notelet Nodelet Squawkbox Client

Version: 1.0 (released July 2, 2003)
Download location: http://www.pitt.edu/~rttaylor/e2/squawkboxclient.js

Note to readers: I welcome any feedback on this code - good or bad.


What is it?

Yet another Notelet Nodelet Utility.

The Notelet Nodelet Squawkbox Client is an auto-refreshing chatterbox client. Unlike many other chatterbox clients, this one works directly within E2 as opposed to running a separate application, or opening another browser window.

As the name implies, the client uses the combination of the Notelet Nodelet and the squawkbox to do all of this. A single JavaScript file "glues" these resources together. Once you have set it up, you simply navigate to the squawkbox through a link or the search box, and the script automatically starts working.


How do I set it up?

First, you need to make sure you have some hard drive or web space to save a file to. You then create a .js file named squawkboxclient.js and include the source code listed below (or download it from the location specified at the top of this writeup). Then just upload the file to your web site or to a specific location on your computer.

Next, make sure you have the Notelet Nodelet turned on. You can do this by selecting it from your User Settings under the Nodelets heading. Once you have turned it on, you should see it in the column on the right with all the other nodelets. You then add the single line of code specified below to your notelet.

You're done! Just go to squawkbox and try it out.


Source Code

The .js Code

The squawkboxclient.js file should contain the following code:
// nodetitle is case sensitive
var nodetitle = 'squawkbox';

// you can change this to whichever server you use
var e2server = 'http://everything2.com';

// feel free to remove this link to the squawkbox
document.write('<a href="/?node=squawkbox">Open the Squawkbox</a>');

// only refresh the page if the user is at the squawkbox so that
// normal E2 use is not disrupted by unwanted refreshes
if (document.title == nodetitle + '@Everything2.com')
{
    // the refresh time is in milliseconds so 1000 = 1 second
    // (i.e., 60000 = 1 minute)
    // change it as you see fit, but don't make it too low or you 
    // may overload the server
    setTimeout('refresh()', 60000);
}
	
function refresh()
{
    // don't refresh if the user is in the middle of typing a message
    if (document.forms[2].message.value == '')
        document.location.href = e2server + '/?node=' + nodetitle;
}

Notelet Nodelet Code

If you saved the .js file to a web site, go to the Nodelet Editor to add the following HTML tag:

<script type="text/javascript" src="http://www.mydomain.com/squawkboxclient.js"></script>

Where http://www.mydomain.com/squawkboxclient.js is the URL of the JavaScript file you uploaded.

If you saved the .js file to your hard drive, go to the Nodelet Editor to add the following HTML tag:

<script type="text/javascript" src="file:///c:/mydocuments/squawkboxclient.js"></script>

Where c:/mydocuments/squawkboxclient.js is the file system path of the JavaScript file you saved to your hard drive.

If you are really pressed for space in your notelet with either of these methods, you can probably leave off the type="text/javascript" attribute.


Testing it out

If you want to "try before you buy", you may enter http://www.pitt.edu/~rttaylor/e2/squawkboxclient.js for the URL in your notelet. If you like it, please download your own copy, as I don't need hundreds of requests to that server. Note that the test file uses everything2.com as the primary server, so if you typically use another server, you will be taken to http://everything2.com after the first refresh.


Words of Wisdom

Please be respectful and consciencious when using this. Do not leave your browser on the squawkbox if you are not chatting (or at least actively lurking). Do not set your refresh interval to low, or you may bog down the server.


Frequently Asked Questions

Q. Are there any compatibility issues?
A. I tested this with Mozilla 1.3, Internet Explorer 6, and Netscape 7 and found no problems. Please let me know if this does not work with your browser, and I'll see what I can do.

Q. If it refreshes on a timer, won't that cause it to sometimes refresh while I'm in the middle of typing a message?
A. No. The script checks to see if there is any text in the message field before refreshing. If so, it stops, and it is then up to you to press Talk.

Q. I am a super elite uber-god content editor edevite, so have plenty of room in my notelet for your entire source code, but when I tried it, it didn't work. Why?
A. The source code references the document forms array through the use of square brackets ([ ]). Obviously this is how hard links are made, so it gets messed up. If anyone knows how to get around this, I'd love to hear it.

Q. Will you add Feature X to your client?
A. Maybe. Feel free to send me RFEs.

Q. Why?
A. Because.


1 Apparently it doesn't work from GeoCities.
2 Thanks m_turner for this idea.

Log in or register to write something here or to contact authors.