Content deleted Content added
Polygnotus (talk | contribs) No edit summary |
Polygnotus (talk | contribs) No edit summary |
||
(3 intermediate revisions by the same user not shown) | |||
Line 6:
if (mw.config.get('wgCanonicalSpecialPageName') === 'Blankpage' &&
mw.config.get('wgPageName') === 'Special:BlankPage/Listgen') {
document.title = 'Wikipedia List Generator';▼
// Set up the page
$('#firstHeading').text('Wikipedia List Generator');
▲ document.title = 'Wikipedia List Generator';
setupListGeneratorInterface();
}
Line 308 ⟶ 309:
let totalCategories = 0;
while (queue.length > 0)
statusCallback('Operation stopped by user.');
break;
}
const currentCategory = queue.shift();
const categoryKey = `Category:${currentCategory}`;
Line 318 ⟶ 324:
statusCallback(`Getting items from "${currentCategory}" (processed ${totalCategories} categories, found ${allItems.length} items, queue: ${queue.length})...`);
if (OPERATION_STATE.shouldStop) break;
const currentItems = await fetchCategoryMembers(currentCategory, statusCallback);
if (OPERATION_STATE.shouldStop) break;
allItems.push(...currentItems);
if (OPERATION_STATE.shouldStop) break;
const subcategories = await fetchCategorySubcategories(currentCategory, statusCallback);
if (OPERATION_STATE.shouldStop) break;
for (const subcategory of subcategories) {
if (OPERATION_STATE.shouldStop) break;
if (!visited.has(subcategory)) {
queue.push(subcategory.replace('Category:', ''));
Line 337 ⟶ 349:
const queue = [`Category:${categoryTitle}`];
while (queue.length > 0)
statusCallback('Operation stopped by user.');
break;
}
const currentCategory = queue.shift();
Line 345 ⟶ 362:
statusCallback(`Exploring subcategories (found ${allSubcategories.length} categories, queue: ${queue.length})...`);
if (OPERATION_STATE.shouldStop) break;
const categoryNameForApi = currentCategory.replace('Category:', '');
const directSubcategories = await fetchCategorySubcategories(categoryNameForApi, statusCallback);
if (OPERATION_STATE.shouldStop) break;
for (const subcategory of directSubcategories) {
if (OPERATION_STATE.shouldStop) break;
if (!visited.has(subcategory)) {
allSubcategories.push(subcategory);
Line 366 ⟶ 386:
let totalCategories = 0;
while (queue.length > 0)
statusCallback('Operation stopped by user.');
break;
}
const currentCategory = queue.shift();
const categoryKey = `Category:${currentCategory}`;
Line 376 ⟶ 401:
statusCallback(`Getting items and subcategories from "${currentCategory}" (processed ${totalCategories} categories, found ${allItems.length} items, ${allSubcategories.length} subcategories, queue: ${queue.length})...`);
if (OPERATION_STATE.shouldStop) break;
const [currentItems, directSubcategories] = await Promise.all([
fetchCategoryMembers(currentCategory, statusCallback),
fetchCategorySubcategories(currentCategory, statusCallback)
]);
if (OPERATION_STATE.shouldStop) break;
allItems.push(...currentItems);
for (const subcategory of directSubcategories) {
if (OPERATION_STATE.shouldStop) break;
if (!visited.has(subcategory)) {
allSubcategories.push(subcategory);
Line 411 ⟶ 440:
</div>
<div id="listgen-tabs" style="margin-bottom:
<button class="listgen-tab active" data-tab="category">Categories</button>
<button class="listgen-tab" data-tab="backlinks">Whatlinkshere</button>
Line 423 ⟶ 452:
<div class="input-group">
<label for="category-input">Category name (without "Category:" prefix):</label>
<input type="text" id="category-input" placeholder="e.g., American novelists" style="width:
</div>
<div class="button-group">
Line 441 ⟶ 470:
<div class="input-group">
<label for="backlinks-input">Page title:</label>
<input type="text" id="backlinks-input" placeholder="e.g., United States" style="width:
</div>
<div class="button-group">
Line 456 ⟶ 485:
<div class="input-group">
<label for="prefix-input">Page title with namespace prefix (if any):</label>
<input type="text" id="prefix-input" placeholder="e.g., List of, User:Jimbo, Template:Infobox" style="width:
<div style="font-size: 12px; color: #666; margin-top: 5px;">
Examples: "List of" (mainspace), "User:Jimbo" (user namespace), "Template:Infobox" (template namespace)
Line 472 ⟶ 501:
<div class="input-group">
<label for="search-input">Search query:</label>
<input type="text" id="search-input" placeholder="e.g., American authors" style="width:
</div>
<div class="button-group">
Line 628 ⟶ 657:
OPERATION_STATE.shouldStop = true;
OPERATION_STATE.isPaused = false;
updateStatus('
};
|