diff options
Diffstat (limited to 'uncompressed/messenger')
-rw-r--r-- | uncompressed/messenger/README.md | 5 | ||||
-rw-r--r-- | uncompressed/messenger/icon.svg | 23 | ||||
-rw-r--r-- | uncompressed/messenger/index.js | 8 | ||||
-rw-r--r-- | uncompressed/messenger/package.json | 13 | ||||
-rw-r--r-- | uncompressed/messenger/webview.js | 34 |
5 files changed, 83 insertions, 0 deletions
diff --git a/uncompressed/messenger/README.md b/uncompressed/messenger/README.md new file mode 100644 index 0000000..cbe1f4d --- /dev/null +++ b/uncompressed/messenger/README.md | |||
@@ -0,0 +1,5 @@ | |||
1 | # Messenger for Franz | ||
2 | This is the official Franz recipe for Messenger | ||
3 | |||
4 | ### How to create your own Franz recipes: | ||
5 | * [Read the documentation](https://github.com/meetfranz/plugins) | ||
diff --git a/uncompressed/messenger/icon.svg b/uncompressed/messenger/icon.svg new file mode 100644 index 0000000..c861e9a --- /dev/null +++ b/uncompressed/messenger/icon.svg | |||
@@ -0,0 +1,23 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <svg width="80px" height="80px" viewBox="0 0 80 80" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> | ||
3 | <!-- Generator: Sketch 42 (36781) - http://www.bohemiancoding.com/sketch --> | ||
4 | <title>messenger</title> | ||
5 | <desc>Created with Sketch.</desc> | ||
6 | <defs> | ||
7 | <linearGradient x1="50%" y1="100%" x2="50%" y2="0%" id="linearGradient-1"> | ||
8 | <stop stop-color="#006DFF" offset="11%"></stop> | ||
9 | <stop stop-color="#00C6FF" offset="95%"></stop> | ||
10 | </linearGradient> | ||
11 | </defs> | ||
12 | <g id="icons" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> | ||
13 | <g id="messenger" fill="url(#linearGradient-1)"> | ||
14 | <g id="Messenger_Mark"> | ||
15 | <g> | ||
16 | <g fill-rule="nonzero"> | ||
17 | <path d="M40,0.0508259212 C17.9415502,0.0508259212 0.0508259212,16.7756036 0.0508259212,37.407878 C0.0508259212,49.1445997 5.83888183,59.6167726 14.8919949,66.4650572 L14.8919949,80.7623888 L28.52554,73.2005083 C32.261136,74.2427379 36.1217398,74.7690906 40,74.7649301 C62.0584498,74.7649301 79.9491741,58.0401525 79.9491741,37.407878 C79.9491741,16.7756036 62.0635324,0.0508259212 40,0.0508259212 Z M44.2073698,50.1448539 L33.8754765,39.4114358 L13.9771283,50.4193139 L35.7926302,27.2660737 L46.1245235,37.9994917 L66.0228717,26.9956798 L44.2073698,50.1448539 Z" id="Bubble_Shape"></path> | ||
18 | </g> | ||
19 | </g> | ||
20 | </g> | ||
21 | </g> | ||
22 | </g> | ||
23 | </svg> \ No newline at end of file | ||
diff --git a/uncompressed/messenger/index.js b/uncompressed/messenger/index.js new file mode 100644 index 0000000..dd10055 --- /dev/null +++ b/uncompressed/messenger/index.js | |||
@@ -0,0 +1,8 @@ | |||
1 | "use strict"; | ||
2 | |||
3 | module.exports = Franz => class Messenger extends Franz { | ||
4 | overrideUserAgent() { | ||
5 | return window.navigator.userAgent.replace(/(Franz|Electron)([^\s]+\s)/g, ''); | ||
6 | } | ||
7 | |||
8 | }; \ No newline at end of file | ||
diff --git a/uncompressed/messenger/package.json b/uncompressed/messenger/package.json new file mode 100644 index 0000000..30cbbdf --- /dev/null +++ b/uncompressed/messenger/package.json | |||
@@ -0,0 +1,13 @@ | |||
1 | { | ||
2 | "id": "messenger", | ||
3 | "name": "Messenger", | ||
4 | "version": "1.0.8", | ||
5 | "description": "Facebook Messenger", | ||
6 | "main": "index.js", | ||
7 | "author": "Stefan Malzner <stefan@adlk.io>", | ||
8 | "license": "MIT", | ||
9 | "config": { | ||
10 | "serviceURL": "https://messenger.com", | ||
11 | "hasNotificationSound": true | ||
12 | } | ||
13 | } | ||
diff --git a/uncompressed/messenger/webview.js b/uncompressed/messenger/webview.js new file mode 100644 index 0000000..ba7ae31 --- /dev/null +++ b/uncompressed/messenger/webview.js | |||
@@ -0,0 +1,34 @@ | |||
1 | "use strict"; | ||
2 | |||
3 | module.exports = Franz => { | ||
4 | const getMessages = function getMessages() { | ||
5 | let count = document.querySelectorAll('._5fx8:not(._569x),._1ht3:not(._569x)').length; | ||
6 | const messageRequestsElement = document.querySelector('._5nxf'); | ||
7 | |||
8 | if (messageRequestsElement) { | ||
9 | count += parseInt(messageRequestsElement.innerHTML, 10); | ||
10 | } | ||
11 | |||
12 | Franz.setBadge(count); | ||
13 | }; | ||
14 | |||
15 | Franz.loop(getMessages); | ||
16 | localStorage.setItem('_cs_desktopNotifsEnabled', JSON.stringify({ | ||
17 | __t: new Date().getTime(), | ||
18 | __v: true | ||
19 | })); | ||
20 | |||
21 | if (typeof Franz.onNotify === 'function') { | ||
22 | Franz.onNotify(notification => { | ||
23 | if (typeof notification.title !== 'string') { | ||
24 | notification.title = ((notification.title.props || {}).content || [])[0] || 'Messenger'; | ||
25 | } | ||
26 | |||
27 | if (typeof notification.options.body !== 'string') { | ||
28 | notification.options.body = (((notification.options.body || {}).props || {}).content || [])[0] || ''; | ||
29 | } | ||
30 | |||
31 | return notification; | ||
32 | }); | ||
33 | } | ||
34 | }; \ No newline at end of file | ||