User:V111P/js/smartLinkingLocalTemplate.js

< User:V111P‎ | js
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
/* With this script template, you can configure Smart Linking for use
 * in a Wikipedia other than the English one.
 * First copy the code to a different page,
 * it should be a protected page such as a user sub-page ending in .js or a MediaWiki: page,
 * then set appropriately the properties of the locale object below.
 * You can also translate the messages in the msgs object.
 * In order to reduce the size of this file, delete the excessive comments before using.
 * Smart Linking home: http://en.wikipedia.org/wiki/User:V111P/js/Smart_Linking
 */
(function () {
	"use strict";

	if ( $.inArray( mw.config.get( 'wgAction' ), ['edit', 'submit'] ) == -1 )
		return;

	var locale = {
		// If you have a local help page, type its address here
		helpUrl: '//en.wikipedia.org/wiki/User:V111P/js/Smart_Linking',

		// "Other meaning" and "main article" templates. The English Wikipedia has many of these, but most other Wikipedias
		// probably have much fewer.
		// You can use regular expressions in the strings. This may cause you problems if the names of your templates
		// contain characters such as ? * . + ( ) | Then you need to escape these characters with two slashes \\ before them.
		// See the option allPossibleOtherMeaningTemplates in the Customizing section on the help page. It can help you
		// to find all templates that need to be included here.
		otherMeaningTemplateNames: ['about', 'hatnote', 'rellink', 'other uses(\\d| of)?',
			'(two|three) other uses', 'see', 'see also\\d?', 'also', 'main( list)?', 'details\\d',
			'for\\d?', 'redirect(-synonym|text|-distinguish)?\\d?\\d?', 'further\\d?',
			'consider disambiguation', 'other people\\d?', 'other places\\d?', 'other hurricanes',
			'other ships', 'distinguish\\d?', 'elect',
			'year dab', 'more information'],

		// Disambiguation template names - these are the templates used on disambiguation pages to mark them as such.
		// This property is commented out because it is not needed on
		// wikis which have added __DISAMBIG__ to their disambiguation templates.
		// Check your local Special:DisambiguationPages page to see whether at least some of them have it already.
		// Check the categoy of your-language version of en:Template:Disambiguation to find all such templates.'
		// As with otherMeaningTemplateNames, you can use regexes and you may need to escape some characters.
		// Again, the English Wikipedia has a lot of these:
		//disambigTemplateNames: ['dab', 'disamb(ig)?', '([^|} ]+ )?disambiguation', 'Geodis', 'Hndis',
		//	'Letter-NumberCombDisambig', 'Numberdis', 'Set index article', 'Mountainindex',
		//	'Roadindex', 'Shipindex', 'Sportindex', 'Surname', 'Given name'],

		// Disambiguation page suffix. It is used at the end of the names of some, but not all, disambiguation pages
		// If your Wikipedia doesn't use a suffix, but something else (a prefix??),
		// or uses more than one suffixes, then let me now.
		// Incude the space before the suffix if there is one.
		// For example in [[America (disambiguation)]], the suffix is a space followed by (disambiguation).
		disambigPgSuffix: ' (disambiguation)'
	};

	var msgs = { // Translate these messages (optional). Remove the first // on a line to "activate" it
		//scriptName: 'Smart Linking',
		//noValidLink: 'No valid link was selected or focused.',
		//error: 'Error',
		//help: 'Help',
		//openInNewWin: 'Open in a new window',
		//editInNewWin: 'Edit in a new window',
		//editIntro: 'Edit the introduction', // link to open section 0 of the article for editing
		//history: 'History', // link to the article history
		//talk: 'Talk', // link to the talk page of the article
		//watch: 'Watch', // link to add the page to user's Watchlist
		//unwatch: 'Unwatch', // link to remove the page from user's Watchlist
		//disambigPage: 'Disambiguation page',
		//nonExistingPage: 'Non-existing page',
		//errorLoadingScript: 'Error loading required script {required script}.', // do NOT change/translate: {required script}
		//backTo: 'Back to [[%1]]', // Back to [[<the previous page's title>]]. Do NOT change: [[%1]]
		//relatedArticles: 'Related articles',
		//tableOfContents: 'Table of contents',
		//tocAndOtherAndMainArticles: 'ToC and other meanings and main articles:', // ToC means Table of Contents
		//backToTop: 'Back to top',
		//focusTextarea: 'Focus the textarea', // link and also title attribute of the OK button
		//close: 'Close', // link that, when clicked, closes/hides the display
		//toggleSectionLinks: 'Toggle displaying the section links',
		//aSpecialNSLink: 'A link to a page in the Special namespace.',
		//aLinkToSecInCurrEdPg: 'A link to a section in the page you are currently editing.',
		//errorOnLoading: 'Could not load page. Check your Internet connection.',
		//unsupportedBrowser: 'Unsupported browser'
	};

	$.extend(true, window.smartLinkingConfig = window.smartLinkingConfig || {}, {
		// you could add properties described in the Customizing section on the help page here
		locale: locale,
		msgs: msgs
	});

	$.ajax({
		url: '//en.wikipedia.org/w/index.php?title=User:V111P/js/smartLinkingLoader.js'
			+ '&action=raw&ctype=text/javascript',
		dataType: 'script',
		cache: true
	});
})();