mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-28 23:42:28 +00:00
Remove jQuery class from the code range selection (#30173)
- Switched from jQuery class functions to plain JavaScript `classList` - Tested the code range selection functionality and it works as before Signed-off-by: Yarden Shoham <git@yardenshoham.com> (cherry picked from commit 911993429f3bec0ff4440c012b2a8f295673f961)
This commit is contained in:
parent
e08f05b069
commit
811c14b8ba
|
@ -25,7 +25,9 @@ function getLineEls() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectRange($linesEls, $selectionEndEl, $selectionStartEls) {
|
function selectRange($linesEls, $selectionEndEl, $selectionStartEls) {
|
||||||
$linesEls.closest('tr').removeClass('active');
|
for (const el of $linesEls) {
|
||||||
|
el.closest('tr').classList.remove('active');
|
||||||
|
}
|
||||||
|
|
||||||
// add hashchange to permalink
|
// add hashchange to permalink
|
||||||
const refInNewIssue = document.querySelector('a.ref-in-new-issue');
|
const refInNewIssue = document.querySelector('a.ref-in-new-issue');
|
||||||
|
@ -72,7 +74,7 @@ function selectRange($linesEls, $selectionEndEl, $selectionStartEls) {
|
||||||
classes.push(`[rel=L${i}]`);
|
classes.push(`[rel=L${i}]`);
|
||||||
}
|
}
|
||||||
$linesEls.filter(classes.join(',')).each(function () {
|
$linesEls.filter(classes.join(',')).each(function () {
|
||||||
$(this).closest('tr').addClass('active');
|
this.closest('tr').classList.add('active');
|
||||||
});
|
});
|
||||||
changeHash(`#L${a}-L${b}`);
|
changeHash(`#L${a}-L${b}`);
|
||||||
|
|
||||||
|
@ -82,7 +84,7 @@ function selectRange($linesEls, $selectionEndEl, $selectionStartEls) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$selectionEndEl.closest('tr').addClass('active');
|
$selectionEndEl[0].closest('tr').classList.add('active');
|
||||||
changeHash(`#${$selectionEndEl[0].getAttribute('rel')}`);
|
changeHash(`#${$selectionEndEl[0].getAttribute('rel')}`);
|
||||||
|
|
||||||
updateIssueHref($selectionEndEl[0].getAttribute('rel'));
|
updateIssueHref($selectionEndEl[0].getAttribute('rel'));
|
||||||
|
|
Loading…
Reference in a new issue