MediaWiki:Common.js: Difference between revisions
Linkify IPW T/? to numeric teams and IPW 424-G to MII |
Deduplicate research notes after splitting mashed CSV bullets |
||
| Line 188: | Line 188: | ||
}); | }); | ||
return text; | return text; | ||
} | |||
function normalizeNoteKey(text) { | |||
text = $.trim(text || '').toLowerCase(); | |||
text = text.replace(/^also\s+/, ''); | |||
text = text.replace(/[^\w\s\-/]/g, ' '); | |||
return text.replace(/\s+/g, ' ').trim(); | |||
} | } | ||
| Line 230: | Line 237: | ||
} | } | ||
var items = []; | var items = []; | ||
var seen = {}; | |||
$ul.find('li').each(function () { | $ul.find('li').each(function () { | ||
$.each(splitNotes($(this).text()), function (_, clause) { | $.each(splitNotes($(this).text()), function (_, clause) { | ||
if (clause && !negative.test(clause) && | var key = normalizeNoteKey(clause); | ||
if (clause && key && !negative.test(clause) && !seen[key]) { | |||
seen[key] = true; | |||
items.push(clause); | items.push(clause); | ||
} | } | ||