User:Sokratis12GR/common/toolbar.js

/** * Creates a Infobox for Armors * * @author User:sokratis12GR */ 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/0/0a/Icon_RedstoneChestplate.png ',				action: {					type: 'encapsulate',					options: {						pre: '{' + '{Infobox\n|name=' + page + '\n|imageicon=' + '' + '\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);		}	}); }