diff options
Diffstat (limited to 'recipes/reddit-chat')
-rw-r--r-- | recipes/reddit-chat/icon.svg | 1 | ||||
-rw-r--r-- | recipes/reddit-chat/index.js | 1 | ||||
-rw-r--r-- | recipes/reddit-chat/package.json | 9 | ||||
-rw-r--r-- | recipes/reddit-chat/webview.js | 29 |
4 files changed, 40 insertions, 0 deletions
diff --git a/recipes/reddit-chat/icon.svg b/recipes/reddit-chat/icon.svg new file mode 100644 index 0000000..4dad730 --- /dev/null +++ b/recipes/reddit-chat/icon.svg | |||
@@ -0,0 +1 @@ | |||
<svg height="186.796" viewBox="0 0 174.865 175.122" width="186.523" xmlns="http://www.w3.org/2000/svg"><path d="M83.021 175.032c-19.341-1.661-33.7-6.792-47.569-16.998C12.951 141.475 0 115.717 0 87.523 0 44.106 30.621 8.168 73.66 1.072c17.569-2.897 37.024.143 53.299 8.329 39.567 19.9 57.65 65.79 42.675 108.292-10.282 29.18-37.275 51.421-68.172 56.17-6.078.935-14.762 1.485-18.441 1.169z" fill="#ff4500"/><path d="M83.018 175.064c-55.345.038-27.673.019 0 0zm19.626-37.606c6.02-1.412 10.378-2.926 14.659-5.09 13.322-6.74 21.663-17.926 21.663-29.056 0-3.365.072-3.521 2.876-6.236 2.226-2.155 3.097-3.547 3.85-6.153.896-3.105.9-3.621.037-6.588-2.42-8.324-11.075-12.073-18.82-8.154l-2.995 1.514-3.085-1.898c-5.933-3.65-16.486-7.226-23.29-7.891-1.865-.183-4.215-.456-5.223-.607l-1.834-.276.788-3.94a661.793 661.793 0 0 1 2.005-9.507c.67-3.061 1.509-7.213 1.865-9.227.514-2.91.865-3.662 1.711-3.662.586 0 4.774.791 9.308 1.758 4.533.966 8.336 1.757 8.45 1.757.114 0 .37.866.568 1.925.502 2.677 1.806 4.34 4.471 5.7 6.396 3.262 13.594-1.085 13.594-8.21 0-8.828-10.884-12.683-16.416-5.815-1.069 1.327-1.605 1.57-2.636 1.196-.712-.259-5.602-1.352-10.867-2.43-6.973-1.427-9.834-1.795-10.533-1.354-1.067.673-.929.176-3.87 13.968-3.496 16.405-3.708 17.334-4.01 17.635-.158.16-2.687.538-5.62.841-8.893.92-18.668 4.06-25.257 8.115l-3.047 1.875-2.992-1.491c-7.811-3.892-16.48-.14-18.899 8.178-.863 2.967-.86 3.483.037 6.588.753 2.606 1.624 3.998 3.85 6.153 2.804 2.715 2.876 2.871 2.876 6.236 0 15.375 15.802 30.047 36.908 34.27 6.992 1.4 7.467 1.436 16.403 1.235 5.84-.132 10.05-.556 13.475-1.36zm-24.64-11.165c-4.847-1.092-10.329-3.527-11.935-5.302-1.28-1.415-.733-3.559.91-3.559.639 0 2.137.665 3.328 1.478 8.044 5.491 26.195 5.471 34.265-.037 2.6-1.774 4.727-1.725 4.989.115.123.866-.43 1.727-1.758 2.74-6.453 4.923-19.4 6.906-29.798 4.565zm-14.783-21.77c-3.018-1.637-4.51-4.249-4.513-7.899-.003-4.183 1.94-6.89 5.888-8.201 2.81-.934 3.145-.933 5.59 0 6.578 2.513 7.925 10.72 2.477 15.107-2.839 2.286-6.374 2.658-9.442.994zm40.887.271c-2.797-1.455-4.36-3.223-5.022-5.68-1.224-4.546 1.08-8.983 5.552-10.69 2.445-.934 2.78-.935 5.59-.001 3.947 1.31 5.89 4.018 5.888 8.201-.003 3.717-1.525 6.308-4.638 7.896-2.8 1.429-4.993 1.51-7.37.274z" fill="#fdfdfd"/></svg> \ No newline at end of file | |||
diff --git a/recipes/reddit-chat/index.js b/recipes/reddit-chat/index.js new file mode 100644 index 0000000..dd41f72 --- /dev/null +++ b/recipes/reddit-chat/index.js | |||
@@ -0,0 +1 @@ | |||
module.exports = Ferdium => Ferdium; | |||
diff --git a/recipes/reddit-chat/package.json b/recipes/reddit-chat/package.json new file mode 100644 index 0000000..6d60303 --- /dev/null +++ b/recipes/reddit-chat/package.json | |||
@@ -0,0 +1,9 @@ | |||
1 | { | ||
2 | "id": "reddit-chat", | ||
3 | "name": "Reddit Chat", | ||
4 | "version": "1.3.0", | ||
5 | "license": "MIT", | ||
6 | "config": { | ||
7 | "serviceURL": "https://www.reddit.com/chat/" | ||
8 | } | ||
9 | } | ||
diff --git a/recipes/reddit-chat/webview.js b/recipes/reddit-chat/webview.js new file mode 100644 index 0000000..7e2ef95 --- /dev/null +++ b/recipes/reddit-chat/webview.js | |||
@@ -0,0 +1,29 @@ | |||
1 | function _interopRequireDefault(obj) { | ||
2 | return obj && obj.__esModule ? obj : { default: obj }; | ||
3 | } | ||
4 | |||
5 | const _path = _interopRequireDefault(require('path')); | ||
6 | |||
7 | module.exports = Ferdium => { | ||
8 | // Regular expression for (*) or (1), will extract the asterisk or the number | ||
9 | const titleRegEx = /^\(([\d*])\)/; | ||
10 | const getMessages = function unreadCount() { | ||
11 | let directCount = 0; | ||
12 | let indirectCount = 0; | ||
13 | |||
14 | const matchArr = document.title.match(titleRegEx); | ||
15 | if (matchArr) { | ||
16 | if (matchArr[1] === '*') { | ||
17 | indirectCount = 1; | ||
18 | } else { | ||
19 | directCount = Number(matchArr[1]); | ||
20 | } | ||
21 | } | ||
22 | |||
23 | Ferdium.setBadge(directCount, indirectCount); | ||
24 | }; | ||
25 | |||
26 | Ferdium.loop(getMessages); | ||
27 | |||
28 | Ferdium.injectCSS(_path.default.join(__dirname, 'service.css')); | ||
29 | }; | ||