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 repository branch settings (#30184)

- Switched from jQuery class functions to plain JavaScript `classList`
- Tested the repository branch settings functionality and it works as
before

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
(cherry picked from commit 2b3f7d3e966ab60cb147115303d1992e8b50d4df)

authored by

Yarden Shoham and committed by
Gergely Nagy
bd141989 702f1126

+18 -13
+18 -13
web_src/js/features/repo-settings.js
··· 77 77 } 78 78 79 79 export function initRepoSettingBranches() { 80 - if (!$('.repository.settings.branches').length) return; 81 - $('.toggle-target-enabled').on('change', function () { 82 - const $target = $(this.getAttribute('data-target')); 83 - $target.toggleClass('disabled', !this.checked); 84 - }); 85 - $('.toggle-target-disabled').on('change', function () { 86 - const $target = $(this.getAttribute('data-target')); 87 - if (this.checked) $target.addClass('disabled'); // only disable, do not auto enable 88 - }); 89 - $('#dismiss_stale_approvals').on('change', function () { 90 - const $target = $('#ignore_stale_approvals_box'); 91 - $target.toggleClass('disabled', this.checked); 80 + if (!document.querySelector('.repository.settings.branches')) return; 81 + 82 + for (const el of document.getElementsByClassName('toggle-target-enabled')) { 83 + el.addEventListener('change', function () { 84 + const target = document.querySelector(this.getAttribute('data-target')); 85 + target?.classList.toggle('disabled', !this.checked); 86 + }); 87 + } 88 + 89 + for (const el of document.getElementsByClassName('toggle-target-disabled')) { 90 + el.addEventListener('change', function () { 91 + const target = document.querySelector(this.getAttribute('data-target')); 92 + if (this.checked) target?.classList.add('disabled'); // only disable, do not auto enable 93 + }); 94 + } 95 + 96 + document.getElementById('dismiss_stale_approvals')?.addEventListener('change', function () { 97 + document.getElementById('ignore_stale_approvals_box')?.classList.toggle('disabled', this.checked); 92 98 }); 93 99 94 100 // show the `Matched` mark for the status checks that match the pattern ··· 106 112 break; 107 113 } 108 114 } 109 - 110 115 toggleElem(el, matched); 111 116 } 112 117 };