soitgoes / hanselsrevenge

JQuery historical based breadcrumbs
10 stars 7 forks source link

IE8 was being picky. #3

Closed elainevdw closed 11 years ago

elainevdw commented 11 years ago

I had to change line 120 of jquery.hanselsrevenge.js from

title = $('<title>').text(document.title);

to

var title = $('<title>').text(document.title);

to prevent it from throwing errors on some pages in IE8. Not exactly sure why, but I figured I'd post it here anyway. The site's a bit of a mess, especially in IE8, so it could very well be an issue with other scripts on there.

Thanks for a great plugin!

soitgoes commented 11 years ago

Thanks for the pull. Let me know if you find anything you'd like it to do. I'm not sure really where to take it from here. Would love to hear your feedback on it.

elainevdw commented 11 years ago

Well, I was trying to figure out how to call some of the plugin's internal functions from my other scripts on the site, and I couldn't figure it out, lol. For example, I'd like to be able to assign my breadcrumb object to a variable and do something like this, or otherwise traverse the breadcrumbs in a customized fashion.

$('#subnav a').click(function(){
     myBreadcrumbObject.pop(); // If I click on a link in the subnav, take the breadcrumbs up one level
     myBreadcrumbObject.rewindTo(2); // Reset the breadcrumbs to whatever the second breadcrumb level is
     myBreadcrumbObject.push('Custom Title','http://mysite.com/custom-result'); // Maybe add a breadcrumb that isn't technically part of your browsing history?
     myBreadcrumbObject.edit(2,'New Title','http://mysite.com/new-result'); // Even go in there after the fact and clean up a breadcrumb?
});

I also added a couple lines in the getTitle function to filter out unecessary stuff. The titles on my site follow this format:

My Page | Parent Page | Website Title and something catchy

So, I split the title by pipes and the function is returning the part before the first pipe rather than the whole string.

That was easy enough to customize that I don't know if it's worth adding another config option to control it though.

Thanks again. :) This has saved me so much time trying to reverse engineer breadcrumbs on this site. They are trying to use tags as a kind of hierarchy, which is making the whole breadcrumb thing very confusing.