﻿/*
Blogger Classic Tag Cloud plugin for jQuery
Copyright (c) 2007-2009 Nik Makris (nikmakris.com)
Licensed under the MIT license (http://www.nikmakris.com/projects/BloggerClassicTagCloud/#license) 
Version: 1.0.0 (29/06/2009 21:35:00)
*/
(function($) { jQuery.fn.BloggerClassicTagCloud = function(ftppath, feedfilename) { return this.each(function() { var div = jQuery(this); var feedurl = ftppath + feedfilename; var categories = new Array(); var dedupedCategories = []; jQuery.get(feedurl, function(data) { jQuery(data).find("category").each(function() { categories[categories.length] = jQuery(this).attr("term"); }); categories.sort(caseInsensitiveCompare); var oldCategory = ""; var x = 0; jQuery(categories).each(function() { if (this.toString() != oldCategory) { dedupedCategories[x] = []; dedupedCategories[x][0] = this.toString(); dedupedCategories[x][1] = 1; x++; } else { dedupedCategories[x - 1][1] = dedupedCategories[x - 1][1] + 1; } oldCategory = this.toString(); }); jQuery(dedupedCategories).each(function(i) { var $link = jQuery("<a></a>").attr("href", ftppath + "labels/" + dedupedCategories[i][0] + ".html"); var $span = jQuery("<span></span>").attr("style", "font-size:" + ((dedupedCategories[i][1] * 3) + 12) + "px;"); $span.append(dedupedCategories[i][0]); $link.append($span); div.append($link); div.append(" \n"); }); }); }); }; function caseInsensitiveCompare(a, b) { var anew = a.toLowerCase(); var bnew = b.toLowerCase(); if (anew < bnew) { return -1; } if (anew > bnew) { return 1; } return 0; } })(jQuery);
