Introduce eslint-plugin-no-jquery/no-event-shorthand (#24198)
https://github.com/go-gitea/gitea/pull/24098#issuecomment-1514010690 --------- Co-authored-by: silverwind <me@silverwind.io>
This commit is contained in:
parent
6793ef0069
commit
8ea33baa1c
12 changed files with 28 additions and 15 deletions
|
@ -21,7 +21,7 @@ export function initAdminCommon() {
|
|||
$('#login_name').removeAttr('required');
|
||||
hideElem($('.non-local'));
|
||||
showElem($('.local'));
|
||||
$('#user_name').focus();
|
||||
$('#user_name').trigger('focus');
|
||||
|
||||
if ($(this).data('password') === 'required') {
|
||||
$('#password').attr('required', 'required');
|
||||
|
@ -33,7 +33,7 @@ export function initAdminCommon() {
|
|||
$('#login_name').attr('required', 'required');
|
||||
showElem($('.non-local'));
|
||||
hideElem($('.local'));
|
||||
$('#login_name').focus();
|
||||
$('#login_name').trigger('focus');
|
||||
|
||||
$('#password').removeAttr('required');
|
||||
}
|
||||
|
|
|
@ -16,19 +16,19 @@ export function initAdminUserListSearchForm() {
|
|||
}
|
||||
}
|
||||
|
||||
$form.find(`input[type=radio]`).click(() => {
|
||||
$form.submit();
|
||||
$form.find(`input[type=radio]`).on('click', () => {
|
||||
$form.trigger('submit');
|
||||
return false;
|
||||
});
|
||||
|
||||
$form.find('.j-reset-status-filter').click(() => {
|
||||
$form.find('.j-reset-status-filter').on('click', () => {
|
||||
$form.find(`input[type=radio]`).each((_, e) => {
|
||||
const $e = $(e);
|
||||
if ($e.attr('name').startsWith('status_filter[')) {
|
||||
$e.prop('checked', false);
|
||||
}
|
||||
});
|
||||
$form.submit();
|
||||
$form.trigger('submit');
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ export function initCitationFileCopyContent() {
|
|||
});
|
||||
|
||||
$inputContent.on('click', () => {
|
||||
$inputContent.select();
|
||||
$inputContent.trigger('select');
|
||||
});
|
||||
|
||||
$('#cite-repo-button').on('click', () => {
|
||||
|
|
|
@ -68,7 +68,7 @@ export function initGlobalButtonClickOnEnter() {
|
|||
export function initGlobalCommon() {
|
||||
// Undo Safari emoji glitch fix at high enough zoom levels
|
||||
if (navigator.userAgent.match('Safari')) {
|
||||
$(window).resize(() => {
|
||||
$(window).on('resize', () => {
|
||||
const px = mqBinarySearch('width', 0, 4096, 1, 'px');
|
||||
const em = mqBinarySearch('width', 0, 1024, 0.01, 'em');
|
||||
if (em * 16 * 1.25 - px <= -1) {
|
||||
|
|
|
@ -69,7 +69,7 @@ export function initRepoCloneLink() {
|
|||
});
|
||||
|
||||
$inputLink.on('focus', () => {
|
||||
$inputLink.select();
|
||||
$inputLink.trigger('select');
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -313,7 +313,7 @@ export function initRepoIssueWipTitle() {
|
|||
e.preventDefault();
|
||||
|
||||
const $issueTitle = $('#issue_title');
|
||||
$issueTitle.focus();
|
||||
$issueTitle.trigger('focus');
|
||||
const value = $issueTitle.val().trim().toUpperCase();
|
||||
|
||||
const wipPrefixes = $('.title_wip_desc').data('wip-prefixes');
|
||||
|
@ -573,7 +573,7 @@ export function initRepoIssueTitleEdit() {
|
|||
toggleElem($('#pull-desc-edit'));
|
||||
toggleElem($('.in-edit'));
|
||||
$('#issue-title-wrapper').toggleClass('edit-active');
|
||||
$editInput.focus();
|
||||
$editInput.trigger('focus');
|
||||
return false;
|
||||
};
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ export function initRepoCommentForm() {
|
|||
const $selectBranch = $('.ui.select-branch');
|
||||
const $branchMenu = $selectBranch.find('.reference-list-menu');
|
||||
const $isNewIssue = $branchMenu.hasClass('new-issue');
|
||||
$branchMenu.find('.item:not(.no-select)').click(function () {
|
||||
$branchMenu.find('.item:not(.no-select)').on('click', function () {
|
||||
const selectedValue = $(this).data('id');
|
||||
const editMode = $('#editing_mode').val();
|
||||
$($(this).data('id-selector')).val(selectedValue);
|
||||
|
|
|
@ -153,7 +153,7 @@ export function initRepoProject() {
|
|||
});
|
||||
|
||||
$('.delete-project-board').each(function () {
|
||||
$(this).click(function (e) {
|
||||
$(this).on('click', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
$.ajax({
|
||||
|
@ -169,7 +169,7 @@ export function initRepoProject() {
|
|||
});
|
||||
});
|
||||
|
||||
$('#new_board_submit').click(function (e) {
|
||||
$('#new_board_submit').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
const boardTitle = $('#new_board');
|
||||
|
|
|
@ -5,7 +5,7 @@ export function initUserAuthOauth2() {
|
|||
const $oauth2LoginNav = $('#oauth2-login-navigator');
|
||||
if ($oauth2LoginNav.length === 0) return;
|
||||
|
||||
$oauth2LoginNav.find('.oauth-login-image').click(() => {
|
||||
$oauth2LoginNav.find('.oauth-login-image').on('click', () => {
|
||||
const oauthLoader = $('#oauth2-login-loader');
|
||||
const oauthNav = $('#oauth2-login-navigator');
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue