refactor: Refactor cv-matcher.js to use shared utilities (Step 3 of 6)
Refactored cv-matcher.js from 257 → 213 lines (17% reduction) by:
- Removing duplicate helper functions now in utils/form-helpers.js
- Removing duplicate i18n logic now in utils/i18n.js
- Removing API loading code now in utils/api.js
Kept CV matcher-specific logic:
- CV file input change handler
- Async CV upload and match flow with two captcha tokens
- Match result rendering with score badge and lists
- escapeHtml() XSS prevention utility
- $(window).on('load') to load reCaptcha
All function calls updated to use window.MyAi.* utilities for consistency.
Added detailed JSDoc comments explaining the two-step async flow.
Updated cv-matcher/index.html to load all utilities before cv-matcher.js.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -221,6 +221,10 @@
|
||||
<a href="#" id="cookieManage" class="cookie-manage btn btn-dark btn-sm shadow" data-i18n="cookies.settings">Cookie settings</a>
|
||||
<script src="/js/vendor/jquery-4.0.0.min.js"></script>
|
||||
<script src="/js/i18n.js"></script>
|
||||
<script src="/js/utils/form-helpers.js"></script>
|
||||
<script src="/js/utils/i18n.js"></script>
|
||||
<script src="/js/utils/api.js"></script>
|
||||
<script src="/js/modules/cookie-consent.js"></script>
|
||||
<script src="/js/main.js"></script>
|
||||
<script src="/js/cv-matcher.js"></script>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user