MediaWiki:Common.js
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
// Display current page in breadcrumbs
$(document).ready(function() {
var breadcrumbs = $('#mw-content-subtitle');
if (breadcrumbs.length) {
// Get the current page title and extract the last segment
var currentTitle = mw.config.get('wgPageName');
var currentPageDisplay = currentTitle.split('/').pop();
var subpages = breadcrumbs.find('.subpages');
if (subpages.length) {
// If subpages exist, replace < and | with >
subpages.html(subpages.html().replace(/<\s*/, '').replace(/\s*\|\s*/g, ' > '));
}
// Create a breadcrumb item for the current page
var currentItem = $('<span class="breadcrumb-current"></span>')
.text(currentPageDisplay);
// Add separator and current page
breadcrumbs.append('<span class="breadcrumb-separator"> > </span>').append(currentItem);
}
});