Upgrade jQuery to 3.5.0, remove jQuery-Migrate, fix deprecations (#11055)
- Removed jQuery-Migrate as it seems to no longer be needed. - Removed a dead code section. - Fixed some deprecations detected by jQuery-Migrate. Ref: https://jquery.com/upgrade-guide/3.5/ Ref: https://github.com/gogs/gogs/search?q=repo-name-change-prompt Ref: https://github.com/go-gitea/gitea/search?q=repo-name-change-prompt Fixes: https://github.com/go-gitea/gitea/issues/9372 Co-authored-by: zeripath <art27@cantab.net>
This commit is contained in:
parent
4be7cf0405
commit
b57a735e77
11
package-lock.json
generated
11
package-lock.json
generated
@ -7861,9 +7861,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"jquery": {
|
"jquery": {
|
||||||
"version": "3.4.1",
|
"version": "3.5.0",
|
||||||
"resolved": "https://registry.npmjs.org/jquery/-/jquery-3.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/jquery/-/jquery-3.5.0.tgz",
|
||||||
"integrity": "sha512-36+AdBzCL+y6qjw5Tx7HgzeGCzC81MDDgaUP8ld2zhx58HdqXGoBd+tHdrBMiyjGQs0Hxs/MLZTu/eHNJJuWPw=="
|
"integrity": "sha512-Xb7SVYMvygPxbFMpTFQiHh1J7HClEaThguL15N/Gg37Lri/qKyhRGZYzHRyLH8Stq3Aow0LsHO2O2ci86fCrNQ=="
|
||||||
},
|
},
|
||||||
"jquery-datetimepicker": {
|
"jquery-datetimepicker": {
|
||||||
"version": "2.5.21",
|
"version": "2.5.21",
|
||||||
@ -7875,11 +7875,6 @@
|
|||||||
"php-date-formatter": "^1.3.4"
|
"php-date-formatter": "^1.3.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"jquery-migrate": {
|
|
||||||
"version": "3.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/jquery-migrate/-/jquery-migrate-3.1.0.tgz",
|
|
||||||
"integrity": "sha512-u/MtE1ST2pCr3rCyouJG2xMiw/k3OzLNeRKprjKTeHUezCGr0DyEgeXFdqFLmQfxfR5EsVu+mGo/sCcYdiYcIQ=="
|
|
||||||
},
|
|
||||||
"jquery-mousewheel": {
|
"jquery-mousewheel": {
|
||||||
"version": "3.1.13",
|
"version": "3.1.13",
|
||||||
"resolved": "https://registry.npmjs.org/jquery-mousewheel/-/jquery-mousewheel-3.1.13.tgz",
|
"resolved": "https://registry.npmjs.org/jquery-mousewheel/-/jquery-mousewheel-3.1.13.tgz",
|
||||||
|
@ -23,9 +23,8 @@
|
|||||||
"fomantic-ui": "2.8.4",
|
"fomantic-ui": "2.8.4",
|
||||||
"highlight.js": "9.18.1",
|
"highlight.js": "9.18.1",
|
||||||
"imports-loader": "0.8.0",
|
"imports-loader": "0.8.0",
|
||||||
"jquery": "3.4.1",
|
"jquery": "3.5.0",
|
||||||
"jquery-datetimepicker": "2.5.21",
|
"jquery-datetimepicker": "2.5.21",
|
||||||
"jquery-migrate": "3.1.0",
|
|
||||||
"jquery.are-you-sure": "1.9.0",
|
"jquery.are-you-sure": "1.9.0",
|
||||||
"less-loader": "5.0.0",
|
"less-loader": "5.0.0",
|
||||||
"mini-css-extract-plugin": "0.9.0",
|
"mini-css-extract-plugin": "0.9.0",
|
||||||
|
7
public/vendor/librejs.html
vendored
7
public/vendor/librejs.html
vendored
@ -18,12 +18,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td><a href="../js/jquery.js">jQuery</a></td>
|
<td><a href="../js/jquery.js">jQuery</a></td>
|
||||||
<td><a href="https://jquery.org/license/">MIT</a></td>
|
<td><a href="https://jquery.org/license/">MIT</a></td>
|
||||||
<td><a href="https://code.jquery.com/jquery-3.4.1.min.js">jquery-3.4.1.min.js</a></td>
|
<td><a href="https://code.jquery.com/jquery-3.5.0.min.js">jquery-3.5.0.min.js</a></td>
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><a href="../js/jquery.js">jQuery Migrate</a></td>
|
|
||||||
<td><a href="https://jquery.org/license/">MIT</a></td>
|
|
||||||
<td><a href="https://code.jquery.com/jquery-migrate-3.1.0.min.js">jquery-migrate-3.1.0.min.js</a></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="../fomantic/semantic.min.js">semantic.min.js</a></td>
|
<td><a href="../fomantic/semantic.min.js">semantic.min.js</a></td>
|
||||||
|
@ -36,7 +36,7 @@ $.fn.tab.settings.silent = true;
|
|||||||
function initCommentPreviewTab($form) {
|
function initCommentPreviewTab($form) {
|
||||||
const $tabMenu = $form.find('.tabular.menu');
|
const $tabMenu = $form.find('.tabular.menu');
|
||||||
$tabMenu.find('.item').tab();
|
$tabMenu.find('.item').tab();
|
||||||
$tabMenu.find(`.item[data-tab="${$tabMenu.data('preview')}"]`).click(function () {
|
$tabMenu.find(`.item[data-tab="${$tabMenu.data('preview')}"]`).on('click', function () {
|
||||||
const $this = $(this);
|
const $this = $(this);
|
||||||
$.post($this.data('url'), {
|
$.post($this.data('url'), {
|
||||||
_csrf: csrf,
|
_csrf: csrf,
|
||||||
@ -62,7 +62,7 @@ function initEditPreviewTab($form) {
|
|||||||
const $previewTab = $tabMenu.find(`.item[data-tab="${$tabMenu.data('preview')}"]`);
|
const $previewTab = $tabMenu.find(`.item[data-tab="${$tabMenu.data('preview')}"]`);
|
||||||
if ($previewTab.length) {
|
if ($previewTab.length) {
|
||||||
previewFileModes = $previewTab.data('preview-file-modes').split(',');
|
previewFileModes = $previewTab.data('preview-file-modes').split(',');
|
||||||
$previewTab.click(function () {
|
$previewTab.on('click', function () {
|
||||||
const $this = $(this);
|
const $this = $(this);
|
||||||
$.post($this.data('url'), {
|
$.post($this.data('url'), {
|
||||||
_csrf: csrf,
|
_csrf: csrf,
|
||||||
@ -84,7 +84,7 @@ function initEditPreviewTab($form) {
|
|||||||
function initEditDiffTab($form) {
|
function initEditDiffTab($form) {
|
||||||
const $tabMenu = $form.find('.tabular.menu');
|
const $tabMenu = $form.find('.tabular.menu');
|
||||||
$tabMenu.find('.item').tab();
|
$tabMenu.find('.item').tab();
|
||||||
$tabMenu.find(`.item[data-tab="${$tabMenu.data('diff')}"]`).click(function () {
|
$tabMenu.find(`.item[data-tab="${$tabMenu.data('diff')}"]`).on('click', function () {
|
||||||
const $this = $(this);
|
const $this = $(this);
|
||||||
$.post($this.data('url'), {
|
$.post($this.data('url'), {
|
||||||
_csrf: csrf,
|
_csrf: csrf,
|
||||||
@ -110,12 +110,12 @@ function initEditForm() {
|
|||||||
function initBranchSelector() {
|
function initBranchSelector() {
|
||||||
const $selectBranch = $('.ui.select-branch');
|
const $selectBranch = $('.ui.select-branch');
|
||||||
const $branchMenu = $selectBranch.find('.reference-list-menu');
|
const $branchMenu = $selectBranch.find('.reference-list-menu');
|
||||||
$branchMenu.find('.item:not(.no-select)').click(function () {
|
$branchMenu.find('.item:not(.no-select)').on('click', function () {
|
||||||
const selectedValue = $(this).data('id');
|
const selectedValue = $(this).data('id');
|
||||||
$($(this).data('id-selector')).val(selectedValue);
|
$($(this).data('id-selector')).val(selectedValue);
|
||||||
$selectBranch.find('.ui .branch-name').text(selectedValue);
|
$selectBranch.find('.ui .branch-name').text(selectedValue);
|
||||||
});
|
});
|
||||||
$selectBranch.find('.reference.column').click(function () {
|
$selectBranch.find('.reference.column').on('click', function () {
|
||||||
$selectBranch.find('.scrolling.reference-list-menu').css('display', 'none');
|
$selectBranch.find('.scrolling.reference-list-menu').css('display', 'none');
|
||||||
$selectBranch.find('.reference .text').removeClass('black');
|
$selectBranch.find('.reference .text').removeClass('black');
|
||||||
$($(this).data('target')).css('display', 'block');
|
$($(this).data('target')).css('display', 'block');
|
||||||
@ -127,22 +127,22 @@ function initBranchSelector() {
|
|||||||
function initLabelEdit() {
|
function initLabelEdit() {
|
||||||
// Create label
|
// Create label
|
||||||
const $newLabelPanel = $('.new-label.segment');
|
const $newLabelPanel = $('.new-label.segment');
|
||||||
$('.new-label.button').click(() => {
|
$('.new-label.button').on('click', () => {
|
||||||
$newLabelPanel.show();
|
$newLabelPanel.show();
|
||||||
});
|
});
|
||||||
$('.new-label.segment .cancel').click(() => {
|
$('.new-label.segment .cancel').on('click', () => {
|
||||||
$newLabelPanel.hide();
|
$newLabelPanel.hide();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.color-picker').each(function () {
|
$('.color-picker').each(function () {
|
||||||
$(this).minicolors();
|
$(this).minicolors();
|
||||||
});
|
});
|
||||||
$('.precolors .color').click(function () {
|
$('.precolors .color').on('click', function () {
|
||||||
const color_hex = $(this).data('color-hex');
|
const color_hex = $(this).data('color-hex');
|
||||||
$('.color-picker').val(color_hex);
|
$('.color-picker').val(color_hex);
|
||||||
$('.minicolors-swatch-color').css('background-color', color_hex);
|
$('.minicolors-swatch-color').css('background-color', color_hex);
|
||||||
});
|
});
|
||||||
$('.edit-label-button').click(function () {
|
$('.edit-label-button').on('click', function () {
|
||||||
$('#label-modal-id').val($(this).data('id'));
|
$('#label-modal-id').val($(this).data('id'));
|
||||||
$('.edit-label .new-label-input').val($(this).data('title'));
|
$('.edit-label .new-label-input').val($(this).data('title'));
|
||||||
$('.edit-label .new-label-desc-input').val($(this).data('description'));
|
$('.edit-label .new-label-desc-input').val($(this).data('description'));
|
||||||
@ -150,7 +150,7 @@ function initLabelEdit() {
|
|||||||
$('.minicolors-swatch-color').css('background-color', $(this).data('color'));
|
$('.minicolors-swatch-color').css('background-color', $(this).data('color'));
|
||||||
$('.edit-label.modal').modal({
|
$('.edit-label.modal').modal({
|
||||||
onApprove() {
|
onApprove() {
|
||||||
$('.edit-label.form').submit();
|
$('.edit-label.form').trigger('submit');
|
||||||
}
|
}
|
||||||
}).modal('show');
|
}).modal('show');
|
||||||
return false;
|
return false;
|
||||||
@ -399,7 +399,7 @@ function initCommentForm() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$listMenu.find('.item:not(.no-select)').click(function () {
|
$listMenu.find('.item:not(.no-select)').on('click', function () {
|
||||||
// we don't need the action attribute when updating assignees
|
// we don't need the action attribute when updating assignees
|
||||||
if (selector === 'select-assignees-modify' || selector === 'select-reviewers-modify') {
|
if (selector === 'select-assignees-modify' || selector === 'select-reviewers-modify') {
|
||||||
// UI magic. We need to do this here, otherwise it would destroy the functionality of
|
// UI magic. We need to do this here, otherwise it would destroy the functionality of
|
||||||
@ -477,7 +477,7 @@ function initCommentForm() {
|
|||||||
$($(this).parent().data('id')).val(listIds.join(','));
|
$($(this).parent().data('id')).val(listIds.join(','));
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
$listMenu.find('.no-select.item').click(function () {
|
$listMenu.find('.no-select.item').on('click', function () {
|
||||||
if (hasLabelUpdateAction || selector === 'select-assignees-modify') {
|
if (hasLabelUpdateAction || selector === 'select-assignees-modify') {
|
||||||
updateIssuesMeta(
|
updateIssuesMeta(
|
||||||
$listMenu.data('update-url'),
|
$listMenu.data('update-url'),
|
||||||
@ -513,7 +513,7 @@ function initCommentForm() {
|
|||||||
const $list = $(`.ui${select_id}.list`);
|
const $list = $(`.ui${select_id}.list`);
|
||||||
const hasUpdateAction = $menu.data('action') === 'update';
|
const hasUpdateAction = $menu.data('action') === 'update';
|
||||||
|
|
||||||
$menu.find('.item:not(.no-select)').click(function () {
|
$menu.find('.item:not(.no-select)').on('click', function () {
|
||||||
$(this).parent().find('.item').each(function () {
|
$(this).parent().find('.item').each(function () {
|
||||||
$(this).removeClass('selected active');
|
$(this).removeClass('selected active');
|
||||||
});
|
});
|
||||||
@ -541,7 +541,7 @@ function initCommentForm() {
|
|||||||
$(`.ui${select_id}.list .no-select`).addClass('hide');
|
$(`.ui${select_id}.list .no-select`).addClass('hide');
|
||||||
$(input_id).val($(this).data('id'));
|
$(input_id).val($(this).data('id'));
|
||||||
});
|
});
|
||||||
$menu.find('.no-select.item').click(function () {
|
$menu.find('.no-select.item').on('click', function () {
|
||||||
$(this).parent().find('.item:not(.no-select)').each(function () {
|
$(this).parent().find('.item:not(.no-select)').each(function () {
|
||||||
$(this).removeClass('selected active');
|
$(this).removeClass('selected active');
|
||||||
});
|
});
|
||||||
@ -579,7 +579,7 @@ function initInstall() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Database type change detection.
|
// Database type change detection.
|
||||||
$('#db_type').change(function () {
|
$('#db_type').on('change', function () {
|
||||||
const sqliteDefault = 'data/gitea.db';
|
const sqliteDefault = 'data/gitea.db';
|
||||||
const tidbDefault = 'data/gitea_tidb';
|
const tidbDefault = 'data/gitea_tidb';
|
||||||
|
|
||||||
@ -616,26 +616,26 @@ function initInstall() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// TODO: better handling of exclusive relations.
|
// TODO: better handling of exclusive relations.
|
||||||
$('#offline-mode input').change(function () {
|
$('#offline-mode input').on('change', function () {
|
||||||
if ($(this).is(':checked')) {
|
if ($(this).is(':checked')) {
|
||||||
$('#disable-gravatar').checkbox('check');
|
$('#disable-gravatar').checkbox('check');
|
||||||
$('#federated-avatar-lookup').checkbox('uncheck');
|
$('#federated-avatar-lookup').checkbox('uncheck');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('#disable-gravatar input').change(function () {
|
$('#disable-gravatar input').on('change', function () {
|
||||||
if ($(this).is(':checked')) {
|
if ($(this).is(':checked')) {
|
||||||
$('#federated-avatar-lookup').checkbox('uncheck');
|
$('#federated-avatar-lookup').checkbox('uncheck');
|
||||||
} else {
|
} else {
|
||||||
$('#offline-mode').checkbox('uncheck');
|
$('#offline-mode').checkbox('uncheck');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('#federated-avatar-lookup input').change(function () {
|
$('#federated-avatar-lookup input').on('change', function () {
|
||||||
if ($(this).is(':checked')) {
|
if ($(this).is(':checked')) {
|
||||||
$('#disable-gravatar').checkbox('uncheck');
|
$('#disable-gravatar').checkbox('uncheck');
|
||||||
$('#offline-mode').checkbox('uncheck');
|
$('#offline-mode').checkbox('uncheck');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('#enable-openid-signin input').change(function () {
|
$('#enable-openid-signin input').on('change', function () {
|
||||||
if ($(this).is(':checked')) {
|
if ($(this).is(':checked')) {
|
||||||
if (!$('#disable-registration input').is(':checked')) {
|
if (!$('#disable-registration input').is(':checked')) {
|
||||||
$('#enable-openid-signup').checkbox('check');
|
$('#enable-openid-signup').checkbox('check');
|
||||||
@ -644,7 +644,7 @@ function initInstall() {
|
|||||||
$('#enable-openid-signup').checkbox('uncheck');
|
$('#enable-openid-signup').checkbox('uncheck');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('#disable-registration input').change(function () {
|
$('#disable-registration input').on('change', function () {
|
||||||
if ($(this).is(':checked')) {
|
if ($(this).is(':checked')) {
|
||||||
$('#enable-captcha').checkbox('uncheck');
|
$('#enable-captcha').checkbox('uncheck');
|
||||||
$('#enable-openid-signup').checkbox('uncheck');
|
$('#enable-openid-signup').checkbox('uncheck');
|
||||||
@ -652,7 +652,7 @@ function initInstall() {
|
|||||||
$('#enable-openid-signup').checkbox('check');
|
$('#enable-openid-signup').checkbox('check');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('#enable-captcha input').change(function () {
|
$('#enable-captcha input').on('change', function () {
|
||||||
if ($(this).is(':checked')) {
|
if ($(this).is(':checked')) {
|
||||||
$('#disable-registration').checkbox('uncheck');
|
$('#disable-registration').checkbox('uncheck');
|
||||||
}
|
}
|
||||||
@ -678,7 +678,7 @@ function initIssueComments() {
|
|||||||
).then(reload);
|
).then(reload);
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).click((event) => {
|
$(document).on('click', (event) => {
|
||||||
const urlTarget = $(':target');
|
const urlTarget = $(':target');
|
||||||
if (urlTarget.length === 0) return;
|
if (urlTarget.length === 0) return;
|
||||||
|
|
||||||
@ -728,17 +728,8 @@ async function initRepository() {
|
|||||||
|
|
||||||
// Options
|
// Options
|
||||||
if ($('.repository.settings.options').length > 0) {
|
if ($('.repository.settings.options').length > 0) {
|
||||||
$('#repo_name').keyup(function () {
|
|
||||||
const $prompt = $('#repo-name-change-prompt');
|
|
||||||
if ($(this).val().toString().toLowerCase() !== $(this).data('name').toString().toLowerCase()) {
|
|
||||||
$prompt.show();
|
|
||||||
} else {
|
|
||||||
$prompt.hide();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Enable or select internal/external wiki system and issue tracker.
|
// Enable or select internal/external wiki system and issue tracker.
|
||||||
$('.enable-system').change(function () {
|
$('.enable-system').on('change', function () {
|
||||||
if (this.checked) {
|
if (this.checked) {
|
||||||
$($(this).data('target')).removeClass('disabled');
|
$($(this).data('target')).removeClass('disabled');
|
||||||
if (!$(this).data('context')) $($(this).data('context')).addClass('disabled');
|
if (!$(this).data('context')) $($(this).data('context')).addClass('disabled');
|
||||||
@ -747,7 +738,7 @@ async function initRepository() {
|
|||||||
if (!$(this).data('context')) $($(this).data('context')).removeClass('disabled');
|
if (!$(this).data('context')) $($(this).data('context')).removeClass('disabled');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('.enable-system-radio').change(function () {
|
$('.enable-system-radio').on('change', function () {
|
||||||
if (this.value === 'false') {
|
if (this.value === 'false') {
|
||||||
$($(this).data('target')).addClass('disabled');
|
$($(this).data('target')).addClass('disabled');
|
||||||
if (typeof $(this).data('context') !== 'undefined') $($(this).data('context')).removeClass('disabled');
|
if (typeof $(this).data('context') !== 'undefined') $($(this).data('context')).removeClass('disabled');
|
||||||
@ -777,7 +768,7 @@ async function initRepository() {
|
|||||||
$('#deadline').val(date.toISOString().substring(0, 10));
|
$('#deadline').val(date.toISOString().substring(0, 10));
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
$('#clear-date').click(() => {
|
$('#clear-date').on('click', () => {
|
||||||
$('#deadline').val('');
|
$('#deadline').val('');
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
@ -813,11 +804,11 @@ async function initRepository() {
|
|||||||
));
|
));
|
||||||
selectionTextField.data('branch', branchNameNew); // update branch name in setting
|
selectionTextField.data('branch', branchNameNew); // update branch name in setting
|
||||||
};
|
};
|
||||||
$('#branch-select > .item').click(changeBranchSelect);
|
$('#branch-select > .item').on('click', changeBranchSelect);
|
||||||
|
|
||||||
$('#edit-title').click(editTitleToggle);
|
$('#edit-title').on('click', editTitleToggle);
|
||||||
$('#cancel-edit-title').click(editTitleToggle);
|
$('#cancel-edit-title').on('click', editTitleToggle);
|
||||||
$('#save-edit-title').click(editTitleToggle).click(function () {
|
$('#save-edit-title').on('click', editTitleToggle).on('click', function () {
|
||||||
const pullrequest_targetbranch_change = function (update_url) {
|
const pullrequest_targetbranch_change = function (update_url) {
|
||||||
const targetBranch = $('#pull-target-branch').data('branch');
|
const targetBranch = $('#pull-target-branch').data('branch');
|
||||||
const $branchTarget = $('#branch_target');
|
const $branchTarget = $('#branch_target');
|
||||||
@ -861,7 +852,7 @@ async function initRepository() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Quote reply
|
// Quote reply
|
||||||
$('.quote-reply').click(function (event) {
|
$('.quote-reply').on('click', function (event) {
|
||||||
$(this).closest('.dropdown').find('.menu').toggle('visible');
|
$(this).closest('.dropdown').find('.menu').toggle('visible');
|
||||||
const target = $(this).data('target');
|
const target = $(this).data('target');
|
||||||
const quote = $(`#comment-${target}`).text().replace(/\n/g, '\n> ');
|
const quote = $(`#comment-${target}`).text().replace(/\n/g, '\n> ');
|
||||||
@ -870,7 +861,7 @@ async function initRepository() {
|
|||||||
let $content;
|
let $content;
|
||||||
if ($(this).hasClass('quote-reply-diff')) {
|
if ($(this).hasClass('quote-reply-diff')) {
|
||||||
const $parent = $(this).closest('.comment-code-cloud');
|
const $parent = $(this).closest('.comment-code-cloud');
|
||||||
$parent.find('button.comment-form-reply').click();
|
$parent.find('button.comment-form-reply').trigger('click');
|
||||||
$content = $parent.find('[name="content"]');
|
$content = $parent.find('[name="content"]');
|
||||||
if ($content.val() !== '') {
|
if ($content.val() !== '') {
|
||||||
$content.val(`${$content.val()}\n\n${content}`);
|
$content.val(`${$content.val()}\n\n${content}`);
|
||||||
@ -889,7 +880,7 @@ async function initRepository() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Edit issue or comment content
|
// Edit issue or comment content
|
||||||
$('.edit-content').click(async function (event) {
|
$('.edit-content').on('click', async function (event) {
|
||||||
$(this).closest('.dropdown').find('.menu').toggle('visible');
|
$(this).closest('.dropdown').find('.menu').toggle('visible');
|
||||||
const $segment = $(this).closest('.header').next();
|
const $segment = $(this).closest('.header').next();
|
||||||
const $editContentZone = $segment.find('.edit-content-zone');
|
const $editContentZone = $segment.find('.edit-content-zone');
|
||||||
@ -987,12 +978,12 @@ async function initRepository() {
|
|||||||
initCommentPreviewTab($editContentForm);
|
initCommentPreviewTab($editContentForm);
|
||||||
initSimpleMDEImagePaste($simplemde, $files);
|
initSimpleMDEImagePaste($simplemde, $files);
|
||||||
|
|
||||||
$editContentZone.find('.cancel.button').click(() => {
|
$editContentZone.find('.cancel.button').on('click', () => {
|
||||||
$renderContent.show();
|
$renderContent.show();
|
||||||
$editContentZone.hide();
|
$editContentZone.hide();
|
||||||
dz.emit('reload');
|
dz.emit('reload');
|
||||||
});
|
});
|
||||||
$editContentZone.find('.save.button').click(() => {
|
$editContentZone.find('.save.button').on('click', () => {
|
||||||
$renderContent.show();
|
$renderContent.show();
|
||||||
$editContentZone.hide();
|
$editContentZone.hide();
|
||||||
const $attachments = $files.find('[name=files]').map(function () {
|
const $attachments = $files.find('[name=files]').map(function () {
|
||||||
@ -1048,7 +1039,7 @@ async function initRepository() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Delete comment
|
// Delete comment
|
||||||
$('.delete-comment').click(function () {
|
$('.delete-comment').on('click', function () {
|
||||||
const $this = $(this);
|
const $this = $(this);
|
||||||
if (window.confirm($this.data('locale'))) {
|
if (window.confirm($this.data('locale'))) {
|
||||||
$.post($this.data('url'), {
|
$.post($this.data('url'), {
|
||||||
@ -1062,16 +1053,16 @@ async function initRepository() {
|
|||||||
|
|
||||||
// Change status
|
// Change status
|
||||||
const $statusButton = $('#status-button');
|
const $statusButton = $('#status-button');
|
||||||
$('#comment-form .edit_area').keyup(function () {
|
$('#comment-form .edit_area').on('keyup', function () {
|
||||||
if ($(this).val().length === 0) {
|
if ($(this).val().length === 0) {
|
||||||
$statusButton.text($statusButton.data('status'));
|
$statusButton.text($statusButton.data('status'));
|
||||||
} else {
|
} else {
|
||||||
$statusButton.text($statusButton.data('status-and-comment'));
|
$statusButton.text($statusButton.data('status-and-comment'));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$statusButton.click(() => {
|
$statusButton.on('click', () => {
|
||||||
$('#status').val($statusButton.data('status-val'));
|
$('#status').val($statusButton.data('status-val'));
|
||||||
$('#comment-form').submit();
|
$('#comment-form').trigger('submit');
|
||||||
});
|
});
|
||||||
|
|
||||||
// Pull Request merge button
|
// Pull Request merge button
|
||||||
@ -1109,21 +1100,21 @@ async function initRepository() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Quick start and repository home
|
// Quick start and repository home
|
||||||
$('#repo-clone-ssh').click(function () {
|
$('#repo-clone-ssh').on('click', function () {
|
||||||
$('.clone-url').text($(this).data('link'));
|
$('.clone-url').text($(this).data('link'));
|
||||||
$('#repo-clone-url').val($(this).data('link'));
|
$('#repo-clone-url').val($(this).data('link'));
|
||||||
$(this).addClass('blue');
|
$(this).addClass('blue');
|
||||||
$('#repo-clone-https').removeClass('blue');
|
$('#repo-clone-https').removeClass('blue');
|
||||||
localStorage.setItem('repo-clone-protocol', 'ssh');
|
localStorage.setItem('repo-clone-protocol', 'ssh');
|
||||||
});
|
});
|
||||||
$('#repo-clone-https').click(function () {
|
$('#repo-clone-https').on('click', function () {
|
||||||
$('.clone-url').text($(this).data('link'));
|
$('.clone-url').text($(this).data('link'));
|
||||||
$('#repo-clone-url').val($(this).data('link'));
|
$('#repo-clone-url').val($(this).data('link'));
|
||||||
$(this).addClass('blue');
|
$(this).addClass('blue');
|
||||||
$('#repo-clone-ssh').removeClass('blue');
|
$('#repo-clone-ssh').removeClass('blue');
|
||||||
localStorage.setItem('repo-clone-protocol', 'https');
|
localStorage.setItem('repo-clone-protocol', 'https');
|
||||||
});
|
});
|
||||||
$('#repo-clone-url').click(function () {
|
$('#repo-clone-url').on('click', function () {
|
||||||
$(this).select();
|
$(this).select();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1143,14 +1134,14 @@ async function initRepository() {
|
|||||||
// Branches
|
// Branches
|
||||||
if ($('.repository.settings.branches').length > 0) {
|
if ($('.repository.settings.branches').length > 0) {
|
||||||
initFilterSearchDropdown('.protected-branches .dropdown');
|
initFilterSearchDropdown('.protected-branches .dropdown');
|
||||||
$('.enable-protection, .enable-whitelist, .enable-statuscheck').change(function () {
|
$('.enable-protection, .enable-whitelist, .enable-statuscheck').on('change', function () {
|
||||||
if (this.checked) {
|
if (this.checked) {
|
||||||
$($(this).data('target')).removeClass('disabled');
|
$($(this).data('target')).removeClass('disabled');
|
||||||
} else {
|
} else {
|
||||||
$($(this).data('target')).addClass('disabled');
|
$($(this).data('target')).addClass('disabled');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('.disable-whitelist').change(function () {
|
$('.disable-whitelist').on('change', function () {
|
||||||
if (this.checked) {
|
if (this.checked) {
|
||||||
$($(this).data('target')).addClass('disabled');
|
$($(this).data('target')).addClass('disabled');
|
||||||
}
|
}
|
||||||
@ -1288,7 +1279,7 @@ function assingMenuAttributes(menu) {
|
|||||||
|
|
||||||
function initRepositoryCollaboration() {
|
function initRepositoryCollaboration() {
|
||||||
// Change collaborator access mode
|
// Change collaborator access mode
|
||||||
$('.access-mode.menu .item').click(function () {
|
$('.access-mode.menu .item').on('click', function () {
|
||||||
const $menu = $(this).parent();
|
const $menu = $(this).parent();
|
||||||
$.post($menu.data('url'), {
|
$.post($menu.data('url'), {
|
||||||
_csrf: csrf,
|
_csrf: csrf,
|
||||||
@ -1300,7 +1291,7 @@ function initRepositoryCollaboration() {
|
|||||||
|
|
||||||
function initTeamSettings() {
|
function initTeamSettings() {
|
||||||
// Change team access mode
|
// Change team access mode
|
||||||
$('.organization.new.team input[name=permission]').change(() => {
|
$('.organization.new.team input[name=permission]').on('change', () => {
|
||||||
const val = $('input[name=permission]:checked', '.organization.new.team').val();
|
const val = $('input[name=permission]:checked', '.organization.new.team').val();
|
||||||
if (val === 'admin') {
|
if (val === 'admin') {
|
||||||
$('.organization.new.team .team-units').hide();
|
$('.organization.new.team .team-units').hide();
|
||||||
@ -1427,12 +1418,12 @@ function initWikiForm() {
|
|||||||
const $bSideBySide = $('.editor-toolbar a.fa-columns');
|
const $bSideBySide = $('.editor-toolbar a.fa-columns');
|
||||||
$bEdit.on('click', () => {
|
$bEdit.on('click', () => {
|
||||||
if ($toolbar.hasClass('disabled-for-preview')) {
|
if ($toolbar.hasClass('disabled-for-preview')) {
|
||||||
$bPreview.click();
|
$bPreview.trigger('click');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$bPrev.on('click', () => {
|
$bPrev.on('click', () => {
|
||||||
if (!$toolbar.hasClass('disabled-for-preview')) {
|
if (!$toolbar.hasClass('disabled-for-preview')) {
|
||||||
$bPreview.click();
|
$bPreview.trigger('click');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$bPreview.on('click', () => {
|
$bPreview.on('click', () => {
|
||||||
@ -1601,7 +1592,7 @@ function setCodeMirror($editArea) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function initEditor() {
|
function initEditor() {
|
||||||
$('.js-quick-pull-choice-option').change(function () {
|
$('.js-quick-pull-choice-option').on('change', function () {
|
||||||
if ($(this).val() === 'commit-to-new-branch') {
|
if ($(this).val() === 'commit-to-new-branch') {
|
||||||
$('.quick-pull-branch-name').show();
|
$('.quick-pull-branch-name').show();
|
||||||
$('.quick-pull-branch-name input').prop('required', true);
|
$('.quick-pull-branch-name input').prop('required', true);
|
||||||
@ -1613,7 +1604,7 @@ function initEditor() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const $editFilename = $('#file-name');
|
const $editFilename = $('#file-name');
|
||||||
$editFilename.keyup(function (e) {
|
$editFilename.on('keyup', function (e) {
|
||||||
const $section = $('.breadcrumb span.section');
|
const $section = $('.breadcrumb span.section');
|
||||||
const $divider = $('.breadcrumb div.divider');
|
const $divider = $('.breadcrumb div.divider');
|
||||||
let value;
|
let value;
|
||||||
@ -1765,12 +1756,12 @@ function initEditor() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$commitButton.click((event) => {
|
$commitButton.on('click', (event) => {
|
||||||
// A modal which asks if an empty file should be committed
|
// A modal which asks if an empty file should be committed
|
||||||
if ($editArea.val().length === 0) {
|
if ($editArea.val().length === 0) {
|
||||||
$('#edit-empty-content-modal').modal({
|
$('#edit-empty-content-modal').modal({
|
||||||
onApprove() {
|
onApprove() {
|
||||||
$('.edit.form').submit();
|
$('.edit.form').trigger('submit');
|
||||||
}
|
}
|
||||||
}).modal('show');
|
}).modal('show');
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
@ -1785,7 +1776,7 @@ function initOrganization() {
|
|||||||
|
|
||||||
// Options
|
// Options
|
||||||
if ($('.organization.settings.options').length > 0) {
|
if ($('.organization.settings.options').length > 0) {
|
||||||
$('#org_name').keyup(function () {
|
$('#org_name').on('keyup', function () {
|
||||||
const $prompt = $('#org-name-change-prompt');
|
const $prompt = $('#org-name-change-prompt');
|
||||||
if ($(this).val().toString().toLowerCase() !== $(this).data('org-name').toString().toLowerCase()) {
|
if ($(this).val().toString().toLowerCase() !== $(this).data('org-name').toString().toLowerCase()) {
|
||||||
$prompt.show();
|
$prompt.show();
|
||||||
@ -1804,7 +1795,7 @@ function initOrganization() {
|
|||||||
function initUserSettings() {
|
function initUserSettings() {
|
||||||
// Options
|
// Options
|
||||||
if ($('.user.settings.profile').length > 0) {
|
if ($('.user.settings.profile').length > 0) {
|
||||||
$('#username').keyup(function () {
|
$('#username').on('keyup', function () {
|
||||||
const $prompt = $('#name-change-prompt');
|
const $prompt = $('#name-change-prompt');
|
||||||
if ($(this).val().toString().toLowerCase() !== $(this).data('name').toString().toLowerCase()) {
|
if ($(this).val().toString().toLowerCase() !== $(this).data('name').toString().toLowerCase()) {
|
||||||
$prompt.show();
|
$prompt.show();
|
||||||
@ -1831,12 +1822,12 @@ function initWebhook() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$('.events.checkbox input').change(function () {
|
$('.events.checkbox input').on('change', function () {
|
||||||
if ($(this).is(':checked')) {
|
if ($(this).is(':checked')) {
|
||||||
$('.events.fields').show();
|
$('.events.fields').show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('.non-events.checkbox input').change(function () {
|
$('.non-events.checkbox input').on('change', function () {
|
||||||
if ($(this).is(':checked')) {
|
if ($(this).is(':checked')) {
|
||||||
$('.events.fields').hide();
|
$('.events.fields').hide();
|
||||||
}
|
}
|
||||||
@ -1847,12 +1838,12 @@ function initWebhook() {
|
|||||||
$('#content_type').parent().parent()[visible ? 'show' : 'hide']();
|
$('#content_type').parent().parent()[visible ? 'show' : 'hide']();
|
||||||
};
|
};
|
||||||
updateContentType();
|
updateContentType();
|
||||||
$('#http_method').change(() => {
|
$('#http_method').on('change', () => {
|
||||||
updateContentType();
|
updateContentType();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Test delivery
|
// Test delivery
|
||||||
$('#test-delivery').click(function () {
|
$('#test-delivery').on('click', function () {
|
||||||
const $this = $(this);
|
const $this = $(this);
|
||||||
$this.addClass('loading disabled');
|
$this.addClass('loading disabled');
|
||||||
$.post($this.data('link'), {
|
$.post($this.data('link'), {
|
||||||
@ -1872,7 +1863,7 @@ function initAdmin() {
|
|||||||
|
|
||||||
// New user
|
// New user
|
||||||
if ($('.admin.new.user').length > 0 || $('.admin.edit.user').length > 0) {
|
if ($('.admin.new.user').length > 0 || $('.admin.edit.user').length > 0) {
|
||||||
$('#login_type').change(function () {
|
$('#login_type').on('change', function () {
|
||||||
if ($(this).val().substring(0, 1) === '0') {
|
if ($(this).val().substring(0, 1) === '0') {
|
||||||
$('#login_name').removeAttr('required');
|
$('#login_name').removeAttr('required');
|
||||||
$('.non-local').hide();
|
$('.non-local').hide();
|
||||||
@ -1960,7 +1951,7 @@ function initAdmin() {
|
|||||||
|
|
||||||
// New authentication
|
// New authentication
|
||||||
if ($('.admin.new.authentication').length > 0) {
|
if ($('.admin.new.authentication').length > 0) {
|
||||||
$('#auth_type').change(function () {
|
$('#auth_type').on('change', function () {
|
||||||
$('.ldap, .dldap, .smtp, .pam, .oauth2, .has-tls, .search-page-size, .sspi').hide();
|
$('.ldap, .dldap, .smtp, .pam, .oauth2, .has-tls, .search-page-size, .sspi').hide();
|
||||||
|
|
||||||
$('.ldap input[required], .binddnrequired input[required], .dldap input[required], .smtp input[required], .pam input[required], .oauth2 input[required], .has-tls input[required], .sspi input[required]').removeAttr('required');
|
$('.ldap input[required], .binddnrequired input[required], .dldap input[required], .smtp input[required], .pam input[required], .oauth2 input[required], .has-tls input[required], .sspi input[required]').removeAttr('required');
|
||||||
@ -2003,23 +1994,23 @@ function initAdmin() {
|
|||||||
onUsePagedSearchChange();
|
onUsePagedSearchChange();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('#auth_type').change();
|
$('#auth_type').trigger('change');
|
||||||
$('#security_protocol').change(onSecurityProtocolChange);
|
$('#security_protocol').on('change', onSecurityProtocolChange);
|
||||||
$('#use_paged_search').change(onUsePagedSearchChange);
|
$('#use_paged_search').on('change', onUsePagedSearchChange);
|
||||||
$('#oauth2_provider').change(onOAuth2Change);
|
$('#oauth2_provider').on('change', onOAuth2Change);
|
||||||
$('#oauth2_use_custom_url').change(onOAuth2UseCustomURLChange);
|
$('#oauth2_use_custom_url').on('change', onOAuth2UseCustomURLChange);
|
||||||
}
|
}
|
||||||
// Edit authentication
|
// Edit authentication
|
||||||
if ($('.admin.edit.authentication').length > 0) {
|
if ($('.admin.edit.authentication').length > 0) {
|
||||||
const authType = $('#auth_type').val();
|
const authType = $('#auth_type').val();
|
||||||
if (authType === '2' || authType === '5') {
|
if (authType === '2' || authType === '5') {
|
||||||
$('#security_protocol').change(onSecurityProtocolChange);
|
$('#security_protocol').on('change', onSecurityProtocolChange);
|
||||||
if (authType === '2') {
|
if (authType === '2') {
|
||||||
$('#use_paged_search').change(onUsePagedSearchChange);
|
$('#use_paged_search').on('change', onUsePagedSearchChange);
|
||||||
}
|
}
|
||||||
} else if (authType === '6') {
|
} else if (authType === '6') {
|
||||||
$('#oauth2_provider').change(onOAuth2Change);
|
$('#oauth2_provider').on('change', onOAuth2Change);
|
||||||
$('#oauth2_use_custom_url').change(onOAuth2UseCustomURLChange);
|
$('#oauth2_use_custom_url').on('change', onOAuth2UseCustomURLChange);
|
||||||
onOAuth2Change();
|
onOAuth2Change();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2029,7 +2020,7 @@ function initAdmin() {
|
|||||||
const $detailModal = $('#detail-modal');
|
const $detailModal = $('#detail-modal');
|
||||||
|
|
||||||
// Attach view detail modals
|
// Attach view detail modals
|
||||||
$('.view-detail').click(function () {
|
$('.view-detail').on('click', function () {
|
||||||
$detailModal.find('.content p').text($(this).data('content'));
|
$detailModal.find('.content p').text($(this).data('content'));
|
||||||
$detailModal.modal('show');
|
$detailModal.modal('show');
|
||||||
return false;
|
return false;
|
||||||
@ -2037,7 +2028,7 @@ function initAdmin() {
|
|||||||
|
|
||||||
// Select actions
|
// Select actions
|
||||||
const $checkboxes = $('.select.table .ui.checkbox');
|
const $checkboxes = $('.select.table .ui.checkbox');
|
||||||
$('.select.action').click(function () {
|
$('.select.action').on('click', function () {
|
||||||
switch ($(this).data('action')) {
|
switch ($(this).data('action')) {
|
||||||
case 'select-all':
|
case 'select-all':
|
||||||
$checkboxes.checkbox('check');
|
$checkboxes.checkbox('check');
|
||||||
@ -2050,7 +2041,7 @@ function initAdmin() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('#delete-selection').click(function () {
|
$('#delete-selection').on('click', function () {
|
||||||
const $this = $(this);
|
const $this = $(this);
|
||||||
$this.addClass('loading disabled');
|
$this.addClass('loading disabled');
|
||||||
const ids = [];
|
const ids = [];
|
||||||
@ -2070,9 +2061,9 @@ function initAdmin() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function buttonsClickOnEnter() {
|
function buttonsClickOnEnter() {
|
||||||
$('.ui.button').keypress(function (e) {
|
$('.ui.button').on('keypress', function (e) {
|
||||||
if (e.keyCode === 13 || e.keyCode === 32) { // enter key or space bar
|
if (e.keyCode === 13 || e.keyCode === 32) { // enter key or space bar
|
||||||
$(this).click();
|
$(this).trigger('click');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -2322,7 +2313,7 @@ function u2fRegisterRequest() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function initWipTitle() {
|
function initWipTitle() {
|
||||||
$('.title_wip_desc > a').click((e) => {
|
$('.title_wip_desc > a').on('click', (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
const $issueTitle = $('#issue_title');
|
const $issueTitle = $('#issue_title');
|
||||||
@ -2352,7 +2343,7 @@ function initTemplateSearch() {
|
|||||||
$nonTemplate.show();
|
$nonTemplate.show();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
$repoTemplate.change(checkTemplate);
|
$repoTemplate.on('change', checkTemplate);
|
||||||
checkTemplate();
|
checkTemplate();
|
||||||
|
|
||||||
const changeOwner = function () {
|
const changeOwner = function () {
|
||||||
@ -2381,7 +2372,7 @@ function initTemplateSearch() {
|
|||||||
fullTextSearch: true
|
fullTextSearch: true
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
$('#uid').change(changeOwner);
|
$('#uid').on('change', changeOwner);
|
||||||
changeOwner();
|
changeOwner();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2425,12 +2416,12 @@ $(document).ready(async () => {
|
|||||||
$('.tabular.menu .item').tab();
|
$('.tabular.menu .item').tab();
|
||||||
$('.tabable.menu .item').tab();
|
$('.tabable.menu .item').tab();
|
||||||
|
|
||||||
$('.toggle.button').click(function () {
|
$('.toggle.button').on('click', function () {
|
||||||
$($(this).data('target')).slideToggle(100);
|
$($(this).data('target')).slideToggle(100);
|
||||||
});
|
});
|
||||||
|
|
||||||
// make table <tr> element clickable like a link
|
// make table <tr> element clickable like a link
|
||||||
$('tr[data-href]').click(function () {
|
$('tr[data-href]').on('click', function () {
|
||||||
window.location = $(this).data('href');
|
window.location = $(this).data('href');
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -2487,14 +2478,14 @@ $(document).ready(async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Helpers.
|
// Helpers.
|
||||||
$('.delete-button').click(showDeletePopup);
|
$('.delete-button').on('click', showDeletePopup);
|
||||||
$('.add-all-button').click(showAddAllPopup);
|
$('.add-all-button').on('click', showAddAllPopup);
|
||||||
$('.link-action').click(linkAction);
|
$('.link-action').on('click', linkAction);
|
||||||
$('.link-email-action').click(linkEmailAction);
|
$('.link-email-action').on('click', linkEmailAction);
|
||||||
|
|
||||||
$('.delete-branch-button').click(showDeletePopup);
|
$('.delete-branch-button').on('click', showDeletePopup);
|
||||||
|
|
||||||
$('.undo-button').click(function () {
|
$('.undo-button').on('click', function () {
|
||||||
const $this = $(this);
|
const $this = $(this);
|
||||||
$.post($this.data('url'), {
|
$.post($this.data('url'), {
|
||||||
_csrf: csrf,
|
_csrf: csrf,
|
||||||
@ -2503,13 +2494,13 @@ $(document).ready(async () => {
|
|||||||
window.location.href = data.redirect;
|
window.location.href = data.redirect;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
$('.show-panel.button').click(function () {
|
$('.show-panel.button').on('click', function () {
|
||||||
$($(this).data('panel')).show();
|
$($(this).data('panel')).show();
|
||||||
});
|
});
|
||||||
$('.show-modal.button').click(function () {
|
$('.show-modal.button').on('click', function () {
|
||||||
$($(this).data('modal')).modal('show');
|
$($(this).data('modal')).modal('show');
|
||||||
});
|
});
|
||||||
$('.delete-post.button').click(function () {
|
$('.delete-post.button').on('click', function () {
|
||||||
const $this = $(this);
|
const $this = $(this);
|
||||||
$.post($this.data('request-url'), {
|
$.post($this.data('request-url'), {
|
||||||
_csrf: csrf
|
_csrf: csrf
|
||||||
@ -2527,7 +2518,7 @@ $(document).ready(async () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.issue-checkbox').click(() => {
|
$('.issue-checkbox').on('click', () => {
|
||||||
const numChecked = $('.issue-checkbox').children('input:checked').length;
|
const numChecked = $('.issue-checkbox').children('input:checked').length;
|
||||||
if (numChecked > 0) {
|
if (numChecked > 0) {
|
||||||
$('#issue-filters').addClass('hide');
|
$('#issue-filters').addClass('hide');
|
||||||
@ -2538,7 +2529,7 @@ $(document).ready(async () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.issue-action').click(function () {
|
$('.issue-action').on('click', function () {
|
||||||
let {action} = this.dataset;
|
let {action} = this.dataset;
|
||||||
let {elementId} = this.dataset;
|
let {elementId} = this.dataset;
|
||||||
const issueIDs = $('.issue-checkbox').children('input:checked').map(function () {
|
const issueIDs = $('.issue-checkbox').children('input:checked').map(function () {
|
||||||
@ -2563,7 +2554,7 @@ $(document).ready(async () => {
|
|||||||
// trigger ckecked event, if checkboxes are checked on load
|
// trigger ckecked event, if checkboxes are checked on load
|
||||||
$('.issue-checkbox input[type="checkbox"]:checked').first().each((_, e) => {
|
$('.issue-checkbox input[type="checkbox"]:checked').first().each((_, e) => {
|
||||||
e.checked = false;
|
e.checked = false;
|
||||||
$(e).click();
|
$(e).trigger('click');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.resolve-conversation').on('click', function (e) {
|
$('.resolve-conversation').on('click', function (e) {
|
||||||
@ -2614,12 +2605,12 @@ $(document).ready(async () => {
|
|||||||
if ($('#repo-clone-url').length > 0) {
|
if ($('#repo-clone-url').length > 0) {
|
||||||
switch (localStorage.getItem('repo-clone-protocol')) {
|
switch (localStorage.getItem('repo-clone-protocol')) {
|
||||||
case 'ssh':
|
case 'ssh':
|
||||||
if ($('#repo-clone-ssh').click().length === 0) {
|
if ($('#repo-clone-ssh').length === 0) {
|
||||||
$('#repo-clone-https').click();
|
$('#repo-clone-https').trigger('click');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$('#repo-clone-https').click();
|
$('#repo-clone-https').trigger('click');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2638,7 +2629,7 @@ $(document).ready(async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const $cloneAddr = $('#clone_addr');
|
const $cloneAddr = $('#clone_addr');
|
||||||
$cloneAddr.change(() => {
|
$cloneAddr.on('change', () => {
|
||||||
const $repoName = $('#repo_name');
|
const $repoName = $('#repo_name');
|
||||||
if ($cloneAddr.val().length > 0 && $repoName.val().length === 0) { // Only modify if repo_name input is blank
|
if ($cloneAddr.val().length > 0 && $repoName.val().length === 0) { // Only modify if repo_name input is blank
|
||||||
$repoName.val($cloneAddr.val().match(/^(.*\/)?((.+?)(\.git)?)$/)[3]);
|
$repoName.val($cloneAddr.val().match(/^(.*\/)?((.+?)(\.git)?)$/)[3]);
|
||||||
@ -2726,7 +2717,7 @@ function showDeletePopup() {
|
|||||||
closable: false,
|
closable: false,
|
||||||
onApprove() {
|
onApprove() {
|
||||||
if ($this.data('type') === 'form') {
|
if ($this.data('type') === 'form') {
|
||||||
$($this.data('form')).submit();
|
$($this.data('form')).trigger('submit');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2755,7 +2746,7 @@ function showAddAllPopup() {
|
|||||||
closable: false,
|
closable: false,
|
||||||
onApprove() {
|
onApprove() {
|
||||||
if ($this.data('type') === 'form') {
|
if ($this.data('type') === 'form') {
|
||||||
$($this.data('form')).submit();
|
$($this.data('form')).trigger('submit');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2965,9 +2956,9 @@ function initVueComponents() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function initCtrlEnterSubmit() {
|
function initCtrlEnterSubmit() {
|
||||||
$('.js-quick-submit').keydown(function (e) {
|
$('.js-quick-submit').on('keydown', function (e) {
|
||||||
if (((e.ctrlKey && !e.altKey) || e.metaKey) && (e.keyCode === 13 || e.keyCode === 10)) {
|
if (((e.ctrlKey && !e.altKey) || e.metaKey) && (e.keyCode === 13 || e.keyCode === 10)) {
|
||||||
$(this).closest('form').submit();
|
$(this).closest('form').trigger('submit');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -3000,16 +2991,16 @@ window.timeAddManual = function () {
|
|||||||
.modal({
|
.modal({
|
||||||
duration: 200,
|
duration: 200,
|
||||||
onApprove() {
|
onApprove() {
|
||||||
$('#add_time_manual_form').submit();
|
$('#add_time_manual_form').trigger('submit');
|
||||||
}
|
}
|
||||||
}).modal('show');
|
}).modal('show');
|
||||||
};
|
};
|
||||||
|
|
||||||
window.toggleStopwatch = function () {
|
window.toggleStopwatch = function () {
|
||||||
$('#toggle_stopwatch_form').submit();
|
$('#toggle_stopwatch_form').trigger('submit');
|
||||||
};
|
};
|
||||||
window.cancelStopwatch = function () {
|
window.cancelStopwatch = function () {
|
||||||
$('#cancel_stopwatch_form').submit();
|
$('#cancel_stopwatch_form').trigger('submit');
|
||||||
};
|
};
|
||||||
|
|
||||||
function initFilterBranchTagDropdown(selector) {
|
function initFilterBranchTagDropdown(selector) {
|
||||||
@ -3103,7 +3094,7 @@ function initFilterBranchTagDropdown(selector) {
|
|||||||
if (!this.showCreateNewBranch) {
|
if (!this.showCreateNewBranch) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.$refs.newBranchForm.submit();
|
this.$refs.newBranchForm.trigger('submit');
|
||||||
},
|
},
|
||||||
focusSearchField() {
|
focusSearchField() {
|
||||||
const vm = this;
|
const vm = this;
|
||||||
@ -3191,7 +3182,7 @@ function initFilterBranchTagDropdown(selector) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$('.commit-button').click(function (e) {
|
$('.commit-button').on('click', function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
$(this).parent().find('.commit-body').toggle();
|
$(this).parent().find('.commit-body').toggle();
|
||||||
});
|
});
|
||||||
@ -3200,7 +3191,7 @@ function initNavbarContentToggle() {
|
|||||||
const content = $('#navbar');
|
const content = $('#navbar');
|
||||||
const toggle = $('#navbar-expand-toggle');
|
const toggle = $('#navbar-expand-toggle');
|
||||||
let isExpanded = false;
|
let isExpanded = false;
|
||||||
toggle.click(() => {
|
toggle.on('click', () => {
|
||||||
isExpanded = !isExpanded;
|
isExpanded = !isExpanded;
|
||||||
if (isExpanded) {
|
if (isExpanded) {
|
||||||
content.addClass('shown');
|
content.addClass('shown');
|
||||||
@ -3221,7 +3212,7 @@ function initTopicbar() {
|
|||||||
const topicForm = $('#topic_edit.ui.form');
|
const topicForm = $('#topic_edit.ui.form');
|
||||||
const topicPrompts = getPrompts();
|
const topicPrompts = getPrompts();
|
||||||
|
|
||||||
mgrBtn.click(() => {
|
mgrBtn.on('click', () => {
|
||||||
viewDiv.hide();
|
viewDiv.hide();
|
||||||
editDiv.css('display', ''); // show Semantic UI Grid
|
editDiv.css('display', ''); // show Semantic UI Grid
|
||||||
});
|
});
|
||||||
@ -3236,7 +3227,7 @@ function initTopicbar() {
|
|||||||
return prompts;
|
return prompts;
|
||||||
}
|
}
|
||||||
|
|
||||||
saveBtn.click(() => {
|
saveBtn.on('click', () => {
|
||||||
const topics = $('input[name=topics]').val();
|
const topics = $('input[name=topics]').val();
|
||||||
|
|
||||||
$.post(saveBtn.data('link'), {
|
$.post(saveBtn.data('link'), {
|
||||||
@ -3445,7 +3436,7 @@ window.deleteDependencyModal = function (id, type) {
|
|||||||
onApprove() {
|
onApprove() {
|
||||||
$('#removeDependencyID').val(id);
|
$('#removeDependencyID').val(id);
|
||||||
$('#dependencyType').val(type);
|
$('#dependencyType').val(type);
|
||||||
$('#removeDependencyForm').submit();
|
$('#removeDependencyForm').trigger('submit');
|
||||||
}
|
}
|
||||||
}).modal('show');
|
}).modal('show');
|
||||||
};
|
};
|
||||||
@ -3487,7 +3478,7 @@ function initIssueList() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('.menu a.label-filter-item').each(function () {
|
$('.menu a.label-filter-item').each(function () {
|
||||||
$(this).click(function (e) {
|
$(this).on('click', function (e) {
|
||||||
if (e.altKey) {
|
if (e.altKey) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
@ -3502,7 +3493,7 @@ function initIssueList() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.menu .ui.dropdown.label-filter').keydown((e) => {
|
$('.menu .ui.dropdown.label-filter').on('keydown', (e) => {
|
||||||
if (e.altKey && e.keyCode === 13) {
|
if (e.altKey && e.keyCode === 13) {
|
||||||
const selectedItems = $('.menu .ui.dropdown.label-filter .menu .item.selected');
|
const selectedItems = $('.menu .ui.dropdown.label-filter .menu .item.selected');
|
||||||
|
|
||||||
@ -3533,7 +3524,7 @@ window.cancelCodeComment = function (btn) {
|
|||||||
window.submitReply = function (btn) {
|
window.submitReply = function (btn) {
|
||||||
const form = $(btn).closest('form');
|
const form = $(btn).closest('form');
|
||||||
if (form.length > 0 && form.hasClass('comment-form')) {
|
if (form.length > 0 && form.hasClass('comment-form')) {
|
||||||
form.submit();
|
form.trigger('submit');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
2
web_src/js/jquery.js
vendored
2
web_src/js/jquery.js
vendored
@ -1,5 +1,3 @@
|
|||||||
import $ from 'jquery';
|
import $ from 'jquery';
|
||||||
import 'jquery-migrate';
|
|
||||||
|
|
||||||
$.migrateMute = true;
|
|
||||||
window.$ = window.jQuery = $;
|
window.$ = window.jQuery = $;
|
||||||
|
Loading…
Reference in New Issue
Block a user