PDA

View Full Version : Subcategory question


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.

Shima
Apr-15-2008, 12:52 PM
bump

anyone?

Shima
May-11-2008, 05:39 AM
bump?

Shima
May-11-2008, 06:01 AM
Here's what I've tried (and it isn't working)
http://photos.cathoffman.com/Weddings
-> I just want to be able to display the wedding date underneath the subcategory name.


/*==============================*/
/* the subCategory descriptions */
/*==============================*/
function addSubCatDescription() {
var SubCatDescription = {
"Heidi__Mike" : "May 10th, 2008",
"Svetlana__Jeremy" : "August 12th, 2007",
"Chereka__Rushaun" : "August 18th, 2007"
};

if (YD.hasClass(document.body, "subcategory"))
{
re = /subcategory_(\S+)/i;
re.exec(document.body.className);

albumtitle = YD.get("subCatGalleryTitle");
if (albumtitle && SubCatDescription[RegExp.$1]) {
divTag = document.createElement("div");
divTag.className = "SubCatDescription";
divTag.appendChild(document.createTextNode(SubCatDescription[RegExp.$1]));
albumtitle.parentNode.insertBefore(divTag, albumtitle.nextSibling);
}
}
if (!YD.hasClass(document.body, "homepage")) {
re = /\>([\w\-]+)<\/a>/i;

divTag = YD.get("galleriesBox");
if (divTag) {
divTags = YD.getElementsByClassName("subCatGalleryTitle", "p", divTag);

for (i=0; i<divTags.length; i++) {
re.exec(divTags[i].innerHTML);
if (SubCatDescription[RegExp.$1] != undefined) {
pTag = document.createElement("p");
pTag.className = "SubCatDescription";
pTag.appendChild(document.createTextNode(SubCatDescription[RegExp.$1]));
divTags[i].parentNode.insertBefore(pTag, divTags[i].nextSibling);
}
}
}
}
}
YE.addListener(window, "load", addSubCatDescription);

PBolchover
May-11-2008, 06:43 AM
Unless it's a cut-and-paste artifact, you have an extra space in the line

divTag.appendChild(document.createTextNode(SubCatD escription[RegExp.$1]));

Shima
May-11-2008, 08:42 AM
Unless it's a cut-and-paste artifact, you have an extra space in the line

divTag.appendChild(document.createTextNode(SubCatD escription[RegExp.$1]));


No such space in my customization code.

Also, I noticed it appears on the subcategory page itself:
http://photos.cathoffman.com/Weddings/513743

But I'm more concerned with it showing up here (which it's not doing):
http://photos.cathoffman.com/Weddings/


help?