Skip to content

Commit 3e78098

Browse files
committed
feat: update version to 1.1 and add auto-fetcher script for Strava ascent/descent values
1 parent dc2c8df commit 3e78098

2 files changed

Lines changed: 52 additions & 10 deletions

File tree

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// ==UserScript==
2+
// @name Strava Button Clicker [For Use Convert Ascent and Descent to Feet][ELevate / Sauce Users]
3+
// @namespace typpi.online
4+
// @version 1.1
5+
// @description Clicks the button to fetch the Ascent and Descent values in meters for use with the Convert Ascent and Descent to Feet script.
6+
// @author Nick2bad4u
7+
// @match https://www.strava.com/activities/*
8+
// @resource https://www.google.com/s2/favicons?sz=64&domain=strava.com
9+
// @icon https://www.google.com/s2/favicons?sz=64&domain=strava.com
10+
// @icon64 https://www.google.com/s2/favicons?sz=64&domain=strava.com
11+
// @grant none
12+
// @run-at document-end
13+
// @homepageURL https://github.com/Nick2bad4u/UserStyles
14+
// @supportURL https://github.com/Nick2bad4u/UserStyles/issues
15+
// @license Unlicense
16+
// @note This is for use with: https://update.greasyfork.org/scripts/520655/Convert%20Ascent%20and%20Descent%20to%20Feet.user.js
17+
// ==/UserScript==
18+
19+
(function () {
20+
'use strict';
21+
22+
// Run 5 seconds after the page finishes loading
23+
setTimeout(() => {
24+
// Select the button by its ID
25+
let button = document.querySelector('#extendedStatsButton');
26+
if (button) {
27+
button.click();
28+
console.log('Button clicked.');
29+
30+
// Close the popup after 3 seconds using the Escape key
31+
setTimeout(() => {
32+
let event = new KeyboardEvent('keydown', {
33+
key: 'Escape',
34+
code: 'Escape',
35+
keyCode: 27,
36+
which: 27,
37+
bubbles: true,
38+
});
39+
document.dispatchEvent(event);
40+
console.log('Popup closed.');
41+
}, 3000);
42+
} else {
43+
console.error('Button not found. Please ensure the selector is correct.');
44+
}
45+
}, 5000);
46+
})();

AscentDescentMetersToFeet.user.js

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
// ==UserScript==
22
// @name Convert Ascent and Descent to Feet
33
// @namespace typpi.online
4-
// @version 1.02
4+
// @version 1.1
55
// @description Converts ascent and descent values from meters to feet on the for Strava Sauce users.
66
// @author Nick2bad4u
77
// @license UnLicense
88
// @match https://www.strava.com/activities/*
9+
// @resource https://www.google.com/s2/favicons?sz=64&domain=strava.com
910
// @icon https://www.google.com/s2/favicons?sz=64&domain=strava.com
11+
// @icon64 https://www.google.com/s2/favicons?sz=64&domain=strava.com
1012
// @grant none
1113
// @run-at document-end
1214
// @downloadURL https://update.greasyfork.org/scripts/520655/Convert%20Ascent%20and%20Descent%20to%20Feet.user.js
13-
// @updateURL https://update.greasyfork.org/scripts/520655/Convert%20Ascent%20and%20Descent%20to%20Feet.meta.js
15+
// @updateURL https://update.greasyfork.org/scripts/520655/Convert%20Ascent%20and%20Descent%20to%20Feet.meta.js
1416
// ==/UserScript==
1517

1618
(function () {
@@ -39,17 +41,11 @@
3941

4042
// Check if the elements exist on the page
4143
if (ascentElement && descentElement) {
42-
console.log(
43-
'Ascent and descent elements found:',
44-
ascentElement,
45-
descentElement,
46-
);
44+
console.log('Ascent and descent elements found:', ascentElement, descentElement);
4745

4846
// Extract the numeric values and convert them to feet
4947
const ascentValueInMeters = parseFloat(ascentElement.textContent.trim());
50-
const descentValueInMeters = parseFloat(
51-
descentElement.textContent.trim(),
52-
);
48+
const descentValueInMeters = parseFloat(descentElement.textContent.trim());
5349

5450
// Convert ascent value and check if valid
5551
const ascentValueInFeet = metersToFeet(ascentValueInMeters);

0 commit comments

Comments
 (0)