-
-
Notifications
You must be signed in to change notification settings - Fork 60
/
Copy pathfb_toggleLight.js
57 lines (53 loc) · 1.72 KB
/
fb_toggleLight.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import { UfsGlobal } from "./content-scripts/ufs_global.js";
export default {
icon: `<i class="fa-solid fa-lightbulb fa-lg"></i>`,
name: {
en: "Turn off light facebook newfeed",
vi: "Tắt đèn newfeed facebook",
},
description: {
en:
"Hide Navigator bar and complementary bar in facebook.<br/><br/>" +
"<ul>" +
"<li>Click to temporarily hide/show on this page.</li>" +
"<li>Enable autorun to auto hide whenever open facebook.</li>" +
"</ul>",
vi:
"Ẩn giao diện 2 bên newfeed, giúp tập trung vào newfeed facebook.<br/><br/>" +
"<ul>" +
"<li>Click để ẩn/hiện tạm thời trong trang hiện tại.</li>" +
"<li>Bật tự chạy để tự động ẩn mỗi khi mở facebook.</li>" +
"</ul>",
},
changeLogs: {
"2024-05-19": "fix auto hide",
},
whiteList: ["https://*.facebook.com/*"],
contentScript: {
onDocumentIdle: () => {
UfsGlobal.DOM.onElementsAdded(
'[role="navigation"], [role="complementary"]',
() => {
[
document.querySelectorAll('[role="navigation"]')?.[2],
document.querySelectorAll('[role="complementary"]')?.[0],
].forEach((el) => {
if (el) {
el.style.display = "none";
} else console.log("ERROR: Cannot find element");
});
}
);
},
onClick: function () {
[
document.querySelectorAll('[role="navigation"]')?.[2],
document.querySelectorAll('[role="complementary"]')?.[0],
].forEach((el) => {
if (el) {
el.style.display = el.style.display != "none" ? "none" : "";
} else console.log("ERROR: Cannot find element");
});
},
},
};