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

Update GroupMe DOM filtering to use latest web app conventions #465

Merged
merged 3 commits into from
Jan 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion recipes/groupme/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "groupme",
"name": "GroupMe",
"version": "1.3.0",
"version": "1.3.1",
"license": "MIT",
"config": {
"serviceURL": "https://web.groupme.com",
Expand Down
16 changes: 7 additions & 9 deletions recipes/groupme/webview.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,18 @@ const _path = _interopRequireDefault(require('path'));
module.exports = Ferdium => {
const getMessages = () => {
// array-ify the list of conversations
const allConversations = [
...document.querySelectorAll('#tray .tray-list .list-item'),
const unreadConversations = [
...document.querySelectorAll('#tray .tray-list .list-item.unread'),
];
// for each conversation on the list...
const filteredConversations = allConversations.filter(e => {
// keep it on the list if [1] it has unread messages (not .ng-hide), and [2] it isn't muted (not .overlay)
return (
!e.innerHTML.includes('ng-hide') && !e.innerHTML.includes('overlay')
);
const filteredConversations = unreadConversations.filter(e => {
// keep it on the list if it isn't muted (not .muted)
return !e.innerHTML.includes('muted');
});
const unreadConversations = filteredConversations.length;
const unreadUnmutedConversations = filteredConversations.length;

// set Ferdium badge
Ferdium.setBadge(unreadConversations);
Ferdium.setBadge(unreadUnmutedConversations);
};

Ferdium.loop(getMessages);
Expand Down