Etdiyiniz dəyişikliklərin yayımlanandan sonra effekt verməsi üçün brauzerinizin keşini təmizləməyə ehtiyacınız ola bilər. Bunun üçün Chrome, Firefox, Edge, yaxud Safari istifadəçisisinizsə, klaviaturanızın Shift düyməsini sıxaraq brauzerin ⟳ səhifə yeniləmək düyməsini klik edə bilərsiniz.
// Bu skript cari adı daxil edərək səhifənin bütün addəyişmə jurnallarını göstərir
(function() {
const sidebarId = 'p-cactions';
const linkId = 'fullHistoryLink';
const modalId = 'fullHistoryModal';
function createModal() {
if (document.getElementById(modalId)) return;
const modal = document.createElement('div');
modal.id = modalId;
modal.style.cssText = `
display:none;
position:fixed;
top:0; left:0; width:100vw; height:100vh;
background:rgba(0,0,0,0.8);
color:#222;
overflow-y:auto;
z-index: 99999;
padding: 20px;
box-sizing: border-box;
font-family: sans-serif;
`;
const closeBtn = document.createElement('button');
closeBtn.innerHTML = '×';
closeBtn.title = 'Bağla';
closeBtn.classList.add('close-modal-btn'); // class əlavə edildi
closeBtn.style.cssText = `
position: fixed;
top: 20px;
right: 20px;
padding: 8px 15px;
font-size: 24px;
background: transparent;
color: white;
border: none;
cursor: pointer;
z-index: 100000;
line-height: 1;
`;
closeBtn.addEventListener('click', () => {
modal.style.display = 'none';
});
const content = document.createElement('div');
content.id = modalId + '_content';
content.style.cssText = `
max-width: 900px;
margin: 60px auto 40px auto;
background: white;
border-radius: 8px;
padding: 20px;
box-sizing: border-box;
color: #000;
font-size: 14px;
min-height: 200px;
position: relative;
`;
modal.appendChild(closeBtn);
modal.appendChild(content);
document.body.appendChild(modal);
}
function formatDateAz(iso) {
const d = new Date(iso);
const saat = d.getUTCHours().toString().padStart(2, '0');
const dəqiqə = d.getUTCMinutes().toString().padStart(2, '0');
const gün = d.getUTCDate();
const aylar = ['yanvar', 'fevral', 'mart', 'aprel', 'may', 'iyun', 'iyul', 'avqust', 'sentyabr', 'oktyabr', 'noyabr', 'dekabr'];
const ay = aylar[d.getUTCMonth()];
const il = d.getUTCFullYear();
return `${saat}:${dəqiqə}, ${gün} ${ay} ${il} (UTC)`;
}
function geriQayitDugmesi(content) {
const backBtn = document.createElement('button');
backBtn.textContent = '← Geri qayıt';
backBtn.style.cssText = `
padding: 6px 12px;
font-size: 14px;
background: #ccc;
border: none;
border-radius: 4px;
margin-bottom: 15px;
cursor: pointer;
`;
backBtn.addEventListener('click', () => {
showSearchModal();
});
content.appendChild(backBtn);
}
// Baş hərfi böyük etmək üçün funksiya
function capitalizeTitle(title) {
if (!title) return title;
return title.charAt(0).toUpperCase() + title.slice(1);
}
let limit = 20;
let offset = 0;
async function loadAllRenameRevisions(title, limitParam = 20, offsetParam = 0) {
// Baş hərfi böyük və alt xətt varsa boşluğa çevir
title = capitalizeTitle(title.replace(/_/g, ' '));
limit = limitParam;
offset = offsetParam;
const modal = document.getElementById(modalId);
const content = document.getElementById(modalId + '_content');
modal.style.display = 'block';
content.innerHTML = `<p style="font-style: italic; color: #666;">Yüklənir...</p>`;
let revisions = [];
let rvcontinue = undefined;
try {
const api = new mw.Api();
do {
const params = {
action: 'query',
prop: 'revisions',
titles: title,
rvprop: 'timestamp|user|comment|ids',
rvlimit: '500',
format: 'json',
origin: '*',
};
if (rvcontinue) params.rvcontinue = rvcontinue;
const data = await api.get(params);
const pages = data.query.pages;
const pageId = Object.keys(pages)[0];
if (pageId === "-1") {
content.innerHTML = `
<h2>${title} üçün heç bir addəyişmə jurnalı tapılmadı</h2>
<p>Belə səhifə mövcud deyil.</p>
`;
geriQayitDugmesi(content);
return;
}
const page = pages[pageId];
if (page.revisions) revisions.push(...page.revisions);
rvcontinue = data.continue?.rvcontinue;
} while (rvcontinue);
const filtered = revisions.filter(r =>
r.comment &&
(r.comment.includes("səhifəsinin adını") || r.comment.includes("adı dəyişdirildi"))
);
if (filtered.length === 0) {
content.innerHTML = `
<h2>${title} üçün heç bir addəyişmə jurnalı tapılmadı</h2>
<p>Görünür bu səhifənin adı heç dəyişdirilməyib.</p>
`;
geriQayitDugmesi(content);
return;
}
content.innerHTML = '';
geriQayitDugmesi(content);
const header = document.createElement('div');
header.style.marginBottom = '5px';
const titleEl = document.createElement('h2');
titleEl.textContent = `${title} — Bütün addəyişmə jurnalları (Ad ${filtered.length} dəfə dəyişdirilib)`;
header.appendChild(titleEl);
content.appendChild(header);
const pagination = document.createElement('div');
pagination.style.margin = '5px 0 10px 0';
pagination.style.fontSize = '14px';
pagination.style.color = '#333';
const select = document.createElement('select');
select.style.fontSize = '14px';
select.style.marginLeft = '8px';
select.style.padding = '2px 6px';
select.title = 'Göstəriləcək sayı seçin';
const options = [
{value: 10, text: '10'},
{value: 20, text: '20'},
{value: 50, text: '50'},
{value: 100, text: '100'},
{value: 'all', text: 'Hamısını göstər'}
];
options.forEach(opt => {
const option = document.createElement('option');
option.value = opt.value;
option.textContent = opt.text;
if ((opt.value === limit) || (opt.value === 'all' && limit === filtered.length)) {
option.selected = true;
}
select.appendChild(option);
});
pagination.textContent = 'Göstər:';
pagination.appendChild(select);
content.appendChild(pagination);
select.addEventListener('change', () => {
let val = select.value;
if (val === 'all') val = filtered.length;
else val = parseInt(val, 10);
loadAllRenameRevisions(title, val, 0);
});
const paged = (limit === filtered.length ? filtered : filtered.slice(offset, offset + limit));
const ul = document.createElement('ul');
ul.style.listStyle = 'none';
ul.style.padding = '0';
ul.style.margin = '0';
paged.forEach(r => {
const li = document.createElement('li');
li.style.cssText = `
padding: 10px 0;
border: none;
outline: none;
box-shadow: none;
`;
const userLink = `https://az.wikipedia.org/wiki/İstifadəçi:${encodeURIComponent(r.user)}`;
const diffLink = `https://az.wikipedia.org/w/index.php?title=${encodeURIComponent(title)}&diff=${r.revid}`;
li.innerHTML = `
<div style="color:#555; font-size:14px; margin-bottom:4px;">${formatDateAz(r.timestamp)}</div>
<div><a href="${userLink}" target="_blank" rel="noopener" style="font-weight:bold; color:#0077cc; text-decoration:none;">${r.user}</a></div>
<div><a href="${diffLink}" target="_blank" rel="noopener" style="font-style:italic; color:#333; text-decoration:underline;">${r.comment}</a></div>
`;
ul.appendChild(li);
});
content.appendChild(ul);
} catch (e) {
content.innerHTML = `<p>Xəta baş verdi: ${e.message}</p>`;
geriQayitDugmesi(content);
}
}
function showSearchModal() {
const modal = document.getElementById(modalId);
const content = document.getElementById(modalId + '_content');
content.innerHTML = '';
const h2 = document.createElement('h2');
h2.textContent = 'Səhifə üzrə bütün addəyişmə jurnallarını axtar';
content.appendChild(h2);
const desc = document.createElement('p');
desc.textContent = 'Bu alət vasitəsilə müəyyən bir səhifə üzrə olan bütün addəyişmələri görə bilərsiniz.';
desc.style.cssText = 'color:#555; font-size:14px; margin-top:-10px; margin-bottom:20px;';
content.appendChild(desc);
const input = document.createElement('input');
input.type = 'text';
input.placeholder = 'Səhifə adı daxil edin';
input.style.cssText = `
width: 100%;
padding: 8px;
font-size: 16px;
margin: 0 0 20px 0;
box-sizing: border-box;
`;
content.appendChild(input);
const btn = document.createElement('button');
btn.textContent = 'Axtar';
btn.style.cssText = `
padding: 8px 16px;
font-size: 16px;
background: #0645ad;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
`;
content.appendChild(btn);
const statusMsg = document.createElement('p');
statusMsg.style.cssText = 'font-style: italic; color: #666; margin-top: 10px;';
content.appendChild(statusMsg);
function startSearch() {
let val = input.value.trim();
// İngilis dilindəki qısaltmaları və adları lokal formaya çevir
val = val.replace(/^User:/i, 'İstifadəçi:');
val = val.replace(/^(VP:|WP:)/i, 'Vikipediya:');
// Sənin istədiyin əlavə prefikslər
val = val.replace(/^İ:/i, 'İstifadəçi:');
val = val.replace(/^(Ş:|Template:)/i, 'Şablon:');
if (!val) {
alert('Zəhmət olmasa səhifə adı daxil edin.');
return;
}
// Prefikslərdən sonra gələn adın baş hərfini böyük et
const prefixMatch = val.match(/^([^:]+:)(.*)$/);
if (prefixMatch) {
const prefix = prefixMatch[1];
let rest = prefixMatch[2];
rest = rest.charAt(0).toUpperCase() + rest.slice(1);
val = prefix + rest;
} else {
val = val.charAt(0).toUpperCase() + val.slice(1);
}
statusMsg.textContent = 'Zəhmət olmasa gözləyin, yüklənilir...';
loadAllRenameRevisions(val).then(() => {
statusMsg.textContent = '';
});
}
btn.addEventListener('click', e => {
e.preventDefault();
startSearch();
});
input.addEventListener('keydown', e => {
if (e.key === 'Enter') {
e.preventDefault();
startSearch();
}
});
modal.style.display = 'block';
}
function addSidebarLink() {
const sidebar = document.getElementById(sidebarId);
if (!sidebar) return;
// Müzakirə səhifələrinin namespace nömrələri
const talkNamespaces = [
1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33
];
const namespace = mw.config.get('wgNamespaceNumber');
if (talkNamespaces.includes(namespace)) return; // Müzakirə səhifələrində link əlavə etmə
const articleId = mw.config.get('wgArticleId');
if (!articleId) return; // Yaradılmamış səhifələrdə link əlavə etmə
const currentPage = mw.config.get('wgPageName');
if (currentPage === 'Vikipediya:Kənd_meydanı') return; // Kənd meydanı üçün gizlət
if (document.getElementById(linkId)) return;
const li = document.createElement('li');
const a = document.createElement('a');
a.href = '#';
a.id = linkId;
a.title = 'Səhifənin bütün addəyişmə jurnallarına bax';
if (mw.config.get('wgIsMainPage')) {
a.textContent = 'Addəyişmə jurnallarını axtar';
a.addEventListener('click', e => {
e.preventDefault();
showSearchModal();
});
} else {
a.textContent = 'Bütün addəyişmə jurnallarına bax';
a.addEventListener('click', e => {
e.preventDefault();
const title = capitalizeTitle(mw.config.get('wgPageName').replace(/_/g, ' '));
loadAllRenameRevisions(title);
});
}
a.style.cursor = 'pointer';
a.style.color = '#0645ad';
a.style.textDecoration = 'none';
li.appendChild(a);
const ul = sidebar.querySelector('ul');
if (ul) ul.appendChild(li);
}
function addStyles() {
if (document.getElementById(modalId + '_style')) return;
const style = document.createElement('style');
style.id = modalId + '_style';
style.textContent = `
#${modalId}_content a.limit-link {
margin: 0 5px;
color: #0645ad;
text-decoration: none;
cursor: pointer;
}
#${modalId}_content a.limit-link:hover {
text-decoration: underline;
}
/* Mobil üçün əlavə stil */
@media (max-width: 600px) {
#${modalId}_content {
width: 95vw !important;
max-width: none !important;
font-size: 16px !important;
padding: 15px !important;
margin: 40px auto 30px auto !important;
}
.close-modal-btn {
position: fixed !important;
top: 10px !important;
right: 10px !important;
font-size: 32px !important;
padding: 12px 18px !important;
z-index: 1000000 !important;
background: rgba(0,0,0,0.5);
border-radius: 50%;
color: white !important;
cursor: pointer;
}
#${modalId} {
padding-top: 50px;
}
}
`;
document.head.appendChild(style);
}
$(document).ready(() => {
createModal();
addSidebarLink();
addStyles();
});
})();