Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getGCRecoveryHR() {
- // get sleep data from garmin connect
- let loc = window.location.href
- let connectURL = "https://connect.garmin.com/modern/activity/";
- if (loc.indexOf(connectURL) != 0 || typeof jQuery === "undefined") {
- alert(
- `You must be logged into Garmin Connect to run this script.
- Your current tab must also be a Garmin Connect activity page with
- URL starting with: ${connectURL}`);
- return;
- }
- // Garmin Connect uses jQuery, so it's available for this script
- const activityId = loc.replace(connectURL, "");
- jQuery.getJSON(
- `https://connect.garmin.com/modern/proxy/activity-service/activity/${activityId}`,
- function(response) {
- if (response.summaryDTO.recoveryHeartRate === undefined) {
- alert("No recovery HR saved for this activity")
- } else {
- alert(`❤ Recovery HR: ${response.summaryDTO.recoveryHeartRate} bpm`);
- }
- }
- ).fail(function() {
- alert("Failed to get activity data 😔");
- })
- }
- getGCRecoveryHR()
Advertisement
Add Comment
Please, Sign In to add comment