MediaWiki:Common.js: Difference between revisions
Appearance
No edit summary |
No edit summary |
||
| Line 45: | Line 45: | ||
}); | }); | ||
function updateContent() { | function updateContent() { | ||
var value = document.getElementById("myDropdown").value; | var value = document.getElementById("myDropdown")?.value; | ||
var output = document.getElementById("output"); | var output = document.getElementById("output"); | ||
| Line 51: | Line 51: | ||
if (value === "one") { | if (value === "one") { | ||
output.innerHTML = " | output.innerHTML = "Nothing"; | ||
} else if (value === "two") { | } else if (value === "two") { | ||
output.innerHTML = "This is content for Option 2"; | output.innerHTML = "This is content for Option 2"; | ||
Revision as of 13:50, 21 April 2026
mw.loader.using('mediawiki.util').then(function () {
$(function () {
// Rename Discussion → Discord
const talkTab = document.querySelector('#ca-talk a');
const talkItem = document.querySelector('#ca-talk');
if (talkTab) {
talkTab.textContent = 'Discord';
talkTab.href = 'https://discord.gg/FZtkXeGeUA';
talkTab.target = '_blank';
talkTab.rel = 'noopener noreferrer';
talkTab.addEventListener('click', function (e) {
e.preventDefault();
window.open('https://discord.gg/FZtkXeGeUA', '_blank');
});
}
// Add Road Map BEFORE Discord
const tabList = document.querySelector('#p-associated-pages .vector-menu-content-list, #p-namespaces .vector-menu-content-list');
if (tabList && !document.getElementById('ca-roadmap')) {
const li = document.createElement('li');
li.id = 'ca-roadmap';
li.className = talkItem ? talkItem.className.replace(/\bselected\b|\bactive\b/g, '').trim() : 'mw-list-item';
const a = document.createElement('a');
a.href = 'https://ohwikiguide.com/index.php/Road_Map';
const span = document.createElement('span');
span.textContent = 'Road Map';
a.appendChild(span);
li.appendChild(a);
if (talkItem) {
tabList.insertBefore(li, talkItem);
} else {
tabList.appendChild(li);
}
}
});
});
function updateContent() {
var value = document.getElementById("myDropdown")?.value;
var output = document.getElementById("output");
if (!output) return;
if (value === "one") {
output.innerHTML = "Nothing";
} else if (value === "two") {
output.innerHTML = "This is content for Option 2";
} else if (value === "three") {
output.innerHTML = "This is content for Option 3";
} else {
output.innerHTML = "Pick something above";
}
}