grack.com

Haloscan Comments

Haloscan comments are coooool.  :)  I've come up with a little scriptlet to handle the non-existance of the Haloscan server:

Note the use of javascript "if" to test for the existance of a global method.

function cleanFilename( strFilename )
{
	return strFilename.replace( /[\s\+\;\,\.\-\=\*]/g, '_' );
}

function showComments( strStoryName )
{
	if ( HaloScan )
		HaloScan( cleanFilename( strStoryName ) );
	else
		alert( 'Comments are currently unavailable' );s
}

function showCommentCount( strStoryName )
{
	if ( postCount )
		postCount( cleanFilename( strStoryName ) );
	else
		document.write( "Comments Unavailable" );
}