(function($, mw) {
if ( $.inArray( mw.config.get( 'wgAction' ), [ 'edit', 'submit' ] ) === -1 ) {
	return;
}
mw.loader.using( 'user.options', function () {
	if ( mw.user.options.get('usebetatoolbar') ) {
		mw.loader.using('ext.wikiEditor', function () {
			$(document).ready( function() {
				var $textbox = $('#wpTextbox1');
				toolbox( $textbox, $);
			});
		});
	}
});

function toolbox($textbox, $) {
	$textbox.wikiEditor( 'addToToolbar', {
		'section': 'main',
		'group': 'format',
		'tools': {
			'underline': {
				label: 'underline',
				type: 'button',
				icon: '//upload.wikimedia.org/wikipedia/commons/8/8b/Button_underline_he.png',
				action: {
					type: 'encapsulate',
					options: { pre: "<u>", peri: "text", post: "</u>" }
				}
			},
			'strikethrough': {
				label: 'strikeout',
				type: 'button',
				icon: '//upload.wikimedia.org/wikipedia/commons/6/6d/Vector_strikeout.png',
				action: {
					type: 'encapsulate',
					options: { pre: "<s>", peri: "text", post: "</s>" }
				}
			}
		}
	});
	text_type($textbox, $);
}

function text_type($textbox, $) {

var sourcetext_type = [
['text', 'Text'],
['abap', 'ABAP'],
['actionscript', 'ActionScript'],
['ada', 'Ada'],
['apache', 'Apache'],
['applescript', 'AppleScript'],
['asm', 'ASM'],
['asp', 'Active Server Pages'],
['autoit', 'AutoIt'],
['bash', 'Bash'],
['basic4gl', 'Basic4GL'],
['bf', 'Brainfuck'],
['blitzbasic', 'Blitz BASIC'],
['bnf', 'Backus-Naur Form'],
['c', 'C'],
['c_mac', 'C (Mac)'],
['caddcl', 'AutoCAD DCL'],
['cadlisp', 'AutoLISP'],
['cfdg', 'CFDG'],
['cfm', 'ColdFusion'],
['cil', 'Common Intermediate Language'],
['cobol', 'COBOL'],
['cpp-qt', 'C++ (Qt toolkit)'],
['cpp', 'C++'],
['csharp', 'C#'],
['css', 'Cascading Style Sheets'],
['d', 'D'],
['delphi', 'Delphi'],
['diff', 'Diff'],
['div', 'DIV'],
['dos', 'DOS batch file'],
['dot', 'DOT'],
['eiffel', 'Eiffel'],
['fortran', 'Fortran'],
['freebasic', 'FreeBASIC'],
['genero', 'Genero'],
['gettext', 'i18n'],
['glsl', 'OpenGL Shading Language'],
['gml', 'Game Maker Language'],
['gnuplot', 'gnuplot'],
['groovy', 'Groovy'],
['haskell', 'Haskell'],
['hq9plus', 'HQ9+'],
['html4strict', 'HTML'],
['idl', 'Uno IDL'],
['ini', 'INI'],
['inno', 'Inno'],
['intercal', 'INTERCAL'],
['io', 'Io'],
['java5', 'Java 5.0'],
['java', 'Java'],
['javascript', 'JavaScript'],
['kixtart', 'KiXtart'],
['klonec', 'Klone C'],
['klonecpp', 'Klone C++'],
['latex', 'LaTeX'],
['lisp', 'Lisp'],
['lolcode', 'LOLCODE'],
['lotusscript', 'LotusScript'],
['lua', 'Lua'],
['m68k', 'Motorola 68000 Assembler'],
['make', 'make'],
['matlab', 'MATLAB M'],
['mirc', 'mIRC scripting language'],
['mxml', 'MXML'],
['mpasm', 'Microchip Assembler'],
['mysql', 'MySQL'],
['nsis', 'Nullsoft Scriptable Install System'],
['objc', 'Objective-C'],
['ocaml-brief', 'OCaml Brief'],
['ocaml', 'OCaml'],
['oobas', 'OpenOffice Basic'],
['oracle8', 'Oracle 8 SQL'],
['oracle11', 'Oracle 11 SQL'],
['pascal', 'Pascal'],
['per', 'per'],
['perl', 'Perl'],
['php-brief', 'PHP Brief'],
['php', 'PHP'],
['pixelbender', 'Pixel Bender'],
['plsql', 'PL/SQL'],
['povray', 'Persistence of Vision Raytracer'],
['powershell', 'Windows PowerShell'],
['progress', 'OpenEdge ABL'],
['prolog', 'Prolog'],
['providex', 'ProvideX'],
['python', 'Python'],
['qbasic', 'QBasic/QuickBASIC'],
['rails', 'Rails'],
['reg', 'Windows Registry'],
['robots', 'robots.txt'],
['ruby', 'Ruby'],
['rsplus', 'R/S+'],
['sas', 'SAS'],
['scala', 'Scala'],
['scheme', 'Scheme'],
['scilab', 'Scilab'],
['sdlbasic', 'SdlBasic'],
['smalltalk', 'Smalltalk'],
['smarty', 'Smarty'],
['sql', 'SQL'],
['tcl', 'Tcl'],
['teraterm', 'Tera Term'],
['thinbasic', 'thinBasic'],
['tsql', 'Transact-SQL'],
['typoscript', 'TypoScript'],
['vbnet', 'Visual Basic .NET'],
['vb', 'Visual Basic'],
['verilog', 'Verilog'],
['vhdl', 'VHDL'],
['vim', 'Vimscript'],
['visualfoxpro', 'Visual FoxPro'],
['visualprolog', 'Visual Prolog'],
['whitespace', 'Whitespace'],
['winbatch', 'Winbatch'],
['xml', 'XML'],
['xorg_conf', 'Xorg.conf'],
['xpp', 'X++'],
['z80', 'ZiLOG Z80 Assembler']
],

source_list = {
	label: 'Text Type',
	type: 'select',
	list: {
		teletype: {
			label: 'teletype',
			'action': { 'type': 'encapsulate', 'options': { 'pre': '<tt>', 'peri': 'text', 'post': '</tt>' } }
		},
		code: {
			'label': 'inline code',
			'action': { 'type': 'encapsulate', 'options': { 'pre': '<code>', 'peri': 'text', 'post': '</code>' } }
		}
	}
};

$.eachAsync(sourcetext_type, {
	'delay': 1,
	'bulk': 0,
	'loop': function(index, value) {
		var name = value[1], lang = value[0];
		source_list.list[name] = {
			'label': name,
			'action': {
				'type': 'encapsulate',
				'options': {
					'pre': '<syntaxhighlight lang="'+ lang + '">\n',
					'post': '\n</syntaxhighlight>',
					ownline: true
				}
			}
		};
	},
	'end': function() {
		$textbox.wikiEditor( 'addToToolbar', {
			'section': 'advanced',
			'group': 'heading',
			'tools': {
				'text-type': source_list
			}
		});		
	}
});

}
})(jQuery, mediaWiki);
"https://si.wikibooks.org/w/index.php?title=සැකිල්ල:Common.js/Toolbox.js&oldid=18996" වෙතින් සම්ප්‍රවේශනය කෙරිණි