MediaWiki

Gadget-breadcrumbs.js

From Dogcraft Wiki

No edit summary
Tag: Reverted
No edit summary
Tag: Reverted
Line 7: Line 7:
mw.notify( mw.message( 'sandbox-test' ) );
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)) {
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 namespace = mw.config.get('wgFormattedNamespaces')[mw.config.get('wgNamespaceNumber')];
var serverInfo = "",
var serverInfo = "",
siteContent = "";
siteContent = "",
typeCategories = [
"Bases",
"Builds",
"Events",
"Groups",
"Phenomenon",
"Projects",
"Stations",
"Worlds"
],
pageCategories = mw.config.get('wgCategories');
if (mw.config.get('wgCategories').includes('Site Content')) {
if (pageCategories.includes('Site Content')) {
siteContent = 'Site Content > ';
siteContent = 'Site Content > ';
}
}
if (mw.config.get('wgCategories').includes('Server Information')) {
if (pageCategories.includes('Server Information')) {
serverInfo = 'Server Information > ';
serverInfo = 'Server Information > ';
}
}
var worldCat = '';
var world = '';
for (var i = 0; i < mw.config.get('wgCategories').length; i++) {
if ( worldCat( pageCategories ) != false) {
if ( mw.config.get('wgCategories')[i].indexOf('Survival ') > -1) {
world = worldCat( pageCategories );
    worldCat = mw.config.get('wgCategories')[i] + '';
        break;
}
}
}
$('#breadcrumbs-test').text('' + siteContent + serverInfo + worldCat + ' > ' + mw.config.get( 'wgTitle' ));
$('#breadcrumbs-test').text('' + siteContent + serverInfo + world + ' > ' + mw.config.get( 'wgTitle' ));
}
}
});
});

Revision as of 14:59, 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 = "",
			typeCategories = [
				"Bases",
				"Builds",
				"Events",
				"Groups",
				"Phenomenon",
				"Projects",
				"Stations",
				"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 );
		}
		
		
		$('#breadcrumbs-test').text('' + siteContent + serverInfo + world + ' > ' + mw.config.get( 'wgTitle' ));
	
	}
		
});
This page was last modified on 3 July 2021, at 14:59. (3 months ago)
Background Takeshi by Edo