From 728d339739b63e9bb59e457e4a84fe9a65b93fc9 Mon Sep 17 00:00:00 2001 From: vantezzen Date: Sat, 28 Sep 2019 12:10:25 +0200 Subject: Add uncompressed recipes --- uncompressed/messenger/README.md | 5 +++++ uncompressed/messenger/icon.svg | 23 +++++++++++++++++++++++ uncompressed/messenger/index.js | 8 ++++++++ uncompressed/messenger/package.json | 13 +++++++++++++ uncompressed/messenger/webview.js | 34 ++++++++++++++++++++++++++++++++++ 5 files changed, 83 insertions(+) create mode 100644 uncompressed/messenger/README.md create mode 100644 uncompressed/messenger/icon.svg create mode 100644 uncompressed/messenger/index.js create mode 100644 uncompressed/messenger/package.json create mode 100644 uncompressed/messenger/webview.js (limited to 'uncompressed/messenger') 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 @@ +# Messenger for Franz +This is the official Franz recipe for Messenger + +### How to create your own Franz recipes: +* [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 @@ + + + + messenger + Created with Sketch. + + + + + + + + + + + + + + + + + + \ 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 @@ +"use strict"; + +module.exports = Franz => class Messenger extends Franz { + overrideUserAgent() { + return window.navigator.userAgent.replace(/(Franz|Electron)([^\s]+\s)/g, ''); + } + +}; \ 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 @@ +{ + "id": "messenger", + "name": "Messenger", + "version": "1.0.8", + "description": "Facebook Messenger", + "main": "index.js", + "author": "Stefan Malzner ", + "license": "MIT", + "config": { + "serviceURL": "https://messenger.com", + "hasNotificationSound": true + } +} 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 @@ +"use strict"; + +module.exports = Franz => { + const getMessages = function getMessages() { + let count = document.querySelectorAll('._5fx8:not(._569x),._1ht3:not(._569x)').length; + const messageRequestsElement = document.querySelector('._5nxf'); + + if (messageRequestsElement) { + count += parseInt(messageRequestsElement.innerHTML, 10); + } + + Franz.setBadge(count); + }; + + Franz.loop(getMessages); + localStorage.setItem('_cs_desktopNotifsEnabled', JSON.stringify({ + __t: new Date().getTime(), + __v: true + })); + + if (typeof Franz.onNotify === 'function') { + Franz.onNotify(notification => { + if (typeof notification.title !== 'string') { + notification.title = ((notification.title.props || {}).content || [])[0] || 'Messenger'; + } + + if (typeof notification.options.body !== 'string') { + notification.options.body = (((notification.options.body || {}).props || {}).content || [])[0] || ''; + } + + return notification; + }); + } +}; \ No newline at end of file -- cgit v1.2.3-70-g09d2