File tree Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -164,7 +164,7 @@ rules:
164164 jquery/no-parse-html : [2]
165165 jquery/no-prop : [0]
166166 jquery/no-proxy : [2]
167- jquery/no-ready : [0 ]
167+ jquery/no-ready : [2 ]
168168 jquery/no-serialize : [2]
169169 jquery/no-show : [2]
170170 jquery/no-size : [2]
Original file line number Diff line number Diff line change 11// bootstrap module must be the first one to be imported, it handles webpack lazy-loading and global errors
22import './bootstrap.js' ;
33
4- import $ from 'jquery' ;
54import { initRepoActivityTopAuthorsChart } from './components/RepoActivityTopAuthors.vue' ;
65import { initDashboardRepoList } from './components/DashboardRepoList.vue' ;
76
@@ -90,6 +89,7 @@ import {initCaptcha} from './features/captcha.js';
9089import { initRepositoryActionView } from './components/RepoActionView.vue' ;
9190import { initGlobalTooltips } from './modules/tippy.js' ;
9291import { initGiteaFomantic } from './modules/fomantic.js' ;
92+ import { onDomReady } from './utils/dom.js' ;
9393
9494// Run time-critical code as soon as possible. This is safe to do because this
9595// script appears at the end of <body> and rendered HTML is accessible at that point.
@@ -98,7 +98,7 @@ initFormattingReplacements();
9898// Init Gitea's Fomantic settings
9999initGiteaFomantic ( ) ;
100100
101- $ ( document ) . ready ( ( ) => {
101+ onDomReady ( ( ) => {
102102 initGlobalCommon ( ) ;
103103
104104 initGlobalTooltips ( ) ;
Original file line number Diff line number Diff line change @@ -67,3 +67,11 @@ export function hideElem(el) {
6767export function toggleElem ( el , force ) {
6868 elementsCall ( el , toggleShown , force ) ;
6969}
70+
71+ export function onDomReady ( cb ) {
72+ if ( document . readyState === 'loading' ) {
73+ document . addEventListener ( 'DOMContentLoaded' , cb ) ;
74+ } else {
75+ cb ( ) ;
76+ }
77+ }
You can’t perform that action at this time.
0 commit comments