MediaWiki:Gadget-WantedPagesMainspace.js: Difference between revisions
No edit summary |
No edit summary Tag: Reverted |
||
| Line 9: | Line 9: | ||
return; | return; | ||
} | } | ||
// Ensure container can host an overlay | |||
if (!container.style.position) { | |||
container.style.position = 'relative'; | |||
} | |||
// Create loading overlay | |||
var overlay = document.createElement('div'); | |||
overlay.className = 'wantedpages-loading-overlay'; | |||
overlay.style.position = 'absolute'; | |||
overlay.style.top = '0'; | |||
overlay.style.left = '0'; | |||
overlay.style.right = '0'; | |||
overlay.style.bottom = '0'; | |||
overlay.style.display = 'flex'; | |||
overlay.style.alignItems = 'center'; | |||
overlay.style.justifyContent = 'center'; | |||
overlay.style.backgroundColor = 'white'; | |||
overlay.style.zIndex = '9999'; | |||
// Create loading circle | |||
var spinner = document.createElement('div'); | |||
spinner.className = 'wantedpages-loading-spinner'; | |||
spinner.style.width = '40px'; | |||
spinner.style.height = '40px'; | |||
spinner.style.borderRadius = '50%'; | |||
spinner.style.border = '4px solid #ccc'; | |||
spinner.style.borderTop = '4px solid #555'; | |||
// Optional simple animation (no @keyframes needed if you want it static) | |||
// If you want it spinning, you'd add a <style> with keyframes instead. | |||
overlay.appendChild(spinner); | |||
container.appendChild(overlay); | |||
var bannedPrefixes = [ | var bannedPrefixes = [ | ||
| Line 76: | Line 110: | ||
}); | }); | ||
// Replace old messy HTML | // Replace old messy HTML and remove overlay | ||
container.innerHTML = ''; | container.innerHTML = ''; | ||
container.appendChild(ul); | container.appendChild(ul); | ||
// Overlay is gone once innerHTML is replaced; no need to explicitly remove it | |||
}); | }); | ||