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: Revizyonlar arasındaki fark

MediaWiki arayüz sayfası
Değişiklik özeti yok
Değişiklik özeti yok
1. satır: 1. satır:
// ==========================================================================
// ==========================================================================
// KIZILBASHICA NİHAİ BİRLEŞİK JAVASCRIPT DOSYASI (AKILLI YAZAR DESTEKLİ)
// KIZILBASHICA JAVASCRIPT DOSYASI
// ==========================================================================
// ==========================================================================


7. satır: 7. satır:
     var pageName = mw.config.get('wgTitle');
     var pageName = mw.config.get('wgTitle');
     var baseUrl = mw.config.get('wgArticlePath') || '/wiki/$1';
     var baseUrl = mw.config.get('wgArticlePath') || '/wiki/$1';
    var action = mw.config.get('wgAction'); // Sayfa modunu alıyoruz (view, edit vb.)
      
      
    // ----------------------------------------------------------------------
     // 1. TARTIŞMA LİNKLERİNİ "KAYNAK" ALANINA YÖNLENDİRME
     // 1. TARTIŞMA LİNKLERİNİ "KAYNAK" ALANINA YÖNLENDİRME
    // ----------------------------------------------------------------------
     if (ns === 0) {
     if (ns === 0) {
         $('a[href*="Tart%C4%B1%C5%9Fma:"], a[href*="Talk:"]').each(function() {
         $('a[href*="Tart%C4%B1%C5%9Fma:"], a[href*="Talk:"]').each(function() {
17. satır: 16. satır:
     }
     }
      
      
    // ----------------------------------------------------------------------
     // 2. KAYNAK AD ALANINDA SADECE "VIEW" (OKUMA) MODUNDAYSAK ŞABLONU GÖSTER
     // 2. KAYNAK AD ALANINDA (ID: 3000) ŞABLONU VE YAZARLARI OTOMATİK ÇEKME
     // Eğer action 'edit' veya 'submit' ise (düzenleme ekranındaysanız) bu kod asla çalışmaz!
     // ----------------------------------------------------------------------
     if (ns === 3000 && action === 'view') {
     if (ns === 3000) {
         if ($('.noarticletext').length > 0 || $('.mw-noarticletext').length > 0 || mw.config.get('wgArticleId') === 0) {
         if ($('.noarticletext').length > 0 || $('.mw-noarticletext').length > 0 || mw.config.get('wgArticleId') === 0) {
              
              
27. satır: 25. satır:
             container.html('<div id="loading-cite" style="color: var(--kb-text-sub); font-style: italic; padding: 10px;">Kaynak arayüzü yükleniyor...</div>');
             container.html('<div id="loading-cite" style="color: var(--kb-text-sub); font-style: italic; padding: 10px;">Kaynak arayüzü yükleniyor...</div>');
              
              
            // Step A: Önce Kaynak Şablonunu Render Ediyoruz
             $.ajax({
             $.ajax({
                 url: mw.util.wikiScript('api'),
                 url: mw.util.wikiScript('api'),
39. satır: 36. satır:
                     if (data && data.parse && data.parse.text) {
                     if (data && data.parse && data.parse.text) {
                         container.html(data.parse.text['*']);
                         container.html(data.parse.text['*']);
                       
                        // Step B: Şablon yüklendikten sonra ana maddeden Yazar bilgisini canlı çekiyoruz
                        $.ajax({
                            url: mw.util.wikiScript('api'),
                            data: {
                                action: 'parse',
                                page: pageName,
                                format: 'json'
                            },
                            success: function(pageData) {
                                if (pageData && pageData.parse && pageData.parse.text) {
                                    // Ana maddenin HTML'ini sanal bir elemente yüklüyoruz
                                    var mainPageHtml = $('<div>').html(pageData.parse.text['*']);
                                    var yazarAlani = mainPageHtml.find('.yazar-alt-imza');
                                   
                                    if (yazarAlani.length > 0) {
                                        // "Yazar:" kelimesini ve noktaları temizleyip sadece isimleri alıyoruz
                                        var yazarMetni = yazarAlani.text().replace('Yazar:', '').replace(/\./g, ',').trim();
                                        // En sondaki fazla virgülü temizle
                                        yazarMetni = yazarMetni.replace(/,\s*$/, "").trim();
                                       
                                        if (yazarMetni) {
                                            // Kaynak kutusundaki yazar alanlarını dinamik olarak güncelle
                                            $('.kb-dinamik-yazar').text(yazarMetni);
                                            $('.kb-dinamik-yazar-wiki').text(yazarMetni);
                                        }
                                    }
                                }
                            }
                        });
                    } else {
                        container.html('<p>Kaynak şablonu yüklenirken bir hata oluştu.</p>');
                     }
                     }
                },
                error: function() {
                    container.html('<p>Kaynak şablonu API bağlantısı kurulamadı.</p>');
                 }
                 }
             });
             });
82. satır: 43. satır:
});
});


// ----------------------------------------------------------------------
// 3. DİNAMİK ELEMENT GÖZLEMCİSİ (KOMUT PALETİ TÜRKÇELEŞTİRME & ZAR BUTONU)
// 3. DİNAMİK ELEMENT GÖZLEMCİSİ (MUTATION OBSERVER)
// ----------------------------------------------------------------------
const observer = new MutationObserver((mutations) => {
const observer = new MutationObserver((mutations) => {
     mutations.forEach((mutation) => {
     mutations.forEach((mutation) => {
        // A. GENEL MENÜ TÜRKÇELEŞTİRME
         const menuHeadings = document.querySelectorAll('.citizen-menu__heading');
         const menuHeadings = document.querySelectorAll('.citizen-menu__heading');
         menuHeadings.forEach(heading => {
         menuHeadings.forEach(heading => {
             if (heading.textContent.trim() === 'Last modified') {
             if (heading.textContent.trim() === 'Last modified') heading.textContent = 'Son değişiklikler';
                heading.textContent = 'Son değişiklikler';
            }
         });
         });


        // B. KOMUT PALETİ İŞLEMLERİ
         const palette = document.querySelector('.citizen-command-palette');
         const palette = document.querySelector('.citizen-command-palette');
       
         if (palette) {
         if (palette) {
            // RASTGELE SAYFA (ZAR) BUTONU EKLEME
             const inputArea = palette.querySelector('.citizen-command-palette-header__input-area');
             const inputArea = palette.querySelector('.citizen-command-palette-header__input-area');
             const customBtnCheck = palette.querySelector('#citizen-custom-random-btn');
             const customBtnCheck = palette.querySelector('#citizen-custom-random-btn');
108. satır: 61. satır:
                 randomBtn.title = 'Rastgele Sayfa Getir';
                 randomBtn.title = 'Rastgele Sayfa Getir';
                 randomBtn.innerHTML = '<span class="citizen-ui-icon mw-ui-icon-wikimedia-die"></span>';
                 randomBtn.innerHTML = '<span class="citizen-ui-icon mw-ui-icon-wikimedia-die"></span>';
               
                 randomBtn.addEventListener('click', function() {
                 randomBtn.addEventListener('click', function() {
                     const randomUrl = mw.config.get('wgArticlePath') || '/wiki/$1';
                     window.location.href = (mw.config.get('wgArticlePath') || '/wiki/$1').replace('$1', 'Özel:Rastgele');
                    window.location.href = randomUrl.replace('$1', 'Özel:Rastgele');
                 });
                 });
               
                 inputArea.appendChild(randomBtn);
                 inputArea.appendChild(randomBtn);
             }
             }


             // PALET İÇİ TÜRKÇELEŞTİRMELER
             palette.querySelectorAll('*').forEach(el => {
            const allElements = palette.querySelectorAll('*');
                 if (el.childNodes.length === 1 && el.textContent.trim() === 'Recent') el.textContent = 'Son Aramalar';
            allElements.forEach(el => {
                 if (el.childNodes.length === 1 && el.textContent.trim() === 'Recent') {
                    el.textContent = 'Son Aramalar';
                }
             });
             });


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


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


             const note = palette.querySelector('[class*="footer-note"]');
             const note = palette.querySelector('[class*="footer-note"]');
             if (note) {
             if (note) {
                 const noteHTML = note.innerHTML;
                 if (note.innerHTML.includes('all commands')) note.innerHTML = 'Tüm komutlar için <code>/</code> yazın';
                if (noteHTML.includes('for all commands') || noteHTML.includes('all commands')) {
                 else if (note.innerHTML.includes('namespace')) note.innerHTML = 'Ad alanlarında aramak için <code>:</code> yazın';
                    note.innerHTML = 'Tüm komutlar için <code>/</code> yazın';
                 else if (note.innerHTML.includes('for users')) note.innerHTML = 'Kullanıcıları aramak için <code>@</code> yazın';
                 } else if (noteHTML.includes('for namespace') || noteHTML.includes('namespace')) {
                 else if (note.innerHTML.includes('for templates')) note.innerHTML = 'Şablonları aramak için <code>{{</code> yazın';
                    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';
                }
             }
             }


             const hints = palette.querySelectorAll('[class*="keyboard-hint"]');
             palette.querySelectorAll('[class*="keyboard-hint"]').forEach(hint => {
            hints.forEach(hint => {
                 const label = hint.querySelector('[class*="label"]');
                 const label = hint.querySelector('[class*="label"]');
                 if (label) {
                 if (label) {
                     const text = label.textContent.trim();
                     var txt = label.textContent.trim();
                     if (text === 'Select') label.textContent = 'Seç';
                     if (txt === 'Select') label.textContent = 'Seç';
                     else if (text === 'Navigate') label.textContent = 'Gezin';
                     else if (txt === 'Navigate') label.textContent = 'Gezin';
                     else if (text === 'Actions') label.textContent = 'Eylemler';
                     else if (txt === 'Actions') label.textContent = 'Eylemler';
                     else if (text === 'Close') label.textContent = 'Kapat';
                     else if (txt === 'Close') label.textContent = 'Kapat';
                 }
                 }
             });
             });
167. satır: 101. satır:
     });
     });
});
});
observer.observe(document.body, { childList: true, subtree: true });
observer.observe(document.body, { childList: true, subtree: true });

19.07, 7 Temmuz 2026 tarihindeki hâli

// ==========================================================================
// KIZILBASHICA JAVASCRIPT DOSYASI
// ==========================================================================

$(document).ready(function() {
    var ns = mw.config.get('wgNamespaceNumber');
    var pageName = mw.config.get('wgTitle');
    var baseUrl = mw.config.get('wgArticlePath') || '/wiki/$1';
    var action = mw.config.get('wgAction'); // Sayfa modunu alıyoruz (view, edit vb.)
    
    // 1. TARTIŞMA LİNKLERİNİ "KAYNAK" ALANINA YÖNLENDİRME
    if (ns === 0) {
        $('a[href*="Tart%C4%B1%C5%9Fma:"], a[href*="Talk:"]').each(function() {
            $(this).attr('href', baseUrl.replace('$1', 'Kaynak:' + encodeURIComponent(pageName)));
        });
    }
    
    // 2. KAYNAK AD ALANINDA SADECE "VIEW" (OKUMA) MODUNDAYSAK ŞABLONU GÖSTER
    // Eğer action 'edit' veya 'submit' ise (düzenleme ekranındaysanız) bu kod asla çalışmaz!
    if (ns === 3000 && action === 'view') {
        if ($('.noarticletext').length > 0 || $('.mw-noarticletext').length > 0 || mw.config.get('wgArticleId') === 0) {
            
            $('.noarticletext, .mw-noarticletext').hide();
            var container = $('#mw-content-text');
            container.html('<div id="loading-cite" style="color: var(--kb-text-sub); font-style: italic; padding: 10px;">Kaynak arayüzü yükleniyor...</div>');
            
            $.ajax({
                url: mw.util.wikiScript('api'),
                data: {
                    action: 'parse',
                    text: '{{AlıntıYap|madde=' + pageName + '}}',
                    contentmodel: 'wikitext',
                    format: 'json'
                },
                success: function(data) {
                    if (data && data.parse && data.parse.text) {
                        container.html(data.parse.text['*']);
                    }
                }
            });
        }
    }
});

// 3. DİNAMİK ELEMENT GÖZLEMCİSİ (KOMUT PALETİ TÜRKÇELEŞTİRME & ZAR BUTONU)
const observer = new MutationObserver((mutations) => {
    mutations.forEach((mutation) => {
        const menuHeadings = document.querySelectorAll('.citizen-menu__heading');
        menuHeadings.forEach(heading => {
            if (heading.textContent.trim() === 'Last modified') heading.textContent = 'Son değişiklikler';
        });

        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';
                randomBtn.innerHTML = '<span class="citizen-ui-icon mw-ui-icon-wikimedia-die"></span>';
                randomBtn.addEventListener('click', function() {
                    window.location.href = (mw.config.get('wgArticlePath') || '/wiki/$1').replace('$1', 'Özel:Rastgele');
                });
                inputArea.appendChild(randomBtn);
            }

            palette.querySelectorAll('*').forEach(el => {
                if (el.childNodes.length === 1 && el.textContent.trim() === 'Recent') el.textContent = 'Son Aramalar';
            });

            palette.querySelectorAll('[class*="badge"], [class*="item-badge"]').forEach(badge => {
                if (badge.textContent.trim() === 'Page') badge.innerHTML = 'Sayfa';
                else if (badge.textContent.trim() === 'Action') badge.innerHTML = 'Eylem';
            });

            palette.querySelectorAll('[class*="description"]').forEach(desc => {
                if (desc.textContent.trim() === 'Create or edit page') desc.textContent = 'Sayfa oluştur veya düzenle';
            });

            const note = palette.querySelector('[class*="footer-note"]');
            if (note) {
                if (note.innerHTML.includes('all commands')) note.innerHTML = 'Tüm komutlar için <code>/</code> yazın';
                else if (note.innerHTML.includes('namespace')) note.innerHTML = 'Ad alanlarında aramak için <code>:</code> yazın';
                else if (note.innerHTML.includes('for users')) note.innerHTML = 'Kullanıcıları aramak için <code>@</code> yazın';
                else if (note.innerHTML.includes('for templates')) note.innerHTML = 'Şablonları aramak için <code>{{</code> yazın';
            }

            palette.querySelectorAll('[class*="keyboard-hint"]').forEach(hint => {
                const label = hint.querySelector('[class*="label"]');
                if (label) {
                    var txt = label.textContent.trim();
                    if (txt === 'Select') label.textContent = 'Seç';
                    else if (txt === 'Navigate') label.textContent = 'Gezin';
                    else if (txt === 'Actions') label.textContent = 'Eylemler';
                    else if (txt === 'Close') label.textContent = 'Kapat';
                }
            });
        }
    });
});
observer.observe(document.body, { childList: true, subtree: true });