Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
133 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// just pass through Franz | ||
module.exports = Franz => Franz; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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">×</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); | ||
}; |