Skip to content

Commit

Permalink
perf: add stop
Browse files Browse the repository at this point in the history
  • Loading branch information
wibus-wee committed Oct 22, 2024
1 parent 03a9f88 commit 171adba
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/utils/dialog.util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,25 @@ export function addDialogButtons(dialog: HTMLElement) {
restoreWatchedLessons();
}},
{ className: "start-watching", text: "开始观看", onClick: () => {
if (localStorage.getItem("isStartedLesson")) {
alert("你已经开始了刷课会话,请先结束刷课会话");
return;
}
if (localStorage.getItem("currentLesson")) {
localStorage.setItem("isStartedLesson", "true");
location.reload();
return;
}
const selectedLessons = getSelectedLessons();
autoWatchVideos(selectedLessons);
}},
{ className: "end-session", text: "结束刷课会话", onClick: () => {
localStorage.removeItem("watchedLessons");
localStorage.removeItem("currentLesson");
localStorage.removeItem("isStartedLesson");
}},
{ className: "toggle-watching", text: "暂停刷课", onClick: () => {
localStorage.removeItem("isStartedLesson");
}}
];

Expand Down

0 comments on commit 171adba

Please sign in to comment.