MediaWiki
Gadget-breadcrumbs.js
From Dogcraft Wiki
No edit summary Tag: Reverted |
No edit summary Tag: Reverted |
||
Line 23: | Line 23: | ||
var serverInfo = "", | var serverInfo = "", | ||
siteContent = "", | siteContent = "", | ||
type = "", | |||
typeCategories = [ | typeCategories = [ | ||
" | "Stations", | ||
"Builds", | "Builds", | ||
"Events", | "Events", | ||
"Settlements", | |||
"Groups", | "Groups", | ||
"Phenomenon", | "Phenomenon", | ||
"Projects", | "Projects", | ||
"Worlds" | "Worlds" | ||
], | ], | ||
Line 47: | Line 48: | ||
world = worldCat( pageCategories ); | world = worldCat( pageCategories ); | ||
} | } | ||
if (pageCategories.includes('Bases')) { | |||
type = 'Builds > Bases > '; | |||
} | |||
var typesOnPage = pageCategories.filter(x => typeCategories.includes(x)); | |||
if ( typesOnPage.lenght > 1) { | |||
//page has more then one type category | |||
} | |||
type = typesOnPage[0] + " > "; | |||
$('#breadcrumbs-test').text('' + siteContent + serverInfo + world + ' > ' + mw.config.get( 'wgTitle' )); | $('#breadcrumbs-test').text('' + siteContent + serverInfo + world + ' > ' + type + mw.config.get( 'wgTitle' )); | ||
} | } | ||
}); | }); |
Revision as of 15:15, 3 July 2021
$(document).ready(function() {
/*$("#alertbutton-domino").click(function(){
mw.messages.set({'sandbox-test': 'Testing'});
var wiki_sandbox_obj = new mw.Message( mw.messages, 'sandbox-test' );
mw.log( wiki_sandbox_obj.text() );
mw.notify( mw.message( 'sandbox-test' ) );
});*/
function worldCat( pageCats ) {
var world;
for (var i = 0; i < pageCats.length; i++) {
if ( pageCats[i].indexOf('Survival ') > -1) {
world = pageCats[i] + '';
return world;
}
}
return false;
}
if ( mw.config.get('wgIsArticle') && (mw.config.get('wgNamespaceNumber') == 4 || mw.config.get('wgNamespaceNumber') == 0)) {
//var namespace = mw.config.get('wgFormattedNamespaces')[mw.config.get('wgNamespaceNumber')];
var serverInfo = "",
siteContent = "",
type = "",
typeCategories = [
"Stations",
"Builds",
"Events",
"Settlements",
"Groups",
"Phenomenon",
"Projects",
"Worlds"
],
pageCategories = mw.config.get('wgCategories');
if (pageCategories.includes('Site Content')) {
siteContent = 'Site Content > ';
}
if (pageCategories.includes('Server Information')) {
serverInfo = 'Server Information > ';
}
var world = '';
if ( worldCat( pageCategories ) != false) {
world = worldCat( pageCategories );
}
if (pageCategories.includes('Bases')) {
type = 'Builds > Bases > ';
}
var typesOnPage = pageCategories.filter(x => typeCategories.includes(x));
if ( typesOnPage.lenght > 1) {
//page has more then one type category
}
type = typesOnPage[0] + " > ";
$('#breadcrumbs-test').text('' + siteContent + serverInfo + world + ' > ' + type + mw.config.get( 'wgTitle' ));
}
});
This page was last modified on 3 July 2021, at 15:15. (3 months ago)