Options

Recent Galleries listing

McDonDemMcDonDem Registered Users Posts: 11 Big grins
I want to show my seven most recent galleries on my homepage automatically with the first being the medium size and the other six being the tiny size. I know they can be brought up through rss but I don't know javascript well enough to implement it myself. If anyone could help me, it would be a great benefit.

davenortonpics.smugmug.com
«1

Comments

  • Options
    darryldarryl Registered Users Posts: 997 Major grins
    edited November 13, 2007
    (Code for this hack is in this post)

    Ok, it can be done. I borrowed and tweaked an AJAX Feed Reader/Parser from here and plopped the output into my Bio box.

    Check it out: http://gladlee.smugmug.com/

    It's super-ugly, as I didn't bother to try to format the output into SmugMug's miniboxes.

    You can check my Javascript ugliness by using Firebug. I've hardcoded the rssurl to be my Recent Galleries feed for only the last 8 galleries. (A bug in the RSS feeds includes private, and thus not-visible galleries in the count.)

    But anyways, it's a start. Do any actual coders (instead of a hack like me) want to pick up the ball and run with it?

    Here's what I think needs to be done:

    - Check to make sure you're on the home page before running getRSS this.
    - Can miniboxes go in the Bio box? If so, format the output so that it looks like a regular Recent Galleries page, including Title, Description, and Updated.
    - Maybe use some other box, because a) people actually want to use the Bio box, b) it screws up the feed. Featured won't work because it doesn't appear unless there's already a gallery featured. :P
    - Add "Recent Galleries" boxTitle
    - Remove RSS Channel Title and Link.
    - Remove RSS Copyright Info and PubDate

    Extra-credit:
    - Implement multi-page "recent galleries" functionality so that you could page forward/backwards 8 galleries at a time. And because it's AJAX, it wouldn't even need to refresh, right? Man, that'd be sweet.
  • Options
    McDonDemMcDonDem Registered Users Posts: 11 Big grins
    edited November 14, 2007
    I was thinking that if the rss feed could be parsed to place the gallery # in one array (with most recent in array[1] and least recent of 7 in array[7]) and the name of the gallery in a separate but similar array. Then have the javascript print to the page with the array information, kinda like a form letter. The main problem I have is the parsing of the rss feed due to the fact I don't know javascript that well.
  • Options
    darryldarryl Registered Users Posts: 997 Major grins
    edited November 14, 2007
    This tutorial walks you through the feed parser:

    http://www.xml.com/pub/a/2006/09/13/rss-and-ajax-a-simple-news-reader.html

    I may actually sit down and go through it, instead of being lazy and just trying to hack it.
  • Options
    McDonDemMcDonDem Registered Users Posts: 11 Big grins
    edited November 16, 2007
    I did it.
    I got it to work. wings.gifI got on the computer and search for info on javascript and used the rss-ajax news reader that darryl pointed out to me and modified it to give me just the information I needed (gallery number and gallery title) so I could display my recent galleries in the different sizes I wanted.

    Thanks for the help
    darryl wrote:
    This tutorial walks you through the feed parser:

    http://www.xml.com/pub/a/2006/09/13/rss-and-ajax-a-simple-news-reader.html

    I may actually sit down and go through it, instead of being lazy and just trying to hack it.
  • Options
    darryldarryl Registered Users Posts: 997 Major grins
    edited November 16, 2007
    Dave -- that looks *great*! Mind if I steal your Javascript?

    Well, it's publicly available on your site. But I was thinking of tweaking it and posting something here. Sweet -- time to do some more hacking. ;-}
  • Options
    devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited November 16, 2007
    McDonDem wrote:
    I got it to work. wings.gifI got on the computer and search for info on javascript and used the rss-ajax news reader that darryl pointed out to me and modified it to give me just the information I needed (gallery number and gallery title) so I could display my recent galleries in the different sizes I wanted.

    Thanks for the help

    did you realise that you can just add &Size=xxx to the feed url to get a different size image ?

    eg. &Size=Large

    Cheers,

    David
    David Parry
    SmugMug API Developer
    My Photos
  • Options
    McDonDemMcDonDem Registered Users Posts: 11 Big grins
    edited November 16, 2007
    devbobo wrote:
    did you realise that you can just add &Size=xxx to the feed url to get a different size image ?

    eg. &Size=Large

    Cheers,

    David

    Yes I did, I just wanted to grab the feed once to pull a random "Medium" picture of my most recent gallery and pull random "Tiny" pictures for the other six next recent galleries as well as the titles of those those galleries.
  • Options
    McDonDemMcDonDem Registered Users Posts: 11 Big grins
    edited November 16, 2007
    darryl wrote:
    Dave -- that looks *great*! Mind if I steal your Javascript?

    Well, it's publicly available on your site. But I was thinking of tweaking it and posting something here. Sweet -- time to do some more hacking. ;-}

    go ahead and use it. I think that this rss reader could be used in many good ways for customization.
  • Options
    darryldarryl Registered Users Posts: 997 Major grins
    edited November 19, 2007
    I got it!

    http://gladlee.smugmug.com/

    Well, almost. Now I need a better place to put the Recent Galleries listing instead of the Bio Box. On IE, I get two columns. But in Firefox, it's just the one.

    I suppose I could use Featured Galleries, but I need some help replacing everything in there with my generated miniboxes. Guess I'll look at devbobo's "recent photos" code, although I think that uses the Yahoo stuff which makes my head spin when I look at it.

    [Also, the date format is in RSS format, not standard SmugMug format. I may get around to writing a regexp to fix that. Also, no gallery descriptions. Gah -- they're not in the feed. :-{]
  • Options
    McDonDemMcDonDem Registered Users Posts: 11 Big grins
    edited November 20, 2007
    I use firefox, so I didn't notice this before. For some reason my images from what my javascript is supposed to display doesn't in Internet Explorer. my text will display fine, but it will not display the images. Any ideas?
  • Options
    darryldarryl Registered Users Posts: 997 Major grins
    edited November 20, 2007
    Sorry Don, I don't have much help for you. I ended up generating usable Tiny images with the following regexps:
    var galimage = RSS.items[i].description ;
    var galimage = galimage.replace(/^.+src="(.*?)" .*/m, "$1") ;
    var galimage = galimage.replace(/(.*-)Th(-\d+)?(\.jpg)/i, "$1Ti$2$3") ;
    

    But now I'm trying to get fancy and use the Yahoo UI stuff to try and add my recent galleries in the Featured Galleries box. (And ideally I'd like to make the one featured gallery that's required to make the box show up at all go away.)

    This isn't working:
    divTags = YD.getElementsByClassName("boxBottom", "div", YD.get("featuredBox"));
    
        for (i=0; i<rsscount; i++) {
    
          var galimage = RSS.items[i].description ;
          var galimage = galimage.replace(/^.+src="(.*?)" .*/m, "$1") ;
          var galimage = galimage.replace(/(.*-)Th(-\d+)?(\.jpg)/i, "$1Ti$2$3") ;
    
          miniBox = document.createElement("div");
          miniBox.className = "miniBox";
    
          photoBox = document.createElement("div");
          photoBox.className = "photo";
          miniBox.appendChild(photoBox);
    
          photoLink = document.createElement("a");
          photoLink.setAttribute("href", RSS.items[i].link);
          photoBox.appendChild(photoLink);
    
          photoImg = document.createElement("img");
          photoImg.setAttribute("border", "0");
          photoImg.setAttribute("alt", RSS.items[i].title);
          photoImg.setAttribute("title", RSS.items[i].title);
          photoImg.src = galimage;
          photoImg.className = "imgBorder";
          photoLink.appendChild(photoImg);
    
          albumTitle = document.createElement("p");
          albumTitle.className = "albumTitle";
          miniBox.appendChild(albumTitle);
          albumLink = document.createElement("a");
          albumLink.className = "nav";
          albumLink.setAttribute("href", RSS.items[i].link);
          albumTitle.appendChild(albumLink);
    
          albumLinkText = document.createTextNode(RSS.items[i].title);
          albumLink.appendChild(albumLinkText);
          spacerDiv = document.createElement("div");
          spacerDiv.className = "spacer";
          miniBox.appendChild(spacerDiv);
    
          divTags[i].insertAfter(miniBox, divTags[i].childNodes[1]);
    
          break;
        }
    

    Devbobo, think you could give me a hint?
  • Options
    McDonDemMcDonDem Registered Users Posts: 11 Big grins
    edited November 21, 2007
    I fixed my problem (must have had a quote mark wrong)

    I was wondering why you don't modify your script and page a bit to put your recent galleries in a div tag at the bottom of your header section. This would put it above your featured galleries and categories boxes, but you would also have more control over it.
  • Options
    darryldarryl Registered Users Posts: 997 Major grins
    edited November 21, 2007
    Well, I kind of want to use the standard SmugMug headers, and such, and if I put it that high it might look weird. But let me give it a try.
  • Options
    darryldarryl Registered Users Posts: 997 Major grins
    edited November 21, 2007
    Ah ok, tried it in the header, but it didn't work when trying to use the box, boxTop and boxBottom SmugMug styles.

    I want to try and use SmugMug's styles because I want this solution to be portable. I'm actually planning to ultimately use this on a different SmugMug site, and I want to be able to just use the code w/o having to modify headers.

    Additionally, if I use SmugMug's styles, then any changes to themes and stuff will automatically be applied to the recent galleries "box" as well. If only there was a way to have an arbitrary "box" in there, instead of me trying to "clean out" one of the existing boxes.
  • Options
    darryldarryl Registered Users Posts: 997 Major grins
    edited November 21, 2007
    SUMMARY: I figured out how to get X number of Recent Galleries to show up on a page where I am showing Galleries by Category as well.

    It is a TOTAL HACK, but it works...

    http://gladlee.smugmug.com/

    Reasons this is a horrible hack:
    - You lose your Friends & Family box because I am replacing its contents with Recent Galleries. However because it takes a while to parse the RSS feed, people will still see that box temporarily.
    - I couldn't figure out how to retain the "Move Up / Move Down" thing for home page configuration, so you'll have to move other stuff around the new Recent Galleries box to position it.
    - JavaScript is still broken because I can't #!@*$(&amp; figure out why it thinks RSS.items has no properties

    Other nitpicks:
    - Date format does not match regular SmugMug dates. This should be somewhat fixable.
    - No gallery descriptions -- they are not in the feed, so I would have to make yet another call to obtain them. Ugh.
    - RSS feed for recent galleries still returns an inaccurate number of items when specifying ImageCount because it counts, but does not return Private Galleries. Workaround requires downloading a "buffer" of extra galleries, which slows things down.

    But anyways, it works. Please look at my JavaScript and laugh/cry, then give me suggestions on how to fix it. :-}
  • Options
    darryldarryl Registered Users Posts: 997 Major grins
    edited November 22, 2007
    Fixed a few things:
    - You lose your Friends & Family box because I am replacing its contents with Recent Galleries. However because it takes a while to parse the RSS feed, people will still see that box temporarily.

    Now I'm plopping the Recent Galleries into the Featured Galleries box. So you lose that box. But it does load a lot more cleanly, I think. However, much like the [thread=26968]Recent Photo Gallery Timeline Hack[/thread], I haven't figured out how to remove the token Featured Gallery that I need to have so that the enclosing box shows up at all.
    - I couldn't figure out how to retain the "Move Up / Move Down" thing for home page configuration, so you'll have to move other stuff around the new Recent Galleries box to position it.

    Fixed -- I'm trying to be good and only modify the elements I need.
    - JavaScript is still broken because I can't #!@*$(&amp; figure out why it thinks RSS.items has no properties

    Fixed -- This was because I wasn't checking to see if (grr), the RSS feed had short-changed me some galleries because of its brokenness w/ Private Galleries.
    Other nitpicks:
    - Date format does not match regular SmugMug dates. This should be somewhat fixable.

    Date format fixed. Still working on military time (ugh). Also, found out a dirty little secret: Timestamps of album updates (at least in RSS) may actually be PST or PDT, but SmugMug just slaps PST on all of them. Oh, that album you uploaded at 8PM in the summer? It's going to be timestamped 7PM.
    - No gallery descriptions -- they are not in the feed, so I would have to make yet another call to obtain them. Ugh.

    No fix.
    - RSS feed for recent galleries still returns an inaccurate number of items when specifying ImageCount because it counts, but does not return Private Galleries. Workaround requires downloading a "buffer" of extra galleries, which slows things down.

    Also still broken, and as it turned out, was causing other problems.

    Anyways though, I'm a little happier with it, despite it still being a nasty hack.
  • Options
    darryldarryl Registered Users Posts: 997 Major grins
    edited November 25, 2007
    Ok, all issues pretty much resolved except that Gallery Description is *not* included. I can kind of live with this, but am toying with the idea of making a JSON call to pull it from the API. However, a few hours trying to get JSON to work has made my head hurt. :-{

    Anywho, not that anybody cares, but here's of an example of the script in action:

    http://darryl.smugmug.com/ (my feeble attempt at concert photography)

    Also: http://nzsmaps.com (amazing extreme sport/ultimate disc photography and killer customization)

    Here is my whole stinking ugly mess:

    {edits - fixed IE incompatibility; need to actually *call* getRSS; added tiny bit of CSS to make grouping tighter, since we don't have description anyways; added body tag to call function; didn't *really* want multiline searching; fixed 0:00 (midnight) hours; CNAME/custom domain fix; added info on loading animations, replacing different sections}

    Header Javascript section:
    // RECENT GALLERIES HACK
    
    // This hack replaces your Featured Galleries with Recent Galleries as determined by the RSS feed.
    //
    // RSS parsing code from Paul Sobocinski found here:
    // http://www.xml.com/pub/a/2006/09/13/rss-and-ajax-a-simple-news-reader.html?page=5
    
    // NOTE: You must have one gallery set to featured, as a placeholder to make the Featured Box show up
    // This placeholder gallery will not show up once the hack is in place.
    
    // Rename Featured Galleries to Recent Galleries
    YE.onContentReady('featuredTitle', function() {this.innerHTML='recent galleries'});
    
    // Specify how many recent galleries you'd like to see
    var rsscount = 6 ;
    
    // Specify your RSS feed for Recent Galleries (replace XXXXXX with your site name)
    // ImageCount needs to be "padded" if you have a lot of private galleries mixed in with your public 
    // galleries.  If you are not seeing 6 (or however many) recent galleries, try increasing ImageCount
    //
    // NOTE:  If you are using a custom domain (CNAME), you need to change http://XXXXXX.smugmug.com to 
    // http://yourcustomdomain.com -- however, for Data=XXXXXXX, you still need XXXXXX to be your SmugMug nickname/sitename
    
    var rssurl = "http://XXXXXX.smugmug.com/hack/feed.mg?Type=nickname&Data=XXXXXX&format=rss200&ImageCount=10";
    
    // Added a line to the doOnLoad function that is also used by the removeLinkFromImg() function and others.  
    // So you may only need to append the if//getRSS clause below.
    
    function doOnLoad() {
      if (YD.hasClass(document.body, "homepage")) //
         getRSS();
    }
    
    //OBJECTS
    
    //objects inside the RSS2Item object
    function RSS2Enclosure(encElement)
    {
    	if (encElement == null)
    	{
    		this.url = null;
    		this.length = null;
    		this.type = null;
    	}
    	else
    	{
    		this.url = encElement.getAttribute("url");
    		this.length = encElement.getAttribute("length");
    		this.type = encElement.getAttribute("type");
    	}
    }
    
    function RSS2Guid(guidElement)
    {
    	if (guidElement == null)
    	{
    		this.isPermaLink = null;
    		this.value = null;
    	}
    	else
    	{
    		this.isPermaLink = guidElement.getAttribute("isPermaLink");
    		this.value = guidElement.childNodes[0].nodeValue;
    	}
    }
    
    function RSS2Source(souElement)
    {
    	if (souElement == null)
    	{
    		this.url = null;
    		this.value = null;
    	}
    	else
    	{
    		this.url = souElement.getAttribute("url");
    		this.value = souElement.childNodes[0].nodeValue;
    	}
    }
    
    //object containing the RSS 2.0 item
    function RSS2Item(itemxml)
    {
    	//required
    	this.title;
    	this.link;
    	this.description;
    
    	//optional vars
    	this.author;
    	this.comments;
    	this.pubDate;
    
    	//optional objects
    	// this.category;
    	this.enclosure;
    	this.guid;
    	this.source;
    
    	var properties = new Array("title", "link", "description", "author", "comments", "pubDate");
    	var tmpElement = null;
    	for (var i=0; i<properties.length; i++)
    	{
    		tmpElement = itemxml.getElementsByTagName(properties[i])[0];
    		if (tmpElement != null)
    			eval("this."+properties[i]+"=tmpElement.childNodes[0].nodeValue");
    	}
    
    	// this.category = new RSS2Category(itemxml.getElementsByTagName("category")[0]);
    	this.enclosure = new RSS2Enclosure(itemxml.getElementsByTagName("enclosure")[0]);
    	this.guid = new RSS2Guid(itemxml.getElementsByTagName("guid")[0]);
    	this.source = new RSS2Source(itemxml.getElementsByTagName("source")[0]);
    }
    
    //objects inside the RSS2Channel object
    function RSS2Category(catElement)
    {
    	if (catElement == null)
    	{
    		this.domain = null;
    		this.value = null;
    	}
    	else
    	{
    		this.domain = catElement.getAttribute("domain");
    		this.value = catElement.childNodes[0].nodeValue;
    	}
    }
    
    //object containing RSS image tag info
    function RSS2Image(imgElement)
    {
    	if (imgElement == null)
    	{
    	this.url = null;
    	this.link = null;
    	this.width = null;
    	this.height = null;
    	this.description = null;
    	}
    	else
    	{
    		imgAttribs = new Array("url","title","link","width","height","description");
    		for (var i=0; i<imgAttribs.length; i++)
    			if (imgElement.getAttribute(imgAttribs[i]) != null)
    				eval("this."+imgAttribs[i]+"=imgElement.getAttribute("+imgAttribs[i]+")");
    	}
    }
    
    //object containing the parsed RSS 2.0 channel
    function RSS2Channel(rssxml)
    {
    	//required
    	this.title;
    	this.link;
    	this.description;
    
    	//array of RSS2Item objects
    	this.items = new Array();
    
    	//optional vars
    	this.language;
    	this.copyright;
    	this.managingEditor;
    	this.webMaster;
    	this.pubDate;
    	this.lastBuildDate;
    	this.generator;
    	this.docs;
    	this.ttl;
    	this.rating;
    
    	//optional objects
    	// this.category;
    	this.image;
    
    	var chanElement = rssxml.getElementsByTagName("channel")[0];
    	var itemElements = rssxml.getElementsByTagName("item");
    
    	for (var i=0; i<itemElements.length; i++)
    	{
    		Item = new RSS2Item(itemElements[i]);
    		this.items.push(Item);
    		//chanElement.removeChild(itemElements[i]);
    	}
    
    	var properties = new Array("title", "link", "description", "language", "copyright", "managingEditor", "webMaster", "pubDate", "lastBuildDate", "generator", "docs", "ttl", "rating");
    	var tmpElement = null;
    	// this.category = new RSS2Category(chanElement.getElementsByTagName("category")[0]);
    	this.image = new RSS2Image(chanElement.getElementsByTagName("image")[0]);
    }
    
    //PROCESSES
    
    //uses xmlhttpreq to get the raw rss xml
    function getRSS()
    {
    	//call the right constructor for the browser being used
    	if (window.ActiveXObject)
    		xhr = new ActiveXObject("Microsoft.XMLHTTP");
    	else if (window.XMLHttpRequest)
    		xhr = new XMLHttpRequest();
    	else
    		alert("not supported");
    
    	//prepare the xmlhttprequest object
    	xhr.open("GET",rssurl,true);
    	xhr.setRequestHeader("Cache-Control", "no-cache");
    	xhr.setRequestHeader("Pragma", "no-cache");
    	xhr.onreadystatechange = function() {
    		if (xhr.readyState == 4)
    		{
    			if (xhr.status == 200)
    			{
    				if (xhr.responseText != null)
    					processRSS(xhr.responseXML);
    				else
    				{
    					alert("Failed to receive RSS file from the server - file not found.");
    					return false;
    				}
    			}
    			else
    				alert("Error code " + xhr.status + " received: " + xhr.statusText);
    		}
    	}
    
    	//send the request
    	xhr.send(null);
    }
    
    //processes the received rss xml
    function processRSS(rssxml)
    {
    	RSS = new RSS2Channel(rssxml);
    	showRSS(RSS);
    }
    
    //shows the RSS content in the browser
    function showRSS(RSS)
    {
    
        divTags = YD.getElementsByClassName("boxBottom", "div", YD.get("featuredBox"));
        
        while(divTags[0].firstChild) divTags[0].removeChild(divTags[0].firstChild);    
    
    //populate the items
    
        for (var i=0; i<rsscount && i<RSS.items.length; i++)
        {
            galimage = RSS.items[i].description;
    
            galimage = galimage.replace(/^.+src="(.*?)" .*/, "$1") ;
            galimage = galimage.replace(/(.*-)Th(-\d+)?(\.\w+)/i, "$1Ti$2$3") ;
    
            // Replace new Th folder with Ti in image link path
            galimage = galimage.replace(/\/Th\//i, "\/Ti\/") ;
    
            pubdate = RSS.items[i].pubDate ;
            pubdate.match(/^\w{3}, (\d\d) (\w{3}) (\d{4}) (\d\d):(\d\d):\d\d -\d\d\d\d/) ;
    
            // Fix up date formatting
            if (RegExp.$4>12) { meridian = 'pm'; hrs = RegExp.$4-12 } else { meridian = 'am'; if (RegExp.$4==0) { hrs = 12 } else { hrs = RegExp.$4-0 }} ;
    
            fixdate = "updated: " + RegExp.$2 + " " + RegExp.$1 + ", " + RegExp.$3 + " " + hrs + ":" + RegExp.$5 + meridian + " PST" ;
    
            miniBox = document.createElement("div");
            miniBox.className = "miniBox miniminiBox";
    
            photoBox = document.createElement("div");
            photoBox.className = "photo";
            miniBox.appendChild(photoBox);
    
            photoLink = document.createElement("a");
            photoLink.setAttribute("href", RSS.items[i].link);
            photoBox.appendChild(photoLink);
    
            photoImg = document.createElement("img");
            photoImg.setAttribute("border", "0");
            photoImg.setAttribute("alt", RSS.items[i].title);
            photoImg.setAttribute("title", RSS.items[i].title);
            photoImg.src = galimage;
            photoImg.className = "imgBorder";
            photoLink.appendChild(photoImg);
    
            albumTitle = document.createElement("p");
            albumTitle.className = "albumTitle";
            miniBox.appendChild(albumTitle);
            albumLink = document.createElement("a");
            albumLink.className = "nav";
            albumLink.setAttribute("href", RSS.items[i].link);
            albumTitle.appendChild(albumLink);
    
            albumLinkText = document.createTextNode(RSS.items[i].title);
            albumLink.appendChild(albumLinkText);
    
            albumUpdated = document.createElement("p");
            albumUpdated.className = "updated";
            miniBox.appendChild(albumUpdated);
            albumUpdatedText = document.createTextNode(fixdate);
            albumUpdated.appendChild(albumUpdatedText);
    
            spacerDiv = document.createElement("div");
            spacerDiv.className = "spacer";
            miniBox.appendChild(spacerDiv);
    
            divTags[0].appendChild(miniBox);
            // insertAfter(miniBox, divTags[0].childNodes[divTags[0].childNodes.length-2]);
    
        }
        spacerDiv = document.createElement("div");
        spacerDiv.className = "spacer";
        divTags[0].appendChild(spacerDiv);
    
        //we're done
        return true;
    }
    
    var xhr;
    

    CSS section:
    /* Smaller miniBox for recent galleries */
    .miniminiBox {
    height:105px;
    }
    

    Body tag section:
    <body onload="doOnLoad();">
    

    IMPORTANT: YOU MUST HAVE A FEATURED GALLERY. I forgot this, installed it on another account, and was wondering why my Bio box kept disappearing on load.

    What this script does is replace that your Featured galleries with your Recent Galleries. This means there must be at least one featured gallery to replace. Additionally, because this is a *MASSIVE HACK*, it can sometimes take a while to read an RSS feed via JavaScript, parse it and format it for display.

    So you need to create an Unlisted (hidden) gallery with a "Loading..." graphic. Sometimes it can take a second or three for my script to grab your RSS feed, parse it, format it, and display it in the browser. You *used* to be able to use a nice animated gif, like here, but a recent SmugMug "fix" forces all thumbnails to be uniform, even if the original image is *smaller* than the standard thumbnail size. Argh. I'm looking into a workaround.

    Finally, be sure that there aren't any other featured galleries, because those will show up (and then get replaced by the script).

    NOTES:

    Replacing a different section instead of Featured Galleries
    Oh, a number of people have asked how to replace the Recent Photos block (instead of Featured Galleries). Here's the relevant lines you'll need to change:
    // Rename Featured Galleries to Recent Galleries
    YE.onContentReady('featuredTitle', function() {this.innerHTML='recent galleries'});

    Change to: recentPhotosBoxTitle

    divTags = YD.getElementsByClassName("boxBottom", "div", YD.get("featuredBox"));

    Change to: recentPhotosBox

    Disclaimer/pleas for help
    Please note that I am a total hack, so this code is not optimized, and doubtless has a lot of excess stuff in it. I welcome any suggestions on how to clean it up, as well as any tips/code on how to get the Gallery Descriptions in there.
  • Options
    afarberafarber Registered Users Posts: 267 Major grins
    edited January 10, 2008
    Nice work!

    Is there any way to have this appear on another page, not my homepage? I would love to have a link in my banner to my "Recent Updates" or something and have it go to a dedicated page for this.

    Thanks
  • Options
    darryldarryl Registered Users Posts: 997 Major grins
    edited January 10, 2008
    Yes, there is a way, although I have not tried it (it's a great idea though):

    http://dgrin.smugmug.com/gallery/2160039
  • Options
    afarberafarber Registered Users Posts: 267 Major grins
    edited January 10, 2008
    fantastic. I'll have to try this soon.
    darryl wrote:
    Yes, there is a way, although I have not tried it (it's a great idea though):

    http://dgrin.smugmug.com/gallery/2160039
  • Options
    McDonDemMcDonDem Registered Users Posts: 11 Big grins
    edited January 10, 2008
    you can set it up approximately the same way you can create a separate galleries page. http://dgrin.smugmug.com/gallery/2160039
    just have to change the galleries to recent, etc.
    darryl wrote:
    Yes, there is a way, although I have not tried it (it's a great idea though):

    http://dgrin.smugmug.com/gallery/2160039
  • Options
    afarberafarber Registered Users Posts: 267 Major grins
    edited January 11, 2008
    Success! I added another 'homepage' and used this hack to change my featured box to a New Updates box. I then added a button to my nav bar to this page. Thanks so much!

    The only problem remaining is that I want the galleries/categories box to appear when I'm logged in on my homepage only and not my galleries (2nd homepage) page. Right now it doesn't appear on either when I'm logged out (which is correect), but it also does appear on both when I'm logged in. Clearly not a huge deal, but I can't figure out how to get rid of it on the galleries page.
  • Options
    PaulSpotPaulSpot Registered Users Posts: 34 Big grins
    edited March 17, 2008
    A better way?
    Hi; I just tried to get this going but wasn't having much luck (I'll keep trying) but it seemed like a newer solution has come up or something? I checked out gladlee.smugmug.com and I don't see all this javascript in the page source?
    -Paul
  • Options
    PaulSpotPaulSpot Registered Users Posts: 34 Big grins
    edited March 17, 2008
    PaulSpot wrote:
    Hi; I just tried to get this going but wasn't having much luck (I'll keep trying) but it seemed like a newer solution has come up or something? I checked out gladlee.smugmug.com and I don't see all this javascript in the page source?

    Nevermind, I'm dumb, I see how it all works now; the .js is on another page, and I wasn't doing everything right. And I see now that the cool thing to do is have a 'hidden' gallery called "Loading..." that makes it look like it's loading. Smart!
    -Paul
  • Options
    darryldarryl Registered Users Posts: 997 Major grins
    edited March 17, 2008
    Woot -- glad to see my hack is working for somebody else. Yeah, I figured out that "Loading..." gallery trick after I got tired of seeing "Ignore this" too many times.

    Boy though, wouldn't it be great if Smugmug simply supported a "Recent Albums" panel for the front page? Because hacking it this way is kind of slow.
  • Options
    PaulSpotPaulSpot Registered Users Posts: 34 Big grins
    edited March 17, 2008
    OK I'm stumped... I have it all working except my token gallery I need as a placeholder, which I call "Loading...." stays. I'm not sure what in the code should make it go away, but I see that darrl's does it and mine doesn't ;) Little help??

    http://paulspot.smugmug.com
    -Paul
  • Options
    PaulSpotPaulSpot Registered Users Posts: 34 Big grins
    edited March 17, 2008
    darryl wrote:
    Woot -- glad to see my hack is working for somebody else. Yeah, I figured out that "Loading..." gallery trick after I got tired of seeing "Ignore this" too many times.

    Boy though, wouldn't it be great if Smugmug simply supported a "Recent Albums" panel for the front page? Because hacking it this way is kind of slow.

    Your "hack" rocks! I really appreciate it. And ignore my "stumped" question. It had not occurrd to me that my loading gallery IS one of myrecent galleries.
    -Paul
  • Options
    darryldarryl Registered Users Posts: 997 Major grins
    edited March 17, 2008
    Ah yeah, that's tricky. You need to upload 5 new galleries. :-}

    Again, it's a sad side-effect of this being a hack, when it should be (IMHO) implemented into the core features of SmugMug.

    --Darryl
  • Options
    PaulSpotPaulSpot Registered Users Posts: 34 Big grins
    edited March 17, 2008
    darryl wrote:
    Ah yeah, that's tricky. You need to upload 5 new galleries. :-}

    Again, it's a sad side-effect of this being a hack, when it should be (IMHO) implemented into the core features of SmugMug.

    --Darryl

    Yeah, it is a bit odd that there is really no facility for recent photos or galleries. The timeline thing isn't really workable because it's in the wrong order. I know smugmug needs to differentiate themselves from flickr but recent photo streams is kind of a commodity and would surely be appreciated. But until then, thank goodness for folks like you ;)
    -Paul
  • Options
    darryldarryl Registered Users Posts: 997 Major grins
    edited March 17, 2008
    Well, to be honest, SmugMug has had a "recent galleries" function available since... forever. Alas, in choosing it you lose the ability to sort by category, *and* it shows every album you have ever published. Kind of... unwieldy:

    http://jt.smugmug.com/

    (Again, sorry JT, but since you are one of the few people I know that continue to show all your galleries sorted by most recent on top, you serve as a great example. :-)
Sign In or Register to comment.