Content deleted Content added
Polygnotus (talk | contribs) No edit summary |
Polygnotus (talk | contribs) No edit summary |
||
(6 intermediate revisions by the same user not shown) | |||
Line 4:
(function() {
'use strict';
//don't run on mobile
if (mw.config.get('skin') === 'minerva' ) {
return;
}
// Only run on watchlist page
Line 9 ⟶ 14:
return;
}
// Flag to prevent double initialization
let initialized = false;
// Create the archive checker section
Line 67 ⟶ 75:
checkUrl: (url) => `https://web.archive.org/web/20250000000000*/${encodeURIComponent(url)}`,
searchUrl: (url) => `https://web.archive.org/web/*/${encodeURIComponent(url)}`,
apiUrl: (url) => `https://archive.org/wayback/available?url=${encodeURIComponent(
apiCheck: true,
notFoundStrings: ['Wayback Machine has not archived that URL.']
},▼
▲ {
name: 'Arquivo.pt',▼
apiCheck: true,▼
},▼
▲ {
apiCheck: true,▼
}
];
Line 132 ⟶ 126:
data.archived_snapshots.closest;
result.available = !!hasArchives; // Ensure it's a boolean
if (hasArchives) {
result.url = data.archived_snapshots.closest.url;
Line 190 ⟶ 184:
function displayResults(results, originalUrl) {
const resultsContainer = document.getElementById('results-container');
console.log(`[Archive Checker] Displaying results for ${originalUrl}:`, results);
let html = `<h4>Results for: ${originalUrl}</h4>`;
Line 195 ⟶ 191:
results.forEach(result => {
console.log(`[Archive Checker] Processing result for ${result.name}:`, {
available: result.available,
availableType: typeof result.available,
});▼
const statusText = result.available === true ? '✓ Available' :
result.available === false ? '✗ Not found' :
Line 201 ⟶ 203:
const statusColor = result.available === true ? '#006400' :
result.available === false ? '#8b0000' : '#666';
console.log(`[Archive Checker] ${result.name} - Status: ${statusText}, Color: ${statusColor}`);
html += `
Line 227 ⟶ 231:
}
//
function
//
if (initialized || document.getElementById('archive-checker-section')) {
return;
} const watchlistContent = document.querySelector('.mw-changeslist, #mw-content-text'); }
initialized = true;
// Add our section to the top of the watchlist page if (e.key === 'Enter') {▼
checkBtn.click();▼
▲ }
▲ }
});
});
}
// Initialize the checker
function init() {
// Try to add immediately if page is already loaded
addArchiveChecker();
//
const
obs.disconnect();
});▼
}
}
});
observer.observe(document.body, {
// Cleanup observer after reasonable time
}
|