Hack the Gallery p .description

AndyAndy Registered Users Posts: 50,016 Major grins
You know, the thing that says "XX Galleries with XXX Photos"

Well, I wanted it to say "XX Themes" (for our new thmes page). But it could easily be used for other applications: Real Estate, say, and you have categories by town- and the p .description says "XX Homes for Sale"

Devbobo to the rescue!

Updated 2006-08-01 to use yui api
<*script*>
if (YAHOO.util.Dom.hasClass(document.body, "homepage"))
  hackMiniBoxDescription();
<!--*script*--><*/script*>

and this in the javascript section:
function hackMiniBoxDescription()
{
  re = /([0-9]+) galler(?:y|ie(s)) with [0-9]+ photos/;
  oMiniBox = YAHOO.util.Dom.getElementsByClassName("miniBox", "div");
  for (var i=0; i < oMiniBox.length ; i++)
  {
    oDescription = YAHOO.util.Dom.getElementsByClassName("description", "p", oMiniBox[i]);
    for (var j=0; j < oDescription.length ; j++)
    {
       if (re.test(oDescription[j].innerHTML))
          oDescription[j].innerHTML = oDescription[j].innerHTML.replace(re, "$1 Theme$2");
    }
  }
}
53333632-L.gif

:clapThanks Dev!

Comments

  • AndyAndy Registered Users Posts: 50,016 Major grins
    edited July 16, 2006
    I have it in use here, on http://themes.smugmug.com

    thumb.gif
  • rainforest1155rainforest1155 Registered Users Posts: 4,566 Major grins
    edited July 16, 2006
    Andy wrote:
    I have it in use here, on http://themes.smugmug.com
    Cool, but somehow the spacing between the thumbs doesn't seem to be correct in IE6 - see attachment.

    Sebastian
    Sebastian
    SmugMug Support Hero
  • AndyAndy Registered Users Posts: 50,016 Major grins
    edited July 16, 2006
    Cool, but somehow the spacing between the thumbs doesn't seem to be correct in IE6 - see attachment.

    Sebastian
    Ack! ok that's not the hack's fault that's crappy CSS. I'll fixit iimmediately.
  • AndyAndy Registered Users Posts: 50,016 Major grins
    edited July 16, 2006
    Cool, but somehow the spacing between the thumbs doesn't seem to be correct in IE6 - see attachment.

    Sebastian
    Thanks, Sebastian. Fixed?
  • rainforest1155rainforest1155 Registered Users Posts: 4,566 Major grins
    edited July 16, 2006
    Andy wrote:
    Thanks, Sebastian. Fixed?
    The overlap is fixed, but in general the page layout looks better in FF. In IE6 the spacing between thumb and caption is confusing big. Makes it more look like the caption is on top of the corrosponding thumb when you look at the second row.
    Also why is the font size or even the font style different IE6 vs. FF?

    Don't waste too much time on it though - I know it's tough to keep both IE and FF in sync.

    Sebastian
    Sebastian
    SmugMug Support Hero
  • AndyAndy Registered Users Posts: 50,016 Major grins
    edited July 16, 2006
    The overlap is fixed, but in general the page layout looks better in FF. In IE6 the spacing between thumb and caption is confusing big. Makes it more look like the caption is on top of the corrosponding thumb when you look at the second row.
    Also why is the font size or even the font style different IE6 vs. FF?

    Don't waste too much time on it though - I know it's tough to keep both IE and FF in sync.

    Sebastian
    God IE6 just sucks in so many ways, doesn't it? lol3.gif
    Anyhow, I'll see about the spacing. The font, I specified Trebuchet for IE, since Verdana looks sucky in IE...
Sign In or Register to comment.