MCPcopy Create free account
hub / github.com/Useful-Scripts-Extension/useful-script / loadModal

Function loadModal

scripts/fb_moreReactionStory.js:30–135  ·  view source on GitHub ↗
(EMOJI_LIST)

Source from the content-addressed store, hash-verified

28 loadModal(emojiData);
29
30 function loadModal(EMOJI_LIST) {
31 const timeoutCheckStoriesFooter = setInterval(async () => {
32 if (!window.location.href.includes("facebook.com/stories")) return;
33 if (!!document.querySelector(".ufs-more-react-story")) return;
34
35 const fb_dtsg = await getFbdtsg();
36 const user_id = await getYourUserId();
37
38 window.ufs_reactStory = async (text) => {
39 const storyId = getStoryId();
40 if (!isEmoji(text)) {
41 alert("Must be emoji");
42 return;
43 }
44 return await reactStory(user_id, fb_dtsg, storyId, text);
45 };
46
47 /* HTML template
48 <div class="ufs-more-react-story">
49 <button class="btn-react">More</button>
50 <div class="emoji-container">
51 <div class="emoji-tab-container">
52 <div class="emoji-tab">😀</div>
53 ...
54 </div>
55 <ul class="emoji-list-container">
56 <li class="emoji">😀</li>
57 ...
58 </ul>
59 </div>
60 </div>
61 */
62
63 const container = document.createElement("div");
64 container.className = "ufs-more-react-story";
65
66 const btnReact = document.createElement("div");
67 btnReact.textContent = "MORE";
68 btnReact.className = "btn-react";
69 const emojiContainer = document.createElement("div");
70 emojiContainer.className = "emoji-container";
71 const emojiTabContener = document.createElement("div");
72 emojiTabContener.className = "emoji-tab-container";
73 const emojiListContainer = document.createElement("div");
74 emojiListContainer.className = "emoji-list-container";
75
76 let allTabs = [];
77 Object.keys(EMOJI_LIST).map((key) => {
78 const emojiTab = document.createElement("div");
79 emojiTab.className = "emoji-tab";
80 emojiTab.textContent = key;
81 allTabs.push(emojiTab);
82
83 emojiTab.onclick = () => {
84 allTabs.forEach((tab) => tab.classList.remove("active"));
85 emojiTab.classList.add("active");
86 emojiListContainer.innerHTML = "";
87

Callers 1

Calls 9

getYourUserIdFunction · 0.85
getStoryIdFunction · 0.85
isEmojiFunction · 0.85
reactStoryFunction · 0.85
addFloatingEmojiFunction · 0.85
errorMethod · 0.80
getFbdtsgFunction · 0.70
removeMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected