Commit 2dc5ace
Modernize JavaScript screen implementations with ES5 compatibility (#2965)
* Modernize JavaScript screen implementations
Improved all screen JavaScript files (advance.js, help.js, index.js,
login.js, profile.js, search.js) with the following enhancements:
- Replace var with const/let for better scoping and immutability
- Use arrow functions for cleaner, more concise syntax
- Remove obsolete vendor prefixes (-webkit-box-shadow, -moz-box-shadow)
- Replace deprecated .hover() with .on('mouseenter'/'mouseleave')
- Use .prop() instead of .attr() for disabled property
- Fix incorrect AJAX timeout parameter (timeoutNumber → timeout)
- Replace document.location with window.location.href
- Extract duplicated suggestor configuration into reusable constant
- Add named constants for magic numbers (durations, timeouts)
- Improve error handling with console.error instead of commented alerts
- Use template literals for cleaner string concatenation
- Optimize favorites loading with Set for O(1) lookup performance
- Fix submit button click to properly trigger form submission
- Use classList.remove/add with multiple classes for better readability
- Improve focus handling logic in login/profile pages
- Add proper event.preventDefault() calls where needed
These changes maintain full backward compatibility while improving
code quality, readability, and maintainability.
* Fix ES5 compatibility for yuicompressor
Replace ES6 arrow functions and features with ES5-compatible syntax
to fix build errors with yuicompressor which only supports ES5.
Changes:
- Replace all arrow functions (() => {}) with regular function expressions
- Replace template literals with string concatenation
- Remove ES6 default parameters
- Remove ES6 Set and map() usage in favor of object literal and for loop
- Replace .includes() method calls with .indexOf() checks
Files affected: advance.js, help.js, index.js, search.js
All other improvements from the previous commit are preserved:
- const/let instead of var
- Named constants for magic numbers
- Extracted suggestor configuration
- Bug fixes (timeout parameter, submit handler, etc.)
* Replace const/let with var for full yuicompressor compatibility
yuicompressor only supports ES5 syntax and does not recognize
const/let keywords which were introduced in ES6. Replace all
const and let declarations with var to ensure successful build.
This completes the ES5 compatibility work. All JavaScript files
now use only ES5-compatible syntax:
- var instead of const/let
- function() instead of arrow functions
- String concatenation instead of template literals
- for loops instead of Array.map()
- Object literals instead of Set
Files updated:
- advance.js
- help.js
- index.js
- login.js
- profile.js
- search.js
* Improve variable naming for lookup map clarity
Rename docIds to docIdsLookup to clarify that the object is being
used as a lookup map for O(1) performance. This makes the code intent
clearer while maintaining ES5 compatibility required by yuicompressor.
Note: ES6 Set would be preferred but is not supported by yuicompressor.
---------
Co-authored-by: Claude <[email protected]>1 parent b5d036f commit 2dc5ace
File tree
6 files changed
+269
-343
lines changed- src/main/webapp/js
6 files changed
+269
-343
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
4 | 5 | | |
5 | | - | |
6 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
7 | 32 | | |
8 | | - | |
9 | | - | |
| 33 | + | |
| 34 | + | |
10 | 35 | | |
11 | 36 | | |
12 | 37 | | |
13 | 38 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
| 39 | + | |
42 | 40 | | |
43 | 41 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
4 | 5 | | |
5 | | - | |
6 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
7 | 32 | | |
8 | | - | |
9 | | - | |
| 33 | + | |
| 34 | + | |
10 | 35 | | |
11 | 36 | | |
12 | 37 | | |
| |||
16 | 41 | | |
17 | 42 | | |
18 | 43 | | |
19 | | - | |
| 44 | + | |
20 | 45 | | |
21 | 46 | | |
22 | 47 | | |
| |||
25 | 50 | | |
26 | 51 | | |
27 | 52 | | |
| 53 | + | |
28 | 54 | | |
29 | 55 | | |
30 | 56 | | |
31 | 57 | | |
32 | | - | |
33 | 58 | | |
34 | 59 | | |
35 | 60 | | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
| 61 | + | |
64 | 62 | | |
65 | 63 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
3 | 29 | | |
4 | | - | |
5 | | - | |
| 30 | + | |
6 | 31 | | |
7 | | - | |
8 | | - | |
| 32 | + | |
| 33 | + | |
9 | 34 | | |
10 | | - | |
11 | | - | |
| 35 | + | |
| 36 | + | |
12 | 37 | | |
13 | 38 | | |
14 | 39 | | |
| |||
18 | 43 | | |
19 | 44 | | |
20 | 45 | | |
21 | | - | |
| 46 | + | |
22 | 47 | | |
23 | 48 | | |
24 | 49 | | |
| |||
27 | 52 | | |
28 | 53 | | |
29 | 54 | | |
| 55 | + | |
30 | 56 | | |
31 | 57 | | |
32 | 58 | | |
33 | 59 | | |
34 | | - | |
35 | 60 | | |
36 | 61 | | |
37 | 62 | | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
| 63 | + | |
66 | 64 | | |
67 | 65 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
| 2 | + | |
| 3 | + | |
9 | 4 | | |
10 | | - | |
11 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | | - | |
18 | 17 | | |
19 | 18 | | |
20 | 19 | | |
21 | 20 | | |
22 | 21 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
35 | 32 | | |
36 | 33 | | |
37 | 34 | | |
38 | 35 | | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
43 | 40 | | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
53 | 45 | | |
54 | 46 | | |
0 commit comments