aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/basecamp/webview.js
diff options
context:
space:
mode:
authorLibravatar Vijay Raghavan Aravamudhan <vraravam@users.noreply.github.com>2021-08-27 18:13:24 +0530
committerLibravatar GitHub <noreply@github.com>2021-08-27 18:13:24 +0530
commit155c4b832281348c16be1f4ef667e6e23dbf1bd8 (patch)
treed144e2de2e6c7fb2e334246e8a4aecdbeb08ef8d /recipes/basecamp/webview.js
parentdocs: fixed template file for creating recipe. (diff)
downloadferdium-recipes-155c4b832281348c16be1f4ef667e6e23dbf1bd8.tar.gz
ferdium-recipes-155c4b832281348c16be1f4ef667e6e23dbf1bd8.tar.zst
ferdium-recipes-155c4b832281348c16be1f4ef667e6e23dbf1bd8.zip
chore: normalized all recipes to ensure compatibility with es6 (#639)
- Removed some calls to set badge with '0' all the time. - Removed all 'sourceMaps' since they are all outdated atm.
Diffstat (limited to 'recipes/basecamp/webview.js')
-rw-r--r--recipes/basecamp/webview.js27
1 files changed, 6 insertions, 21 deletions
diff --git a/recipes/basecamp/webview.js b/recipes/basecamp/webview.js
index 85f78ee..e7b7dde 100644
--- a/recipes/basecamp/webview.js
+++ b/recipes/basecamp/webview.js
@@ -1,6 +1,8 @@
1const path = require('path'); 1const _path = _interopRequireDefault(require('path'));
2 2
3module.exports = (Franz, options) => { 3function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
4
5module.exports = (Ferdi) => {
4 let updates = 0; 6 let updates = 0;
5 const modal = document.createElement('div'); 7 const modal = document.createElement('div');
6 8
@@ -23,7 +25,7 @@ module.exports = (Franz, options) => {
23 updates -= 1; 25 updates -= 1;
24 } 26 }
25 27
26 // Replace window.alert to hide alerts in Franz 28 // Replace window.alert to hide alerts in Ferdi
27 const oldAlert = window.alert; 29 const oldAlert = window.alert;
28 window.alert = function () { 30 window.alert = function () {
29 // when Google Calendar displays an alert notify the user 31 // when Google Calendar displays an alert notify the user
@@ -38,19 +40,6 @@ module.exports = (Franz, options) => {
38 element.style.display = 'none'; 40 element.style.display = 'none';
39 } 41 }
40 42
41 const getMessages = () => {
42 // get unread messages
43 // const updates = document.getElementById('franz').getAttribute('data-unread');
44
45 // get conversations in 'My Inbox'
46 // const inbox = document.getElementById('franz').getAttribute('data-inbox');
47
48 // set Franz badge
49 // updates => passive unread count
50 // inbox => active unread count
51 Franz.setBadge(0, updates);
52 };
53
54 modal.id = 'franz-modal'; 43 modal.id = 'franz-modal';
55 modal.innerHTML = '<div class="modal-content"><span class="close">&times;</span><p></p></div>'; 44 modal.innerHTML = '<div class="modal-content"><span class="close">&times;</span><p></p></div>';
56 modal.querySelector('.close').addEventListener('click', hideModal); 45 modal.querySelector('.close').addEventListener('click', hideModal);
@@ -58,9 +47,5 @@ module.exports = (Franz, options) => {
58 47
59 document.addEventListener('keydown', (e) => { if (e.keyCode === 27) { hideModal(); } }); 48 document.addEventListener('keydown', (e) => { if (e.keyCode === 27) { hideModal(); } });
60 49
61 // inject franz.css stylesheet 50 Ferdi.injectCSS(_path.default.join(__dirname, 'css', 'modal.css'));
62 Franz.injectCSS(path.join(__dirname, 'css', 'modal.css'));
63
64 // check for new messages every second and update Franz badge
65 Franz.loop(getMessages);
66}; 51};