Jump to content

User:The Earwig/copyvios.js

From Wikipedia, the free encyclopedia
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.
/*
	Adds a toolbox link to do a copyvio check on the current page.

	Install by adding:
		importScript('User:The Earwig/copyvios.js'); // [[User:The Earwig/copyvios.js]]
	to your [[Special:MyPage/common.js]].
*/

mw.loader.using('mediawiki.util', function() {
	if (mw.config.get('wgNamespaceNumber') < 0) {
		return;
	}
	var url = 'https://copyvios.toolforge.org/?lang=' + mw.config.get('wgContentLanguage') +
		'&project=' + mw.config.get('wgSiteName').toLowerCase() +
		'&title=' + encodeURIComponent(mw.config.get('wgPageName'));
	if (mw.config.get('wgRevisionId') !== mw.config.get('wgCurRevisionId') ||
			mw.util.getParamValue('oldid') !== null) {
		url += '&oldid=' + encodeURIComponent(mw.config.get('wgRevisionId'));
	}
	mw.util.addPortletLink(
		'p-tb',
		url,
		'Copyvio check',
		't-copyvio-check',
		'Check this page for copyright violations'
	);
});