Talk:List of Ethiopian records in athletics

Latest comment: 6 months ago by Habst in topic Code to generate U20 table

External links modified edit

Hello fellow Wikipedians,

I have just modified 3 external links on List of Ethiopian records in athletics. Please take a moment to review my edit. If you have any questions, or need the bot to ignore the links, or the page altogether, please visit this simple FaQ for additional information. I made the following changes:

When you have finished reviewing my changes, you may follow the instructions on the template below to fix any issues with the URLs.

This message was posted before February 2018. After February 2018, "External links modified" talk page sections are no longer generated or monitored by InternetArchiveBot. No special action is required regarding these talk page notices, other than regular verification using the archive tool instructions below. Editors have permission to delete these "External links modified" talk page sections if they want to de-clutter talk pages, but see the RfC before doing mass systematic removals. This message is updated dynamically through the template {{source check}} (last update: 18 January 2022).

  • If you have discovered URLs which were erroneously considered dead by the bot, you can report them with this tool.
  • If you found an error with any archives or the URLs themselves, you can fix them with this tool.

Cheers.—InternetArchiveBot (Report bug) 21:29, 17 May 2017 (UTC)Reply

External links modified edit

Hello fellow Wikipedians,

I have just modified 5 external links on List of Ethiopian records in athletics. Please take a moment to review my edit. If you have any questions, or need the bot to ignore the links, or the page altogether, please visit this simple FaQ for additional information. I made the following changes:

When you have finished reviewing my changes, you may follow the instructions on the template below to fix any issues with the URLs.

This message was posted before February 2018. After February 2018, "External links modified" talk page sections are no longer generated or monitored by InternetArchiveBot. No special action is required regarding these talk page notices, other than regular verification using the archive tool instructions below. Editors have permission to delete these "External links modified" talk page sections if they want to de-clutter talk pages, but see the RfC before doing mass systematic removals. This message is updated dynamically through the template {{source check}} (last update: 18 January 2022).

  • If you have discovered URLs which were erroneously considered dead by the bot, you can report them with this tool.
  • If you found an error with any archives or the URLs themselves, you can fix them with this tool.

Cheers.—InternetArchiveBot (Report bug) 05:53, 25 December 2017 (UTC)Reply

Code to generate U20 table edit

This is the code I used to generate the U20 records tables. It could be modified to generate senior records tables as well.

window.cache ??= {};
(async () => {
let output = '';
for (const gen of ['women', 'men'])
for (const env of ['outdoor', 'indoor']) {
output += `===U20 ${gen} ${env}===
{| class="wikitable sortable" style="font-size: 90%; width: 95%;"
|- 
! Event !! Record !! Athlete !! Date !! Meet !! Place !! Country !! Age !! Ref
|-
`;
const rows = [];
for (const evt of {
outdoor: [
  "100",
  "200",
  "400",
  "600",
  "800",
  "1000",
  "1500",
  "Mile",
  "2000",
  "3000",
  "2M",
  "5000",
  "10000",
  "10K",
  "HM",
  "Mar",
  "2000S",
  "3000S",
  gen === 'women' ? "100H" : "110H",
  "400H",
  "HJ",
  "PV",
  "LJ",
  "TJ",
  "SP",
  "DT",
  "HT",
  "JT",
  gen === 'women' ? "Hep" : "Dec",
  "20W",
  "30W",
  "35W",
  "50W",
  "4x1",
  "4x4"
],
indoor: [
  "60",
  "200",
  "400",
  "600",
  "800",
  "1000",
  "1500",
  "Mile",
  "2000",
  "3000",
  "2M",
  "5000",
  "60H",
  "HJ",
  "PV",
  "LJ",
  "TJ",
  "SP",
  "WT",
  gen === 'women' ? "Pen" : "Hep",
  "3000W",
  "4x4"
]}[env]) {
const url = `/api/lists/alltime/ETH/${env}/U20/${gen}/${evt}?&top=10`;
console.log(url);
const data = cache[url] ??= await (await fetch(url, {
  headers: {
    Authorization: new Function([...document.querySelectorAll('script:not([src]):not([type])')].at(-1).innerText+'return auth')(),
  },
})).json()
const div = data.templates[0].divs[0];
const res = div.tables[0].body[0];
if (!res) continue;
if (res.venue === 'Saint-Denis') res.venue = 'Paris';
const wikiVenue = res.venueCountry === 'USA' ? res.venue : `${res.venue}, ${res.venueCountryFull}`;
const ayd = res.dateOfBirth ? `{{ayd|${res.dateOfBirth}|${res.date}}}` : res.yearOfBirth ? `{{age in years|${res.yearOfBirth}|${res.date}}} years` : '';
rows.push(`| [[${div.title.replace('One Mile', 'Mile run')}]] || ${res.result} || [[${res.name}]] || {{dts|abbr=on|${res.date}|format=dmy}} || ${res.competitionLong ?? ''} || [[${wikiVenue}|${res.venue}]] || {{flagg|cncie|${res.venueCountry}}} || ${ayd} || <ref>{{cite web |url-access=subscription |title=Tilastopaja - Ethiopian U20 ${data.indoor} ${data.gender}'s ${div.title} |url=https://www.tilastopaja.eu/beta/lists/alltime/ETH/${data.indoor}/U20/${gen}/${evt}?top=10 |website=www.tilastopaja.eu |access-date=${new Date().toISOString().split('T')[0]}}}</ref>`);
}
output += rows.join('\n|-\n') + '\n|}\n\n';
}
console.log(output);
return output;
})()

--Habst (talk) 14:33, 26 October 2023 (UTC)Reply