Shima
Apr-14-2008, 08:42 PM
Can I do what was listed below for subcategories, and if so how?
Can I hack it so my categories have descriptions? (javascript:void(0);) Sure! Add this code (javascript:toggleShow('twelfthCode');) to your javascript, changing the teal to reflect the name of your categories and the descriptions you want to show:
function addCategoryDescription() {
var categoryDescription = {
"category_name" : "multiple word categories are separated by an underscore",
"category2" : "This is another test.",
"category3" : "Final test"
};
if ((YD.hasClass(document.body, "category")) && (!YD.hasClass(document.body, "subcategory"))) {
re = /category_(\S+)/i;
re.exec(document.body.className);
breadCrumb = YD.get("breadcrumb");
if (breadCrumb && categoryDescription[RegExp.$1]) {
divTag = document.createElement("div");
divTag.className = "categoryDescription";
divTag.appendChild(document.createTextNode(categoryDescription[RegExp.$1]));
breadCrumb.parentNode.insertBefore(divTag, breadCrumb.nextSibling);
}
}
if (YD.hasClass(document.body, "homepage")) {
re = /\>([\w\-]+)<\/a>/i;
divTag = YD.get("categoriesBox");
if (divTag) {
divTags = YD.getElementsByClassName("albumTitle", "p", divTag);
for (i=0; i<divTags.length; i++) {
re.exec(divTags[i].innerHTML);
if (categoryDescription[RegExp.$1] != undefined) {
pTag = document.createElement("p");
pTag.className = "categoryDescription";
pTag.appendChild(document.createTextNode(categoryDescription[RegExp.$1]));
divTags[i].parentNode.insertBefore(pTag, divTags[i].nextSibling);
}
}
}
}
}
YE.addListener(window, "load", addCategoryDescription);
Note that you can add more and less category descriptions as needed. Also, category names are CaSE SenSITive.
Can I hack it so my categories have descriptions? (javascript:void(0);) Sure! Add this code (javascript:toggleShow('twelfthCode');) to your javascript, changing the teal to reflect the name of your categories and the descriptions you want to show:
function addCategoryDescription() {
var categoryDescription = {
"category_name" : "multiple word categories are separated by an underscore",
"category2" : "This is another test.",
"category3" : "Final test"
};
if ((YD.hasClass(document.body, "category")) && (!YD.hasClass(document.body, "subcategory"))) {
re = /category_(\S+)/i;
re.exec(document.body.className);
breadCrumb = YD.get("breadcrumb");
if (breadCrumb && categoryDescription[RegExp.$1]) {
divTag = document.createElement("div");
divTag.className = "categoryDescription";
divTag.appendChild(document.createTextNode(categoryDescription[RegExp.$1]));
breadCrumb.parentNode.insertBefore(divTag, breadCrumb.nextSibling);
}
}
if (YD.hasClass(document.body, "homepage")) {
re = /\>([\w\-]+)<\/a>/i;
divTag = YD.get("categoriesBox");
if (divTag) {
divTags = YD.getElementsByClassName("albumTitle", "p", divTag);
for (i=0; i<divTags.length; i++) {
re.exec(divTags[i].innerHTML);
if (categoryDescription[RegExp.$1] != undefined) {
pTag = document.createElement("p");
pTag.className = "categoryDescription";
pTag.appendChild(document.createTextNode(categoryDescription[RegExp.$1]));
divTags[i].parentNode.insertBefore(pTag, divTags[i].nextSibling);
}
}
}
}
}
YE.addListener(window, "load", addCategoryDescription);
Note that you can add more and less category descriptions as needed. Also, category names are CaSE SenSITive.