Extension:JSBreadCrumbs

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manualManual:Extensions
Crystal Clear action run.png
JSBreadCrumbs

Release status:Extension status stable

ImplementationTemplate:Extension#type Skin
DescriptionTemplate:Extension#description Adds a trail of breadcrumbs below the tab bar.
Author(s)Template:Extension#username Ryan Lane, Kevin Forbes
Latest versionTemplate:Extension#version 0.7.0 (2017-07-18)
Compatibility policyCompatibility#mediawiki_extensions master
MediaWikiTemplate:Extension#mediawiki 1.23+
PHPTemplate:Extension#php 5.3+
Database changesTemplate:Extension#needs-updatephp No
LicenseTemplate:Extension#license GNU General Public License 2.0 or later
Download
ParametersTemplate:Extension#parameters
  • $wgDefaultUserOptions
  • $wgJSBreadCrumbsSeparator
  • $wgJSBreadCrumbsCookiePath
Hooks usedTemplate:Extension#hook
BeforePageDisplayManual:Hooks/BeforePageDisplay
MakeGlobalVariablesScriptManual:Hooks/MakeGlobalVariablesScript
GetPreferencesManual:Hooks/GetPreferences

Translate the JSBreadCrumbs extension if it is available at translatewiki.net

Check usage and version matrix.

The JSBreadCrumbs extension is a simple extension that adds a jQuery-based Javascript file and a CSS file to your wiki's output that will add a trail of navigation breadcrumbs below the navigation tabs. The idea is for a simpler history than your back button that only tracks navigation inside of the wiki. Unlike the browser's back button, it will only track GET requests, not POSTs, and will remove duplicate entries from the list.

Supports multiple MediaWiki skins including Vector and Foreground.

Installation[edit]

  • Download and place the file(s) in a directory called JSBreadCrumbs in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    require_once "$IP/extensions/JSBreadCrumbs/JSBreadCrumbs.php";
    
  • Configure as required
  • YesY Done - Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Configuration[edit]

Like most MediaWiki configuration, you can set these options by adding changes to the bottom of LocalSettings.php.

Defaults shown below:

// Set bread crumbs enabled for users by default
// Required if you want anonymous users to get bread crumbs
// Default: false
$wgDefaultUserOptions['jsbreadcrumbs-showcrumbs'] = true;

// Number of breadcrumbs to display by default
// Default: 5
$wgDefaultUserOptions['jsbreadcrumbs-numberofcrumbs'] = 5;

// Whether or not to show the site name before bread crumb links
// Useful when using wiki farms, where the wikis share the same cookie path
// Default: false
$wgDefaultUserOptions['jsbreadcrumbs-showsite'] = false;
//Show Crumbs In SideBar
// Default is false. which will cause breadcrumbs to appear at top of the wiki. If set to true, the BreadCrumbs will appear in the Left Side Bar for skins like Vector
$wgDefaultUserOptions['jsbreadcrumbs-showcrumbssidebar'] = false;

//Default is false which will cause crumbs to only be tracked "within" a wiki. When set to true, if you are maintaining a "wikifarm" crumbs will be tracked through all your wikis. So for example you could have a crumb trail such as: site1-link1, site1-link2, site2-link1, site3-link1, etc...
$wgDefaultUserOptions['jsbreadcrumbs-pervasivewikifarm'] = false;

//Default is "Navigation Trail", changing this setting will set the leading description to the specfied string followed by a colon
//This setting only activates when the sidebar is not used. 
$wgDefaultUserOptions['jsbreadcrumbs-leading-description']= "Last Pages Viewed";

// Separator to display
// This option is localized, and should be changed at translatewiki.net
// if you are wanting it changed for your language. Otherwise, if you
// don't like the separator symbol, you can override it with this setting.
// Some characters should be entered as HTML entities to ensure they show
// up correctly on all browsers. Reference for them is here: 
// http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references
// Default: →
$wgJSBreadCrumbsSeparator = "→";

// Cookie path for breadcrumbs
// Default is "/", which will cause the breadcrumbs to cross
// wikis for wikis on the same domain. If you prefer the breadcrumbs
// to be unique per wiki, set this to your wiki's directory. For instance,
// if you had http://example.org/wiki and http://example.org/sandbox, you'd
// want to set this to "/wiki/" in that wiki's LocalSettings.php.
$wgJSBreadCrumbsCookiePath = "/";

//This parameter is used to specify where the breadcrumbs will appear. For default skins such as Vector and Foreground, the placements are known and supported. If you are using a custom skin that differs from CSS object placement, you may want to set this variable to an alternate tag for proper placement of the crumbs in your wiki
$wgJSBreadCrumbsCSSSelector = "#top";

Using as a Gadget instead of as an extension[edit]

Since this extension simply adds a Javascript and CSS file, it can easily be added as a gadget, if your wiki is using the Extension:Gadgets extension. To do so, take the JavaScript, and add it as a gadget; then take the CSS and add it to MediaWiki:Vector.css.

Changelog[edit]

0.7.0
  • Removed I18n shim for php
  • Provided license information
0.6.1
  • Added capability to support additional skins
    • Added capability to specify additional skin -> CSS mappings in code and LocalSettings.php
    • Added dynamic "lookup" of user's current skin and will apply skin->CSS mapping dynamically
  • Added capability for sidebar view vice topbar view
  • Added support for SemanticTitle (does not require SemanticTitle to be present)
  • Removed seperate jquery.cookie library
  • Added ResourceLoader code to load mediawiki.cookie
  • Fixed random === critques
  • Set "show crumbs" to true by default
  • Updated variable usage to use mw.config due to deprication
  • Added variable for "pervasive wiki farm" linking
  • Changed "cookie link" storage and checking for duplicates to prevent issue when using query parameters causing duplicate crumbs
  • Changed way extension passes JavaScript config parameters to BreadCrumbs.js as we were experiencing a situation where parameters were not being passed to some instances of Mediawiki
0.6
  • I18n migrated to json
0.5
  • Changed the display of site names to (sitename) from sitename: to make a visual difference between project namespace, and site name
0.4
  • Added different site name support (when breadcrumbs are enabled on wiki farma, and they share the same cookie path)
  • Added support for preferences
    • Users can enable/disable bread crumbs
    • Users can enable/disable prepending sitename on titles
    • Users can set the number of bread crumbs to display
  • Delete cookies on log out
  • Removed some global preferences (replaced with default user options)
  • Fixed localization issue with namespaces
  • Only output Javascript/CSS when using the Vector skin
0.3
  • Display wgTitle instead of wgPage to avoid url encoded titles
  • Fix issue where wgJSBreadCrumbsMaxCrumbs + 1 number of bread crumbs were shown instead wgJSBreadCrumbsMaxCrumbs
  • Strip empty title and url when it exists
  • Change the output of the leading description to look like "Leading description:" instead of "Leading description " + wgJSBreadCrumbsSeparator, to make it more clear that it isn't part of the history.
  • Change the character used to split and join in cookies to '|' since it is illegal in urls and page titles, and therefore is guaranteed to work, unlike using the user overridable separator
  • Make addResources in JSBreadCrumbs.hooks.php public and static to get rid of php warning
0.2
  • Allow the separator character to be localized
  • Add preceding string to the breadcrumbs to describe their purpose on initial page load
0.1
  • Initial commit