(Created page with "→All JavaScript here will be loaded for users of the Cosmos skin: (function() { function removePrefixFromCustomNamespaces() { let nsNumber = mw.config.get('wgN...") |
No edit summary |
||
Line 2: | Line 2: | ||
(function() { | (function() { | ||
function removePrefixFromCustomNamespaces() { | function removePrefixFromCustomNamespaces() { | ||
var nsNumber = mw.config.get('wgNamespaceNumber'); | |||
if (nsNumber < 3000) { | if (nsNumber < 3000) { | ||
return; | return; | ||
} | } | ||
var nsName = mw.config.get('wgCanonicalNamespace').split('_').join(' '); | |||
var $cosmosTitleText = $('#cosmos-title-text'); | |||
var prefixedTitle = $cosmosTitleText.text(); | |||
var unprefixedTitle = prefixedTitle.replace(`${nsName}:`, nsNumber % 2 === 0 ? '' : 'Talk:'); | |||
$('#cosmos-title-text').text(unprefixedTitle); | $('#cosmos-title-text').text(unprefixedTitle); |
Revision as of 11:09, 4 January 2023
/* All JavaScript here will be loaded for users of the Cosmos skin */
(function() {
function removePrefixFromCustomNamespaces() {
var nsNumber = mw.config.get('wgNamespaceNumber');
if (nsNumber < 3000) {
return;
}
var nsName = mw.config.get('wgCanonicalNamespace').split('_').join(' ');
var $cosmosTitleText = $('#cosmos-title-text');
var prefixedTitle = $cosmosTitleText.text();
var unprefixedTitle = prefixedTitle.replace(`${nsName}:`, nsNumber % 2 === 0 ? '' : 'Talk:');
$('#cosmos-title-text').text(unprefixedTitle);
}
removePrefixFromCustomNamespaces();
}());