therearefivethings

@therearefivethings@lemmy.world

This profile is from a federated server and may be incomplete. Browse more on the original instance.

therearefivethings,

Yeah, the sub (subscript) and up (superscript) were from Jebora’s editor, but they didn’t even render once posted

therearefivethings,

Gut gemacht. Ich bin drei jahre herI don’t speak much Deutsche and this came up in “all” so I felt I needed to reply, so that somebody did congratulations and keep it up. (From somebody 3 years quit)!

Edit: people replied whilst I was typing, but whatever 🎉

therearefivethings,

Just to make your pain a little less…

<pre style="background-color:#ffffff;">
<span style="color:#323232;">function collapseNestedDivs(element) {
</span><span style="color:#323232;">  const childDivs = element.querySelectorAll('div');
</span><span style="color:#323232;">
</span><span style="color:#323232;">  childDivs.forEach((div) => {
</span><span style="color:#323232;">    collapseNestedDivs(div); // Recursively check for nested divs
</span><span style="color:#323232;">
</span><span style="color:#323232;">    if (div.childElementCount === 1 && div.children[0].tagName === 'DIV') {
</span><span style="color:#323232;">      const nestedDiv = div.children[0];
</span><span style="color:#323232;">      const parent = div.parentNode;
</span><span style="color:#323232;">
</span><span style="color:#323232;">      // Move the styles from the nested div to the parent div
</span><span style="color:#323232;">      Array.from(nestedDiv.style).forEach((styleName) => {
</span><span style="color:#323232;">        parent.style[styleName] = nestedDiv.style[styleName];
</span><span style="color:#323232;">      });
</span><span style="color:#323232;">
</span><span style="color:#323232;">      // Move the classes from the nested div to the parent div
</span><span style="color:#323232;">      nestedDiv.classList.forEach((className) => {
</span><span style="color:#323232;">        parent.classList.add(className);
</span><span style="color:#323232;">      });
</span><span style="color:#323232;">
</span><span style="color:#323232;">      // Remove the nested div
</span><span style="color:#323232;">      parent.removeChild(nestedDiv);
</span><span style="color:#323232;">    }
</span><span style="color:#323232;">  });
</span><span style="color:#323232;">}
</span><span style="color:#323232;">
</span><span style="color:#323232;">// Call the function to collapse the nested divs starting from a root element
</span><span style="color:#323232;">const rootElement = document.getElementById('root'); // Replace 'root' with your actual root element ID
</span><span style="color:#323232;">collapseNestedDivs(rootElement);
</span><span style="color:#323232;">
</span>
  • All
  • Subscribed
  • Moderated
  • Favorites
  • JUstTest
  • InstantRegret
  • magazineikmin
  • cubers
  • everett
  • rosin
  • Youngstown
  • GTA5RPClips
  • tester
  • slotface
  • khanakhh
  • Durango
  • kavyap
  • DreamBathrooms
  • normalnudes
  • ethstaker
  • ngwrru68w68
  • cisconetworking
  • thenastyranch
  • Leos
  • osvaldo12
  • anitta
  • mdbf
  • tacticalgear
  • modclub
  • megavids
  • provamag3
  • lostlight
  • All magazines