Remove jQuery from the code diff expansion buttons (#29385)

- Removed all jQuery AJAX calls and replaced with htmx
- Tested the code diff expansion buttons functionality and it works as
before plus a loading indicator

# Demo using `htmx` instead of jQuery AJAX

![action](afba7442-ed56-4d39-b764-835d1f6c3a9c)

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
(cherry picked from commit 4e3d81e44ee3f504f7262966533305561e04101f)
This commit is contained in:
Yarden Shoham 2024-02-25 07:07:23 +02:00 committed by Earl Warren
parent 4a08726c96
commit 30fe3d8d4c
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
4 changed files with 12 additions and 20 deletions

View file

@ -186,14 +186,6 @@ export function initRepoCodeView() {
$(document).on('click', '.fold-file', ({currentTarget}) => {
invertFileFolding(currentTarget.closest('.file-content'), currentTarget);
});
$(document).on('click', '.code-expander-button', async ({currentTarget}) => {
const url = currentTarget.getAttribute('data-url');
const query = currentTarget.getAttribute('data-query');
const anchor = currentTarget.getAttribute('data-anchor');
if (!url) return;
const blob = await $.get(`${url}?${query}&anchor=${anchor}`);
currentTarget.closest('tr').outerHTML = blob;
});
$(document).on('click', '.copy-line-permalink', async ({currentTarget}) => {
await clippie(toAbsoluteUrl(currentTarget.getAttribute('data-url')));
});