Skip to content

Commit 1a6c728

Browse files
committed
Fix notifications and hooks based on yet another changes from Meta
Also bump electron version to 30
1 parent 2fb1a19 commit 1a6c728

File tree

4 files changed

+1193
-4947
lines changed

4 files changed

+1193
-4947
lines changed

notifications_hook.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ const config = { attributes: false, characterData: true, childList: false, subtr
44
let unreadMessages = {};
55

66
function checkMessages(notify) {
7-
document.querySelector('[role="navigation"]').querySelectorAll('[aria-label="Mark as read"]').forEach((el) => {
7+
document.querySelector("[aria-label=\"Chats\"]").querySelectorAll('.x6s0dn4.xzolkzo.x12go9s9.x1rnf11y.xprq8jg.x9f619.x3nfvp2.xl56j7k.x107p15e.x170jfvy.x1fsd2vl').forEach((el) => {
88
// This magic might stop working, we will have to check later
99
// Alternative way is iterating through <span> elements and finding two different values
1010
// and skipping first - first span's textContent would return everything (both user and message)
1111
// That would prolly be less likely to break, since facebook will probably still use <span> for text
1212
// and those random class selectors are way more likely to change (I expect #:rk: to stay same)
13-
let mainElement = el.parentElement.parentElement.parentElement.parentElement.parentElement
14-
let mainText = mainElement.querySelectorAll(".x1lliihq.x193iq5w.x6ikm8r.x10wlt62.xlyipyv.xuxw1ft")
13+
let mainElement = el.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement
14+
let mainText = mainElement.querySelectorAll('.html-div > span')
1515
let imageSrc = mainElement.querySelector("img").src
1616
let user = mainText[0].textContent
1717
let message = mainText[1].textContent

0 commit comments

Comments
 (0)