diff options
Diffstat (limited to 'uncompressed')
-rw-r--r-- | uncompressed/reddit/README.md | 3 | ||||
-rw-r--r-- | uncompressed/reddit/icon.png | bin | 0 -> 22342 bytes | |||
-rw-r--r-- | uncompressed/reddit/icon.svg | 1 | ||||
-rw-r--r-- | uncompressed/reddit/index.js | 1 | ||||
-rw-r--r-- | uncompressed/reddit/package.json | 15 | ||||
-rw-r--r-- | uncompressed/reddit/service.css | 6 | ||||
-rw-r--r-- | uncompressed/reddit/webview.js | 47 |
7 files changed, 73 insertions, 0 deletions
diff --git a/uncompressed/reddit/README.md b/uncompressed/reddit/README.md new file mode 100644 index 0000000..4c14cdc --- /dev/null +++ b/uncompressed/reddit/README.md | |||
@@ -0,0 +1,3 @@ | |||
1 | # Franz Reddit recipe | ||
2 | |||
3 | A Franz recipe for Reddit service. | ||
diff --git a/uncompressed/reddit/icon.png b/uncompressed/reddit/icon.png new file mode 100644 index 0000000..69622a1 --- /dev/null +++ b/uncompressed/reddit/icon.png | |||
Binary files differ | |||
diff --git a/uncompressed/reddit/icon.svg b/uncompressed/reddit/icon.svg new file mode 100644 index 0000000..75f689a --- /dev/null +++ b/uncompressed/reddit/icon.svg | |||
@@ -0,0 +1 @@ | |||
<svg xmlns="http://www.w3.org/2000/svg" style="isolation:isolate" viewBox="0 0 1024 1020.735" width="1024" height="1020.735"><defs><clipPath id="a"><path d="M0 0h1024v1020.735h-1024z"/></clipPath></defs><g clip-path="url(#a)"><clipPath id="b"><path fill="#fff" d="M0 0h1024v1020.735h-1024z"/></clipPath><g clip-path="url(#b)"><path d="M566.177 127.378c7.537-4.362 16.063-.941 23.946.349 41.846 9.27 83.885 17.599 125.679 26.969 13.438-15.022 30.888-29.497 52.353-28.307 37.332-3.176 74.169 31.877 67.376 70.052-3.815 36.09-41.693 63.509-77.14 55.574-27.962-4.808-49.379-28.754-54.637-56.072-37.677-9.021-75.901-15.713-113.53-24.987-13.881 41.894-26.724 84.134-41.199 125.827 70.796 5.704 141.544 25.337 200.591 65.888 26.719-26.028 70.499-31.531 103.019-13.583 31.583 17.105 50.175 54.782 43.482 90.329-5.057 26.973-24.392 48.884-47.2 63.114 11.006 53.592-2.774 110.902-35.596 154.481-45.612 61.526-117.003 99.107-190.031 117.847-100.988 24.292-211.147 15.963-304.848-30.244-53.744-27.315-103.42-68.216-129.099-123.894-17.651-36.737-21.172-78.876-14.379-118.736-16.014-10.263-30.687-23.5-39.216-40.753-17.201-32.721-9.121-76.548 18.74-100.84 20.328-19.186 50.42-24.886 77.244-19.584 16.754 4.164 31.579 13.438 46.304 22.012 67.475-46.107 149.129-68.662 230.433-69.655 13.338-45.761 28.706-90.923 42.638-136.536 3.521-10.362 5.604-22.41 15.07-29.251zm-182.94 318.933c-24.243 4.064-43.675 27.314-42.931 51.955-.446 28.854 26.623 54.485 55.477 52.354 27.117-.744 50.963-25.481 50.468-52.603.744-31.728-31.929-58.897-63.014-51.706zm237.923-.149c-19.436 3.32-35.499 18.837-41.247 37.428-8.627 28.163 10.906 60.486 39.808 65.84 31.334 8.032 64.453-19.186 64.453-51.063.595-31.78-31.732-59.147-63.014-52.205zm-233.26 177.088c-7.437 4.365-15.074 13.635-10.214 22.558 4.213 11.553 15.717 17.651 25.533 23.898 51.015 30.639 114.424 34.703 171.239 20.175 23.5-6.395 46.601-16.606 64.747-33.115 6.098-5.306 9.768-14.33 7.239-22.261-4.908-12.642-23.154-18.491-33.513-8.775-55.38 39.217-133.959 42.489-191.667 6.443-10.113-5.897-21.168-16.855-33.364-8.923z" fill="#fff"/><g fill="#ff3f18"><path d="M451.208 3.484c97.769-11.352 198.757 5.057 287.052 48.836 112.988 55.079 204.06 153.391 250.07 270.395 46.156 115.564 47.543 248.233 4.016 364.787-40.704 110.061-120.573 205.153-222.306 263.753-103.863 61.129-229.839 82.743-348.33 61.575-121.413-21.071-234.103-88.346-310.451-185.022-80.762-100-120.822-231.776-109.318-359.782 7.682-100.841 47.445-198.758 111.002-277.337 82.647-103.369 206.786-171.982 338.265-187.205zm114.969 123.894c-9.466 6.841-11.549 18.889-15.07 29.251-13.932 45.613-29.3 90.775-42.638 136.536-81.304.993-162.958 23.548-230.433 69.655-14.725-8.574-29.55-17.848-46.304-22.012-26.824-5.302-56.916.398-77.244 19.584-27.861 24.292-35.941 68.119-18.74 100.84 8.529 17.253 23.202 30.49 39.216 40.753-6.793 39.86-3.272 81.999 14.379 118.736 25.679 55.678 75.355 96.579 129.099 123.894 93.701 46.207 203.86 54.536 304.848 30.244 73.028-18.74 144.419-56.321 190.031-117.847 32.822-43.579 46.602-100.889 35.596-154.481 22.808-14.23 42.143-36.141 47.2-63.114 6.693-35.547-11.899-73.224-43.482-90.329-32.52-17.948-76.3-12.445-103.019 13.583-59.047-40.551-129.795-60.184-200.591-65.888 14.475-41.693 27.318-83.933 41.199-125.827 37.629 9.274 75.853 15.966 113.53 24.987 5.258 27.318 26.675 51.264 54.637 56.072 35.447 7.935 73.325-19.484 77.14-55.574 6.793-38.175-30.044-73.228-67.376-70.052-21.465-1.19-38.915 13.285-52.353 28.307-41.794-9.37-83.833-17.699-125.679-26.969-7.883-1.29-16.409-4.711-23.946-.349zM383.237 446.311c31.085-7.191 63.758 19.978 63.014 51.706.495 27.122-23.351 51.859-50.468 52.603-28.854 2.131-55.923-23.5-55.477-52.354-.744-24.641 18.688-47.891 42.931-51.955zM621.16 446.162c31.282-6.942 63.609 20.425 63.014 52.205 0 31.877-33.119 59.095-64.453 51.063-28.902-5.354-48.435-37.677-39.808-65.84 5.748-18.591 21.811-34.108 41.247-37.428zM387.9 623.25c12.196-7.932 23.251 3.026 33.364 8.923 57.708 36.046 136.287 32.774 191.667-6.443 10.359-9.716 28.605-3.867 33.513 8.775 2.529 7.931-1.141 16.955-7.239 22.261-18.146 16.509-41.247 26.72-64.747 33.115-56.815 14.528-120.224 10.464-171.239-20.175-9.816-6.247-21.32-12.345-25.533-23.898-4.86-8.923 2.777-18.193 10.214-22.558z"/></g></g></g></svg> \ No newline at end of file | |||
diff --git a/uncompressed/reddit/index.js b/uncompressed/reddit/index.js new file mode 100644 index 0000000..6d8dd70 --- /dev/null +++ b/uncompressed/reddit/index.js | |||
@@ -0,0 +1 @@ | |||
module.exports = Franz => Franz | |||
diff --git a/uncompressed/reddit/package.json b/uncompressed/reddit/package.json new file mode 100644 index 0000000..c0df9bd --- /dev/null +++ b/uncompressed/reddit/package.json | |||
@@ -0,0 +1,15 @@ | |||
1 | { | ||
2 | "id": "reddit", | ||
3 | "name": "Reddit", | ||
4 | "version": "1.0.0", | ||
5 | "description": "Reddit", | ||
6 | "main": "index.js", | ||
7 | "author": "Alex Devero <deveroalex@gmail.com> and The Ferdi Team <hello@getferdi.com>", | ||
8 | "license": "MIT", | ||
9 | "repository": "https://github.com/getferdi/recipes", | ||
10 | "config": { | ||
11 | "hasNotificationSound": false, | ||
12 | "hasIndirectMessages": true, | ||
13 | "serviceURL": "https://www.reddit.com/" | ||
14 | } | ||
15 | } | ||
diff --git a/uncompressed/reddit/service.css b/uncompressed/reddit/service.css new file mode 100644 index 0000000..690ef99 --- /dev/null +++ b/uncompressed/reddit/service.css | |||
@@ -0,0 +1,6 @@ | |||
1 | [id*=google_ads_iframe], | ||
2 | [data-before-content=advertisement], | ||
3 | .promotedlink { | ||
4 | display: none !important; | ||
5 | visibility: hidden !important; | ||
6 | } | ||
diff --git a/uncompressed/reddit/webview.js b/uncompressed/reddit/webview.js new file mode 100644 index 0000000..df5b929 --- /dev/null +++ b/uncompressed/reddit/webview.js | |||
@@ -0,0 +1,47 @@ | |||
1 | var _path = _interopRequireDefault(require("path")); | ||
2 | |||
3 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
4 | |||
5 | module.exports = (Franz) => { | ||
6 | const getMessages = function getMessages() { | ||
7 | const elements = document.querySelectorAll('#HeaderUserActions--Messages > a > span'); | ||
8 | let count = 0 | ||
9 | |||
10 | if (elements[0]) { | ||
11 | count = parseInt(elements[0].innerHTML, 10); | ||
12 | } | ||
13 | |||
14 | console.log(count) | ||
15 | Franz.setBadge(count) | ||
16 | } | ||
17 | |||
18 | if (document.querySelectorAll('.promotedlink').length > 0) { | ||
19 | document.querySelectorAll('.promotedlink').forEach((sponsoredLink) => { | ||
20 | sponsoredLink.parentElement.parentElement.style.display = 'none' | ||
21 | }) | ||
22 | } | ||
23 | |||
24 | Franz.loop(getMessages) | ||
25 | |||
26 | // Use CSS to hide Google Ads | ||
27 | Franz.injectCSS(_path.default.join(__dirname, 'service.css')) | ||
28 | |||
29 | Franz.handleDarkMode((isEnabled, config) => { | ||
30 | // Open dropdown menu if not already open | ||
31 | const menu = document.querySelector('#USER_DROPDOWN_ID'); | ||
32 | if (menu.getAttribute('aria-expanded') === 'false') { | ||
33 | menu.click(); | ||
34 | } | ||
35 | |||
36 | setTimeout(() => { | ||
37 | // Check if service is already in right mode | ||
38 | const btn = document.querySelector('[role=menu] button button'); | ||
39 | const checked = btn.getAttribute('aria-checked') === 'true'; | ||
40 | |||
41 | if ((checked && !isEnabled) || (!checked && isEnabled)) { | ||
42 | // Click the button to switch between modes | ||
43 | btn.click(); | ||
44 | } | ||
45 | }, 50); | ||
46 | }); | ||
47 | } | ||