MediaWiki:Common.js
MediaWiki interface page
More languages
More actions
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
$(function () {
if (!mw.config.get("wgIsMainPage")) return;
var host = location.hostname;
var dropdown = $(`
<div id="languageDropdown" style="
position:fixed;
top:10px;
right:20px;
z-index:99999;
font-size:14px;
">
<button type="button" style="
padding:6px 10px;
cursor:pointer;
">🌐 Language ▾</button>
<div id="languageDropdownContent" style="
display:none;
background:#fff;
border:1px solid #ccc;
margin-top:4px;
box-shadow:0 2px 6px rgba(0,0,0,.2);
"></div>
</div>
`);
var content = dropdown.find("#languageDropdownContent");
if (host === "tr.sanarsiv.org") {
content.append('<a href="https://tr.sanarsiv.org/">Türkçe</a>');
content.append('<a href="https://az.sanarsiv.org/wiki/Ana_səhifə">Azərbaycanca</a>');
} else if (host === "az.sanarsiv.org") {
content.append('<a href="https://az.sanarsiv.org/wiki/Ana_səhifə">Azərbaycanca</a>');
content.append('<a href="https://tr.sanarsiv.org/">Türkçe</a>');
}
content.find("a").css({
display: "block",
padding: "8px 12px",
textDecoration: "none",
color: "#000"
});
$("body").append(dropdown);
$("#languageDropdown button").on("click", function (e) {
e.stopPropagation();
content.toggle();
});
$(document).on("click", function () {
content.hide();
});
});