User:Qwerfjkl/scripts/massXFD.js: Difference between revisions

Content deleted Content added
delink section names [Factotum]
Fix delinking algorithm & use delinking in the code the updates the prependTextInputField based on the nom input field [Factotum]
Line 448:
if (p1 && p2) {
// If there is both link text and target (piped)
return p1p2; // Just return the link text
} else if (p3) {
// If there is only link text, without a target (unpiped)
Line 1,085:
if (/(\| *days *= *)\d+/.test(text)) { // already has days=, update
text = text.replace(/(\| *days *= *)\d+/, '$1' + getDateDifference(date));
text = replaceOccurence(text, delinkWikitext(oldSectionName), delinkWikitext(sectionName));
} else {
text = replaceOccurence(text, delinkWikitext(oldSectionName), delinkWikitext(sectionName) + '|days=' + getDateDifference(date));
}
} else text = replaceOccurence(text, delinkWikitext(oldSectionName), delinkWikitext(sectionName));
 
prependTextInputField.setValue(text);
Line 1,101:
sectionName = newNomHeaderInputField.getValue().trim();
var text = prependTextInputField.getValue();
text = replaceOccurence(text, delinkWikitext(oldSectionName), delinkWikitext(sectionName));
prependTextInputField.setValue(text);
}