Removed jquery

This commit is contained in:
Thomas Sayen 2025-06-11 09:45:58 +02:00 committed by Thomas Sayen
parent 8cef3d3217
commit bb6778500f
2 changed files with 24 additions and 20 deletions

View File

@ -1,7 +1,6 @@
import {createTippy} from '../modules/tippy.ts'; import {createTippy} from '../modules/tippy.ts';
import {toggleElem} from '../utils/dom.ts'; import {toggleElem} from '../utils/dom.ts';
import {registerGlobalEventFunc, registerGlobalInitFunc} from '../modules/observer.ts'; import {registerGlobalEventFunc, registerGlobalInitFunc} from '../modules/observer.ts';
import $ from 'jquery';
export function initRepoEllipsisButton() { export function initRepoEllipsisButton() {
registerGlobalEventFunc('click', 'onRepoEllipsisButtonClick', async (el: HTMLInputElement, e: Event) => { registerGlobalEventFunc('click', 'onRepoEllipsisButtonClick', async (el: HTMLInputElement, e: Event) => {
@ -26,24 +25,28 @@ export function initCommitStatuses() {
}); });
} }
window.addEventListener('DOMContentLoaded', () => { export function initCommitFileHistoryFollowRename() {
($('input[name=history-enable-follow-renames]')[0] as HTMLInputElement).checked = location.toString().includes('history_follow_rename=true'); const checkbox : HTMLInputElement | null = document.querySelector('input[name=history-enable-follow-renames]');
});
$('input[name=history-enable-follow-renames]').on('change', function() { if (!checkbox) {
const checked = ($(this)[0] as HTMLInputElement).matches(':checked'); return;
let url = location.toString();
url = url.replaceAll(/history_follow_rename=(true|false)&*/g, '');
if (url.endsWith('?')) {
url = url.slice(0, -1);
}
if (url.includes('?')) {
url += '&';
} else {
url += '?';
} }
checkbox.checked = location.toString().includes('history_follow_rename=true');
url += `history_follow_rename=${checked}`; checkbox.addEventListener('change', () => {
window.location.href = url; let url = location.toString();
});
url = url.replaceAll(/history_follow_rename=(true|false)&*/g, '');
if (url.endsWith('?')) {
url = url.slice(0, -1);
}
if (url.includes('?')) {
url += '&';
} else {
url += '?';
}
url += `history_follow_rename=${checkbox.checked}`;
window.location.href = url;
});
}

View File

@ -22,7 +22,7 @@ import {initMarkupContent} from './markup/content.ts';
import {initPdfViewer} from './render/pdf.ts'; import {initPdfViewer} from './render/pdf.ts';
import {initUserAuthOauth2, initUserCheckAppUrl} from './features/user-auth.ts'; import {initUserAuthOauth2, initUserCheckAppUrl} from './features/user-auth.ts';
import {initRepoPullRequestAllowMaintainerEdit, initRepoPullRequestReview, initRepoIssueSidebarDependency, initRepoIssueFilterItemLabel} from './features/repo-issue.ts'; import {initRepoPullRequestAllowMaintainerEdit, initRepoPullRequestReview, initRepoIssueSidebarDependency, initRepoIssueFilterItemLabel} from './features/repo-issue.ts';
import {initRepoEllipsisButton, initCommitStatuses} from './features/repo-commit.ts'; import {initRepoEllipsisButton, initCommitStatuses, initCommitFileHistoryFollowRename} from './features/repo-commit.ts';
import {initRepoTopicBar} from './features/repo-home.ts'; import {initRepoTopicBar} from './features/repo-home.ts';
import {initAdminCommon} from './features/admin/common.ts'; import {initAdminCommon} from './features/admin/common.ts';
import {initRepoCodeView} from './features/repo-code.ts'; import {initRepoCodeView} from './features/repo-code.ts';
@ -151,6 +151,7 @@ onDomReady(() => {
initRepoRecentCommits, initRepoRecentCommits,
initCommitStatuses, initCommitStatuses,
initCommitFileHistoryFollowRename,
initCaptcha, initCaptcha,
initUserCheckAppUrl, initUserCheckAppUrl,