Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not working for archived chats #5

Open
tusharnankani opened this issue Oct 12, 2022 · 4 comments
Open

not working for archived chats #5

tusharnankani opened this issue Oct 12, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@tusharnankani
Copy link
Owner

blur not working for archived chats

  • side chat list for archive
  • whatsapp chat name

Credits: Hritik Sharma

@tusharnankani tusharnankani added the bug Something isn't working label Oct 12, 2022
@kana800
Copy link

kana800 commented Oct 12, 2022

Hi,

I love this project !!
Also I am not that good at js so take this with a grain of salt.


Replicating the Bug

I tested out the code; currently when we are selecting chatList, Only div element with side gets selected;
archivedbug1


The reason that archived isn't getting selected is cause its created in another place.
archivedbug2

Maybe Solution?

We can get rid of the archive panel left-drawer if we select the data-testid=drawer-left attribute.

let chatList = document.querySelectorAll('[data-testid=drawer-left]');
// NodeList [div.ldL67._2i3T7._1cpSb]

Executing the above code will give us the attributes with drawer-left. Then we can blur it

chatList[0] ? chatList[0].style.filter = "blur(10px)" : " ";
// Should Run a For Loop Here 🤷🏽 
2022-10-12.13-42-06_Trim.mp4

Let me know what you think

References

@tusharnankani
Copy link
Owner Author

tusharnankani commented Oct 12, 2022

Hi @kana800
Thank you SO much for this! I appreciate it :D

I was a little afraid of using these HTML attributes for a reason.
You see, WhatsApp does a pretty good job with the class names; but my conjecture was that there must have been a reason with some specifc class names like color-${i} or an id like side or panel-side

That's why changed the previous implementation.

blurrit/content.js

Lines 5 to 17 in 94ab183

/*
Multiple problems
0. Blurs <forwarded> instead of name.
1. Doesn't blur names for above a <sent media>; because of `.copyable-text`.
2. Doesn't blur names in tagged messages.
*/
// for (let text of whatsappMessageTexts) {
// let textSibling = text.parentElement.firstChild;
// if(textSibling != text) {
// textSibling.style.filter = "blur(4px)";
// }
// }

For example (an old project): An implementation like this has to be updated if the HTML tree, elements or attributes are changed by the owner.

So, I have been wanting to look for common patterns instead of using HTML tree struct or exploring different HTML attributes; that might be bound to change.

Let me know your thoughts about this?

@kana800
Copy link

kana800 commented Oct 12, 2022

@tusharnankani

For example (an old project): An implementation like this has to be updated if the HTML tree, elements or attributes are changed by the owner.

That is totally understandable; It would be pain if you have to update every time the web app gets updated.

So, I have been wanting to look for common patterns instead of using HTML tree struct or exploring different HTML attributes; that might be bound to change.

web dev in general isn't my strong suit so I don't have any idea on how to approach something like this.

I looked at some other implementation.
For example in this repo they have used class-id to figure out the elements in the web-app;

@tusharnankani
Copy link
Owner Author

web dev in general isn't my strong suit so I don't have any idea on how to approach something like this.

No problem at all!

I looked at some other implementation.
For example in this repo they have used class-id to figure out the elements in the web-app;

Damn, that is interesting. I believe this (hardcoded) implementation is always scary.
Let's go with this approach if we are not able to find a potential fix to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants