אונטערשייד צווישן ווערסיעס פון "באַניצער:שווערמער/common.js"

קיין רעדאגירונג באמערקונג
אין תקציר עריכה
צייכן: צוריקגעשטעלט
אין תקציר עריכה
צייכן: צוריקגעשטעלט
שורה 134: שורה 134:
// [[m:User:Jon Harald Søby/diffedit.js]]
// [[m:User:Jon Harald Søby/diffedit.js]]
mw.loader.load( '//meta.wikimedia.org/w/index.php?title=User:Jon_Harald_Søby/diffedit.js&action=raw&ctype=text/javascript' );
mw.loader.load( '//meta.wikimedia.org/w/index.php?title=User:Jon_Harald_Søby/diffedit.js&action=raw&ctype=text/javascript' );
document.querySelectorAll('sup.reference').forEach((ref, i, arr) => {
document.querySelectorAll('sup.reference').forEach(ref => {
  const next = ref.nextElementSibling;
    // Look for the next sibling node
  if (next && next.classList.contains('reference')) {
    let next = ref.nextSibling;
    ref.insertAdjacentText('afterend', ', ');
    while (next && next.nodeType === Node.TEXT_NODE && next.textContent.trim() === '') {
  }
        next = next.nextSibling; // skip empty text nodes
    }
    // If the next non-empty node is also a reference, add a comma
    if (next && next.nodeType === Node.ELEMENT_NODE && next.classList.contains('reference')) {
        ref.insertAdjacentText('afterend', ', ');
    }
});
});