User:Habst/makeUsaNationalsMeet.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
![]() | Documentation for this user script can be added at User:Habst/makeUsaNationalsMeet. |
// <nowiki>
year = '1922';
window.doc ??= new DOMParser().parseFromString(await (await fetch('https://en.wikipedia.org/wiki/USA_Outdoor_Track_and_Field_Championships')).text(), 'text/html');
tr = [...doc.querySelectorAll('tr')].find(tr => tr.querySelector('td')?.innerText === year);
([_, mLoc, mStadium, mDate, wLoc, wStadium, wDate] = [...tr.querySelectorAll('td')].map(td => td?.innerText));
([mMonth, mDays] = mDate.split(' ').map(s => s.replace(',', '')));
([wMonth, wDays] = wDate?.split(' ')?.map(s => s.replace(',', '')) ?? []);
([mCity, mState] = mLoc.split(', '));
([wCity, wState] = wLoc?.split(', ') ?? []);
`{{short description|American athletics championship event}}
{{Use dmy dates|date=December 2024}}
{{Infobox Athletics Championships
| Name = ${year} USA Outdoor Track and Field Championships
| Stadium image = [[File:.jpg|200px]]
| Size =
| Host city = [[${mCity}, ${mState}]] (men)
<br>[[${wCity}, ${wState}]] (women)
| Dates = ${mDays} ${mMonth} (men)
<br>${wDays} ${wMonth} (women)
| Stadium = [[${mStadium}]] (men)
<br>[[${wStadium}]] (women)
| Athletes participating =
| Events =
| Previous = [[${year-1} USA Outdoor Track and Field Championships|${year-1}]]
| Next = [[${+year+1} USA Outdoor Track and Field Championships|${+year+1}]]
}}
The ${year} [[USA Outdoor Track and Field Championships]] were organized by the [[Amateur Athletic Union]] (AAU) and served as the [[national championships]] in outdoor [[track and field]] for the [[United States]].
The men's edition was held at [[${mStadium}]] in [[${mCity}, ${mState}]], and it took place ${mDays} ${mMonth}. ${wLoc ? `The women's meet was held separately at [[${wStadium}]] in [[${wCity}, ${wState}]], on ${wDays} ${wMonth}.` : "The first women's championships were not held until [[1923 USA Outdoor Track and Field Championships|1923]].<ref>{{cite web |title=Sites & Dates Of The U.S. National Women’s Championships |url=https://trackandfieldnews.com/sites-dates-of-the-national-womens-championships/ |website=[[Track & Field News]] |access-date=4 December 2024}}</ref>"}
At the ${wLoc ? "men's " : ''}championships, .<ref>{{cite web |title=Sites/Dates Of The U.S. Men’s Nationals, 1876–2023 |url=https://trackandfieldnews.com/sites-of-the-national-mens-championships/ |website=[[Track & Field News]] |access-date=4 December 2024 |date=19 October 2020}}</ref>${wLoc ? ` In the women's competition, .<ref>{{cite web |title=Sites & Dates Of The U.S. National Women’s Championships |url=https://trackandfieldnews.com/sites-dates-of-the-national-womens-championships/ |website=[[Track & Field News]] |access-date=4 December 2024}}</ref>` : ''}
==Results==
${(wLoc ? ['===Men===\n', '===Women===\n'] : ['']).map(h => `${h}{| {{MedalistTable|type=Event|columns=2}}
|-
|}`)}
==See also==
* [[${year} USA Indoor Track and Field Championships]]
* [[List of USA Outdoor Track and Field Championships winners (men)]]
* [[List of USA Outdoor Track and Field Championships winners (women)]]
==References==
{{Reflist|refs=
<ref name=usatf>{{cite web |title=USATF Outdoor Champions |website=[[USA Track & Field]] |url=https://www.usatf.org/resources/statistics/usatf-champions/usatf-outdoor-champions |access-date=4 December 2024}}</ref>
<ref name=ap>{{apch|usa-track-and-field-championships/${year}-usa-track-and-field-championships}}</ref>
}}
; Results
* {{cite web |title=U.S. National Championships History 1876–2023: Results by Event |url=https://trackandfieldnews.com/u-s-national-championships-history/ |website=[[Track & Field News]] |access-date=4 December 2024}}
* {{cite web |title=Track and Field Statistics: USA National Championship ${year} Men, Track |url=http://trackfield.brinkster.net/USATournaments.asp?TourCode=N&Year=${year}&Gender=M&TF=T&P=F&By=Y&Count= |website=trackfield.brinkster.net |access-date=4 December 2024}}
* {{cite web |title=Track and Field Statistics: USA National Championship ${year} Men, Field |url=http://trackfield.brinkster.net/USATournaments.asp?TourCode=N&Year=${year}&Gender=M&TF=F&P=F&By=Y&Count= |website=trackfield.brinkster.net |access-date=4 December 2024}}${wLoc ? `
* {{cite web |title=Track and Field Statistics: USA National Championship ${year} Women, Track |url=http://trackfield.brinkster.net/USATournaments.asp?TourCode=N&Year=${year}&Gender=W&TF=T&P=F&By=Y&Count= |website=trackfield.brinkster.net |access-date=4 December 2024}}
* {{cite web |title=Track and Field Statistics: USA National Championship ${year} Women, Field |url=http://trackfield.brinkster.net/USATournaments.asp?TourCode=N&Year=${year}&Gender=W&TF=F&P=F&By=Y&Count= |website=trackfield.brinkster.net |access-date=4 December 2024}}` : ''}
{{USA Outdoor Track and Field Championships}}
${`
[[Category:USA Outdoor Track and Field Championships]]
[[Category:${year} in athletics (track and field)|USA Outdoor Track And Field Championships, ${year}]]
[[Category:${year} in sports in ${mState}|USA Outdoor Track and Field Championships]]
[[Category:${year} in sports in ${wState}|USA Outdoor Track and Field Championships]]
[[Category:${mMonth} ${year} sports events in the United States|USA Outdoor Track and Field Championships]]
[[Category:${wMonth} ${year} sports events in the United States|USA Outdoor Track and Field Championships]]
[[Category:Track and field competitions in ${mState}]]
[[Category:Track and field competitions in ${wState}]]
[[Category:Sports competitions in ${mCity}, ${mState}]]
[[Category:Sports competitions in ${wCity}, ${wState}]]
[[Category:${year} in sports in ${mCity}, ${mState}]]
[[Category:${year} in sports in ${wCity}, ${wState}]]
${wLoc ? `[[Category:Women's sports in ${wState}]]
[[Category:${year} in American women's sports]]
[[Category:${year} in women's athletics]]` : ''}
`.split('\n').filter(x => x).reduce((acc, x) => acc.includes(x) ? acc : [...acc, x], []).join('\n')}
`.split('\n').filter(x => !x.includes('undefined')).join('\n')
// </nowiki>