MediaWiki:Common.js: Revizyonlar arasındaki fark
MediaWiki arayüz sayfası
More actions
C. Karakuş (mesaj | katkılar) Değişiklik özeti yok |
C. Karakuş (mesaj | katkılar) Değişiklik özeti yok |
||
| 1. satır: | 1. satır: | ||
// ========================================================================== | // ========================================================================== | ||
// KIZILBASHICA | // 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 ( | // 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>'); | ||
$.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['*']); | ||
} | } | ||
} | } | ||
}); | }); | ||
| 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İ ( | |||
const observer = new MutationObserver((mutations) => { | const observer = new MutationObserver((mutations) => { | ||
mutations.forEach((mutation) => { | mutations.forEach((mutation) => { | ||
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'; | ||
}); | }); | ||
const palette = document.querySelector('.citizen-command-palette'); | const palette = document.querySelector('.citizen-command-palette'); | ||
if (palette) { | if (palette) { | ||
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() { | ||
window.location.href = (mw.config.get('wgArticlePath') || '/wiki/$1').replace('$1', 'Özel:Rastgele'); | |||
}); | }); | ||
inputArea.appendChild(randomBtn); | inputArea.appendChild(randomBtn); | ||
} | } | ||
palette.querySelectorAll('*').forEach(el => { | |||
if (el.childNodes.length === 1 && el.textContent.trim() === 'Recent') el.textContent = 'Son Aramalar'; | |||
if (el.childNodes.length === 1 && el.textContent.trim() === 'Recent') | |||
}); | }); | ||
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'; | |||
else if ( | |||
}); | }); | ||
palette.querySelectorAll('[class*="description"]').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') | |||
}); | }); | ||
const note = palette.querySelector('[class*="footer-note"]'); | const note = palette.querySelector('[class*="footer-note"]'); | ||
if (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"]'); | const label = hint.querySelector('[class*="label"]'); | ||
if (label) { | if (label) { | ||
var txt = label.textContent.trim(); | |||
if ( | if (txt === 'Select') label.textContent = 'Seç'; | ||
else if ( | else if (txt === 'Navigate') label.textContent = 'Gezin'; | ||
else if ( | else if (txt === 'Actions') label.textContent = 'Eylemler'; | ||
else if ( | 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 });