Menüyü değiştir
Toggle preferences menu
Kişisel menüyü aç / kapat
Oturum açık değil
Your IP address will be publicly visible if you make any edits.

MediaWiki:Common.js

MediaWiki arayüz sayfası
10.55, 7 Temmuz 2026 tarihinde C. Karakuş (mesaj | katkılar) tarafından oluşturulmuş 501 numaralı sürüm

Not: Yayımladıktan sonra değişiklikleri görmeniz için tarayıcınızın önbelleğini temizlemeniz gerekebilir.

  • Firefox / Safari: Shift tuşuna basılıyken Yeniden Yükle'ye tıklayın ya da Ctrl-F5 ya da Ctrl-R tıklayın (Mac için ⌘-R)
  • Google Chrome: Ctrl-Shift-R'ye basın. (Mac için ⌘-Shift-R)
  • Edge: Ctrl basılıyken Yenile'ye tıklayın ya da Ctrl-F5'e basın.
// ==========================================
// KIZILBASHICA BİRLEŞİK JS KODU
// (Komut Paleti + Menü Türkçeleştirme + Zar İkonu)
// ==========================================

const observer = new MutationObserver((mutations) => {
    mutations.forEach((mutation) => {
        // --------------------------------------
        // GENEL MENÜ TÜRKÇELEŞTİRME (YENİ)
        // --------------------------------------
        // "Last modified" başlığını bul ve değiştir
        const menuHeadings = document.querySelectorAll('.citizen-menu__heading');
        menuHeadings.forEach(heading => {
            if (heading.textContent.trim() === 'Last modified') {
                heading.textContent = 'Son güncelleme';
            }
        });

        // --------------------------------------
        // RASTGELE SAYFA (ZAR) BUTONU ENTEGRASYONU
        // --------------------------------------
        const palette = document.querySelector('.citizen-command-palette');
        
        if (palette) {
            const inputArea = palette.querySelector('.citizen-command-palette-header__input-area');
            const customBtnCheck = palette.querySelector('#citizen-custom-random-btn');
            
            if (inputArea && !customBtnCheck) {
                const randomBtn = document.createElement('div');
                randomBtn.id = 'citizen-custom-random-btn';
                randomBtn.title = 'Rastgele Sayfa Getir';
                
                // İstediğiniz orijinal Wikimedia zar ikon yapısı:
                randomBtn.innerHTML = '<span class="citizen-ui-icon mw-ui-icon-wikimedia-die"></span>';
                
                randomBtn.addEventListener('click', function() {
                    const baseUrl = mw.config.get('wgArticlePath') || '/wiki/$1';
                    window.location.href = baseUrl.replace('$1', 'Özel:Rastgele');
                });
                
                inputArea.appendChild(randomBtn);
            }

            // --------------------------------------
            // KOMUT PALETİ TÜRKÇELEŞTİRME KISMI
            // --------------------------------------
            
            // 1. "Recent" Başlığı İçin Derin Arama
            const allElements = palette.querySelectorAll('*');
            allElements.forEach(el => {
                if (el.childNodes.length === 1 && el.textContent.trim() === 'Recent') {
                    el.textContent = 'Son Aramalar';
                }
            });

            // 2. Sağ taraftaki "Page" ve "Action" Rozetleri
            const badges = palette.querySelectorAll('[class*="badge"], [class*="item-badge"], .citizen-command-palette__item-badge');
            badges.forEach(badge => {
                const text = badge.textContent.trim();
                if (text === 'Page') {
                    badge.innerHTML = 'Sayfa';
                } else if (text === 'Action') {
                    badge.innerHTML = 'Eylem';
                }
            });

            // 3. "Create or edit page" Açıklamaları
            const descriptions = palette.querySelectorAll('[class*="description"], [class*="item-description"]');
            descriptions.forEach(desc => {
                if (desc.textContent.trim() === 'Create or edit page') {
                    desc.textContent = 'Sayfa oluştur veya düzenle';
                }
            });

            // 4. Sol alttaki Değişken Alt Not Alanları
            const note = palette.querySelector('[class*="footer-note"]');
            if (note) {
                const noteHTML = note.innerHTML;
                if (noteHTML.includes('for all commands') || noteHTML.includes('all commands')) {
                    note.innerHTML = 'Tüm komutlar için <code>/</code> yazın';
                } else if (noteHTML.includes('for namespace') || noteHTML.includes('namespace')) {
                    note.innerHTML = 'Ad alanlarında aramak için <code>:</code> yazın';
                } else if (noteHTML.includes('to search for users') || noteHTML.includes('for users')) {
                    note.innerHTML = 'Kullanıcıları aramak için <code>@</code> yazın';
                } else if (noteHTML.includes('to search for templates') || noteHTML.includes('for templates')) {
                    note.innerHTML = 'Şablonları aramak için <code>{{</code> yazın';
                }
            }

            // 5. Alt taraftaki Tuş İpuçları
            const hints = palette.querySelectorAll('[class*="keyboard-hint"]');
            hints.forEach(hint => {
                const label = hint.querySelector('[class*="label"]');
                if (label) {
                    const text = label.textContent.trim();
                    if (text === 'Select') label.textContent = 'Seç';
                    else if (text === 'Navigate') label.textContent = 'Gezin';
                    else if (text === 'Actions') label.textContent = 'Eylemler';
                    else if (text === 'Close') label.textContent = 'Kapat';
                }
            });
        }
    });
});

// Sayfayı izlemeye al
observer.observe(document.body, { childList: true, subtree: true });