Skip to content

Instantly share code, notes, and snippets.

@jpaajarv
Created January 9, 2026 22:08
Show Gist options
  • Select an option

  • Save jpaajarv/b1525aa0133fbb909a238f55b98a2677 to your computer and use it in GitHub Desktop.

Select an option

Save jpaajarv/b1525aa0133fbb909a238f55b98a2677 to your computer and use it in GitHub Desktop.
Curling.fi team stats for played games by player
// ==UserScript==
// @name Player Stats Overlay for curling.fi Team Page
// @namespace https://github.com/jpaajarv
// @version 1.0
// @description Show player stats sorted by games played
// @author jpaajarv
// @match https://www.curling.fi/fi/kilpailut/sarjat/*/joukkueet/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=curling.fi
// @grant none
// ==/UserScript==
(function () {
'use strict';
// Ensure DOM is ready
$(function () {
const stats = $('h3:contains("Joukkueen kokoonpano") + ul li a')
.map(function () {
return $(this)
.text()
.trim()
.replace(/\s*\(kapteeni\)/i, '');
})
.get()
.map(name => ({
name,
played: $('.curling-game-details h3:contains("Kokoonpano") + ul li:contains("' + name + '")').length
}))
.sort((a, b) => b.played - a.played);
if (!stats.length) {
console.log("Player stats user script: failed to read stats")
return;
}
// Build UI container
const box = $('<div>', {
css: {
position: 'fixed',
bottom: '20px',
right: '20px',
zIndex: 9999,
background: '#fff',
border: '1px solid #ccc',
padding: '10px 12px',
fontSize: '13px',
fontFamily: 'Arial, sans-serif',
boxShadow: '0 2px 6px rgba(0,0,0,0.2)',
maxHeight: '70vh',
overflowY: 'auto',
minWidth: '220px'
}
});
box.append('<strong>Games played stats</strong><hr style="margin:6px 0">');
stats.forEach(item => {
box.append(
$('<div>').text(`${item.name}: ${item.played}`)
);
});
// Action button
const openBtn = $('<button>', {
text: 'Open all games',
css: {
marginTop: '8px',
width: '100%',
cursor: 'pointer'
}
}).on('click', function () {
$('details.curling-game-details').attr('open', '');
});
box.append('<hr style="margin:8px 0">');
box.append(openBtn);
// Add close button
const closeBtn = $('<span>', {
text: '×',
css: {
position: 'absolute',
top: '4px',
right: '8px',
cursor: 'pointer',
fontWeight: 'bold'
}
}).on('click', () => box.remove());
box.append(closeBtn);
$('body').append(box);
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment