Skip to content

Commit 1cc6620

Browse files
committed
refactor: code cleanup, updated dependencies
1 parent e5d3732 commit 1cc6620

File tree

3 files changed

+690
-455
lines changed

3 files changed

+690
-455
lines changed

package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636
"bootstrap": "^5.3.3",
3737
"bootstrap-datepicker": "^1.10.0",
3838
"bootstrap-icons": "^1.11.3",
39-
"chart.js": "^4.4.6",
39+
"chart.js": "^4.4.7",
4040
"handlebars": "4.7.8",
41-
"highlight.js": "^11.10.0",
41+
"highlight.js": "^11.11.0",
4242
"masonry-layout": "^4.2.2",
4343
"sortablejs": "^1.15.6",
4444
"tinymce": "^6.8.5",
@@ -47,27 +47,27 @@
4747
"devDependencies": {
4848
"@babel/core": "^7.26.0",
4949
"@babel/preset-env": "^7.26.0",
50-
"@commitlint/cli": "^19.6.0",
50+
"@commitlint/cli": "^19.6.1",
5151
"@commitlint/config-conventional": "^19.6.0",
52-
"@types/node": "^20.17.9",
52+
"@types/node": "^20.17.10",
5353
"@vitest/coverage-v8": "2.1.5",
5454
"autoprefixer": "^10.4.20",
5555
"babel-preset-env": "^1.7.0",
5656
"husky": "^9.1.7",
5757
"jsdom": "^25.0.1",
5858
"postcss": "^8.4.49",
59-
"prettier": "^3.4.1",
59+
"prettier": "^3.4.2",
6060
"pretty-quick": "^4.0.0",
6161
"rollup-plugin-sbom": "^1.1.1",
62-
"sass": "^1.81.0",
62+
"sass": "^1.83.0",
6363
"sigmund": "^1.0.1",
64-
"vite": "^6.0.1",
64+
"vite": "^6.0.5",
6565
"vite-plugin-compression": "^0.5.1",
6666
"vite-plugin-html": "^3.2.2",
6767
"vite-plugin-minify": "^2.1.0",
6868
"vite-plugin-static-copy": "^2.2.0",
69-
"vitest": "^2.1.6",
70-
"vitest-fetch-mock": "^0.4.2"
69+
"vitest": "^2.1.8",
70+
"vitest-fetch-mock": "^0.4.3"
7171
},
7272
"husky": {
7373
"hooks": {

phpmyfaq/assets/src/frontend.js

Lines changed: 59 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
*/
1515

1616
import Masonry from 'masonry-layout';
17-
1817
import { handleContactForm } from './contact';
1918
import {
2019
handleAddFaq,
@@ -37,94 +36,66 @@ import { calculateReadingTime, handlePasswordStrength, handlePasswordToggle, han
3736
import './utils/tooltip';
3837
import { 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

Comments
 (0)