Difference between revisions of "MediaWiki:Common.js"
From Pathfinder Wiki
DesignerThan (talk | contribs) |
DesignerThan (talk | contribs) |
||
Line 17: | Line 17: | ||
'n-Investiture-Achievement', | 'n-Investiture-Achievement', | ||
'n-Master-Guide', | 'n-Master-Guide', | ||
− | |||
]; | ]; | ||
Revision as of 21:43, 29 July 2022
/* Any JavaScript here will be loaded for all users on every page load. */
console.log('Test');
const interfaceLang = document.documentElement.lang;
const navItems = [
'n-Home',
'n-All-Honors',
'n-Arts.2C-Crafts.2C-and-Hobbies',
'n-Health-and-Science',
'n-Household-Arts',
'n-Nature',
'n-Outdoor-Industries',
'n-Recreation',
'n-Spiritual-Growth.2C-Outreach-and-Heritage',
'n-Vocational',
'n-Honor-Pilots',
'n-Investiture-Achievement',
'n-Master-Guide',
];
if (interfaceLang !== 'en') {
navItems.forEach((item) => {
const parent = document.getElementById(item);
if (parent) {
if (parent.childNodes[0] && parent.childNodes[0].tagName === 'A' ) {
parent.childNodes[0].href += `/${interfaceLang}`;
}
}
});
}