Skip to content

Commit

Permalink
Close #8 #9 #11.
Browse files Browse the repository at this point in the history
* Update images.

* Bump to 2.0.0.

* Fix compile error.
  • Loading branch information
zhongl authored Sep 3, 2024
1 parent 52cf46e commit 43d4089
Show file tree
Hide file tree
Showing 60 changed files with 676 additions and 640 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Upload to webstore
uses: mnao305/chrome-extension-upload@v5.0.0
with:
file-path: dist/file.zip
file-path: mpb.zip
extension-id: nojpfacijldambjcnpbpneghbaefnlme
client-id: ${{ secrets.CLIENT_ID }}
client-secret: ${{ secrets.CLIENT_SECRET }}
Expand Down
6 changes: 3 additions & 3 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
version = "3.7.12"
version = "3.8.3"

runner.dialect = scala3
project.git = true

preset = default
preset = Scala.js
indent.defnSite = 2
align.preset = more
maxColumn = 120
Expand All @@ -21,7 +21,7 @@ rewrite.imports.groups = [

rewrite.scala3.convertToNewSyntax = true
rewrite.scala3.removeOptionalBraces = true
rewrite.scala3.insertEndMarkerMinLines = 10
rewrite.scala3.insertEndMarkerMinLines = 3

fileOverride {
"glob:**/*.sc" {
Expand Down
23 changes: 3 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@



![Activities Chart](./mpb-activities.png)
![Activity Chart](./mpb-activity.png)
![Profile Chart](./mpb-profile.png)
![History Chart](./mpb-history.png)
![Intervals Chart](./mpb-intervals.png)

这是一款面向 **入门跑者****[MAF训练法][maf]跑者** 的,聚焦于跑步训练中 **[速心比](#速心比meters-per-beat)** 指标数据可视化的浏览器扩展程序(俗称:插件)。

Expand All @@ -19,7 +18,7 @@
将其与速度关联起来,即 *平均速度*[^mpm]*平均心率* 的比值,以便反映身体努力程度与速度的变化关系。
从而更为有效的评估自己每一次严肃的训练表现。这在关注最大有氧能力(MAF)的跑者看来,是显而易见的。

[^mpm]: 平均每分钟跑多少米,可用活动记录中 **平均配速(或平均坡度调整配速)**换算而来。
[^mpm]: 平均每分钟跑多少米

相较 **最大摄氧量****乳酸阈值** 这样专业的竞技训练指标而言,速心比是大众跑者在佩戴一款支持GPS和心率的手表,即可实时获知的。
尽管一些专业跑表也提供 [**最大摄氧量**][vomax][**乳酸阈值**][lt] 估算值,只是在实际使用中,它们时常会与自身的体感有所出入。
Expand All @@ -34,22 +33,6 @@
1. 已有[Garmin Connect 中国][gcc]账号;
1. 此账号下已上传多次类型为 **跑步** 的活动记录。

## 最佳实践

为了更科学地分析对比多次跑步活动的速心比指标数据,强烈参考以下实践:

![课程参考](workout.png)

1.**训练课程** 中,创建一个属于自己的跑步专项课程;
1. 课程中至少有 **热身****跑步** 两个步骤;
1. 步骤中 **持续时间****训练目标** 可按需调整;
1. 保存并同步至手表,供下次训练使用。

一旦课程训练数据存在后,进入课程页面会看到如下:

![Workout Charts](./mpb-workout.png)


## 安装

请移步[Chrome 商店][ws]
Expand Down
6 changes: 5 additions & 1 deletion build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ import $ivy.`com.github.lolgab::mill-scalablytyped::0.1.14`
import com.github.lolgab.mill.scalablytyped._

object root extends RootModule with ScalaJSModule with ScalablyTyped {
def scalaVersion = "3.4.2"
def scalaVersion = "3.5.0"
def scalaJSVersion = "1.16.0"
def moduleKind = ModuleKind.ESModule

override def ivyDeps: T[Agg[Dep]] = T {
super.ivyDeps() ++ Agg(ivy"com.lihaoyi::sourcecode::0.4.2")
}

override def scalacOptions: Target[Seq[String]] = T {
super.scalacOptions() ++ Seq("-Wunused:all")
}
Expand Down
Binary file removed mpb-activities.png
Binary file not shown.
Binary file removed mpb-activity.png
Binary file not shown.
Binary file added mpb-history.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mpb-intervals.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed mpb-profile.png
Binary file not shown.
Binary file removed mpb-workout.png
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "meters-per-beat",
"description": "A visualization of running performance with Garmin Connect",
"private": true,
"version": "1.3.0",
"version": "2.0.0",
"type": "module",
"scripts": {
"dev": "vite build --watch --mode development",
Expand Down
23 changes: 14 additions & 9 deletions src/Main.scala
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
import org.scalajs.dom.*

import core.*
import garmin.*
import plotly.given

object Main:

def main(args: Array[String]): Unit =
val route = OnPageActivities() orElse OnPageActivity() orElse OnPageWorkout() orElse OnPageProfile()
MutationObserver: (rs, _) =>
route.applyOrElse((new URL(window.location.href), rs.toSeq), _ => ())
.observe(
document.querySelector("div.main-body"),
new:
childList = true
subtree = true
)
val init = new MutationObserverInit:
childList = true
subtree = true

MutationObserver: (smr, _) =>
val url = URL(window.location.href)
val added = smr.flatMap(_.addedNodes).collect({ case e: HTMLElement => e }).toSeq
summon[Page[(Activities, Profile)]](url -> added)
.observe(document.querySelector("div.main-body"), init)

end main

end Main
29 changes: 0 additions & 29 deletions src/OnPageActivities.scala

This file was deleted.

36 changes: 0 additions & 36 deletions src/OnPageActivity.scala

This file was deleted.

44 changes: 0 additions & 44 deletions src/OnPageProfile.scala

This file was deleted.

35 changes: 0 additions & 35 deletions src/OnPageWorkout.scala

This file was deleted.

23 changes: 0 additions & 23 deletions src/common/Anchor.scala

This file was deleted.

42 changes: 0 additions & 42 deletions src/common/Functional.scala

This file was deleted.

22 changes: 0 additions & 22 deletions src/common/Generic.scala

This file was deleted.

6 changes: 0 additions & 6 deletions src/common/GetElement.scala

This file was deleted.

8 changes: 0 additions & 8 deletions src/common/GetMutationRecord.scala

This file was deleted.

10 changes: 0 additions & 10 deletions src/common/GetURL.scala

This file was deleted.

Loading

0 comments on commit 43d4089

Please sign in to comment.