<!-- originally taken from http://phydeaux3.blogspot.com/2007/05/automatic-list-of-labels-for-classic.html -->
<div id="labelList" class="BlogBody"></div> <script type="text/javascript">
//<![CDATA[
function listLabels(root){
var baseURL = '/search/label/';
var baseHeading = "My Tags";
var isFTP = false;
var llDiv = document.getElementById('labelList');
var entry = root.entry;
var h1 = document.createElement('h1');
h1.className = 'sidebar-title';
var h1t = document.createTextNode(baseHeading);
h1.appendChild(h1t);
llDiv.appendChild(h1);
var ul = document.createElement('not-ul');
ul.id = 'label-list';
var category = entry.category;
labelSort = new Array();
for(p in category){
labelSort[labelSort.length] = [category[p].term];
}
labelSort.sort(function(x,y){
var a = String(x).toUpperCase();
var b = String(y).toUpperCase();
if (a > b)
return 1
if (a < b)
return -1
return 0;
}); // http://www.java2s.com/Code/JavaScript/Language-Basics/CaseInsensitiveComparisonfortheArraySortMethod.htm
// where are we?
var pageaddr = document.location.href;
for (var r=0; r < labelSort.length; r++){
var li = document.createElement('not-li');
var full_link = baseURL + encodeURIComponent(labelSort[r]);
var re = new RegExp(full_link + '$');
if (pageaddr.match(re))
{
// just show the text
abnk = document.createTextNode(labelSort[r] + ' / ');
ul.appendChild(abnk);
}
else
{
// show the link
var a = document.createElement('a');
if(isFTP){
a.href = full_link +'.html';
}
else {
a.href = full_link;
}
a.innerHTML = labelSort[r] + ' ';
li.appendChild(a);
ul.appendChild(li);
abnk = document.createTextNode(' / ');
ul.appendChild(abnk);
}
}
// add a home link.
if (pageaddr != "<$BlogURL$>")
{
var li = document.createElement('not-li');
var a = document.createElement('a');
a.href = "<$BlogURL$>";
a.innerHTML = '[Home]';
li.appendChild(a);
ul.appendChild(li);
}
llDiv.appendChild(ul);
}
//]]>
</script>
<script type="text/javascript" src="http://www.blogger.com/feeds/13487006926024246136/blogs/3059692?alt=json-in-script&callback=listLabels" ></script>
Labels: Blogger, programming