Skip to content

Commit

Permalink
refactor: code cleanup, updated dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
thorsten committed Dec 23, 2024
1 parent e5d3732 commit 1cc6620
Show file tree
Hide file tree
Showing 3 changed files with 690 additions and 455 deletions.
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
"bootstrap": "^5.3.3",
"bootstrap-datepicker": "^1.10.0",
"bootstrap-icons": "^1.11.3",
"chart.js": "^4.4.6",
"chart.js": "^4.4.7",
"handlebars": "4.7.8",
"highlight.js": "^11.10.0",
"highlight.js": "^11.11.0",
"masonry-layout": "^4.2.2",
"sortablejs": "^1.15.6",
"tinymce": "^6.8.5",
Expand All @@ -47,27 +47,27 @@
"devDependencies": {
"@babel/core": "^7.26.0",
"@babel/preset-env": "^7.26.0",
"@commitlint/cli": "^19.6.0",
"@commitlint/cli": "^19.6.1",
"@commitlint/config-conventional": "^19.6.0",
"@types/node": "^20.17.9",
"@types/node": "^20.17.10",
"@vitest/coverage-v8": "2.1.5",
"autoprefixer": "^10.4.20",
"babel-preset-env": "^1.7.0",
"husky": "^9.1.7",
"jsdom": "^25.0.1",
"postcss": "^8.4.49",
"prettier": "^3.4.1",
"prettier": "^3.4.2",
"pretty-quick": "^4.0.0",
"rollup-plugin-sbom": "^1.1.1",
"sass": "^1.81.0",
"sass": "^1.83.0",
"sigmund": "^1.0.1",
"vite": "^6.0.1",
"vite": "^6.0.5",
"vite-plugin-compression": "^0.5.1",
"vite-plugin-html": "^3.2.2",
"vite-plugin-minify": "^2.1.0",
"vite-plugin-static-copy": "^2.2.0",
"vitest": "^2.1.6",
"vitest-fetch-mock": "^0.4.2"
"vitest": "^2.1.8",
"vitest-fetch-mock": "^0.4.3"
},
"husky": {
"hooks": {
Expand Down
147 changes: 59 additions & 88 deletions phpmyfaq/assets/src/frontend.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
*/

import Masonry from 'masonry-layout';

import { handleContactForm } from './contact';
import {
handleAddFaq,
Expand All @@ -37,94 +36,66 @@ import { calculateReadingTime, handlePasswordStrength, handlePasswordToggle, han
import './utils/tooltip';
import { handleWebAuthn } from './webauthn/webauthn';

//
// Reload Captchas
//
const reloadButton = document.querySelector('#captcha-button');
if (reloadButton !== null) {
handleReloadCaptcha(reloadButton);
}

//
// Password helpers
//
handlePasswordToggle();
handlePasswordStrength();

//
// Calculate reading time
//
const faqBody = document.querySelector('.pmf-faq-body');
if (faqBody !== null) {
calculateReadingTime();
}

//
// Handle votings
//
handleUserVoting();

//
// Handle comments
//
handleSaveComment();
handleComments();

//
// Handle Add a FAQ
//
handleAddFaq();

//
// Handle show FAQ
//
handleShowFaq();
handleShareLinkButton();

//
// Handle Add a Question
//
handleQuestion();

//
// Handle Bookmarks
//
handleDeleteBookmarks();
handleRemoveAllBookmarks();

//
// Handle user control panel
//
handleUserControlPanel();

//
// Handle user password
//
handleUserPassword();

//
// Handle request removal
//
handleRequestRemoval();

//
// Handle the contact form
//
handleContactForm();

//
// Handle the registration form
//
handleRegister();
handleWebAuthn();

//
// Masonry on startpage
//
window.onload = () => {
handleAutoComplete();
document.addEventListener('DOMContentLoaded', () => {
// Reload Captchas
const reloadButton = document.querySelector('#captcha-button');
if (reloadButton !== null) {
handleReloadCaptcha(reloadButton);
}

// Password helpers
handlePasswordToggle();
handlePasswordStrength();

// Calculate reading time
const faqBody = document.querySelector('.pmf-faq-body');
if (faqBody !== null) {
calculateReadingTime();
}

// Handle votings
handleUserVoting();

// Handle comments
handleSaveComment();
handleComments();

// Handle Add a FAQ
handleAddFaq();

// Handle show FAQ
handleShowFaq();
handleShareLinkButton();

// Handle Add a Question
handleQuestion();

// Handle Bookmarks
handleDeleteBookmarks();
handleRemoveAllBookmarks();

// Handle user control panel
handleUserControlPanel();

// Handle user password
handleUserPassword();

// Handle request removal
handleRequestRemoval();

// Handle the contact form
handleContactForm();

// Handle the registration form
handleRegister();
handleWebAuthn();

// Masonry on startpage
const masonryElement = document.querySelector('.masonry-grid');
if (masonryElement) {
new Masonry(masonryElement, { columnWidth: 0 });
}
};

// AutoComplete
handleAutoComplete();
});
Loading

0 comments on commit 1cc6620

Please sign in to comment.