Skip to content

Commit 8cf9f27

Browse files
Dale KunceDale Kunce
authored andcommitted
Fix JavaScript linting errors
- Auto-fix indentation, spacing, and code style issues Resolves CI build failure due to linting errors
1 parent bc33067 commit 8cf9f27

File tree

2 files changed

+56
-56
lines changed

2 files changed

+56
-56
lines changed

app/assets/scripts/main.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,35 +73,35 @@ if (document.readyState === 'loading') {
7373
/**
7474
* Initialize mobile menu functionality
7575
*/
76-
function initMobileMenu() {
76+
function initMobileMenu () {
7777
const mobileMenuButton = document.querySelector('.resp-nav-dropdown');
7878
const mobileMenuContent = document.querySelector('.resp-dropdown-content');
79-
79+
8080
if (mobileMenuButton && mobileMenuContent) {
8181
// Toggle menu on click/touch
82-
mobileMenuButton.addEventListener('click', function(e) {
82+
mobileMenuButton.addEventListener('click', (e) => {
8383
e.preventDefault();
8484
e.stopPropagation();
85-
85+
8686
// Toggle the mobile menu
8787
if (mobileMenuContent.classList.contains('show')) {
8888
mobileMenuContent.classList.remove('show');
8989
} else {
9090
mobileMenuContent.classList.add('show');
9191
}
9292
});
93-
93+
9494
// Close menu when clicking outside
95-
document.addEventListener('click', function(e) {
95+
document.addEventListener('click', (e) => {
9696
if (!mobileMenuButton.contains(e.target)) {
9797
mobileMenuContent.classList.remove('show');
9898
}
9999
});
100-
100+
101101
// Close menu when clicking on a menu item
102102
const menuLinks = mobileMenuContent.querySelectorAll('a');
103103
menuLinks.forEach(link => {
104-
link.addEventListener('click', function() {
104+
link.addEventListener('click', () => {
105105
mobileMenuContent.classList.remove('show');
106106
});
107107
});

app/assets/scripts/mobile-menu.js

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -2,53 +2,53 @@
22
* Mobile Navigation Menu
33
* Handles touch/click events for mobile devices where hover doesn't work properly
44
*/
5-
(function() {
6-
'use strict';
7-
8-
function initMobileMenu() {
9-
// Find the mobile dropdown toggle
10-
const mobileDropdown = document.querySelector('.resp-nav-dropdown');
11-
const dropdownContent = document.querySelector('.resp-dropdown-content');
12-
13-
if (!mobileDropdown || !dropdownContent) {
14-
return;
15-
}
16-
17-
// Add click event listener to toggle mobile menu
18-
mobileDropdown.addEventListener('click', function(e) {
19-
e.preventDefault();
20-
e.stopPropagation();
21-
22-
// Toggle the show class
23-
dropdownContent.classList.toggle('show');
24-
});
25-
26-
// Close menu when clicking outside
27-
document.addEventListener('click', function(e) {
28-
if (!mobileDropdown.contains(e.target)) {
29-
dropdownContent.classList.remove('show');
30-
}
31-
});
32-
33-
// Close menu when pressing escape key
34-
document.addEventListener('keydown', function(e) {
35-
if (e.key === 'Escape') {
36-
dropdownContent.classList.remove('show');
37-
}
38-
});
39-
40-
// Close menu when window is resized to desktop size
41-
window.addEventListener('resize', function() {
42-
if (window.innerWidth > 650) {
43-
dropdownContent.classList.remove('show');
44-
}
45-
});
46-
}
47-
48-
// Initialize when DOM is ready
49-
if (document.readyState === 'loading') {
50-
document.addEventListener('DOMContentLoaded', initMobileMenu);
51-
} else {
52-
initMobileMenu();
5+
(function () {
6+
'use strict';
7+
8+
function initMobileMenu () {
9+
// Find the mobile dropdown toggle
10+
const mobileDropdown = document.querySelector('.resp-nav-dropdown');
11+
const dropdownContent = document.querySelector('.resp-dropdown-content');
12+
13+
if (!mobileDropdown || !dropdownContent) {
14+
return;
5315
}
16+
17+
// Add click event listener to toggle mobile menu
18+
mobileDropdown.addEventListener('click', (e) => {
19+
e.preventDefault();
20+
e.stopPropagation();
21+
22+
// Toggle the show class
23+
dropdownContent.classList.toggle('show');
24+
});
25+
26+
// Close menu when clicking outside
27+
document.addEventListener('click', (e) => {
28+
if (!mobileDropdown.contains(e.target)) {
29+
dropdownContent.classList.remove('show');
30+
}
31+
});
32+
33+
// Close menu when pressing escape key
34+
document.addEventListener('keydown', (e) => {
35+
if (e.key === 'Escape') {
36+
dropdownContent.classList.remove('show');
37+
}
38+
});
39+
40+
// Close menu when window is resized to desktop size
41+
window.addEventListener('resize', () => {
42+
if (window.innerWidth > 650) {
43+
dropdownContent.classList.remove('show');
44+
}
45+
});
46+
}
47+
48+
// Initialize when DOM is ready
49+
if (document.readyState === 'loading') {
50+
document.addEventListener('DOMContentLoaded', initMobileMenu);
51+
} else {
52+
initMobileMenu();
53+
}
5454
})();

0 commit comments

Comments
 (0)