srich250
Feb-12-2010, 05:41 AM
[U]hello and thanks in advance for your help...whoever can advise me:) this is my first post and i love smugmug so far and all the support from them also.
I want specific galleries under a 'sports' category to allow for a search at the top of that gallery by athlete #, or race event,etc. here is code that Jfriend gave to the site below that is exactly what i want.
Is it possible to have this on a specific page or just sitewide? also, what other customizing do i need to do and where do i put this script in the advanced area?
here is a sample of what i am trying to accomplish?
http://www.jarandell.SmugMug.com
function processMultiples(str)
{
var newStr = str.replace(/,|-/g, " "); // replace commas or dashes with spaces (so they can be used as a delimiter between multiple search params)
newStr = TrimString(newStr); // remove leading or trailing spaces
return(newStr.replace(/\s+/g, "-")); // replace any sequence of one or more consecutive spaces with a single dash
}
function addNewParam(resultSoFar, newParam)
{
var newResult = resultSoFar;
if (newParam && (newParam != ""))
{
if (resultSoFar != "")
{
newResult += "-";
}
newResult += newParam;
}
return(newResult);
}
function doTheSearch()
{
var raceNumber = document.racesearch.number.value;
var race = document.racesearch.race.options[document.racesearch.race.selectedIndex].value;
var eventType = document.racesearch.event.options[document.racesearch.event.selectedIndex].value;
var name = document.racesearch.lname.value;
raceNumber = processMultiples(raceNumber);
name = processMultiples(name);
var newUrl = "";
newUrl = addNewParam(newUrl, raceNumber);
newUrl = addNewParam(newUrl, race);
newUrl = addNewParam(newUrl, eventType);
newUrl = addNewParam(newUrl, name);
if (newUrl != "")
{
window.location = "/keyword/" + newUrl;
}
}
I want specific galleries under a 'sports' category to allow for a search at the top of that gallery by athlete #, or race event,etc. here is code that Jfriend gave to the site below that is exactly what i want.
Is it possible to have this on a specific page or just sitewide? also, what other customizing do i need to do and where do i put this script in the advanced area?
here is a sample of what i am trying to accomplish?
http://www.jarandell.SmugMug.com
function processMultiples(str)
{
var newStr = str.replace(/,|-/g, " "); // replace commas or dashes with spaces (so they can be used as a delimiter between multiple search params)
newStr = TrimString(newStr); // remove leading or trailing spaces
return(newStr.replace(/\s+/g, "-")); // replace any sequence of one or more consecutive spaces with a single dash
}
function addNewParam(resultSoFar, newParam)
{
var newResult = resultSoFar;
if (newParam && (newParam != ""))
{
if (resultSoFar != "")
{
newResult += "-";
}
newResult += newParam;
}
return(newResult);
}
function doTheSearch()
{
var raceNumber = document.racesearch.number.value;
var race = document.racesearch.race.options[document.racesearch.race.selectedIndex].value;
var eventType = document.racesearch.event.options[document.racesearch.event.selectedIndex].value;
var name = document.racesearch.lname.value;
raceNumber = processMultiples(raceNumber);
name = processMultiples(name);
var newUrl = "";
newUrl = addNewParam(newUrl, raceNumber);
newUrl = addNewParam(newUrl, race);
newUrl = addNewParam(newUrl, eventType);
newUrl = addNewParam(newUrl, name);
if (newUrl != "")
{
window.location = "/keyword/" + newUrl;
}
}