|
|
Thread Tools | Display Modes |
|
#461
|
||
|
Scripting dude-volunteer
|
Quote:
__________________
--John Homepage • Popular JFriend's javascript customizations • Secrets for getting fast answers on Dgrin Always include a link to your site when posting a question |
|
|
|
||
|
#462
|
|
|
Major grins
|
Ok. Will do it tonight when home from work.
|
|
|
|
|
#463
|
||
|
Major grins
|
Quote:
|
|
|
|
||
|
#464
|
|
|
Beginner grinner
|
Hi,
I am not sure what I am doing wrong. I pasted and added the 3rd step and...just clooless! Please help. www.christahunt.com |
|
|
|
|
#465
|
||
|
Scripting dude-volunteer
|
Quote:
Code:
//change gallery comments to guestbook comments
function ModifyText ()
{
if (YD.hasClass(document.body, "gallery_1605513"))
{
var objElement = YD.get("comment")
if (objElement != null)
{
var str = new String(objElement.innerHTML);
str = str.replace(/\gallery/gi, 'Guestbook');
objElement.innerHTML = str;
}
}
}
YE.onAvailable("comment", ModifyText);
//------------------------------------------------------------------------------------------
// Highlight the link in your navbar that matches the current page.
//
// Revision 1.1
// See http://www.dgrin.com/showthread.php?t=141678 for documentation.
//------------------------------------------------------------------------------------------
YE.onContentReady("customNavContainer", function ()
{
function AddTrailingSlash(str)
{
if (str.search(/\/$/) == -1)
{
str = str + "/";
}
return(str);
}
function StripDomainAndHash(oldStr)
{
var str = oldStr.replace(/#.*$/, ""); // get rid of hash value
str = AddTrailingSlash(str); // make sure it always ends in a slash
str = str.replace(/^https?:\/\/[^\/]*/, ""); // get rid of domain on the front
return(str);
}
var links = this.getElementsByTagName("a");
if (links && (links.length > 0))
{
var pageURL = StripDomainAndHash(window.location.href);
var foundExactMatch = false;
var partialIndex = -1; // index of best partial match
var partialLength = 0; // length of the best partial match
var galleriesIndex = -1; // index of the /galleries link
// check each link for an href match with our current page
for (var i = 0; i < links.length; i++)
{
var testLink = StripDomainAndHash(links[i].href); // relative link will be turned into absolute link here
if (testLink == pageURL)
{
YD.addClass(links[i], "navCurrentPage navCurrentPageExact");
YD.addClass(links[i].parentNode, "navCurrentPageParent navCurrentPageParentExact");
foundExactMatch = true;
break;
}
// if testLink is not the top level (don't want to do partial matches for top level)
else if (testLink != "/")
{
// if the testLink is contained within the pageURL
// (e.g. the current page link is longer than the navbar link and starts with it),
// remember it as a partial match
if (pageURL.indexOf(testLink) == 0)
{
// save the longest partial match (assuming it to be the most specific)
if (testLink.length > partialLength)
{
partialIndex = i;
partialLength = testLink.length;
}
}
else if (testLink == "/galleries/")
{
galleriesIndex = i;
}
}
}
if (!foundExactMatch)
{
// since we had no exact match, check for partial matches
if (partialIndex != -1)
{
YD.addClass(links[partialIndex], "navCurrentPage navCurrentPagePartial");
YD.addClass(links[partialIndex].parentNode, "navCurrentPageParent navCurrentPageParentPartial");
}
// if no exact match and no partial matches
// and we did have a galleries link
// and we're on a gallery page or a category or subcategory page
// then, mark the galleries link
else if ((galleriesIndex != -1) && (YD.hasClass(document.body, "galleryPage") || YD.hasClass(document.body, "category")))
{
YD.addClass(links[galleriesIndex], "navCurrentPage navCurrentPageGallery");
YD.addClass(links[galleriesIndex].parentNode, "navCurrentPageParent navCurrentPageParentGallery");
}
}
}
});
//--------------------------------------------------------------------------------------------------
// Install Email Contact Link (for pro accounts only)
//
// Version 1.1
//--------------------------------------------------------------------------------------------------
YE.onDOMReady(InitMyContactButton);
function InitMyContactButton()
{
InitMyContactButton.extraContactUsButtons = new Array;
var contacts = Sizzle(".customContactButton");
// look in Easy Customizer navbar too
var navEntries = Sizzle("#customNav li a");
for (var j = 0; j < navEntries.length; j++)
{
var str = navEntries[j].href;
if (str.search(/\/customcontact/i) != -1)
{
navEntries[j].onclick = function () {return false;};
contacts.push(navEntries[j]);
break;
}
}
var nick, o, matches;
// see if the nickname is already defined in the page
try {
nick = NickName || SM.hostConfig.nickname ; // get standard nickname
} catch (e) {}
// see if the nickname is in the URL
if (!nick)
{
try {
matches = window.location.host.match(/^(www.)?(.*)\.smugmug\.com$/i);
nick = matches[2];
} catch (e) {}
}
// see if we can get the nickname from one of the built-in contact links on the page
if (!nick)
{
// hack - NickName doesn't exist on some pages so we try to pull it from the password prompt or the standard footer
o = YD.get("contactUsButtonWrapper") || YD.get("contactUsButtonWrapperFooter");
matches = o.onmouseover.toString().match(/ownerNickName:\s*'([^']+)'/)
if (matches && matches.length > 1)
{
nick = matches[1];
}
}
for (var i = 0; i < contacts.length; i++)
{
InitMyContactButton.extraContactUsButtons.push(new SM.buttons.contactUs
(
contacts[i].parentNode,
contacts[i],
{
buttonText: 'Contact',
panelTitle: 'Contact the gallery owner',
currentPage: window.location.toString(),
currentPageOverride: '',
referringPage: '',
pro: '',
modal: 'true',
popupName: 'contactOwner',
uniqueID: 'myContactPanel' + InitMyContactButton.extraContactUsButtons.length,
ownerNickName: nick,
width: '755px',
albumID: '',
additionalParams: 'FooterContact'
}
));
}
}
__________________
--John Homepage • Popular JFriend's javascript customizations • Secrets for getting fast answers on Dgrin Always include a link to your site when posting a question |
|
|
|
||
|
#466
|
|
|
Beginner grinner
|
Hello John,
I have a question concerning the code you wrote and I put onto my site. It was working yesterday, but today I made a few changes to my site via easy customizer and now the "Yellow" highlight has stopped working. The other features of your script are working (highlight and italics), just the color stopped. I assume I did something in easy customizer that is overriding the script. I was in the navigation bar builder area and played around with the font color. I am thinking I did something to change a default, but not sure. Any ideas? Thanks, Harold photos.bhagavideo.com
__________________
Harold |
|
|
|
|
#467
|
||
|
Scripting dude-volunteer
|
Quote:
Code:
/* highlight individual menu items when their page is current */
#customNav li a.navCurrentPage {
font-style: italic !important;
font-weight: bold !important;
color: #FFFF00 !important;
}
__________________
--John Homepage • Popular JFriend's javascript customizations • Secrets for getting fast answers on Dgrin Always include a link to your site when posting a question |
|
|
|
||
|
#468
|
|
|
Beginner grinner
|
[QUOTE=jfriend;1784067]The EZ Customizer color settings are trying to take over from anything else that you've specified (I despise how EZ Customizer works in this regard). Anyway, you can get your custom color back by changing the navbar highlight CSS to this:
Thanks John, works perfect. Thanks for the quick response as well. Very much appreciated.
__________________
Harold |
|
|
|
|
#469
|
||
|
Big grins
|
stuck at step 3
Quote:
Here is an example of what I want to happen (different color) http://www.rachelkabukala.com/index2.php#/home/ Here is a page in my site: http://tnye.smugmug.com/Portfolio/fl...922791&k=H8CET Thanks! |
|
|
|
||
|
#470
|
|
|
Big grins
|
I am trying to do the bold, italic, and yellow but it isn't working. Can you help me. www.jeremycrawfordphotography.smugmug.com
|
|
|
|
|
#471
|
||
|
Scripting dude-volunteer
|
Quote:
Change this: Code:
/* highlight individual menu items when their page is current */
#navcontainer .navCurrentPage {font-style: italic !important; font-weight: bold !important; color: #FFFF00 !important;}
Code:
/* highlight individual menu items when their page is current */
#customNav .navCurrentPage {font-style: italic !important; font-weight: bold !important; color: #FFFF00 !important;}
__________________
--John Homepage • Popular JFriend's javascript customizations • Secrets for getting fast answers on Dgrin Always include a link to your site when posting a question |
|
|
|
||
|
#472
|
|
|
Big grins
|
I am having some issues with the highlighting of the current page. Seems to work just fine for "Home" and "Family" but not for the others... Any help would be greatly appreciated:
http://www.scottramsdenphotography.com
__________________
Scott Ramsden Photography |
|
|
|
|
#473
|
||
|
Big grins
|
Quote:
|
|
|
|
||
|
#474
|
||
|
Scripting dude-volunteer
|
Quote:
Code:
/* highlight individual menu items when their page is current */
#customNav li a.navCurrentPage {font-style: italic !important; font-weight: bold !important; color: #FFFF00 !important;}
__________________
--John Homepage • Popular JFriend's javascript customizations • Secrets for getting fast answers on Dgrin Always include a link to your site when posting a question |
|
|
|
||
|
#475
|
|
|
Big grins
|
Looks like the one labeled "My Reef" on mine still isn't working properly. If I go into one of the galleries inside "My Reef" it then gets highlighted... Hmmm
__________________
Scott Ramsden Photography |
|
|
|
|
#476
|
|
|
Scripting dude-volunteer
|
Seems to be working here now - perhaps you fixed it. Usually what you observed is when the URL in the HTML isn't exactly what is displayed when you go there. Those two have to match.
__________________
--John Homepage • Popular JFriend's javascript customizations • Secrets for getting fast answers on Dgrin Always include a link to your site when posting a question |
|
|
|
|
#477
|
|
|
Big grins
|
Hi JFriend or anyone Else who maybe able to help,
I'm using Allens dropdown thread and so changed the line <div class="menu" id="navcontainer"> for the code to find the link and pasted the correct info but, nothing comes up, any ideas? |
|
|
|
|
#478
|
||
|
Scripting dude-volunteer
|
Quote:
id="navcontainer" and YE.onContentReady("NavContainer", function () You must use the same caps for navcontainer in both places.
__________________
--John Homepage • Popular JFriend's javascript customizations • Secrets for getting fast answers on Dgrin Always include a link to your site when posting a question |
|
|
|
||
|
#479
|
||
|
Big grins
|
No change
Quote:
Thank you yet again for getting back to me. I've add the details in the above quote to no avail. Any ideas will be gratefully received. Many thanks |
|
|
|
||
|
#480
|
|
|
Scripting dude-volunteer
|
The code is working now, but your CSS to format it is not. Your CSS has to use the same NavContainer identifier too. All three have to match.
__________________
--John Homepage • Popular JFriend's javascript customizations • Secrets for getting fast answers on Dgrin Always include a link to your site when posting a question |
|
|
|
| Tell The World! | |
| Thread Tools | |
| Display Modes | |
|
|