mirror of
https://github.com/go-gitea/gitea
synced 2024-11-25 21:52:52 +01:00
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>
This commit is contained in:
parent
bcf3be3a6c
commit
2b3f7d3e96
1 changed files with 18 additions and 13 deletions
|
@ -77,18 +77,24 @@ export function initRepoSettingGitHook() {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function initRepoSettingBranches() {
|
export function initRepoSettingBranches() {
|
||||||
if (!$('.repository.settings.branches').length) return;
|
if (!document.querySelector('.repository.settings.branches')) return;
|
||||||
$('.toggle-target-enabled').on('change', function () {
|
|
||||||
const $target = $(this.getAttribute('data-target'));
|
for (const el of document.getElementsByClassName('toggle-target-enabled')) {
|
||||||
$target.toggleClass('disabled', !this.checked);
|
el.addEventListener('change', function () {
|
||||||
});
|
const target = document.querySelector(this.getAttribute('data-target'));
|
||||||
$('.toggle-target-disabled').on('change', function () {
|
target?.classList.toggle('disabled', !this.checked);
|
||||||
const $target = $(this.getAttribute('data-target'));
|
});
|
||||||
if (this.checked) $target.addClass('disabled'); // only disable, do not auto enable
|
}
|
||||||
});
|
|
||||||
$('#dismiss_stale_approvals').on('change', function () {
|
for (const el of document.getElementsByClassName('toggle-target-disabled')) {
|
||||||
const $target = $('#ignore_stale_approvals_box');
|
el.addEventListener('change', function () {
|
||||||
$target.toggleClass('disabled', this.checked);
|
const target = document.querySelector(this.getAttribute('data-target'));
|
||||||
|
if (this.checked) target?.classList.add('disabled'); // only disable, do not auto enable
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
document.getElementById('dismiss_stale_approvals')?.addEventListener('change', function () {
|
||||||
|
document.getElementById('ignore_stale_approvals_box')?.classList.toggle('disabled', this.checked);
|
||||||
});
|
});
|
||||||
|
|
||||||
// show the `Matched` mark for the status checks that match the pattern
|
// show the `Matched` mark for the status checks that match the pattern
|
||||||
|
@ -106,7 +112,6 @@ export function initRepoSettingBranches() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleElem(el, matched);
|
toggleElem(el, matched);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue