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

Adds Yammer integration #274

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
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
Binary file added yammer/icon.png
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 yammer/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 yammer/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = Franz => Franz;
23 changes: 23 additions & 0 deletions yammer/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "Yammer",
"version": "1.0.0",
"description": "Yammer",
"main": "index.js",
"author": "Sally Young <[email protected]>",
"license": "MIT",
"config": {
"serviceURL": "https://www.yammer.com/login",
"serviceName": "Yammer",
"message": "",
"popup": [],
"hasNotificationSound": false,
"hasIndirectMessages": false,
"hasTeamID": false,
"customURL": false,
"hostedOnly": false,
"webviewOptions": {
"disablewebsecurity": ""
},
"openDevTools": false
}
}
23 changes: 23 additions & 0 deletions yammer/webview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module.exports = (Franz, options) => {
const getMessages = () => {
const countText = $('.yj-thread-list--new-message-text:visible').text();
const regex = /Click to see (\d+) new/g;
let newMessageCount = 0;
if (countText && countText.length) {
let m;
while ((m = regex.exec(countText)) !== null) {
if (m.index === regex.lastIndex) {
regex.lastIndex++;
}
if (typeof m[1] !== undefined) {
newMessageCount = m[1];
}
}
}

Franz.setBadge(newMessageCount);
};

// check for new messages every second and update Franz badge
Franz.loop(getMessages);
}