About
Adds a link to the consolidated club report for the most recent Sunday on junior parkrun group pages
Version 0.2.19 Updated
Screenshot
Install
Recommended: userscript. Bookmarklet works where a userscript manager isn’t available.
Userscript (recommended)
Install junior parkrun Group Sunday Link
First time? Userscript basics and installation steps
What is a userscript?
A userscript is a small piece of JavaScript that runs in your browser and enhances specific websites. These scripts work with parkrun event pages, parkrunner profile pages, and results pages, and can be used with any userscript manager including Userscripts, Tampermonkey, Violentmonkey, or any compatible browser extension.
Installation steps
-
Install a userscript manager for your browser:
- Desktop: Userscripts (Safari), Tampermonkey (Chrome, Firefox, Edge, Opera), or Violentmonkey (Orion)
- iOS: Userscripts (Safari) or Violentmonkey (Orion)
- Android: Install Kiwi Browser, then install Tampermonkey or Violentmonkey from the Chrome Web Store.
- Click the Install button above for this script.
- Click “Install” when prompted by your userscript manager.
Bookmarklet
A bookmarklet is a bookmark whose URL is JavaScript. Use it on browsers that support bookmarks but not userscript managers.
Drag this link to your bookmarks bar:
junior parkrun Group Sunday Link bookmarklet
Mobile bookmarklet setup and full code
Mobile bookmarklet
On mobile browsers that let you edit bookmark URLs:
- Copy the JavaScript code below to your clipboard.
- Create a new bookmark for any page.
- Edit the bookmark and replace its URL with the code you copied.
- Navigate to the relevant parkrun page.
- Select the bookmark to run the script.
javascript:function findConsolidatedClubLink(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:document;return Array.from(t.querySelectorAll("a")).find(function(t){return t.href.includes("/consolidatedclub/?")})||null}function extractClubNumFromLink(t){try{return new URL(t.href).searchParams.get("clubNum")}catch(t){return null}}function getMostRecentSunday(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new Date,e=new Date(t);return e.setDate(t.getDate()-t.getDay()),e}function formatDateYYYYMMDD(t){var e=t.getFullYear(),n=String(t.getMonth()+1).padStart(2,"0"),t=String(t.getDate()).padStart(2,"0");return"".concat(e,"-").concat(n,"-").concat(t)}function buildSundayLink(t,e,n){e="https://www.parkrun.com/results/consolidatedclub/?clubNum=".concat(e,"&eventdate=").concat(n),n=t.cloneNode(!0);return n.href=e,n.textContent="View the consolidated club report for member participation at last Sunday's junior parkruns",n}function insertAfter(t,e){t.parentNode.insertBefore(document.createElement("br"),t.nextSibling),t.parentNode.insertBefore(e,t.nextSibling.nextSibling)}(()=>{var t,e=findConsolidatedClubLink();e&&(t=extractClubNumFromLink(e))&&insertAfter(e,buildSundayLink(e,t,formatDateYYYYMMDD(getMostRecentSunday())))})(),"undefined"!=typeof module&&void 0!==module.exports&&(module.exports={findConsolidatedClubLink:findConsolidatedClubLink,extractClubNumFromLink:extractClubNumFromLink,getMostRecentSunday:getMostRecentSunday,formatDateYYYYMMDD:formatDateYYYYMMDD,buildSundayLink:buildSundayLink,insertAfter:insertAfter});