loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>
(cherry picked from commit 56ac5f18e8022242316d86c8f3091bce554faebb)

authored by

Yarden Shoham
wxiaoguang
Giteabot
and committed by
Gergely Nagy
6d164224 811c14b8

+5 -7
+5 -7
web_src/js/features/notification.js
··· 1 1 import $ from 'jquery'; 2 2 import {GET} from '../modules/fetch.js'; 3 + import {toggleElem} from '../utils/dom.js'; 3 4 4 5 const {appSubUrl, notificationSettings, assetVersionEncoded} = window.config; 5 6 let notificationSequenceNumber = 0; ··· 177 178 178 179 const data = await response.json(); 179 180 180 - const $notificationCount = $('.notification_count'); 181 - if (data.new === 0) { 182 - $notificationCount.addClass('tw-hidden'); 183 - } else { 184 - $notificationCount.removeClass('tw-hidden'); 181 + toggleElem('.notification_count', data.new !== 0); 182 + 183 + for (const el of document.getElementsByClassName('notification_count')) { 184 + el.textContent = `${data.new}`; 185 185 } 186 - 187 - $notificationCount.text(`${data.new}`); 188 186 189 187 return `${data.new}`; 190 188 } catch (error) {