Butun axtardiqlarinizi tapmaq ucun buraya: DAXIL OLUN
  Mp4 Mp3 Axtar Yukle
  Video Axtar Yukle
  Shekil Axtar Yukle
  Informasiya Melumat Axtar
  Hazir Inshalar Toplusu
  AZERI CHAT + Tanishliq
  1-11 Sinif Derslikler Yukle
  Saglamliq Tibbi Melumat
  Whatsapp Plus Yukle(Yeni)

  • Ana səhifə
  • Təsadüfi
  • Yaxınlıqdakılar
  • Daxil ol
  • Nizamlamalar
İndi ianə et Əgər Vikipediya sizin üçün faydalıdırsa, bu gün ianə edin.

İstifadəçi:Gadir/AllMoveLogsMobileDemo.js

  • İstifadəçi səhifəsi
  • Müzakirə
  • Mənbəyə bax
< İstifadəçi:Gadir
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.
(function() {
  const sidebarId = 'p-cactions';
  const linkId = 'fullHistoryLink';
  const modalId = 'fullHistoryModal';

  // Modal yaradılması (desktop və mobil üçün ortaq)
  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.9);
      color:#fff;
      overflow-y:auto;
      z-index: 100000;
      padding: 20px;
      box-sizing: border-box;
      font-family: sans-serif;
    `;

    const closeBtn = document.createElement('button');
    closeBtn.innerHTML = '&times;';
    closeBtn.title = 'Bağla';
    closeBtn.classList.add('close-modal-btn');
    closeBtn.style.cssText = `
      position: fixed;
      top: 15px;
      right: 15px;
      font-size: 32px;
      padding: 10px 16px;
      background: rgba(255,255,255,0.2);
      border: none;
      border-radius: 50%;
      color: white;
      cursor: pointer;
      z-index: 100001;
      line-height: 1;
    `;
    closeBtn.addEventListener('click', () => {
      modal.style.display = 'none';
    });

    const content = document.createElement('div');
    content.id = modalId + '_content';
    content.style.cssText = `
      background: #222;
      border-radius: 8px;
      padding: 15px;
      font-size: 16px;
      min-height: 200px;
      margin-top: 60px;
      color: white;
      max-width: 900px;
      margin-left: auto;
      margin-right: auto;
      box-sizing: border-box;
    `;

    modal.appendChild(closeBtn);
    modal.appendChild(content);
    document.body.appendChild(modal);
  }

  // Tarixi Azərbaycan formatında göstərmək üçün funksiya
  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)`;
  }

  // Geri qayıt düyməsi əlavə et
  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);
  }

  let limit = 20;
  let offset = 0;

  // Addəyişmə jurnallarını API-dən yüklə və göstər
  async function loadAllRenameRevisions(title, limitParam = 20, offsetParam = 0) {
    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: #ccc;">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);

      // Limit seçimi
      const pagination = document.createElement('div');
      pagination.style.margin = '5px 0 10px 0';
      pagination.style.fontSize = '14px';
      pagination.style.color = '#ccc';

      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;
          border-bottom: 1px solid #444;
        `;

        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:#999; font-size:14px; margin-bottom:4px;">${formatDateAz(r.timestamp)}</div>
          <div><a href="${userLink}" target="_blank" rel="noopener" style="font-weight:bold; color:#4aa3df; text-decoration:none;">${r.user}</a></div>
          <div><a href="${diffLink}" target="_blank" rel="noopener" style="font-style:italic; color:#ccc; 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);
    }
  }

  // Axtarış modalını göstər
  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:#bbb; 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;
      border-radius: 4px;
      border: none;
      outline: none;
    `;
    content.appendChild(input);

    const btn = document.createElement('button');
    btn.textContent = 'Axtar';
    btn.style.cssText = `
      padding: 8px 16px;
      font-size: 16px;
      background: #4aa3df;
      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() {
      const val = input.value.trim();
      if (!val) {
        alert('Zəhmət olmasa səhifə adı daxil edin.');
        return;
      }
      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';
  }

  // Yan panelə link əlavə et
  function addSidebarLink() {
    const sidebar = document.getElementById(sidebarId);
    if (!sidebar) return;

    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;

    const articleId = mw.config.get('wgArticleId');
    if (!articleId) return;

    const currentPage = mw.config.get('wgPageName');
    if (currentPage === 'Vikipediya:Kənd_meydanı') return;

    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 = mw.config.get('wgPageName').replace(/_/g, ' ');
        loadAllRenameRevisions(title);
      });
    }

    a.style.cursor = 'pointer';
    a.style.color = '#4aa3df';
    a.style.textDecoration = 'none';

    li.appendChild(a);
    const ul = sidebar.querySelector('ul');
    if (ul) ul.appendChild(li);
  }

  // Mobil üçün "Mobil modal aç" düyməsi səhifə başlığının altında
  function addMobileTestButton() {
    const firstHeading = document.getElementById('firstHeading');
    if (firstHeading && !document.getElementById('mobileModalBtn')) {
      const mobileBtn = document.createElement('button');
      mobileBtn.id = 'mobileModalBtn';
      mobileBtn.textContent = 'Addəyişmə jurnalı aləti';
      mobileBtn.style.cssText = `
        display: block;
        margin: 15px 0;
        padding: 10px 20px;
        font-size: 16px;
        cursor: pointer;
        background: #0645ad;
        color: white;
        border: none;
        border-radius: 5px;
      `;
      mobileBtn.addEventListener('click', e => {
        e.preventDefault();
        showSearchModal();
      });
      firstHeading.parentNode.insertBefore(mobileBtn, firstHeading.nextSibling);
    }
  }

  // Stil əlavə et
  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: #4aa3df;
        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);
  }

  // Başlanğıc
  $(document).ready(() => {
    createModal();
    addSidebarLink();
    addMobileTestButton();
    addStyles();
  });

})();
Mənbə — "https://az.wikipedia.org/w/index.php?title=İstifadəçi:Gadir/AllMoveLogsMobileDemo.js&oldid=8239567"
Informasiya Melumat Axtar