-
-
Notifications
You must be signed in to change notification settings - Fork 47
/
fb_stopNewFeed.js
110 lines (100 loc) · 3.1 KB
/
fb_stopNewFeed.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import { BADGES } from "./helpers/badge.js";
import { UfsGlobal } from "./content-scripts/ufs_global.js";
import { hookXHR } from "./libs/ajax-hook/index.js";
export default {
icon: '<i class="fa-solid fa-ban fa-lg"></i>',
name: {
en: "Stop new feed facebook",
vi: "Dừng dòng thời gian facebook",
},
description: {
en: `Stop load new feed on facebook, better for work performance<br/>
<ul>
<li>Support feeds: stories, home, video, group, marketplace</li>
</ul>`,
vi: `Tạm dừng tải dòng thời gian trên facebook, giúp tập trung làm việc<br/>
<ul>
<li>Hỗ trợ các tab: stories, home, video, nhóm, marketplace</li>
</ul>`,
},
changeLogs: {
"2024-06-12": "init",
},
badges: [BADGES.new],
whiteList: ["https://www.facebook.com/*"],
pageScript: {
onDocumentStart: (details) => {
window.ufs_fb_stopNewFeed_toggle = stopNewFeed();
},
onClick: () => {
if (typeof window.ufs_fb_stopNewFeed_toggle !== "function")
window.ufs_fb_stopNewFeed_toggle = stopNewFeed();
else window.ufs_fb_stopNewFeed_toggle();
},
},
};
function stopNewFeed() {
const blackList = {
story: [
// "StoriesSuspenseNavigationPaneRootWithEntryPointQuery",
// "StoriesSuspenseContentPaneRootWithEntryPointQuery",
"StoriesTrayRectangularQuery",
// "StoriesTrayRectangularRootQuery",
"useStoriesViewerBucketsPaginationQuery",
],
"video tab": [
"CometVideoHomeFeedRootQuery",
"CometVideoHomeFeedSectionPaginationQuery",
],
"home tab": ["CometModernHomeFeedQuery", "CometNewsFeedPaginationQuery"],
"group tab": [
"GroupsCometCrossGroupFeedPaginationQuery",
"GroupsCometCrossGroupFeedContainerQuery",
],
"group feed": ["GroupsCometFeedRegularStoriesPaginationQuery"],
"marketplace tab": [
// "CometMarketplaceRootQuery",
// "MarketplaceCometBrowseFeedLightContainerQuery",
// "MarketplaceCometBrowseFeedLightPaginationQuery",
"MarketplaceBannerContainerQuery",
"CometMarketplaceLeftRailNavigationContainerQuery",
],
"event tab": [
// "EventCometHomeDiscoverContentRefetchQuery"
],
"online status": [
// "UpdateUserLastActiveMutation"
],
};
let enabled = true;
hookXHR({
onBeforeSend: ({ method, url, async, user, password }, dataSend) => {
let s = dataSend?.toString() || "";
let inBlackList = false;
for (const [key, value] of Object.entries(blackList)) {
if (value.find((item) => s.includes(item))) {
inBlackList = key;
break;
}
}
if (enabled && inBlackList) {
UfsGlobal.DOM.notify({
msg: "Useful-script: Stopped new feed facebook '" + inBlackList + "'",
});
return null;
}
},
});
UfsGlobal.DOM.notify({
msg: "Useful-script: ENABLED Stop new feed facebook",
});
return (value = !enabled) => {
enabled = value;
UfsGlobal.DOM.notify({
msg:
"Useful-script:" +
(enabled ? "ENABLED" : "DISABLED") +
" Stop new feed facebook ",
});
};
}