Widget:RemoveParserOutputParentDiv

From Tsadra Commons
Revision as of 18:30, 14 February 2025 by Jeremi (talk | contribs) ((by SublimeText.Mediawiker))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

<script> function unwrapElementsByClass(className, parentId) { const container = document.getElementById(parentId); if (!container) return;

const elements = container.getElementsByClassName(className);

// Convert to array since we'll be modifying the live HTMLCollection Array.from(elements).forEach(element => { // Move all children before the wrapper while (element.firstChild) { element.parentNode.insertBefore(element.firstChild, element); } // Remove the empty wrapper element.parentNode.removeChild(element); }); } unwrapElementsByClass('mw-parser-output', 'remoteValue'); </script>