An open API service indexing awesome lists of open source software.

https://github.com/jerboa88/better-segments-for-strava

A userscript for Strava that adds additional stats and features to the starred segments page.
https://github.com/jerboa88/better-segments-for-strava

fitness javascript segments strava user-script user-scripts userscript userscripts

Last synced: about 1 year ago
JSON representation

A userscript for Strava that adds additional stats and features to the starred segments page.

Awesome Lists containing this project

README

          


Better Segments for Strava


Project category
Language
Repository size

Project license


A userscript for Strava that adds additional stats and features to the starred segments page.



## About
Hunting for [Strava] crowns? This script may help. It runs in your browser and adds additional stats and features to the [starred segments page] on Strava to help you find segments that you already hold a competitive time on.

### Features
- **📄 Configurable # of items per page**: Increase the number of segments shown per page from the default 20 up to 200
- **🚻 Configurable gender for comparison**: Compare your PR against the segment record for men, women, or the fastest time overall
- **↕️ Sortable columns**: Sort the table by any column in ascending or descending order
- **🎨 Color-coded values**: Differences between your time and the segment record are color-coded to help you quickly identify segments where you hold a competitive time
- **➕ Additional columns**:
- **Absolute difference**: View the difference between your time and the segment record in seconds
- **Relative difference**: View the difference between your time and the segment record as a percentage

### Screenshots
| ![Screenshot of the starred segments page with the script running](screenshot.png) |
| ---------------------------------------------------------------------------------- |
| _Starred segments page ([strava.com/athlete/segments/starred]) - v0.1.1_ |

## Installation
> [!CAUTION]
> For security reasons, I do not recommend running scripts from the internet unless you understand what they are doing. If you are not a developer, I recommend reading the comments in the code and/or asking a LLM like [ChatGPT] or [Claude] to explain it to you.

I recommend using this script with a userscript manager because it will keep the script up-to-date and run it automatically when you visit the appropriate page. If you don't want to do that, you can also run it manually.

### Using a userscript manager
A userscript manager is a browser extension that allows you to organize and run scripts on websites. If you don't already have one, I would recommend [Violentmonkey], [Tampermonkey], or [Greasemonkey]. Once installed, you can click the button below to install the script.

[![Install](https://img.shields.io/badge/%F0%9F%A7%A9_Install-better--segments--for--strava.user.js-blue)](https://github.com/jerboa88/better-segments-for-strava/raw/refs/heads/main/better-segments-for-strava.user.js)

### Manually
> [!NOTE]
> This only works once. If the page gets reloaded (ex. by changing the # of items per page) or you navigate away and come back, you will have to run the script again. If you want to run the script automatically, I suggest using a userscript manager.

Alternatively, you can run the script by going to [strava.com/athlete/segments/starred], copying the code in [better-segments-for-strava.user.js], and pasting it into your browser's devtools console.

Detailed instructions:


  1. Open strava.com/athlete/segments/starred in your browser

  2. Open your browser's devtools console (how?)

  3. Copy the code in better-segments-for-strava.user.js and paste it into the console. If this doesn't work or you see a warning message about pasting, see the FAQ.

  4. Press enter to run the script. You should see the page update. If this doesn't happen, see the FAQ.

## Usage
This script only works on the starred segments page, so you will need to star segments that you want to track.

### Setting the number of items per page
By default, Strava only shows 20 segments per page. You can use the `Items per Page` dropdown to change this to 50, 100, or 200. This will reload the page.

### Setting gender for comparison
The script doesn't know your gender, so it defaults to using the fastest time overall to calculate differences. You can use the `Compare with Gender` dropdown to change the gender used for comparison.

### Sorting
> [!NOTE]
> Sorting only applies to the current page of results. If you want to sort the entire list, you will need to increase the number of items per page so that all segments are shown on a single page.

Click on the column headers to sort the table. Clicking on the same column header again will reverse the sort order.

### Color coding
Differences between your time and the record time are color coded, with warmer colors indicating a slower time and cooler colors indicating a faster time:
| 🟣🔵 | 🟢 | 🟡🟠🔴 |
| --------------------: | :---------: | ------------------- |
| <0% (ahead of leader) | 0% (leader) | >0% (behind leader) |

## FAQ

### Nothing shows up when I paste in the console / I get a warning when I try to paste in the console
Some browsers prevent you from pasting code in the console because it could be malicious. This is called Paste Protection and you can read more about it on the [Chrome for Developers Blog].

If this happens, follow the instructions in the console to re-enable pasting, and then try again. For Chrome, the following steps should work:
1. Try to paste something in the console. You should get a warning message about pasting
2. Type "allow pasting" in the console and press enter

See [this video] for a visual walkthrough.

### I get an `Uncaught SyntaxError: Unexpected identifier` error when running the script
Make sure that you select the entire file with Ctrl + A when copying it. If part of the script is cut off, it won't work.

## Contributing
If you encounter any problems with the script, feel free to [create an issue].

Pull requests, bug reports, translations, and other kinds of contributions are greatly appreciated. By contributing code, you agree to license your contributions under the terms of the [LICENSE].

## License
This project is licensed under the MIT License. See [LICENSE](LICENSE) for details.

The project logo is based on [vip-crown-line] by [Remix Icon],
licensed under [Apache License 2.0]. I have added start and end points to the line below the crown.

This project is not affiliated with or endorsed by Strava in any way.

[Apache License 2.0]: https://github.com/Remix-Design/remixicon/blob/master/License
[better-segments-for-strava.user.js]: better-segments-for-strava.user.js
[ChatGPT]: https://chatgpt.com/
[Chrome for Developers Blog]: https://developer.chrome.com/blog/self-xss
[Claude]: https://claude.ai
[create an issue]: https://github.com/jerboa88/better-segments-for-strava/issues
[Greasemonkey]: https://github.com/greasemonkey/greasemonkey
[LICENSE]: LICENSE
[Remix Icon]: https://remixicon.com/]
[starred segments page]: https://www.strava.com/athlete/segments/starred
[strava.com/athlete/segments/starred]: https://www.strava.com/athlete/segments/starred
[Strava]: https://strava.com
[Tampermonkey]: https://www.tampermonkey.net/index.php
[this video]: https://youtu.be/X5uyCtVD1-o?si=AOrzgez90KiDlA-z&t=11
[Violentmonkey]: https://violentmonkey.github.io/
[vip-crown-line]: https://remixicon.com/icon/vip-crown-line