User:Sokratis12GR/common/toolbar.js

var customizeToolbar = function{ var page = mw.config.get('wgTitle'); $('#wpTextbox1').wikiEditor('addToToolbar', {		'section': 'templates',		'group': 'infoboxes',		'tools': {			'armor': {				label: 'Armor',				type: 'button',				icon: '//hydra-media.cursecdn.com/ftb.gamepedia.com/5/51/Icon_Mod.png',				action: {					type: 'encapsulate',					options: {						pre: '{' + '{Infobox\n|name=' + page + '\n|imageicon=' + page + '\n|mod=Mod\n|type=armor\n|durability=1\n|armorrating=1\n|toughness=1\n}}'					}				}			}		}	}); };

/* Check if view is in edit mode and adds toolbar.*/ if($.inArray(mw.config.get('wgAction'), ['edit', 'submit']) !== -1){ mw.loader.using('user.options', function{		if(mw.user.options.get('usebetatoolbar') == 1){			$.when(mw.loader.using('ext.wikiEditor.toolbar'), $.ready).then(customizeToolbar);		}	}); }