Skip to content

Commit 0d53051

Browse files
author
hoang.tran12
committed
remove favorite + add fontawsome
1 parent 93de972 commit 0d53051

File tree

3 files changed

+112
-39
lines changed

3 files changed

+112
-39
lines changed

popup/helpers/category.js

Lines changed: 105 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,126 @@ export const CATEGORY = {
22
favorite: {
33
id: "favorite",
44
style: { textDecoration: "underline" },
5-
name: { en: "Favorite", vi: "Yêu thích" },
5+
name: {
6+
en: `<i class="fa-solid fa-star" style="color:#1F51FF"></i> Favorite`,
7+
vi: `<i class="fa-solid fa-star" style="color:#1F51FF"></i> Yêu thích`,
8+
},
69
},
710
recently: {
811
id: "recently",
912
style: { textDecoration: "underline" },
10-
name: { en: "Recently", vi: "Gần đây" },
13+
name: {
14+
en: `<i class="fa-solid fa-clock" style="color:#1F51FF"></i> Recently`,
15+
vi: `<i class="fa-solid fa-clock" style="color:#1F51FF"></i> Gần đây`,
16+
},
1117
},
1218
available: {
1319
id: "available",
1420
showCount: true,
1521
style: { textDecoration: "underline" },
16-
name: { en: "Available", vi: "Có thể dùng" },
17-
},
18-
search: { id: "search", name: { en: "Search", vi: "Tìm kiếm" } },
19-
download: { id: "download", name: { en: "Download", vi: "Tải xuống" } },
20-
facebook: { id: "facebook", name: { en: "Facebook", vi: "Facebook" } },
21-
instagram: { id: "instagram", name: { en: "Instagram", vi: "Instagram" } },
22-
youtube: { id: "youtube", name: { en: "Youtube", vi: "Youtube" } },
23-
github: { id: "github", name: { en: "Github", vi: "Github" } },
22+
name: {
23+
en: `<i class="fa-solid fa-play" style="color:#1F51FF"></i> Available`,
24+
vi: `<i class="fa-solid fa-play" style="color:#1F51FF"></i> Có thể dùng`,
25+
},
26+
},
27+
search: {
28+
id: "search",
29+
name: {
30+
en: `<i class="fa-solid fa-magnifying-glass"></i> Search`,
31+
vi: `<i class="fa-solid fa-magnifying-glass"></i> Tìm kiếm`,
32+
},
33+
},
34+
download: {
35+
id: "download",
36+
name: {
37+
en: `<i class="fa-solid fa-download"></i> Download`,
38+
vi: `<i class="fa-solid fa-download"></i> Tải xuống`,
39+
},
40+
},
41+
facebook: {
42+
id: "facebook",
43+
name: {
44+
en: `<i class="fa-brands fa-facebook"></i> Facebook`,
45+
vi: `<i class="fa-brands fa-facebook"></i> Facebook`,
46+
},
47+
},
48+
instagram: {
49+
id: "instagram",
50+
name: {
51+
en: `<i class="fa-brands fa-instagram"></i> Instagram`,
52+
vi: `<i class="fa-brands fa-instagram"></i> Instagram`,
53+
},
54+
},
55+
youtube: {
56+
id: "youtube",
57+
name: {
58+
en: `<i class="fa-brands fa-youtube"></i> Youtube`,
59+
vi: `<i class="fa-brands fa-youtube"></i> Youtube`,
60+
},
61+
},
62+
github: {
63+
id: "github",
64+
name: {
65+
en: `<i class="fa-brands fa-github"></i> Github`,
66+
vi: `<i class="fa-brands fa-github"></i> Github`,
67+
},
68+
},
2469
doutube: { id: "doutube", name: { en: "Doutu.be", vi: "Doutu.be" } },
25-
pdf: { id: "pdf", name: { en: "PDF", vi: "PDF" } },
26-
qrcode: { id: "qrcode", name: { en: "QR Code", vi: "QR Code" } },
70+
pdf: {
71+
id: "pdf",
72+
name: {
73+
en: `<i class="fa-solid fa-file-pdf"></i> PDF`,
74+
vi: `<i class="fa-solid fa-file-pdf"></i> PDF`,
75+
},
76+
},
77+
qrcode: {
78+
id: "qrcode",
79+
name: {
80+
en: `<i class="fa-solid fa-qrcode"></i> QR Code`,
81+
vi: `<i class="fa-solid fa-qrcode"></i> QR Code`,
82+
},
83+
},
2784
automation: {
2885
id: "automation",
29-
name: { en: "Automation", vi: "Tự động hoá" },
86+
name: {
87+
en: `<i class="fa-solid fa-robot"></i> Automation`,
88+
vi: `<i class="fa-solid fa-robot"></i> Tự động hoá`,
89+
},
90+
},
91+
password: {
92+
id: "password",
93+
name: {
94+
en: `<i class="fa-solid fa-key"></i> Password`,
95+
vi: `<i class="fa-solid fa-key"></i> Mật khẩu`,
96+
},
97+
},
98+
unlock: {
99+
id: "unlock",
100+
name: {
101+
en: `<i class="fa-solid fa-unlock"></i> Unlock`,
102+
vi: `<i class="fa-solid fa-unlock"></i> Mở khoá`,
103+
},
104+
},
105+
webUI: {
106+
id: "webui",
107+
name: {
108+
en: `<i class="fa-solid fa-eye"></i> Web UI`,
109+
vi: `<i class="fa-solid fa-eye"></i> Giao diện`,
110+
},
111+
},
112+
more: {
113+
id: "more",
114+
name: {
115+
en: `<i class="fa-solid fa-ellipsis"></i> More`,
116+
vi: `<i class="fa-solid fa-ellipsis"></i> Khác`,
117+
},
30118
},
31-
password: { id: "password", name: { en: "Password", vi: "Mật khẩu" } },
32-
unlock: { id: "unlock", name: { en: "Unlock", vi: "Mở khoá" } },
33-
webUI: { id: "webui", name: { en: "Web UI", vi: "Giao diện" } },
34-
more: { id: "more", name: { en: "More...", vi: "Khác..." } },
35119
recommend: {
36120
id: "recommend",
37121
style: { textDecoration: "underline" },
38-
name: { en: "Recommend", vi: "Khuyên dùng" },
122+
name: {
123+
en: `<i class="fa-solid fa-thumbs-up" style="color:#1F51FF"></i> Recommend`,
124+
vi: `<i class="fa-solid fa-thumbs-up" style="color:#1F51FF"></i> Khuyên dùng`,
125+
},
39126
},
40127
};

popup/index.js

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ async function createTabs() {
3333
// create tab button
3434
const tabBtn = document.createElement("button");
3535
tabBtn.className = "tablinks";
36-
tabBtn.textContent = t(tab.name);
36+
tabBtn.innerHTML = t(tab.name);
3737
tabBtn.type = "button";
3838
tabBtn.setAttribute("content-id", tab.id);
3939
if (tab.style && typeof tab.style === "object")
@@ -79,10 +79,9 @@ function createTabContent(tab) {
7979
});
8080
contentContainer.appendChild(emptyText);
8181
} else {
82-
for (let script of tab.scripts) {
82+
tab.scripts.forEach((script) => {
8383
contentContainer.appendChild(createScriptButton(script));
84-
// contentContainer.appendChild(document.createElement("br"));
85-
}
84+
});
8685
}
8786

8887
// inject to DOM
@@ -94,20 +93,12 @@ function createScriptButton(script) {
9493
// Section title
9594
if (isTitle(script)) {
9695
const title = document.createElement("h3");
97-
title.textContent = t(script.name);
96+
title.innerHTML = t(script.name);
9897
title.classList.add("section-title");
9998

10099
return title;
101100
}
102101

103-
const btnContainer = document.createElement("div");
104-
105-
// favorite
106-
// const favoriteBtn = document.createElement("span");
107-
// favoriteBtn.classList.add("favorite");
108-
// favoriteBtn.innerHTML = `<i class="fa-regular fa-star"></i>`;
109-
// btnContainer.appendChild(favoriteBtn);
110-
111102
// Button
112103
const button = document.createElement("button");
113104
button.className = "tooltip";
@@ -153,13 +144,13 @@ function createScriptButton(script) {
153144
title.innerText = t(script.name);
154145
button.appendChild(title);
155146

147+
// tooltip
156148
const tooltip = document.createElement("span");
157149
tooltip.classList.add("tooltiptext");
158150
tooltip.innerText = t(script.description);
159151
button.appendChild(tooltip);
160-
btnContainer.appendChild(button);
161152

162-
return btnContainer;
153+
return button;
163154
}
164155

165156
async function runScript(script) {

popup/styles/style.css

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,18 +95,13 @@ a:hover {
9595
margin-bottom: 10px;
9696
}
9797

98-
.content .btnContainer {}
99-
10098
.content .favorite {
10199
transform: scale(0);
102100
transition: all .2s;
103101
}
104102

105-
.content .btnContainer:hover .favorite {
106-
transform: scale(1);
107-
}
108-
109103
.content button {
104+
display: block;
110105
border: none;
111106
margin: 0.25em;
112107
padding: 0.75em 1em;

0 commit comments

Comments
 (0)