<!-- A small script that expands all collapsed items in the blog archive -->
<script type='text/javascript'>
function getElementsByClassName(oElm, strTagName, oClassNames) {
var arrElements = (strTagName == '*' && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
var arrReturnElements = new Array();
var arrRegExpClassNames = new Array();
if (typeof oClassNames == 'object') {
for(var i=0; i < oClassNames.length; i++){
arrRegExpClassNames.push(new RegExp('(^|\\s)' + oClassNames[i].replace(/\-/g, '\\-') + '(\\s|$)'));
}
}
else{
arrRegExpClassNames.push(new RegExp('(^|\\s)' + oClassNames.replace(/\-/g, '\\-') + '(\\s|$)'));
}
var oElement;
var bMatchesAll;
for(var j=0; j < arrElements.length; j++){
oElement = arrElements[j];
bMatchesAll = true;
for(var k = 0; k < arrRegExpClassNames.length; k++){
if (!arrRegExpClassNames[k].test(oElement.className)) {
bMatchesAll = false;
break;
}
}
if (bMatchesAll) {
arrReturnElements.push(oElement);
}
}
return (arrReturnElements)
}
var listItems = getElementsByClassName(document, 'li', 'archivedate collapsed');
for (var i = 0; i < listItems.length; i++) {
listItems[i].className = 'archivedate expanded';
}
</script>
NOTE: The above javascript is in a valid XML format since blogger now XML validates any changes you make to your blogger template.
No comments:
Post a Comment