• Gear
  • Shots
  • Photo Craft
  • Video
  • Wide Angle
  • Support
  • New Stuff
  • More
Support SmugMug Customization Customization code review - how bad is it?

FAQtoid

Ever wanted to create an Avatar? Creating an Avatar!

Searching Dgrin with Google Searching with Google

Dgrin Challenges

Congratulations to the Winner of DSS #128 (Sunrise or Sunset), ShootingStar.

The next Dgrin Challenge DSS #129 (Silhouette Revisited ) is open for entries through May 27th, 2013 at 8:00pm PDT.

As always, we look forward to your participation but please do take a moment to read through the rules before posting your entry.

Past DSS Challenge Winners, DSS Challenge Rules, and other important DSS Challenge information is here.

Need some help with Accessories?

Tutorials

Ever find yourself wondering just how someone managed to create an image using different effects?

Here are three simple tutorials we hope will encourage you to try something new.

The Hot Seat

A lifelong interest in landscape photography has led Eyal Oren to make a study of his adopted hometown of Marblehead, MA. As you can see, his dedication is paying off!

Africa!

Dgrinners Harryb, Pathfinder, and others joined Andy Williams and Marc Muench on Safari in East Africa recently. Here are some awesome threads to check out!

 
Thread Tools Display Modes
Old May-25-2009, 07:00 AM
#1
ChancyRat is offline ChancyRat OP
Soooo Beginner Grinner
Customization code review - how bad is it?
I have discovered I shouldn't just copy in code without jotting down what it's for. Plus there's the problem that I don't know what I'm doing, so I've probably made a mess. Would someone mind surveying my code and tell me if I've done something amiss? I believe there are elements that don't work, as well, and I've left them there thinking I would get back to them. Sadly, I can't tell you which ones they are. I'm obviously learning the hard way. This is the code that I received by email. Thank you!

http://joinrats.smugmug.com/


PHP Code:
You recently requested a copy of your customizationHere are the values:
BACKGROUND COLORdark
PAGE TITLE
JoinRats Socialize Pet RatsBuild Trust and Relationship
CSS
/* hides the word home */
#userHome {
displaynone;
}
/* remove the 's */
.possess {
displaynone;
}
 
#journal .journal_entry .right {
floatleft;
margin-right0;
}
#smugmug_small #albumNav_bottom, #smugmug #albumNav_bottom {
displaynone;
}
 
#breadcrumb .title,
.photoNav a.nav.next {
font-familyverdana !important;
font-weightnormal !important;
font-size14px !important;
}
#comments {font-size: 14pt;}
#caption,
.caption {font-size14pt !important;}
#albumDescription {font-size: 20px;}
#caption_bottom {font-size: 14pt !important;}
#menu {font-size: 20px !important;}
#small-caption,
.small-caption {font-size20pt !important;}
#message-box,
.message-box {font-size20pt !important;}
/* html only page for gallery XXXXXX */
/*.gallery_http://joinrats.smugmug.com/gallery/7817105_r5Gvj .nophotos { display: none; } */
/* START gallery 8004395_A7pkR#520478125_27XEV */
.gallery_8004395_A7pkR#520478125_27XEV #albumDescription {
margin-top40px/* gap from navbar at top */
background#ccc; /* background of description box */
padding20px 40px 40px 40px/* top right bottom left */
/* spacing inside box from edges */
.gallery_8004395_A7pkR#520478125_27XEV .myPhoto {
floatleft/* allows the text to flow to the right */
padding0 30px 10px 0/* top right bottom left */
/* spacing of text around photo */
.gallery_8004395_A7pkR#520478125_27XEV .myPhoto img {
border4px ridge #444; /* add border around photo */
}
.
gallery_8004395_A7pkR#520478125_27XEV .myTitle {
font-familyComic Sans MSverdana;
font-size150%;
color#444;
font-weightbold;
text-aligncenter;
margin0 auto 30px auto/* top right bottom left */
}
.
gallery_8004395_A7pkR#520478125_27XEV .myText {
font-familyComic Sans MSverdana;
font-size100%;
color#444;
font-weightnormal;
text-alignjustify;
}
.
gallery_8004395_A7pkR#520478125_27XEV .myEmail {color: #444;}
.gallery_8004395_A7pkR#520478125_27XEV .myEmail:hover {color: red;}
/* things you can hide on page */
.gallery_8004395_A7pkR#520478125_27XEV .nophotos h3, /* if no photos in gallery */
.gallery_8004395_A7pkR#520478125_27XEV #albumNav_top,
.gallery_8004395_A7pkR#520478125_27XEV #albumNav_bottom,
.notLoggedIn .gallery_8004395_A7pkR#520478125_27XEV .journal_entry, /* hides photos in gallery */
.notLoggedIn .gallery_8004395_A7pkR#520478125_27XEV #breadcrumb {display: none;}
/* END gallery 8004395_A7pkR#520478125_27XEV */
 
HEADER javascript: function updateSS() {
// look at the body tags classes, if it is the homepage then swap
bodyClass document.getElementsByTagName("body")[0].className;
if (
bodyClass.indexOf("slideshow") != -1) {
slideDuration 3;
document.getElementById("duration").value "3";
}
// Change Home Link (from Devbobo)
YE.onContentReady('toolbar', function () { this.innerHTML this.innerHTML.replace(/href="http:\/\/www.smugmug.joinrats.com\/([?\w&;=]+)?"/, 'href="' webServer '"')});
BODY TAG: <body onload="updateSS();">
CUSTOM HEADER:
CUSTOM FOOTER: ******** type="text/javascript">
var 
gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." "http://www.");
document.write(unescape("%3Cscript src='" gaJsHost "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
<
/********
******** type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-8541296-1");
pageTracker._trackPageview();
} catch(err) {}</********
******** type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</********
******** type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-8541296-2");
pageTracker._trackPageview();
} catch(err) {}</********
FOOTER javascript: filmstripMove = 0;
showPhotoBar = false;
showImagePreview = false;
 
function delHover() {
oLst = YD.getElementsBy(function(el) {return (YD.hasClass(el,'imgBorder') || YD.hasClass(el,'imgBorderOn'))},'img');
for (i=0; i < oLst.length ; i++) {
if (oLst[i].title && oLst[i].title != '') oLst[i].title = '';
if (oLst[i].alt && oLst[i].alt != '') oLst[i].alt = '';
}
}
YE.onContentReady('bodyWrapper', function() {if (!YD.hasClass(document.body, 'smugmug_ajax')) delHover()});
onPhotoShow.subscribe(function(){YE.onAvailable('mainImage', delHover)});
function addCategoryTitleToBreadcrumb(description)
{
var breadCrumb = YD.get("breadcrumb");
if (breadCrumb)
{
var divTag = document.createElement("div");
divTag.className = "categoryDescription";
divTag.innerHTML = description;
breadCrumb.parentNode.insertBefore(divTag, breadCrumb.nextSibling);
}
}
function addCategoryTitleToThumbs(descriptionObject, boxObjectName)
{
var re = /\>([^\<]+)<\/a>/i; // pattern to find the category name between the <a> and </a> tags
var divTag = YD.get(boxObjectName);
if (divTag)
{
var divTags = YD.getElementsByClassName("albumTitle", "p", divTag);
for (var i = 0; i < divTags.length; i++)
{
var matches = re.exec(divTags[i].innerHTML); // get just the category name
// if we found a category name and the category name exists in our categoryDescription object, then add the description
if (matches && (matches.length > 1) && descriptionObject[matches[1]] != undefined)
{
var pTag = document.createElement("p");
pTag.className = "categoryDescription";
pTag.innerHTML = descriptionObject[matches[1]];
divTags[i].parentNode.insertBefore(pTag, divTags[i].nextSibling);
}
}
}
}
/* Category descriptions */
function addCategoryDescription()
{
var 
categoryDescription = {
// list "categoryname" : "category title",
// or "categoryname.subcategoryname" : "subcategory title",
// Examples:
// "Kenya" : "Our vacation to Kenya",
// "Kenya.Highlights" : "The highlights galleries from our vacation to Kenya",
"EARNING THE TRUST OF PET RATS" "Helping pet rats trust",
"WORKING WITH BITING RATS" "Rats who bite are terrified and need help",
"RATTIE ENRICHMENT" "Playing with rats. Rats are intelligent and need their minds stimulated",
"RATTIE HEALTH" "Techniques to handle sick rats",
"KARENBORGA" "Karen's private gallery"
};
var 
rematchesi// various local variables
// now fix it so that it works automatically even if the category or sub-category name has spaces in it
// we replace those spaces with underscores (which is what the classname does) and add those to our object so we can match those too
for (i in categoryDescription)
{
var 
newName i.replace(/ /g"_");
categoryDescription[newName] = categoryDescription[i]; // add a property to the object that has only underscores in the name
}
// on the homepage, we want to check for category names and add a description if a match found
// on a category page, we want to check to see if the category that the page is needs a description under the breadcrumb
// and, we need to see if any of the sub-category items on the page need us to add a description under the name
// on a sub-category page, we want to check to see if the sub-category that the page is needs a description under the breadcrumb
if (YD.hasClass(document.body"category"))
{
// fetch the category name
re = /category_(\S+)/i;
matches re.exec(document.body.className);
if (
matches && (matches.length 1))
{
var 
categoryName matches[1];
// now see if we have a subcategory too
if (YD.hasClass(document.body"subcategory"))
{
re = /subcategory_(\S+)/i;
matches re.exec(document.body.className);
if (
matches && (matches.length 1))
{
var 
subcatName matches[1];
// category and subcategory so we are on a subcategory page showing a list of galleries in this subcategory
// we need to just add a subcategory title to this page if the category-subcategory matches
var fullName categoryName "." subcatName;
if (
categoryDescription[fullName])
{
addCategoryTitleToBreadcrumb(categoryDescription[fullName]);
}
}
}
// here we're on a category page
// we need to add a category description for the category page
// and potentially add subcategory descriptions to the subcategory names displayed on this page
else
{
if (
categoryDescription[categoryName])
{
addCategoryTitleToBreadcrumb(categoryDescription[categoryName]);
}
// now we need to build a temporary subcategoryDescription object that has only the subcategory names in it that are in this category
var subcatDescriptions = {};
re = new RegExp("^" categoryName "\\.(.+)$""i");
for (
i in categoryDescription)
{
matches re.exec(i);
if (
matches && (matches.length 1))
{
subcatDescriptions[matches[1]] = categoryDescription[i];
}
}
addCategoryTitleToThumbs(subcatDescriptions"subcategoriesBox");
}
}
}
// then see if we're on the homepage
if (YD.hasClass(document.body"homepage"))
{
addCategoryTitleToThumbs(categoryDescription"categoriesBox");
}
}
YE.onDOMReady(addCategoryDescription); 
Old May-26-2009, 01:25 PM
#2
denisegoldberg is offline denisegoldberg
Major grins
denisegoldberg's Avatar
There is no need to paste your code into the forum - it can easily be seen by the helpers here using tools like Firefox Web Developer.

All of your gallery-specific CSS is incorrect because you have included the album id, the album key, and the photo id and key. Only the album id should be specified.

For example, instead of
Code:
.gallery_8004395_A7pkR#520478125_27XEV .myTitle {
you need to use
Code:
 
.gallery_8004395 .myTitle {
--- Denise
__________________
http://www.denisegoldberg.com ... http://denise.smugmug.com

Musings & ramblings at http://denisegoldberg.blogspot.com, quick posts in google+
Tell The World!  

Thread Tools
Display Modes

Posting Rules  
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump