PDA

View Full Version : Another Breadcrumb Question


Gary Miller
Oct-09-2008, 09:08 AM
I've been reading Dgrin and testing code for the past 4 hours (with no success) to get rid of my "username" which links to my SmugMug homepage in the breadcrumb.

For example, the breadcrumb currently reads "Gary Miller (gmillerphotographer) > Dog Show > Irish Setter Specialty".

I would like for it to read "Dog Show > Irish Setter Specialty".

My SmugMug homepage is http://galleries.gmillerphotographer.com.

Can anyone help?

Thanks.

Allen
Oct-09-2008, 09:56 AM
I've been reading Dgrin and testing code for the past 4 hours (with no success) to get rid of my "username" which links to my SmugMug homepage in the breadcrumb.

For example, the breadcrumb currently reads "Gary Miller (gmillerphotographer) > Dog Show > Irish Setter Specialty".

I would like for it to read "Dog Show > Irish Setter Specialty".

My SmugMug homepage is http://galleries.gmillerphotographer.com.

Can anyone help?

Thanks.
This in javascript gets rid of your name but not the first >.

YE.onContentReady('breadCrumbTrail', function() {this.innerHTML =
this.innerHTML.replace('Gary Miller (gmillerphotographer)', ' ')});

Gary Miller
Oct-09-2008, 10:02 AM
Thank you, Allen.

Is there no way to get rid of the first ">"?

Also, when I go to the gallery link "Dog Show" the SmugMug name - Gary Miller (gmillerphotographer) - reappears there. Anyway to get rid of it at that level as well?

Again, thanks.



This in javascript gets rid of your name but not the first >.

YE.onContentReady('breadCrumbTrail', function() {this.innerHTML =
this.innerHTML.replace('Gary Miller (gmillerphotographer)', ' ')});

Allen
Oct-09-2008, 10:06 AM
Thank you, Allen.

Is there no way to get rid of the first ">"?

Also, when I go to the gallery link "Dog Show" the SmugMug name - Gary Miller (gmillerphotographer) - reappears there. Anyway to get rid of it at that level as well?

Again, thanks.
Why not just hide it with CSS?

.category.category_Dog_Show #breadcrumb {display: none;}

Gary Miller
Oct-09-2008, 12:57 PM
Thanks for the additional info, Allen. I am still not getting the result I'm after (not even sure it's possible).

What I'm want is to drop my name and SmugMug ID from the breadcrumbs on all gallery pages. I still want the category and gallery name to remain so that viewers can use them to navigate to other galleries in the category.

As you have probably seen, I have a NavBar at the top to allow visitors to move back to my main (non-SmugMug) webpages <http://www.gmillerphotographer.com>.

If you can advise me on how to make this happen, I would be very grateful.



Why not just hide it with CSS?

.category.category_Dog_Show #breadcrumb {display: none;}

Allen
Oct-09-2008, 01:14 PM
Thanks for the additional info, Allen. I am still not getting the result I'm after (not even sure it's possible).

What I'm want is to drop my name and SmugMug ID from the breadcrumbs on all gallery pages. I still want the category and gallery name to remain so that viewers can use them to navigate to other galleries in the category.

As you have probably seen, I have a NavBar at the top to allow visitors to move back to my main (non-SmugMug) webpages <http://www.gmillerphotographer.com>.

If you can advise me on how to make this happen, I would be very grateful.
These two added to CSS and js should work.:scratch

YE.onContentReady('breadCrumbTrail', function() {this.innerHTML =
this.innerHTML.replace('Gary Miller (G. Miller)', ' ')});


.category.category #breadcrumb {visibility: hidden;}
.category.category .loggedIn #breadcrumb {visibility: visible;}

Gary Miller
Oct-09-2008, 01:31 PM
Looks like that did it Allen! I have no idea why it didn't work the last time around.

Now if I can just get rid of that pesky ">" at the beginning of the breadcrumb, all will be well with the world.

Thanks a ton for your help.



These two added to CSS and js should work.:scratch

YE.onContentReady('breadCrumbTrail', function() {this.innerHTML =
this.innerHTML.replace('Gary Miller (G. Miller)', ' ')});


.category.category #breadcrumb {visibility: hidden;}
.category.category .loggedIn #breadcrumb {visibility: visible;}

Allen
Oct-09-2008, 01:54 PM
Looks like that did it Allen! I have no idea why it didn't work the last time around.

Now if I can just get rid of that pesky ">" at the beginning of the breadcrumb, all will be well with the world.

Thanks a ton for your help.
Problem is there are two >'s and they have not been assigned a class. Maybe
someway with js to select the first one and hide it, but don't know.

G. Miller
Oct-09-2008, 02:18 PM
No worries, Allen. I can learn to live with something as small as a ">". :D

Thanks again for your help on this.

(And as you may have noticed, while I was in a tweaking mood, I tweaked my username to match everything else I'm tweaking today.)

Problem is there are two >'s and they have not been assigned a class. Maybe
someway with js to select the first one and hide it, but don't know.

jfriend
Oct-09-2008, 02:52 PM
No worries, Allen. I can learn to live with something as small as a ">". :D

Thanks again for your help on this.

(And as you may have noticed, while I was in a tweaking mood, I tweaked my username to match everything else I'm tweaking today.)

Gary, if you get rid of the previous breadCrumbTrail javascript you had and then add this one, it will get rid of both your name and the leading ">" char.

YE.onContentReady("breadCrumbTrail", function(){this.innerHTML = this.innerHTML.replace(/<a.*?>.*?<\/a>[\s\n]*&nbsp;&gt;&nbsp;/, "");});

Technical, this is a regular expression that matches everything in the first <a></a> tag up to the next &nbsp;&gt;&nbsp; which is the part you want to get rid of.

G. Miller
Oct-09-2008, 06:39 PM
John -

Thank you very much. It's people like you and Allen (and the rest of the incredible Smuggers here) who make this place so amazing.

I will now sleep soundly knowing that pesky "&gt" is gone. :barb

- Gary


Gary, if you get rid of the previous breadCrumbTrail javascript you had and then add this one, it will get rid of both your name and the leading ">" char.

YE.onContentReady("breadCrumbTrail", function(){this.innerHTML = this.innerHTML.replace(/<a.*?>.*?<\/a>[\s\n]*&nbsp;&gt;&nbsp;/, "");});
Technical, this is a regular expression that matches everything in the first <a></a> tag up to the next &nbsp;&gt;&nbsp; which is the part you want to get rid of.

G. Miller
Oct-10-2008, 10:10 AM
Allen (and John) -

I think I know why all the code you were giving me yesterday wasn't working for me. Early in the day, I was viewing everything in IE and Safari (for Windows). Later, when it all started working properly, I was viewing everything with Firefox.

I just looked at it again with IE and Safari and it is back to its old tricks.

Thoughts anyone? :dunno

creativewedding
Jan-13-2010, 01:23 AM
YE.onContentReady('breadCrumbTrail', function() {this.innerHTML =
this.innerHTML.replace('Kelvin Loh', ' ')});



YE.onContentReady("breadCrumbTrail", function(){this.innerHTML = this.innerHTML.replace(/<a.*?>.*?<\/a>[\s\n]*&nbsp;&gt;&nbsp;/, "");});

May I know whether these codes are inserted under Bottom Javascript?

I have tried putting them there but not working at all.

jfriend
Jan-13-2010, 07:53 AM
YE.onContentReady('breadCrumbTrail', function() {this.innerHTML =
this.innerHTML.replace('Kelvin Loh', ' ')});


YE.onContentReady("breadCrumbTrail", function(){this.innerHTML = this.innerHTML.replace(/<a.*?>.*?<\/a>[\s\n]*&nbsp;&gt;&nbsp;/, "");});
May I know whether these codes are inserted under Bottom Javascript?

I have tried putting them there but not working at all. Can you back up and tell me what you're trying to accomplish?

creativewedding
Jan-13-2010, 07:58 AM
Can you back up and tell me what you're trying to accomplish?

Basically, I want to hide the the word "Kelvin Loh" for all the breadcrumbs. Just show the categories and galleries names will do.

jfriend
Jan-13-2010, 08:05 AM
Basically, I want to hide the the word "Kelvin Loh" for all the breadcrumbs. Just show the categories and galleries names will do. Neither of the scripts you have now will work reliably across browsers. The second one works in Firefox, but not IE. Remove both of them and insert this in your bottom javascript:



// -------------------------------------------------------------------------------------------
// Code to remove the first part of the breadcrumb where the account name is
// -------------------------------------------------------------------------------------------
YE.onContentReady("breadCrumbTrail", function()
{
var str = this.innerHTML;
str = str.replace(/\n/g, " "); // get rid of linebreaks which cause problems for regular expressions in javascript
this.innerHTML = str.replace(/^\s*<a .*?a>.*?</i, "<");
});

creativewedding
Jan-13-2010, 08:25 AM
Neither of the scripts you have now will work reliably across browsers. The second one works in Firefox, but not IE. Remove both of them and insert this in your bottom javascript:



// -------------------------------------------------------------------------------------------
// Code to remove the first part of the breadcrumb where the account name is
// -------------------------------------------------------------------------------------------
YE.onContentReady("breadCrumbTrail", function()
{
var str = this.innerHTML;
str = str.replace(/\n/g, " "); // get rid of linebreaks which cause problems for regular expressions in javascript
this.innerHTML = str.replace(/^\s*<a .*?a>.*?</i, "<");
});





Thanks John.

But can I also remove the word "Travel" from the main category page since it serves no purpose now?

http://www.kelvinlohphotography.com/Travel

jfriend
Jan-13-2010, 08:35 AM
Thanks John.

But can I also remove the word "Travel" from the main category page since it serves no purpose now?

http://www.kelvinlohphotography.com/Travel All your categories have that issue. I'd suggest adding this to the CSS section of your site-wide-customization to hide the breadcrumb in top level categories:

.category #breadCrumbTrail {display:none;}
.category.subcategory #breadCrumbTrail {display:block;}