No edit summary |
No edit summary |
||
Line 9: | Line 9: | ||
var $cosmosTitleText = $('#cosmos-title-text'); | var $cosmosTitleText = $('#cosmos-title-text'); | ||
var prefixedTitle = $cosmosTitleText.text(); | var prefixedTitle = $cosmosTitleText.text(); | ||
var | var replacementText = nsNumber % 2 === 0 ? '' : 'Talk:'; | ||
var unprefixedTitle = prefixedTitle.replace(`${nsName}:`, replacementText); | |||
$('#cosmos-title-text').text(unprefixedTitle); | $('#cosmos-title-text').text(unprefixedTitle); |
Revision as of 11:11, 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 replacementText = nsNumber % 2 === 0 ? '' : 'Talk:';
var unprefixedTitle = prefixedTitle.replace(`${nsName}:`, replacementText);
$('#cosmos-title-text').text(unprefixedTitle);
}
removePrefixFromCustomNamespaces();
}());