Difference between revisions 237604 and 237605 on ptwikibooks

/**
 * TemplateScript
 * Adds a menu of configurable templates and scripts to the sidebar
 * @author: [[m:user:Pathoschild]] ([[meta:User:Pathoschild/Scripts/TemplateScript]])
 * @author: [[User:Helder.wiki]] (this configuration file)
 * @tracking: [[Special:GlobalUsage/User:Helder.wiki/Tools/TemplateScript.js]] ([[File:User:Helder.wiki/Tools/TemplateScript.js]])
 */
/*global jQuery, mediaWiki, LanguageConverter, pathoschild */
(contracted; show full)
function fixLists( context ){
	oldText = context.$target.val();

	regex( context, [{
		find: /\s*\n;([^\n]+)\n([^:])/g,
		replace: '\n;$1\n:$2'
	}], '+
[[' +
		(mw.config.get( 'wgDBname' ) === 'ptwiki'? '' : 'w:') +
		'Special:PermaLink/31511942|semântica]] na lista de definições (;:)' );

	regex( context, [{
		// Deixa apenas 1 espaço entre *, # ou : e o texto da lista
		find: /^(:+[*#]+[*#:]*|:+(?![\{:])|[*#][*#:]*|:+[*#]+[*#:]*)\s*/gm,
		replace: '$1 '
	}], 'format. listas' );
}

function abs2rel( context ){
	if (mw.config.get( 'wgPageName' ) === mw.config.get( 'wgBookName' ) ){
		// Troca underscores por espaços
(contracted; show full)		name: 'Corrige assinatura',
		script: fixSignature,
		isMinorEdit: true
	}, {
		name: 'Corrige links HTTP',
		script: fixHTTPLinks,
		isMinorEdit: true

	}, {
		name: 'Formatação geral',
		script: generalFixes
	}]);

	switch( mw.config.get( 'wgDBname' ) ) {
	case 'ptwiki':
		pathoschild.TemplateScript.AddWith({
			forActions: 'edit'
		},[{
			name: 'Usar "Ver também,..."',
(contracted; show full)			script: usingRegex
		});
	}
}

$.getScript( '//meta.wikimedia.org/w/index.php?title=User:Pathoschild/Scripts/TemplateScript/dev.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400', loadMyRegexTools );

}( jQuery, mediaWiki ) );