MediaWiki:Common.js: Difference between revisions

No edit summary
No edit summary
Line 843: Line 843:
   var apiBase = mw.util.wikiScript('api');
   var apiBase = mw.util.wikiScript('api');
   var allRows = [];
   var allRows = [];
  // Inject the Download button and status span above the table
  $(document).ready(function() {
    var wrapper = document.getElementById('article-overview-wrapper');
    var table = document.getElementById('article-overview-table');
    if (!wrapper || !table) return;
    // Create controls div if it doesn't exist
    var controls = document.getElementById('article-overview-controls');
    if (!controls) {
      controls = document.createElement('div');
      controls.id = 'article-overview-controls';
      controls.style.marginBottom = '14px';
      wrapper.insertBefore(controls, table);
    }
    // Create Download button
    var btn = document.createElement('button');
    btn.id = 'download-csv-btn';
    btn.textContent = 'Download CSV';
    btn.style.cssText = 'background-color:#e07b00;color:#fff;padding:9px 20px;border:none;border-radius:5px;font-size:14px;font-weight:bold;cursor:pointer;letter-spacing:0.3px;';
    btn.addEventListener('click', downloadCSV);
    controls.appendChild(btn);
    // Create status span
    var statusSpan = document.createElement('span');
    statusSpan.id = 'overview-status';
    statusSpan.style.cssText = 'margin-left:14px;font-size:13px;color:#aaa;vertical-align:middle;';
    controls.appendChild(statusSpan);
    buildTable();
  });


   function getCategoryMembers(catName, cmtype, continueParam, accumulated, callback) {
   function getCategoryMembers(catName, cmtype, continueParam, accumulated, callback) {
Line 982: Line 1,014:
   }
   }


  $(document).ready(function() {
    var btn = document.getElementById('download-csv-btn');
    if (btn) btn.addEventListener('click', downloadCSV);
    buildTable();
  });
})();
})();