MediaWiki:Gadget-wikificator.js

Vikipēdijas lapa

Piezīme: Lai redzētu izmaiņas, pēc publicēšanas var nākties iztīrīt sava pārlūka kešatmiņu.

  • Firefox / Safari: Pieturi Shift un klikšķini uz Pārlādēt vai nospied Ctrl-F5 vai Ctrl-R (⌘-R uz Mac)
  • Google Chrome: Nospied Ctrl-Shift-R (⌘-Shift-R uz Mac)
  • Internet Explorer / Edge: Pieturi Ctrl un klikšķini uz Pārlādēt vai nospied Ctrl-F5
  • Opera: Nospied Ctrl-F5.
// <nowiki>
( function () {

var wmFullText = 'Vikifikators apstrādās visu tekstu. Turpināt?',
	wmTalkPage = 'Vikifikators neapstrādā diskusiju lapas pilnībā.\n\nIezīmē savus ziņojumus — tiks apstrādāti tikai tie';
window.wfPlugins = window.wfPlugins || [];
window.wfPluginsT = window.wfPluginsT || [];


// Function takes an input or text as an argument. If it is absent, it uses $( '#wpTextbox1' )
// as an input.
window.Wikify = function ( inputOrText ) {
	'use strict';

	var $input, text, caretPosition, textScroll,
		txt = '',
		hidden = [],
		winScroll = document.documentElement.scrollTop,
		$CodeMirrorVscrollbar = $( '.CodeMirror-vscrollbar' );

	// Check what's in the first parameter
	if ( typeof inputOrText === 'string' ) {
		text = inputOrText;
	} else {
		$input = $( ( inputOrText &&
				( ( inputOrText.nodeType && inputOrText.value !== undefined ) || // node
					( inputOrText.prop && inputOrText.prop( 'nodeType' ) ) // jQuery object
				)
			) ?
			inputOrText :
			'#wpTextbox1'
		);
	}


	// FUNCTIONS

	function r( r1, r2 ) {
		txt = txt.replace( r1, r2 );
	}

	function hide( re ) {
		r( re, function ( s ) {
			return '\x01' + hidden.push( s ) + '\x02';
		} );
	}

	function hideTag ( tag ) {
		hide( new RegExp( '<' + tag + '( [^>]+)?>[\\s\\S]+?<\\/' + tag + '>', 'gi' ) );
	}

	function hideTemplates() {
		hide( /\{\{([^{]\{?)+?\}\}/g );
		var pos = 0,
			stack = [],
			tpl,
			left,
			right;
		while ( true ) {
			left = txt.indexOf( '{{', pos );
			right = txt.indexOf( '}}', pos );
			if ( left === -1 && right === -1 && !stack.length ) {
				break;
			}
			if ( left !== -1 && ( left < right || right === -1 ) ) {
				stack.push( left );
				pos = left + 2;
			} else {
				left = stack.pop();
				if ( typeof left === 'undefined' ) {
					if ( right === -1 ) {
						pos += 2;
						continue;
					} else {
						left = 0;
					}
				}
				if ( right === -1 ) {
					right = txt.length;
				}
				right += 2;
				tpl = txt.substring( left, right );
				txt = txt.substring( 0, left ) +
					'\x01' + hidden.push( tpl ) + '\x02' +
					txt.substr( right );
				pos = right - tpl.length;
			}
		}
	}
	
	function processLink( link, left, right ) {
		left = $.trim( left.replace( /[ _\u00A0]+/g, ' ' ) );
		if ( left.match( /^(?:Kategorija|Attēls) ?:/ ) ) {
			return '[[' + left + '|' + right + ']]';
		}
		right = $.trim( right.replace( / {2,}/g, ' ' ) );
		var inLink = right.substr( 0, left.length );
		var afterLink = right.substr( left.length );
		var uniLeft = left.substr( 0, 1 ).toUpperCase() + left.substr( 1 );
		var uniRight = ( right.substr( 0, 1 ).toUpperCase() + right.substr( 1 ) ).replace( /[_\u00A0]/g, ' ' );
		if ( uniRight.indexOf( uniLeft ) === 0 && afterLink.match( /^[a-zа-яё]*$/ ) ) {
			return '[[' + inLink + ']]' + afterLink;
		} else {
			return '[[' + left + '|' + right + ']]';
		}
	}

	function processText() {
		var i,
			u = '\u00A0'; // non-breaking space
		if ( mw.config.get( 'wgNamespaceNumber' ) % 2 || mw.config.get( 'wgNamespaceNumber' ) === 4 ) { // is talk page
			var sigs = txt.match( /\d\d:\d\d, \d\d? \S{3,8} 20\d\d \(UTC\)/g );
			if ( sigs && sigs.length > 1 ) {
				alert( wmTalkPage );
				return;
			}
		}

		hideTag('nowiki');
		hideTag('pre');
		hideTag('source');
		hideTag('syntaxhighlight');
		hideTag('code');
		hideTag('tt');
		hideTag('math');
		hideTag('timeline');

		r(/( |\n|\r)+\{\{(·|•|\*)\}\}/g, '{{$2}}'); // before {{·/•/*}}, usually in templates
		r(/\{\{\s*(veidne|template):([\s\S]+?)\}\}/ig, '{{$2}}');
		//r(/\<ref\s+(name|group)=\s*"?([^"]+)"?\/\>/gi, '<ref $1="$2" />');

		// veidņu nosaukumu tīrīšana
		r(/(\{\{\s*)reflist(\s*[\|\}])/ig, '$1Atsauces$2');
		r(/\{\{[Vv]al\-(?!(aizmetnis|stub))/g, '{{val|');
		r(/\{\{\s*commons\s?cat\|/ig, '{{Commons category|');
		r(/\{\{\s*commons\s?cat-inline/ig, '{{Commons category-inline');
		r(/\{\{\s*URL/ig, '{{URL');
		r(/\{\{\s*cite web/ig, '{{Tīmekļa atsauce');
		r(/\{\{\s*cite news/ig, '{{Ziņu atsauce');
		r(/\{\{\s*hokejista\sinfokaste\sv2/ig, '{{Hokejista infokaste');
		r(/\{\{\s*fact\s*\}\}/ig, '{{nepieciešama atsauce}}');
		r(/\{\{\s*imdb\stitle/ig, '{{IMDB filma');
		r(/\{\{\s*angliski\s*\}\}/ig, '{{en ikona}}');
		r(/\{\{\s*film\sdate/ig, '{{Filmas datums');
		r(/\{\{\s*imdb/ig, '{{IMDB');
		r(/\{\{\s*us\$/ig, '{{ASV dolārs');
		r(/British\sBoard\sof\sFilm\sClassification/g, 'Britu filmu klasifikācijas padome');

		hide(/<br>/mg);
		r(/<[\/\\]?(hr|br)( [^\/\\>]+?)? ?[\/\\]?>/gi, '<$1$2 />');
		hideTemplates();
		hide(/^ .*/mg);
		hide(/(https?|ftp|news|nntp|telnet|irc|gopher):\/\/[^\s\[\]<>"]+ ?/gi);
		hide(/^#\s?redirect/i);
		hideTag('gallery');

		r(/ +(\n|\r)/g, '$1'); // spaces at EOL
		txt = '\n' + txt + '\n';

		// LINKS
		r(/(\[\[:?)(category|kategorija):( *)/ig, '$1Kategorija:');
		r(/(\[\[:?)(image|file):( *)/ig, '$1Attēls:');
		// attēli
		r(/(\[\[Attēls:[^\n\|\]]+?\|thumb)\|right/g, '$1');
		r(/(\[\[Attēls:[^\n\|\]]+?)\|right(\|thumb)/g, '$1$2');
		r(/(\[\[Attēls:[^\|\]]+\|[^\|\]]+)\.\]\]/g, '$1]]');
		// Nice links
		r(/(\[\[[^|\[\]]*)[\u00AD\u200E\u200F]+([^\[\]]*\]\])/g, '$1$2'); // Soft Hyphen & DirMark
		r(/\[\[ *([^|\[\]]+) *\| *(\1)([a-zа-яё]*) *\]\]/ig, '[[$2]]$3');
		r(/\[\[ *([^|\[\]]+)([^|\[\]()]+) *\| *\1 *\]\]\2/g, '[[$1$2]]'); // text repetition after link
		r(/\[\[ *(?!Attēls:|Kategorija:)([a-zA-Zа-яёА-ЯЁ\u00A0-\u00FF %!\"$&'()*,\-—.\/0-9:;=?\\@\^_`’~]+) *\| *([^\|\[\]]+) *\]\]([a-zа-яё]+)/g, '[[$1|$2$3]]'); // "
		r(/\[\[ *([^\|]+)\|("|'''?)\1\2\]\]/g, '$2[[$1]]$2'); // vienkāršota Vizuālajā redaktorā veidota saite
		hide(/\[\[[^\]|]+/g); // only link part

		// nbsp + mērvienība
		r(/(\b\d?,?\.?\d+)[\s\u00a0]*([cmknuµ][mgWN]|m?mol|cd|mi|lb[fs]?|b?hp|mph|ft|dB|[kGM]?Hz|m\/s|°[CF])\b/gi, '$1 $2');

		// TAGS
		r(/<<(\S.+\S)>>/g, '"$1"'); // << >>
		r(/(su[pb]>)-(\d)/g, '$1−$2'); // ->minus
		r(/<(b|strong)>(.*?)<\/(b|strong)>/gi, "'''$2'''");
		r(/<(i|em)>(.*?)<\/(i|em)>/gi, "''$2''");
		r(/^<hr ?\/?>/gim, '----');
		r(/[\u00A0 \t]*<ref(?:\s+name="")?(\s|>)/gi, '<ref$1');
		r(/(\n== *[a-z\s\.:]+ *==\n+)<references *\/>/gi, '$1{' + '{atsauces}}');
		// TAGS - no vācu autoformatter
		r(/(<\/?s)trike\b/gi, '$1');
		r(/<sub\s*(>[^<>]*<)\s*(?:su[bp]\s*[.\/\\]+|[.\/\\]+\s*su[bp])\s*>/gi, '<sub$1/sub>');
		r(/<sup\s*(>[^<>]*<)\s*(?:su[bp]\s*[.\/\\]+|[.\/\\]+\s*su[bp])\s*>/gi, '<sup$1/sup>');
		r(/(<font\b[^<>]*?)\s+fa\w+(?:[\s"',=]*(?:Arial|Helvetica(?:\W?N\w*)?|sans\W?serif)\b)+[\s"';]*(?=\s\w+\s*=|>)/gi, '$1');
		r(/(<font\b[^<>]*?)\s+size[\s"',=]*(?:-1\b|2\b|100\b[ ,.]*\d*%|1(?:\.0*)?em\b)["';]*/gi, '$1');
		r(/<(font|span)\s*>\s*((?:<(?!\1)|[^<])*?)\s*<\/\1[^<>]*>/gi, '$2');
		r(/<font\s+color[\s"',=]*(#[\dA-F]{3,6}|[a-z]{3,20})[\s"';]*>((?:<(?!font)|[^<])*?)<\/font[^<>]*>/gi, '<span style="color:$1;">$2<\/span>');
		r(/<font\s+size[\s"',=]*(?:-[2-9]|[01])[\s"';]*>((?:<(?!font)|[^<])*?)<\/font[^<>]*>/gi, '<small>$1<\/small>');
		r(/<font\s+size[\s"',=]*(?:[+-]0|3)[\s"';]*>((?:<(?!font)|[^<])*?)<\/font[^<>]*>/gi, '<span style="font-size:larger;">$1<\/span>');
		r(/<(abbr|cite|mark|q|s|small|u)\s*><(font|span)\s+style\s*=\s*["']?([^\n"<>]*?);?["']?\s*>([^<>]*)<\/\2\s*>\s*(?=<\/\1\s*>)/gi, '<$1 style="$3;">$4');
		r(/(<span\b[^<>]*?)\s+style\s*=\s*["']?([^\n"<>]*?);?["']?\s*><span\s+style\s*=\s*["']?([^\n"<>]*?);?["']?\s*>([^<>]*)<\/span\s*>\s*(?=<\/span\s*>)/gi, '$1 style="$2;$3;">$4');
		r(/<(?:[\s\/\\]*br\b)+\s*(\s\w[^<>]*?)?[\s.\/\\]*>/gi, '<br$1 />');
		r(/ *<br \/>(?=\n[\n#*:;])/gi, '');
		r(/<(ref|small|su[bp])\b\s*(\s\w[^<>]*?)?\s*><small\s*>([^<>]*)<\/small\s*><\/\1\s*>/gi, '<$1$2>$3<\/$1>');
		r(/<small\s*><(ref|small|su[bp])\b\s*(\s\w[^<>]*?)?\s*?( ?\/|>[^<>]*<\/\1)\s*><\/small\s*>/gi, '<$1$2$3>');
		hide(/<[a-z][^>]*?>/gi);

		// URL
		r(/\b(?:http(s?)(?::+\/*|\/\/+:*)\b)+/gi, 'http$1://');
		r(/\[+ *(https?:\/\/[^\n[\]]*?) *\]+/gi, '[$1]');
		r(/(\[https?:\/\/[^\s[\]|]*?) *\| *(?=[^\s=[\]|]+\])/gi, '$1 ');
		r(/(\[https?:\/\/\w[\w.-]*\w\.\w+) +/gi, '$1/ ');

		hide(/^(\{\||\|\-).*/mg); // table/row def
		hide(/(^\||^!|!!|\|\|) *[a-z]+=[^|]+\|(?!\|)/mgi); // cell style
		hide(/\| +/g); // formatted cell

		r(/[ \t\u00A0]+/g, ' '); // double spaces

		// Entities etc. → Unicode chars
		if ( mw.config.get( 'wgNamespaceNumber' ) !== 10 ) {
			r( /&(#x[0-9a-f]{2,4}|#[0-9]{3,4}|[0-9a-z]{2,8});/gi, function ( s ) {
				var t = document.createElement( 'textarea' );
				t.innerHTML = s;
				var c = t.value;
				if ( c.length === 1 && c.charCodeAt( 0 ) > 127 || s === '&#x20;' ) {
					return c;
				}
				return s;
			});
		}
		r(/\(tm\)/gi, '™');
	//    r(/\.\.\./g, '…');
		r(/(^|[^+])\+-(?!\+|-)/g, '$1±');
		r(/~=/g, '≈');
	//    r(/\^2(\D)/g, '²$1');
	//    r(/\^3(\D)/g, '³$1');
	//    r(/(\s)кв\.\s*(дм|см|мм|мкм|нм|км|м)(\s)/g, '$1' + u + '$2²$3');
	//    r(/(\s)куб\.\s*(дм|см|мм|мкм|нм|км|м)(\s)/g, '$1' + u + '$2³$3');
	//    r(/((?:^|[\s"])\d+(?:[\.,]\d+)?)\s*[xх]\s*(\d+(?:[\.,]\d+)?)\s*([мm]{1,2}(?:[\s"\.,;?!]|$))/g, '$1×$2' + u + '$3');
	//    r(/([\wa-žA-Ž])'([\wa-žA-Ž])/g, '$1’$2'); //'
		r(/№№/g, '№');
		r(/mmHg/g, 'mm Hg');
		// m2 -> m<sup>2</sup> u.t.t. ; sia, a/s, as?

		// Headings
		r(/^(=+)[ \t\f\v]*(.*?)[ \t\f\v]*=+$/gm, '$1 $2 $1'); //add spaces inside
		r(/([^\r\n])(\r?\n==.*==\r?\n)/g, '$1\n$2'); //add empty line before
		//r(/^-(\.?|tie|ajos|ie|to|ajos) ?$/gmi, '.');
		//r(/^== sk(at|atīt|atie[st])?\.? arī ==$/gmi, '== Skatīt arī ==');
		//r(/^== ār[eē]j[āa]s saites ==$/gmi, '== Ārējās saites ==');
	//    r(/^== внешние\sссылки ==$/gmi, '== Ссылки ==');
		r(/^(=+) (.+)[.:] \1$/gm, '$1 $2 $1');
		r(/^(=+) '''(?!.*'''.*''')(.+)''' \1$/gm, '$1 $2 $1');
		r(/^(=+) *(.*[^\s=:]) *:? *\1$/gm, '$1 $2 $1');

	//    r(/“|”|„/g, '"'); // temp

		// Hyphens and en dashes to pretty dashes
		r(/–/g, '—'); // &ndash; -> &mdash;
		r(/\s(\d\.?\s?)[–-](\s?\d\.?)\s/g, ' $1—$2 '); // ISBN jāatfiltrē
		r(/\(\s?(\d+)\.?\s?[–—-]\s?(\d+)\.?\s?\)/g, '($1—$2)');
	//    r(/([A-Ža-ž])[–-](\s[A-Ža-ž])/g, '$1 —$2'); //Grenz- und Auslanddeutschtum
	//    r(/(\s)-{1,3} /g, '$1— '); // hyphen -> &mdash;
	//    r(/(\d)--(\d)/g, '$1—$2'); // -> &mdash;
	//    r(/(\s)-(\d)/g, '$1−$2'); // hyphen -> minus

		// Reductions
		r(/ISBN:\s?(?=[\d\-]{8,17})/, 'ISBN ');
	//    r(/\[\[(\d+)\.?\s?(gads)?(\|\1)?\]\]/g, '$1');

		// Insert/delete spaces
		r(/^([#*:]+)[ \t\f\v]*(?!\{\|)([^ \t\f\v*#:;])/gm, '$1 $2'); // space after #*: unless before table
		r(/(\S)[\u00A0 \t](-{1,3}|—)[\u00A0 \t](\S)/g, '$1' + u + '— $3');
		r(/([A-Ž]\.) ?([A-Ž]\.) ?([А-ЯЁ][а-яё])/g, '$1' + u + '$2' + u + '$3');
	//    r(/([A-Ž]\.)([A-Ž]\.)/g, '$1 $2');
	//    r(/([až]"?\)?[\.\?!:])((?:\x01\d+\x02\|)?[A-ZА-ЯЁ])/g, '$1 $2'); // word. word
	//    r(/([)"až\]²³])\s*([,:])([\[("až])/g, '$1$2 $3'); // word, word
	//    r(/([)"až\]²³])\s([,;])\s([\[("až])/g, '$1$2 $3');
	//    r(/([^%\/\wА-Яа-яЁё]\d+?(?:[\.,]\d+?)?) ?([%‰])(?!-[А-Яа-яЁё])/g, '$1$2'); //5 %
		r(/(\d) ([%‰])(?=-[A-Žа-яЁё])/g, '$1$2'); //5%-й
		r(/([№§])(\s*)(\d)/g, '$1' + u + '$3');
		// inside ()
		r(/\( +/g, '(');
		r(/ +\)/g, ')');
		r(/\'\'\(([^\)]+)\)\'\'/g, "(''$1'')");


		// Temperature
		r(/([\s\d=≈≠≤≥<>—("'|])([+±−\-]?\d+?(?:[.,]\d+?)?)(([ °\^*]| [°\^*])(C|F))(?=[\s"').,;!?|\x01])/gm, '$1$2' + u + '°$5'); //'

		// Dot → comma in numbers
	 //   r(/(\s\d+)\.(\d+[\u00A0 ]*[%‰°×])/gi, '$1,$2');

		// Plugins
		for ( i in window.wfPlugins ) {
			if ( window.wfPlugins.hasOwnProperty( i ) ) {
				window.wfPlugins[i]( txt, r );
			}
		}

		// "" → «»
		/*
		for ( i = 1; i <= 2; i++ ) {
			r( /([\s\x02!|#'"\/([{;+\-])"([^"]*)([^\s"([{|])"([^a-zа-яё])/ig, '$1«$2$3»$4' ); // "
		}
		while ( /«[^»]*«/.test( txt ) ) {
			r( /«([^»]*)«([^»]*)»/g, '«$1„$2“' );
		}
		*/
		function unhide( s, num ) {
			return hidden[ num - 1 ];
		}
		while ( txt.match( /\x01\d+\x02/ ) ) {
			r( /\x01(\d+)\x02/g, unhide );
		}

		txt = txt.substr( 1, txt.length - 2 ); // compensation for "txt = '\n' + txt + '\n';"
	}

	function processAllText() {
		txt = $input ? $input.textSelection( 'getContents' ) : text;
		processText();
		if ( $input ) {
			r( /^[\n\r]+/, '' );
			
			// 2017 wikitext editor adds an empty line to the end with every text replacement
			// Remove the following block when [[phab:T198010]] is fixed.
			if ( window.ve && ve.init && ve.init.target && ve.init.target.active ) {
				r( /[\n\r]+$/, '' );
			}
			
			$input.textSelection( 'setContents', txt );
			if ( caretPosition ) {
				$input.textSelection( 'setSelection', {
					start: caretPosition[0] > txt.length ? txt.length : caretPosition[0]
				} );
			}
		} else {
			text = txt;
		}
		if ( window.auto_comment &&
			window.insertSummary &&
			!document.editform.wpSection.value
		) {
			window.insertSummary( 'викификатор' );
		}
	}


	// MAIN CODE

	if ( $input ) {
		$input.focus();
		
		caretPosition = $input.textSelection( 'getCaretPosition', { startAndEnd: true } );
		if ( caretPosition ) {
			textScroll = ( $CodeMirrorVscrollbar.length ? $CodeMirrorVscrollbar : $input )
				.scrollTop();
			if ( caretPosition[0] === caretPosition[1] ) {
				processAllText();
			} else {
				txt = $input.textSelection( 'getSelection' );
				processText();
				// replaceSelection doesn't work with MediaWiki 1.30 in case this gadget is loaded
				// from other wiki
				$input.textSelection( 'encapsulateSelection', {
					replace: true,
					peri: txt
				} );
				// In CodeMirror, the selection isn't preserved, so we do it explicitly
				$input.textSelection( 'setSelection', {
					start: caretPosition[0],
					end: caretPosition[0] + txt.length
				} );
			}
			( $CodeMirrorVscrollbar.length ? $CodeMirrorVscrollbar : $input )
				.scrollTop( textScroll );
		// If something went wrong
		} else if ( confirm( wmFullText ) ) {
			processAllText();
		}
	} else {
		processAllText();
		return text;
	}

	// scroll back, for 2017 wikitext editor, IE, Opera
	document.documentElement.scrollTop = winScroll;
};


/* Toolbar buttons */

var addOldToolbarButton = function () {
	var $toolbar = $( '#gadget-toolbar' );
	if ( !$toolbar.length ) {
		$toolbar = $( '#toolbar' );
	}
	$( '<div>' )
		.addClass( 'mw-toolbar-editbutton' )
		.attr( 'alt', 'Vikifikators' )
		.attr( 'title', 'Vikifikators' )
		.css( {
			'width': '69px',
			'backgroundImage': 'url(//upload.wikimedia.org/wikipedia/commons/4/42/Toolbaricon_regular_f.png)'
		} )
		.appendTo( $toolbar )
		.on( 'click', Wikify );
};

var addNewToolbarButton = function () {
	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
		'section': 'main',
		'group': 'insert',
		'tools': {
			'wikif': {
				label: 'Vikifikators',
				type: 'button',
				icon: '//upload.wikimedia.org/wikipedia/commons/4/42/Toolbaricon_regular_f.png',
				action: {
					type: 'callback',
					execute: Wikify
				}
			}
		}
	} );

	mw.hook( 'wikieditor.toolbar.wikificator' ).fire();
};

if ( $.inArray( mw.config.get( 'wgAction' ), [ 'edit', 'submit' ] ) !== -1 ) {
	mw.loader.using( [ 'user.options', 'jquery.textSelection' ], function () {
		if ( mw.user.options.get( 'usebetatoolbar' ) === 1 ) {
			$.when(
				mw.loader.using( 'ext.wikiEditor' ),
				$.ready
			).then( function () {
				addNewToolbarButton();
			} );
		} else {
			mw.hook( 'legacy.toolbar.ready' ).add( function () {
				$( addOldToolbarButton );
			});
		}
	} );
}


/* VisualEditor code */

window.createVEWikificatorTool = function () {
	// Create and register a command
	function WikifyCommand() {
		WikifyCommand.parent.call( this, 'wikificator' );
	}
	OO.inheritClass( WikifyCommand, ve.ui.Command );

	// Forbid the command from being executed in the visual mode
	WikifyCommand.prototype.isExecutable = function () {
		var surface = ve.init.target.getSurface();
		return surface && surface.getMode() === 'source';
	};

	WikifyCommand.prototype.execute = function ( surface ) {
		Wikify();
		return true;
	};

	if ( ve.ui.wikitextCommandRegistry ) {
		ve.ui.wikitextCommandRegistry.register( new WikifyCommand() );
	}

	// Create and register a tool
	function WikificatorTool() {
		WikificatorTool.parent.apply( this, arguments );
	}
	OO.inheritClass( WikificatorTool, ve.ui.Tool );

	WikificatorTool.static.name = 'wikificator';
	WikificatorTool.static.group = 'utility';
	WikificatorTool.static.title = 'Vikifikators';
	WikificatorTool.static.icon = 'wikify';
	WikificatorTool.static.commandName = 'wikificator';
	WikificatorTool.static.autoAddToCatchall = false;
	WikificatorTool.static.deactivateOnSelect = false;

	WikificatorTool.prototype.onUpdateState = function () {
		WikificatorTool.parent.prototype.onUpdateState.apply( this, arguments );
		this.setActive( false );
	};

	ve.ui.toolFactory.register( WikificatorTool );
};

}() );
// </nowiki>