Skip to content

Commit b505b25

Browse files
Fix/avoid using a hard-code timezone &&Refactor: modify github star button style(#38)
* Fix/avoid using a hard-code timezone (#36) * Release: v0.1.4 * Fix/avoid using a hard-code timezone --------- Co-authored-by: Haco <75477391+xiaohajiayou@users.noreply.github.com> Co-authored-by: xiaohajiayou <923390377@qq.com> * Refactor: modify github star button style * Fix/avoid using a hard-code timezone (#36) * Release: v0.1.4 * Fix/avoid using a hard-code timezone --------- Co-authored-by: Haco <75477391+xiaohajiayou@users.noreply.github.com> Co-authored-by: xiaohajiayou <923390377@qq.com> * Refactor: modify github star button style --------- Co-authored-by: ishiko <ishiko732@gmail.com>
1 parent 5dcb2be commit b505b25

File tree

4 files changed

+78
-32
lines changed

4 files changed

+78
-32
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
| 提供笔记功能 | ✅ 已完成 | 题目列表中新增笔记按钮,支持导出所有笔记为Markdown |
8585
| 收集Anki fsrs 训练数据 | ✅ 已完成 | 待用于测试fsrs官方端口训练 |
8686
| 接入Anki fsrs官方训练端口 | ✅ 已完成 | 目前仅支持本地复习记录训练(云同步用户可能存在影响) |
87-
| 扩展webdev云同步服务 | ❌ 待完成 | 待接入坚果云 |
87+
| 扩展webdav云同步服务 | ❌ 待完成 | 待接入坚果云 |
8888
| 支持语言切换 | ❌ 待完成 | 待完成 |
8989
| 不同网站题目数据源切换 | ❌ 待完成 | 待完成(目前仅支持力扣国际站和中国站,待兼容洛谷等) |
9090
| 兼容火狐 | ❌ 待完成 | 待完成 |
@@ -101,7 +101,7 @@
101101
| Provide note-taking feature | ✳️ Completed | Add note button in problem list, support exporting all notes to Markdown |
102102
| Collect Anki FSRS training data | ✳️ Completed | To be used for testing FSRS official training endpoint |
103103
| Integrate Anki FSRS official training endpoint | ✳️ Completed | Currently supports training with local review records (may affect cloud sync users) |
104-
| Expand webdev cloud sync service | ❌ Pending | To be integrated with Nutstore |
104+
| Expand webdav cloud sync service | ❌ Pending | To be integrated with Nutstore |
105105
| Support language switching | ❌ Pending | Pending completion |
106106
| Switch data sources for different websites | ❌ Pending | Pending completion (currently only supports LeetCode international and Chinese sites, to be compatible with Luogu, etc.) |
107107
| Compatibility with Firefox | ❌ Pending | Pending completion |

popup.html

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -164,28 +164,28 @@ <h3>Add Review Card</h3>
164164
<!-- footer -->
165165
<div class="footer">
166166
<!-- GitHub Star -->
167-
<!-- 先放一个占位符 -->
168-
<div id="github-star-container"
169-
data-bs-toggle="tooltip"
170-
data-bs-placement="top"
171-
title="A star from you would make our day! 🌟">
172-
<a href="https://github.com/xiaohajiayou/Leetcode-Mastery-Scheduler"
167+
<a href="https://github.com/xiaohajiayou/Leetcode-Mastery-Scheduler"
173168
target="_blank"
174-
style="text-decoration: none; display: inline-block; margin-right: 15px;">
175-
<img alt="GitHub"
176-
src="https://img.shields.io/badge/GitHub-%20Star%20Us-color%3D%2523%234a9d9c?style=flat&color=%234a9d9c
177-
"
178-
height="20"
179-
style="margin: 0; vertical-align: middle;">
180-
</a>
181-
</div>
169+
style="text-decoration: none;"
170+
data-bs-toggle="tooltip"
171+
data-bs-placement="top"
172+
title="🌟 Star us please! / 点个星星吧!求求了~"
173+
>
174+
<button type="button" class="btn custom-btn github-star-btn">
175+
<div class="btn-content">
176+
<i class="fas fa-star"></i>
177+
<span>Star Us</span>
178+
</div>
179+
</button>
180+
</a>
182181

183-
<!-- 将 GitHub iframe 加载逻辑放在单独的脚本文件中 -->
184-
185182
<!-- 反馈按钮 -->
186183
<a href="https://github.com/xiaohajiayou/Leetcode-Mastery-Scheduler/issues"
187184
target="_blank"
188185
style="text-decoration: none;"
186+
data-bs-toggle="tooltip"
187+
data-bs-placement="top"
188+
title="💡 Report issue"
189189
>
190190
<button type="button" class="btn custom-btn feedback-btn-review">
191191
<div class="btn-content">
@@ -402,15 +402,21 @@ <h3>Add Review Card</h3>
402402
<div id="github-problems"
403403
data-bs-toggle="tooltip"
404404
data-bs-placement="top"
405-
title="A star from you would make our day! 🌟">
405+
>
406+
406407
<a href="https://github.com/xiaohajiayou/Leetcode-Mastery-Scheduler"
407408
target="_blank"
408-
style="text-decoration: none; display: inline-block; margin-right: 15px;">
409-
<img alt="GitHub"
410-
src="https://img.shields.io/badge/GitHub-%20Star%20Us-color%3D%2523%234a9d9c?style=flat&color=%234a9d9c
411-
"
412-
height="20"
413-
style="margin: 0; vertical-align: middle;">
409+
style="text-decoration: none;"
410+
data-bs-toggle="tooltip"
411+
data-bs-placement="top"
412+
title="🌟 Star us please! / 点个星星吧!求求了~"
413+
>
414+
<button type="button" class="btn custom-btn github-star-btn">
415+
<div class="btn-content">
416+
<i class="fas fa-star"></i>
417+
<span>Star Us</span>
418+
</div>
419+
</button>
414420
</a>
415421
</div>
416422

@@ -607,7 +613,6 @@ <h5 class="problem-title mb-2">
607613
<script type="text/javascript" src="lib/fontawesome.js"></script>
608614
<script src="dist/popup.js"></script>
609615

610-
<!-- 直接引用外部脚本文件 -->
611-
<script src="dist/loadGithubStar.js"></script>
616+
612617
</body>
613618
</html>

src/popup/delegate/fsrsDelegate.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@ export const optimizeFSRSParams = async (csvContent, onProgress) => {
33
try {
44
const formData = new FormData();
55
const csvBlob = new Blob([csvContent], { type: 'text/csv' });
6+
// ref: https://github.com/ishiko732/fsrs-online-training/blob/73b3281e4c972bf965083dcfe61f087383b4a083/components/lib/tz.ts#L3-L4
7+
// Chrome > 24, Edge > 12, Firefox > 29
8+
const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone
69
formData.append('file', csvBlob, 'revlog.csv');
710
formData.append('sse', '1');
811
formData.append('hour_offset', '4');
912
formData.append('enable_short_term', '0');
10-
formData.append('timezone', 'Asia/Shanghai');
13+
formData.append('timezone', timeZone);
1114

1215
const response = await fetch('https://ishiko732-fsrs-online-training.hf.space/api/train', {
1316
method: 'POST',

src/popup/popup.css

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -757,15 +757,53 @@ iframe {
757757

758758
#github-star-container {
759759
display: flex;
760-
align-items: center; /* 垂直居中对齐 */
761-
height: 30px; /* 固定高度,与按钮一致 */
760+
align-items: center;
761+
height: 30px;
762762
}
763763

764-
/* 确保 GitHub Star 按钮的样式 */
764+
/* GitHub Star 按钮样式 */
765765
.github-star-btn {
766+
font-size: 0.875rem;
767+
font-family: 'Courier Prime', monospace;
768+
background: #1d2e3d;
769+
border: 1px solid rgba(97, 218, 251, 0.3);
770+
color: #61dafb;
771+
border-radius: 6px;
772+
display: flex;
773+
align-items: center;
774+
gap: 0.6rem;
775+
transition: all 0.3s ease;
776+
position: relative;
777+
overflow: hidden;
778+
padding: 0.35rem 0.8rem;
779+
}
780+
781+
.github-star-btn:hover {
782+
background: #1a3244;
783+
border-color: #61dafb;
784+
box-shadow: 0 0 10px rgba(97, 218, 251, 0.5);
785+
color: #61dafb;
786+
}
787+
788+
.github-star-btn .btn-content {
766789
display: flex;
767790
align-items: center;
768-
height: 100%; /* 使其填满容器高度 */
791+
gap: 0.6rem;
792+
transition: all 0.3s ease;
793+
}
794+
795+
.github-star-btn:hover .btn-content {
796+
transform: translateX(2px);
797+
}
798+
799+
.github-star-btn i {
800+
font-size: 0.875rem;
801+
color: #61dafb;
802+
transition: all 0.3s ease;
803+
}
804+
805+
.github-star-btn:hover i {
806+
color: #61dafb;
769807
}
770808

771809
.feedback-btn-review {

0 commit comments

Comments
 (0)