diff options
-rw-r--r-- | all.json | 11 | ||||
-rw-r--r-- | recipes/telegram-react/icon.svg | 1 | ||||
-rw-r--r-- | recipes/telegram-react/index.js | 1 | ||||
-rw-r--r-- | recipes/telegram-react/package.json | 10 | ||||
-rw-r--r-- | recipes/telegram-react/webview.js | 21 | ||||
-rw-r--r-- | recipes/telegram/darkmode.css | 190 | ||||
-rw-r--r-- | recipes/telegram/package.json | 2 | ||||
-rw-r--r-- | recipes/telegram/webview.js | 67 |
8 files changed, 59 insertions, 244 deletions
@@ -1593,22 +1593,13 @@ | |||
1593 | "featured": true, | 1593 | "featured": true, |
1594 | "id": "telegram", | 1594 | "id": "telegram", |
1595 | "name": "Telegram", | 1595 | "name": "Telegram", |
1596 | "version": "3.2.3", | 1596 | "version": "3.2.4", |
1597 | "icons": { | 1597 | "icons": { |
1598 | "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/telegram/icon.svg" | 1598 | "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/telegram/icon.svg" |
1599 | } | 1599 | } |
1600 | }, | 1600 | }, |
1601 | { | 1601 | { |
1602 | "featured": false, | 1602 | "featured": false, |
1603 | "id": "telegram-react", | ||
1604 | "name": "Telegram React", | ||
1605 | "version": "1.2.2", | ||
1606 | "icons": { | ||
1607 | "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/telegram-react/icon.svg" | ||
1608 | } | ||
1609 | }, | ||
1610 | { | ||
1611 | "featured": false, | ||
1612 | "id": "thelounge", | 1603 | "id": "thelounge", |
1613 | "name": "The Lounge", | 1604 | "name": "The Lounge", |
1614 | "version": "1.1.2", | 1605 | "version": "1.1.2", |
diff --git a/recipes/telegram-react/icon.svg b/recipes/telegram-react/icon.svg deleted file mode 100644 index f8c7fe3..0000000 --- a/recipes/telegram-react/icon.svg +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | <svg height="80" width="80" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><path id="a" d="M39.982.036C17.901.036 0 17.936 0 40.018S17.9 80 39.982 80s39.982-17.9 39.982-39.982S62.064.036 39.982.036z"/><mask id="b" fill="#fff"><use fill-rule="evenodd" xlink:href="#a"/></mask></defs><g fill="none" fill-rule="evenodd"><use fill="#08c" xlink:href="#a"/><g mask="url(#b)"><path d="M59.437 23.035 52.296 59.04s-.999 2.497-3.746 1.298L32.071 47.704l-5.992-2.896-10.088-3.396s-1.548-.55-1.698-1.748c-.15-1.198 1.748-1.848 1.748-1.848l40.1-15.73s3.296-1.448 3.296.949" fill="#fefefe"/><path d="M30.804 58.636s-.48-.045-1.08-1.943c-.6-1.898-3.645-11.885-3.645-11.885l24.22-15.381s1.397-.849 1.348 0c0 0 .25.15-.5.849-.749.7-19.026 17.128-19.026 17.128" fill="#d3e5f1"/><path d="m38.39 52.548-6.519 5.943s-.51.387-1.067.145l1.248-11.04" fill="#b6d0e4"/></g></g></svg> \ No newline at end of file | ||
diff --git a/recipes/telegram-react/index.js b/recipes/telegram-react/index.js deleted file mode 100644 index 23607bd..0000000 --- a/recipes/telegram-react/index.js +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | module.exports = Ferdi => Ferdi; | ||
diff --git a/recipes/telegram-react/package.json b/recipes/telegram-react/package.json deleted file mode 100644 index 11ae14f..0000000 --- a/recipes/telegram-react/package.json +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | { | ||
2 | "id": "telegram-react", | ||
3 | "name": "Telegram React", | ||
4 | "version": "1.2.2", | ||
5 | "license": "MIT", | ||
6 | "config": { | ||
7 | "serviceURL": "https://webk.telegram.org", | ||
8 | "hasNotificationSound": true | ||
9 | } | ||
10 | } | ||
diff --git a/recipes/telegram-react/webview.js b/recipes/telegram-react/webview.js deleted file mode 100644 index c17b200..0000000 --- a/recipes/telegram-react/webview.js +++ /dev/null | |||
@@ -1,21 +0,0 @@ | |||
1 | module.exports = Ferdi => { | ||
2 | const getMessages = () => { | ||
3 | let count = 0; | ||
4 | const elements = document.querySelectorAll('.chatlist > li:not(.is-muted)'); | ||
5 | if (elements) { | ||
6 | for (const element of elements) { | ||
7 | if ( | ||
8 | element.querySelector('.unread') && | ||
9 | element.querySelector('.unread').textContent !== 0 | ||
10 | ) { | ||
11 | count += Ferdi.safeParseInt( | ||
12 | element.querySelector('.unread').textContent, | ||
13 | ); | ||
14 | } | ||
15 | } | ||
16 | } | ||
17 | Ferdi.setBadge(count); | ||
18 | }; | ||
19 | |||
20 | Ferdi.loop(getMessages); | ||
21 | }; | ||
diff --git a/recipes/telegram/darkmode.css b/recipes/telegram/darkmode.css deleted file mode 100644 index 24f415f..0000000 --- a/recipes/telegram/darkmode.css +++ /dev/null | |||
@@ -1,190 +0,0 @@ | |||
1 | /* Copied from: https://github.com/ducfilan/Dark-mode-Franz-Ferdi */ | ||
2 | |||
3 | body, | ||
4 | .modal-content { | ||
5 | color: #bbb !important; | ||
6 | background: rgb(40, 44, 52) !important; | ||
7 | } | ||
8 | |||
9 | a.tg_checkbox { | ||
10 | color: #bbb !important; | ||
11 | } | ||
12 | |||
13 | .im_page_wrap { | ||
14 | /*background color of contentwrapper under header*/ | ||
15 | background-color: rgb(40, 44, 52) !important; | ||
16 | border-left: 1px solid rgb(40, 44, 52) !important; | ||
17 | border-right: 1px solid rgb(40, 44, 52) !important; | ||
18 | border-bottom: 1px solid rgb(40, 44, 52) !important; | ||
19 | box-shadow: none; | ||
20 | } | ||
21 | |||
22 | .im_message_body, | ||
23 | .im_attach, | ||
24 | .im_media_attach, | ||
25 | .im_record, | ||
26 | .im_record_bg, | ||
27 | .im_record:hover, | ||
28 | .im_message_document_thumbed, | ||
29 | .composer_emoji_panel a.composer_emoji_btn { | ||
30 | background: inherit !important; | ||
31 | } | ||
32 | |||
33 | .im_dialog_peer { | ||
34 | /*peer nickname unselected*/ | ||
35 | color: #bbb !important; | ||
36 | } | ||
37 | |||
38 | .contacts_modal_members_list a.contacts_modal_contact { | ||
39 | /*nicknames in contactlist via hamburger menu*/ | ||
40 | color: #bbb; | ||
41 | } | ||
42 | |||
43 | .active a.im_dialog { | ||
44 | /*selected peer */ | ||
45 | background-color: rgb(40, 44, 52) !important; | ||
46 | } | ||
47 | |||
48 | .tg_head_split, | ||
49 | .md_modal_head { | ||
50 | /*page header block*/ | ||
51 | background-color: rgb(40, 44, 52) !important; | ||
52 | } | ||
53 | |||
54 | .dropdown.open .tg_head_btn, | ||
55 | .tg_head_btn:hover { | ||
56 | background: rgb(40, 44, 52) !important; | ||
57 | } | ||
58 | |||
59 | .form-control { | ||
60 | /*input field*/ | ||
61 | background-color: #0e0e0e !important; | ||
62 | color: #bbb !important; | ||
63 | } | ||
64 | |||
65 | .composer_rich_textarea { | ||
66 | background: rgb(40, 44, 52) !important; | ||
67 | border-color: #bbb !important; | ||
68 | } | ||
69 | |||
70 | .im_dialogs_col_wrap { | ||
71 | /*contactlist right border*/ | ||
72 | border-right: 2px solid rgb(40, 44, 52); | ||
73 | } | ||
74 | |||
75 | .im_dialogs_col .nano>.nano-pane>.nano-slider { | ||
76 | /*scrollbarbutton when hover*/ | ||
77 | background-color: rgb(40, 44, 52) !important; | ||
78 | } | ||
79 | |||
80 | code, | ||
81 | pre { | ||
82 | background-color: #bbb !important; | ||
83 | color: #0e0e0e; | ||
84 | border: none !important; | ||
85 | } | ||
86 | |||
87 | .tg_head_split { | ||
88 | background-color: #151515; | ||
89 | } | ||
90 | |||
91 | .im_submit { | ||
92 | color: rgb(40, 44, 52); | ||
93 | } | ||
94 | |||
95 | .im_message_mymention { | ||
96 | background: #1d1d1d; | ||
97 | } | ||
98 | |||
99 | .im_message_focus .im_message_outer_wrap { | ||
100 | background-color: rgb(40, 44, 52); | ||
101 | } | ||
102 | |||
103 | .im_message_selected .im_message_outer_wrap { | ||
104 | background: rgb(40, 44, 52); | ||
105 | } | ||
106 | |||
107 | a:hover { | ||
108 | background-color: #282828 !important; | ||
109 | } | ||
110 | |||
111 | .im_message_unread_split { | ||
112 | background: rgb(40, 44, 52); | ||
113 | } | ||
114 | |||
115 | @ keyframes im_message_focus_fade { | ||
116 | 0% { | ||
117 | /*soft transaction*/ | ||
118 | |||
119 | background-color: #2d2d2d; | ||
120 | } | ||
121 | } | ||
122 | |||
123 | .btn-primary { | ||
124 | background-color: rgb(40, 44, 52); | ||
125 | } | ||
126 | |||
127 | .im_history_select_active .im_message_outer_wrap:hover { | ||
128 | background: rgb(40, 44, 52); | ||
129 | } | ||
130 | |||
131 | .im_dialog_chat_from_wrap, | ||
132 | .im_dialog_message_service { | ||
133 | color: #6ac; | ||
134 | } | ||
135 | |||
136 | .composer_rich_textarea, | ||
137 | .composer_textarea { | ||
138 | box-shadow: 0px 3px 1px #ddd; | ||
139 | } | ||
140 | |||
141 | .composer_rich_textarea:focus { | ||
142 | box-shadow: 0px 3px 1px #ddd !important; | ||
143 | } | ||
144 | |||
145 | .tg_head_logo_dropdown .dropdown-menu>li>a, | ||
146 | a.tg_radio { | ||
147 | color: #ddd; | ||
148 | } | ||
149 | |||
150 | .btn-primary.disabled, | ||
151 | .btn-primary[disabled] { | ||
152 | background: rgb(40, 44, 52) none repeat scroll 0% 0%; | ||
153 | } | ||
154 | |||
155 | /*emoji*/ | ||
156 | |||
157 | .composer_emoji_tooltip, | ||
158 | .icon-tooltip-tail, | ||
159 | .dropdown-menu { | ||
160 | background-color: rgb(40, 44, 52) !important; | ||
161 | border-color: #5d5d5d; | ||
162 | } | ||
163 | |||
164 | .im_dialog_badge.badge { | ||
165 | background-color: #bfbfbf30 !important; | ||
166 | } | ||
167 | |||
168 | .im_message_selected .im_message_outer_wrap, | ||
169 | .im_history_select_active .im_message_outer_wrap:hover { | ||
170 | background-color: rgb(40, 44, 52) !important; | ||
171 | } | ||
172 | |||
173 | .reply_markup_button { | ||
174 | color: #FFFFFF !important; | ||
175 | background-color: #666666 !important; | ||
176 | } | ||
177 | |||
178 | .reply_markup_button:focus, | ||
179 | .reply_markup_button:hover { | ||
180 | color: #FFFFFF !important; | ||
181 | background-color: rgb(40, 44, 52) !important; | ||
182 | } | ||
183 | |||
184 | .tg_head_logo_dropdown .dropdown-menu>li>a, | ||
185 | .dropdown-menu>li>a, | ||
186 | .dropdown-menu>li>a, | ||
187 | .dropdown-menu>li>a:focus, | ||
188 | .dropdown-menu>li>a:hover { | ||
189 | color: #FFFFFF !important; | ||
190 | } | ||
diff --git a/recipes/telegram/package.json b/recipes/telegram/package.json index beda3c3..e537a9c 100644 --- a/recipes/telegram/package.json +++ b/recipes/telegram/package.json | |||
@@ -1,7 +1,7 @@ | |||
1 | { | 1 | { |
2 | "id": "telegram", | 2 | "id": "telegram", |
3 | "name": "Telegram", | 3 | "name": "Telegram", |
4 | "version": "3.2.3", | 4 | "version": "3.2.4", |
5 | "license": "MIT", | 5 | "license": "MIT", |
6 | "config": { | 6 | "config": { |
7 | "serviceURL": "https://web.telegram.org", | 7 | "serviceURL": "https://web.telegram.org", |
diff --git a/recipes/telegram/webview.js b/recipes/telegram/webview.js index 7d2c8e3..d63282e 100644 --- a/recipes/telegram/webview.js +++ b/recipes/telegram/webview.js | |||
@@ -1,5 +1,3 @@ | |||
1 | // Code copied from: https://gitlab.com/gortega4/ferdi_recipes | ||
2 | |||
3 | const _path = _interopRequireDefault(require('path')); | 1 | const _path = _interopRequireDefault(require('path')); |
4 | 2 | ||
5 | function _interopRequireDefault(obj) { | 3 | function _interopRequireDefault(obj) { |
@@ -7,27 +5,76 @@ function _interopRequireDefault(obj) { | |||
7 | } | 5 | } |
8 | 6 | ||
9 | module.exports = Ferdi => { | 7 | module.exports = Ferdi => { |
10 | const getMessages = () => { | 8 | const telegramVersion = document |
11 | let direct = 0; | 9 | .querySelector('meta[name="application-name"]') |
12 | let indirect = 0; | 10 | ?.getAttribute('content'); |
13 | const elements = document.querySelectorAll('.rp'); | 11 | |
12 | const isWebZ = telegramVersion?.includes('WebZ'); | ||
13 | const isWebK = telegramVersion?.includes('WebK'); | ||
14 | |||
15 | // There are two different Telegram versions for internal competition | ||
16 | // Read more: https://bugs.telegram.org/c/4002/public | ||
17 | const webZCount = () => { | ||
18 | let directCount = 0; | ||
19 | let groupCount = 0; | ||
20 | |||
21 | const directCountSelector = document.querySelectorAll( | ||
22 | '.chat-list .ListItem.private .Badge.unread:not(.muted)', | ||
23 | ); | ||
24 | const groupCountSelector = document.querySelectorAll( | ||
25 | '.chat-list .ListItem.group .Badge.unread:not(.muted)', | ||
26 | ); | ||
27 | |||
28 | for (const badge of directCountSelector) { | ||
29 | directCount += Ferdi.safeParseInt(badge.textContent); | ||
30 | } | ||
31 | |||
32 | for (const badge of groupCountSelector) { | ||
33 | groupCount += Ferdi.safeParseInt(badge.textContent); | ||
34 | } | ||
35 | |||
36 | Ferdi.setBadge(directCount, groupCount); | ||
37 | }; | ||
38 | |||
39 | const webKCount = () => { | ||
40 | let directCount = 0; | ||
41 | let groupCount = 0; | ||
42 | |||
43 | const elements = document.querySelectorAll('.rp:not(.is-muted)'); | ||
44 | |||
14 | for (const element of elements) { | 45 | for (const element of elements) { |
15 | const subtitleBadge = element.querySelector('.dialog-subtitle-badge'); | 46 | const subtitleBadge = element.querySelector('.dialog-subtitle-badge'); |
47 | |||
16 | if (subtitleBadge) { | 48 | if (subtitleBadge) { |
17 | const parsedValue = Ferdi.safeParseInt(subtitleBadge.textContent); | 49 | const parsedValue = Ferdi.safeParseInt(subtitleBadge.textContent); |
50 | |||
18 | if (element.dataset.peerId > 0) { | 51 | if (element.dataset.peerId > 0) { |
19 | direct += parsedValue; | 52 | directCount += parsedValue; |
20 | } else { | 53 | } else { |
21 | indirect += parsedValue; | 54 | groupCount += parsedValue; |
22 | } | 55 | } |
23 | } | 56 | } |
24 | } | 57 | } |
25 | 58 | ||
26 | Ferdi.setBadge(direct, indirect); | 59 | Ferdi.setBadge(directCount, groupCount); |
60 | }; | ||
61 | |||
62 | const getMessages = () => { | ||
63 | if (isWebZ) { | ||
64 | webZCount(); | ||
65 | } else if (isWebK) { | ||
66 | webKCount(); | ||
67 | } | ||
27 | }; | 68 | }; |
28 | 69 | ||
29 | const getActiveDialogTitle = () => { | 70 | const getActiveDialogTitle = () => { |
30 | const element = document.querySelector('.top .peer-title'); | 71 | let element; |
72 | |||
73 | if (isWebZ) { | ||
74 | element = document.querySelector('.chat-list .ListItem .title > h3'); | ||
75 | } else if (isWebK) { | ||
76 | element = document.querySelector('.top .peer-title'); | ||
77 | } | ||
31 | 78 | ||
32 | Ferdi.setDialogTitle(element ? element.textContent : ''); | 79 | Ferdi.setDialogTitle(element ? element.textContent : ''); |
33 | }; | 80 | }; |