Skip to content

Commit a81ef3b

Browse files
author
hoang.tran12
committed
update icon
1 parent 0f1e4d0 commit a81ef3b

File tree

5 files changed

+43
-21
lines changed

5 files changed

+43
-21
lines changed

popup/helpers/category.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,25 @@ export const CATEGORY = {
33
id: "favorite",
44
style: { textDecoration: "underline" },
55
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`,
6+
en: `<i class="fa-solid fa-star fa-beat" style="--fa-beat-scale: 1.5;color:#1F51FF"></i> Favorite`,
7+
vi: `<i class="fa-solid fa-star fa-beat" style="--fa-beat-scale: 1.5;color:#1F51FF"></i> Yêu thích`,
88
},
99
},
1010
recently: {
1111
id: "recently",
1212
style: { textDecoration: "underline" },
1313
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`,
14+
en: `<i class="fa-solid fa-clock fa-spin-pulse" style="color:#1F51FF"></i> Recently`,
15+
vi: `<i class="fa-solid fa-clock fa-spin-pulse" style="color:#1F51FF"></i> Gần đây`,
1616
},
1717
},
1818
available: {
1919
id: "available",
2020
showCount: true,
2121
style: { textDecoration: "underline" },
2222
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`,
23+
en: `<i class="fa-solid fa-play fa-beat-fade" style="color:#1F51FF"></i> Available`,
24+
vi: `<i class="fa-solid fa-play fa-beat-fade" style="color:#1F51FF"></i> Có thể dùng`,
2525
},
2626
},
2727
search: {
@@ -120,8 +120,8 @@ export const CATEGORY = {
120120
id: "recommend",
121121
style: { textDecoration: "underline" },
122122
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`,
123+
en: `<i class="fa-solid fa-thumbs-up fa-bounce" style="color:#1F51FF"></i> Recommend`,
124+
vi: `<i class="fa-solid fa-thumbs-up fa-bounce" style="color:#1F51FF"></i> Khuyên dùng`,
125125
},
126126
},
127127
};

popup/index.js

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -154,23 +154,37 @@ function createScriptButton(script, isFavorite = false) {
154154

155155
// button icon
156156
if (script.icon && typeof script.icon === "string") {
157-
const icon = document.createElement("img");
158-
icon.classList.add("icon");
159-
icon.src = script.icon;
160-
button.appendChild(icon);
157+
// image icon
158+
if (
159+
script.icon.indexOf("http://") === 0 ||
160+
script.icon.indexOf("https://") === 0
161+
) {
162+
const icon = document.createElement("img");
163+
icon.classList.add("icon-img");
164+
icon.src = script.icon;
165+
button.appendChild(icon);
166+
}
167+
168+
// text/html icon
169+
else {
170+
const icon = document.createElement("span");
171+
icon.classList.add("icon-html");
172+
icon.innerHTML = script.icon;
173+
button.appendChild(icon);
174+
}
161175
}
162176

163177
// button title
164178
const title = document.createElement("span");
165179
title.classList.add("btn-title");
166-
title.innerText = t(script.name);
180+
title.innerHTML = t(script.name);
167181
button.appendChild(title);
168182

169183
// add to favorite button
170184
const addFavoriteBtn = document.createElement("i");
171185
addFavoriteBtn.className = isFavorite
172-
? "fa-solid fa-star active"
173-
: "fa-regular fa-star";
186+
? "fa-solid fa-star star active"
187+
: "fa-regular fa-star star";
174188
addFavoriteBtn.onclick = (e) => {
175189
e.stopPropagation();
176190
e.preventDefault();

popup/styles/style.css

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,22 +122,22 @@ a:hover {
122122
transition: all 50ms;
123123
}
124124

125-
.content button i {
125+
.content button i.star {
126126
opacity: 0;
127127
width: 0;
128128
transition: all .2s;
129129
}
130130

131-
.content button i.active {
131+
.content button i.star.active {
132132
color: #0048ad;
133133
}
134134

135-
.content button i:hover {
135+
.content button i.star:hover {
136136
transform: scale(1.8);
137137
}
138138

139-
.content button:hover i,
140-
.content button i.active {
139+
.content button:hover i.star,
140+
.content button i.star.active {
141141
width: auto;
142142
margin-left: 5px;
143143
opacity: 1;
@@ -147,13 +147,19 @@ a:hover {
147147
vertical-align: middle;
148148
}
149149

150-
.content button .icon {
150+
.content button .icon-img {
151151
display: inline-block;
152152
vertical-align: middle;
153153
height: 30px;
154154
margin-right: 5px;
155155
}
156156

157+
.content button .icon-html {
158+
display: inline-block;
159+
vertical-align: middle;
160+
margin-right: 5px;
161+
}
162+
157163
.content button .badgeContainer {
158164
position: absolute;
159165
top: 0;

scripts/performanceAnalyzer.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export default {
2+
icon: `<i class="fa-solid fa-gauge-max"></i>`,
23
name: {
34
en: "Performance Analyzer",
45
vi: "Phân tích hiệu suất",

scripts/toggleEditPage.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export default {
2+
icon: `<i class="fa-solid fa-pen-to-square"></i>`,
23
name: {
34
en: "Toggle edit page",
45
vi: "Bật/tắt chế độ chỉnh sửa website",

0 commit comments

Comments
 (0)