167,245
עריכות
מהדורה קמא (שיחה | תרומות) (M) |
מהדורה קמא (שיחה | תרומות) (ניסוי) |
||
שורה 34: | שורה 34: | ||
$.each(anchors, function (key, positions) { | $.each(anchors, function (key, positions) { | ||
if (positions.length > 1) { | if (positions.length > 1) { | ||
var | var counter = 1; | ||
positions.forEach(function (pos, i) { | positions.forEach(function (pos, i) { | ||
var replacement = `{{עוגן|${key}${ | var replacement = `{{עוגן|${key}${counter}|${key}}}`; | ||
content = content.slice(0, pos.index) + replacement + content.slice(pos.index + pos.length); | |||
content = content.slice(0, | counter++; | ||
}); | }); | ||
} | } | ||
}); | }); | ||
textArea.val(content); // מעדכן את התוכן בתיבת הטקסט | |||
alert('הוחלפו עוגנים כפולים בהצלחה'); | |||
}); | }); | ||
}); | }); | ||
}); | }); |