PDA

View Full Version : New Dev Creation.. worthy of FAQ?


brandofamily
Feb-02-2007, 07:18 PM
Dev has been creating again so I thought I'd share...

A thread/post came up awhile back looking to add a 'button' to the singleImage page(s) that would allow the user to navigate back to the index page of the gallery w/o having to back out one image at a time. Dev created a bit of code to add that feature.
I then decided that if that 'button' was doable, why not add the same type of 'button' to the singleImage pages generated thru using the search by date and search by keyword features... these would take the user back to the search results page w/o having to back out image by image..
here are three example pages from my site...

singleImage from gallery:
http://brandolinoimaging.smugmug.com/gallery/1262744/1/59619692/Medium

singleImage from keyword search:
http://www.brandolinoimaging.com/keyword/candle%20light%20vigil/1/53112692/Medium

singleImage from search by date:
http://www.brandolinoimaging.com/date/2004-01-01/2004-12-31/1/59360874/Medium

The 1st set of code is for the JS section... the 2nd for the footer section..

JS code...

/*=======================================*/
/*==Return to Thumb (Single Image Page)==*/
/*=======================================*/
function fixPhotoNav()
{
oPhotoNav = YD.getElementsByClassName("photoNav", "div");

for (i=0; i < oPhotoNav.length; i++)
{
re = /gallery\/(\d+)\//;
oTitle = YD.getElementsByClassName("title", "span", oPhotoNav[i]);
if (re.test(window.location)) {
oTitle[0].innerHTML = "|&nbsp;" + oTitle[0].innerHTML + "&nbsp;|";
re.exec(window.location);
oPhotoNav[i].innerHTML = oPhotoNav[i].innerHTML + "<span ><a href='/gallery/" + RegExp.$1 + "'>Return to Index</a></span>";
}
}
}


/*=================================================================*/
/*==Return to Thumb (Single Image Search by Keyword Results Page)==*/
/*=================================================================*/
function fixPhotoNav2()
{
oPhotoNav = YD.getElementsByClassName("photoNav", "div");

for (i=0; i < oPhotoNav.length; i++)
{
re = /keyword\/([\w\%]+)\//;
oTitle = YD.getElementsByClassName("title", "span", oPhotoNav[i]);
if (re.test(window.location)) {
oTitle[0].innerHTML = "|&nbsp;" + oTitle[0].innerHTML + "&nbsp;|";
re.exec(window.location);
oPhotoNav[i].innerHTML = oPhotoNav[i].innerHTML + "<span ><a href='/keyword/" + RegExp.$1 + "'>Return to Results Page</a></span>";
}
}
}


/*==============================================================*/
/*==Return to Thumb (Single Image Search bt Date Results Page)==*/
/*==============================================================*/
function fixPhotoNav3()
{
oPhotoNav = YD.getElementsByClassName("photoNav", "div");

for (i=0; i < oPhotoNav.length; i++)
{
re = /date\/([\d\-]+)\/([\d\-]+)/;
oTitle = YD.getElementsByClassName("title", "span", oPhotoNav[i]);
if (re.test(window.location)) {
oTitle[0].innerHTML = "|&nbsp;" + oTitle[0].innerHTML + "&nbsp;|";
re.exec(window.location);
oPhotoNav[i].innerHTML = oPhotoNav[i].innerHTML + "<span ><a href='/date/" + RegExp.$1 + "/" + RegExp.$2 + "'>Return to Results Page</a></span>";
}
}
}

Footer code...


<!-- Return to Thumb (singleImage Pages) -->
<***script***>
if (YD.hasClass(document.body, "singleImage")) {
if (YD.hasClass(document.body, "keywordPage")) {
// Return to Thumb (Single Image Search by Keyword Results Page)
fixPhotoNav2();
}
else {
if (YD.hasClass(document.body, "datePage")) {
// Return to Thumb (Single Image Search by Date Results Page)
fixPhotoNav3();
}
else {
// Return to Thumb (Single Image Page)
fixPhotoNav();
}
}
}
<***/script***>
<!-- End of Return to Thumb (singleImage Pages) -->

thanks to Dev for creating this for me... I hope others can benefit...

brandofamily
Feb-04-2007, 05:03 AM
bump to get props for Dev...

Andy
Feb-04-2007, 05:07 AM
bump to get props for Dev...Dev gets props, yep.
But a "FAQ" is for "frequently" asked questions. This is a nice hack but we've not been asked for this by many, any, other than you, AFAICT.

Thanks though!

brandofamily
Feb-04-2007, 06:24 AM
Dev gets props, yep.
But a "FAQ" is for "frequently" asked questions. This is a nice hack but we've not been asked for this by many, any, other than you, AFAICT.

Thanks though!

OK, how about the ??? I don't know, but it's a really cool hack isn't it...

Oh... AFAICT?

DJKennedy
Feb-04-2007, 11:01 AM
Oh... AFAICT?

As Far As I Can Tell would be my guess :scratch