Skip to content

Commit ef8ffcf

Browse files
committed
Remove jQuery class from the notification count
- Switched from jQuery class functions to plain JavaScript `classList` - Tested the notification count and it works as before Signed-off-by: Yarden Shoham <[email protected]>
1 parent 8fd1599 commit ef8ffcf

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

web_src/js/features/notification.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import $ from 'jquery';
22
import {GET} from '../modules/fetch.js';
3+
import {hideElem, showElem} from '../utils/dom.js';
34

45
const {appSubUrl, notificationSettings, assetVersionEncoded} = window.config;
56
let notificationSequenceNumber = 0;
@@ -177,14 +178,15 @@ async function updateNotificationCount() {
177178

178179
const data = await response.json();
179180

180-
const $notificationCount = $('.notification_count');
181181
if (data.new === 0) {
182-
$notificationCount.addClass('tw-hidden');
182+
hideElem('.notification_count');
183183
} else {
184-
$notificationCount.removeClass('tw-hidden');
184+
showElem('.notification_count');
185185
}
186186

187-
$notificationCount.text(`${data.new}`);
187+
for (const el of document.getElementsByClassName('notification_count')) {
188+
el.textContent = `${data.new}`;
189+
}
188190

189191
return `${data.new}`;
190192
} catch (error) {

0 commit comments

Comments
 (0)