Strava Button Clicker [For Use Convert Ascent and Descent to Feet][ELevate / Sauce Users]

Clicks the button to fetch the Ascent and Descent values in meters for use with the Convert Ascent and Descent to Feet script.

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Strava Button Clicker [For Use Convert Ascent and Descent to Feet][ELevate / Sauce Users]
// @namespace    typpi.online
// @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
// @supportURL   https://github.com/Nick2bad4u/UserStyles/issues
// @license      Unlicense
// @note         This is for use with: https://update.greasyfork.org/scripts/520655/Convert%20Ascent%20and%20Descent%20to%20Feet.user.js
// ==/UserScript==

(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);
})();