Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
tsuyoshizawa committed Dec 1, 2017
0 parents commit a777a74
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 0 deletions.
Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = Franz => Franz;
17 changes: 17 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"id": "typetalk",
"name": "Typetalk",
"version": "1.0.0",
"description": "Typetalk is a powerful messaging and chat app for team discussion. Improve efficiency and team work. Available on desktop and mobile. Sign up for free today!",
"main": "index.js",
"author": "Nulab Inc. <[email protected]>",
"license": "MIT",
"config": {
"serviceURL": "https://typetalk.com",
"serviceName": "Typetalk",
"message": "Typetalk is a powerful messaging and chat app for team discussion. Improve efficiency and team work. Available on desktop and mobile. Sign up for free today!",
"hasNotificationSound": true,
"hasIndirectMessages": true,
"hasTeamID": false
}
}
21 changes: 21 additions & 0 deletions webview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module.exports = (Franz) => {
const className = 'is_new';
const topicsIndex = 0;
const dmIndex = 1;
const notificationsIndex = 2;
const likesActivitiesIndex = 3;

const hasUnreads = (sidebarItems, index) => {
return Number($(sidebarItems.get(index)).hasClass(className));
};

const getUnreads = () => {
const sidebarItems = $(".sidebar__item");
const indirectMessages = hasUnreads(sidebarItems, topicsIndex) + hasUnreads(sidebarItems, likesActivitiesIndex);
const directMessages = hasUnreads(sidebarItems, dmIndex) + hasUnreads(sidebarItems, notificationsIndex);

Franz.setBadge(directMessages, indirectMessages);
};

Franz.loop(getUnreads);
};

0 comments on commit a777a74

Please sign in to comment.