MediaWiki:Common.js: Difference between revisions
Appearance
No edit summary |
No edit summary |
||
| Line 44: | Line 44: | ||
}); | }); | ||
}); | }); | ||
function | document.addEventListener("DOMContentLoaded", function () { | ||
const container = document.getElementById("dropdown-container"); | |||
if (!container) return; | |||
container.innerHTML = ` | |||
<select id="myDropdown"> | |||
<option value="">Select one</option> | |||
<option value="one">Raw Hide</option> | |||
<option value="two">Option 2</option> | |||
<option value="three">Option 3</option> | |||
</select> | |||
<div id="output" style="margin-top:10px;">Pick something above</div> | |||
`; | |||
if (value === "one") { | document.getElementById("myDropdown").addEventListener("change", function () { | ||
const value = this.value; | |||
const output = document.getElementById("output"); | |||
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"; | |||
} | |||
}); | |||
}); | |||
Revision as of 13:53, 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);
}
}
});
});
document.addEventListener("DOMContentLoaded", function () {
const container = document.getElementById("dropdown-container");
if (!container) return;
container.innerHTML = `
<select id="myDropdown">
<option value="">Select one</option>
<option value="one">Raw Hide</option>
<option value="two">Option 2</option>
<option value="three">Option 3</option>
</select>
<div id="output" style="margin-top:10px;">Pick something above</div>
`;
document.getElementById("myDropdown").addEventListener("change", function () {
const value = this.value;
const output = document.getElementById("output");
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";
}
});
});