Toggle menu
7
27
38
5.2K
Sanarchive
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

MediaWiki:Common.js

MediaWiki interface page
Revision as of 20:23, 11 January 2026 by Pumpkin (talk | contribs)

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() {
    // Sadece anasayfada çalışması için kontrol
    if (!mw.config.get("wgIsMainPage")) return;

    // Menüyü oluştur
    var $dropdown = $('<div id="lang-switcher"></div>').css({
        "margin": "20px 0",
        "position": "relative",
        "display": "inline-block"
    });

    var $btn = $('<button>🌐 Dil Seçin / Select Language ▾</button>').css({
        "padding": "8px 15px",
        "cursor": "pointer",
        "background": "#fff",
        "border": "1px solid #a2a9b1",
        "border-radius": "2px"
    });

    var $menu = $('<div id="lang-menu"></div>').css({
        "display": "none",
        "position": "absolute",
        "bottom": "100%", // Yukarı doğru açılır
        "left": "0",
        "background": "#fff",
        "border": "1px solid #a2a9b1",
        "box-shadow": "0 -2px 5px rgba(0,0,0,0.2)",
        "z-index": "9999",
        "min-width": "180px"
    });

    // Linkleri ekle - Tam Liste
    var links = [
        { t: "Türkçe", u: "https://tr.sanarsiv.org/wiki/Ana_Sayfa" },
        { t: "Azərbaycanca", u: "https://az.sanarsiv.org/wiki/Ana_səhifə" },
        { t: "English", u: "https://en.sanarsiv.org/wiki/Main_Page" }
    ];

    $.each(links, function(i, link) {
        var $a = $('<a></a>').attr('href', link.u).text(link.t).css({
            "display": "block",
            "padding": "10px",
            "text-decoration": "none",
            "color": "#0645ad",
            "border-bottom": "1px solid #eee"
        });
        $menu.append($a);
    });

    $dropdown.append($btn).append($menu);

    // Ekleme Noktası: #bodyContent genellikle tüm MediaWiki temalarında vardır
    // Eğer hala görünmezse #mw-content-text olarak değiştirilebilir
    $("#bodyContent").append($dropdown);

    // Tıklama olayları
    $btn.on("click", function(e) {
        e.stopPropagation();
        $menu.toggle();
    });

    $(document).on("click", function() {
        $menu.hide();
    });
});