Extension talk:JSBreadCrumbs

From MediaWiki.org
Jump to: navigation, search

Contents

Thread titleRepliesLast modified
Proposal: Merge with BreadCrumbs219:08, 14 January 2013
Duplicate entries620:37, 19 July 2012
Way to avoid the screen jump?214:40, 6 July 2012
jquery now included in MW, so can this be modified to use it?317:36, 31 March 2012
HTML entities usually required for separator character104:53, 21 August 2011
Add explanation like "Last visited"?507:10, 19 August 2011
Removing Wiki Title402:08, 18 August 2011
Font Size?320:00, 13 July 2011
Not BreadCrumbs for not logged users016:51, 17 March 2011
Download broken101:07, 11 September 2010
0.5 and 1.16.0, no JQuery418:38, 29 July 2010
Only visible on edit pane522:26, 5 July 2010

Proposal: Merge with BreadCrumbs

Hey! I took over maintaining the Extension:BreadCrumbs about 6 months ago, and I've been thinking that the functional duplication between that and Extension:JSBreadCrumbs is pretty wasteful. JSBreadCrumbs is much faster (and more stable) than BreadCrumbs, but provides no fallback for pageloads without Javascript. I'd like to integrate the two to create a fast, flexible, and more powerful BreadCrumbs extension. Here's what I'm thinking: By default, the new extension will behave exactly the same as JSBreadCrumbs: drop a div on the page and let the Javascript fill it in. However, add a global variable (i.e. an option for administrators) for a pure, server-side implementation, which will provide exactly the same output as the JavaScript. This will make the extension useful in environments in which Javascript use is not preferable (e.g. Internet Explorer-favoring environments, or js-paranoid browsers).

AABoyles (talk)16:08, 11 January 2013

Sounds fine to me. I'm not actively maintaining JSBreadCrumbs. Merge away.

Ryan lane (talk)23:16, 12 January 2013

Thanks a lot! Will do.

AABoyles (talk)19:08, 14 January 2013
 
 

Duplicate entries

Hi,

thanks for the extension. Sometimes, on some pages I get duplicate entries in the breadcrumb list:


Extension-JSBreadCrumb-Issue-1.jpg

Do you have any idea, how to solve this problem? Thank you and greetings

Filburt11:36, 14 January 2011

Hmm. That's odd. Duplicates are definitely supposed to be getting stripped. I'll see if I can replicate the issue.

Ryan lane02:25, 25 January 2011

I don't know if you've duplicated this or not yet, but I see that it isn't fixed. I duplicated it. It is a bug triggered by visiting edit, history, and maybe a few other pages, which then show up in the list. Once you visit one of those pages, JSBreadCrumbs will continually add more of them, including the main page, unlimited numbers of times, with no removal of duplicates. It's as if it forgets about removing duplicates for that page.

Those pages should be counted as duplicates and removed. There might be other pages that should be removed too, but I can't think of them off the top of my head.

Badon02:45, 18 August 2011

Thanks for duplicating it. I'll see if I can get time to work on this. I'm pretty swamped right now due to Wikimedia projects... I'd of course take patches, if you happen to fix it before I get to it.

Ryan lane17:24, 18 August 2011

Unfortunately, I'm not a coder, but with some more practice I might be able to play one on TV :) It looks like any of the "&action=" parameter-url pages will trigger this bug. If I start feeling confident, I might try to fix it. Then I'll have to figure out how to produce a patch.

Badon20:34, 18 August 2011

Also, ?title= will trigger the bug too. It looks like any URL variation on the page will trigger the bug.

Badon04:51, 21 August 2011
 

I fixed this with code that skips adding the current page to the breadcrumbs if it's an action page (edit, view history, ...). The relevant code modifications to /js/BreadCrumbs.js are shown below. Note that you might be reading this post after Ryan has already had a chance to incorporate this or a different fix; get the latest version first.

    // Don't add this page if it's an action page (edit, view history, ...)
    if (!location.search || location.search.indexOf('action=') == -1)
    {
        // Remove duplicates
        ...

        // Add the current page
        ...

        // Ensure we only display the maximum breadcrumbs set
        ...
    }
Sethlivingston (talk)20:11, 19 July 2012
 
 
 
 

Way to avoid the screen jump?

Edited by 2 users.
Last edit: 17:35, 22 March 2012

Hi.

I've noticed that when the page loads, the breadcrumbs do not load immediately. So the vertical space they occupy is obviously not there. So when the breadcrumbs loads a second or so later it causes the whole page to shunt down.

This is a little disconcerting to see on every page load. Is there a way to prevent this? A CSS tweak perhaps? Or perhaps a skin change is needed to allocate a permanent div?

Any suggestions gratefully received!

Thanks

Mitchelln17:21, 22 March 2012

I have stopped using this extension recently (and some other stuff too) just to speed up load times, but last time I used it, I didn't notice any screen jump. Can you share a demo? What browser is that occurring in?

Badon (talk)02:20, 30 March 2012

It does it on this site: http://www.aroundisleofwight.info

All browsers, but worse on ones with slow javascript engines e.g. IE8. Still very noticeable on firefox and chrome. though.

Mitchelln (talk)14:40, 6 July 2012
 
 

jquery now included in MW, so can this be modified to use it?

Hi.

I tried this extension with MW 1.17.2, but it only shows if Vector skin is used. I need it to work with my custome skin. I understand that MW 1.17+ now has jquery "built-in" without the need for the usability extension or any other tweaks.

Would it be possible to modify this great extension to use 1.17+'s jquery?

Thanks!

Mitchelln (talk)14:44, 22 March 2012

Aha! I sorted it myself :)

There is a check for the vector skin:

        static function enableBreadCrumbs() {
                global $wgUser;

                // Ensure we only enable bread crumbs if we are using vector and
                // the user has them enabled
                if ( $wgUser->getSkin() instanceof SkinVector && $wgUser->getOption( "jsbreadcrumbs-showcrumbs" ) ) {
                        return true;
                }

I simply knocked out the vector check. Coupled with the $out->IncludeJQuery(); this all now works :)

Finally I'm free of the old unsupported Breadcrumbs - yay!

Mitchelln (talk)14:48, 22 March 2012

Great job! I wonder if you can persuade User:Ryan Lane to accept a patch from you? Maybe you can rewrite it to make the check configurable? Did you happen to notice why the code was looking for Vector?

Badon (talk)02:29, 30 March 2012

I'd love it if someone took over maintenance of the extension, really. I don't use it in production anywhere anymore, so it doesn't get maintenance or testing at all. I'd also be totally happy to accept patches. It'll be much easier when this is moved to git, since I'll be able to just do a code review and merge of a pushed change.

Ryan lane (talk)17:36, 31 March 2012
 
 
 

HTML entities usually required for separator character

I updated the configuration defaults example with HTML entities. That will prevent screwy displays. Also, I recommend using a semantically correct right arrow character instead of the European double right angle quote. It is this HTML entity:

AMPERSANDGOESHERErarr;

I couldn't get it to let me write in the HTML entity without it getting parsed by the browser, so replace "AMPERSANDGOESHERE" with an ampersand: &

Badon02:39, 18 August 2011

Line 7 of BreadCrumbs.js needs to be updated with an appropriate default HTML entity, like the right arrow. I'm going to go ahead and update the default parameters in the documentation with the semantically correct right arrow instead of the right quote, but I can't update the file.

Badon04:53, 21 August 2011
 

Add explanation like "Last visited"?

Thanks for creating this extension - it looks very useful. I just tested it, but was a bit confused at first, because there were just the links, without any explanation what they were for. Maybe add a description at the start of the line (something like "Last visited:")?

Tbleher16:02, 28 June 2010

I'll add something like that. Thanks for the feedback.

Ryan lane16:02, 28 June 2010
 

I added this in 0.2.

Ryan lane16:03, 28 June 2010

Is there a parameter to change this? I'd like to experiment with having it, not having it, and having it be something different.

Badon02:10, 18 August 2011

This is a localized message, so like other MediaWiki messages, you can override it via the MediaWiki namespace; the message is: jsbreadcrumbs-leading-description

Ryan lane17:27, 18 August 2011

I did some more research on this, and it looks like I have to got to Special:AllMessages to see all the possibilities, and documentation for messages is here:

http://www.mediawiki.org/wiki/Manual:System_message

Hopefully that info will help anyone else that has the same question. I assume it's possible to change it via a LocalSettings.php parameter. That might be something easy to figure out how to do. If I try to hack on this, maybe I'll start there.

Badon07:10, 19 August 2011
 
 
 
 

Removing Wiki Title

Is there a way to prevent the Wiki title from being included along with the page titles in the page trail?

i.e. instead of:

(Wiki Title)foo >> (Wiki Title)baz

I'd have:

foo >> baz

Thanks

Enterprise user17:46, 7 January 2011

$wgDefaultUserOptions['jsbreadcrumbs-showsite'] = false;

Ryan lane03:36, 13 January 2011
 

Which should be the default.

Ryan lane03:37, 13 January 2011

Got it; I got the LocalSettings.php code from the main page for this extension. The default is mentioned in the comment section, but the variable is set to 'true'. Guess that's where I got mixed up.

Thanks

Enterprise user19:24, 13 January 2011

I fixed that. Changed it to false.

Badon02:08, 18 August 2011
 
 
 

Font Size?

Is there a way to make the font size a bit smaller? My users like it, only complaint is they wish it was 2 size fonts smaller.

Lynxcub18:31, 13 July 2011

Yes. This is adjustable via the CSS.

Ryan lane18:44, 13 July 2011
 

Specifically, here is the css you need to override. You can override this in MediaWiki:Common.css

Ryan lane18:47, 13 July 2011
Edited by another user.
Last edit: 19:57, 13 July 2011

Unfortunately, that doesn't seem to work. I tried it in both the Vector.css and Common.css. Also tried changing the em to px and %, and even tried small/large and had no effect.

I'm sure i'm missing something, just don't know what. I'm using MW 1.16.x, Default skin in Vector

Edit: I went through and changed the BreadCrumbs.css, and that seemed to do the trick.

Lynxcub19:56, 13 July 2011
 
 

Not BreadCrumbs for not logged users

I'm using:

MediaWiki 1.16.0 Vector 0.2.0 JSBreadCrumbs 0.5

When a user is logged, it works fien, but when a user navigates without login, the breadCrumbs do not apeear.

My configuration:

require_once("$IP/extensions/JSBreadCrumbs/JSBreadCrumbs.php"); $wgDefaultUserOptions['jsbreadcrumbs-showcrumbs'] = true; $wgDefaultUserOptions['jsbreadcrumbs-numberofcrumbs'] = 5; $wgDefaultUserOptions['jsbreadcrumbs-showsite'] = false; $wgJSBreadCrumbsSeparator = "»"; $wgJSBreadCrumbsCookiePath = "/";

87.221.108.12316:51, 17 March 2011

Download broken

Upon trying to download a snapshot via the link in the box to the right of the article, the target page reports No such extension "JSBreadCrumbs". JFYI. --91.64.174.228 06:32, 2 September 2010 (UTC)

91.64.174.22806:32, 2 September 2010

Ugh. No idea why this is happening. Extension Distributor is broken.... Annoying. Maybe I'll get around to fixing it soon, since I now have access to do so.

Ryan lane01:07, 11 September 2010
 

0.5 and 1.16.0, no JQuery

I just tried version 0.5 from svn with Mediawiki 1.16.0 (stable release) and the JQuery script is not insterted when this plugin is enabled.

By adding one line in JSBreadCrumbs.hooks.php I was able to correct this (here's a diff):

--- JSBreadCrumbs.hooks.php     2010-07-29 10:39:01.238463930 -0400
+++ JSBreadCrumbs.hooks.php.new 2010-07-29 10:39:57.263476116 -0400
@@ -10,6 +10,7 @@
                global $wgExtensionAssetsPath;
 
                if ( self::enableBreadCrumbs() ) {
+                       $out->IncludeJQuery();
                        $out->addScriptFile( "$wgExtensionAssetsPath/JSBreadCrumbs/js/BreadCrumbs.js", 7 );
                        $out->addExtensionStyle( "$wgExtensionAssetsPath/JSBreadCrumbs/css/BreadCrumbs.css?1" );
                }

But even if JQuery is loading now, the breadcrumbs don't show up.

66.36.154.6614:42, 29 July 2010

There is a possibility that this only works if the usability initiative version of Vector is being used. I'll check this, and get back with you.

Ryan lane17:59, 29 July 2010

I installed the UsabilityInitiative version of the Vector skin and the breadcrumbs appeared. With the new skin, I now see "jquery-ui" is included in the page. Probably this was the "missing link".

A note about this should be added to the Requirements section of the plugin.

66.36.154.6618:19, 29 July 2010

Yeah. Likely. The need for jquery cookie plugin is likely what the issue is. I don't understand why this isn't included with MediaWiki core.

Ryan lane18:36, 29 July 2010
 

Updated the documentation to reflect this.

Ryan lane18:38, 29 July 2010
 
 
 

Only visible on edit pane

Hi!

I have some kind of a problem with this extension. I only see it, if I edit a page. While browsing pages it does not appears on top.

I'm using vector skin and 1.16beta1.

Can you give me a hint to search for the problem cause ?

Regards,

EduRam09:57, 29 June 2010

Well, that sure is weird. Are you doing any caching on your server? If you are using the file cache, or squid, or varnish, you will likely need to purge your cache after the initial install. You will, for sure, if you are using the file cache.

Check LocalSettings.php for:

$wgUseFileCache = true;

If you have that, you'll need to clear your cache directory (usually <wikidir>/cache).

BTW, does this occur if you are logged in as well?

Ryan lane18:24, 29 June 2010

Hi!

I don't have that flag on my LocalSettings.php file.

User logged in or not, I can only see the history when editing a page :( Is any kind of php step debug I can do in my installation ?

Thanks for your patience.

Edu

213.58.193.20617:04, 30 June 2010

Which web browser are you trying this with? Is your site open to the public, so I can see what the issue might be?

Ryan lane19:01, 30 June 2010

I tried with Opera and Chrome. It's on intranet so not acessible :( I'll wait for August to upgrade to MW 1.16.beta3. Then I will test again.

Anyway, thanks for the interest.

EduRam09:17, 2 July 2010

That is the version I tested with. It is possible that 1.6beta1 didn't include the correct version of jquery...

Ryan lane22:26, 5 July 2010