Permalink
Browse files

Basecamp Plugin

  • Loading branch information...
1 parent 0d05c82 commit 891f857b08848513f50bfa4abb11198623b30845 @friedow friedow committed Oct 19, 2016
Showing with 133 additions and 0 deletions.
  1. +37 −0 basecamp/css/modal.css
  2. BIN basecamp/icon.png
  3. +12 −0 basecamp/icon.svg
  4. +2 −0 basecamp/index.js
  5. +23 −0 basecamp/package.json
  6. +59 −0 basecamp/webview.js
@@ -0,0 +1,37 @@
+#franz-modal {
+ display: none;
+ position: fixed;
+ z-index: 9999;
+ left: 0;
+ top: 0;
+ width: 100%;
+ height: 100%;
+ overflow: auto;
+ background-color: rgba(0, 0, 0, 0.8);
+}
+
+#franz-modal .modal-content {
+ background-color: #fefefe;
+ margin: 15% auto;
+ padding: 20px;
+ border: 1px solid #888;
+ width: 30%;
+ -webkit-border-radius: 3px;
+ -moz-border-radius: 3px;
+ border-radius: 3px;
+}
+
+#franz-modal .close {
+ color: #aaa;
+ float: right;
+ margin-top: -10px;
+ font-size: 20px;
+ font-weight: bold;
+}
+
+#franz-modal .close:hover,
+#franz-modal .close:focus {
+ color: black;
+ text-decoration: none;
+ cursor: pointer;
+}
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Oops, something went wrong.
View
@@ -0,0 +1,2 @@
+// just pass through Franz
+module.exports = Franz => Franz;
View
@@ -0,0 +1,23 @@
+{
+ "name": "meetfranz-basecamp-plugin",
+ "version": "1.0.0",
+ "description": "Basecamp plugin for meetfranz.",
+ "main": "index.js",
+ "author": "",
+ "license": "MIT",
+ "config": {
+ "serviceURL": "https://launchpad.37signals.com/",
+ "serviceName": "Basecamp",
+ "message": "Basecamp plugin for meetfranz.",
+ "popup": [],
+ "hasNotificationSound": false,
+ "hasIndirectMessages": false,
+ "hasTeamID": false,
+ "customURL": false,
+ "hostedOnly": false,
+ "webviewOptions": {
+ "disablewebsecurity": ""
+ },
+ "openDevTools": false
+ }
+}
View
@@ -0,0 +1,59 @@
+const path = require('path');
+
+module.exports = (Franz, options) => {
+ let updates = 0;
+ const modal = document.createElement('div');
+
+ function showModal (text) {
+ show(modal);
+ modal.querySelector('p').innerHTML = text;
+ updates += 1;
+ }
+
+ function hideModal () {
+ hide(modal);
+ modal.querySelector('p').innerHTML = '';
+ updates -= 1;
+ }
+
+ // Replace window.alert to hide alerts in Franz
+ const oldAlert = window.alert;
+ window.alert = function () {
+ // when Google Calendar displays an alert notify the user
+ showModal.apply(oldAlert, arguments);
+ };
+
+ function show (element) {
+ element.style.display = 'inherit';
+ }
+
+ function hide (element) {
+ element.style.display = 'none';
+ }
+
+ const getMessages = () => {
+ // get unread messages
+ //const updates = document.getElementById('franz').getAttribute('data-unread');
+
+ // get conversations in 'My Inbox'
+ //const inbox = document.getElementById('franz').getAttribute('data-inbox');
+
+ // set Franz badge
+ // updates => passive unread count
+ // inbox => active unread count
+ Franz.setBadge(0, updates);
+ };
+
+ modal.id = 'franz-modal';
+ modal.innerHTML = '<div class="modal-content"><span class="close">&times;</span><p></p></div>';
+ modal.querySelector('.close').addEventListener('click', hideModal);
+ document.body.appendChild(modal);
+
+ document.addEventListener('keydown', function(e) { if (e.keyCode === 27) { hideModal(); } })
+
+ // inject franz.css stylesheet
+ Franz.injectCSS(path.join(__dirname, 'css', 'modal.css'));
+
+ // check for new messages every second and update Franz badge
+ Franz.loop(getMessages);
+};

0 comments on commit 891f857

Please sign in to comment.