โ Back to parkrun Userscripts
Tracks progress on the unofficial parkrun alphabet challenge (A-Z, excluding X) with a 5x5 grid visualization and download feature.
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
-
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 link below for this script.
- Click โInstallโ when prompted by your userscript manager.
Install parkrun Alphabet Challenge
Bookmarklet version
You can also use this script as a bookmarklet (a bookmark whose URL is JavaScript), which can be useful on browsers that support bookmarks but not userscript managers.
Desktop bookmarklet
Drag this link to your bookmarks bar:
parkrun Alphabet Challenge bookmarklet
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 _createForOfIteratorHelper(e,t){var n,o,r,a,l="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(l)return r=!(o=!0),{s:function(){l=l.call(e)},n:function(){var e=l.next();return o=e.done,e},e:function(e){r=!0,n=e},f:function(){try{o||null==l.return||l.return()}finally{if(r)throw n}}};if(Array.isArray(e)||(l=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length)return l&&(e=l),a=0,{s:t=function(){},n:function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var n;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(n="Object"===(n={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n<t;n++)o[n]=e[n];return o}(()=>{var e,t,p="ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("").filter(function(e){return"X"!==e});function d(){return window.innerWidth<768?{isMobile:!0,spacing:{small:"8px",medium:"10px",large:"10px"},container:{padding:"10px",marginTop:"10px"},typography:{heading:"1.1em",stats:"1em",statsSubtext:"0.9em"},grid:{gapSize:"5px",marginTop:"10px",cellPadding:"5px",letterFontSize:"1.2em",letterMarginBottom:"2px",eventFontSize:"0.7em",dateFontSize:"0.65em"},button:{padding:"6px 12px",fontSize:"0.9em",marginTop:"10px"},heading:{marginBottom:"10px"}}:{isMobile:!1,spacing:{small:"10px",medium:"15px",large:"20px"},container:{padding:"20px",marginTop:"20px"},typography:{heading:"1.3em",stats:"1.2em",statsSubtext:"1em"},grid:{gapSize:"10px",marginTop:"20px",cellPadding:"10px",letterFontSize:"1.5em",letterMarginBottom:"5px",eventFontSize:"0.8em",dateFontSize:"0.7em"},button:{padding:"8px 15px",fontSize:"1em",marginTop:"15px"},heading:{marginBottom:"15px"}}}function n(a){var e,t,r,n=d(),o=document.createElement("div"),l=(o.className="parkrun-alphabet-container",o.style.width="100%",o.style.maxWidth="800px",o.style.margin="".concat(n.container.marginTop," auto"),o.style.padding=n.container.padding,o.style.backgroundColor="#2b223d",o.style.borderRadius="8px",o.style.boxShadow="0 2px 4px rgba(0,0,0,0.1)",o.style.color="#e0e0e0",o.style.textAlign="center",document.createElement("h3")),l=(l.textContent="Alphabet Challenge",l.style.marginBottom=n.heading.marginBottom,l.style.color="#FFA300",l.style.fontSize=n.typography.heading,o.appendChild(l),document.createElement("div")),i=(l.innerHTML='<div style="font-size: '.concat(n.typography.stats,"; margin-bottom: ").concat(n.spacing.small,';">')+"<strong>"+a.completedCount+" of 25</strong> letters completed</div>"+'<div style="font-size: '.concat(n.typography.statsSubtext,';">After ')+a.totalEvents+" parkruns</div>"+(a.dateOfCompletion?'<div style="font-size: '.concat(n.typography.statsSubtext,';">๐ Challenge completed on: ').concat(a.dateOfCompletion,"</div>"):""),o.appendChild(l),document.createElement("div"));return i.style.display="grid",i.style.gridTemplateColumns="repeat(5, 1fr)",i.style.gap=n.grid.gapSize,i.style.marginTop=n.grid.marginTop,p.forEach(function(r){var e=document.createElement("div"),t=(e.style.aspectRatio="1",e.style.position="relative",e.style.border="1px solid #666",e.style.borderRadius="4px",e.style.backgroundColor=a.completedLetters[r]?"#FFA300":"#008080",e.style.color="#fff",e.style.display="flex",e.style.flexDirection="column",e.style.alignItems="flex-start",e.style.justifyContent="flex-start",e.style.padding=n.grid.cellPadding,e.style.fontWeight="bold",e.style.fontSize="1em",e.style.cursor=a.completedLetters[r]?"pointer":"default",document.createElement("div"));t.textContent=r,t.style.fontSize=n.grid.letterFontSize,t.style.marginBottom=n.grid.letterMarginBottom,e.appendChild(t),a.completedLetters[r]&&((t=document.createElement("div")).innerHTML='<div style="font-size: '.concat(n.grid.eventFontSize,'; text-align: left;">')+a.completedLetters[r].eventName+"<br>"+'<span style="font-size: '.concat(n.grid.dateFontSize,';">(')+a.completedLetters[r].date+")</span></div>",n.isMobile&&(t.style.display="none"),e.appendChild(t),e.addEventListener("click",function(){var e=d(),t=document.createElement("div"),n=(t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.width="100%",t.style.height="100%",t.style.backgroundColor="rgba(0, 0, 0, 0.5)",t.style.zIndex="999",t.addEventListener("click",function(){document.body.removeChild(t)}),document.createElement("div")),o=(n.style.position="fixed",n.style.top="50%",n.style.left="50%",n.style.transform="translate(-50%, -50%)",n.style.backgroundColor="#2b223d",n.style.color="#fff",e.isMobile?"15px":"20px"),o=(n.style.padding=o,n.style.borderRadius="8px",n.style.boxShadow="0 2px 4px rgba(0,0,0,0.5)",n.style.zIndex="1000",n.style.maxWidth=e.isMobile?"95%":"90%",n.style.maxHeight=e.isMobile?"85%":"80%",n.style.overflowY="auto",n.style.fontSize=e.isMobile?"0.9em":"1em",document.createElement("h4")),e=(o.textContent="Letter ".concat(r),o.style.marginBottom="10px",o.style.color="#FFA300",n.appendChild(o),document.createElement("div"));e.style.marginBottom="10px",e.innerHTML="<strong>"+a.completedLetters[r].eventName+'</strong><br><span style="font-size: 0.9em;">'+a.completedLetters[r].date+"</span>",n.appendChild(e),t.appendChild(n),document.body.appendChild(t)})),i.appendChild(e)}),o.appendChild(i),e=o,l=d(),(t=document.createElement("div")).style.marginTop=l.button.marginTop,t.id="alphabet-download-btn-container",(r=document.createElement("button")).textContent="๐พ Save as Image",r.style.padding=l.button.padding,r.style.backgroundColor="#FFA300",r.style.color="#2b223d",r.style.border="none",r.style.borderRadius="4px",r.style.cursor="pointer",r.style.fontWeight="bold",r.style.fontSize=l.button.fontSize,r.addEventListener("mouseover",function(){this.style.backgroundColor="#e59200"}),r.addEventListener("mouseout",function(){this.style.backgroundColor="#FFA300"}),r.addEventListener("click",function(){r.style.display="none",html2canvas(e,{backgroundColor:"#2b223d",scale:2,logging:!1,allowTaint:!0,useCORS:!0}).then(function(e){r.style.display="block";var t=document.createElement("a"),n=(new Date).toISOString().split("T")[0],o=window.location.pathname.split("/")[2]||"parkrunner";t.download="alphabet-challenge-".concat(o,"-").concat(n,".png"),t.href=e.toDataURL("image/png"),t.click()})}),t.appendChild(r),e.appendChild(t),o}(t=(t=document.querySelectorAll("#results"))[t.length-1])?(t=t=n((e=>{var t,n={},o=0,r=null,a=_createForOfIteratorHelper(Array.from(e.querySelectorAll("tr")).reverse());try{for(a.s();!(t=a.n()).done;){var l=t.value.querySelectorAll("td");if(!(l.length<1)){var i=l[0].textContent.trim(),d=l[1].textContent.trim(),s=i.charAt(0).toUpperCase();if(o++,p.includes(s)&&!n[s]&&(n[s]={eventName:i,date:d},25===Object.keys(n).length)){r=d;break}}}}catch(e){a.e(e)}finally{a.f()}return e=Object.keys(n).length,{completedLetters:n,remainingLetters:p.filter(function(e){return!n[e]}),completedCount:e,dateOfCompletion:r,totalEvents:o}})(t)),(e=document.querySelector("h2"))&&e.parentNode&&(e.nextSibling?e.parentNode.insertBefore(t,e.nextSibling):e.parentNode.appendChild(t))):console.log("Results table not found")})();