Skip to content

Commit 0e749b4

Browse files
author
hoang.tran12
committed
some refactor
1 parent b1d5f3b commit 0e749b4

File tree

5 files changed

+23
-10
lines changed

5 files changed

+23
-10
lines changed

scripts/_test.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,9 @@ export default {
150150
},
151151

152152
contentScript: {
153+
// onDocumentStart: () => {
154+
// window.stop();
155+
// },
153156
onClick() {
154157
console.log(UfsGlobal.DOM.getMousePos());
155158
},

scripts/auto_redirectLargestImageSrc.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,16 @@ export default {
55
vi: "Tự động - xem ảnh lớn nhất",
66
},
77
description: {
8-
en: "Auto redirect to largest image, support hundred of websites",
9-
vi: "Tự động chuyển trang sang ảnh lớn nhất, hỗ trợ hàng trăm trang web",
8+
en: `<ul>
9+
<li>When viewing an image in new tab.</li>
10+
<li>This script will auto find and redirect to largest image.</li>
11+
<li>Support hundred of websites.</li>
12+
</ul>`,
13+
vi: `<ul>
14+
<li>Khi bạn mở xem ảnh trong tab mới.</li>
15+
<li>Chức năng này sẽ tự động tìm và chuyển trang sang ảnh chất lượng cao nhất.</li>
16+
<li>Hỗ trợ hàng trăm trang web.</li>
17+
</ul>`,
1018
img: "/scripts/auto_redirectLargestImageSrc.jpg",
1119
},
1220

scripts/helpers/utils.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ export async function getNextDynamicRuleIds(count = 1) {
4848
const result = [];
4949
let nextAvailableId = 1;
5050

51-
for (let i = 0; i < count; i++) {
52-
while (ids.has(nextAvailableId)) {
53-
nextAvailableId++;
51+
while (result.length < count) {
52+
if (!ids.has(nextAvailableId)) {
53+
result.push(nextAvailableId);
54+
ids.add(nextAvailableId);
5455
}
55-
result.push(nextAvailableId);
56-
ids.add(nextAvailableId);
56+
nextAvailableId++;
5757
}
5858

5959
return count === 1 ? result[0] : result;

scripts/remove_tracking_in_url_rules_simplified.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@ export const simplifiedRules = {
2828
"ved",
2929
"uact",
3030
"stick",
31-
"sa",
32-
"usg",
3331
"sca_esv",
32+
33+
// uncomment this cause bug when open link from google chat
34+
// "sa",
35+
// "usg",
3436
],
3537
},
3638
Spotify: {

working_note.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
- [x] thêm event onInstalled, onStartup cho background script
1616

17-
- [ ] Kiểm tra trang web an toàn <https://chongluadao.vn/> <https://api.chongluadao.vn/v2/blacklist> <https://api.chongluadao.vn/v2/whitelist>
17+
- [x] Kiểm tra trang web an toàn <https://chongluadao.vn/> <https://api.chongluadao.vn/v2/blacklist> <https://api.chongluadao.vn/v2/whitelist>
1818

1919
- [x] Fix magnify image on right click
2020

0 commit comments

Comments
 (0)