MediaWiki:Common.js: Difference between revisions
Split mashed research notes; keep team links. |
Hide leftover overseas-flag rows |
||
| Line 2: | Line 2: | ||
* Hide leftover imported rows the infobox no longer shows. | * Hide leftover imported rows the infobox no longer shows. | ||
* Put the research-notes disclaimer under that section heading. | * Put the research-notes disclaimer under that section heading. | ||
* | * Turn MII / IPW / 439-G style codes in notes into team links. | ||
*/ | */ | ||
$(function () { | $(function () { | ||
| Line 45: | Line 45: | ||
}); | }); | ||
return text; | return text; | ||
} | } | ||
var negative = /fail(?:ed|ure)?|flunk|wash(?:ed)?\s*out|kick(?:ed)?\s*out|dismiss|expel|unsatisfactor|poor\s+(?:performance|work)|awol|court[-\s]?martial|disciplin|discharged\s+for\s+cause|drop(?:ped)?\s+(?:out|from)|relieved|eliminat|unfit|misconduct|desert/i; | var negative = /fail(?:ed|ure)?|flunk|wash(?:ed)?\s*out|kick(?:ed)?\s*out|dismiss|expel|unsatisfactor|poor\s+(?:performance|work)|awol|court[-\s]?martial|disciplin|discharged\s+for\s+cause|drop(?:ped)?\s+(?:out|from)|relieved|eliminat|unfit|misconduct|desert/i; | ||
$heading.nextAll('ul').first().find('li').each(function () { | |||
var $li = $(this); | |||
var kept = []; | |||
$.each($li.text().split(';'), function (_, clause) { | |||
clause = $.trim(clause); | |||
if (clause && !negative.test(clause)) { | |||
$.each | kept.push(clause); | ||
if (clause && !negative.test(clause) | |||
} | } | ||
}); | }); | ||
if (kept.length) { | |||
$li.html(linkifyTeams(kept.join('; '))); | |||
} else { | |||
$li.remove(); | |||
} | |||
}); | }); | ||
}); | }); | ||