1414 */
1515
1616import Masonry from 'masonry-layout' ;
17-
1817import { handleContactForm } from './contact' ;
1918import {
2019 handleAddFaq ,
@@ -37,94 +36,66 @@ import { calculateReadingTime, handlePasswordStrength, handlePasswordToggle, han
3736import './utils/tooltip' ;
3837import { handleWebAuthn } from './webauthn/webauthn' ;
3938
40- //
41- // Reload Captchas
42- //
43- const reloadButton = document . querySelector ( '#captcha-button' ) ;
44- if ( reloadButton !== null ) {
45- handleReloadCaptcha ( reloadButton ) ;
46- }
47-
48- //
49- // Password helpers
50- //
51- handlePasswordToggle ( ) ;
52- handlePasswordStrength ( ) ;
53-
54- //
55- // Calculate reading time
56- //
57- const faqBody = document . querySelector ( '.pmf-faq-body' ) ;
58- if ( faqBody !== null ) {
59- calculateReadingTime ( ) ;
60- }
61-
62- //
63- // Handle votings
64- //
65- handleUserVoting ( ) ;
66-
67- //
68- // Handle comments
69- //
70- handleSaveComment ( ) ;
71- handleComments ( ) ;
72-
73- //
74- // Handle Add a FAQ
75- //
76- handleAddFaq ( ) ;
77-
78- //
79- // Handle show FAQ
80- //
81- handleShowFaq ( ) ;
82- handleShareLinkButton ( ) ;
83-
84- //
85- // Handle Add a Question
86- //
87- handleQuestion ( ) ;
88-
89- //
90- // Handle Bookmarks
91- //
92- handleDeleteBookmarks ( ) ;
93- handleRemoveAllBookmarks ( ) ;
94-
95- //
96- // Handle user control panel
97- //
98- handleUserControlPanel ( ) ;
99-
100- //
101- // Handle user password
102- //
103- handleUserPassword ( ) ;
104-
105- //
106- // Handle request removal
107- //
108- handleRequestRemoval ( ) ;
109-
110- //
111- // Handle the contact form
112- //
113- handleContactForm ( ) ;
114-
115- //
116- // Handle the registration form
117- //
118- handleRegister ( ) ;
119- handleWebAuthn ( ) ;
120-
121- //
122- // Masonry on startpage
123- //
124- window . onload = ( ) => {
125- handleAutoComplete ( ) ;
39+ document . addEventListener ( 'DOMContentLoaded' , ( ) => {
40+ // Reload Captchas
41+ const reloadButton = document . querySelector ( '#captcha-button' ) ;
42+ if ( reloadButton !== null ) {
43+ handleReloadCaptcha ( reloadButton ) ;
44+ }
45+
46+ // Password helpers
47+ handlePasswordToggle ( ) ;
48+ handlePasswordStrength ( ) ;
49+
50+ // Calculate reading time
51+ const faqBody = document . querySelector ( '.pmf-faq-body' ) ;
52+ if ( faqBody !== null ) {
53+ calculateReadingTime ( ) ;
54+ }
55+
56+ // Handle votings
57+ handleUserVoting ( ) ;
58+
59+ // Handle comments
60+ handleSaveComment ( ) ;
61+ handleComments ( ) ;
62+
63+ // Handle Add a FAQ
64+ handleAddFaq ( ) ;
65+
66+ // Handle show FAQ
67+ handleShowFaq ( ) ;
68+ handleShareLinkButton ( ) ;
69+
70+ // Handle Add a Question
71+ handleQuestion ( ) ;
72+
73+ // Handle Bookmarks
74+ handleDeleteBookmarks ( ) ;
75+ handleRemoveAllBookmarks ( ) ;
76+
77+ // Handle user control panel
78+ handleUserControlPanel ( ) ;
79+
80+ // Handle user password
81+ handleUserPassword ( ) ;
82+
83+ // Handle request removal
84+ handleRequestRemoval ( ) ;
85+
86+ // Handle the contact form
87+ handleContactForm ( ) ;
88+
89+ // Handle the registration form
90+ handleRegister ( ) ;
91+ handleWebAuthn ( ) ;
92+
93+ // Masonry on startpage
12694 const masonryElement = document . querySelector ( '.masonry-grid' ) ;
12795 if ( masonryElement ) {
12896 new Masonry ( masonryElement , { columnWidth : 0 } ) ;
12997 }
130- } ;
98+
99+ // AutoComplete
100+ handleAutoComplete ( ) ;
101+ } ) ;
0 commit comments