mirror of https://github.com/go-gitea/gitea.git
Remove jQuery class from the notification count (#30172)
- Switched from jQuery class functions to plain JavaScript `classList` - Tested the notification count and it works as before --------- Signed-off-by: Yarden Shoham <git@yardenshoham.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Giteabot <teabot@gitea.io>
This commit is contained in:
parent
911993429f
commit
56ac5f18e8
|
@ -1,5 +1,6 @@
|
||||||
import $ from 'jquery';
|
import $ from 'jquery';
|
||||||
import {GET} from '../modules/fetch.js';
|
import {GET} from '../modules/fetch.js';
|
||||||
|
import {toggleElem} from '../utils/dom.js';
|
||||||
|
|
||||||
const {appSubUrl, notificationSettings, assetVersionEncoded} = window.config;
|
const {appSubUrl, notificationSettings, assetVersionEncoded} = window.config;
|
||||||
let notificationSequenceNumber = 0;
|
let notificationSequenceNumber = 0;
|
||||||
|
@ -177,14 +178,11 @@ async function updateNotificationCount() {
|
||||||
|
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
|
|
||||||
const $notificationCount = $('.notification_count');
|
toggleElem('.notification_count', data.new !== 0);
|
||||||
if (data.new === 0) {
|
|
||||||
$notificationCount.addClass('tw-hidden');
|
|
||||||
} else {
|
|
||||||
$notificationCount.removeClass('tw-hidden');
|
|
||||||
}
|
|
||||||
|
|
||||||
$notificationCount.text(`${data.new}`);
|
for (const el of document.getElementsByClassName('notification_count')) {
|
||||||
|
el.textContent = `${data.new}`;
|
||||||
|
}
|
||||||
|
|
||||||
return `${data.new}`;
|
return `${data.new}`;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
Loading…
Reference in New Issue