diff options
Diffstat (limited to 'recipes/facebook')
-rwxr-xr-x | recipes/facebook/README.md | 5 | ||||
-rw-r--r-- | recipes/facebook/icon.png | bin | 0 -> 22359 bytes | |||
-rw-r--r-- | recipes/facebook/icon.svg | 8 | ||||
-rwxr-xr-x | recipes/facebook/index.js | 2 | ||||
-rwxr-xr-x | recipes/facebook/package.json | 12 | ||||
-rwxr-xr-x | recipes/facebook/webview.js | 24 |
6 files changed, 51 insertions, 0 deletions
diff --git a/recipes/facebook/README.md b/recipes/facebook/README.md new file mode 100755 index 0000000..5a96fcf --- /dev/null +++ b/recipes/facebook/README.md | |||
@@ -0,0 +1,5 @@ | |||
1 | # Facebook for Franz | ||
2 | This is the unofficial Franz recipe for Facebook | ||
3 | |||
4 | ### How to create your own Franz recipes: | ||
5 | * [Read the documentation](https://github.com/meetfranz/plugins) | ||
diff --git a/recipes/facebook/icon.png b/recipes/facebook/icon.png new file mode 100644 index 0000000..f243671 --- /dev/null +++ b/recipes/facebook/icon.png | |||
Binary files differ | |||
diff --git a/recipes/facebook/icon.svg b/recipes/facebook/icon.svg new file mode 100644 index 0000000..fc7b1bd --- /dev/null +++ b/recipes/facebook/icon.svg | |||
@@ -0,0 +1,8 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
2 | <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> | ||
3 | <svg width="100%" height="100%" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;"> | ||
4 | <g> | ||
5 | <path d="M1024,512C1024,229.23 794.77,0 512,0C229.23,0 0,229.23 0,512C0,767.554 187.231,979.37 432,1017.78L432,660L302,660L302,512L432,512L432,399.2C432,270.88 508.438,200 625.39,200C681.407,200 740,210 740,210L740,336L675.438,336C611.835,336 592,375.467 592,415.957L592,512L734,512L711.3,660L592,660L592,1017.78C836.769,979.37 1024,767.554 1024,512Z" style="fill:rgb(24,119,242);fill-rule:nonzero;"/> | ||
6 | <path d="M711.3,660L734,512L592,512L592,415.957C592,375.467 611.835,336 675.438,336L740,336L740,210C740,210 681.407,200 625.39,200C508.438,200 432,270.88 432,399.2L432,512L302,512L302,660L432,660L432,1017.78C458.067,1021.87 484.784,1024 512,1024C539.216,1024 565.933,1021.87 592,1017.78L592,660L711.3,660Z" style="fill:white;fill-rule:nonzero;"/> | ||
7 | </g> | ||
8 | </svg> | ||
diff --git a/recipes/facebook/index.js b/recipes/facebook/index.js new file mode 100755 index 0000000..46f936f --- /dev/null +++ b/recipes/facebook/index.js | |||
@@ -0,0 +1,2 @@ | |||
1 | // just pass through Franz | ||
2 | module.exports = Franz => Franz; | ||
diff --git a/recipes/facebook/package.json b/recipes/facebook/package.json new file mode 100755 index 0000000..5783e7a --- /dev/null +++ b/recipes/facebook/package.json | |||
@@ -0,0 +1,12 @@ | |||
1 | { | ||
2 | "id": "facebook", | ||
3 | "name": "Facebook", | ||
4 | "version": "1.0.1", | ||
5 | "description": "Facebook", | ||
6 | "main": "index.js", | ||
7 | "author": "Tony Ko <tony@htko.ca> and The Ferdi Team <hello@getferdi.com>", | ||
8 | "license": "MIT", | ||
9 | "config": { | ||
10 | "serviceURL": "https://www.facebook.com/login" | ||
11 | } | ||
12 | } | ||
diff --git a/recipes/facebook/webview.js b/recipes/facebook/webview.js new file mode 100755 index 0000000..392d891 --- /dev/null +++ b/recipes/facebook/webview.js | |||
@@ -0,0 +1,24 @@ | |||
1 | module.exports = (Franz) => { | ||
2 | const getNotifications = function getNotifications() { | ||
3 | |||
4 | var count = 0; | ||
5 | |||
6 | var elements = [ | ||
7 | document.getElementById('requestsCountValue'), | ||
8 | // document.getElementById('mercurymessagesCountValue'), | ||
9 | document.getElementById('notificationsCountValue'), | ||
10 | document.querySelector('.k4urcfbm.qnrpqo6b.qt6c0cv9.jxrgncrl.jb3vyjys.taijpn5t.datstx6m.pq6dq46d.ljqsnud1.bp9cbjyn'), | ||
11 | ] | ||
12 | |||
13 | elements.forEach(function(element){ | ||
14 | if(element !== null && parseInt(element.innerHTML, 10)){ | ||
15 | count += parseInt(element.innerHTML, 10); | ||
16 | } | ||
17 | }) | ||
18 | |||
19 | Franz.setBadge(count); | ||
20 | }; | ||
21 | |||
22 | // check for new messages every second and update Franz badge | ||
23 | Franz.loop(getNotifications); | ||
24 | }; | ||