var TR = new Object(); TR.taglist = {"art":"298","college":"212","comics":"551","culture":"487","dowdyworld":"332","education":"289","film":"506","food":"189","jazz":"251","life":"361","music":"702","pencils":"190","photography":"219","poetry":"291","politics":"620","Proust":"191","technology":"293","television":"391","words":"623","writing":"447"}; TR.MAX_FONT_SIZE = 14; TR.MIN_FONT_SIZE = 14; TR.username = 'm.leddy'; TR.startColor = [0x55,0x88,0xaa]; TR.endColor = [0x55,0x88,0xaa]; TR.isRGB = 1; TR.minCount = 189; TR.maxCount = 702; function pb_cook(s) { return s; } function pb_render_tag(tag, size, color) { var ctag = pb_cook(tag); var link = ''; link += ctag; link += ""; //link += "
 " + color + "
"; return link; } function scale(start, end, val, minVal, maxVal) { if (start > end) { var factor = (start - end) / Math.log(maxVal / minVal); var result = start - Math.round(Math.log(val / minVal) * factor); } else { var factor = (end - start) / Math.log(maxVal / minVal); var result = Math.round(Math.log(val / minVal) * factor + start); } return result; } function toRGBString(rgbVal) { var result = "#"; for (var i = 0; i < 3; i++) { if (rgbVal[i] < 16) { result = result + '0'; } result = result + rgbVal[i].toString(16); } return result; } function HSBtoRGB(hue, saturation, brightness) { var r = 0; var g = 0; var b = 0; var hu = hue / 10; var sat = saturation / 10000; var bri = brightness / 10000; if (saturation == 0) { r = g = b = Math.round(bri * 255); } else { var h = hu / 60; var f = h - Math.floor(h); var p = bri * (1.0 - sat); var q = bri * (1.0 - sat * f); var t = bri * (1.0 - (sat * (1.0 - f))); h = Math.floor(h); switch (h) { case 0: r = Math.round(bri * 255.0); g = Math.round(t * 255.0); b = Math.round(p * 255.0); break; case 1: r = Math.round(q * 255.0); g = Math.round(bri * 255.0); b = Math.round(p * 255.0); break; case 2: r = Math.round(p * 255.0); g = Math.round(bri * 255.0); b = Math.round(t * 255.0); break; case 3: r = Math.round(p * 255.0); g = Math.round(q * 255.0); b = Math.round(bri * 255.0); break; case 4: r = Math.round(t * 255.0); g = Math.round(p * 255.0); b = Math.round(bri * 255.0); break; case 5: r = Math.round(bri * 255.0); g = Math.round(p * 255.0); b = Math.round(q * 255.0); break; } } var result = [r, g, b]; return result; } //document.write("

Pinboard Tag Cloud

"); for (var t in TR.taglist) { var count = TR.taglist[t]; var size = scale(TR.MIN_FONT_SIZE, TR.MAX_FONT_SIZE, count, TR.minCount, TR.maxCount); var rgbVal = new Array(3); for (var i = 0; i < 3; i++) { rgbVal[i] = scale(TR.startColor[i], TR.endColor[i], count, TR.minCount, TR.maxCount); } if (!TR.isRGB) { rgbVal = HSBtoRGB(rgbVal[0], rgbVal[1], rgbVal[2]); } var formatted = pb_render_tag(t, size, toRGBString(rgbVal)); document.write(formatted); document.write("\n"); }