mirror of https://github.com/go-gitea/gitea.git
Removed jquery
This commit is contained in:
parent
8cef3d3217
commit
bb6778500f
|
|
@ -1,7 +1,6 @@
|
|||
import {createTippy} from '../modules/tippy.ts';
|
||||
import {toggleElem} from '../utils/dom.ts';
|
||||
import {registerGlobalEventFunc, registerGlobalInitFunc} from '../modules/observer.ts';
|
||||
import $ from 'jquery';
|
||||
|
||||
export function initRepoEllipsisButton() {
|
||||
registerGlobalEventFunc('click', 'onRepoEllipsisButtonClick', async (el: HTMLInputElement, e: Event) => {
|
||||
|
|
@ -26,24 +25,28 @@ export function initCommitStatuses() {
|
|||
});
|
||||
}
|
||||
|
||||
window.addEventListener('DOMContentLoaded', () => {
|
||||
($('input[name=history-enable-follow-renames]')[0] as HTMLInputElement).checked = location.toString().includes('history_follow_rename=true');
|
||||
});
|
||||
export function initCommitFileHistoryFollowRename() {
|
||||
const checkbox : HTMLInputElement | null = document.querySelector('input[name=history-enable-follow-renames]');
|
||||
|
||||
$('input[name=history-enable-follow-renames]').on('change', function() {
|
||||
const checked = ($(this)[0] as HTMLInputElement).matches(':checked');
|
||||
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 += '?';
|
||||
if (!checkbox) {
|
||||
return;
|
||||
}
|
||||
checkbox.checked = location.toString().includes('history_follow_rename=true');
|
||||
|
||||
url += `history_follow_rename=${checked}`;
|
||||
window.location.href = url;
|
||||
});
|
||||
checkbox.addEventListener('change', () => {
|
||||
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;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import {initMarkupContent} from './markup/content.ts';
|
|||
import {initPdfViewer} from './render/pdf.ts';
|
||||
import {initUserAuthOauth2, initUserCheckAppUrl} from './features/user-auth.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 {initAdminCommon} from './features/admin/common.ts';
|
||||
import {initRepoCodeView} from './features/repo-code.ts';
|
||||
|
|
@ -151,6 +151,7 @@ onDomReady(() => {
|
|||
initRepoRecentCommits,
|
||||
|
||||
initCommitStatuses,
|
||||
initCommitFileHistoryFollowRename,
|
||||
initCaptcha,
|
||||
|
||||
initUserCheckAppUrl,
|
||||
|
|
|
|||
Loading…
Reference in New Issue