aboutsummaryrefslogtreecommitdiffstats
path: root/web_src/js
diff options
context:
space:
mode:
authorsilverwind <me@silverwind.io>2024-03-24 19:23:38 +0100
committerGitHub <noreply@github.com>2024-03-24 18:23:38 +0000
commitec3d467f15a683b305ac165c3eba6683628dcb25 (patch)
treeefcac44b28525ab5a131893e5eeab1771a5ae901 /web_src/js
parent0a2f973de9b681a472c96bdfcd945978e88458d8 (diff)
downloadgitea-ec3d467f15a683b305ac165c3eba6683628dcb25.tar.gz
gitea-ec3d467f15a683b305ac165c3eba6683628dcb25.zip
Migrate `gt-hidden` to `tw-hidden` (#30046)
We have to define this one in helpers.css because tailwind only generates a single class but certain things rely on this being double-class. Command ran: ```sh perl -p -i -e 's#gt-hidden#tw-hidden#g' web_src/js/**/* templates/**/* models/**/* web_src/css/**/* --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'web_src/js')
-rw-r--r--web_src/js/features/comp/LabelEdit.js6
-rw-r--r--web_src/js/features/notification.js6
-rw-r--r--web_src/js/features/repo-diff.js8
-rw-r--r--web_src/js/features/repo-graph.js12
-rw-r--r--web_src/js/features/repo-issue-content.js4
-rw-r--r--web_src/js/features/repo-issue.js28
-rw-r--r--web_src/js/features/repo-legacy.js18
-rw-r--r--web_src/js/markup/mermaid.js4
-rw-r--r--web_src/js/svg.js2
-rw-r--r--web_src/js/utils/dom.js8
10 files changed, 48 insertions, 48 deletions
diff --git a/web_src/js/features/comp/LabelEdit.js b/web_src/js/features/comp/LabelEdit.js
index 44fc9d9b6b..c5992fa355 100644
--- a/web_src/js/features/comp/LabelEdit.js
+++ b/web_src/js/features/comp/LabelEdit.js
@@ -15,14 +15,14 @@ function updateExclusiveLabelEdit(form) {
$exclusiveField.removeClass('muted');
$exclusiveField.removeAttr('aria-disabled');
if ($exclusiveCheckbox[0].checked && $exclusiveCheckbox.data('exclusive-warn')) {
- $exclusiveWarning.removeClass('gt-hidden');
+ $exclusiveWarning.removeClass('tw-hidden');
} else {
- $exclusiveWarning.addClass('gt-hidden');
+ $exclusiveWarning.addClass('tw-hidden');
}
} else {
$exclusiveField.addClass('muted');
$exclusiveField.attr('aria-disabled', 'true');
- $exclusiveWarning.addClass('gt-hidden');
+ $exclusiveWarning.addClass('tw-hidden');
}
}
diff --git a/web_src/js/features/notification.js b/web_src/js/features/notification.js
index 90e19b683b..d9f6e50202 100644
--- a/web_src/js/features/notification.js
+++ b/web_src/js/features/notification.js
@@ -35,7 +35,7 @@ async function receiveUpdateCount(event) {
const data = JSON.parse(event.data);
for (const count of document.querySelectorAll('.notification_count')) {
- count.classList.toggle('gt-hidden', data.Count === 0);
+ count.classList.toggle('tw-hidden', data.Count === 0);
count.textContent = `${data.Count}`;
}
await updateNotificationTable();
@@ -179,9 +179,9 @@ async function updateNotificationCount() {
const $notificationCount = $('.notification_count');
if (data.new === 0) {
- $notificationCount.addClass('gt-hidden');
+ $notificationCount.addClass('tw-hidden');
} else {
- $notificationCount.removeClass('gt-hidden');
+ $notificationCount.removeClass('tw-hidden');
}
$notificationCount.text(`${data.new}`);
diff --git a/web_src/js/features/repo-diff.js b/web_src/js/features/repo-diff.js
index 262ce2abff..4c8b411c64 100644
--- a/web_src/js/features/repo-diff.js
+++ b/web_src/js/features/repo-diff.js
@@ -42,8 +42,8 @@ function initRepoDiffFileViewToggle() {
$this.addClass('active');
const $target = $($this.data('toggle-selector'));
- $target.parent().children().addClass('gt-hidden');
- $target.removeClass('gt-hidden');
+ $target.parent().children().addClass('tw-hidden');
+ $target.removeClass('tw-hidden');
});
}
@@ -118,7 +118,7 @@ export function initRepoDiffConversationNav() {
// Previous/Next code review conversation
$(document).on('click', '.previous-conversation', (e) => {
const $conversation = $(e.currentTarget).closest('.comment-code-cloud');
- const $conversations = $('.comment-code-cloud:not(.gt-hidden)');
+ const $conversations = $('.comment-code-cloud:not(.tw-hidden)');
const index = $conversations.index($conversation);
const previousIndex = index > 0 ? index - 1 : $conversations.length - 1;
const $previousConversation = $conversations.eq(previousIndex);
@@ -127,7 +127,7 @@ export function initRepoDiffConversationNav() {
});
$(document).on('click', '.next-conversation', (e) => {
const $conversation = $(e.currentTarget).closest('.comment-code-cloud');
- const $conversations = $('.comment-code-cloud:not(.gt-hidden)');
+ const $conversations = $('.comment-code-cloud:not(.tw-hidden)');
const index = $conversations.index($conversation);
const nextIndex = index < $conversations.length - 1 ? index + 1 : 0;
const $nextConversation = $conversations.eq(nextIndex);
diff --git a/web_src/js/features/repo-graph.js b/web_src/js/features/repo-graph.js
index f2c0d78f34..a5b61bff54 100644
--- a/web_src/js/features/repo-graph.js
+++ b/web_src/js/features/repo-graph.js
@@ -57,9 +57,9 @@ export function initRepoGraphGit() {
ajaxUrl.searchParams.set('div-only', 'true');
window.history.replaceState({}, '', queryString ? `?${queryString}` : window.location.pathname);
$('#pagination').empty();
- $('#rel-container').addClass('gt-hidden');
- $('#rev-container').addClass('gt-hidden');
- $('#loading-indicator').removeClass('gt-hidden');
+ $('#rel-container').addClass('tw-hidden');
+ $('#rev-container').addClass('tw-hidden');
+ $('#loading-indicator').removeClass('tw-hidden');
(async () => {
const response = await GET(String(ajaxUrl));
const html = await response.text();
@@ -67,9 +67,9 @@ export function initRepoGraphGit() {
$('#pagination').html($div.find('#pagination').html());
$('#rel-container').html($div.find('#rel-container').html());
$('#rev-container').html($div.find('#rev-container').html());
- $('#loading-indicator').addClass('gt-hidden');
- $('#rel-container').removeClass('gt-hidden');
- $('#rev-container').removeClass('gt-hidden');
+ $('#loading-indicator').addClass('tw-hidden');
+ $('#rel-container').removeClass('tw-hidden');
+ $('#rev-container').removeClass('tw-hidden');
})();
};
const dropdownSelected = params.getAll('branch');
diff --git a/web_src/js/features/repo-issue-content.js b/web_src/js/features/repo-issue-content.js
index 9d51ab6b8d..3c4efe0447 100644
--- a/web_src/js/features/repo-issue-content.js
+++ b/web_src/js/features/repo-issue-content.js
@@ -18,7 +18,7 @@ function showContentHistoryDetail(issueBaseUrl, commentId, historyId, itemTitleH
${svg('octicon-x', 16, 'close icon inside')}
<div class="header tw-flex tw-items-center tw-justify-between">
<div>${itemTitleHtml}</div>
- <div class="ui dropdown dialog-header-options tw-mr-8 gt-hidden">
+ <div class="ui dropdown dialog-header-options tw-mr-8 tw-hidden">
${i18nTextOptions}
${svg('octicon-triangle-down', 14, 'dropdown icon')}
<div class="menu">
@@ -76,7 +76,7 @@ function showContentHistoryDetail(issueBaseUrl, commentId, historyId, itemTitleH
$dialog.find('.comment-diff-data').removeClass('is-loading').html(resp.diffHtml);
// there is only one option "item[data-option-item=delete]", so the dropdown can be entirely shown/hidden.
if (resp.canSoftDelete) {
- $dialog.find('.dialog-header-options').removeClass('gt-hidden');
+ $dialog.find('.dialog-header-options').removeClass('tw-hidden');
}
} catch (error) {
console.error('Error:', error);
diff --git a/web_src/js/features/repo-issue.js b/web_src/js/features/repo-issue.js
index bf4ec15372..492428b327 100644
--- a/web_src/js/features/repo-issue.js
+++ b/web_src/js/features/repo-issue.js
@@ -222,7 +222,7 @@ export function initRepoIssueCodeCommentCancel() {
$(document).on('click', '.cancel-code-comment', (e) => {
const $form = $(e.currentTarget).closest('form');
if ($form.length > 0 && $form.hasClass('comment-form')) {
- $form.addClass('gt-hidden');
+ $form.addClass('tw-hidden');
showElem($form.closest('.comment-code-cloud').find('button.comment-form-reply'));
} else {
$form.closest('.comment-code-cloud').remove();
@@ -397,7 +397,7 @@ export function initRepoIssueComments() {
export async function handleReply($el) {
hideElem($el);
const $form = $el.closest('.comment-code-cloud').find('.comment-form');
- $form.removeClass('gt-hidden');
+ $form.removeClass('tw-hidden');
const $textarea = $form.find('textarea');
let editor = getComboMarkdownEditor($textarea);
@@ -433,10 +433,10 @@ export function initRepoPullRequestReview() {
if ($diffHeader[0]) {
offset += $('.diff-detail-box').outerHeight() + $diffHeader.outerHeight();
}
- $(`#show-outdated-${id}`).addClass('gt-hidden');
- $(`#code-comments-${id}`).removeClass('gt-hidden');
- $(`#code-preview-${id}`).removeClass('gt-hidden');
- $(`#hide-outdated-${id}`).removeClass('gt-hidden');
+ $(`#show-outdated-${id}`).addClass('tw-hidden');
+ $(`#code-comments-${id}`).removeClass('tw-hidden');
+ $(`#code-preview-${id}`).removeClass('tw-hidden');
+ $(`#hide-outdated-${id}`).removeClass('tw-hidden');
// if the comment box is folded, expand it
if ($ancestorDiffBox.attr('data-folded') && $ancestorDiffBox.attr('data-folded') === 'true') {
setFileFolding($ancestorDiffBox[0], $ancestorDiffBox.find('.fold-file')[0], false);
@@ -452,19 +452,19 @@ export function initRepoPullRequestReview() {
$(document).on('click', '.show-outdated', function (e) {
e.preventDefault();
const id = $(this).data('comment');
- $(this).addClass('gt-hidden');
- $(`#code-comments-${id}`).removeClass('gt-hidden');
- $(`#code-preview-${id}`).removeClass('gt-hidden');
- $(`#hide-outdated-${id}`).removeClass('gt-hidden');
+ $(this).addClass('tw-hidden');
+ $(`#code-comments-${id}`).removeClass('tw-hidden');
+ $(`#code-preview-${id}`).removeClass('tw-hidden');
+ $(`#hide-outdated-${id}`).removeClass('tw-hidden');
});
$(document).on('click', '.hide-outdated', function (e) {
e.preventDefault();
const id = $(this).data('comment');
- $(this).addClass('gt-hidden');
- $(`#code-comments-${id}`).addClass('gt-hidden');
- $(`#code-preview-${id}`).addClass('gt-hidden');
- $(`#show-outdated-${id}`).removeClass('gt-hidden');
+ $(this).addClass('tw-hidden');
+ $(`#code-comments-${id}`).addClass('tw-hidden');
+ $(`#code-preview-${id}`).addClass('tw-hidden');
+ $(`#show-outdated-${id}`).removeClass('tw-hidden');
});
$(document).on('click', 'button.comment-form-reply', async function (e) {
diff --git a/web_src/js/features/repo-legacy.js b/web_src/js/features/repo-legacy.js
index 838540fcc0..838c131623 100644
--- a/web_src/js/features/repo-legacy.js
+++ b/web_src/js/features/repo-legacy.js
@@ -31,7 +31,7 @@ const {csrfToken} = window.config;
// if there are draft comments, confirm before reloading, to avoid losing comments
function reloadConfirmDraftComment() {
const commentTextareas = [
- document.querySelector('.edit-content-zone:not(.gt-hidden) textarea'),
+ document.querySelector('.edit-content-zone:not(.tw-hidden) textarea'),
document.querySelector('#comment-form textarea'),
];
for (const textarea of commentTextareas) {
@@ -197,15 +197,15 @@ export function initRepoCommentForm() {
$(this).parent().find('.item').each(function () {
if ($(this).hasClass('checked')) {
listIds.push($(this).data('id'));
- $($(this).data('id-selector')).removeClass('gt-hidden');
+ $($(this).data('id-selector')).removeClass('tw-hidden');
} else {
- $($(this).data('id-selector')).addClass('gt-hidden');
+ $($(this).data('id-selector')).addClass('tw-hidden');
}
});
if (listIds.length === 0) {
- $noSelect.removeClass('gt-hidden');
+ $noSelect.removeClass('tw-hidden');
} else {
- $noSelect.addClass('gt-hidden');
+ $noSelect.addClass('tw-hidden');
}
$($(this).parent().data('id')).val(listIds.join(','));
return false;
@@ -234,9 +234,9 @@ export function initRepoCommentForm() {
}
$list.find('.item').each(function () {
- $(this).addClass('gt-hidden');
+ $(this).addClass('tw-hidden');
});
- $noSelect.removeClass('gt-hidden');
+ $noSelect.removeClass('tw-hidden');
$($(this).parent().data('id')).val('');
});
}
@@ -286,7 +286,7 @@ export function initRepoCommentForm() {
</a>
`);
- $(`.ui${select_id}.list .no-select`).addClass('gt-hidden');
+ $(`.ui${select_id}.list .no-select`).addClass('tw-hidden');
$(input_id).val($(this).data('id'));
});
$menu.find('.no-select.item').on('click', function () {
@@ -307,7 +307,7 @@ export function initRepoCommentForm() {
}
$list.find('.selected').html('');
- $list.find('.no-select').removeClass('gt-hidden');
+ $list.find('.no-select').removeClass('tw-hidden');
$(input_id).val('');
});
}
diff --git a/web_src/js/markup/mermaid.js b/web_src/js/markup/mermaid.js
index 82e9909fec..0549fb3e31 100644
--- a/web_src/js/markup/mermaid.js
+++ b/web_src/js/markup/mermaid.js
@@ -49,7 +49,7 @@ export async function renderMermaid() {
iframe.srcdoc = `<html><head><style>${iframeCss}</style></head><body>${svg}</body></html>`;
const mermaidBlock = document.createElement('div');
- mermaidBlock.classList.add('mermaid-block', 'is-loading', 'gt-hidden');
+ mermaidBlock.classList.add('mermaid-block', 'is-loading', 'tw-hidden');
mermaidBlock.append(iframe);
const btn = makeCodeCopyButton();
@@ -58,7 +58,7 @@ export async function renderMermaid() {
iframe.addEventListener('load', () => {
pre.replaceWith(mermaidBlock);
- mermaidBlock.classList.remove('gt-hidden');
+ mermaidBlock.classList.remove('tw-hidden');
iframe.style.height = `${iframe.contentWindow.document.body.clientHeight}px`;
setTimeout(() => { // avoid flash of iframe background
mermaidBlock.classList.remove('is-loading');
diff --git a/web_src/js/svg.js b/web_src/js/svg.js
index 3544b47c3d..20babb331e 100644
--- a/web_src/js/svg.js
+++ b/web_src/js/svg.js
@@ -213,7 +213,7 @@ export const SvgIcon = {
classes.push(...this.className.split(/\s+/).filter(Boolean));
}
if (this.symbolId) {
- classes.push('gt-hidden', 'svg-symbol-container');
+ classes.push('tw-hidden', 'svg-symbol-container');
svgInnerHtml = `<symbol id="${this.symbolId}" viewBox="${attrs['^viewBox']}">${svgInnerHtml}</symbol>`;
}
// create VNode
diff --git a/web_src/js/utils/dom.js b/web_src/js/utils/dom.js
index 4a6adf478e..59c455e2ab 100644
--- a/web_src/js/utils/dom.js
+++ b/web_src/js/utils/dom.js
@@ -22,11 +22,11 @@ function elementsCall(el, func, ...args) {
*/
function toggleShown(el, force) {
if (force === true) {
- el.classList.remove('gt-hidden');
+ el.classList.remove('tw-hidden');
} else if (force === false) {
- el.classList.add('gt-hidden');
+ el.classList.add('tw-hidden');
} else if (force === undefined) {
- el.classList.toggle('gt-hidden');
+ el.classList.toggle('tw-hidden');
} else {
throw new Error('invalid force argument');
}
@@ -46,7 +46,7 @@ export function toggleElem(el, force) {
export function isElemHidden(el) {
const res = [];
- elementsCall(el, (e) => res.push(e.classList.contains('gt-hidden')));
+ elementsCall(el, (e) => res.push(e.classList.contains('tw-hidden')));
if (res.length > 1) throw new Error(`isElemHidden doesn't work for multiple elements`);
return res[0];
}