mirror of
https://gitcode.com/gitea/gitea.git
synced 2025-06-26 23:08:27 +08:00
Refactor hiding-methods, remove jQuery show/hide, remove .hide
class, remove inline style=display:none (#22950)
Close #22847 This PR: * introduce Gitea's own `showElem` and related functions * remove jQuery show/hide * remove .hide class * remove inline style=display:none From now on: do not use: * "[hidden]" attribute: it's too weak, can not be applied to an element with "display: flex" * ".hidden" class: it has been polluted by Fomantic UI in many cases * inline style="display: none": it's difficult to tweak * jQuery's show/hide/toggle: it can not show/hide elements with "display: xxx !important" only use: * this ".gt-hidden" class * showElem/hideElem/toggleElem functions in "utils/dom.js" cc: @silverwind , this is the all-in-one PR
This commit is contained in:
.eslintrc.yaml
docs/content/doc/developers
templates
admin
install.tmplorg
repo
blame.tmplbranch_dropdown.tmplcommits_list.tmplcommits_list_small.tmplcreate.tmpl
diff
editor
find
graph.tmplhome.tmplissue
branch_selector_field.tmpl
labels
list.tmplmilestone_issues.tmplnew_form.tmplview_content.tmplview_content
view_title.tmplmigrate
settings
sub_menu.tmplview_file.tmplview_list.tmplwiki
shared/secrets
user
web_src
js
components
features
admin
common-global.jscommon-issue.jscommon-organization.jscomp
imagediff.jsinstall.jsorg-team.jsrepo-commit.jsrepo-common.jsrepo-diff.jsrepo-editor.jsrepo-findfile.jsrepo-graph.jsrepo-home.jsrepo-issue-content.jsrepo-issue.jsrepo-legacy.jsrepo-migrate.jsrepo-migration.jsrepo-release.jsrepo-template.jsrepo-unicode-escape.jsuser-auth-webauthn.jsuser-auth.jsuser-settings.jsutils
less
@ -1,4 +1,5 @@
|
||||
import $ from 'jquery';
|
||||
import {hideElem, showElem, toggleElem} from '../utils/dom.js';
|
||||
|
||||
const {csrfToken} = window.config;
|
||||
|
||||
@ -76,8 +77,8 @@ export function initRepoCommonBranchOrTagDropdown(selector) {
|
||||
$(selector).each(function () {
|
||||
const $dropdown = $(this);
|
||||
$dropdown.find('.reference.column').on('click', function () {
|
||||
$dropdown.find('.scrolling.reference-list-menu').hide();
|
||||
$($(this).data('target')).show();
|
||||
hideElem($dropdown.find('.scrolling.reference-list-menu'));
|
||||
showElem($($(this).data('target')));
|
||||
return false;
|
||||
});
|
||||
});
|
||||
@ -102,7 +103,7 @@ export function initRepoCommonLanguageStats() {
|
||||
if ($('.language-stats').length > 0) {
|
||||
$('.language-stats').on('click', (e) => {
|
||||
e.preventDefault();
|
||||
$('.language-stats-details, .repository-menu').slideToggle();
|
||||
toggleElem($('.language-stats-details, .repository-menu'));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user