Archive for February, 2006

Archive for February, 2006


Posted on

This post has been ‘deprecated’. Please see FreshTags-Singpolyma 2

I have for some time had my own version of the FreshTags system. In the past, all upgrades to this version have been seamless to the user, but this time the changes were too radical to allow that to work. I have rewritten the entire hack based off of the FreshTags v0.5 code. The major changes from FreshTags 0.5 are:

  • Hidden post page is used for displaying tags, instead of reloading the current page and displaying in the sidebar (the primary purpose of the original modifications)
  • Completely asynchronous data load — FreshTags no longer loads before the page content, but rather loads afterwards, resulting in a faster page load time
  • If no tag is selected one can be automatically pulled from relTag data on the page
  • Full support for peek-a-boo headlines in blogrolls

Please Note : If you are upgrading from my previous hack, you will need to remove all of its code from your template before upgrading. You will also have to edit the Tags post.

Basic Installation Instructions

  1. Create a new post on the blog you would like to implement this hack on with the title ‘Tags’ and click the ‘Edit Html’ tab for the post body, pasting the exact code ‘<div id=”freshtags_postpage”><i>Loading…</i></div>’ into the post body. Turn comments off for the post and set the post date to January 1, 2000. The time doesn’t matter. Post this post. (If you are upgrading from the previous version, just edit the post to contain the new code.)
  2. Edit the template for your blog and insert this code into the <head> section:
    <script type=”text/javascript”>
    var del_user = “delicious username“;
    var anchor = “anchor tag“;
    var defs = “”;
    var maxposts = 10;
    var freshtags_tags_id = “freshtags_tags”;
    var freshtags_posts_id = “freshtags_posts”;
    var freshtags_postpage_id = “freshtags_postpage”;
    <script type=”text/javascript” src=”;id=818185

    Where ‘delicious username’ is the username you store your blog data in and ‘anchor tag’ is the anchor tag you use (if you use one). If you don’t use an anchor tag, just replace the words ‘anchor tag’ with nothing.

  3. Insert this code where you would like the tags drop-down to go:
    <div id=”freshtags_tags”><i>Loading…</i></div>
    <div id=”freshtags_posts”></div>
  4. Save your template and republish your blog

Customisation Options

  • no_autocapture — setting this variable to true will keep the script from attempting to grab relTag data from the page. For example, to keep a Blogger blog using this script from grabbing relTag data when on the main page use <MainPage><script type=”text/javascript”>var no_autocapture = true;</script></MainPage>
  • defs — setting this variable sets what tag(s) will be selected be default if the user has not selected any. This will do nothing if no_autocapture is not set to true unless the autocapture failes.
  • maxposts — the maximum number of posts to display in the sidebar
  • freshtags_tags_id — the ID of the block to put the tags dropdown in
  • freshtags_posts_id — the ID of the block to put the posts list
  • freshtags_postpage_id — the ID of the block in the Tags post
  • freshtags_tag_format — the format for the tags list (default is ‘drop-add’). For example, to use asynchronous post loading add this code to your template: <script type=”text/javascript”>var freshtags_tag_format = “drop-add-async”;</script>

Peek-A-Boo Blogroll Headlines
To add peek-a-boo headlines to your blogrolls follow the following steps:

  1. Add this code to the <head> section of your blog to facilitate the actual show/hide:
    <script type=”text/javascript”>
    function toggleitem(postid,linkid,newtxt,displaytype) {
    if(!displaytype) {displaytype = ‘block’;}
    var whichpost = document.getElementById(postid);
    if ( != “none”) { = “none”;
    } else { = displaytype;
    if(linkid) {
    var lnk = document.getElementById(linkid);
    lnk.href = “javascript:toggleitem(‘”+postid+”‘,'”+linkid+”‘,'”+lnk.innerHTML+”‘);”;
    lnk.innerHTML = newtxt;
  2. Add this code just after the blogroll link you want to add peek-a-boo headlines for (it’s invisible defaultly, just the container for the headlines) ‘<div id=”blognameheadlines” style=”display:none;”><i>Loading…</i></div>
  3. If this blog stores post data in (they don’t have to use FreshTags necessarily) add this code just before the blogroll link (it’s the +/- link for showing/hiding the headlines):

    <a id=”blognamelink” href=”javascript:toggleitem(‘blognameheadlines’,’blognamelink’,’-‘); load_otherblog_titles(‘’,’other blog’s account username‘,’other blog’s anchor tag (if they use one)‘,’URL to other blog’s feed (optional)‘,’blognameheadlines’);”>+</a>

    Otherwise add this code to use just their feed:

    <a id=”blognamelink” href=”javascript:toggleitem(‘blognameheadlines’,’blognamelink’,’-‘); load_otherblog_titles(‘feed’,”,”,’URL to other blog’s feed‘,’blognameheadlines’);”>+</a>

coComment JSONP

Posted on

coComment is a new service like Commentosphere that helps you tracks your comments/conversations across the web. If you haven’t heard of coComment yet check out Johan’s article at Ecmanaut.

One of the features missing from coComment has been JSON(P) feeds of data. They have a ‘blog box’ JavaScript include, but it is limitedly customisable. So, frustrated with the way it did work, but still wanting to display my coComment data in my sidebar like I have been doing with Commentosphere, I created a hack that generates JSONP feeds for coComment.

Using the script is simple. You pass the URL to the JavaScript for a customised blog box on coComment to the script, along with optionally the name of a callback function (using ‘&callback’). You can tack on ‘&raw’ to make it output raw JSON data. If no callback is specified and you do not specify raw data it will check to see if you have a coComment.callbacks objects with a comments function and call that. The URL is:

If you want a sidebar element, or just some example JavaScript code to work with, here is what I use. Put this in your <head> section:

<script type=”text/javascript”>
var list_cocomment_limit = NUMBER OF CHARACTERS;
var list_cocomment_id = “cocomment”;
var list_cocomment_url = “URL TO BLOG BOX“;
function list_cocomment_callback() {
val = ”;
val += ‘<ul class=”cocomment”>’;
for(var i=0; i<coComment.comments.length; i++) {
val += ‘ <li><a href=”‘+coComment.comments[i].articlelink+'”>’+coComment.comments[i].body.substr(0,list_cocomment_limit)+’…</a></li>’;
}//end for
val += ‘</ul>’;
val += ‘<a href=”‘+coComment.url+'”>More</a> on <a href=”;;
item = document.getElementById(list_cocomment_id);
item.innerHTML = val;
}//end function list_cocomment_callback
coComment = {};
coComment.callbacks = {};
coComment.callbacks.comments = list_cocomment_callback;
function list_cocomment() {
coComment = {};
coComment.callbacks = {};
coComment.callbacks.comments = list_cocomment_callback;
var thescript = document.createElement(“script”);
thescript.type = “text/javascript”;
thescript.src = ‘;
}//end function list_cocomment
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != ‘function’) {
window.onload = func;
} else {
window.onload = function() {
}//end if
}//end function addLoadEvent

And in your sidebar put ‘<div id=”cocomment”><i>Loading…</i></div>‘.

Been Sick

Posted on

Yes I’ve been a bit sick as of late — just haven’t got around to posting about it 😉 Parents think it may be malaria-related and have me on those drugs — whatever the case it seems to be getting better 🙂 Not a lot else happening — school, chat, lounging around, the usual. Chels threw out her back awhile ago and that’s been really bothering me… but she’s recovering slowly 🙂 How do some of you ppl post every day?? I can hardly think of anyting to write and it’s been awhile… oh, I’ve finished up my EBC application, and their next meeting is on the 27th, so I should know if I’m in or not soon 🙂 School seems to be going alright, and some of my marks are picking up a bit… not as good as I would have hoped, but I’ll have to live with it 🙂 Well I’m sure (as always) that there’s more to say… but I can’t think of a thing… so until next time and hope to see you online! JSONP is Native!

Posted on

For quite awhile now, has offered JSON support, but not a proper JSONP implementation. I even wrote my own proxying script to fix this oversight. It seems that that will no longer be necessary. If you pass callback=CALLBACK to a JSON feed it will now output proper JSONP that does not set the Delicious.posts variable (easy to fix in your callback function) but calls CALLBACK with the JSON object as a parameter. Compare these:
There has, as yet, been no official announcement on the blog, so this feature may yet be pulled like some others have, but I hope they will not. Hopefully I will soon be modifying my version of FreshTags to make good use of this native JSONP support.


Posted on

Yesterday was Valentines day, and we had a sort of party-thing hosted by Aunt Cindy McCordic for lunch. It was a lot of fun — we ate spaghetti with cheese sauce and played some games. Two of them were mind-trick games — one where Aunt Cindy did something we were supposed to copy, but no one could get it because they didn’t notice she’d cleared her throat at the beginning, and one Janelle did called ‘Chinese numbers’ (but I won’t tell you how it works, ’cause that’d spoil it 😉 ). We also played a wonderful trick on me! You see, there’s this game where you stick a funnel in the top of your pants and then stick a coin to your head and try to drop it into the funnel. Not an easy task! Well, while you’re busy sticking the coin to your head, someone runs over and pours water into the funnel!! Hehe, all in all, it was great fun 😉

Not whole globs of other stuff going on right now… although I’m sure I had thought of something else to say in this post 😛 ah, well, I always seem to forget what all I was gonna say.

Oh, and by the way, I have a bunch of new pictures on my flickr again — check ’em out 😀