About

parkrun Volunteer Days Display shows each finisher’s volunteer credit count on results pages, for celebration — without inventing run-to-volunteer ratios (e.g. Fountains Abbey latest results).

What you see

Where the results table exposes volunteer credits (data-vols greater than zero), the script adds text such as 3 volunteer credits in the detailed name cell.

It also adds sort by volunteer credits (ascending and descending) to the page’s existing sort control and, when present, the responsive sort dialog.

Version 1.2.2 Updated

Screenshot

parkrun Volunteer Days Display Screenshot

Install

Recommended: userscript. Bookmarklet works where a userscript manager isn’t available.

Userscript (recommended)

Install parkrun Volunteer Days Display

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

  1. Install a userscript manager for your browser:
  2. Click the Install button above for this script.
  3. 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:

parkrun Volunteer Days Display bookmarklet

Mobile bookmarklet setup and full code

Mobile bookmarklet

On mobile browsers that let you edit bookmark URLs:

  1. Copy the JavaScript code below to your clipboard.
  2. Create a new bookmark for any page.
  3. Edit the bookmark and replace its URL with the code you copied.
  4. Navigate to the relevant parkrun page.
  5. Select the bookmark to run the script.
javascript:(function(){!function e(){var t,s,a,o,n,l,r,c;function d(e){i(e),s.querySelectorAll(".Results-dialog-option.js-ResultsOption").forEach(function(e){return e.classList.remove("isSelected")}),s.querySelectorAll(".Results-dialog-arrow.js-ResultsDirection").forEach(function(e){return e.classList.remove("isSelected")}),a.classList.add("isSelected"),("asc"===e?l:r).classList.add("isSelected")}function i(o){var e;t&&((e=Array.from(t.querySelectorAll("tr")).map(function(e,t){return{row:e,index:t}})).sort(function(e,t){var s=parseInt(e.row.getAttribute("data-vols")||"0",10),a=parseInt(t.row.getAttribute("data-vols")||"0",10);return s===a?e.index-t.index:"asc"===o?s-a:a-s}),e.forEach(function(e){return e=e.row,t.appendChild(e)}))}document.querySelector("tr[data-vols]")?(document.querySelectorAll("tr[data-vols] > td.Results-table-td.Results-table-td--name > div.detailed").forEach(function(e){var t,s,a=e.closest("tr").getAttribute("data-vols");a&&0<parseInt(a)&&((t=document.createElement("span")).classList.add("spacer"),t.textContent=" | ",(s=document.createElement("span")).textContent="".concat(a," volunteer credit").concat("1"===a?"":"s"),s.classList.add("volunteer-days"),(a=e.querySelector(".Results-tablet"))?(e.insertBefore(t,a),t.insertAdjacentElement("afterend",s)):(a=e.firstElementChild)?(a.insertAdjacentElement("afterend",t),t.insertAdjacentElement("afterend",s)):e.appendChild(s))}),(c=document.querySelector("tr[data-vols]"))&&(t=c.closest("tbody"),(c=document.querySelector('select[name="sort"], .Results-sort select, select.Results-sort, .Results-controls select'))&&(c.querySelector('option[value="vols-asc"]')||(o=new Option("Sort by volunteer credits ▲","vols-asc"),n=new Option("Sort by volunteer credits ▼","vols-desc"),c.appendChild(o),c.appendChild(n)),c.dataset.volsSortWired||(c.addEventListener("change",function(e){var t=e.target.value||"";"vols-asc"!==t&&"vols-desc"!==t||(e.cancelable&&e.preventDefault(),"function"==typeof e.stopImmediatePropagation&&e.stopImmediatePropagation(),"function"==typeof e.stopPropagation&&e.stopPropagation(),i(t.endsWith("asc")?"asc":"desc"))},!0),c.addEventListener("change",function(e){"vols-asc"===(e=e.target.value||"")?i("asc"):"vols-desc"===e&&i("desc")}),c.dataset.volsSortWired="true")),s=document.querySelector('.Results-dialog-options[data-name="sort"]'))&&!s.querySelector('[data-vols-sort="true"]')&&((a=document.createElement("div")).className="Results-dialog-option Results-dialog-option--block js-ResultsOption",a.dataset.volsSort="true",(o=document.createElement("button")).type="button",o.className="Results-dialog-button",(n=document.createElement("span")).textContent="Sort by volunteer credits",o.appendChild(n),(c=document.createElement("div")).className="Results-dialog-arrows",(l=document.createElement("button")).type="button",l.className="Results-dialog-arrow js-ResultsDirection",l.dataset.value="vols-asc",l.textContent="▲",(r=document.createElement("button")).type="button",r.className="Results-dialog-arrow js-ResultsDirection",r.dataset.value="vols-desc",r.textContent="▼",l.addEventListener("click",function(e){e.cancelable&&e.preventDefault(),e.stopPropagation(),d("asc")}),r.addEventListener("click",function(e){e.cancelable&&e.preventDefault(),e.stopPropagation(),d("desc")}),c.appendChild(l),c.appendChild(r),a.appendChild(o),a.appendChild(c),s.appendChild(a))):setTimeout(e,500)}();})()

Support

Issues and support on GitHub