-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathAscentDescentMetersToFeet-AutoFetcher.user.js
More file actions
50 lines (46 loc) · 2.07 KB
/
AscentDescentMetersToFeet-AutoFetcher.user.js
File metadata and controls
50 lines (46 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// ==UserScript==
// @name Strava Button Clicker [For Use Convert Ascent and Descent to Feet][ELevate / Sauce Users]
// @namespace nick2bad4u.github.io
// @version 1.2
// @description Clicks the button to fetch the Ascent and Descent values in meters for use with the Convert Ascent and Descent to Feet script.
// @author Nick2bad4u
// @match https://www.strava.com/activities/*
// @resource https://www.google.com/s2/favicons?sz=64&domain=strava.com
// @icon https://www.google.com/s2/favicons?sz=64&domain=strava.com
// @icon64 https://www.google.com/s2/favicons?sz=64&domain=strava.com
// @grant none
// @run-at document-end
// @homepageURL https://github.com/Nick2bad4u/UserStyles
// @homepage https://github.com/Nick2bad4u/UserStyles
// @supportURL https://github.com/Nick2bad4u/UserStyles/issues
// @license Unlicense
// @downloadURL https://update.greasyfork.org/scripts/530304/Strava%20Button%20Clicker%20%5BFor%20Use%20Convert%20Ascent%20and%20Descent%20to%20Feet%5D%5BELevate%20%20Sauce%20Users%5D.user.js
// @updateURL https://update.greasyfork.org/scripts/530304/Strava%20Button%20Clicker%20%5BFor%20Use%20Convert%20Ascent%20and%20Descent%20to%20Feet%5D%5BELevate%20%20Sauce%20Users%5D.meta.js
// ==/UserScript==
// Note: This is for use with: https://update.greasyfork.org/scripts/520655/Convert%20Ascent%20and%20Descent%20to%20Feet.user.js
(function () {
'use strict';
// Run 5 seconds after the page finishes loading
setTimeout(() => {
// Select the button by its ID
let button = document.querySelector('#extendedStatsButton');
if (button) {
button.click();
console.log('Button clicked.');
// Close the popup after 3 seconds using the Escape key
setTimeout(() => {
let event = new KeyboardEvent('keydown', {
key: 'Escape',
code: 'Escape',
keyCode: 27,
which: 27,
bubbles: true,
});
document.dispatchEvent(event);
console.log('Popup closed.');
}, 3000);
} else {
console.error('Button not found. Please ensure the selector is correct.');
}
}, 5000);
})();