Skip to content

Commit 889efbb

Browse files
committed
refactor
1 parent e145a50 commit 889efbb

File tree

5 files changed

+27
-9
lines changed

5 files changed

+27
-9
lines changed

pages/viewScriptSource/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<script src="libs/javascript.min.js"></script>
1515

1616
<link rel="stylesheet" href="style.css">
17-
<script src="main.js"></script>
17+
<script type="module" src="main.js"></script>
1818
</head>
1919

2020
<body>
@@ -25,4 +25,4 @@
2525
</pre>
2626
</body>
2727

28-
</html>
28+
</html>

pages/viewScriptSource/main.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
import { run as enableSmoothScroll } from "../../scripts/smoothScroll.js";
2+
13
window.onload = async () => {
4+
enableSmoothScroll();
25
try {
36
let id = new URL(location.href).searchParams.get("file");
47
let source = await getScriptSource(id);

popup/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ async function updateButtonChecker(script, checkmarkContainer, val) {
394394
} else {
395395
checkmark.classList.remove("active");
396396
tooltip = t({
397-
vi: "Bật tự động chạy",
397+
vi: "Bật tự chạy",
398398
en: "Turn on Autorun",
399399
});
400400
}

scripts/auto_lockWebsite.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,23 @@ export default {
5757
await locker.sites.clear();
5858
return true;
5959
},
60+
onClick: async () => {
61+
const { t } = await import("../popup/helpers/lang.js");
62+
let password = await locker.password.get();
63+
if (password == null) {
64+
Swal.fire({
65+
icon: "warning",
66+
title: t({
67+
vi: "Cần tạo mật khẩu",
68+
en: "Autorun required",
69+
}),
70+
html: t({
71+
vi: "Bạn hãy Bật tự chạy và Tạo mật khẩu trước.<br/><br/>Sau đó hãy bấm lại để KHÓA trang web hiện tại nhé.",
72+
en: "Please enable autorun and create password first.<br/><br/>Then click again to LOCK current website.",
73+
}),
74+
});
75+
}
76+
},
6077
},
6178

6279
contentScript: {
@@ -75,9 +92,6 @@ export default {
7592
try {
7693
let password = await locker.password.get();
7794
if (password == null) {
78-
alert(
79-
"Bạn chưa tạo mật khẩu, Vui lòng bật chức năng và tạo mật khẩu trước"
80-
);
8195
return;
8296
}
8397
lockCurrentWebsite(password);

scripts/smoothScroll.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ export default {
55
vi: "Cuộn chuột siêu mượt",
66
},
77
description: {
8-
en: "Scroll smoothly on all websites with your mouse and keyboard. Smooth like this extension.",
9-
vi: "Cuộn chuột siêu mượt cho tất cả website, mượt như extension này vậy.",
8+
en: "Scroll smoothly on all websites with your mouse and keyboard.<br/>Smooth like when you scroll this extension.",
9+
vi: "Cuộn chuột siêu mượt cho tất cả website.<br/>Mượt như khi cuộn chuột trong extension này vậy.",
1010
img: "",
1111
},
1212

@@ -56,8 +56,9 @@ export default {
5656
},
5757
};
5858

59+
// TODO: setting page + horizontal scroll + fix window.scrollTo with behavior: "smooth"
60+
5961
// https://chromewebstore.google.com/detail/smoothscroll/nbokbjkabcmbfdlbddjidfmibcpneigj
60-
// TODO: setting page
6162
export function run() {
6263
// =======================================================================
6364
// ============================ sscr.js ==================================

0 commit comments

Comments
 (0)