-
-
Save SMUsamaShah/dfcc6f709158b0adcc0a48c2d66fd353 to your computer and use it in GitHub Desktop.
| javascript:(function() { | |
| function sortEmailsBySender() { | |
| var emails = Array.from(document.querySelectorAll('.zA')); | |
| emails.sort(function(a, b) { | |
| var senderA = a.querySelector('.yW span').innerText.toLowerCase(); | |
| var senderB = b.querySelector('.yW span').innerText.toLowerCase(); | |
| return senderA.localeCompare(senderB); | |
| }); | |
| emails.forEach(function(email) { | |
| email.parentNode.appendChild(email); | |
| }); | |
| } | |
| sortEmailsBySender(); | |
| })(); |
Hi SMUsamaShah,
I'm trying to run this but it doesn't seem to sort the emails. I tested the very first version and it does sort but when you open the email its the original message from that position.
So these newer versions are obviously better but don't seem to work for me. I checked the console messages and it does seem to be triggering but doesn't change the emails shown.
Any suggestions on what I might have missed?
Thanks
@shadsnz Did you remove all the comments when using it as bookmarklet?
Yes, I did. I'm using Chrome, have tested in both the Gmail Inbox, Sent and All Mail folders. I might try a different browser and another Gmail account to test.
Well, it seems to work sometimes now after refreshing browsers and increasing the number of messages per page. Thanks for posting the code.
It fixed that too