1. ==Major Feature==: This plugin now supports usage on the Mobile end!
  2. ==Major Optimization==: Added support for **read-only mode**, now the timer can be updated in real time and data can be persisted even in read-only mode.
  3. ==Major Feature==: Added a timer deletion function, which can be accessed through the command line or right-click menu.
  4. **Slimming Plan for Timer Blocks a Huge Success!**: The length of Timer blocks has been significantly reduced by 60% in version V1.0.5.
  5. Bug Fix: Fixed the issue where time display was incorrect after exceeding 24 hours.
This commit is contained in:
frankthwang 2025-08-05 12:48:08 +08:00
parent 7ea010d7eb
commit f160143545
5 changed files with 1273 additions and 938 deletions

View file

@ -20,7 +20,7 @@ A text block timing tool designed for Obsidian, allowing you to add a **count-up
### 1. Command Palette + Shortcut (Recommended⭐)
1. Configure a shortcut for the command "Text Block Timer: Toggle timer" for quick access.
2. When the cursor is on a text block, press the shortcut key to start, pause, or resume.
2. When the cursor is on a text block, press the shortcut key to start, pause, resume, or delete the timer.
3. The timer will be displayed in the format `【⏳00:00:00 】` at the beginning of the text line.
![Command Shortcut](https://github.com/wth461694678/text-block-timer/blob/main/demo/command_shortcut.gif)
@ -28,7 +28,7 @@ A text block timing tool designed for Obsidian, allowing you to add a **count-up
### 2. Mouse Operations (Not Recommended)
1. Right-click on a text line.
2. Select "Start Timer," "Pause Timer," or "Resume Timer."
2. Select "Start Timer", "Pause Timer", "Resume Timer", or "Delete Timer".
![Right Click](https://github.com/wth461694678/text-block-timer/blob/main/demo/right_click.gif)
@ -39,50 +39,56 @@ A text block timing tool designed for Obsidian, allowing you to add a **count-up
![controlbycheckbox](https://github.com/wth461694678/text-block-timer/blob/main/demo/controlbycheckbox.gif)
## Custom Settings
Users can customize the following options in the plugin Settings:
### 1. Whether to continue timing after the file or Obsidian closed
Users can freely choose whether to continue the timing after closing the file or disabling Obsidian.
#### 1.1 never stops unless the user stops manually
After a user closes a file or exits Obsidian, the timer will still "time in the background". When the file is opened next time, the time spent during the closure period will be counted as the timer time and the timing will automatically resume.
<img src="https://github.com/wth461694678/text-block-timer/blob/main/demo/settings_never.gif" width="100%" alt="">
![settings_never](https://github.com/wth461694678/text-block-timer/blob/main/demo/settings_never.gif)
#### 1.2 auto-stop only when exiting Obsidian. Background timing continues when closing files (recommended, default option)
After the user closes a file, the timer will still "time in the background". When the file is opened next time, the time spent during the closing period will be counted as the timer time and the timing will automatically resume.
However, once the user exits Obsidian, all timers will stop immediately to prevent significant data errors caused by the user forgetting to manually close the timers.
<img src="https://github.com/wth461694678/text-block-timer/blob/main/demo/settings_quit.gif" width="100%" alt="">
![settings_quit](https://github.com/wth461694678/text-block-timer/blob/main/demo/settings_quit.gif)
#### 1.3 auto-stop immediately when closing a file
After the user closes a file, all timers will stop immediately. However, if a file is closed by mistake, it may cause the timer to pause.
<img src="https://github.com/wth461694678/text-block-timer/blob/main/demo/settings_close.gif" width="100%" alt="">
![settings_close](https://github.com/wth461694678/text-block-timer/blob/main/demo/settings_close.gif)
### 2. Timer insert position
Users can choose to insert a timer label either before or after the text block.
<img src="https://github.com/wth461694678/text-block-timer/blob/main/demo/insert_position.png" width="100%" alt="">
Users can choose to insert a timer label either before or after the text block.
![insert_position](https://github.com/wth461694678/text-block-timer/blob/main/demo/insert_position.png)
### 3. Control Timer by Task Status Automatically - Path Control
In the default settings, path control is disabled. When you only want to use the timer in specific folders, you can use a whitelist or blacklist to control it, which will only take effect in one of the two ways.
- Disable path controlthis feature can always take place
<img src="https://github.com/wth461694678/text-block-timer/blob/main/demo/pathControl_no.gif" width="100%" alt="">
![pathControl_no](https://github.com/wth461694678/text-block-timer/blob/main/demo/pathControl_no.gif)
- Whitelistonly folders in the whitelist will work
<img src="https://github.com/wth461694678/text-block-timer/blob/main/demo/pathControl_white.gif" width="100%" alt="">
![pathControl_white](https://github.com/wth461694678/text-block-timer/blob/main/demo/pathControl_white.gif)
- Blacklistfolders in the blacklist will not work
<img src="https://github.com/wth461694678/text-block-timer/blob/main/demo/pathControl_black.gif" width="100%" alt="">
![pathControl_black](https://github.com/wth461694678/text-block-timer/blob/main/demo/pathControl_black.gif)
## Version Log:
- V1.0.5
1. ==Major Feature==: This plugin now supports usage on the Mobile end!
2. ==Major Optimization==: Added support for **read-only mode**, now the timer can be updated in real time and data can be persisted even in read-only mode.
3. ==Major Feature==: Added a timer deletion function, which can be accessed through the command line or right-click menu.
4. **Slimming Plan for Timer Blocks a Huge Success!**: The length of Timer blocks has been significantly reduced by 60% in version V1.0.5.
5. Bug Fix: Fixed the issue where time display was incorrect after exceeding 24 hours.
- V1.0.4
1. ==Major Feature==Now you can control the timer switch by the checkbox in the task front.
@ -102,4 +108,4 @@ In the default settings, path control is disabled. When you only want to use the
## Development Information
- Developer: frankthwang
- Version: 1.0.4
- Version: 1.0.5

View file

@ -20,7 +20,7 @@
### 1. 命令行+快捷键(推荐⭐️)
1. 为命令 "Text Block Timer: Toggle timer" 配置快捷键,方便快速使用
2. 当光标在某个文本块时按下快捷键即可实现timer的开始、暂停、继续操作
2. 当光标在某个文本块时按下快捷键即可实现timer的开始、暂停、继续、删除操作
3. 计时器会以 `【⏳00:00:00 】`格式显示在文本块的行首
![Command Shortcut](https://github.com/wth461694678/text-block-timer/blob/main/demo/command_shortcut.gif)
@ -28,7 +28,7 @@
### 2. 鼠标操作(不推荐)
1. 在文本行上右键点击
2. 选择"开始计时"、"暂停计时"或"继续计时"
2. 选择"开始计时"、"暂停计时"、"继续计时"、"删除计时器"
![Right Click](https://github.com/wth461694678/text-block-timer/blob/main/demo/right_click.gif)
@ -53,44 +53,50 @@
用户关闭文件、退出Obsidian后计时器依然会“后台计时”在下次打开文件时会讲关闭期间的耗时计入计时器耗时并自动恢复计时。
<img src="https://github.com/wth461694678/text-block-timer/blob/main/demo/settings_never.gif" width="100%" alt="">
![settings_never](https://github.com/wth461694678/text-block-timer/blob/main/demo/settings_never.gif)
#### 1.2 仅退出Obsidian时停止关闭文件依然后台计时推荐默认选项
用户关闭文件后,计时器依然会“后台计时”,在下次打开文件时,会讲关闭期间的耗时计入计时器耗时,并自动恢复计时。
然而用户退出Obsidian后所有计时器会立即停止防止用户忘记手动关闭计时器导致数据产生重大误差。
<img src="https://github.com/wth461694678/text-block-timer/blob/main/demo/settings_quit.gif" width="100%" alt="">
![settings_quit](https://github.com/wth461694678/text-block-timer/blob/main/demo/settings_quit.gif)
#### 1.3 关闭文件时立即停止
用户关闭文件后,所有计时器会立即停止,但在误关文件时,可能导致计时暂停。
<img src="https://github.com/wth461694678/text-block-timer/blob/main/demo/settings_close.gif" width="100%" alt="">
![settings_close](https://github.com/wth461694678/text-block-timer/blob/main/demo/settings_close.gif)
### 2. 插入位置
用户可以选择在文本块的前面或后面插入计时器标签。对于Day Planner用户而言推荐插入在文本块后面。
<img src="https://github.com/wth461694678/text-block-timer/blob/main/demo/insert_position.png" width="100%" alt="">
![insert_position](https://github.com/wth461694678/text-block-timer/blob/main/demo/insert_position.png)
### 3. 通过任务状态自动控制计时器 - 路径控制
在默认设置下,路径控制是关闭的。当你只希望在部分文件夹下使用该功能,你可以通过白名单或黑名单的方式进行控制,这两种方式只会生效其中一种。
- 不控制:所有文件夹下都可以使用该功能
<img src="https://github.com/wth461694678/text-block-timer/blob/main/demo/pathControl_no.gif" width="100%" alt="">
![pathControl_no](https://github.com/wth461694678/text-block-timer/blob/main/demo/pathControl_no.gif)
- 白名单:只有在白名单中的文件夹下,才会生效
<img src="https://github.com/wth461694678/text-block-timer/blob/main/demo/pathControl_white.gif" width="100%" alt="">
![pathControl_white](https://github.com/wth461694678/text-block-timer/blob/main/demo/pathControl_white.gif)
- 黑名单:在黑名单中的文件夹下,不会生效
<img src="https://github.com/wth461694678/text-block-timer/blob/main/demo/pathControl_black.gif" width="100%" alt="">
![pathControl_black](https://github.com/wth461694678/text-block-timer/blob/main/demo/pathControl_black.gif)
## 版本日志:
- V1.0.5
1. ==重大功能==该插件现在已经支持Mobile端使用
2. ==重大优化==:增加**只读模式**支持,现在只读模式也可实时更新计时器并持久化数据
3. ==重大功能==:增加了删除计时器功能,删除计时器可通过命令行或右键菜单使用
4. **Timer块瘦身计划大成功**V1.0.5版本Timer块长度大幅削减60%
5. BUG修复修复了计时超过24小时后时间展示不正确问题
- V1.0.4
1. ==重大功能==:现在你可以通过任务前的 [ ] 勾选框来控制计时器的开关
@ -110,4 +116,4 @@
## 开发信息
- 开发者: frankthwang
- 版本: 1.0.4
- 版本: 1.0.5

2116
main.js

File diff suppressed because it is too large Load diff

View file

@ -1,9 +1,9 @@
{
"id": "text-block-timer",
"version": "1.0.4",
"minAppVersion": "1.8.9",
"version": "1.0.5",
"minAppVersion": "1.8.0",
"name": "Text Block Timer",
"author": "frankthwang",
"description": "Add a timer to text block to enable count-up timing.",
"isDesktopOnly": true
"isDesktopOnly": false
}

View file

@ -1,26 +1,3 @@
.timer-container {
display: inline-flex;
align-items: center;
margin-left: 10px;
}
.timer-button {
width: 0;
height: 0;
border-style: solid;
border-width: 8px 0 8px 12px;
border-color: transparent transparent transparent var(--text-normal);
cursor: pointer;
margin-right: 5px;
}
.timer-button.paused {
border-style: double;
border-width: 0 0 0 12px;
border-color: transparent transparent transparent var(--text-normal);
}
.timer-display {
font-size: 0.9em;
color: var(--text-muted);
.timer-r {
color: #10b981;
}