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
113. satır: 113. satır:
///  ///  ///
///  ///  ///
///  ///  ///
///  ///  ///
// Citizen Komut Paleti Tam Türkçeleştirme
const observer = new MutationObserver((mutations) => {
    mutations.forEach((mutation) => {
        mutation.addedNodes.forEach((node) => {
            if (node.nodeType === 1) {
                // Palet açıldıysa ana kapsayıcıyı bul
                const palette = node.classList && node.classList.contains('citizen-command-palette')
                    ? node
                    : node.querySelector('.citizen-command-palette');
               
                if (palette) {
                    // 1. "Recent" Başlığı
                    const recentHeader = palette.querySelector('.citizen-command-palette__header, .citizen-command-palette__group-title');
                    if (recentHeader && recentHeader.textContent.trim() === 'Recent') {
                        recentHeader.textContent = 'Son Aramalar';
                    }
                    // 2. Sağ taraftaki "Page" ve "Action" Rozetleri
                    const badges = palette.querySelectorAll('.citizen-command-palette__item-badge');
                    badges.forEach(badge => {
                        const badgeText = badge.textContent.trim();
                        if (badgeText === 'Page') badge.textContent = 'Sayfa';
                        if (badgeText === 'Action') badge.textContent = 'Eylem';
                    });
                    // 3. "Create or edit page" Açıklamaları
                    const descriptions = palette.querySelectorAll('.citizen-command-palette__item-description');
                    descriptions.forEach(desc => {
                        if (desc.textContent.trim() === 'Create or edit page') {
                            desc.textContent = 'Sayfa oluştur veya düzenle';
                        }
                    });
                    // 4. Sol alttaki "Type / for all commands" Uyarısı
                    const note = palette.querySelector('.citizen-command-palette__footer-note');
                    if (note && !note.classList.contains('tr-not-hazir')) {
                        // Eğer içinde "for all commands" geçiyorsa değiştir
                        if (note.innerHTML.includes('for all commands')) {
                            note.innerHTML = 'Tüm komutlar için <code>/</code> yazın';
                        } else if (note.innerHTML.includes('for namespace')) {
                            note.innerHTML = 'Ad alanlarında aramak için <code>:</code> yazın';
                        }
                        note.classList.add('tr-not-hazir');
                    }
                    // 5. Alt taraftaki Tuş İpuçları (Seç, Gezin, Eylemler, Kapat)
                    const hints = palette.querySelectorAll('.citizen-keyboard-hint');
                    hints.forEach(hint => {
                        const label = hint.querySelector('.citizen-keyboard-hint-label');
                        if (label && !label.classList.contains('tr-hazir')) {
                            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';
                            label.classList.add('tr-hazir');
                        }
                    });
                }
            }
        });
    });
});
// Tüm sayfayı dinamik değişiklikler için izle
observer.observe(document.body, { childList: true, subtree: true });

10.43, 7 Temmuz 2026 tarihindeki hâli

/* Ana Sayfa Son Değişiklikler Feed Motoru - Tıklayınız İbareli Sürüm */
mw.loader.using(['mediawiki.api', 'mediawiki.util'], function () {
    $(document).ready(function () {
        var $feedContainer = $('#wiki-recent-js-feed');
        if (!$feedContainer.length) return;

        var api = new mw.Api();
        
        // Sadece ana maddeleri (Namespace 0) listeler
        api.get({
            action: 'query',
            list: 'recentchanges',
            rcnamespace: 0, 
            rclimit: 5,
            rctype: 'edit|new',
            format: 'json'
        }).done(function (data) {
            var items = data.query.recentchanges;
            if (!items || items.length === 0) {
                $feedContainer.html('<div style="color:#666; padding:20px; text-align:center;">Henüz bir değişiklik bulunmuyor.</div>');
                return;
            }

            var titles = items.map(function (item) { return item.title; });

            // Sayfa görsellerini çek
            api.get({
                action: 'query',
                titles: titles.join('|'),
                prop: 'pageimages',
                piprop: 'thumbnail',
                pithumbsize: 160,
                format: 'json'
            }).done(function (imgData) {
                var pages = imgData.query.pages;
                var imageMap = {};
                
                for (var pageId in pages) {
                    var p = pages[pageId];
                    if (p.thumbnail && p.thumbnail.source) {
                        imageMap[p.title] = p.thumbnail.source;
                    }
                }

                var htmlOutput = '';
                
                items.forEach(function (item) {
                    var pageTitle = item.title;
                    var pageLink = mw.util.getUrl(pageTitle);
                    var imgUrl = imageMap[pageTitle];

                    htmlOutput += '<div class="wiki-recent-row">' +
                        '<div class="wiki-recent-text">' +
                            '<div class="wiki-recent-title"><a href="' + pageLink + '">' + pageTitle + '</a></div>' +
                            '<div class="wiki-recent-subtext"><a href="' + pageLink + '">Okumak için tıklayınız</a></div>' +
                        '</div>' +
                        '<div class="wiki-recent-img-wrapper">';
                    
                    if (imgUrl) {
                        htmlOutput += '<a href="' + pageLink + '"><img src="' + imgUrl + '" alt="' + pageTitle + '"></a>';
                    } else {
                        htmlOutput += '<a href="' + pageLink + '"><div class="wiki-recent-empty-thumb"></div></a>';
                    }
                    
                    htmlOutput += '</div></div>';
                });

                $feedContainer.html(htmlOutput);
            });
        }).fail(function () {
            $feedContainer.html('<div style="color:#888; padding:20px; text-align:center;">Akış yüklenirken bir sorun oluştu.</div>');
        });
    });
});
/* Arama Paleti Her Açıldığında Rastgele Sayfa Butonunu Yeniden Oluşturan Kesin Çözüm */
$( function () {
	// Butonu ekleyen fonksiyon
	function injectRandomButton() {
		var $inputArea = $( '.citizen-command-palette-header__input-area' );
		if ( $inputArea.length && !$( '#citizen-custom-random-btn' ).length ) {
			var randomBtn = $( '<a>' )
				.attr( {
					id: 'citizen-custom-random-btn',
					href: '/m/Özel:Rastgele',
					title: 'Rastgele Sayfa Getir'
				} )
				.html( '<span class="citizen-ui-icon mw-ui-icon-die mw-ui-icon-wikimedia-die"></span>' );

			$inputArea.append( randomBtn );
		}
	}

	// Sayfa ilk yüklendiğinde eğer palet açıksa ekle
	injectRandomButton();

	// Vue.js element silme/ekleme hareketlerini (DOM değişikliklerini) sürekli izleyen gözlemci
	var observer = new MutationObserver( function ( mutations ) {
		mutations.forEach( function ( mutation ) {
			if ( mutation.addedNodes.length ) {
				injectRandomButton();
			}
		} );
	} );

	// Bütün sayfayı ve dinamik açılan pencereleri izlemeye al
	observer.observe( document.body, {
		childList: true,
		subtree: true
	} );
} );
/////////////
///  ///  ///
///  ///  ///
///  ///  ///
// Citizen Komut Paleti Tam Türkçeleştirme
const observer = new MutationObserver((mutations) => {
    mutations.forEach((mutation) => {
        mutation.addedNodes.forEach((node) => {
            if (node.nodeType === 1) {
                // Palet açıldıysa ana kapsayıcıyı bul
                const palette = node.classList && node.classList.contains('citizen-command-palette') 
                    ? node 
                    : node.querySelector('.citizen-command-palette');
                
                if (palette) {
                    // 1. "Recent" Başlığı
                    const recentHeader = palette.querySelector('.citizen-command-palette__header, .citizen-command-palette__group-title');
                    if (recentHeader && recentHeader.textContent.trim() === 'Recent') {
                        recentHeader.textContent = 'Son Aramalar';
                    }

                    // 2. Sağ taraftaki "Page" ve "Action" Rozetleri
                    const badges = palette.querySelectorAll('.citizen-command-palette__item-badge');
                    badges.forEach(badge => {
                        const badgeText = badge.textContent.trim();
                        if (badgeText === 'Page') badge.textContent = 'Sayfa';
                        if (badgeText === 'Action') badge.textContent = 'Eylem';
                    });

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

                    // 4. Sol alttaki "Type / for all commands" Uyarısı
                    const note = palette.querySelector('.citizen-command-palette__footer-note');
                    if (note && !note.classList.contains('tr-not-hazir')) {
                        // Eğer içinde "for all commands" geçiyorsa değiştir
                        if (note.innerHTML.includes('for all commands')) {
                            note.innerHTML = 'Tüm komutlar için <code>/</code> yazın';
                        } else if (note.innerHTML.includes('for namespace')) {
                            note.innerHTML = 'Ad alanlarında aramak için <code>:</code> yazın';
                        }
                        note.classList.add('tr-not-hazir');
                    }

                    // 5. Alt taraftaki Tuş İpuçları (Seç, Gezin, Eylemler, Kapat)
                    const hints = palette.querySelectorAll('.citizen-keyboard-hint');
                    hints.forEach(hint => {
                        const label = hint.querySelector('.citizen-keyboard-hint-label');
                        if (label && !label.classList.contains('tr-hazir')) {
                            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';
                            label.classList.add('tr-hazir');
                        }
                    });
                }
            }
        });
    });
});

// Tüm sayfayı dinamik değişiklikler için izle
observer.observe(document.body, { childList: true, subtree: true });