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

קפיצה לניווט קפיצה לחיפוש
קיין רעדאגירונג באמערקונג
אין תקציר עריכה
אין תקציר עריכה
 
שורה 10: שורה 10:
*/
*/
if ((mw.config.get('wgAction') === 'delete') && ((($("#firstHeading").text().indexOf("הפעולה בוצעה")>-1))||($("#firstHeading").text().indexOf("די אקציע איז אויסגעפירט געווארן")>-1))){
if ((mw.config.get('wgAction') === 'delete') && ((($("#firstHeading").text().indexOf("הפעולה בוצעה")>-1))||($("#firstHeading").text().indexOf("די אקציע איז אויסגעפירט געווארן")>-1))){
// MediaWiki:Gadget-RefComma.js (or your common.js)
document.querySelectorAll('.mw-parser-output').forEach(container => {
mw.hook('wikipage.content').add(function ($content) {
   const refs = container.querySelectorAll('sup.reference');
   $content.find('sup.reference + sup.reference').each(function () {
  for (let i = 1; i < refs.length; i++) {
     // Insert a literal comma+space text node before the 2nd ref
    const prev = refs[i - 1];
     this.parentNode.insertBefore(document.createTextNode(', '), this);
    const cur = refs[i];
   });
 
     // Collect text between prev and cur
    let betweenText = '';
    let node = prev.nextSibling;
     while (node && node !== cur) {
      if (node.nodeType === Node.TEXT_NODE) betweenText += node.textContent;
      if (node.nodeType === Node.ELEMENT_NODE) betweenText += node.textContent;
      node = node.nextSibling;
    }
 
    // Only insert comma if nothing visible between
    if (betweenText.trim() === '') {
      cur.insertAdjacentText('beforebegin', ', ');
    }
   }
});
});




נאוויגאציע מעניו