Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump.
This code will be executed when previewing this page.
This code will be executed when previewing this page.
This user script seems to have a documentation page at User:Gommeh/Scripts/ShowBlockLog.
// <nowiki>
(function () {
'use strict';
// Namespace numbers on MediaWiki:
// 2 = User, 3 = User talk
var ns = mw.config.get('wgNamespaceNumber');
if (ns !== 2 && ns !== 3) return;
// On User/User talk pages, wgTitle is the part after the namespace,
// e.g. "Gommeh" or "Gommeh/Archives"
var fullTitle = mw.config.get('wgTitle');
if (!fullTitle) return;
// If we're on a subpage, only use the base username (before first "/")
var username = fullTitle.split('/')[0];
if (!username) return;
// Build the Special:Log URL for blocks against User:USERNAME
var pageParam = 'User:' + username;
var params = new URLSearchParams({
type: 'block',
user: '',
page: pageParam,
excludetempacct: '1',
wpdate: '',
tagfilter: '',
'wpfilters[]': 'newusers',
wpFormIdentifier: 'logeventslist',
});
var logUrl = mw.util.getUrl('Special:Log') + '?' + params.toString();
mw.loader.using(['jquery', 'mediawiki.util']).done(function () {
$(function () {
var link = mw.util.addPortletLink(
'p-tb', // toolbox
logUrl, // target URL
'Block log', // link text
'ca-user-blocklog', // id
'View this user’s block log'
);
if (link) {
link.target = '_blank';
link.rel = 'noopener';
}
});
});
})();
// </nowiki>