Soft launch: Soldier biographies and research notes vary in completeness. Prefer class-roster, NARA, newspapers, and other cited sources for contested facts — treat Research notes as leads, not settled history. Anyone can correct a page; contact us with questions.
MediaWiki:Common.js: Difference between revisions
Jump to navigation
Jump to search
Hide leftover Special rows. |
Restore Research notes as a real section; keep disclaimer. |
||
| Line 1: | Line 1: | ||
/** | /** | ||
* 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. | |||
*/ | */ | ||
$(function () { | $(function () { | ||
| Line 11: | Line 12: | ||
) { | ) { | ||
$(this).closest('tr').remove(); | $(this).closest('tr').remove(); | ||
} | |||
}); | |||
var $heading = $('#Research_notes').closest('h2'); | |||
var $disclaimer = $('.mw-parser-output > .research-notes-disclaimer').first(); | |||
if ($heading.length && $disclaimer.length) { | |||
$disclaimer.insertAfter($heading); | |||
} | |||
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)) { | |||
kept.push(clause); | |||
} | |||
}); | |||
if (kept.length) { | |||
$li.text(kept.join('; ')); | |||
} else { | |||
$li.remove(); | |||
} | } | ||
}); | }); | ||
}); | }); | ||
Revision as of 06:42, 18 August 2026
/**
* Hide leftover imported rows the infobox no longer shows.
* Put the research-notes disclaimer under that section heading.
*/
$(function () {
$('.infobox th, .soldier-infobox th, table.wikitable td').each(function () {
var text = $(this).text().replace(/\s+/g, ' ').trim();
if (
text === 'Overseas' ||
text === 'Over Seas Flag' ||
text === 'Special'
) {
$(this).closest('tr').remove();
}
});
var $heading = $('#Research_notes').closest('h2');
var $disclaimer = $('.mw-parser-output > .research-notes-disclaimer').first();
if ($heading.length && $disclaimer.length) {
$disclaimer.insertAfter($heading);
}
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)) {
kept.push(clause);
}
});
if (kept.length) {
$li.text(kept.join('; '));
} else {
$li.remove();
}
});
});